Beispiel #1
0
 private static void MapWindow(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt16();
     int num3 = pvSrc.ReadInt16();
     int num4 = pvSrc.ReadInt16();
     int num5 = pvSrc.ReadInt16();
     int num6 = pvSrc.ReadInt16();
     int num7 = pvSrc.ReadInt16();
     int num8 = pvSrc.ReadInt16();
     m_xMapLeft = num3;
     m_yMapTop = num4;
     m_xMapRight = num5;
     m_yMapBottom = num6;
     m_xMapWidth = num7;
     m_yMapHeight = num8;
 }
Beispiel #2
0
 private static void WorldItem(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int itemID = pvSrc.ReadUInt16();
     int num3 = ((serial & 0x80000000L) != 0L) ? pvSrc.ReadInt16() : 0;
     if ((itemID & 0x8000) != 0)
     {
         itemID &= 0x7fff;
         itemID += pvSrc.ReadSByte();
     }
     int num4 = pvSrc.ReadInt16();
     int num5 = pvSrc.ReadInt16();
     bool flag2 = (num4 & 0x8000) != 0;
     bool flag3 = (num5 & 0x8000) != 0;
     bool flag4 = (num5 & 0x4000) != 0;
     int num6 = flag2 ? pvSrc.ReadByte() : 0;
     int num7 = pvSrc.ReadSByte();
     int hue = flag3 ? pvSrc.ReadUInt16() : 0;
     int num9 = flag4 ? pvSrc.ReadByte() : 0;
     serial &= 0x7fffffff;
     num4 &= 0x7fff;
     num5 &= 0x3fff;
     bool wasFound = false;
     Item i = World.WantItem(serial, ref wasFound);
     bool isMulti = i.IsMulti;
     i.IsMulti = itemID >= 0x4000;
     int id = 0;
     if (i.IsMulti)
     {
         id = itemID & 0x3fff;
         Engine.Multis.Register(i, id);
         itemID = 1;
     }
     else if (isMulti)
     {
         Engine.Multis.Unregister(i);
     }
     Engine.ItemArt.Translate(ref itemID, ref hue);
     itemID &= 0x3fff;
     i.SetLocation((short) num4, (short) num5, (short) num7);
     i.ID = (short) itemID;
     i.Amount = (short) num3;
     i.Direction = (byte) num6;
     i.Hue = (ushort) hue;
     i.Flags.Value = num9;
     if ((!i.Visible && (i.IsCorpse || i.IsBones)) && World.CharData.IncomingNames)
     {
         i.Look();
     }
     i.Visible = true;
     i.InWorld = true;
     if (i.IsEquip)
     {
         i.RemoveEquip();
     }
     if (i.Parent != null)
     {
         i.Parent.RemoveItem(i);
     }
     if ((itemID == 0x2006) && (i.CorpseSerial != 0))
     {
         Mobile mobile = World.FindMobile(i.CorpseSerial);
         if (mobile != null)
         {
             i.Direction = mobile.Direction;
             i.Visible = false;
         }
     }
     i.Update();
     if (i.IsMulti && Engine.GMPrivs)
     {
         Engine.AddTextMessage(string.Format("House serial: 0x{0:X}", serial));
     }
 }
Beispiel #3
0
        private static void Command(PacketReader pvSrc)
        {
            int num = pvSrc.ReadInt16();
            switch (num)
            {
                case 4:
                    pvSrc.ReturnName = "Close Dialog";
                    Command_CloseDialog(pvSrc);
                    return;

                case 6:
                    Command_Party(pvSrc);
                    return;

                case 8:
                    pvSrc.ReturnName = "Set World";
                    Command_SetWorld(pvSrc);
                    return;

                case 0x10:
                    pvSrc.ReturnName = "Equipment Description";
                    Command_EquipInfo(pvSrc);
                    return;

                case 20:
                    pvSrc.ReturnName = "Mobile Popup";
                    Command_Popup(pvSrc);
                    return;

                case 0x17:
                    pvSrc.ReturnName = "Open Wisdom Codex";
                    Command_OpenWisdomCodex(pvSrc);
                    return;

                case 0x18:
                    pvSrc.ReturnName = "Map Patches";
                    Command_MapPatches(pvSrc);
                    return;

                case 0x19:
                    pvSrc.ReturnName = "Extended Status";
                    Command_ExtendedStatus(pvSrc);
                    return;

                case 0x1b:
                    pvSrc.ReturnName = "Spellbook Content";
                    Command_SpellbookContent(pvSrc);
                    return;

                case 0x1d:
                    pvSrc.ReturnName = "Custom House";
                    Command_CustomHouse(pvSrc);
                    return;

                case 0x20:
                    pvSrc.ReturnName = "Edit Custom House";
                    Command_EditCustomHouse(pvSrc);
                    return;

                case 0x21:
                    pvSrc.ReturnName = "Clear Combat Ability";
                    AbilityInfo.ClearActive();
                    return;

                case 0x22:
                    pvSrc.ReturnName = "Damage";
                    Command_Damage(pvSrc);
                    return;
            }
            Debug.Trace("Unhandled subcommand {0} ( 0x{0:X4} )", num);
            pvSrc.Trace();
        }
