Exemplo n.º 1
0
        public override void SendMeTo(Player Plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Spawn.WorldO);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt32((UInt32)Spawn.WorldX);
            Out.WriteUInt32((UInt32)Spawn.WorldY);
            Out.WriteUInt16((ushort)Spawn.DisplayID);

            Out.WriteUInt16(Spawn.Proto.GetUnk(0));
            Out.WriteUInt16(Spawn.Proto.GetUnk(1));
            Out.WriteUInt16(Spawn.Proto.GetUnk(2));
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto.GetUnk(3));
            Out.Fill(0, 5);
            Out.WriteUInt16(Spawn.Proto.GetUnk(4));
            Out.WriteUInt16(Spawn.Proto.GetUnk(5));

            Out.WriteUInt32(0);

            Out.WritePascalString(Name);
            Out.WriteByte(0);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = (LobbyClient)client;

            UInt32 WorldUid = packet.GetUint32R();
            string Name = packet.GetUnicodeString();

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK);

            if (CheckName(Name) == 0)
            {
                cclient.CreateChar = new DBCharacter();
                cclient.CreateChar.AcctId = cclient.Account.Id;
                cclient.CreateChar.Name = Name;

                if (cclient.Account.WorldId != WorldUid)
                    Program.CharMgr.SetAccountWorld(cclient.Account.Id, (int)WorldUid);

                Out.WriteUInt32(0);
            }
            else
            {
                cclient.CreateChar = null;
                Out.WriteUInt32(1);
            }

            cclient.SendTCP(Out);
        }
Exemplo n.º 3
0
        static public void F_PING(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            uint Timestamp = packet.GetUint32();

            PacketOut Out = new PacketOut((byte)Opcodes.S_PONG);
            Out.WriteUInt32(Timestamp);
            Out.WriteUInt64((UInt64)TCPManager.GetTimeStamp());
            Out.WriteUInt32((UInt32)(cclient.SequenceID+1));
            Out.WriteUInt32(0);
            cclient.SendPacket(Out);
        }
Exemplo n.º 4
0
        static public void F_CONNECT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            packet.Skip(8);
            UInt32 Tag = packet.GetUint32();
            string Token = packet.GetString(80);
            packet.Skip(21);
            string Username = packet.GetString(23);

            // TODO
            AuthResult Result = Program.AcctMgr.CheckToken(Username, Token);
            if (Result != AuthResult.AUTH_SUCCESS)
            {
                Log.Error("F_CONNECT", "Invalid Token =" + Username);
                cclient.Disconnect();
            }
            else
            {
                cclient._Account = Program.AcctMgr.GetAccount(Username);
                if (cclient._Account == null)
                {
                    Log.Error("F_CONNECT", "Invalid Account =" + Username);
                    cclient.Disconnect();
                }
                else
                {
                    //Log.Success("F_CONNECT", "MeId=" + cclient.Id);

                    GameClient Other = (cclient.Server as TCPServer).GetClientByAccount(cclient, cclient._Account.AccountId);
                    if (Other != null)
                        Other.Disconnect();

                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED);
                        Out.WriteUInt32(0);
                        Out.WriteUInt32(Tag);
                        Out.WriteByte(Program.Rm.RealmId);
                        Out.WriteUInt32(1);
                        Out.WritePascalString(Username);
                        Out.WritePascalString(Program.Rm.Name);
                        Out.WriteByte(0);
                        Out.WriteUInt16(0);
                        cclient.SendPacket(Out);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void SendMount(Player Plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_MOUNT_UPDATE);
            Out.WriteUInt16(Owner.Oid);

            if (CurrentMountInfo == null)
                Out.WriteUInt32(0);
            else
                Out.WriteUInt32(CurrentMountInfo.Entry);

            Out.Fill(0, 14);

            if (Plr == null)
                Owner.DispatchPacket(Out, true);
            else
                Plr.SendPacket(Out);
        }
Exemplo n.º 6
0
 public void SendTok(ushort Entry, bool Print)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_TOK_ENTRY_UPDATE);
     Out.WriteUInt32(1);
     Out.WriteUInt16((UInt16)Entry);
     Out.WriteByte(1);
     Out.WriteByte((byte)(Print ? 1 : 0));
     Out.WriteByte(1);
     GetPlayer().SendPacket(Out);
 }
