Beispiel #1
0
 public void CharacterList(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     for (int i = 0; i < 5; i++)
     {
         string name = pvSrc.ReadString(60);
         if (name.Length > 0)
         {
             CharacterProfile profile = null;
             for (int j = 0; (profile == null) && (j < this.m_Shard.Characters.Length); j++)
             {
                 if (this.m_Shard.Characters[j].Index == i)
                 {
                     profile = this.m_Shard.Characters[j];
                 }
             }
             if (profile != null)
             {
                 profile.Name = name;
             }
             else
             {
                 this.m_Shard.AddCharacter(new CharacterProfile(this.m_Shard, name, i));
             }
         }
         else
         {
             CharacterProfile character = null;
             for (int k = 0; (character == null) && (k < this.m_Shard.Characters.Length); k++)
             {
                 if (this.m_Shard.Characters[k].Index == i)
                 {
                     character = this.m_Shard.Characters[k];
                 }
             }
             if (character != null)
             {
                 this.m_Shard.RemoveCharacter(character);
             }
         }
     }
     Array.Sort(this.m_Shard.Characters, new CharacterComparer());
     new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
 }
Beispiel #2
0
 private static void ServerList(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     int num = pvSrc.ReadInt16();
     if (num <= 0)
     {
         Gumps.Desktop.Children.Clear();
         xGumps.SetVariable("FailMessage", "The Ultima Online servers are currently down. Please try again in a few moments.");
         xGumps.Display("ConnectionFailed");
         Cursor.Hourglass = false;
     }
     else
     {
         Server[] array = new Server[num];
         Server server = null;
         for (int i = 0; i < num; i++)
         {
             array[i] = new Server(pvSrc.ReadInt16(), pvSrc.ReadString(0x20), pvSrc.ReadByte(), pvSrc.ReadSByte(), new IPAddress((long) pvSrc.ReadUInt32()));
             if (array[i].ServerID == NewConfig.LastServerID)
             {
                 server = array[i];
             }
         }
         Array.Sort(array);
         Engine.Servers = array;
         Engine.LastServer = server;
         if (Engine.m_QuickLogin)
         {
             for (int j = 0; j < array.Length; j++)
             {
                 if ((array[j].ServerID == Engine.m_QuickEntry.ServerID) && (array[j].Name == Engine.m_QuickEntry.ServerName))
                 {
                     array[j].Select();
                     Cursor.Hourglass = true;
                     Gumps.Desktop.Children.Clear();
                     xGumps.Display("Connecting");
                     Engine.DrawNow();
                     return;
                 }
             }
             Cursor.Hourglass = false;
             Gumps.Desktop.Children.Clear();
             xGumps.SetVariable("FailMessage", "That server was not found on the server list.");
             xGumps.Display("ConnectionFailed");
             Engine.DrawNow();
         }
         else
         {
             Cursor.Hourglass = false;
             Gumps.Desktop.Children.Clear();
             xGumps.Display("ServerList");
         }
     }
 }
Beispiel #3
0
 private static void SellContent(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt16();
     SellInfo[] info = new SellInfo[num2];
     bool flag = false;
     for (int i = 0; i < num2; i++)
     {
         Item item = World.WantItem(pvSrc.ReadInt32());
         info[i] = new SellInfo(item, pvSrc.ReadInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadString(pvSrc.ReadUInt16()));
     }
     if (flag)
     {
         Engine.AddTextMessage("Selling items.");
         Network.Send(new PSellItems(serial, info));
     }
     else
     {
         Gumps.Desktop.Children.Add(new GSellGump(serial, info));
     }
 }
