diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 8364ffaa..87aa0047 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -744,8 +744,10 @@ dclass DistributedToon : DistributedPlayer { setTrueFriends(uint32[] = []) required clsend ownrecv db; setNextKnockHeal(uint32) ram airecv; setEPP(uint8[] = []) required ownrecv db; + setStats(uint32[] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) required ownrecv db; requestNametagStyle(uint8) airecv ownsend; requestFishingRod(uint8) airecv ownsend; + wipeStats() airecv ownsend; }; dclass DistributedPartyGate : DistributedObject { diff --git a/otp/chat/WhiteListData.py b/otp/chat/WhiteListData.py index da4b6509..e99854de 100755 --- a/otp/chat/WhiteListData.py +++ b/otp/chat/WhiteListData.py @@ -2886,6 +2886,7 @@ WHITELIST = [ 'be', 'be-awesome', 'be-yoink', + 'beach', 'beachcombers', 'beachead', 'beached', @@ -9980,6 +9981,7 @@ WHITELIST = [ 'deny', 'denying', 'deodorant', + 'deorro', 'depart', 'departed', 'departing', @@ -22308,6 +22310,8 @@ WHITELIST = [ 'masterly', 'masterpiece', 'masters', + 'mastervoltage', + 'mastervolty', 'mastery', 'mat', 'matata', @@ -30128,6 +30132,7 @@ WHITELIST = [ 'sins', 'sip', 'sir', + 'sirbiscuit', 'siren', "siren's", 'sirens', @@ -34728,6 +34733,7 @@ WHITELIST = [ 'volleyball', 'voltage', 'voltorn', + 'volty', 'volume', "volume's", 'volumed', @@ -36496,6 +36502,7 @@ WHITELIST = [ 'zebra', "zebra's", 'zebras', + 'zedd', 'zeddars', 'zeke', 'zelda', @@ -36862,4 +36869,4 @@ WHITELIST = [ 'zyyk', 'zzz', 'zzzzzs', -] +] \ No newline at end of file diff --git a/toontown/ai/FishManagerAI.py b/toontown/ai/FishManagerAI.py index bf45b494..124a2e83 100755 --- a/toontown/ai/FishManagerAI.py +++ b/toontown/ai/FishManagerAI.py @@ -3,7 +3,7 @@ import random from otp.ai.MagicWordGlobal import * from toontown.fishing import FishGlobals from toontown.fishing.FishBase import FishBase -from toontown.toonbase import TTLocalizer +from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.uberdog import TopToonsGlobals @@ -51,6 +51,7 @@ class FishManagerAI: netlist = av.fishTank.getNetLists() av.d_setFishTank(netlist[0], netlist[1], netlist[2]) del self.requestedFish[av.doId] + av.addStat(ToontownGlobals.STAT_FISH) return [itemType, genus, species, weight] if itemType == FishGlobals.FishItem: success, genus, species, weight = FishGlobals.getRandomFishVitals(zoneId, av.getFishingRod()) @@ -68,6 +69,7 @@ class FishManagerAI: netlist = av.fishTank.getNetLists() av.d_setFishTank(netlist[0], netlist[1], netlist[2]) messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_FISH, 1]) + av.addStat(ToontownGlobals.STAT_FISH) return [itemType, genus, species, weight] elif itemType == FishGlobals.BootItem: return [itemType, 0, 0, 0] @@ -92,6 +94,7 @@ class FishManagerAI: netlist = av.fishTank.getNetLists() av.d_setFishTank(netlist[0], netlist[1], netlist[2]) messenger.send('topToonsManager-event', [av.doId, TopToonsGlobals.CAT_FISH, 1]) + av.addStat(ToontownGlobals.STAT_FISH) return [itemType, genus, species, weight] else: money = FishGlobals.Rod2JellybeanDict[av.getFishingRod()] diff --git a/toontown/ai/QuestManagerAI.py b/toontown/ai/QuestManagerAI.py index 4a212157..8be875d0 100755 --- a/toontown/ai/QuestManagerAI.py +++ b/toontown/ai/QuestManagerAI.py @@ -4,6 +4,7 @@ from otp.ai.MagicWordGlobal import * from toontown.hood import ZoneUtil from toontown.quest import Quests from toontown.uberdog import TopToonsGlobals +from toontown.toonbase import ToontownGlobals QuestIdIndex = 0 QuestFromNpcIdIndex = 1 @@ -92,6 +93,7 @@ class QuestManagerAI: # The toon has completed this quest. Give them a reward! npc.completeQuest(avId, questId, rewardId) self.completeQuest(av, questId) + av.addStat(ToontownGlobals.STAT_TASKS) break else: # They haven't completed any quests so we have to give them choices. diff --git a/toontown/battle/BattleExperienceAI.py b/toontown/battle/BattleExperienceAI.py index 84d9c3d2..573b6793 100755 --- a/toontown/battle/BattleExperienceAI.py +++ b/toontown/battle/BattleExperienceAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -from toontown.toonbase import ToontownBattleGlobals +from toontown.toonbase import ToontownBattleGlobals, ToontownGlobals from toontown.suit import SuitDNA BattleExperienceAINotify = DirectNotifyGlobal.directNotify.newCategory('BattleExprienceAI') @@ -183,9 +183,15 @@ def assignRewards(activeToons, toonSkillPtsGained, suitsKilled, zoneId, helpfulT if helpfulToons and toon.doId in helpfulToons: simbase.air.questManager.toonKilledCogs(toon, suitsKilled, zoneId) simbase.air.cogPageManager.toonKilledCogs(toon, suitsKilled, zoneId) + addStats(toon, suitsKilled) else: BattleExperienceAINotify.debug('toon=%d unhelpful not getting killed cog quest credit' % toon.doId) else: simbase.air.questManager.toonKilledCogs(toon, suitsKilled, zoneId) simbase.air.cogPageManager.toonKilledCogs(toon, suitsKilled, zoneId) - return + addStats(toon, suitsKilled) + +def addStats(toon, suitsKilled): + toon.addStat(ToontownGlobals.STAT_COGS, len(suitsKilled)) + toon.addStat(ToontownGlobals.STAT_V2, len([suit for suit in suitsKilled if 'hasRevives' in suit and suit['hasRevives']])) + toon.addStat(ToontownGlobals.STAT_SKELE, len([suit for suit in suitsKilled if 'isSkelecog' in suit and suit['isSkelecog']])) \ No newline at end of file diff --git a/toontown/battle/DistributedBattleBaseAI.py b/toontown/battle/DistributedBattleBaseAI.py index d511b62c..95228535 100755 --- a/toontown/battle/DistributedBattleBaseAI.py +++ b/toontown/battle/DistributedBattleBaseAI.py @@ -1366,6 +1366,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas if check == -1: self.air.writeServerEvent('suspicious', toonId, 'Toon generating movie for non-existent gag track %s level %s' % (track, level)) self.notify.warning('generating movie for non-existent gag track %s level %s! avId: %s' % (track, level, toonId)) + toon.addStat(ToontownGlobals.STAT_GAGS) toon.d_setInventory(toon.inventory.makeNetString()) hps = attack[TOON_HP_COL] if track == SOS: diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index dc7f4092..00f463d1 100755 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -23,7 +23,7 @@ from toontown.cogdominium.CogdoLayout import CogdoLayout from toontown.cogdominium.SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI from toontown.hood import ZoneUtil from toontown.toonbase.ToontownGlobals import ToonHall - +from toontown.toonbase import ToontownGlobals class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): def __init__(self, air, blockNumber, zoneId, trophyMgr): @@ -292,6 +292,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList)) if toon is not None: self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, self.numFloors, self.zoneId, 0) + toon.addStat(ToontownGlobals.STAT_BLDG) for i in xrange(0, 4): victor = victorList[i] if (victor is None) or (victor not in self.air.doId2do): @@ -329,6 +330,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): if toon != None: self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, 5, self.zoneId, 1) + toon.addStat(ToontownGlobals.STAT_COGDO) continue victorList.extend([None, None, None, None]) diff --git a/toontown/estate/DistributedPhoneAI.py b/toontown/estate/DistributedPhoneAI.py index 7c91051f..6c3af351 100755 --- a/toontown/estate/DistributedPhoneAI.py +++ b/toontown/estate/DistributedPhoneAI.py @@ -176,17 +176,19 @@ class DistributedPhoneAI(DistributedFurnitureItemAI): if returnCode != ToontownGlobals.P_ItemOnOrder: return returnCode - + if item.getDeliveryTime(): self.chargeAvatar(av, price, item.getEmblemPrices()) av.onOrder.append(item) av.b_setDeliverySchedule(av.onOrder) + av.addStat(ToontownGlobals.STAT_ITEMS) else: returnCode = item.recordPurchase(av, optional) if returnCode == ToontownGlobals.P_ItemAvailable: self.chargeAvatar(av, price, item.getEmblemPrices()) - + av.addStat(ToontownGlobals.STAT_ITEMS) + return returnCode return None @@ -209,6 +211,7 @@ class DistributedPhoneAI(DistributedFurnitureItemAI): item.giftTag = avId self.chargeAvatar(av, optional[2], item.getEmblemPrices()) recipient.onGiftOrder.append(item) + av.addStat(ToontownGlobals.STAT_ITEMS) dg = self.air.dclassesByName['DistributedToonAI'].aiFormatUpdate('setGiftSchedule', targetId, targetId, self.air.ourChannel, [recipient.getGiftScheduleBlob()]) self.air.send(dg) diff --git a/toontown/golf/DistributedGolfCourseAI.py b/toontown/golf/DistributedGolfCourseAI.py index a5b2df81..96e21b2f 100755 --- a/toontown/golf/DistributedGolfCourseAI.py +++ b/toontown/golf/DistributedGolfCourseAI.py @@ -768,6 +768,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): oldTrophies = GolfGlobals.calcTrophyListFromHistory(oldHistory) endingTrophies = GolfGlobals.calcTrophyListFromHistory(endingHistory) av.b_setGolfHistory(endingHistory) + av.addStat(ToontownGlobals.STAT_GOLF) newTrophies = [] for index in xrange(len(oldTrophies)): if not oldTrophies[index] and endingTrophies[index]: diff --git a/toontown/racing/DistributedRaceAI.py b/toontown/racing/DistributedRaceAI.py index 4fce5142..a4cb502f 100755 --- a/toontown/racing/DistributedRaceAI.py +++ b/toontown/racing/DistributedRaceAI.py @@ -9,7 +9,7 @@ import random from toontown.racing import RaceGlobals from toontown.racing.DistributedGagAI import DistributedGagAI from toontown.racing.DistributedVehicleAI import DistributedVehicleAI -from toontown.toonbase import TTLocalizer +from toontown.toonbase import TTLocalizer, ToontownGlobals class DistributedRaceAI(DistributedObjectAI, FSM): @@ -318,6 +318,7 @@ class DistributedRaceAI(DistributedObjectAI, FSM): av.b_setTickets(av.getTickets() + winnings) if av.getTickets() > RaceGlobals.MaxTickets: av.b_setTickets(RaceGlobals.MaxTickets) + av.addStat(ToontownGlobals.STAT_RACING) self.sendUpdate('setPlace', [avId, totalTime, place, entryFee, qualify, max((winnings-entryFee), 0), bonus, trophies, [], 0]) def calculateTrophies(self, avId, won, qualify, time): diff --git a/toontown/shtiker/ShtikerBook.py b/toontown/shtiker/ShtikerBook.py index bdd38eb2..711ac54f 100755 --- a/toontown/shtiker/ShtikerBook.py +++ b/toontown/shtiker/ShtikerBook.py @@ -34,6 +34,7 @@ class ShtikerBook(DirectFrame, StateData.StateData): self.pageOrder = [TTLocalizer.OptionsPageTitle, TTLocalizer.ShardPageTitle, TTLocalizer.MapPageTitle, + TTLocalizer.StatPageTitle, TTLocalizer.InventoryPageTitle, TTLocalizer.QuestPageToonTasks, TTLocalizer.TrackPageShortTitle, @@ -46,7 +47,6 @@ class ShtikerBook(DirectFrame, StateData.StateData): TTLocalizer.GolfPageTitle, TTLocalizer.PhotoPageTitle, TTLocalizer.EventsPageName] - return def setSafeMode(self, setting): self.safeMode = setting @@ -182,7 +182,7 @@ class ShtikerBook(DirectFrame, StateData.StateData): iconGeom = None iconImage = None iconScale = 1 - iconColor = Vec4(1) + iconColor = (1, 1, 1, 1) buttonPressedCommand = goToPage extraArgs = [] if pageName == TTLocalizer.OptionsPageTitle: @@ -251,6 +251,10 @@ class ShtikerBook(DirectFrame, StateData.StateData): iconGeom = iconModels = loader.loadModel('phase_4/models/minigames/photogame_filmroll') iconScale = (1.9, 1.5, 1.5) iconModels.detachNode() + elif pageName == TTLocalizer.StatPageTitle: + iconGeom = iconModels = loader.loadModel('phase_3.5/models/gui/name_star') + iconColor = (0, 0.6, 1, 1) + iconModels.detachNode() if pageName == TTLocalizer.OptionsPageTitle: pageName = TTLocalizer.OptionsTabTitle pageTab = DirectButton(parent=self.pageTabFrame, relief=DGG.RAISED, frameSize=(-0.575, diff --git a/toontown/shtiker/StatPage.py b/toontown/shtiker/StatPage.py new file mode 100644 index 00000000..9c38a7f8 --- /dev/null +++ b/toontown/shtiker/StatPage.py @@ -0,0 +1,79 @@ +from direct.gui.DirectGui import * +from toontown.toonbase import TTLocalizer +from toontown.toontowngui import TTDialog +import ShtikerPage + +STATS = ['cog', 'v2', 'skele', 'beanSpent', 'beanEarnt', 'task', 'vp', 'cfo', 'cj', 'ceo', 'sad', 'bldg', 'cogdo', 'item', 'fish', 'flower', 'race', 'golf', 'sos', 'unite', 'slip', 'gag'] + +class StatPage(ShtikerPage.ShtikerPage): + + def __init__(self): + ShtikerPage.ShtikerPage.__init__(self) + self.dialog = None + + def load(self): + guiButton = loader.loadModel('phase_3/models/gui/quit_button') + + self.rows = [None] * 2 + self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.StatPageTitle, text_scale=0.12, textMayChange=0, pos=(0, 0, 0.6)) + self.rows[0] = DirectLabel(parent=self, relief=None, text_align=TextNode.ALeft, text='', text_scale=0.06, text_wordwrap=16, pos=(-0.8, 0, 0.515)) + self.rows[1] = DirectLabel(parent=self, relief=None, text_align=TextNode.ALeft, text='', text_scale=0.06, text_wordwrap=16, pos=(0.05, 0, 0.515)) + self.resetButton = empty = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(1.1, 1, 1), text='Reset stats', text_scale=0.055, text_pos=(0, -0.02), pos=(-0.55, 0.0, 0.65), command=self.__showDialog) + guiButton.removeNode() + + def enter(self): + self.show() + self.updateStats() + self.accept('refreshStats', self.updateStats) + + def exit(self): + self.ignoreAll() + self.unloadDialog() + self.hide() + + def unload(self): + for row in self.rows: + row.destroy() + + del self.rows + self.unloadDialog() + self.title.destroy() + del self.title + self.resetButton.destroy() + del self.resetButton + ShtikerPage.ShtikerPage.unload(self) + + def unloadDialog(self, arg=None): + if self.dialog: + self.dialog.destroy() + self.dialog = None + + def cutToChunks(self, list, size): + for i in xrange(0, len(list), size): + yield list[i:i+size] + + def updateStats(self): + dict = {} + stats = base.localAvatar.stats + + for i, string in enumerate(STATS): + dict[string] = "{:,}".format(stats[i]) + + textChunks = list(self.cutToChunks(TTLocalizer.Stats, 11)) + + for i, chunk in enumerate(textChunks): + self.rows[i]['text'] = '\n\n'.join(chunk) % dict + + def __showDialog(self): + self.dialog = TTDialog.TTDialog(style=TTDialog.TwoChoice, text=TTLocalizer.StatResetAsk, text_wordwrap=15, command=self.__handleDialogResponse) + self.dialog.show() + + def __handleDialogResponse(self, response): + self.unloadDialog() + + if response <= 0: + return + + base.localAvatar.wipeStats() + self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.StatResetDone, text_wordwrap=15, command=self.unloadDialog) + self.dialog.show() \ No newline at end of file diff --git a/toontown/shtiker/TIPPage.py b/toontown/shtiker/TIPPage.py deleted file mode 100755 index 06937bbc..00000000 --- a/toontown/shtiker/TIPPage.py +++ /dev/null @@ -1,34 +0,0 @@ -from panda3d.core import * -import ShtikerPage -from direct.gui.DirectGui import * -from toontown.toon import NPCToons -from toontown.hood import ZoneUtil -from toontown.toonbase import ToontownGlobals -from toontown.toonbase import TTLocalizer - -class TIPPage(ShtikerPage.ShtikerPage): - - def __init__(self): - ShtikerPage.ShtikerPage.__init__(self) - self.textRolloverColor = Vec4(1, 1, 0, 1) - self.textDownColor = Vec4(0.5, 0.9, 1, 1) - self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1) - - def load(self): - self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.TIPPageTitle, text_scale=0.12, textMayChange=0, pos=(0, 0, 0.6)) - return - - def unload(self): - del self.title - loader.unloadModel('phase_3.5/models/gui/stickerbook_gui') - ShtikerPage.ShtikerPage.unload(self) - - def updatePage(self): - pass - - def enter(self): - self.updatePage() - ShtikerPage.ShtikerPage.enter(self) - - def exit(self): - ShtikerPage.ShtikerPage.exit(self) diff --git a/toontown/suit/DistributedBossCogAI.py b/toontown/suit/DistributedBossCogAI.py index d36e75ba..a70ddd34 100755 --- a/toontown/suit/DistributedBossCogAI.py +++ b/toontown/suit/DistributedBossCogAI.py @@ -13,6 +13,13 @@ import SuitDNA import random AllBossCogs = [] +BOSS_TO_STAT = { + 's': ToontownGlobals.STAT_VP, + 'm': ToontownGlobals.STAT_CFO, + 'l': ToontownGlobals.STAT_CJ, + 'c': ToontownGlobals.STAT_CEO +} + class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBossCogAI') @@ -618,4 +625,13 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): toon = self.air.doId2do.get(toonId) if toon: - toon.addCrateKeys(1) \ No newline at end of file + toon.addCrateKeys(1) + + def addStats(self): + stat = BOSS_TO_STAT[self.dept] + + for toonId in self.involvedToons: + toon = self.air.doId2do.get(toonId) + + if toon: + toon.addStat(stat) \ No newline at end of file diff --git a/toontown/suit/DistributedBossbotBossAI.py b/toontown/suit/DistributedBossbotBossAI.py index 5e9d1a7a..c90dd4f1 100755 --- a/toontown/suit/DistributedBossbotBossAI.py +++ b/toontown/suit/DistributedBossbotBossAI.py @@ -580,6 +580,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS 'isSupervisor': 0, 'isVirtual': 0, 'activeToons': self.involvedToons[:]}) + self.addStats() self.barrier = self.beginBarrier('Victory', self.involvedToons, 30, self.__doneVictory) return diff --git a/toontown/suit/DistributedCashbotBossAI.py b/toontown/suit/DistributedCashbotBossAI.py index ec40d9d3..482cb4d8 100755 --- a/toontown/suit/DistributedCashbotBossAI.py +++ b/toontown/suit/DistributedCashbotBossAI.py @@ -463,6 +463,7 @@ class DistributedCashbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS 'isSupervisor': 0, 'isVirtual': 0, 'activeToons': self.involvedToons[:]}) + self.addStats() self.barrier = self.beginBarrier('Victory', self.involvedToons, 30, self.__doneVictory) return diff --git a/toontown/suit/DistributedLawbotBossAI.py b/toontown/suit/DistributedLawbotBossAI.py index ce42202c..102ad9e4 100755 --- a/toontown/suit/DistributedLawbotBossAI.py +++ b/toontown/suit/DistributedLawbotBossAI.py @@ -638,6 +638,7 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM 'isSupervisor': 0, 'isVirtual': 0, 'activeToons': self.involvedToons[:]}) + self.addStats() self.barrier = self.beginBarrier('Victory', self.involvedToons, 30, self.__doneVictory) return diff --git a/toontown/suit/DistributedSellbotBossAI.py b/toontown/suit/DistributedSellbotBossAI.py index 5cd80854..82a740a2 100755 --- a/toontown/suit/DistributedSellbotBossAI.py +++ b/toontown/suit/DistributedSellbotBossAI.py @@ -339,6 +339,7 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS 'isSupervisor': 0, 'isVirtual': 0, 'activeToons': self.involvedToons[:]}) + self.addStats() self.barrier = self.beginBarrier('Victory', self.involvedToons, 10, self.__doneVictory) return diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 17ac747d..792a1b14 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2424,6 +2424,20 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute ToontownGlobals.ToonJumpForce, ToontownGlobals.ToonReverseSpeed * ToontownGlobals.BMovementSpeedMultiplier, ToontownGlobals.ToonRotateSpeed * ToontownGlobals.BMovementSpeedMultiplier) + + def setStats(self, stats): + self.stats = stats + if self == base.localAvatar: + messenger.send('refreshStats') + + def getStats(self): + return self.stats + + def getStat(self, index): + return self.stats[index] + + def wipeStats(self): + self.sendUpdate('wipeStats') @magicWord(category=CATEGORY_COMMUNITY_MANAGER) def globalTeleport(): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index e8459b4f..bbada645 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -574,6 +574,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.NPCFriendsDict[npcFriend] = self.maxCallsPerNPC self.d_setNPCFriendsDict(self.NPCFriendsDict) self.air.questManager.toonMadeNPCFriend(self, numCalls, method) + self.addStat(ToontownGlobals.STAT_SOS, numCalls) return 1 def attemptSubtractNPCFriend(self, npcFriend): @@ -932,11 +933,13 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.hp -= hpLost if self.hp <= 0: self.hp = -1 - messenger.send(self.getGoneSadMessage()) if not self.hpOwnedByBattle: self.hp = min(self.hp, self.maxHp) if sendTotal: self.d_setHp(self.hp) + + if self.hp <= 0: + self.addStat(ToontownGlobals.STAT_SAD) def b_setMaxHp(self, maxHp): if (maxHp > ToontownGlobals.MaxHpLimit): @@ -953,18 +956,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo else: self.sendUpdate('setMaxHp', [maxHp]) - @staticmethod - def getGoneSadMessageForAvId(avId): - return 'goneSad-%s' % avId - - def getGoneSadMessage(self): - return self.getGoneSadMessageForAvId(self.doId) - - def setHp(self, hp): - DistributedPlayerAI.DistributedPlayerAI.setHp(self, hp) - if hp <= 0: - messenger.send(self.getGoneSadMessage()) - def b_setTutorialAck(self, tutorialAck): self.d_setTutorialAck(tutorialAck) self.setTutorialAck(tutorialAck) @@ -2033,6 +2024,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo msgs.append([textId, 1]) self.b_setResistanceMessages(msgs) + self.addStat(ToontownGlobals.STAT_UNITES) def removeResistanceMessage(self, textId): msgs = self.getResistanceMessages() @@ -2303,6 +2295,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo if overflowMoney > 0: bankMoney = self.bankMoney + overflowMoney self.b_setBankMoney(bankMoney) + self.addStat(ToontownGlobals.STAT_BEANS_EARNT, deltaMoney) def takeMoney(self, deltaMoney, bUseBank = True): totalMoney = self.money @@ -2316,6 +2309,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.b_setMoney(0) else: self.b_setMoney(self.money - deltaMoney) + self.addStat(ToontownGlobals.STAT_BEANS_SPENT, deltaMoney) return True def b_setMoney(self, money): @@ -3408,6 +3402,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return 0 elif self.flowerBasket.addFlower(species, variety): self.d_setFlowerBasket(*self.flowerBasket.getNetLists()) + self.addStat(ToontownGlobals.STAT_FLOWERS) return 1 else: self.notify.warning('addFlowerToBasket: addFlower failed') @@ -3688,6 +3683,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def addPinkSlips(self, amountToAdd): pinkSlips = min(self.getPinkSlips() + amountToAdd, 255) self.b_setPinkSlips(pinkSlips) + self.addStat(ToontownGlobals.STAT_SLIPS, amountToAdd) def removePinkSlips(self, amount): if hasattr(self, 'autoRestockPinkSlips') and self.autoRestockPinkSlips: @@ -4134,6 +4130,33 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def hasEPP(self, dept): return dept in self.epp + + def b_setStats(self, stats): + self.d_setStats(stats) + self.setStats(stats) + + def d_setStats(self, stats): + self.sendUpdate('setStats', [stats]) + + def setStats(self, stats): + self.stats = stats + + def getStats(self): + return self.stats + + def getStat(self, index): + return self.stats[index] + + def addStat(self, index, amount=1): + if amount <= 0: + return + + self.stats[index] += amount + self.d_setStats(self.stats) + + def wipeStats(self): + self.stats = [0] * 22 + self.d_setStats(self.stats) @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int]) def cheesyEffect(value, hood=0, expire=0): diff --git a/toontown/toon/DistributedToonUD.py b/toontown/toon/DistributedToonUD.py index b791f78f..01b0d550 100755 --- a/toontown/toon/DistributedToonUD.py +++ b/toontown/toon/DistributedToonUD.py @@ -522,3 +522,6 @@ class DistributedToonUD(DistributedObjectUD): def setWishNameState(self, todo0): pass + + def setStats(self, todo0): + pass diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 458c4da8..1f45ee9a 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -47,7 +47,7 @@ from toontown.shtiker import QuestPage from toontown.shtiker import ShardPage from toontown.shtiker import ShtikerBook from toontown.shtiker import SuitPage -from toontown.shtiker import TIPPage +from toontown.shtiker import StatPage from toontown.shtiker import TrackPage from toontown.toon import ElevatorNotifier from toontown.toon import ToonDNA @@ -307,6 +307,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.shardPage = ShardPage.ShardPage() self.shardPage.load() self.book.addPage(self.shardPage, pageName=TTLocalizer.ShardPageTitle) + self.statPage = StatPage.StatPage() + self.statPage.load() + self.book.addPage(self.statPage, pageName=TTLocalizer.StatPageTitle) self.mapPage = MapPage.MapPage() self.mapPage.load() self.book.addPage(self.mapPage, pageName=TTLocalizer.MapPageTitle) @@ -1654,11 +1657,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.book.addPage(self.eventsPage, pageName=TTLocalizer.EventsPageName) return - def addTIPPage(self): - self.tipPage = TIPPage.TIPPage() - self.tipPage.load() - self.book.addPage(self.tipPage, pageName=TTLocalizer.TIPPageTitle) - def setSpecialInventory(self, specialInventory): DistributedToon.DistributedToon.setSpecialInventory(self, specialInventory) self.inventory.updateTotalPropsText() diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 95e3639a..b5e6266e 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -3977,7 +3977,7 @@ EmoteHappy = 'Happy' EmoteSad = 'Sad' EmoteAnnoyed = 'Annoyed' EmoteSleep = 'Sleepy' -TIPPageTitle = 'TIP' +StatPageTitle = 'Statistics' SuitBaseNameWithLevel = '%(name)s\n%(dept)s\nLevel %(level)s' HealthForceAcknowledgeMessage = 'You cannot leave the playground until your Laff meter is smiling!' InventoryTotalGags = 'Total gags\n%d / %d' @@ -8625,6 +8625,33 @@ CrateEmotePrize = "Congratulations! You've unlocked a new emote. Check your mail CrateClothingPrize = "Congratulations! You've received a new clothing item. Check your mailbox to check it out!" CrateAccessoryPrize = 'Congratulations! You found a new accessory for your Toon. Check your mailbox and rock it!' +Stats = [ + 'Cogs defeated: %(cog)s', + 'V2.0 cogs defeated: %(v2)s', + 'Skelecogs defeated: %(skele)s', + 'Jellybeans spent: %(beanSpent)s', + 'Jellybeans earnt: %(beanEarnt)s', + 'Tasks completed: %(task)s', + 'Total VP defeats: %(vp)s', + 'Total CFO defeats: %(cfo)s', + 'Total CJ defeats: %(cj)s', + 'Total CEO defeats: %(ceo)s', + 'Gone sad: %(sad)s times', + 'Buildings liberated: %(bldg)s', + 'Field Offices defeated: %(cogdo)s', + 'Items purchased: %(item)s', + 'Fish caught: %(fish)s', + 'Flowers picked: %(flower)s', + 'Races completed: %(race)s', + 'Golf holes played: %(golf)s', + 'Total SOS cards: %(sos)s', + 'Total unites: %(unite)s', + 'Total pink slips: %(slip)s', + 'Total gags used: %(gag)s' +] +StatResetAsk = 'Are you sure you want to reset your stats? This is an irreversible action!' +StatResetDone = 'Your stats have been reset.' + Blacklist = [ "$1ut", "$h1t", diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index e4f98778..3d7ae65c 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1642,4 +1642,27 @@ CRATE_BUFFS = 3 CRATE_NAMETAGS = 4 CRATE_EMOTES = 5 CRATE_CLOTHING = 6 -CRATE_ACCESSORIES = 7 \ No newline at end of file +CRATE_ACCESSORIES = 7 + +STAT_COGS = 0 +STAT_V2 = 1 +STAT_SKELE = 2 +STAT_BEANS_SPENT = 3 +STAT_BEANS_EARNT = 4 +STAT_TASKS = 5 +STAT_VP = 6 +STAT_CFO = 7 +STAT_CJ = 8 +STAT_CEO = 9 +STAT_SAD = 10 +STAT_BLDG = 11 +STAT_COGDO = 12 +STAT_ITEMS = 13 +STAT_FISH = 14 +STAT_FLOWERS = 15 +STAT_RACING = 16 +STAT_GOLF = 17 +STAT_SOS = 18 +STAT_UNITES = 19 +STAT_SLIPS = 20 +STAT_GAGS = 21 \ No newline at end of file