diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index 593b1eb8..f9cbf99a 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -13,12 +13,9 @@ from otp.friends import PlayerFriendsManager/UD from otp.friends import GuildManager/AI/UD from otp.friends import FriendInfo from otp.friends import AvatarFriendInfo -from otp.distributed import ObjectServer/AI/UD from otp.distributed import DistributedDistrict/AI/UD from otp.distributed import DistributedDirectory/AI -from otp.distributed import DistributedTestObject/AI from otp.chat import ChatAgent/UD -from otp.distributed import CentralLogger/AI/UD from otp.avatar import AvatarHandle typedef uint8 bool; @@ -57,19 +54,6 @@ dclass DistributedObject { broadcastMessage() broadcast; }; -dclass DistributedTestObject : DistributedObject { - uint32 AutoInterest[]; - setParentingRules(string, string) broadcast ram; - setRequiredField(uint32) required broadcast ram; - setB(uint32) broadcast; - setBA(uint32) broadcast airecv; - setBO(uint32) broadcast ownsend; - setBR(uint32) broadcast ram; - setBRA(uint32) broadcast ram airecv; - setBRO(uint32) broadcast ram ownsend; - setBROA(uint32) broadcast ram ownsend airecv; -}; - struct OSInfo { string name; int16 platform; @@ -103,12 +87,6 @@ dclass TimeManager : DistributedObject { checkAvOnDistrictResult(uint32 context, DoId av, bool isOnDistrict); }; -dclass ObjectServer { - setName(string) airecv ram required; - setDcHash(uint32) ram required; - setDateCreated(uint32) airecv; -}; - dclass DistributedDirectory : DistributedObject { setParentingRules(string, string) broadcast ram; }; @@ -414,11 +392,6 @@ dclass PlayerFriendsManager : DistributedObject, TalkPath_account { removePlayerFriend(uint32); }; -dclass CentralLogger : DistributedObject { - sendMessage(string(0-256), string(0-1024), uint32, uint32) clsend; - logAIGarbage() airecv; -}; - dclass CallbackObject { callback(uint32, bool, uint8); }; @@ -581,6 +554,7 @@ from toontown.suit import DistributedGridGoon/AI from toontown.coghq import BattleBlocker/AI from toontown.ai import DistributedAprilToonsMgr/AI from toontown.ai import DistributedBlackCatMgr/AI +from toontown.ai import DistributedReportMgr/AI from toontown.ai import DistributedPolarBearMgr/AI from toontown.ai import DistributedPolarPlaceEffectMgr/AI from toontown.ai import DistributedGreenToonEffectMgr/AI @@ -849,6 +823,7 @@ dclass DistributedToon : DistributedPlayer { setExperience(blob = [0*14]) required broadcast db; setTrueFriends(uint32[]) required ownrecv db; setIgnored(uint32[]) required clsend airecv ownrecv db; + setReported(uint32[]) required clrecv db; setMaxCarry(uint8 = 20) required ownrecv db; setTrackAccess(uint16[] = [0,0,0,0,1,1,0]) required broadcast ownrecv db; setTrackProgress(int8 = -1, uint32 = 0) required ownrecv db; @@ -2746,6 +2721,10 @@ dclass DistributedBlackCatMgr : DistributedObject { requestBlackCatTransformation() airecv clsend; }; +dclass DistributedReportMgr : DistributedObject { + sendRequest(uint32, string) airecv; +}; + dclass DistributedPolarBearMgr : DistributedObject { doPolarBearTransformation(uint32 avId) broadcast; requestPolarBearTransformation() airecv clsend; diff --git a/otp/ai/AIBase.py b/otp/ai/AIBase.py index 87c8a839..22415dc4 100644 --- a/otp/ai/AIBase.py +++ b/otp/ai/AIBase.py @@ -60,7 +60,6 @@ class AIBase: __builtins__['hidden'] = self.hidden AIBase.notify.info('__dev__ == %s' % __dev__) PythonUtil.recordFunctorCreationStacks() - __builtins__['wantTestObject'] = self.config.GetBool('want-test-object', 0) self.wantStats = self.config.GetBool('want-pstats', 0) Task.TaskManager.pStatsTasks = self.config.GetBool('pstats-tasks', 0) taskMgr.resumeFunc = PStatClient.resumeAfterPause diff --git a/otp/distributed/CentralLogger.py b/otp/distributed/CentralLogger.py deleted file mode 100644 index cc16e9a8..00000000 --- a/otp/distributed/CentralLogger.py +++ /dev/null @@ -1,26 +0,0 @@ -from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal - - -REPORT_PLAYER = 'report-player' -ReportFoulLanguage = 'foul-language' -ReportPersonalInfo = 'personal-info' -ReportRudeBehavior = 'rude-behavior' -ReportBadName = 'bad-name' -ReportHacking = 'hacking' - - -class CentralLogger(DistributedObjectGlobal): - PlayersReportedThisSession = {} - - def hasReportedPlayer(self, targetDISLId, targetAvId): - return (targetDISLId, targetAvId) in self.PlayersReportedThisSession - - def reportPlayer(self, category, targetDISLId, targetAvId, description='None'): - if self.hasReportedPlayer(targetDISLId, targetAvId): - return False - self.PlayersReportedThisSession[targetDISLId, targetAvId] = 1 - self.sendUpdate('sendMessage', [category, REPORT_PLAYER, targetDISLId, targetAvId]) - return True - - def writeClientEvent(self, eventString, sender=0, receiver=0): - self.sendUpdate('sendMessage', ['client-event', eventString, sender, receiver]) diff --git a/otp/distributed/CentralLoggerAI.py b/otp/distributed/CentralLoggerAI.py deleted file mode 100644 index 248cfa99..00000000 --- a/otp/distributed/CentralLoggerAI.py +++ /dev/null @@ -1,12 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI - -class CentralLoggerAI(DistributedObjectAI): - notify = DirectNotifyGlobal.directNotify.newCategory("CentralLoggerAI") - - def sendMessage(self, todo0, todo1, todo2, todo3): - pass - - def logAIGarbage(self): - pass - diff --git a/otp/distributed/CentralLoggerUD.py b/otp/distributed/CentralLoggerUD.py deleted file mode 100644 index e758d843..00000000 --- a/otp/distributed/CentralLoggerUD.py +++ /dev/null @@ -1,9 +0,0 @@ -from direct.distributed.DistributedObjectUD import DistributedObjectUD - - -class CentralLoggerUD(DistributedObjectUD): - def sendMessage(self, category, description, sender, receiver): - self.air.writeServerEvent(category, sender, receiver, description) - - def logAIGarbage(self): - pass diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index a64db6c2..864e476d 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * -hashVal = 348191280 +hashVal = 3777956254L from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot @@ -14,7 +14,7 @@ from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiv from toontown.shtiker import DeleteManager, PurchaseManager, NewbiePurchaseManager from toontown.groups import GroupManager from toontown.uberdog.ClientServicesManager import ClientServicesManager -from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr +from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedReportMgr, DistributedPolarBearMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedSillyMeterMgr from otp.chat import ChatAgent from toontown.parties.GlobalPartyManager import GlobalPartyManager from toontown.racing.DistributedStartingBlock import DistributedViewingBlock @@ -33,7 +33,7 @@ from toontown.friends.TrueFriendsMgr import TrueFriendsMgr from toontown.coghq.InGameEditorDCImports import * from toontown.friends import TTPlayerFriendsManager, TTUFriendsManager from toontown.cogdominium import DistributedCogdoInterior, DistributedCogdoBattleBldg, DistributedCogdoElevatorExt, DistributedCogdoElevatorInt, DistributedCogdoBarrel, DistCogdoGame, DistCogdoLevelGame, DistCogdoBoardroomGame, DistCogdoCraneGame, DistCogdoMazeGame, DistCogdoFlyingGame, DistCogdoCrane, DistCogdoCraneMoneyBag, DistCogdoCraneCog -from otp.distributed import Account, ObjectServer, DistributedDistrict, DistributedDirectory, DistributedTestObject, CentralLogger +from otp.distributed import Account, DistributedDistrict, DistributedDirectory from toontown.estate import DistributedCannon, DistributedTarget, EstateManager, DistributedEstate, DistributedHouse, DistributedHouseInterior, DistributedGarden, DistributedHouseDoor, DistributedMailbox, DistributedFurnitureManager, DistributedFurnitureItem, DistributedBank, DistributedCloset, DistributedTrunk, DistributedPhone, DistributedFireworksCannon, DistributedLawnDecor, DistributedGardenPlot, DistributedGardenBox, DistributedFlower, DistributedGagTree, DistributedStatuary, DistributedToonStatuary, DistributedChangingStatuary, DistributedAnimatedStatuary, DistributedPlantBase, DistributedLawnDecor from toontown.toon import DistributedToon, DistributedNPCToonBase, DistributedNPCToon, DistributedSmartNPC, DistributedSmartNPC, DistributedNPCSpecialQuestGiver, DistributedNPCFlippyInToonHall, DistributedNPCScientist, DistributedNPCClerk, DistributedNPCTailor, DistributedNPCBlocker, DistributedNPCFisherman, DistributedNPCPartyPerson, DistributedNPCPetclerk, DistributedNPCKartClerk, DistributedNPCGlove from toontown.tutorial import DistributedBattleTutorial, TutorialManager diff --git a/otp/distributed/DistributedTestObject.py b/otp/distributed/DistributedTestObject.py deleted file mode 100644 index 0adf0041..00000000 --- a/otp/distributed/DistributedTestObject.py +++ /dev/null @@ -1,34 +0,0 @@ -from direct.distributed import DistributedObject - -class DistributedTestObject(DistributedObject.DistributedObject): - - def setRequiredField(self, r): - self.requiredField = r - - def setB(self, B): - self.B = B - - def setBA(self, BA): - self.BA = BA - - def setBO(self, BO): - self.BO = BO - - def setBR(self, BR): - self.BR = BR - - def setBRA(self, BRA): - self.BRA = BRA - - def setBRO(self, BRO): - self.BRO = BRO - - def setBROA(self, BROA): - self.BROA = BROA - - def gotNonReqThatWasntSet(self): - for field in ('B', 'BA', 'BO', 'BR', 'BRA', 'BRO', 'BROA'): - if hasattr(self, field): - return True - - return False diff --git a/otp/distributed/DistributedTestObjectAI.py b/otp/distributed/DistributedTestObjectAI.py deleted file mode 100644 index 031e3582..00000000 --- a/otp/distributed/DistributedTestObjectAI.py +++ /dev/null @@ -1,33 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI - -class DistributedTestObjectAI(DistributedObjectAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedTestObjectAI") - - def setParentingRules(self, todo0, todo1): - pass - - def setRequiredField(self, todo0): - pass - - def setB(self, todo0): - pass - - def setBA(self, todo0): - pass - - def setBO(self, todo0): - pass - - def setBR(self, todo0): - pass - - def setBRA(self, todo0): - pass - - def setBRO(self, todo0): - pass - - def setBROA(self, todo0): - pass - diff --git a/otp/distributed/GameServerTestSuite.py b/otp/distributed/GameServerTestSuite.py deleted file mode 100644 index b5551555..00000000 --- a/otp/distributed/GameServerTestSuite.py +++ /dev/null @@ -1,133 +0,0 @@ -from direct.directnotify.DirectNotifyGlobal import directNotify -from direct.showbase import DirectObject, TaskThreaded - -class GameServerTestSuite(DirectObject.DirectObject, TaskThreaded.TaskThreaded): - notify = directNotify.newCategory('GarbageReport') - - def __init__(self, cr): - self.cr = cr - TaskThreaded.TaskThreaded.__init__(self, self.__class__.__name__) - - class TimeoutTest(DirectObject.DirectObject): - Timeout = 10 - - def _getTaskName(self, name): - return '%s-timeout-%s' % (self.__class__.__name__, name) - - def startTimeout(self, name): - self.stopTimeout(name) - _taskName = self._getTaskName(name) - taskMgr.doMethodLater(self.Timeout, Functor(self._timeout, _taskName), _taskName) - - def stopTimeout(self, name): - _taskName = self._getTaskName(name) - taskMgr.remove(_taskName) - - def _timeout(self, taskName, task = None): - self.parent.notify.warning('TEST TIMED OUT: %s' % taskName) - import pdb - pdb.set_trace() - - class MsgHandlerTest: - - def installMsgHandler(self): - self.oldHandler = self.parent.handler - self.parent.handler = self.handleMsg - - def removeMsgHandler(self): - self.parent.handler = self.oldHandler - del self.oldHandler - - def handleMsg(self, msgType, di): - self.parent.cr.handler(msgType, di) - - class TestGetAvatars(TaskThreaded.TaskThread, TimeoutTest, MsgHandlerTest): - - def setUp(self): - self.state = 'request' - self.installMsgHandler() - - def handleMsg(self, msgType, di): - if msgType == CLIENT_GET_AVATARS_RESP: - self.finished() - else: - MsgHandlerTest.handleMsg(self, msgType, di) - - def run(self): - if self.state == 'request': - self.parent.cr.sendGetAvatarsMsg() - self.startTimeout('getAvatarList') - self.state = 'waitForList' - - def tearDown(self): - self.stopTimeout('getAvatarList') - self.removeMsgHandler() - - class TestInterestOpenAndClose(TaskThreaded.TaskThread, TimeoutTest): - - def setUp(self): - self.state = 'open' - - def run(self): - if self.state == 'open': - - def openInterestDone(): - self.stopTimeout(self.timeoutName) - self.state = 'modify' - - doneEvent = uniqueName('openInterest') - self.acceptOnce(doneEvent, openInterestDone) - openInterestDone = None - self.timeoutName = 'openInterest' - self.startTimeout(self.timeoutName) - self.handle = self.parent.cr.addInterest(self.parent.cr.GameGlobalsId, 91504, 'testInterest', doneEvent) - self.state = 'waitOpenComplete' - elif self.state == 'modify': - - def modifyInterestDone(): - self.stopTimeout(self.timeoutName) - self.state = 'close' - - doneEvent = uniqueName('openInterest') - self.acceptOnce(doneEvent, modifyInterestDone) - modifyInterestDone = None - self.timeoutName = 'modifyInterest' - self.startTimeout(self.timeoutName) - self.parent.cr.alterInterest(self.handle, self.parent.cr.GameGlobalsId, 91506, 'testInterest', doneEvent) - self.state = 'waitModifyComplete' - elif self.state == 'close': - - def closeInterestDone(): - self.stopTimeout(self.timeoutName) - self.state = 'done' - - doneEvent = uniqueName('closeInterest') - self.acceptOnce(doneEvent, closeInterestDone) - closeInterestDone = None - self.timeoutName = 'closeInterest' - self.startTimeout(self.timeoutName) - self.handle = self.parent.cr.removeInterest(self.handle, doneEvent) - self.state = 'waitCloseComplete' - elif self.state == 'done': - self.finished() - return - - class TestNonRequiredNonSetFields(TaskThreaded.TaskThread, TimeoutTest): - Timeout = 60 - - def setUp(self): - self.timeoutName = 'lookForObj' - self.startTimeout(self.timeoutName) - - def run(self): - testObj = self.parent.cr.doFind('DistributedTestObject') - if testObj is not None: - self.finished() - return - - def tearDown(self): - self.stopTimeout(self.timeoutName) - del self.timeoutName - - self.scheduleThread(TestInterestOpenAndClose()) - self.scheduleThread(TestNonRequiredNonSetFields()) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index c779406a..35d2e395 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -261,7 +261,6 @@ class OTPClientRepository(ClientRepositoryBase): self.__pendingMessages = {} self.__doId2pendingInterest = {} - self.centralLogger = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CENTRAL_LOGGER, 'CentralLogger') self.chatAgent = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CHAT_MANAGER, 'ChatAgent') self.csm = None # To be set by subclass. @@ -530,9 +529,6 @@ class OTPClientRepository(ClientRepositoryBase): @report(types=['args', 'deltaStamp'], dConfigParam='teleport') def waitForGetGameListResponse(self): if self.isGameListCorrect(): - if base.config.GetBool('game-server-tests', 0): - from otp.distributed import GameServerTestSuite - GameServerTestSuite.GameServerTestSuite(self) self.loginFSM.request('waitForShardList') else: self.loginFSM.request('missingGameRootObject') diff --git a/otp/distributed/ObjectServer.py b/otp/distributed/ObjectServer.py deleted file mode 100644 index 18c80872..00000000 --- a/otp/distributed/ObjectServer.py +++ /dev/null @@ -1,11 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedObject - -class ObjectServer(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('ObjectServer') - - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - - def setName(self, name): - self.name = name diff --git a/otp/distributed/ObjectServerAI.py b/otp/distributed/ObjectServerAI.py deleted file mode 100644 index cb2c3804..00000000 --- a/otp/distributed/ObjectServerAI.py +++ /dev/null @@ -1,15 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI - -class ObjectServerAI(DistributedObjectAI): - notify = DirectNotifyGlobal.directNotify.newCategory("ObjectServerAI") - - def setName(self, todo0): - pass - - def setDcHash(self, todo0): - pass - - def setDateCreated(self, todo0): - pass - diff --git a/otp/distributed/ObjectServerUD.py b/otp/distributed/ObjectServerUD.py deleted file mode 100644 index a49ca96b..00000000 --- a/otp/distributed/ObjectServerUD.py +++ /dev/null @@ -1,15 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectUD import DistributedObjectUD - -class ObjectServerUD(DistributedObjectUD): - notify = DirectNotifyGlobal.directNotify.newCategory("ObjectServerUD") - - def setName(self, todo0): - pass - - def setDcHash(self, todo0): - pass - - def setDateCreated(self, todo0): - pass - diff --git a/toontown/ai/DistributedBlackCatMgr.py b/toontown/ai/DistributedBlackCatMgr.py index 7f40c776..85c0fb10 100644 --- a/toontown/ai/DistributedBlackCatMgr.py +++ b/toontown/ai/DistributedBlackCatMgr.py @@ -24,9 +24,6 @@ class DistributedBlackCatMgr(DistributedObject.DistributedObject): neverDisable = 1 notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBlackCatMgr') - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - def announceGenerate(self): DistributedObject.DistributedObject.announceGenerate(self) base.cr.blackCatMgr = self diff --git a/toontown/ai/DistributedReportMgr.py b/toontown/ai/DistributedReportMgr.py new file mode 100644 index 00000000..237c3d73 --- /dev/null +++ b/toontown/ai/DistributedReportMgr.py @@ -0,0 +1,20 @@ +from direct.directnotify import DirectNotifyGlobal +from direct.distributed import DistributedObject + +class DistributedReportMgr(DistributedObject.DistributedObject): + neverDisable = 1 + notify = DirectNotifyGlobal.directNotify.newCategory('DistributedReportMgr') + + def __init__(self, cr): + DistributedObject.DistributedObject.__init__(self, cr) + + def announceGenerate(self): + DistributedObject.DistributedObject.announceGenerate(self) + base.cr.reportMgr = self + + def delete(self): + base.cr.reportMgr = None + DistributedObject.DistributedObject.delete(self) + + def sendReport(self, avId, category): + self.sendUpdate('sendReport', [avId, category]) \ No newline at end of file diff --git a/toontown/ai/DistributedReportMgrAI.py b/toontown/ai/DistributedReportMgrAI.py new file mode 100644 index 00000000..90f5998d --- /dev/null +++ b/toontown/ai/DistributedReportMgrAI.py @@ -0,0 +1,37 @@ +from direct.directnotify import DirectNotifyGlobal +from direct.distributed.DistributedObjectAI import DistributedObjectAI +from toontown.uberdog.ClientServicesManagerUD import executeHttpRequestAndLog +import ReportGlobals, threading + +class DistributedReportMgrAI(DistributedObjectAI): + notify = DirectNotifyGlobal.directNotify.newCategory("DistributedReportMgrAI") + + def __init__(self, air): + DistributedObjectAI.DistributedObjectAI(self, air) + self.reports = [] + self.interval = config.GetInt('report-interval', 600) + self.scheduleReport() + + def scheduleReport(self): + threading.Timer(self.interval, self.sendAllReports) + + def sendReport(self, avId, category): + if not ReportGlobals.isValidCategoryName(category) or not len(str(avId)) == 9: + return + + reporterId = self.air.getAvatarIdFromSender() + reporter = self.air.doId2do.get(reporterId) + + if not reporter or reporter.isReported(avId): + return + + timestamp = int(round(time.time() * 1000)) + self.reports.append('%s|%s|%s|%s' % (timestamp, reporterId, avId, category)) + + def sendAllReports(self): + if not self.reports: + return + + executeHttpRequestAndLog('report', reports=','.join(self.reports)) + self.reports = [] + self.scheduleReport() \ No newline at end of file diff --git a/toontown/ai/ReportGlobals.py b/toontown/ai/ReportGlobals.py new file mode 100644 index 00000000..8f95c6f5 --- /dev/null +++ b/toontown/ai/ReportGlobals.py @@ -0,0 +1,10 @@ +categories = ['foul-language', 'greening', 'rude-behavior', 'bad-name', 'hacking'] + +def isValidCategory(value): + return value < len(categories) + +def isValidCategoryName(value): + return value in categories + +def getCategory(value): + return categories[value] \ No newline at end of file diff --git a/toontown/toon/AvatarPanelBase.py b/toontown/toon/AvatarPanelBase.py index 3d96fd26..699fffc5 100644 --- a/toontown/toon/AvatarPanelBase.py +++ b/toontown/toon/AvatarPanelBase.py @@ -4,7 +4,7 @@ from direct.showbase import DirectObject from otp.avatar import AvatarPanel from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog -from otp.distributed import CentralLogger +from toontown.ai import ReportGlobals IGNORE_SCALE = 0.06 STOP_IGNORE_SCALE = 0.04 @@ -24,9 +24,7 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel): def handleIgnore(self): isAvatarFriend = base.cr.isFriend(self.avatar.doId) - isPlayerFriend = base.cr.playerFriendsManager.isAvatarOwnerPlayerFriend(self.avatar.doId) - isFriend = isAvatarFriend or isPlayerFriend - if isFriend: + if isAvatarFriend: self.dialog = TTDialog.TTGlobalDialog( style=TTDialog.CancelOnly, text=TTLocalizer.IgnorePanelAddFriendAvatar % self.avName, @@ -93,13 +91,13 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel): self.freeLocalAvatar() def handleReport(self): - if base.cr.centralLogger.hasReportedPlayer(self.playerId, self.avId): + if base.localAvatar.isReported(self.avId): self.alreadyReported() else: self.confirmReport() def confirmReport(self): - if base.cr.isFriend(self.avId) or base.cr.playerFriendsManager.isPlayerFriend(self.avId): + if base.cr.isFriend(self.avId): string = TTLocalizer.ReportPanelBodyFriends titlePos = 0.41 else: @@ -135,7 +133,7 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel): DirectLabel(parent=self.dialog, relief=None, pos=(0, 0, 0.225), text=TTLocalizer.ReportPanelTitle, textMayChange=0, text_scale=0.08) guiButton = loader.loadModel('phase_3/models/gui/quit_button') DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.125, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryLanguage, text_scale=0.06, text_pos=(0, -0.0124), pos=(0, 0, -0.3), command=self.handleReportCategory, extraArgs=[0]) - DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.15, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryPii, text_scale=0.06, text_pos=(0, -0.0125), pos=(0, 0, -0.425), command=self.handleReportCategory, extraArgs=[1]) + DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.15, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryGreening, text_scale=0.06, text_pos=(0, -0.0125), pos=(0, 0, -0.425), command=self.handleReportCategory, extraArgs=[1]) DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.125, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryRude, text_scale=0.06, text_pos=(0, -0.0125), pos=(0, 0, -0.55), command=self.handleReportCategory, extraArgs=[2]) DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.125, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryName, text_scale=0.06, text_pos=(0, -0.0125), pos=(0, 0, -0.675), command=self.handleReportCategory, extraArgs=[3]) DirectButton(parent=self.dialog, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(2.125, 1.0, 1.0), text=TTLocalizer.ReportPanelCategoryHacking, text_scale=0.06, text_pos=(0, -0.0125), pos=(0, 0, -0.8), command=self.handleReportCategory, extraArgs=[4]) @@ -147,13 +145,8 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel): def handleReportCategory(self, value): self.cleanupDialog() - if value >= 0: - cat = [CentralLogger.ReportFoulLanguage, - CentralLogger.ReportPersonalInfo, - CentralLogger.ReportRudeBehavior, - CentralLogger.ReportBadName, - CentralLogger.ReportHacking] - self.category = cat[value] + if value >= 0 and ReportGlobals.isValidCategory(value): + self.category = ReportGlobals.getCategory(value) self.confirmReportCategory(value) else: self.requestWalk() @@ -170,32 +163,22 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel): def handleReportCategoryConfirm(self, value): self.cleanupDialog() removed = 0 - isPlayer = 0 + if value > 0: - if self.category == CentralLogger.ReportHacking: - base.cr.centralLogger.reportPlayer(self.category, self.playerId, self.avId) - self.category = CentralLogger.ReportRudeBehavior - base.cr.centralLogger.reportPlayer(self.category, self.playerId, self.avId) if base.cr.isFriend(self.avId): base.cr.removeFriend(self.avId) removed = 1 - if base.cr.playerFriendsManager.isPlayerFriend(self.playerId): - if self.playerId: - base.cr.playerFriendsManager.sendRequestRemove(self.playerId) - removed = 1 - isPlayer = 1 - self.reportComplete(removed, isPlayer) + + base.cr.reportMgr.sendReport(self.avId, self.category) + self.reportComplete(removed) else: self.requestWalk() - def reportComplete(self, removed, isPlayer): + def reportComplete(self, removed): string = TTLocalizer.ReportPanelThanks titlePos = 0.25 if removed: - if isPlayer: - string += ' ' + TTLocalizer.ReportPanelRemovedPlayerFriend % self.playerId - else: - string += ' ' + TTLocalizer.ReportPanelRemovedFriend % self.avName + string += ' ' + TTLocalizer.ReportPanelRemovedFriend % self.avName titlePos = 0.3 self.dialog = TTDialog.TTGlobalDialog(style=TTDialog.Acknowledge, text=string, text_wordwrap=18.5, text_scale=0.06, topPad=0.1, doneEvent='ReportComplete', command=self.handleReportComplete) DirectLabel(parent=self.dialog, relief=None, pos=(0, 0, titlePos), text=TTLocalizer.ReportPanelTitle, textMayChange=0, text_scale=0.08) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 062d389f..8de5adaa 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -188,6 +188,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.redeemedCodes = [] self.trueFriends = [] self.ignored = [] + self.reported = [] def disable(self): for soundSequence in self.soundSequenceList: @@ -2635,6 +2636,16 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute if self.isIgnored(doId): self.ignored.remove(doId) self.d_setIgnored(self.ignored) + + def setReported(self, reported): + self.reported = reported + + def isReported(self, doId): + return doId in self.reported + + def addReport(self, doId): + if not self.isReported(doId): + self.reported.append(doId) def applyBuffs(self): for id, timestamp in enumerate(self.buffs): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 183529b1..e109adc7 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -191,6 +191,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.redeemedCodes = [] self.trueFriends = [] self.ignored = [] + self.reported = [] def generate(self): DistributedPlayerAI.DistributedPlayerAI.generate(self) @@ -477,8 +478,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getIgnored(self): return self.ignored - def isIgnored(self, doId): - return doId in self.ignored + def setReported(self, reported): + self.reported = reported + + def getReported(self): + return self.reported + + def isReported(self, doId): + return doId in self.reported def b_setInventory(self, inventory): self.setInventory(inventory) diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index c36c0de9..93f28ce7 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -1924,33 +1924,30 @@ AvatarPanelGroupMerge = 'Resulting in' AvatarPanelGroupRetract = 'Retract Invitation' AvatarPanelGroupMember = 'Already In Group' AvatarPanelGroupMemberKick = 'Remove' -ReportPanelTitle = 'Report A Player' +ReportPanelTitle = 'Report A Toon' ReportPanelBody = 'This feature will send a complete report to a Moderator. Instead of sending a report, you might choose to do one of the following:\n\n - Teleport to another district\n - Use "Ignore" on the toon\'s panel\n\nDo you really want to report %s to a Moderator?' ReportPanelBodyFriends = 'This feature will send a complete report to a Moderator. Instead of sending a report, you might choose to do one of the following:\n\n - Teleport to another district\n - Break your friendship\n\nDo you really want to report %s to a Moderator?\n\n(This will also break your friendship)' ReportPanelCategoryBody = 'You are about to report %s. A Moderator will be alerted to your complaint and will take appropriate action for anyone breaking our rules. Please choose the reason you are reporting %s:' -ReportPanelBodyPlayer = 'This feature is stilling being worked on and will be coming soon. In the meantime you can do the following:\n\n - Go to DXD and break the friendship there.\n - Tell a parent about what happened.' -ReportPanelCategoryLanguage = 'Foul Language' -ReportPanelCategoryPii = 'Sharing/Requesting Personal Info' +ReportPanelCategoryLanguage = 'Inappropriate Language' ReportPanelCategoryRude = 'Rude or Mean Behavior' ReportPanelCategoryName = 'Bad Name' ReportPanelCategoryHacking = 'Hacking' +ReportPanelCategoryGreening = 'Greening' ReportPanelConfirmations = ('You are about to report that %s has used obscene, bigoted or sexually explicit language.', - 'You are about to report that %s is being unsafe by giving out or requesting a phone number, address, last name, email address, password or account name.', + 'You are about to report that %s has disrupted your experience by intentionally causing your toon to go sad.', 'You are about to report that %s is bullying, harassing, or using extreme behavior to disrupt the game.', - "You are about to report that %s has created a name that does not follow the Toontown United rules.", + "You are about to report that %s has created a name that does not follow the rules.", 'You are about to report that %s has hacked/tampered with the game or used third party software.') -ReportPanelWarning = "We take reporting very seriously. Your report will be viewed by a Moderator who will take appropriate action for anyone breaking our rules. If your account is found to have participated in breaking the rules, or if you make false reports or abuse the 'Report a Player' system, a Moderator may take action against your account. Are you absolutely sure you want to report this player?" -ReportPanelThanks = 'Thank you! Your report has been sent to a Moderator for review. There is no need to contact us again about the issue. The moderation team will take appropriate action for a player found breaking our rules.' +ReportPanelWarning = "We take reporting very seriously. Your report will be viewed by a Moderator who will take appropriate action for anyone breaking our rules. If your account is found to have participated in breaking the rules, or if you make false reports or abuse the 'Report a Toon' system, a Moderator may take action against your account. Are you absolutely sure you want to report this toon?" +ReportPanelThanks = 'Thank you! Your report has been sent to a Moderator for review. There is no need to contact us again about the issue. The moderation team will take appropriate action for a toon found breaking our rules.' ReportPanelRemovedFriend = 'We have automatically removed %s from your Toon Friends List.' -ReportPanelRemovedPlayerFriend = 'We have automatically removed %s as a Player friend so as such you will not see them as your friend in any Toontown United product.' ReportPanelAlreadyReported = 'You have already reported %s during this session. A Moderator will review your previous report.' -IgnorePanelTitle = 'Ignore A Player' +IgnorePanelTitle = 'Ignore A PToon' IgnorePanelAddIgnore = 'Would you like to ignore %s?' IgnorePanelIgnore = 'You are now ignoring %s.' IgnorePanelRemoveIgnore = 'Would you like to stop ignoring %s?' IgnorePanelEndIgnore = 'You are no longer ignoring %s.' IgnorePanelAddFriendAvatar = '%s is your friend, you cannot ignore them while you are friends.' -IgnorePanelAddFriendPlayer = '%s (%s)is your friend, you cannot ignore them while you are friends.' PetPanelFeed = 'Feed' PetPanelCall = 'Call' PetPanelGoTo = 'Go To'