Ejemplo n.º 1
0
    public static void WriteSkills(this PacketWriter pWriter, SkillTab skillTab, SkillType type, HashSet <int> newSkillsId = null)
    {
        List <(int skillId, short skillLevel)> skills = skillTab.GetSkillsByType(type);

        pWriter.WriteByte((byte)skills.Count);

        foreach ((int skillId, short skillLevel) in skills)
        {
            pWriter.WriteBool(newSkillsId?.Contains(skillId) ?? false);
            pWriter.WriteBool(skillLevel > 0); // Is it learned?
            pWriter.WriteInt(skillId);
            pWriter.WriteInt(Math.Max((int)skillLevel, 1));
            pWriter.WriteByte();
        }
    }
Ejemplo n.º 2
0
    public static void WritePassiveSkills(this PacketWriter pWriter, IFieldObject <Player> fieldPlayer)
    {
        Player   player   = fieldPlayer.Value;
        SkillTab skillTab = player.SkillTabs.First(x => x.TabId == player.ActiveSkillTabId);

        List <(int skillId, short skillLevel)> passiveSkillList = skillTab.GetSkillsByType(SkillType.Passive);

        pWriter.WriteShort((short)passiveSkillList.Count);

        foreach ((int skillId, short skillLevel) in passiveSkillList)
        {
            pWriter.WriteInt(fieldPlayer.ObjectId);
            pWriter.WriteInt(); // unk int
            pWriter.WriteInt(fieldPlayer.ObjectId);
            pWriter.WriteInt(); // unk int 2
            pWriter.WriteInt(); // same as the unk int 2
            pWriter.WriteInt(skillId);
            pWriter.WriteShort(skillLevel);
            pWriter.WriteInt(1);  // unk int = 1
            pWriter.WriteByte(1); // unk byte = 1
            pWriter.WriteLong();
        }
    }