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;
};
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 {
startHoliday(uint8) broadcast;
endHoliday(uint8) broadcast;
setActiveHolidays(uint8[]);
setInvasionStatus(uint8, string, uint32, uint8) broadcast;
};
dclass PurchaseManager : DistributedObject {

View file

@ -1,6 +1,9 @@
from direct.distributed.DistributedObject import DistributedObject
from direct.interval.IntervalGlobal import *
from toontown.battle import SuitBattleGlobals
from toontown.estate import Estate
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
from toontown.suit import SuitDNA
import HolidayGlobals
class NewsManager(DistributedObject):
@ -8,7 +11,6 @@ class NewsManager(DistributedObject):
def __init__(self, cr):
DistributedObject.__init__(self, cr)
print 'NewsMgr - GEN!'
self.invading = False
self.activeHolidays = []
base.localAvatar.inventory.setInvasionCreditMultiplier(1)
@ -22,7 +24,6 @@ class NewsManager(DistributedObject):
return id in self.activeHolidays
def setActiveHolidays(self, ids):
print 'set active holidays %s' % ids
for id in ids:
self.startHoliday(id, True)
@ -81,3 +82,24 @@ class NewsManager(DistributedObject):
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
elif id == ToontownGlobals.CHRISTMAS:
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
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):
return self.activeHolidays

View file

@ -574,10 +574,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
def setChosenToonAttacks(self, ids, tracks, levels, targets):
if self.__battleCleanedUp:
return
self.notify.debug('setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids,
print 'setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids,
tracks,
levels,
targets))
targets)
toonIndices = []
targetIndices = []
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_CANCEL = lCancel
STOREOWNER_TROPHY = 'Wow! You collected %s of %s fish. That deserves a trophy and a Laff boost!'
SuitInvasionBegin1 = lToonHQ + ': A Cog invasion has begun!!!'
SuitInvasionBegin2 = lToonHQ + ': %s have taken over Toontown!!!'
SuitInvasionEnd1 = lToonHQ + ': The %s invasion has ended!!!'
SuitInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!'
SuitInvasionUpdate1 = lToonHQ + ': Keep it up, Toons!!!'
SuitInvasionUpdate2 = lToonHQ + ': The Cogs appear to be decreasing in numbers!!!'
SuitInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!'
SuitInvasionBulletin2 = lToonHQ + ': %s have taken over Toontown!!!'
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!'
SkelecogInvasionBegin3 = lToonHQ + ': Skelecogs have taken over Toontown!!!'
SkelecogInvasionEnd1 = lToonHQ + ': The Skelecog invasion has ended!!!'
SkelecogInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!'
SkelecogInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!'
SkelecogInvasionBulletin2 = lToonHQ + ': The Cog factories are running out of parts to build new Cogs!'
SkelecogInvasionBulletin3 = lToonHQ + ': Skelecogs 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!!!'
WaiterInvasionEnd1 = lToonHQ + ': The unemployed waiters have been defeated!!!'
WaiterInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!'
WaiterInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!'
WaiterInvasionBulletin2 = lToonHQ + ': The C.E.O. has fired all of his waiters!!!'
WaiterInvasionBulletin3 = lToonHQ + ": The unemployed waiters are invading Toontown!!!"
V2InvasionBegin1 = lToonHQ + ": Yikes!!! This isn't good, Toons!"
V2InvasionBegin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!'
V2InvasionBegin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!'
V2InvasionEnd1 = lToonHQ + ': The version 2.0 Cog invasion has ended!!!'
V2InvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!'
V2InvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!'
V2InvasionBulletin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!'
V2InvasionBulletin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!'
SuitInvasionPrefix = '%s: ' % lToonHQ
SuitInvasionBegin = [
'A Cog invasion has begun!!!',
'%(plural)s have taken over Toontown!!!'
]
SuitInvasionEnd = [
'The %(singular)s invasion has ended!!!',
'The Toons have saved the day once again!!!'
]
SuitInvasionUpdate = [
'Keep it up, Toons!!!',
'The Cogs appear to be decreasing in numbers!!!'
]
SuitInvasionBulletin = [
'There is a Cog invasion in progress!!!',
'%(plural)s have taken over Toontown!!!'
]
SkelecogInvasionBegin = [
"Hmm... We're getting a strange reading over here...",
'The Cog factories are running out of parts to build new Cogs!',
'Skelecogs have taken over Toontown!!!'
]
SkelecogInvasionEnd = [
'The Skelecog invasion has ended!!!',
'The Toons have saved the day once again!!!'
]
SkelecogInvasionBulletin = [
'There is a Cog invasion in progress!!!',
'The Cog factories are running out of parts to build new Cogs!',
'Skelecogs 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'
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.'

View file

@ -824,6 +824,22 @@ WaiterInvasionBulletin = 9
V2InvasionBegin = 10
V2InvasionEnd = 11
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
NEW_YEAR_FIREWORKS = 2
HALLOWEEN = 3