Exemplo n.º 1
0
            internal ServerPacket Packet()
            {
                var packet = new ServerPacket(OpCode);

                packet.WriteByte(0x01);
                packet.WriteByte(0x3C);
                if (IsInitial)
                {
                    packet.WriteByte(0x00);
                    packet.WriteByte(RecipeCount);
                    packet.WriteByte(0x00);
                }
                else
                {
                    packet.WriteByte(0x01);
                    packet.WriteByte(Index);
                    packet.WriteUInt16(Sprite);

                    packet.WriteString16(RecipeDescription);

                    var ing = "Ingredients: \n";
                    foreach (var ingredient in RecipeIngredients)
                    {
                        ing += $"{ingredient.Value} {ingredient.Key}\n";
                    }
                    packet.WriteString16(ing);
                    packet.WriteByte(0x01);
                    packet.WriteByte(0x00);
                }

                return(packet);
            }
Exemplo n.º 2
0
        public ServerPacket RenderToPacket(bool Mailbox = true)
        {
            var response = new ServerPacket(0x31);

            // Functionality unknown but necessary
            if (Mailbox)
            {
                response.WriteByte(0x05);
                response.WriteByte(0x03);
            }
            else
            {
                response.WriteByte(0x03);
                response.WriteByte(0x00);
            }
            response.WriteBoolean(Mailbox || Highlighted); // Mailbox messages are always "read"
            response.WriteUInt16((ushort)Id);
            response.WriteString8(Sender);
            response.WriteByte((byte)Created.Month);
            response.WriteByte((byte)Created.Day);
            response.WriteString8(Subject);
            response.WriteString16(Body);

            return(response);
        }
Exemplo n.º 3
0
        public void SendMessage(string message, byte type)
        {
            var x0A = new ServerPacket(0x0A);

            x0A.WriteByte(type);
            x0A.WriteString16(message);
            Enqueue(x0A);
        }
Exemplo n.º 4
0
            internal ServerPacket Packet()
            {
                ServerPacket packet = new ServerPacket(OpCode);

                packet.WriteByte(Type);
                packet.WriteString16(Message);
                return(packet);
            }
Exemplo n.º 5
0
 public void SendMessage(string message, byte type)
 {
     var x0A = new ServerPacket(0x0A);
     x0A.WriteByte(type);
     x0A.WriteString16(message);
     Enqueue(x0A);
 }
Exemplo n.º 6
0
            internal ServerPacket Packet()
            {
                var packet = new ServerPacket(OpCode);

                packet.WriteByte((byte)MerchantDialogType);
                packet.WriteByte((byte)MerchantDialogObjectType);
                packet.WriteUInt32(ObjectId);
                packet.WriteByte(0);
                packet.WriteInt16((short)Tile1);
                packet.WriteByte(0);
                packet.WriteByte(1);
                packet.WriteInt16((short)Tile1);
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteString8(Name);
                packet.WriteString16(Text);
                if (MerchantDialogType == MerchantDialogType.Options)
                {
                    packet.WriteByte(Options.OptionsCount);
                    foreach (var opt in Options.Options)
                    {
                        packet.WriteString8(opt.Text);
                        packet.WriteUInt16(opt.Id);
                    }
                }
                if (MerchantDialogType == MerchantDialogType.OptionsWithArgument)
                {
                    packet.WriteString8(OptionsWithArgument.Argument);
                    packet.WriteByte(OptionsWithArgument.OptionsCount);
                    foreach (var opt in OptionsWithArgument.Options)
                    {
                        packet.WriteString8(opt.Text);
                        packet.WriteUInt16(opt.Id);
                    }
                }
                if (MerchantDialogType == MerchantDialogType.Input)
                {
                    packet.WriteUInt16(Input.Id);
                }
                if (MerchantDialogType == MerchantDialogType.InputWithArgument)
                {
                    packet.WriteString8(InputWithArgument.Argument);
                    packet.WriteUInt16(InputWithArgument.Id);
                }
                if (MerchantDialogType == MerchantDialogType.MerchantShopItems)
                {
                    packet.WriteUInt16(ShopItems.Id);
                    packet.WriteUInt16(ShopItems.ItemsCount);
                    foreach (var item in ShopItems.Items)
                    {
                        packet.WriteUInt16(item.Tile);
                        packet.WriteByte(item.Color);
                        packet.WriteUInt32(item.Price);
                        packet.WriteString8(item.Name);
                        packet.WriteString8(item.Description);
                    }
                }
                if (MerchantDialogType == MerchantDialogType.MerchantSkills)
                {
                    packet.WriteUInt16(Skills.Id);
                    packet.WriteUInt16(Skills.SkillsCount);
                    foreach (var skill in Skills.Skills)
                    {
                        packet.WriteByte(skill.IconType);
                        packet.WriteUInt16(skill.Icon);
                        packet.WriteByte(skill.Color);
                        packet.WriteString8(skill.Name);
                    }
                }
                if (MerchantDialogType == MerchantDialogType.MerchantSpells)
                {
                    packet.WriteUInt16(Spells.Id);
                    packet.WriteUInt16(Spells.SpellsCount);
                    foreach (var spell in Spells.Spells)
                    {
                        packet.WriteByte(spell.IconType);
                        packet.WriteUInt16(spell.Icon);
                        packet.WriteByte(spell.Color);
                        packet.WriteString8(spell.Name);
                    }
                }
                if (MerchantDialogType == MerchantDialogType.UserSkillBook)
                {
                    packet.WriteUInt16(UserSkills.Id);
                }
                if (MerchantDialogType == MerchantDialogType.UserSpellBook)
                {
                    packet.WriteUInt16(UserSpells.Id);
                }
                if (MerchantDialogType == MerchantDialogType.UserInventoryItems)
                {
                    packet.WriteUInt16(UserInventoryItems.Id);
                    packet.WriteByte(UserInventoryItems.InventorySlotsCount);
                    foreach (var slot in UserInventoryItems.InventorySlots)
                    {
                        packet.WriteByte(slot);
                    }
                }

                return(packet);
            }