Flippy will now turn you into a black cat on October 31

This commit is contained in:
DenialMC 2015-04-07 17:55:39 +03:00
parent 04233eb9f3
commit 9568591627
11 changed files with 54 additions and 62 deletions

View file

@ -2789,7 +2789,7 @@ dclass DistributedAprilToonsMgr : DistributedObject {
};
dclass DistributedBlackCatMgr : DistributedObject {
doBlackCatTransformation(uint32 avId) broadcast;
doBlackCatTransformation() broadcast;
requestBlackCatTransformation() airecv clsend;
};

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import *
hashVal = 781330651
hashVal = 1472811447
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
@ -14,7 +14,7 @@ from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiv
from toontown.shtiker import DeleteManager, PurchaseManager, NewbiePurchaseManager
from toontown.groups import GroupManager
from toontown.uberdog.ClientServicesManager import ClientServicesManager
from toontown.ai import NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr
from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr
from toontown.ai.DistributedTrashcanZeroMgr import DistributedTrashcanZeroMgr
from toontown.uberdog.DistributedMailManager import DistributedMailManager
from otp.chat import ChatAgent

View file

@ -9,16 +9,19 @@ def getDustCloudIval(toon):
dustCloud.setZ(3)
dustCloud.setScale(0.4)
dustCloud.createTrack()
if getattr(toon, 'laffMeter', None):
if hasattr(toon, 'laffMeter'):
toon.laffMeter.color = toon.style.getBlackColor()
seq = Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy))
seq.append(Func(messenger.send, 'blackcat-transformed'))
if getattr(toon, 'laffMeter', None):
seq.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
return seq
sequence = Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy))
if hasattr(toon, 'laffMeter'):
sequence.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
return sequence
class DistributedBlackCatMgr(DistributedObject.DistributedObject):
neverDisable = 1
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBlackCatMgr')
def __init__(self, cr):
@ -26,28 +29,15 @@ class DistributedBlackCatMgr(DistributedObject.DistributedObject):
def announceGenerate(self):
DistributedObject.DistributedObject.announceGenerate(self)
DistributedBlackCatMgr.notify.debug('announceGenerate')
self.acceptOnce('DistributedBlackCatMgr-activate', self.d_requestBlackCatTransformation)
self.dustCloudIval = None
base.cr.blackCatMgr = self
def delete(self):
if self.dustCloudIval:
self.dustCloudIval.finish()
del self.dustCloudIval
self.ignore('DistributedBlackCatMgr-activate')
base.cr.blackCatMgr = None
DistributedObject.DistributedObject.delete(self)
def d_requestBlackCatTransformation(self):
self.sendUpdate('requestBlackCatTransformation', [])
def requestBlackCatTransformation(self):
self.sendUpdate('requestBlackCatTransformation')
def doBlackCatTransformation(self, avId):
DistributedBlackCatMgr.notify.debug('doBlackCatTransformation')
toon = self.cr.doId2do.get(avId)
if not toon:
DistributedBlackCatMgr.notify.warning("couldn't find Toon %s" % self.avId)
return
if toon.style.getAnimal() != 'cat':
DistributedBlackCatMgr.notify.warning('not a cat: %s' % self.avId)
return
self.dustCloudIval = getDustCloudIval(toon)
self.dustCloudIval.start()
def doBlackCatTransformation(self):
print 'doit'
getDustCloudIval(base.localAvatar).start()

View file

@ -1,21 +1,23 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.toon.ToonDNA import ToonDNA
from toontown.toonbase import ToontownGlobals
class DistributedBlackCatMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedBlackCatMgrAI")
def requestBlackCatTransformation(self):
if not self.air.holidayManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
return
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av: return
if av.dna.getAnimal() == 'cat' and av.dna.headColor != 0x1a:
newDNA = ToonDNA()
newDNA.makeFromNetString(av.getDNAString())
newDNA.headColor = 0x1a
newDNA.armColor = 0x1a
newDNA.legColor = 0x1a
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
self.sendUpdate('doBlackCatTransformation', [avId])
if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
return
newDNA = ToonDNA()
newDNA.makeFromNetString(av.getDNAString())
newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])

View file

