本文整理汇总了Python中toontown.toon.NPCToons类的典型用法代码示例。如果您正苦于以下问题:Python NPCToons类的具体用法?Python NPCToons怎么用?Python NPCToons使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NPCToons类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createZone
def createZone(self):
HoodAI.createZone(self)
self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData()
self.createTrolley()
self.createTreasurePlanner()
self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr)
NPCToons.createNpcsInZone(self.air, self.HOOD)
示例2: spawn
def spawn(air, zone, element, match):
if zone % 1000 != 0:
# This should hopefully create the Fishermen NPCs on streets.
NPCToons.createNpcsInZone(air, zone)
pond = DistributedFishingPondAI(air)
area = ZoneUtil.getBranchZone(zone)
pond.setArea(area)
pond.generateWithRequired(zone)
bingoMgr = DistributedPondBingoManagerAI(air)
bingoMgr.setPondDoId(pond.getDoId())
bingoMgr.generateWithRequired(zone)
pond.bingoMgr = bingoMgr
pond.bingoMgr.createGame()
simbase.air.fishManager.ponds[zone] = pond
for i in range(FishingTargetGlobals.getNumTargets(area)):
target = DistributedFishingTargetAI(simbase.air)
target.setPondDoId(pond.getDoId())
target.generateWithRequired(zone)
for child in element.children:
if isinstance(child, DNAProp) and 'fishing_spot' in child.code:
spot = DistributedFishingSpotAI(air)
spot.setPondDoId(pond.getDoId())
x, y, z = child.getPos()
h, p, r = child.getHpr()
spot.setPosHpr(x, y, z, h, p, r)
spot.generateWithRequired(zone)
示例3: startup
def startup(self):
HoodAI.HoodAI.startup(self)
if simbase.config.GetBool('want-minigames', True):
self.createTrolley()
if simbase.config.GetBool('want-classic-chars', True):
if simbase.config.GetBool('want-mickey', True):
self.createClassicChar()
if simbase.config.GetBool('want-butterflies', True):
self.createButterflies()
if simbase.air.wantYinYang:
NPCToons.createNPC(
simbase.air, 2021,
(ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2021], ('css', 'ms', 'm', 'm', 26, 0, 26, 26, 0, 27, 0, 27, 0, 27), 'm', 1, NPCToons.NPC_YIN),
ToontownGlobals.ToontownCentral, posIndex=0)
NPCToons.createNPC(
simbase.air, 2022,
(ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2022], ('bss', 'ms', 'm', 'm', 0, 0, 0, 0, 0, 31, 0, 31, 0, 31), 'm', 1, NPCToons.NPC_YANG),
ToontownGlobals.ToontownCentral, posIndex=0)
if simbase.air.wantHalloween:
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
self.TrickOrTreatTargetManager.generateWithRequired(2649)
if simbase.air.wantChristmas:
self.WinterCarolingTargetManager = DistributedWinterCarolingTargetAI.DistributedWinterCarolingTargetAI(self.air)
self.WinterCarolingTargetManager.generateWithRequired(2649)
if simbase.config.GetBool('want-experiment-event'):
self.createExperimentEvent()
示例4: setVictors
def setVictors(self, victorIds):
DistributedFactoryAI.DistributedFactoryAI.setVictors(self, victorIds)
activeVictors = []
for victorId in victorIds:
toon = self.air.doId2do.get(victorId)
if toon is not None:
activeVictors.append(toon)
npcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3))
for toon in activeVictors:
toon.attemptAddNPCFriend(npcId)
toon.d_setSystemMessage(0, 'You got a %s SOS card.' % (NPCToons.getNPCName(npcId)))
示例5: __makeShopOwnerNpc
def __makeShopOwnerNpc(self):
if self.shopOwnerNpc:
return
self.shopOwnerNpc = NPCToons.createLocalNPC(self.shopOwnerNpcId)
if not self.shopOwnerNpc:
self.notify.warning('No shopkeeper in this cogdominium, using FunnyFarm Sellbot FO NPCToons')
random.seed(self.doId)
shopkeeper = random.randint(7001, 7009)
self.shopOwnerNpc = NPCToons.createLocalNPC(shopkeeper)
self.shopOwnerNpc.addActive()
self.shopOwnerNpc.reparentTo(self.cage)
self.shopOwnerNpc.setPosHpr(0, -2, 0, 180, 0, 0)
self.shopOwnerNpc.loop('neutral')
示例6: createCogHeadquarters
def createCogHeadquarters(self):
NPCToons.generateZone2NpcDict()
if self.config.GetBool('want-sellbot-headquarters', True):
self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self)
self.cogHeadquarters.append(SellbotHQAI.SellbotHQAI(self))
if self.config.GetBool('want-cashbot-headquarters', True):
self.mintMgr = MintManagerAI.MintManagerAI(self)
self.cogHeadquarters.append(CashbotHQAI.CashbotHQAI(self))
if self.config.GetBool('want-lawbot-headquarters', True):
self.lawOfficeMgr = LawOfficeManagerAI.LawOfficeManagerAI(self)
self.cogHeadquarters.append(LawbotHQAI.LawbotHQAI(self))
if self.config.GetBool('want-bossbot-headquarters', True):
self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(self)
self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self))
示例7: __init__
def __init__(self, air, zones, avId):
FSM.__init__(self, 'TutorialFSM')
self.avId = avId
self.zones = zones
self.air = air
npcDesc = NPCToons.NPCToonDict.get(20000)
self.tom = NPCToons.createNPC(self.air, 20000, npcDesc, self.zones.shop, 0)
self.tom.setTutorial(1)
npcDesc = NPCToons.NPCToonDict.get(20002)
self.harry = NPCToons.createNPC(self.air, 20002, npcDesc, self.zones.hq, 0)
self.harry.setTutorial(1)
self.building = ToontorialBuildingAI(self.air, zones.street, zones.shop, self.tom.getDoId())
self.hq = HQBuildingAI(self.air, zones.street, zones.hq, 1)
self.forceTransition('Introduction')
示例8: createFishingPonds
def createFishingPonds(self):
self.fishingPonds = []
fishingPondGroups = []
for zoneId in self.getZoneTable():
dnaData = self.air.dnaDataMap.get(zoneId, None)
if dnaData.getName() == 'root':
area = ZoneUtil.getCanonicalZoneId(zoneId)
(foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area)
self.fishingPonds.extend(foundFishingPonds)
fishingPondGroups.extend(foundFishingPondGroups)
for fishingPond in self.fishingPonds:
NPCToons.createNpcsInZone(self.air, fishingPond.zoneId)
fishingSpots = []
for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds):
fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond))
示例9: __healDance
def __healDance(heal, hasInteractivePropHealBonus):
npcId = 0
if "npcId" in heal:
npcId = heal["npcId"]
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal["toon"]
targets = heal["target"]
ineffective = heal["sidestep"]
level = heal["level"]
if npcId != 0:
track = Sequence(MovieNPCSOS.teleportIn(heal, toon))
else:
track = Sequence(__runToHealSpot(heal))
delay = 3.0
first = 1
targetTrack = Sequence()
for target in targets:
targetToon = target["toon"]
hp = target["hp"]
reactIval = Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus)
if first:
targetTrack.append(Wait(delay))
first = 0
targetTrack.append(reactIval)
hat = globalPropPool.getProp("hat")
hat2 = MovieUtil.copyProp(hat)
hats = [hat, hat2]
cane = globalPropPool.getProp("cane")
cane2 = MovieUtil.copyProp(cane)
canes = [cane, cane2]
leftHands = toon.getLeftHands()
rightHands = toon.getRightHands()
dScale = 0.5
propTrack = Sequence(
Func(MovieUtil.showProps, hats, rightHands, Point3(0.23, 0.09, 0.69), Point3(180, 0, 0)),
Func(MovieUtil.showProps, canes, leftHands, Point3(-0.28, 0.0, 0.14), Point3(0.0, 0.0, -150.0)),
MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_NEARZERO, MovieUtil.PNT3_ONE),
Wait(toon.getDuration("happy-dance") - 2.0 * dScale),
MovieUtil.getScaleIntervals(hats + canes, dScale, MovieUtil.PNT3_ONE, MovieUtil.PNT3_NEARZERO),
Func(MovieUtil.removeProps, hats + canes),
)
mtrack = Parallel(
propTrack, ActorInterval(toon, "happy-dance"), __getSoundTrack(level, 0.2, duration=6.4, node=toon), targetTrack
)
track.append(Func(toon.loop, "neutral"))
track.append(Wait(0.1))
track.append(mtrack)
if npcId != 0:
track.append(MovieNPCSOS.teleportOut(heal, toon))
else:
track.append(__returnToBase(heal))
for target in targets:
targetToon = target["toon"]
track.append(Func(targetToon.clearChat))
return track
示例10: load
def load(self):
SafeZoneLoader.SafeZoneLoader.load(self)
self.seagullSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_Seagull.ogg')
self.underwaterSound = base.loadSfx('phase_4/audio/sfx/AV_ambient_water.ogg')
self.swimSound = base.loadSfx('phase_4/audio/sfx/AV_swim_single_stroke.ogg')
self.submergeSound = base.loadSfx('phase_5.5/audio/sfx/AV_jump_in_water.ogg')
self.boat = self.geom.find('**/donalds_boat')
self.dockSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_dockcreak.ogg')
self.foghornSound = base.loadSfx('phase_5/audio/sfx/SZ_DD_foghorn.ogg')
self.bellSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_shipbell.ogg')
self.waterSound = base.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.ogg')
if not self.boat.isEmpty():
wheel = self.boat.find('**/wheel')
if not wheel.isEmpty():
wheel.hide()
self.boat.stash()
self.donald = NPCToons.createLocalNPC(7011)
self.donald.setPos(0, -1, 3.95)
self.donald.reparentTo(self.boat)
self.donald.setHat(48, 0, 0)
random.shuffle(TTLocalizer.DonaldChatter)
self.donaldSpeech = self.donald.createTalkSequence(TTLocalizer.DonaldChatter, 15)
self.donaldSpeech.loop(0)
示例11: findToonAttack
def findToonAttack(toons, attacks, track):
foundAttacks = []
for t in toons:
if attacks.has_key(t):
attack = attacks[t]
local_track = attack[TOON_TRACK_COL]
if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
if local_track == track:
if local_track == FIRE:
canFire = 1
for attackCheck in foundAttacks:
if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
canFire = 0
if canFire:
foundAttacks.append(attack)
else:
foundAttacks.append(attack)
def compFunc(a, b):
if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
return 1
elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
return -1
return 0
foundAttacks.sort(compFunc)
return foundAttacks
示例12: setup
def setup(self, blockNumber):
self.kartShopInterior = DistributedKartShopInteriorAI(
blockNumber, self.air, self.interiorZone)
self.kartShopInterior.generateWithRequired(self.interiorZone)
self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)
self.outsideDoor0 = DistributedDoorAI(
self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=1)
self.outsideDoor1 = DistributedDoorAI(
self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=2)
self.insideDoor0 = DistributedDoorAI(
self.air, blockNumber, DoorTypes.INT_KS, doorIndex=1)
self.insideDoor1 = DistributedDoorAI(
self.air, blockNumber, DoorTypes.INT_KS, doorIndex=2)
self.outsideDoor0.setOtherDoor(self.insideDoor0)
self.outsideDoor1.setOtherDoor(self.insideDoor1)
self.insideDoor0.setOtherDoor(self.outsideDoor0)
self.insideDoor1.setOtherDoor(self.outsideDoor1)
self.outsideDoor0.zoneId = self.exteriorZone
self.outsideDoor1.zoneId = self.exteriorZone
self.insideDoor0.zoneId = self.interiorZone
self.insideDoor1.zoneId = self.interiorZone
self.outsideDoor0.generateWithRequired(self.exteriorZone)
self.outsideDoor1.generateWithRequired(self.exteriorZone)
self.insideDoor0.generateWithRequired(self.interiorZone)
self.insideDoor1.generateWithRequired(self.interiorZone)
self.outsideDoor0.sendUpdate('setDoorIndex', [self.outsideDoor0.getDoorIndex()])
self.outsideDoor1.sendUpdate('setDoorIndex', [self.outsideDoor1.getDoorIndex()])
self.insideDoor0.sendUpdate('setDoorIndex', [self.insideDoor0.getDoorIndex()])
self.insideDoor1.sendUpdate('setDoorIndex', [self.insideDoor1.getDoorIndex()])
示例13: doNPCTeleports
def doNPCTeleports(attacks):
npcs = []
npcDatas = []
arrivals = Sequence()
departures = Parallel()
for attack in attacks:
if attack.has_key('npcId'):
npcId = attack['npcId']
npc = NPCToons.createLocalNPC(npcId)
if npc != None:
npcs.append(npc)
attack['npc'] = npc
toon = attack['toon']
battle = attack['battle']
pos = toon.getPos(battle) + offset
hpr = toon.getHpr(battle)
npcDatas.append((npc, battle, hpr))
arrival = teleportIn(attack, npc, pos=pos)
arrivals.append(arrival)
departure = teleportOut(attack, npc)
departures.append(departure)
turns = Parallel()
unturns = Parallel()
hpr = Vec3(180.0, 0, 0)
for npc in npcDatas:
turns.append(Func(npc[0].setHpr, npc[1], npc[2]))
unturns.append(Func(npc[0].setHpr, npc[1], hpr))
arrivals.append(turns)
unturns.append(departures)
return (arrivals, unturns, npcs)
示例14: startup
def startup(self):
self.createLobbyManager()
self.createLobbyElevator()
self.extDoor = self.makeCogHQDoor(self.lobbyZoneId, 0, 0, self.lobbyFADoorCode)
if simbase.config.GetBool('want-boarding-groups', True):
self.createBoardingParty()
self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
示例15: playTutorialReward_3
def playTutorialReward_3(self, value):
self.tutRewardDialog_2.cleanup()
from toontown.toon import NPCToons
def doneChat1(page, elapsed = 0):
self.track2.start()
def doneChat2(elapsed):
self.track2.pause()
self.track3.start()
def uniqueName(hook):
return 'TutorialTom-' + hook
self.tutorialTom = NPCToons.createLocalNPC(20000)
self.tutorialTom.uniqueName = uniqueName
if config.GetString('language', 'english') == 'japanese':
self.tomDialogue03 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward01.ogg')
self.tomDialogue04 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward02.ogg')
self.tomDialogue05 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward03.ogg')
self.musicVolume = config.GetFloat('tutorial-music-volume', 0.5)
else:
self.tomDialogue03 = None
self.tomDialogue04 = None
self.tomDialogue05 = None
self.musicVolume = 0.9
music = base.cr.playGame.place.loader.battleMusic
if self.questList:
self.track1 = Sequence(Wait(1.0), Func(self.rewardPanel.initQuestFrame, base.localAvatar, copy.deepcopy(base.localAvatar.quests)), Wait(1.0), Sequence(*self.questList), Wait(1.0), Func(self.rewardPanel.hide), Func(camera.setPosHpr, render, 34, 19.88, 3.48, -90, -2.36, 0), Func(base.localAvatar.animFSM.request, 'neutral'), Func(base.localAvatar.setPosHpr, 40.31, 22.0, -0.47, 150.0, 360.0, 0.0), Wait(0.5), Func(self.tutorialTom.reparentTo, render), Func(self.tutorialTom.show), Func(self.tutorialTom.setPosHpr, 40.29, 17.9, -0.47, 11.31, 0.0, 0.07), Func(self.tutorialTom.animFSM.request, 'TeleportIn'), Wait(1.517), Func(self.tutorialTom.animFSM.request, 'neutral'), Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat1), Func(self.tutorialTom.addActive), Func(music.setVolume, self.musicVolume), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward3, 0, None, [self.tomDialogue03]), name='tutorial-reward-3a')
self.track2 = Sequence(Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat2), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward4, 1, None, [self.tomDialogue04]), Func(self.tutorialTom.setPlayRate, 1.5, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.5), Func(self.tutorialTom.loop, 'right-hand'), name='tutorial-reward-3b')
self.track3 = Parallel(Sequence(Func(self.tutorialTom.setPlayRate, -1.8, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.8), Func(self.tutorialTom.animFSM.request, 'neutral'), name='tutorial-reward-3ca'), Sequence(Wait(0.5), Func(self.tutorialTom.setChatAbsolute, TTLocalizer.MovieTutorialReward5, CFSpeech | CFTimeout, self.tomDialogue05), Wait(1.0), Func(self.tutorialTom.animFSM.request, 'TeleportOut'), Wait(self.tutorialTom.getDuration('teleport')), Wait(1.0), Func(self.playTutorialReward_4, 0), name='tutorial-reward-3cb'), name='tutorial-reward-3c')
self.track1.start()
else:
self.playTutorialReward_4(0)
return