Esempio n. 1
0
 public static byte[] SendUnSealPet(Pet pet)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(pet.PetID);
     p.WriteInt(pet.OwnerID);
     p.WriteInt(pet.MapID);
     p.WriteByte(pet.PetType);
     p.WriteString(pet.Name);
     p.WriteShort(pet.Level);
     p.WriteShort((short)pet.Position.X);
     p.WriteShort((short)pet.Position.Y);
     p.WriteHexString("4E 4E");
     p.WriteHexString("01 78 02 4E C6 00");
     p.WriteInt(pet.MaxHealth);
     p.WriteInt(pet.CurHealth);
     p.WriteShort(pet.Damage);
     p.WriteShort(pet.Defense);
     p.WriteShort(pet.AttackRating);
     p.WriteHexString("01 00 09 00 00 00 00 00 25 32 00 00 01");
     p.WriteLong(pet.CurrentExperience);
     p.WriteLong(pet.NegativeExperience);
     p.WriteLong(pet.ExperienceToLevel + pet.NegativeExperience);
     p.WriteByte(pet.Evolution);
     p.WriteByte(pet.Wildness);
     p.WriteByte(Convert.ToByte(pet.IsLegendary));
     p.WriteHexString("00 00 00 00");
     p.WriteHexString("00 00 00 00 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendUnSealPet);
 }
Esempio n. 2
0
 public static byte[] SendChatMessage(Character ch, ChatMessageInfo cmi)
 {
     Packet p = new Packet(200);
     p.WriteInt(ch.CharacterId);
     p.WriteByte((byte)cmi.Type); // chat type probably
     p.WriteString(cmi.Message);
     p.WriteString(ch.Name);
     if (cmi.Type == ChatType.Whisper)
     {
         p.WriteInt(cmi.TargetID);
         p.WriteString(cmi.TargetName);
     }
     return p.GetWrittenBuffer(PacketIds.SendChatMessage);
 }