Exemplo n.º 7
0
        /*
         * |00 3D 71 
06 90 
00 00 
00 00 
1F E3 
00 0C E3 29 
00 0E 59 90 
FF FF 
1E 00 00 00 35 F3 00 03 04 00 00
|00 00 64 8B 76 09 CD 00 00 00 00 0F 45 6D 70 69 |..d.v.......Empi|
|72 65 20 42 61 72 20 44 6F 6F 72 04 06 AB DD 00 |re Bar Door.....|                                                
-------------------------------------------------------------------
         * */

        public override void SendMeTo(Player Plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Spawn.WorldO);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt32((UInt32)Spawn.WorldX);
            Out.WriteUInt32((UInt32)Spawn.WorldY);
            Out.WriteUInt16((ushort)Spawn.DisplayID);

            Out.WriteUInt16(Spawn.GetUnk(0));
            Out.WriteUInt16(Spawn.GetUnk(1));
            Out.WriteUInt16(Spawn.GetUnk(2));
            Out.WriteByte(Spawn.Unk1);

            int flags = Spawn.GetUnk(3);
            Loot Loots = LootsMgr.GenerateLoot(this, Plr);
            if (Loots != null && Loots.IsLootable())
            {
                flags = flags | 4;
            }

            Out.WriteUInt16((ushort)flags);
            Out.WriteByte(Spawn.Unk2);
            Out.WriteUInt32(Spawn.Unk3);
            Out.WriteUInt16(Spawn.GetUnk(4));
            Out.WriteUInt16(Spawn.GetUnk(5));
            Out.WriteUInt32(Spawn.Unk4);

            Out.WritePascalString(Name);
            Out.WriteByte(0);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
Exemplo n.º 8
0
 public void SendReinitTime(Player Plr, ushort Time)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
     Out.WriteUInt32(Info.Entry);
     Out.WriteByte(1);
     Out.WriteByte(2);
     Out.WriteByte(1);
     Out.WriteUInt16(0);
     Out.WritePascalString(Info.Name);
     Out.WriteUInt16(0);
     Out.WriteUInt16(Time); // Time in seconds
     Out.WriteUInt16(0);
     Out.WriteUInt16(0);
     Plr.SendPacket(Out);
 }
Exemplo n.º 9
0
        public static void CL_INFO(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

            if (cclient.LastInfoRequest == 0 || cclient.LastInfoRequest <= TCPServer.GetTimeStampMS()+10000)
            {
                cclient.LastInfoRequest = TCPServer.GetTimeStampMS();

                List<Realm> Rms = Program.AcctMgr.GetRealms();

                PacketOut Out = new PacketOut((byte)Opcodes.LCR_INFO);
                Out.WriteByte((byte)Rms.Count);
                foreach (Realm Rm in Rms)
                {
                    Out.WriteByte(Convert.ToByte(Rm.Info != null));
                    Out.WriteString(Rm.Name);
                    Out.WriteUInt32(Rm.OnlinePlayers);
                    Out.WriteUInt32(Rm.OrderCount);
                    Out.WriteUInt32(Rm.DestructionCount);
                }

                cclient.SendTCP(Out);
            }
        }
Exemplo n.º 10
0
        public static void BuildPlayerInfo(ref PacketOut Out,uint CharId, string Name, bool Online, byte Level, UInt16 Career, UInt16 Zone)
        {
            Out.WriteUInt32(CharId);
            Out.WriteByte(0);
            Out.WritePascalString(Name);
            Out.WriteByte(0);

            Out.WriteByte((byte)(Online ? 1 : 0));
            Out.WriteByte((byte)(Online ? 1 : 0));

            if (!Online)
                return;

            Out.WriteByte(Level);
            Out.WriteUInt16(0);
            Out.WriteUInt16(Career);
            Out.WriteUInt16(Zone);
            Out.WriteUInt16(1); // Guild Size
            Out.WriteByte(0);
        }
Exemplo n.º 11
0
        public void SendLevelUp(Dictionary<byte, UInt16> Diff)
        {
            SendRankUpdate(null);

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_LEVEL_UP);
            Out.WriteUInt32(0);
            Out.WriteByte((byte)Diff.Count);
            foreach (KeyValuePair<byte, UInt16> Stat in Diff)
            {
                Out.WriteByte(Stat.Key);
                Out.WriteUInt16(Stat.Value);
            }
            SendPacket(Out);
        }
