def __call__(self, account, ob, **kw):
        adaptedOB = super(ISuitableAmmoBeltsAdapter, self).__call__(account, ob, **kw)
        planeData, gunData = ob
        availableAmmoTypes = AVAILABLE_BELTS_BY_PLANE_TYPE[planeData.planeType]
        adaptedOB['compatibleBeltIDs'] = []
        from db.DBLogic import g_instance as db
        for beltID in gunData.compatibleBeltIDs:
            if db.getComponentByID(COMPONENT_TYPE.AMMOBELT, beltID).ammo[0] in availableAmmoTypes:
                adaptedOB['compatibleBeltIDs'].append(beltID)

        return adaptedOB
예제 #2
0
 def __init__(self, avatar, gunDescription, turretPivot):
     self._avatar = avatar
     self._gunDescription = gunDescription
     self._turretPivot = turretPivot
     gunProfile = gDb.getGunProfileData(self._gunDescription.gunProfileName)
     beltDescription = gDb.getComponentByID(
         COMPONENT_TYPE.AMMOBELT, self._gunDescription.defaultBelt)
     self._ammoBelt = AmmoBelt(self._gunDescription, beltDescription,
                               gunProfile)
     self._ammoBelt.registerShotRender()
     self.gun = Dummy()
     self.gun.RPM = self._gunDescription.RPM
     self.gun.uniqueId = id(self.gun)
     self.gun.shellPath = gunProfile.bulletShell if gunProfile else ''
     self.gun.shellOutInterval = gunProfile.shellOutInterval if gunProfile else ''
     self.gun.shellSyncTime = 0
     self.gun.gunProfileName = self._gunDescription.gunProfileName
     self._reloadTimer = 0.0
     self._reloadTime = 60.0 / self._gunDescription.RPM
     self._reduction = 0
     self._hasTarget = False
     self.__Q = Math.Quaternion()
예제 #3
0
def onChangedDepotCount(event):
    upgradeID = next((iD for iD, typ in event.idTypeList if typ == 'upgrade'),
                     None)
    from db.DBLogic import g_instance as dbInstance
    if upgradeID is None and event.idTypeList[0][1] in ('bomb', 'rocket'):
        upgradeID = event.idTypeList[0][0]
        component = dbInstance.getComponentByID(
            _COMPONENT_BY_TYPE[event.idTypeList[0][1]], upgradeID)
        upgradeName = component.name
    elif upgradeID is not None:
        upgrade = dbInstance.upgrades.get(
            dbInstance.getUpgradeNameByID(upgradeID), None)
        upgradeName = upgrade.name
    if upgradeID is not None and event.ob != event.prevob:
        from BWPersonality import g_lobbyCarouselHelper
        if not g_lobbyCarouselHelper.inventory.inventoryDataInitialized:
            return
        currentValue = g_lobbyCarouselHelper.inventory.getUpgradeCountInDepot(
            upgradeName)
        g_lobbyCarouselHelper.inventory.addUpgradeToDepot(
            upgradeName, event.ob['value'] - currentValue)
    return
예제 #4
0
def getRocket(obid, account=None):
    from db.DBLogic import g_instance as db_instance
    return db_instance.getComponentByID(COMPONENT_TYPE.ROCKETS, obid)
예제 #5
0
def getBomb(obid, account=None):
    from db.DBLogic import g_instance as db_instance
    return db_instance.getComponentByID(COMPONENT_TYPE.BOMBS, obid)
예제 #6
0
def getAmmoBelt(obid, account=None):
    from db.DBLogic import g_instance as db_instance
    return db_instance.getComponentByID(COMPONENT_TYPE.AMMOBELT, obid)