/// <summary> /// Returns what went wrong (if anything) when the given unit tries to equip or use Items of this Template. /// </summary> public InventoryError CheckEquip(Character chr) { if (chr.GodMode) { return InventoryError.OK; } // level if (chr.Level < RequiredLevel) { return InventoryError.YOU_MUST_REACH_LEVEL_N; } // class if (RequiredClassMask != 0 && !RequiredClassMask.HasAnyFlag(chr.ClassMask)) { return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM; } // race if (RequiredRaceMask != 0 && !RequiredRaceMask.HasAnyFlag(chr.RaceMask)) { return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM2; } // faction if (RequiredFaction != null) { if (chr.Faction != RequiredFaction) { return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM2; } if (RequiredFactionStanding != StandingLevel.Hated && chr.Reputations.GetStandingLevel(RequiredFaction.ReputationIndex) >= RequiredFactionStanding) { return InventoryError.ITEM_REPUTATION_NOT_ENOUGH; } } // skill if (RequiredSkill != null) { if (!chr.Skills.CheckSkill(RequiredSkill.Id, (int)RequiredSkillValue)) { return InventoryError.SKILL_ISNT_HIGH_ENOUGH; } } // ability if (RequiredProfession != null) { if (!chr.Spells.Contains(RequiredProfessionId)) { return InventoryError.NO_REQUIRED_PROFICIENCY; } } // set if (Set != null) { if (Set.RequiredSkill != null) { if (!chr.Skills.CheckSkill(Set.RequiredSkill.Id, (int)Set.RequiredSkillValue)) { return InventoryError.SKILL_ISNT_HIGH_ENOUGH; } } } // profession if (ItemProfession != SkillId.None) { if (!chr.Skills.Contains(ItemProfession)) { return InventoryError.NO_REQUIRED_PROFICIENCY; } } // Disarmed if (IsWeapon && !chr.MayCarry(InventorySlotMask)) { return InventoryError.CANT_DO_WHILE_DISARMED; } // TODO: Add missing restrictions // if (template.RequiredLockpickSkill // if (template.RequiredPvPRank // if (RequiredArenaRanking return InventoryError.OK; }