Holiday stuff - cleanup, add Laughing Man holiday (everybody gets Laughing Man heads, including NPCs), add ~startHoliday and ~endHoliday magic word, clean up Laughing Man effect, remove Secret NPC

This commit is contained in:
DenialMC 2015-04-04 11:20:42 +03:00
parent 7065e2b06f
commit e0df87ac48
9 changed files with 75 additions and 61 deletions

View file

@ -17,8 +17,7 @@ class HolidayManagerAI:
simbase.air.newsManager.setHolidayIdList([self.currentHolidays]) simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
def isHolidayRunning(self, holidayId): def isHolidayRunning(self, holidayId):
if holidayId in self.currentHolidays: return holidayId in self.currentHolidays
return True
def isMoreXpHolidayRunning(self): def isMoreXpHolidayRunning(self):
if ToontownGlobals.MORE_XP_HOLIDAY in self.currentHolidays: if ToontownGlobals.MORE_XP_HOLIDAY in self.currentHolidays:

View file

@ -12,6 +12,7 @@ from direct.interval.IntervalGlobal import *
import calendar import calendar
from copy import deepcopy from copy import deepcopy
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
from otp.ai.MagicWordGlobal import *
decorationHolidays = [ToontownGlobals.WINTER_DECORATIONS, decorationHolidays = [ToontownGlobals.WINTER_DECORATIONS,
@ -258,6 +259,9 @@ class NewsManager(DistributedObject.DistributedObject):
elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT: elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSpookyBlackCatHolidayStart() self.setSpookyBlackCatHolidayStart()
elif holidayId == ToontownGlobals.LAUGHING_MAN:
if hasattr(base, 'localAvatar') and base.localAvatar:
self.setLaughingManHolidayStart()
elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON: elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setTopToonsMarathonStart() self.setTopToonsMarathonStart()
@ -275,6 +279,8 @@ class NewsManager(DistributedObject.DistributedObject):
self.setExpandedClosetsStart() self.setExpandedClosetsStart()
elif holidayId == ToontownGlobals.KARTING_TICKETS_HOLIDAY: elif holidayId == ToontownGlobals.KARTING_TICKETS_HOLIDAY:
self.setKartingTicketsHolidayStart() self.setKartingTicketsHolidayStart()
return True
return False
def endHoliday(self, holidayId): def endHoliday(self, holidayId):
if holidayId in self.holidayIdList: if holidayId in self.holidayIdList:
@ -377,6 +383,8 @@ class NewsManager(DistributedObject.DistributedObject):
elif holidayId == ToontownGlobals.IDES_OF_MARCH: elif holidayId == ToontownGlobals.IDES_OF_MARCH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu() base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu()
return True
return False
def setHolidayIdList(self, holidayIdList): def setHolidayIdList(self, holidayIdList):
@ -531,6 +539,11 @@ class NewsManager(DistributedObject.DistributedObject):
for currToon in base.cr.toons.values(): for currToon in base.cr.toons.values():
currToon.setDNA(currToon.style.clone()) currToon.setDNA(currToon.style.clone())
def setLaughingManHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.LaughingManHolidayStart)
for currToon in base.cr.toons.values():
currToon.generateLaughingMan()
def setTopToonsMarathonStart(self): def setTopToonsMarathonStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart) base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart)
@ -725,5 +738,42 @@ class NewsManager(DistributedObject.DistributedObject):
startingWeekDay = (startingWeekDay + 1) % 7 startingWeekDay = (startingWeekDay + 1) % 7
def isHolidayRunning(self, holidayId): def isHolidayRunning(self, holidayId):
result = holidayId in self.holidayIdList return holidayId in self.holidayIdList
return result
def getHoliday(id):
if id.isdigit():
return int(id)
elif hasattr(ToontownGlobals, id):
return getattr(ToontownGlobals, id)
return -1
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
def startHoliday(id):
"""
Start a holiday.
"""
holiday = getHoliday(id.upper())
if holiday < 0:
return "Couldn't find holiday " + id + '!'
if base.cr.newsManager.startHoliday(holiday):
return 'Successfully started holiday ' + id + '!'
else:
return id + ' is already running!'
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
def endHoliday(id):
"""
End a holiday.
"""
holiday = getHoliday(id.upper())
if holiday < 0:
return "Couldn't find holiday " + id + '!'
if base.cr.newsManager.endHoliday(holiday):
return 'Successfully stopped holiday ' + id + '!'
else:
return id + ' is not running!'