Exemplo n.º 12
0
        public void SendBuyBack()
        {
            if (!HasPlayer())
                return;

            Player Plr = GetPlayer();

            PacketOut Out = new PacketOut((byte)Opcodes.F_STORE_BUY_BACK);
            Out.WriteByte((byte)BuyBack.Count); // Count
            for (int i = BuyBack.Count - 1; i >= 0; --i)
            {
                Out.WriteUInt32(BuyBack[i].Info.SellPrice);
                Item.BuildItem(ref Out, BuyBack[i], null, 0, 0);
            }
            Out.WriteByte(0);
            Plr.SendPacket(Out);
        }
Exemplo n.º 13
0
        static public void BuildItem(ref PacketOut Out,Item Itm,Item_Info Info,ushort SlotId,ushort Count)
        {
            SlotId = SlotId == 0 ? (Itm == null ? SlotId : Itm.SlotId ) : SlotId;
            Count = Count == 0 ? (Itm == null ? Count : Itm.Count) : Count;
            Info = Info == null ? (Itm == null ? null : Itm.Info) : Info;
            

            if(SlotId != 0)
                Out.WriteUInt16(SlotId);

            Out.WriteByte(0);
            Out.WriteUInt32((uint)(Info != null ? Info.Entry : 0));

            if (Info == null)
                return;

            Out.WriteUInt16((ushort)Info.ModelId);  // Valid 1.4.8
            Out.Fill(0, 7);  // Valid 1.4.8
            Out.WriteUInt16(Info.SlotId);  // Valid 1.4.8
            Out.WriteByte(Info.Type);  // Valid 1.4.8

            Out.WriteByte(Info.MinRank); // Min Level
            Out.WriteByte(Info.ObjectLevel); // 1.3.5, Object Level
            Out.WriteByte(Info.MinRenown); // 1.3.5, Min Renown
            Out.WriteByte(Info.MinRenown); // ?
            Out.WriteByte(Info.UniqueEquiped); // Unique - Equiped

            Out.WriteByte(Info.Rarity);
            Out.WriteByte(Info.Bind);
            Out.WriteByte(Info.Race);

            // Trophys have some extra bytes
            if (Info.Type == (byte)GameData.ItemTypes.ITEMTYPES_TROPHY)
            {
                Out.WriteUInt32(0);
                Out.WriteUInt16(0x0080);
            }

            Out.WriteUInt32(Info.Career);
            Out.WriteUInt32(0);
            Out.WriteUInt32(Info.SellPrice);

            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));
            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));

            Out.WriteUInt32(0);

            Out.WriteUInt32(Info.Skills);  // Valid 1.4.8
            Out.WriteUInt16(Info.Dps > 0 ? Info.Dps : Info.Armor);  // Valid 1.4.8
            Out.WriteUInt16(Info.Speed);  // Valid 1.4.8
            Out.WritePascalString(Info.Name);  // Valid 1.4.8

            Out.WriteByte((byte)Info._Stats.Count);  // Valid 1.4.8
            foreach (KeyValuePair<byte, UInt16> Key in Info._Stats)
            {
                Out.WriteByte(Key.Key);
                Out.WriteUInt16(Key.Value);
                Out.Fill(0, 5);
            }

            Out.WriteByte(0); // Equip Effects

            Out.WriteByte((byte)Info._Spells.Count); // OK
            foreach (KeyValuePair<UInt32, UInt32> Kp in Info._Spells)
            {
                Out.WriteUInt32(Kp.Key);
                Out.WriteUInt32(Kp.Value);
            }
            // (uint32)Entry, uint16 X, uint16 Y

            Out.WriteByte((byte)Info._Crafts.Count); // OK
            foreach (KeyValuePair<byte, ushort> Kp in Info._Crafts)
            {
                Out.WriteByte(Kp.Key);
                Out.WriteUInt16(Kp.Value);
            }

            Out.WriteByte(0); // ??

            Out.WriteByte(Info.TalismanSlots);
            Item_Info TalismanInfo = null;
            for (int i = 0; i < Info.TalismanSlots; ++i)
            {
                if (Itm != null)
                    TalismanInfo = Itm.GetTalisman((byte)i);
 
                if (TalismanInfo == null)
                    Out.WriteUInt32(0); // Entry;
                else
                {
                    Out.WriteUInt32(TalismanInfo.Entry);
                    Out.WritePascalString(TalismanInfo.Name);
                    Out.Fill(0, 15);
                }
            }

            Out.WritePascalString(Info.Description);

            Out.Write(Info.Unk27);

            /*Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);

            Out.WriteUInt16(0x0302);

            Out.Fill(0, 8);
            Out.WriteByte(0); // Type , Culture, etc etc
            Out.WriteByte(0); // Type, Recipian , Soil , etc etc
            Out.Fill(0, 11);*/
        }
