Пример #1
0
 private static void DragItem(PacketReader pvSrc)
 {
     int itemID = pvSrc.ReadInt16();
     if (pvSrc.ReadByte() != 0)
     {
         pvSrc.Trace();
     }
     ushort hue = pvSrc.ReadUInt16();
     int num3 = pvSrc.ReadUInt16();
     int sourceSerial = pvSrc.ReadInt32();
     int xSource = pvSrc.ReadInt16();
     int ySource = pvSrc.ReadInt16();
     int zSource = pvSrc.ReadSByte();
     int targetSerial = pvSrc.ReadInt32();
     int xTarget = pvSrc.ReadInt16();
     int yTarget = pvSrc.ReadInt16();
     int zTarget = pvSrc.ReadSByte();
     bool shouldDouble = false;
     shouldDouble = Map.m_ItemFlags[itemID & 0x3fff][TileFlag.Generic] && (num3 > 1);
     if ((itemID >= 0xeea) && (itemID <= 0xef2))
     {
         int num12 = (itemID - 0xeea) / 3;
         num12 *= 3;
         num12 += 0xeea;
         shouldDouble = false;
         if (num3 <= 1)
         {
             itemID = num12;
         }
         else if ((num3 >= 2) && (num3 <= 5))
         {
             itemID = num12 + 1;
         }
         else
         {
             itemID = num12 + 2;
         }
     }
     Engine.Effects.Add(new DragEffect(itemID, sourceSerial, xSource, ySource, zSource, targetSerial, xTarget, yTarget, zTarget, Hues.GetItemHue(itemID, hue), shouldDouble));
 }
Пример #2
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();
        }
Пример #3
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);
     }
 }
Пример #4
0
 private static void WarmodeStatus(PacketReader pvSrc)
 {
     bool flag = pvSrc.ReadBoolean();
     if (pvSrc.ReadByte() == 0)
     {
         byte num = pvSrc.ReadByte();
         if (((num != 0x20) && (num != 50)) && (num != 0))
         {
             pvSrc.Trace();
         }
         else if (pvSrc.ReadByte() != 0)
         {
             pvSrc.Trace();
         }
     }
     Mobile player = World.Player;
     if (player != null)
     {
         player.Flags[MobileFlag.Warmode] = flag;
         if (!flag)
         {
             Engine.m_Highlight = null;
         }
         if (player.Paperdoll != null)
         {
             Gumps.OpenPaperdoll(player, player.PaperdollName, player.PaperdollCanDrag);
         }
     }
     Gumps.Invalidate();
     Engine.Redraw();
 }
Пример #5
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.");
 }
Пример #6
0
        private static void Skills(PacketReader pvSrc)
        {
            switch (pvSrc.ReadByte())
            {
                case 0:
                    pvSrc.ReturnName = "Skills (Absolute)";
                    Skills_Absolute(pvSrc, false);
                    return;

                case 2:
                    pvSrc.ReturnName = "Skills (Absolute, Capped)";
                    Skills_Absolute(pvSrc, true);
                    return;

                case 0xdf:
                    pvSrc.ReturnName = "Skills (Delta, Capped)";
                    Skills_Delta(pvSrc, true);
                    return;

                case 0xff:
                    pvSrc.ReturnName = "Skills (Delta)";
                    Skills_Delta(pvSrc, false);
                    return;
            }
            pvSrc.Trace();
        }
Пример #7
0
 private static void Trace(PacketReader pvSrc)
 {
     pvSrc.Trace();
 }
Пример #8
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);
        }
Пример #9
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();
     }
 }