Esempio n. 3
0
 /// <summary>
 /// Create character
 /// </summary>
 /// <param name="ms">State of character making</param>
 /// <param name="playerid">ID of character that was made</param>
 /// <returns></returns>
 public static byte[] SendCreateCharacter(CharCreationState ms, int playerid)
 {
     Packet p = new Packet(500);
     p.WriteByte((byte)ms);
     if (ms == CharCreationState.Success)
         p.WriteInt(playerid);
     else
         p.WriteHexString("00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendCreateCharacter);
 }
Esempio n. 4
0
        /// <summary>
        /// Send Unit Server login state to client
        /// </summary>
        /// <param name="uls"></param>
        /// <param name="PlayerID"></param>
        /// <returns></returns>
        public static byte[] SendUnitLoginState(LoginState uls, int PlayerID)
        {
            Packet p = new Packet(100);
            if (uls == LoginState.Success)
            {
                p.WriteShort((short)uls);
                p.WriteInt(PlayerID); // if client were ingame before, else its just 00 00 00 00
            }
            else
            {
                p.WriteShort((short)uls);
                p.WriteHexString("00 00 00 00"); // if its error just logintype and rest zeroes
            }

            return p.GetWrittenBuffer(PacketIds.SendUnitLoginState);
        }
Esempio n. 5
0
        public static byte[] SendBagItems(List<BaseItem> items, int bag)
        {
            Packet p = new Packet(200);
            //    p.WriteHexString("18 31 A4 00 00 02 00 73 83 D0 00 2A 4E 01 02 B0 04 00 00 00 00 00 00 02 00 00 04 00 05 00 06 00 07 00 08 00 C0 C8 00 C8 00 05 00 06 00 07 00 08 00 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 08 00 00 00 04 00 05 00 07 00 0A 00 0B 00 0C 00 0D 00 00 00 00 01 01 01 02 02 74 83 D0 00 35 4E 02 01 34 08 00 00 00 00 00 00 02 01 00 01 00 00 00 00 00 01 00 00 00 C8 64 00 64 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
            p.WriteByte(bag);
            p.WriteByte(items.Count);
            foreach (BaseItem i in items)
            {
                p.WriteByte(i.Slot);
                p.WriteInt(i.ItemID);
                p.WriteShort(i.ReferenceID);
                p.WriteByte(i.bType);
                p.WriteByte(i.bKind);
                p.WriteShort(i.VisualID);
                p.WriteInt(i.Price);
                p.WriteHexString("00 00");
                if (i is Equipment)
                {
                    Equipment e = i as Equipment;
                    p.WriteByte(e.RequiredClass);
                    p.WriteShort(e.Amount);
                    p.WriteShort(e.RequiredLevel);
                    p.WriteShort(e.RequiredDexterity);
                    p.WriteShort(e.RequiredStrength);
                    p.WriteShort(e.RequiredStamina);
                    p.WriteShort(e.RequiredEnergy);
                    p.WriteByte(e.MaxImbueTries);
                    p.WriteShort(e.Durability);
                    p.WriteShort(e.MaxDurability);
                    p.WriteShort(e.Damage);
                    p.WriteShort(e.Defence);
                    p.WriteShort(e.AttackRating);
                    p.WriteShort(e.AttackSpeed);
                    p.WriteShort(e.AttackRange);
                    p.WriteShort(e.IncMaxLife);
                    p.WriteShort(e.IncMaxMana);
                    p.WriteShort(e.IncLifeRegen);
                    p.WriteShort(e.IncManaRegen);
                    p.WriteShort(e.Critical);
                    p.WriteByte(e.Plus);
                    p.WriteByte(e.Slvl);
                    p.WriteHexString("00"); // unknown
                    p.WriteByte(e.ImbueTries);
                    p.WriteHexString("00"); // unknown
                    p.WriteShort(e.DragonSuccessImbueTries);
                    p.WriteByte(e.DiscountRepairFee);
                    p.WriteShort(e.TotalDragonImbueTries);
                    p.WriteShort(e.DragonDamage);
                    p.WriteShort(e.DragonDefence);
                    p.WriteShort(e.DragonAttackRating);
                    p.WriteShort(e.DragonLife);
                    p.WriteByte(e.MappedData);
                    if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
                        p.WriteByte(e.ForceSlot);
                    p.WriteHexString("00 00"); // unknown
                    if (e is Cape)
                    {
                        Cape c = e as Cape;
                        p.WriteHexString("00 00"); // required guild position
                        p.WriteHexString("00 00 00 00 00 00 00");
                        p.WriteHexString("01 00"); // decrease times of durability
                        p.WriteByte(c.PolishImbueTries); // polish imbue tries
                        p.WriteShort(c.MaxPolishImbueTries); // polish max tries
                        p.WriteShort(c.VigiStat1); // stat1
                        p.WriteShort(c.VigiStat2); // stat2
                        p.WriteShort(c.VigiStat3); // stat3
                        p.WriteShort(c.VigiStat4); // stat4
                        p.WriteHexString("00 00"); // stat5
                        p.WriteShort(c.VigiStatAdd1); // stat1 increase
                        p.WriteShort(c.VigiStatAdd2); // stat2 increase
                        p.WriteShort(c.VigiStatAdd3); // stat3 increase
                        p.WriteShort(c.VigiStatAdd4); // stat4 increase
                        p.WriteHexString("00 00"); // stat5 increase
                        p.WriteHexString("00 00"); // unknown
                    }
                    if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
                    {
                        p.WriteByte(e.RebirthHole);
                        p.WriteByte(e.RebirthHoleItem);
                        p.WriteShort(e.RebirthHoleStat);
                    }
                }
                if (i is ImbueItem)
                {
                    ImbueItem im = i as ImbueItem;
                    p.WriteByte(im.RequiredClass);
                    p.WriteShort(i.Amount);
                    p.WriteHexString("00"); // imbuestat, eg dec level, increase value etc
                    p.WriteShort(im.ImbueChance);
                    p.WriteShort(im.IncreaseValue);
                    p.WriteHexString("00 00"); // could be lowest lvl who knows
                    p.WriteHexString("00 00"); // maxlevel of usage, for dragon stones
                    p.WriteHexString("00 00"); // unknown
                }
                if (i is PotionItem)
                {
                    PotionItem pot = i as PotionItem;
                    p.WriteByte(pot.RequiredClass);
                    p.WriteShort(pot.Amount);
                    p.WriteHexString("00 00 00 00");
                    p.WriteShort(pot.HealHp);
                    p.WriteShort(pot.HealMana);
                    p.WriteHexString("00 20 4E 00 00 00 00");
                }
                if (i is BookItem)
                {
                    BookItem book = i as BookItem;
                    p.WriteByte(book.RequiredClass);
                    p.WriteShort(book.Amount);
                    p.WriteShort(book.RequiredLevel);
                    p.WriteInt(book.SkillID);
                    p.WriteByte(book.SkillLevel);
                    p.WriteInt(book.SkillData);
                }
                if (i is BeadItem)
                {
                    BeadItem bead = i as BeadItem;
                    p.WriteByte(bead.RequiredClass);
                    p.WriteShort(bead.Amount);
                    p.WriteInt(bead.ToMapID);
                    p.WriteHexString("01 00 00 00 00 00 00");
                }
            }

            return p.GetWrittenBuffer(PacketIds.SendItemList);
        }
Esempio n. 6
0
        // something about repulation, current hp/mana, stats
        public static byte[] SendSpawnStats(Character ch)
        {
            Packet p = new Packet(200);
            p.WriteShort(ch.Level);
            p.WriteShort(ch.Strength);
            p.WriteShort(ch.Stamina);
            p.WriteShort(ch.Dexterity);
            p.WriteShort(ch.Energy);
            p.WriteHexString("01 01 01 01"); // unknown :(, maybe base stats?: D
            p.WriteShort(ch.MaxMana);
            p.WriteShort(ch.CurrentMana);
            p.WriteInt(ch.MaxHp);
            p.WriteInt(ch.CurrentHp);
            p.WriteLong(ch.CurrentExp); // cur exp
            p.WriteHexString("00 00 00 00 00 00 00 00"); // curxp to next training
            p.WriteLong(1200000); // exp to level
            p.WriteHexString("00 00 00 00 00 00 00 00"); // xp to next training
            p.WriteHexString("00 00");
            p.WriteHexString("04 00 00 00");
            p.WriteHexString("00 00");
            p.WriteHexString("08 00 00 00");
            p.WriteShort(ch.StatPoint); // stat points
            p.WriteHexString("6B 00 00 00"); // total trainings?
            p.WriteShort(ch.TrainingPoint); // current trainings
            p.WriteHexString("7C 00"); // damage from stats
            p.WriteHexString("C5 00 00 00"); // total damage (from items, skills etc)
            p.WriteHexString("11 00"); // defence from stats
            p.WriteHexString("12 00 00 00"); // total defence (from items, skills etc)
            p.WriteHexString("13 00"); // attack rating from stats
            p.WriteHexString("14 00 00 00"); // total attack rating (from items, skills etc)
            p.WriteHexString("07 00"); // attack range or speed
            p.WriteHexString("0B 0B"); // animation speed (the speed hax thingy in xiah 2827)
            p.WriteHexString("0B"); // movement speed, from shoes ^_ ^
            p.WriteHexString("00 00 00 00 00");
            p.WriteInt(ch.Money);
            p.WriteHexString("02 00");  // Critical
            p.WriteHexString("1A 00");
            p.WriteInt(ch.Fame);
            p.WriteShort(ch.FiveElementPoint); // five element points (unused)
            p.WriteInt(ch.CurrentFEExp); // current fe experience
            p.WriteHexString("02 00 00 00"); // fe experience to point, 40000 each level
            p.WriteHexString("00 00 00 00"); // that other five element skill experience :S
            p.WriteHexString("00 00"); // fire fe level
            p.WriteHexString("00 00"); // water fe level
            p.WriteHexString("00 00"); // wood fe level
            p.WriteHexString("00 00"); // steel fe level
            p.WriteHexString("00 00"); // soil fe level
            p.WriteByte(ch.Rebirth); // rebirths
            p.WriteInt(ch.RepulationPoint); // Repulation points, the points near stat ones :U

            return p.GetWrittenBuffer(PacketIds.SendSpawnStats);
        }
Esempio n. 7
0
        public static byte[] SendStats(Character ch)
        {
            Packet p = new Packet(200);
            // p.WriteHexString("02 3A 52 00 01 00 02 00 03 00 04 00 05 00 06 00 00 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 00 0B 05 00 00 00 06 00 00 00 07 00 08 00 09 00 01 00 02 00 02 00 0C 07 00 02 03 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
            p.WriteShort(ch.Level);
            p.WriteShort(ch.Strength);
            p.WriteShort(ch.Stamina);
            p.WriteShort(ch.Dexterity);
            p.WriteShort(ch.Energy);
            p.WriteShort(ch.StatPoint); // stat points

            //PLOX FUNCTION OF STATS HERE
            ch.CalculateTotalStats();

            p.WriteHexString("00 00 00 00"); // unknown
            p.WriteInt(ch.TotalDamage); // total damage
            p.WriteInt(ch.TotalDefence); // total defence
            p.WriteInt(ch.TotalAttackRating); // total attack rating

            p.WriteHexString("00 0B"); // unknown
            p.WriteInt(ch.CurrentHp);
            p.WriteInt(ch.MaxHp);
            p.WriteShort(ch.CurrentMana);
            p.WriteShort(ch.MaxMana);

            p.WriteShort(ch.Critical); // critical hit

            p.WriteShort(ch.StatDamage); // damage from stats
            p.WriteShort(ch.StatDefence); // defence from stats
            p.WriteShort(ch.StatAttackRating); // attack rating from stats

            p.WriteHexString("0C 07 01"); // unknown
            p.WriteByte(ch.MovingSpeed); // movement speed
            p.WriteShort(ch.TrainingPoint); // trainings
            p.WriteHexString("00 00 00 00"); // unknown
            p.WriteInt(ch.Fame);
            p.WriteHexString("00"); // gives you green name, luls
            p.WriteByte(ch.Rebirth); // rebirths
            p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00"); // unknown
            p.WriteInt(ch.RepulationPoint); // repulation points
            return p.GetWrittenBuffer(PacketIds.SendStats);
        }
Esempio n. 8
0
        public static byte[] SendMapID(int mapId)
        {
            Packet p = new Packet(200);
            p.WriteHexString("00");
            p.WriteInt(mapId);

            return p.GetWrittenBuffer(PacketIds.SendMapId);
        }
Esempio n. 9
0
        public static byte[] SendMoneyLeft(int money)
        {
            Packet p = new Packet(20);
            p.WriteInt(money);
            p.WriteHexString("00"); // something

            return p.GetWrittenBuffer(PacketIds.SendMoneyLeft);
        }
Esempio n. 10
0
 public static byte[] SendItemOnGround(MapItem e)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00 01 00");
     p.WriteInt(e.MapID);
     p.WriteShort(e.MapX);
     p.WriteShort(e.MapY);
     p.WriteByte(e.MapZ);
     p.WriteInt(e.MapItemID); // DROP ITEM NEED NEW CLASS DROP ITEM PROBABLY
     p.WriteByte(e.bType);
     p.WriteShort(e.VisualID);
     p.WriteShort(e.ReferenceID);
     p.WriteInt(e.ItemID);
     p.WriteShort(e.Amount);
     p.WriteHexString("00 00 00 00 00 00 01 00 00");
     return p.GetWrittenBuffer(PacketIds.SendItemOnGround);
 }
