clientbot/tools/PropVisual.py

221 lines
8.5 KiB
Python

#!/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))