class MovementManager(Model): base_move_speed = FloatField(0x2D0, label='基本移动速度') current_move_speed = FloatField(0x2CC, label='当前移动速度') current_jump_height = FloatField(0x300, label='当前跳跃高度') base_jump_height = FloatField(0x304, label='基本跳跃高度') rriction = FloatField(0x2FC, label='摩擦力') coord = CoordField(0x5C, label='坐标') move_vector = CoordField(0x124, label='移动向量')
class PlayerConfig(Model): """玩家属性""" player_model_scale = FloatField(0x78, label='角色模型大小') player_visibility = ByteField(0xBF, label='角色能见度') move_speed_mult = FloatField(0x310, label='移动速度倍数') current_weapon = ModelPtrField(0x470, Weapon) second_wind = ModelPtrField((0x6A4, 0x68), SecondWind) hit_ricochet_chance = FloatField(0x948, label='击飞') miss_ricochet_chance = FloatField(0x9AC, label='避开击飞') ignore_fatal_damage_chance = FloatField(0x9E8, label='免受致命伤') coord = CoordField(0x60, label='坐标') move_vector = CoordField(0x104, label='移动向量')
class Vehicle(Entity, GTA3Vehicle): SIZE = 0x5dc hp = Field(0x204, float) roll = CoordField(0x04) dir = CoordField(0x14) turn = CoordField(0x7C) color1 = Field(0x30, int, 1) color2 = Field(0x31, int, 1) model_id = Field(0x5c, int, 1) primaryColor = Field(0x1a0, int, 1) secondaryColor = Field(0x1a1, int, 1) num_passengers = Field(0x1cc, int, 1) max_passengers = Field(0x1d0, int, 1) door_status = Field(0x230, int, 1) @property def passengers(self): offset = 0x1ac for i in range(4): yield Player(self.handler.read32(self.addr + offset), self.context) offset += 4 @property def driver(self): addr = self.handler.read32(self.addr + 0x1a8) if addr: return Player(addr, self.context) def stop(self): self.speed = (0, 0, 0) def flip(self): self.dir[0] = -self.dir[0] self.dir[1] = -self.dir[1] def lock_door(self): self.door_status = 2 def unlock_door(self): self.door_status = 1 @property def name(self): model_id = self.model_id try: item = next(filter(lambda x: x[1] == model_id, VEHICLE_LIST)) return item[0] except Exception: return None
class MemVehicle(Entity): SIZE = 0x20d0 hp = Field(0x200, float) engine_hp = Field(0x10FC, float) roll = CoordField(0x04) dir = CoordField(0x14) numPassengers = Field(0x1c8, int, 1) maxPassengers = Field(0x1cc, int, 1) door_status = Field(0x224, int, 1) flags = Field(0x1f5, int, 1) primaryColor = Field(0x19c, int, 1) secondaryColor = Field(0x19d, int, 1) type = Field(0x284, int, 4)
class Vehicle(Entity, GTA3Vehicle): SIZE = 0x5a8 hp = Field(0x200, float) roll = CoordField(0x04) dir = CoordField(0x14) num_passengers = Field(0x1c8, int, 1) max_passengers = Field(0x1cc, int, 1) door_status = Field(0x224, int, 1) flags = Field(0x1f5, int, 1) primaryColor = Field(0x19c, int, 1) secondaryColor = Field(0x19d, int, 1) type = Field(0x284, int, 4) @property def passengers(self): offset = 0x1a8 for i in range(4): yield Player(self.handler.read32(self.addr + offset), self.context) offset += 4 @property def driver(self): addr = self.handler.read32(self.addr + 0x1a4) if addr: return Player(addr, self.context) def stop(self): self.speed = (0, 0, 0) def flip(self): self.coord[2] += 0.05 self.dir[0] = -self.dir[0] self.dir[1] = -self.dir[1] def lock_door(self): self.door_status = 2 def unlock_door(self): self.door_status = 1 def ignoreDamage(self, ignore=True): if ignore: self.flags |= 4 else: self.flags &= u32(~4)
class PlayerConfig(Model): """玩家属性""" player_model_scale = FloatField(0x78, label='角色模型大小') time_scale_multiplier = FloatField(0x328, label='时间流逝倍数') gravity = FloatField(0x3A0, label='重力') # confirm player_visibility = ByteField(0xBF, label='角色能见度') player_allegiance = Field(0x518, label='角色忠诚') move_speed_mult = FloatField(0x320, label='移动速度倍数') current_weapon = ModelPtrField(0x480, Weapon) hit_ricochet_chance = FloatField(0xA1C, label='击飞') miss_ricochet_chance = FloatField(0xA80, label='避开击飞') ignore_fatal_damage_chance = FloatField(0xABC, label='免受致命伤') bullet_reflect_chance = FloatField(0xA44, label='子弹反弹几率') coord = CoordField(0x60, label='坐标') move_vector = CoordField(0x104, label='移动向量') ffyl_time_mult = FloatField(0xBDC, label='原地复活时间倍数') ffyl_Health_mult = FloatField(0xBDC, label='原地复活生命倍数') current_vehicle = ModelPtrField(0x450, VehicleManager)
class Character(Model): health = WordField(0x1364, label="HP") health_max = WordField(0x1366, label="最大HP") coord = CoordField(0x30, label="坐标") # idle = Field(0x10E0) # target = Field(0x2DA4, label="目标") # ai = Field(0x2DA8, label="AI") # attack_reaction = Field(0x1358) # merce_kill_counter = Field(0x25BC) invincible = ToggleField(0x135C, label="无敌", enable=0, disable=1) items = ArrayField(0x21A8, 24, ModelField(0, IngameItem))
class Marker(BaseBlip): SIZE = 56 color = Field(0) blipType = Field(4) entity_handle = Field(8) coord = CoordField(24) index = WordField(36) bright = ByteField(38) active = ByteField(39) sprite = ByteField(52)
class Marker(BaseBlip): SIZE = 48 color = Field(0) blipType = Field(4) entity_handle = Field(8) coord = CoordField(20) index = WordField(3) bright = ByteField(34) active = ByteField(35) sprite = ByteField(44)
class Entity(Physicle): SPECIAL_BP = 2 SPECIAL_FP = 3 SPECIAL_DP = 6 SPECIAL_EP = 7 special = Field( 0x42, int, 1 ) # bit coded for BP DP EP FP (Prevent from Explosion, Collision, Bullet, Fire) speed = CoordField(0x44) turn_speed = CoordField(0x50) model_id = Field(0x22, int, 2) weight = Field(0x8c, float) @property def pos(self): return Pos(self.handler.read32(self.addr + 0x14), self.handler) @property def coord(self): return self.pos.coord @coord.setter def coord(self, val): self.pos.coord = val def stop(self): self.speed = (0, 0, 0) self.turn_speed = (0, 0, 0) def set_proof(self, on, bitindex): # 设置免疫属性 if on: self.special |= 1 << bitindex else: self.special &= ~(1 << 1)
class Character(Model): """角色""" id = Field((0x010C, 0x16), bytes, 6) health = WordField(0x0F10, label="生命值") health_max = WordField(0x0F12, label="生命值上限") invincible = ToggleField(0x0FC4, enable=0, disable=1, label="无敌") stamina = Field(0x3B00, float, label="体力") stamina_max = Field(0x3B04, float, label="体力上限") coord = CoordField(0x50, label="坐标") moving_speed = Field(0x54, float, label="移动速度") cur_item = ByteField(0x46D8) # 当前使用的物品序号(只读) items = ArrayField(0x46E0, 24, ModelField( 0, IngameItem)) # 水平武器: 0~6, 药丸: 7, 垂直武器: 8~12 其他物品: 15~23 rapid_fire = Field(0x4F4C, float, label="快速开火") fix_weapon_switch = Field(0x46D0, float) # 竖行武器切换至横行武器时的修正? is_wet = Field(0x2E34, label="是否湿了")
class NativeContext(NativeContext): """GTAIV原生函数调用的环境""" SIZE = 160 m_nDataCount = Field(0x0C) # unsigned int m_nDataCount; // 0C-10 m_pOriginalData = ArrayField(0x10, 4, ModelPtrField(0, _Vector3)) # CVector3 * m_pOriginalData[4]; // 10-20 m_TemporaryData = ArrayField(0x20, 4, CoordField(0, length=4)) # Vector4 m_TemporaryData[4]; // 20-60 m_TempStack = ArrayField(0x60, 16, Field(0)) # int m_TempStack[16]; // 60-A0 def get_result(self, type, size=0): """获取调用结果""" if self.m_nDataCount: """推测是把local Vector变量写回传进的Vector指针参数""" for i in range(self.m_nDataCount): self.m_pOriginalData[i].value.set(self.m_TemporaryData[i]) self.m_nDataCount = 0 return self.handler.read(self.m_TempStack.addr, type, size) def reset(self): self.m_nArgCount = 0 self.m_nDataCount = 0
class Marker(ManagedModel): SIZE = 40 MARKER_TYPE_CAR = 1 MARKER_TYPE_PED = 2 MARKER_TYPE_OBJECT = 3 MARKER_TYPE_COORDS = 4 MARKER_TYPE_CONTACT = 5 AVAILABLE_TYPE = (MARKER_TYPE_CAR, MARKER_TYPE_PED) MARKER_SPRITE_WAYPOINT = 41 color = Field(0) entity_handle = Field(4, int) coord = CoordField(8) sprite = Field(36, int, 1) flags1 = Field(37, int, 1) flags2 = Field(38, int, 1) @property def bright(self): return self.flags1 & 1 @property def blipType(self): return self.flags2 >> 2 @property def entity(self): blipType = self.blipType index = self.entity_handle >> 8 if blipType is __class__.MARKER_TYPE_CAR: return self.context.vehicle_pool[index] elif blipType is __class__.MARKER_TYPE_PED: return self.context.ped_pool[index] elif blipType is __class__.MARKER_TYPE_OBJECT: return self.context.object_pool[index]
class UnitType(Model): # type = ByteField(0x4, label="类型") # 类型 # dll_name = WordField(0xC, label="语言DLL:名称") # dll_hint = WordField(0xE, label="语言DLL:创建提示") # id1 = WordField(0x10, label="ID 1") # id2 = WordField(0x12, label="ID 2") # id3 = WordField(0x14, label="ID 3") # type2 = WordField(0x16, label="类别") # fn_str = ModelPtrField(0x18, StringField(0), 'fn名称指针') # name_str = ModelPtrField(0x20, StringField(0), '名称指针') # dll_help = Field(0xA8, label="语言DLL:帮助说明") # dll_hot_text = Field(0xAC, label="语言DLL:热键文字") # dll_hot_text_ = Field(0xB0, label="热键文字") hp_max = WordField(0x2A, label="HP上限") view = FloatField(0x2C, label="视野") shipload = ByteField(0x30, label="Shipload") collision = FloatField(0x34, label="碰撞") move_speed = FloatField(0xC8, label="移动速度") search = FloatField(0x104, label="搜索") work_efficiency = FloatField(0x108, label="工作效率") def_items = ModelPtrField(0x128, AtkDefItems) # 防御列表 atk_items = ModelPtrField(0x130, AtkDefItems) # 攻击列表 range_max = FloatField(0x138, label="最大射程") damage_radius = FloatField(0x13C, label="攻击范围") damage_type = Field(0x140, label="伤害方式") atk_interval = FloatField(0x144, label="攻击间隔") # 越小攻速越快(>0) atk_interval2 = FloatField(0x168, label="攻击间隔2") range_min = FloatField(0x15C, label="最小射程") base_def = WordField(0x160, label="显示的防御") base_atk = WordField(0x162, label="显示的攻击") range_base = FloatField(0x164, label="显示的射程") construction_time = WordField(0x182, label="建造时间") thrown_object = WordField(0x148, label="抛掷物单位") addition_thrown_object = WordField(0x1AC, label="附加抛掷物单位") min_thrown_object_count = WordField(0x19C, label="最小附加弹药数") thrown_object_area = CoordField(0x1A0, label="抛掷物产生区域")
class Entity(Physicle): coord = CoordField(0x34) speed = CoordField(0x70) weight = Field(0xB8, float)
class Entity(Physicle): coord = CoordField(0x34) speed = CoordField(0x78) weight = Field(0xc0, float) model_id = Field(0x5c, int, 1)
class _Vector3(Model): value = CoordField(0)
class Movement(Model): coord = CoordField(0, label='坐标') air_time = FloatField(-0x14, label='空中滞留时间') # 初始30, 减慢为15 jump_height = FloatField(-0x18, label='跳跃高度') move_speed_mult = FloatField(-0x38, label='移动速度倍数')
class VehicleManager(Model): boost = ModelPtrField((0x38C, 0x188), Value, label='推进剂') health = ModelPtrField(0x394, Value, label='血量') scale = FloatField(0x78, label='缩放') coord = CoordField(0x60, label='坐标')
class Pos(Model): grad = CoordField(0) looking = CoordField(0x10) coord = CoordField(0x30)