public override bool Matches(IVendorSearchItem item) { var bonuses = item as ISkillBonuses; if (bonuses != null) { for (int i = 0; i < 5; ++i) { SkillName skill; double bonus; if (!bonuses.SkillBonuses.GetValues(i, out skill, out bonus)) { continue; } if (skill == Skill && ((int)bonus) >= Value) { return(true); } } } return(false); }
public override bool Matches(IVendorSearchItem item) { AosSkillBonuses attrib = null; if (item is BaseArmor) attrib = ((BaseArmor) item).SkillBonuses; else if (item is BaseClothing) attrib = ((BaseClothing) item).SkillBonuses; else if (item is BaseJewel) attrib = ((BaseJewel) item).SkillBonuses; else if (item is BaseQuiver) attrib = ((BaseQuiver) item).SkillBonuses; else if (item is BaseTalisman) attrib = ((BaseTalisman) item).SkillBonuses; else if (item is BaseWeapon) attrib = ((BaseWeapon) item).SkillBonuses; if (attrib != null) { for (var i = 0; i < 5; ++i) { SkillName skill; double bonus; if (!attrib.GetValues(i, out skill, out bonus)) continue; if (skill == Skill && ((int) bonus) >= Value) return true; } } return false; }
public override int LabelNumber { get { return 1154661; } } // Faction Item public override bool Matches( IVendorSearchItem item ) { if ( item is IFactionArtifact ) return true; return item is IFactionItem && ( (IFactionItem) item ).FactionItemState != null; }
public override bool Matches(IVendorSearchItem item) { var slayer = item.Item as ISlayer; if (slayer != null) return slayer.Slayer == Slayer || slayer.Slayer2 == Slayer; return false; }
public override bool Matches(IVendorSearchItem item) { var talisman = item.Item as BaseTalisman; if (talisman != null) return talisman.Slayer == Slayer; return false; }
public override bool Matches( IVendorSearchItem item ) { var weapon = item.Item as BaseWeapon; if ( weapon != null ) return weapon.Skill == RequiredSkill; else return false; }
public override bool Matches(IVendorSearchItem item) { AosArmorAttributes attrib = null; if (item is BaseArmor) attrib = ((BaseArmor) item).ArmorAttributes; return attrib != null && attrib[Attribute] != 0; }
} // Faction Item public override bool Matches(IVendorSearchItem item) { if (item is IFactionArtifact) { return(true); } return(item is IFactionItem && ((IFactionItem)item).FactionItemState != null); }
} // Balanced public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as BaseRanged; if (weapon != null) return weapon.Balanced.Equals(true); return false; }
} // artifact rarity ~1_val~ public override bool Matches(IVendorSearchItem item) { const string property = "ArtifactRarity"; var value = -1; if (item.Item.ContainsProperty(property)) { value = item.Item.GetValue(property); } return value.Equals(Value); }
public override bool Matches(IVendorSearchItem item) { SAAbsorptionAttributes attrib = null; if (item is BaseArmor) attrib = ((BaseArmor) item).AbsorptionAttributes; else if (item is BaseJewel) attrib = ((BaseJewel) item).AbsorptionAttributes; else if (item is BaseWeapon) attrib = ((BaseWeapon) item).AbsorptionAttributes; return attrib != null && attrib[Attribute] >= Value; }
public override bool Matches(IVendorSearchItem item) { var talisman = item.Item as BaseTalisman; if (talisman != null) { return(talisman.TalisSlayer == Slayer); } else { return(false); } }
public override bool Matches(IVendorSearchItem item) { var slayer = item.Item as ISlayer; if (slayer != null) { return(slayer.Slayer == Slayer || slayer.Slayer2 == Slayer); } else { return(false); } }
public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as BaseWeapon; if (weapon != null) { return(weapon.Skill == RequiredSkill); } else { return(false); } }
public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as BaseWeapon; if (weapon != null) { return(GetElementAttributeValue(weapon, Element) >= Value); } else { return(false); } }
} // Cannot Be Repaired public override bool Matches(IVendorSearchItem item) { var cr = false; if (item is BaseArmor) cr = ((BaseArmor) item).BlockRepair; else if (item is BaseClothing) cr = ((BaseClothing) item).BlockRepair; else if (item is BaseJewel) cr = ((BaseJewel) item).BlockRepair; else if (item is BaseWeapon) cr = ((BaseWeapon) item).BlockRepair; return !cr; }
public override bool Matches(IVendorSearchItem item) { AosAttributes attrib = null; if (item is BaseArmor) attrib = ((BaseArmor) item).Attributes; if (item is BaseClothing) attrib = ((BaseClothing) item).Attributes; if (item is BaseJewel) attrib = ((BaseJewel) item).Attributes; if (item is BaseWeapon) attrib = ((BaseWeapon) item).Attributes; return attrib != null && attrib[Attribute] != 0; }
} // Brittle public override bool Matches(IVendorSearchItem item) { var x = item.Item; if (x is BaseArmor) return ((BaseArmor) x).Attributes.Brittle > 0; if (x is BaseJewel) return ((BaseJewel) x).Attributes.Brittle > 0; if (x is BaseWeapon) return ((BaseWeapon) x).Attributes.Brittle > 0; if (x is BaseClothing) return ((BaseClothing) x).Attributes.Brittle > 0; return false; }
public override bool Matches(IVendorSearchItem item) { var x = item.Item; if (x is BaseArmor) return ((BaseArmor) x).RequiredRace == RequiredRace; if (x is BaseJewel) return ((BaseJewel) x).RequiredRace == RequiredRace; if (x is BaseWeapon) return ((BaseWeapon) x).RequiredRace == RequiredRace; if (x is BaseClothing) return ((BaseClothing) x).RequiredRace == RequiredRace; return false; }
public override bool Matches(IVendorSearchItem item) { var magicalItem = item.Item as IMagicalItem; if (magicalItem == null) { return(false); } int value = Value; if (magicalItem.Attributes.SpellChanneling != 0) { value++; } return(magicalItem.Attributes[Attribute] >= value); }
public bool Matches(IVendorSearchItem item) { if (item.Price < m_MinPrice || item.Price > m_MaxPrice) { return(false); } Item i = item.Item; if (!string.IsNullOrEmpty(m_Name)) { string name = i.Name ?? i.GetNameProperty().Delocalize().ToLower(); if (!name.Contains(m_Name)) { return(false); } } return(m_Criteria.Values.All(c => c.Matches(item))); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 2) { VendorSearchQueryGump.StartSearch(from, m_Criteria, m_Page + 1); return; } int index = info.ButtonID - 100; if (!from.BeginAction(typeof(ShopMap))) { from.SendLocalizedMessage(500119); // You must wait to perform another action return; } Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => from.EndAction(typeof(ShopMap))); if (index >= 0 && index < m_Items.Length) { IVendorSearchItem item = m_Items[index]; var mapItem = new ShopMap(item.Vendor, item.Container); if (from.AddToBackpack(mapItem)) { from.SendLocalizedMessage(1154690); // The vendor map has been placed in your backpack. } else { from.SendLocalizedMessage(502385); // Your pack cannot hold this item. mapItem.Delete(); } from.SendGump(new VendorSearchResultsGump(m_Items, m_Criteria, m_Page)); } }
/// <summary> /// Returns whether the given vendor item will appear in the search results filtered by this criterion. /// </summary> /// <param name="item">The item</param> /// <returns></returns> public abstract bool Matches(IVendorSearchItem item);
public override bool Matches( IVendorSearchItem item ) { var magicalItem = item.Item as IMagicalItem; if ( magicalItem == null ) return false; int value = Value; if ( magicalItem.Attributes.SpellChanneling != 0 ) value++; return magicalItem.Attributes[Attribute] >= value; }
} // mage weapon -~1_val~ skill public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as BaseWeapon; return weapon != null && weapon.WeaponAttributes.MageWeapon == (30 - Value); }
public override bool Matches(IVendorSearchItem item) { return item.Item is BaseWeapon && ((BaseWeapon) item.Item).WeaponAttributes[Attribute] != 0; }
} // energy resist ~1_val~% public override bool Matches(IVendorSearchItem item) { return(item.Item.EnergyResistance >= Value); }
public override bool Matches(IVendorSearchItem item) { return(item.Item is IWeapon && ((IWeapon)item.Item).WeaponAttributes[Attribute] != 0); }
public bool Matches(IVendorSearchItem item) { if (item.Price < m_MinPrice || item.Price > m_MaxPrice) return false; var i = item.Item; if (!string.IsNullOrEmpty(m_Name)) { var name = i.Name ?? i.GetType().Name; if (!name.ToLower().Contains(m_Name.ToLower())) return false; } return m_Criteria.Values.All(c => c.Matches(item)); }
public override sealed bool Matches(IVendorSearchItem item) { return(ItemType.IsAssignableFrom(item.Item.GetType())); }
public override sealed bool Matches( IVendorSearchItem item ) { return ItemType.IsAssignableFrom( item.Item.GetType() ); }
} // Brittle public override bool Matches(IVendorSearchItem item) { return(item.Item is IDurability && ((IDurability)item.Item).Brittle); }
public override int LabelNumber { get { return 1060446; } } // energy resist ~1_val~% public override bool Matches( IVendorSearchItem item ) { return item.Item.EnergyResistance >= Value; }
public override bool Matches(IVendorSearchItem item) { return(item.Item.Layer == Layer); }
public bool Matches( IVendorSearchItem item ) { if ( item.Price < m_MinPrice || item.Price > m_MaxPrice ) return false; Item i = item.Item; if ( !string.IsNullOrEmpty( m_Name ) ) { string name = i.Name ?? i.GetNameProperty().Delocalize().ToLower(); if ( !name.Contains( m_Name ) ) return false; } return m_Criteria.Values.All( c => c.Matches( item ) ); }
} // Cursed public override bool Matches(IVendorSearchItem item) { return(item.Item.LootType == LootType.Cursed); }
public override bool Matches( IVendorSearchItem item ) { return item.Item.RequiredRace == RequiredRace; }
} // Cannot Be Repaired public override bool Matches(IVendorSearchItem item) { return(item.Item is IDurability && ((IDurability)item.Item).CannotBeRepaired); }
public override bool Matches(IVendorSearchItem item) { return(item.Item is IMagicalItem && ((IMagicalItem)item.Item).Attributes[Attribute] != 0); }
} // mage weapon -~1_val~ skill public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as IWeapon; return(weapon != null && weapon.WeaponAttributes.MageWeapon == (30 - Value)); }
public override bool Matches(IVendorSearchItem item) { return(item.Item.RequiredRace == RequiredRace); }
public override bool Matches(IVendorSearchItem item) { var weapon = item.Item as BaseWeapon; if (weapon != null) return (GetElementAttributeValue(weapon, Element) >= Value); return false; }
public override bool Matches(IVendorSearchItem item) { return(item.Item is IAbsorption && ((IAbsorption)item.Item).AbsorptionAttributes[Attribute] >= Value); }
public override bool Matches(IVendorSearchItem item) { return item.Item.Layer == Layer; }
} // Cursed public override bool Matches(IVendorSearchItem item) { return item.Item.LootType == LootType.Cursed; }
public override bool Matches( IVendorSearchItem item ) { var bonuses = item as ISkillBonuses; if ( bonuses != null ) { for ( int i = 0; i < 5; ++i ) { SkillName skill; double bonus; if ( !bonuses.SkillBonuses.GetValues( i, out skill, out bonus ) ) continue; if ( skill == Skill && ( (int) bonus ) >= Value ) return true; } } return false; }
public override bool Matches( IVendorSearchItem item ) { return item.Item is IMagicalItem && ( (IMagicalItem) item.Item ).Attributes[Attribute] >= Value; }
public override bool Matches(IVendorSearchItem item) { if (item.Item is BaseWeapon) return ((BaseWeapon) item.Item).Skill.Equals(RequiredSkill); return false; }
public VendorSearchResultsGump(IVendorSearchItem[] items, SearchCriteria criteria, int page) : base(30, 30) { m_Items = items; m_Criteria = criteria; m_Page = page; int pageIndex = 0; AddPage(pageIndex++); AddBackground(0, 0, 500, 550, 0x7748); AddHtmlLocalized(50, 50, 400, 18, 1154509, 0x4BBD, false, false); // <center>Vendor Search Results</center> AddHtmlLocalized(162, 70, 102, 18, 1114513, "#1062218", 0x4BBD, false, false); // <DIV ALIGN=CENTER>Price</DIV> AddHtmlLocalized(274, 70, 61, 18, 1114513, "#1154644", 0x4BBD, false, false); // <DIV ALIGN=CENTER>Facet</DIV> AddHtmlLocalized(345, 70, 102, 18, 1114513, "#1154642", 0x4BBD, false, false); // <DIV ALIGN=CENTER>Create Map</DIV> int yOffset = 0; for (int i = 0; i < m_Items.Length; i++) { IVendorSearchItem item = m_Items[i]; if ((i % ResultsPerPage) == 0) { AddPage(pageIndex); if (pageIndex > 1) { AddButton(50, 480, 0x7745, 0x7745, 0, GumpButtonType.Page, pageIndex - 1); AddHtmlLocalized(90, 480, 255, 20, 1044044, 0x4BBD, false, false); // PREV PAGE } bool thereAreMorePages = (i + ResultsPerPage < m_Items.Length); if (thereAreMorePages) { AddButton(430, 480, 0x7745, 0x7745, 0, GumpButtonType.Page, pageIndex + 1); AddHtmlLocalized(355, 480, 70, 20, 1114514, "#1044045", 0x4BBD, false, false); // <DIV ALIGN=RIGHT>NEXT PAGE</DIV> } pageIndex++; yOffset = 0; } AddButtonTileArt(50, 101 + yOffset, 0x918, 0x918, GumpButtonType.Page, 0, 0, item.Item.ItemID, item.Item.Hue, 18, 12); AddItemPropertyTooltip(item.Item); AddHtmlLocalized(162, 101 + yOffset, 102, 72, item.IsContained ? 1154598 : 1154645, item.Price.ToString("N0"), 0x6B55, false, false); // <center>Container Price<BR>~1_cost~</center> / <center>~1_val~</center> AddHtmlLocalized(274, 101 + yOffset, 102, 72, item.Item.Map.GetNameCliloc(), 0x6B55, false, false); AddButton(386, 106 + yOffset, 0x7745, 0x7745, 100 + i, GumpButtonType.Reply, 0); yOffset += 74; } if (m_Items.Length == VendorItemFinder.MaxResults) { AddButton(430, 480, 0x7745, 0x7745, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(225, 480, 200, 20, 1114514, "#1154687", 0x4BBD, false, false); // <DIV ALIGN=RIGHT>~1_TOKEN~</DIV> } }
public override int LabelNumber { get { return 1151826; } } // Cannot Be Repaired public override bool Matches( IVendorSearchItem item ) { return item.Item is IDurability && ( (IDurability) item.Item ).CannotBeRepaired; }
public VendorSearchResultsGump( IVendorSearchItem[] items, SearchCriteria criteria, int page ) : base(30, 30) { m_Items = items; m_Criteria = criteria; m_Page = page; int pageIndex = 0; AddPage( pageIndex++ ); AddBackground( 0, 0, 500, 550, 0x7748 ); AddHtmlLocalized( 50, 50, 400, 18, 1154509, 0x4BBD, false, false ); // <center>Vendor Search Results</center> AddHtmlLocalized( 162, 70, 102, 18, 1114513, "#1062218", 0x4BBD, false, false ); // <DIV ALIGN=CENTER>Price</DIV> AddHtmlLocalized( 274, 70, 61, 18, 1114513, "#1154644", 0x4BBD, false, false ); // <DIV ALIGN=CENTER>Facet</DIV> AddHtmlLocalized( 345, 70, 102, 18, 1114513, "#1154642", 0x4BBD, false, false ); // <DIV ALIGN=CENTER>Create Map</DIV> int yOffset = 0; for ( int i = 0; i < m_Items.Length; i++ ) { IVendorSearchItem item = m_Items[i]; if ( ( i % ResultsPerPage ) == 0 ) { AddPage( pageIndex ); if ( pageIndex > 1 ) { AddButton( 50, 480, 0x7745, 0x7745, 0, GumpButtonType.Page, pageIndex - 1 ); AddHtmlLocalized( 90, 480, 255, 20, 1044044, 0x4BBD, false, false ); // PREV PAGE } bool thereAreMorePages = ( i + ResultsPerPage < m_Items.Length ); if ( thereAreMorePages ) { AddButton( 430, 480, 0x7745, 0x7745, 0, GumpButtonType.Page, pageIndex + 1 ); AddHtmlLocalized( 355, 480, 70, 20, 1114514, "#1044045", 0x4BBD, false, false ); // <DIV ALIGN=RIGHT>NEXT PAGE</DIV> } pageIndex++; yOffset = 0; } AddButtonTileArt( 50, 101 + yOffset, 0x918, 0x918, GumpButtonType.Page, 0, 0, item.Item.ItemID, item.Item.Hue, 18, 12 ); AddItemPropertyTooltip( item.Item ); AddHtmlLocalized( 162, 101 + yOffset, 102, 72, item.IsContained ? 1154598 : 1154645, item.Price.ToString( "N0" ), 0x6B55, false, false ); // <center>Container Price<BR>~1_cost~</center> / <center>~1_val~</center> AddHtmlLocalized( 274, 101 + yOffset, 102, 72, item.Item.Map.GetNameCliloc(), 0x6B55, false, false ); AddButton( 386, 106 + yOffset, 0x7745, 0x7745, 100 + i, GumpButtonType.Reply, 0 ); yOffset += 74; } if ( m_Items.Length == VendorItemFinder.MaxResults ) { AddButton( 430, 480, 0x7745, 0x7745, 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 225, 480, 200, 20, 1114514, "#1154687", 0x4BBD, false, false ); // <DIV ALIGN=RIGHT>~1_TOKEN~</DIV> } }
} // Exclude items on Felucca public override bool Matches(IVendorSearchItem item) { return(item.Vendor.Map != Map.Felucca); }
public override bool Matches(IVendorSearchItem item) { return(item.Item is IArmor && ((IArmor)item.Item).ArmorAttributes[Attribute] != 0); }
} // artifact rarity ~1_val~ public override bool Matches(IVendorSearchItem item) { return(item.Item is IArtifactRarity && ((IArtifactRarity)item.Item).ArtifactRarity == Value); }