Poodletooth-iLand/toontown/estate/DistributedTreasureChestAI.py

23 lines
871 B
Python
Raw Normal View History

2015-05-11 19:05:59 +00:00
from direct.distributed.DistributedObjectAI import DistributedObjectAI
2015-05-11 14:54:45 +00:00
from toontown.fishing import FishGlobals
import TreasureChestGlobals
2015-05-11 19:05:59 +00:00
class DistributedTreasureChestAI(DistributedObjectAI):
2015-05-11 14:54:45 +00:00
def completeSale(self, sell):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
2015-05-11 19:05:59 +00:00
2015-05-11 14:54:45 +00:00
if not av:
return
2015-05-11 19:05:59 +00:00
2015-05-11 14:54:45 +00:00
if sell:
trophyResult = self.air.fishManager.creditFishTank(av)
2015-05-11 19:05:59 +00:00
2015-05-11 14:54:45 +00:00
if trophyResult:
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.TROPHY, len(av.fishCollection), FishGlobals.getTotalNumFish()])
else:
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.COMPLETE, 0, 0])
else:
2015-05-11 19:05:59 +00:00
self.sendUpdateToAvatarId(avId, 'completeSaleResult', [TreasureChestGlobals.NONE, 0, 0])