From 622653d25e2bd092dc5697ceb203bdc2b132e01b Mon Sep 17 00:00:00 2001 From: Little Cat Date: Thu, 22 Jul 2021 01:39:46 -0300 Subject: [PATCH] spellbook: Add basic MaxToon magic word --- toontown/ai/ToontownAIRepository.py | 5 +++++ toontown/spellbook/MagicWordIndex.py | 30 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index 122949b..d08b56a 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -97,21 +97,26 @@ class ToontownAIRepository(ToontownInternalRepository): ToontownInternalRepository.handleConnected(self) # Generate our district... + self.notify.info('Generating district...') self.districtId = self.allocateChannel() self.district = ToontownDistrictAI(self) self.district.setName(self.districtName) self.district.generateWithRequiredAndId(self.districtId, self.getGameDoId(), OTP_ZONE_ID_DISTRICTS) # Claim ownership of that district... + self.notify.info('Declaring ownership...') self.district.setAI(self.ourChannel) # Create our local objects. + self.notify.info('Creating local objects...') self.createLocals() # Create our global objects. + self.notify.info('Creating global objects...') self.createGlobals() # Create our zones. + self.notify.info('Creating zones...') self.createZones() # Make our district available, and we're done. diff --git a/toontown/spellbook/MagicWordIndex.py b/toontown/spellbook/MagicWordIndex.py index 46c2be9..5f6cf9f 100644 --- a/toontown/spellbook/MagicWordIndex.py +++ b/toontown/spellbook/MagicWordIndex.py @@ -242,6 +242,36 @@ class ToggleRun(MagicWord): inputState.set('debugRunning', not inputState.isSet('debugRunning')) return "Run mode has been toggled." +class MaxToon(MagicWord): + aliases = ["max", "idkfa"] + desc = "Maxes your target toon." + execLocation = MagicWordConfig.EXEC_LOC_SERVER + accessLevel = 'ADMIN' + + def handleWord(self, invoker, avId, toon, *args): + from toontown.toonbase import ToontownGlobals + + # TODO: Handle this better, like giving out all awards, set the quest tier, stuff like that. + # This is mainly copied from Anesidora just so I can better work on things. + toon.b_setTrackAccess([1, 1, 1, 1, 1, 1, 1]) + + toon.b_setMaxCarry(ToontownGlobals.MaxCarryLimit) + toon.b_setQuestCarryLimit(ToontownGlobals.MaxQuestCarryLimit) + + toon.experience.maxOutExp() + toon.d_setExperience(toon.experience.makeNetString()) + + toon.inventory.maxOutInv() + toon.d_setInventory(toon.inventory.makeNetString()) + + toon.b_setMaxHp(ToontownGlobals.MaxHpLimit) + toon.b_setHp(ToontownGlobals.MaxHpLimit) + + toon.b_setMaxMoney(250) + toon.b_setMoney(toon.maxMoney) + toon.b_setBankMoney(toon.maxBankMoney) + + return f"Successfully maxed {toon.getName()}!" # Instantiate all classes defined here to register them. # A bit hacky, but better than the old system