本文整理汇总了Python中toontown.toon.NPCToons.getNPCName方法的典型用法代码示例。如果您正苦于以下问题:Python NPCToons.getNPCName方法的具体用法?Python NPCToons.getNPCName怎么用?Python NPCToons.getNPCName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toon.NPCToons
的用法示例。
在下文中一共展示了NPCToons.getNPCName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cogSummonsDone
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def cogSummonsDone(self, returnCode, suitIndex, buildingId):
self.cancel['state'] = DGG.NORMAL
if self.summonsType == 'single':
if returnCode == 'success':
self.statusLabel['text'] = TTL.SummonDlgSingleSuccess
elif returnCode == 'badlocation':
self.statusLabel['text'] = TTL.SummonDlgSingleBadLoc
elif returnCode == 'fail':
self.statusLabel['text'] = TTL.SummonDlgInvasionFail
elif self.summonsType == 'building':
if returnCode == 'success':
building = base.cr.doId2do.get(buildingId)
dnaStore = base.cr.playGame.dnaStore
buildingTitle = dnaStore.getTitleFromBlockNumber(building.block)
buildingInteriorZone = building.zoneId + 500 + building.block
npcName = TTLocalizer.SummonDlgShopkeeper
npcId = NPCToons.zone2NpcDict.get(buildingInteriorZone)
if npcId:
npcName = NPCToons.getNPCName(npcId[0])
if buildingTitle:
self.statusLabel['text'] = TTL.SummonDlgBldgSuccess % (npcName, buildingTitle)
else:
self.statusLabel['text'] = TTL.SummonDlgBldgSuccess2
elif returnCode == 'badlocation':
self.statusLabel['text'] = TTL.SummonDlgBldgBadLoc
elif returnCode == 'fail':
self.statusLabel['text'] = TTL.SummonDlgInvasionFail
elif self.summonsType == 'invasion':
if returnCode == 'success':
self.statusLabel['text'] = TTL.SummonDlgInvasionSuccess
elif returnCode == 'busy':
self.statusLabel['text'] = TTL.SummonDlgInvasionBusy % self.suitFullName
elif returnCode == 'fail':
self.statusLabel['text'] = TTL.SummonDlgInvasionFail
示例2: cogSummonsDone
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def cogSummonsDone(self, returnCode, suitIndex, buildingId):
self.cancel["state"] = DGG.NORMAL
if self.summonsType == "single":
if returnCode == "success":
self.statusLabel["text"] = TTL.SummonDlgSingleSuccess
elif returnCode == "badlocation":
self.statusLabel["text"] = TTL.SummonDlgSingleBadLoc
elif returnCode == "fail":
self.statusLabel["text"] = TTL.SummonDlgInvasionFail
elif self.summonsType == "building":
if returnCode == "success":
building = base.cr.doId2do.get(buildingId)
buildingTitle = base.cr.playGame.dnaData.getBlock(building.block).title
buildingInteriorZone = building.zoneId + 500 + building.block
npcName = TTLocalizer.SummonDlgShopkeeper
npcId = NPCToons.zone2NpcDict.get(buildingInteriorZone)
if npcId:
npcName = NPCToons.getNPCName(npcId[0])
if buildingTitle:
self.statusLabel["text"] = TTL.SummonDlgBldgSuccess % (npcName, buildingTitle)
else:
self.statusLabel["text"] = TTL.SummonDlgBldgSuccess2
elif returnCode == "badlocation":
self.statusLabel["text"] = TTL.SummonDlgBldgBadLoc
elif returnCode == "fail":
self.statusLabel["text"] = TTL.SummonDlgInvasionFail
elif self.summonsType == "invasion":
if returnCode == "success":
self.statusLabel["text"] = TTL.SummonDlgInvasionSuccess
elif returnCode == "busy":
self.statusLabel["text"] = TTL.SummonDlgInvasionBusy % self.suitFullName
elif returnCode == "fail":
self.statusLabel["text"] = TTL.SummonDlgInvasionFail
示例3: setVictors
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def setVictors(self, victorIds):
DistributedFactoryAI.setVictors(self, victorIds)
activeVictors = [self.air.doId2do.get(victorId) for victorId in victorIds if self.air.doId2do.get(victorId) is not None]
npcId = random.choice(self.POSSIBLE_SOS)
npcName = NPCToons.getNPCName(npcId)
for victor in activeVictors:
victor.attemptAddNPCFriend(npcId)
victor.d_setSystemMessage(0, 'You got a %s SOS card.' % npcName)
示例4: setVictors
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
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: decodeTTSCToontaskMsg
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def decodeTTSCToontaskMsg(taskId, toNpcId, toonProgress, msgIndex):
q = Quests.getQuest(taskId)
if q is None:
return
name = NPCToons.getNPCName(toNpcId)
if name is None:
return
msgs = q.getSCStrings(toNpcId, toonProgress)
if type(msgs) != type([]):
msgs = [msgs]
if msgIndex >= len(msgs):
return
return msgs[msgIndex]
示例6: update
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def update(self, questDesc):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
quest = Quests.getQuest(questId)
if quest == None:
self.notify.warning('Tried to display poster for unknown quest %s' % questId)
return
if rewardId == Quests.NA:
finalReward = Quests.getFinalRewardId(questId, fAll=1)
transformedReward = Quests.transformReward(finalReward, base.localAvatar)
reward = Quests.getReward(transformedReward)
else:
reward = Quests.getReward(rewardId)
if reward and questId not in Quests.NoRewardTierZeroQuests:
rewardString = reward.getPosterString()
else:
rewardString = ''
self.rewardText['text'] = rewardString
self.fitLabel(self.rewardText)
if Quests.isQuestJustForFun(questId, rewardId):
self.funQuest.show()
else:
self.funQuest.hide()
if self._deleteCallback:
self.showDeleteButton(questDesc)
else:
self.hideDeleteButton()
fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE
if Quests.isQuestJustForFun(questId, rewardId):
if fComplete:
self.funQuest.hide()
if toNpcId == Quests.ToonHQ:
toNpcName = TTLocalizer.QuestPosterHQOfficer
toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
elif toNpcId == Quests.ToonTailor:
toNpcName = TTLocalizer.QuestPosterTailor
toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
else:
toNpcName = NPCToons.getNPCName(toNpcId)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
lPos = Vec3(0, 0, 0.13)
lIconGeom = None
lIconGeomScale = 1
rIconGeom = None
rIconGeomScale = 1
infoText = ''
infoZ = TTLocalizer.QPinfoZ
auxText = None
auxTextPos = Vec3(0, 0, 0.12)
headlineString = quest.getHeadlineString()
objectiveStrings = quest.getObjectiveStrings()
captions = map(lambda x: str(x).title(), quest.getObjectiveStrings())
imageColor = Vec4(*self.colors['white'])
if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
frameBgColor = 'red'
if quest.getType() == Quests.DeliverGagQuest:
invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
track, item = quest.getGagType()
lIconGeom = invModel.find('**/' + AvPropsNew[track][item])
invModel.removeNode()
else:
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/package')
lIconGeomScale = 0.12
bookModel.removeNode()
if not fComplete:
captions.append(toNpcName)
auxText = TTLocalizer.QuestPosterAuxTo
auxTextPos.setZ(0.12)
lPos.setX(-0.18)
infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
rIconGeom = self.createNpcToonHead(toNpcId)
rIconGeomScale = IMAGE_SCALE_SMALL
elif quest.getType() == Quests.RecoverItemQuest:
frameBgColor = 'green'
bookModel = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
lIconGeom = bookModel.find('**/package')
lIconGeomScale = 0.12
bookModel.removeNode()
if not fComplete:
rIconGeomScale = IMAGE_SCALE_SMALL
#.........这里部分代码省略.........
示例7: setSOSNpcId
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def setSOSNpcId(self, npcId):
self.SOSToonName = NPCToons.getNPCName(npcId)
示例8: setValues
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def setValues(self, index, track, level = None, numTargets = None, targetIndex = None, localNum = None):
self.notify.debug('Toon Panel setValues: index=%s track=%s level=%s numTargets=%s targetIndex=%s localNum=%s' % (index,
track,
level,
numTargets,
targetIndex,
localNum))
self.undecidedText.hide()
self.sosText.hide()
self.fireText.hide()
self.gagNode.hide()
self.whichText.hide()
self.passNode.hide()
self.cleanupSosHead()
self.hoverButton.unbind(DGG.ENTER)
if self.hasGag:
self.gag.removeNode()
self.hasGag = 0
if track == BattleBase.NO_ATTACK or track == BattleBase.UN_ATTACK:
self.undecidedText.show()
elif track == BattleBase.PASS_ATTACK:
self.passNode.show()
elif track == BattleBase.FIRE:
self.fireText.show()
self.whichText.show()
self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index)
elif track == BattleBase.NPCSOS:
self.sosHead = createNPCToonHead(targetIndex)
self.sosHead.reparentTo(self)
self.sosHead.setPos(0.1, 0, 0.045)
self.sosHead.setScale(0.24)
track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(targetIndex)
sosType = self.sosTracks[track]
if track == NPC_RESTOCK_GAGS:
if level == -1:
sosType += ' All'
else:
sosType += ' ' + self.sosTracks[level]
if hp:
hpString = TTLocalizer.BattleSOSPopupHP % (TTLocalizer.BattleSOSPopupHeal if track == HEAL_TRACK else TTLocalizer.BattleSOSPopupHarm, hp)
sosType = TextEncoder.upper(sosType)
count = max(0, self.avatar.getNPCFriendCount(targetIndex) - 1)
info = TTLocalizer.BattleSOSPopup % (sosType, NPCToons.getNPCName(targetIndex), hpString if hp else '', rarity, count)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverSos, info])
elif track == BattleBase.SOS or track == BattleBase.PETSOS:
self.sosText.show()
elif track >= MIN_TRACK_INDEX and track <= MAX_TRACK_INDEX:
self.undecidedText.hide()
self.passNode.hide()
self.gagNode.show()
invButton = base.localAvatar.inventory.buttonLookup(track, level)
self.gag = invButton.instanceUnderNode(self.gagNode, 'gag')
self.gag.setScale(0.8)
self.gag.setPos(0, 0, 0.02)
self.hasGag = 1
if self.avatar:
curExp, nextExp = self.avatar.inventory.getCurAndNextExpValues(track)
organic = self.avatar.checkGagBonus(track, level)
damage = int(getAvPropDamage(track, level, curExp, organic))
numItems = max(0, self.avatar.inventory.numItem(track, level) - 1)
info = TTLocalizer.BattleGagPopup % (self.avatar.inventory.getToonupDmgStr(track, 0), damage, numItems)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverGag, info])
if self.avatar.checkGagBonus(track, level):
self.gag.setColor((1, 0, 0, 1) if track == 1 and level == 5 else (0, 1, 0, 1))
if numTargets is not None and targetIndex is not None and localNum is not None:
self.whichText.show()
self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index)
else:
self.notify.error('Bad track value: %s' % track)
示例9: update
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCName [as 别名]
def update(self, questDesc):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
quest = Quests.getQuest(questId)
if quest == None:
self.notify.warning("Tried to display poster for unknown quest %s" % questId)
return
if rewardId == Quests.NA:
finalReward = Quests.getFinalRewardId(questId, fAll=1)
transformedReward = Quests.transformReward(finalReward, base.localAvatar)
reward = Quests.getReward(transformedReward)
else:
reward = Quests.getReward(rewardId)
if reward and questId not in Quests.NoRewardTierZeroQuests:
rewardString = reward.getPosterString()
else:
rewardString = ""
self.rewardText["text"] = rewardString
self.fitLabel(self.rewardText)
if Quests.isQuestJustForFun(questId, rewardId):
self.funQuest.show()
else:
self.funQuest.hide()
if self._deleteCallback:
self.showDeleteButton(questDesc)
else:
self.hideDeleteButton()
fComplete = quest.getCompletionStatus(base.localAvatar, questDesc) == Quests.COMPLETE
if toNpcId == Quests.ToonHQ:
toNpcName = TTLocalizer.QuestPosterHQOfficer
toNpcBuildingName = TTLocalizer.QuestPosterHQBuildingName
toNpcStreetName = TTLocalizer.QuestPosterHQStreetName
toNpcLocationName = TTLocalizer.QuestPosterHQLocationName
elif toNpcId == Quests.ToonTailor:
toNpcName = TTLocalizer.QuestPosterTailor
toNpcBuildingName = TTLocalizer.QuestPosterTailorBuildingName
toNpcStreetName = TTLocalizer.QuestPosterTailorStreetName
toNpcLocationName = TTLocalizer.QuestPosterTailorLocationName
else:
toNpcName = NPCToons.getNPCName(toNpcId)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)
toNpcStreetName = ZoneUtil.getStreetName(toNpcBranchId)
lPos = Vec3(0, 0, 0.13)
lIconGeom = None
lIconGeomScale = 1
rIconGeom = None
rIconGeomScale = 1
infoText = ""
infoZ = TTLocalizer.QPinfoZ
auxText = None
auxTextPos = Vec3(0, 0, 0.12)
headlineString = quest.getHeadlineString()
objectiveStrings = quest.getObjectiveStrings()
captions = map(string.capwords, quest.getObjectiveStrings())
imageColor = Vec4(*self.colors["white"])
if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest:
frameBgColor = "red"
if quest.getType() == Quests.DeliverGagQuest:
invModel = loader.loadModel("phase_3.5/models/gui/inventory_icons")
track, item = quest.getGagType()
lIconGeom = invModel.find("**/" + AvPropsNew[track][item])
invModel.removeNode()
else:
bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
lIconGeom = bookModel.find("**/package")
lIconGeomScale = 0.12
bookModel.removeNode()
if not fComplete:
captions.append(toNpcName)
auxText = TTLocalizer.QuestPosterAuxTo
auxTextPos.setZ(0.12)
lPos.setX(-0.18)
infoText = TTLocalizer.QuestPageDestination % (toNpcBuildingName, toNpcStreetName, toNpcLocationName)
rIconGeom = self.createNpcToonHead(toNpcId)
rIconGeomScale = IMAGE_SCALE_SMALL
elif quest.getType() == Quests.RecoverItemQuest:
frameBgColor = "green"
bookModel = loader.loadModel("phase_3.5/models/gui/stickerbook_gui")
lIconGeom = bookModel.find("**/package")
lIconGeomScale = 0.12
bookModel.removeNode()
if not fComplete:
rIconGeomScale = IMAGE_SCALE_SMALL
holder = quest.getHolder()
holderType = quest.getHolderType()
if holder == Quests.Any:
cogIcons = loader.loadModel("phase_3/models/gui/cog_icons")
rIconGeom = cogIcons.find("**/cog")
cogIcons.removeNode()
lPos.setX(-0.18)
auxText = TTLocalizer.QuestPosterAuxFrom
elif holder == Quests.AnyFish:
headlineString = TTLocalizer.QuestPosterFishing
auxText = TTLocalizer.QuestPosterAuxFor
auxTextPos.setX(-0.18)
captions = captions[:1]
else:
#.........这里部分代码省略.........