public static void BuildPlayerInfo(ref PacketOut Out, uint CharId, string Name, bool Online, bool Anonymous, byte Level, ushort Career, ushort Zone, string GuildName, bool noHide = false)
        {
            Out.WriteUInt32(CharId);

            Out.WriteUInt16((ushort)(Name.Length + 1));
            Out.WriteStringBytes(Name);
            Out.WriteByte(0);

            Out.WriteByte(0);

            if (!Online || Anonymous && !noHide)
            {
                Out.WriteByte(0);
            }
            else
            {
                Out.WriteByte(1);
                Out.WriteByte(1);

                Out.WriteByte(Level);
                Out.WriteUInt16(0);
                Out.WriteUInt16(Career);
                Out.WriteUInt16(Zone);

                Out.WriteUInt16((ushort)(GuildName.Length));
                Out.WriteStringBytes(GuildName);
            }
        }
Beispiel #2
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.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);
            }
        }
Beispiel #3
0
 static public 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);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
        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.Items.Count);
            foreach (KeyValuePair <uint, ushort> item in Mail.Items)
            {
                Item_Info Req = WorldMgr.GetItem_Info(item.Key);
                Item.BuildItem(ref Out, null, Req, 0, item.Value);
            }
            GetPlayer().SendPacket(Out);
        }
Beispiel #6
0
 static public void BuildQuestInProgress(PacketOut Out, Quest Q, bool Particular)
 {
     Out.WritePascalString(Q.Name);
     Out.WriteUInt16((UInt16)Q.ProgressText.Length);
     Out.WriteStringBytes(Q.ProgressText);
     Out.WriteByte(1);
 }
Beispiel #7
0
        private void WritePostRolls(PacketOut Out)
        {
            int maxCount = Math.Min(24, _postRoll.Count);

            for (int i = 0; i < maxCount; i++)
            {
                ContributionInfo curRoll = _postRoll[i].Value;

                Out.WriteStringBytes(curRoll.PlayerName);
                Out.Fill(0, 24 - curRoll.PlayerName.Length);
                Out.Fill(0, 2);
                Out.WriteUInt16R((ushort)curRoll.RandomBonus);
                Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
                Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
                Out.WriteByte(1);              // ???
                Out.WriteByte(curRoll.BagWon); // bag won
            }

            if (maxCount < 24)
            {
                for (int i = maxCount; i < 24; i++)
                {
                    Out.Fill(0, 34);  // i just send empty once here
                }
            }
        }
        public static void BuildQuestHeader(PacketOut Out, Player plr, Quest q, bool particular)
        {
            Out.WritePascalString(q.Name);

            Out.WriteUInt16((ushort)q.Description.Length);
            Out.WriteStringBytes(q.Description);

            if (particular)
            {
                Out.WriteUInt16((ushort)q.Particular.Length);
                Out.WriteStringBytes(q.Particular);
            }
            Out.WriteByte(1);
            Out.WriteUInt32(q.Gold);
            Out.WriteUInt32(q.Xp);
        }
Beispiel #9
0
 public static void Send(LobbyClient client)
 {
     PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS);
     Out.WriteParsedString("Welcome to rebornAPB", 48);
     Out.WriteUInt32Reverse(client.Account.IsAdmin);
     Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
     Out.WriteByte(0x13);
     Out.WriteByte(0x29);
     Out.WriteUInt16Reverse(0x12);
     Out.WriteByte(0x0E);
     Out.WriteByte(0x07);
     Out.WriteUInt16Reverse(9999);
     Out.WriteInt32Reverse(1450);
     Out.WriteUInt32Reverse((uint)client.Account.RTW_Points);
     for (int i = 1; i < 6; ++i) Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)client.Account.Index, i, true, "", ""));
     Out.WriteInt32Reverse(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.Send(Out);
 }
        public static void BuildQuestInProgress(PacketOut Out, Quest q, bool particular)
        {
            Out.WritePascalString(q.Name);

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

            Out.WriteByte(1);
        }
        static public 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);
        }