Esempio n. 11
0
 public static byte[] SendMap(Map mh)
 {
     Packet p = new Packet(200);
     p.WriteByte(0);
     p.WriteInt(mh.MapID);
     p.WriteByte(0);
     p.WriteShort(mh.MultiplyValue);
     p.WriteByte(mh.MultiplyValue);
     p.WriteByte(1);
     p.WriteByte(mh.Portals.Count);
     foreach (Portal portal in mh.Portals)
     {
         p.WriteInt(portal.ToMapID);
         p.WriteShort(portal.FromX);
         p.WriteShort(portal.FromY);
         p.WriteShort(portal.Width);
         p.WriteShort(portal.Height);
         p.WriteByte(1); // type
     }
     //  p.WriteHexString("01 02 01 00 00 00 21 03 2A 03 40 00 40 00 01 0B 00 00 00 91 00 75 00 20 00 20 00 01");
     return p.GetWrittenBuffer(PacketIds.SendMap);
 }
Esempio n. 12
0
 public static byte[] SendImbueMessage(ImbueError error, ImbueStat stat, int value, Equipment item)
 {
     Packet p = new Packet(5);
     p.WriteByte((byte)error); // Error message
     p.WriteByte((byte)stat); // Stat
     p.WriteInt(value);
     p.WriteHexString("00");
     p.WriteShort(item.ReferenceID);
     p.WriteByte(item.Plus);
     p.WriteByte(item.Slvl);
     return p.GetWrittenBuffer(PacketIds.SendImbueMessage);
 }
