def get_hair_key(self): value1, value2 = self.get_raw_value() value2 = get_lowest_byte_value(value2, 128) value2 = get_lowest_byte_value(value2, 8) # Value with offset applied value = value1 + (value2 * 256) key = False if value >= 0 and value <= 3: key = self.get_hair_key_bald(value) elif value >= 4 and value <= 83: key = self.get_hair_key_buzz_cut(value) elif value >= 84 and value <= 107: key = self.get_hair_key_very_short_1(value) elif value >= 108 and value <= 152: key = self.get_hair_key_very_short_2(value) elif value >= 153 and value <= 560: key = self.get_hair_key_straight_1(value) elif value >= 561 and value <= 659: key = self.get_hair_key_straight_2(value) elif value >= 660 and value <= 863: key = self.get_hair_key_curly_1(value) elif value >= 864 and value <= 911: key = self.get_hair_key_curly_2(value) elif value >= 912 and value <= 947: key = self.get_hair_key_ponytail_1(value) elif value >= 948 and value <= 983: key = self.get_hair_key_ponytail_2(value) elif value >= 984 and value <= 1007: key = self.get_hair_key_dreadlocks(value) elif value >= 1008 and value <= 1025: key = self.get_hair_key_pulled_back(value) else: key = self.get_hair_key_special(value) return key
def get_hair_key_buzz_cut(self, value): darkness_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, 3: PlayerAttributeOption.OPT_4, } darkness_value = get_lowest_byte_value(value, 4) darkness_value = darkness_by_value[darkness_value] front_by_value = { 4: PlayerAttributeOption.OPT_1, 8: PlayerAttributeOption.OPT_2, 12: PlayerAttributeOption.OPT_3, 16: PlayerAttributeOption.OPT_4, 0: PlayerAttributeOption.OPT_5, } front_value = get_lowest_byte_value(value, 20) front_value = get_base_byte_value(front_value, 4) front_value = front_by_value[front_value] shape_by_value = { 0: PlayerAttributeOption.OPT_1, 20: PlayerAttributeOption.OPT_2, 40: PlayerAttributeOption.OPT_3, 60: PlayerAttributeOption.OPT_4, } shape_value = get_base_byte_value(value - 4, 20) shape_value = shape_by_value[shape_value] hair_type = PlayerAttributeOption.OPT_BUZZ_CUT hair_shape = str(shape_value) hair_front = str(front_value) hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = str(darkness_value) bandana_type = PlayerAttributeOption.OPT_NA return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_age(self): value = self.get_value() value = get_lowest_byte_value(value, 64) # If value is an odd number then it has been set oddly # and most likely nationality has not been set or is messed up # Takeaway 1 to get a "correct" value if (value % 2) != 0: value -= 1 return (value // 2) + self.min_age
def get_hair_key_curly_2(self, value): hair_type = PlayerAttributeOption.OPT_CURLY_2 hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA shape_1_base = 864 shape_val_count = 12 shape_base_offset_by_value = { 864: (PlayerAttributeOption.OPT_1, 0), 876: (PlayerAttributeOption.OPT_2, 1), 888: (PlayerAttributeOption.OPT_3, 2), 900: (PlayerAttributeOption.OPT_4, 3), } shape_base_offset = get_base_byte_value(value, shape_val_count) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, } volume_value = get_lowest_byte_value(value - (shape_base), 2) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 2: PlayerAttributeOption.OPT_2, 4: PlayerAttributeOption.OPT_3, 6: PlayerAttributeOption.OPT_4, 8: PlayerAttributeOption.OPT_5, 10: PlayerAttributeOption.OPT_6, } front_value = get_base_byte_value(value - (shape_base), 2) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_hair_key_ponytail_2(self, value): hair_type = PlayerAttributeOption.OPT_PONYTAIL_2 hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA shape_1_base = 948 shape_val_count = 12 shape_base_offset_by_value = { 948: (PlayerAttributeOption.OPT_1, 0), 960: (PlayerAttributeOption.OPT_2, 1), 972: (PlayerAttributeOption.OPT_3, 2), } shape_base_offset = get_base_byte_value(value, shape_val_count) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, } volume_value = get_lowest_byte_value(value - (shape_base), 3) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 3: PlayerAttributeOption.OPT_2, 6: PlayerAttributeOption.OPT_3, 9: PlayerAttributeOption.OPT_4, } front_value = get_base_byte_value(value - (shape_base), 3) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_hair_key_dreadlocks(self, value): hair_type = PlayerAttributeOption.OPT_DREADLOCKS hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA shape_1_base = 984 shape_val_count = 8 shape_base_offset_by_value = { 984: (PlayerAttributeOption.OPT_1, 0), 992: (PlayerAttributeOption.OPT_2, 1), 1000: (PlayerAttributeOption.OPT_3, 2), } shape_base_offset = get_base_byte_value(value, shape_val_count) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, } volume_value = get_lowest_byte_value(value - (shape_base), 2) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 2: PlayerAttributeOption.OPT_2, 4: PlayerAttributeOption.OPT_3, 6: PlayerAttributeOption.OPT_4, } front_value = get_base_byte_value(value - (shape_base), 2) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_hair_key_very_short_1(self, value): front_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, 3: PlayerAttributeOption.OPT_4, 4: PlayerAttributeOption.OPT_5, 5: PlayerAttributeOption.OPT_6, } front_value = get_lowest_byte_value(value, 6) front_value = front_by_value[front_value] shape_by_value = { 84: PlayerAttributeOption.OPT_1, 90: PlayerAttributeOption.OPT_2, 96: PlayerAttributeOption.OPT_3, 102: PlayerAttributeOption.OPT_4, } shape_value = get_base_byte_value(value, 6) shape_value = shape_by_value[shape_value] hair_type = PlayerAttributeOption.OPT_VERY_SHORT_1 hair_shape = str(shape_value) hair_front = str(front_value) hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_brows_type_label(self): value = self.get_value() value = get_lowest_byte_value(value, 32) return self.array_opts_brows_type[value]
def get_eye_color_two_label(self): value = self.get_value()[1] value = get_lowest_byte_value(value, 128) value = get_base_byte_value(value, 8) return self.array_opts_eye_color_two[value]
def get_weak_foot_frequency_label(self): value = self.get_value() value = get_lowest_byte_value(value, 64) value = get_base_byte_value(value, 8) return self.array_opts_weak_foot_frequency[value]
def get_one_touch_pass_label(self): value = self.get_value() value = get_lowest_byte_value(value, 2) return self.array_opts_one_touch_pass[value]
def get_marking_label(self): value = self.get_value() value = get_base_byte_value(value, 4) value = get_lowest_byte_value(value, 8) return self.array_opts_marking[value]
def get_covering_label(self): value = self.get_value() value = get_base_byte_value(value, 16) value = get_lowest_byte_value(value, 32) return self.array_opts_covering[value]
def get_penalty_stopper_label(self): value = self.get_value() value = get_base_byte_value(value, 64) value = get_lowest_byte_value(value, 128) return self.array_opts_penalty_stopper[value]
def get_hair_key_straight_2(self, value): hair_type = PlayerAttributeOption.OPT_STRAIGHT_2 hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA shape_1_base = 561 shape_val_count = 33 shape_base_offset_by_value = { 561: (PlayerAttributeOption.OPT_1, 0), 594: (PlayerAttributeOption.OPT_2, 1), 627: (PlayerAttributeOption.OPT_3, 2), } shape_base_offset = get_base_byte_value(value, shape_val_count) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) front_1_to_2_count = 18 if value < shape_base + front_1_to_2_count: # Front 1-2 # Front 1-2 can have bandana set bandana_type_by_value = { 0: PlayerAttributeOption.OPT_N, 1: PlayerAttributeOption.OPT_1, 2: PlayerAttributeOption.OPT_2, } bandana_value = get_lowest_byte_value(value, 3) bandana_type = bandana_type_by_value[bandana_value] volume_by_value = { 0: PlayerAttributeOption.OPT_1, 3: PlayerAttributeOption.OPT_2, 6: PlayerAttributeOption.OPT_3, } volume_value = get_base_byte_value(value - shape_base, 3) volume_value = get_lowest_byte_value(volume_value, 9) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 9: PlayerAttributeOption.OPT_2, } front_value = get_base_byte_value(value - shape_base, 9) hair_front = front_by_value[front_value] else: # Front 3-7 volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, } volume_value = get_lowest_byte_value( value - (shape_base + front_1_to_2_count), 3 ) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_3, 3: PlayerAttributeOption.OPT_4, 6: PlayerAttributeOption.OPT_5, 9: PlayerAttributeOption.OPT_6, 12: PlayerAttributeOption.OPT_7, } front_value = get_base_byte_value( value - (shape_base + front_1_to_2_count), 3 ) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_hair_key_straight_1(self, value): hair_type = PlayerAttributeOption.OPT_STRAIGHT_1 hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA # Each shape has 102 vals, need to get offset to nearest 102 (153->102) shape_1_base = 153 shape_val_count = 102 shape_offset = 51 shape_base_offset_by_value = { 102: (PlayerAttributeOption.OPT_1, 0), 204: (PlayerAttributeOption.OPT_2, 1), 306: (PlayerAttributeOption.OPT_3, 2), 408: (PlayerAttributeOption.OPT_4, 3), } shape_base_offset = get_base_byte_value( value - shape_offset, shape_val_count ) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) front_1_to_9_count = 81 if value < shape_base + front_1_to_9_count: # Front 1-9 # Front 1-9 can have bandana set bandana_type_by_value = { 0: PlayerAttributeOption.OPT_N, 1: PlayerAttributeOption.OPT_1, 2: PlayerAttributeOption.OPT_2, } bandana_value = get_lowest_byte_value(value, 3) bandana_type = bandana_type_by_value[bandana_value] volume_by_value = { 0: PlayerAttributeOption.OPT_1, 3: PlayerAttributeOption.OPT_2, 6: PlayerAttributeOption.OPT_3, } volume_value = get_base_byte_value(value - shape_base, 3) volume_value = get_lowest_byte_value(volume_value, 9) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 9: PlayerAttributeOption.OPT_2, 18: PlayerAttributeOption.OPT_3, 27: PlayerAttributeOption.OPT_4, 36: PlayerAttributeOption.OPT_5, 45: PlayerAttributeOption.OPT_6, 54: PlayerAttributeOption.OPT_7, 63: PlayerAttributeOption.OPT_8, 72: PlayerAttributeOption.OPT_9, } front_value = get_base_byte_value(value - shape_base, 9) hair_front = front_by_value[front_value] else: # Front 10-16 volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, } volume_value = get_lowest_byte_value( value - (shape_base + front_1_to_9_count), 3 ) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_10, 3: PlayerAttributeOption.OPT_11, 6: PlayerAttributeOption.OPT_12, 9: PlayerAttributeOption.OPT_13, 12: PlayerAttributeOption.OPT_14, 15: PlayerAttributeOption.OPT_15, 18: PlayerAttributeOption.OPT_16, } front_value = get_base_byte_value( value - (shape_base + front_1_to_9_count), 3 ) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_hair_key_very_short_2(self, value): front_value = "" # Options start at byte val 108, need to get to nearest 10 # as there are 5 or 10 hair front options depending on the shape shape_offset = 2 if value <= 137: # Shapes 1-3 have 10 hair front options front_by_value_1 = { 8: PlayerAttributeOption.OPT_1, 9: PlayerAttributeOption.OPT_2, 0: PlayerAttributeOption.OPT_3, 1: PlayerAttributeOption.OPT_4, 2: PlayerAttributeOption.OPT_5, 3: PlayerAttributeOption.OPT_6, 4: PlayerAttributeOption.OPT_7, 5: PlayerAttributeOption.OPT_8, 6: PlayerAttributeOption.OPT_9, 7: PlayerAttributeOption.OPT_10, } front_value = get_lowest_byte_value(value, 10) front_value = front_by_value_1[front_value] shape_by_value_1 = { 110: PlayerAttributeOption.OPT_1, 120: PlayerAttributeOption.OPT_2, 130: PlayerAttributeOption.OPT_3, } shape_value = get_base_byte_value(value + shape_offset, 10) shape_value = shape_by_value_1[shape_value] else: # Shapes 4-6 have 5 hair front options front_by_value_2 = { 3: PlayerAttributeOption.OPT_1, 4: PlayerAttributeOption.OPT_2, 0: PlayerAttributeOption.OPT_3, 1: PlayerAttributeOption.OPT_4, 2: PlayerAttributeOption.OPT_5, } front_value = get_lowest_byte_value(value, 5) front_value = front_by_value_2[front_value] shape_by_value_2 = { 140: PlayerAttributeOption.OPT_4, 145: PlayerAttributeOption.OPT_5, 150: PlayerAttributeOption.OPT_6, } shape_value = get_base_byte_value(value + shape_offset, 5) shape_value = shape_by_value_2[shape_value] hair_type = PlayerAttributeOption.OPT_VERY_SHORT_2 hair_shape = str(shape_value) hair_front = str(front_value) hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_ankle_tape_label(self): value = self.get_value() value = get_lowest_byte_value(value, 128) value = get_base_byte_value(value, 64) return self.array_opts_ankle_tape[value]
def get_consistency_label(self): value = self.get_value() value = get_lowest_byte_value(value, 8) return self.array_opts_consistency[value]
def get_first_opt_label(cls, value): value = get_lowest_byte_value(value, 16) return PlayerAttributePhysicalLinkedOpts.FIRST_OPT_BY_VALUE[value]
def get_dribble_style_label(self): value = self.get_value() value = get_lowest_byte_value(value, 4) return self.array_opts_dribble_style[value]
def get_hair_key_curly_1(self, value): hair_type = PlayerAttributeOption.OPT_CURLY_1 hair_shape = PlayerAttributeOption.OPT_NA hair_front = PlayerAttributeOption.OPT_NA hair_volume = PlayerAttributeOption.OPT_NA hair_darkness = PlayerAttributeOption.OPT_NA bandana_type = PlayerAttributeOption.OPT_NA # Each shape has 51 vals, need to get offset to nearest 51 (660->612) shape_1_base = 660 shape_val_count = 51 shape_offset = 48 shape_base_offset_by_value = { 612: (PlayerAttributeOption.OPT_1, 0), 663: (PlayerAttributeOption.OPT_2, 1), 714: (PlayerAttributeOption.OPT_3, 2), 765: (PlayerAttributeOption.OPT_4, 3), } shape_base_offset = get_base_byte_value( value - shape_offset, shape_val_count ) hair_shape, shape_base_multiplier = shape_base_offset_by_value[ shape_base_offset ] shape_base = shape_1_base + (shape_val_count * shape_base_multiplier) front_1_to_5_count = 45 if value < shape_base + front_1_to_5_count: # Front 1-5 # Front 1-5 can have bandana set bandana_type_by_value = { 0: PlayerAttributeOption.OPT_N, 1: PlayerAttributeOption.OPT_1, 2: PlayerAttributeOption.OPT_2, } bandana_value = get_lowest_byte_value(value, 3) bandana_type = bandana_type_by_value[bandana_value] volume_by_value = { 0: PlayerAttributeOption.OPT_1, 3: PlayerAttributeOption.OPT_2, 6: PlayerAttributeOption.OPT_3, } volume_value = get_base_byte_value(value - shape_base, 3) volume_value = get_lowest_byte_value(volume_value, 9) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_1, 9: PlayerAttributeOption.OPT_2, 18: PlayerAttributeOption.OPT_3, 27: PlayerAttributeOption.OPT_4, 36: PlayerAttributeOption.OPT_5, } front_value = get_base_byte_value(value - shape_base, 9) hair_front = front_by_value[front_value] else: # Front 6-7 volume_by_value = { 0: PlayerAttributeOption.OPT_1, 1: PlayerAttributeOption.OPT_2, 2: PlayerAttributeOption.OPT_3, } volume_value = get_lowest_byte_value( value - (shape_base + front_1_to_5_count), 3 ) hair_volume = volume_by_value[volume_value] front_by_value = { 0: PlayerAttributeOption.OPT_6, 3: PlayerAttributeOption.OPT_7, } front_value = get_base_byte_value( value - (shape_base + front_1_to_5_count), 3 ) hair_front = front_by_value[front_value] return ( hair_type, hair_shape, hair_front, hair_volume, hair_darkness, bandana_type, )
def get_d_line_control_label(self): value = self.get_value() value = get_base_byte_value(value, 32) value = get_lowest_byte_value(value, 64) return self.array_opts_d_line_control[value]
def get_bracelet_color_label(self): value = self.get_value() value = get_lowest_byte_value(value, 32) value = round_down(value, 4) return self.array_opts_bracelet_color[value]
def get_sliding_label(self): value = self.get_value() value = get_base_byte_value(value, 8) value = get_lowest_byte_value(value, 16) return self.array_opts_sliding[value]
def get_undershorts_color_label(self): value = self.get_value()[0] value = get_lowest_byte_value(value, 8) return self.array_opts_undershorts_color[value]
def get_outside_label(self): value = self.get_value() value = get_base_byte_value(value, 2) value = get_lowest_byte_value(value, 4) return self.array_opts_outside[value]
def get_socks_type_label(self): value = self.get_value()[0] value = get_lowest_byte_value(value, 32) value = get_base_byte_value(value, 8) return self.array_opts_socks_type[value]
def get_face_type_label(self): value = self.get_value() value = get_lowest_byte_value(value, 4) return self.array_opts_face_type[value]
def get_rgb_b_label(self): value = self.get_value() value = get_lowest_byte_value(value, 64) value = self.MAX_RGB_B_VALUE - value return str(value)