Beispiel #12
0
        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);
        }
        /// <summary>
        /// Writes 13 + quest name length + description length + particular length.
        /// </summary>
        public static void BuildQuestComplete(PacketOut Out, Quest q, bool particular)
        {
            Out.WritePascalString(q.Name);

            if (q.OnCompletionQuest.Length > 0)
            {
                Out.WriteUInt16((ushort)q.OnCompletionQuest.Length);
                Out.WriteStringBytes(q.OnCompletionQuest);
            }
            else
            {
                Out.WriteUInt16((ushort)q.Description.Length);
                Out.WriteStringBytes(q.Description);
            }

            if (particular)
            {
                Out.WriteUInt16((ushort)q.Particular.Length);
                Out.WriteStringBytes(q.Particular);
            }
            Out.WriteByte(1);
            Out.WriteUInt32(q.Gold);
            Out.WriteUInt32(q.Xp);
        }
Beispiel #14
0
        protected override void SendCreateMonster(Player plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);

            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16(Heading);
            Out.WriteUInt16((ushort)WorldPosition.Z);
            Out.WriteUInt32((uint)WorldPosition.X);
            Out.WriteUInt32((uint)WorldPosition.Y);
            Out.WriteUInt16(0);    // Speed Z
            // 18
            Out.WriteUInt16(1578); //1578    1583???

            Out.WriteByte(50);
            Out.WriteByte(Owner.GldInterface.Guild.Info.Level);
            if (RealmStandard == Realms.REALMS_REALM_DESTRUCTION)
            {
                Out.WriteByte(128);
            }
            else
            {
                Out.WriteByte(64);
            }
            Out.Fill(0, 6);
            Out.WriteUInt16(9);
            Out.Fill(0, 13);

            Out.WriteByte(0x02);
            Out.WriteByte(0x17);
            Out.WriteByte(0x19);
            Out.WriteByte(0x01);

            Owner.GldInterface.Guild.BuildHeraldry(Out);
            Log.Info("", "" + Owner.GldInterface.Guild.GetBannerPost(Bannertyp));
            Out.WriteByte(Owner.GldInterface.Guild.GetBannerPost(Bannertyp));
            //Out.WriteByte(0x01);
            Out.WriteByte(0x02);


            Out.WriteStringBytes(Name);

            Out.WriteHexStringBytes("000000100303010A0000001205002905CAA286BB2910640005040000100343002905000000");


            plr.SendPacket(Out);
        }
Beispiel #15
0
        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);
        }
Beispiel #16
0
        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);
        }
Beispiel #17
0
        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);
        }
Beispiel #18
0
        static public void Send(LobbyClient client)
        {
            PacketOut Out = new PacketOut((uint)Opcodes.ANS_LOGIN_SUCCESS);

            Out.WriteParsedString("Welcome to rebornAPB", 48);
            Out.WriteUInt32Reverse(client.Account.IsAdmin);
            Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
            Out.WriteByte(0x13);
            Out.WriteByte(0x29);
            Out.WriteUInt16Reverse(0x12);
            Out.WriteByte(0x0E);
            Out.WriteByte(0x07);
            Out.WriteUInt16Reverse(9999);
            Out.WriteInt32Reverse(1450);
            Out.WriteUInt32Reverse((uint)client.Account.RTW_Points);
            for (int i = 1; i < 6; ++i)
            {
                Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion(client.Account.Index, i, true, "", ""));
            }
            Out.WriteInt32Reverse(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.Send(Out);
        }
Beispiel #19
0
        private void WritePersonalPreRolls(PacketOut Out)
        {
            int maxCount = Math.Min(24, 1);

            for (int i = 0; i < maxCount; i++)
            {
                ContributionInfo curRoll = _preRoll[i].Value;

                Out.WriteStringBytes(curRoll.PlayerName);
                Out.Fill(0, 24 - curRoll.PlayerName.Length);
                Out.Fill(0, 2);
                Out.WriteUInt16R((ushort)curRoll.RandomBonus);
                Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
                Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
            }

            if (maxCount < 24)
            {
                for (int i = maxCount; i < 24; i++)
                {
                    Out.Fill(0, 32);
                }
            }
        }
Beispiel #20
0
        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);
        }
