Пример #1
0
    public static PacketWriter Join(Player player)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.PARTY);

        pWriter.Write(PartyPacketMode.Join);
        CharacterListPacket.WriteCharacter(player, pWriter);
        pWriter.WriteInt();
        pWriter.WriteSkills(player);
        pWriter.WriteLong();
        return(pWriter);
    }
Пример #2
0
    public static PacketWriter UpdatePlayer(Player player)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.PARTY);

        pWriter.Write(PartyPacketMode.UpdatePlayer);
        pWriter.WriteLong(player.CharacterId);

        CharacterListPacket.WriteCharacter(player, pWriter);
        WritePartyDungeonInfo(pWriter);
        return(pWriter);
    }
Пример #3
0
    public static PacketWriter UpdateGroupMembers(Player member, Player invitee, GroupChat groupChat)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.GROUP_CHAT);

        pWriter.Write(GroupChatPacketMode.UpdateGroupMembers);
        pWriter.WriteInt(groupChat.Id);
        pWriter.WriteUnicodeString(member.Name);
        pWriter.WriteByte(0x1);
        CharacterListPacket.WriteCharacter(invitee, pWriter);
        return(pWriter);
    }
Пример #4
0
    public static PacketWriter LoginNotice(Player player)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.PARTY);

        pWriter.Write(PartyPacketMode.LoginNotice);
        CharacterListPacket.WriteCharacter(player, pWriter);
        pWriter.WriteLong();
        pWriter.WriteInt();
        pWriter.WriteShort();
        pWriter.WriteByte();
        return(pWriter);
    }
Пример #5
0
    public static PacketWriter Update(GroupChat groupChat)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.GROUP_CHAT);

        pWriter.Write(GroupChatPacketMode.Update);
        pWriter.WriteInt(groupChat.Id);
        pWriter.WriteByte((byte)groupChat.Members.Count);
        foreach (Player member in groupChat.Members)
        {
            pWriter.WriteByte(0x1);
            CharacterListPacket.WriteCharacter(member, pWriter);
        }
        return(pWriter);
    }
Пример #6
0
    public static PacketWriter Create(Party party, bool joinNotice)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.PARTY);

        pWriter.Write(PartyPacketMode.Create);
        pWriter.WriteBool(joinNotice);
        pWriter.WriteInt(party.Id);
        pWriter.WriteLong(party.Leader.CharacterId);
        pWriter.WriteByte((byte)party.Members.Count);

        foreach (Player member in party.Members)
        {
            pWriter.WriteBool(!member.Session.Connected());
            CharacterListPacket.WriteCharacter(member, pWriter);
            WritePartyDungeonInfo(pWriter);
        }

        pWriter.WriteByte(); // is in dungeon? might be a bool.
        pWriter.WriteInt();  //dungeonid for "enter dungeon"
        pWriter.WriteByte();
        pWriter.WriteByte();
        pWriter.WriteByte();
        return(pWriter);
    }
Пример #7
0
    public static PacketWriter AddPlayer(IFieldActor <Player> fieldPlayer)
    {
        Player       player  = fieldPlayer.Value;
        PacketWriter pWriter = PacketWriter.Of(SendOp.FIELD_ADD_PLAYER);

        pWriter.WriteInt(fieldPlayer.ObjectId);
        CharacterListPacket.WriteCharacter(player, pWriter);

        // Skills
        pWriter.Write(player.JobCode);
        pWriter.WriteByte(1);
        pWriter.Write(player.Job);
        pWriter.WriteSkills(player);

        // Coords
        pWriter.Write(fieldPlayer.Coord);
        pWriter.Write(fieldPlayer.Rotation);
        pWriter.WriteByte();

        // Stats
        pWriter.WriteFieldStats(fieldPlayer.Stats);

        pWriter.WriteBool(fieldPlayer.OnCooldown);
        pWriter.WriteBool(player.Guide?.Value.Type == 0);
        pWriter.WriteInt();
        pWriter.WriteLong();
        pWriter.WriteLong();

        // ???
        bool flagA = false;

        pWriter.WriteBool(flagA);
        if (flagA)
        {
            pWriter.WriteLong();
            pWriter.WriteUnicodeString();
            pWriter.WriteUnicodeString();
            pWriter.WriteByte();
            pWriter.WriteInt();
            pWriter.WriteLong();
            pWriter.WriteLong();
            pWriter.WriteUnicodeString();
            pWriter.WriteLong();
            pWriter.WriteUnicodeString();
            pWriter.WriteByte();
        }

        pWriter.WriteInt(1);
        pWriter.Write(player.SkinColor);
        pWriter.WriteUnicodeString(player.ProfileUrl);

        pWriter.WriteBool(player.Mount != null);
        if (player.Mount != null)
        {
            pWriter.WriteMount(player.Mount);

            // Unknown
            byte countA = 0;
            pWriter.WriteByte(countA);
            for (int i = 0; i < countA; i++)
            {
                pWriter.WriteInt();
                pWriter.WriteByte();
            }
        }
        pWriter.WriteInt();
        pWriter.WriteLong(TimeInfo.Now()); // some timestamp
        pWriter.WriteInt();
        pWriter.WriteInt();

        bool appearance = true;

        pWriter.WriteBool(appearance);
        if (appearance)
        {
            PacketWriter appearanceBuffer = new();
            CharacterListPacket.WriteEquipsAndCosmetics(appearanceBuffer, player);

            appearanceBuffer.WriteByte(1);
            appearanceBuffer.WriteLong();
            appearanceBuffer.WriteLong();
            appearanceBuffer.WriteByte();

            pWriter.WriteDeflated(appearanceBuffer.Buffer, 0, appearanceBuffer.Length);
        }
        else
        {
            pWriter.WriteDeflated(new byte[1], 0, 1); // Empty buffer
        }

        bool unusuedBuffer = false;

        pWriter.WriteBool(unusuedBuffer);
        if (unusuedBuffer)
        {
            // kms2 outfits? Unused buffer for gms2
        }
        else
        {
            pWriter.WriteDeflated(new byte[1], 0, 1); // Empty buffer
        }

        List <Item> badges = player.Inventory.Badges.Where(x => x != null).ToList();

        pWriter.WriteBool(badges.Count > 0);
        if (badges.Count > 0)
        {
            PacketWriter badgesBuffer = new();
            CharacterListPacket.WriteBadges(badgesBuffer, player);
            pWriter.WriteDeflated(badgesBuffer.Buffer, 0, badgesBuffer.Length);
        }
        else
        {
            pWriter.WriteDeflated(new byte[1], 0, 1); // Empty buffer
        }

        JobPacket.WritePassiveSkills(pWriter, fieldPlayer);

        pWriter.WriteInt();
        pWriter.WriteInt();
        pWriter.WriteByte();
        pWriter.WriteInt();
        pWriter.WriteByte();
        pWriter.WriteByte();
        pWriter.WriteInt(player.TitleId);
        pWriter.WriteShort(player.InsigniaId);
        pWriter.WriteByte();
        pWriter.WriteInt();
        pWriter.WriteByte();
        pWriter.WriteLong(); // Another timestamp
        pWriter.WriteInt(int.MaxValue);
        pWriter.WriteByte();
        pWriter.WriteInt(); // MushkingRoyale taileffect kill count
        pWriter.WriteInt();
        pWriter.WriteShort();

        return(pWriter);
    }