Beispiel #4
0
 private static void SecureTrade_Open(int serial, PacketReader pvSrc)
 {
     string str;
     string str2;
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt32();
     bool flag = pvSrc.ReadBoolean();
     Mobile player = World.Player;
     Mobile mobile2 = World.FindMobile(serial);
     if (((player == null) || ((str = player.Name) == null)) || ((str = str.Trim()).Length <= 0))
     {
         str = "Me";
     }
     if (flag)
     {
         str2 = pvSrc.ReadString();
     }
     else if (((mobile2 == null) || ((str2 = mobile2.Name) == null)) || ((str2 = str2.Trim()).Length <= 0))
     {
         str2 = "Them";
     }
     GSecureTrade toAdd = new GSecureTrade(num, null, str, str2);
     IFont uniFont = Engine.GetUniFont(1);
     IHue hue = Hues.Load(1);
     IHue hue2 = Hues.Load(0);
     Item item = World.WantItem(num);
     GSecureTradeCheck partner = new GSecureTradeCheck(250, 2, null, null);
     GSecureTradeCheck check2 = new GSecureTradeCheck(2, 2, item, partner);
     toAdd.Children.Add(check2);
     toAdd.Children.Add(partner);
     IContainer container = new GContainer(item, 0x52, hue2);
     toAdd.m_Container = container.Gump;
     container.Gump.X = 13;
     container.Gump.Y = 0x21;
     ((GContainer) container).m_TradeContainer = true;
     container.Gump.SetTag("Check1", check2);
     container.Gump.SetTag("Check2", partner);
     toAdd.Children.Add(container.Gump);
     item.Container = container;
     Item item2 = World.WantItem(num2);
     IContainer container2 = new GContainer(item2, 0x52, hue2) {
         Gump = { X = 0x8e, Y = 0x21 }
     };
     container2.Gump.SetTag("Check1", check2);
     container2.Gump.SetTag("Check2", partner);
     ((GContainer) container2).m_HitTest = false;
     ((GContainer) container2).m_TradeContainer = true;
     toAdd.Children.Add(container2.Gump);
     item2.Container = container2;
     if (Engine.Features.AOS)
     {
         toAdd.Tooltip = new ItemTooltip(item2);
     }
     Gumps.Desktop.Children.Add(toAdd);
 }
Beispiel #5
0
 private static void DisplayGump(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int dialogID = pvSrc.ReadInt32();
     int x = pvSrc.ReadInt32();
     int y = pvSrc.ReadInt32();
     string layout = pvSrc.ReadString(pvSrc.ReadUInt16());
     string[] text = new string[pvSrc.ReadUInt16()];
     for (int i = 0; i < text.Length; i++)
     {
         text[i] = pvSrc.ReadUnicodeString(pvSrc.ReadUInt16());
     }
     GServerGump.GetCachedLocation(dialogID, ref x, ref y);
     GServerGump toAdd = new GServerGump(serial, dialogID, x, y, layout, text);
     Gumps.Desktop.Children.Add(toAdd);
 }
Beispiel #6
0
        public void ShardList(PacketReader pvSrc)
        {
            pvSrc.ReadByte();
            int num = pvSrc.ReadInt16();

            if (num > 0)
            {
                int port = this.m_Server.Port;
                switch (port)
                {
                case 0x1e5f:
                case 0x1e60:
                    port = 0x1389;
                    break;
                }
                for (int i = 0; i < num; i++)
                {
                    int       index       = pvSrc.ReadInt16();
                    string    name        = pvSrc.ReadString(0x20);
                    int       percentFull = pvSrc.ReadByte();
                    int       timeZone    = pvSrc.ReadSByte();
                    IPAddress address     = new IPAddress((long)pvSrc.ReadUInt32());
                    if (this.m_Shard == null)
                    {
                        ShardProfile profile = null;
                        for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                        {
                            if (this.m_Account.Shards[j].Name == name)
                            {
                                profile = this.m_Account.Shards[j];
                            }
                        }
                        if (profile == null)
                        {
                            this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                        }
                        else
                        {
                            profile.Index       = index;
                            profile.Address     = address;
                            profile.Port        = port;
                            profile.TimeZone    = timeZone;
                            profile.PercentFull = percentFull;
                        }
                        if (i == 0)
                        {
                            new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                        }
                    }
                }
                ShardProfile[] shards = this.m_Account.Shards;
                if (shards.Length > 0)
                {
                    if (this.m_Shard == null)
                    {
                        Array.Sort(shards, new ShardComparer());
                        this.m_Shard = shards[0];
                    }
                    this.Send(new PServerSelection(this.m_Shard.Index));
                }
            }
        }