Beispiel #21
0
        public void BuildInteract(Player Plr, Creature Crea, PacketOut Out)
        {
            List <Quest> Starter    = Crea.Spawn.Proto.StartingQuests;
            List <Quest> Finisher   = Crea.Spawn.Proto.FinishingQuests;
            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)//added
            //return;// added
            ////////////////////////////////////////////////////////////////////////////////////////////////

            // was disabled ???
            //PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            //Out.WriteByte(0);
            //Out.WriteUInt16(Obj.Oid);
            //Out.WriteUInt16(_Owner.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);
        }
Beispiel #22
0
        public void Scoreboard(ContributionInfo playerRoll, int preIndex, int postIndex)
        {
            Player targPlayer = Player.GetPlayer(playerRoll.PlayerCharId);

            if (targPlayer == null)
            {
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_PQLOOT_TRIGGER, 1723);

            Out.WriteStringBytes(_publicQuestInfo.Name);
            Out.Fill(0, 24 - _publicQuestInfo.Name.Length);
            Out.WriteByte(_bags[gold]);  // gold
            Out.WriteByte(_bags[purple]);
            Out.WriteByte(_bags[blue]);
            Out.WriteByte(_bags[green]);
            Out.WriteByte(_bags[white]); // white
            Out.Fill(0, 3);

            WritePreRolls(Out);

            Out.WriteStringBytes(playerRoll.PlayerName);
            Out.Fill(0, 24 - playerRoll.PlayerName.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
            Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
            Out.WriteUInt16((ushort)(preIndex + 1)); // place

            WritePostRolls(Out);

            Out.WriteUInt16((ushort)(postIndex + 1)); // place
            Out.WriteStringBytes(playerRoll.PlayerName);
            Out.Fill(0, 24 - playerRoll.PlayerName.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
            Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
            Out.WriteByte(1);                 // ???
            Out.WriteByte(playerRoll.BagWon); // bag won

            Out.Fill(0, 2);
            //Out.WriteUInt16(TIME_PQ_RESET);
            Out.WriteByte(0);
            Out.WriteByte(3);


            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(1);
            Out.Fill(0, 27);
            //
            // no clue yet seams to be if you didnt won anything you get that item


            /*
             * Out.WritePacketString(@"|d4 c0 01 |...d............|
             |57 61 72 20 43 72 65 73 74 00 00 00 00 00 00 00 |War Crest.......|
             |00 00 00 00 00 00 00 00 00 00 00                |...........     |
             * ");
             */

            targPlayer.SendPacket(Out);
            // Info.SendCurrentStage(plr);
        }  //  d4 c0 01
Beispiel #23
0
        public override void SendMeTo(Player Plr)
        {
            // Log.Success("Creature", "SendMe " + Name);


            //Log.Info("Creature", "npc = " + Name + "  Oid = " + Oid + "  X= " + Spawn.WorldX + "  Y= " + Spawn.WorldY + "  Z= " + Spawn.WorldZ);



            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


            if (Spawn.Proto.Model2 != 0)
            {
                if (RandomMgr.Next(0, 100) < 50)
                {
                    Out.WriteUInt16(Spawn.Proto.Model2);
                }
                else
                {
                    Out.WriteUInt16(Spawn.Proto.Model1);
                }
            }
            else
            {
                Out.WriteUInt16(Spawn.Proto.Model1);
            }

            Out.WriteByte((byte)RandomMgr.Next(Spawn.Proto.MinScale, Spawn.Proto.MaxScale));
            Out.WriteByte(Level);
            Out.WriteByte(Faction);

            Out.WriteByte(0);
            Out.WriteByte(Spawn.Val);
            Out.WriteUInt16(0);

            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.WriteByte(Spawn.D1);
            Out.WriteByte(Spawn.D2);

            Out.WriteUInt16(0); //00 00
            Out.WriteUInt16(0); // 00 00

            Out.WriteByte(Spawn.Unk1);

            Out.WriteByte(0);
            Out.WriteByte(48);
            Out.WriteByte(0x01);
            Out.WriteByte(0x0A);

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


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


            Out.WriteUInt16(Oid);
            Out.WriteUInt32((UInt32)Spawn.Flag);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);

            Out.WriteByte(100);

            Out.WriteUInt16(Spawn.ZoneId);

            Out.WriteUInt32(0);
            Out.WriteByte(Spawn.Head0);

            Out.WriteUInt16R((UInt16)Heading);


            Out.WriteUInt16(Oid);
            Out.WriteByte(0);
            Out.WriteByte(7);

            Plr.SendPacket(Out);



            Out = new PacketOut((byte)Opcodes.F_PLAY_SOUND);
            Out.WriteByte(0);
            Out.WriteUInt32((UInt32)Spawn.Sound1);
            Out.WriteUInt32((UInt32)Spawn.Flag);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt16(0);
            Plr.SendPacket(Out);


            Out = new PacketOut((byte)Opcodes.F_PLAY_SOUND);
            Out.WriteByte(0);
            Out.WriteUInt32((UInt32)Spawn.Sound2);
            Out.WriteUInt32((UInt32)Spawn.Flag);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt16(0);
            Plr.SendPacket(Out);



            base.SendMeTo(Plr);
        }
Beispiel #24
0
        }  //  d4 c0 01

        public void PersonalScoreboard(ContributionInfo playerRoll, byte bagWon)
        {
            Player targPlayer = Player.GetPlayer(playerRoll.PlayerCharId);

            if (targPlayer == null)
            {
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_PQLOOT_TRIGGER, 1723);

            Out.WriteStringBytes(_publicQuestInfo.Name);
            Out.Fill(0, 24 - _publicQuestInfo.Name.Length);
            Out.WriteByte(_bags[gold]);  // gold
            Out.WriteByte(_bags[purple]);
            Out.WriteByte(_bags[blue]);
            Out.WriteByte(_bags[green]);
            Out.WriteByte(_bags[white]); // white
            Out.Fill(0, 3);
            ContributionInfo curRoll = playerRoll;

            Out.WriteStringBytes(targPlayer.Name);
            Out.Fill(0, 24 - targPlayer.Name.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)curRoll.RandomBonus);
            Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
            for (int i = 1; i < 24; i++)
            {
                Out.Fill(0, 32);
            }

            Out.WriteStringBytes(targPlayer.Name);
            Out.Fill(0, 24 - targPlayer.Name.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
            Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
            Out.WriteUInt16(1); // place
            Out.WriteStringBytes(targPlayer.Name);
            Out.Fill(0, 24 - targPlayer.Name.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)curRoll.RandomBonus);
            Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
            Out.WriteByte(1);              // ???
            Out.WriteByte(curRoll.BagWon); // bag won
            for (int i = 1; i < 24; i++)
            {
                Out.Fill(0, 34); // i just send empty once here
            }
            Out.WriteUInt16(1);  // place
            Out.WriteStringBytes(targPlayer.Name);
            Out.Fill(0, 24 - targPlayer.Name.Length);
            Out.Fill(0, 2);
            Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
            Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
            Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
            Out.WriteByte(1);                 // ???
            Out.WriteByte(playerRoll.BagWon); // bag won

            Out.Fill(0, 2);
            //Out.WriteUInt16(TIME_PQ_RESET);
            Out.WriteByte(0);
            Out.WriteByte(3);


            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(1);
            Out.Fill(0, 27);
            //
            // no clue yet seams to be if you didnt won anything you get that item


            /*
             * Out.WritePacketString(@"|d4 c0 01 |...d............|
             |57 61 72 20 43 72 65 73 74 00 00 00 00 00 00 00 |War Crest.......|
             |00 00 00 00 00 00 00 00 00 00 00                |...........     |
             * ");
             */
            targPlayer.SendPacket(Out);
            // Info.SendCurrentStage(plr);
        }  //  d4 c0 01
