mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-25 04:32:33 -06:00
27 lines
No EOL
928 B
Python
27 lines
No EOL
928 B
Python
from toontown.toonbase import ToontownGlobals
|
|
import LaffRestockGlobals, DistributedNPCToonBaseAI
|
|
|
|
class DistributedNPCLaffRestockAI(DistributedNPCToonBaseAI.DistributedNPCToonBaseAI):
|
|
|
|
def restock(self):
|
|
avId = self.air.getAvatarIdFromSender()
|
|
av = self.air.doId2do.get(avId)
|
|
|
|
if not av:
|
|
return
|
|
|
|
laff = av.getMaxHp() - av.getHp()
|
|
|
|
if laff <= 0:
|
|
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_LAFF, 0])
|
|
return
|
|
|
|
cost = laff * ToontownGlobals.CostPerLaffRestock
|
|
|
|
if cost > av.getTotalMoney():
|
|
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_MONEY, cost])
|
|
return
|
|
|
|
av.takeMoney(cost)
|
|
av.b_setHp(av.getMaxHp())
|
|
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0]) |