Beispiel #7
0
 private static void CharacterList(PacketReader pvSrc)
 {
     bool flag;
     byte num = pvSrc.ReadByte();
     Cursor.Hourglass = false;
     Engine.CharacterCount = num;
     string[] strArray = Engine.CharacterNames = new string[5];
     int num2 = 0;
     for (int i = 0; i < 5; i++)
     {
         Engine.CharacterNames[i] = strArray[i] = pvSrc.ReadString(60);
         if (strArray[i].Length > 0)
         {
             num2++;
         }
     }
     pvSrc.ReadString(60);
     int num4 = pvSrc.ReadByte();
     while (--num4 >= 0)
     {
         byte num5 = pvSrc.ReadByte();
         string str = pvSrc.ReadString(0x1f);
         string str2 = pvSrc.ReadString(0x1f);
     }
     if (!pvSrc.Finished)
     {
         int num6 = pvSrc.ReadInt32();
         Engine.ServerFeatures.SingleChar = (num6 & 4) != 0;
         Engine.ServerFeatures.ContextMenus = (num6 & 8) != 0;
         Engine.ServerFeatures.AOS = (num6 & 0x20) != 0;
         if ((num6 & 4) != 0)
         {
             flag = num2 < 1;
         }
         else
         {
             flag = num2 < 5;
         }
     }
     else
     {
         flag = num2 < 5;
     }
     if (Engine.m_QuickLogin)
     {
         CharacterProfile charProfile = Engine.m_QuickEntry.CharProfile;
         if (charProfile != null)
         {
             ShardProfile shard = charProfile.Shard;
             for (int j = 0; j < 5; j++)
             {
                 string name = Engine.CharacterNames[j];
                 if (name.Length > 0)
                 {
                     CharacterProfile profile3 = null;
                     for (int k = 0; (profile3 == null) && (k < shard.Characters.Length); k++)
                     {
                         if (shard.Characters[k].Index == j)
                         {
                             profile3 = shard.Characters[k];
                         }
                     }
                     if (profile3 != null)
                     {
                         profile3.Name = name;
                     }
                     else
                     {
                         shard.AddCharacter(new CharacterProfile(shard, name, j));
                     }
                 }
                 else
                 {
                     CharacterProfile character = null;
                     for (int m = 0; (character == null) && (m < shard.Characters.Length); m++)
                     {
                         if (shard.Characters[m].Index == j)
                         {
                             character = shard.Characters[m];
                         }
                     }
                     if (character != null)
                     {
                         shard.RemoveCharacter(character);
                     }
                 }
             }
             Array.Sort(shard.Characters, new CharacterComparer());
             Timer timer = new Timer(new OnTick(PacketHandlers.Update_OnTick), 0, 1);
             timer.SetTag("shard", shard);
             timer.Start(false);
         }
         QuickLogin.Add(Engine.m_QuickEntry);
         Network.Send(new PCharSelect(Engine.m_QuickEntry.CharName, Engine.m_QuickEntry.CharID));
         if (Animations.IsLoading)
         {
             Gumps.Desktop.Children.Clear();
             xGumps.Display("AnimationLoad");
             do
             {
                 Engine.DrawNow();
             }
             while (!Animations.WaitLoading());
         }
         Gumps.Desktop.Children.Clear();
         xGumps.Display("EnterBritannia");
         Engine.DrawNow();
     }
     else
     {
         xGumps.SetVariable("CharSlotAvailable", flag ? "1" : "0");
         Gumps.Desktop.Children.Clear();
         xGumps.Display("CharacterList");
         int index = 0;
         int num11 = 0;
         while (index < 5)
         {
             if (strArray[index].Length > 0)
             {
                 xGumps.SetVariable("CharName", strArray[index]);
                 xGumps.SetVariable("CharDisplayIndex", num11++.ToString());
                 xGumps.SetVariable("CharIndex", index.ToString());
                 xGumps.Display("CharacterEntry", "CharacterList");
             }
             index++;
         }
     }
 }