Beispiel #25
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);
        }
Beispiel #26
0
        public void SendMail(Character_mail mail)
        {
            if (mail == null)
            {
                Log.Error("MailInterface", "Attempted to send NULL mail!");
                return;
            }


            if (mail.Content == null)
            {
                Log.Error("MailInterface", "Mail sent with NULL content!");
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_MAIL);

            Out.WriteByte(0x0D);

            if (mail.AuctionType == 0)
            {
                Out.WriteByte(0);
            }
            else
            {
                Out.WriteByte(1);
            }

            BuildPreMail(Out, mail);

            if (mail.AuctionType == 0)
            {
                Out.WriteUInt16((ushort)(mail.Content.Length + 1));
                Out.WriteStringBytes(mail.Content);
                Out.WriteByte(0);
            }
            else
            {
                ushort contentLocal = 0;
                if (mail.AuctionType == 1) // Refund (outbid)
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_REFUND_ITEM_X;
                }
                else if (mail.AuctionType == 2) // Complete
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_COMPLETE_ITEM_X;
                }
                else if (mail.AuctionType == 3) // Cancelled
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_CANCELLED;
                }
                else if (mail.AuctionType == 4) // Expired
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_EXPIRED;
                }
                else if (mail.AuctionType == 5) // Won
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_WON_ITEM_X;
                }
                else
                {
                    contentLocal = (ushort)Localized_text.TEXT_AUCTION_MAIL_BODY_OTHER;
                }

                Out.WriteUInt16(0);
                Out.WriteUInt16(contentLocal);
                Out.WriteUInt16(0);
                Out.WriteByte(0);

                if (mail.Content.Length == 0)
                {
                    Out.WriteByte(0);
                }
                else
                {
                    Out.WriteByte(1);
                    Out.WriteByte(1);

                    Out.WriteByte(0);
                    Out.WritePascalString(mail.Content);
                }
            }

            Out.WriteByte((byte)mail.Items.Count);
            foreach (MailItem item in mail.Items)
            {
                Item.BuildItem(ref Out, null, null, item, 0, item.count);
            }
            GetPlayer().SendPacket(Out);
        }