Exemplo n.º 14
0
        public static byte[] BuildCharacters(int AccountId)
        {
            Log.Debug("BuildCharacters", "AcocuntId = " + AccountId);

            Character[] Chars = GetAccountChar(AccountId)._Chars;
            UInt16 Count = 0;

            // On Compte le nombre de personnages existant du joueur
            for (UInt16 c = 0; c < Chars.Length; ++c)
                if (Chars[c] != null) ++Count;

            PacketOut Out = new PacketOut(0);
            Out.Position = 0;

            Out.WriteByte(MAX_SLOT);
            Out.WriteUInt32(0xFF);
            Out.WriteByte(0x14);

            Character Char = null;
            for (int i = 0; i < MAX_SLOT; ++i)
            {
                Char = Chars[i];

                if (Char == null)
                    Out.Fill(0, 284); // 284
                else
                {
                    List<Character_item> Items = CharMgr.GetItemChar(Char.CharacterId);

                    Out.FillString(Char.Name, 48);
                    Out.WriteByte(Char.Value.Level);
                    Out.WriteByte(Char.Career);
                    Out.WriteByte(Char.Realm);
                    Out.WriteByte(Char.Sex);
                    Out.WriteByte(Char.ModelId);
                    Out.WriteUInt16(Char.Value.ZoneId);
                    Out.Fill(0, 5);

                    Character_item Item = null;
                    for (UInt16 SlotId = 14; SlotId < 30; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);
                        if (Item == null)
                            Out.WriteUInt32(0);
                        else
                            Out.WriteUInt32R(Item.ModelId);

                        Out.Fill(0, 4);
                    }

                    Out.Fill(0, 6);

                    for (int j = 0; j < 5; ++j)
                    {
                        Out.Fill(0, 6);
                        Out.WriteUInt16(0xFF00);
                    }

                    for (UInt16 SlotId = 10; SlotId < 13; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);
                        Out.WriteUInt16(0);
                        if (Item == null)
                            Out.WriteUInt16(0);
                        else
                            Out.WriteUInt16R((ushort)Item.ModelId);
                    }

                    Out.Fill(0, 10);
                    Out.WriteUInt16(0xFF00);
                    Out.WriteByte(0);
                    Out.WriteByte(Char.Race);
                    Out.WriteUInt16(0);
                    Out.Write(Char.bTraits, 0, Char.bTraits.Length);
                    Out.Fill(0, 14);// 272
                }
            }
            return Out.ToArray();
        }
Exemplo n.º 15
0
        public void SendTradeInfo(ItemsInterface DistInterface)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_TRADE_STATUS);
            Out.WriteByte(DistInterface.TradingAccepted);
            Out.WriteByte(0);
            Out.WriteUInt16(DistInterface != this ? DistInterface._Owner.Oid : (ushort)0);

            if (DistInterface.TradingAccepted == 2)
                Out.Fill(0, 24);
            else
            {
                Out.WriteUInt32(DistInterface.TradingMoney);
                Out.WriteByte(TradingUpdate);
                Out.Fill(0, 2 * MAX_TRADE_SLOT);
            }

            _Owner.GetPlayer().SendPacket(Out);
        }
