bool CanAddAppearance(ItemModifiedAppearanceRecord itemModifiedAppearance) { if (itemModifiedAppearance == null) { return(false); } if (itemModifiedAppearance.TransmogSourceTypeEnum == 6 || itemModifiedAppearance.TransmogSourceTypeEnum == 9) { return(false); } if (!CliDB.ItemSearchNameStorage.ContainsKey(itemModifiedAppearance.ItemID)) { return(false); } ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemModifiedAppearance.ItemID); if (itemTemplate == null) { return(false); } if (!_owner.GetPlayer()) { return(false); } if (_owner.GetPlayer().CanUseItem(itemTemplate) != InventoryResult.Ok) { return(false); } if (itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.NoSourceForItemVisual) || itemTemplate.GetQuality() == ItemQuality.Artifact) { return(false); } switch (itemTemplate.GetClass()) { case ItemClass.Weapon: { if (!Convert.ToBoolean(_owner.GetPlayer().GetWeaponProficiency() & (1 << (int)itemTemplate.GetSubClass()))) { return(false); } if (itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Exotic || itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Exotic2 || itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Miscellaneous || itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Thrown || itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Spear || itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.FishingPole) { return(false); } break; } case ItemClass.Armor: { switch (itemTemplate.GetInventoryType()) { case InventoryType.Body: case InventoryType.Shield: case InventoryType.Cloak: case InventoryType.Tabard: case InventoryType.Holdable: break; case InventoryType.Head: case InventoryType.Shoulders: case InventoryType.Chest: case InventoryType.Waist: case InventoryType.Legs: case InventoryType.Feet: case InventoryType.Wrists: case InventoryType.Hands: case InventoryType.Robe: if ((ItemSubClassArmor)itemTemplate.GetSubClass() == ItemSubClassArmor.Miscellaneous) { return(false); } break; default: return(false); } if (itemTemplate.GetInventoryType() != InventoryType.Cloak) { if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().GetClassMask())) { return(false); } } break; } default: return(false); } if (itemTemplate.GetQuality() < ItemQuality.Uncommon) { if (!itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.IgnoreQualityForItemVisualSource) || !itemTemplate.GetFlags3().HasAnyFlag(ItemFlags3.ActsAsTransmogHiddenVisualOption)) { return(false); } } if (itemModifiedAppearance.Id < _appearances.Count && _appearances.Get((int)itemModifiedAppearance.Id)) { return(false); } return(true); }
//helpers public bool IsGoldRequired(ItemTemplate pProto) { return(Convert.ToBoolean(pProto.GetFlags2() & ItemFlags2.DontIgnoreBuyPrice) || ExtendedCost == 0); }
public void _ApplyWeaponDamage(uint slot, Item item, bool apply) { ItemTemplate proto = item.GetTemplate(); WeaponAttackType attType = WeaponAttackType.BaseAttack; float damage = 0.0f; if (slot == EquipmentSlot.MainHand && (proto.GetInventoryType() == InventoryType.Ranged || proto.GetInventoryType() == InventoryType.RangedRight)) { attType = WeaponAttackType.RangedAttack; } else if (slot == EquipmentSlot.OffHand) { attType = WeaponAttackType.OffAttack; } uint itemLevel = item.GetItemLevel(this); float minDamage, maxDamage; proto.GetDamage(itemLevel, out minDamage, out maxDamage); if (minDamage > 0) { damage = apply ? minDamage : SharedConst.BaseMinDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MinDamage, damage); } if (maxDamage > 0) { damage = apply ? maxDamage : SharedConst.BaseMaxDamage; SetBaseWeaponDamage(attType, WeaponDamageRange.MaxDamage, damage); } SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm()); if (proto.GetDelay() != 0 && !(shapeshift != null && shapeshift.CombatRoundTime != 0)) { SetBaseAttackTime(attType, apply ? proto.GetDelay() : SharedConst.BaseAttackTime); } int weaponBasedAttackPower = apply ? (int)(proto.GetDPS(itemLevel) * 6.0f) : 0; switch (attType) { case WeaponAttackType.BaseAttack: SetMainHandWeaponAttackPower(weaponBasedAttackPower); break; case WeaponAttackType.OffAttack: SetOffHandWeaponAttackPower(weaponBasedAttackPower); break; case WeaponAttackType.RangedAttack: SetRangedWeaponAttackPower(weaponBasedAttackPower); break; default: break; } if (CanModifyStats() && (damage != 0 || proto.GetDelay() != 0)) { UpdateDamagePhysical(attType); } }