This commit is contained in:
John 2015-06-20 12:24:08 +03:00
parent a8fc4f513b
commit c57ebf03ed
10 changed files with 41 additions and 115 deletions

View file

@ -1,4 +1,5 @@
from direct.distributed import DistributedObject/AI/UD
from direct.distributed import DistributedObjectGlobal
from direct.distributed import DistributedNode/AI/UD
from direct.distributed import DistributedSmoothNode/AI
from direct.distributed import DistributedCartesianGrid/AI
@ -14,18 +15,15 @@ from otp.distributed import DistributedDirectory/AI
from otp.chat import ChatAgent/UD
typedef uint8 bool;
typedef uint32 DoId;
typedef DoId DoIdList[];
struct AvatarPendingDel {
uint32 Avatar;
uint32 avId;
uint32 date;
};
dclass Account {
string DcObjectType db;
uint32 ACCOUNT_AV_SET[] required db;
uint32 ESTATE_ID db;
AvatarPendingDel ACCOUNT_AV_SET_DEL[] db;
@ -45,14 +43,16 @@ struct BarrierData {
dclass DistributedObject {
setBarrierData(BarrierData []) broadcast ram;
setBarrierReady(uint16 barrierContext) airecv clsend;
execCommand(string command, DoId magicWordMgr,
DoId avatar, uint32 zoneId);
execCommand(string command, DoId magicWordMgr, DoId avatar, uint32 zoneId);
broadcastMessage() broadcast;
};
dclass DistributedObjectGlobal : DistributedObject {
};
dclass TimeManager : DistributedObject {
requestServerTime(uint8 context) airecv clsend;
serverTime(uint8 context, int32 timestap, uint32 timeOfDay);
serverTime(uint8 context, int32 timestamp, uint32 timeOfDay);
setDisconnectReason(uint8) airecv clsend;
setExceptionInfo(string(0-1024)) airecv clsend;
};
@ -128,7 +128,6 @@ dclass DistributedCamera : DistributedNode {
};
dclass DistributedAvatar : DistributedSmoothNode {
string DcObjectType db;
setName(string = "[Name not set]") required broadcast db airecv;
friendsNotify(DoId avId, int8 status) ownrecv airecv;
checkAvOnShard(DoId) clsend airecv;
@ -152,8 +151,8 @@ dclass DistributedPlayer : DistributedAvatar {
setSCCustom(uint16 msgIndex) broadcast ownsend airecv;
setFriendsList(uint32[] = []) ownrecv required db airecv;
setDISLid(uint32 = 0) broadcast ownrecv ram db airecv required;
WishName(string = "") db ram;
WishNameState(string = "OPEN") db ram;
setWishName(string = "") db ram;
setWishNameState(string = "OPEN") db ram;
setAdminAccess(uint16 = 0) required broadcast ownrecv db;
};
@ -178,7 +177,6 @@ dclass FriendManager : DistributedObject {
inviteeCancelFriendQuery(int32);
};
from direct.distributed import DistributedObjectGlobal
from toontown.building import DistributedAnimatedProp/AI
from toontown.toon import DistributedToon/AI/UD
from toontown.safezone import DistributedTrolley/AI
@ -1239,7 +1237,6 @@ struct lawnItem {
};
dclass DistributedEstate : DistributedObject {
string DcObjectType db;
setEstateReady() broadcast;
setClientReady() airecv clsend;
setClosestHouse(uint8) airecv clsend;
@ -1275,7 +1272,6 @@ dclass DistributedEstate : DistributedObject {
};
dclass DistributedHouse : DistributedObject {
string DcObjectType db;
setHousePos(uint8) required broadcast;
setHouseType(uint8 type = 0) required broadcast db;
setGardenPos(uint8 index = 0) required broadcast db;
@ -2388,7 +2384,6 @@ dclass DistributedMover : DistributedEntity {
typedef uint16/10000 PetTrait;
dclass DistributedPet : DistributedSmoothNode {
string DcObjectType db;
setOwnerId(uint32) required broadcast db;
setPetName(string) required broadcast db;
setTraitSeed(uint32) required broadcast db;
@ -3130,7 +3125,6 @@ dclass DistributedFindFour : DistributedNode {
tie() broadcast;
};
dclass DistributedLobbyManager : DistributedObject {
addLobby(uint32, uint32, string, string, int8, int8, activity [], decoration [], uint32[], uint16);
addLobbyRequest(uint32) airecv clsend;
@ -3211,9 +3205,6 @@ dclass DistributedPartyManager : DistributedObject {
receiveId(uint64 ids[]) airecv;
};
dclass DistributedObjectGlobal : DistributedObject {
};
dclass GlobalLobbyManager : DistributedObjectGlobal {
lobbyManagerAIHello(uint32 channel);
queryLobby(uint32 hostId);

View file

@ -22,10 +22,6 @@ import sys, time, types, random
class OTPClientRepository(ClientRepositoryBase):
notify = directNotify.newCategory('OTPClientRepository')
avatarLimit = 6
WishNameResult = Enum(['Failure',
'PendingApproval',
'Approved',
'Rejected'])
def __init__(self, serverVersion, playGame = None):
ClientRepositoryBase.__init__(self)
@ -1198,48 +1194,6 @@ class OTPClientRepository(ClientRepositoryBase):
else:
self.handleObjectLocation(di)
def sendWishName(self, avId, name):
datagram = PyDatagram()
datagram.addUint16(CLIENT_SET_WISHNAME)
datagram.addUint32(avId)
datagram.addString(name)
self.send(datagram)
def sendWishNameAnonymous(self, name):
self.sendWishName(0, name)
def getWishNameResultMsg(self):
return 'OTPCR.wishNameResult'
def gotWishnameResponse(self, di):
avId = di.getUint32()
returnCode = di.getUint16()
pendingName = ''
approvedName = ''
rejectedName = ''
if returnCode == 0:
pendingName = di.getString()
approvedName = di.getString()
rejectedName = di.getString()
if approvedName:
name = approvedName
elif pendingName:
name = pendingName
elif rejectedName:
name = rejectedName
else:
name = ''
WNR = self.WishNameResult
if returnCode:
result = WNR.Failure
elif rejectedName:
result = WNR.Rejected
elif pendingName:
result = WNR.PendingApproval
elif approvedName:
result = WNR.Approved
messenger.send(self.getWishNameResultMsg(), [result, avId, name])
def replayDeferredGenerate(self, msgType, extra):
if msgType == CLIENT_DONE_INTEREST_RESP:
dg, di = extra

View file

@ -1,5 +1,3 @@
class PotentialAvatar:
def __init__(self, id, names, dna, position, allowedName, creator = 1, shared = 1, online = 0, wishState = 'CLOSED', wishName = '', defaultShard = 0, lastLogout = 0):
@ -19,4 +17,3 @@ class PotentialAvatar:
self.online = online
self.defaultShard = defaultShard
self.lastLogout = lastLogout
return

View file

@ -1,6 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from otp.ai.MagicWordGlobal import *
class FriendManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("FriendManagerAI")
@ -119,15 +118,3 @@ class FriendManagerAI(DistributedObjectAI):
return
del self.requests[context]
def friendConsidering(self, todo0, todo1):
pass
def friendResponse(self, todo0, todo1):
pass
def inviteeFriendQuery(self, todo0, todo1, todo2, todo3):
pass
def inviteeCancelFriendQuery(self, todo0):
pass

View file

@ -749,8 +749,8 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
On success: True
On failure: False
"""
newFields = {'WishNameState': 'APPROVED'}
oldFields = {'WishNameState': 'PENDING'}
newFields = {'setWishNameState': 'APPROVED'}
oldFields = {'setWishNameState': 'PENDING'}
return self.rpc_updateObject(
avId, 'DistributedToonUD', newFields, oldFields=oldFields)
@ -769,7 +769,7 @@ class ToontownRPCHandler(ToontownRPCHandlerBase):
On success: True
On failure: False
"""
newFields = {'WishNameState': 'REJECTED'}
oldFields = {'WishNameState': 'PENDING'}
newFields = {'setWishNameState': 'REJECTED'}
oldFields = {'setWishNameState': 'PENDING'}
return self.rpc_updateObject(
avId, 'DistributedToonUD', newFields, oldFields=oldFields)

View file

@ -249,6 +249,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def setAdminAccess(self, access):
DistributedPlayer.DistributedPlayer.setAdminAccess(self, access)
self.removeGMIcon()
if self.isAdmin():
self.setGMIcon()
def setDNA(self, dna):
@ -2364,10 +2365,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
if hasattr(self, 'gmIcon') and self.gmIcon:
return
icons = loader.loadModel('phase_3/models/props/gm_icons')
searchString = '**/access_level_' + str(self.adminAccess)
self.gmIcon = icons.find(searchString)
self.gmIcon = icons.find('**/access_level_' + str(self.adminAccess))
np = NodePath(self.nametag.getIcon())
if np.isEmpty():
if np.isEmpty() or not self.gmIcon:
return
self.gmIcon.flattenStrong()
self.gmIcon.reparentTo(np)

View file

@ -4432,7 +4432,7 @@ def badName():
colorString = TTLocalizer.NumToColor[target.dna.headColor]
animalType = TTLocalizer.AnimalToSpecies[target.dna.getAnimal()]
target.b_setName(colorString + ' ' + animalType)
target.sendUpdate('WishNameState', ['REJECTED'])
target.sendUpdate('setWishNameState', ['REJECTED'])
return "Revoked %s's name!" % _name
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])

View file

@ -478,8 +478,8 @@ class CreateAvatarFSM(OperationFSM):
name = ' '.join((colorString, animalType))
toonFields = {
'setName': (name,),
'WishNameState': ('OPEN',),
'WishName': ('',),
'setWishNameState': ('OPEN',),
'setWishName': ('',),
'setDNAString': (self.dna,),
'setDISLid': (self.target,),
}
@ -578,7 +578,7 @@ class GetAvatarsFSM(AvatarOperationFSM):
for avId, fields in self.avatarFields.items():
index = self.avList.index(avId)
wishNameState = fields.get('WishNameState', [''])[0]
wishNameState = fields.get('setWishNameState', [''])[0]
name = fields['setName'][0]
nameState = 0
@ -590,13 +590,13 @@ class GetAvatarsFSM(AvatarOperationFSM):
self.csm.air.dbId,
avId,
self.csm.air.dclassesByName['DistributedToonUD'],
{'WishNameState': [actualNameState]}
{'setWishNameState': [actualNameState]}
)
if actualNameState == 'PENDING':
nameState = 2
if actualNameState == 'APPROVED':
nameState = 3
name = fields['WishName'][0]
name = fields['setWishName'][0]
elif actualNameState == 'REJECTED':
nameState = 4
elif wishNameState == 'APPROVED':
@ -692,7 +692,7 @@ class SetNameTypedFSM(AvatarOperationFSM):
self.demand('Kill', "One of the account's avatars is invalid!")
return
if fields['WishNameState'][0] != 'OPEN':
if fields['setWishNameState'][0] != 'OPEN':
self.demand('Kill', 'Avatar is not in a namable state!')
return
@ -708,8 +708,8 @@ class SetNameTypedFSM(AvatarOperationFSM):
self.csm.air.dbId,
self.avId,
self.csm.air.dclassesByName['DistributedToonUD'],
{'WishNameState': ('PENDING',),
'WishName': (self.name,)})
{'setWishNameState': ('PENDING',),
'setWishName': (self.name,)})
else:
status = False
@ -742,7 +742,7 @@ class SetNamePatternFSM(AvatarOperationFSM):
self.demand('Kill', "One of the account's avatars is invalid!")
return
if fields['WishNameState'][0] != 'OPEN':
if fields['setWishNameState'][0] != 'OPEN':
self.demand('Kill', 'Avatar is not in a namable state!')
return
@ -768,8 +768,8 @@ class SetNamePatternFSM(AvatarOperationFSM):
self.csm.air.dbId,
self.avId,
self.csm.air.dclassesByName['DistributedToonUD'],
{'WishNameState': ('',),
'WishName': ('',),
{'setWishNameState': ('',),
'setWishName': ('',),
'setName': (name,)})
self.csm.air.writeServerEvent('avatarNamed', self.avId, name)
@ -799,8 +799,8 @@ class AcknowledgeNameFSM(AvatarOperationFSM):
return
# Process the WishNameState change.
wishNameState = fields['WishNameState'][0]
wishName = fields['WishName'][0]
wishNameState = fields['setWishNameState'][0]
wishName = fields['setWishName'][0]
name = fields['setName'][0]
if wishNameState == 'APPROVED':
@ -821,11 +821,11 @@ class AcknowledgeNameFSM(AvatarOperationFSM):
self.csm.air.dbId,
self.avId,
self.csm.air.dclassesByName['DistributedToonUD'],
{'WishNameState': (wishNameState,),
'WishName': (wishName,),
{'setWishNameState': (wishNameState,),
'setWishName': (wishName,),
'setName': (name,)},
{'WishNameState': fields['WishNameState'],
'WishName': fields['WishName'],
{'setWishNameState': fields['setWishNameState'],
'setWishName': fields['setWishName'],
'setName': fields['setName']})
self.csm.sendUpdateToAccountId(self.target, 'acknowledgeAvatarNameResp', [])

View file

@ -1,12 +1,10 @@
from direct.distributed.PyDatagram import *
import urlparse
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
from otp.distributed.OtpDoGlobals import *
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
import toontown.minigame.MinigameCreatorAI
if config.GetBool('want-rpc-server', False):
from toontown.rpc.ToontownRPCServer import ToontownRPCServer
from toontown.rpc.ToontownRPCHandler import ToontownRPCHandler
@ -14,7 +12,6 @@ if config.GetBool('want-rpc-server', False):
if config.GetBool('want-mongo-client', False):
import pymongo
class ToontownUberRepository(ToontownInternalRepository):
def __init__(self, baseChannel, serverId):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='UD')