More Cogdo stuff.

This commit is contained in:
Loudrob 2015-03-26 22:48:23 -04:00
parent bced66317b
commit 83b204098c
8 changed files with 78 additions and 52 deletions

0
darwin/start-game-localhost.sh Normal file → Executable file
View file

View file

@ -18,8 +18,9 @@ from toontown.distributed import DelayDelete
from toontown.toon import TTEmote
from otp.avatar import Emote
from toontown.hood import ZoneUtil
import sys
FO_DICT = {'s': 'tt_m_ara_cbe_fieldOfficeMoverShaker',
'l': 'tt_m_ara_cbe_fieldOfficeMoverShaker',
'l': 'tt_m_ara_cbe_fieldOfficeLegalEagle',
'm': 'tt_m_ara_cbe_fieldOfficeMoverShaker',
'c': 'tt_m_ara_cbe_fieldOfficeMoverShaker'}
@ -537,6 +538,8 @@ class DistributedBuilding(DistributedObject.DistributedObject):
dnaStore = self.cr.playGame.dnaStore
level = int(self.difficulty / 2) + 1
suitNP = dnaStore.findNode(FO_DICT[chr(self.track)])
if not suitNP:
suitNP = loader.loadModel('phase_5/models/cogdominium/%s' % FO_DICT[chr(self.track)])
zoneId = dnaStore.getZoneFromBlockNumber(self.block)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId)
newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId]
@ -551,7 +554,7 @@ class DistributedBuilding(DistributedObject.DistributedObject):
textNode.setFont(ToontownGlobals.getSuitFont())
textNode.setAlign(TextNode.ACenter)
textNode.setWordwrap(12.0)
textNode.setText(buildingTitle)
textNode.setText(buildingTitle.decode(sys.getdefaultencoding()))
textHeight = textNode.getHeight()
zScale = (textHeight + 2) / 3.0
signOrigin = suitBuildingNP.find('**/sign_origin;+s')
@ -562,12 +565,12 @@ class DistributedBuilding(DistributedObject.DistributedObject):
signTextNodePath = backgroundNP.attachNewNode(textNode.generate())
signTextNodePath.setPosHprScale(0.0, 0.0, -0.13 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1 * 8.0 / 20.0, 0.1, 0.1 / zScale)
signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0)
frontNP = suitBuildingNP.find('**/*_front/+GeomNode;+s')
frontNP = suitBuildingNP.find('**/*_front')
backgroundNP.wrtReparentTo(frontNP)
frontNP.node().setEffect(DecalEffect.make())
suitBuildingNP.setName('cb' + str(self.block) + ':_landmark__DNARoot')
suitBuildingNP.setPosHprScale(nodePath, 15.463, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)
suitBuildingNP.flattenMedium()
#suitBuildingNP.flattenMedium()
suitBuildingNP.setColorScale(0.6, 0.6, 0.6, 1.0)
self.loadElevator(suitBuildingNP, cogdo=True)
return suitBuildingNP

View file