Beispiel #4
0
 private static void Skills_Absolute(PacketReader pvSrc, bool hasCapData)
 {
     int num;
     Client.Skills skills = Engine.Skills;
     while ((num = pvSrc.ReadInt16()) > 0)
     {
         Skill skill = skills[num - 1];
         if (skill != null)
         {
             skill.Value = ((float) pvSrc.ReadInt16()) / 10f;
             skill.Real = ((float) pvSrc.ReadInt16()) / 10f;
             skill.Lock = (SkillLock) pvSrc.ReadByte();
             if (hasCapData)
             {
                 pvSrc.Seek(2, SeekOrigin.Current);
             }
             if (Engine.m_SkillsOpen && (Engine.m_SkillsGump != null))
             {
                 Engine.m_SkillsGump.OnSkillChange(skill);
             }
         }
     }
 }
Beispiel #5
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 #6
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 #7
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 #8
0
 private static void Mobile_Moving(PacketReader pvSrc)
 {
     Mobile m = World.FindMobile(pvSrc.ReadInt32());
     if (m != null)
     {
         bool flag = false;
         m.Body = pvSrc.ReadInt16();
         if (!m.Player)
         {
             int x = pvSrc.ReadInt16();
             int y = pvSrc.ReadInt16();
             int z = pvSrc.ReadSByte();
             int dir = pvSrc.ReadByte();
             m.Walking.Enqueue(WalkAnimation.PoolInstance(m, x, y, z, dir));
             if (m.Walking.Count > 4)
             {
                 WalkAnimation animation = (WalkAnimation) m.Walking.Dequeue();
                 m.SetLocation((short) animation.NewX, (short) animation.NewY, (short) animation.NewZ);
                 animation.Dispose();
                 flag = true;
             }
             ((WalkAnimation) m.Walking.Peek()).Start();
             m.SetReal(x, y, z);
         }
         else
         {
             pvSrc.Seek(6, SeekOrigin.Current);
         }
         m.Hue = pvSrc.ReadInt16();
         m.Flags.Value = pvSrc.ReadByte();
         m.Notoriety = (Notoriety) pvSrc.ReadByte();
         m.IsMoving = !m.Player || Engine.amMoving;
         if (!m.Visible)
         {
             m.Visible = true;
             m.Update();
         }
         else if (flag)
         {
             m.Update();
         }
         if (m.Paperdoll != null)
         {
             Gumps.OpenPaperdoll(m, m.PaperdollName, m.PaperdollCanDrag);
         }
     }
 }
