Holocaust HolidayManagerAI (newsmanager rewrite soon to come)

This commit is contained in:
John 2015-06-21 22:46:17 +03:00
parent 74429800e7
commit 7029f536c8
8 changed files with 10 additions and 52 deletions

View file

@ -7,7 +7,7 @@ class DistributedBlackCatMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedBlackCatMgrAI")
def requestBlackCatTransformation(self):
if not self.air.holidayManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
if not self.air.newsManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
return
avId = self.air.getAvatarIdFromSender()

View file

@ -1,42 +0,0 @@
from toontown.toonbase import ToontownGlobals
from datetime import datetime
class HolidayManagerAI:
def __init__(self, air):
self.air = air
self.currentHolidays = []
self.xpMultiplier = 1
self.setup()
def setup(self):
holidays = config.GetString('active-holidays','')
if holidays != '':
for holiday in holidays.split(","):
holiday = int(holiday)
self.currentHolidays.append(holiday)
date = datetime.now()
if date.month == 10 and date.day == 31:
# Halloween: Black Cat Day
self.currentHolidays.append(ToontownGlobals.BLACK_CAT_DAY)
if date.weekday() == 6:
# Saturday: Fish Bingo
self.currentHolidays.append(ToontownGlobals.SILLY_SATURDAY_BINGO)
simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
def isHolidayRunning(self, holidayId):
return holidayId in self.currentHolidays
def isMoreXpHolidayRunning(self):
if ToontownGlobals.MORE_XP_HOLIDAY in self.currentHolidays:
self.xpMultiplier = 2
return True
return False
def getXpMultiplier(self):
return self.xpMultiplier

View file

@ -13,6 +13,9 @@ class NewsManagerAI(DistributedObjectAI):
if self.air.suitInvasionManager.getInvading():
self.air.suitInvasionManager.notifyInvasionBulletin(avatar.getDoId())
def isHolidayRunning(self, holidayId):
return False
def setPopulation(self, todo0):
pass

View file

@ -10,8 +10,7 @@ from otp.friends.FriendManagerAI import FriendManagerAI
from toontown.ai import CogPageManagerAI
from toontown.ai import CogSuitManagerAI
from toontown.ai import PromotionManagerAI
from toontown.ai.FishManagerAI import FishManagerAI
from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.FishManagerAI import FishManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI
@ -119,7 +118,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI()
self.promotionMgr = PromotionManagerAI.PromotionManagerAI(self)
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2)
self.accountDateMgr = AccountDateAI(self)

View file

@ -50,7 +50,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
if self.air.suitInvasionManager.getInvading():
mult = getInvasionMultiplier()
self.battleCalc.setSkillCreditMultiplier(mult)
if self.air.holidayManager.isMoreXpHolidayRunning():
if self.air.newsManager.isHolidayRunning(ToontownGlobals.MORE_XP_HOLIDAY):
mult = getMoreXpHolidayMultiplier()
self.battleCalc.setSkillCreditMultiplier(mult)
self.fsm = None

View file

@ -718,7 +718,7 @@ def getValue(genus, species, weight):
holidayIds = base.cr.newsManager.getHolidayIdList()
if ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY in holidayIds or ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH in holidayIds:
finalValue *= JellybeanFishingHolidayScoreMultiplier
elif ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays:
elif simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY) or simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH):
finalValue *= JellybeanFishingHolidayScoreMultiplier
return finalValue

View file

@ -299,7 +299,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI):
score = int(self.scoreDict[avId] + 0.5)
else:
score = 0
if ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays:
if simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY) or simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH):
score *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier
logEvent = False
if score > 255:

View file

@ -1586,12 +1586,11 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.sendUpdate('setCheesyEffect', [effect, hoodId, expireTime])
def setCheesyEffect(self, effect, hoodId, expireTime):
# We don't yet have a working holidayManager, and we want to keep snowman heads.
if simbase.air.holidayManager and ToontownGlobals.WINTER_CAROLING not in simbase.air.holidayManager.currentHolidays and ToontownGlobals.WACKY_WINTER_CAROLING not in simbase.air.holidayManager.currentHolidays and effect == ToontownGlobals.CESnowMan:
if (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.WINTER_CAROLING)) and (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.WACKY_WINTER_CAROLING)) and effect == ToontownGlobals.CESnowMan:
self.b_setCheesyEffect(ToontownGlobals.CENormal, hoodId, expireTime)
self.b_setScavengerHunt([])
return
if simbase.air.holidayManager and ToontownGlobals.HALLOWEEN_PROPS not in simbase.air.holidayManager.currentHolidays and ToontownGlobals.HALLOWEEN_COSTUMES not in simbase.air.holidayManager.currentHolidays and not simbase.air.wantHalloween and effect == ToontownGlobals.CEPumpkin:
elif (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN_PROPS)) and (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN_COSTUMES)) and (not simbase.air.wantHalloween) and effect == ToontownGlobals.CEPumpkin:
self.b_setCheesyEffect(ToontownGlobals.CENormal, hoodId, expireTime)
self.b_setScavengerHunt([])
return