Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
1273
Scripts/Services/Vendor Searching/VendorSearch.cs
Normal file
1273
Scripts/Services/Vendor Searching/VendorSearch.cs
Normal file
File diff suppressed because it is too large
Load Diff
276
Scripts/Services/Vendor Searching/VendorSearchCriteria.cs
Normal file
276
Scripts/Services/Vendor Searching/VendorSearchCriteria.cs
Normal file
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.VendorSearching
|
||||
{
|
||||
public class SearchCriteriaCategory
|
||||
{
|
||||
public Category Category { get; set; }
|
||||
public int PageID { get; set; }
|
||||
public int Cliloc { get; set; }
|
||||
public SearchCriterionEntry[] Criteria { get; set; }
|
||||
|
||||
public SearchCriteriaCategory(Category cat, int pid, int cliloc, SearchCriterionEntry[] criteria)
|
||||
{
|
||||
Category = cat;
|
||||
PageID = pid;
|
||||
Cliloc = cliloc;
|
||||
Criteria = criteria;
|
||||
}
|
||||
|
||||
public static SearchCriteriaCategory[] AllCategories = new SearchCriteriaCategory[]
|
||||
{
|
||||
new SearchCriteriaCategory(Category.PriceRange, 2, 1154512, new SearchCriterionEntry[] { /* Price Range */
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Equipment, 3, 1154531, new SearchCriterionEntry[] { // Equipment
|
||||
new SearchCriterionEntry(Layer.Shoes, 1154602),
|
||||
new SearchCriterionEntry(Layer.Pants, 1154603),
|
||||
new SearchCriterionEntry(Layer.Shirt, 1154604),
|
||||
new SearchCriterionEntry(Layer.Helm, 1154605),
|
||||
new SearchCriterionEntry(Layer.Gloves, 1154606),
|
||||
new SearchCriterionEntry(Layer.Ring, 1154607),
|
||||
new SearchCriterionEntry(Layer.Talisman, 1154608),
|
||||
new SearchCriterionEntry(Layer.Neck, 1154609),
|
||||
new SearchCriterionEntry(Layer.Waist, 1154611),
|
||||
new SearchCriterionEntry(Layer.InnerTorso, 1154612),
|
||||
new SearchCriterionEntry(Layer.Bracelet, 1154613),
|
||||
new SearchCriterionEntry(Layer.MiddleTorso, 1154616),
|
||||
new SearchCriterionEntry(Layer.Earrings, 1154617),
|
||||
new SearchCriterionEntry(Layer.Arms, 1154618),
|
||||
new SearchCriterionEntry(Layer.Cloak, 1154619),
|
||||
new SearchCriterionEntry(Layer.OuterTorso, 1154621),
|
||||
new SearchCriterionEntry(Layer.OuterLegs, 1154622),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Combat, 4, 1154541, new SearchCriterionEntry[] { // Combat
|
||||
new SearchCriterionEntry(AosAttribute.WeaponDamage, 1079760, 1060401),
|
||||
new SearchCriterionEntry(AosAttribute.DefendChance, 1075620, 1060408),
|
||||
new SearchCriterionEntry(AosAttribute.AttackChance, 1075616, 1060415),
|
||||
new SearchCriterionEntry(AosAttribute.WeaponSpeed, 1075629, 1060486),
|
||||
new SearchCriterionEntry(AosArmorAttribute.SoulCharge, 1116536, 1113630),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.UseBestSkill, 1079592),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.ReactiveParalyze, 1154660),
|
||||
new SearchCriterionEntry(ExtendedWeaponAttribute.AssassinHoned, 1152206),
|
||||
new SearchCriterionEntry("SearingWeapon", 1151183),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.BloodDrinker, 1113591),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.BattleLust, 1113710),
|
||||
new SearchCriterionEntry(AosAttribute.BalancedWeapon, 1072792),
|
||||
new SearchCriterionEntry(ExtendedWeaponAttribute.Focus, 1150018),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterFire, 1154662, 1113593),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterCold, 1154663, 1113594),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterPoison, 1154664, 1113595),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterEnergy, 1154665, 1113596),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterKinetic, 1154666, 1113597),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.EaterDamage, 1154667, 1113598),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Casting, 5, 1154538, new SearchCriterionEntry[] { // Casting
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.ResonanceFire, 1154655, 1113691),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.ResonanceCold, 1154656, 1113692),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.ResonancePoison, 1154657, 1113693),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.ResonanceEnergy, 1154658, 1113692),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.ResonanceKinetic, 1154659, 1113695),
|
||||
new SearchCriterionEntry(AosAttribute.SpellDamage, 1075628, 1060483),
|
||||
new SearchCriterionEntry(SAAbsorptionAttribute.CastingFocus, 1116535, 1113696),
|
||||
new SearchCriterionEntry(AosAttribute.CastRecovery, 1075618, 1060412),
|
||||
new SearchCriterionEntry(AosAttribute.CastSpeed, 1075617, 1060413),
|
||||
new SearchCriterionEntry(AosAttribute.LowerManaCost, 1075621, 1060433),
|
||||
new SearchCriterionEntry(AosAttribute.LowerRegCost, 1075625, 1060434),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.MageWeapon, 1079759, 1060438),
|
||||
new SearchCriterionEntry(AosArmorAttribute.MageArmor, 1079758),
|
||||
new SearchCriterionEntry(AosAttribute.SpellChanneling, 1079766),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Misc, 6, 1154647, new SearchCriterionEntry[] { // Miscellaneous
|
||||
new SearchCriterionEntry(Misc.ExcludeFel, 1154646),
|
||||
new SearchCriterionEntry(Misc.GargoyleOnly, 1154648),
|
||||
new SearchCriterionEntry(Misc.NotGargoyleOnly, 1154704),
|
||||
new SearchCriterionEntry(Misc.ElvesOnly, 1154650),
|
||||
new SearchCriterionEntry(Misc.NotElvesOnly, 1154703),
|
||||
new SearchCriterionEntry(Misc.FactionItem, 1154661),
|
||||
new SearchCriterionEntry(Misc.PromotionalToken, 1154682),
|
||||
new SearchCriterionEntry(AosAttribute.NightSight, 1075643),
|
||||
new SearchCriterionEntry(Misc.Cursed, 1116639),
|
||||
new SearchCriterionEntry(Misc.NotCursed, 1154701),
|
||||
new SearchCriterionEntry(Misc.CannotRepair, 1151826),
|
||||
new SearchCriterionEntry(Misc.NotCannotBeRepaired, 1154705),
|
||||
new SearchCriterionEntry(Misc.Brittle, 1116209),
|
||||
new SearchCriterionEntry(Misc.NotBrittle, 1154702),
|
||||
new SearchCriterionEntry(Misc.Antique, 1152714),
|
||||
new SearchCriterionEntry(Misc.NotAntique, 1156479),
|
||||
new SearchCriterionEntry(AosAttribute.EnhancePotions, 1075624, 1060411),
|
||||
new SearchCriterionEntry(AosArmorAttribute.LowerStatReq, 1079757, 1060435),
|
||||
new SearchCriterionEntry(AosAttribute.Luck, 1061153, 1060436),
|
||||
new SearchCriterionEntry(AosAttribute.ReflectPhysical, 1075626, 1060442),
|
||||
new SearchCriterionEntry(AosArmorAttribute.SelfRepair, 1079709, 1060450),
|
||||
new SearchCriterionEntry("ArtifactRarity", 1154693, 1061078),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.DamageType, 9, 1154535, new SearchCriterionEntry[] { // Damage Type
|
||||
new SearchCriterionEntry(AosElementAttribute.Physical, 1151800, 1060403),
|
||||
new SearchCriterionEntry(AosElementAttribute.Cold, 1151802, 1060404),
|
||||
new SearchCriterionEntry(AosElementAttribute.Fire, 1151801, 1060405),
|
||||
new SearchCriterionEntry(AosElementAttribute.Poison, 1151803, 1060406),
|
||||
new SearchCriterionEntry(AosElementAttribute.Energy, 1151804, 1060407),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.HitSpell, 10, 1154536, new SearchCriterionEntry[] { // Hit Spell
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitDispel, 1079702, 1060417),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitFireball, 1079703, 1060420),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitHarm, 1079704, 1060421),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitCurse, 1154673, 1113712),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLeechHits, 1079698, 1060422),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLightning, 1079705, 1060423),
|
||||
new SearchCriterionEntry("WeaponVelocity", 1080416, 1072793),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLowerAttack, 1079699, 1060424),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLowerDefend, 1079700, 1060425),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitMagicArrow, 1079706, 1060426),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLeechMana, 1079701, 1060427),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitLeechStam, 1079707, 1060430),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitFatigue, 1154668, 1113700),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitManaDrain, 1154669, 1113699),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.SplinteringWeapon, 1154670, 1112857),
|
||||
new SearchCriterionEntry(ExtendedWeaponAttribute.Bane, 1154671),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.HitArea, 11, 1154537, new SearchCriterionEntry[] { // Hit Area
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitColdArea, 1079693, 1060416),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitEnergyArea, 1079694, 1060418),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitFireArea, 1079695, 1060419),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitPhysicalArea, 1079696, 1060428),
|
||||
new SearchCriterionEntry(AosWeaponAttribute.HitPoisonArea, 1079697, 1060429),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Resists, 12, 1154539, new SearchCriterionEntry[] { // Resists
|
||||
new SearchCriterionEntry(AosElementAttribute.Cold, 1079761, 1060445),
|
||||
new SearchCriterionEntry(AosElementAttribute.Energy, 1079762, 1060446),
|
||||
new SearchCriterionEntry(AosElementAttribute.Fire, 1079763, 1060447),
|
||||
new SearchCriterionEntry(AosElementAttribute.Physical, 1079764, 1060448),
|
||||
new SearchCriterionEntry(AosElementAttribute.Poison, 1079765, 1060449),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Stats, 13, 1154540, new SearchCriterionEntry[] { // Stats
|
||||
new SearchCriterionEntry(AosAttribute.BonusStr, 1079767, 1060485),
|
||||
new SearchCriterionEntry(AosAttribute.BonusDex, 1079732, 1060409),
|
||||
new SearchCriterionEntry(AosAttribute.BonusInt, 1079756, 1060432),
|
||||
new SearchCriterionEntry(AosAttribute.BonusHits, 1079404, 1060415),
|
||||
new SearchCriterionEntry(AosAttribute.BonusStam, 1079405, 1060484),
|
||||
new SearchCriterionEntry(AosAttribute.BonusMana, 1079406, 1060439),
|
||||
new SearchCriterionEntry(AosAttribute.RegenHits, 1075627, 1060444),
|
||||
new SearchCriterionEntry(AosAttribute.RegenStam, 1079411, 1060443),
|
||||
new SearchCriterionEntry(AosAttribute.RegenMana, 1079410, 1060440),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Slayer1, 15, 1154683, new SearchCriterionEntry[] { // Arachnid/Reptile Slayers
|
||||
new SearchCriterionEntry(SlayerName.ReptilianDeath, 1079751),
|
||||
new SearchCriterionEntry(SlayerName.DragonSlaying, 1061284),
|
||||
new SearchCriterionEntry(SlayerName.LizardmanSlaughter, 1079738),
|
||||
new SearchCriterionEntry(SlayerName.Ophidian, 1079740),
|
||||
new SearchCriterionEntry(SlayerName.SnakesBane, 1079744),
|
||||
new SearchCriterionEntry(SlayerName.ArachnidDoom, 1079747),
|
||||
new SearchCriterionEntry(SlayerName.ScorpionsBane, 1079743),
|
||||
new SearchCriterionEntry(SlayerName.SpidersDeath, 1079746),
|
||||
new SearchCriterionEntry(SlayerName.Terathan, 1079753),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Slayer2, 16, 1154684, new SearchCriterionEntry[] { // Repond/Undead Slayers
|
||||
new SearchCriterionEntry(SlayerName.Repond, 1079750),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Bat, 1072506),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Bear, 1072504),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Beetle, 1072508),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Bird, 1072509),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Bovine, 1072512),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Flame, 1072511),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Goblin, 1095010),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Ice, 1072510),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Mage, 1072507),
|
||||
new SearchCriterionEntry(SlayerName.OgreTrashing, 1079739),
|
||||
new SearchCriterionEntry(SlayerName.OrcSlaying, 1079741),
|
||||
new SearchCriterionEntry(SlayerName.TrollSlaughter, 1079754),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Vermin, 1072505),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Undead, 1079752),
|
||||
new SearchCriterionEntry(TalismanSlayerName.Wolf, 1075462),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Slayer3, 17, 1154685, new SearchCriterionEntry[] { // Demon/Fey/Elemental Slayers
|
||||
new SearchCriterionEntry(SlayerName.Exorcism, 1079748),
|
||||
new SearchCriterionEntry(SlayerName.GargoylesFoe, 1079737),
|
||||
new SearchCriterionEntry(SlayerName.Fey, 1154652),
|
||||
new SearchCriterionEntry(SlayerName.ElementalBan, 1079749),
|
||||
new SearchCriterionEntry(SlayerName.Vacuum, 1079733),
|
||||
new SearchCriterionEntry(SlayerName.BloodDrinking, 1079734),
|
||||
new SearchCriterionEntry(SlayerName.EarthShatter, 1079735),
|
||||
new SearchCriterionEntry(SlayerName.FlameDousing, 1079736),
|
||||
new SearchCriterionEntry(SlayerName.ElementalHealth, 1079742),
|
||||
new SearchCriterionEntry(SlayerName.SummerWind, 1079745),
|
||||
new SearchCriterionEntry(SlayerName.WaterDissipation, 1079755),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.RequiredSkill, 18, 1154543, new SearchCriterionEntry[] { // Required Skill
|
||||
new SearchCriterionEntry(SkillName.Swords, 1044100),
|
||||
new SearchCriterionEntry(SkillName.Macing, 1044101),
|
||||
new SearchCriterionEntry(SkillName.Fencing, 1044102),
|
||||
new SearchCriterionEntry(SkillName.Archery, 1044091),
|
||||
new SearchCriterionEntry(SkillName.Throwing, 1044117),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill1, 19, 1114255, new SearchCriterionEntry[] { // Skill Group 1
|
||||
new SearchCriterionEntry(SkillName.Swords, 1044100),
|
||||
new SearchCriterionEntry(SkillName.Fencing, 1044102),
|
||||
new SearchCriterionEntry(SkillName.Macing, 1044101),
|
||||
new SearchCriterionEntry(SkillName.Magery, 1044085),
|
||||
new SearchCriterionEntry(SkillName.Musicianship, 1044089),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill2, 20, 1114256, new SearchCriterionEntry[] { // Skill Group 2
|
||||
new SearchCriterionEntry(SkillName.Wrestling, 1044103),
|
||||
new SearchCriterionEntry(SkillName.Tactics, 1044087),
|
||||
new SearchCriterionEntry(SkillName.AnimalTaming, 1044095),
|
||||
new SearchCriterionEntry(SkillName.Provocation, 1044082),
|
||||
new SearchCriterionEntry(SkillName.SpiritSpeak, 1044092),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill3, 21, 1114257, new SearchCriterionEntry[] { // Skill Group 3
|
||||
new SearchCriterionEntry(SkillName.Stealth, 1044107),
|
||||
new SearchCriterionEntry(SkillName.Parry, 1044065),
|
||||
new SearchCriterionEntry(SkillName.Meditation, 1044106),
|
||||
new SearchCriterionEntry(SkillName.AnimalLore, 1044062),
|
||||
new SearchCriterionEntry(SkillName.Discordance, 1044075),
|
||||
new SearchCriterionEntry(SkillName.Focus, 1044110),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill4, 22, 1114258, new SearchCriterionEntry[] { // Skill Group 4
|
||||
new SearchCriterionEntry(SkillName.Stealing, 1044093),
|
||||
new SearchCriterionEntry(SkillName.Anatomy, 1044061),
|
||||
new SearchCriterionEntry(SkillName.EvalInt, 1044076),
|
||||
new SearchCriterionEntry(SkillName.Veterinary, 1044099),
|
||||
new SearchCriterionEntry(SkillName.Necromancy, 1044109),
|
||||
new SearchCriterionEntry(SkillName.Bushido, 1044112),
|
||||
new SearchCriterionEntry(SkillName.Mysticism, 1044115),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill5, 23, 1114259, new SearchCriterionEntry[] { // Skill Group 5
|
||||
new SearchCriterionEntry(SkillName.Healing, 1044077),
|
||||
new SearchCriterionEntry(SkillName.MagicResist, 1044086),
|
||||
new SearchCriterionEntry(SkillName.Peacemaking, 1044069),
|
||||
new SearchCriterionEntry(SkillName.Archery, 1044091),
|
||||
new SearchCriterionEntry(SkillName.Chivalry, 1044111),
|
||||
new SearchCriterionEntry(SkillName.Ninjitsu, 1044113),
|
||||
new SearchCriterionEntry(SkillName.Throwing, 1044117),
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Skill6, 24, 1114260, new SearchCriterionEntry[] { // Skill Group 6
|
||||
new SearchCriterionEntry(SkillName.Lumberjacking, 1044104),
|
||||
new SearchCriterionEntry(SkillName.Snooping, 1044088),
|
||||
new SearchCriterionEntry(SkillName.Mining, 1044105)
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Sort, 25, 1154695, new SearchCriterionEntry[] { /* Sort */
|
||||
}),
|
||||
new SearchCriteriaCategory(Category.Auction, 26, 1159353, new SearchCriterionEntry[] { /* Auction Item */
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
public class SearchCriterionEntry
|
||||
{
|
||||
public object Object { get; set; }
|
||||
public int Cliloc { get; set; }
|
||||
public int PropCliloc { get; set; }
|
||||
|
||||
public SearchCriterionEntry(object obj, int cliloc)
|
||||
: this(obj, cliloc, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public SearchCriterionEntry(object obj, int cliloc, int pcliloc)
|
||||
{
|
||||
Object = obj;
|
||||
Cliloc = cliloc;
|
||||
PropCliloc = pcliloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
585
Scripts/Services/Vendor Searching/VendorSearchGump.cs
Normal file
585
Scripts/Services/Vendor Searching/VendorSearchGump.cs
Normal file
@@ -0,0 +1,585 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Engines.VendorSearching
|
||||
{
|
||||
public class VendorSearchGump : BaseGump
|
||||
{
|
||||
public SearchCriteria Criteria { get; set; }
|
||||
public Map SetMap { get; set; }
|
||||
|
||||
public int Feedback { get; private set; }
|
||||
|
||||
public static int LabelColor = 0x4BBD;
|
||||
public static int CriteriaColor = 0x6B55;
|
||||
public static int TextColor = 0x9C2;
|
||||
public static int AlertColor = 0x7C00;
|
||||
|
||||
public VendorSearchGump(PlayerMobile pm, int feedback = -1)
|
||||
: base(pm, 10, 10)
|
||||
{
|
||||
TypeID = 0xF3EC8;
|
||||
Feedback = feedback;
|
||||
Criteria = VendorSearch.GetContext(pm);
|
||||
|
||||
if (Criteria == null)
|
||||
Criteria = VendorSearch.AddNewContext(pm);
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 780, 600, 30546);
|
||||
|
||||
AddHtmlLocalized(10, 10, 760, 18, 1114513, "#1154508", LabelColor, false, false); // Vendor Search Query
|
||||
AddHtmlLocalized(522, 30, 246, 18, 1154546, LabelColor, false, false); // Selected Search Criteria
|
||||
|
||||
int yOffset = 0;
|
||||
|
||||
if (!string.IsNullOrEmpty(Criteria.SearchName))
|
||||
{
|
||||
AddButton(522, 50 + (yOffset * 22), 4017, 4019, 7, GumpButtonType.Reply, 0);
|
||||
AddTooltip(1154694); // Remove Selected Search Criteria
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, 1154510, CriteriaColor, false, false);
|
||||
yOffset++;
|
||||
}
|
||||
|
||||
if (Criteria.EntryPrice)
|
||||
{
|
||||
AddButton(522, 50 + (yOffset * 22), 4017, 4019, 8, GumpButtonType.Reply, 0);
|
||||
AddTooltip(1154694); // Remove Selected Search Criteria
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, 1154512, string.Format("@{0}@{1}", Criteria.MinPrice.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Criteria.MaxPrice.ToString("N0", CultureInfo.GetCultureInfo("en-US"))), CriteriaColor, false, false);
|
||||
yOffset++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Criteria.Details.Count; i++)
|
||||
{
|
||||
int cliloc = Criteria.Details[i].PropLabel;
|
||||
|
||||
if (cliloc > 0)
|
||||
{
|
||||
if (Criteria.Details[i].Attribute is SkillName)
|
||||
{
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, 1060451, string.Format("#{0}@{1}", cliloc, Criteria.Details[i].Value), CriteriaColor, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, cliloc, string.Format("{0}", Criteria.Details[i].Value), CriteriaColor, false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, Criteria.Details[i].Label, CriteriaColor, false, false);
|
||||
}
|
||||
|
||||
AddButton(522, 50 + (yOffset * 22), 4017, 4019, 1001 + i, GumpButtonType.Reply, 0);
|
||||
AddTooltip(1154694); // Remove Selected Search Criteria
|
||||
|
||||
yOffset++;
|
||||
}
|
||||
|
||||
AddButton(522, 50 + (yOffset * 22), 4017, 4019, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 215, 20, Criteria.SortBy == SortBy.LowToHigh ? 1154696 : 1154697, CriteriaColor, false, false);
|
||||
|
||||
yOffset++;
|
||||
|
||||
AddButton(522, 50 + (yOffset * 22), 4017, 4019, 9, GumpButtonType.Reply, 0);
|
||||
AddTooltip(1154694); // Remove Selected Search Criteria
|
||||
AddHtmlLocalized(562, 50 + (yOffset * 22), 206, 20, Criteria.Auction ? 1159353 : 1159354, CriteriaColor, false, false);
|
||||
|
||||
AddHtmlLocalized(10, 30, 246, 18, 1154510, LabelColor, false, false); // Item Name
|
||||
AddBackground(10, 50, 246, 22, 9350);
|
||||
AddTextEntry(12, 52, 242, 18, TextColor, 1, Criteria.SearchName, 25);
|
||||
|
||||
yOffset = 0;
|
||||
|
||||
SearchCriteriaCategory.AllCategories.OrderByDescending(x => x.PageID == 2).ThenByDescending(x => x.PageID == 6).ToList().ForEach(x =>
|
||||
{
|
||||
AddButton(10, 74 + (yOffset * 22), 30533, 30533, 0, GumpButtonType.Page, x.PageID);
|
||||
|
||||
if (x.Category == Category.PriceRange)
|
||||
AddHtmlLocalized(50, 75 + (yOffset * 22), 215, 20, x.Cliloc, string.Format("@{0}@{1}", Criteria.MinPrice.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Criteria.MaxPrice.ToString("N0", CultureInfo.GetCultureInfo("en-US"))), LabelColor, false, false);
|
||||
else
|
||||
AddHtmlLocalized(50, 75 + (yOffset * 22), 215, 20, x.Cliloc, LabelColor, false, false);
|
||||
|
||||
yOffset++;
|
||||
});
|
||||
|
||||
AddButton(10, 570, 0x7747, 0x7747, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 570, 50, 20, 1150300, LabelColor, false, false); // Cancel
|
||||
|
||||
if (Feedback != -1)
|
||||
{
|
||||
AddHtmlLocalized(110, 570, 660, 20, Feedback, AlertColor, false, false);
|
||||
}
|
||||
|
||||
AddButton(740, 570, 30534, 30534, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(630, 570, 100, 20, 1114514, "#1154641", LabelColor, false, false); // Search
|
||||
|
||||
AddButton(740, 550, 30533, 30533, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(630, 550, 100, 20, 1114514, "#1154588", LabelColor, false, false); // Clear Search Criteria
|
||||
|
||||
int buttonIdx = 50;
|
||||
|
||||
SearchCriteriaCategory.AllCategories.ToList().ForEach(x =>
|
||||
{
|
||||
AddPage(x.PageID);
|
||||
|
||||
if (x.Category == Category.PriceRange)
|
||||
{
|
||||
AddHtmlLocalized(266, 30, 246, 18, 1154532, LabelColor, false, false); // Minimum Price
|
||||
AddBackground(266, 50, 246, 22, 9350);
|
||||
AddTextEntry(268, 52, 242, 18, TextColor, 7, Criteria.MinPrice.ToString(), 10);
|
||||
|
||||
AddHtmlLocalized(266, 74, 246, 18, 1154533, LabelColor, false, false); // Maximum Price
|
||||
AddBackground(266, 94, 246, 22, 9350);
|
||||
AddTextEntry(268, 96, 242, 18, TextColor, 8, Criteria.MaxPrice.ToString(), 10);
|
||||
|
||||
AddButton(266, 118, 4011, 4012, 1154512, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(306, 118, 100, 272, 1154534, LabelColor, false, false); // Add Search Criteria
|
||||
}
|
||||
else if (x.Category == Category.Sort)
|
||||
{
|
||||
AddHtmlLocalized(266, 30, 246, 18, x.Cliloc, LabelColor, false, false); // Sort Results
|
||||
|
||||
AddHtmlLocalized(306, 50, 215, 20, 1154696, LabelColor, false, false); // Price: Low to High
|
||||
AddButton(266, 50, 30533, 30533, 236, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(306, 72, 215, 20, 1154697, LabelColor, false, false); // Price: High to Low
|
||||
AddButton(266, 72, 30533, 30533, 237, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else if (x.Category == Category.Auction)
|
||||
{
|
||||
AddHtmlLocalized(266, 30, 246, 18, x.Cliloc, LabelColor, false, false); // Auction Item
|
||||
|
||||
AddHtmlLocalized(306, 50, 215, 20, 1159354, LabelColor, false, false); // Non Auction Item
|
||||
AddButton(266, 50, 30533, 30533, 238, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(306, 72, 215, 20, 1159353, LabelColor, false, false); // Auction Item
|
||||
AddButton(266, 72, 30533, 30533, 239, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(266, 30, 246, 18, x.Cliloc, LabelColor, false, false);
|
||||
|
||||
yOffset = 0;
|
||||
|
||||
x.Criteria.ToList().ForEach(y =>
|
||||
{
|
||||
AddHtmlLocalized(306, 50 + (yOffset * 22), 215, 20, y.Cliloc, LabelColor, false, false);
|
||||
AddButton(266, 50 + (yOffset * 22), 30533, 30533, buttonIdx, GumpButtonType.Reply, 0);
|
||||
|
||||
if (y.PropCliloc != 0)
|
||||
{
|
||||
int value = Criteria.GetValueForDetails(y.Object);
|
||||
|
||||
AddBackground(482, 50 + (yOffset * 22), 30, 20, 9350);
|
||||
AddTextEntry(484, 50 + (yOffset * 22), 26, 16, TextColor, buttonIdx - 40, value > 0 ? value.ToString() : "", 3);
|
||||
}
|
||||
|
||||
yOffset++;
|
||||
buttonIdx++;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID != 0)
|
||||
{
|
||||
if (!VendorSearch.CanSearch(User))
|
||||
{
|
||||
User.SendLocalizedMessage(1154680); //Before using vendor search, you must be in a justice region or a safe log-out location (such as an inn or a house which has you on its Owner, Co-owner, or Friends list).
|
||||
return;
|
||||
}
|
||||
|
||||
TextRelay searchname = info.GetTextEntry(1);
|
||||
|
||||
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: // Search
|
||||
{
|
||||
User.CloseGump(typeof(SearchResultsGump));
|
||||
|
||||
if (Criteria.IsEmpty)
|
||||
{
|
||||
SendGump(new VendorSearchGump(User, 1154586)); // Please select some criteria to search for.
|
||||
}
|
||||
else
|
||||
{
|
||||
var resultsTask = FindVendorItemsAsync(User, Criteria);
|
||||
|
||||
var pollingTimer = new TaskPollingTimer<List<SearchItem>>(resultsTask, (results) =>
|
||||
{
|
||||
User.CloseGump(typeof(SearchWaitGump));
|
||||
|
||||
if (results == null || results.Count == 0)
|
||||
{
|
||||
SendGump(new VendorSearchGump(User, 1154587)); // No items matched your search.
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh(true);
|
||||
SendGump(new SearchResultsGump(User, results));
|
||||
}
|
||||
});
|
||||
|
||||
resultsTask.Start();
|
||||
pollingTimer.Start();
|
||||
|
||||
SendGump(new SearchWaitGump(User, pollingTimer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Clear Criteria
|
||||
{
|
||||
Criteria.Reset();
|
||||
Refresh(true);
|
||||
break;
|
||||
}
|
||||
case 4: // Nothing, resend gump
|
||||
Refresh(true);
|
||||
break;
|
||||
case 7: // remove item name
|
||||
Criteria.SearchName = null;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 8: // remove price entry
|
||||
Criteria.EntryPrice = false;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 9: // remove auction entry
|
||||
Refresh(true);
|
||||
break;
|
||||
case 236: // Low to High
|
||||
Criteria.SortBy = SortBy.LowToHigh;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 237: // High to Low
|
||||
Criteria.SortBy = SortBy.HighToLow;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 238: // Non Auction Item
|
||||
Criteria.Auction = false;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 239: // Auction Item
|
||||
Criteria.Auction = true;
|
||||
Refresh(true);
|
||||
break;
|
||||
case 1154512: // Set Min/Max price
|
||||
TextRelay tr1 = info.GetTextEntry(7);
|
||||
TextRelay tr2 = info.GetTextEntry(8);
|
||||
|
||||
if (tr1 != null && tr1.Text != null)
|
||||
{
|
||||
string text = tr1.Text.Trim();
|
||||
|
||||
if (int.TryParse(text, out int min))
|
||||
{
|
||||
Criteria.MinPrice = min;
|
||||
}
|
||||
}
|
||||
|
||||
if (tr2 != null && tr2.Text != null)
|
||||
{
|
||||
string text = tr2.Text.Trim();
|
||||
|
||||
if (int.TryParse(text, out int max))
|
||||
{
|
||||
Criteria.MaxPrice = max;
|
||||
}
|
||||
}
|
||||
|
||||
Criteria.EntryPrice = true;
|
||||
Refresh(true);
|
||||
break;
|
||||
default:
|
||||
if (info.ButtonID > 1000)
|
||||
{
|
||||
SearchDetail toRemove = Criteria.Details[info.ButtonID - 1001];
|
||||
|
||||
if (toRemove.Category == Category.Equipment)
|
||||
Criteria.SearchType = Layer.Invalid;
|
||||
|
||||
Criteria.Details.Remove(toRemove);
|
||||
Refresh(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Criteria.Details.Count >= 20)
|
||||
{
|
||||
SendGump(new VendorSearchGump(User, 1154681)); // You may not add any more search criteria items.
|
||||
}
|
||||
|
||||
var criteria = SearchCriteriaCategory.AllCategories.SelectMany(x => x.Criteria, (x, c) => new { x.Category, c.Object, c.Cliloc, c.PropCliloc }).ToList()[info.ButtonID - 50];
|
||||
object o = criteria.Object;
|
||||
int value = 0;
|
||||
|
||||
TextRelay valuetext = info.GetTextEntry(info.ButtonID - 40);
|
||||
|
||||
if (valuetext != null)
|
||||
value = Math.Max(o is AosAttribute && (AosAttribute)o == AosAttribute.CastSpeed ? -1 : 0, Utility.ToInt32(valuetext.Text));
|
||||
|
||||
Criteria.TryAddDetails(o, criteria.Cliloc, criteria.PropCliloc, value, criteria.Category);
|
||||
Refresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Task<List<SearchItem>> FindVendorItemsAsync(Mobile m, SearchCriteria criteria)
|
||||
{
|
||||
return new Task<List<SearchItem>>(() =>
|
||||
{
|
||||
return criteria.Auction ? VendorSearch.DoSearchAuction(m, criteria) : VendorSearch.DoSearch(m, criteria);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class SearchWaitGump : BaseGump
|
||||
{
|
||||
private Timer m_PollingTimer;
|
||||
|
||||
public SearchWaitGump(PlayerMobile pm, Timer waitTimer)
|
||||
: base(pm, 10, 10)
|
||||
{
|
||||
m_PollingTimer = waitTimer;
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 414, 214, 0x7752);
|
||||
|
||||
AddHtmlLocalized(27, 47, 380, 80, 1114513, "#1154678", 0x4E73, false, false); // <DIV ALIGN=CENTER>Please wait for your search to complete.</DIV>
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
m_PollingTimer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public class SearchResultsGump : BaseGump
|
||||
{
|
||||
public int PerPage = 5;
|
||||
public int LabelColor { get { return 0x4BBD; } }
|
||||
public int TextColor { get { return 0x6B55; } }
|
||||
|
||||
public List<SearchItem> Items { get; set; }
|
||||
public int Index { get; set; }
|
||||
|
||||
public SearchResultsGump(PlayerMobile pm, List<SearchItem> items)
|
||||
: base(pm, 30, 30)
|
||||
{
|
||||
Items = items;
|
||||
Index = 0;
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddBackground(0, 0, 500, 550, 30536);
|
||||
|
||||
AddHtmlLocalized(50, 50, 400, 18, 1114513, "#1154509", LabelColor, false, false); // Vendor Search Results
|
||||
|
||||
AddHtmlLocalized(162, 70, 102, 18, 1114513, "#1062218", LabelColor, false, false); // Price
|
||||
AddHtmlLocalized(274, 70, 61, 18, 1114513, "#1154644", LabelColor, false, false); // Facet
|
||||
AddHtmlLocalized(345, 70, 102, 18, 1114513, "#1154642", LabelColor, false, false); // Create Map
|
||||
|
||||
if (Index < 0) Index = Items.Count - 1;
|
||||
if (Index >= Items.Count) Index = 0;
|
||||
|
||||
int start = Index;
|
||||
int index = 0;
|
||||
|
||||
for (int i = start; i < start + PerPage && i < Items.Count; i++)
|
||||
{
|
||||
var item = Items[i].Item;
|
||||
var price = Items[i].Price;
|
||||
|
||||
Rectangle2D bounds = ItemBounds.Table[item.ItemID];
|
||||
int y = 101 + (index * 75);
|
||||
Map map = item.Map;
|
||||
|
||||
if (map == null && item.RootParentEntity is Mobile)
|
||||
map = ((Mobile)item.RootParentEntity).Map;
|
||||
|
||||
AddImageTiledButton(50, y, 0x918, 0x918, 0x0, GumpButtonType.Page, 0, item.ItemID, item.Hue, 40 - bounds.Width / 2 - bounds.X, 30 - bounds.Height / 2 - bounds.Y);
|
||||
AddItemProperty(item);
|
||||
|
||||
if (Items[i].IsAuction)
|
||||
AddHtmlLocalized(162, y, 102, 72, 1159353, 0x6B55, false, false); // Auction Item
|
||||
else
|
||||
AddHtmlLocalized(162, y, 102, 72, Items[i].IsChild ? 1154598 : 1154645, string.Format("{0}", price <= 0 ? "0" : FormatPrice(price)), TextColor, false, false); // <center>~1_val~</center>
|
||||
|
||||
if (map != null)
|
||||
AddHtmlLocalized(274, y, 102, 72, 1114513, string.Format("{0}", map.ToString()), TextColor, false, false);
|
||||
|
||||
AddButton(386, y, 30533, 30533, 100 + i, GumpButtonType.Reply, 0);
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (Index + PerPage < Items.Count)
|
||||
{
|
||||
AddButton(430, 480, 30533, 30533, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(355, 480, 70, 20, 1114514, "#1044045", LabelColor, false, false); // NEXT PAGE
|
||||
}
|
||||
|
||||
if (Index >= PerPage)
|
||||
{
|
||||
AddButton(50, 480, 30533, 30533, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(90, 480, 255, 20, 1044044, "#1044044", LabelColor, false, false); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatPrice(int price)
|
||||
{
|
||||
return price.ToString("N0", CultureInfo.GetCultureInfo("en-US"));
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: break;
|
||||
default: // Buy Map
|
||||
SearchItem item = Items[info.ButtonID - 100];
|
||||
|
||||
if (item != null && (item.AuctionSafe != null && item.AuctionSafe.CheckAuctionItem(item.Item) || item.Vendor != null && item.Vendor.GetVendorItem(item.Item) != null))
|
||||
{
|
||||
if (_GivenTo == null)
|
||||
_GivenTo = new Dictionary<Item, List<PlayerMobile>>();
|
||||
|
||||
if (!_GivenTo.ContainsKey(item.Item))
|
||||
_GivenTo[item.Item] = new List<PlayerMobile>();
|
||||
|
||||
if (!_GivenTo[item.Item].Contains(User))
|
||||
{
|
||||
VendorSearchMap map = new VendorSearchMap(item.Item, item.IsAuction);
|
||||
|
||||
if (User.Backpack == null || !User.Backpack.TryDropItem(User, map, false))
|
||||
map.Delete();
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1154690); // The vendor map has been placed in your backpack.
|
||||
_GivenTo[item.Item].Add(User);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendLocalizedMessage(1154643); // That item is no longer for sale.
|
||||
}
|
||||
break;
|
||||
case 2: // Next Page
|
||||
Index += PerPage;
|
||||
Refresh();
|
||||
break;
|
||||
case 3: // Prev Page
|
||||
Index -= PerPage;
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Timer t = Timer.DelayCall(TimeSpan.FromMinutes(30), TimeSpan.FromMinutes(30), () =>
|
||||
{
|
||||
if (_GivenTo != null)
|
||||
{
|
||||
_GivenTo.Clear();
|
||||
_GivenTo = null;
|
||||
}
|
||||
});
|
||||
|
||||
t.Priority = TimerPriority.OneMinute;
|
||||
}
|
||||
|
||||
public static Dictionary<Item, List<PlayerMobile>> _GivenTo;
|
||||
}
|
||||
|
||||
public class ConfirmTeleportGump : BaseGump
|
||||
{
|
||||
public VendorSearchMap VendorMap { get; set; }
|
||||
|
||||
public ConfirmTeleportGump(VendorSearchMap map, PlayerMobile pm)
|
||||
: base(pm, 10, 10)
|
||||
{
|
||||
VendorMap = map;
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 414, 214, 0x7752);
|
||||
|
||||
if (VendorMap.SetLocation != Point3D.Zero && (VendorMap.Vendor != null || VendorMap.AuctionSafe != null))
|
||||
{
|
||||
string[] coord = VendorMap.GetCoords();
|
||||
AddHtmlLocalized(27, 47, 380, 80, 1154637, string.Format("@{0}@{1}", coord[0], coord[1]), 0x4E73, false, false); // Please select 'Accept' if you would like to return to ~1_loc~ (~2_facet~). This map will be deleted after use.
|
||||
}
|
||||
else
|
||||
AddHtmlLocalized(27, 47, 380, 80, 1154635, string.Format("@{0}@{1}@{2}", VendorMap.TeleportCost.ToString(), VendorMap.Name()[0], VendorMap.DeleteDelayMinutes.ToString()), 0x4E73, false, false); // Please select 'Accept' if you would like to pay ~1_cost~ gold to teleport to vendor ~2_name~. For this price you will also be able to teleport back to this location within the next ~3_minutes~ minutes.
|
||||
|
||||
AddButton(7, 167, 0x7747, 0x7747, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(47, 167, 100, 40, 1150300, 0x4E73, false, false); // CANCEL
|
||||
|
||||
AddButton(377, 167, 0x7746, 0x7746, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(267, 167, 100, 40, 1114514, "#1150299", 0x4E73, false, false); // <DIV ALIGN=RIGHT>~1_TOKEN~</DIV>
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
default: break;
|
||||
case 1:
|
||||
{
|
||||
if (Banker.GetBalance(User) < VendorMap.TeleportCost)
|
||||
{
|
||||
User.SendLocalizedMessage(1154672); // You cannot afford to teleport to the vendor.
|
||||
}
|
||||
else if (VendorMap.SetLocation == Point3D.Zero && !VendorSearch.CanSearch(User))
|
||||
{
|
||||
User.SendLocalizedMessage(1154680); //Before using vendor search, you must be in a justice region or a safe log-out location (such as an inn or a house which has you on its Owner, Co-owner, or Friends list).
|
||||
}
|
||||
else if (VendorMap.SetLocation == Point3D.Zero && !VendorSearch.CanSearch(User))
|
||||
{
|
||||
User.SendLocalizedMessage(501035); // You cannot teleport from here to the destination.
|
||||
}
|
||||
else
|
||||
{
|
||||
new Spells.Fourth.RecallSpell(User, VendorMap, VendorMap).Cast();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
411
Scripts/Services/Vendor Searching/VendorSearchMap.cs
Normal file
411
Scripts/Services/Vendor Searching/VendorSearchMap.cs
Normal file
@@ -0,0 +1,411 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.VendorSearching;
|
||||
using Server.Mobiles;
|
||||
using Server.ContextMenus;
|
||||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.Engines.Auction;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class VendorSearchMap : MapItem
|
||||
{
|
||||
public readonly int TeleportCost = 1000;
|
||||
public readonly int DeleteDelayMinutes = 30;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public PlayerVendor Vendor { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public AuctionSafe AuctionSafe { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsAuction { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Item SearchItem { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Point3D SetLocation { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Map SetMap { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime DeleteTime { get; set; }
|
||||
|
||||
public int TimeRemaining { get { return DeleteTime <= DateTime.UtcNow ? 0 : (int)(DeleteTime - DateTime.UtcNow).TotalMinutes; } }
|
||||
|
||||
public VendorSearchMap(Item item, bool auction)
|
||||
: base(item.Map)
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = RecallRune.CalculateHue(item.Map, null, true);
|
||||
|
||||
IsAuction = auction;
|
||||
SearchItem = item;
|
||||
|
||||
Point3D p;
|
||||
|
||||
if (IsAuction)
|
||||
{
|
||||
AuctionSafe = Auction.Auctions.Find(x => x.AuctionItem == item).Safe;
|
||||
p = AuctionSafe.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vendor = item.RootParentEntity as PlayerVendor;
|
||||
p = Vendor.Location;
|
||||
}
|
||||
|
||||
Width = 300;
|
||||
Height = 300;
|
||||
var size = item.Map == Map.Tokuno ? 300 : item.Map == Map.TerMur ? 200 : 600;
|
||||
|
||||
Bounds = new Rectangle2D(p.X - size / 2, p.Y - size / 2, size, size);
|
||||
AddWorldPin(p.X, p.Y);
|
||||
|
||||
DeleteTime = DateTime.UtcNow + TimeSpan.FromMinutes(DeleteDelayMinutes);
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(DeleteDelayMinutes), Delete);
|
||||
}
|
||||
|
||||
public override bool DropToWorld(Mobile from, Point3D p)
|
||||
{
|
||||
from.SendLocalizedMessage(500424); // You destroyed the item.
|
||||
Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
string[] name = Name();
|
||||
|
||||
list.Add(1154559, string.Format("{0}\t{1}", name[0], name[1])); // Map to Vendor ~1_Name~: ~2_Shop~
|
||||
}
|
||||
|
||||
public new string[] Name()
|
||||
{
|
||||
string[] array = new string[2];
|
||||
|
||||
string Name = "Unknown";
|
||||
string Shop = "Unknown";
|
||||
|
||||
if (IsAuction)
|
||||
{
|
||||
if (SearchItem != null)
|
||||
{
|
||||
if (AuctionSafe != null)
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(AuctionSafe);
|
||||
|
||||
if (house != null)
|
||||
Name = house.Sign.GetName();
|
||||
}
|
||||
|
||||
Shop = (SearchItem.LabelNumber != 0) ? string.Format("#{0}", SearchItem.LabelNumber) : SearchItem.Name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Vendor != null)
|
||||
{
|
||||
Name = Vendor.Name;
|
||||
Shop = Vendor.ShopName;
|
||||
}
|
||||
}
|
||||
|
||||
return new string[] { Name, Shop };
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
string[] coord = GetCoords();
|
||||
|
||||
if (SetLocation == Point3D.Zero)
|
||||
list.Add(1154639, string.Format("{0}\t{1}", coord[0], coord[1])); // Vendor Located at ~1_loc~ (~2_facet~)
|
||||
else
|
||||
list.Add(1154638, string.Format("{0}\t{1}", coord[0], coord[1])); // Return to ~1_loc~ (~2_facet~)
|
||||
|
||||
if (!IsSale())
|
||||
{
|
||||
list.Add(1154700); // Item no longer for sale.
|
||||
}
|
||||
|
||||
list.Add(1075269); // Destroyed when dropped
|
||||
}
|
||||
|
||||
public bool IsSale()
|
||||
{
|
||||
return SearchItem != null && (AuctionSafe != null && AuctionSafe.CheckAuctionItem(SearchItem) || Vendor != null && Vendor.GetVendorItem(SearchItem) != null);
|
||||
}
|
||||
|
||||
public string[] GetCoords()
|
||||
{
|
||||
string[] array = new string[2];
|
||||
|
||||
Point3D loc = Point3D.Zero;
|
||||
Map locmap = Map.Internal;
|
||||
|
||||
if (SetLocation != Point3D.Zero)
|
||||
{
|
||||
loc = SetLocation;
|
||||
locmap = SetMap;
|
||||
}
|
||||
else if (AuctionSafe != null)
|
||||
{
|
||||
loc = AuctionSafe.Location;
|
||||
locmap = AuctionSafe.Map;
|
||||
}
|
||||
else if (Vendor != null)
|
||||
{
|
||||
loc = Vendor.Location;
|
||||
locmap = Vendor.Map;
|
||||
}
|
||||
|
||||
if (loc != Point3D.Zero && locmap != Map.Internal)
|
||||
{
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int z = loc.Z;
|
||||
Map map = locmap;
|
||||
|
||||
int xLong = 0, yLat = 0;
|
||||
int xMins = 0, yMins = 0;
|
||||
bool xEast = false, ySouth = false;
|
||||
|
||||
if (Sextant.Format(new Point3D(x, y, z), map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
|
||||
{
|
||||
return new string[] { string.Format("{0}o {1}'{2}, {3}o {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W"), map.ToString() };
|
||||
}
|
||||
}
|
||||
|
||||
return new string[] { "an unknown location", "Unknown" };
|
||||
}
|
||||
|
||||
public void OnBeforeTravel(Mobile from)
|
||||
{
|
||||
if (SetLocation != Point3D.Zero)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Banker.Withdraw(from, TeleportCost);
|
||||
from.SendLocalizedMessage(1060398, TeleportCost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
|
||||
|
||||
SetLocation = from.Location;
|
||||
SetMap = from.Map;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
list.Add(new OpenMapEntry(from, this));
|
||||
|
||||
if (SetLocation == Point3D.Zero)
|
||||
list.Add(new TeleportEntry(from, this));
|
||||
else
|
||||
list.Add(new ReturnTeleportEntry(from, this));
|
||||
|
||||
list.Add(new OpenContainerEntry(from, this));
|
||||
}
|
||||
|
||||
public Point3D GetLocation(Mobile m)
|
||||
{
|
||||
BaseHouse h = null;
|
||||
|
||||
if (SetLocation != Point3D.Zero)
|
||||
{
|
||||
h = BaseHouse.FindHouseAt(SetLocation, SetMap, 16);
|
||||
}
|
||||
else if (IsAuction)
|
||||
{
|
||||
if (AuctionSafe != null)
|
||||
{
|
||||
h = BaseHouse.FindHouseAt(AuctionSafe);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Vendor != null)
|
||||
{
|
||||
h = BaseHouse.FindHouseAt(Vendor);
|
||||
}
|
||||
}
|
||||
|
||||
if (h != null)
|
||||
{
|
||||
m.SendLocalizedMessage(1070905); // Strong magics have redirected you to a safer location!
|
||||
return h.BanLocation;
|
||||
}
|
||||
|
||||
return SetLocation != Point3D.Zero ? SetLocation : Point3D.Zero;
|
||||
}
|
||||
|
||||
public Map GetMap()
|
||||
{
|
||||
if (SetLocation != Point3D.Zero)
|
||||
return SetMap;
|
||||
|
||||
Map map = null;
|
||||
|
||||
if (IsAuction)
|
||||
{
|
||||
if (AuctionSafe != null)
|
||||
{
|
||||
map = AuctionSafe.Map;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Vendor != null)
|
||||
{
|
||||
map = Vendor.Map;
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public class OpenMapEntry : ContextMenuEntry
|
||||
{
|
||||
public VendorSearchMap VendorMap { get; set; }
|
||||
public Mobile Clicker { get; set; }
|
||||
|
||||
public OpenMapEntry(Mobile from, VendorSearchMap map)
|
||||
: base(3006150, 1) // Open Map
|
||||
{
|
||||
VendorMap = map;
|
||||
Clicker = from;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
VendorMap.DisplayTo(Clicker);
|
||||
}
|
||||
}
|
||||
|
||||
public class TeleportEntry : ContextMenuEntry
|
||||
{
|
||||
private VendorSearchMap VendorMap { get; set; }
|
||||
private Mobile Clicker { get; set; }
|
||||
|
||||
public TeleportEntry(Mobile from, VendorSearchMap map)
|
||||
: base(1154558, -1) // Teleport To Vendor
|
||||
{
|
||||
VendorMap = map;
|
||||
Clicker = from;
|
||||
Enabled = VendorMap.IsSale();
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (VendorMap.IsSale())
|
||||
{
|
||||
BaseGump.SendGump(new ConfirmTeleportGump(VendorMap, (PlayerMobile)Clicker));
|
||||
}
|
||||
else
|
||||
{
|
||||
Clicker.SendLocalizedMessage(1154700); // Item no longer for sale.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ReturnTeleportEntry : ContextMenuEntry
|
||||
{
|
||||
private VendorSearchMap VendorMap { get; set; }
|
||||
private Mobile Clicker { get; set; }
|
||||
|
||||
public ReturnTeleportEntry(Mobile from, VendorSearchMap map)
|
||||
: base(1154636, -1) // Return to Previous Location
|
||||
{
|
||||
VendorMap = map;
|
||||
Clicker = from;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (Clicker is PlayerMobile)
|
||||
{
|
||||
BaseGump.SendGump(new ConfirmTeleportGump(VendorMap, (PlayerMobile)Clicker));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class OpenContainerEntry : ContextMenuEntry
|
||||
{
|
||||
private VendorSearchMap VendorMap { get; set; }
|
||||
private Mobile Clicker { get; set; }
|
||||
private Container Container { get; set; }
|
||||
|
||||
public OpenContainerEntry(Mobile from, VendorSearchMap map)
|
||||
: base(1154699, -1) // Open Container Containing Item
|
||||
{
|
||||
VendorMap = map;
|
||||
Clicker = from;
|
||||
|
||||
if (VendorMap.SearchItem != null)
|
||||
Container = VendorMap.SearchItem.ParentEntity as Container;
|
||||
|
||||
Enabled = IsAccessible();
|
||||
}
|
||||
|
||||
private bool IsAccessible()
|
||||
{
|
||||
if (Container == null || VendorMap.IsAuction)
|
||||
return false;
|
||||
|
||||
if (!Container.IsAccessibleTo(Clicker))
|
||||
return false;
|
||||
|
||||
if (!Clicker.InRange(Container.GetWorldLocation(), 18))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
RecurseOpen(Container, Clicker);
|
||||
}
|
||||
|
||||
private static void RecurseOpen(Container c, Mobile from)
|
||||
{
|
||||
if (c.Parent is Container parent)
|
||||
RecurseOpen(parent, from);
|
||||
|
||||
c.DisplayTo(from);
|
||||
}
|
||||
}
|
||||
|
||||
public VendorSearchMap(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user