mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Laff Restock NPC (isn't anywhere in the game yet)
This commit is contained in:
parent
3e61bc9501
commit
cbf82d4a5d
8 changed files with 115 additions and 6 deletions
|
@ -338,6 +338,7 @@ from toontown.toon import DistributedNPCPartyPerson/AI
|
|||
from toontown.toon import DistributedNPCPetclerk/AI
|
||||
from toontown.toon import DistributedNPCKartClerk/AI
|
||||
from toontown.toon import DistributedNPCGlove/AI
|
||||
from toontown.toon import DistributedNPCLaffRestock/AI
|
||||
from toontown.building import DistributedKnockKnockDoor/AI
|
||||
from toontown.building import DistributedElevator/AI
|
||||
from toontown.building import DistributedElevatorFSM/AI
|
||||
|
@ -1961,6 +1962,11 @@ dclass DistributedNPCGlove : DistributedNPCToonBase {
|
|||
requestTransformation(uint32) airecv clsend;
|
||||
};
|
||||
|
||||
dclass DistributedNPCLaffRestock : DistributedNPCToonBase {
|
||||
restock() airecv clsend;
|
||||
restockResult(int8, int16);
|
||||
};
|
||||
|
||||
dclass DistributedKnockKnockDoor : DistributedAnimatedProp {
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from pandac.PandaModules import *
|
||||
|
||||
|
||||
hashVal = 3970808174L
|
||||
hashVal = 3008682321L
|
||||
|
||||
|
||||
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
|
||||
|
@ -34,7 +34,7 @@ from toontown.cogdominium import DistributedCogdoInterior, DistributedCogdoBattl
|
|||
from toontown.uberdog.ARGManager import ARGManager
|
||||
from otp.distributed import Account, DistributedDistrict, DistributedDirectory
|
||||
from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedTreasureChest, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor
|
||||
from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove
|
||||
from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove, DistributedNPCLaffRestock
|
||||
from toontown.tutorial import DistributedBattleTutorial, TutorialManager
|
||||
from toontown.pets import DistributedPetProxy
|
||||
from toontown.coderedemption.TTCodeRedemptionMgr import TTCodeRedemptionMgr
|
||||
|
|
63
toontown/toon/DistributedNPCLaffRestock.py
Normal file
63
toontown/toon/DistributedNPCLaffRestock.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
from toontown.chat.ChatGlobals import CFSpeech, CFTimeout
|
||||
from toontown.toonbase import TTLocalizer, ToontownGlobals
|
||||
from toontown.toontowngui import TTDialog
|
||||
from DistributedNPCToonBase import DistributedNPCToonBase
|
||||
import LaffRestockGlobals
|
||||
|
||||
class DistributedNPCLaffRestock(DistributedNPCToonBase):
|
||||
|
||||
def __init__(self, cr):
|
||||
DistributedNPCToonBase.__init__(self, cr)
|
||||
|
||||
def disable(self):
|
||||
self.ignoreAll()
|
||||
self.destroyDialog()
|
||||
DistributedNPCToonBase.disable(self)
|
||||
|
||||
def destroyDialog(self):
|
||||
if hasattr(self, 'dialog'):
|
||||
self.dialog.cleanup()
|
||||
del self.dialog
|
||||
|
||||
def getCollSphereRadius(self):
|
||||
return 1.0
|
||||
|
||||
def handleCollisionSphereEnter(self, collEntry):
|
||||
laff = base.localAvatar.getMaxHp() - base.localAvatar.getHp()
|
||||
|
||||
if laff <= 0:
|
||||
self.setChatAbsolute(TTLocalizer.RestockFullLaffMessage, CFSpeech|CFTimeout)
|
||||
return
|
||||
|
||||
cost = laff * ToontownGlobals.CostPerLaffRestock
|
||||
|
||||
if cost > base.localAvatar.getTotalMoney():
|
||||
self.setChatAbsolute(TTLocalizer.RestockNoMoneyMessage % cost, CFSpeech|CFTimeout)
|
||||
return
|
||||
|
||||
base.cr.playGame.getPlace().setState('stopped')
|
||||
base.setCellsActive(base.bottomCells, 0)
|
||||
|
||||
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.RestockAskMessage % (laff, cost), command=self.confirmRestock)
|
||||
self.dialog.show()
|
||||
|
||||
def confirmRestock(self, value):
|
||||
base.cr.playGame.getPlace().setState('walk')
|
||||
base.setCellsActive(base.bottomCells, 1)
|
||||
|
||||
if value > 0:
|
||||
self.sendUpdate('restock')
|
||||
else:
|
||||
self.setChatAbsolute(TTLocalizer.RestockLaffCancelMessage, CFSpeech|CFTimeout)
|
||||
|
||||
self.destroyDialog()
|
||||
|
||||
def restockResult(self, state, cost):
|
||||
if state == LaffRestockGlobals.NO_LAFF:
|
||||
message = TTLocalizer.RestockFullLaffMessage
|
||||
elif state == LaffRestockGlobals.NO_MONEY:
|
||||
message = TTLocalizer.RestockNoMoneyMessage % cost
|
||||
else:
|
||||
message = TTLocalizer.RestockLaffMessage
|
||||
|
||||
self.setChatAbsolute(message, CFSpeech|CFTimeout)
|
27
toontown/toon/DistributedNPCLaffRestockAI.py
Normal file
27
toontown/toon/DistributedNPCLaffRestockAI.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
import LaffRestockGlobals, DistributedNPCToonBaseAI
|
||||
|
||||
class DistributedNPCLaffRestockAI(DistributedNPCToonBaseAI.DistributedNPCToonBaseAI):
|
||||
|
||||
def restock(self):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
av = self.air.doId2do.get(avId)
|
||||
|
||||
if not av:
|
||||
return
|
||||
|
||||
laff = av.getMaxHp() - av.getHp()
|
||||
|
||||
if laff <= 0:
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_LAFF, 0])
|
||||
return
|
||||
|
||||
cost = laff * ToontownGlobals.CostPerLaffRestock
|
||||
|
||||
if cost > av.getTotalMoney():
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.NO_MONEY, cost])
|
||||
return
|
||||
|
||||
av.takeMoney(cost)
|
||||
av.b_setHp(av.getMaxHp())
|
||||
self.sendUpdateToAvatarId(avId, 'restockResult', [LaffRestockGlobals.SUCCESS, 0])
|
3
toontown/toon/LaffRestockGlobals.py
Normal file
3
toontown/toon/LaffRestockGlobals.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
NO_LAFF = 0
|
||||
NO_MONEY = 1
|
||||
SUCCESS = 2
|
|
@ -66,8 +66,9 @@ NPC_PARTYPERSON = 8
|
|||
NPC_SPECIALQUESTGIVER = 9
|
||||
NPC_FLIPPYTOONHALL = 10
|
||||
NPC_SCIENTIST = 11
|
||||
NPC_SMART = 13
|
||||
NPC_GLOVE = 14
|
||||
NPC_SMART = 12
|
||||
NPC_GLOVE = 13
|
||||
NPC_LAFF_RESTOCK = 14
|
||||
CLERK_COUNTDOWN_TIME = 120
|
||||
TAILOR_COUNTDOWN_TIME = 300
|
||||
|
||||
|
@ -90,6 +91,7 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
|
|||
import DistributedNPCScientistAI
|
||||
import DistributedSmartNPCAI
|
||||
import DistributedNPCGloveAI
|
||||
import DistributedNPCLaffRestockAI
|
||||
canonicalZoneId, name, dnaType, gender, protected, type = desc
|
||||
if type == NPC_REGULAR:
|
||||
npc = DistributedNPCToonAI.DistributedNPCToonAI(air, npcId, questCallback=questCallback)
|
||||
|
@ -119,6 +121,8 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
|
|||
npc = DistributedSmartNPCAI.DistributedSmartNPCAI(air, npcId)
|
||||
elif type == NPC_GLOVE and simbase.air.wantGloveNpc:
|
||||
npc = DistributedNPCGloveAI.DistributedNPCGloveAI(air, npcId)
|
||||
elif type == NPC_LAFF_RESTOCK:
|
||||
npc = DistributedNPCLaffRestockAI.DistributedNPCLaffRestockAI(air, npcId)
|
||||
else:
|
||||
print 'createNPC() error!!!'
|
||||
npc.setName(name)
|
||||
|
|
|
@ -8438,4 +8438,9 @@ DonaldChatter = ["I'm glad you're here today!",
|
|||
'I like what you are wearing.',
|
||||
'I love to play tag. Do you?']
|
||||
NPCFriendUnavailable = 'Unavailable'
|
||||
FireTalkMessage = "You're fired!"
|
||||
FireTalkMessage = "You're fired!"
|
||||
RestockFullLaffMessage = "Sorry, but you're already happy!"
|
||||
RestockNoMoneyMessage = "Sorry, but you need %s jellybeans to restock your laff!"
|
||||
RestockAskMessage = "Would you like to restock %s laff for %s jellybeans?"
|
||||
RestockLaffMessage = "Enjoy your happiness!"
|
||||
RestockLaffCancelMessage = "Alright. Come back here if you change your mind."
|
|
@ -1637,4 +1637,5 @@ PropIdToColor = [
|
|||
]
|
||||
|
||||
BugReportSite = 'https://bugs.launchpad.net/toontown-united/+filebug'
|
||||
TreasureChestSphereRadius = 1.0
|
||||
TreasureChestSphereRadius = 1.0
|
||||
CostPerLaffRestock = 3
|
Loading…
Reference in a new issue