mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Proper Fish Bingo implementation using News Manager
This commit is contained in:
parent
0718b91ed4
commit
ce8d856ebe
10 changed files with 111 additions and 116 deletions
|
@ -1,6 +1,7 @@
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
from direct.distributed.ClockDelta import globalClockDelta
|
from direct.distributed.ClockDelta import globalClockDelta
|
||||||
from direct.task import Task
|
from direct.task import Task
|
||||||
|
from otp.ai.MagicWordGlobal import *
|
||||||
from toontown.effects.DistributedFireworkShowAI import DistributedFireworkShowAI
|
from toontown.effects.DistributedFireworkShowAI import DistributedFireworkShowAI
|
||||||
from toontown.effects import FireworkShows
|
from toontown.effects import FireworkShows
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
@ -18,19 +19,21 @@ class NewsManagerAI(DistributedObjectAI):
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObjectAI.announceGenerate(self)
|
DistributedObjectAI.announceGenerate(self)
|
||||||
self.__checkHolidays()
|
self.__checkHolidays()
|
||||||
self.checkTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
|
|
||||||
self.accept('avatarEntered', self.__handleAvatarEntered)
|
self.accept('avatarEntered', self.__handleAvatarEntered)
|
||||||
|
taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
DistributedObjectAI.delete(self)
|
DistributedObjectAI.delete(self)
|
||||||
taskMgr.remove(self.checkTask)
|
self.deleteTasks()
|
||||||
|
|
||||||
|
def deleteTasks(self):
|
||||||
|
taskMgr.remove('holidayCheckTask')
|
||||||
self.deleteFireworkTasks()
|
self.deleteFireworkTasks()
|
||||||
|
|
||||||
def deleteFireworkTasks(self):
|
def deleteFireworkTasks(self):
|
||||||
if self.fireworkTasks:
|
for task in self.fireworkTasks:
|
||||||
for task in self.fireworkTasks:
|
taskMgr.remove(task)
|
||||||
taskMgr.remove(task)
|
self.fireworkTasks = []
|
||||||
self.fireworkTasks = []
|
|
||||||
|
|
||||||
def __handleAvatarEntered(self, av):
|
def __handleAvatarEntered(self, av):
|
||||||
avId = av.getDoId()
|
avId = av.getDoId()
|
||||||
|
@ -64,41 +67,44 @@ class NewsManagerAI(DistributedObjectAI):
|
||||||
else:
|
else:
|
||||||
return HolidayGlobals.getStartDate(holiday) <= date <= HolidayGlobals.getEndDate(holiday)
|
return HolidayGlobals.getStartDate(holiday) <= date <= HolidayGlobals.getEndDate(holiday)
|
||||||
|
|
||||||
def isHolidayRunning(self, id):
|
def isHolidayRunning(self, *args):
|
||||||
return id in self.activeHolidays
|
for id in args:
|
||||||
|
if id in self.activeHolidays:
|
||||||
|
return True
|
||||||
|
|
||||||
def startHoliday(self, id):
|
def startHoliday(self, id):
|
||||||
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
|
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
|
||||||
return
|
return False
|
||||||
|
|
||||||
self.activeHolidays.append(id)
|
self.activeHolidays.append(id)
|
||||||
self.startSpecialHoliday(id)
|
self.startSpecialHoliday(id)
|
||||||
self.sendUpdate('startHoliday', [id])
|
self.sendUpdate('startHoliday', [id])
|
||||||
|
return True
|
||||||
|
|
||||||
def endHoliday(self, id):
|
def endHoliday(self, id):
|
||||||
if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
|
if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
|
||||||
return
|
return False
|
||||||
|
|
||||||
self.activeHolidays.remove(id)
|
self.activeHolidays.remove(id)
|
||||||
self.endSpecialHoliday(id)
|
self.endSpecialHoliday(id)
|
||||||
self.sendUpdate('endHoliday', [id])
|
self.sendUpdate('endHoliday', [id])
|
||||||
|
return True
|
||||||
|
|
||||||
def startSpecialHoliday(self, id):
|
def startSpecialHoliday(self, id):
|
||||||
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
|
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
|
||||||
messenger.send('checkBingoState')
|
messenger.send('startBingo')
|
||||||
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
|
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
|
||||||
self.fireworkTasks.append(taskMgr.doMethodLater((60 - datetime.datetime.now().minute) * 60, self.startFireworkTask, 'initialFireworkTask-%s' % id, extraArgs=[id]))
|
self.fireworkTasks.append(taskMgr.doMethodLater((60 - datetime.datetime.now().minute) * 60, self.startFireworkTask, 'initialFireworkTask-%s' % id, extraArgs=[id]))
|
||||||
|
|
||||||
def endSpecialHoliday(self, id):
|
def endSpecialHoliday(self, id):
|
||||||
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
|
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
|
||||||
messenger.send('checkBingoState')
|
messenger.send('stopBingo')
|
||||||
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
|
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
|
||||||
self.deleteFireworkTasks()
|
self.deleteFireworkTasks()
|
||||||
|
|
||||||
def startFireworkTask(self, id, task=None):
|
def startFireworkTask(self, id, task=None):
|
||||||
self.startFireworks(id)
|
self.startFireworks(id)
|
||||||
self.fireworkTasks.append(taskMgr.doMethodLater(3600, self.startFireworks, 'fireworkTask-%s' % id, extraArgs=[id]))
|
self.fireworkTasks.append(taskMgr.doMethodLater(3600, self.startFireworks, 'fireworkTask-%s' % id, extraArgs=[id]))
|
||||||
return Task.done
|
|
||||||
|
|
||||||
def startFireworks(self, type, task=None):
|
def startFireworks(self, type, task=None):
|
||||||
maxShow = len(FireworkShows.shows.get(type, [])) - 1
|
maxShow = len(FireworkShows.shows.get(type, [])) - 1
|
||||||
|
@ -112,3 +118,31 @@ class NewsManagerAI(DistributedObjectAI):
|
||||||
fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime())
|
fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime())
|
||||||
|
|
||||||
return Task.again
|
return Task.again
|
||||||
|
|
||||||
|
@magicWord(category=CATEGORY_PROGRAMMER)
|
||||||
|
def newsShutdown():
|
||||||
|
"""
|
||||||
|
Shutdown the news manager tasks.
|
||||||
|
"""
|
||||||
|
simbase.air.newsManager.deleteTasks()
|
||||||
|
return 'News manager shut down!'
|
||||||
|
|
||||||
|
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
|
||||||
|
def startHoliday(holiday):
|
||||||
|
"""
|
||||||
|
Start a holiday.
|
||||||
|
"""
|
||||||
|
if simbase.air.newsManager.startHoliday(holiday):
|
||||||
|
return 'Started holiday %s!' % holiday
|
||||||
|
|
||||||
|
return 'Holiday %s is already running!' % holiday
|
||||||
|
|
||||||
|
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
|
||||||
|
def stopHoliday(holiday):
|
||||||
|
"""
|
||||||
|
Stop a holiday.
|
||||||
|
"""
|
||||||
|
if simbase.air.newsManager.endHoliday(holiday):
|
||||||
|
return 'Stopped holiday %s!' % holiday
|
||||||
|
|
||||||
|
return 'Holiday %s is not running!' % holiday
|
|
@ -5,7 +5,6 @@ import HouseGlobals
|
||||||
import time, random
|
import time, random
|
||||||
|
|
||||||
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
|
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
|
||||||
from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
|
|
||||||
from toontown.fishing import FishingTargetGlobals, FishGlobals
|
from toontown.fishing import FishingTargetGlobals, FishGlobals
|
||||||
from toontown.safezone import TreasureGlobals
|
from toontown.safezone import TreasureGlobals
|
||||||
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
||||||
|
@ -506,11 +505,6 @@ class DistributedEstateAI(DistributedObjectAI):
|
||||||
self.pond.generateWithRequired(self.zoneId)
|
self.pond.generateWithRequired(self.zoneId)
|
||||||
self.pond.start()
|
self.pond.start()
|
||||||
|
|
||||||
self.pond.bingoMgr = DistributedPondBingoManagerAI(simbase.air)
|
|
||||||
self.pond.bingoMgr.setPondDoId(self.pond.getDoId())
|
|
||||||
self.pond.bingoMgr.generateWithRequired(self.zoneId)
|
|
||||||
self.pond.bingoMgr.initTasks()
|
|
||||||
|
|
||||||
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate]
|
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[ToontownGlobals.MyEstate]
|
||||||
self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
|
self.treasurePlanner = SZTreasurePlannerAI(self.zoneId, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
|
||||||
self.treasurePlanner.start()
|
self.treasurePlanner.start()
|
||||||
|
|
|
@ -156,11 +156,6 @@ class BingoCardGui(DirectFrame):
|
||||||
elif self.game.getGameState() & 1 << index:
|
elif self.game.getGameState() & 1 << index:
|
||||||
self.cellGuiList[index].disable()
|
self.cellGuiList[index].disable()
|
||||||
|
|
||||||
def disableCard(self):
|
|
||||||
self.stopCellBlinking()
|
|
||||||
for index in xrange(self.game.getCardSize()):
|
|
||||||
self.cellGuiList[index].disable()
|
|
||||||
|
|
||||||
def enableCard(self, callback = None):
|
def enableCard(self, callback = None):
|
||||||
self.notify.info('enable Bingo card')
|
self.notify.info('enable Bingo card')
|
||||||
self.stopCellBlinking()
|
self.stopCellBlinking()
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from direct.directnotify.DirectNotifyGlobal import *
|
from direct.directnotify.DirectNotifyGlobal import *
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
from toontown.fishing import FishingTargetGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
from toontown.fishing.DistributedFishingTargetAI import DistributedFishingTargetAI
|
from DistributedFishingTargetAI import DistributedFishingTargetAI
|
||||||
|
from DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
|
||||||
|
import FishingTargetGlobals
|
||||||
|
|
||||||
class DistributedFishingPondAI(DistributedObjectAI):
|
class DistributedFishingPondAI(DistributedObjectAI):
|
||||||
notify = directNotify.newCategory("DistributedFishingPondAI")
|
notify = directNotify.newCategory("DistributedFishingPondAI")
|
||||||
|
@ -15,12 +16,42 @@ class DistributedFishingPondAI(DistributedObjectAI):
|
||||||
self.spots = {}
|
self.spots = {}
|
||||||
self.bingoMgr = None
|
self.bingoMgr = None
|
||||||
|
|
||||||
|
def announceGenerate(self):
|
||||||
|
if self.air.newsManager.isHolidayRunning(ToontownGlobals.FISH_BINGO, ToontownGlobals.SILLY_SATURDAY):
|
||||||
|
self.startBingo()
|
||||||
|
|
||||||
|
self.accept('startBingo', self.startBingo)
|
||||||
|
self.accept('stopBingo', self.stopBingo)
|
||||||
|
DistributedObjectAI.announceGenerate(self)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
self.ignoreAll()
|
||||||
|
DistributedObjectAI.delete(self)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
for _ in xrange(FishingTargetGlobals.getNumTargets(self.area)):
|
for _ in xrange(FishingTargetGlobals.getNumTargets(self.area)):
|
||||||
fishingTarget = DistributedFishingTargetAI(simbase.air)
|
fishingTarget = DistributedFishingTargetAI(simbase.air)
|
||||||
fishingTarget.setPondDoId(self.doId)
|
fishingTarget.setPondDoId(self.doId)
|
||||||
fishingTarget.generateWithRequired(self.zoneId)
|
fishingTarget.generateWithRequired(self.zoneId)
|
||||||
|
|
||||||
|
def startBingo(self):
|
||||||
|
if self.bingoMgr:
|
||||||
|
self.notify.warning('Tried to start bingo while already started!')
|
||||||
|
return
|
||||||
|
|
||||||
|
self.bingoMgr = DistributedPondBingoManagerAI(self.air)
|
||||||
|
self.bingoMgr.setPondDoId(self.getDoId())
|
||||||
|
self.bingoMgr.generateWithRequired(self.zoneId)
|
||||||
|
self.bingoMgr.createGame()
|
||||||
|
|
||||||
|
def stopBingo(self):
|
||||||
|
if not self.bingoMgr:
|
||||||
|
self.notify.warning('Tried to stop bingo but not started!')
|
||||||
|
return
|
||||||
|
|
||||||
|
self.bingoMgr.requestDelete()
|
||||||
|
self.bingoMgr = None
|
||||||
|
|
||||||
def hitTarget(self, target):
|
def hitTarget(self, target):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
if self.targets.get(target) is None:
|
if self.targets.get(target) is None:
|
||||||
|
|
|
@ -49,6 +49,7 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
self.notify.debug('generate: DistributedPondBingoManager')
|
self.notify.debug('generate: DistributedPondBingoManager')
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
self.pond.resetSpotGui()
|
||||||
del self.pond.pondBingoMgr
|
del self.pond.pondBingoMgr
|
||||||
self.pond.pondBingoMgr = None
|
self.pond.pondBingoMgr = None
|
||||||
del self.pond
|
del self.pond
|
||||||
|
@ -58,7 +59,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
del self.card
|
del self.card
|
||||||
self.notify.debug('delete: Deleting Local PondManager %s' % self.doId)
|
self.notify.debug('delete: Deleting Local PondManager %s' % self.doId)
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
return
|
|
||||||
|
|
||||||
def d_cardUpdate(self, cellId, genus, species):
|
def d_cardUpdate(self, cellId, genus, species):
|
||||||
self.sendUpdate('cardUpdate', [self.cardId,
|
self.sendUpdate('cardUpdate', [self.cardId,
|
||||||
|
@ -121,7 +121,7 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
self.card.hide()
|
self.card.hide()
|
||||||
|
|
||||||
def showCard(self):
|
def showCard(self):
|
||||||
if (self.state != 'Off' or self.state != 'CloseEvent') and self.card.getGame():
|
if self.state != 'Off' and self.card.getGame() != None:
|
||||||
self.card.loadCard()
|
self.card.loadCard()
|
||||||
self.card.show()
|
self.card.show()
|
||||||
elif self.state == 'GameOver':
|
elif self.state == 'GameOver':
|
||||||
|
@ -283,8 +283,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
return (request, args)
|
return (request, args)
|
||||||
elif request == 'Intermission':
|
elif request == 'Intermission':
|
||||||
return (request, args)
|
return (request, args)
|
||||||
elif request == 'CloseEvent':
|
|
||||||
return 'CloseEvent'
|
|
||||||
elif request == 'Off':
|
elif request == 'Off':
|
||||||
return 'Off'
|
return 'Off'
|
||||||
else:
|
else:
|
||||||
|
@ -305,8 +303,6 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
return (request, args)
|
return (request, args)
|
||||||
elif request == 'Intermission':
|
elif request == 'Intermission':
|
||||||
return (request, args)
|
return (request, args)
|
||||||
elif request == 'CloseEvent':
|
|
||||||
return 'CloseEvent'
|
|
||||||
elif request == 'Off':
|
elif request == 'Off':
|
||||||
return 'Off'
|
return 'Off'
|
||||||
else:
|
else:
|
||||||
|
@ -338,17 +334,3 @@ class DistributedPondBingoManager(DistributedObject.DistributedObject, FSM.FSM):
|
||||||
|
|
||||||
def exitIntermission(self):
|
def exitIntermission(self):
|
||||||
self.notify.debug('enterIntermission: Exit Intermission State')
|
self.notify.debug('enterIntermission: Exit Intermission State')
|
||||||
|
|
||||||
def enterCloseEvent(self, timestamp):
|
|
||||||
self.notify.debug('enterCloseEvent: Enter CloseEvent State')
|
|
||||||
self.card.hide()
|
|
||||||
self.pond.resetSpotGui()
|
|
||||||
|
|
||||||
def filterCloseEvent(self, request, args):
|
|
||||||
if request == 'Off':
|
|
||||||
return 'Off'
|
|
||||||
else:
|
|
||||||
self.notify.warning('filterOff: Invalid State Transition from GameOver to %s' % request)
|
|
||||||
|
|
||||||
def exitCloseEvent(self):
|
|
||||||
self.notify.debug('exitCloseEvent: Exit CloseEvent State')
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
from direct.distributed.ClockDelta import *
|
||||||
from toontown.fishing import BingoGlobals
|
from toontown.fishing import BingoGlobals
|
||||||
from toontown.fishing import FishGlobals
|
from toontown.fishing import FishGlobals
|
||||||
from toontown.toonbase import ToontownGlobals
|
|
||||||
from toontown.fishing.NormalBingo import NormalBingo
|
from toontown.fishing.NormalBingo import NormalBingo
|
||||||
from toontown.fishing.ThreewayBingo import ThreewayBingo
|
from toontown.fishing.ThreewayBingo import ThreewayBingo
|
||||||
from toontown.fishing.DiagonalBingo import DiagonalBingo
|
from toontown.fishing.DiagonalBingo import DiagonalBingo
|
||||||
from toontown.fishing.BlockoutBingo import BlockoutBingo
|
from toontown.fishing.BlockoutBingo import BlockoutBingo
|
||||||
from toontown.fishing.FourCornerBingo import FourCornerBingo
|
from toontown.fishing.FourCornerBingo import FourCornerBingo
|
||||||
from direct.task import Task
|
import random
|
||||||
from direct.distributed.ClockDelta import *
|
|
||||||
import random, datetime
|
|
||||||
RequestCard = {}
|
|
||||||
|
|
||||||
|
RequestCard = {}
|
||||||
|
|
||||||
class DistributedPondBingoManagerAI(DistributedObjectAI):
|
class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPondBingoManagerAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPondBingoManagerAI")
|
||||||
|
@ -26,35 +24,14 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
self.state = 'Off'
|
self.state = 'Off'
|
||||||
self.pond = None
|
self.pond = None
|
||||||
self.canCall = False
|
self.canCall = False
|
||||||
self.shouldStop = False
|
|
||||||
self.lastUpdate = globalClockDelta.getRealNetworkTime()
|
self.lastUpdate = globalClockDelta.getRealNetworkTime()
|
||||||
self.cardId = 0
|
self.cardId = 0
|
||||||
|
|
||||||
def initTasks(self):
|
def delete(self):
|
||||||
now = datetime.datetime.now()
|
taskMgr.remove(self.uniqueName('startWait'))
|
||||||
weekday = now.weekday()
|
taskMgr.remove(self.uniqueName('createGame'))
|
||||||
targetday = 2 # Wednesday
|
taskMgr.remove(self.uniqueName('finishGame'))
|
||||||
if weekday in (3, 4):
|
DistributedObjectAI.delete(self)
|
||||||
targetday = 5
|
|
||||||
togo = targetday - weekday
|
|
||||||
if togo < 0:
|
|
||||||
togo += 7
|
|
||||||
s = now + datetime.timedelta(days=togo)
|
|
||||||
start = datetime.datetime(s.year, s.month, s.day)
|
|
||||||
secs = max(0, (start - now).total_seconds())
|
|
||||||
self.notify.debug('Today it\'s %d, so we wait for %d, togo: %d %d' % (weekday, targetday, togo, secs))
|
|
||||||
taskMgr.doMethodLater(secs, DistributedPondBingoManagerAI.startTask, self.taskName('start'), extraArgs=[self])
|
|
||||||
|
|
||||||
def startTask(self):
|
|
||||||
self.notify.debug('Starting game')
|
|
||||||
|
|
||||||
def stop(task):
|
|
||||||
self.notify.debug('Stopping game')
|
|
||||||
self.shouldStop = True
|
|
||||||
return task.done
|
|
||||||
|
|
||||||
taskMgr.doMethodLater(24 * 60 * 60, stop, self.taskName('stop'))
|
|
||||||
self.createGame()
|
|
||||||
|
|
||||||
def setPondDoId(self, pondId):
|
def setPondDoId(self, pondId):
|
||||||
self.pond = self.air.doId2do[pondId]
|
self.pond = self.air.doId2do[pondId]
|
||||||
|
@ -87,12 +64,16 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
elif result == BingoGlobals.UPDATE:
|
elif result == BingoGlobals.UPDATE:
|
||||||
self.sendGameStateUpdate(cellId)
|
self.sendGameStateUpdate(cellId)
|
||||||
|
|
||||||
def d_enableBingo(self):
|
|
||||||
self.sendUpdate('enableBingo', [])
|
|
||||||
|
|
||||||
def handleBingoCall(self, cardId):
|
def handleBingoCall(self, cardId):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
|
av = self.air.doId2do.get(avId)
|
||||||
|
|
||||||
|
if not av:
|
||||||
|
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo while not on district!')
|
||||||
|
return
|
||||||
|
|
||||||
spot = self.pond.hasToon(avId)
|
spot = self.pond.hasToon(avId)
|
||||||
|
|
||||||
if not spot:
|
if not spot:
|
||||||
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo while not fishing!')
|
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo while not fishing!')
|
||||||
return
|
return
|
||||||
|
@ -102,7 +83,7 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
if cardId != self.cardId:
|
if cardId != self.cardId:
|
||||||
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo with an expired cardId!')
|
self.air.writeServerEvent('suspicious', avId, 'Toon tried to call bingo with an expired cardId!')
|
||||||
return
|
return
|
||||||
av = self.air.doId2do[avId]
|
|
||||||
av.d_announceBingo()
|
av.d_announceBingo()
|
||||||
self.rewardAll()
|
self.rewardAll()
|
||||||
|
|
||||||
|
@ -158,40 +139,25 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
continue
|
continue
|
||||||
av = self.air.doId2do[self.pond.spots[spot].avId]
|
av = self.air.doId2do[self.pond.spots[spot].avId]
|
||||||
av.addMoney(self.jackpot)
|
av.addMoney(self.jackpot)
|
||||||
if self.shouldStop:
|
taskMgr.doMethodLater(5, self.startWait, self.uniqueName('startWait'))
|
||||||
self.stopGame()
|
taskMgr.remove(self.uniqueName('finishGame'))
|
||||||
return
|
|
||||||
taskMgr.doMethodLater(5, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
|
|
||||||
taskMgr.remove('finishGame%d' % self.getDoId())
|
|
||||||
|
|
||||||
def finishGame(self):
|
def finishGame(self, task=None):
|
||||||
self.state = 'GameOver'
|
self.state = 'GameOver'
|
||||||
self.sendStateUpdate()
|
self.sendStateUpdate()
|
||||||
if self.shouldStop:
|
taskMgr.doMethodLater(5, self.startWait, self.uniqueName('startWait'))
|
||||||
self.stopGame()
|
|
||||||
return
|
|
||||||
taskMgr.doMethodLater(5, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
|
|
||||||
|
|
||||||
def stopGame(self):
|
|
||||||
self.state = 'CloseEvent'
|
|
||||||
self.sendStateUpdate()
|
|
||||||
taskMgr.doMethodLater(10, DistributedPondBingoManagerAI.turnOff, 'turnOff%d' % self.getDoId(), [self])
|
|
||||||
|
|
||||||
def turnOff(self):
|
|
||||||
self.state = 'Off'
|
|
||||||
self.sendStateUpdate()
|
|
||||||
|
|
||||||
def startIntermission(self):
|
def startIntermission(self):
|
||||||
self.state = 'Intermission'
|
self.state = 'Intermission'
|
||||||
self.sendStateUpdate()
|
self.sendStateUpdate()
|
||||||
taskMgr.doMethodLater(300, DistributedPondBingoManagerAI.startWait, 'startWait%d' % self.getDoId(), [self])
|
taskMgr.doMethodLater(300, self.startWait, self.uniqueName('startWait'))
|
||||||
|
|
||||||
def startWait(self):
|
def startWait(self, task=None):
|
||||||
self.state = 'WaitCountdown'
|
self.state = 'WaitCountdown'
|
||||||
self.sendStateUpdate()
|
self.sendStateUpdate()
|
||||||
taskMgr.doMethodLater(15, DistributedPondBingoManagerAI.createGame, 'createGame%d' % self.getDoId(), [self])
|
taskMgr.doMethodLater(15, self.createGame, self.uniqueName('createGame'))
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self, task=None):
|
||||||
self.canCall = False
|
self.canCall = False
|
||||||
self.tileSeed = None
|
self.tileSeed = None
|
||||||
self.typeId = None
|
self.typeId = None
|
||||||
|
@ -223,4 +189,4 @@ class DistributedPondBingoManagerAI(DistributedObjectAI):
|
||||||
self.b_setJackpot(BingoGlobals.getJackpot(self.typeId))
|
self.b_setJackpot(BingoGlobals.getJackpot(self.typeId))
|
||||||
self.state = 'Playing'
|
self.state = 'Playing'
|
||||||
self.sendStateUpdate()
|
self.sendStateUpdate()
|
||||||
taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), DistributedPondBingoManagerAI.finishGame, 'finishGame%d' % self.getDoId(), [self])
|
taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), self.finishGame, self.uniqueName('finishGame'))
|
||||||
|
|
|
@ -5,7 +5,6 @@ from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
|
||||||
from toontown.hood import ZoneUtil
|
from toontown.hood import ZoneUtil
|
||||||
from toontown.safezone import TreasureGlobals
|
from toontown.safezone import TreasureGlobals
|
||||||
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
|
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
|
||||||
from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoManagerAI
|
|
||||||
from toontown.safezone.DistributedPartyGateAI import DistributedPartyGateAI
|
from toontown.safezone.DistributedPartyGateAI import DistributedPartyGateAI
|
||||||
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
||||||
from toontown.suit import DistributedSuitPlannerAI
|
from toontown.suit import DistributedSuitPlannerAI
|
||||||
|
@ -90,12 +89,6 @@ class HoodAI:
|
||||||
fishingPond.setArea(area)
|
fishingPond.setArea(area)
|
||||||
fishingPond.generateWithRequired(zoneId)
|
fishingPond.generateWithRequired(zoneId)
|
||||||
fishingPond.start()
|
fishingPond.start()
|
||||||
|
|
||||||
fishingPond.bingoMgr = DistributedPondBingoManagerAI(simbase.air)
|
|
||||||
fishingPond.bingoMgr.setPondDoId(fishingPond.getDoId())
|
|
||||||
fishingPond.bingoMgr.generateWithRequired(zoneId)
|
|
||||||
fishingPond.bingoMgr.initTasks()
|
|
||||||
|
|
||||||
fishingPonds.append(fishingPond)
|
fishingPonds.append(fishingPond)
|
||||||
elif isinstance(dnaGroup, DNAVisGroup):
|
elif isinstance(dnaGroup, DNAVisGroup):
|
||||||
zoneId = int(dnaGroup.getName().split(':')[0])
|
zoneId = int(dnaGroup.getName().split(':')[0])
|
||||||
|
|
|
@ -18,7 +18,6 @@ class BodyShop(StateData.StateData):
|
||||||
self.legChoice = 0
|
self.legChoice = 0
|
||||||
self.headChoice = 0
|
self.headChoice = 0
|
||||||
self.speciesChoice = 0
|
self.speciesChoice = 0
|
||||||
return
|
|
||||||
|
|
||||||
def enter(self, toon, shopsVisited = []):
|
def enter(self, toon, shopsVisited = []):
|
||||||
base.disableMouse()
|
base.disableMouse()
|
||||||
|
|
|
@ -51,7 +51,6 @@ class ShuffleButton:
|
||||||
self.incBtnShowLerp = LerpColorInterval(self.incBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
|
self.incBtnShowLerp = LerpColorInterval(self.incBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
|
||||||
self.decBtnShowLerp = LerpColorInterval(self.decBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
|
self.decBtnShowLerp = LerpColorInterval(self.decBtn, self.lerpDuration, Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 0))
|
||||||
self.__updateArrows()
|
self.__updateArrows()
|
||||||
return
|
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
if self.showLerp:
|
if self.showLerp:
|
||||||
|
|
|
@ -661,6 +661,8 @@ class DistributedFishingSpot(DistributedObject.DistributedObject):
|
||||||
jar.setPos(0, 0, 0)
|
jar.setPos(0, 0, 0)
|
||||||
|
|
||||||
def resetCastGui(self):
|
def resetCastGui(self):
|
||||||
|
if not self.castGui:
|
||||||
|
return
|
||||||
self.notify.debug('resetCastGui: Bingo Night Ends - resetting Gui')
|
self.notify.debug('resetCastGui: Bingo Night Ends - resetting Gui')
|
||||||
bucket = self.castGui.find('**/bucket')
|
bucket = self.castGui.find('**/bucket')
|
||||||
jar = self.castGui.find('**/jar')
|
jar = self.castGui.find('**/jar')
|
||||||
|
|
Loading…
Reference in a new issue