Esempio n. 1
0
 def validate(self, update=False):
     """
     Validates vehicles selected in unit if player is in slot now
     Args:
         update: is this unit update
     """
     items = g_itemsCache.items
     invVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
     vehCDs = invVehicles.keys()
     pInfo = self.__entity.getPlayerInfo()
     if pInfo.isInSlot:
         _, unit = self.__entity.getUnit()
         roster = unit.getRoster()
         if not roster.checkVehicleList(
                 vehCDs, pInfo.slotIdx) and not pInfo.isCommander():
             self.__entity.request(
                 AssignUnitCtx(pInfo.dbID, UNIT_SLOT.REMOVE,
                               'prebattle/assign'))
         elif self.__entity.getEntityType() != PREBATTLE_TYPE.FALLOUT:
             resultCtx = self.__entity.invalidateSelectedVehicles(vehCDs)
             if resultCtx is not None:
                 self.__entity.request(resultCtx)
             elif update:
                 self.__entity.unit_onUnitPlayerVehDictChanged(
                     getAccountDatabaseID())
     elif update:
         self.__entity.unit_onUnitPlayerVehDictChanged(
             getAccountDatabaseID())
     return
 def validate(self, update=False):
     items = self.itemsCache.items
     invVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
     vehCDs = invVehicles.keys()
     pInfo = self.__entity.getPlayerInfo()
     if pInfo.isInSlot:
         _, unit = self.__entity.getUnit(safe=False)
         roster = unit.getRoster()
         if not roster.checkVehicleList(vehCDs, pInfo.slotIdx) and not pInfo.isCommander():
             self.__entity.request(AssignUnitCtx(pInfo.dbID, UNIT_SLOT.REMOVE, 'prebattle/assign'))
     elif update:
         self.__entity.unit_onUnitPlayerVehDictChanged(getAccountDatabaseID())
 def requestToUnassign(self, pID):
     self.sendRequest(
         AssignUnitCtx(pID, UNIT_SLOT.REMOVE, 'prebattle/assign'))
 def requestToAssign(self, pID, slotIdx):
     self.sendRequest(AssignUnitCtx(pID, slotIdx, 'prebattle/assign'))