Пример #10
0
 private static void ItemPickupFailed(PacketReader pvSrc)
 {
     int index = pvSrc.ReadByte();
     if (index < m_IPFReason.Length)
     {
         Engine.AddTextMessage(m_IPFReason[index], Engine.GetFont(3), Hues.Default);
     }
     else if ((index != 5) && (index != 0xff))
     {
         pvSrc.Trace();
     }
     Item item = PPickupItem.m_Item;
     if (item != null)
     {
         if (((Gumps.Drag != null) && (Gumps.Drag.GetType() == typeof(GDraggedItem))) && (((GDraggedItem) Gumps.Drag).Item == item))
         {
             Gumps.Destroy(Gumps.Drag);
         }
         RestoreInfo restoreInfo = item.RestoreInfo;
         if (restoreInfo != null)
         {
             if (item.InWorld)
             {
                 Map.RemoveItem(item);
                 item.InWorld = false;
             }
             else if (item.IsEquip)
             {
                 item.RemoveEquip();
             }
             else if (item.Parent != null)
             {
                 item.Parent.RemoveItem(item);
             }
             item.Visible = true;
             if (restoreInfo.m_InWorld)
             {
                 item.SetLocation((short) restoreInfo.m_X, (short) restoreInfo.m_Y, (short) restoreInfo.m_Z);
                 item.InWorld = true;
                 item.Update();
             }
             else if (restoreInfo.m_Parent != null)
             {
                 restoreInfo.m_Parent.AddItem(item);
             }
             else if (restoreInfo.m_IsEquip && (restoreInfo.m_EquipEntry != null))
             {
                 if (restoreInfo.m_EquipParent is Mobile)
                 {
                     Mobile equipParent = (Mobile) restoreInfo.m_EquipParent;
                     equipParent.AddEquip(restoreInfo.m_EquipEntry);
                     if (equipParent.Paperdoll != null)
                     {
                         Gumps.OpenPaperdoll(equipParent, equipParent.PaperdollName, equipParent.PaperdollCanDrag);
                     }
                 }
                 else if (restoreInfo.m_EquipParent is Item)
                 {
                     ((Item) restoreInfo.m_EquipParent).Equip.Add(restoreInfo.m_EquipEntry);
                 }
                 item.IsEquip = true;
             }
         }
         item.RestoreInfo = null;
     }
 }
Пример #11
0
 private static void LoginConfirm(PacketReader pvSrc)
 {
     World.Clear();
     Map.Invalidate();
     Mobile mobile = World.WantMobile(pvSrc.ReadInt32());
     World.Serial = mobile.Serial;
     Macros.Load();
     if (pvSrc.ReadInt32() != 0)
     {
         pvSrc.Trace();
     }
     mobile.Body = pvSrc.ReadInt16();
     short x = pvSrc.ReadInt16();
     short y = pvSrc.ReadInt16();
     short z = pvSrc.ReadInt16();
     World.SetLocation(x, y, z);
     mobile.SetLocation(x, y, z);
     mobile.UpdateReal();
     mobile.Direction = pvSrc.ReadByte();
     mobile.Visible = true;
     mobile.Update();
     Network.Send(new PQuerySkills());
     Network.Send(new PClientVersion("4.0.8b"));
     Network.Send(new PScreenSize());
     Network.Send(new PSetLanguage());
     Network.Send(new PUnknownLogin());
     if (NewConfig.SendUpdateRange)
     {
         Network.Send(new PInitialUpdateRange());
     }
     Party.State = PartyState.Alone;
 }
Пример #12
0
 private static void FightOccurring(PacketReader pvSrc)
 {
     if (pvSrc.ReadByte() != 0)
     {
         pvSrc.Trace();
     }
     Mobile mobile = World.FindMobile(pvSrc.ReadInt32());
     Mobile mobile2 = World.FindMobile(pvSrc.ReadInt32());
     if ((mobile != null) && !mobile.Player)
     {
         mobile.QueryStats();
     }
     if ((mobile2 != null) && !mobile2.Player)
     {
         mobile2.QueryStats();
     }
 }
