예제 #1
0
        public static byte[] SendGuild(Guild g)
        {
            Packet p = new Packet(200);
            p.WriteInt(g.ID);
            p.WriteString(g.Name);
            p.WriteInt(g.Members.Count);

            foreach (GuildMember c in g.Members)
            {
                p.WriteInt((int)c.Rank);
                p.WriteInt(c.Character.CharacterId);
                p.WriteString(c.Character.Name);
                p.WriteString(c.Title);
                p.WriteByte(Convert.ToByte(c.Online));
                p.WriteHexString("01");
            }

            return p.GetWrittenBuffer(PacketIds.SendGuild);
        }
예제 #2
0
        /// <summary>
        /// Send list of worlds to client
        /// </summary>
        /// <returns></returns>
        public static byte[] SendWorldList(WorldInfo[] worldInfos)
        {
            Packet p = new Packet(100);

            p.WriteByte(worldInfos.Length);
            for (int i = 0; i < worldInfos.Length; i++)
            {
                p.WriteByte(worldInfos[i].WorldId);
                p.WriteString(worldInfos[i].WorldName);
                p.WriteString(worldInfos[i].WorldDesc);
            }

            return p.GetWrittenBuffer(PacketIds.SendWorldList);
        }
예제 #3
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);
        }
예제 #4
0
 public static byte[] SendTradePetOffer(Pet pet, int MoneyWanted, int targetid)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(pet.OwnerID);
     p.WriteInt(targetid);
     p.WriteInt(pet.PetID);
     p.WriteInt(MoneyWanted);
     p.WriteString("Pet"); // type of the pet, could be like beast, undead etc
     p.WriteString(pet.Name);
     p.WriteShort(pet.Level);
     p.WriteInt(pet.MaxHealth);
     p.WriteShort(pet.Damage);
     p.WriteShort(pet.Defense);
     p.WriteShort(pet.AttackRating);
     p.WriteHexString("01 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendTradePetOffer);
 }
예제 #5
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);
 }
예제 #6
0
        public static byte[] SendPlayerPet(Character ch)
        {
            Packet p = new Packet(200);
            Pet pet = ch.Pet;
            p.WriteInt(ch.CharacterId);
            if (pet != null)
            {
                p.WriteHexString("01");
                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(pet.Position.X);
                p.WriteShort(pet.Position.Y);
                p.WriteHexString("38 D7 03 96 04 38 CE 00");
                p.WriteInt(pet.TotalHealth);
                p.WriteInt(pet.CurHealth);
                p.WriteShort(pet.TotalDamage);
                p.WriteShort(pet.TotalDefense);
                p.WriteShort(pet.TotalAttackRating);
                p.WriteHexString("01 00 09 00 00 00 00 00 56 2A 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 00 00 00 00 00 00 00 00");
                p.WriteHexString("00 00 00 00 00 00 00 00 00 00");
            }
            else
                p.WriteHexString("00"); // no pet

            return p.GetWrittenBuffer(PacketIds.SendPetOnLogin);
        }
예제 #7
0
        public static byte[] SendSpawnPlayer(Character ch)
        {
            Packet p = new Packet(200);
            p.WriteHexString("00");
            p.WriteInt(ch.CharacterId);
            p.WriteInt(ch.MapId);
            p.WriteShort(ch.Position.X);
            p.WriteShort(ch.Position.Y);
            p.WriteHexString("76");
            p.WriteShort(ch.Position.X);
            p.WriteShort(ch.Position.Y);
            p.WriteHexString("76");
            p.WriteHexString("0B C5 00 00");
            p.WriteByte(ch.Class);
            p.WriteString(ch.Name);
            p.WriteInt(ch.Fame);
            p.WriteByte(Convert.ToByte(ch.Shop.Active));
            p.WriteString(ch.Shop.ShopName);
            p.WriteString(ch.Shop.ShopDesc);
            p.WriteHexString("00 00 00 00 00 00 00 00 00");
            p.WriteInt(ch.Party.PartyID);
            p.WriteInt(ch.Party.Leader.CharacterId);
            p.WriteHexString("00 00 00 00");
            foreach (Equipment e in ch.GetVisuals())
            {
                p.WriteShort(e.VisualID);
                p.WriteByte(e.Plus);
                p.WriteByte(e.Slvl);
                p.WriteByte(e.RequiredClass);
            }
            p.WriteHexString("00 00 00 00 00 00");

            return p.GetWrittenBuffer(PacketIds.SendSpawnPlayer);
        }
