The teleport button now takes jellybeans for usage + add proper teleport coordinates for Toon Hall

This commit is contained in:
John 2015-08-29 15:24:40 +03:00
parent 64a4f9fe92
commit 6becda3f16
6 changed files with 62 additions and 17 deletions

View file

@ -755,6 +755,7 @@ dclass DistributedToon : DistributedPlayer {
requestNametagStyle(uint8) airecv ownsend;
requestFishingRod(uint8) airecv ownsend;
wipeStats() airecv ownsend;
takeMoney(int16) airecv ownsend;
};
dclass DistributedPartyGate : DistributedObject {

View file

@ -176,12 +176,13 @@ class ToonInterior(Place.Place):
def enterTeleportIn(self, requestStatus):
modelType = DistributedToonInterior.DistributedToonInterior(base.cr).getModelType(self.getZoneId())
if ZoneUtil.isHQ(self.zoneId):
if self.zoneId == ToontownGlobals.ToonHall:
base.localAvatar.setPosHpr(-63.5, 30.5, ToontownGlobals.FloorOffset, 90.0, 0.0, 0.0)
elif ZoneUtil.isHQ(self.zoneId):
base.localAvatar.setPosHpr(-5.5, -1.5, ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0)
elif ZoneUtil.isPetshop(self.zoneId):
base.localAvatar.setPosHpr(0, 0, ToontownGlobals.FloorOffset, 45.0, 0.0, 0.0)
else:
if modelType in InteriorTypes:
elif modelType in InteriorTypes:
area = InteriorTypes[modelType]
base.localAvatar.setPosHpr(area[0], area[1], ToontownGlobals.FloorOffset, area[2], 0.0, 0.0)
else:

View file

@ -73,12 +73,19 @@ class QuestPoster(DirectFrame):
self.teleportButton = DirectButton(parent=self.questFrame, relief=None, image=circleModel, text=TTLocalizer.TeleportButton, text_scale=0.035, text_pos=(-0.0025, -0.015), pos=(0.175, 0, 0.125), scale=0.75) #, text_bg=(0, 0.75, 1, 1)
self.teleportButton.hide()
self.laffMeter = None
return
self.dialog = None
def destroy(self):
self._deleteGeoms()
self.destroyDialog()
DirectFrame.destroy(self)
def destroyDialog(self, extra=None):
if self.dialog:
self.dialog.destroy()
self.dialog = None
base.cr.playGame.getPlace().setState('walk')
def _deleteGeoms(self):
for icon in (self.lQuestIcon, self.rQuestIcon):
geom = icon['geom']
@ -153,11 +160,7 @@ class QuestPoster(DirectFrame):
def loadElevator(self, building, numFloors):
elevatorNodePath = hidden.attachNewNode('elevatorNodePath')
elevatorModel = loader.loadModel('phase_4/models/modules/elevator')
floorIndicator = [None,
None,
None,
None,
None]
floorIndicator = [None] * 5
npc = elevatorModel.findAllMatches('**/floor_light_?;+s')
for i in xrange(npc.getNumPaths()):
np = npc.getPath(i)
@ -174,6 +177,9 @@ class QuestPoster(DirectFrame):
elevatorNodePath.setPosHpr(0, 0, 0, 0, 0, 0)
def teleportToShop(self, npcId):
if base.cr.playGame.getPlace().getState() != 'walk':
return
npcZone = NPCToons.getNPCZone(npcId)
npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
hqZone = {2000:2520, 1000:1507, 3000:3508, 4000:4504, 5000:5502, 7000:7503, 9000:9505}
@ -185,14 +191,31 @@ class QuestPoster(DirectFrame):
npcHood = ZoneUtil.getCanonicalHoodId(zoneId)
npcZone = hqZone.get(npcHood, 2520)
base.cr.buildingQueryMgr.d_isSuit(npcZone, lambda isSuit: self.teleportToShopCallback(npcZone, npcHood, isSuit))
cost = ToontownGlobals.getTeleportButtonCost(npcHood)
self.destroyDialog()
base.cr.playGame.getPlace().setState('stopped')
def teleportToShopCallback(self, npcZone, npcHood, flag):
if base.localAvatar.getTotalMoney() < cost:
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TeleportButtonNoMoney % cost, command=self.destroyDialog)
else:
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.TeleportButtonConfirm % cost, command=lambda value: self.teleportToShopConfirm(npcZone, npcHood, cost, value))
self.dialog.show()
def teleportToShopConfirm(self, npcZone, npcHood, cost, value):
self.destroyDialog()
if value > 0:
base.cr.buildingQueryMgr.d_isSuit(npcZone, lambda isSuit: self.teleportToShopCallback(npcZone, npcHood, cost, isSuit))
def teleportToShopCallback(self, npcZone, npcHood, cost, flag):
if flag:
self.teleportButton.setColorScale(0.3, 0.3, 0.3, 1.0)
base.cr.playGame.getPlace().setState('stopped')
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TeleportButtonTakenOver, command=self.destroyDialog)
self.dialog.show()
return
self.teleportButton.setColorScale(1.0, 1.0, 1.0, 1.0)
base.localAvatar.takeMoney(cost)
base.cr.playGame.getPlace().requestTeleport(npcHood, npcZone, base.localAvatar.defaultShard, -1)
def fitGeometry(self, geom, fFlip = 0, dimension = 0.8):
@ -228,6 +251,7 @@ class QuestPoster(DirectFrame):
self.rPictureFrame.hide()
self.questProgress.hide()
self.teleportButton.hide()
self.destroyDialog()
if hasattr(self, 'chooseButton'):
self.chooseButton.destroy()
del self.chooseButton

View file

@ -1259,6 +1259,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def getTotalMoney(self):
return self.getBankMoney() + self.getMoney()
def takeMoney(self, money):
self.sendUpdate('takeMoney', [money])
def setEmblems(self, emblems):
if self.emblems != emblems:
self.emblems = emblems

View file

@ -8727,6 +8727,9 @@ ShardPageShardTitle = '%s Population: %s'
ShardPageTeleport = 'Teleport to\n%s'
TeleportButton = 'Teleport'
TeleportButtonNoMoney = 'Sorry, but you need %s jellybeans to teleport!'
TeleportButtonConfirm = 'Would you like to spend %s jellybeans to teleport?'
TeleportButtonTakenOver = 'Sorry, but this shop has been taken over by the Cogs!'
BattleCogPopup = '\x01androidGreen\x01Group attacks:\x02\n%s\n\n\x01androidGreen\x01Regular attacks:\x02\n%s'
BattleCogPopupAttack = '%s %s HP'

View file

@ -1689,3 +1689,16 @@ COLOR_SATURATION_MIN = 0.5
COLOR_SATURATION_MAX = 0.8
COLOR_VALUE_MIN = 0.5
COLOR_VALUE_MAX = 0.8
TELEPORT_BUTTON_DEFAULT_COST = 50
TELEPORT_BUTTON_COSTS = {
ToontownCentral: 5,
DonaldsDock: 15,
DaisyGardens: 30,
MinniesMelodyland: 45,
TheBrrrgh: 60,
DonaldsDreamland: 75
}
def getTeleportButtonCost(hoodId):
return TELEPORT_BUTTON_COSTS.get(hoodId, TELEPORT_BUTTON_DEFAULT_COST)