Esempio n. 1
0
        public void HandleCharEnum(PacketIn packet)
        {
            byte count = packet.ReadByte();

            PlayerEnum[] chr = new PlayerEnum[10];
            for (int i = 0; i < count; i++)
            {

                chr[i].GUID = new GameGuid(packet.ReadUInt64());
                chr[i].Name = packet.ReadString();
                chr[i].Race = packet.ReadByte();
                chr[i].Class = packet.ReadByte();
                chr[i].Gender = packet.ReadByte();
                chr[i].Skin = packet.ReadByte();
                chr[i].Face = packet.ReadByte();
                chr[i].HairStyle = packet.ReadByte();
                chr[i].HairColor = packet.ReadByte();
                chr[i].FacialHair = packet.ReadByte();
                chr[i].Level = packet.ReadByte();
                chr[i].ZoneID = packet.ReadUInt32();
                chr[i].MapID = packet.ReadUInt32();
                chr[i].X = packet.ReadFloat();
                chr[i].Y = packet.ReadFloat();
                chr[i].Z = packet.ReadFloat();

                chr[i].Guild = packet.ReadUInt32();
                chr[i].CharacterFlags = packet.ReadUInt32();
                chr[i].CustomizationFlags = packet.ReadUInt32();
                chr[i].FirstLogin = packet.ReadByte();
                chr[i].PetInfoID = packet.ReadUInt32();
                chr[i].PetLevel = packet.ReadUInt32();
                chr[i].PetFamilyID = packet.ReadUInt32();
                chr[i]._items = new PlayerEnumItem[23];
                for (int x = 0; x <= 22; x++)
                {
                    chr[i]._items[x].displayId = packet.ReadUInt32();
                    chr[i]._items[x].inventorytype = packet.ReadByte();
                    chr[i]._items[x].enchant = packet.ReadUInt32(); // enchant (2.4 patch)
                }

               /* packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();*/

                CharacterListExt cx;
                cx.p = chr[i];
                cx.class_ = "classname";
                cx.race = "racename";
                cx.zone = "zonename";
                cx.map_ = "mapname";

                Global.GetInstance().GetWSession().GetCharList().Add(cx);

            }

            #region Default Char Create
            if (count == 0)
            {
                PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_CREATE);

                outpacket.Write("qweqwe");
                outpacket.Write((byte)1); // race - human
                outpacket.Write((byte)1); // class - warrior
                outpacket.Write((byte)0); // gender - male
                outpacket.Write((byte)1); // skin
                outpacket.Write((byte)1); // face
                outpacket.Write((byte)1); // hair style
                outpacket.Write((byte)1); // hair color
                outpacket.Write((byte)1); // facial hair
                outpacket.Write((byte)1); // outfit id
                Send(outpacket);
                outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_ENUM);
                Send(outpacket);
                // return;
            }
            else {

            }
            #endregion

            Log.WriteLine(netLogic.Shared.LogType.Success, "Received info about {0} characters", count);

            PingLoop();
            LevelManager.Load("CharactersList");
        }
