예제 #1
0
 def getMissionResults(self):
     (missionTime, shipDamage, skeletonKills, navyKills, creatureKills, seamonsterKills, pirateKills, townfolkKills, shipKills, repairCost, exp, gold, cargo, numCrew) = self.stats
     (pMissionTime, pShipDamage, pSkeletonKills, pNavyKills, pCreatureKills, pSeamonsterKills, pPirateKills, pTownfolkKills, pShipKills, pRepairCost, pExp, pGold, pCargo, pLootBoxes, dummyCrew) = self.playerStats
     inventory = base.localAvatar.getInventory()
     if inventory:
         currentGold = inventory.getGoldInPocket()
     
     t = time.gmtime(missionTime)
     totalTime = str(t[3]) + '"' + str(t[4]) + "'" + str(t[5])
     self.cargo = cargo
     cargoValue = EconomyGlobals.getCargoTotalValue(cargo)
     totalGold = max(cargoValue + gold - repairCost, 0)
     self.results = []
     self.results.append({
         'Type': 'Title',
         'Text': PLocalizer.PlunderedLootContainers,
         'Value1': '' })
     if len(pLootBoxes) == 0:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.NoLootContainersPlundered,
             'Value1': '',
             'UnwrapMode': 1 })
     else:
         gold = 0
         height = self.plunderHeight
         for lootBox in pLootBoxes:
             plunderList = lootBox[1]
             gridText = self.getLootLabel(lootBox[2])
             self.makeLootLabel(gridText, self.plunderHeight)
             grid = self.setupPlunderGrid(plunderList, height, lootBox[0])
             grid.gridText = gridText
         
         self.manager.addScoreboard(self)
     return self.results
    def getMissionResults(self):
        (missionTime, shipDamage, skeletonKills, navyKills, creatureKills,
         seamonsterKills, pirateKills, townfolkKills, shipKills, repairCost,
         exp, gold, cargo, numCrew) = self.stats
        (pMissionTime, pShipDamage, pSkeletonKills, pNavyKills, pCreatureKills,
         pSeamonsterKills, pPirateKills, pTownfolkKills, pShipKills,
         pRepairCost, pExp, pGold, pCargo, pLootBoxes,
         dummyCrew) = self.playerStats
        inventory = base.localAvatar.getInventory()
        if inventory:
            currentGold = inventory.getGoldInPocket()

        t = time.gmtime(missionTime)
        totalTime = str(t[3]) + '"' + str(t[4]) + "'" + str(t[5])
        self.cargo = cargo
        cargoValue = EconomyGlobals.getCargoTotalValue(cargo)
        totalGold = max(cargoValue + gold - repairCost, 0)
        self.results = []
        self.results.append({
            'Type': 'Title',
            'Text': PLocalizer.PlunderedLootContainers,
            'Value1': ''
        })
        if len(pLootBoxes) == 0:
            self.results.append({
                'Type': 'Entry',
                'Text': PLocalizer.NoLootContainersPlundered,
                'Value1': '',
                'UnwrapMode': 1
            })
        else:
            gold = 0
            height = 1.6499999999999999
            for lootBox in pLootBoxes:
                plunderList = lootBox[1]
                if lootBox[2] == PiratesGlobals.ITEM_SAC:
                    self.makeLootLabel(PLocalizer.LootContainerItemSac, height)
                elif lootBox[2] == PiratesGlobals.TREASURE_CHEST:
                    self.makeLootLabel(PLocalizer.LootContainerTreasureChest,
                                       height)
                elif lootBox[2] == PiratesGlobals.RARE_CHEST:
                    self.makeLootLabel(PLocalizer.LootContainerRareChest,
                                       height)

                height -= 0.029999999999999999
                ammoAmountIndex = 0
                self.setupPlunderGrid(plunderList, height, lootBox[0])
                plunderLength = len(plunderList)
                while plunderLength > 0:
                    height -= self.buttonSize
                    plunderLength -= 2
                height -= 0.10000000000000001

            self.manager.addScoreboard(self)
        return self.results
 def getMissionResults(self):
     (missionTime, shipDamage, skeletonKills, navyKills, creatureKills, seamonsterKills, pirateKills, townfolkKills, shipKills, repairCost, exp, gold, cargo, numCrew) = self.stats
     (pMissionTime, pShipDamage, pSkeletonKills, pNavyKills, pCreatureKills, pSeamonsterKills, pPirateKills, pTownfolkKills, pShipKills, pRepairCost, pExp, pGold, pCargo, pLootBoxes, dummyCrew) = self.playerStats
     inventory = base.localAvatar.getInventory()
     if inventory:
         currentGold = inventory.getGoldInPocket()
     
     t = time.gmtime(missionTime)
     totalTime = str(t[3]) + '"' + str(t[4]) + "'" + str(t[5])
     self.cargo = cargo
     cargoValue = EconomyGlobals.getCargoTotalValue(cargo)
     totalGold = max(cargoValue + gold - repairCost, 0)
     self.results = []
     self.results.append({
         'Type': 'Title',
         'Text': PLocalizer.PlunderedLootContainers,
         'Value1': '' })
     if len(pLootBoxes) == 0:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.NoLootContainersPlundered,
             'Value1': '',
             'UnwrapMode': 1 })
     else:
         gold = 0
         height = 1.6499999999999999
         for lootBox in pLootBoxes:
             plunderList = lootBox[1]
             if lootBox[2] == PiratesGlobals.ITEM_SAC:
                 self.makeLootLabel(PLocalizer.LootContainerItemSac, height)
             elif lootBox[2] == PiratesGlobals.TREASURE_CHEST:
                 self.makeLootLabel(PLocalizer.LootContainerTreasureChest, height)
             elif lootBox[2] == PiratesGlobals.RARE_CHEST:
                 self.makeLootLabel(PLocalizer.LootContainerRareChest, height)
             
             height -= 0.029999999999999999
             ammoAmountIndex = 0
             self.setupPlunderGrid(plunderList, height, lootBox[0])
             plunderLength = len(plunderList)
             while plunderLength > 0:
                 height -= self.buttonSize
                 plunderLength -= 2
             height -= 0.10000000000000001
         
         self.manager.addScoreboard(self)
     return self.results
    def getCargoResults(self):
        missionTime, shipDamage, skeletonKills, navyKills, creatureKills, seamonsterKills, pirateKills, townfolkKills, shipKills, repairCost, exp, gold, cargo, numCrew = self.stats
        pMissionTime, pShipDamage, pSkeletonKills, pNavyKills, pCreatureKills, pSeamonsterKills, pPirateKills, pTownfolkKills, pShipKills, pRepairCost, pExp, pGold, pCargo, pLootBoxes, dummyCrew = self.playerStats
        inventory = base.localAvatar.getInventory()
        if inventory:
            currentGold = inventory.getGoldInPocket()
        avId = base.localAvatar.getDoId()
        cargoValue = EconomyGlobals.getCargoTotalValue(pCargo)
        totalGold = cargoValue + pGold
        bonusGold = 0
        if base.localAvatar.ship:
            if base.localAvatar.ship.getOwnerId() == avId:
                if len(base.localAvatar.ship.getCrew()) > 1:
                    bonusGold = int(totalGold *
                                    EconomyGlobals.CAPTAIN_LOOT_MULTIPLIER)
                    totalGold += bonusGold
            if base.cr.newsManager and (base.cr.newsManager.getHoliday(
                    HolidayGlobals.DOUBLEGOLDHOLIDAYPAID)
                                        and Freebooter.getPaidStatus(avId)
                                        or base.cr.newsManager.getHoliday(
                                            HolidayGlobals.DOUBLEGOLDHOLIDAY)):
                totalGold *= 2
            netGold = totalGold - pRepairCost
            self.results = []
            self.results.append({
                'Type': 'Title',
                'Text': PLocalizer.CargoPlunder,
                'Value1': ''
            })
            if pGold:
                self.results.append({
                    'Type': 'Entry',
                    'Text': PLocalizer.GoldLooted,
                    'Value1': pGold,
                    'Value2': gold
                })
            len(pCargo) == 0 and self.results.append({
                'Type': 'Entry',
                'Text': PLocalizer.NoCargoLooted,
                'Value1': '',
                'UnwrapMode': 1
            })
        else:
            cargoDict = {}
            for itemId in pCargo:
                cargoCount = cargoDict.get(itemId, None)
                if cargoCount == None:
                    cargoDict[itemId] = 0
                cargoDict[itemId] += 1

            for cargoKey in cargoDict:
                amount = cargoDict[cargoKey]
                self.results.append({
                    'Type': 'Cargo',
                    'Text': '',
                    'Value1': cargoKey,
                    'UnwrapMode': 1,
                    'Amount': amount
                })

            if bonusGold > 0:
                self.results.append({
                    'Type': 'Space',
                    'Text': '',
                    'Value1': '',
                    'UnwrapMode': 1
                })
                self.results.append({
                    'Type':
                    'Entry',
                    'Text':
                    PLocalizer.CaptainsBonus,
                    'Value1':
                    str(bonusGold) + ' ' + PLocalizer.MoneyName,
                    'UnwrapMode':
                    1
                })
        if base.cr.newsManager and (base.cr.newsManager.getHoliday(
                HolidayGlobals.DOUBLEGOLDHOLIDAYPAID)
                                    and Freebooter.getPaidStatus(avId)
                                    or base.cr.newsManager.getHoliday(
                                        HolidayGlobals.DOUBLEGOLDHOLIDAY)):
            self.results.append({
                'Type': 'Space',
                'Text': '',
                'Value1': '',
                'UnwrapMode': 1
            })
            self.results.append({
                'Type':
                'Entry',
                'Text':
                PLocalizer.DoubleGoldBonus,
                'Value1':
                str(totalGold / 2) + ' ' + PLocalizer.MoneyName,
                'UnwrapMode':
                1
            })
        self.results.append({
            'Type': 'Space',
            'Text': '',
            'Value1': '',
            'UnwrapMode': 1
        })
        self.results.append({
            'Type': 'Title',
            'Text': PLocalizer.PlunderShare,
            'Value1': str(netGold) + ' ' + PLocalizer.MoneyName,
            'UnwrapMode': 1
        })
        return self.results
 def getCargoResults(self):
     (missionTime, shipDamage, skeletonKills, navyKills, creatureKills, seamonsterKills, pirateKills, townfolkKills, shipKills, repairCost, exp, gold, cargo, numCrew) = self.stats
     (pMissionTime, pShipDamage, pSkeletonKills, pNavyKills, pCreatureKills, pSeamonsterKills, pPirateKills, pTownfolkKills, pShipKills, pRepairCost, pExp, pGold, pCargo, pLootBoxes, dummyCrew) = self.playerStats
     inventory = base.localAvatar.getInventory()
     if inventory:
         currentGold = inventory.getGoldInPocket()
     
     avId = base.localAvatar.getDoId()
     cargoValue = EconomyGlobals.getCargoTotalValue(pCargo)
     totalGold = cargoValue + pGold
     bonusGold = 0
     if base.localAvatar.ship:
         if base.localAvatar.ship.getOwnerId() == avId and len(base.localAvatar.ship.getCrew()) > 1:
             bonusGold = int(totalGold * EconomyGlobals.CAPTAIN_LOOT_MULTIPLIER)
             totalGold += bonusGold
         
     
     if base.cr.newsManager:
         if base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAYPAID) or Freebooter.getPaidStatus(avId) or base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAY):
             totalGold *= 2
         
     netGold = totalGold - pRepairCost
     self.results = []
     self.results.append({
         'Type': 'Title',
         'Text': PLocalizer.CargoPlunder,
         'Value1': '' })
     if pGold:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.GoldLooted,
             'Value1': pGold,
             'Value2': gold })
     
     if len(pCargo) == 0:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.NoCargoLooted,
             'Value1': '',
             'UnwrapMode': 1 })
     else:
         for itemId in pCargo:
             self.results.append({
                 'Type': 'Cargo',
                 'Text': '',
                 'Value1': itemId,
                 'UnwrapMode': 1 })
         
     if bonusGold > 0:
         self.results.append({
             'Type': 'Space',
             'Text': '',
             'Value1': '',
             'UnwrapMode': 1 })
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.CaptainsBonus,
             'Value1': str(bonusGold) + ' ' + PLocalizer.MoneyName,
             'UnwrapMode': 1 })
     
     if base.cr.newsManager:
         if base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAYPAID) or Freebooter.getPaidStatus(avId) or base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAY):
             self.results.append({
                 'Type': 'Space',
                 'Text': '',
                 'Value1': '',
                 'UnwrapMode': 1 })
             self.results.append({
                 'Type': 'Entry',
                 'Text': PLocalizer.DoubleGoldBonus,
                 'Value1': str(totalGold / 2) + ' ' + PLocalizer.MoneyName,
                 'UnwrapMode': 1 })
         
     self.results.append({
         'Type': 'Space',
         'Text': '',
         'Value1': '',
         'UnwrapMode': 1 })
     self.results.append({
         'Type': 'Title',
         'Text': PLocalizer.PlunderShare,
         'Value1': str(netGold) + ' ' + PLocalizer.MoneyName,
         'UnwrapMode': 1 })
     return self.results