Beispiel #1
0
 public GObjectProperties(int number, object o, ObjectPropertyList propList)
     : base(0, 0, 2, 20)
 {
     this.m_Object = o;
     base.m_CanDrag = false;
     this.m_Timer = new Timer(new OnTick(this.Roll_OnTick), 0);
     this.m_Timer.Start(false);
     int length = propList.Properties.Length;
     if ((length == 0) && (number != -1))
     {
         length = 1;
     }
     this.SetList(number, propList);
     this.m_WidthDuration = this.m_TotalWidth * 0.000625;
     this.m_HeightDuration = length * 0.0125;
     this.m_Sync = new TimeSync(this.m_WidthDuration + this.m_HeightDuration);
 }
Beispiel #2
0
 public AosAttributes(ObjectPropertyList props)
 {
     this.m_Props = props;
 }
Beispiel #3
0
        public void SetList(int number, ObjectPropertyList propList)
        {
            this.m_List = propList;
            base.m_Children.Clear();
            int y = 5;
            int num2 = 10;
            ObjectProperty[] properties = propList.Properties;
            if ((properties.Length == 0) && (number != -1))
            {
                properties = new ObjectProperty[] { new ObjectProperty(number, "") };
            }
            int num3 = 0;
            int index = -1;
            int num5 = 0;
            int num6 = 0;
            int num7 = 0;
            int num8 = 0;
            int num9 = 0;
            int num10 = 0;
            int num11 = 0;
            for (int i = 0; i < properties.Length; i++)
            {
                if ((properties[i].Number >= 0x102e5d) && (properties[i].Number <= 0x102e61))
                {
                    int num13 = 0;
                    try
                    {
                        num13 = int.Parse(properties[i].Arguments.Trim());
                    }
                    catch
                    {
                    }
                    switch (properties[i].Number)
                    {
                        case 0x102e5d:
                            num7 += num13;
                            break;

                        case 0x102e5e:
                            num9 += num13;
                            break;

                        case 0x102e5f:
                            num6 += num13;
                            break;

                        case 0x102e60:
                            num5 += num13;
                            break;

                        case 0x102e61:
                            num8 += num13;
                            break;
                    }
                    if (index == -1)
                    {
                        index = i;
                    }
                    num3 += num13;
                    continue;
                }
                if (properties[i].Number == 0x102e86)
                {
                    try
                    {
                        num11 = int.Parse(properties[i].Arguments.Trim());
                    }
                    catch
                    {
                    }
                }
                else if (properties[i].Number == 0x10312f)
                {
                    try
                    {
                        num10 = int.Parse(properties[i].Arguments.Trim());
                    }
                    catch
                    {
                    }
                }
            }
            if (num10 > 0)
            {
                num10 *= 100 + num11;
                num10 /= 100;
            }
            ResistInfo info = null;
            ResistInfo info2 = null;
            if (index != -1)
            {
                ArrayList list = new ArrayList(properties);
                list.Insert(index, new ObjectProperty(0xfea1b, string.Format("total resist {0}%", num3)));
                properties = (ObjectProperty[]) list.ToArray(typeof(ObjectProperty));
                info = ResistInfo.Find(properties[0].Text, ResistInfo.m_Armor);
                info2 = ResistInfo.Find(properties[0].Text, ResistInfo.m_Materials);
            }
            int num14 = -1;
            if (this.m_Object is Mobile)
            {
                Mobile mobile = (Mobile) this.m_Object;
                ArrayList equip = mobile.Equip;
                int num15 = 0;
                int num16 = 0;
                int num17 = 0;
                int num18 = 0;
                int num19 = 0;
                int num20 = 0;
                int num21 = 0;
                for (int k = 0; k < equip.Count; k++)
                {
                    EquipEntry entry = (EquipEntry) equip[k];
                    if (entry.m_Item != null)
                    {
                        Item item = entry.m_Item;
                        ObjectPropertyList propertyList = item.PropertyList;
                        if (propertyList == null)
                        {
                            item.QueryProperties();
                        }
                        else
                        {
                            foreach (ObjectProperty property in propertyList.Properties)
                            {
                                if ((property.Number >= 0x102e5d) && (property.Number <= 0x102e61))
                                {
                                    int num24 = 0;
                                    try
                                    {
                                        num24 = int.Parse(property.Arguments.Trim());
                                    }
                                    catch
                                    {
                                    }
                                    switch (property.Number)
                                    {
                                        case 0x102e5d:
                                            num17 += num24;
                                            break;

                                        case 0x102e5e:
                                            num19 += num24;
                                            break;

                                        case 0x102e5f:
                                            num16 += num24;
                                            break;

                                        case 0x102e60:
                                            num15 += num24;
                                            break;

                                        case 0x102e61:
                                            num18 += num24;
                                            break;
                                    }
                                }
                                else if (property.Number == 0x102e3d)
                                {
                                    try
                                    {
                                        num20 += int.Parse(property.Arguments.Trim());
                                    }
                                    catch
                                    {
                                    }
                                }
                                else if (property.Number == 0x102e3c)
                                {
                                    try
                                    {
                                        num21 += int.Parse(property.Arguments.Trim());
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                num14 = num15;
                if (num16 < num14)
                {
                    num14 = num16;
                }
                if (num17 < num14)
                {
                    num14 = num17;
                }
                if (num18 < num14)
                {
                    num14 = num18;
                }
                if (num19 < num14)
                {
                    num14 = num19;
                }
                if ((((num15 != 0) || (num16 != 0)) || ((num17 != 0) || (num18 != 0))) || (((num19 != 0) || (num20 != 0)) || (num21 != 0)))
                {
                    ArrayList list4 = new ArrayList(properties);
                    if ((num20 != 0) || (num21 != 0))
                    {
                        list4.Add(new ObjectProperty(0xfea1b, string.Format("FC {0}, FCR {1}", num20, num21)));
                    }
                    list4.Add(new ObjectProperty(0x102e60, num15.ToString()));
                    list4.Add(new ObjectProperty(0x102e5f, num16.ToString()));
                    list4.Add(new ObjectProperty(0x102e5d, num17.ToString()));
                    list4.Add(new ObjectProperty(0x102e61, num18.ToString()));
                    list4.Add(new ObjectProperty(0x102e5e, num19.ToString()));
                    properties = (ObjectProperty[]) list4.ToArray(typeof(ObjectProperty));
                }
            }
            if (((this.m_Object is Item) && (((Item) this.m_Object).Container is GContainer)) && ((GContainer) ((Item) this.m_Object).Container).m_TradeContainer)
            {
                ArrayList list5 = new ArrayList(properties);
                if (list5.Count > 0)
                {
                    list5[0] = new ObjectProperty(0xfea1b, "Their Offer");
                }
                Item item2 = (Item) this.m_Object;
                Item[] itemArray = item2.FindItems(new ItemIDValidator(new int[] { 0xeed, 0xeec, 0xeee }));
                int num25 = 0;
                for (int m = 0; m < itemArray.Length; m++)
                {
                    num25 += itemArray[m].Amount;
                }
                Item[] itemArray2 = item2.FindItems(new ItemIDValidator(new int[] { 0x14ef, 0x14f0 }));
                for (int n = 0; n < itemArray2.Length; n++)
                {
                    ObjectPropertyList list6 = itemArray2[n].PropertyList;
                    if (list6 == null)
                    {
                        itemArray2[n].QueryProperties();
                    }
                    else
                    {
                        bool flag = false;
                        for (int num28 = 0; num28 < list6.Properties.Length; num28++)
                        {
                            if (list6.Properties[num28].Number == 0xfe3d1)
                            {
                                flag = true;
                            }
                            else if ((list6.Properties[num28].Number == 0x102f82) && flag)
                            {
                                try
                                {
                                    num25 += int.Parse(list6.Properties[num28].Arguments.Trim());
                                }
                                catch
                                {
                                }
                                break;
                            }
                        }
                    }
                }
                list5.Add(new ObjectProperty(0xfea1b, string.Format("Total Gold: {0:N0}", num25)));
                properties = (ObjectProperty[]) list5.ToArray(typeof(ObjectProperty));
            }
            for (int j = 0; j < properties.Length; j++)
            {
                ObjectProperty property2 = properties[j];
                GLabel toAdd = new GLabel(Engine.MakeProperCase(property2.Text), Engine.DefaultFont, (j == 0) ? this.GetDefaultHue() : Hues.Bright, 5, y);
                if (property2.Number == 0x103132)
                {
                    int num30 = 0;
                    try
                    {
                        num30 = int.Parse(property2.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    Mobile player = World.Player;
                    if ((player != null) && (num30 > player.Str))
                    {
                        toAdd.Hue = Hues.Load(0x22);
                    }
                }
                else if (property2.Number == 0x103332)
                {
                    toAdd.Hue = Hues.Load(0x59);
                    toAdd.Text = "Insured";
                }
                else if (((num14 >= 0) && (property2.Number >= 0x102e5d)) && (property2.Number <= 0x102e61))
                {
                    int num31 = 0;
                    try
                    {
                        num31 = int.Parse(property2.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    if (num31 == num14)
                    {
                        if (property2.Number == 0x102e5d)
                        {
                            toAdd.Hue = Hues.Load(0x5f);
                        }
                        else if (property2.Number == 0x102e5e)
                        {
                            toAdd.Hue = Hues.Load(0x1a);
                        }
                        else if (property2.Number == 0x102e5f)
                        {
                            toAdd.Hue = Hues.Load(0x2d);
                        }
                        else if (property2.Number == 0x102e60)
                        {
                            toAdd.Hue = Hues.Load(0x482);
                        }
                        else if (property2.Number == 0x102e61)
                        {
                            toAdd.Hue = Hues.Load(70);
                        }
                    }
                }
                else if (((info != null) && (property2.Number >= 0x102e5d)) && (property2.Number <= 0x102e61))
                {
                    int num32 = 0;
                    try
                    {
                        num32 = int.Parse(property2.Arguments.Trim());
                    }
                    catch
                    {
                    }
                    int num33 = 0;
                    switch (property2.Number)
                    {
                        case 0x102e5d:
                            num33 = info.m_Cold + ((info2 == null) ? 0 : info2.m_Cold);
                            break;

                        case 0x102e5e:
                            num33 = info.m_Energy + ((info2 == null) ? 0 : info2.m_Energy);
                            break;

                        case 0x102e5f:
                            num33 = info.m_Fire + ((info2 == null) ? 0 : info2.m_Fire);
                            break;

                        case 0x102e60:
                            num33 = info.m_Physical + ((info2 == null) ? 0 : info2.m_Physical);
                            break;

                        case 0x102e61:
                            num33 = info.m_Poison + ((info2 == null) ? 0 : info2.m_Poison);
                            break;
                    }
                    int num34 = num32 - num33;
                    if (num34 > 0)
                    {
                        toAdd.Text = toAdd.Text + string.Format(" (+{0}%)", num34);
                    }
                    else if (num34 < 0)
                    {
                        toAdd.Text = toAdd.Text + string.Format(" (-{0}%)", Math.Abs(num34));
                    }
                }
                else if (property2.Number == 0x10312f)
                {
                    Mobile mobile3 = World.Player;
                    if (mobile3 != null)
                    {
                        double num35 = Math.Floor((double) (40000.0 / ((double) ((mobile3.StamCur + 100) * num10)))) / 2.0;
                        toAdd.Text = toAdd.Text + string.Format(" ({0:F1}s)", num35);
                    }
                }
                toAdd.Y -= toAdd.Image.yMin;
                toAdd.X -= toAdd.Image.xMin;
                y = (toAdd.Y + toAdd.Image.yMax) + 5;
                if ((10 + ((toAdd.Image.xMax - toAdd.Image.xMin) + 1)) > num2)
                {
                    num2 = 10 + ((toAdd.Image.xMax - toAdd.Image.xMin) + 1);
                }
                base.m_Children.Add(toAdd);
                if (j == 0)
                {
                    this.m_CompactHeight = y;
                }
            }
            this.m_TotalWidth = num2;
            this.m_TotalHeight = y;
            if (this.m_Timer == null)
            {
                this.Width = num2;
                this.Height = y;
            }
            foreach (GLabel label2 in base.m_Children.ToArray())
            {
                label2.X = ((num2 - ((label2.Image.xMax - label2.Image.xMin) + 1)) / 2) - label2.Image.xMin;
                label2.Scissor(1 - label2.X, 1 - label2.Y, this.Width - 2, this.Height - 2);
            }
        }
Beispiel #4
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);
                 }
             }
         }
     }
 }