Merge pull request #87 from DarthMDev/patch-3

MagicWordIndex: Add some more magic words
This commit is contained in:
Little Cat 2023-05-30 20:49:10 -03:00 committed by GitHub
commit 464c2d45f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -287,6 +287,41 @@ class MaxToon(MagicWord):
return f"Successfully maxed {toon.getName()}!"
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):
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 SetPinkSlips(MagicWord):
# this command gives the target toon the specified amount of pink slips
# default is 255
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)]
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."