예제 #8
0
 public static byte[] SendGuildMemberInfo(GuildMember g)
 {
     Packet p = new Packet(200);
     p.WriteInt(g.Character.CharacterId);
     p.WriteString(g.Character.Name);
     p.WriteInt((int)g.Rank);
     p.WriteString(g.Title);
     p.WriteByte(Convert.ToByte(g.Online));
     p.WriteByte(g.Character.Level);
     p.WriteHexString("00"); // some stats
     p.WriteByte(g.Character.Class);
     return p.GetWrittenBuffer(PacketIds.SendGuildMemberInfo);
 }
예제 #9
0
 public static byte[] SendGuildNotice(Guild g)
 {
     Packet p = new Packet(20);
     p.WriteInt(g.Leader.Character.CharacterId);
     p.WriteHexString("09");
     p.WriteString(g.Notice);
     return p.GetWrittenBuffer(PacketIds.SendGuildNotice);
 }
예제 #10
0
 public static byte[] SendGuildJoin(Character c)
 {
     Packet p = new Packet(20);
     p.WriteHexString("00");
     p.WriteHexString("45 1A 00 00"); // guild id
     p.WriteHexString("01 00 00 00");
     p.WriteInt(c.CharacterId);
     p.WriteString(c.Name);
     return p.GetWrittenBuffer(PacketIds.SendGuildJoin);
 }
예제 #11
0
 public static byte[] SendGuildMember(Guild g, GuildMember m)
 {
     Packet p = new Packet(20);
     p.WriteInt(m.Character.CharacterId);
     p.WriteInt(g.ID);
     p.WriteString(g.Name);
     p.WriteInt((int)m.Rank);
     p.WriteString(m.Title);
     p.WriteString(m.Character.Name); // owner name
     p.WriteHexString("00 00 00 00 00");
     p.WriteHexString("02 00 00 00");
     p.WriteHexString("00 00 00 00"); // more stats?
     p.WriteHexString("00 00 00 00"); // guild mark
     return p.GetWrittenBuffer(PacketIds.SendGuildOwner);
 }
예제 #12
0
 public static byte[] SendGuildCreate(Guild g)
 {
     Packet p = new Packet(20);
     p.WriteHexString("00");
     p.WriteInt(g.ID);
     p.WriteString(g.Name);
     return p.GetWrittenBuffer(PacketIds.SendGuildCreate);
 }
예제 #13
0
 public static byte[] SendGuildChat(Character ch, string message)
 {
     Packet p = new Packet(20);
     p.WriteInt(ch.CharacterId);
     p.WriteHexString("06");
     p.WriteString(message);
     return p.GetWrittenBuffer(PacketIds.SendGuildNotice);
 }
예제 #14
0
 public static byte[] SendGuildChangeMemberTitle(Guild g, GuildMember m, GuildMemberError e)
 {
     Packet p = new Packet(20);
     p.WriteByte((byte)e); // error proly
     if (e == GuildMemberError.Success)
     {
         p.WriteInt(g.ID);
         p.WriteInt(m.Character.CharacterId);
         p.WriteString(m.Title);
     }
     else
     {
         p.WriteInt(0);
         p.WriteInt(0);
         p.WriteString("");
     }
     return p.GetWrittenBuffer(PacketIds.SendGuildChangeMemberTitle);
 }
예제 #15
0
 public static byte[] SendPetRenamed(Pet pet)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(pet.PetID);
     p.WriteString(pet.Name);
     return p.GetWrittenBuffer(PacketIds.SendPetRenamed);
 }
예제 #16
0
 public static byte[] SendGuildStats(Guild g)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(g.ID);
     p.WriteString(g.Name);
     p.WriteInt(g.Leader.Character.CharacterId);
     p.WriteString(g.Leader.Character.Name);
     p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 00 02 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 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 05 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendGuildStats);
 }
