Exemple #1
0
        /// <summary>
        /// Returns string representing GenericBuyInfo.
        /// </summary>
        /// <returns>string representing <see cref="VendorItem"/>.</returns>
        public string ConstructInfo()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("Add( new GenericBuyInfo( ");
            builder.AppendFormat(" \"#{0}\", ", NameCliloc);
            builder.AppendFormat("typeof( {0} ), ", Name);
            builder.AppendFormat("{0}, ", SellPrice);
            builder.AppendFormat("{0}, ", Amount);
            builder.AppendFormat("0x{0:X}, ", ItemID);
            builder.AppendFormat("0x{0:X} ", Hue);
            builder.AppendFormat("); // {0}", LocalizedList.Construct(NameCliloc, null));

            return(builder.ToString());
        }
Exemple #2
0
        /// <summary>
        /// Analyzes packet and saves it, if its part of the loot.
        /// </summary>
        /// <param name="packet">Packet</param>
        public void AnalyzePacket(Packet packet)
        {
            if (packet is MobileIncoming)
            {
                MobileIncoming p = (MobileIncoming)packet;

                if (!m_Mobiles.ContainsKey(p.Serial))
                {
                    Mobile m = new Mobile(p.Serial);
                    m.Body      = p.ModelId;
                    m.Hue       = (int)p.Hue;
                    m.Notoriety = (Notoriety)p.Notoriety;
                    m.Female    = (p.Flag & 0x2) == 1 ? true : false;
                    m.Blessed   = (p.Flag & 0x8) == 1 ? true : false;

                    m_Mobiles.Add(p.Serial, m);
                }
                else
                {
                    Mobile m = m_Mobiles[p.Serial];

                    m.Body      = p.ModelId;
                    m.Hue       = (int)p.Hue;
                    m.Notoriety = (Notoriety)p.Notoriety;
                    m.Female    = (p.Flag & 0x2) == 1 ? true : false;
                    m.Blessed   = (p.Flag & 0x8) == 1 ? true : false;
                }
            }

            /*else if ( packet is MobileStat )
             * {
             *      MobileStat p = (MobileStat) packet;
             *
             *      if ( m_Mobiles.ContainsKey( p.Serial ) )
             *      {
             *              Mobile m = m_Mobiles[ p.Serial ];
             *
             *              if ( m.Name == null )
             *                      m.Name = p.Name;
             *      }
             * }*/
            else if (packet is DeathAnimation)
            {
                DeathAnimation p = (DeathAnimation)packet;

                if (m_Mobiles.ContainsKey(p.Serial))
                {
                    Mobile m = m_Mobiles[p.Serial];

                    if (m.Corpse == 0)
                    {
                        m.Corpse = p.Corpse;

                        if (!m_Corpses.ContainsKey(p.Corpse))
                        {
                            m_Corpses.Add(p.Corpse, m);
                        }
                    }
                }
            }
            else if (packet is ContainerContentUpdate)
            {
                ContainerContentUpdate p = (ContainerContentUpdate)packet;

                if (m_Corpses.ContainsKey(p.ContSerial))
                {
                    Mobile m = m_Corpses[p.ContSerial];

                    if (m.CorpseContainer == 0)
                    {
                        m.CorpseContainer = p.Serial;
                        m_Filter.AddMobile(m.Name);

                        if (!m_CorpseContainers.ContainsKey(p.Serial))
                        {
                            m_CorpseContainers.Add(p.Serial, m);
                        }
                    }
                }
            }
            else if (packet is ContainerContent)
            {
                ContainerContent p = (ContainerContent)packet;

                foreach (ContainerContent.ContainedItem i in p.Items)
                {
                    if (m_CorpseContainers.ContainsKey(i.ContSerial))
                    {
                        Mobile m = m_CorpseContainers[i.ContSerial];

                        if (!m.Loot.ContainsKey(i.Serial))
                        {
                            Item item;

                            if (!m_Items.ContainsKey(i.Serial))
                            {
                                item = new Item(i.Serial);
                                m_Items.Add(i.Serial, item);
                            }
                            else
                            {
                                item = m_Items[i.Serial];
                            }

                            item.ItemID = i.ItemId;
                            item.Hue    = i.Hue;
                            item.Amount = i.Amount;

                            m.Loot.Add(i.Serial, item);
                        }
                    }
                }
            }
            else if (packet is ObjectProperties)
            {
                ObjectProperties p = (ObjectProperties)packet;

                if (m_Corpses.ContainsKey(p.Serial))
                {
                    Mobile m = m_Corpses[p.Serial];

                    if (m.CorpseName == null && p.Properties.Length > 0)
                    {
                        ObjectProperties.Property prop = p.Properties[0];
                        m.CorpseName = LocalizedList.Construct(prop.Number, prop.Arguments);
                    }
                }
                else if (m_Mobiles.ContainsKey(p.Serial))
                {
                    Mobile m = m_Mobiles[p.Serial];

                    if (p.Properties.Length > 0)
                    {
                        m.Name = LocalizedList.Construct(p.Properties[0].Number, p.Properties[0].Arguments);
                    }
                }
                else
                {
                    Item item;

                    if (!m_Items.ContainsKey(p.Serial))
                    {
                        item = new Item(p.Serial);
                        m_Items.Add(p.Serial, item);
                    }
                    else
                    {
                        item = m_Items[p.Serial];
                    }

                    if (item.Name != null)
                    {
                        return;
                    }

                    for (int i = 0; i < p.Properties.Length; i++)
                    {
                        ObjectProperties.Property prop = p.Properties[i];

                        item.ParseProperty(i, prop.Number, prop.Arguments);
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Analyzes packet and saves it, if it is related to vendors.
        /// </summary>
        /// <param name="packet">Packet.</param>
        public void AnalyzePacket(Packet packet)
        {
            if (packet is MobileIncoming)
            {
                MobileIncoming p = (MobileIncoming)packet;

                if (!m_Vendors.ContainsKey(p.Serial) && p.Notoriety == Notoriety.Invulnerable)
                {
                    Vendor m = new Vendor(p.Serial);
                    m.Body      = p.ModelId;
                    m.Hue       = (int)p.Hue;
                    m.Notoriety = (Notoriety)p.Notoriety;
                    m.Female    = (p.Flag & 0x2) == 1 ? true : false;
                    m.Blessed   = (p.Flag & 0x8) == 1 ? true : false;

                    foreach (MobileIncoming.EquipInfo i in p.Equipment)
                    {
                        Item item = new Item(i.Serial);
                        item.ItemID = i.ItemId;
                        item.Layer  = (Layer)i.Layer;
                        item.Hue    = i.Hue;
                        m.Items.Add(item);
                        m_Items.Add(i.Serial, item);

                        if (item.Layer == Layer.ShopBuy)
                        {
                            m_Shops.Add(item.Serial, m);
                        }
                    }

                    m_Vendors.Add(p.Serial, m);
                }
            }
            else if (packet is ContainerContent)
            {
                ContainerContent p = (ContainerContent)packet;

                foreach (ContainerContent.ContainedItem i in p.Items)
                {
                    if (m_Shops.ContainsKey(i.ContSerial))
                    {
                        Vendor m = m_Shops[i.ContSerial];

                        if (!m.Shop.ContainsKey(i.Serial))
                        {
                            VendorItem item = new VendorItem(i.Serial);

                            if (!m_Items.ContainsKey(i.Serial))
                            {
                                m_Items.Add(i.Serial, item);
                            }

                            item.ItemID = i.ItemId;
                            item.Hue    = i.Hue;
                            item.Amount = i.Amount;

                            m.Shop.Add(i.Serial, item);
                        }
                    }
                }
            }
            else if (packet is BuyInfo)
            {
                BuyInfo p = (BuyInfo)packet;

                if (m_Shops.ContainsKey(p.VendorSerial))
                {
                    m_Prices  = new int[p.ItemCount];
                    m_Counter = 0;

                    for (int i = 0; i < p.ItemCount; i++)
                    {
                        m_Prices[i] = p.List[i].Price;
                    }
                }
            }
            else if (packet is ObjectProperties)
            {
                ObjectProperties p = (ObjectProperties)packet;

                if (m_Items.ContainsKey(p.Serial))
                {
                    Item item = m_Items[p.Serial];

                    if (item.Name != null)
                    {
                        return;
                    }

                    for (int i = 0; i < p.Properties.Length; i++)
                    {
                        ObjectProperties.Property prop = p.Properties[i];
                        item.ParseProperty(i, prop.Number, prop.Arguments);
                    }

                    if (item is VendorItem && m_Prices != null && m_Counter < m_Prices.Length)
                    {
                        ((VendorItem)item).SellPrice = m_Prices[m_Counter++];
                    }
                }
                else if (m_Vendors.ContainsKey(p.Serial))
                {
                    Mobile m = m_Vendors[p.Serial];

                    if (m.Name == null && p.Properties.Length > 0)
                    {
                        m.Name = LocalizedList.Construct(p.Properties[0].Number, p.Properties[0].Arguments);
                    }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Parses and adds a property to <see cref="Properties"/> list.
        /// </summary>
        /// <param name="index">Number of the property.</param>
        /// <param name="number">Localized number of this property.</param>
        /// <param name="args">Arguments for the <paramref name="number"/>.</param>
        public void ParseProperty(int index, uint number, string args)
        {
            string prop = LocalizedList.Construct(number, args);

            if (index == 0)
            {
                m_Name = prop;

                if (m_Amount > 1)
                {
                    m_Name = m_Name.Replace(m_Amount.ToString() + " ", String.Empty);
                }

                if (args != null)
                {
                    int s = args.IndexOf('#');

                    if (s >= 0)
                    {
                        int e = args.IndexOf('\t', s);

                        if (e < 0)
                        {
                            e = args.Length;
                        }

                        UInt32.TryParse(args.Substring(s + 1, e - s - 1), out m_NameCliloc);
                    }
                    else
                    {
                        m_NameCliloc = number;
                    }
                }
            }

            if (prop.Contains(" slayer"))
            {
                if (m_Properties.ContainsKey(ItemProperty.Slayer1))
                {
                    m_Properties.Add(ItemProperty.Slayer2, prop);
                }
                else
                {
                    m_Properties.Add(ItemProperty.Slayer1, prop);
                }
            }

            switch (number)
            {
            case 1072225:
            case 1072788:
            case 1072789: Int32.TryParse(args, out m_Weight); break;

            case 1062412:
            case 1062413:
            case 1062414:
            case 1062415:
            case 1062416: AddProperty(ItemProperty.Poison, args); break;

            case 1060445: AddProperty(ItemProperty.ColdResist, args); break;

            case 1060446: AddProperty(ItemProperty.EnergyResist, args); break;

            case 1060447: AddProperty(ItemProperty.FireResist, args); break;

            case 1060448: AddProperty(ItemProperty.PhysicalResist, args); break;

            case 1060449: AddProperty(ItemProperty.PoisonResist, args); break;

            case 1060400: AddProperty(ItemProperty.UseBestSkill, args); break;

            case 1060401: AddProperty(ItemProperty.WeaponDamageInc, args); break;

            case 1060408: AddProperty(ItemProperty.DefendChance, args); break;

            case 1060411: AddProperty(ItemProperty.EnhancePotions, args); break;

            case 1060412: AddProperty(ItemProperty.CastRecovery, args); break;

            case 1060413: AddProperty(ItemProperty.CastSpeed, args); break;

            case 1060415: AddProperty(ItemProperty.AttackChance, args); break;

            case 1060416: AddProperty(ItemProperty.HitColdArea, args); break;

            case 1060417: AddProperty(ItemProperty.HitDispel, args); break;

            case 1060418: AddProperty(ItemProperty.HitEnergyArea, args); break;

            case 1060419: AddProperty(ItemProperty.HitFireArea, args); break;

            case 1060420: AddProperty(ItemProperty.HitFireball, args); break;

            case 1060421: AddProperty(ItemProperty.HitHarm, args); break;

            case 1060422: AddProperty(ItemProperty.HitLeechHits, args); break;

            case 1060423: AddProperty(ItemProperty.HitLightning, args); break;

            case 1060424: AddProperty(ItemProperty.HitLowerAttack, args); break;

            case 1060425: AddProperty(ItemProperty.HitLowerDefend, args); break;

            case 1060426: AddProperty(ItemProperty.HitMagicArrow, args); break;

            case 1060427: AddProperty(ItemProperty.HitLeechMana, args); break;

            case 1060428: AddProperty(ItemProperty.HitPhysicalArea, args); break;

            case 1060429: AddProperty(ItemProperty.HitPoisonArea, args); break;

            case 1060430: AddProperty(ItemProperty.HitLeechStam, args); break;

            case 1060409: AddProperty(ItemProperty.BonusDex, args); break;

            case 1060431: AddProperty(ItemProperty.BonusHits, args); break;

            case 1060432: AddProperty(ItemProperty.BonusInt, args); break;

            case 1060433: AddProperty(ItemProperty.LowerManaCost, args); break;

            case 1060434: AddProperty(ItemProperty.LowerRegCost, args); break;

            case 1060435: AddProperty(ItemProperty.LowerStatReq, args); break;

            case 1060436: AddProperty(ItemProperty.Luck, args); break;

            case 1060438: AddProperty(ItemProperty.MageWeapon, args); break;

            case 1060439: AddProperty(ItemProperty.BonusMana, args); break;

            case 1060440: AddProperty(ItemProperty.RegenMana, args); break;

            case 1060441: AddProperty(ItemProperty.NightSight); break;

            case 1060442: AddProperty(ItemProperty.ReflectPhysical, args); break;

            case 1060443: AddProperty(ItemProperty.RegenStam, args); break;

            case 1060444: AddProperty(ItemProperty.RegenHits, args); break;

            case 1060410: AddProperty(ItemProperty.DurabilityBonus, args); break;

            case 1060450: AddProperty(ItemProperty.SelfRepair, args); break;

            case 1060482: AddProperty(ItemProperty.SpellChanneling); break;

            case 1060483: AddProperty(ItemProperty.SpellDamage, args); break;

            case 1060484: AddProperty(ItemProperty.BonusStam, args); break;

            case 1060485: AddProperty(ItemProperty.BonusStr, args); break;

            case 1060486: AddProperty(ItemProperty.WeaponSpeedInc, args); break;

            case 1060403: AddProperty(ItemProperty.PhysicalDamage, args); break;

            case 1060405: AddProperty(ItemProperty.FireDamage, args); break;

            case 1060404: AddProperty(ItemProperty.ColdDamage, args); break;

            case 1060406: AddProperty(ItemProperty.PoisonDamage, args); break;

            case 1060407: AddProperty(ItemProperty.EnergyDamage, args); break;

            case 1079978: AddProperty(ItemProperty.DirectDamage, args); break;

            case 1072846: AddProperty(ItemProperty.ChaosDamage, args); break;

            case 1061168: AddTwoProperties(ItemProperty.MinWeaponDamage, ItemProperty.MaxWeaponDamage, args); break;

            case 1061169: AddProperty(ItemProperty.WeaponRange, args); break;

            case 1061167: AddProperty(ItemProperty.WeaponSpeed, args); break;

            case 1061170: AddProperty(ItemProperty.StrRequirement, args); break;

            case 1061171: AddProperty(ItemProperty.OneHanded); break;

            case 1061824: AddProperty(ItemProperty.TwoHanded); break;

            case 1061172: AddProperty(ItemProperty.SkillSwords, args); break;

            case 1061173: AddProperty(ItemProperty.SkillMacing, args); break;

            case 1061174: AddProperty(ItemProperty.SkillFencing, args); break;

            case 1061175: AddProperty(ItemProperty.SkillArchery, args); break;

            case 1060639: AddTwoProperties(ItemProperty.MinDurability, ItemProperty.MaxDurability, args); break;

            case 1038021: AddProperty(ItemProperty.Blessed); break;

            case 1049643: AddProperty(ItemProperty.Cursed); break;

            case 1072792: AddProperty(ItemProperty.Blanaced); break;

            case 1060584: AddProperty(ItemProperty.UsesRemaining, args); break;

            case 1075086: AddProperty(ItemProperty.ElvesOnly); break;

            case 1060451: AddTwoProperties(ItemProperty.SkillBonus1, ItemProperty.SkillValue1, args); break;

            case 1060452: AddTwoProperties(ItemProperty.SkillBonus2, ItemProperty.SkillValue2, args); break;

            case 1060453: AddTwoProperties(ItemProperty.SkillBonus3, ItemProperty.SkillValue3, args); break;

            case 1060454: AddTwoProperties(ItemProperty.SkillBonus4, ItemProperty.SkillValue4, args); break;

            case 1060455: AddTwoProperties(ItemProperty.SkillBonus5, ItemProperty.SkillValue5, args); break;

            case 1060437: AddProperty(ItemProperty.MageArmor); break;
            }
        }