Exemplo n.º 16
0
        public static void BuildItem(ref PacketOut Out,Item Itm,Item_Info Info,ushort SlotId,ushort Count)
        {
            SlotId = SlotId == 0 ? (Itm == null ? SlotId : Itm.SlotId ) : SlotId;
            Count = Count == 0 ? (Itm == null ? Count : Itm.Count) : Count;
            Info = Info == null ? (Itm == null ? null : Itm.Info) : Info;

            if(SlotId != 0)
                Out.WriteUInt16(SlotId);

            Out.WriteByte(0);
            Out.WriteUInt32((uint)(Info != null ? Info.Entry : 0));

            if (Info == null)
                return;

            Out.WriteUInt16((ushort)Info.ModelId);
            Out.Fill(0, 7);
            Out.WriteUInt16(Info.SlotId);
            Out.WriteByte(Info.Type);
            Out.WriteByte(Info.MinRank);

            Out.WriteByte((byte)(Info.MinRank + 1)); // 1.3.5
            Out.WriteByte(Info.MinRenown); // 1.3.5

            Out.WriteByte(Info.MinRenown);
            Out.WriteByte(Info.MinRenown);
            Out.WriteByte(Info.Rarity);
            Out.WriteByte(Info.Bind);
            Out.WriteByte(Info.Race);
            Out.WriteUInt32(Info.Career);

            Out.WriteUInt32(0);
            Out.WriteUInt32(Info.SellPrice);

            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));
            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));

            Out.WriteUInt32(0);

            Out.WriteUInt32(Info.Skills);
            Out.WriteUInt16(Info.Dps > 0 ? Info.Dps : Info.Armor);
            Out.WriteUInt16(Info.Speed);
            Out.WritePascalString(Info.Name);

            Out.WriteByte((byte)Info._Stats.Count);
            foreach (KeyValuePair<byte, UInt16> Key in Info._Stats)
            {
                Out.WriteByte(Key.Key);
                Out.WriteUInt16(Key.Value);
                Out.Fill(0, 5);
            }

            Out.WriteByte(0);
            Out.WriteByte(0); // SpellCounts
            // (uint32)Entry, uint16 X, uint16 Y

            Out.WriteByte(0); // Artisana Info , 3 bytes pour chaque artisana
            Out.WriteByte(0);

            Out.WriteByte(Info.TalismanSlots);
            for (int i = 0; i < Info.TalismanSlots; ++i)
                Out.WriteUInt32(0); // Entry;

            Out.WritePascalString(Info.Description);

            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);

            Out.WriteUInt16(0x0302);

            Out.Fill(0, 8);
            Out.WriteByte(0); // Type , Culture, etc etc
            Out.WriteByte(0); // Type, Recipian , Soil , etc etc
            Out.Fill(0, 11);
        }
Exemplo n.º 17
0
        public void SendStartCasting(ushort TargetOID)
        {
            PacketOut Out1 = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
            Out1.WriteUInt16(TargetOID);
            Out1.WriteByte(0x1A);
            Out1.Fill(0, 7);
            Caster.DispatchPacket(Out1, true);

            if (Info.CastTime == 0)
                return;

            PacketOut Out2 = new PacketOut((byte)Opcodes.F_USE_ABILITY);
            Out2.WriteUInt16(0);
            Out2.WriteUInt16(Info.Entry);
            Out2.WriteUInt16(Caster.Oid);
            Out2.WriteByte(0x06);
            Out2.WriteByte(0x10);
            Out2.WriteUInt16(0x2273);
            Out2.WriteUInt32(0x1010000);
            Out2.WriteUInt16((ushort)this.Info.CastTime);
            Out2.WriteByte(1);
            Out2.Fill(0, 3);
            Caster.GetPlayer().DispatchPacket(Out2, true);
        }
Exemplo n.º 18
0
        public void SendMailBox()
        {
            if (GetPlayer() == null)
                return;

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteUInt16(0);
                Out.WriteByte(1);
                GetPlayer().SendPacket(Out);
            }

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteUInt32(0x0E000000);
                Out.WriteUInt32(0x001E0AD7);
                Out.WriteUInt16(0xA33C);
                GetPlayer().SendPacket(Out);
            }

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteByte(0x0A);
                Out.WriteUInt16(0);
                Out.WriteByte((byte)_Mails.Count());
                foreach (Character_mail Mail in _Mails)
                    BuildPreMail(Out, Mail);
                Out.WriteUInt16((UInt16)_Mails.Count());

                GetPlayer().SendPacket(Out);
            }
        }