Пример #13
0
 private static void EquipItem(PacketReader pvSrc)
 {
     Item item = World.WantItem(pvSrc.ReadInt32());
     int itemID = pvSrc.ReadInt16() & 0x3fff;
     item.Query();
     if (pvSrc.ReadByte() != 0)
     {
         pvSrc.Trace();
     }
     Layer layer = (Layer) pvSrc.ReadByte();
     Mobile mobile = World.FindMobile(pvSrc.ReadInt32());
     if (mobile != null)
     {
         short animation;
         int hue = pvSrc.ReadUInt16();
         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);
         }
         Engine.ItemArt.Translate(ref itemID, ref hue);
         item.ID = (short) itemID;
         item.Hue = (ushort) hue;
         item.IsEquip = true;
         item.EquipParent = mobile;
         if (layer == Layer.Mount)
         {
             animation = (short) Engine.m_Animations.ConvertMountItemToBody(itemID);
         }
         else
         {
             animation = Map.GetAnimation(itemID);
         }
         mobile.AddEquip(new EquipEntry(item, animation, layer));
     }
 }
Пример #14
0
        private static void Effect(PacketReader pvSrc, bool hasHueData, bool hasParticleData)
        {
            Client.Effect effect;
            int num = pvSrc.ReadByte();
            int source = pvSrc.ReadInt32();
            int target = pvSrc.ReadInt32();
            int itemID = pvSrc.ReadInt16();
            int xSource = pvSrc.ReadInt16();
            int ySource = pvSrc.ReadInt16();
            int zSource = pvSrc.ReadSByte();
            int xTarget = pvSrc.ReadInt16();
            int yTarget = pvSrc.ReadInt16();
            int zTarget = pvSrc.ReadSByte();
            int num11 = pvSrc.ReadByte();
            int duration = pvSrc.ReadByte();
            int num13 = pvSrc.ReadByte();
            int num14 = pvSrc.ReadByte();
            bool flag = !pvSrc.ReadBoolean();
            bool flag2 = pvSrc.ReadBoolean();
            int hue = hasHueData ? pvSrc.ReadInt32() : 0;
            int num16 = hasHueData ? pvSrc.ReadInt32() : 0;
            int num17 = hasParticleData ? pvSrc.ReadInt16() : 0;
            int num18 = hasParticleData ? pvSrc.ReadInt16() : 0;
            int num19 = hasParticleData ? pvSrc.ReadInt16() : 0;
            int num20 = hasParticleData ? pvSrc.ReadInt32() : 0;
            EffectLayer layer = hasParticleData ? ((EffectLayer) pvSrc.ReadByte()) : EffectLayer.Head;
            int num21 = hasParticleData ? pvSrc.ReadInt16() : 0;
            if ((((((num17 == 0x139d) || (num17 == 0x13bc)) || ((num17 == 0x13b4) || (num17 == 0xbe3))) || (((num17 == 0x251e) || (num17 == 0x1395)) || ((num == 1) || (num17 == 0xbbe)))) || (num17 == 0x13ae)) || (itemID == 0x113a))
            {
                m_EffectTime = DateTime.Now;
            }
            if ((itemID & 0x3fff) > 1)
            {
                if ((num13 > 1) || (num14 != 0))
                {
                    pvSrc.Trace();
                }
                if (hue > 0)
                {
                    hue++;
                }
                switch (num)
                {
                    case 0:
                        effect = new MovingEffect(source, target, xSource, ySource, zSource, xTarget, yTarget, zTarget, itemID, Hues.GetItemHue(itemID, hue));
                        ((MovingEffect) effect).m_RenderMode = num16;
                        if (flag2)
                        {
                            effect.Children.Add(new AnimatedItemEffect(target, xTarget, yTarget, zTarget, 0x36cb, Hues.GetItemHue(0x36cb, hue), duration));
                        }
                        goto Label_0274;

                    case 1:
                        effect = new LightningEffect(source, xSource, ySource, zSource, Hues.Load(hue ^ 0x8000));
                        goto Label_0274;

                    case 2:
                        effect = new AnimatedItemEffect(xSource, ySource, zSource, itemID, Hues.GetItemHue(itemID, hue), duration);
                        ((AnimatedItemEffect) effect).m_RenderMode = num16;
                        goto Label_0274;

                    case 3:
                        effect = new AnimatedItemEffect(source, xSource, ySource, zSource, itemID, Hues.GetItemHue(itemID, hue), duration);
                        ((AnimatedItemEffect) effect).m_RenderMode = num16;
                        goto Label_0274;
                }
                pvSrc.Trace();
            }
            return;
            Label_0274:
            Engine.Effects.Add(effect);
        }