Esempio n. 13
0
 public static byte[] SendWarehouseRemoveItem(byte slot, int itemid)
 {
     Packet p = new Packet(20);
     p.WriteByte(slot);
     p.WriteInt(itemid);
     p.WriteHexString("01 00 00 00"); // maybe amount who knows
     return p.GetWrittenBuffer(PacketIds.SendRemoveWarehouseItem);
 }
Esempio n. 14
0
        public static byte[] SendWarehouseItems(List<BaseItem> items, int bag)
        {
            Packet p = new Packet(500);
            // p.WriteHexString("9E 38 58 00 01 00 00 00 01 01 00 00 00 00 40 72 F0 00 B8 4E 01 02 B9 04 DD E3 00 00 01 00 02 01 00 28 00 7C 00 08 00 00 00 00 00 C8 F0 0A F0 0A BE 00 00 00 00 00 04 00 03 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
            p.WriteHexString("01 00 00 00");
            p.WriteHexString("01");
            p.WriteByte(items.Count);
            p.WriteHexString("00 00 00");
            foreach (BaseItem i in items)
            {
                p.WriteByte(i.Slot);
                p.WriteInt(i.ItemID);
                p.WriteShort(i.ReferenceID);
                p.WriteByte(i.bType);
                p.WriteByte(i.bKind);
                p.WriteShort(i.VisualID);
                p.WriteInt(i.Price);
                p.WriteHexString("00 00");
                if (i is Equipment)
                {
                    Equipment e = i as Equipment;
                    p.WriteByte(e.RequiredClass);
                    p.WriteShort(e.Amount);
                    p.WriteShort(e.RequiredLevel);
                    p.WriteShort(e.RequiredDexterity);
                    p.WriteShort(e.RequiredStrength);
                    p.WriteShort(e.RequiredStamina);
                    p.WriteShort(e.RequiredEnergy);
                    p.WriteShort(e.MaxImbueTries);
                    p.WriteShort(e.Durability);
                    p.WriteShort(e.MaxDurability);
                    p.WriteShort(e.Damage);
                    p.WriteShort(e.Defence);
                    p.WriteShort(e.AttackRating);
                    p.WriteShort(e.AttackSpeed);
                    p.WriteShort(e.AttackRange);
                    p.WriteShort(e.IncMaxLife);
                    p.WriteShort(e.IncMaxMana);
                    p.WriteShort(e.IncLifeRegen);
                    p.WriteShort(e.IncManaRegen);
                    p.WriteShort(e.Critical);
                    p.WriteByte(e.Plus);
                    p.WriteByte(e.Slvl);
                    p.WriteHexString("00"); // unknown
                    p.WriteShort(e.ImbueTries);
                    p.WriteHexString("00"); // unknown
                    p.WriteShort(e.DragonSuccessImbueTries);
                    p.WriteByte(e.DiscountRepairFee);
                    p.WriteShort(e.TotalDragonImbueTries);
                    p.WriteShort(e.DragonDamage);
                    p.WriteShort(e.DragonDefence);
                    p.WriteShort(e.DragonAttackRating);
                    p.WriteShort(e.DragonLife);
                    if (e is Mirror)
                    {
                        Mirror m = e as Mirror;
                        p.WriteInt(m.PetID);
                        p.WriteShort(m.LifeAbsorb);
                        p.WriteShort(m.DamageAbsorb);
                        p.WriteShort(m.DefenseAbsorb);
                        p.WriteShort(m.AttackRatingAbsorb);
                        p.WriteHexString("00 00 00 00 00 00 00 00 00 00"); // pet skill stuff yo
                    }
                    else
                    {
                        p.WriteByte(e.MappedData);
                        if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
                        {
                            p.WriteByte(e.ForceSlot);
                            p.WriteHexString("00 00"); // other slots
                        }
                        if (e is Cape)
                        {
                            Cape c = e as Cape;
                            p.WriteHexString("00 00"); // required guild position
                            p.WriteHexString("00 00 00 00 00 00 00");
                            p.WriteHexString("01 00"); // decrease times of durability
                            p.WriteByte(c.PolishImbueTries); // polish imbue tries
                            p.WriteShort(c.MaxPolishImbueTries); // polish max tries
                            p.WriteShort(c.VigiStat1); // stat1
                            p.WriteShort(c.VigiStat2); // stat2
                            p.WriteShort(c.VigiStat3); // stat3
                            p.WriteShort(c.VigiStat4); // stat4
                            p.WriteHexString("00 00"); // stat5
                            p.WriteShort(c.VigiStatAdd1); // stat1 increase
                            p.WriteShort(c.VigiStatAdd2); // stat2 increase
                            p.WriteShort(c.VigiStatAdd3); // stat3 increase
                            p.WriteShort(c.VigiStatAdd4); // stat4 increase
                            p.WriteHexString("00 00"); // stat5 increase
                            p.WriteHexString("00 00"); // unknown
                        }
                        if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
                        {
                            p.WriteShort(e.RebirthHole);
                            //p.WriteShort(e.RebirthHoleStat);
                        }
                    }
                }
                if (i is ImbueItem)
                {
                    ImbueItem im = i as ImbueItem;
                    p.WriteByte(im.RequiredClass);
                    p.WriteShort(i.Amount);
                    if (i is RbHoleItem)
                    {
                        p.WriteByte(0);
                        p.WriteInt(im.ImbueChance);
                        p.WriteInt(im.IncreaseValue);
                    }
                    else
                    {
                        p.WriteByte(im.ImbueData);
                        p.WriteShort(im.ImbueChance);
                        p.WriteShort(im.IncreaseValue);
                        p.WriteHexString("00 00"); // could be lowest lvl who knows
                        p.WriteHexString("00 00"); // maxlevel of usage, for dragon stones
                    }
                }
                if (i is PotionItem)
                {
                    PotionItem pot = i as PotionItem;
                    p.WriteByte(pot.RequiredClass);
                    p.WriteShort(pot.Amount);
                    p.WriteHexString("00 00 00 00");
                    p.WriteShort(pot.HealHp);
                    p.WriteShort(pot.HealMana);
                    p.WriteHexString("00 20 4E 00 00");
                }
                if (i is BookItem)
                {
                    BookItem book = i as BookItem;
                    p.WriteByte(book.RequiredClass);
                    p.WriteShort(book.Amount);
                    p.WriteShort(book.RequiredLevel);
                    p.WriteInt(book.SkillID);
                    p.WriteByte(book.SkillLevel);
                    p.WriteShort(book.SkillData);
                }
                if (i is BeadItem)
                {
                    BeadItem bead = i as BeadItem;
                    p.WriteByte(bead.RequiredClass);
                    p.WriteShort(bead.Amount);
                    p.WriteInt(bead.ToMapID);
                    p.WriteHexString("01 00 00 00 00");
                }
                if (i is StoreTag)
                {
                    StoreTag tag = i as StoreTag;
                    p.WriteByte(tag.RequiredClass);
                    p.WriteShort(tag.Amount);
                    p.WriteHexString("00 00");
                    p.WriteShort(tag.TimeLeft);
                    p.WriteShort(tag.TimeMax);
                    p.WriteHexString("00 00 00 00");
                }
                if (i is PetItem)
                {
                    PetItem pet = i as PetItem;
                    p.WriteByte(pet.RequiredClass);
                    p.WriteShort(pet.Amount);
                    p.WriteByte(pet.TameChance);
                    p.WriteHexString("00 00"); // unknown
                    p.WriteByte(pet.DecreaseWildness);
                    p.WriteInt(pet.HealLife);
                }
                if (i is RebirthPill)
                {
                    RebirthPill pill = i as RebirthPill;
                    p.WriteHexString("00");
                    p.WriteShort(pill.Amount);
                    p.WriteShort(pill.RequiredRebirth);
                    p.WriteHexString("00");
                    p.WriteShort(pill.RequiredLevel);
                }
            }

            return p.GetWrittenBuffer(PacketIds.SendWarehouseItemList);
        }
