From 440fe2c51bb15cafeb772e2bc182fcf3a03e594e Mon Sep 17 00:00:00 2001 From: Michael G <10155689+DarthMDev@users.noreply.github.com> Date: Tue, 30 May 2023 17:50:06 -0400 Subject: [PATCH 1/2] MagicWordIndex: Add some more magic words Restockinventory to fill up gags emtpyinventory to emptygags and setpinkslips to give pinkslips --- toontown/spellbook/MagicWordIndex.py | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/toontown/spellbook/MagicWordIndex.py b/toontown/spellbook/MagicWordIndex.py index 39eddcb..c109628 100644 --- a/toontown/spellbook/MagicWordIndex.py +++ b/toontown/spellbook/MagicWordIndex.py @@ -286,7 +286,39 @@ class MaxToon(MagicWord): toon.b_setCogLevels([ToontownGlobals.MaxCogSuitLevel] * 4) return f"Successfully maxed {toon.getName()}!" + +class RestockInventory(MagicWord): + aliases = ['allstuff', 'restockinv', 'maxinv', 'maxinventory', 'restock'] + desc = 'Gives target all the inventory they can carry.' + execLocation = MagicWordConfig.EXEC_LOC_SERVER + def handleWord(self, invoker, avId, toon, *args): + toon.inventory.maxOutInv() + toon.d_setInventory(toon.inventory.makeNetString()) + return ("Maxing out inventory for " + toon.getName() + ".") + +class EmptyInventory(MagicWord): + aliases = ['nostuff', 'emptyinv', 'zeroinv', 'zeroinventory'] + desc = 'Gives target all the inventory they can carry.' + execLocation = MagicWordConfig.EXEC_LOC_SERVER + + def handleWord(self, invoker, avId, toon, *args): + toon.inventory.zeroInv() + toon.d_setInventory(toon.inventory.makeNetString()) + return ("Zeroing inventory for " + toon.getName() + ".") + +class SetPinkSlips(MagicWord): + # this command gives the target toon the specified amount of pink slips + # default is 255 + aliases = ["pinkslips"] + desc = "Gives the target toon the specified amount of pink slips." + execLocation = MagicWordConfig.EXEC_LOC_SERVER + arguments = [("amount", int, False, 255)] + + def handleWord(self, invoker, avId, toon, *args): + toon.b_setPinkSlips(args[0]) + return f"Gave {toon.getName()} {args[0]} pink slips!" + class AbortMinigame(MagicWord): aliases = ["exitgame", "exitminigame", "quitgame", "quitminigame", "skipgame", "skipminigame"] desc = "Aborts an ongoing minigame." From fd0e7d86a2363843055ca134601d093f433d25e4 Mon Sep 17 00:00:00 2001 From: DarthNihilus1 Date: Tue, 30 May 2023 18:20:54 -0400 Subject: [PATCH 2/2] MagicWordIndex: update - Combine inventory commands - Add aliases for setting pink slips --- toontown/spellbook/MagicWordIndex.py | 37 +++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/toontown/spellbook/MagicWordIndex.py b/toontown/spellbook/MagicWordIndex.py index c109628..a2b7a5f 100644 --- a/toontown/spellbook/MagicWordIndex.py +++ b/toontown/spellbook/MagicWordIndex.py @@ -287,30 +287,33 @@ class MaxToon(MagicWord): return f"Successfully maxed {toon.getName()}!" -class RestockInventory(MagicWord): - aliases = ['allstuff', 'restockinv', 'maxinv', 'maxinventory', 'restock'] - desc = 'Gives target all the inventory they can carry.' +class Inventory(MagicWord): + # by default restock the inventory + aliases = ['gags', 'inv'] + desc = 'This allows you to modify your inventory in various ways.' execLocation = MagicWordConfig.EXEC_LOC_SERVER - + arguments = [("command", str, False, ''), ("track", str, False, ""), ("level", int, False, 0), ("amount", int, False, 0)] def handleWord(self, invoker, avId, toon, *args): - toon.inventory.maxOutInv() - toon.d_setInventory(toon.inventory.makeNetString()) - return ("Maxing out inventory for " + toon.getName() + ".") + command = args[0] + # the list of words that can be used to restock the inventory + restockInvWords = ['restock', 'max', 'all', '', 'fill'] + # the list of words that can be used to empty the inventory + emptyInvWords = ['empty', 'zero', 'null', 'clear', 'none', 'reset'] + if command in restockInvWords: + toon.inventory.maxOutInv() + toon.d_setInventory(toon.inventory.makeNetString()) + return ("Maxing out inventory for " + toon.getName() + ".") + if command in emptyInvWords: + toon.inventory.zeroInv() + toon.d_setInventory(toon.inventory.makeNetString()) + return ("Zeroing inventory for " + toon.getName() + ".") -class EmptyInventory(MagicWord): - aliases = ['nostuff', 'emptyinv', 'zeroinv', 'zeroinventory'] - desc = 'Gives target all the inventory they can carry.' - execLocation = MagicWordConfig.EXEC_LOC_SERVER - - def handleWord(self, invoker, avId, toon, *args): - toon.inventory.zeroInv() - toon.d_setInventory(toon.inventory.makeNetString()) - return ("Zeroing inventory for " + toon.getName() + ".") + class SetPinkSlips(MagicWord): # this command gives the target toon the specified amount of pink slips # default is 255 - aliases = ["pinkslips"] + aliases = ["pinkslips", "fires", 'setfires'] desc = "Gives the target toon the specified amount of pink slips." execLocation = MagicWordConfig.EXEC_LOC_SERVER arguments = [("amount", int, False, 255)]