Пример #15
0
        private static void SecureTrade(PacketReader pvSrc)
        {
            byte num = pvSrc.ReadByte();
            int serial = pvSrc.ReadInt32();
            switch (num)
            {
                case 0:
                    pvSrc.ReturnName = "Initiate Secure Trade";
                    SecureTrade_Open(serial, pvSrc);
                    break;

                case 1:
                    pvSrc.ReturnName = "Close Secure Trade";
                    SecureTrade_Close(serial, pvSrc);
                    break;

                case 2:
                    pvSrc.ReturnName = "Update Secure Trade Status";
                    SecureTrade_Check(serial, pvSrc);
                    break;

                default:
                    pvSrc.Trace();
                    break;
            }
        }
Пример #16
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;
     }
 }
Пример #17
0
        private static void Sequence(PacketReader pvSrc)
        {
            byte num = pvSrc.ReadByte();
            if (num > 1)
            {
                pvSrc.Trace();
            }
            else
            {
                switch (num)
                {
                    case 0:
                        if (Engine.Effects.Locked)
                        {
                            pvSrc.Trace();
                        }
                        else
                        {
                            Engine.Effects.Lock();
                        }
                        break;

                    case 1:
                        if (!Engine.Effects.Locked)
                        {
                            pvSrc.Trace();
                        }
                        else
                        {
                            Engine.Effects.Unlock();
                        }
                        break;
                }
            }
        }
Пример #18
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();
 }
Пример #19
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;
                 }
             }
         }
     }
 }
Пример #20
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();
             }
         }
     }
 }
Пример #21
0
 private static void VersionRequest_Assist(PacketReader pvSrc)
 {
     pvSrc.Trace();
     Engine.AddTextMessage("Server is requesting the assist version.", Engine.GetFont(3), Hues.Load(0x22));
     Network.Send(new PAssistVersion(pvSrc.ReadInt32(), "4.0.8b"));
 }
Пример #22
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);
     }
 }
Пример #23
0
        private static void BulletinBoard(PacketReader pvSrc)
        {
            switch (pvSrc.ReadByte())
            {
                case 0:
                    BulletinBoard_Display(pvSrc);
                    break;

                case 1:
                    BulletinBoard_SetHeader(pvSrc);
                    break;

                case 2:
                    BulletinBoard_SetBody(pvSrc);
                    break;

                default:
                    pvSrc.Trace();
                    break;
            }
        }
Пример #24
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);
 }
Пример #25
0
 private static void CloseShopDialog(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     if (pvSrc.ReadByte() != 0)
     {
         pvSrc.Trace();
     }
     Gumps.Destroy(Gumps.FindGumpByGUID(string.Format("GSellGump-{0}", num)));
     Gumps.Destroy(Gumps.FindGumpByGUID(string.Format("GBuyGump-{0}", num)));
 }