Exemplo n.º 19
0
        public override void SendMeTo(Player Plr)
        {
            List<byte> TmpState = new List<byte>();

            if (QtsInterface.CreatureHasStartQuest(Plr))
                TmpState.Add(5);
            else if (QtsInterface.CreatureHasQuestToComplete(Plr))
                TmpState.Add(7);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Heading);
            Out.WriteUInt16((UInt16)WorldPosition.Z);
            Out.WriteUInt32((UInt32)WorldPosition.X);
            Out.WriteUInt32((UInt32)WorldPosition.Y);
            Out.WriteUInt16(0); // Speed Z
            // 18
            Out.WriteUInt16(Spawn.Proto.Model1);
            Out.WriteByte((byte)Spawn.Proto.MinScale);
            Out.WriteByte(Spawn.Proto.MinLevel);
            Out.WriteByte(Faction);

            Out.Fill(0, 4);
            Out.WriteByte(Spawn.Emote);
            Out.WriteByte(0); // ?
            Out.WriteUInt16(Spawn.Proto._Unks[1]);
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto._Unks[2]);
            Out.WriteUInt16(Spawn.Proto._Unks[3]);
            Out.WriteUInt16(Spawn.Proto._Unks[4]);
            Out.WriteUInt16(Spawn.Proto._Unks[5]);
            Out.WriteUInt16(Spawn.Proto._Unks[6]);
            Out.WriteUInt16(Spawn.Title);

            Out.WriteByte((byte)(Spawn.bBytes.Length + States.Count + TmpState.Count));
            Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
            Out.Write(States.ToArray(), 0, States.Count);
            Out.Write(TmpState.ToArray(), 0, TmpState.Count);

            Out.WriteByte(0);

            Out.WriteStringBytes(Name);

            Out.WriteByte(0); // ?
            Out.WriteByte(1); // ?
            Out.WriteByte(10); // ?

            Out.WriteByte(0); // ?

            Out.WriteUInt16(0); // ?
            Out.WriteByte(Spawn.Icone);
            Out.WriteByte((byte)Spawn.Proto._Unks[0]);

            Out.WriteByte(0);

            Out.Fill(0, 8); // Flags;

            Out.WriteByte(100); // Health %

            Out.WriteUInt16(Zone.ZoneId);

            Out.Fill(0, 48);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
Exemplo n.º 20
0
        public override void SendMeTo(Player Plr)
        {
            //Log.Success("Creature", "SendMe " + Name);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Heading);
            Out.WriteUInt16((UInt16)WorldPosition.Z);
            Out.WriteUInt32((UInt32)WorldPosition.X);
            Out.WriteUInt32((UInt32)WorldPosition.Y);
            Out.WriteUInt16(0); // Speed Z
            // 18
            Out.WriteUInt16(Spawn.Proto.Model1);
            Out.WriteByte((byte)Spawn.Proto.MinScale);
            Out.WriteByte(Level);
            Out.WriteByte(Faction);

            Out.Fill(0, 4);
            Out.WriteByte(Spawn.Emote);
            Out.WriteByte(0); // ?
            Out.WriteUInt16(Spawn.Proto._Unks[1]);
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto._Unks[2]);
            Out.WriteUInt16(Spawn.Proto._Unks[3]);
            Out.WriteUInt16(Spawn.Proto._Unks[4]);
            Out.WriteUInt16(Spawn.Proto._Unks[5]);
            Out.WriteUInt16(Spawn.Proto._Unks[6]);
            Out.WriteUInt16(Spawn.Title);

            long TempPos = Out.Position;
            byte TempLen = (byte)(Spawn.bBytes.Length + States.Count);
            Out.WriteByte(TempLen);
            Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
            Out.Write(States.ToArray(), 0, States.Count);
            if (QtsInterface.CreatureHasStartQuest(Plr))
            {
                Out.WriteByte(5);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }
            else if (QtsInterface.CreatureHasQuestToAchieve(Plr))
            {
                Out.WriteByte(4);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }
            else if (QtsInterface.CreatureHasQuestToComplete(Plr))
            {
                Out.WriteByte(7);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }

            Out.Position = Out.Length;

            Out.WriteByte(0);

            Out.WriteStringBytes(Name);

            Out.Fill(0, 48);
            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
Exemplo n.º 21
0
 public void SendMoney()
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_WEALTH);
     Out.WriteUInt32(0);
     Out.WriteUInt32(_Value.Money);
     SendPacket(Out);
 }