@ -166,45 +166,45 @@ CLEAR_OUT_TOON_BLDG_TIME = 4
TO_SUIT_BLDG_TIME = 8
buildingMinMax = {
ToontownGlobals.SillyStreet: (config.GetInt('silly-street-building-min', 0),
config.GetInt('silly-street-building-max', 3)),
ToontownGlobals.LoopyLane: (config.GetInt('loopy-lane-building-min', 0),
config.GetInt('loopy-lane-building-max', 3)),
ToontownGlobals.PunchlinePlace: (config.GetInt('punchline-place-building-min', 0),
config.GetInt('punchline-place-building-max', 3)),
ToontownGlobals.BarnacleBoulevard: (config.GetInt('barnacle-boulevard-building-min', 1),
config.GetInt('barnacle-boulevard-building-max', 5)),
ToontownGlobals.SeaweedStreet: (config.GetInt('seaweed-street-building-min', 1),
config.GetInt('seaweed-street-building-max', 5)),
ToontownGlobals.LighthouseLane: (config.GetInt('lighthouse-lane-building-min', 1),
config.GetInt('lighthouse-lane-building-max', 5)),
ToontownGlobals.ElmStreet: (config.GetInt('elm-street-building-min', 2),
config.GetInt('elm-street-building-max', 6)),
ToontownGlobals.MapleStreet: (config.GetInt('maple-street-building-min', 2),
config.GetInt('maple-street-building-max', 6)),
ToontownGlobals.OakStreet: (config.GetInt('oak-street-building-min', 2),
config.GetInt('oak-street-building-max', 6)),
ToontownGlobals.AltoAvenue: (config.GetInt('alto-avenue-building-min', 3),
config.GetInt('alto-avenue-building-max', 7)),
ToontownGlobals.BaritoneBoulevard: (config.GetInt('baritone-boulevard-building-min', 3),
config.GetInt('baritone-boulevard-building-max', 7)),
ToontownGlobals.TenorTerrace: (config.GetInt('tenor-terrace-building-min', 3),
config.GetInt('tenor-terrace-building-max', 7)),
ToontownGlobals.WalrusWay: (config.GetInt('walrus-way-building-min', 5),
config.GetInt('walrus-way-building-max', 10)),
ToontownGlobals.SleetStreet: (config.GetInt('sleet-street-building-min', 5),
config.GetInt('sleet-street-building-max', 10)),
ToontownGlobals.PolarPlace: (config.GetInt('polar-place-building-min', 5),
config.GetInt('polar-place-building-max', 10)),
ToontownGlobals.LullabyLane: (config.GetInt('lullaby-lane-building-min', 6),
config.GetInt('lullaby-lane-building-max', 12)),
ToontownGlobals.PajamaPlace: (config.GetInt('pajama-place-building-min', 6),
config.GetInt('pajama-place-building-max', 12)),
ToontownGlobals.SellbotHQ: (0, 0),
ToontownGlobals.SellbotFactoryExt: (0, 0),
ToontownGlobals.CashbotHQ: (0, 0),
ToontownGlobals.LawbotHQ: (0, 0),
ToontownGlobals.BossbotHQ: (0, 0)
ToontownGlobals.SillyStreet: [config.GetInt('silly-street-building-min', 0),
config.GetInt('silly-street-building-max', 3)],
ToontownGlobals.LoopyLane: [config.GetInt('loopy-lane-building-min', 0),
config.GetInt('loopy-lane-building-max', 3)],
ToontownGlobals.PunchlinePlace: [config.GetInt('punchline-place-building-min', 0),
config.GetInt('punchline-place-building-max', 3)],
ToontownGlobals.BarnacleBoulevard: [config.GetInt('barnacle-boulevard-building-min', 1),
config.GetInt('barnacle-boulevard-building-max', 5)],
ToontownGlobals.SeaweedStreet: [config.GetInt('seaweed-street-building-min', 1),
config.GetInt('seaweed-street-building-max', 5)],
ToontownGlobals.LighthouseLane: [config.GetInt('lighthouse-lane-building-min', 1),
config.GetInt('lighthouse-lane-building-max', 5)],
ToontownGlobals.ElmStreet: [config.GetInt('elm-street-building-min', 2),
config.GetInt('elm-street-building-max', 6)],
ToontownGlobals.MapleStreet: [config.GetInt('maple-street-building-min', 2),
config.GetInt('maple-street-building-max', 6)],
ToontownGlobals.OakStreet: [config.GetInt('oak-street-building-min', 2),
config.GetInt('oak-street-building-max', 6)],
ToontownGlobals.AltoAvenue: [config.GetInt('alto-avenue-building-min', 3),
config.GetInt('alto-avenue-building-max', 7)],
ToontownGlobals.BaritoneBoulevard: [config.GetInt('baritone-boulevard-building-min', 3),
config.GetInt('baritone-boulevard-building-max', 7)],
ToontownGlobals.TenorTerrace: [config.GetInt('tenor-terrace-building-min', 3),
config.GetInt('tenor-terrace-building-max', 7)],
ToontownGlobals.WalrusWay: [config.GetInt('walrus-way-building-min', 5),
config.GetInt('walrus-way-building-max', 10)],
ToontownGlobals.SleetStreet: [config.GetInt('sleet-street-building-min', 5),
config.GetInt('sleet-street-building-max', 10)],
ToontownGlobals.PolarPlace: [config.GetInt('polar-place-building-min', 5),
config.GetInt('polar-place-building-max', 10)],
ToontownGlobals.LullabyLane: [config.GetInt('lullaby-lane-building-min', 6),
config.GetInt('lullaby-lane-building-max', 12)],
ToontownGlobals.PajamaPlace: [config.GetInt('pajama-place-building-min', 6),
config.GetInt('pajama-place-building-max', 12)],
ToontownGlobals.SellbotHQ: [0, 0],
ToontownGlobals.SellbotFactoryExt: [0, 0],
ToontownGlobals.CashbotHQ: [0, 0],
ToontownGlobals.LawbotHQ: [0, 0],
ToontownGlobals.BossbotHQ: [0, 0]
}
buildingChance = {

View file

@ -119,8 +119,7 @@ class DistCogdoFlyingGameAI(DistCogdoGameAI):
return self.totalMemos
from otp.ai.MagicWordGlobal import *
@magicWord(category=CATEGORY_MODERATOR)
@magicWord(category=CATEGORY_PROGRAMMER)
def endFly():
if hasattr(simbase.air, 'cogdoGame'):
game = simbase.air.cogdoGame

View file

@ -230,8 +230,7 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
self.game.handleToonDisconnected(toonId)
from otp.ai.MagicWordGlobal import *
@magicWord(category=CATEGORY_MODERATOR)
@magicWord(category=CATEGORY_PROGRAMMER)
def revealMap():
if hasattr(base.cr, 'cogdoGame'):
game = base.cr.cogdoGame

View file

@ -240,8 +240,7 @@ class DistCogdoMazeGameAI(DistCogdoGameAI):
self.removeAll()
from otp.ai.MagicWordGlobal import *
@magicWord(category=CATEGORY_MODERATOR)
@magicWord(category=CATEGORY_PROGRAMMER)
def endMaze():
if hasattr(simbase.air, 'cogdoGame'):
maze = simbase.air.cogdoGame

View file

@ -21,6 +21,12 @@ from toontown.toonbase import ToontownBattleGlobals
from toontown.toonbase import ToontownGlobals
ALLOWED_FO_TRACKS = 's'
if config.GetBool('want-lawbot-cogdo', True):
ALLOWED_FO_TRACKS += 'l'
DEFAULT_COGDO_RATIO = .5
class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlannerBase.SuitPlannerBase):
notify = directNotify.newCategory('DistributedSuitPlannerAI')
CogdoPopFactor = config.GetFloat('cogdo-pop-factor', 1.5)
@ -570,11 +576,11 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
return
building.suitTakeOver(suitTrack, difficulty, buildingHeight)
def cogdoTakeOver(self, blockNumber, difficulty, buildingHeight):
def cogdoTakeOver(self, blockNumber, difficulty, buildingHeight, dept):
if self.pendingBuildingHeights.count(buildingHeight) > 0:
self.pendingBuildingHeights.remove(buildingHeight)
building = self.buildingMgr.getBuilding(blockNumber)
building.cogdoTakeOver(difficulty, buildingHeight)
building.cogdoTakeOver(difficulty, buildingHeight, dept)
def recycleBuilding(self):
bmin = SuitBuildingGlobals.buildingMinMax[self.zoneId][0]

View file

@ -5177,3 +5177,23 @@ def immortal():
av = spellbook.getTarget() if spellbook.getInvokerAccess() >= 500 else spellbook.getInvoker()
av.setImmortalMode(not av.immortalMode)
return 'Toggled immortal mode %s for %s' % ('ON' if av.immortalMode else 'OFF', av.getName())
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int])
def summoncogdo(track="s", difficulty=5):
tracks = ['s']
if config.GetBool('want-lawbot-cogdo', True):
tracks.append('l')
if track not in tracks:
return "Invalid track!"
av = spellbook.getInvoker()
building = av.findClosestDoor()
if building == None:
return "No bldg found!"
building.cogdoTakeOver(difficulty, 2, track)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int, int])
def emblems(silver=10, gold=10):
spellbook.getTarget().addEmblems((gold, silver))