Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(32)  |  Call(25)  |  Derive(0)  |  Import(7)
help extract map list from frostbite data

usage :
    mapList = MapListBlock([2, 3, "MP_001", "ConquestLarge0", 2, "MP_011", "Rush", 3])
    print "num of maps : %s" % len(mapList)
    print "first map name : %s" % mapList[0]['name']
    print "second map gamemode : %s" % mapList[1]['gamemode']
    print "the first 2 maps data : %s" % mapList[0:2]
    print "the first 2 maps num_of_rounds : %s" % [x['num_of_rounds'] for x in mapList[0:2]]
    for p in mapList:(more...)

src/b/3/b3-1.9.2/b3/parsers/frostbite2/abstractParser.py   b3(Download)
from b3.parsers.frostbite2.rcon import Rcon as FrostbiteRcon
from b3.parsers.frostbite2.protocol import FrostbiteServer, CommandFailedError, CommandError, NetworkError
from b3.parsers.frostbite2.util import PlayerInfoBlock, MapListBlock, BanlistContent
import b3.events
import b3.cvar
    def getFullMapRotationList(self):
        """query the Frostbite2 game server and return a MapListBlock containing all maps of the current
         map rotation list.
        """
        response = MapListBlock()
        offset = 0
        tmp = self.write(('mapList.list', offset))
        tmp_num_maps = len(MapListBlock(tmp))
            response.append(tmp)
            tmp = self.write(('mapList.list', len(response)))
            tmp_num_maps = len(MapListBlock(tmp))
        return response
 

src/b/i/big-brother-bot-HEAD/b3/parsers/frostbite2/abstractParser.py   big-brother-bot(Download)
from b3.parsers.frostbite2.rcon import Rcon as FrostbiteRcon
from b3.parsers.frostbite2.protocol import FrostbiteServer, CommandFailedError, CommandError, NetworkError
from b3.parsers.frostbite2.util import PlayerInfoBlock, MapListBlock, BanlistContent
import b3.events
import b3.cvar
    def getFullMapRotationList(self):
        """query the Frostbite2 game server and return a MapListBlock containing all maps of the current
         map rotation list.
        """
        response = MapListBlock()
        offset = 0
        tmp = self.write(('mapList.list', offset))
        tmp_num_maps = len(MapListBlock(tmp))
            response.append(tmp)
            tmp = self.write(('mapList.list', len(response)))
            tmp_num_maps = len(MapListBlock(tmp))
        return response
 

src/b/3/b3-plugin-poweradminbf3-HEAD/extplugins/poweradminbf3.py   b3-plugin-poweradminbf3(Download)
from ConfigParser import NoOptionError
from b3.parsers.frostbite2.protocol import CommandFailedError
from b3.parsers.frostbite2.util import MapListBlock, PlayerInfoBlock
from b3.parsers.bf3 import GAME_MODES_NAMES, __version__ as bf3_version, GUNMASTER_WEAPONS_PRESET_BY_INDEX, GUNMASTER_WEAPONS_PRESET_BY_NAME
from b3.update import B3version
        map_id, gamemode_id, num_rounds = parsed_data
 
        maplist = MapListBlock(self.console.write(('mapList.list',)))
        if not len(maplist):
            # maplist is empty, nextmap will be inserted at index 0

src/b/3/b3-1.9.2/tests/parsers/frostbite2/test_util.py   b3(Download)
 
