RIP AccountDate + changed CREATED in Account to uint64 instead of string

This commit is contained in:
John 2015-07-06 22:46:20 +03:00
parent 66600531fb
commit 32a26abd79
6 changed files with 2 additions and 76 deletions

View file

@ -27,7 +27,7 @@ dclass Account {
uint32 ACCOUNT_AV_SET[] required db; uint32 ACCOUNT_AV_SET[] required db;
uint32 ESTATE_ID db; uint32 ESTATE_ID db;
AvatarPendingDel ACCOUNT_AV_SET_DEL[] db; AvatarPendingDel ACCOUNT_AV_SET_DEL[] db;
string CREATED db; uint64 CREATED db;
string LAST_LOGIN db; string LAST_LOGIN db;
string ACCOUNT_ID db; string ACCOUNT_ID db;
uint16 ACCESS_LEVEL db; uint16 ACCESS_LEVEL db;
@ -235,7 +235,6 @@ from toontown.shtiker import NewbiePurchaseManager/AI
from toontown.safezone import SafeZoneManager/AI from toontown.safezone import SafeZoneManager/AI
from toontown.tutorial import TutorialManager/AI from toontown.tutorial import TutorialManager/AI
from toontown.catalog import CatalogManager/AI from toontown.catalog import CatalogManager/AI
from toontown.catalog import AccountDate/AI
from toontown.safezone import DistributedTreasure/AI from toontown.safezone import DistributedTreasure/AI
from toontown.coghq import DistributedCashbotBossTreasure/AI from toontown.coghq import DistributedCashbotBossTreasure/AI
from toontown.building import DistributedTrophyMgr/AI from toontown.building import DistributedTrophyMgr/AI
@ -1531,11 +1530,6 @@ dclass CatalogManager : DistributedObject {
startCatalog() airecv clsend; startCatalog() airecv clsend;
}; };
dclass AccountDate : DistributedObject {
requestDate() airecv clsend;
requestDateResult(string);
};
dclass DistributedTreasure : DistributedObject { dclass DistributedTreasure : DistributedObject {
setTreasureType(uint16) required broadcast ram; setTreasureType(uint16) required broadcast ram;
setPosition(int16/10, int16/10, int16/10) required broadcast ram; setPosition(int16/10, int16/10, int16/10) required broadcast ram;

View file

@ -15,7 +15,6 @@ from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI
from toontown.ai.DistributedReportMgrAI import DistributedReportMgrAI from toontown.ai.DistributedReportMgrAI import DistributedReportMgrAI
from toontown.catalog.AccountDateAI import AccountDateAI
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI from toontown.catalog.CatalogManagerAI import CatalogManagerAI
@ -118,8 +117,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.cogPageManager = CogPageManagerAI.CogPageManagerAI() self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self) self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2) self.codeRedemptionMgr.generateWithRequired(2)
self.accountDateMgr = AccountDateAI(self)
self.accountDateMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self) self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2) self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2) self.groupManager.generateWithRequired(2)

View file

@ -1,39 +0,0 @@
from direct.distributed.DistributedObject import DistributedObject
from direct.directnotify.DirectNotifyGlobal import directNotify
from datetime import datetime
class AccountDate(DistributedObject):
neverDisable = 1
notify = directNotify.newCategory('AccountDate')
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.accountDays = 0
def announceGenerate(self):
DistributedObject.announceGenerate(self)
base.cr.accountDateMgr = self
taskMgr.doMethodLater(10, self.requestDate, 'request-task')
def delete(self):
if hasattr(base.cr, 'accountDateMgr'):
if base.cr.accountDateMgr is self:
del base.cr.accountDateMgr
DistributedObject.delete(self)
def getAccountDays(self):
return self.accountDays
def requestDate(self, task=None):
self.sendUpdate('requestDate')
if task is not None:
return task.done
def requestDateResult(self, result):
if result is None:
notify.warning('Invalid response from server.')
self.accountDays = 0
else:
date = datetime.strptime(result, "%a %b %d %H:%M:%S %Y")
self.accountDays = (datetime.now() - date).days

View file

@ -1,23 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class AccountDateAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("AccountDateAI")
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def requestDate(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
def callback(dclass, fields):
if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and 'CREATED' in fields:
self.sendUpdateToAvatarId(avId, 'requestDateResult', [fields.get('CREATED')])
else:
self.sendUpdateToAvatarId(avId, 'requestDateResult', [None])
self.air.dbInterface.queryObject(self.air.dbId, av.DISLid, callback)

View file

@ -1662,9 +1662,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
DistributedToon.DistributedToon.setPinkSlips(self, pinkSlips) DistributedToon.DistributedToon.setPinkSlips(self, pinkSlips)
self.inventory.updateTotalPropsText() self.inventory.updateTotalPropsText()
def getAccountDays(self):
return base.cr.accountDateMgr.getAccountDays()
def hasActiveBoardingGroup(self): def hasActiveBoardingGroup(self):
if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty:
return localAvatar.boardingParty.hasActiveGroup(localAvatar.doId) return localAvatar.boardingParty.hasActiveGroup(localAvatar.doId)

View file

@ -329,7 +329,7 @@ class LoginAccountFSM(OperationFSM):
'ACCOUNT_AV_SET': [0] * 6, 'ACCOUNT_AV_SET': [0] * 6,
'ESTATE_ID': 0, 'ESTATE_ID': 0,
'ACCOUNT_AV_SET_DEL': [], 'ACCOUNT_AV_SET_DEL': [],
'CREATED': time.ctime(), 'CREATED': time.time(),
'LAST_LOGIN': time.ctime(), 'LAST_LOGIN': time.ctime(),
'LAST_LOGIN_TS': time.time(), 'LAST_LOGIN_TS': time.time(),
'ACCOUNT_ID': str(self.userId), 'ACCOUNT_ID': str(self.userId),