예제 #1
0
 def _setVehicle(self, playerID, vehTypeCompDescr, vehInvID):
     veh = self._vehicles.get(playerID)
     if not veh or veh['vehTypeCompDescr'] != vehTypeCompDescr:
         (itemTypeIdx, nationIdx, inNationIdx,) = vehicles.parseIntCompactDescr(vehTypeCompDescr)
         vehType = vehicles.g_cache.vehicle(nationIdx, inNationIdx)
         classTag = _getVehClassTag(vehType)
         vehClassIdx = VEHICLE_CLASS_INDICES.get(classTag, _BAD_CLASS_INDEX)
         self._vehicles[playerID] = dict(vehTypeCompDescr=vehTypeCompDescr, vehInvID=vehInvID, nationIdx=nationIdx, inNationIdx=inNationIdx, vehLevel=vehType.level, vehClassIdx=vehClassIdx)
         self.storeOp(UNIT_OP.SET_VEHICLE, playerID, vehTypeCompDescr, vehInvID)
         self._storeNotification(playerID, UNIT_NOTIFY_CMD.SET_VEHICLE, [vehInvID])
         self._dirty = 1
         return True
     return False
예제 #2
0
 def checkVehicle(self, vehTypeCompDescr):
     if self.vehTypeCompDescr is not None:
         return self.vehTypeCompDescr == vehTypeCompDescr
     else:
         vehType = vehicles.getVehicleType(vehTypeCompDescr)
         if not self.nationMask & 1 << vehType.id[0]:
             return False
         level = vehType.level
         if not (self.levels[0] <= level and level <= self.levels[1]):
             return False
         classTag = vehicles.getVehicleClass(vehTypeCompDescr)
         classIndex = VEHICLE_CLASS_INDICES.get(classTag, _BAD_CLASS_INDEX)
         return False if not self.vehClassMask & 1 << classIndex else True
예제 #3
0
 def _setVehicle(self, accountDBID, vehTypeCompDescr, vehInvID):
     classTag = vehicles.getVehicleClass(vehTypeCompDescr)
     vehType = vehicles.getVehicleType(vehTypeCompDescr)
     vehClassIdx = VEHICLE_CLASS_INDICES.get(classTag, _BAD_CLASS_INDEX)
     self._vehicles[accountDBID] = {'vehTypeCompDescr': vehTypeCompDescr,
      'vehInvID': vehInvID,
      'nationIdx': vehType.id[0],
      'inNationIdx': vehType.id[1],
      'vehLevel': vehType.level,
      'vehClassIdx': vehClassIdx}
     self.storeOp(UNIT_OP.SET_VEHICLE, accountDBID, vehTypeCompDescr, vehInvID)
     self._storeNotification(accountDBID, UNIT_NOTIFY_CMD.SET_VEHICLE, [vehInvID])
     self._dirty = 1
     return True
예제 #4
0
 def checkVehicle(self, vehTypeCompDescr):
     if self.vehTypeCompDescr is not None:
         return self.vehTypeCompDescr == vehTypeCompDescr
     vehType = vehicles.getVehicleType(vehTypeCompDescr)
     if not self.nationMask & 1 << vehType.id[0]:
         return False
     level = vehType.level
     if not (self.levels[0] <= level and level <= self.levels[1]):
         return False
     classTag = vehicles.getVehicleClass(vehTypeCompDescr)
     classIndex = VEHICLE_CLASS_INDICES.get(classTag, _BAD_CLASS_INDEX)
     if not self.vehClassMask & 1 << classIndex:
         return False
     else:
         return True
예제 #5
0
    def _setVehicleList(self, accountDBID, vehShortList):
        vehs = []
        vehInvIDs = []
        for vehInvID, vehTypeCompDescr in vehShortList:
            classTag = vehicles.getVehicleClass(vehTypeCompDescr)
            vehType = vehicles.getVehicleType(vehTypeCompDescr)
            vehClassIdx = VEHICLE_CLASS_INDICES.get(classTag, _BAD_CLASS_INDEX)
            vehTuple = UnitVehicle(vehInvID, vehTypeCompDescr, vehType.level, vehClassIdx)
            vehs.append(vehTuple)
            vehInvIDs.append(vehInvID)

        self._vehicles[accountDBID] = vehs
        self.storeOp(UNIT_OP.SET_VEHICLE_LIST, accountDBID, vehShortList)
        self._storeNotification(accountDBID, UNIT_NOTIFY_CMD.SET_VEHICLE_LIST, [vehInvIDs])
        self._dirty = 1
        return True
