NewsManager setInvasionStatus

This commit is contained in:
John 2015-06-30 21:50:15 +03:00
parent 244fc5f057
commit 3660d305cd
6 changed files with 109 additions and 71 deletions

View file

@ -1488,43 +1488,11 @@ dclass GroupManager : DistributedObject {
removePlayerFromGroup(uint32, uint32) clsend airecv; removePlayerFromGroup(uint32, uint32) clsend airecv;
}; };
struct weeklyCalendarHoliday {
uint8 holidayId;
uint8 dayOfTheWeek;
};
struct yearlyCalendarHoliday {
uint8 holidayId;
uint8[] firstStartTime;
uint8[] lastEndTime;
};
struct oncelyCalendarHoliday {
uint8 holidayId;
uint16[] firstStartTime;
uint16[] lastEndTime;
};
struct relativelyCalendarHoliday {
uint8 holidayId;
uint16[] firstStartTime;
uint16[] lastEndTime;
};
struct startAndEndTime {
uint16[] startTime;
uint16[] endTime;
};
struct multipleStartHoliday {
uint8 holidayId;
startAndEndTime times[];
};
dclass NewsManager : DistributedObject { dclass NewsManager : DistributedObject {
startHoliday(uint8) broadcast; startHoliday(uint8) broadcast;
endHoliday(uint8) broadcast; endHoliday(uint8) broadcast;
setActiveHolidays(uint8[]); setActiveHolidays(uint8[]);
setInvasionStatus(uint8, string, uint32, uint8) broadcast;
}; };
dclass PurchaseManager : DistributedObject { dclass PurchaseManager : DistributedObject {

View file

@ -1,6 +1,9 @@
from direct.distributed.DistributedObject import DistributedObject from direct.distributed.DistributedObject import DistributedObject
from direct.interval.IntervalGlobal import *
from toontown.battle import SuitBattleGlobals
from toontown.estate import Estate from toontown.estate import Estate
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
from toontown.suit import SuitDNA
import HolidayGlobals import HolidayGlobals
class NewsManager(DistributedObject): class NewsManager(DistributedObject):
@ -8,7 +11,6 @@ class NewsManager(DistributedObject):
def __init__(self, cr): def __init__(self, cr):
DistributedObject.__init__(self, cr) DistributedObject.__init__(self, cr)
print 'NewsMgr - GEN!'
self.invading = False self.invading = False
self.activeHolidays = [] self.activeHolidays = []
base.localAvatar.inventory.setInvasionCreditMultiplier(1) base.localAvatar.inventory.setInvasionCreditMultiplier(1)
@ -22,7 +24,6 @@ class NewsManager(DistributedObject):
return id in self.activeHolidays return id in self.activeHolidays
def setActiveHolidays(self, ids): def setActiveHolidays(self, ids):
print 'set active holidays %s' % ids
for id in ids: for id in ids:
self.startHoliday(id, True) self.startHoliday(id, True)
@ -80,4 +81,25 @@ class NewsManager(DistributedObject):
elif id == ToontownGlobals.HALLOWEEN: elif id == ToontownGlobals.HALLOWEEN:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu() base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
elif id == ToontownGlobals.CHRISTMAS: elif id == ToontownGlobals.CHRISTMAS:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu() base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
def setInvasionStatus(self, msgType, suitType, remaining, flags):
if msgType not in ToontownGlobals.SuitInvasions:
return
if suitType in SuitDNA.suitHeadTypes:
attributes = SuitBattleGlobals.SuitAttributes[suitType]
suitNames = {'singular': attributes['name'], 'plural': attributes['pluralname']}
elif suitType in SuitDNA.suitDepts:
suitNames = {'singular': SuitDNA.getDeptFullname(suitType), 'plural': SuitDNA.getDeptFullnameP(suitType)}
else:
return
track = Sequence()
base.localAvatar.inventory.setInvasionCreditMultiplier(1 if msgType in ToontownGlobals.EndingInvasions else ToontownBattleGlobals.getInvasionMultiplier())
for i, message in enumerate(ToontownGlobals.SuitInvasions[msgType]):
track.append(Wait(5 if i else 1))
track.append(Func(base.localAvatar.setSystemMessage, 0, (TTLocalizer.SuitInvasionPrefix + message) % suitNames))
track.start()

View file

@ -32,7 +32,12 @@ class NewsManagerAI(DistributedObjectAI):
self.fireworkTask = None self.fireworkTask = None
def __handleAvatarEntered(self, av): def __handleAvatarEntered(self, av):
self.sendUpdateToAvatarId(av.getDoId(), 'setActiveHolidays', [self.activeHolidays]) avId = av.getDoId()
if self.air.suitInvasionManager.getInvading():
self.air.suitInvasionManager.notifyInvasionBulletin(avId)
self.sendUpdateToAvatarId(avId, 'setActiveHolidays', [self.activeHolidays])
def getActiveHolidays(self): def getActiveHolidays(self):
return self.activeHolidays return self.activeHolidays

View file

@ -574,10 +574,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
def setChosenToonAttacks(self, ids, tracks, levels, targets): def setChosenToonAttacks(self, ids, tracks, levels, targets):
if self.__battleCleanedUp: if self.__battleCleanedUp:
return return
self.notify.debug('setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids, print 'setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids,
tracks, tracks,
levels, levels,
targets)) targets)
toonIndices = [] toonIndices = []
targetIndices = [] targetIndices = []
unAttack = 0 unAttack = 0

