Пример #1
0
        public static void Initialize()
        {
            try
            {
                StringList = new Ultima.StringList("enu");
            }
            catch { }

            CommandSystem.Register("GetOPLString", AccessLevel.Administrator, e =>
            {
                e.Mobile.BeginTarget(-1, false, TargetFlags.None, (m, targeted) =>
                {
                    if (targeted is Item)
                    {
                        Console.WriteLine(GetItemName((Item)targeted));
                        e.Mobile.SendMessage(GetItemName((Item)targeted));
                    }
                });
            });

            Categories = new List <SearchCategory>();
            Contexts   = new Dictionary <PlayerMobile, SearchCriteria>();

            Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
            {
                SearchCategory price         = new SearchCategory(Category.PriceRange);
                SearchCategory equipment     = new SearchCategory(Category.Equipment);
                SearchCategory misc          = new SearchCategory(Category.Misc);
                SearchCategory combat        = new SearchCategory(Category.Combat);
                SearchCategory casting       = new SearchCategory(Category.Casting);
                SearchCategory damagetype    = new SearchCategory(Category.DamageType);
                SearchCategory hitspell      = new SearchCategory(Category.HitSpell);
                SearchCategory hitarea       = new SearchCategory(Category.HitArea);
                SearchCategory resists       = new SearchCategory(Category.Resists);
                SearchCategory stats         = new SearchCategory(Category.Stats);
                SearchCategory slayer1       = new SearchCategory(Category.Slayer1);
                SearchCategory slayer2       = new SearchCategory(Category.Slayer2);
                SearchCategory slayer3       = new SearchCategory(Category.Slayer3);
                SearchCategory requiredskill = new SearchCategory(Category.RequiredSkill);
                SearchCategory skill1        = new SearchCategory(Category.Skill1);
                SearchCategory skill2        = new SearchCategory(Category.Skill2);
                SearchCategory skill3        = new SearchCategory(Category.Skill3);
                SearchCategory skill4        = new SearchCategory(Category.Skill4);
                SearchCategory skill5        = new SearchCategory(Category.Skill5);
                SearchCategory skill6        = new SearchCategory(Category.Skill6);
                SearchCategory sort          = new SearchCategory(Category.Sort);

                object[] enums = new object[15];
                int[] labels   = new int[15];
                int index      = 0;

                foreach (int i in Enum.GetValues(typeof(Misc)))
                {
                    enums[index]  = (Misc)i;
                    labels[index] = i;
                    index++;
                }

                misc.Register(enums, labels);
                misc.Register(new object[] { AosAttribute.EnhancePotions, AosArmorAttribute.LowerStatReq, AosAttribute.Luck, AosAttribute.ReflectPhysical, AosArmorAttribute.SelfRepair });
                misc.Register(new object[] { "ArtifactRarity" }, new int[] { 1154693 });

                equipment.Register(new object[] { Layer.Shoes, Layer.Pants, Layer.Shirt, Layer.Helm, Layer.Gloves, Layer.Ring, Layer.Talisman, Layer.Neck, Layer.Waist, Layer.InnerTorso,
                                                  Layer.Bracelet, Layer.MiddleTorso, Layer.Earrings, Layer.Arms, Layer.Cloak, Layer.OuterTorso, Layer.OuterLegs },
                                   new int[] { 1154602, 1154603, 1154604, 1154605, 1154606, 1154607, 1154608, 1154609, 1154611, 1154612, 1154613, 1154616, 1154617, 1154618, 1154619, 1154621, 1154622 });

                combat.Register(new object[] { AosAttribute.WeaponDamage, AosAttribute.DefendChance, AosAttribute.AttackChance, AosAttribute.WeaponSpeed, AosArmorAttribute.SoulCharge,
                                               AosWeaponAttribute.UseBestSkill, AosWeaponAttribute.ReactiveParalyze, /*TODO: Assassin Honed*/ "SearingWeapon", AosWeaponAttribute.BloodDrinker, AosWeaponAttribute.BattleLust,
                                               AosAttribute.BalancedWeapon, SAAbsorptionAttribute.CastingFocus, SAAbsorptionAttribute.EaterFire, SAAbsorptionAttribute.EaterCold,
                                               SAAbsorptionAttribute.EaterPoison, SAAbsorptionAttribute.EaterEnergy, SAAbsorptionAttribute.EaterDamage });

                casting.Register(new object[] { SAAbsorptionAttribute.ResonanceFire, SAAbsorptionAttribute.ResonanceCold, SAAbsorptionAttribute.ResonancePoison, SAAbsorptionAttribute.ResonanceEnergy,
                                                SAAbsorptionAttribute.ResonanceKinetic, AosAttribute.SpellDamage, SAAbsorptionAttribute.CastingFocus, AosAttribute.CastRecovery, AosAttribute.CastSpeed,
                                                AosAttribute.LowerManaCost, AosAttribute.LowerRegCost, AosWeaponAttribute.MageWeapon, AosArmorAttribute.MageArmor, AosAttribute.SpellChanneling });

                damagetype.Register(new object[] { AosElementAttribute.Physical, AosElementAttribute.Fire, AosElementAttribute.Cold, AosElementAttribute.Poison, AosElementAttribute.Energy },
                                    new int[] { 1151800, 1151801, 1151802, 1151803, 1151804 });

                hitspell.Register(new object[] { AosWeaponAttribute.HitDispel, AosWeaponAttribute.HitFireball, AosWeaponAttribute.HitHarm, AosWeaponAttribute.HitCurse, AosWeaponAttribute.HitLeechHits,
                                                 AosWeaponAttribute.HitLightning, "WeaponVelocity", AosWeaponAttribute.HitLowerAttack, AosWeaponAttribute.HitLowerDefend, AosWeaponAttribute.HitMagicArrow,
                                                 AosWeaponAttribute.HitLeechMana, AosWeaponAttribute.HitLeechStam, AosWeaponAttribute.HitFatigue, AosWeaponAttribute.HitManaDrain, AosWeaponAttribute.SplinteringWeapon /*TODO: Bane*/ });

                hitarea.Register(new object[] { AosWeaponAttribute.HitColdArea, AosWeaponAttribute.HitEnergyArea, AosWeaponAttribute.HitFireArea, AosWeaponAttribute.HitPhysicalArea, AosWeaponAttribute.HitPoisonArea });

                resists.Register(new object[] { AosElementAttribute.Physical, AosElementAttribute.Fire, AosElementAttribute.Cold, AosElementAttribute.Poison, AosElementAttribute.Energy });

                stats.Register(new object[] { AosAttribute.BonusStr, AosAttribute.BonusDex, AosAttribute.BonusInt, AosAttribute.BonusHits, AosAttribute.BonusStam, AosAttribute.BonusMana, AosAttribute.RegenHits, AosAttribute.RegenStam, AosAttribute.RegenMana });

                slayer1.Register(new object[] { SlayerName.ReptilianDeath, SlayerName.DragonSlaying, SlayerName.LizardmanSlaughter, SlayerName.Ophidian, SlayerName.SnakesBane, SlayerName.ArachnidDoom, SlayerName.ScorpionsBane, SlayerName.SpidersDeath, SlayerName.Terathan });

                slayer2.Register(new object[] { SlayerName.Repond, TalismanSlayerName.Bear, TalismanSlayerName.Beetle, TalismanSlayerName.Bird, TalismanSlayerName.Bovine, TalismanSlayerName.Flame, TalismanSlayerName.Goblin, TalismanSlayerName.Ice,
                                                TalismanSlayerName.Mage, SlayerName.OgreTrashing, SlayerName.OrcSlaying, SlayerName.TrollSlaughter, TalismanSlayerName.Vermin, TalismanSlayerName.Undead });
                slayer3.Register(new object[] { SlayerName.Exorcism, SlayerName.GargoylesFoe, SlayerName.Fey, SlayerName.ElementalBan, SlayerName.Vacuum, SlayerName.BloodDrinking, SlayerName.EarthShatter, SlayerName.FlameDousing, SlayerName.ElementalHealth, SlayerName.SummerWind, SlayerName.WaterDissipation });

                requiredskill.Register(new object[] { SkillName.Swords, SkillName.Macing, SkillName.Fencing, SkillName.Archery, SkillName.Throwing });

                skill1.Register(new object[] { SkillName.Swords, SkillName.Fencing, SkillName.Macing, SkillName.Magery, SkillName.Musicianship });
                skill2.Register(new object[] { SkillName.Wrestling, SkillName.Tactics, SkillName.AnimalTaming, SkillName.Provocation, SkillName.SpiritSpeak });
                skill3.Register(new object[] { SkillName.Stealth, SkillName.Parry, SkillName.Meditation, SkillName.AnimalLore, SkillName.Discordance, SkillName.Focus });
                skill4.Register(new object[] { SkillName.Stealing, SkillName.Anatomy, SkillName.EvalInt, SkillName.Veterinary, SkillName.Necromancy, SkillName.Bushido, SkillName.Mysticism });
                skill5.Register(new object[] { SkillName.Healing, SkillName.MagicResist, SkillName.Peacemaking, SkillName.Archery, SkillName.Chivalry, SkillName.Ninjitsu, SkillName.Throwing });
                skill6.Register(new object[] { SkillName.Lumberjacking, SkillName.Snooping, SkillName.Mining });

                Categories.Add(price);
                Categories.Add(misc);
                Categories.Add(equipment);
                Categories.Add(combat);
                Categories.Add(casting);
                Categories.Add(damagetype);
                Categories.Add(hitspell);
                Categories.Add(hitarea);
                Categories.Add(resists);
                Categories.Add(stats);
                Categories.Add(slayer1);
                Categories.Add(slayer2);
                Categories.Add(slayer3);
                Categories.Add(requiredskill);
                Categories.Add(skill1);
                Categories.Add(skill2);
                Categories.Add(skill3);
                Categories.Add(skill4);
                Categories.Add(skill5);
                Categories.Add(skill6);
                Categories.Add(sort);
            });

            Keywords = new Dictionary <string, Type>();

            Keywords["power scroll"] = typeof(PowerScroll);
            Keywords["stat scroll"]  = typeof(StatCapScroll);
        }