Beispiel #9
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 #10
0
        private static void Mobile_Animation(PacketReader pvSrc)
        {
            int num;
            int num3;
            bool flag;
            bool flag2;
            int num4;
            int num5;
            Mobile mobile = World.FindMobile(pvSrc.ReadInt32());
            if (mobile != null)
            {
                num = pvSrc.ReadInt16();
                int num2 = pvSrc.ReadInt16();
                num3 = pvSrc.ReadInt16();
                flag = !pvSrc.ReadBoolean();
                flag2 = pvSrc.ReadBoolean();
                num4 = pvSrc.ReadByte();
                switch (Engine.m_Animations.GetBodyType(mobile.Body))
                {
                    case BodyType.Monster:
                        num = num % 0x16;
                        goto Label_00D9;

                    case BodyType.Sea:
                    case BodyType.Animal:
                    {
                        object obj2 = Engine.m_Animations.ActionDef1[num];
                        if (obj2 != null)
                        {
                            num = (int) obj2;
                        }
                        num = num % 13;
                        goto Label_00D9;
                    }
                    case BodyType.Human:
                    case BodyType.Equipment:
                    {
                        object obj3 = Engine.m_Animations.ActionDef2[num];
                        if (obj3 != null)
                        {
                            num = (int) obj3;
                        }
                        num = num % 0x23;
                        goto Label_00D9;
                    }
                }
            }
            return;
            Label_00D9:
            num5 = Engine.GetAnimDirection(mobile.Direction) & 7;
            if (Engine.m_Animations.IsValid(mobile.Body, num, num5))
            {
                Animation animation = new Animation {
                    Action = num,
                    RepeatCount = num3,
                    Forward = flag,
                    Repeat = flag2,
                    Delay = num4
                };
                mobile.Animation = animation;
                animation.Run();
            }
        }
Beispiel #11
0
 private static void Mobile_Incoming(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     if (!NewConfig.IncomingFix || ((serial & 0x3fffffff) != World.Serial))
     {
         int num10;
         if ((serial & -1073741824) != 0)
         {
             pvSrc.Trace();
         }
         short num2 = pvSrc.ReadInt16();
         if ((serial & 0x80000000L) != 0L)
         {
             short num3 = pvSrc.ReadInt16();
         }
         short x = pvSrc.ReadInt16();
         short y = pvSrc.ReadInt16();
         sbyte z = pvSrc.ReadSByte();
         byte dir = pvSrc.ReadByte();
         short num8 = pvSrc.ReadInt16();
         byte num9 = pvSrc.ReadByte();
         Notoriety notoriety = (Notoriety) pvSrc.ReadByte();
         ArrayList list = new ArrayList();
         LayerComparer comparer = LayerComparer.FromDirection(dir);
         bool wasFound = false;
         Mobile mobile = World.WantMobile(serial, ref wasFound);
         while ((num10 = pvSrc.ReadInt32()) > 0)
         {
             Item item = World.WantItem(num10);
             item.Query();
             int itemID = pvSrc.ReadInt16();
             Layer layer = (Layer) pvSrc.ReadByte();
             int hue = ((itemID & 0x8000) != 0) ? pvSrc.ReadUInt16() : 0;
             if (comparer.IsValid(layer))
             {
                 short animation;
                 item.Visible = true;
                 if (item.InWorld)
                 {
                     Map.RemoveItem(item);
                     item.InWorld = false;
                 }
                 else if (item.IsEquip)
                 {
                     item.RemoveEquip();
                 }
                 else if (item.Parent != null)
                 {
                     item.Parent.RemoveItem(item);
                 }
                 itemID &= 0x3fff;
                 Engine.ItemArt.Translate(ref itemID, ref hue);
                 item.ID = (short) itemID;
                 item.Hue = (ushort) hue;
                 if (layer == Layer.Mount)
                 {
                     animation = (short) Engine.m_Animations.ConvertMountItemToBody(itemID);
                 }
                 else
                 {
                     animation = Map.GetAnimation(itemID);
                 }
                 item.IsEquip = true;
                 item.EquipParent = mobile;
                 list.Add(new EquipEntry(item, animation, layer));
             }
         }
         list.Sort(comparer);
         if (mobile.Player)
         {
             dir = (byte) (dir & 7);
             dir = (byte) (dir | ((byte) (mobile.Direction & 0x80)));
         }
         if ((!mobile.Visible && !mobile.Player) && World.CharData.IncomingNames)
         {
             mobile.Look();
         }
         if ((!mobile.Visible && !mobile.Player) && ((num2 == 400) || (num2 == 0x191)))
         {
             bool flag2;
             if ((World.Player != null) && (World.Player.Notoriety == Notoriety.Murderer))
             {
                 flag2 = ((((notoriety == Notoriety.Innocent) || (notoriety == Notoriety.Ally)) || ((notoriety == Notoriety.Attackable) || (notoriety == Notoriety.Enemy))) || (notoriety == Notoriety.Murderer)) || (notoriety == Notoriety.Criminal);
             }
             else
             {
                 flag2 = (((notoriety == Notoriety.Ally) || (notoriety == Notoriety.Attackable)) || ((notoriety == Notoriety.Enemy) || (notoriety == Notoriety.Murderer))) || (notoriety == Notoriety.Criminal);
             }
             if (flag2)
             {
                 mobile.QueryStats();
             }
         }
         if (!mobile.Player)
         {
             mobile.SetLocation(x, y, z);
             mobile.Direction = dir;
             mobile.Hue = num8;
             mobile.Body = num2;
             mobile.IsMoving = false;
             mobile.MovedTiles = 0;
             mobile.HorseFootsteps = 0;
             mobile.Walking.Clear();
             mobile.UpdateReal();
         }
         mobile.Equip = list;
         mobile.Flags.Value = num9;
         mobile.Visible = true;
         mobile.Notoriety = notoriety;
         mobile.EquipChanged();
         mobile.Update();
     }
 }