Exemplo n.º 22
0
        public void SendInited()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.S_PLAYER_INITTED);
            Out.WriteUInt16(_ObjectId);
            Out.WriteUInt16(0);
            Out.WriteUInt32((uint)_Info.CharacterId);
            Out.WriteUInt16((ushort)_Value.WorldZ);
            Out.WriteUInt16(0);
            Out.WriteUInt32((uint)_Value.WorldX);
            Out.WriteUInt32((uint)_Value.WorldY);
            Out.WriteUInt16((ushort)_Value.WorldO);
            Out.WriteByte(0);
            Out.WriteByte((byte)Realm);
            Out.Fill(0, 5); // ??
            Out.WriteByte((byte)Zone.Info.Region);
            Out.WriteUInt16(1);
            Out.WriteByte(0);
            Out.WriteByte(_Info.Career);
            Out.Fill(0, 6);
            Out.WritePascalString(Program.Rm.Name);
            Out.Fill(0, 3);
            SendPacket(Out);

              /*  PacketOut Out = new PacketOut((byte)Opcodes.S_PLAYER_INITTED);
            Out.WriteHexStringBytes("00CA00000028D5BF1D7F0000000CF824000CAFC7051700020000000000080001001A000000000000084261646C616E6473000000");
            SendPacket(Out);
            */
        }
Exemplo n.º 23
0
 public void SendRenown()
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_RENOWN);
     Out.WriteUInt32(_Value.Renown);
     Out.WriteUInt32(CurrentRenown.Renown);
     Out.WriteByte(_Value.RenownRank);
     Out.Fill(0, 3);
     SendPacket(Out);
 }
Exemplo n.º 24
0
        public void SendMailBox()
        {
            if (GetPlayer() == null)
                return;

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteUInt16(0);
                Out.WriteByte(1);
                GetPlayer().SendPacket(Out);
            }

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteUInt32(0x0E000000);
                Out.WriteUInt32(0x001E0AD7);
                Out.WriteUInt16(0xA33C);
                GetPlayer().SendPacket(Out);
            }

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
                Out.WriteByte(0x0A);
                Out.WriteByte((byte)GameData.MailboxType.MAILBOXTYPE_PLAYER);
                Out.WriteByte(0);
                Out.WriteByte((byte)_Mails.Where(info => info.AuctionType == 0).Count());
                foreach (Character_mail Mail in _Mails)
                    if (Mail.AuctionType == 0)
                        BuildPreMail(Out, Mail);
                Out.WriteUInt16((UInt16)_Mails.Count());

                GetPlayer().SendPacket(Out);
            }
        }
Exemplo n.º 25
0
        public void BuildPreMail(PacketOut Out, Character_mail Mail)
        {
            if (Mail == null)
                return;

            Out.WriteUInt32(0);
            Out.WriteUInt32((UInt32)Mail.Guid);
            Out.WriteUInt16((UInt16)(Mail.Opened ? 1 : 0));
            Out.WriteByte((byte)(Mail.AuctionType == 0 ? 100 : 0)); // Icon ID

            Out.WriteUInt32(Mail.SendDate); // Time
            Out.WriteUInt32(Mail.SendDate); // Sent time

            Out.WriteUInt32((UInt32)Mail.CharacterIdSender); // Sender ID

            Out.WriteByte(0); // 1 = localized name

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.SenderName);

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.ReceiverName);

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.Title);
            Out.WriteUInt32(0);

            Out.WriteUInt32(Mail.Money);
            Out.WriteUInt16((ushort)Mail.Items.Count);
            if (Mail.Items.Count > 0)
                Out.WriteByte(0);
            if (Mail.Items.Count > 8)
                Out.WriteByte(0);

            foreach (KeyValuePair<uint, ushort> item in Mail.Items)
            {
                Out.WriteUInt32(WorldMgr.GetItem_Info(item.Key).ModelId);
            }
        }
Exemplo n.º 26
0
 public void SendXp()
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_EXPERIENCE);
     Out.WriteUInt32(_Value.Xp);
     Out.WriteUInt32(CurrentXp != null ? CurrentXp.Xp : 0);
     Out.WriteUInt32(0);
     Out.WriteByte(_Value.Level);
     Out.Fill(0, 3);
     SendPacket(Out);
 }
