key-value: convert writeServerEvents from coghq to new format

This commit is contained in:
Aidan 2014-05-11 18:36:09 -04:00
parent dd9f9a9ab7
commit e1f94a2982
10 changed files with 56 additions and 64 deletions

View file

@ -138,7 +138,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if self.avIdDict.has_key(inviteeId):
self.notify.warning('inviter %s tried to invite %s who already exists in the avIdDict.' % (inviterId, inviteeId))
self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.air.writeServerEvent('suspicious', avId=inviterId, issue='tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.avIdDict[inviteeId] = leaderId
self.sendUpdateToAvatarId(inviteeId, 'postInvite', [leaderId, inviterId])
@ -152,7 +152,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
else:
if self.avIdDict.has_key(inviteeId):
self.notify.warning('inviter %s tried to invite %s who already exists in avIdDict.' % (inviterId, inviteeId))
self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.air.writeServerEvent('suspicious', avId=inviterId, issue='tried to invite %s who already exists in the avIdDict.' % inviteeId)
self.notify.debug('new group')
leaderId = inviterId
@ -188,7 +188,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
self.notify.debug('invitee already in group, aborting requestAcceptInvite')
return
else:
self.air.writeServerEvent('suspicious: ', inviteeId, " accepted a second invite from %s, in %s's group, while he was in alredy in %s's group." % (inviterId, leaderId, self.avIdDict[inviteeId]))
self.air.writeServerEvent('suspicious', avId=inviteeId, issue="accepted a second invite from %s, in %s's group, while he was in alredy in %s's group." % (inviterId, leaderId, self.avIdDict[inviteeId]))
self.removeFromGroup(self.avIdDict[inviteeId], inviteeId, post=0)
if len(memberList) >= self.maxSize:
self.removeFromGroup(leaderId, inviteeId)
@ -198,7 +198,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
self.sendUpdateToAvatarId(inviterId, 'postInviteAccepted', [inviteeId])
self.addToGroup(leaderId, inviteeId)
else:
self.air.writeServerEvent('suspicious: ', inviteeId, " was invited to %s's group by %s, but the invitee didn't have an entry in the avIdDict." % (leaderId, inviterId))
self.air.writeServerEvent('suspicious', avId=inviteeId, issue="was invited to %s's group by %s, but the invitee didn't have an entry in the avIdDict." % (leaderId, inviterId))
def requestRejectInvite(self, leaderId, inviterId):
inviteeId = self.air.getAvatarIdFromSender()
@ -298,7 +298,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
if avatar:
elevator.partyAvatarBoard(avatar, wantBoardingShow=1)
self.air.writeServerEvent('boarding_elevator', self.zoneId, '%s; Sending avatars %s' % (elevatorId, group[0]))
self.air.writeServerEvent('boarding_elevator', zoneId=self.zoneId, elevatorId=elevatorId, group=group[0])
else:
self.sendUpdateToAvatarId(leaderId, 'postRejectBoard', [elevatorId, boardOkay, avatarsFailingRequirements, avatarsInBattle])
return
@ -321,7 +321,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
return True
else:
self.notify.warning('avId: %s has hacked his/her client.' % leaderId)
self.air.writeServerEvent('suspicious: ', leaderId, ' pressed the GO Button while inside the elevator.')
self.air.writeServerEvent('suspicious', avId=leaderId, issue='pressed the GO Button while inside the elevator.')
else:
self.sendUpdateToAvatarId(leaderId, 'rejectGoToRequest', [elevatorId, boardOkay, avatarsFailingRequirements, avatarsInBattle])
return False
@ -351,12 +351,12 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
boardOkay, avatarsFailingRequirements, avatarsInBattle = self.testBoard(avList[0], elevatorId, needSpace=0)
if not boardOkay == BoardingPartyBase.BOARDCODE_OKAY:
for avId in avatarsFailingRequirements:
self.air.writeServerEvent('suspicious: ', avId, ' failed requirements after the second go button request.')
self.air.writeServerEvent('suspicious', avId=avId, issue='failed requirements after the second go button request.')
for avId in avatarsInBattle:
self.air.writeServerEvent('suspicious: ', avId, ' joined battle after the second go button request.')
self.air.writeServerEvent('suspicious', avId=avId, issue='joined battle after the second go button request.')
self.air.writeServerEvent('boarding_go', self.zoneId, '%s; Sending avatars %s' % (elevatorId, avList))
self.air.writeServerEvent('boarding_go', zoneId=self.zoneId, elevatorId=elevatorId, group=avList)
elevator.sendAvatarsToDestination(avList)
return Task.done
@ -461,7 +461,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi
def informDestinationInfo(self, offset):
leaderId = self.air.getAvatarIdFromSender()
if offset > len(self.elevatorIdList):
self.air.writeServerEvent('suspicious: ', leaderId, 'has requested to go to %s elevator which does not exist' % offset)
self.air.writeServerEvent('suspicious', avId=leaderId, issue='has requested to go to %s elevator which does not exist' % offset)
return
memberList = self.getGroupMemberList(leaderId)
for avId in memberList:

View file

@ -43,9 +43,8 @@ class DistributedCountryClubAI(DistributedObjectAI.DistributedObjectAI):
self.placeElevatorsOnMarkers()
if __dev__:
simbase.countryClub = self
description = '%s|%s|%s' % (self.countryClubId, self.floorNum, self.avIds)
for avId in self.avIds:
self.air.writeServerEvent('countryClubEntered', avId, description)
self.air.writeServerEvent('countryClubEntered', avId=avId, countryClubId=self.countryClubId, floorNum=self.floorNum, avIds=self.avIds)
return

View file

@ -108,9 +108,8 @@ class DistributedCountryClubRoomAI(DistributedLevelAI.DistributedLevelAI, Countr
activeVictors.append(toon)
activeVictorIds.append(victorId)
description = '%s|%s' % (self.countryClubId, activeVictorIds)
for avId in activeVictorIds:
self.air.writeServerEvent('mintDefeated', avId, description)
self.air.writeServerEvent('countryClubDefeated', avId=avId, countryClubId=self.countryClubId, victors=activeVictorIds)
return

View file

@ -55,7 +55,7 @@ class DistributedLawbotCannonAI(DistributedObjectAI.DistributedObjectAI):
self.setMovie(CannonGlobals.CANNON_MOVIE_LOAD, self.avId, cannonBallsLeft)
self.acceptOnce(self.air.getAvatarExitEvent(avId), self.__handleUnexpectedExit, extraArgs=[avId])
else:
self.air.writeServerEvent('suspicious', avId, 'DistributedCannonAI.requestEnter cannon already occupied')
self.air.writeServerEvent('suspicious', avId=avId, issue='DistributedCannonAI.requestEnter cannon already occupied')
self.notify.warning('requestEnter() - cannon already occupied')
def setMovie(self, mode, avId, extraInfo):
@ -75,7 +75,7 @@ class DistributedLawbotCannonAI(DistributedObjectAI.DistributedObjectAI):
if self.avId != 0:
self.__doExit()
else:
self.air.writeServerEvent('suspicious', avId, 'DistributedCannonAI.requestLeave cannon not occupied')
self.air.writeServerEvent('suspicious', avId=avId, issue='DistributedCannonAI.requestLeave cannon not occupied')
self.notify.warning('requestLeave() - cannon not occupied')
def setCannonPosition(self, zRot, angle):

View file

@ -33,9 +33,8 @@ class DistributedMintAI(DistributedObjectAI.DistributedObjectAI):
self.sendUpdate('setRoomDoIds', [roomDoIds])
if __dev__:
simbase.mint = self
description = '%s|%s|%s' % (self.mintId, self.floorNum, self.avIds)
for avId in self.avIds:
self.air.writeServerEvent('mintEntered', avId, description)
self.air.writeServerEvent('mintEntered', avId=avId, mintId=self.mintId, floorNum=self.floorNum, avIds=self.avIds)
def requestDelete(self):
self.notify.info('requestDelete: %s' % self.doId)

View file

@ -107,9 +107,8 @@ class DistributedMintRoomAI(DistributedLevelAI.DistributedLevelAI, MintRoomBase.
activeVictors.append(toon)
activeVictorIds.append(victorId)
description = '%s|%s' % (self.mintId, activeVictorIds)
for avId in activeVictorIds:
self.air.writeServerEvent('mintDefeated', avId, description)
self.air.writeServerEvent('mintDefeated', avId=avId, mintId=self.mintId, victors=activeVictorIds)
for toon in activeVictors:
simbase.air.questManager.toonDefeatedMint(toon, self.mintId, activeVictors)

View file

@ -41,9 +41,8 @@ class DistributedStageAI(DistributedObjectAI.DistributedObjectAI):
self.placeElevatorsOnMarkers()
if __dev__:
simbase.stage = self
description = '%s|%s|%s' % (self.stageId, self.floorNum, self.avIds)
for avId in self.avIds:
self.air.writeServerEvent('stageEntered', avId, description)
self.air.writeServerEvent('stageEntered', avId=avId, stageId=self.stageId, floorNum=self.floorNum, avIds=self.avIds)
return

View file

@ -114,9 +114,8 @@ class DistributedStageRoomAI(DistributedLevelAI.DistributedLevelAI, StageRoomBas
activeVictors.append(toon)
activeVictorIds.append(victorId)
description = '%s|%s' % (self.stageId, activeVictorIds)
for avId in activeVictorIds:
self.air.writeServerEvent('stageDefeated', avId, description)
self.air.writeServerEvent('stageDefeated', avId=avId, stageId=self.stageId, victors=activeVictorIds)
for toon in activeVictors:
simbase.air.questManager.toonDefeatedStage(toon, self.stageId, activeVictors)

View file

@ -416,25 +416,23 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS
self.numToonsAtEnd += 1
toonHps.append(toon.hp)
self.air.writeServerEvent('ceoInfo', self.doId, '%d|%.2f|%d|%d|%d|%d|%d|%d|%s|%s|%.1f|%d|%d|%d|%d|%d}%d|%s|' % (didTheyWin,
self.battleFourTimeInMin,
self.battleDifficulty,
self.numToonsAtStart,
self.numToonsAtEnd,
self.numTables,
self.numTables * self.numDinersPerTable,
self.numDinersExploded,
toonHps,
self.involvedToons,
self.speedDamage,
self.numMoveAttacks,
self.numGolfAttacks,
self.numGearAttacks,
self.numGolfAreaAttacks,
self.numToonupGranted,
self.totalLaffHealed,
'ceoBugfixes')
)
self.air.writeServerEvent('ceoInfo', doId=self.doId, victory=didTheyWin,
battleTIme=self.battleFourTimeInMin,
difficulty=self.battleDifficulty,
numToonsAtStart=self.numToonsAtStart,
numToonsAtEnd=self.numToonsAtEnd,
numTables=self.numTables,
numDiners=self.numTables * self.numDinersPerTable,
dinersKilled=self.numDinersExploded,
toonHps=toonHps,
involvedToons=self.involvedToons,
speedDamage=self.speedDamage,
numMoveAttacks=self.numMoveAttacks,
numGolfAttacks=self.numGolfAttacks,
numGearAttacks=self.numGearAttacks,
numGolfAreaAttacks=self.numGolfAreaAttacks,
toonupsGranted=self.numToonupGranted,
laffHealed=self.totalLaffHealed)
def setupBattleFourObjects(self):
if self.battleFourSetup:

View file

@ -443,7 +443,7 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM
self.numToonJurorsSeated += 1
self.notify.debug('numToonJurorsSeated=%d' % self.numToonJurorsSeated)
self.air.writeServerEvent('jurorsSeated', self.doId, '%s|%s|%s' % (self.dept, self.involvedToons, self.numToonJurorsSeated))
self.air.writeServerEvent('jurorsSeated', doId=self.doId, dept=self.dept, involvedToons=self.involvedToons, numToonJurors=self.numToonJurorsSeated)
self.__deleteCannons()
self.__stopChairs()
@ -485,12 +485,12 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM
self.numGavels,
self.numLawyers,
self.toonupValue))
self.air.writeServerEvent('lawbotBossSettings', self.doId, '%s|%s|%s|%s|%s|%s' % (self.dept,
self.battleDifficulty,
self.ammoCount,
self.numGavels,
self.numLawyers,
self.toonupValue))
self.air.writeServerEvent('lawbotBossSettings', doId=self.doId, dept=self.dept,
difficulty=self.battleDifficulty,
ammoCount=self.ammoCount,
numGavels=self.numGavels,
numLawyers=self.numLawyers,
toonupValue=self.toonupValue)
self.__makeBattleThreeObjects()
self.__makeLawyers()
self.numPies = self.ammoCount
@ -600,20 +600,20 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM
self.numToonsAtEnd += 1
toonHps.append(toon.hp)
self.air.writeServerEvent('b3Info', self.doId, '%d|%.2f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%s' % (didTheyWin,
self.battleThreeTimeInMin,
self.numToonsAtStart,
self.numToonsAtEnd,
self.numToonJurorsSeated,
self.battleDifficulty,
self.ammoCount,
self.numGavels,
self.numLawyers,
self.toonupValue,
self.numBonusStates,
self.numAreaAttacks,
toonHps,
self.weightPerToon))
self.air.writeServerEvent('b3Info', doId=self.doId, victory=didTheyWin,
time=self.battleThreeTimeInMin,
numToonsAtStart=self.numToonsAtStart,
numToonsAtEnd=self.numToonsAtEnd,
toonJurors=self.numToonJurorsSeated,
difficulty=self.battleDifficulty,
ammoCount=self.ammoCount,
numGavels=self.numGavels,
numLawyers=self.numLawyers,
toonupValue=self.toonupValue,
numBonuses=self.numBonusStates,
numAreaAttacks=self.numAreaAttacks,
toonHps=toonHps,
weightPerToon=self.weightPerToon)
def exitBattleThree(self):
self.doBattleThreeInfo()