// =========== Check if Choosen Attribute Replaces Another ================= public static TextDefinition WhatReplacesWhat(int id, Item item) { if (Imbuing.GetValueForID(item, id) > 0) { return(ItemPropertyInfo.GetAttributeName(id)); } if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (id >= 101 && id <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (id >= 35 && id <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (id >= 30 && id <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } } if (item is BaseJewel) { BaseJewel i = item as BaseJewel; // SkillGroup1 replace SkillGroup1 if (id >= 151 && id <= 155) { if (i.SkillBonuses.GetBonus(0) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(0) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup2 replace SkillGroup2 if (id >= 156 && id <= 160) { if (i.SkillBonuses.GetBonus(1) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(1) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup3 replace SkillGroup3 if (id >= 161 && id <= 166) { if (i.SkillBonuses.GetBonus(2) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(2) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup4 replace SkillGroup4 if (id >= 167 && id <= 172) { if (i.SkillBonuses.GetBonus(3) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(3) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup5 replace SkillGroup5 if (id >= 173 && id <= 178) { if (i.SkillBonuses.GetBonus(4) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(4) == sk) { return(GetNameForAttribute(sk)); } } } } } return(null); }
public override void OnCast() { if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint }/* * else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) ) * { * DoFizzle(); * }*/ else if (CheckSequence()) { StopTimer(Caster); //Reset polymorph spell if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_PolymorphEntry.BodyID != 0) { if (!((Body)m_PolymorphEntry.BodyID).IsHuman) { IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } if (m_PolymorphEntry.BodyID == 0x3B) //Dragon, two different body IDs { Caster.BodyMod = Utility.RandomList(0x3B, 0xC); } else { Caster.BodyMod = m_PolymorphEntry.BodyID; } Caster.PlaySound(Sound); StopTimer(Caster); Timer t = new InternalTimer(Caster, m_PolymorphEntry); m_Timers.Add(Caster, t); t.Start(); BaseArmor.ValidateMobile(Caster); BaseWeapon.ValidateMobile(Caster); BaseJewel.ValidateMobile(Caster); if (Caster.NameMod != null) //Caster has incognito, need to update name { Caster.NameMod = IncognitoSpell.GetNameMod(Caster.BodyValue); } } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
// =========== Check if Choosen Attribute Replaces Another ================= public static TextDefinition WhatReplacesWhat(int id, Item item) { if (Imbuing.GetValueForID(item, id) > 0) { return(ItemPropertyInfo.GetAttributeName(id)); } if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (id >= 101 && id <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (id >= 35 && id <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (id >= 30 && id <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } } if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; if (id >= 151 && id <= 183) { AosSkillBonuses bonuses = jewel.SkillBonuses; SkillName[] group = Imbuing.GetSkillGroup((SkillName)ItemPropertyInfo.GetAttribute(id)); for (int i = 0; i < 5; i++) { if (bonuses.GetBonus(i) > 0 && group.Any(sk => sk == bonuses.GetSkill(i))) { return(GetNameForAttribute(bonuses.GetSkill(i))); } } } } return(null); }
protected override void OnTarget(Mobile from, object targeted) { int number; if (m_CraftSystem is DefBlacksmithy) { bool anvil, forge; DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge); if (anvil && forge) { // You must be near a forge and and anvil to repair items. number = 1044282; } } if (m_CraftSystem is DefTinkering && targeted is BaseCreature && ((BaseCreature)targeted).IsGolem) { BaseCreature g = (BaseCreature)targeted; int damage = g.HitsMax - g.Hits; if (g.IsDeadBondedPet) { number = 500426; // You can't repair that. } else if (damage <= 0) { number = 500423; // That is already in full repair. } else { double skillValue = from.Skills[SkillName.Tinkering].Value; if (skillValue < 60.0) { number = 1044153; // You don't have the required skills to attempt this item. } else if (!from.CanBeginAction(typeof(Golem))) { number = 501789; // You must wait before trying again. } else { if (damage > (int)(skillValue * 0.3)) { damage = (int)(skillValue * 0.3); } damage += 30; if (!from.CheckSkill(SkillName.Tinkering, 0.0, 100.0)) { damage /= 2; } Container pack = from.Backpack; if (pack != null) { int v = pack.ConsumeUpTo(typeof(IronIngot), (damage + 4) / 5); if (v > 0) { g.Hits += v * 5; number = 1044279; // You repair the item. from.BeginAction(typeof(Golem)); Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair), from); if (m_Contract != null) { m_Contract.Delete(); } } else { number = 1044037; // You do not have sufficient metal to make that. } } else { number = 1044037; // You do not have sufficient metal to make that. } } } } else if (targeted is IFactionArtifact) { // That item cannot be repaired number = 1044277; } else if (targeted is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 1; if (m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !IsSpecialWeapon(weapon)) { if (m_Contract != null) { // You cannot repair that item with this type of repair contract. number = 1061136; } else { // You cannot repair that using this type of tool. number = 1061139; } } else if (!weapon.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (weapon.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { weapon.MaxHitPoints -= toWeaken; weapon.HitPoints = Math.Max(0, weapon.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); weapon.HitPoints = weapon.MaxHitPoints; } else { if (m_Contract != null) { // You fail to repair the item and the repair contract is destroyed. number = 1061137; } else { // You fail to repair the item. number = 1044280; } m_CraftSystem.PlayCraftEffect(from); } if (m_Contract != null) { m_Contract.Delete(); } } } else if (targeted is BaseArmor) { BaseArmor armor = (BaseArmor)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 1; if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null && !IsSpecialArmor(armor)) { if (m_Contract != null) { // You cannot repair that item with this type of repair contract. number = 1061136; } else { // You cannot repair that using this type of tool. number = 1061139; } } else if (!armor.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (armor.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints)) { armor.MaxHitPoints -= toWeaken; armor.HitPoints = Math.Max(0, armor.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); armor.HitPoints = armor.MaxHitPoints; } else { if (m_Contract != null) { // You fail to repair the item and the repair contract is destroyed. number = 1061137; } else { // You fail to repair the item. number = 1044280; } m_CraftSystem.PlayCraftEffect(from); } if (m_Contract != null) { m_Contract.Delete(); } } } else if (targeted is BaseClothing) { BaseClothing clothing = (BaseClothing)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 1; if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing)) { if (m_Contract != null) { // You cannot repair that item with this type of repair contract. number = 1061136; } else { // That item cannot be repaired number = 1044277; } } else if (!clothing.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (clothing.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { clothing.MaxHitPoints -= toWeaken; clothing.HitPoints = Math.Max(0, clothing.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); clothing.HitPoints = clothing.MaxHitPoints; } else { if (m_Contract != null) { // You fail to repair the item and the repair contract is destroyed. number = 1061137; } else { // You fail to repair the item. number = 1044280; } m_CraftSystem.PlayCraftEffect(from); } if (m_Contract != null) { m_Contract.Delete(); } } } else if (targeted is BaseJewel) { BaseJewel jewel = (BaseJewel)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 1; if (m_CraftSystem.CraftItems.SearchForSubclass(jewel.GetType()) == null && !(jewel is SilverBracelet || jewel is SilverRing)) { if (m_Contract != null) { // You cannot repair that item with this type of repair contract. number = 1061136; } else { // That item cannot be repaired number = 1044277; } } else if (!jewel.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (!jewel.CanLoseDurability || jewel.MaxHitPoints <= 0 || jewel.HitPoints == jewel.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (jewel.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { jewel.MaxHitPoints -= toWeaken; jewel.HitPoints = Math.Max(0, jewel.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); jewel.HitPoints = jewel.MaxHitPoints; } else { if (m_Contract != null) { // You fail to repair the item and the repair contract is destroyed. number = 1061137; } else { // You fail to repair the item. number = 1044280; } m_CraftSystem.PlayCraftEffect(from); } if (m_Contract != null) { m_Contract.Delete(); } } } else if (targeted is BaseTalisman) { BaseTalisman talisman = (BaseTalisman)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 1; if (!IsSpecialTalisman(talisman)) { if (m_Contract != null) { // You cannot repair that item with this type of repair contract. number = 1061136; } else { // That item cannot be repaired number = 1044277; } } else if (!talisman.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (!talisman.CanLoseDurability || talisman.MaxHitPoints <= 0 || talisman.HitPoints == talisman.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (talisman.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else { if (CheckWeaken(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { talisman.MaxHitPoints -= toWeaken; talisman.HitPoints = Math.Max(0, talisman.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); talisman.HitPoints = talisman.MaxHitPoints; } else { if (m_Contract != null) { // You fail to repair the item and the repair contract is destroyed. number = 1061137; } else { // You fail to repair the item. number = 1044280; } m_CraftSystem.PlayCraftEffect(from); } if (m_Contract != null) { m_Contract.Delete(); } } } else if (targeted is Item) { number = 1044283; // You cannot repair that. SkillName skill = m_CraftSystem.MainSkill; double value = from.Skills[skill].Value; if (targeted is BlankScroll) { Item contract = null; if (value < 50.0) { // You must be at least apprentice level to create a repair service contract. number = 1047005; } else { if (skill == SkillName.Blacksmith) { contract = new RepairContract(ContractType.Blacksmith, value, from.Name); } else if (skill == SkillName.Carpentry) { contract = new RepairContract(ContractType.Carpenter, value, from.Name); } else if (skill == SkillName.Fletching) { contract = new RepairContract(ContractType.Fletcher, value, from.Name); } else if (skill == SkillName.Tailoring) { contract = new RepairContract(ContractType.Tailor, value, from.Name); } else if (skill == SkillName.Tinkering) { contract = new RepairContract(ContractType.Tinker, value, from.Name); } } if (contract != null) { from.AddToBackpack(contract); number = 1044154; // You create the item. BlankScroll scroll = targeted as BlankScroll; if (scroll.Amount >= 2) { scroll.Amount -= 1; } else { scroll.Delete(); } } } } else { number = 500426; // You can't repair that. } if (m_Tool != null) { //CraftContext context = m_CraftSystem.GetContext( from ); from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number)); } else { from.SendLocalizedMessage(number); } }
private bool IsSpecialJewel(BaseJewel jewel) { return(jewel is SilverBracelet || jewel is SilverRing); }
// Test item vs. chance public static bool SDropTest(Item item, double chance) { bool TrySDrop = false; if (item is OrcHelm) { return(false); } if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; // adam: Medwin says that armor > guarding is as good as GM, so we want to reduce thos by requiring // that they become SDrops (Sdrops involve a GM) if (armor.ProtectionLevel >= ArmorProtectionLevel.Guarding) { TrySDrop = true; } // Make sure level 3 armor or higher //if( armor.GetProtOffset() >= 3 ) //TrySDrop = true; } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; // Make sure level 3 weapon or higher if (((int)weapon.DamageLevel) >= 3) { TrySDrop = true; } } else if (item is BaseClothing) { BaseClothing bc = (BaseClothing)item; int iMagicEffect = (int)bc.MagicType; // Make sure it's got at least 6 charges // for invis & bless, 10 for the others if ((bc.MagicCharges >= 6 && (iMagicEffect == 2 || iMagicEffect == 3) ) || bc.MagicCharges >= 10) { TrySDrop = true; } } else if (item is BaseJewel) { BaseJewel bj = (BaseJewel)item; int iMagicEffect = (int)bj.MagicType; // Make sure it's got at least 6 charges // for invis, bless, teleport, 10 for the others if ((bj.MagicCharges >= 6 && (iMagicEffect == 2 || iMagicEffect == 3 || iMagicEffect == 4) ) || bj.MagicCharges >= 10) { TrySDrop = true; } } if (TrySDrop && Utility.RandomDouble() < chance) { return(true); } return(false); }
// =========== Check if Choosen Attribute Replaces Another ================= public static int WhatReplacesWhat(int mod, Item item) { if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (mod >= 101 && mod <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (mod >= 35 && mod <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (mod >= 30 && mod <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } // OnHitLeech replace OnHitLeech /*if (mod >= 25 && mod <= 27) * { * if (i.WeaponAttributes.HitLeechHits > 0) * return GetNameForAttribute(AosWeaponAttribute.HitLeechHits); * else if (i.WeaponAttributes.HitLeechStam > 0) * return GetNameForAttribute(AosWeaponAttribute.HitLeechStam); * else if (i.WeaponAttributes.HitLeechMana > 0) * return GetNameForAttribute(AosWeaponAttribute.HitLeechMana); * } * // HitLower replace HitLower * if (mod >= 28 && mod <= 29) * { * if (i.WeaponAttributes.HitLowerAttack > 0) * return GetNameForAttribute(AosWeaponAttribute.HitLowerAttack); * else if (i.WeaponAttributes.HitLowerDefend > 0) * return GetNameForAttribute(AosWeaponAttribute.HitLowerDefend); * }*/ } if (item is BaseJewel) { BaseJewel i = item as BaseJewel; // SkillGroup1 replace SkillGroup1 if (mod >= 151 && mod <= 155) { if (i.SkillBonuses.GetBonus(0) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(0) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup2 replace SkillGroup2 if (mod >= 156 && mod <= 160) { if (i.SkillBonuses.GetBonus(1) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(1) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup3 replace SkillGroup3 if (mod >= 161 && mod <= 166) { if (i.SkillBonuses.GetBonus(2) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(2) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup4 replace SkillGroup4 if (mod >= 167 && mod <= 172) { if (i.SkillBonuses.GetBonus(3) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(3) == sk) { return(GetNameForAttribute(sk)); } } } } // SkillGroup5 replace SkillGroup5 if (mod >= 173 && mod <= 178) { if (i.SkillBonuses.GetBonus(4) > 0) { foreach (SkillName sk in Imbuing.PossibleSkills) { if (i.SkillBonuses.GetSkill(4) == sk) { return(GetNameForAttribute(sk)); } } } } } return(-1); }
void ApplyAttributes() { double failChance = (100 / (from.Skills.Inscribe.Value * 10)) * 2.5; bool empty = true; for (int i = 1; i <= 12; i++) { if (_values[i] > 0) { empty = false; break; } } if (empty) { from.SendMessage("You have not chosen any runes to apply."); return; } if (Utility.RandomDouble() <= failChance) { beheld.Delete(); Effects.SendLocationEffect(from.Location, from.Map, 14000, 16, 3, 0, 0); from.PlaySound(0x207); from.SendMessage("You overlap a two runes, causing an ethereal reaction, destroying the object!"); from.Damage(Utility.RandomMinMax(20, 40)); tool.Delete(); return; } Effects.PlaySound(from.Location, from.Map, 0x243); from.SendMessage("You successfully inscribe the runes to the object, imbuing it with magic properties."); if (beheld is BaseArmor) { BaseArmor armor = beheld as BaseArmor; armor.Identified = true; for (int i = 1; i < _values.Length; i++) { if (_values[i] > 0) { armor.Attributes[attributes[i]] = _values[i] * _multipliers[i]; } } } if (beheld is BaseWeapon) { BaseWeapon weapon = beheld as BaseWeapon; weapon.Identified = true; for (int i = 1; i < _values.Length; i++) { if (_values[i] > 0) { weapon.Attributes[attributes[i]] = _values[i] * _multipliers[i]; } } } if (beheld is BaseJewel) { BaseJewel jewel = beheld as BaseJewel; jewel.Identified = true; for (int i = 1; i < _values.Length; i++) { if (_values[i] > 0) { jewel.Attributes[attributes[i]] = _values[i] * _multipliers[i]; } } } if (beheld is BaseClothing) { BaseClothing clothing = beheld as BaseClothing; clothing.Identified = true; for (int i = 1; i < _values.Length; i++) { if (_values[i] > 0) { clothing.Attributes[attributes[i]] = _values[i] * _multipliers[i]; } } } if (beheld is Spellbook) { Spellbook book = beheld as Spellbook; for (int i = 1; i < _values.Length; i++) { if (_values[i] > 0) { book.Attributes[attributes[i]] = _values[i] * _multipliers[i]; } } } }
public void EnhanceJewel(Item item, string name) { if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; int num = Utility.RandomMinMax(3, 5); for (int count = 0; count < num; count++) { int attribute = Utility.RandomMinMax(1, 24); switch (attribute) { case (int)CustomArmorAttributes.RegenHits: { jewel.Attributes.RegenHits = Utility.RandomMinMax(5, 25); goto case 99; } case (int)CustomArmorAttributes.RegenStam: { jewel.Attributes.RegenStam = Utility.RandomMinMax(5, 25); goto case 99; } case (int)CustomArmorAttributes.RegenMana: { jewel.Attributes.RegenMana = Utility.RandomMinMax(5, 25); goto case 99; } case (int)CustomArmorAttributes.DefendChance: { jewel.Attributes.DefendChance = Utility.RandomMinMax(5, 40); goto case 99; } case (int)CustomArmorAttributes.AttackChance: { jewel.Attributes.AttackChance = Utility.RandomMinMax(5, 40); goto case 99; } case (int)CustomArmorAttributes.BonusStr: { jewel.Attributes.BonusStr = Utility.RandomMinMax(2, 20); goto case 99; } case (int)CustomArmorAttributes.BonusDex: { jewel.Attributes.BonusDex = Utility.RandomMinMax(2, 20); goto case 99; } case (int)CustomArmorAttributes.BonusInt: { jewel.Attributes.BonusInt = Utility.RandomMinMax(2, 20); goto case 99; } case (int)CustomArmorAttributes.BonusHits: { jewel.Attributes.BonusHits = Utility.RandomMinMax(5, 50); goto case 99; } case (int)CustomArmorAttributes.BonusStam: { jewel.Attributes.BonusStam = Utility.RandomMinMax(10, 50); goto case 99; } case (int)CustomArmorAttributes.BonusMana: { jewel.Attributes.BonusMana = Utility.RandomMinMax(10, 50); goto case 99; } case (int)CustomArmorAttributes.WeaponDamage: { jewel.Attributes.WeaponDamage = Utility.RandomMinMax(5, 30); goto case 99; } case (int)CustomArmorAttributes.WeaponSpeed: { jewel.Attributes.WeaponSpeed = Utility.RandomMinMax(5, 30); goto case 99; } case (int)CustomArmorAttributes.SpellDamage: { jewel.Attributes.SpellDamage = Utility.RandomMinMax(10, 40); goto case 99; } case (int)CustomArmorAttributes.CastRecovery: { jewel.Attributes.CastRecovery = Utility.RandomMinMax(5, 30); goto case 99; } case (int)CustomArmorAttributes.CastSpeed: { jewel.Attributes.CastSpeed = Utility.RandomMinMax(5, 30); goto case 99; } case (int)CustomArmorAttributes.LowerManaCost: { jewel.Attributes.LowerManaCost = Utility.RandomMinMax(4, 30); goto case 99; } case (int)CustomArmorAttributes.LowerRegCost: { jewel.Attributes.LowerRegCost = Utility.RandomMinMax(10, 25); goto case 99; } case (int)CustomArmorAttributes.ReflectPhysical: { jewel.Attributes.ReflectPhysical = Utility.RandomMinMax(10, 50); goto case 99; } case (int)CustomArmorAttributes.EnhancePotions: { jewel.Attributes.EnhancePotions = Utility.RandomMinMax(10, 50); goto case 99; } case (int)CustomArmorAttributes.Luck: { jewel.Attributes.Luck = Utility.RandomMinMax(10, 200); goto case 99; } case (int)CustomArmorAttributes.NightSight: { jewel.Attributes.NightSight = 1; goto case 99; } case 99: { jewel.PropertyList.Add(name); break; } default: break; } } } }
public static void HandleSingleClick(BaseJewel item, Mobile m) { DefaultHandleSingleClick(item, m); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = targeted as Item; if (tool.Type == RuneApplicationTool.ApplyType.Metal) { if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; if (!jewel.Attributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(jewel.Resource) == CraftResourceType.Metal || CraftResources.GetType(jewel.Resource) == CraftResourceType.Wood) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on metal and wooden objects only."); } } if (item is BaseWeapon) { BaseWeapon weapon = item as BaseWeapon; if (!weapon.Attributes.IsEmpty || !weapon.WeaponAttributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal || CraftResources.GetType(weapon.Resource) == CraftResourceType.Wood) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on metal and wooden objects only."); } } if (item is BaseWeapon) { BaseWeapon weapon = item as BaseWeapon; if (!weapon.Attributes.IsEmpty || !weapon.WeaponAttributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal || CraftResources.GetType(weapon.Resource) == CraftResourceType.Wood) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on metal and wooden objects only."); } } if (item is BaseArmor) { BaseArmor armor = item as BaseArmor; if (!armor.Attributes.IsEmpty || !armor.ArmorAttributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(armor.Resource) == CraftResourceType.Metal || CraftResources.GetType(armor.Resource) == CraftResourceType.Wood) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on metal and wooden objects only."); } } } if (tool.Type == RuneApplicationTool.ApplyType.Leather) { if (item is BaseClothing) { BaseClothing cloth = item as BaseClothing; if (!cloth.Attributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(cloth.Resource) == CraftResourceType.Leather) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on leather objects only."); } return; } if (item is BaseArmor) { BaseArmor armor = item as BaseArmor; if (!armor.Attributes.IsEmpty || !armor.ArmorAttributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(armor.Resource) == CraftResourceType.Leather) { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } else { from.SendMessage("This is for use on leather objects only."); } } if (item is Spellbook) { if (!((Spellbook)item).Attributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } else { from.SendGump(new BasicAttributeGump(item, from, tool)); return; } } //if (tool.Type == RuneApplicationTool.ApplyType.Wood) //{ // if (item is BaseWeapon) // { // BaseWeapon weapon = item as BaseWeapon; // if (!weapon.Attributes.IsEmpty || !weapon.WeaponAttributes.IsEmpty) // { // from.SendMessage("This object already has already been inscribed with runes."); return; // } // if (CraftResources.GetType(weapon.Resource) == CraftResourceType.Wood) // { // from.SendGump(new BasicAttributeGump(item, from)); // } // else from.SendMessage("This is for use on wooden objects only."); // } // if (item is BaseArmor) // { // BaseArmor armor = item as BaseArmor; // if (!armor.Attributes.IsEmpty || !armor.ArmorAttributes.IsEmpty) // { // from.SendMessage("This object already has already been inscribed with runes."); return; // } // if (CraftResources.GetType(armor.Resource) == CraftResourceType.Wood) // { // from.SendGump(new BasicAttributeGump(item, from)); // } // else from.SendMessage("This is for use on wooden objects only."); // } //} if (tool.Type == RuneApplicationTool.ApplyType.Cloth) { if (item is BaseClothing) { BaseClothing cloth = item as BaseClothing; if (!cloth.Attributes.IsEmpty) { from.SendMessage("This object already has already been inscribed with runes."); return; } if (CraftResources.GetType(cloth.Resource) == CraftResourceType.None) { from.SendGump(new BasicAttributeGump(item, from, tool)); } else { from.SendMessage("This is for use on cloth objects only."); } } } } } }
public Jewelry(BaseJewel Item, uint Container) { Item.UpdateLocalizedProperties(); Item.UpdateTextProperties(); //General Properties ID = Item.Serial.Value; ContainerID = Container; SkillBonuses = ""; ItemName = Item.Tooltip.Split('|')[0].Replace("'", ""); DI = (sbyte)Item.Attributes.WeaponDamage; SSI = (sbyte)Item.Attributes.WeaponSpeed; FC = (sbyte)Item.Attributes.CastSpeed; FCR = (sbyte)Item.Attributes.CastRecovery; SDI = (sbyte)Item.Attributes.SpellDamage; DCI = (sbyte)Item.Attributes.DefendChance; HCI = (sbyte)Item.Attributes.AttackChance; STR = (sbyte)Item.Attributes.BonusStr; DEX = (sbyte)Item.Attributes.BonusDex; INTEL = (sbyte)Item.Attributes.BonusInt; HP = (sbyte)Item.Attributes.BonusHits; Stam = (sbyte)Item.Attributes.BonusStam; Mana = (sbyte)Item.Attributes.BonusMana; HPRegen = (sbyte)Item.Attributes.RegenHits; StamRegen = (sbyte)Item.Attributes.RegenStam; ManaRegen = (sbyte)Item.Attributes.RegenMana; LMC = (sbyte)Item.Attributes.LowerManaCost; LRC = (sbyte)Item.Attributes.LowerRegCost; EnhancePotions = (sbyte)Item.Attributes.EnhancePotions; Luck = (short)Item.Attributes.Luck; PhysicalResist = (sbyte)Item.Resistances.Physical; FireResist = (sbyte)Item.Resistances.Fire; ColdResist = (sbyte)Item.Resistances.Cold; PoisonResist = (sbyte)Item.Resistances.Poison; EnergyResist = (sbyte)Item.Resistances.Energy; Added = DateTime.Now; Antique = "false"; foreach (string _s in Item.Tooltip.Split('|')) { if (_s == "Antique") { Antique = "true"; } } //Skill Bonuses ItemSkillName _skill1 = (ItemSkillName)Item.SkillBonuses.Skill_1_Name; ItemSkillName _skill2 = (ItemSkillName)Item.SkillBonuses.Skill_2_Name; ItemSkillName _skill3 = (ItemSkillName)Item.SkillBonuses.Skill_3_Name; ItemSkillName _skill4 = (ItemSkillName)Item.SkillBonuses.Skill_4_Name; ItemSkillName _skill5 = (ItemSkillName)Item.SkillBonuses.Skill_5_Name; string[][] _skillBonusesString = new string[][] { new string[] { Item.SkillBonuses.Skill_1_Value.ToString(), _skill1.ToString() }, new string[] { Item.SkillBonuses.Skill_2_Value.ToString(), _skill2.ToString() }, new string[] { Item.SkillBonuses.Skill_3_Value.ToString(), _skill3.ToString() }, new string[] { Item.SkillBonuses.Skill_4_Value.ToString(), _skill4.ToString() }, new string[] { Item.SkillBonuses.Skill_5_Value.ToString(), _skill5.ToString() }, }; int _totalSkill = 0; foreach (string[] _s in _skillBonusesString) { if (_s[1].Equals("Invalid")) { continue; } else { SkillBonuses = SkillBonuses + _s[0] + ' ' + _s[1]; _totalSkill += Int32.Parse(_s[0]); } } SkillBonuses = SkillBonuses.Replace('_', ' '); //item rating if (DI >= 0) { Rating += (DI / 5) + (DI / 10); } if (HCI > 0) { Rating += (HCI / 2) + (HCI / 3); } if (DCI > 0) { Rating += (DCI / 2) + (DCI / 3); } if (HPRegen > 0) { Rating += (HPRegen * 4); } if (ManaRegen > 0) { Rating += (ManaRegen * 4); } if (StamRegen > 0) { Rating += (StamRegen * 3); } if (LRC > 0) { Rating += (LRC / 2) + (LRC / 3); } if (LMC > 0) { Rating += (LMC / 2) + (LMC / 3); } if (INTEL > 0) { Rating += (INTEL / 2) + (INTEL / 3); } if (DEX > 0) { Rating += (DEX / 2) + (DEX / 3); } if (STR > 0) { Rating += (STR / 2) + (STR / 3); } if (HP > 0) { Rating += (HP / 2) + (HP / 3); } if (Stam > 0) { Rating += (Stam / 2) + (Stam / 3); } if (Mana > 0) { Rating += (Mana / 2) + (Mana / 3); } if (_totalSkill > 0) { Rating += (_totalSkill / 2); } if (FC > 0) { Rating += (FC * 6); } if (FCR > 0) { Rating += (FCR * 6); } if (SSI > 0) { Rating += (SSI / 3) + (SSI / 10); } if (SDI > 0) { Rating += (SDI / 2); } if (Luck > 0) { Rating += (Luck / 11) + (Luck / 15); } if (EnhancePotions > 0) { Rating += (EnhancePotions / 6); } }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon || item is BaseArmor || item is BaseJewel) { if (Core.AOS) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (20 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && 35 > Utility.Random(100)) { switch (Utility.Random(25)) { case 0: { weapon.Slayer = SlayerName.Silver; break; } case 1: { weapon.Slayer = SlayerName.OrcSlaying; break; } case 2: { weapon.Slayer = SlayerName.TrollSlaughter; break; } case 3: { weapon.Slayer = SlayerName.OgreTrashing; break; } case 4: { weapon.Slayer = SlayerName.Repond; break; } case 5: { weapon.Slayer = SlayerName.DragonSlaying; break; } case 6: { weapon.Slayer = SlayerName.Terathan; break; } case 7: { weapon.Slayer = SlayerName.LizardmanSlaughter; break; } case 8: { weapon.Slayer = SlayerName.ReptilianDeath; break; } case 9: { weapon.Slayer = SlayerName.DaemonDismissal; break; } case 10: { weapon.Slayer = SlayerName.GargoylesFoe; break; } case 11: { weapon.Slayer = SlayerName.BalronDamnation; break; } case 12: { weapon.Slayer = SlayerName.Exorcism; break; } case 13: { weapon.Slayer = SlayerName.Ophidian; break; } case 14: { weapon.Slayer = SlayerName.SpidersDeath; break; } case 15: { weapon.Slayer = SlayerName.ScorpionsBane; break; } case 16: { weapon.Slayer = SlayerName.ArachnidDoom; break; } case 17: { weapon.Slayer = SlayerName.FlameDousing; break; } case 18: { weapon.Slayer = SlayerName.WaterDissipation; break; } case 19: { weapon.Slayer = SlayerName.Vacuum; break; } case 20: { weapon.Slayer = SlayerName.ElementalHealth; break; } case 21: { weapon.Slayer = SlayerName.EarthShatter; break; } case 22: { weapon.Slayer = SlayerName.BloodDrinking; break; } case 23: { weapon.Slayer = SlayerName.SummerWind; break; } case 24: { weapon.Slayer = SlayerName.ElementalBan; break; } case 25: { weapon.Slayer = SlayerName.Fey; break; } } } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } else if (item is BaseJewel) { BaseJewel jewel = (BaseJewel)item; if (80 > Utility.Random(100)) { jewel.Effect = (MagicEffect)Utility.Random(0, 11); jewel.Uses = Utility.Random(1, 10); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
// =========== Check if Choosen Attribute Replaces Another ================= public static TextDefinition WhatReplacesWhat(int id, Item item) { if (Imbuing.GetValueForID(item, id) > 0) { return(ItemPropertyInfo.GetAttributeName(id)); } if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (id >= 101 && id <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (id >= 35 && id <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (id >= 30 && id <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } } if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; if (id >= 151 && id <= 183) { AosSkillBonuses bonuses = jewel.SkillBonuses; SkillName[] group = Imbuing.GetSkillGroup((SkillName)ItemPropertyInfo.GetAttribute(id)); for (int i = 0; i < 5; i++) { if (bonuses.GetBonus(i) > 0 && group.Any(sk => sk == bonuses.GetSkill(i))) { return(GetNameForAttribute(bonuses.GetSkill(i))); } } } // SkillGroup1 replace SkillGroup1 /*if (id >= 151 && id <= 155) * { * if (i.SkillBonuses.GetBonus(0) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(0) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup2 replace SkillGroup2 * if (id >= 156 && id <= 160) * { * if (i.SkillBonuses.GetBonus(1) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(1) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup3 replace SkillGroup3 * if (id >= 161 && id <= 166) * { * if (i.SkillBonuses.GetBonus(2) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(2) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup4 replace SkillGroup4 * if (id >= 167 && id <= 172) * { * if (i.SkillBonuses.GetBonus(3) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(3) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup5 replace SkillGroup5 * if (id >= 173 && id <= 178) * { * if (i.SkillBonuses.GetBonus(4) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(4) == sk) * return GetNameForAttribute(sk); * } * } * }*/ } return(null); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is PlayerMobile) { PlayerMobile pm = targeted as PlayerMobile; if (pm.Female == false) { m_Jeweler.SayTo(from, "You are a male, not an object. But you do seem like a tough fella."); } else if (pm.Female == true) { m_Jeweler.SayTo(from, "You are a female, not an object and not bad looking either."); } else { m_Jeweler.SayTo(from, "Yeah I'm not touching that with a 10 foot pole."); } } if (targeted is BaseVendor) { BaseVendor bv = targeted as BaseVendor; if (bv.Female == false) { m_Jeweler.SayTo(from, "That person identifies as a male. Want me to pull down their pants?"); } else if (bv.Female == true) { m_Jeweler.SayTo(from, "That person identifies as a female. Want me to lift up their shirt?"); } else { m_Jeweler.SayTo(from, "They identify as none of your business."); } } if (targeted is BaseCreature) { BaseCreature c = targeted as BaseCreature; if (c.Tamable) { m_Jeweler.SayTo(from, "That creature seems to know its identity already. It doesn't need my help."); } else { m_Jeweler.SayTo(from, "Get that frigging thing away from me before it causes trouble."); } } if (targeted is BaseWeapon) { BaseWeapon bw = targeted as BaseWeapon; Container pack = from.Backpack; int toConsume = 250; toConsume = 250; if (bw.Identified == true) { m_Jeweler.SayTo(from, "That weapon is already identified."); } else if ((bw.Identified == false) && (pack.ConsumeTotal(typeof(Gold), toConsume))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } bw.Identified = true; m_Jeweler.SayTo(from, "Here is your weapon."); from.SendMessage("You pay 500 gp."); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Jeweler.SayTo(from, "It will cost you 500 gp to have your weapon identified."); from.SendMessage("You do not have enough gold."); } } else if (targeted is BaseArmor) { BaseArmor ba = targeted as BaseArmor; Container pack = from.Backpack; int toConsume = 200; toConsume = 200; if (ba.Identified == true) { m_Jeweler.SayTo(from, "That armor is already identified."); } else if ((ba.Identified == false) && (pack.ConsumeTotal(typeof(Gold), toConsume))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } ba.Identified = true; m_Jeweler.SayTo(from, "Here is your armor."); from.SendMessage("You pay 400 gp."); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Jeweler.SayTo(from, "It will cost you 400 gp to have your armor identified."); from.SendMessage("You do not have enough gold."); } } else if (targeted is BaseClothing) { BaseClothing bc = targeted as BaseClothing; Container pack = from.Backpack; int toConsume = 150; toConsume = 150; if (bc.Identified == true) { m_Jeweler.SayTo(from, "That clothing is already identified."); } else if ((bc.Identified == false) && (pack.ConsumeTotal(typeof(Gold), toConsume))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } bc.Identified = true; m_Jeweler.SayTo(from, "Here is your clothing."); from.SendMessage("You pay 300 gp."); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Jeweler.SayTo(from, "It will cost you 300 gp to have your clothing identified."); from.SendMessage("You do not have enough gold."); } } else if (targeted is BaseJewel) { BaseJewel bj = targeted as BaseJewel; Container pack = from.Backpack; int toConsume = 100; toConsume = 100; if (bj.Identified == true) { m_Jeweler.SayTo(from, "That jewel is already identified."); } else if ((bj.Identified == false) && (pack.ConsumeTotal(typeof(Gold), toConsume))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } bj.Identified = true; m_Jeweler.SayTo(from, "Here is your jewel."); from.SendMessage("You pay 200 gp."); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Jeweler.SayTo(from, "It will cost you 200 gp to have your jewel identified."); from.SendMessage("You do not have enough gold."); } } else { m_Jeweler.SayTo(from, "That is not something I can identify."); } }
public static void ApplyAttribute(Mobile from, BookOfSpellCrafts book, int craftId, BaseJewel jewel, AosElementAttribute attribute, int minimum, int maximum) { CheckItem(from, jewel, (jewel.Resistances[attribute] == 0)); UseMagicJewels(from, book, jewel, SpellCraftConfig.MagicJewelRequirements[craftId]); int scalar = ComputeSkillScalar(from); ApplyAttribute(jewel.Resistances, SpellCraftConfig.MinimumIntensity * scalar, SpellCraftConfig.MaximumIntensity * scalar, attribute, minimum, maximum); }
public Jewelry(BaseJewel Item, uint Container) { Item.UpdateLocalizedProperties(); Item.UpdateTextProperties(); //General Properties ID = Item.Serial.Value; ContainerID = Container; SkillBonuses = ""; ItemName = Item.Tooltip.Split('|')[0].Replace("'", ""); DI = (sbyte)Item.Attributes.WeaponDamage; SSI = (sbyte)Item.Attributes.WeaponSpeed; FC = (sbyte)Item.Attributes.CastSpeed; FCR = (sbyte)Item.Attributes.CastRecovery; SDI = (sbyte)Item.Attributes.SpellDamage; DCI = (sbyte)Item.Attributes.DefendChance; HCI = (sbyte)Item.Attributes.AttackChance; STR = (sbyte)Item.Attributes.BonusStr; DEX = (sbyte)Item.Attributes.BonusDex; INTEL = (sbyte)Item.Attributes.BonusInt; HP = (sbyte)Item.Attributes.BonusHits; Stam = (sbyte)Item.Attributes.BonusStam; Mana = (sbyte)Item.Attributes.BonusMana; HPRegen = (sbyte)Item.Attributes.RegenHits; StamRegen = (sbyte)Item.Attributes.RegenStam; ManaRegen = (sbyte)Item.Attributes.RegenMana; LMC = (sbyte)Item.Attributes.LowerManaCost; LRC = (sbyte)Item.Attributes.LowerRegCost; EnhancePotions = (sbyte)Item.Attributes.EnhancePotions; Luck = (short)Item.Attributes.Luck; PhysicalResist = (sbyte)Item.Resistances.Physical; FireResist = (sbyte)Item.Resistances.Fire; ColdResist = (sbyte)Item.Resistances.Cold; PoisonResist = (sbyte)Item.Resistances.Poison; EnergyResist = (sbyte)Item.Resistances.Energy; Added = DateTime.Now; Antique = "false"; foreach (string _s in Item.Tooltip.Split('|')) { if (_s == "Antique") { Antique = "true"; } } //Skill Bonuses ItemSkillName _skill1 = (ItemSkillName)Item.SkillBonuses.Skill_1_Name; ItemSkillName _skill2 = (ItemSkillName)Item.SkillBonuses.Skill_2_Name; ItemSkillName _skill3 = (ItemSkillName)Item.SkillBonuses.Skill_3_Name; ItemSkillName _skill4 = (ItemSkillName)Item.SkillBonuses.Skill_4_Name; ItemSkillName _skill5 = (ItemSkillName)Item.SkillBonuses.Skill_5_Name; string[][] _skillBonusesString = new string[][] { new string[] { Item.SkillBonuses.Skill_1_Value.ToString(), _skill1.ToString() }, new string[] { Item.SkillBonuses.Skill_2_Value.ToString(), _skill2.ToString() }, new string[] { Item.SkillBonuses.Skill_3_Value.ToString(), _skill3.ToString() }, new string[] { Item.SkillBonuses.Skill_4_Value.ToString(), _skill4.ToString() }, new string[] { Item.SkillBonuses.Skill_5_Value.ToString(), _skill5.ToString() }, }; foreach (string[] _s in _skillBonusesString) { if (_s[1].Equals("Invalid")) { continue; } else { SkillBonuses = SkillBonuses + _s[0] + ' ' + _s[1] + ' '; } } SkillBonuses = SkillBonuses.Replace('_', ' '); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseWeapon || targeted is BaseArmor || targeted is BaseJewel) { if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { string texttype = "Inconnu", textquality = "Inconnue", textresource = "Inconnue", textdurability = "Inconnue"; if (targeted is BaseWeapon) { BaseWeapon arm = (BaseWeapon)targeted; double durability = 0; if (arm.MaxHitPoints != 0) { durability = arm.HitPoints / (double)arm.MaxHitPoints; } switch (arm.Type) { case WeaponType.Axe: texttype = "Hache"; break; case WeaponType.Bashing: texttype = "Arme contondante"; break; case WeaponType.Fists: texttype = "Arme de pugilat"; break; case WeaponType.Piercing: texttype = "Arme d'estoc"; break; case WeaponType.Polearm: texttype = "Arme à longue portée"; break; case WeaponType.Ranged: texttype = "Arme de jet"; break; case WeaponType.Slashing: texttype = "Arme à tranchant"; break; case WeaponType.Staff: texttype = "Baton"; break; default: texttype = "Arme"; break; } if (from.Skills[SkillName.ArmsLore].Value > 20) { if (arm.Quality == WeaponQuality.Low) { textquality = "Mauvaise"; } else if (arm.Quality == WeaponQuality.Exceptional) { textquality = "Excellente"; } else { textquality = "Commune"; } } if (from.Skills[SkillName.Mining].Value > 30 && arm.Resource != CraftResource.None) { textresource = string.Format("{0}", CraftResources.GetName(arm.Resource)); } if (from.Skills[SkillName.ArmsLore].Value >= 50 && from.Skills[SkillName.ArmsLore].Value <= 75) { if (durability < 0.1 || arm.MaxHitPoints < 10) { textdurability = "Fissurée et menace de se briser!"; } else if (durability < 0.3) { textdurability = "Signes importants de faiblesse"; } else if (durability < 0.6) { textdurability = "Endommagée"; } else if (durability < 0.85) { textdurability = "Quelques dégats"; } else if (durability < 1) { textdurability = "Presque neuve"; } else { textdurability = "Aucun défaut"; } } else if (from.Skills[SkillName.ArmsLore].Value > 75 && from.Skills[SkillName.ArmsLore].Value <= 95) { textdurability = string.Format("Endommagée à {0}%", (100 - Math.Round(durability * 100.0))); } else if (from.Skills[SkillName.ArmsLore].Value > 95) { textdurability = string.Format("{0} sur {1}", arm.HitPoints, arm.MaxHitPoints); } else if (durability < 0.15) { textdurability = string.Format("Cette arme tombe en ruine"); } from.SendMessage("Type : {0}", texttype); from.SendMessage("Resource : {0}", textresource); from.SendMessage("Qualité : {0}", textquality); from.SendMessage("Durabilité : {0}", textdurability);/*, textquality, textresource, textdurability*/ } else if (targeted is BaseArmor) { BaseArmor arm = (BaseArmor)targeted; double durability = 0; if (arm.MaxHitPoints != 0) { durability = arm.HitPoints / (double)arm.MaxHitPoints; } switch (arm.MaterialType) { case ArmorMaterialType.Barbed: case ArmorMaterialType.Horned: case ArmorMaterialType.Spined: case ArmorMaterialType.Studded: case ArmorMaterialType.Daemon: texttype = "Armure de cuir de demon"; break; case ArmorMaterialType.Leather: texttype = "Armure de cuir"; break; case ArmorMaterialType.Bone: texttype = "Armure d'os"; break; case ArmorMaterialType.Chainmail: texttype = "Armure de chaine"; break; case ArmorMaterialType.Cloth: texttype = "Armure de tissus"; break; case ArmorMaterialType.Dragon: texttype = "Armure d'écaille"; break; case ArmorMaterialType.Ringmail: texttype = "Armure d'anneau"; break; case ArmorMaterialType.Plate: texttype = "Armure de plaque"; break; default: texttype = "Armure"; break; } if (from.Skills[SkillName.ArmsLore].Value > 20) { if (arm.Quality == ArmorQuality.Low) { textquality = "Mauvaise"; } else if (arm.Quality == ArmorQuality.Exceptional) { textquality = "Excellente"; } else { textquality = "Commune"; } } if (arm.MaterialType != ArmorMaterialType.Bone && from.Skills[SkillName.Mining].Value > 30 && arm.Resource != CraftResource.None) { textresource = string.Format(" en {0}.", CraftResources.GetName(arm.Resource)); } if (from.Skills[SkillName.ArmsLore].Value >= 50 && from.Skills[SkillName.ArmsLore].Value <= 75) { if (durability < 0.1 || arm.MaxHitPoints < 10) { textdurability = "Fissurée et menace de se briser!"; } else if (durability < 0.3) { textdurability = "Signes importants de faiblesse"; } else if (durability < 0.6) { textdurability = "Endommagée"; } else if (durability < 0.85) { textdurability = "Quelques dégats"; } else if (durability < 1) { textdurability = "Presque neuve"; } else { textdurability = "Aucun défaut"; } } else if (from.Skills[SkillName.ArmsLore].Value > 75 && from.Skills[SkillName.ArmsLore].Value <= 95) { textdurability = string.Format("Endommagée à {0}%", (100 - Math.Round(durability * 100.0))); } else if (from.Skills[SkillName.ArmsLore].Value > 95) { textdurability = string.Format("{0} sur {1}", arm.HitPoints, arm.MaxHitPoints); } else if (durability < 0.15) { textdurability = string.Format("Cette arme tombe en ruine"); } from.SendMessage("Type : {0}", texttype); from.SendMessage("Resource : {0}", textresource); from.SendMessage("Qualité : {0}", textquality); from.SendMessage("Durabilité : {0}", textdurability); } else if (targeted is BaseJewel) { BaseJewel arm = (BaseJewel)targeted; switch (arm.Layer) { case Layer.Earrings: texttype = "Boucles d'oreilles"; break; case Layer.Neck: texttype = "Pendentif"; break; case Layer.Bracelet: texttype = "Bracelet"; break; default: texttype = "Bijou"; break; } if (from.Skills[SkillName.Mining].Value > 30 && arm.Resource != CraftResource.None) { textresource = string.Format("{0}.", CraftResources.GetName(arm.Resource)); } from.SendMessage("Type : {0}", texttype); from.SendMessage("Resource : {0}", textresource); } else { from.SendMessage("Ceci n'est ni une arme, ni une armure, ni un bijou"); // This is neither weapon nor armor. } } else { from.SendMessage("Vous êtes incertain..."); // You are not certain... } } else { from.SendMessage("Ceci n'est ni une arme, ni une armure, ni un bijou"); // This is neither weapon nor armor. } }
protected override void OnTarget(Mobile from, object targeted) { bool usingDeed = (m_Deed != null); bool toDelete = false; int number; if (m_CraftSystem is DefTinkering && targeted is IRepairableMobile) { if (TryRepairMobile(from, (IRepairableMobile)targeted, usingDeed, out toDelete)) { number = 1044279; // You repair the item. } else { number = 500426; // You can't repair that. } } else if (targeted is Item) { if (from.InRange(((Item)targeted).GetWorldLocation(), 2)) { if (!CheckDeed(from)) { return; } if (!AllowsRepair(targeted, m_CraftSystem)) { from.SendLocalizedMessage(500426); // You can't repair that. return; } if (m_CraftSystem.CanCraft(from, m_Tool, targeted.GetType()) == 1044267) { number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's * } else if (!usingDeed && m_CraftSystem is DefTinkering && targeted is BrokenAutomatonHead) { if (((BrokenAutomatonHead)targeted).TryRepair(from)) { number = 1044279; // You repair the item. } else { number = 1044280; // You fail to repair the item. } } else if (targeted is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !CheckSpecial(weapon)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!weapon.IsChildOf(from.Backpack) && (!Core.ML || weapon.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (!Core.AOS && weapon.PoisonCharges != 0) { number = 1005012; // You cannot repair an item while a caustic substance is on it. } else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (weapon.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (weapon.BlockRepair || weapon.NegativeAttributes.NoRepair > 0) { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { weapon.MaxHitPoints -= toWeaken; weapon.HitPoints = Math.Max(0, weapon.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); weapon.HitPoints = weapon.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseArmor) { BaseArmor armor = (BaseArmor)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null && !CheckSpecial(armor)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!armor.IsChildOf(from.Backpack) && (!Core.ML || armor.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (armor.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (armor.BlockRepair || armor.NegativeAttributes.NoRepair > 0) { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints)) { armor.MaxHitPoints -= toWeaken; armor.HitPoints = Math.Max(0, armor.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); armor.HitPoints = armor.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseJewel) { BaseJewel jewel = (BaseJewel)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(jewel.GetType()) == null && !CheckSpecial(jewel)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!jewel.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (jewel.MaxHitPoints <= 0 || jewel.HitPoints == jewel.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (jewel.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (jewel.BlockRepair || jewel.NegativeAttributes.NoRepair > 0) { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { jewel.MaxHitPoints -= toWeaken; jewel.HitPoints = Math.Max(0, jewel.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); jewel.HitPoints = jewel.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseClothing) { BaseClothing clothing = (BaseClothing)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !CheckSpecial(clothing)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!clothing.IsChildOf(from.Backpack) && (!Core.ML || clothing.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (clothing.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (clothing.BlockRepair || clothing.NegativeAttributes.NoRepair > 0) // quick fix { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { clothing.MaxHitPoints -= toWeaken; clothing.HitPoints = Math.Max(0, clothing.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); clothing.HitPoints = clothing.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseTalisman) { BaseTalisman talisman = (BaseTalisman)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (!(m_CraftSystem is DefTinkering)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!talisman.IsChildOf(from.Backpack) && (!Core.ML || talisman.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (talisman.MaxHitPoints <= 0 || talisman.HitPoints == talisman.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (talisman.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (!talisman.CanRepair) // quick fix { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { talisman.MaxHitPoints -= toWeaken; talisman.HitPoints = Math.Max(0, talisman.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); talisman.HitPoints = talisman.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (!usingDeed && targeted is BlankScroll) { SkillName skill = m_CraftSystem.MainSkill; if (from.Skills[skill].Value >= 50.0) { ((BlankScroll)targeted).Consume(1); RepairDeed deed = new RepairDeed(RepairDeed.GetTypeFor(m_CraftSystem), from.Skills[skill].Value, from); from.AddToBackpack(deed); number = 500442; // You create the item and put it in your backpack. } else { number = 1047005; // You must be at least apprentice level to create a repair service contract. } } else { number = 500426; // You can't repair that. } } else { number = 500446; // That is too far away. } } else { number = 500426; // You can't repair that. } if (!usingDeed) { CraftContext context = m_CraftSystem.GetContext(from); from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number)); } else { from.SendLocalizedMessage(number); if (toDelete) { m_Deed.Delete(); } } }
public static void MorphMyItem(Item i, string etch, string prefix, string names, string imbue) { if (i is BaseWeapon) { BaseWeapon x = (BaseWeapon)i; string name = i.Name; if (names != "IGNORED") { i.Name = names; } else if (prefix != "IGNORED") { if (name == null) { name = AddSpacesToSentence((i.GetType()).Name); } i.Name = prefix + " " + name; } if (etch != "IGNORED") { x.EngravedText = etch; } char[] delimiterChars = { ',' }; string[] morph = imbue.Split(delimiterChars); int force = 0; int cycle = 0; double skill1 = 0.0; double skill2 = 0.0; double skill3 = 0.0; double skill4 = 0.0; double skill5 = 0.0; foreach (string s in morph) { cycle++; force = Int32.Parse(s); if (force > 0 && cycle == 1) { x.WeaponAttributes.LowerStatReq = force; } if (force > 0 && cycle == 2) { x.WeaponAttributes.SelfRepair = force; } if (force > 0 && cycle == 3) { x.WeaponAttributes.HitLeechHits = force; } if (force > 0 && cycle == 4) { x.WeaponAttributes.HitLeechStam = force; } if (force > 0 && cycle == 5) { x.WeaponAttributes.HitLeechMana = force; } if (force > 0 && cycle == 6) { x.WeaponAttributes.HitLowerAttack = force; } if (force > 0 && cycle == 7) { x.WeaponAttributes.HitLowerDefend = force; } if (force > 0 && cycle == 8) { x.WeaponAttributes.HitMagicArrow = force; } if (force > 0 && cycle == 9) { x.WeaponAttributes.HitHarm = force; } if (force > 0 && cycle == 10) { x.WeaponAttributes.HitFireball = force; } if (force > 0 && cycle == 11) { x.WeaponAttributes.HitLightning = force; } if (force > 0 && cycle == 12) { x.WeaponAttributes.HitDispel = force; } if (force > 0 && cycle == 13) { x.WeaponAttributes.HitColdArea = force; } if (force > 0 && cycle == 14) { x.WeaponAttributes.HitFireArea = force; } if (force > 0 && cycle == 15) { x.WeaponAttributes.HitPoisonArea = force; } if (force > 0 && cycle == 16) { x.WeaponAttributes.HitEnergyArea = force; } if (force > 0 && cycle == 17) { x.WeaponAttributes.HitPhysicalArea = force; } if (force > 0 && cycle == 18) { x.WeaponAttributes.ResistPhysicalBonus = force; } if (force > 0 && cycle == 19) { x.WeaponAttributes.ResistFireBonus = force; } if (force > 0 && cycle == 20) { x.WeaponAttributes.ResistColdBonus = force; } if (force > 0 && cycle == 21) { x.WeaponAttributes.ResistPoisonBonus = force; } if (force > 0 && cycle == 22) { x.WeaponAttributes.ResistEnergyBonus = force; } if (force > 0 && cycle == 23) { x.WeaponAttributes.UseBestSkill = 1; } if (force > 0 && cycle == 24) { x.WeaponAttributes.DurabilityBonus = force; } if (force > 0 && cycle == 25) { i.Hue = force; } if (force > 0 && cycle == 26) { if (force == 1) { x.AccuracyLevel = WeaponAccuracyLevel.Regular; } else if (force == 2) { x.AccuracyLevel = WeaponAccuracyLevel.Accurate; } else if (force == 3) { x.AccuracyLevel = WeaponAccuracyLevel.Surpassingly; } else if (force == 4) { x.AccuracyLevel = WeaponAccuracyLevel.Eminently; } else if (force == 5) { x.AccuracyLevel = WeaponAccuracyLevel.Exceedingly; } else if (force == 6) { x.AccuracyLevel = WeaponAccuracyLevel.Supremely; } } if (force > 0 && cycle == 27) { if (force == 1) { x.DamageLevel = WeaponDamageLevel.Regular; } else if (force == 2) { x.DamageLevel = WeaponDamageLevel.Ruin; } else if (force == 3) { x.DamageLevel = WeaponDamageLevel.Might; } else if (force == 4) { x.DamageLevel = WeaponDamageLevel.Force; } else if (force == 5) { x.DamageLevel = WeaponDamageLevel.Power; } else if (force == 6) { x.DamageLevel = WeaponDamageLevel.Vanq; } } if (force > 0 && cycle == 28) { x.Quality = WeaponQuality.Exceptional; } if (force > 0 && cycle == 29) { if (force == 1) { x.DurabilityLevel = WeaponDurabilityLevel.Regular; } else if (force == 2) { x.DurabilityLevel = WeaponDurabilityLevel.Durable; } else if (force == 3) { x.DurabilityLevel = WeaponDurabilityLevel.Substantial; } else if (force == 4) { x.DurabilityLevel = WeaponDurabilityLevel.Massive; } else if (force == 5) { x.DurabilityLevel = WeaponDurabilityLevel.Fortified; } else if (force == 6) { x.DurabilityLevel = WeaponDurabilityLevel.Indestructible; } } if (force > 0 && cycle == 30) { x.AosElementDamages.Physical = force; } // 30-34 SHOULD TOTAL 100 if (force > 0 && cycle == 31) { x.AosElementDamages.Fire = force; } if (force > 0 && cycle == 32) { x.AosElementDamages.Cold = force; } if (force > 0 && cycle == 33) { x.AosElementDamages.Poison = force; } if (force > 0 && cycle == 34) { x.AosElementDamages.Energy = force; } if (force > 0 && cycle == 35) { x.HitPoints = x.HitPoints + force; x.MaxHitPoints = x.MaxHitPoints + force; } if (force > 0 && cycle == 36) { x.MinDamage = x.MinDamage + force; x.MaxDamage = x.MaxDamage + force; } if (force > 0 && cycle == 37) { x.Attributes.RegenHits = force; } if (force > 0 && cycle == 38) { x.Attributes.RegenStam = force; } if (force > 0 && cycle == 39) { x.Attributes.RegenMana = force; } if (force > 0 && cycle == 40) { x.Attributes.DefendChance = force; } if (force > 0 && cycle == 41) { x.Attributes.AttackChance = force; } if (force > 0 && cycle == 42) { x.Attributes.BonusStr = force; } if (force > 0 && cycle == 43) { x.Attributes.BonusDex = force; } if (force > 0 && cycle == 44) { x.Attributes.BonusInt = force; } if (force > 0 && cycle == 45) { x.Attributes.BonusHits = force; } if (force > 0 && cycle == 46) { x.Attributes.BonusStam = force; } if (force > 0 && cycle == 47) { x.Attributes.BonusMana = force; } if (force > 0 && cycle == 48) { x.Attributes.WeaponDamage = force; } if (force > 0 && cycle == 49) { x.Attributes.WeaponSpeed = force; } if (force > 0 && cycle == 50) { x.Attributes.SpellDamage = force; } if (force > 0 && cycle == 51) { x.Attributes.CastRecovery = force; } if (force > 0 && cycle == 52) { x.Attributes.CastSpeed = force; } if (force > 0 && cycle == 53) { x.Attributes.LowerManaCost = force; } if (force > 0 && cycle == 54) { x.Attributes.LowerRegCost = force; } if (force > 0 && cycle == 55) { x.Attributes.ReflectPhysical = force; } if (force > 0 && cycle == 56) { x.Attributes.EnhancePotions = force; } if (force > 0 && cycle == 57) { x.Attributes.Luck = force; } if (force > 0 && cycle == 58) { x.Attributes.SpellChanneling = 1; } if (force > 0 && cycle == 59) { x.Attributes.NightSight = 1; } if (force > 0 && cycle == 60) { x.Slayer = GetMorphSlayer(force); } if (force > 0 && cycle == 61) { x.Slayer2 = GetMorphSlayer(force); } if (force > 0 && cycle == 62) { skill1 = (double)force; } if (force > 0 && cycle == 63) { // GIVE THE WEAPON A BONUS FOR THE WEAPON SKILL IF SET TO 99 if (force == 99) { x.SkillBonuses.SetValues(0, x.Skill, skill1); } else { x.SkillBonuses.SetValues(0, GetMorphSkill(force), skill1); } } if (force > 0 && cycle == 64) { skill2 = (double)force; } if (force > 0 && cycle == 65) { x.SkillBonuses.SetValues(1, GetMorphSkill(force), skill2); } if (force > 0 && cycle == 66) { skill3 = (double)force; } if (force > 0 && cycle == 67) { x.SkillBonuses.SetValues(2, GetMorphSkill(force), skill3); } if (force > 0 && cycle == 68) { skill4 = (double)force; } if (force > 0 && cycle == 69) { x.SkillBonuses.SetValues(3, GetMorphSkill(force), skill4); } if (force > 0 && cycle == 70) { skill5 = (double)force; } if (force > 0 && cycle == 71) { x.SkillBonuses.SetValues(4, GetMorphSkill(force), skill5); } } } else if (i is BaseArmor) { BaseArmor x = (BaseArmor)i; string name = i.Name; if (names != "IGNORED") { i.Name = names; } else if (prefix != "IGNORED") { if (name == null) { name = AddSpacesToSentence((i.GetType()).Name); } i.Name = prefix + " " + name; } char[] delimiterChars = { ',' }; string[] morph = imbue.Split(delimiterChars); int force = 0; int cycle = 0; double skill1 = 0.0; double skill2 = 0.0; double skill3 = 0.0; double skill4 = 0.0; double skill5 = 0.0; foreach (string s in morph) { cycle++; force = Int32.Parse(s); if (force > 0 && cycle == 1) { x.ArmorAttributes.LowerStatReq = force; } if (force > 0 && cycle == 2) { x.ArmorAttributes.SelfRepair = force; } if (force > 0 && cycle == 3) { x.ArmorAttributes.MageArmor = 1; } if (force > 0 && cycle == 4) { x.ArmorAttributes.DurabilityBonus = force; } if (force > 0 && cycle == 5) { x.PhysicalBonus = force; } if (force > 0 && cycle == 6) { x.ColdBonus = force; } if (force > 0 && cycle == 7) { x.EnergyBonus = force; } if (force > 0 && cycle == 8) { x.FireBonus = force; } if (force > 0 && cycle == 9) { x.PoisonBonus = force; } if (force > 0 && cycle == 10) { x.HitPoints = x.HitPoints + force; x.MaxHitPoints = x.MaxHitPoints + force; } if (force > 0 && cycle == 11) { if (force == 1) { x.Durability = ArmorDurabilityLevel.Regular; } else if (force == 2) { x.Durability = ArmorDurabilityLevel.Durable; } else if (force == 3) { x.Durability = ArmorDurabilityLevel.Substantial; } else if (force == 4) { x.Durability = ArmorDurabilityLevel.Massive; } else if (force == 5) { x.Durability = ArmorDurabilityLevel.Fortified; } else if (force == 6) { x.Durability = ArmorDurabilityLevel.Indestructible; } } if (force > 0 && cycle == 12) { x.Quality = ArmorQuality.Exceptional; } if (force > 0 && cycle == 13) { if (force == 1) { x.ProtectionLevel = ArmorProtectionLevel.Regular; } else if (force == 2) { x.ProtectionLevel = ArmorProtectionLevel.Defense; } else if (force == 3) { x.ProtectionLevel = ArmorProtectionLevel.Guarding; } else if (force == 4) { x.ProtectionLevel = ArmorProtectionLevel.Hardening; } else if (force == 5) { x.ProtectionLevel = ArmorProtectionLevel.Fortification; } else if (force == 6) { x.ProtectionLevel = ArmorProtectionLevel.Invulnerability; } } if (force > 0 && cycle == 14) { x.Attributes.RegenHits = force; } if (force > 0 && cycle == 15) { x.Attributes.RegenStam = force; } if (force > 0 && cycle == 16) { x.Attributes.RegenMana = force; } if (force > 0 && cycle == 17) { x.Attributes.DefendChance = force; } if (force > 0 && cycle == 18) { x.Attributes.AttackChance = force; } if (force > 0 && cycle == 19) { x.Attributes.BonusStr = force; } if (force > 0 && cycle == 20) { x.Attributes.BonusDex = force; } if (force > 0 && cycle == 21) { x.Attributes.BonusInt = force; } if (force > 0 && cycle == 22) { x.Attributes.BonusHits = force; } if (force > 0 && cycle == 23) { x.Attributes.BonusStam = force; } if (force > 0 && cycle == 24) { x.Attributes.BonusMana = force; } if (force > 0 && cycle == 25) { x.Attributes.WeaponDamage = force; } if (force > 0 && cycle == 26) { x.Attributes.WeaponSpeed = force; } if (force > 0 && cycle == 27) { x.Attributes.SpellDamage = force; } if (force > 0 && cycle == 28) { x.Attributes.CastRecovery = force; } if (force > 0 && cycle == 29) { x.Attributes.CastSpeed = force; } if (force > 0 && cycle == 30) { x.Attributes.LowerManaCost = force; } if (force > 0 && cycle == 31) { x.Attributes.LowerRegCost = force; } if (force > 0 && cycle == 32) { x.Attributes.ReflectPhysical = force; } if (force > 0 && cycle == 33) { x.Attributes.EnhancePotions = force; } if (force > 0 && cycle == 34) { x.Attributes.Luck = force; } if (force > 0 && cycle == 35) { x.Attributes.SpellChanneling = 1; } if (force > 0 && cycle == 36) { x.Attributes.NightSight = 1; } if (force > 0 && cycle == 37) { skill1 = (double)force; } if (force > 0 && cycle == 38) { x.SkillBonuses.SetValues(0, GetMorphSkill(force), skill1); } if (force > 0 && cycle == 39) { skill2 = (double)force; } if (force > 0 && cycle == 40) { x.SkillBonuses.SetValues(1, GetMorphSkill(force), skill2); } if (force > 0 && cycle == 41) { skill3 = (double)force; } if (force > 0 && cycle == 42) { x.SkillBonuses.SetValues(2, GetMorphSkill(force), skill3); } if (force > 0 && cycle == 43) { skill4 = (double)force; } if (force > 0 && cycle == 44) { x.SkillBonuses.SetValues(3, GetMorphSkill(force), skill4); } if (force > 0 && cycle == 45) { skill5 = (double)force; } if (force > 0 && cycle == 46) { x.SkillBonuses.SetValues(4, GetMorphSkill(force), skill5); } if (force > 0 && cycle == 47) { i.Hue = force; } } } else if (i is BaseJewel) { BaseJewel x = (BaseJewel)i; string name = i.Name; if (names != "IGNORED") { i.Name = names; } else if (prefix != "IGNORED") { if (name == null) { name = AddSpacesToSentence((i.GetType()).Name); } i.Name = prefix + " " + name; } char[] delimiterChars = { ',' }; string[] morph = imbue.Split(delimiterChars); int force = 0; int cycle = 0; double skill1 = 0.0; double skill2 = 0.0; double skill3 = 0.0; double skill4 = 0.0; double skill5 = 0.0; foreach (string s in morph) { cycle++; force = Int32.Parse(s); if (force > 0 && cycle == 1) { x.Resistances.Physical = force; } if (force > 0 && cycle == 2) { x.Resistances.Fire = force; } if (force > 0 && cycle == 3) { x.Resistances.Cold = force; } if (force > 0 && cycle == 4) { x.Resistances.Poison = force; } if (force > 0 && cycle == 5) { x.Resistances.Energy = force; } if (force > 0 && cycle == 6) { x.Attributes.DefendChance = force; } if (force > 0 && cycle == 7) { x.Attributes.AttackChance = force; } if (force > 0 && cycle == 8) { x.Attributes.BonusStr = force; } if (force > 0 && cycle == 9) { x.Attributes.BonusDex = force; } if (force > 0 && cycle == 10) { x.Attributes.BonusInt = force; } if (force > 0 && cycle == 11) { x.Attributes.BonusHits = force; } if (force > 0 && cycle == 12) { x.Attributes.BonusStam = force; } if (force > 0 && cycle == 13) { x.Attributes.BonusMana = force; } if (force > 0 && cycle == 14) { x.Attributes.CastRecovery = force; } if (force > 0 && cycle == 15) { x.Attributes.CastSpeed = force; } if (force > 0 && cycle == 16) { x.Attributes.EnhancePotions = force; } if (force > 0 && cycle == 17) { x.Attributes.LowerManaCost = force; } if (force > 0 && cycle == 18) { x.Attributes.LowerRegCost = force; } if (force > 0 && cycle == 19) { x.Attributes.Luck = force; } if (force > 0 && cycle == 20) { x.Attributes.NightSight = 1; } if (force > 0 && cycle == 21) { x.Attributes.ReflectPhysical = force; } if (force > 0 && cycle == 22) { x.Attributes.RegenHits = force; } if (force > 0 && cycle == 23) { x.Attributes.RegenStam = force; } if (force > 0 && cycle == 24) { x.Attributes.RegenMana = force; } if (force > 0 && cycle == 25) { x.Attributes.SpellDamage = force; } if (force > 0 && cycle == 26) { x.Attributes.WeaponDamage = force; } if (force > 0 && cycle == 27) { x.Attributes.WeaponSpeed = force; } if (force > 0 && cycle == 28) { skill1 = (double)force; } if (force > 0 && cycle == 29) { x.SkillBonuses.SetValues(0, GetMorphSkill(force), skill1); } if (force > 0 && cycle == 30) { skill2 = (double)force; } if (force > 0 && cycle == 31) { x.SkillBonuses.SetValues(1, GetMorphSkill(force), skill2); } if (force > 0 && cycle == 32) { skill3 = (double)force; } if (force > 0 && cycle == 33) { x.SkillBonuses.SetValues(2, GetMorphSkill(force), skill3); } if (force > 0 && cycle == 34) { skill4 = (double)force; } if (force > 0 && cycle == 35) { x.SkillBonuses.SetValues(3, GetMorphSkill(force), skill4); } if (force > 0 && cycle == 36) { skill5 = (double)force; } if (force > 0 && cycle == 37) { x.SkillBonuses.SetValues(4, GetMorphSkill(force), skill5); } if (force > 0 && cycle == 38) { i.Hue = force; } } } return; }
protected override void OnTarget(Mobile from, object targeted) { int number; if (!this.CheckDeed(from)) { return; } bool usingDeed = (this.m_Deed != null); bool toDelete = false; // TODO: Make an IRepairable if (this.m_CraftSystem.CanCraft(from, this.m_Tool, targeted.GetType()) == 1044267) { number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's * } else if (this.m_CraftSystem is DefTinkering && targeted is Golem) { Golem g = (Golem)targeted; int damage = g.HitsMax - g.Hits; if (g.IsDeadBondedPet) { number = 500426; // You can't repair that. } else if (damage <= 0) { number = 500423; // That is already in full repair. } else { double skillValue = (usingDeed) ? this.m_Deed.SkillLevel : from.Skills[SkillName.Tinkering].Value; if (skillValue < 60.0) { number = 1044153; // You don't have the required skills to attempt this item. //TODO: How does OSI handle this with deeds with golems? } else if (!from.CanBeginAction(typeof(Golem))) { number = 501789; // You must wait before trying again. } else { if (damage > (int)(skillValue * 0.3)) { damage = (int)(skillValue * 0.3); } damage += 30; if (!from.CheckSkill(SkillName.Tinkering, 0.0, 100.0)) { damage /= 2; } Container pack = from.Backpack; if (pack != null) { int v = pack.ConsumeUpTo(typeof(IronIngot), (damage + 4) / 5); if (v > 0) { g.Hits += v * 5; number = 1044279; // You repair the item. toDelete = true; from.BeginAction(typeof(Golem)); Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair), from); } else { number = 1044037; // You do not have sufficient metal to make that. } } else { number = 1044037; // You do not have sufficient metal to make that. } } } } else if (targeted is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = this.m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? this.m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (this.m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !this.IsSpecialWeapon(weapon)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!weapon.IsChildOf(from.Backpack) && (!Core.ML || weapon.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (!Core.AOS && weapon.PoisonCharges != 0) { number = 1005012; // You cannot repair an item while a caustic substance is on it. } else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (weapon.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (weapon.BlockRepair) { number = 1044277; // That item cannot be repaired. } else { if (this.CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { weapon.MaxHitPoints -= toWeaken; weapon.HitPoints = Math.Max(0, weapon.HitPoints - toWeaken); } if (this.CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints)) { number = 1044279; // You repair the item. this.m_CraftSystem.PlayCraftEffect(from); weapon.HitPoints = weapon.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] this.m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseArmor) { BaseArmor armor = (BaseArmor)targeted; SkillName skill = this.m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? this.m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (this.m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null && !this.IsSpecialArmor(armor)) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!armor.IsChildOf(from.Backpack) && (!Core.ML || armor.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (armor.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (armor.BlockRepair) { number = 1044277; // That item cannot be repaired. } else { if (this.CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints)) { armor.MaxHitPoints -= toWeaken; armor.HitPoints = Math.Max(0, armor.HitPoints - toWeaken); } if (this.CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints)) { number = 1044279; // You repair the item. this.m_CraftSystem.PlayCraftEffect(from); armor.HitPoints = armor.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] this.m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseJewel && ((BaseJewel)targeted).TimesImbued > 0) { BaseJewel jewel = (BaseJewel)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(jewel.GetType()) == null) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!jewel.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (jewel.MaxHitPoints <= 0 || jewel.HitPoints == jewel.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (jewel.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (jewel.BlockRepair) { number = 1044277; // That item cannot be repaired. } else { if (CheckWeaken(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { jewel.MaxHitPoints -= toWeaken; jewel.HitPoints = Math.Max(0, jewel.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, jewel.HitPoints, jewel.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); jewel.HitPoints = jewel.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseClothing) { BaseClothing clothing = (BaseClothing)targeted; SkillName skill = this.m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? this.m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (this.m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !this.IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask))) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else if (!clothing.IsChildOf(from.Backpack) && (!Core.ML || clothing.Parent != from)) { number = 1044275; // The item must be in your backpack to repair it. } else if (clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints) { number = 1044281; // That item is in full repair } else if (clothing.MaxHitPoints <= toWeaken) { number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again. } else if (clothing.BlockRepair) // quick fix { number = 1044277; // That item cannot be repaired. } else { if (this.CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { clothing.MaxHitPoints -= toWeaken; clothing.HitPoints = Math.Max(0, clothing.HitPoints - toWeaken); } if (this.CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { number = 1044279; // You repair the item. this.m_CraftSystem.PlayCraftEffect(from); clothing.HitPoints = clothing.MaxHitPoints; } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] this.m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (!usingDeed && targeted is BlankScroll) { SkillName skill = this.m_CraftSystem.MainSkill; if (from.Skills[skill].Value >= 50.0) { ((BlankScroll)targeted).Consume(1); RepairDeed deed = new RepairDeed(RepairDeed.GetTypeFor(this.m_CraftSystem), from.Skills[skill].Value, from); from.AddToBackpack(deed); number = 500442; // You create the item and put it in your backpack. } else { number = 1047005; // You must be at least apprentice level to create a repair service contract. } } else if (targeted is Item) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } else { number = 500426; // You can't repair that. } if (!usingDeed) { CraftContext context = this.m_CraftSystem.GetContext(from); from.SendGump(new CraftGump(from, this.m_CraftSystem, this.m_Tool, number)); } else { from.SendLocalizedMessage(number); if (toDelete) { this.m_Deed.Delete(); } } }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (Core.AOS) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > m_MaxProps) { props = m_MaxProps; } if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } //if ( 20 > Utility.Random( 100 ) ) // weapon.MagicAffect = (BaseWeapon.PreUORMagAff)Utility.Random( 12 ); // weapon.AffectCharges = Utility.Random( 45 ); if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } //if ( 20 > Utility.Random( 100 ) ) //armor.MagicAffect = (BaseArmor.PreUORMagAff)Utility.Random( 14 ); //armor.AffectCharges = Utility.Random( 45 ); } else if (item is BaseJewel) { BaseJewel jewel = (BaseJewel)item; //if ( 60 > Utility.Random( 100 ) ) // jewel.MagicAffect = (BaseJewel.PreUORMagAff)Utility.Random( 14 ); // jewel.AffectCharges = Utility.Random( 45 ); } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }