示例#1
0
    def _set_start_location(self):
        race = CharacterRace(self.player.race)
        coords = START_LOCATION[race]

        self.player.x = coords['x']
        self.player.y = coords['y']
        self.player.z = coords['z']
        self.player.orientation = float(0)

        region = self.session.query(Region).filter_by(
            region_id=coords['region_id']).first()

        self.player.region = region
        self.player.map_id = coords['map_id']
示例#2
0
    def _parse_packet(self):
        # omit first 6 bytes, cause 01-02 = packet size, 03-04 = opcode (0x1ED), 05-06 - unknown null-bytes
        tmp_buf = BytesIO(self.packet[6:])

        result = dict()

        result['name'] = CharacterCreate._parse_account_name(tmp_buf)

        char_data = unpack('<9B', tmp_buf.read(9))
        result['race'] = CharacterRace(char_data[0]).value
        result['char_class'] = CharacterClass(char_data[1]).value
        result['gender'] = CharacterGender(char_data[2]).value

        features = char_data[3:8]
        result['skin'] = features[0]
        result['face'] = features[1]
        result['hair_style'] = features[2]
        result['hair_color'] = features[3]
        result['facial_hair'] = features[4]

        return result
示例#3
0
 def _set_faction_template_id(self):
     race = CharacterRace(self.player.race)
     self.player.faction_template = CHARACTER_DISPLAY_ID[race][
         'faction_template']
示例#4
0
 def _set_display_id(self):
     race = CharacterRace(self.player.race)
     gender = CharacterGender(self.player.gender)
     display_id = CHARACTER_DISPLAY_ID[race][gender]
     self.player.display_id = self.player.native_display_id = display_id
示例#5
0
 def _get_base_attribute(attribute, player: Player):
     race = CharacterRace(player.race)
     char_class = CharacterClass(player.char_class)
     mod = BASE_STATS_MOD[race][attribute]
     base_stat = BASE_STATS[char_class][attribute]
     return base_stat[player.level] - abs(mod * player.level)