Beispiel #12
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 #13
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 #14
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 #15
0
 private static void QuestArrow(PacketReader pvSrc)
 {
     if (pvSrc.ReadBoolean())
     {
         GQuestArrow.Activate(pvSrc.ReadInt16(), pvSrc.ReadInt16());
     }
     else
     {
         GQuestArrow.Stop();
     }
 }
Beispiel #16
0
 private static void Mobile_Update(PacketReader pvSrc)
 {
     Mobile m = World.WantMobile(pvSrc.ReadInt32());
     short num = pvSrc.ReadInt16();
     byte num2 = pvSrc.ReadByte();
     short num3 = pvSrc.ReadInt16();
     byte num4 = pvSrc.ReadByte();
     short x = pvSrc.ReadInt16();
     short y = pvSrc.ReadInt16();
     short num7 = pvSrc.ReadInt16();
     byte newDir = pvSrc.ReadByte();
     sbyte z = pvSrc.ReadSByte();
     if ((num2 != 0) || (num7 != 0))
     {
         pvSrc.Trace();
     }
     if (m.Player)
     {
         if (Engine.m_InResync)
         {
             Engine.m_InResync = false;
             Engine.AddTextMessage("Resynchronization complete.");
         }
         m_Sequences.Clear();
         Engine.m_Sequence = 0;
         Engine.m_WalkAck = 0;
         Engine.m_WalkReq = 0;
     }
     if (m.Player)
     {
         if (((num == 0x192) || (num == 0x193)) && ((m.Body != 0x192) && (m.Body != 0x193)))
         {
             Network.Send(new PSetWarMode(false, 0x20, 0));
             Engine.Effects.Add(new DeathEffect());
         }
         else if (((m.Body == 0x192) || (m.Body == 0x193)) && ((num != 0x192) && (num != 0x193)))
         {
             Animation animation = m.Animation = new Animation();
             animation.Action = 0x11;
             animation.Delay = 0;
             animation.Forward = true;
             animation.Repeat = false;
             animation.Run();
             Engine.Effects.Add(new ResurrectEffect());
         }
     }
     if (m.Player)
     {
         World.SetLocation(x, y, z);
     }
     m.SetLocation(x, y, z);
     m.Body = num;
     m.Hue = num3;
     m.IsMoving = false;
     m.MovedTiles = 0;
     m.HorseFootsteps = 0;
     m.Walking.Clear();
     m.UpdateReal();
     Engine.EquipSort(m, newDir);
     m.Direction = newDir;
     m.Flags.Value = num4;
     if (m.Paperdoll != null)
     {
         Gumps.OpenPaperdoll(m, m.PaperdollName, m.PaperdollCanDrag);
     }
     m.Visible = true;
     m.Update();
 }
