mirror of
https://port.numenaute.org/aleajactaest/clientbot.git
synced 2024-11-21 22:56:13 +00:00
adding decoder PropVisual (VPA, VPB, VPC)
This commit is contained in:
parent
9755a2941b
commit
8e9c92c5f3
3 changed files with 268 additions and 2 deletions
|
@ -879,7 +879,8 @@ class SpyPcap():
|
||||||
self.outyaml.write(" timestamp: %d\n" % (property['timestamp']))
|
self.outyaml.write(" timestamp: %d\n" % (property['timestamp']))
|
||||||
for action in property['Actions']:
|
for action in property['Actions']:
|
||||||
try:
|
try:
|
||||||
self.outyaml.write(" %s: %s\n" % (action.get_name(), str(action.value)))
|
action.print_yaml(self.outyaml, " ")
|
||||||
|
#self.outyaml.write(" %s: %s\n" % (action.get_name(), str(action.get_property())))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# TODO - change print if CAtion is Position or other (and not CActionSint64)
|
# TODO - change print if CAtion is Position or other (and not CActionSint64)
|
||||||
params = action.get_parameter()
|
params = action.get_parameter()
|
||||||
|
|
|
@ -20,9 +20,12 @@
|
||||||
|
|
||||||
#from tools import Enum
|
#from tools import Enum
|
||||||
import logging
|
import logging
|
||||||
|
import struct
|
||||||
|
import math
|
||||||
from tools import TPropIndex
|
from tools import TPropIndex
|
||||||
from tools import TPVPMode
|
from tools import TPVPMode
|
||||||
from tools import Enum
|
from tools import Enum
|
||||||
|
from tools import PropVisual
|
||||||
|
|
||||||
LOGGER='CActionFactory'
|
LOGGER='CActionFactory'
|
||||||
INVALID_SLOT = 0xff
|
INVALID_SLOT = 0xff
|
||||||
|
@ -413,8 +416,9 @@ class CActionSint64(CAction):
|
||||||
self.value = 0
|
self.value = 0
|
||||||
self.NbBits = 64
|
self.NbBits = 64
|
||||||
self.NameProperty = 'None'
|
self.NameProperty = 'None'
|
||||||
|
self.PropertyIndex = None
|
||||||
self.PropertyToNbBit = {
|
self.PropertyToNbBit = {
|
||||||
TPropIndex.TPropIndex.PROPERTY_ORIENTATION: 32,
|
TPropIndex.TPropIndex.PROPERTY_ORIENTATION: 32,
|
||||||
TPropIndex.TPropIndex.PROPERTY_SHEET: 52,
|
TPropIndex.TPropIndex.PROPERTY_SHEET: 52,
|
||||||
TPropIndex.TPropIndex.PROPERTY_BEHAVIOUR: 48,
|
TPropIndex.TPropIndex.PROPERTY_BEHAVIOUR: 48,
|
||||||
TPropIndex.TPropIndex.PROPERTY_NAME_STRING_ID: 32,
|
TPropIndex.TPropIndex.PROPERTY_NAME_STRING_ID: 32,
|
||||||
|
@ -469,9 +473,49 @@ class CActionSint64(CAction):
|
||||||
def setNbBits(self, propIndex, nameproperty):
|
def setNbBits(self, propIndex, nameproperty):
|
||||||
self.NbBits = PROPERTY_TO_NB_BIT[propIndex]
|
self.NbBits = PROPERTY_TO_NB_BIT[propIndex]
|
||||||
self.NameProperty = nameproperty
|
self.NameProperty = nameproperty
|
||||||
|
self.PropertyIndex = propIndex
|
||||||
self.set_name(nameproperty)
|
self.set_name(nameproperty)
|
||||||
logging.getLogger(LOGGER).debug("NameProperty:{1} NbBits:{0}".format(self.NbBits, self.NameProperty ))
|
logging.getLogger(LOGGER).debug("NameProperty:{1} NbBits:{0}".format(self.NbBits, self.NameProperty ))
|
||||||
|
|
||||||
|
def get_property(self):
|
||||||
|
ret = ""
|
||||||
|
if self.PropertyIndex == TPropIndex.TPropIndex.PROPERTY_ORIENTATION:
|
||||||
|
v1 = struct.pack('I', self.value)
|
||||||
|
angle = struct.unpack('<f',v1)[0] * 180 / math.pi
|
||||||
|
ret = "{0} [{1}]".format(angle, self.value)
|
||||||
|
else:
|
||||||
|
ret = "{0}".format(self.value)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def print_yaml(self, outyaml, space):
|
||||||
|
if self.PropertyIndex == TPropIndex.TPropIndex.PROPERTY_ORIENTATION:
|
||||||
|
v1 = struct.pack('I', self.value)
|
||||||
|
angle_radius = struct.unpack('<f',v1)[0]
|
||||||
|
angle_degree = angle_radius * 180 / math.pi
|
||||||
|
outyaml.write("{0} {1}:\n".format(space, self.get_name() ))
|
||||||
|
outyaml.write("{0} raw: {1}\n".format(space, self.value ))
|
||||||
|
outyaml.write("{0} radius: {1}\n".format(space, angle_radius ))
|
||||||
|
outyaml.write("{0} degree: {1}\n".format(space, angle_degree ))
|
||||||
|
elif self.PropertyIndex == TPropIndex.TPropIndex.PROPERTY_VPA:
|
||||||
|
outyaml.write("{0} {1}:\n".format(space, self.get_name()))
|
||||||
|
outyaml.write("{0} raw: {1}\n".format(space, self.value))
|
||||||
|
vba = PropVisual.PropVisualA()
|
||||||
|
vba.set_compress_data(self.value)
|
||||||
|
vba.print_yaml(outyaml, space+' ')
|
||||||
|
elif self.PropertyIndex == TPropIndex.TPropIndex.PROPERTY_VPB:
|
||||||
|
outyaml.write("{0} {1}:\n".format(space, self.get_name()))
|
||||||
|
outyaml.write("{0} raw: {1}\n".format(space, self.value))
|
||||||
|
vbb= PropVisual.PropVisualB()
|
||||||
|
vbb.set_compress_data(self.value)
|
||||||
|
vbb.print_yaml(outyaml, space+' ')
|
||||||
|
elif self.PropertyIndex == TPropIndex.TPropIndex.PROPERTY_VPC:
|
||||||
|
outyaml.write("{0} {1}:\n".format(space, self.get_name()))
|
||||||
|
outyaml.write("{0} raw: {1}\n".format(space, self.value))
|
||||||
|
vbc= PropVisual.PropVisualC()
|
||||||
|
vbc.set_compress_data(self.value)
|
||||||
|
vbc.print_yaml(outyaml, space+' ')
|
||||||
|
else:
|
||||||
|
outyaml.write("{0} {1}: {2}\n".format(space, self.get_name(), self.get_property()))
|
||||||
|
|
||||||
class CActionBlock:
|
class CActionBlock:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
221
tools/PropVisual.py
Normal file
221
tools/PropVisual.py
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# module PropVisual
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019 AleaJactaEst
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#from tools import Enum
|
||||||
|
#import logging
|
||||||
|
#import struct
|
||||||
|
#import math
|
||||||
|
#from tools import TPropIndex
|
||||||
|
#from tools import TPVPMode
|
||||||
|
#from tools import Enum
|
||||||
|
|
||||||
|
LOGGER='PropVisual'
|
||||||
|
|
||||||
|
# uint64 Sex : 1; // max: 2 current: 2
|
||||||
|
# uint64 JacketModel : 8; // max: 256 current: 93
|
||||||
|
# uint64 JacketColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 TrouserModel : 8; // max: 256 current: 104
|
||||||
|
# uint64 TrouserColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 WeaponRightHand : 10; // max: 1024 current: 457
|
||||||
|
# uint64 WeaponLeftHand : 8; // max: 256 current: 63
|
||||||
|
# uint64 ArmModel : 8; // max: 256 current: 94
|
||||||
|
# uint64 ArmColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 HatModel : 9; // max: 512 current: 192
|
||||||
|
# uint64 HatColor : 3; // max: 8 current: 8
|
||||||
|
|
||||||
|
class PropVisualA:
|
||||||
|
# khanat-opennel-code/code/ryzom/common/src/game_share/player_visual_properties.h:32 struct SPropVisualA
|
||||||
|
def __init__(self):
|
||||||
|
self.Sex = 0
|
||||||
|
self.JacketModel = 0
|
||||||
|
self.JacketColor = 0
|
||||||
|
self.TrouserModel = 0
|
||||||
|
self.TrouserColor = 0
|
||||||
|
self.WeaponRightHand = 0
|
||||||
|
self.WeaponLeftHand = 0
|
||||||
|
self.ArmModel = 0
|
||||||
|
self.ArmColor = 0
|
||||||
|
self.HatModel = 0
|
||||||
|
self.HatColor = 0
|
||||||
|
|
||||||
|
def set_compress_data(self, value):
|
||||||
|
self.Sex = value & 1
|
||||||
|
value >>= 1
|
||||||
|
self.JacketModel = value & 0xff
|
||||||
|
value >>= 8
|
||||||
|
self.JacketColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.TrouserModel = value & 0xff
|
||||||
|
value >>= 8
|
||||||
|
self.TrouserColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.WeaponRightHand = value & 0x3ff
|
||||||
|
value >>= 10
|
||||||
|
self.WeaponLeftHand = value & 0xff
|
||||||
|
value >>= 8
|
||||||
|
self.ArmModel = value & 0xff
|
||||||
|
value >>= 8
|
||||||
|
self.ArmColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.HatModel = value & 0x1ff
|
||||||
|
value >>= 9
|
||||||
|
self.HatColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
|
||||||
|
def print_yaml(self, outyaml, space):
|
||||||
|
outyaml.write("{0} sex: {1}\n".format(space, self.Sex))
|
||||||
|
outyaml.write("{0} JacketModel: {1}\n".format(space, self.JacketModel))
|
||||||
|
outyaml.write("{0} JacketColor: {1}\n".format(space, self.JacketColor))
|
||||||
|
outyaml.write("{0} TrouserModel: {1}\n".format(space, self.TrouserModel))
|
||||||
|
outyaml.write("{0} TrouserColor: {1}\n".format(space, self.TrouserColor))
|
||||||
|
outyaml.write("{0} WeaponRightHand: {1}\n".format(space, self.WeaponRightHand))
|
||||||
|
outyaml.write("{0} WeaponLeftHand: {1}\n".format(space, self.WeaponLeftHand))
|
||||||
|
outyaml.write("{0} ArmModel: {1}\n".format(space, self.ArmModel))
|
||||||
|
outyaml.write("{0} ArmColor: {1}\n".format(space, self.ArmColor))
|
||||||
|
outyaml.write("{0} HatModel: {1}\n".format(space, self.HatModel))
|
||||||
|
outyaml.write("{0} HatColor: {1}\n".format(space, self.HatColor))
|
||||||
|
|
||||||
|
# uint64 Name : 16;
|
||||||
|
# uint64 HandsModel : 9; // max: 512 current: 90
|
||||||
|
# uint64 HandsColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 FeetModel : 9; // max: 512 current: 94
|
||||||
|
# uint64 FeetColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 RTrail : 4;
|
||||||
|
# uint64 LTrail : 3;
|
||||||
|
|
||||||
|
class PropVisualB:
|
||||||
|
# khanat-opennel-code/code/ryzom/common/src/game_share/player_visual_properties.h:105 struct SPropVisualB
|
||||||
|
def __init__(self):
|
||||||
|
self.Name = 0
|
||||||
|
self.HandsModel = 0
|
||||||
|
self.HandsColor = 0
|
||||||
|
self.FeetModel = 0
|
||||||
|
self.FeetColor = 0
|
||||||
|
self.RTrail = 0
|
||||||
|
self.LTrail = 0
|
||||||
|
|
||||||
|
def set_compress_data(self, value):
|
||||||
|
self.Name = value & 0xffff
|
||||||
|
value >>= 16
|
||||||
|
self.HandsModel = value & 0x1ff
|
||||||
|
value >>= 9
|
||||||
|
self.HandsColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.FeetModel = value & 0x1ff
|
||||||
|
value >>= 9
|
||||||
|
self.FeetColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.RTrail = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
self.LTrail = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
|
||||||
|
def print_yaml(self, outyaml, space):
|
||||||
|
outyaml.write("{0} Name: {1}\n".format(space, self.Name))
|
||||||
|
outyaml.write("{0} HandsModel: {1}\n".format(space, self.HandsModel))
|
||||||
|
outyaml.write("{0} HandsColor: {1}\n".format(space, self.HandsColor))
|
||||||
|
outyaml.write("{0} FeetModel: {1}\n".format(space, self.FeetModel))
|
||||||
|
outyaml.write("{0} FeetColor: {1}\n".format(space, self.FeetColor))
|
||||||
|
outyaml.write("{0} RTrail: {1}\n".format(space, self.RTrail))
|
||||||
|
outyaml.write("{0} LTrail: {1}\n".format(space, self.LTrail))
|
||||||
|
|
||||||
|
# uint64 MorphTarget1 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget2 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget3 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget4 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget5 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget6 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget7 : 3; // max: 8 current: 8
|
||||||
|
# uint64 MorphTarget8 : 3; // max: 8 current: 8
|
||||||
|
# uint64 EyesColor : 3; // max: 8 current: 8
|
||||||
|
# uint64 Tattoo : 7; // max: 128 current: 64
|
||||||
|
# uint64 CharacterHeight : 4; // max: 16 current: 16
|
||||||
|
# uint64 TorsoWidth : 4; // max: 16 current: 16
|
||||||
|
# uint64 ArmsWidth : 4; // max: 16 current: 16
|
||||||
|
# uint64 LegsWidth : 4; // max: 16 current: 16
|
||||||
|
# uint64 BreastSize : 4; // max: 16 current: 16
|
||||||
|
|
||||||
|
class PropVisualC:
|
||||||
|
# khanat-opennel-code/code/ryzom/common/src/game_share/player_visual_properties.h:163 struct SPropVisualC
|
||||||
|
def __init__(self):
|
||||||
|
self.MorphTarget1 = 0
|
||||||
|
self.MorphTarget2 = 0
|
||||||
|
self.MorphTarget3 = 0
|
||||||
|
self.MorphTarget4 = 0
|
||||||
|
self.MorphTarget5 = 0
|
||||||
|
self.MorphTarget6 = 0
|
||||||
|
self.MorphTarget7 = 0
|
||||||
|
self.MorphTarget8 = 0
|
||||||
|
self.EyesColor = 0
|
||||||
|
self.Tattoo = 0
|
||||||
|
self.CharacterHeight = 0
|
||||||
|
self.TorsoWidth = 0
|
||||||
|
self.ArmsWidth = 0
|
||||||
|
self.LegsWidth = 0
|
||||||
|
self.BreastSize = 0
|
||||||
|
|
||||||
|
def set_compress_data(self, value):
|
||||||
|
self.MorphTarget1 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget2 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget3 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget4 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget5 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget6 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget7 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.MorphTarget8 = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.EyesColor = value & 0x07
|
||||||
|
value >>= 3
|
||||||
|
self.Tattoo = value & 0x7f
|
||||||
|
value >>= 7
|
||||||
|
self.CharacterHeight = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
self.TorsoWidth = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
self.ArmsWidth = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
self.LegsWidth = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
self.BreastSize = value & 0x0f
|
||||||
|
value >>= 4
|
||||||
|
|
||||||
|
def print_yaml(self, outyaml, space):
|
||||||
|
outyaml.write("{0} MorphTarget1: {1}\n".format(space, self.MorphTarget1))
|
||||||
|
outyaml.write("{0} MorphTarget2: {1}\n".format(space, self.MorphTarget2))
|
||||||
|
outyaml.write("{0} MorphTarget3: {1}\n".format(space, self.MorphTarget3))
|
||||||
|
outyaml.write("{0} MorphTarget4: {1}\n".format(space, self.MorphTarget4))
|
||||||
|
outyaml.write("{0} MorphTarget5: {1}\n".format(space, self.MorphTarget5))
|
||||||
|
outyaml.write("{0} MorphTarget6: {1}\n".format(space, self.MorphTarget6))
|
||||||
|
outyaml.write("{0} MorphTarget7: {1}\n".format(space, self.MorphTarget7))
|
||||||
|
outyaml.write("{0} MorphTarget8: {1}\n".format(space, self.MorphTarget8))
|
||||||
|
outyaml.write("{0} EyesColor: {1}\n".format(space, self.EyesColor))
|
||||||
|
outyaml.write("{0} Tattoo: {1}\n".format(space, self.Tattoo))
|
||||||
|
outyaml.write("{0} CharacterHeight: {1}\n".format(space, self.CharacterHeight))
|
||||||
|
outyaml.write("{0} TorsoWidth: {1}\n".format(space, self.TorsoWidth))
|
||||||
|
outyaml.write("{0} ArmsWidth: {1}\n".format(space, self.ArmsWidth))
|
||||||
|
outyaml.write("{0} LegsWidth: {1}\n".format(space, self.LegsWidth))
|
||||||
|
outyaml.write("{0} BreastSize: {1}\n".format(space, self.BreastSize))
|
Loading…
Reference in a new issue