Beispiel #27
0
        public static void F_CREATE_CHARACTER(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;
            CreateInfo Info;

            Info.slot     = packet.GetUint8();
            Info.race     = packet.GetUint8();
            Info.career   = packet.GetUint8();
            Info.sex      = packet.GetUint8();
            Info.model    = packet.GetUint8();
            Info.NameSize = packet.GetUint16();
            packet.Skip(2);

            byte[] traits = new byte[8];
            packet.Read(traits, 0, traits.Length);
            packet.Skip(7);

            string name = packet.GetString(Info.NameSize);

            ushort duplicate = 0;

            for (int i = 0; i < name.Length; i++)
            {
                if (i != 0)
                {
                    if (name[i] == name[i - 1])
                    {
                        duplicate++;
                    }
                    else
                    {
                        duplicate = 0;
                    }

                    if (duplicate > 3)
                    {
                        break;
                    }
                }
            }

            if (name.Length > 2 && !CharMgr.NameIsUsed(name) && CharMgr.AllowName(name) && !CharMgr.NameIsDeleted(name) && duplicate < 3)
            {
                CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career);
                if (CharInfo == null)
                {
                    Log.Error("ON_CREATE", "Can not find career :" + Info.career);
                }
                else
                {
                    //Log.Success("OnCreate", "New Character : " + Name);

                    Character Char = new Character
                    {
                        AccountId    = cclient._Account.AccountId,
                        bTraits      = traits,
                        Career       = Info.career,
                        CareerLine   = CharInfo.CareerLine,
                        ModelId      = Info.model,
                        Name         = name,
                        Race         = Info.race,
                        Realm        = CharInfo.Realm,
                        RealmId      = Program.Rm.RealmId,
                        Sex          = Info.sex,
                        FirstConnect = true
                    };

                    if (!CharMgr.CreateChar(Char))
                    {
                        Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!");
                    }
                    else
                    {
                        List <CharacterInfo_item> Items = CharMgr.GetCharacterInfoItem(Char.CareerLine);

                        foreach (CharacterInfo_item Itm in Items)
                        {
                            if (Itm == null)
                            {
                                continue;
                            }

                            CharacterItem Citm = new CharacterItem
                            {
                                Counts       = Itm.Count,
                                CharacterId  = Char.CharacterId,
                                Entry        = Itm.Entry,
                                ModelId      = Itm.ModelId,
                                SlotId       = Itm.SlotId,
                                PrimaryDye   = 0,
                                SecondaryDye = 0
                            };
                            CharMgr.CreateItem(Citm);
                        }

                        Character_value CInfo = new Character_value
                        {
                            CharacterId = Char.CharacterId,
                            Level       = 1,
                            Money       = 2000,
                            Online      = false,
                            RallyPoint  = CharInfo.RallyPt,
                            RegionId    = CharInfo.Region,
                            Renown      = 0,
                            RenownRank  = 1,
                            RestXp      = 0,
                            Skills      = CharInfo.Skills,
                            Speed       = 100,
                            PlayedTime  = 0,
                            WorldO      = CharInfo.WorldO,
                            WorldX      = CharInfo.WorldX,
                            WorldY      = CharInfo.WorldY,
                            WorldZ      = CharInfo.WorldZ,
                            Xp          = 0,
                            ZoneId      = CharInfo.ZoneId
                        };

                        CharMgr.Database.AddObject(CInfo);
                        Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=2"));

                        CharacterClientData clientData = new CharacterClientData {
                            CharacterId = Char.CharacterId
                        };
                        CharMgr.Database.AddObject(clientData);

                        Char.Value      = CInfo;
                        Char.ClientData = clientData;

                        PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE, 32);
                        Out.WritePascalString(cclient._Account.Username);
                        cclient.SendPacket(Out);
                    }
                }
            }
            else
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_ERROR, 64);
                Out.FillString(cclient._Account.Username, 24);
                Out.WriteStringBytes("You have entered a duplicate or invalid name. Please enter a new name.");
                cclient.SendPacket(Out);
            }
        }