Esempio n. 2
0
        public void _ItemQuerySingleResponse(PacketIn packet)
        {
            UInt32 ItemID;
              //  UInt32 unk;
               // uint unk8;
              //  string s;

            ItemID = packet.ReadUInt32();

            if (!(ItemID == 0x80000000)) // invalid item flag?
            {
                ItemProto proto = new ItemProto();
                proto.Id = ItemID;
                proto.Class = packet.ReadUInt32();
                proto.SubClass = packet.ReadUInt32();
                packet.ReadUInt32();
                proto.Name = packet.ReadString();
                packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();
                proto.DisplayInfoID = packet.ReadUInt32();
                proto.Quality = packet.ReadUInt32();
                proto.Flags = packet.ReadUInt32();
                proto.Faction = packet.ReadUInt32();
                proto.BuyPrice = packet.ReadUInt32();
                proto.SellPrice = packet.ReadUInt32();
                proto.InventoryType = packet.ReadUInt32();
                proto.AllowableClass = packet.ReadUInt32();
                proto.AllowableRace = packet.ReadUInt32();
                proto.ItemLevel = packet.ReadUInt32();
                proto.RequiredLevel = packet.ReadUInt32();
                proto.RequiredSkill = packet.ReadUInt32();
                proto.RequiredSkillRank = packet.ReadUInt32();
                proto.RequiredSpell = packet.ReadUInt32();
                proto.RequiredHonorRank = packet.ReadUInt32();
                proto.RequiredCityRank = packet.ReadUInt32();
                proto.RequiredReputationFaction = packet.ReadUInt32();
                proto.RequiredReputationRank = packet.ReadUInt32();
                proto.MaxCount = packet.ReadUInt32();
                proto.Stackable = packet.ReadUInt32();
                proto.ContainerSlots = packet.ReadUInt32();
                proto.StatsCount = packet.ReadUInt32();
                for (UInt32 i = 0; i<proto.StatsCount; i++)
                {
                    proto.ItemStat = new _ItemStat[10];
                    proto.ItemStat[i].ItemStatType = packet.ReadUInt32();
                    proto.ItemStat[i].ItemStatValue = packet.ReadUInt32();
                }
                proto.ScalingStatDistribution = packet.ReadUInt32();
                proto.ScalingStatValue = packet.ReadUInt32();
                for (int i = 0; i < 2; i++)
                {
                    proto.Damage = new _ItemDamage[2];
                    proto.Damage[i].DamageMin = packet.ReadFloat();
                    proto.Damage[i].DamageMax = packet.ReadFloat();
                    proto.Damage[i].DamageType = packet.ReadUInt32();
                }
                proto.Armor = packet.ReadUInt32();
                proto.HolyRes = packet.ReadUInt32();
                proto.FireRes = packet.ReadUInt32();
                proto.NatureRes = packet.ReadUInt32();
                proto.FrostRes = packet.ReadUInt32();
                proto.ShadowRes = packet.ReadUInt32();
                proto.ArcaneRes = packet.ReadUInt32();
                proto.Delay = packet.ReadUInt32();
                proto.Ammo_type = packet.ReadUInt32();
                proto.RangedModRange = packet.ReadFloat();
                for (int i = 0; i < 5; i++)
                {
                    proto.Spells = new _ItemSpell[5];
                    proto.Spells[i].SpellId = packet.ReadUInt32();
                    proto.Spells[i].SpellTrigger = packet.ReadUInt32();
                    proto.Spells[i].SpellCharges = packet.ReadUInt32();
                    proto.Spells[i].SpellCooldown = packet.ReadUInt32();
                    proto.Spells[i].SpellCategory = packet.ReadUInt32();
                    proto.Spells[i].SpellCategoryCooldown = packet.ReadUInt32();
                }
                proto.Bonding = packet.ReadUInt32();
                proto.Description = packet.ReadString();
                proto.PageText = packet.ReadUInt32();
                proto.LanguageID = packet.ReadUInt32();
                proto.PageMaterial = packet.ReadUInt32();
                proto.StartQuest = packet.ReadUInt32();
                proto.LockID = packet.ReadUInt32();
                proto.Material = packet.ReadUInt32();
                proto.Sheath = packet.ReadUInt32();
                proto.RandomProperty = packet.ReadUInt32();
                proto.RandomSuffix = packet.ReadUInt32();
                proto.Block = packet.ReadUInt32();
                proto.ItemSet = packet.ReadUInt32();
                proto.MaxDurability = packet.ReadUInt32();
                proto.Area = packet.ReadUInt32();
                proto.Map = packet.ReadUInt32();
                proto.BagFamily = packet.ReadUInt32();
                proto.TotemCategory = packet.ReadUInt32();
                for (UInt32 i = 0; i < 3; i++)
                {
                    proto.Socket = new _ItemSocket[3];
                    proto.Socket[i].Color = packet.ReadUInt32();
                    proto.Socket[i].Content = packet.ReadUInt32();
                }
                proto.socketBonus = packet.ReadUInt32();
                proto.GemProperties = packet.ReadUInt32();
                proto.RequiredDisenchantSkill = packet.ReadUInt32();
                proto.ArmorDamageModifier = packet.ReadFloat();
                proto.Duration = packet.ReadInt32();
                proto.ItemLimitCategory = packet.ReadUInt32();
                proto.HolidayId = packet.ReadUInt32();

                //TODO
               /* objmgr.Add(proto);
                objmgr.AssignNameToObj(proto->Id, TYPEID_ITEM, proto->Name);
                objmgr.AssignNameToObj(proto->Id, TYPEID_CONTAINER, proto->Name);*/

            }
        }
Esempio n. 3
0
        public void HandleRealmlist(PacketIn packetIn)
        {
            //packetIn.ReadByte();
            UInt16 Length = packetIn.ReadUInt16();
            UInt32 Request = packetIn.ReadUInt32();
            int realmscount = packetIn.ReadInt16();

            //Console.Write(packetIn.ToHex());

            Log.WriteLine(LogType.Success, "Got information about {0} realms.", realmscount);
            Realm[] realms = new Realm[realmscount];
            try
            {
                for (int i = 0; i < realmscount; i++)
                {
                    realms[i].Type = packetIn.ReadByte();
                    realms[i].Color = packetIn.ReadByte();
                    packetIn.ReadByte(); // unk
                    realms[i].Name = packetIn.ReadString();
                    realms[i].Address = packetIn.ReadString();
                    realms[i].Population = packetIn.ReadFloat();
                    realms[i].NumChars = packetIn.ReadByte();
                    realms[i].Language = packetIn.ReadByte();
                    packetIn.ReadByte();
               }

                Realmlist = realms;

                LevelManager.Load("RealmServers");
                //netInstance.Event(new Event(EventType.EVENT_REALMLIST, "", new object[] { Realmlist }));

            }
            catch (Exception ex)
            {
                Log.WriteLine(LogType.Error, "Exception Occured");
                Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
                Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
                Disconnect();
            }
        }