View file

@ -4605,37 +4605,64 @@ STOREOWNER_CONFIRM_LOSS = 'Your closet is full. You will lose the clothes you w
STOREOWNER_OK = lOK STOREOWNER_OK = lOK
STOREOWNER_CANCEL = lCancel STOREOWNER_CANCEL = lCancel
STOREOWNER_TROPHY = 'Wow! You collected %s of %s fish. That deserves a trophy and a Laff boost!' STOREOWNER_TROPHY = 'Wow! You collected %s of %s fish. That deserves a trophy and a Laff boost!'
SuitInvasionBegin1 = lToonHQ + ': A Cog invasion has begun!!!' SuitInvasionPrefix = '%s: ' % lToonHQ
SuitInvasionBegin2 = lToonHQ + ': %s have taken over Toontown!!!' SuitInvasionBegin = [
SuitInvasionEnd1 = lToonHQ + ': The %s invasion has ended!!!' 'A Cog invasion has begun!!!',
SuitInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' '%(plural)s have taken over Toontown!!!'
SuitInvasionUpdate1 = lToonHQ + ': Keep it up, Toons!!!' ]
SuitInvasionUpdate2 = lToonHQ + ': The Cogs appear to be decreasing in numbers!!!' SuitInvasionEnd = [
SuitInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' 'The %(singular)s invasion has ended!!!',
SuitInvasionBulletin2 = lToonHQ + ': %s have taken over Toontown!!!' 'The Toons have saved the day once again!!!'
SkelecogInvasionBegin1 = lToonHQ + ": Hmm... We're getting a strange reading over here..." ]
SkelecogInvasionBegin2 = lToonHQ + ': The Cog factories are running out of parts to build new Cogs!' SuitInvasionUpdate = [
SkelecogInvasionBegin3 = lToonHQ + ': Skelecogs have taken over Toontown!!!' 'Keep it up, Toons!!!',
SkelecogInvasionEnd1 = lToonHQ + ': The Skelecog invasion has ended!!!' 'The Cogs appear to be decreasing in numbers!!!'
SkelecogInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' ]
SkelecogInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' SuitInvasionBulletin = [
SkelecogInvasionBulletin2 = lToonHQ + ': The Cog factories are running out of parts to build new Cogs!' 'There is a Cog invasion in progress!!!',
SkelecogInvasionBulletin3 = lToonHQ + ': Skelecogs have taken over Toontown!!!' '%(plural)s have taken over Toontown!!!'
WaiterInvasionBegin1 = lToonHQ + ': It appears that the C.E.O. has fired all his waiters...' ]
WaiterInvasionBegin2 = lToonHQ + ': The unemployed waiters are invading Toontown!!!' SkelecogInvasionBegin = [
WaiterInvasionEnd1 = lToonHQ + ': The unemployed waiters have been defeated!!!' "Hmm... We're getting a strange reading over here...",
WaiterInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' 'The Cog factories are running out of parts to build new Cogs!',
WaiterInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' 'Skelecogs have taken over Toontown!!!'
WaiterInvasionBulletin2 = lToonHQ + ': The C.E.O. has fired all of his waiters!!!' ]
WaiterInvasionBulletin3 = lToonHQ + ": The unemployed waiters are invading Toontown!!!" SkelecogInvasionEnd = [
V2InvasionBegin1 = lToonHQ + ": Yikes!!! This isn't good, Toons!" 'The Skelecog invasion has ended!!!',
V2InvasionBegin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' 'The Toons have saved the day once again!!!'
V2InvasionBegin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' ]
V2InvasionEnd1 = lToonHQ + ': The version 2.0 Cog invasion has ended!!!' SkelecogInvasionBulletin = [
V2InvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' 'There is a Cog invasion in progress!!!',
V2InvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' 'The Cog factories are running out of parts to build new Cogs!',
V2InvasionBulletin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' 'Skelecogs have taken over Toontown!!!'
V2InvasionBulletin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' ]
WaiterInvasionBegin = [
'It appears that the C.E.O. has fired all his waiters...',
'The unemployed waiters are invading Toontown!!!'
]
WaiterInvasionEnd = [
'The unemployed waiters have been defeated!!!',
'The Toons have saved the day once again!!!'
]
WaiterInvasionBulletin = [
'There is a Cog invasion in progress!!!',
'The C.E.O. has fired all of his waiters!!!',
'The unemployed waiters are invading Toontown!!!'
]
V2InvasionBegin = [
"Yikes!!! This isn't good, Toons!",
'A major firmware update has been released to the Cogs!!!',
'Version 2.0 %(plural)s have taken over Toontown!!!'
]
V2InvasionEnd = [
'The Version 2.0 %(singular)s invasion has ended!!!',
'The Toons have saved the day once again!!!'
]
V2InvasionBulletin = [
'There is a Cog invasion in progress!!!',
'A major firmware update has been released to the Cogs!!!',
'Version 2.0 %(plural)s have taken over Toontown!!!'
]
LeaderboardTitle = 'Toon Platoon' LeaderboardTitle = 'Toon Platoon'
QuestScript101_0 = 'Come here! Use the arrow keys to move.' QuestScript101_0 = 'Come here! Use the arrow keys to move.'
QuestScript101_1 = 'These are Cogs. They are robots that are trying to take over Toontown.' QuestScript101_1 = 'These are Cogs. They are robots that are trying to take over Toontown.'

View file

@ -824,6 +824,22 @@ WaiterInvasionBulletin = 9
V2InvasionBegin = 10 V2InvasionBegin = 10
V2InvasionEnd = 11 V2InvasionEnd = 11
V2InvasionBulletin = 12 V2InvasionBulletin = 12
EndingInvasions = [SuitInvasionEnd, SkelecogInvasionEnd, WaiterInvasionEnd, V2InvasionEnd]
SuitInvasions = {
SuitInvasionBegin: TTLocalizer.SuitInvasionBegin,
SuitInvasionEnd: TTLocalizer.SuitInvasionEnd,
SuitInvasionUpdate: TTLocalizer.SuitInvasionUpdate,
SuitInvasionBulletin: TTLocalizer.SuitInvasionBulletin,
SkelecogInvasionBegin: TTLocalizer.SkelecogInvasionBegin,
SkelecogInvasionEnd: TTLocalizer.SkelecogInvasionEnd,
SkelecogInvasionBulletin: TTLocalizer.SkelecogInvasionBulletin,
WaiterInvasionBegin: TTLocalizer.WaiterInvasionBegin,
WaiterInvasionEnd: TTLocalizer.WaiterInvasionEnd,
WaiterInvasionBulletin: TTLocalizer.WaiterInvasionBulletin,
V2InvasionBegin: TTLocalizer.V2InvasionBegin,
V2InvasionEnd: TTLocalizer.V2InvasionEnd,
V2InvasionBulletin: TTLocalizer.V2InvasionBulletin
}
SUMMER_FIREWORKS = 1 SUMMER_FIREWORKS = 1
NEW_YEAR_FIREWORKS = 2 NEW_YEAR_FIREWORKS = 2
HALLOWEEN = 3 HALLOWEEN = 3