Esempio n. 15
0
 public static byte[] SendSpawnNpc(List<Npc> npcs, int mapid)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00"); // unknown
     p.WriteInt(mapid);
     p.WriteShort(npcs.Count);
     foreach (Npc n in npcs)
     {
         p.WriteInt(n.NpcID);
         p.WriteByte(n.NpcType);
         p.WriteByte(n.NpcType);
         p.WriteHexString("01"); // unknown
         p.WriteShort(n.X);
         p.WriteShort(n.Y);
         p.WriteHexString("00"); // unknown
         p.WriteShort(n.Direction);
         p.WriteHexString("00 00 00 00 00 00 00 00 00"); // unknown
     }
     return p.GetWrittenBuffer(PacketIds.SendNpcSpawn);
 }
Esempio n. 16
0
        public static byte[] SendNpcItemList(Npc n, byte bag)
        {
            Packet p = new Packet(200);
            p.WriteHexString("00"); // unknown
            p.WriteInt(n.NpcID);
            p.WriteByte(bag); // bag
            p.WriteShort(n.Bags[bag].ItemCount);
            foreach (BaseItem i in n.Bags[bag].Items)
            {
                p.WriteShort(i.ReferenceID);
                p.WriteByte(i.bType);
                p.WriteByte(i.bKind);
                p.WriteShort(i.VisualID);
                p.WriteInt(i.Price);
                p.WriteHexString("00 00"); // some quest item, only guild master thingy
                p.WriteByte(i.RequiredClass);
                p.WriteShort(i.Amount);
                p.WriteByte(i.Slot);
                p.WriteHexString("00");

                if (i is Equipment)
                {
                    Equipment e = i as Equipment;
                    p.WriteShort(e.RequiredLevel);
                    p.WriteShort(e.RequiredDexterity);
                    p.WriteShort(e.RequiredStrength);
                    p.WriteShort(e.RequiredStamina);
                    p.WriteShort(e.RequiredEnergy);
                    p.WriteByte(e.MaxImbueTries);
                    p.WriteHexString("00"); // something
                    p.WriteShort(e.Durability);
                    p.WriteShort(e.Durability);
                    p.WriteShort(e.Damage);
                    p.WriteShort(e.Defence);
                    p.WriteShort(e.AttackRating);
                    if (e is Cape)
                    {
                        Cape c = e as Cape;
                        p.WriteHexString("00 00"); // faster run
                        p.WriteHexString("01 00"); // decrease times of durability
                        p.WriteByte(c.PolishImbueTries); // polish imbue tries
                        p.WriteHexString("00"); // something
                        p.WriteShort(c.MaxPolishImbueTries); // polish max tries
                        p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00"); // something
                    }
                    else
                    {
                        p.WriteShort(e.AttackSpeed);
                        p.WriteShort(e.AttackRange);
                        p.WriteShort(e.IncMaxLife);
                        p.WriteShort(e.IncMaxMana);
                        p.WriteShort(e.IncLifeRegen);
                        p.WriteShort(e.IncManaRegen);
                        p.WriteShort(e.Critical);
                        p.WriteHexString("00 00 00 00 00 00 00 00");
                    }
                }
                if (i is PotionItem)
                {
                    PotionItem pot = i as PotionItem;
                    p.WriteShort(pot.HealHp);
                    p.WriteShort(pot.HealMana);
                }
            }

            return p.GetWrittenBuffer(PacketIds.SendNpcItemList);
        }
