toonbase: Remove yet another Disney hack check

This commit is contained in:
John Cote 2021-07-08 15:32:24 -04:00
parent 9b84e09b13
commit 5fccccd206
3 changed files with 0 additions and 109 deletions

View file

@ -618,7 +618,6 @@ dclass DistributedToon : DistributedPlayer {
setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv;
setDISLname(string) ram;
setDISLid(uint32) ram db airecv;
flagAv(uint32, uint16, string []) airecv ownsend;
};
dclass DistributedCCharBase : DistributedObject {

View file

@ -67,8 +67,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
ToontownGlobals.FT_Leg: (CogDisguiseGlobals.leftLegIndex, CogDisguiseGlobals.rightLegIndex),
ToontownGlobals.FT_Arm: (CogDisguiseGlobals.leftArmIndex, CogDisguiseGlobals.rightArmIndex),
ToontownGlobals.FT_Torso: (CogDisguiseGlobals.torsoIndex,)}
lastFlagAvTime = globalClock.getFrameTime()
flagCounts = {}
WantTpTrack = simbase.config.GetBool('want-tptrack', False)
WantOldGMNameBan = simbase.config.GetBool('want-old-gm-name-ban', 1)
@ -4142,108 +4140,3 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
else:
return self.inventory._createStack
return 'no inventory'
def flagAv(self, avId, reason, params):
self.notify.debug('reason: %s timepassed: %s' % (reason, globalClock.getFrameTime() - DistributedToonAI.lastFlagAvTime))
if reason == AV_FLAG_REASON_TOUCH and globalClock.getFrameTime() - DistributedToonAI.lastFlagAvTime > AV_TOUCH_CHECK_DELAY_AI:
DistributedToonAI.lastFlagAvTime = globalClock.getFrameTime()
av = self.air.doId2do.get(avId)
otherAv = self.air.doId2do.get(int(params[0]))
self.notify.debug('checking suspicious avatar positioning %s for %s with %s' % (avId, reason, params))
if av and otherAv and isinstance(av, DistributedToonAI) and isinstance(otherAv, DistributedToonAI) and av.zoneId == otherAv.zoneId and av.zoneId not in MinigameCreatorAI.MinigameZoneRefs:
self.notify.debug('...in zone %s' % av.zoneId)
componentNode = av.getParent().attachNewNode('blah')
componentNode.setPos(av.getComponentX(), av.getComponentY(), av.getComponentZ())
avPos = componentNode.getPos(av.getRender())
componentNode.reparentTo(otherAv.getParent())
componentNode.setPos(otherAv.getComponentX(), otherAv.getComponentY(), otherAv.getComponentZ())
otherAvPos = componentNode.getPos(otherAv.getRender())
componentNode.removeNode()
zDist = avPos.getZ() - otherAvPos.getZ()
avPos2D = copy.copy(avPos)
avPos2D.setZ(0)
otherAvPos2D = copy.copy(otherAvPos)
otherAvPos2D.setZ(0)
moveVec = avPos2D - otherAvPos2D
dist = moveVec.length()
self.notify.debug('2d dist between avs is %s %s %s' % (dist, avPos, otherAvPos))
if dist < AV_TOUCH_CHECK_DIST and zDist < AV_TOUCH_CHECK_DIST_Z:
self.notify.debug('...moving!')
if dist == 0.0:
moveVec = Vec3(1.0, 0, 0)
else:
moveVec.normalize()
moveVec = moveVec * AV_TOUCH_CHECK_DIST
avHpr = av.getHpr(av.getRender())
newX = avPos.getX() + moveVec.getX()
newY = avPos.getY() + moveVec.getY()
newZ = avPos.getZ() + moveVec.getZ()
newH = avHpr.getX()
newP = avHpr.getY()
newR = avHpr.getZ()
av.setPosHpr(av.getRender(), newX, newY, newZ, newH, newP, newR)
newAvPos = av.getPos()
if newAvPos.getX() > 3000 or newAvPos.getX() < -3000 or newAvPos.getY() > 3000 or newAvPos.getY() < -3000:
return
av.d_setXY(newAvPos.getX(), newAvPos.getY())
self.notify.debug('setting ai pos: %s %s %s and sending pos: %s' % (newX,
newY,
newZ,
newAvPos))
if len(DistributedToonAI.flagCounts) > AV_FLAG_HISTORY_LEN:
DistributedToonAI.flagCounts = {}
avPairKey = str(min(av.doId, otherAv.doId)) + '+' + str(max(av.doId, otherAv.doId))
prevCount = DistributedToonAI.flagCounts.setdefault(avPairKey, [{}, globalClock.getFrameTime(), {}])
if av.doId not in prevCount[2]:
prevCount[2][av.doId] = [None, None]
if av.doId not in prevCount[0]:
prevCount[0][av.doId] = 0
self.notify.debug('moving av %s, newPos: %s oldPos: %s' % (av.doId, prevCount[2][av.doId], avPos))
if prevCount[2][av.doId][0] == None or prevCount[2][av.doId][1] == None:
pass
elif prevCount[2][av.doId][0] != avPos.getX() or prevCount[2][av.doId][1] != avPos.getY():
prevCount[0][av.doId] += 1
prevCount[2][av.doId] = [newX, newY]
if prevCount[0][av.doId] > AV_TOUCH_COUNT_LIMIT:
if globalClock.getFrameTime() - prevCount[1] < AV_TOUCH_COUNT_TIME:
zoneId = not hasattr(av, 'zoneId') and 'undef' or av.zoneId
battleId = not hasattr(av, 'battleId') and 'undef' or av.battleId
animName = not hasattr(av, 'animName') and 'undef' or av.animName
inEstate = not hasattr(av, 'isInEstate') and 'undef' or av.isInEstate()
ghostMode = not hasattr(av, 'ghostMode') and 'undef' or av.ghostMode
immortalMode = not hasattr(av, 'immortalMode') and 'undef' or av.immortalMode
isGm = not hasattr(av, '_isGM') and 'undef' or av._isGM
valStr = '%s %s %s %s %s %s %s %s' % (otherAv.doId,
zoneId,
battleId,
animName,
inEstate,
ghostMode,
immortalMode,
isGm)
self.notify.info('av %s is consistently in an inappropriate position with %s...' % (av.doId, valStr))
self.air.writeServerEvent('suspicious', avId, ' consistently in an inappropriate position with toon %s' % valStr)
response = simbase.config.GetString('toon-pos-hack-response', 'nothing')
av.handleHacking(response, 'collision and position hacking', [otherAv])
del DistributedToonAI.flagCounts[avPairKey]
return
def handleHacking(self, response, comment, coconspirators = []):
if response == 'quietzone':
self.b_setLocation(self.parentId, ToontownGlobals.QuietZone)
elif response == 'disconnect':
self.disconnect()
elif response == 'disconnectall':
self.disconnect()
for coconspirator in coconspirators:
coconspirator.disconnect()
elif response == 'ban':
self.ban('collision and position hacking')
self.disconnect()
elif response == 'banall':
self.ban('collision and position hacking')
self.disconnect()
for coconspirator in coconspirators:
coconspirator.ban('collision and position hacking')
coconspirator.disconnect()

View file

@ -167,7 +167,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
self.physControls.event.addAgainPattern('again%in')
self.oldPos = None
self.questMap = None
self.prevToonIdx = 0
def wantLegacyLifter(self):
return True