예제 #6
0
    LEGIONARY = 16
    CLAN_OFFICER = 32
    IN_ARENA = 64
    OFFLINE = 128
    START_STOP_BATTLE = CHANGE_ROSTER
    ADD_REMOVE_MEMBERS = CHANGE_ROSTER
    INVITE_KICK_PLAYERS = CHANGE_ROSTER
    CREATOR = COMMANDER_UPDATES | CHANGE_ROSTER
    CHANGE_LEADERSHIP = CREATOR | CLAN_OFFICER
    SELF_ONLY = 65536
    SELF_UNLOCKED = 131072
    NON_IDLE = 262144
    NO_LEGIONARY_CANDIDATES = 524288

UNIT_ROLE_NAMES = buildNamesDict(UNIT_ROLE)
VEHICLE_CLASS_SPG = VEHICLE_CLASS_INDICES.get('SPG', _BAD_CLASS_INDEX)

class UNIT_BROWSER_CMD:
    REFRESH = 0
    LEFT = 1
    RIGHT = 2


class UNIT_BROWSER_ERROR:
    OK = 0
    UNSUBSCRIBED = 1
    PAGING_ERROR = 2
    ACCEPT_TIMEOUT = 3
    BAD_ACCEPT_CONTEXT = 4
    SEARCH_CANCELED = 5
    ACCEPT_CANCELED = 6
예제 #7
0
    AUTO_SEARCH = 512
    START_STOP_BATTLE = CHANGE_ROSTER
    ADD_REMOVE_MEMBERS = CHANGE_ROSTER
    INVITE_KICK_PLAYERS = CHANGE_ROSTER
    CREATOR = COMMANDER_UPDATES | CHANGE_ROSTER
    CHANGE_LEADERSHIP = CREATOR | MANAGER
    SOCIAL_ROLES = LEGIONARY | MANAGER | CAN_LEAD
    SELF_ONLY = 65536
    SELF_UNLOCKED = 131072
    NON_IDLE = 262144
    NO_LEGIONARY_CANDIDATES = 524288
    PRE_ARENA = 1048576


UNIT_ROLE_NAMES = buildNamesDict(UNIT_ROLE)
VEHICLE_CLASS_SPG = VEHICLE_CLASS_INDICES.get('SPG', _BAD_CLASS_INDEX)


class UNIT_BROWSER_CMD:
    REFRESH = 0
    LEFT = 1
    RIGHT = 2


class UNIT_BROWSER_ERROR:
    OK = 0
    UNSUBSCRIBED = 1
    PAGING_ERROR = 2
    ACCEPT_TIMEOUT = 3
    BAD_ACCEPT_CONTEXT = 4
    SEARCH_CANCELED = 5
예제 #8
0
    AUTO_SEARCH = 512
    START_STOP_BATTLE = CHANGE_ROSTER
    ADD_REMOVE_MEMBERS = CHANGE_ROSTER
    INVITE_KICK_PLAYERS = CHANGE_ROSTER
    CREATOR = COMMANDER_UPDATES | CHANGE_ROSTER
    CHANGE_LEADERSHIP = CREATOR | MANAGER
    SOCIAL_ROLES = LEGIONARY | MANAGER | CAN_LEAD
    SELF_ONLY = 65536
    SELF_UNLOCKED = 131072
    NON_IDLE = 262144
    NO_LEGIONARY_CANDIDATES = 524288
    PRE_ARENA = 1048576


UNIT_ROLE_NAMES = buildNamesDict(UNIT_ROLE)
VEHICLE_CLASS_SPG = VEHICLE_CLASS_INDICES.get("SPG", _BAD_CLASS_INDEX)


class UNIT_BROWSER_CMD:
    REFRESH = 0
    LEFT = 1
    RIGHT = 2


class UNIT_BROWSER_ERROR:
    OK = 0
    UNSUBSCRIBED = 1
    PAGING_ERROR = 2
    ACCEPT_TIMEOUT = 3
    BAD_ACCEPT_CONTEXT = 4
    SEARCH_CANCELED = 5