Пример #26
0
 private static void PropertyListContent(PacketReader pvSrc)
 {
     int num = pvSrc.ReadUInt16();
     int serial = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadByte();
     int num4 = pvSrc.ReadByte();
     int number = pvSrc.ReadInt32();
     if (((num != 1) || (num3 != 0)) || (num4 != 0))
     {
         pvSrc.Trace();
     }
     ArrayList dataStore = Engine.GetDataStore();
     while (true)
     {
         int num6 = pvSrc.ReadInt32();
         if (num6 == 0)
         {
             break;
         }
         int length = pvSrc.ReadUInt16();
         string arguments = Encoding.Unicode.GetString(pvSrc.ReadBytes(length));
         dataStore.Add(new ObjectProperty(num6, arguments));
     }
     ObjectPropertyList list2 = new ObjectPropertyList(serial, number, (ObjectProperty[]) dataStore.ToArray(typeof(ObjectProperty)));
     Engine.ReleaseDataStore(dataStore);
     Item item = World.FindItem(serial);
     if (item != null)
     {
         item.PropertyID = number;
     }
     Mobile mobile = World.FindMobile(serial);
     if (mobile != null)
     {
         mobile.PropertyID = number;
     }
     if (item != null)
     {
         object parent = item;
         bool flag = false;
         while (parent != null)
         {
             if (!(parent is Item))
             {
                 break;
             }
             Item item2 = (Item) parent;
             if (((item2.Container != null) && (item2.Container.Gump is GContainer)) && ((GContainer) item2.Container.Gump).m_TradeContainer)
             {
                 flag = true;
             }
             if (flag)
             {
                 break;
             }
             parent = item2.Parent;
         }
         if (flag && (parent is Item))
         {
             Item item3 = (Item) parent;
             if ((item3.Container != null) && (item3.Container.Gump.Tooltip is ItemTooltip))
             {
                 GObjectProperties gump = ((ItemTooltip) item3.Container.Gump.Tooltip).Gump as GObjectProperties;
                 if (gump != null)
                 {
                     gump.SetList(0xf9060 + (item3.ID & 0x3fff), item3.PropertyList);
                 }
             }
         }
     }
 }
Пример #27
0
 private static void Command_Damage(PacketReader pvSrc)
 {
     if (pvSrc.ReadByte() != 1)
     {
         pvSrc.Trace();
     }
     Mobile m = World.FindMobile(pvSrc.ReadInt32());
     if (m != null)
     {
         int damage = pvSrc.ReadByte();
         if (damage > 0)
         {
             Gumps.Desktop.Children.Add(new GDamageLabel(damage, m));
         }
     }
 }
Пример #28
0
 private static void Season(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     int num2 = pvSrc.ReadByte();
     if (num > 4)
     {
         pvSrc.Trace();
     }
     else if (num2 > 1)
     {
         pvSrc.Trace();
     }
 }
Пример #29
0
 private static void Command_ExtendedStatus(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     Mobile mobile = World.FindMobile(pvSrc.ReadInt32());
     if (mobile != null)
     {
         mobile.Bonded = pvSrc.ReadBoolean();
         if (num >= 2)
         {
             int num2 = pvSrc.ReadByte();
             if (num >= 3)
             {
                 pvSrc.Trace();
             }
         }
     }
 }
Пример #30
0
 private static void Command_SpellbookContent(PacketReader pvSrc)
 {
     if (pvSrc.ReadInt16() != 1)
     {
         pvSrc.Trace();
     }
     Item container = World.FindItem(pvSrc.ReadInt32());
     if ((container != null) && container.QueueOpenSB)
     {
         container.QueueOpenSB = false;
         container.SpellbookGraphic = pvSrc.ReadInt16();
         container.SpellbookOffset = pvSrc.ReadInt16();
         for (int i = 0; i < 8; i++)
         {
             int num3 = pvSrc.ReadByte();
             for (int j = 0; j < 8; j++)
             {
                 container.SetSpellContained((i * 8) + j, (num3 & (((int) 1) << j)) != 0);
             }
         }
         if (!container.OpenSB)
         {
             container.OpenSB = true;
             Spells.OpenSpellbook(container);
         }
         else
         {
             Gump gump = Gumps.FindGumpByGUID(string.Format("Spellbook Icon #{0}", container.Serial));
             if (gump != null)
             {
                 ((GSpellbookIcon) gump).OnDoubleClick(gump.Width / 2, gump.Height / 2);
             }
         }
     }
 }