Example #1
0
 def __handleServerChange(self, newSlotsData):
     oldInstalledSlotsData = self.__installedSlotsData
     self.__installedSlotsData = newSlotsData
     for cType in CUSTOMIZATION_TYPE.ALL:
         for slotIdx in range(0, len(newSlotsData[cType])):
             newSlotData = newSlotsData[cType][slotIdx]
             currentSlotData = self.__currentSlotsData[cType][slotIdx]
             oldInstalledSlotData = oldInstalledSlotsData[cType][slotIdx]
             if elementsDiffer(newSlotData['element'], oldInstalledSlotData['element']):
                 self.__currentSlotsData[cType][slotIdx] = newSlotData
                 self.__events.onSlotUpdated(newSlotData, cType, slotIdx)
             elif elementsDiffer(oldInstalledSlotData['element'], currentSlotData['element']):
                 self.__events.onSlotUpdated(currentSlotData, cType, slotIdx)
Example #2
0
 def __handleServerChange(self, newSlotsData):
     oldInstalledSlotsData = self.__installedSlotsData
     self.__installedSlotsData = newSlotsData
     for cType in CUSTOMIZATION_TYPE.ALL:
         for slotIdx in range(0, len(newSlotsData[cType])):
             newSlotData = newSlotsData[cType][slotIdx]
             currentSlotData = self.__currentSlotsData[cType][slotIdx]
             oldInstalledSlotData = oldInstalledSlotsData[cType][slotIdx]
             if elementsDiffer(newSlotData['element'], oldInstalledSlotData['element']):
                 self.__currentSlotsData[cType][slotIdx] = newSlotData
                 self.__events.onSlotUpdated(newSlotData, cType, slotIdx)
             elif elementsDiffer(oldInstalledSlotData['element'], currentSlotData['element']):
                 self.__events.onSlotUpdated(currentSlotData, cType, slotIdx)
Example #3
0
 def __recalculateBonusData(self, newSlotData, oldSlotData, cType, slotIdx):
     newElement = newSlotData['element']
     oldElement = oldSlotData['element']
     if elementsDiffer(newElement, oldElement):
         if newElement is not None:
             newValue = newElement.qualifier.getValue()
             newType = newElement.qualifier.getType()
             itemData = {'isApplied': not newSlotData['isInDossier'],
              'available': newElement,
              'installed': self.__installedElements[cType][slotIdx]}
             self.__bonusData[newType][cType].append(itemData)
             if cType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
                 if self.__bonusData[newType]['bonusTotalCount'] != newValue:
                     self.__bonusData[newType]['bonusAppliedCount'] = newValue
             elif oldElement is not None:
                 oldValue = oldElement.qualifier.getValue()
                 oldType = oldElement.qualifier.getType()
                 self.__bonusData[newType]['bonusAppliedCount'] += newValue
                 self.__bonusData[oldType]['bonusAppliedCount'] -= oldValue
                 if oldElement.qualifier.getDescription():
                     self.__bonusData[oldType]['bonusAppliedDescriptionCount'] -= 1
             else:
                 self.__bonusData[newType]['bonusAppliedCount'] += newValue
             if newElement.qualifier.getDescription():
                 self.__bonusData[newType]['bonusAppliedDescriptionCount'] += 1
     return
Example #4
0
 def __recalculateBonusData(self, newSlotData, oldSlotData, cType, slotIdx):
     newElement = newSlotData['element']
     oldElement = oldSlotData['element']
     if elementsDiffer(newElement, oldElement):
         if newElement is not None:
             newValue = newElement.qualifier.getValue()
             newType = newElement.qualifier.getType()
             itemData = {
                 'isApplied': not newSlotData['isInDossier'],
                 'available': newElement,
                 'installed': self.__installedElements[cType][slotIdx]
             }
             self.__bonusData[newType][cType].append(itemData)
             if cType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
                 if self.__bonusData[newType]['bonusTotalCount'] != newValue:
                     self.__bonusData[newType][
                         'bonusAppliedCount'] = newValue
             elif oldElement is not None:
                 oldValue = oldElement.qualifier.getValue()
                 oldType = oldElement.qualifier.getType()
                 self.__bonusData[newType]['bonusAppliedCount'] += newValue
                 self.__bonusData[oldType]['bonusAppliedCount'] -= oldValue
                 if oldElement.qualifier.getDescription():
                     self.__bonusData[oldType][
                         'bonusAppliedDescriptionCount'] -= 1
             else:
                 self.__bonusData[newType]['bonusAppliedCount'] += newValue
             if newElement.qualifier.getDescription():
                 self.__bonusData[newType][
                     'bonusAppliedDescriptionCount'] += 1
     return
Example #5
0
 def __recalculatePurchaseData(container, newSlotData, oldSlotData, cType, slotIdx):
     newElement = newSlotData['element']
     oldElement = oldSlotData['element']
     if elementsDiffer(oldElement, newElement):
         if newSlotData['isInQuest']:
             return
         container[cType].append({'type': cType,
          'idx': slotIdx,
          'object': newElement,
          'duration': newSlotData['duration'],
          'initialDuration': newSlotData['duration'],
          'spot': newSlotData['spot'],
          'isDuplicate': False,
          'isSelected': True})
Example #6
0
 def __recalculatePurchaseData(container, newSlotData, oldSlotData, cType, slotIdx):
     newElement = newSlotData['element']
     oldElement = oldSlotData['element']
     if elementsDiffer(oldElement, newElement):
         if newSlotData['isInQuest']:
             return
         container[cType].append({'type': cType,
          'idx': slotIdx,
          'object': newElement,
          'duration': newSlotData['duration'],
          'initialDuration': newSlotData['duration'],
          'spot': newSlotData['spot'],
          'isDuplicate': False,
          'isSelected': True})