View file

@ -1,27 +0,0 @@
from DistributedNPCToonBase import *
from toontown.chat.ChatGlobals import *
from toontown.nametag.NametagGlobals import *
class DistributedNPCSecret(DistributedNPCToonBase):
def __init__(self, cr):
DistributedNPCToonBase.__init__(self, cr)
def delayDelete(self):
DistributedNPCToonBase.delayDelete(self)
DistributedNPCToonBase.disable(self)
def handleCollisionSphereEnter(self, collEntry):
self.sendUpdate('avatarEnter', [])
def createBot(self, chatPhraseId):
chatPhrases = [
"I'm Kyle, AKA the chicken lord, and I like to make bots!",
'I love the smell of fresh bots in the morning...',
'Bots... bots... bots...',
"Patch the Injector, or we'll continue...",
"All the kids who sweat it out... it's unbelievable! Let's give them more bots!",
"Master Milton is sweaty. Here's another bot!"
]
self.setChatAbsolute(chatPhrases[chatPhraseId], CFSpeech|CFTimeout)

View file

@ -1,22 +0,0 @@
from otp.ai.AIBaseGlobal import *
from DistributedNPCToonBaseAI import *
from ToonDNA import *
from DistributedBotAI import *
import random
class DistributedNPCSecretAI(DistributedNPCToonBaseAI):
def __init__(self, air, npcId, questCallback=None, hq=0):
DistributedNPCToonBaseAI.__init__(self, air, npcId, questCallback)
self.air = air
def avatarEnter(self):
self.sendUpdate('createBot', [random.randrange(6)])
dna = ToonDNA()
dna.newToonRandom()
newToon = DistributedBotAI(self.cr)
newToon.b_setDNAString(dna.makeNetString())
x = (random.random()*10) + 10
y = (random.random()*10) + 10
z = 4
newToon.sendUpdate('setPos', [x, y, z])

View file

@ -55,6 +55,7 @@ class DistributedNPCToonBase(DistributedToon.DistributedToon):
self.parentToonParts() self.parentToonParts()
self.rescaleToon() self.rescaleToon()
self.resetHeight() self.resetHeight()
self.generateLaughingMan()
self.rightHands = [] self.rightHands = []
self.leftHands = [] self.leftHands = []
self.headParts = [] self.headParts = []

View file

@ -1,6 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
def makeCard(book=False): def makeCard(book=False):
cardMaker = CardMaker('laughing-man-cm') cardMaker = CardMaker('laughing-man-cm')
cardMaker.setHasUvs(1) cardMaker.setHasUvs(1)
@ -27,17 +26,16 @@ def makeCard(book=False):
return nodePath return nodePath
def addHeadEffect(head, book=False): def addHeadEffect(head, book=False):
card = makeCard(book=book) card = makeCard(book=book)
card.setScale(1.45 if book else 2.5) card.setScale(1.45 if book else 2.5)
card.setZ(0.05 if book else 0.5) card.setZ(0.05 if book else 0.5)
for nodePath in head.getChildren(): for nodePath in head.getChildren():
nodePath.removeNode() nodePath.hide()
card.instanceTo(head) card.instanceTo(head)
def addToonEffect(toon): def addToonEffect(toon):
toon.getDialogueArray = lambda *args, **kwargs: []
for lod in toon.getLODNames(): for lod in toon.getLODNames():
addHeadEffect(toon.getPart('head', lod)) addHeadEffect(toon.getPart('head', lod))

View file