@ -1,4 +1,5 @@
from toontown.toonbase import ToontownGlobals
from datetime import datetime
class HolidayManagerAI:
@ -10,11 +11,19 @@ class HolidayManagerAI:
def setup(self):
holidays = config.GetString('active-holidays','')
if holidays != '':
for holiday in holidays.split(","):
holiday = int(holiday)
self.currentHolidays.append(holiday)
simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
date = datetime.now()
if date.month == 10 and date.day == 31:
# Halloween: Black Cat Day
self.currentHolidays.append(ToontownGlobals.BLACK_CAT_DAY)
simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
def isHolidayRunning(self, holidayId):
return holidayId in self.currentHolidays

View file

@ -15,6 +15,7 @@ from toontown.ai.FishManagerAI import FishManagerAI
from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI
from toontown.ai import BankManagerAI
from toontown.catalog.AccountDateAI import AccountDateAI
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
@ -113,6 +114,8 @@ class ToontownAIRepository(ToontownInternalRepository):
self.banManager = BanManagerAI.BanManagerAI(self)
self.achievementsManager = AchievementsManagerAI(self)
self.suitInvasionManager = SuitInvasionManagerAI(self)
self.blackCatMgr = DistributedBlackCatMgrAI(self)
self.blackCatMgr.generateWithRequired(2)
self.trophyMgr = DistributedTrophyMgrAI(self)
self.trophyMgr.generateWithRequired(2)
self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI(self)

View file

@ -8340,7 +8340,6 @@ WHITELIST = [
'crazycorner',
"crazycorner's",
'crazycorners',
'crazyknucklesthebestblackcat',
'crazyquilt',
"crazyquilt's",
'crazyquilts',

View file

@ -862,7 +862,7 @@ class NPCMoviePlayer(DirectObject.DirectObject):
def phraseSaid(phraseId):
toontastic = 315
if phraseId == toontastic:
messenger.send('DistributedBlackCatMgr-activate')
base.cr.blackCatMgr.requestBlackCatTransformation()
def enableBlackCatListen():
self.acceptOnce(SpeedChatGlobals.SCStaticTextMsgEvent, phraseSaid)

View file

@ -2682,3 +2682,10 @@ def promote(deptIndex):
invoker = spellbook.getInvoker()
invoker.sendUpdate('requestPromotion', [deptIndex])
return 'Your promotion request has been sent.'
@magicWord(category=CATEGORY_ADMINISTRATOR)
def blackCat():
"""
Ask the black cat manager to turn you into a cat.
"""
base.cr.blackCatMgr.requestBlackCatTransformation()

View file

@ -2515,17 +2515,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def isToonedUp(self):
return self.hp >= self.maxHp
def makeBlackCat(self):
if self.dna.getAnimal() != 'cat':
return 'not a cat'
self.air.writeServerEvent('blackCat', self.doId, '')
newDna = ToonDNA.ToonDNA()
newDna.makeFromNetString(self.dna.makeNetString())
black = 26
newDna.updateToonProperties(armColor=black, legColor=black, headColor=black)
self.b_setDNAString(newDna.makeNetString())
return None
def b_announceBingo(self):
self.d_announceBingo()
self.announceBingo

View file

@ -1,8 +1,6 @@
from direct.directnotify.DirectNotifyGlobal import *
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.fsm.FSM import FSM
from toontown.ai import DistributedBlackCatMgrAI
from toontown.building import FADoorCodes
from toontown.building.HQBuildingAI import HQBuildingAI
from toontown.building.TutorialBuildingAI import TutorialBuildingAI
@ -64,11 +62,6 @@ class TutorialFSM(FSM):
def enterTunnel(self):
npcDesc = NPCToons.NPCToonDict.get(20001)
self.flippy = NPCToons.createNPC(self.air, 20001, npcDesc, self.zones['street'], 0)
if simbase.air.wantHalloween:
self.BlackCatManager = DistributedBlackCatMgrAI.DistributedBlackCatMgrAI(self.air)
self.BlackCatManager.generateWithRequired(self.zones['street'])
self.hq.insideDoor0.setDoorLock(FADoorCodes.WRONG_DOOR_HQ)
self.hq.insideDoor1.setDoorLock(FADoorCodes.UNLOCKED)
self.hq.door0.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)