예제 #17
0
 public static byte[] SendPetStats(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(pet.Position.X);
     p.WriteShort(pet.Position.Y);
     p.WriteHexString("00");
     p.WriteShort(pet.Position.X);
     p.WriteShort(pet.Position.Y);
     p.WriteHexString("00 8B 00");
     p.WriteInt(pet.TotalHealth);
     p.WriteInt(pet.CurHealth);
     p.WriteShort(pet.TotalDamage);
     p.WriteShort(pet.TotalDefense);
     p.WriteShort(pet.TotalAttackRating);
     p.WriteHexString("00 00 04 04 00 00 00 00 83 4E 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 00 00 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendPetStats);
 }
예제 #18
0
 public static byte[] SendGuildTown(GuildTown Town)
 {
     Packet p = new Packet(200);
     p.WriteByte(0);
     p.WriteInt(Town.MapID); // map id prolly
     p.WriteHexString("01 00"); // status, 1 = free, rest sold?
     p.WriteInt(Town.ID); // guild townID
     p.WriteString(Town.Name); // name
     p.WriteByte(Town.Grade); // town level/grade
     p.WriteShort(Town.Position.X); // x
     p.WriteShort(Town.Position.Y); // y
     p.WriteHexString("00 00 00"); // something
     p.WriteInt(Town.CurDura); // dura
     p.WriteInt(Town.MaxDura); // dura
     p.WriteInt(Town.OwnerID); // owner guildID
     return p.GetWrittenBuffer(PacketIds.SendGuildTown);
 }
예제 #19
0
        public static byte[] SendPlayerShop(Character ch, short timeleft)
        {
            Packet p = new Packet(20);
            p.WriteHexString("00");
            p.WriteInt(ch.CharacterId);
            p.WriteHexString("00");
            p.WriteString(ch.Shop.ShopName);
            p.WriteString(ch.Shop.ShopDesc);
            p.WriteInt(ch.Shop.TotalMoney);
            p.WriteShort(timeleft);
            p.WriteByte(ch.Shop.ItemCount);
            foreach (BaseItem i in ch.Shop.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"); // 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"); // otherslots
                        }
                        else
                            p.WriteHexString("00 00");
                        if (e is Cape)
                        {
                            Cape c = e as Cape;
                            p.WriteHexString("00 00 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
                        }
                        if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
                        {
                            p.WriteShort(e.RebirthHole);
                            //p.WriteByte(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 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);
                }

                p.WriteInt(i.SellPrice);
                if (i is Equipment)
                {
                    Equipment e = i as Equipment;
                    if (e.RebirthHoleStat > 0)
                        p.WriteShort(e.RebirthHoleStat);
                    else
                        p.WriteHexString("00 00");
                }
                else
                    p.WriteHexString("00 00");
            }

            return p.GetWrittenBuffer(PacketIds.SendPlayerShop);
        }
예제 #20
0
 public static byte[] SendLastDiedPets(List<Pet> pets)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteByte(pets.Count);
     foreach (Pet pet in pets)
     {
         p.WriteInt(pet.PetID);
         p.WriteByte(pet.PetType);
         p.WriteString(pet.Name);
         p.WriteShort(pet.Level);
         p.WriteInt(pet.MaxHealth);
         p.WriteShort(pet.Damage);
         p.WriteShort(pet.Defense);
         p.WriteShort(pet.AttackRating);
         p.WriteHexString("01 00"); // ending bytes
     }
     return p.GetWrittenBuffer(PacketIds.SendLastDiedPets);
 }
예제 #21
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.Position.X);
     p.WriteShort(ch.Position.Y);
     p.WriteHexString("76");
     p.WriteShort(ch.Position.X);
     p.WriteShort(ch.Position.Y);
     p.WriteHexString("76");
     p.WriteHexString("16 B2 00 00");
     p.WriteByte(ch.Class);
     p.WriteString(ch.Name);
     p.WriteInt(ch.Fame);
     p.WriteByte(Convert.ToByte(ch.Shop.Active));
     p.WriteString(ch.Shop.ShopName);
     p.WriteString(ch.Shop.ShopDesc);
     p.WriteHexString("00"); // purple name
     p.WriteHexString("00"); // fe
     p.WriteHexString("00"); // fe ring
     p.WriteHexString("00 00");
     if (ch.Guild != null)
     {
         p.WriteInt(ch.Guild.ID);
         p.WriteString(ch.Guild.Name);
         GuildMember member = ch.Guild.Members.Single(x => x.Character.CharacterId == ch.CharacterId);
         p.WriteInt((int)member.Rank);
         p.WriteString(member.Title);
         p.WriteHexString("00 00 00 00"); // picture
     }
     else
         p.WriteHexString("00 00 00");
     p.WriteHexString("00");
     if (ch.Party != null)
     {
         p.WriteInt(ch.Party.PartyID);
         p.WriteInt(ch.Party.Leader.CharacterId);
     }
     p.WriteHexString("00 00 00 00");
     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");
     p.WriteHexString("00 00 00 00"); // title
     return p.GetWrittenBuffer(PacketIds.SendSpawnPlayers);
 }