Пример #2
0
        public static bool HasValue(object o, SearchCategory category)
        {
            if (o is AosAttribute && (AosAttribute)o == AosAttribute.CastSpeed)
                return true;

            if (category.Category == Category.RequiredSkill)
                return false;

            if (o is string && (string)o == "ArtifactRarity")
                return true;

            return Imbuing.GetMaxValue(o) > 1;
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 0)
            {
                TextRelay searchname = info.GetTextEntry(0);

                if (searchname != null && !String.IsNullOrEmpty(searchname.Text))
                {
                    string text = searchname.Text.Trim();

                    if (Criteria.SearchName == null || text.ToLower() != Criteria.SearchName.ToLower())
                    {
                        Criteria.SearchName = searchname.Text;
                    }
                }
            }

            switch (info.ButtonID)
            {
            case 0: break;

            case 1:     // Set Min/Max price
                TextRelay tr1 = info.GetTextEntry(1);
                TextRelay tr2 = info.GetTextEntry(2);

                if (tr1 != null && tr1.Text != null)
                {
                    string text = tr1.Text.Trim();
                    int    min  = 0;

                    if (int.TryParse(text, out min))
                    {
                        Criteria.MinPrice = min;
                    }
                }

                if (tr2 != null && tr2.Text != null)
                {
                    string text = tr2.Text.Trim();
                    int    max  = 0;

                    if (int.TryParse(text, out max))
                    {
                        Criteria.MaxPrice = max;
                    }
                }
                Refresh();
                break;

            case 2:     // Low to High
                Criteria.SortBy = SortBy.LowToHigh;
                Refresh();
                break;

            case 3:     // High to Low
                Criteria.SortBy = SortBy.HighToLow;
                Refresh();
                break;

            case 4:     // Nothing, resend gump
                Criteria.SortBy = SortBy.None;
                Refresh();
                break;

            case 5:     // Clear Criteria
                Criteria.Reset();
                Refresh();
                break;

            case 6:     // Search
                User.CloseGump(typeof(SearchResultsGump));

                if (Criteria.IsEmpty)
                {
                    Refresh(false, true);
                }
                else
                {
                    List <VendorItem> list = VendorSearch.DoSearch(User, Criteria);

                    if (list == null || list.Count == 0)
                    {
                        Refresh(true);
                    }
                    else
                    {
                        Refresh();
                        User.SendGump(new SearchResultsGump(User, list));
                    }
                }
                break;

            case 7:     // remove item name
                Criteria.SearchName = null;
                Refresh();
                break;

            default:
                if (info.ButtonID >= 100 && info.ButtonID < 200)
                {
                    ChosenCategory = info.ButtonID - 100;
                    Refresh();
                }
                else if (info.ButtonID >= 200 && info.ButtonID < 300 && ChosenCategory >= 0 && ChosenCategory < VendorSearch.Categories.Count)
                {
                    int index = info.ButtonID - 200;

                    SearchCategory      category = VendorSearch.Categories[ChosenCategory];
                    Tuple <object, int> data     = category.Objects[index];
                    object o     = data.Item1;
                    int    value = 0;

                    TextRelay valuetext = info.GetTextEntry(index + 400);

                    if (valuetext != null)
                    {
                        value = Math.Max(o is AosAttribute && (AosAttribute)o == AosAttribute.CastSpeed ? -1 : 0, Utility.ToInt32(valuetext.Text));
                    }

                    Criteria.TryAddDetails(o, data.Item2, value, category.Category);
                    Refresh();
                }
                else if (info.ButtonID >= 300 && info.ButtonID - 300 >= 0 && info.ButtonID - 300 < Criteria.Details.Count)
                {
                    SearchDetail toRemove = Criteria.Details[info.ButtonID - 300];

                    if (toRemove.Category == Category.Equipment)
                    {
                        Criteria.SearchType = Layer.Invalid;
                    }

                    Criteria.Details.Remove(toRemove);
                    Refresh();
                }
                break;
            }
        }
