Core/Items: implement some helper methods for easier readability
Port From (https://github.com/TrinityCore/TrinityCore/commit/9124fd1f1fafea19b118eb69c6a35f94376fc7e8)
This commit is contained in:
@@ -440,7 +440,7 @@ namespace Game.Entities
|
||||
public bool IgnoreFiltering;
|
||||
|
||||
//helpers
|
||||
public bool IsGoldRequired(ItemTemplate pProto) { return Convert.ToBoolean(pProto.GetFlags2() & ItemFlags2.DontIgnoreBuyPrice) || ExtendedCost == 0; }
|
||||
public bool IsGoldRequired(ItemTemplate pProto) { return pProto.HasFlag(ItemFlags2.DontIgnoreBuyPrice) || ExtendedCost == 0; }
|
||||
}
|
||||
|
||||
public class VendorItemData
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace Game.Entities
|
||||
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
if ((uState == ItemUpdateState.Changed) && HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
if ((uState == ItemUpdateState.Changed) && IsWrapped())
|
||||
{
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GIFT_OWNER);
|
||||
stmt.AddValue(0, GetOwnerGUID().GetCounter());
|
||||
@@ -372,7 +372,7 @@ namespace Game.Entities
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
trans.Append(stmt);
|
||||
|
||||
if (HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
if (IsWrapped())
|
||||
{
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
@@ -446,7 +446,7 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_itemData).ModifyValue(m_itemData.MaxDurability), proto.MaxDurability);
|
||||
|
||||
// do not overwrite durability for wrapped items
|
||||
if (durability > proto.MaxDurability && !HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
if (durability > proto.MaxDurability && !IsWrapped())
|
||||
{
|
||||
SetDurability(proto.MaxDurability);
|
||||
need_save = true;
|
||||
@@ -805,7 +805,7 @@ namespace Game.Entities
|
||||
if (m_lootGenerated)
|
||||
return false;
|
||||
|
||||
if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasItemFlag(ItemFieldFlags.BopTradeable) || !trade)))
|
||||
if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!IsBOPTradeable() || !trade)))
|
||||
return false;
|
||||
|
||||
if (IsBag() && (Player.IsBagPos(GetPos()) || !ToBag().IsEmpty()))
|
||||
@@ -924,7 +924,7 @@ namespace Game.Entities
|
||||
bool isEnchantSpell = spellInfo.HasEffect(SpellEffectName.EnchantItem) || spellInfo.HasEffect(SpellEffectName.EnchantItemTemporary) || spellInfo.HasEffect(SpellEffectName.EnchantItemPrismatic);
|
||||
if ((int)spellInfo.EquippedItemClass != -1) // -1 == any item class
|
||||
{
|
||||
if (isEnchantSpell && proto.GetFlags3().HasAnyFlag(ItemFlags3.CanStoreEnchants))
|
||||
if (isEnchantSpell && proto.HasFlag(ItemFlags3.CanStoreEnchants))
|
||||
return true;
|
||||
|
||||
if (spellInfo.EquippedItemClass != proto.GetClass())
|
||||
@@ -1209,7 +1209,7 @@ namespace Game.Entities
|
||||
if (GetOwnerGUID() == player.GetGUID())
|
||||
return false;
|
||||
|
||||
if (HasItemFlag(ItemFieldFlags.BopTradeable))
|
||||
if (IsBOPTradeable())
|
||||
if (allowedGUIDs.Contains(player.GetGUID()))
|
||||
return false;
|
||||
|
||||
@@ -1355,7 +1355,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetNotRefundable(Player owner, bool changestate = true, SQLTransaction trans = null, bool addToCollection = true)
|
||||
{
|
||||
if (!HasItemFlag(ItemFieldFlags.Refundable))
|
||||
if (!IsRefundable())
|
||||
return;
|
||||
|
||||
ItemExpirePurchaseRefund itemExpirePurchaseRefund = new();
|
||||
@@ -1458,7 +1458,7 @@ namespace Game.Entities
|
||||
if (proto.GetClass() == ItemClass.Weapon && proto.GetSubClass() == (uint)ItemSubClassWeapon.FishingPole)
|
||||
return false;
|
||||
|
||||
if (proto.GetFlags2().HasAnyFlag(ItemFlags2.NoAlterItemVisual))
|
||||
if (proto.HasFlag(ItemFlags2.NoAlterItemVisual))
|
||||
return false;
|
||||
|
||||
if (!HasStats())
|
||||
@@ -1614,7 +1614,7 @@ namespace Game.Entities
|
||||
{
|
||||
standardPrice = true;
|
||||
|
||||
if (proto.GetFlags2().HasAnyFlag(ItemFlags2.OverrideGoldCost))
|
||||
if (proto.HasFlag(ItemFlags2.OverrideGoldCost))
|
||||
return proto.GetBuyPrice();
|
||||
|
||||
var qualityPrice = CliDB.ImportPriceQualityStorage.LookupByKey(quality + 1);
|
||||
@@ -1746,7 +1746,7 @@ namespace Game.Entities
|
||||
|
||||
public static uint GetSellPrice(ItemTemplate proto, uint quality, uint itemLevel)
|
||||
{
|
||||
if (proto.GetFlags2().HasAnyFlag(ItemFlags2.OverrideGoldCost))
|
||||
if (proto.HasFlag(ItemFlags2.OverrideGoldCost))
|
||||
return proto.GetSellPrice();
|
||||
|
||||
bool standardPrice;
|
||||
@@ -1772,7 +1772,7 @@ namespace Game.Entities
|
||||
ItemTemplate itemTemplate = GetTemplate();
|
||||
uint minItemLevel = owner.m_unitData.MinItemLevel;
|
||||
uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff;
|
||||
uint maxItemLevel = itemTemplate.GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel;
|
||||
uint maxItemLevel = itemTemplate.HasFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel;
|
||||
bool pvpBonus = owner.IsUsingPvpItemLevels();
|
||||
|
||||
uint azeriteLevel = 0;
|
||||
@@ -1867,7 +1867,7 @@ namespace Game.Entities
|
||||
|
||||
public static ItemDisenchantLootRecord GetDisenchantLoot(ItemTemplate itemTemplate, uint quality, uint itemLevel)
|
||||
{
|
||||
if (itemTemplate.GetFlags().HasAnyFlag(ItemFlags.Conjured | ItemFlags.NoDisenchant) || itemTemplate.GetBonding() == ItemBondingType.Quest)
|
||||
if (itemTemplate.HasFlag(ItemFlags.Conjured) || itemTemplate.HasFlag(ItemFlags.NoDisenchant) || itemTemplate.GetBonding() == ItemBondingType.Quest)
|
||||
return null;
|
||||
|
||||
if (itemTemplate.GetArea(0) != 0 || itemTemplate.GetArea(1) != 0 || itemTemplate.GetMap() != 0 || itemTemplate.GetMaxStackSize() > 1)
|
||||
@@ -2501,8 +2501,8 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public bool IsSoulBound() { return HasItemFlag(ItemFieldFlags.Soulbound); }
|
||||
public bool IsBoundAccountWide() { return GetTemplate().GetFlags().HasAnyFlag(ItemFlags.IsBoundToAccount); }
|
||||
public bool IsBattlenetAccountBound() { return GetTemplate().GetFlags2().HasAnyFlag(ItemFlags2.BnetAccountTradeOk); }
|
||||
public bool IsBoundAccountWide() { return GetTemplate().HasFlag(ItemFlags.IsBoundToAccount); }
|
||||
public bool IsBattlenetAccountBound() { return GetTemplate().HasFlag(ItemFlags2.BnetAccountTradeOk); }
|
||||
|
||||
public bool HasItemFlag(ItemFieldFlags flag) { return (m_itemData.DynamicFlags & (uint)flag) != 0; }
|
||||
public void AddItemFlag(ItemFieldFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_itemData).ModifyValue(m_itemData.DynamicFlags), (uint)flags); }
|
||||
@@ -2517,6 +2517,9 @@ namespace Game.Entities
|
||||
public AzeriteItem ToAzeriteItem() { return IsAzeriteItem() ? this as AzeriteItem : null; }
|
||||
public AzeriteEmpoweredItem ToAzeriteEmpoweredItem() { return IsAzeriteEmpoweredItem() ? this as AzeriteEmpoweredItem : null; }
|
||||
|
||||
public bool IsRefundable() { return HasItemFlag(ItemFieldFlags.Refundable); }
|
||||
public bool IsBOPTradeable() { return HasItemFlag(ItemFieldFlags.BopTradeable); }
|
||||
public bool IsWrapped() { return HasItemFlag(ItemFieldFlags.Wrapped); }
|
||||
public bool IsLocked() { return !HasItemFlag(ItemFieldFlags.Unlocked); }
|
||||
public bool IsBag() { return GetTemplate().GetInventoryType() == InventoryType.Bag; }
|
||||
public bool IsAzeriteItem() { return GetTypeId() == TypeId.AzeriteItem; }
|
||||
@@ -2784,8 +2787,8 @@ namespace Game.Entities
|
||||
for (int i = EffectCount; i < Effects.Length; ++i)
|
||||
Effects[i] = null;
|
||||
|
||||
CanDisenchant = !proto.GetFlags().HasAnyFlag(ItemFlags.NoDisenchant);
|
||||
CanScrap = proto.GetFlags4().HasAnyFlag(ItemFlags4.Scrapable);
|
||||
CanDisenchant = !proto.HasFlag(ItemFlags.NoDisenchant);
|
||||
CanScrap = proto.HasFlag(ItemFlags4.Scrapable);
|
||||
|
||||
_state.SuffixPriority = int.MaxValue;
|
||||
_state.AppearanceModPriority = int.MaxValue;
|
||||
|
||||
@@ -45,9 +45,15 @@ namespace Game.Entities
|
||||
return GetMaxStackSize() == 1 &&
|
||||
GetClass() != ItemClass.Consumable &&
|
||||
GetClass() != ItemClass.Quest &&
|
||||
!GetFlags().HasFlag(ItemFlags.NoCreator) &&
|
||||
!HasFlag(ItemFlags.NoCreator) &&
|
||||
GetId() != 6948; /*Hearthstone*/
|
||||
}
|
||||
|
||||
public bool HasFlag(ItemFlags flag) { return (ExtendedData.Flags[0] & (int)flag) != 0; }
|
||||
public bool HasFlag(ItemFlags2 flag) { return (ExtendedData.Flags[1] & (int)flag) != 0; }
|
||||
public bool HasFlag(ItemFlags3 flag) { return (ExtendedData.Flags[2] & (int)flag) != 0; }
|
||||
public bool HasFlag(ItemFlags4 flag) { return (ExtendedData.Flags[3] & (int)flag) != 0; }
|
||||
public bool HasFlag(ItemFlagsCustom customFlag) { return (FlagsCu & customFlag) != 0; }
|
||||
|
||||
public bool CanChangeEquipStateInCombat()
|
||||
{
|
||||
@@ -180,7 +186,7 @@ namespace Game.Entities
|
||||
dps = CliDB.ItemDamageAmmoStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
break;
|
||||
case InventoryType.Weapon2Hand:
|
||||
if (GetFlags2().HasAnyFlag(ItemFlags2.CasterWeapon))
|
||||
if (HasFlag(ItemFlags2.CasterWeapon))
|
||||
dps = CliDB.ItemDamageTwoHandCasterStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
else
|
||||
dps = CliDB.ItemDamageTwoHandStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
@@ -196,7 +202,7 @@ namespace Game.Entities
|
||||
case ItemSubClassWeapon.Bow:
|
||||
case ItemSubClassWeapon.Gun:
|
||||
case ItemSubClassWeapon.Crossbow:
|
||||
if (GetFlags2().HasAnyFlag(ItemFlags2.CasterWeapon))
|
||||
if (HasFlag(ItemFlags2.CasterWeapon))
|
||||
dps = CliDB.ItemDamageTwoHandCasterStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
else
|
||||
dps = CliDB.ItemDamageTwoHandStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
@@ -208,7 +214,7 @@ namespace Game.Entities
|
||||
case InventoryType.Weapon:
|
||||
case InventoryType.WeaponMainhand:
|
||||
case InventoryType.WeaponOffhand:
|
||||
if (GetFlags2().HasAnyFlag(ItemFlags2.CasterWeapon))
|
||||
if (HasFlag(ItemFlags2.CasterWeapon))
|
||||
dps = CliDB.ItemDamageOneHandCasterStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
else
|
||||
dps = CliDB.ItemDamageOneHandStorage.LookupByKey(itemLevel).Quality[(int)quality];
|
||||
@@ -234,7 +240,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsUsableByLootSpecialization(Player player, bool alwaysAllowBoundToAccount)
|
||||
{
|
||||
if (GetFlags().HasAnyFlag(ItemFlags.IsBoundToAccount) && alwaysAllowBoundToAccount)
|
||||
if (HasFlag(ItemFlags.IsBoundToAccount) && alwaysAllowBoundToAccount)
|
||||
return true;
|
||||
|
||||
uint spec = player.GetLootSpecId();
|
||||
@@ -265,10 +271,6 @@ namespace Game.Entities
|
||||
public ItemClass GetClass() { return (ItemClass)BasicData.ClassID; }
|
||||
public uint GetSubClass() { return BasicData.SubclassID; }
|
||||
public ItemQuality GetQuality() { return (ItemQuality)ExtendedData.OverallQualityID; }
|
||||
public ItemFlags GetFlags() { return (ItemFlags)ExtendedData.Flags[0]; }
|
||||
public ItemFlags2 GetFlags2() { return (ItemFlags2)ExtendedData.Flags[1]; }
|
||||
public ItemFlags3 GetFlags3() { return (ItemFlags3)ExtendedData.Flags[2]; }
|
||||
public ItemFlags4 GetFlags4() { return (ItemFlags4)ExtendedData.Flags[3]; }
|
||||
public uint GetOtherFactionItemId() { return ExtendedData.FactionRelated; }
|
||||
public float GetPriceRandomValue() { return ExtendedData.PriceRandomValue; }
|
||||
public float GetPriceVariance() { return ExtendedData.PriceVariance; }
|
||||
@@ -327,9 +329,9 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public bool IsPotion() { return GetClass() == ItemClass.Consumable && GetSubClass() == (uint)ItemSubClassConsumable.Potion; }
|
||||
public bool IsVellum() { return GetFlags3().HasAnyFlag(ItemFlags3.CanStoreEnchants); }
|
||||
public bool IsConjuredConsumable() { return GetClass() == ItemClass.Consumable && GetFlags().HasAnyFlag(ItemFlags.Conjured); }
|
||||
public bool IsCraftingReagent() { return GetFlags2().HasAnyFlag(ItemFlags2.UsedInATradeskill); }
|
||||
public bool IsVellum() { return HasFlag(ItemFlags3.CanStoreEnchants); }
|
||||
public bool IsConjuredConsumable() { return GetClass() == ItemClass.Consumable && HasFlag(ItemFlags.Conjured); }
|
||||
public bool IsCraftingReagent() { return HasFlag(ItemFlags2.UsedInATradeskill); }
|
||||
|
||||
public bool IsWeapon() { return GetClass() == ItemClass.Weapon; }
|
||||
|
||||
|
||||
@@ -599,7 +599,7 @@ namespace Game.Entities
|
||||
if (!CanAddAppearance(itemModifiedAppearance))
|
||||
return;
|
||||
|
||||
if (item.HasItemFlag(ItemFieldFlags.BopTradeable | ItemFieldFlags.Refundable))
|
||||
if (item.IsBOPTradeable() || item.IsRefundable())
|
||||
{
|
||||
AddTemporaryAppearance(item.GetGUID(), itemModifiedAppearance);
|
||||
return;
|
||||
@@ -638,7 +638,7 @@ namespace Game.Entities
|
||||
if (_owner.GetPlayer().CanUseItem(itemTemplate) != InventoryResult.Ok)
|
||||
return false;
|
||||
|
||||
if (itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.NoSourceForItemVisual) || itemTemplate.GetQuality() == ItemQuality.Artifact)
|
||||
if (itemTemplate.HasFlag(ItemFlags2.NoSourceForItemVisual) || itemTemplate.GetQuality() == ItemQuality.Artifact)
|
||||
return false;
|
||||
|
||||
switch (itemTemplate.GetClass())
|
||||
@@ -691,7 +691,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (itemTemplate.GetQuality() < ItemQuality.Uncommon)
|
||||
if (!itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.IgnoreQualityForItemVisualSource) || !itemTemplate.GetFlags3().HasAnyFlag(ItemFlags3.ActsAsTransmogHiddenVisualOption))
|
||||
if (!itemTemplate.HasFlag(ItemFlags2.IgnoreQualityForItemVisualSource) || !itemTemplate.HasFlag(ItemFlags3.ActsAsTransmogHiddenVisualOption))
|
||||
return false;
|
||||
|
||||
if (itemModifiedAppearance.Id < _appearances.Count && _appearances.Get((int)itemModifiedAppearance.Id))
|
||||
|
||||
@@ -232,13 +232,13 @@ namespace Game.Entities
|
||||
remove = true;
|
||||
}
|
||||
// "Conjured items disappear if you are logged out for more than 15 minutes"
|
||||
else if (timeDiff > 15 * Time.Minute && proto.GetFlags().HasAnyFlag(ItemFlags.Conjured))
|
||||
else if (timeDiff > 15 * Time.Minute && proto.HasFlag(ItemFlags.Conjured))
|
||||
{
|
||||
Log.outDebug(LogFilter.Player, "LoadInventory: player (GUID: {0}, name: {1}, diff: {2}) has conjured item (GUID: {3}, entry: {4}) with expired lifetime (15 minutes). Deleting item.",
|
||||
GetGUID().ToString(), GetName(), timeDiff, item.GetGUID().ToString(), item.GetEntry());
|
||||
remove = true;
|
||||
}
|
||||
if (item.HasItemFlag(ItemFieldFlags.Refundable))
|
||||
if (item.IsRefundable())
|
||||
{
|
||||
if (item.GetPlayedTime() > (2 * Time.Hour))
|
||||
{
|
||||
@@ -272,7 +272,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.HasItemFlag(ItemFieldFlags.BopTradeable))
|
||||
else if (item.IsBOPTradeable())
|
||||
{
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_BOP_TRADE);
|
||||
stmt.AddValue(0, item.GetGUID().ToString());
|
||||
@@ -1590,7 +1590,7 @@ namespace Game.Entities
|
||||
if (item.GetState() == ItemUpdateState.New)
|
||||
{
|
||||
if (itemTemplate != null)
|
||||
if (itemTemplate.GetFlags().HasAnyFlag(ItemFlags.HasLoot))
|
||||
if (itemTemplate.HasFlag(ItemFlags.HasLoot))
|
||||
Global.LootItemStorage.RemoveStoredLootForContainer(item.GetGUID().GetCounter());
|
||||
|
||||
continue;
|
||||
@@ -1601,7 +1601,7 @@ namespace Game.Entities
|
||||
m_items[i].FSetState(ItemUpdateState.New);
|
||||
|
||||
if (itemTemplate != null)
|
||||
if (itemTemplate.GetFlags().HasAnyFlag(ItemFlags.HasLoot))
|
||||
if (itemTemplate.HasFlag(ItemFlags.HasLoot))
|
||||
Global.LootItemStorage.RemoveStoredLootForContainer(item.GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void RefundItem(Item item)
|
||||
{
|
||||
if (!item.HasItemFlag(ItemFieldFlags.Refundable))
|
||||
if (!item.IsRefundable())
|
||||
{
|
||||
Log.outDebug(LogFilter.Player, "Item refund: item not refundable!");
|
||||
return;
|
||||
@@ -152,7 +152,7 @@ namespace Game.Entities
|
||||
// This function call unsets ITEM_FLAGS_REFUNDABLE if played time is over 2 hours.
|
||||
item.UpdatePlayedTime(this);
|
||||
|
||||
if (!item.HasItemFlag(ItemFieldFlags.Refundable))
|
||||
if (!item.IsRefundable())
|
||||
{
|
||||
Log.outDebug(LogFilter.Player, "Item refund: item not refundable!");
|
||||
return;
|
||||
@@ -1453,13 +1453,13 @@ namespace Game.Entities
|
||||
if (proto == null)
|
||||
return InventoryResult.ItemNotFound;
|
||||
|
||||
if (proto.GetFlags2().HasAnyFlag(ItemFlags2.InternalItem))
|
||||
if (proto.HasFlag(ItemFlags2.InternalItem))
|
||||
return InventoryResult.CantEquipEver;
|
||||
|
||||
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionHorde) && GetTeam() != Team.Horde)
|
||||
if (proto.HasFlag(ItemFlags2.FactionHorde) && GetTeam() != Team.Horde)
|
||||
return InventoryResult.CantEquipEver;
|
||||
|
||||
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
|
||||
if (proto.HasFlag(ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
|
||||
return InventoryResult.CantEquipEver;
|
||||
|
||||
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)SharedConst.GetMaskForRace(GetRace())) == 0)
|
||||
@@ -2469,7 +2469,7 @@ namespace Game.Entities
|
||||
if (!bStore)
|
||||
AutoUnequipOffhandIfNeed();
|
||||
|
||||
if (pProto.GetFlags().HasAnyFlag(ItemFlags.ItemPurchaseRecord) && crItem.ExtendedCost != 0 && pProto.GetMaxStackSize() == 1)
|
||||
if (pProto.HasFlag(ItemFlags.ItemPurchaseRecord) && crItem.ExtendedCost != 0 && pProto.GetMaxStackSize() == 1)
|
||||
{
|
||||
it.AddItemFlag(ItemFieldFlags.Refundable);
|
||||
it.SetRefundRecipient(GetGUID());
|
||||
@@ -2542,7 +2542,7 @@ namespace Game.Entities
|
||||
|
||||
foreach (var item in m_itemDuration)
|
||||
{
|
||||
if (!realtimeonly || item.GetTemplate().GetFlags().HasAnyFlag(ItemFlags.RealDuration))
|
||||
if (!realtimeonly || item.GetTemplate().HasFlag(ItemFlags.RealDuration))
|
||||
item.UpdateDuration(this, time);
|
||||
}
|
||||
}
|
||||
@@ -3220,7 +3220,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsGameMaster() && ((pProto.GetFlags2().HasAnyFlag(ItemFlags2.FactionHorde) && GetTeam() == Team.Alliance) || (pProto.GetFlags2().HasAnyFlag(ItemFlags2.FactionAlliance) && GetTeam() == Team.Horde)))
|
||||
if (!IsGameMaster() && ((pProto.HasFlag(ItemFlags2.FactionHorde) && GetTeam() == Team.Alliance) || (pProto.HasFlag(ItemFlags2.FactionAlliance) && GetTeam() == Team.Horde)))
|
||||
return false;
|
||||
|
||||
Creature creature = GetNPCIfCanInteractWith(vendorguid, NPCFlags.Vendor, NPCFlags2.None);
|
||||
@@ -3478,7 +3478,7 @@ namespace Game.Entities
|
||||
{
|
||||
ItemTemplate itemTemplate = pItem.GetTemplate();
|
||||
if (itemTemplate != null)
|
||||
if (itemTemplate.GetFlags().HasAnyFlag(ItemFlags.HasLoot))
|
||||
if (itemTemplate.HasFlag(ItemFlags.HasLoot))
|
||||
Global.LootItemStorage.RemoveStoredLootForContainer(pItem.GetGUID().GetCounter());
|
||||
|
||||
pItem.SetState(ItemUpdateState.Removed, this);
|
||||
@@ -3812,7 +3812,7 @@ namespace Game.Entities
|
||||
|
||||
void ApplyItemEquipSpell(Item item, bool apply, bool formChange = false)
|
||||
{
|
||||
if (item == null || item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||
if (item == null || item.GetTemplate().HasFlag(ItemFlags.Legacy))
|
||||
return;
|
||||
|
||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||
@@ -3880,7 +3880,7 @@ namespace Game.Entities
|
||||
|
||||
void ApplyEquipCooldown(Item pItem)
|
||||
{
|
||||
if (pItem.GetTemplate().GetFlags().HasAnyFlag(ItemFlags.NoEquipCooldown))
|
||||
if (pItem.GetTemplate().HasFlag(ItemFlags.NoEquipCooldown))
|
||||
return;
|
||||
|
||||
DateTime now = GameTime.GetGameTimeSteadyPoint();
|
||||
@@ -4252,7 +4252,7 @@ namespace Game.Entities
|
||||
// in case trade we already have item in other player inventory
|
||||
pLastItem.SetState(in_characterInventoryDB ? ItemUpdateState.Changed : ItemUpdateState.New, this);
|
||||
|
||||
if (pLastItem.HasItemFlag(ItemFieldFlags.BopTradeable))
|
||||
if (pLastItem.IsBOPTradeable())
|
||||
AddTradeableItem(pLastItem);
|
||||
}
|
||||
}
|
||||
@@ -4917,7 +4917,7 @@ namespace Game.Entities
|
||||
}
|
||||
else if (type == InventoryType.WeaponOffhand)
|
||||
{
|
||||
if (!CanDualWield() && !pProto.GetFlags3().HasAnyFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
if (!CanDualWield() && !pProto.HasFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
return InventoryResult.TwoHandSkillNotFound;
|
||||
}
|
||||
else if (type == InventoryType.Weapon2Hand)
|
||||
@@ -5025,7 +5025,7 @@ namespace Game.Entities
|
||||
public InventoryResult CanEquipUniqueItem(ItemTemplate itemProto, byte except_slot = ItemConst.NullSlot, uint limit_count = 1)
|
||||
{
|
||||
// check unique-equipped on item
|
||||
if (Convert.ToBoolean(itemProto.GetFlags() & ItemFlags.UniqueEquippable))
|
||||
if (itemProto.HasFlag(ItemFlags.UniqueEquippable))
|
||||
{
|
||||
// there is an equip limit on this item
|
||||
if (HasItemOrGemWithIdEquipped(itemProto.GetId(), 1, except_slot))
|
||||
@@ -5429,7 +5429,7 @@ namespace Game.Entities
|
||||
for (byte i = 0; i < ItemConst.MaxBagSize; ++i)
|
||||
DestroyItem(slot, i, update);
|
||||
|
||||
if (pItem.HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
if (pItem.IsWrapped())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT);
|
||||
stmt.AddValue(0, pItem.GetGUID().GetCounter());
|
||||
@@ -5493,7 +5493,7 @@ namespace Game.Entities
|
||||
|
||||
// Delete rolled money / loot from db.
|
||||
// MUST be done before RemoveFromWorld() or GetTemplate() fails
|
||||
if (pProto.GetFlags().HasAnyFlag(ItemFlags.HasLoot))
|
||||
if (pProto.HasFlag(ItemFlags.HasLoot))
|
||||
Global.LootItemStorage.RemoveStoredLootForContainer(pItem.GetGUID().GetCounter());
|
||||
|
||||
if (IsInWorld && update)
|
||||
|
||||
@@ -882,8 +882,8 @@ namespace Game.Entities
|
||||
if (rewardProto == null)
|
||||
return false;
|
||||
|
||||
if ((rewardProto.GetFlags2().HasAnyFlag(ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance) ||
|
||||
(rewardProto.GetFlags2().HasAnyFlag(ItemFlags2.FactionHorde) && GetTeam() != Team.Horde))
|
||||
if ((rewardProto.HasFlag(ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance) ||
|
||||
(rewardProto.HasFlag(ItemFlags2.FactionHorde) && GetTeam() != Team.Horde))
|
||||
return false;
|
||||
|
||||
switch (questPackageItem.DisplayType)
|
||||
|
||||
@@ -1491,7 +1491,7 @@ namespace Game.Entities
|
||||
|
||||
public void CastItemUseSpell(Item item, SpellCastTargets targets, ObjectGuid castCount, uint[] misc)
|
||||
{
|
||||
if (!item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||
if (!item.GetTemplate().HasFlag(ItemFlags.Legacy))
|
||||
{
|
||||
// item spells casted at use
|
||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||
@@ -1779,7 +1779,7 @@ namespace Game.Entities
|
||||
|
||||
void ApplyItemObtainSpells(Item item, bool apply)
|
||||
{
|
||||
if (item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||
if (item.GetTemplate().HasFlag(ItemFlags.Legacy))
|
||||
return;
|
||||
|
||||
foreach (ItemEffectRecord effect in item.GetEffects())
|
||||
@@ -3260,7 +3260,7 @@ namespace Game.Entities
|
||||
bool canTrigger = damageInfo.GetHitMask().HasAnyFlag(ProcFlagsHit.Normal | ProcFlagsHit.Critical | ProcFlagsHit.Absorb);
|
||||
if (canTrigger)
|
||||
{
|
||||
if (!item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||
if (!item.GetTemplate().HasFlag(ItemFlags.Legacy))
|
||||
{
|
||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||
{
|
||||
|
||||
@@ -7342,7 +7342,7 @@ namespace Game.Entities
|
||||
ItemTemplate offtemplate = offItem.GetTemplate();
|
||||
|
||||
// unequip offhand weapon if player doesn't have dual wield anymore
|
||||
if (!CanDualWield() && ((offItem.GetTemplate().GetInventoryType() == InventoryType.WeaponOffhand && !offItem.GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
if (!CanDualWield() && ((offItem.GetTemplate().GetInventoryType() == InventoryType.WeaponOffhand && !offItem.GetTemplate().HasFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
|| offItem.GetTemplate().GetInventoryType() == InventoryType.Weapon))
|
||||
force = true;
|
||||
|
||||
|
||||
@@ -1321,7 +1321,7 @@ namespace Game.Entities
|
||||
UpdateDamagePhysical(WeaponAttackType.BaseAttack);
|
||||
Item offhand = GetWeaponForAttack(WeaponAttackType.OffAttack, true);
|
||||
if (offhand)
|
||||
if (CanDualWield() || offhand.GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
if (CanDualWield() || offhand.GetTemplate().HasFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
UpdateDamagePhysical(WeaponAttackType.OffAttack);
|
||||
|
||||
if (HasAuraType(AuraType.OverrideSpellPowerByApPct))
|
||||
|
||||
Reference in New Issue
Block a user