예제 #22
0
        public static byte[] SendParty(Party party)
        {
            Packet p = new Packet(20);
            p.WriteInt(party.PartyID);
            p.WriteByte(party.MemberCount);
            p.WriteByte(1); // unknown
            foreach (Character ch in party.Members)
            {
                p.WriteInt(ch.CharacterId);
                p.WriteByte(2); // unknown
                p.WriteString(ch.Name);
                p.WriteShort(ch.Level);
                p.WriteShort(ch.Position.X);
                p.WriteShort(ch.Position.Y);
                p.WriteInt(ch.CurrentHp);
                p.WriteInt(ch.MaxHp);
                p.WriteInt(ch.MapId);
            }

            return p.GetWrittenBuffer(PacketIds.SendParty);
        }
예제 #23
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);
 }
예제 #24
0
        public static byte[] SendPetBaitTaken(Monster m, Pet pet)
        {
            Packet p = new Packet(200);

            p.WriteInt(m.MonsterID);
            p.WriteByte((byte)m.Type);
            p.WriteHexString("00 00 00 00");
            p.WriteInt(pet.PetID);
            p.WriteByte((byte)pet.Type);
            p.WriteInt(pet.OwnerID);
            p.WriteString(pet.Name);
            return p.GetWrittenBuffer(PacketIds.SendPetBaitTaken);
        }
예제 #25
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);
 }
예제 #26
0
 public static byte[] SendPetOtherPlayerSpawn(Pet pet)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(pet.MapID);
     p.WriteByte(pet.Evolution);
     p.WriteByte(pet.PetType);
     p.WriteInt(pet.PetID);
     p.WriteHexString("00");
     p.WriteInt(pet.MapID);
     p.WriteShort(pet.Position.X);
     p.WriteShort(pet.Position.Y);
     p.WriteHexString("4E 58 01");
     p.WriteString(pet.Name);
     p.WriteHexString("14 51 01 B4 00 4E 24 00 00 00 24 00 00 00 09");
     p.WriteInt(pet.OwnerID);
     p.WriteHexString("02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendPetOtherPlayerSpawn);
 }
예제 #27
0
 /// <summary>
 /// Send channel to client
 /// </summary>
 /// <param name="CI">Channel Info, containing id, name, desc, ip address and port</param>
 /// <param name="TotalChannels"></param>
 /// <returns></returns>
 public static byte[] SendChannel(ChannelInfo CI, int TotalChannels)
 {
     Packet p = new Packet(500);
     p.WriteByte(TotalChannels); // total channels
     p.WriteByte(CI.ChannelId); // channel id
     p.WriteString(CI.ChannelName); // name
     p.WriteString(CI.ChannelDesc); // desc
     p.WriteHexString("12 F4 01");
     p.WriteString(CI.IPAddress); // ip
     p.WriteShort(CI.Port); // port
     p.WriteHexString("00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendChannelList);
 }
예제 #28
0
        public static byte[] SendPetOtherPlayerSpawn2(Pet pet)
        {
            Packet p = new Packet(200);
            p.WriteHexString("00");
            p.WriteInt(pet.PetID);
            p.WriteByte(pet.PetType);
            p.WriteInt(pet.MapID);
            p.WriteShort(pet.Position.X);
            p.WriteShort(pet.Position.Y);
            p.WriteHexString("00 00 00");
            p.WriteString(pet.Name);
            p.WriteHexString("00");
            p.WriteShort(pet.Position.X);
            p.WriteShort(pet.Position.Y);
            p.WriteHexString("00");
            p.WriteInt(pet.MaxHealth);
            p.WriteInt(pet.CurHealth);
            p.WriteHexString("00");
            p.WriteInt(pet.OwnerID);
            p.WriteHexString("00");
            p.WriteByte(Convert.ToByte(pet.IsLegendary));
            p.WriteHexString("00"); // mytholy pill :S
            p.WriteHexString("00 00"); // pet skill1
            p.WriteHexString("00 00"); // pet skill1 amount
            p.WriteHexString("00 00"); // pet skill2
            p.WriteHexString("00 00"); // pet skill2 amount
            p.WriteHexString("00"); // pet closeness
            p.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00");

            return p.GetWrittenBuffer(PacketIds.SendPetOtherPlayerSpawn2);
        }
예제 #29
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);
 }
예제 #30
0
 public static byte[] SendFriendList(List<Friend> friends)
 {
     Packet p = new Packet(200);
     p.WriteByte(friends.Count);
     foreach (Friend f in friends)
     {
         p.WriteByte((byte)f.RelationType);
         p.WriteInt(f.FriendID);
         p.WriteString(f.FriendName);
         p.WriteHexString("02 04 00 00 00");
         p.WriteByte(Convert.ToByte(f.FriendOnline));
     }
     return p.GetWrittenBuffer(PacketIds.SendFriendList);
 }