コード例 #1
0
ファイル: QuestsInterface.cs プロジェクト: Necrosummon/WarEmu
 public static void BuildQuestComplete(PacketOut Out, Quest Q, bool Particular)
 {
     Out.WritePascalString(Q.Name);
     Out.WriteUInt16((UInt16)Q.OnCompletionQuest.Length);
     Out.WriteStringBytes(Q.OnCompletionQuest);
     if (Particular)
     {
         Out.WriteUInt16((UInt16)Q.Particular.Length);
         Out.WriteStringBytes(Q.Particular);
     }
     Out.WriteByte(1);
     Out.WriteUInt32(Q.Gold);
     Out.WriteUInt32(Q.Xp);
 }
コード例 #2
0
        public static void Send(LobbyClient client)
        {
            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS);
            Out.WriteUnicodeString(client.Account.RealTag,48);

            Out.WriteUInt32R(21); // Account Type

            Out.WriteInt64R(TCPManager.GetTimeStamp());

            // Temps avant expiration du compte
            Out.WriteByte(0x13); // ms
            Out.WriteByte(0x29); // sec
            Out.WriteUInt16R(0x12); // Hour

            // Date de création
            Out.WriteByte(0x0E); // day
            Out.WriteByte(0x07); // month
            Out.WriteUInt16R(2010); // Year

            Out.WriteInt32R(1450); // Temps de jeu (secondes)
            Out.WriteInt32R(client.Account.Points); // Points APB

            for(int i=1;i<6;++i)
                Out.WriteInt32R(
                    Program.FileMgr.GetFileVersion(client.Account.Id, i, true, "", "")); // Config file, Server Version

            Out.WriteInt32R(0);

            Out.WriteUInt16(0x957D);
            Out.WriteUInt16(0x0400);

            Out.WriteUInt16(0x5052);
            Out.WriteUInt16(0x4F45);
            Out.WriteUInt16(0x552E);
            Out.WriteUInt16(0x3232);
            Out.WriteUInt16(0x3738);
            Out.WriteUInt16(0x3031);
            Out.WriteUInt16(0);

            Out.WriteUInt16(0x0067);

            Out.WriteUInt64(0x526C624331313256);
            Out.WriteUInt64(0x486E314100000000);
            Out.WriteUInt16(0);
            Out.WriteStringBytes("");
            Out.WriteByte(0);

            client.SendTCP(Out);

            ANS_CHARACTER_INFO.Send(client);
        }
コード例 #3
0
ファイル: Creature.cs プロジェクト: dzikun/WarEmu
        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);
        }
コード例 #4
0
ファイル: Creature.cs プロジェクト: JeFawk/WarEmu
        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);
        }
コード例 #5
0
ファイル: MailInterface.cs プロジェクト: JeFawk/WarEmu
        public void SendMail(Character_mail Mail)
        {
            if (Mail == null)
                return;

            PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);
            Out.WriteByte(0x0D);
            Out.WriteByte(0);
            BuildPreMail(Out, Mail);
            Out.WriteUInt16((ushort)(Mail.Content.Length + 1));
            Out.WriteStringBytes(Mail.Content);
            Out.WriteByte(0);
            Out.WriteByte((byte)Mail.ItemsReqInfo.Count);
            foreach (Character_items item in Mail.ItemsReqInfo)
            {
                Item_Info Req = WorldMgr.GetItem_Info(item.Entry);
                Item.BuildItem(ref Out, null, Req, 0, item.Counts);
            }
            GetPlayer().SendPacket(Out);
        }
コード例 #6
0
ファイル: Group.cs プロジェクト: dzikun/WarEmu
        public void Update()
        {
            Log.Debug("Group", "Updating Group");

            if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First()))
            {
                Delete();
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteUInt16(0x0602); // Group info
            Out.WriteUInt16(0xB536); // Group id
            Out.WriteByte((byte)Members.Count);
            foreach (Player Plr in Members)
            {
                Out.WriteUInt32(0xA8BF3B0C);
                Out.WriteByte((byte)Plr._Info.ModelId);
                Out.WriteByte((byte)Plr._Info.Race);
                Out.WriteByte((byte)Plr.Level);
                Out.WriteUInt16((ushort)Plr._Info.CareerLine);
                Out.WriteByte(1);
                Out.WriteByte(0); // Will be 1 for at least one member. Perhaps Leader?
                Out.WriteByte(0);
                Out.WriteByte(1); // Online = 1, Offline = 0
                Out.WriteByte((byte)Plr.Name.Length);
                Out.Fill(0, 3);
                Out.WriteStringBytes(Plr.Name);
                Out.WriteByte(0); // Name length. Pet? Target?
                Out.Fill(0, 3);
                //Out.WriteStringBytes(Pet name? Target?);

                Out.WriteByte(0x8B);
                Out.WriteUInt16R((ushort)650); // X ?
                Out.WriteByte(0xD3);
                Out.WriteUInt16R((ushort)650); // y ?
                byte[] data = { 0xC8, 0x50, 0x27, 0x25, 0x05, 0x40, 0x01, 0x02 };
                Out.Write(data);
                
                Out.WriteByte((byte)(Plr._Value.ZoneId*2));
                Out.WriteByte(1);
                Out.WriteByte(1);
 
                Out.WriteByte((byte)Plr.PctHealth);
                Out.WriteByte((byte)Plr.PctAp); // action points
                Out.WriteByte(0);
            }

            SendToGroup(Out);
        }
