mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-26 13:12:30 -06:00
27 lines
981 B
Python
Executable file
27 lines
981 B
Python
Executable file
from DistributedNPCToonBaseAI import DistributedNPCToonBaseAI
|
|
from ToonDNA import ToonDNA
|
|
from toontown.toonbase import ToontownGlobals
|
|
|
|
class DistributedNPCGloveAI(DistributedNPCToonBaseAI):
|
|
|
|
def requestTransformation(self, color):
|
|
avId = self.air.getAvatarIdFromSender()
|
|
av = self.air.doId2do.get(avId)
|
|
|
|
if av is None or not hasattr(av, 'dna'):
|
|
return
|
|
|
|
if av.dna.gloveColor == color:
|
|
self.sendUpdate('doTransformation', [avId, 1])
|
|
return
|
|
|
|
if av.getTotalMoney() < ToontownGlobals.GloveCost:
|
|
self.sendUpdate('doTransformation', [avId, 2])
|
|
return
|
|
|
|
av.takeMoney(ToontownGlobals.GloveCost)
|
|
newDNA = ToonDNA()
|
|
newDNA.makeFromNetString(av.getDNAString())
|
|
newDNA.gloveColor = color
|
|
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
|
self.sendUpdate('doTransformation', [avId, 3])
|