Esempio n. 17
0
 public static byte[] SendSpawnPlayers(Character ch)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(ch.MapId);
     p.WriteHexString("01 00");
     p.WriteInt(ch.CharacterId);
     p.WriteShort(ch.X);
     p.WriteShort(ch.Y);
     p.WriteHexString("76");
     p.WriteShort(ch.X);
     p.WriteShort(ch.Y);
     p.WriteHexString("76");
     p.WriteHexString("16 B2 00 00");
     p.WriteByte(ch.Class);
     p.WriteString(ch.Name);
     p.WriteInt(ch.Fame);
     p.WriteHexString("00"); // bool selling
     p.WriteString(""); // shopname
     p.WriteString(""); // shopdesc
     p.WriteHexString("00"); // purple name
     p.WriteHexString("00"); // fe
     p.WriteHexString("00"); // fe ring
     p.WriteHexString("00"); // maybe has guild thingy
     //if Character has guild
     //p.WriteHexString("00 00 00 00"); // guild id
     //p.WriteString(""); // guild name
     //p.WriteHexString("00 00 00 00"); // maybe guild position
     //p.WriteHexString("00 00 00 00"); // maybe guild position
     //p.WriteHexString("00 00 00 00 00 00 00 00");
     //p.WriteHexString("00"); // something
     p.WriteHexString("00 00 00 00 00 00 00 00 00"); // else write this
     foreach (Equipment e in ch.GetVisuals())
     {
         p.WriteShort(e.VisualID);
         p.WriteByte(e.Plus);
         p.WriteByte(e.Slvl);
         p.WriteByte(e.RequiredClass);
     }
     p.WriteByte(ch.Rebirth); // rebirth
     p.WriteHexString("00 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendSpawnPlayers);
 }