@ -27,7 +27,7 @@ from toontown.nametag.NametagGlobals import *
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toon import LaughingManGlobals
def teleportDebug(requestStatus, msg, onlyIfToAv = True): def teleportDebug(requestStatus, msg, onlyIfToAv = True):
if teleportNotify.getDebug(): if teleportNotify.getDebug():
@ -434,6 +434,8 @@ class Toon(Avatar.Avatar, ToonHead):
self.hatNodes = [] self.hatNodes = []
self.glassesNodes = [] self.glassesNodes = []
self.backpackNodes = [] self.backpackNodes = []
self.wantLaughingMan = False
self.hasLaughingMan = False
self.hat = (0, 0, 0) self.hat = (0, 0, 0)
self.glasses = (0, 0, 0) self.glasses = (0, 0, 0)
self.backpack = (0, 0, 0) self.backpack = (0, 0, 0)
@ -630,6 +632,7 @@ class Toon(Avatar.Avatar, ToonHead):
self.rescaleToon() self.rescaleToon()
self.resetHeight() self.resetHeight()
self.setupToonNodes() self.setupToonNodes()
self.generateLaughingMan()
def setupToonNodes(self): def setupToonNodes(self):
rightHand = NodePath('rightHand') rightHand = NodePath('rightHand')
@ -965,6 +968,10 @@ class Toon(Avatar.Avatar, ToonHead):
return swappedTorso return swappedTorso
def generateLaughingMan(self):
if not self.getHasLaughingMan() and self.getWantLaughingMan():
LaughingManGlobals.addToonEffect(self)
def generateHat(self, fromRTM = False): def generateHat(self, fromRTM = False):
hat = self.getHat() hat = self.getHat()
if hat[0] >= len(ToonDNA.HatModels): if hat[0] >= len(ToonDNA.HatModels):
@ -1137,7 +1144,13 @@ class Toon(Avatar.Avatar, ToonHead):
def getHat(self): def getHat(self):
return self.hat return self.hat
def getWantLaughingMan(self):
return self.wantLaughingMan or (base.cr.newsManager and base.cr.newsManager.isHolidayRunning(ToontownGlobals.LAUGHING_MAN))
def getHasLaughingMan(self):
return self.hasLaughingMan
def setGlasses(self, glassesIdx, textureIdx, colorIdx, fromRTM = False): def setGlasses(self, glassesIdx, textureIdx, colorIdx, fromRTM = False):
self.glasses = (glassesIdx, textureIdx, colorIdx) self.glasses = (glassesIdx, textureIdx, colorIdx)
self.generateGlasses(fromRTM=fromRTM) self.generateGlasses(fromRTM=fromRTM)

View file

@ -8579,6 +8579,7 @@ SpookyPropsHolidayStart = 'Silly Meter spins Toontown into spooky mode!'
BlackCatHolidayStart = 'Create a Black Cat - Today only!' BlackCatHolidayStart = 'Create a Black Cat - Today only!'
BlackCatHolidayEnd = 'Black Cat day has ended!' BlackCatHolidayEnd = 'Black Cat day has ended!'
SpookyBlackCatHolidayStart = 'Friday 13th means a Black Cat blast!' SpookyBlackCatHolidayStart = 'Friday 13th means a Black Cat blast!'
LaughingManHolidayStart = 'Today is the day of the Laughing Man!'
TopToonsMarathonStart = "The Top Toons New Year's Day Marathon has begun!" TopToonsMarathonStart = "The Top Toons New Year's Day Marathon has begun!"
TopToonsMarathonEnd = "The Top Toons New Year's Day Marathon has ended." TopToonsMarathonEnd = "The Top Toons New Year's Day Marathon has ended."
WinterDecorationsStart = "It's Winter Holiday time in Toontown!" WinterDecorationsStart = "It's Winter Holiday time in Toontown!"

View file

@ -962,6 +962,7 @@ SPOOKY_PROPS = 119
SPOOKY_COSTUMES = 120 SPOOKY_COSTUMES = 120
WACKY_WINTER_DECORATIONS = 121 WACKY_WINTER_DECORATIONS = 121
WACKY_WINTER_CAROLING = 122 WACKY_WINTER_CAROLING = 122
LAUGHING_MAN = 123
TOT_REWARD_JELLYBEAN_AMOUNT = 100 TOT_REWARD_JELLYBEAN_AMOUNT = 100
TOT_REWARD_END_OFFSET_AMOUNT = 0 TOT_REWARD_END_OFFSET_AMOUNT = 0
LawbotBossMaxDamage = 2700 LawbotBossMaxDamage = 2700