import unittest2 as unittest
from b3.parsers.frostbite2.util import BanlistContent, BanlistContentError, PlayerInfoBlock, TeamScoresBlock, MapListBlock, MapListBlockError
 
 
    def test_minimal(self):
        self.assertEqual(0, len(MapListBlock([0,3])))
        self.assertEqual('MapListBlock[]', repr(MapListBlock([0,3])))
        self.assertEqual(0, len(MapListBlock(['0','3'])))
        tmp = MapListBlock(['1', '3', 'test','mode', '2'])
    def test_1(self):
        bloc = MapListBlock(['1', '3', 'test','mode', '2'])
        self.assertEqual(1, len(bloc))
        self.assertEqual('test', bloc[0]['name'])
        self.assertEqual('mode', bloc[0]['gamemode'])
    def test_2(self):
        bloc = MapListBlock(['2','3','map1','mode1', '1', 'map2', 'mode2', '2'])
        self.assertEqual(2, len(bloc))
        self.assertEqual('map1', bloc[0]['name'])
        self.assertEqual('mode1', bloc[0]['gamemode'])
    def test_3(self):
        bloc = MapListBlock(['3','3', 'map1','mode1','1', 'map2','mode2','2', 'map1','mode2','2'])
        self.assertEqual(3, len(bloc))
        self.assertEqual('map1', bloc[2]['name'])
        self.assertEqual('mode2', bloc[2]['gamemode'])

src/b/i/big-brother-bot-HEAD/tests/parsers/frostbite2/test_util.py   big-brother-bot(Download)
 
import unittest2 as unittest
from b3.parsers.frostbite2.util import BanlistContent, BanlistContentError, PlayerInfoBlock, TeamScoresBlock, MapListBlock, MapListBlockError
 
 
    def test_minimal(self):
        self.assertEqual(0, len(MapListBlock([0,3])))
        self.assertEqual('MapListBlock[]', repr(MapListBlock([0,3])))
        self.assertEqual(0, len(MapListBlock(['0','3'])))
        tmp = MapListBlock(['1', '3', 'test','mode', '2'])
    def test_1(self):
        bloc = MapListBlock(['1', '3', 'test','mode', '2'])
        self.assertEqual(1, len(bloc))
        self.assertEqual('test', bloc[0]['name'])
        self.assertEqual('mode', bloc[0]['gamemode'])
    def test_2(self):
        bloc = MapListBlock(['2','3','map1','mode1', '1', 'map2', 'mode2', '2'])
        self.assertEqual(2, len(bloc))
        self.assertEqual('map1', bloc[0]['name'])
        self.assertEqual('mode1', bloc[0]['gamemode'])
    def test_3(self):
        bloc = MapListBlock(['3','3', 'map1','mode1','1', 'map2','mode2','2', 'map1','mode2','2'])
        self.assertEqual(3, len(bloc))
        self.assertEqual('map1', bloc[2]['name'])
        self.assertEqual('mode2', bloc[2]['gamemode'])

src/b/i/big-brother-bot-HEAD/tests/parsers/test_bf3.py   big-brother-bot(Download)
from b3.parsers.bf3 import Bf3Parser, MAP_NAME_BY_ID, GAME_MODES_BY_MAP_ID, GAME_MODES_NAMES
from b3.config import XmlConfigParser
from b3.parsers.frostbite2.util import MapListBlock
from b3.plugins.admin import AdminPlugin
 
                return []
        self.parser.write = Mock(side_effect=fake_write)
        self.parser.getFullMapRotationList = Mock(return_value=MapListBlock(['4', '3', 'MP_007', 'RushLarge0', '4', 'MP_011', 'RushLarge0', '4', 'MP_012',
                                                                             'SquadRush0', '4', 'MP_013', 'SquadRush0', '4']))
        self.parser.rotateMap()

src/b/3/b3-1.9.2/tests/parsers/test_bf3.py   b3(Download)
from b3.parsers.bf3 import Bf3Parser, MAP_NAME_BY_ID, GAME_MODES_BY_MAP_ID, GAME_MODES_NAMES
from b3.config import XmlConfigParser
from b3.parsers.frostbite2.util import MapListBlock
from b3.plugins.admin import AdminPlugin
 
                return []
        self.parser.write = Mock(side_effect=fake_write)
        self.parser.getFullMapRotationList = Mock(return_value=MapListBlock(['4', '3', 'MP_007', 'RushLarge0', '4', 'MP_011', 'RushLarge0', '4', 'MP_012',
                                                                             'SquadRush0', '4', 'MP_013', 'SquadRush0', '4']))
        self.parser.rotateMap()