Esempio n. 18
0
 public static byte[] SendPlayerID(int id)
 {
     Packet p = new Packet(200);
     p.WriteHexString("20 3A 05 00");
     p.WriteInt(id);
     p.WriteByte(0);
     return p.GetWrittenBuffer();
 }
Esempio n. 19
0
        public static byte[] SendStartMoving(MovementInfo mo, byte movingspeed)
        {
            Packet p = new Packet(200);
            p.WriteByte(0);
            p.WriteInt(mo.CharacterID);
            p.WriteShort(mo.FromX);
            p.WriteShort(mo.FromY);
            p.WriteByte(mo.FromZ);
            p.WriteShort(mo.ToX);
            p.WriteShort(mo.ToY);
            p.WriteByte(mo.ToZ);
            p.WriteShort(mo.Rotation);
            p.WriteHexString("00");
            p.WriteByte(11 + movingspeed);
            p.WriteHexString("00");

            return p.GetWrittenBuffer(PacketIds.SendStartMoving);
        }
Esempio n. 20
0
 public static byte[] SendPortal(Portal portal)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(portal.ToMapID);
     p.WriteShort(portal.ToX);
     p.WriteShort(portal.ToY);
     p.WriteHexString("01");
     return p.GetWrittenBuffer(PacketIds.SendPortal);
 }
Esempio n. 21
0
 public static byte[] SendStopMoving(MovementInfo mo)
 {
     Packet p = new Packet(200);
     p.WriteByte(0);
     p.WriteInt(mo.CharacterID);
     p.WriteShort(mo.FromX);
     p.WriteShort(mo.FromY);
     p.WriteByte(mo.FromZ);
     p.WriteByte(0);
     return p.GetWrittenBuffer(PacketIds.SendStopMoving);
 }
Esempio n. 22
0
 public static byte[] SendRemoveCharacter(Character ch)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(ch.CharacterId);
     p.WriteHexString("01");
     p.WriteInt(ch.MapId);
     p.WriteHexString("00");
     return p.GetWrittenBuffer(PacketIds.SendRemoveCharacter);
 }
Esempio n. 23
0
 /// <summary>
 /// Send chosed world ip to client
 /// </summary>
 /// <param name="ip"></param>
 /// <returns></returns>
 public static byte[] SendWorldIP(string ip, int port)
 {
     Packet p = new Packet(100);
     p.WriteString(ip); // world ip, if theres multiple worlds request will send the world id in order to get right ones ip
     p.WriteInt(port);
     return p.GetWrittenBuffer(PacketIds.SendWorldIP);
 }
Esempio n. 24
0
 public static byte[] SendRemoveMapItem(int mapitemId)
 {
     Packet p = new Packet(200);
     p.WriteInt(mapitemId);
     return p.GetWrittenBuffer(PacketIds.SendRemoveMapItem);
 }
Esempio n. 25
0
        /// <summary>
        /// Send character list to client
        /// </summary>
        /// <returns></returns>
        public static byte[] SendCharacterList(Character[] characters)
        {
            Packet p = new Packet(200);
            p.WriteByte(characters.Length);

            foreach (Character c in characters)
            {
                p.WriteInt(c.MapId);
                p.WriteInt(c.CharacterId);
                p.WriteString(c.Name);
                p.WriteByte(c.Class);
                p.WriteShort(c.Level);
                p.WriteInt(c.CurrentHp);
                p.WriteInt(c.MaxHp);
                p.WriteInt(c.MaxMana);
                p.WriteShort(c.Strength);
                p.WriteShort(c.Stamina);
                p.WriteShort(c.Dexterity);
                p.WriteShort(c.Energy);
                p.WriteHexString("00 00 00 00 02 00 00 00 00 00 00 00"); // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                foreach (Equipment e in c.GetVisuals())
                {
                    p.WriteShort(e.VisualID);
                    p.WriteByte(e.Plus);
                    p.WriteByte(e.Slvl);
                }

                p.WriteHexString("01 00"); // ending bytes
            }

            return p.GetWrittenBuffer(PacketIds.SendCharacterList);
        }