Beispiel #17
0
 private static void SelectHue(PacketReader pvSrc)
 {
     GItemArt art;
     int num = pvSrc.ReadInt32();
     short num2 = pvSrc.ReadInt16();
     short itemID = pvSrc.ReadInt16();
     GAlphaBackground background = new GAlphaBackground(0, 0, 0xf4, 110) {
         m_NonRestrictivePicking = true
     };
     background.Center();
     art = new GItemArt(0xb7, 3, itemID) {
         X = art.X + (((0x3a - (art.Image.xMax - art.Image.xMin)) / 2) - art.Image.xMin),
         Y = art.Y + (((0x52 - (art.Image.yMax - art.Image.yMin)) / 2) - art.Image.yMin)
     };
     background.Children.Add(art);
     GHuePicker toAdd = new GHuePicker(4, 4) {
         Brightness = 1
     };
     toAdd.SetTag("ItemID", (int) itemID);
     toAdd.SetTag("Item Art", art);
     toAdd.SetTag("Dialog", background);
     toAdd.OnHueSelect = new OnHueSelect(Engine.HuePicker_OnHueSelect);
     background.Children.Add(toAdd);
     background.Children.Add(new GSingleBorder(3, 3, 0xa2, 0x52));
     background.Children.Add(new GSingleBorder(0xa4, 3, 0x11, 0x52));
     GBrightnessBar bar = new GBrightnessBar(0xa5, 4, 15, 80, toAdd);
     background.Children.Add(bar);
     bar.Refresh();
     GFlatButton button = new GFlatButton(0x7b, 0x57, 0x3a, 20, "Picker", new OnClick(Engine.HuePickerPicker_OnClick));
     GFlatButton okay = new GFlatButton(0xb7, 0x57, 0x3a, 20, "Okay", new OnClick(Engine.HuePickerOk_OnClick));
     okay.SetTag("Hue Picker", toAdd);
     okay.SetTag("Dialog", background);
     okay.SetTag("Serial", num);
     okay.SetTag("ItemID", itemID);
     okay.SetTag("Relay", num2);
     button.SetTag("Hue Picker", toAdd);
     button.SetTag("Brightness Bar", bar);
     background.Children.Add(new GQuickHues(toAdd, bar, okay));
     background.Children.Add(button);
     background.Children.Add(okay);
     Gumps.Desktop.Children.Add(background);
     Engine.HuePicker_OnHueSelect(toAdd.Hue, toAdd);
 }
Beispiel #18
0
 private static void Movement_Reject(PacketReader pvSrc)
 {
     m_Sequences.Clear();
     Engine.m_Sequence = 0;
     Engine.m_WalkReq = 0;
     Engine.m_WalkAck = 0;
     Mobile player = World.Player;
     if (player != null)
     {
         pvSrc.ReadByte();
         short x = pvSrc.ReadInt16();
         short y = pvSrc.ReadInt16();
         byte dir = pvSrc.ReadByte();
         if (player.Direction != dir)
         {
             player.Direction = dir;
             player.Equip.Sort(LayerComparer.FromDirection(dir));
         }
         sbyte z = pvSrc.ReadSByte();
         World.SetLocation(x, y, z);
         player.SetLocation(x, y, z);
         player.MovedTiles = 0;
         player.HorseFootsteps = 0;
         player.IsMoving = false;
         player.Walking.Clear();
         player.UpdateReal();
         player.Update();
     }
 }
Beispiel #19
0
 private static void ServerChange(PacketReader pvSrc)
 {
     Engine.Multis.Clear();
     Mobile player = World.Player;
     if (player != null)
     {
         short x = pvSrc.ReadInt16();
         short y = pvSrc.ReadInt16();
         short z = pvSrc.ReadInt16();
         World.SetLocation(x, y, z);
         player.SetLocation(x, y, z);
         player.UpdateReal();
     }
     else
     {
         pvSrc.Seek(6, SeekOrigin.Current);
     }
 }