Beispiel #28
0
        protected virtual void SendWarbandComposition()
        {
            #region Warband Update

            int       disabled = WorldMgr.WorldSettingsMgr.GetGenericSetting(17);
            PacketOut Out      = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteByte(0x06); // Group info
            Out.WriteByte(3);
            Out.WriteByte(1);    // Unknown

            for (int i = 0; i < MaxGroups; ++i)
            {
                if (Groups[i] == null || Groups[i].IsEmpty)
                {
                    Out.WriteVarUInt(0); // Null party
                }
                else
                {
                    Out.WriteVarUInt(Groups[i].GroupId);
                    Out.WriteByte((byte)Groups[i].Members.Count);

                    foreach (Player plr in Groups[i].Members)
                    {
                        Out.WriteVarUInt(plr.CharacterId);
                        Out.WriteByte(0x0F); // ?
                        Out.WriteByte(plr.Info.ModelId);
                        Out.WriteVarUInt(plr.Info.Race);
                        Out.WriteByte(plr.Level);
                        Out.WriteByte(plr.StsInterface.BolsterLevel); // Real level? shows ^ - x = this byte
                        Out.WriteByte(plr.Info.CareerLine);
                        Out.WriteByte((byte)plr.Realm);
                        Out.WriteByte((byte)(plr == Leader ? 1 : 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((byte)plr.GldInterface.GetGuildName().Length);
                        Out.Fill(0, 3);
                        Out.WriteStringBytes(plr.GldInterface.GetGuildName());
                        Out.WriteVarUInt((uint)plr.X);
                        Out.WriteVarUInt((uint)plr.Y);
                        Out.WriteVarUInt((uint)plr.Z);
                        byte[] data  = { 0x27, 0x25, 0x05, 0x40, 0x00, 0x00 };
                        byte[] data2 = { 0x27, 0x25, 0x05, 0x40, 0x01, 0x02 };

                        // FIXME: Best guess right now is this data is actually 4 bytes + 2 varints.
                        //        Most likely it has something to do with state that is only relevant
                        //        when the player is online, because it is part of a block of data
                        //        (plr.X through plr.PctMorale) that only gets sent when online=1.
                        Out.Write(data2);
                        Out.WriteZigZag(plr._Value.ZoneId);

                        Out.WriteByte(2);

                        Out.WriteByte(plr.PctHealth);
                        Out.WriteByte(plr.PctAp); // action points
                        Out.WriteByte(plr.PctMorale);
                    }
                }
            }

            SendToWarband(Out);

            WarbandStatusDirty = true;

            #endregion
        }
Beispiel #29
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);
        }