Esempio n. 26
0
 public static byte[] SendSpawn10(Character Char)
 {
     Packet p = new Packet(200);
     p.WriteByte(0);
     p.WriteInt(Char.MapId);
     p.WriteInt(Char.CharacterId);
     p.WriteByte(Char.Class);
     p.WriteShort(Char.X);
     p.WriteShort(Char.Y);
     p.WriteHexString("00 00 00 00 13 00 00 00 00 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendSpawn);
 }
Esempio n. 27
0
 public static byte[] SendCommand(Character ch, CommandInfo ci)
 {
     Packet p = new Packet(200);
     p.WriteInt(ch.CharacterId);
     p.WriteByte(ci.Type);
     p.WriteByte(ci.Action);
     p.WriteByte(ci.Something);
     p.WriteByte(ci.Something2);
     return p.GetWrittenBuffer(PacketIds.SendCommand);
 }
Esempio n. 28
0
        public static byte[] SendSpawn12(Client[] Characters)
        {
            Packet p = new Packet(200);

            p.WriteByte(0);
            p.WriteByte(Characters.Length);

            for (int i = 0; i < Characters.Length; i++)
            {
                p.WriteInt(Characters[i].MyCharacter.CharacterId);
                p.WriteHexString("01 00"); // entity type, like 1 for players blabla
            }

            return p.GetWrittenBuffer(PacketIds.SendPlayerIdsSomething);
        }
Esempio n. 29
0
 public static byte[] SendImbuedItem(BaseItem i)
 {
     Packet p = new Packet(500);
     p.WriteByte(i.Bag);
     p.WriteByte(i.Slot);
     p.WriteInt(i.ItemID);
     p.WriteShort(i.ReferenceID);
     p.WriteByte(i.bType);
     p.WriteByte(i.bKind);
     p.WriteShort(i.VisualID);
     p.WriteInt(i.Price);
     p.WriteHexString("00 00");
     Equipment e = i as Equipment;
     p.WriteByte(e.RequiredClass);
     p.WriteShort(e.Amount);
     p.WriteShort(e.RequiredLevel);
     p.WriteShort(e.RequiredDexterity);
     p.WriteShort(e.RequiredStrength);
     p.WriteShort(e.RequiredStamina);
     p.WriteShort(e.RequiredEnergy);
     p.WriteByte(e.MaxImbueTries);
     p.WriteShort(e.Durability);
     p.WriteShort(e.MaxDurability);
     p.WriteShort(e.Damage);
     p.WriteShort(e.Defence);
     p.WriteShort(e.AttackRating);
     p.WriteShort(e.AttackSpeed);
     p.WriteShort(e.AttackRange);
     p.WriteShort(e.IncMaxLife);
     p.WriteShort(e.IncMaxMana);
     p.WriteShort(e.IncLifeRegen);
     p.WriteShort(e.IncManaRegen);
     p.WriteShort(e.Critical);
     p.WriteByte(e.Plus);
     p.WriteByte(e.Slvl);
     p.WriteHexString("00"); // unknown
     p.WriteByte(e.ImbueTries);
     p.WriteHexString("00"); // unknown
     p.WriteShort(e.DragonSuccessImbueTries);
     p.WriteByte(e.DiscountRepairFee);
     p.WriteShort(e.TotalDragonImbueTries);
     p.WriteShort(e.DragonDamage);
     p.WriteShort(e.DragonDefence);
     p.WriteShort(e.DragonAttackRating);
     p.WriteShort(e.DragonLife);
     p.WriteByte(e.MappedData);
     if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
         p.WriteByte(e.ForceSlot);
     p.WriteHexString("00 00"); // unknown
     if (e is Cape)
     {
         Cape c = e as Cape;
         p.WriteHexString("00 00"); // required guild position
         p.WriteHexString("00 00 00 00 00 00 00");
         p.WriteHexString("01 00"); // decrease times of durability
         p.WriteByte(c.PolishImbueTries); // polish imbue tries
         p.WriteShort(c.MaxPolishImbueTries); // polish max tries
         p.WriteShort(c.VigiStat1); // stat1
         p.WriteShort(c.VigiStat2); // stat2
         p.WriteShort(c.VigiStat3); // stat3
         p.WriteShort(c.VigiStat4); // stat4
         p.WriteHexString("00 00"); // stat5
         p.WriteShort(c.VigiStatAdd1); // stat1 increase
         p.WriteShort(c.VigiStatAdd2); // stat2 increase
         p.WriteShort(c.VigiStatAdd3); // stat3 increase
         p.WriteShort(c.VigiStatAdd4); // stat4 increase
         p.WriteHexString("00 00"); // stat5 increase
         p.WriteHexString("00 00"); // unknown
     }
     if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
     {
         p.WriteByte(e.RebirthHole);
         p.WriteByte(e.RebirthHoleItem);
         p.WriteShort(e.RebirthHoleStat);
     }
     return p.GetWrittenBuffer(PacketIds.SendImbuedItem);
 }
Esempio n. 30
0
 public static byte[] SendTradePlayerError(byte error, int characterId)
 {
     Packet p = new Packet(20);
     p.WriteByte((byte)error);
     p.WriteInt(characterId);
     return p.GetWrittenBuffer(PacketIds.SendTradePlayerError);
 }