Пример #4
0
        public static void Initialize()
        {
            try
            {
                StringList = new Ultima.StringList("enu");
            }
            catch { }

            CommandSystem.Register("GetOPLString", AccessLevel.Administrator, e =>
                {
                    e.Mobile.BeginTarget(-1, false, TargetFlags.None, (m, targeted) =>
                        {
                            if (targeted is Item)
                            {
                                Console.WriteLine(GetItemName((Item)targeted));
                                e.Mobile.SendMessage(GetItemName((Item)targeted));
                            }
                        });
                });

            Categories = new List<SearchCategory>();
            Contexts = new Dictionary<PlayerMobile, SearchCriteria>();

            Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                {
                    SearchCategory price = new SearchCategory(Category.PriceRange);
                    SearchCategory equipment = new SearchCategory(Category.Equipment);
                    SearchCategory misc = new SearchCategory(Category.Misc);
                    SearchCategory combat = new SearchCategory(Category.Combat);
                    SearchCategory casting = new SearchCategory(Category.Casting);
                    SearchCategory damagetype = new SearchCategory(Category.DamageType);
                    SearchCategory hitspell = new SearchCategory(Category.HitSpell);
                    SearchCategory hitarea = new SearchCategory(Category.HitArea);
                    SearchCategory resists = new SearchCategory(Category.Resists);
                    SearchCategory stats = new SearchCategory(Category.Stats);
                    SearchCategory slayer1 = new SearchCategory(Category.Slayer1);
                    SearchCategory slayer2 = new SearchCategory(Category.Slayer2);
                    SearchCategory slayer3 = new SearchCategory(Category.Slayer3);
                    SearchCategory requiredskill = new SearchCategory(Category.RequiredSkill);
                    SearchCategory skill1 = new SearchCategory(Category.Skill1);
                    SearchCategory skill2 = new SearchCategory(Category.Skill2);
                    SearchCategory skill3 = new SearchCategory(Category.Skill3);
                    SearchCategory skill4 = new SearchCategory(Category.Skill4);
                    SearchCategory skill5 = new SearchCategory(Category.Skill5);
                    SearchCategory skill6 = new SearchCategory(Category.Skill6);
                    SearchCategory sort = new SearchCategory(Category.Sort);

                    object[] enums = new object[15];
                    int[] labels = new int[15];
                    int index = 0;

                    foreach (int i in Enum.GetValues(typeof(Misc)))
                    {
                        enums[index] = (Misc)i;
                        labels[index] = i;
                        index++;
                    }

                    misc.Register(enums, labels);
                    misc.Register(new object[] { AosAttribute.EnhancePotions, AosArmorAttribute.LowerStatReq, AosAttribute.Luck, AosAttribute.ReflectPhysical, AosArmorAttribute.SelfRepair });
                    misc.Register(new object[] { "ArtifactRarity" }, new int[] { 1154693 });

                    equipment.Register(new object[] { Layer.Shoes, Layer.Pants, Layer.Shirt, Layer.Helm, Layer.Gloves, Layer.Ring, Layer.Talisman, Layer.Neck, Layer.Waist, Layer.InnerTorso,
                                                          Layer.Bracelet, Layer.MiddleTorso, Layer.Earrings, Layer.Arms, Layer.Cloak, Layer.OuterTorso, Layer.OuterLegs },
                                       new int[] { 1154602, 1154603, 1154604, 1154605, 1154606, 1154607, 1154608, 1154609, 1154611, 1154612, 1154613, 1154616, 1154617, 1154618, 1154619, 1154621, 1154622 });

                    combat.Register(new object[] { AosAttribute.WeaponDamage, AosAttribute.DefendChance, AosAttribute.AttackChance, AosAttribute.WeaponSpeed, AosArmorAttribute.SoulCharge, 
                                                       AosWeaponAttribute.UseBestSkill, AosWeaponAttribute.ReactiveParalyze, /*TODO: Assassin Honed*/"SearingWeapon", AosWeaponAttribute.BloodDrinker, AosWeaponAttribute.BattleLust, 
                                                       "BalancedWeapon", SAAbsorptionAttribute.CastingFocus, SAAbsorptionAttribute.EaterFire, SAAbsorptionAttribute.EaterCold,
                                                       SAAbsorptionAttribute.EaterPoison, SAAbsorptionAttribute.EaterEnergy, SAAbsorptionAttribute.EaterDamage });

                    casting.Register(new object[] { SAAbsorptionAttribute.ResonanceFire, SAAbsorptionAttribute.ResonanceCold, SAAbsorptionAttribute.ResonancePoison, SAAbsorptionAttribute.ResonanceEnergy,
                                                        SAAbsorptionAttribute.ResonanceKinetic, AosAttribute.SpellDamage, SAAbsorptionAttribute.CastingFocus, AosAttribute.CastRecovery, AosAttribute.CastSpeed,
                                                        AosAttribute.LowerManaCost, AosAttribute.LowerRegCost, AosWeaponAttribute.MageWeapon, AosArmorAttribute.MageArmor, AosAttribute.SpellChanneling });

                    damagetype.Register(new object[] { AosElementAttribute.Physical, AosElementAttribute.Fire, AosElementAttribute.Cold, AosElementAttribute.Poison, AosElementAttribute.Energy },
                                        new int[] { 1151800, 1151801, 1151802, 1151803, 1151804 });

                    hitspell.Register(new object[] { AosWeaponAttribute.HitDispel, AosWeaponAttribute.HitFireball, AosWeaponAttribute.HitHarm, AosWeaponAttribute.HitCurse, AosWeaponAttribute.HitLeechHits,
                                                         AosWeaponAttribute.HitLightning, "WeaponVelocity", AosWeaponAttribute.HitLowerAttack, AosWeaponAttribute.HitLowerDefend, AosWeaponAttribute.HitMagicArrow,
                                                         AosWeaponAttribute.HitLeechMana, AosWeaponAttribute.HitLeechStam, AosWeaponAttribute.HitFatigue, AosWeaponAttribute.HitManaDrain, AosWeaponAttribute.SplinteringWeapon /*TODO: Bane*/});

                    hitarea.Register(new object[] { AosWeaponAttribute.HitColdArea, AosWeaponAttribute.HitEnergyArea, AosWeaponAttribute.HitFireArea, AosWeaponAttribute.HitPhysicalArea, AosWeaponAttribute.HitPoisonArea });

                    resists.Register(new object[] { AosElementAttribute.Physical, AosElementAttribute.Fire, AosElementAttribute.Cold, AosElementAttribute.Poison, AosElementAttribute.Energy });

                    stats.Register(new object[] { AosAttribute.BonusStr, AosAttribute.BonusDex, AosAttribute.BonusInt, AosAttribute.BonusHits, AosAttribute.BonusStam, AosAttribute.BonusMana, AosAttribute.RegenHits, AosAttribute.RegenStam, AosAttribute.RegenMana });

                    slayer1.Register(new object[] { SlayerName.ReptilianDeath, SlayerName.DragonSlaying, SlayerName.LizardmanSlaughter, SlayerName.Ophidian, SlayerName.SnakesBane, SlayerName.ArachnidDoom, SlayerName.ScorpionsBane, SlayerName.SpidersDeath, SlayerName.Terathan });

                    slayer2.Register(new object[] { SlayerName.Repond, TalismanSlayerName.Bear, TalismanSlayerName.Beetle, TalismanSlayerName.Bird, TalismanSlayerName.Bovine, TalismanSlayerName.Flame, TalismanSlayerName.Goblin, TalismanSlayerName.Ice, 
                                                        TalismanSlayerName.Mage, SlayerName.OgreTrashing, SlayerName.OrcSlaying, SlayerName.TrollSlaughter, TalismanSlayerName.Vermin, TalismanSlayerName.Undead });
                    slayer3.Register(new object[] { SlayerName.Exorcism, SlayerName.GargoylesFoe, SlayerName.Fey, SlayerName.ElementalBan, SlayerName.Vacuum, SlayerName.BloodDrinking, SlayerName.EarthShatter, SlayerName.FlameDousing, SlayerName.ElementalHealth, SlayerName.SummerWind, SlayerName.WaterDissipation });

                    requiredskill.Register(new object[] { SkillName.Swords, SkillName.Macing, SkillName.Fencing, SkillName.Archery, SkillName.Throwing });

                    skill1.Register(new object[] { SkillName.Swords, SkillName.Fencing, SkillName.Macing, SkillName.Magery, SkillName.Musicianship });
                    skill2.Register(new object[] { SkillName.Wrestling, SkillName.Tactics, SkillName.AnimalTaming, SkillName.Provocation, SkillName.SpiritSpeak });
                    skill3.Register(new object[] { SkillName.Stealth, SkillName.Parry, SkillName.Meditation, SkillName.AnimalLore, SkillName.Discordance, SkillName.Focus });
                    skill4.Register(new object[] { SkillName.Stealing, SkillName.Anatomy, SkillName.EvalInt, SkillName.Veterinary, SkillName.Necromancy, SkillName.Bushido, SkillName.Mysticism });
                    skill5.Register(new object[] { SkillName.Healing, SkillName.MagicResist, SkillName.Peacemaking, SkillName.Archery, SkillName.Chivalry, SkillName.Ninjitsu, SkillName.Throwing });
                    skill6.Register(new object[] { SkillName.Lumberjacking, SkillName.Snooping, SkillName.Mining });

                    Categories.Add(price);
                    Categories.Add(misc);
                    Categories.Add(equipment);
                    Categories.Add(combat);
                    Categories.Add(casting);
                    Categories.Add(damagetype);
                    Categories.Add(hitspell);
                    Categories.Add(hitarea);
                    Categories.Add(resists);
                    Categories.Add(stats);
                    Categories.Add(slayer1);
                    Categories.Add(slayer2);
                    Categories.Add(slayer3);
                    Categories.Add(requiredskill);
                    Categories.Add(skill1);
                    Categories.Add(skill2);
                    Categories.Add(skill3);
                    Categories.Add(skill4);
                    Categories.Add(skill5);
                    Categories.Add(skill6);
                    Categories.Add(sort);
                });

            Keywords = new Dictionary<string, Type>();

            Keywords["power scroll"] = typeof(PowerScroll);
            Keywords["stat scroll"] = typeof(StatCapScroll);
        }