コード例 #7
0
ファイル: QuestsInterface.cs プロジェクト: dzikun/WarEmu
        static public void BuildQuestInProgress(PacketOut Out, Quest Q, bool Particular)
        {
            Out.WritePascalString(Q.Name);

            if (Q.ProgressText.Length > 0)
            {
                Out.WriteUInt16((UInt16)Q.ProgressText.Length);
                Out.WriteStringBytes(Q.ProgressText);
            }
            else
            {
                Out.WriteUInt16((UInt16)Q.Particular.Length);
                Out.WriteStringBytes(Q.Particular);
            }

            Out.WriteByte(1);
        }
コード例 #8
0
ファイル: QuestsInterface.cs プロジェクト: dzikun/WarEmu
        static public void BuildQuestHeader(PacketOut Out, Quest Q, bool Particular)
        {
            Out.WritePascalString(Q.Name);
            Out.WriteUInt16((UInt16)Q.Description.Length);
            Out.WriteStringBytes(Q.Description);
            if (Particular)
            {
                Out.WriteUInt16((UInt16)Q.Particular.Length);
                Out.WriteStringBytes(Q.Particular);
            }
            Out.WriteByte(1);
            Out.WriteUInt32(Q.Gold);
            Out.WriteUInt32(Q.Xp);

        }