Beispiel #20
0
 private static void MultiTarget(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     Engine.m_MultiPreview = true;
     Engine.m_MultiSerial = pvSrc.ReadInt32();
     Engine.TargetHandler = new MultiTargetHandler(Engine.m_MultiSerial);
     pvSrc.Seek(12, SeekOrigin.Current);
     Engine.m_MultiID = pvSrc.ReadInt16();
     Engine.m_xMultiOffset = pvSrc.ReadInt16();
     Engine.m_yMultiOffset = pvSrc.ReadInt16();
     Engine.m_zMultiOffset = pvSrc.ReadInt16();
     ArrayList list = new ArrayList(Engine.Multis.Load(Engine.m_MultiID));
     int count = list.Count;
     int x = 0x3e8;
     int y = 0x3e8;
     int num4 = -1000;
     int num5 = -1000;
     for (int i = 0; i < count; i++)
     {
         MultiItem item = (MultiItem) list[i];
         if (item.X < x)
         {
             x = item.X;
         }
         if (item.X > num4)
         {
             num4 = item.X;
         }
         if (item.Y < y)
         {
             y = item.Y;
         }
         if (item.Y > num5)
         {
             num5 = item.Y;
         }
     }
     Engine.m_MultiMinX = x;
     Engine.m_MultiMinY = y;
     Engine.m_MultiMaxX = num4;
     Engine.m_MultiMaxY = num5;
     ArrayList list2 = new ArrayList(list.Count);
     for (int j = x; j <= num4; j++)
     {
         for (int k = y; k <= num5; k++)
         {
             ArrayList list3 = new ArrayList(8);
             count = list.Count;
             int index = 0;
             while (index < count)
             {
                 MultiItem item2 = (MultiItem) list[index];
                 if ((item2.X == j) && (item2.Y == k))
                 {
                     list3.Add(StaticItem.Instantiate(item2.ItemID, (sbyte) item2.Z, item2.Flags));
                     list.RemoveAt(index);
                     count--;
                 }
                 else
                 {
                     index++;
                 }
             }
             list3.Sort(TileSorter.Comparer);
             count = list3.Count;
             for (index = 0; index < count; index++)
             {
                 StaticItem item3 = (StaticItem) list3[index];
                 MultiItem item4 = new MultiItem {
                     X = (short) j,
                     Y = (short) k,
                     Z = item3.Z,
                     ItemID = (short) ((item3.ID & 0x3fff) | 0x4000),
                     Flags = item3.Serial
                 };
                 list2.Add(item4);
             }
         }
     }
     Engine.m_MultiList = list2;
 }
Beispiel #21
0
 private static void ServerRelay(PacketReader pvSrc)
 {
     int serverIP = ((pvSrc.ReadByte() | (pvSrc.ReadByte() << 8)) | (pvSrc.ReadByte() << 0x10)) | (pvSrc.ReadByte() << 0x18);
     int port = pvSrc.ReadInt16();
     int gameSeed = pvSrc.ReadInt32();
     Network.Disconnect();
     if (!Network.Connect(serverIP, port))
     {
         Gumps.Desktop.Children.Clear();
         xGumps.SetVariable("FailMessage", "Couldn't connect to the game server.  Either the server is down, or an invalid host / port was specified in the server ini.");
         xGumps.Display("ConnectionFailed");
         Cursor.Hourglass = false;
     }
     else
     {
         Network.EnableUnpacking();
         Network.Send(new PGameSeed(gameSeed));
         if (Engine.m_QuickLogin)
         {
             Network.Send(new PGameLogin(gameSeed, Engine.m_QuickEntry.AccountName, Engine.m_QuickEntry.Password));
         }
         else
         {
             Network.Send(new PGameLogin(gameSeed, NewConfig.Username, NewConfig.Password));
         }
         Network.CheckCache();
     }
 }
Beispiel #22
0
 private static void Pathfind(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt16();
     int num2 = pvSrc.ReadInt16();
     int num3 = pvSrc.ReadInt16();
     if (--m_PathfindIndex == 1)
     {
         m_PathfindIndex = 20;
         Engine.AddTextMessage(string.Format("Pathfind to ({0}, {1}, {2})", num, num2, num3), Engine.GetFont(3), Hues.Load(0x3b2));
     }
 }
Beispiel #23
0
 private static void Skills_Delta(PacketReader pvSrc, bool hasCapData)
 {
     Skill skill = Engine.Skills[pvSrc.ReadInt16()];
     if (skill != null)
     {
         float num = ((float) pvSrc.ReadInt16()) / 10f;
         if (skill.Value != num)
         {
             float num2 = num - skill.Value;
             int num3 = Math.Sign(num2);
             Engine.AddTextMessage(string.Format("Your skill in {0} has {1} by {2:F1}. Is it now {3:F1}.", new object[] { skill.Name, (num2 > 0f) ? "increased" : "decreased", Math.Abs(num2), num }), Engine.GetFont(3), Hues.Load(0x59));
             skill.Value = num;
         }
         skill.Real = ((float) pvSrc.ReadInt16()) / 10f;
         skill.Lock = (SkillLock) pvSrc.ReadByte();
         if (hasCapData)
         {
             pvSrc.Seek(2, SeekOrigin.Current);
         }
         if (Engine.m_SkillsOpen && (Engine.m_SkillsGump != null))
         {
             Engine.m_SkillsGump.OnSkillChange(skill);
         }
     }
 }