Exemplo n.º 27
0
 public void SendStageInfo(Player Plr)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE);
     Out.WriteUInt32(Info.Entry);
     Out.WriteByte(0);
     Out.Fill(0, 3);
     Plr.SendPacket(Out);
 }
Exemplo n.º 28
0
        public void BuildPreMail(PacketOut Out, Character_mail Mail)
        {
            if (Mail == null)
                return;

            Out.WriteUInt32(0);
            Out.WriteUInt32((UInt32)Mail.Guid);
            Out.WriteUInt16((UInt16)(Mail.Opened ? 1 : 0));
            Out.WriteByte(0x64); // Icon ID

            Out.WriteUInt32(0xFFE4D486); // Time
            Out.WriteUInt32(0xFFE4D486); // Sent time

            Out.WriteUInt32((UInt32)Mail.CharacterIdSender); // Sender ID
            Out.WriteByte(0); // 1 = localized name

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.SenderName);

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.ReceiverName);

            Out.WriteByte(0);
            Out.WriteStringToZero(Mail.Title);

            Out.WriteUInt32(0);

            Out.WriteUInt32(Mail.Money);
            Out.WriteUInt16((ushort)Mail.ItemsReqInfo.Count);
            if(Mail.ItemsReqInfo.Count > 0)
                Out.WriteByte(0);
            if(Mail.ItemsReqInfo.Count > 8)
                Out.WriteByte(0);

            foreach(Character_items item in Mail.ItemsReqInfo)
            {
                Out.WriteUInt32(item.ModelId);
            }
        }
Exemplo n.º 29
0
        public static void SendVendorPage(Player Plr, ref List<Creature_vendor> Vendors, byte Count,byte Page)
        {
            Count = (byte)Math.Min(Count, Vendors.Count);

            Log.Success("SendVendorPage", "Count=" + Count + ",Page=" + Page + ",ItmC=" + Vendors.Count);

            PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_STORE);
            Out.WriteByte(3);
            Out.WriteByte(0);
            Out.WriteByte(Page);
            Out.WriteByte(Count);
            Out.WriteByte((byte)(Page > 0 ? 0 : 1));
            Out.WriteByte(1);
            Out.WriteUInt16(0);

            for (byte i = 0; i < Count; ++i)
            {
                Out.WriteByte(i);
                Out.WriteByte(3); // sometimes 1
                Out.WriteUInt32(Vendors[i].Price);
                Item.BuildItem(ref Out, null, Vendors[i].Info, 0, 1);

                Out.WriteByte((byte)Vendors[i].ItemsReqInfo.Count); // ReqItemSize
                foreach (KeyValuePair<UInt16, Item_Info> Kp in Vendors[i].ItemsReqInfo)
                {
                    Out.WriteUInt32(Kp.Value.Entry);
                    Out.WriteUInt16((UInt16)Kp.Value.ModelId);
                    Out.WritePascalString(Kp.Value.Name);
                    Out.WriteUInt16(Kp.Key);
                    Out.Fill(0, 18);
                }
            }

            Out.WriteByte(0);
            Plr.SendPacket(Out);

            Vendors.RemoveRange(0, Count);
        }
Exemplo n.º 30
0
 public void SendCurrentStage(Player Plr)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
     Out.WriteUInt32(Info.Entry);
     Out.WriteByte(0); // Type
     Out.WriteByte(Info.Type);
     Out.WriteByte(Info.Type); // Forteresse, rien du tout ,etc
     Out.WriteUInt16(0);
     Out.WritePascalString(Info.Name);
     Out.WriteByte(1);
     Out.WriteUInt16(0); // Time in second
     Out.WriteUInt32(0x034B0201);
     Out.WriteByte(1);
     Out.WriteByte(0);
     Out.WriteByte(1);
     Out.WriteUInt16(0);
     Out.WriteByte(0);
     Out.WritePascalString("Un Nom");
     Out.WriteByte(0);
     Out.WriteByte(0);
     Out.WriteStringToZero("Stage III");
     Out.WritePascalString("Test d'un message quelque soit");
     Out.WriteUInt16(0);
     Out.WriteUInt16(0x012C);
     Out.WriteUInt32(0x9E);
     Out.WriteUInt32(0);
     Out.WriteByte(0x48);
     Out.WriteUInt32(0);
     //Out.WriteHexStringBytes(Str.Replace(" ", string.Empty));
     Plr.SendPacket(Out);
 }