コード例 #9
0
ファイル: QuestsInterface.cs プロジェクト: Necrosummon/WarEmu
        public void HandleInteract(Player Plr, InteractMenu Menu)
        {
            if(Entry == 0)
                return;

            List<Quest> Starter = WorldMgr.GetStartQuests(Entry);
            List<Quest> Finisher = WorldMgr.GetFinishersQuests(Entry);
            List<Quest> InProgress = Starter != null ? Starter.FindAll(info => Plr.QtsInterface.HasQuest(info.Entry) && !Plr.QtsInterface.HasDoneQuest(info.Entry)) : null;

            string Text = WorldMgr.GetCreatureText(Entry);

            if (Starter == null && Finisher == null && Text.Length <= 0 && InProgress == null)
                return;

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            Out.WriteByte(0);
            Out.WriteUInt16(Obj.Oid);
            Out.Fill(0, 3);
            Out.WriteByte(0x60);
            Out.WriteUInt32(0);
            Out.WriteUInt16(Plr.Oid);

            if (Starter != null)
            {
                List<Quest> Starts = Starter.FindAll(q => Plr.QtsInterface.CanStartQuest(q) );

                Log.Success("QuestInterface", "Handle Interact : Starts=" + Starts.Count);

                Out.WriteByte((byte)Starts.Count);
                foreach (Quest Q in Starts)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WriteUInt16(0);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
                Out.WriteByte(0);

            if (Finisher != null)
            {
                List<Quest> Finishs = Finisher.FindAll(q => Plr.QtsInterface.CanEndQuest(q));

                Log.Success("QuestInterface", "Handle Interact : Finishs=" + Finishs.Count);

                Out.WriteByte((byte)Finishs.Count);
                foreach (Quest Q in Finishs)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else if (InProgress != null)
            {
                Log.Success("QuestInterface", "Handle Interact : InProgress=" + InProgress.Count);

                Out.WriteByte((byte)InProgress.Count);
                foreach (Quest Q in InProgress)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
                Out.WriteByte(0);

            Log.Info("QTS", "Text=" + Text);
            Out.WriteUInt16((ushort)Text.Length);
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }
コード例 #10
0
ファイル: Group.cs プロジェクト: javierz/WarEmu
        public void Update()
        {
            Log.Debug("Group", "Updating Group");

            if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First()))
            {
                Delete();
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteUInt16(0x0602); // Group info
            Out.WriteUInt16(0xB536); // Group id
            Out.WriteByte((byte)Members.Count);
            foreach (Player Plr in Members)
            {
                Out.WriteUInt32(0xA8BF3B0C);
                Out.WriteByte((byte)Plr._Info.ModelId);
                Out.WriteByte((byte)Plr._Info.Race);
                Out.WriteByte((byte)Plr.Level);
                Out.WriteUInt16((ushort)Plr._Info.CareerLine);
                Out.WriteByte(1);
                Out.WriteUInt16(0);
                Out.WriteByte(1); // Online = 1, Offline = 0
                Out.WriteByte((byte)Plr.Name.Length);
                Out.Fill(0, 3);
                Out.WriteStringBytes(Plr.Name);
                Out.Fill(0, 4);

                // X/Y ....
                byte[] data =
                {
                    0x84,0x7A,0x90,0x95,0x03,0xE2,0x36,0x50,0xE2,0x50,
                    0x40,0x01,0x02,0xD4,0x01,0x01,
                };

                Out.Write(data);
                Out.WriteByte((byte)Plr.PctHealth);
                Out.WriteByte(0x64); // action points
                Out.WriteByte(0);
            }

            SendToGroup(Out);
        }
コード例 #11
0
ファイル: Player.cs プロジェクト: dzikun/WarEmu
        public void SendMessage(UInt16 Oid, string NameSender, string Text, SystemData.ChatLogFilters Filter)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CHAT);
            Out.WriteUInt16(Oid);
            Out.WriteByte((byte)Filter);
            Out.Fill(0, 4);
            Out.WritePascalString(NameSender);
            Out.WriteUInt16((ushort)(Text.Length + 1));
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);

            int a = Text.IndexOf("<LINK");
            int b = Text.IndexOf("ITEM:");
            if (a >= 0 && b > 0)
            {
                Out.WriteByte(1);
                long p = Out.Position;
                Out.WriteByte(0);

                int Count = 0;
                while (a >= 0 && b >= 0)
                {
                    int Pos = b + 5;
                    int LastPos = Text.IndexOf(" ", Pos) - 1;
                    string Value = Text.Substring(Pos, LastPos - Pos);
                    uint ItemId = uint.Parse(Value);
                    Item_Info Info = WorldMgr.GetItem_Info(ItemId);
                    if (Info != null)
                    {
                        ++Count;
                        Out.WriteByte(3);
                        Item.BuildItem(ref Out, null, Info, 0, 1);
                    }

                    a = Text.IndexOf("<LINK", Pos);
                    b = Text.IndexOf("ITEM:", Pos);
                }

                Out.Position = p;
                Out.WriteByte((byte)Count);
                Out.Position = Out.Length;
            }

            SendPacket(Out);
        }
コード例 #12
0
ファイル: Player.cs プロジェクト: dzikun/WarEmu
        public void SendHelpMessage(Player Plr, string Text)
        {
            /*|00 3D 06 00 00 23 00 00 00 00 0D 57 68 69 69 74 |.=...#.....Whiit|
|65 63 68 65 72 72 79 00 00 25 4C 46 20 74 61 6E |echerry..%LF tan|
|6B 20 61 6E 64 20 68 65 61 6C 65 72 20 66 6F 72 |k and healer for|
|20 73 63 2F 6F 72 76 72 20 67 72 6F 75 70 00 00 | sc/orvr group..|      */

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHAT);
            Out.WriteUInt16(Plr.Oid);
            Out.WriteByte(0x23);
            Out.WriteUInt32(0);
            Out.WriteStringToZero(Plr.Name);
            Out.WriteUInt16((ushort)(Text.Length + 1));
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);
            Out.WriteByte(0);
            SendPacket(Out);
        }
コード例 #13
0
ファイル: MailInterface.cs プロジェクト: javierz/WarEmu
        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.WriteByte((byte)(Mail.SenderName.Length + 1));
            Out.WriteStringBytes(Mail.SenderName);
            Out.WriteByte(0);

            Out.WriteByte(0);

            Out.WriteByte((byte)(Mail.ReceiverName.Length + 1));
            Out.WriteStringBytes(Mail.ReceiverName);
            Out.WriteByte(0);

            Out.WriteByte(0);
            Out.WriteByte((byte)(Mail.Title.Length + 1));
            Out.WriteStringBytes(Mail.Title);
            Out.WriteByte(0);

            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);
            }
        }