Beispiel #24
0
 private static void PlayMusic(PacketReader pvSrc)
 {
     if (NewConfig.PlayMusic)
     {
         int midiID = pvSrc.ReadInt16();
         if (midiID < 0)
         {
             Music.Stop();
         }
         else
         {
             string fileName = Engine.MidiTable.Translate(midiID);
             if (fileName != null)
             {
                 Music.Play(fileName);
             }
             else
             {
                 pvSrc.Trace();
             }
         }
     }
 }
Beispiel #25
0
 private static void Target(PacketReader pvSrc)
 {
     byte num = pvSrc.ReadByte();
     int targetID = pvSrc.ReadInt32();
     byte num3 = pvSrc.ReadByte();
     int num4 = pvSrc.ReadInt32();
     short num5 = pvSrc.ReadInt16();
     short num6 = pvSrc.ReadInt16();
     byte num7 = pvSrc.ReadByte();
     sbyte num8 = pvSrc.ReadSByte();
     short num9 = pvSrc.ReadInt16();
     if (m_CancelTarget)
     {
         m_CancelTarget = false;
     }
     else if (num3 == 3)
     {
         if (Engine.TargetHandler is ServerTargetHandler)
         {
             Engine.TargetHandler.OnCancel(TargetCancelType.UserCancel);
             Engine.TargetHandler = null;
         }
     }
     else
     {
         ServerTargetHandler handler;
         m_TimeLastCast = DateTime.Now;
         Engine.m_LastTargetID = targetID;
         if ((num > 1) || (((num3 != 1) && (num3 != 2)) && (num3 != 0)))
         {
             pvSrc.Trace();
         }
         Engine.TargetHandler = handler = new ServerTargetHandler(targetID, num != 1, (ServerTargetFlags) num3);
         TargetActions.Identify();
         if (handler.Action != TargetAction.Unknown)
         {
             for (int i = 0; i < Engine.m_AutoTarget.Count; i++)
             {
                 AutoTargetSession session = (AutoTargetSession) Engine.m_AutoTarget[i];
                 if (session.m_Action == handler.Action)
                 {
                     session.m_Timer.Delete();
                     Engine.m_AutoTarget.RemoveAt(i);
                     Engine.Target(session.m_Entity);
                     break;
                 }
             }
         }
     }
 }
Beispiel #26
0
 private static void PlaySound(PacketReader pvSrc)
 {
     byte num = pvSrc.ReadByte();
     short soundID = pvSrc.ReadInt16();
     short num3 = pvSrc.ReadInt16();
     short x = pvSrc.ReadInt16();
     short y = pvSrc.ReadInt16();
     short z = pvSrc.ReadInt16();
     if (num > 1)
     {
         pvSrc.Trace();
     }
     if (soundID >= 0)
     {
         Engine.Sounds.PlaySound(soundID, x, y, z, 0.75f);
     }
 }
Beispiel #27
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 #28
0
 private static void Prompt_Unicode(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int prompt = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadInt32();
     pvSrc.Seek(4, SeekOrigin.Current);
     string text = "";
     if (pvSrc.ReadInt16() != 0)
     {
         pvSrc.Trace();
         pvSrc.Seek(-2, SeekOrigin.Current);
         text = pvSrc.ReadUnicodeLEString();
     }
     Engine.Prompt = new UnicodePrompt(serial, prompt, text);
 }
Beispiel #29
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 #30
0
 private static void MapCommand(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadByte();
     bool flag = pvSrc.ReadBoolean();
     int num3 = pvSrc.ReadInt16();
     int num4 = pvSrc.ReadInt16();
     switch (num2)
     {
         case 1:
         {
             GMapTracker.MapX = m_xMapLeft + ((int) ((m_xMapRight - m_xMapLeft) * (((double) num3) / ((double) m_xMapWidth))));
             GMapTracker.MapY = m_yMapTop + ((int) ((m_yMapBottom - m_yMapTop) * (((double) num4) / ((double) m_yMapHeight))));
             GRadar.AddTag(GMapTracker.MapX, GMapTracker.MapY, "Treasure Map");
             Engine.AddTextMessage(string.Format("Map: ({0}, {1})", GMapTracker.MapX, GMapTracker.MapY));
         }
     }
 }