Where in the client side can I find the order for the resp packets?
func (c *Character) SpawnCharacter() ([]byte, error) {
if c == nil {
return nil, nil
}
resp := CHARACTER_SPAWNED
resp.Insert(utils.IntToBytes(uint64(c.PseudoID), 2, true), 6) // character pseudo id
if c.IsActive {
resp[12] = 3
} else {
resp[12] = 4
}
/*
if c.DuelID > 0 {
resp.Overwrite(utils.IntToBytes(500, 2, true), 13) // duel state
}
*/
resp[17] = byte(len(c.Name)) // character name length
resp.Insert([]byte(c.Name), 18) // character name
index := len(c.Name) + 18 + 4
resp[index] = byte(c.Type) // character type
index += 1
index += 8
coordinate := ConvertPointToLocation(c.Coordinate)
resp.Insert(utils.FloatToBytes(coordinate.X, 4, true), index) // coordinate-x
index += 4
resp.Insert(utils.FloatToBytes(coordinate.Y, 4, true), index) // coordinate-y
index += 8
resp.Insert(utils.FloatToBytes(coordinate.X, 4, true), index) // coordinate-x
index += 4
resp.Insert(utils.FloatToBytes(coordinate.Y, 4, true), index) // coordinate-y
index += 4
index += 18
resp.Overwrite(utils.IntToBytes(uint64(c.Socket.Stats.HP), 4, true), index) // hp
index += 9
resp[index] = byte(c.WeaponSlot) // weapon slot
index += 16
resp.Insert(utils.IntToBytes(uint64(c.GuildID), 4, true), index) // guild id
index += 8
resp[index] = byte(c.Faction) // character faction
index += 10
items, err := c.ShowItems()
if err != nil {
return nil, err
}
itemsData := items[11 : len(items)-2]
sale := FindSale(c.PseudoID)
if sale != nil {
itemsData = []byte{0x05, 0xAA, 0x45, 0xF1, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x6C, 0xF1, 0x00, 0x01, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
}
resp.Insert(itemsData, index)
index += len(itemsData)
length := int16(len(itemsData) + len(c.Name) + 111)
if sale != nil {
resp.Insert([]byte{0x02}, index) // sale indicator
index++
resp.Insert([]byte{byte(len(sale.Name))}, index) // sale name length
index++
resp.Insert([]byte(sale.Name), index) // sale name
index += len(sale.Name)
resp.Insert([]byte{0x00}, index)
index++
length += int16(len(sale.Name) + 3)
}
resp.SetLength(length)
resp.Concat(items) // FIX => workaround for weapon slot
if c.GuildID > 0 {
guild, err := FindGuildByID(c.GuildID)
if err == nil && guild != nil {
resp.Concat(guild.GetInfo())
}
}
return resp, nil
}