Easy Promotion Papers

This commit is contained in:
Loudrob 2015-07-17 14:01:50 -04:00
parent 98347f5b7f
commit c76b2ca2c8
5 changed files with 102 additions and 13 deletions

View file

@ -741,6 +741,7 @@ dclass DistributedToon : DistributedPlayer {
setEmblems(uint32[] = [0, 0]) required ownrecv db;
setTrueFriends(uint32[] = []) required clsend ownrecv db;
setNextKnockHeal(uint32) ram airecv;
setEPP(uint8[] = []) required ownrecv db;
};
dclass DistributedPartyGate : DistributedObject {

View file

@ -19,6 +19,10 @@ sys.path.append(
)
import argparse
import gc
# Panda3D 1.10.0 is 63.
gc.disable()
parser = argparse.ArgumentParser()
parser.add_argument('--base-channel', help='The base channel that the server may use.')
@ -58,6 +62,8 @@ if ':' in host:
port = int(port)
simbase.air.connect(host, port)
gc.enable()
try:
run()
except SystemExit:

View file

@ -1675,6 +1675,7 @@ class PhoneQuest(Quest):
def getObjectiveStrings(self):
return [TTLocalizer.QuestsPhoneQuestString]
DefaultDialog = {GREETING: DefaultGreeting,
QUEST: DefaultQuest,
@ -4007,6 +4008,27 @@ class BuffReward(Reward):
def getPosterString(self):
return TTLocalizer.getBuffPosterString(self.getBuffId())
class EPPReward(Reward):
trackNames = [TTLocalizer.Bossbot,
TTLocalizer.Lawbot,
TTLocalizer.Cashbot,
TTLocalizer.Sellbot]
def sendRewardAI(self, av):
av.addEPP(self.reward[0])
def countReward(self, qrc):
pass
def getCogTrackName(self):
return EPPReward.trackNames[self.reward[0]]
def getString(self):
return TTLocalizer.QuestsEPPReward % self.getCogTrackName()
def getPosterString(self):
return TTLocalizer.QuestsEPPRewardPoster % self.getCogTrackName()
def getRewardClass(id):
reward = RewardDict.get(id)
@ -4401,7 +4423,11 @@ RewardDict = {
3001: (BuffReward, ToontownGlobals.BMovementSpeed, 30),
3002: (BuffReward, ToontownGlobals.BMovementSpeed, 60),
3003: (BuffReward, ToontownGlobals.BMovementSpeed, 180),
3004: (BuffReward, ToontownGlobals.BMovementSpeed, 360)
3004: (BuffReward, ToontownGlobals.BMovementSpeed, 360),
10000: (EPPReward, 0), # Bossbot
10001: (EPPReward, 1), # Lawbot
10002: (EPPReward, 2), # Cashbot
10003: (EPPReward, 3), # Sellbot
}

View file

@ -160,6 +160,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.trueFriends = []
self.fishBingoTutorialDone = False
self.nextKnockHeal = 0
self.epp = []
def generate(self):
DistributedPlayerAI.DistributedPlayerAI.generate(self)
@ -1262,20 +1263,27 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
return self.cogMerits
def b_promote(self, dept):
self.promote(dept)
self.d_promote(dept)
def promote(self, dept):
if self.cogLevels[dept] < ToontownGlobals.MaxCogSuitLevel:
self.cogMerits[dept] = 0
oldMerits = CogDisguiseGlobals.getTotalMerits(self, dept)
self.incCogLevel(dept)
def d_promote(self, dept):
merits = self.getCogMerits()
if self.cogLevels[dept] < ToontownGlobals.MaxCogSuitLevel:
merits[dept] = 0
self.d_setCogMerits(merits)
merits = self.getCogMerits()
if not self.hasEPP(dept):
merits[dept] = 0
else:
# If we have EPP, check if the merit count is too much (i.e. enough to promote again)
if oldMerits >= CogDisguiseGlobals.getTotalMerits(self, dept):
# We have more merits than needed (i.e. promoting to another cog or earning laff)
# Therefore:
merits[dept] = 0
else:
merits[dept] = oldMerits
self.d_setCogMerits(merits)
def readyForPromotion(self, dept):
merits = self.cogMerits[dept]
totalMerits = CogDisguiseGlobals.getTotalMerits(self, dept)
@ -4037,6 +4045,29 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def getNextKnockHeal(self):
return self.nextKnockHeal
def setEPP(self, epp):
self.epp = epp
def d_setEPP(self, epp):
self.sendUpdate("setEPP", [epp])
def b_setEPP(self, epp):
self.setEPP(epp)
self.d_setEPP(epp)
def addEPP(self, dept):
self.epp.append(dept)
self.d_setEPP(self.epp)
def removeEPP(self, dept):
if dept in self.epp:
self.epp.remove(dept)
self.d_setEPP(self.epp)
def hasEPP(self, dept):
return dept in self.epp
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int])
def cheesyEffect(value, hood=0, expire=0):
"""
@ -4904,3 +4935,26 @@ def canSkill(skill):
"""
av = spellbook.getTarget()
av.b_setWateringCanSkill(skill)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int, str])
def epp(dept, command="add"):
av = spellbook.getTarget()
if command == "add":
av.addEPP(dept)
elif command == "remove":
av.removeEPP(dept)
elif command == "get":
if dept == -1:
return av.epp
return av.hasEPP(dept)
else:
return "Unknown command!"
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def promote(dept):
spellbook.getTarget().b_promote(dept)

View file

@ -398,6 +398,8 @@ TIPQuestsClothingTicketRewardPoster = 'Reward: TIP Clothing Ticket'
QuestsCheesyEffectRewardPoster = 'Reward: %s'
QuestsCogSuitPartReward = 'You now have a %(cogTrack)s %(part)s Cog Suit Part.'
QuestsCogSuitPartRewardPoster = 'Reward: %(cogTrack)s %(part)s Part'
QuestsEPPReward = 'You now have %s Easy Promotion Papers.'
QuestsEPPRewardPoster = 'Reward: %s Easy Promotion Papers'
QuestsStreetLocationThisPlayground = 'in this playground'
QuestsStreetLocationThisStreet = 'on this street'
QuestsStreetLocationNamedPlayground = 'in the %s playground'