clientbot/tools/CCharacterSummary.py

146 lines
6.9 KiB
Python

#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# module CCharacterSummary
#
# 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
from tools import convertUStringToString
class SPropVisualA():
def __init__(self):
'''
khanat-opennel-code/code/ryzom/common/src/game_share/player_visual_properties.h # struct SPropVisualA
'''
self.Sex = False #: 1; // max: 2 current: 2
self.JacketModel = 0 #: 8; // max: 256 current: 93
self.JacketColor = 0 #: 3; // max: 8 current: 8
self.TrouserModel = 0 #: 8; // max: 256 current: 104
self.TrouserColor = 0 #: 3; // max: 8 current: 8
self.WeaponRightHand = 0 #: 10; // max: 1024 current: 457
self.WeaponLeftHand = 0 #: 8; // max: 256 current: 63
self.ArmModel = 0 #: 8; // max: 256 current: 94
self.ArmColor = 0 #: 3; // max: 8 current: 8
self.HatModel = 0 #: 9; // max: 512 current: 192
self.HatColor = 0 #: 3; // max: 8 current: 8
def read(self, msgin):
self.Sex = msgin.readBool('Sex')
self.JacketModel = msgin.readUint8('JacketModel')
self.JacketColor = msgin.readSerial(3, 'JacketModel')
self.TrouserModel = msgin.readSerial(8, 'TrouserModel')
self.TrouserColor = msgin.readSerial(3, 'TrouserColor')
self.WeaponRightHand = msgin.readSerial(10, 'WeaponRightHand')
self.WeaponLeftHand = msgin.readSerial(8, 'WeaponLeftHand')
self.ArmModel = msgin.readSerial(8, 'ArmModel')
self.ArmColor = msgin.readSerial(3, 'ArmColor')
self.HatModel = msgin.readSerial(9, 'HatModel')
self.HatColor = msgin.readSerial(3, 'HatColor')
class SPropVisualB():
def __init__(self):
self.Name = "" #: 16;
self.HandsModel = 0 #: 9; // max: 512 current: 90
self.HandsColor = 0 #: 3; // max: 8 current: 8
self.FeetModel = 0 #: 9; // max: 512 current: 94
self.FeetColor = 0 #: 3; // max: 8 current: 8
self.RTrail = 0 #: 4;
self.LTrail = 0 #: 3;
self.NotUsed = 0 # 17 : # not used -> just to complete 64 bit
def read(self, msgin):
self.Name = msgin.readSerial(16, 'Name')
self.HandsModel = msgin.readSerial(9, 'HandsModel')
self.HandsColor = msgin.readSerial(3, 'HandsColor')
self.FeetModel = msgin.readSerial(9, 'FeetModel')
self.FeetColor = msgin.readSerial(3, 'FeetColor')
self.RTrail = msgin.readSerial(4, 'RTrail')
self.LTrail = msgin.readSerial(3, 'LTrail')
self.NotUsed = msgin.readSerial(17, 'NotUsed')
class SPropVisualC():
def __init__(self):
self.MorphTarget1 = 0 # : 3; // max: 8 current: 8
self.MorphTarget2 = 0 # : 3; // max: 8 current: 8
self.MorphTarget3 = 0 # : 3; // max: 8 current: 8
self.MorphTarget4 = 0 # : 3; // max: 8 current: 8
self.MorphTarget5 = 0 # : 3; // max: 8 current: 8
self.MorphTarget6 = 0 # : 3; // max: 8 current: 8
self.MorphTarget7 = 0 # : 3; // max: 8 current: 8
self.MorphTarget8 = 0 # : 3; // max: 8 current: 8
self.EyesColor = 0 # : 3; // max: 8 current: 8
self.Tattoo = 0 # : 7; // max: 128 current: 64
self.CharacterHeight = 0 # : 4; // max: 16 current: 16
self.TorsoWidth = 0 # : 4; // max: 16 current: 16
self.ArmsWidth = 0 # : 4; // max: 16 current: 16
self.LegsWidth = 0 # : 4; // max: 16 current: 16
self.BreastSize = 0 # : 4; // max: 16 current: 16
self.NotUsed = 0 # 10 : # not used -> just to complete 64 bit
def read(self, msgin):
self.MorphTarget1 = msgin.readSerial(3, 'MorphTarget1')
self.MorphTarget2 = msgin.readSerial(3, 'MorphTarget2')
self.MorphTarget3 = msgin.readSerial(3, 'MorphTarget3')
self.MorphTarget4 = msgin.readSerial(3, 'MorphTarget4')
self.MorphTarget5 = msgin.readSerial(3, 'MorphTarget5')
self.MorphTarget6 = msgin.readSerial(3, 'MorphTarget6')
self.MorphTarget7 = msgin.readSerial(3, 'MorphTarget7')
self.MorphTarget8 = msgin.readSerial(3, 'MorphTarget8')
self.EyesColor = msgin.readSerial(3, 'EyesColor')
self.Tattoo = msgin.readSerial(7, 'Tattoo')
self.CharacterHeight = msgin.readSerial(4, 'CharacterHeight')
self.TorsoWidth = msgin.readSerial(4, 'TorsoWidth')
self.ArmsWidth = msgin.readSerial(4, 'ArmsWidth')
self.LegsWidth = msgin.readSerial(4, 'LegsWidth')
self.BreastSize = msgin.readSerial(4, 'BreastSize')
self.NotUsed = msgin.readSerial(10, 'NotUsed')
class CCharacterSummary():
def __init__(self):
self.version = -1
self.Mainland = 0 # CSessionId
self.Name = ""
self.People = Enum.TPeople.Unknown
self.Location = 0
self.sPropVisualA = SPropVisualA()
self.sPropVisualB = SPropVisualB()
self.sPropVisualC = SPropVisualC()
self.sheetId = 0
self.Title = Enum.ECharacterTitle.NB_CHARACTER_TITLE
self.CharacterSlot = 255
self.InRingSession = False
self.HasEditSession = False
self.InNewbieland = False
def read(self, msgin):
'''
khanat-opennel-code/code/ryzom/common/src/game_share/character_summary.cpp # void CCharacterSummary::serial(NLMISC::IStream &f)
'''
self.version = msgin.readUint8('version')
self.Mainland = msgin.readUint32('Mainland')
self.Name = convertUStringToString.convertUStringToString(msgin.readUString('Name'))
self.People = msgin.readSint32('People')
self.Location = msgin.readUint32('Location')
self.sPropVisualA.read(msgin)
self.sPropVisualB.read(msgin)
self.sPropVisualC.read(msgin)
self.sheetId = msgin.readUint32('SheetId')
self.Title = msgin.readSint32('Title') # see ECharacterTitle
self.CharacterSlot = msgin.readUint8('CharacterSlot')
self.InRingSession = msgin.readBool('InRingSession')
self.HasEditSession = msgin.readBool('HasEditSession')
self.InNewbieland = msgin.readBool('InNewbieland')