Beispiel #8
0
 private static void Book_Open(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     bool flag = pvSrc.ReadBoolean();
     bool flag2 = pvSrc.ReadBoolean();
     int num2 = pvSrc.ReadInt16();
     int fixedLength = pvSrc.ReadInt16();
     string str = pvSrc.ReadString(fixedLength);
     int num4 = pvSrc.ReadInt16();
     string str2 = pvSrc.ReadString(num4);
     m_BookTitle = str;
     m_BookAuthor = str2;
     Engine.AddTextMessage("Books are not currently supported.");
 }
Beispiel #9
0
        private static void Message_Localized_Affix(PacketReader pvSrc)
        {
            int serial = pvSrc.ReadInt32();
            int num2 = pvSrc.ReadInt16();
            int type = pvSrc.ReadByte();
            IHue hue = Hues.Load(pvSrc.ReadInt16());
            IFont uniFont = Engine.GetUniFont(pvSrc.ReadInt16());
            int number = pvSrc.ReadInt32();
            int num5 = pvSrc.ReadByte();
            string name = pvSrc.ReadString(30);
            string input = Localization.GetString(number);
            string str3 = pvSrc.ReadString();
            string str4 = pvSrc.ReadUnicodeString();
            if (((num5 & -8) != 0) || (((num5 & 2) != 0) && (serial > 0)))
            {
                using (StreamWriter writer = new StreamWriter("Message Localized Affix.log", true))
                {
                    writer.WriteLine("Serial: 0x{0:X8}; Graphic: 0x{1:X4}; Type: {2}; Number: {3}; Flags: 0x{4:X2}; Name: '{5}'; Affix: '{6}'; Args: '{7}'; Text: '{8}';", new object[] { serial, num2, type, number, num5, name, str3, str4, input });
                }
            }
            if (str3.Length > 0)
            {
                switch ((num5 & 1))
                {
                    case 0:
                        input = input + str3;
                        break;

                    case 1:
                        input = str3 + input;
                        break;
                }
            }
            if (str4.Length > 0)
            {
                string[] strArray = str4.Split(new char[] { '\t' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    if ((strArray[i].Length > 1) && strArray[i].StartsWith("#"))
                    {
                        try
                        {
                            strArray[i] = Localization.GetString(Convert.ToInt32(strArray[i].Substring(1)));
                        }
                        catch
                        {
                        }
                    }
                }
                m_Args = strArray;
                input = m_ArgReplace.Replace(input, new MatchEvaluator(PacketHandlers.ArgReplace_Eval));
            }
            if ((num5 & -8) != 0)
            {
                pvSrc.Trace();
                input = string.Format("0x{0:X2}\n{1}", num5, input);
            }
            AddMessage(serial, uniFont, hue, type, name, input, number);
        }
Beispiel #10
0
        private static void Message_Localized(PacketReader pvSrc)
        {
            int serial = pvSrc.ReadInt32();
            int num2 = pvSrc.ReadInt16();
            byte type = pvSrc.ReadByte();
            IHue hue = Hues.Load(pvSrc.ReadInt16());
            IFont uniFont = Engine.GetUniFont(pvSrc.ReadInt16());
            int number = pvSrc.ReadInt32();
            string name = pvSrc.ReadString(30);
            string str2 = pvSrc.ReadUnicodeLEString();
            string input = Localization.GetString(number);
            switch (number)
            {
                case 0x7a1a6:
                    Engine.m_Meditating = false;
                    break;

                case 0x7a4b4:
                case 0x7a4e3:
                case 0x7a4e4:
                case 0x7a4e5:
                case 0x7a4e6:
                case 0x7a4e7:
                case 0x7a4e8:
                case 0x7a4e9:
                case 0x7add5:
                case 0x7add6:
                case 0x7adda:
                case 0x7addb:
                case 0xfe68a:
                case 0xfe68c:
                    GBandageTimer.Stop();
                    Engine.m_Healing = false;
                    break;

                case 0x7a4dc:
                case 0x7a4dd:
                case 0x7a4de:
                case 0x7a4df:
                case 0x7a4e0:
                    m_HealStart = DateTime.Now;
                    GBandageTimer.Start();
                    Engine.m_Healing = true;
                    break;

                case 0x7a856:
                case 0x7a85b:
                    Engine.m_Meditating = true;
                    break;

                case 0x7abc5:
                case 0x7abc6:
                case 0x7abc7:
                case 0x7abc8:
                case 0x7abc9:
                case 0x7abcb:
                    Engine.m_Stealth = false;
                    Engine.m_StealthSteps = 0;
                    break;

                case 0x7abca:
                    Engine.m_Stealth = true;
                    if (!Engine.Features.AOS)
                    {
                        Engine.m_StealthSteps = (int) (Engine.Skills[SkillName.Stealth].Value / 10f);
                        break;
                    }
                    Engine.m_StealthSteps = (int) (Engine.Skills[SkillName.Stealth].Value / 5f);
                    break;
            }
            if (str2.Length > 0)
            {
                string[] strArray = str2.Split(new char[] { '\t' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    if ((strArray[i].Length > 1) && strArray[i].StartsWith("#"))
                    {
                        try
                        {
                            strArray[i] = Localization.GetString(Convert.ToInt32(strArray[i].Substring(1)));
                        }
                        catch
                        {
                        }
                    }
                }
                m_Args = strArray;
                input = m_ArgReplace.Replace(input, new MatchEvaluator(PacketHandlers.ArgReplace_Eval));
            }
            AddMessage(serial, uniFont, hue, type, name, input, number);
        }
Beispiel #11
0
 private static void LaunchBrowser(PacketReader pvSrc)
 {
     string url = pvSrc.ReadString();
     if (Engine.m_Fullscreen)
     {
         Engine.AddTextMessage("Cannot open browser in fullscreen.");
     }
     else
     {
         Engine.OpenBrowser(url);
     }
 }
Beispiel #12
0
 private static void DisplayQuestionMenu(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int menuID = pvSrc.ReadInt16();
     string question = pvSrc.ReadString(pvSrc.ReadByte());
     AnswerEntry[] answers = new AnswerEntry[pvSrc.ReadByte()];
     for (int i = 0; i < answers.Length; i++)
     {
         answers[i] = new AnswerEntry(i, pvSrc.ReadInt16(), pvSrc.ReadUInt16(), pvSrc.ReadString(pvSrc.ReadByte()));
     }
     if ((answers.Length > 0) && (answers[0].ItemID != 0))
     {
         Gumps.Desktop.Children.Add(new GItemList(serial, menuID, question, answers));
     }
     else
     {
         Gumps.Desktop.Children.Add(new GQuestionMenu(serial, menuID, question, answers));
     }
 }
Beispiel #13
0
 private static void DisplayProfile(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     string header = pvSrc.ReadString();
     string footer = pvSrc.ReadUnicodeString();
     string body = pvSrc.ReadUnicodeString();
     Mobile owner = World.FindMobile(serial);
     if (owner != null)
     {
         Gumps.Desktop.Children.Add(new GCharacterProfile(owner, header, body, footer));
     }
 }
Beispiel #14
0
 private static void DisplayPaperdoll(PacketReader pvSrc)
 {
     Mobile m = World.FindMobile(pvSrc.ReadInt32());
     if (m != null)
     {
         m.PaperdollName = pvSrc.ReadString(60);
         byte num = pvSrc.ReadByte();
         m.PaperdollCanDrag = m.Player || ((num & 2) != 0);
         Gumps.OpenPaperdoll(m, m.PaperdollName, m.PaperdollCanDrag);
     }
 }
Beispiel #15
0
 private static void ShopContent(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadByte();
     if (num2 > 0)
     {
         m_BuyMenuSerial = num;
         m_BuyMenuNames = new string[num2];
         m_BuyMenuPrices = new int[num2];
         for (int i = 0; i < num2; i++)
         {
             m_BuyMenuPrices[i] = pvSrc.ReadInt32();
             string str = pvSrc.ReadString(pvSrc.ReadByte());
             try
             {
                 str = Localization.GetString(Convert.ToInt32(str));
             }
             catch
             {
             }
             m_BuyMenuNames[i] = str;
         }
     }
 }
Beispiel #16
0
 private static void StringQuery(PacketReader pvSrc)
 {
     GDragable dragable;
     GWrappedLabel label2;
     int num = pvSrc.ReadInt32();
     short num2 = pvSrc.ReadInt16();
     int fixedLength = pvSrc.ReadInt16();
     string text = pvSrc.ReadString(fixedLength);
     bool flag = pvSrc.ReadBoolean();
     byte num4 = pvSrc.ReadByte();
     int num5 = pvSrc.ReadInt32();
     int num6 = pvSrc.ReadInt16();
     string str2 = pvSrc.ReadString(num6);
     dragable = new GDragable(0x474, 0, 0) {
         CanClose = false,
         Modal = true,
         X = (Engine.ScreenWidth - dragable.Width) / 2,
         Y = (Engine.ScreenHeight - dragable.Height) / 2
     };
     GButton toAdd = new GButton(0x47b, 0x47d, 0x47c, 0x75, 190, new OnClick(Engine.StringQueryOkay_OnClick));
     GButton button2 = new GButton(0x478, 0x47a, 0x479, 0xcc, 190, flag ? new OnClick(Engine.StringQueryCancel_OnClick) : null);
     if (!flag)
     {
         button2.Enabled = false;
     }
     GImage image = new GImage(0x477, 60, 0x91);
     GWrappedLabel label = new GWrappedLabel(text, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110);
     label2 = new GWrappedLabel(str2, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110) {
         Y = image.Y - label2.Height
     };
     GTextBox box = new GTextBox(0, false, 0x44, 140, image.Width - 8, image.Height, "", Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455));
     box.Focus();
     if (num4 == 1)
     {
         box.MaxChars = num5;
     }
     toAdd.SetTag("Dialog", dragable);
     toAdd.SetTag("Serial", num);
     toAdd.SetTag("Type", num2);
     toAdd.SetTag("Text", box);
     button2.SetTag("Dialog", dragable);
     button2.SetTag("Serial", num);
     button2.SetTag("Type", num2);
     dragable.Children.Add(label);
     dragable.Children.Add(label2);
     dragable.Children.Add(image);
     dragable.Children.Add(box);
     dragable.Children.Add(button2);
     dragable.Children.Add(toAdd);
     dragable.m_CanDrag = true;
     Gumps.Desktop.Children.Add(dragable);
 }
Beispiel #17
0
 private static void Message_Unicode(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt16();
     int type = pvSrc.ReadByte();
     IHue hue = Hues.Load(pvSrc.ReadInt16());
     IFont uniFont = Engine.GetUniFont(pvSrc.ReadInt16());
     string str = pvSrc.ReadString(4);
     string name = pvSrc.ReadString(30);
     string text = pvSrc.ReadUnicodeString();
     AddMessage(serial, uniFont, hue, type, name, text);
 }
Beispiel #18
0
 private static void ChangeCharacter(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     int num2 = pvSrc.ReadByte();
     string[] strArray = new string[5];
     for (int i = 0; i < 5; i++)
     {
         strArray[i] = pvSrc.ReadString(30);
         pvSrc.Seek(30, SeekOrigin.Current);
     }
     if (!pvSrc.Finished || (num2 != 0))
     {
         pvSrc.Trace();
     }
     Engine.AddTextMessage("That is not supported.");
 }
Beispiel #19
0
 private static void Mobile_Status(PacketReader pvSrc)
 {
     Mobile mobile = World.WantMobile(pvSrc.ReadInt32());
     if (mobile != null)
     {
         mobile.Refresh = true;
         mobile.Name = pvSrc.ReadString(30);
         mobile.HPCur = pvSrc.ReadUInt16();
         mobile.HPMax = pvSrc.ReadUInt16();
         mobile.IsPet = pvSrc.ReadBoolean();
         byte num = pvSrc.ReadByte();
         if (num >= 1)
         {
             mobile.Gender = pvSrc.ReadByte();
             mobile.Str = pvSrc.ReadUInt16();
             mobile.Dex = pvSrc.ReadUInt16();
             mobile.Int = pvSrc.ReadUInt16();
             mobile.StamCur = pvSrc.ReadUInt16();
             mobile.StamMax = pvSrc.ReadUInt16();
             mobile.ManaCur = pvSrc.ReadUInt16();
             mobile.ManaMax = pvSrc.ReadUInt16();
             mobile.Gold = pvSrc.ReadInt32();
             mobile.Armor = pvSrc.ReadUInt16();
             mobile.Weight = pvSrc.ReadUInt16();
             if (num >= 2)
             {
                 mobile.StatCap = pvSrc.ReadUInt16();
                 if (num >= 3)
                 {
                     mobile.FollowersCur = pvSrc.ReadByte();
                     mobile.FollowersMax = pvSrc.ReadByte();
                     if (num >= 4)
                     {
                         mobile.FireResist = pvSrc.ReadInt16();
                         mobile.ColdResist = pvSrc.ReadInt16();
                         mobile.PoisonResist = pvSrc.ReadInt16();
                         mobile.EnergyResist = pvSrc.ReadInt16();
                         mobile.Luck = pvSrc.ReadUInt16();
                         mobile.DamageMin = pvSrc.ReadUInt16();
                         mobile.DamageMax = pvSrc.ReadUInt16();
                         mobile.TithingPoints = pvSrc.ReadInt32();
                         if (num > 4)
                         {
                             pvSrc.Trace();
                         }
                     }
                     else
                     {
                         mobile.FireResist = 0;
                         mobile.ColdResist = 0;
                         mobile.PoisonResist = 0;
                         mobile.EnergyResist = 0;
                         mobile.Luck = 0;
                         mobile.DamageMin = 0;
                         mobile.DamageMax = 0;
                     }
                 }
                 else
                 {
                     mobile.FollowersCur = 0;
                     mobile.FollowersMax = 5;
                 }
             }
             else
             {
                 mobile.StatCap = 0xe1;
             }
         }
         mobile.Refresh = false;
     }
 }
Beispiel #20
0
 private static void Command_EquipInfo(PacketReader pvSrc)
 {
     if (Engine.Features.AOS)
     {
         int serial = pvSrc.ReadInt32();
         int num2 = pvSrc.ReadInt32();
         Item item = World.FindItem(serial);
         if (item != null)
         {
             item.PropertyID = num2;
             if (((item.Parent != null) && ((item.Parent.ID & 0x3fff) == 0x2006)) && (item.PropertyList == null))
             {
                 item.QueryProperties();
             }
         }
         Mobile mobile = World.FindMobile(serial);
         if (mobile != null)
         {
             mobile.PropertyID = num2;
         }
     }
     else
     {
         int num5;
         IFont uniFont = Engine.GetUniFont(3);
         IHue bright = Hues.Bright;
         int num3 = pvSrc.ReadInt32();
         int number = pvSrc.ReadInt32();
         AddMessage(num3, uniFont, bright, 6, "You see", Localization.GetString(number));
         ArrayList dataStore = Engine.GetDataStore();
         while (!pvSrc.Finished && ((num5 = pvSrc.ReadInt32()) != -1))
         {
             if (num5 < 0)
             {
                 switch (num5)
                 {
                     case -4:
                     {
                         AddMessage(num3, uniFont, bright, 6, "", "[" + Localization.GetString(0xfd6b0) + "]");
                         continue;
                     }
                     case -3:
                     {
                         int fixedLength = pvSrc.ReadInt16();
                         string str = pvSrc.ReadString(fixedLength).Trim();
                         if (str.Length > 0)
                         {
                             AddMessage(num3, uniFont, bright, 6, "", Localization.GetString(0xfd2d1) + " " + str);
                         }
                         continue;
                     }
                 }
                 Engine.ReleaseDataStore(dataStore);
                 pvSrc.Trace();
                 Engine.AddTextMessage(string.Format("Unknown sub message : {0}", num5));
                 return;
             }
             int num7 = pvSrc.ReadInt16();
             if (num7 != -1)
             {
                 dataStore.Add(Localization.GetString(num5) + ": " + num7);
             }
             else
             {
                 dataStore.Add(Localization.GetString(num5));
             }
         }
         if (dataStore.Count > 0)
         {
             StringBuilder builder = new StringBuilder();
             builder.Append('[');
             for (int i = 0; i < dataStore.Count; i++)
             {
                 builder.Append(dataStore[i]);
                 if (i != (dataStore.Count - 1))
                 {
                     builder.Append('/');
                 }
             }
             builder.Append(']');
             AddMessage(num3, uniFont, bright, 6, "", builder.ToString());
         }
         if (!pvSrc.Finished)
         {
             pvSrc.Trace();
         }
         Engine.ReleaseDataStore(dataStore);
     }
 }
Beispiel #21
0
 private static void Prompt_ASCII(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int prompt = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadInt32();
     string text = pvSrc.ReadString().Trim();
     Engine.Prompt = new ASCIIPrompt(serial, prompt, text);
 }
Beispiel #22
0
 private static void ScrollMessage(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     int num2 = pvSrc.ReadInt32();
     string text = pvSrc.ReadString(pvSrc.ReadUInt16());
     if (text != "MISSING UPDATE")
     {
         Gumps.Desktop.Children.Add(new GUpdateScroll(text));
     }
 }
Beispiel #23
0
 public void ShardList(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     int num = pvSrc.ReadInt16();
     if (num > 0)
     {
         int port = this.m_Server.Port;
         switch (port)
         {
             case 0x1e5f:
             case 0x1e60:
                 port = 0x1389;
                 break;
         }
         for (int i = 0; i < num; i++)
         {
             int index = pvSrc.ReadInt16();
             string name = pvSrc.ReadString(0x20);
             int percentFull = pvSrc.ReadByte();
             int timeZone = pvSrc.ReadSByte();
             IPAddress address = new IPAddress((long) pvSrc.ReadUInt32());
             if (this.m_Shard == null)
             {
                 ShardProfile profile = null;
                 for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                 {
                     if (this.m_Account.Shards[j].Name == name)
                     {
                         profile = this.m_Account.Shards[j];
                     }
                 }
                 if (profile == null)
                 {
                     this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                 }
                 else
                 {
                     profile.Index = index;
                     profile.Address = address;
                     profile.Port = port;
                     profile.TimeZone = timeZone;
                     profile.PercentFull = percentFull;
                 }
                 if (i == 0)
                 {
                     new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                 }
             }
         }
         ShardProfile[] shards = this.m_Account.Shards;
         if (shards.Length > 0)
         {
             if (this.m_Shard == null)
             {
                 Array.Sort(shards, new ShardComparer());
                 this.m_Shard = shards[0];
             }
             this.Send(new PServerSelection(this.m_Shard.Index));
         }
     }
 }