private void createArmor() { newArmor = new BaseArmor(); newArmor.ItemName = itemNames[Random.Range(0, 1)]; newArmor.ItemID = Random.Range(1, 101); chooseItemType(); newArmor.Health = Random.Range (1, 11); newArmor.Attack = Random.Range (1, 11); newArmor.Magic = Random.Range (1, 11); newArmor.Defence = Random.Range (1, 11); newArmor.Resistance = Random.Range (1, 11); newArmor.HiddenStatLuck = Random.Range (1, 11); newArmor.AwesomeStat = Random.Range (1, 11); newArmor.Speed = Random.Range (1, 11); }
public TreasureLevel4() : base(Utility.RandomList(0xe40, 0xe42, 0x9ab)) { RequiredSkill = 92; LockLevel = RequiredSkill - Utility.Random(1, 10); MaxLockLevel = RequiredSkill; TrapType = TrapType.MagicTrap; TrapPower = 4 * Utility.Random(1, 25); DropItem(new Gold(200, 400)); DropItem(new BlankScroll(Utility.Random(1, 4))); for (int i = Utility.Random(1, 4); i > 1; i--) { Item ReagentLoot = Loot.RandomReagent(); ReagentLoot.Amount = Utility.Random(6, 12); DropItem(ReagentLoot); } for (int i = Utility.Random(1, 4); i > 1; i--) { DropItem(Loot.RandomPotion()); } if (0.75 > Utility.RandomDouble()) //75% chance = 3/4 { for (int i = Utility.RandomMinMax(8, 16); i > 0; i--) { DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular)); } } if (0.75 > Utility.RandomDouble()) //75% chance = 3/4 { for (int i = Utility.RandomMinMax(6, 12) + 1; i > 0; i--) { DropItem(Loot.RandomGem()); } } for (int i = Utility.Random(1, 4); i > 1; i--) { DropItem(Loot.RandomWand()); } // Magical ArmorOrWeapon for (int i = Utility.Random(1, 4); i > 1; i--) { Item item = Loot.RandomArmorOrShieldOrWeapon(); if (!Core.AOS) { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(4); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(4); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(4); weapon.Quality = ItemQuality.Normal; } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(4); armor.Durability = (ArmorDurabilityLevel)Utility.Random(4); armor.Quality = ItemQuality.Normal; } } else { AddLoot(item); } } for (int i = Utility.Random(1, 2); i > 1; i--) { AddLoot(Loot.RandomClothing()); } for (int i = Utility.Random(1, 2); i > 1; i--) { AddLoot(Loot.RandomJewelry()); } }
protected override void OnTarget(Mobile from, object targeted) { int number; if (!this.CheckDeed(from)) { return; } bool usingDeed = (this.m_Deed != null); bool toDelete = false; if (!AllowsRepair(targeted as Item, m_CraftSystem)) { from.SendLocalizedMessage(500426); // You can't repair that. return; } 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 || weapon.NegativeAttributes.NoRepair > 0) { 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 || armor.NegativeAttributes.NoRepair > 0) { 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 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 || 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 = 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 || clothing.NegativeAttributes.NoRepair > 0) // 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 (targeted is BaseTalisman) { BaseTalisman talisman = (BaseTalisman)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 (talisman is IRepairable && ((IRepairable)talisman).RepairSystem != m_CraftSystem) { 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 (this.CheckWeaken(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { talisman.MaxHitPoints -= toWeaken; talisman.HitPoints = Math.Max(0, talisman.HitPoints - toWeaken); } if (this.CheckRepairDifficulty(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { number = 1044279; // You repair the item. this.m_CraftSystem.PlayCraftEffect(from); talisman.HitPoints = talisman.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) { // Try to generate a new random item based on the creature killed if (Core.HS && RandomItemGenerator.Enabled && from is BaseCreature) { if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from)) { return(item); } } 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; } // Use the older style random generation 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 (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (from != null && 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(); } } } } 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 = ItemQuality.Normal; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public ChestOfHeirlooms() : base(0x2811) { Locked = true; LockLevel = 95; MaxLockLevel = 140; RequiredSkill = 95; TrapType = TrapType.ExplosionTrap; TrapLevel = 10; TrapPower = 100; GumpID = 0x10B; for (int i = 0; i < 10; ++i) { Item item = Loot.ChestOfHeirloomsContains(); int attributeCount = Utility.RandomMinMax(1, 5); int min = 20; int max = 80; if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max); } else { weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max); } else { armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6); armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); } } else if (item is BaseHat && Core.AOS) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, attributeCount, min, max); } else if (item is BaseJewel && Core.AOS) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max); } DropItem(item); } }
public Item Resourced(BaseArmor armor, CraftResource resource) { armor.Resource = resource; return(armor); }
public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage) { if (item == null) { return(EnhanceResult.BadItem); } if (!item.IsChildOf(from.Backpack)) { return(EnhanceResult.NotInBackpack); } if (!(item is BaseArmor) && !(item is BaseWeapon)) { return(EnhanceResult.BadItem); } if (item is IArcaneEquip) { IArcaneEquip eq = (IArcaneEquip)item; if (eq.IsArcane) { return(EnhanceResult.BadItem); } } if (CraftResources.IsStandard(resource)) { return(EnhanceResult.BadResource); } int num = craftSystem.CanCraft(from, tool, item.GetType()); if (num > 0) { resMessage = num; return(EnhanceResult.None); } CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(EnhanceResult.BadItem); } #region Mondain's Legacy if (craftItem.ForceNonExceptional) { return(EnhanceResult.BadItem); } #endregion bool allRequiredSkills = false; if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0) { return(EnhanceResult.NoSkill); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(EnhanceResult.BadResource); } CraftAttributeInfo attributes = info.AttributeInfo; if (attributes == null) { return(EnhanceResult.BadResource); } int resHue = 0, maxAmount = 0; if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage)) { return(EnhanceResult.NoResources); } if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0; int dura = 0, luck = 0, lreq = 0, dinc = 0; int baseChance = 0; bool physBonus = false; bool fireBonus = false; bool coldBonus = false; bool nrgyBonus = false; bool poisBonus = false; bool duraBonus = false; bool luckBonus = false; bool lreqBonus = false; bool dincBonus = false; if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (!CraftResources.IsStandard(weapon.Resource)) { return(EnhanceResult.AlreadyEnhanced); } baseChance = 20; dura = weapon.MaxHitPoints; luck = weapon.Attributes.Luck; lreq = weapon.WeaponAttributes.LowerStatReq; dinc = weapon.Attributes.WeaponDamage; fireBonus = (attributes.WeaponFireDamage > 0); coldBonus = (attributes.WeaponColdDamage > 0); nrgyBonus = (attributes.WeaponEnergyDamage > 0); poisBonus = (attributes.WeaponPoisonDamage > 0); duraBonus = (attributes.WeaponDurability > 0); luckBonus = (attributes.WeaponLuck > 0); lreqBonus = (attributes.WeaponLowerRequirements > 0); dincBonus = (dinc > 0); } else { BaseArmor armor = (BaseArmor)item; if (!CraftResources.IsStandard(armor.Resource)) { return(EnhanceResult.AlreadyEnhanced); } baseChance = 20; phys = armor.PhysicalResistance; fire = armor.FireResistance; cold = armor.ColdResistance; pois = armor.PoisonResistance; nrgy = armor.EnergyResistance; dura = armor.MaxHitPoints; luck = armor.Attributes.Luck; lreq = armor.ArmorAttributes.LowerStatReq; physBonus = (attributes.ArmorPhysicalResist > 0); fireBonus = (attributes.ArmorFireResist > 0); coldBonus = (attributes.ArmorColdResist > 0); nrgyBonus = (attributes.ArmorEnergyResist > 0); poisBonus = (attributes.ArmorPoisonResist > 0); duraBonus = (attributes.ArmorDurability > 0); luckBonus = (attributes.ArmorLuck > 0); lreqBonus = (attributes.ArmorLowerRequirements > 0); dincBonus = false; } int skill = from.Skills[craftSystem.MainSkill].Fixed / 10; if (skill >= 100) { baseChance -= (skill - 90) / 10; } EnhanceResult res = EnhanceResult.Success; if (physBonus) { CheckResult(ref res, baseChance + phys); } if (fireBonus) { CheckResult(ref res, baseChance + fire); } if (coldBonus) { CheckResult(ref res, baseChance + cold); } if (nrgyBonus) { CheckResult(ref res, baseChance + nrgy); } if (poisBonus) { CheckResult(ref res, baseChance + pois); } if (duraBonus) { CheckResult(ref res, baseChance + (dura / 40)); } if (luckBonus) { CheckResult(ref res, baseChance + 10 + (luck / 2)); } if (lreqBonus) { CheckResult(ref res, baseChance + (lreq / 4)); } if (dincBonus) { CheckResult(ref res, baseChance + (dinc / 4)); } switch (res) { case EnhanceResult.Broken: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage)) { return(EnhanceResult.NoResources); } item.Delete(); break; } case EnhanceResult.Success: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage)) { return(EnhanceResult.NoResources); } if (item is BaseWeapon) { BaseWeapon w = (BaseWeapon)item; w.Resource = resource; #region Mondain's Legacy if (resource != CraftResource.Heartwood) { w.Attributes.WeaponDamage += attributes.WeaponDamage; w.Attributes.WeaponSpeed += attributes.WeaponSwingSpeed; w.Attributes.AttackChance += attributes.WeaponHitChance; w.Attributes.RegenHits += attributes.WeaponRegenHits; w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech; } else { switch (Utility.Random(6)) { case 0: w.Attributes.WeaponDamage += attributes.WeaponDamage; break; case 1: w.Attributes.WeaponSpeed += attributes.WeaponSwingSpeed; break; case 2: w.Attributes.AttackChance += attributes.WeaponHitChance; break; case 3: w.Attributes.Luck += attributes.WeaponLuck; break; case 4: w.WeaponAttributes.LowerStatReq += attributes.WeaponLowerRequirements; break; case 5: w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech; break; } } #endregion int hue = w.GetElementalDamageHue(); if (hue > 0) { w.Hue = hue; } } #region Mondain's Legacy else if (item is BaseShield) { BaseShield shield = (BaseShield)item; shield.Resource = resource; switch (resource) { case CraftResource.AshWood: shield.ArmorAttributes.LowerStatReq += 20; break; case CraftResource.YewWood: shield.Attributes.RegenHits += 1; break; case CraftResource.Heartwood: switch (Utility.Random(7)) { case 0: shield.Attributes.BonusDex += 2; break; case 1: shield.Attributes.BonusStr += 2; break; case 2: shield.Attributes.ReflectPhysical += 5; break; case 3: shield.Attributes.SpellChanneling = 1; shield.Attributes.CastSpeed = -1; break; case 4: shield.ArmorAttributes.SelfRepair += 2; break; case 5: shield.PhysicalBonus += 5; break; case 6: shield.ColdBonus += 3; break; } break; case CraftResource.Bloodwood: shield.Attributes.RegenHits += 2; shield.Attributes.Luck += 40; break; case CraftResource.Frostwood: shield.Attributes.SpellChanneling = 1; shield.Attributes.CastSpeed = -1; break; } } #endregion else if (item is BaseArmor) //Sanity { ((BaseArmor)item).Resource = resource; #region Mondain's Legacy BaseArmor armor = (BaseArmor)item; if (resource != CraftResource.Heartwood) { armor.Attributes.WeaponDamage += attributes.ArmorDamage; armor.Attributes.AttackChance += attributes.ArmorHitChance; armor.Attributes.RegenHits += attributes.ArmorRegenHits; armor.ArmorAttributes.MageArmor += attributes.ArmorMage; } else { switch (Utility.Random(5)) { case 0: armor.Attributes.WeaponDamage += attributes.ArmorDamage; break; case 1: armor.Attributes.AttackChance += attributes.ArmorHitChance; break; case 2: armor.ArmorAttributes.MageArmor += attributes.ArmorMage; break; case 3: armor.Attributes.Luck += attributes.ArmorLuck; break; case 4: armor.ArmorAttributes.LowerStatReq += attributes.ArmorLowerRequirements; break; } } #endregion } break; } case EnhanceResult.Failure: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage)) { return(EnhanceResult.NoResources); } break; } } return(res); }
public override void OnCast() { if (!Caster.CanBeginAction(typeof(MutationSpell))) { if (Caster is PlayerMobile) { PlayerMobile pm = (PlayerMobile)Caster; pm.Transformation.OnTransformationChange(0, null, -1, true); } else { Caster.BodyMod = 0; Caster.NameMod = null; } Caster.EndAction(typeof(MutationSpell)); Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); if (Caster is PlayerMobile) { ((PlayerMobile)Caster).CheckRaceSkin(); } BaseArmor.ValidateMobile(Caster); } else if (m_NewBody == 0) { ArrayList entries = new ArrayList(); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Dragonnet", ShrinkTable.Lookup(12), 12, 1015237, 0, 0, 0, 0, 2174)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Arbre sylvestre", ShrinkTable.Lookup(301), 301, 1015246, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Golem d'os", ShrinkTable.Lookup(308), 308, 1015246, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Golem de chaire", ShrinkTable.Lookup(304), 304, 1015237, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Demonologue", ShrinkTable.Lookup(318), 318, 1015246, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Mangeur d'âmes", ShrinkTable.Lookup(303), 303, 1015246, 0, 0, 0, 0, 0)); Caster.SendGump(new MetamorphoseGump(Caster, Scroll, entries, 6)); } else if (!CheckTransformation(Caster, Caster)) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(MutationSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } if (Caster is PlayerMobile) { PlayerMobile pm = (PlayerMobile)Caster; pm.Transformation.OnTransformationChange(m_NewBody, m_NameMod, m_HueMod, true); } else { Caster.BodyMod = m_NewBody; Caster.NameMod = m_NameMod; Caster.HueMod = m_HueMod; } Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); } } } FinishSequence(); }
private void DoRepair(object targeted) { int number = 0; bool usingDeed = false; bool toDelete = false; Mobile from = m_from; 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 && !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)) { number = 1044275; // The item must be in your backpack to repair it. } else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints) { number = 500423; // That is already 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 { 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) { 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)) { number = 1044275; // The item must be in your backpack to repair it. } else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints) { number = 500423; // That is already 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 { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_craftSystem.PlayCraftEffect(from); } toDelete = true; } } // tell the user what happened if (number != 0) { Craft.From.SendLocalizedMessage(number); } }
public int GetSellPriceFor(Item item, int barter) { int price = 0; m_Table.TryGetValue(item.GetType(), out price); if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (armor.Quality == ArmorQuality.Low) { price = (int)(price * 0.60); } else if (armor.Quality == ArmorQuality.Exceptional) { price = (int)(price * 1.25); } switch (armor.Resource) { case CraftResource.DullCopper: price = (int)(price * 1.25); break; case CraftResource.ShadowIron: price = (int)(price * 1.5); break; case CraftResource.Copper: price = (int)(price * 1.75); break; case CraftResource.Bronze: price = (int)(price * 2); break; case CraftResource.Gold: price = (int)(price * 2.25); break; case CraftResource.Agapite: price = (int)(price * 2.50); break; case CraftResource.Verite: price = (int)(price * 2.75); break; case CraftResource.Valorite: price = (int)(price * 3); break; case CraftResource.Nepturite: price = (int)(price * 3.10); break; case CraftResource.Obsidian: price = (int)(price * 3.10); break; case CraftResource.Steel: price = (int)(price * 3.25); break; case CraftResource.Brass: price = (int)(price * 3.5); break; case CraftResource.Mithril: price = (int)(price * 3.75); break; case CraftResource.Xormite: price = (int)(price * 3.75); break; case CraftResource.Dwarven: price = (int)(price * 7.50); break; case CraftResource.SpinedLeather: price = (int)(price * 1.5); break; case CraftResource.HornedLeather: price = (int)(price * 1.75); break; case CraftResource.BarbedLeather: price = (int)(price * 2.0); break; case CraftResource.NecroticLeather: price = (int)(price * 2.25); break; case CraftResource.VolcanicLeather: price = (int)(price * 2.5); break; case CraftResource.FrozenLeather: price = (int)(price * 2.75); break; case CraftResource.GoliathLeather: price = (int)(price * 3.0); break; case CraftResource.DraconicLeather: price = (int)(price * 3.25); break; case CraftResource.HellishLeather: price = (int)(price * 3.5); break; case CraftResource.DinosaurLeather: price = (int)(price * 3.75); break; case CraftResource.AlienLeather: price = (int)(price * 3.75); break; case CraftResource.RedScales: price = (int)(price * 1.25); break; case CraftResource.YellowScales: price = (int)(price * 1.25); break; case CraftResource.BlackScales: price = (int)(price * 1.5); break; case CraftResource.GreenScales: price = (int)(price * 1.5); break; case CraftResource.WhiteScales: price = (int)(price * 1.5); break; case CraftResource.BlueScales: price = (int)(price * 1.5); break; case CraftResource.AshTree: price = (int)(price * 1.25); break; case CraftResource.CherryTree: price = (int)(price * 1.45); break; case CraftResource.EbonyTree: price = (int)(price * 1.65); break; case CraftResource.GoldenOakTree: price = (int)(price * 1.85); break; case CraftResource.HickoryTree: price = (int)(price * 2.05); break; case CraftResource.MahoganyTree: price = (int)(price * 2.25); break; case CraftResource.DriftwoodTree: price = (int)(price * 2.25); break; case CraftResource.OakTree: price = (int)(price * 2.45); break; case CraftResource.PineTree: price = (int)(price * 2.65); break; case CraftResource.GhostTree: price = (int)(price * 2.65); break; case CraftResource.RosewoodTree: price = (int)(price * 2.85); break; case CraftResource.WalnutTree: price = (int)(price * 3); break; case CraftResource.ElvenTree: price = (int)(price * 6); break; case CraftResource.PetrifiedTree: price = (int)(price * 3.25); break; } /* End of Changes */ price += 100 * (int)armor.Durability; price += 100 * (int)armor.ProtectionLevel; if (price < 1) { price = 1; } } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (weapon.Quality == WeaponQuality.Low) { price = (int)(price * 0.60); } else if (weapon.Quality == WeaponQuality.Exceptional) { price = (int)(price * 1.25); } switch (weapon.Resource) { case CraftResource.DullCopper: price = (int)(price * 1.25); break; case CraftResource.ShadowIron: price = (int)(price * 1.5); break; case CraftResource.Copper: price = (int)(price * 1.75); break; case CraftResource.Bronze: price = (int)(price * 2); break; case CraftResource.Gold: price = (int)(price * 2.25); break; case CraftResource.Agapite: price = (int)(price * 2.50); break; case CraftResource.Verite: price = (int)(price * 2.75); break; case CraftResource.Valorite: price = (int)(price * 3); break; case CraftResource.Obsidian: price = (int)(price * 3); break; case CraftResource.Nepturite: price = (int)(price * 3); break; case CraftResource.Steel: price = (int)(price * 3.25); break; case CraftResource.Brass: price = (int)(price * 3.5); break; case CraftResource.Mithril: price = (int)(price * 3.75); break; case CraftResource.Xormite: price = (int)(price * 3.75); break; case CraftResource.Dwarven: price = (int)(price * 7.50); break; } /* End of Changes */ price += 100 * (int)weapon.DurabilityLevel; price += 100 * (int)weapon.DamageLevel; if (price < 1) { price = 1; } } else if (item is BaseBeverage) { int price1 = price, price2 = price; if (item is Pitcher) { price1 = 3; price2 = 5; } else if (item is BeverageBottle) { price1 = 3; price2 = 3; } else if (item is Jug) { price1 = 6; price2 = 6; } BaseBeverage bev = (BaseBeverage)item; if (bev.IsEmpty || bev.Content == BeverageType.Milk) { price = price1; } else { price = price2; } } price = (int)(price / 2); if (barter > 0) { if (barter > 100) { barter = 100; } double nId = 1 + (barter * 0.03); price = (int)(price * nId); } if (price < 1) { price = 1; } return(price); }
public static TimeSpan OnUse(Mobile mobile) { PlayerMobile pm = mobile as PlayerMobile; if (pm != null) { if (pm.TrueHidden == false) { pm.SendMessage("You must hide first using the Hiding skill."); pm.RevealingAction(); return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); } } if (!mobile.Hidden) { mobile.SendLocalizedMessage(502725); // You must hide first } else if (mobile.Skills[SkillName.Hiding].Base < HidingRequirement) { mobile.SendLocalizedMessage(502726); // You are not hidden well enough. Become better at hiding. mobile.RevealingAction(); } else if (!mobile.CanBeginAction(typeof(Stealth))) { mobile.RevealingAction(); } else { if (mobile.CheckSkill(SkillName.Stealth, 0, 100, 1.0)) { int steps = (int)(mobile.Skills[SkillName.Stealth].Value / 10); BaseArmor gorget = mobile.NeckArmor as BaseArmor; BaseArmor gloves = mobile.HandArmor as BaseArmor; BaseArmor arms = mobile.ArmsArmor as BaseArmor; BaseArmor head = mobile.HeadArmor as BaseArmor; BaseArmor legs = mobile.LegsArmor as BaseArmor; BaseArmor chest = mobile.ChestArmor as BaseArmor; List <BaseArmor> equipment = new List <BaseArmor>(); equipment.Add(gorget); equipment.Add(gloves); equipment.Add(arms); equipment.Add(head); equipment.Add(legs); equipment.Add(chest); //Each Piece of Armor that Has a Meditation Penalty Reduces Total Stealth Steps By 1 foreach (BaseArmor armor in equipment) { if (armor != null) { if (armor.OldMedAllowance == ArmorMeditationAllowance.None) { steps--; } } } DungeonArmor.PlayerDungeonArmorProfile stealtherDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(mobile, null); if (stealtherDungeonArmor.MatchingSet && !stealtherDungeonArmor.InPlayerCombat) { steps += 6 + stealtherDungeonArmor.DungeonArmorDetail.BonusStealthSteps; } if (steps < 1) { steps = 1; } mobile.AllowedStealthSteps = steps; if (pm != null) { pm.IsStealthing = true; if (pm.Skills[SkillName.Hiding].Value >= 80 && pm.Skills[SkillName.Stealth].Value >= 80) { mobile.StealthAttackReady = true; } } mobile.SendMessage("You begin to move quietly."); mobile.BeginAction((typeof(Hiding))); Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Hiding)); }); mobile.BeginAction((typeof(Stealth))); Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Stealth)); }); mobile.m_StealthMovementTimer = null; mobile.m_StealthMovementTimer = new Mobile.StealthMovementTimer(mobile); mobile.m_StealthMovementTimer.Start(); mobile.m_HidingTimer = null; mobile.m_HidingTimer = new Mobile.HidingTimer(mobile, DateTime.UtcNow, true); mobile.m_HidingTimer.Start(); return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); } else { mobile.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed. mobile.RevealingAction(); } } return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); }
protected override void OnTarget(Mobile from, object targeted) { int number; if (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 = 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); } 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 = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double 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 && !IsSpecialWeapon(weapon)) { number = 1044277; // That item cannot be repaired. } else if (!weapon.IsChildOf(from.Backpack)) { number = 1044275; // The item must be in your backpack to repair it. } else if (weapon.MaxHits <= 0 || weapon.Hits == weapon.MaxHits) { number = 1044281; // That item is in full repair } else if (weapon.MaxHits <= toWeaken) { number = 500424; // You destroyed the item. m_CraftSystem.PlayCraftEffect(from); weapon.Delete(); } else if (from.CheckSkill(skill, -285.0, 100.0)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); weapon.MaxHits -= toWeaken; weapon.Hits = weapon.MaxHits; } else { number = 1044280; // You fail to repair the item. m_CraftSystem.PlayCraftEffect(from); weapon.MaxHits -= toWeaken; if (weapon.Hits - toWeaken < 0) { weapon.Hits = 0; } else { weapon.Hits -= toWeaken; } } if (weapon.MaxHits <= toWeaken) { from.SendLocalizedMessage(1044278); // That item has been repaired many times, and will break if repairs are attempted again. } } 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 = 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) { number = 1044277; // That item cannot be repaired. } 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 = 500424; // You destroyed the item. m_CraftSystem.PlayCraftEffect(from); armor.Delete(); } else if (from.CheckSkill(skill, -285.0, 100.0)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); armor.MaxHitPoints -= toWeaken; armor.HitPoints = armor.MaxHitPoints; } else { number = 1044280; // You fail to repair the item. m_CraftSystem.PlayCraftEffect(from); armor.MaxHitPoints -= toWeaken; if (armor.HitPoints - toWeaken < 0) { armor.HitPoints = 0; } else { armor.HitPoints -= toWeaken; } } if (armor.MaxHitPoints <= toWeaken) { from.SendLocalizedMessage(1044278); // That item has been repaired many times, and will break if repairs are attempted again. } } else if (targeted is Item) { number = 1044277; // That item cannot be repaired. } else { number = 500426; // You can't repair that. } from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number)); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item examine = (Item)targeted; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (targeted is UnidentifiedItem) { UnidentifiedItem relic = (UnidentifiedItem)targeted; if (relic.IDAttempt > 5) { from.SendMessage("Only a vendor can identify this item now as too many attempts were made."); } else if (relic.SkillRequired != "ArmsLore") { from.SendMessage("You are using the wrong skill to figure this out."); } else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, -5, 120)) { Container pack = (Container)relic; List <Item> items = new List <Item>(); foreach (Item item in pack.Items) { items.Add(item); } foreach (Item item in items) { from.AddToBackpack(item); } from.SendMessage("You successfully identify the item."); relic.Delete(); } else { relic.IDAttempt = relic.IDAttempt + 1; from.SendMessage("You can't seem to identify this item."); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if (Server.Misc.RelicItems.IsRelicItem(examine) == true) { from.SendMessage(Server.Misc.RelicItems.IdentifyRelicValue(from, from, examine)); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if (targeted is BaseWeapon) { if (((BaseWeapon)targeted).Identified == true) { BaseWeapon weap = (BaseWeapon)targeted; if (weap.MaxHitPoints != 0) { int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } int damage = (weap.MaxDamage + weap.MinDamage) / 2; int hand = (weap.Layer == Layer.OneHanded ? 0 : 1); if (damage < 3) { damage = 0; } else { damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0); } WeaponType type = weap.Type; if (type == WeaponType.Ranged) { from.SendLocalizedMessage(1038224 + (damage * 9)); } else if (type == WeaponType.Piercing) { from.SendLocalizedMessage(1038218 + hand + (damage * 9)); } else if (type == WeaponType.Slashing) { from.SendLocalizedMessage(1038220 + hand + (damage * 9)); } else if (type == WeaponType.Bashing) { from.SendLocalizedMessage(1038222 + hand + (damage * 9)); } else { from.SendLocalizedMessage(1038216 + hand + (damage * 9)); } if (weap.Poison != null && weap.PoisonCharges > 0) { from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it. } } else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { ((BaseWeapon)targeted).Identified = true; BaseWeapon weap = (BaseWeapon)targeted; if (weap.MaxHitPoints != 0) { int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } int damage = (weap.MaxDamage + weap.MinDamage) / 2; int hand = (weap.Layer == Layer.OneHanded ? 0 : 1); if (damage < 3) { damage = 0; } else { damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0); } WeaponType type = weap.Type; if (type == WeaponType.Ranged) { from.SendLocalizedMessage(1038224 + (damage * 9)); } else if (type == WeaponType.Piercing) { from.SendLocalizedMessage(1038218 + hand + (damage * 9)); } else if (type == WeaponType.Slashing) { from.SendLocalizedMessage(1038220 + hand + (damage * 9)); } else if (type == WeaponType.Bashing) { from.SendLocalizedMessage(1038222 + hand + (damage * 9)); } else { from.SendLocalizedMessage(1038216 + hand + (damage * 9)); } if (weap.Poison != null && weap.PoisonCharges > 0) { from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it. } } else { from.SendLocalizedMessage(500353); // You are not certain... } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if (targeted is BaseArmor) { if (((BaseArmor)targeted).Identified == true) { BaseArmor arm = (BaseArmor)targeted; if (arm.MaxHitPoints != 0) { int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } } else if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { ((BaseArmor)targeted).Identified = true; BaseArmor arm = (BaseArmor)targeted; if (arm.MaxHitPoints != 0) { int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0)); /* * if ( arm.ArmorRating < 1 ) * from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers. * else if ( arm.ArmorRating < 6 ) * from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection. * else if ( arm.ArmorRating < 11 ) * from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection. * else if ( arm.ArmorRating < 16 ) * from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows. * else if ( arm.ArmorRating < 21 ) * from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection. * else if ( arm.ArmorRating < 26 ) * from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack. * else if ( arm.ArmorRating < 31 ) * from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection. * else * from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection. * */ } else { from.SendLocalizedMessage(500353); // You are not certain... } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding) { SwampDragon pet = (SwampDragon)targeted; if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { int perc = (4 * pet.BardingHP) / pet.BardingMaxHP; if (perc < 0) { perc = 0; } else if (perc > 4) { perc = 4; } pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState); } else { from.SendLocalizedMessage(500353); // You are not certain... } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else { from.SendLocalizedMessage(500352); // This is neither weapon nor armor. } } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static void PowerArtifactArmor(Item artifact, string arty) { BaseArmor armor = (BaseArmor)artifact; ArtifactDurability(artifact); if (arty == "driftwood") { armor.Attributes.DefendChance = 10; armor.PhysicalBonus = 20; armor.EnergyBonus = 23; armor.ArmorAttributes.MageArmor = 1; } else if (arty == "bronzed") { armor.Attributes.BonusStr = 5; armor.Attributes.BonusDex = 5; armor.Attributes.BonusHits = 5; armor.Attributes.BonusStam = 5; armor.Attributes.RegenStam = 3; armor.Attributes.LowerManaCost = 10; armor.PhysicalBonus = 6; armor.FireBonus = 11; armor.ColdBonus = 6; armor.PoisonBonus = 8; armor.EnergyBonus = 6; } else if (arty == "invulnerable") { armor.PhysicalBonus = 16; armor.ArmorAttributes.MageArmor = 1; armor.Attributes.ReflectPhysical = 10; armor.Attributes.DefendChance = 15; armor.ArmorAttributes.LowerStatReq = 100; armor.MaxHitPoints = 200; armor.HitPoints = 200; } else if (arty == "kelp") { armor.Attributes.BonusHits = 5; armor.Attributes.BonusMana = 8; armor.Attributes.RegenMana = 2; armor.Attributes.SpellDamage = 8; armor.Attributes.LowerRegCost = 15; armor.PhysicalBonus = 3; armor.FireBonus = 9; armor.ColdBonus = 9; armor.PoisonBonus = 5; armor.EnergyBonus = 11; } else if (arty == "barnacle") { armor.PhysicalBonus = 30; armor.Attributes.DefendChance = 15; armor.ArmorAttributes.SelfRepair = 5; armor.MaxHitPoints = 200; armor.HitPoints = 200; } else if (arty == "neptune") { armor.Attributes.RegenStam = 10; armor.FireBonus = 20; armor.SkillBonuses.SetValues(0, SkillName.Fishing, 10); } }
public static bool CheckMatch(Item item, int price, SearchCriteria searchCriteria) { if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null) { item = ((CommodityDeed)item).Commodity; } if (searchCriteria.MinPrice > -1 && price < searchCriteria.MinPrice) { return(false); } if (searchCriteria.MaxPrice > -1 && price > searchCriteria.MaxPrice) { return(false); } if (!String.IsNullOrEmpty(searchCriteria.SearchName)) { string name; if (item is CommodityDeed && ((CommodityDeed)item).Commodity is ICommodity) { var commodity = (ICommodity)((CommodityDeed)item).Commodity; if (!String.IsNullOrEmpty(commodity.Description.String)) { name = commodity.Description.String; } else { name = StringList.GetString(commodity.Description.Number); } } else { name = GetItemName(item); } if (name == null) { return(false); // TODO? REturn null names? } if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0) { return(false); } } if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer) { return(false); } if (searchCriteria.Details.Count == 0) { return(true); } foreach (SearchDetail detail in searchCriteria.Details) { object o = detail.Attribute; int value = detail.Value; if (value == 0) { value = 1; } if (o is AosAttribute) { AosAttributes attrs = RunicReforging.GetAosAttributes(item); if (attrs == null || attrs[(AosAttribute)o] < value) { return(false); } } else if (o is AosWeaponAttribute) { AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item); if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon) { if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value)) { return(false); } } else if (attrs == null || attrs[(AosWeaponAttribute)o] < value) { return(false); } } else if (o is SAAbsorptionAttribute) { SAAbsorptionAttributes attrs = RunicReforging.GetSAAbsorptionAttributes(item); if (attrs == null || attrs[(SAAbsorptionAttribute)o] < value) { return(false); } } else if (o is AosArmorAttribute) { AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item); if (attrs == null || attrs[(AosArmorAttribute)o] < value) { return(false); } } else if (o is SkillName) { if (detail.Category != Category.RequiredSkill) { AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item); if (skillbonuses != null) { bool hasSkill = false; for (int i = 0; i < 5; i++) { SkillName check; double bonus; if (skillbonuses.GetValues(i, out check, out bonus) && check == (SkillName)o && bonus >= value) { hasSkill = true; break; } } if (!hasSkill) { return(false); } } else if (item is SpecialScroll && value >= 105) { if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value) { return(false); } } else { return(false); } } else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o) { return(false); } } else if (!CheckSlayer(item, o)) { return(false); } else if (o is AosElementAttribute) { if (item is BaseWeapon) { BaseWeapon wep = item as BaseWeapon; if (detail.Category == Category.DamageType) { int phys, fire, cold, pois, nrgy, chaos, direct; wep.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (phys < value) { return(false); } break; case AosElementAttribute.Fire: if (fire < value) { return(false); } break; case AosElementAttribute.Cold: if (cold < value) { return(false); } break; case AosElementAttribute.Poison: if (pois < value) { return(false); } break; case AosElementAttribute.Energy: if (nrgy < value) { return(false); } break; case AosElementAttribute.Chaos: if (chaos < value) { return(false); } break; case AosElementAttribute.Direct: if (direct < value) { return(false); } break; } } else { switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (wep.WeaponAttributes.ResistPhysicalBonus < value) { return(false); } break; case AosElementAttribute.Fire: if (wep.WeaponAttributes.ResistFireBonus < value) { return(false); } break; case AosElementAttribute.Cold: if (wep.WeaponAttributes.ResistColdBonus < value) { return(false); } break; case AosElementAttribute.Poison: if (wep.WeaponAttributes.ResistPoisonBonus < value) { return(false); } break; case AosElementAttribute.Energy: if (wep.WeaponAttributes.ResistEnergyBonus < value) { return(false); } break; } } } else if (item is BaseArmor && detail.Category == Category.Resists) { BaseArmor armor = item as BaseArmor; switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (armor.PhysicalResistance < value) { return(false); } break; case AosElementAttribute.Fire: if (armor.FireResistance < value) { return(false); } break; case AosElementAttribute.Cold: if (armor.ColdResistance < value) { return(false); } break; case AosElementAttribute.Poison: if (armor.PoisonResistance < value) { return(false); } break; case AosElementAttribute.Energy: if (armor.EnergyResistance < value) { return(false); } break; } } else if (detail.Category != Category.DamageType) { AosElementAttributes attrs = RunicReforging.GetElementalAttributes(item); if (attrs == null || attrs[(AosElementAttribute)o] < value) { return(false); } } else { return(false); } } else if (o is Misc) { switch ((Misc)o) { case Misc.ExcludeFel: break; case Misc.GargoyleOnly: if (!IsGargoyle(item)) { return(false); } break; case Misc.NotGargoyleOnly: if (IsGargoyle(item)) { return(false); } break; case Misc.ElvesOnly: if (!IsElf(item)) { return(false); } break; case Misc.NotElvesOnly: if (IsElf(item)) { return(false); } break; case Misc.FactionItem: if (!(item is Server.Factions.IFactionItem)) { return(false); } break; case Misc.PromotionalToken: if (!(item is PromotionalToken)) { return(false); } break; case Misc.Cursed: if (item.LootType != LootType.Cursed) { return(false); } break; case Misc.NotCursed: if (item.LootType == LootType.Cursed) { return(false); } break; case Misc.CannotRepair: if (CheckCanRepair(item)) { return(false); } break; case Misc.NotCannotBeRepaired: if (!CheckCanRepair(item)) { return(false); } break; case Misc.Brittle: NegativeAttributes neg2 = RunicReforging.GetNegativeAttributes(item); if (neg2 == null || neg2.Brittle == 0) { return(false); } break; case Misc.NotBrittle: NegativeAttributes neg3 = RunicReforging.GetNegativeAttributes(item); if (neg3 != null && neg3.Brittle > 0) { return(false); } break; case Misc.Antique: NegativeAttributes neg4 = RunicReforging.GetNegativeAttributes(item); if (neg4 == null || neg4.Antique == 0) { return(false); } break; case Misc.NotAntique: NegativeAttributes neg5 = RunicReforging.GetNegativeAttributes(item); if (neg5 != null && neg5.Antique > 0) { return(false); } break; } } else if (o is string) { string str = o as string; if (str == "WeaponVelocity" && (!(item is BaseRanged) || ((BaseRanged)item).Velocity < value)) { return(false); } if (str == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon)) { return(false); } if (str == "ArtifactRarity" && (!(item is IArtifact) || ((IArtifact)item).ArtifactRarity < value)) { return(false); } } } return(true); }
public override void OnCast() { if (!Caster.CanBeginAction(typeof(TransmutationSpell))) { if (Caster is PlayerMobile) { PlayerMobile pm = (PlayerMobile)Caster; pm.Transformation.OnTransformationChange(0, null, -1, true); } else { Caster.BodyMod = 0; Caster.NameMod = null; } Caster.EndAction(typeof(TransmutationSpell)); Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); if (Caster is PlayerMobile) { ((PlayerMobile)Caster).CheckRaceSkin(); } BaseArmor.ValidateMobile(Caster); } else if (m_NewBody == 0) { ArrayList entries = new ArrayList(); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Ours Polaire", ShrinkTable.Lookup(0xD5), 0xD5, 1015237, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Momie", ShrinkTable.Lookup(0x9A), 0x9A, 1015246, 0, 0, 0, 0, 0)); entries.Add(new MetamorphoseGump.MetamorphoseEntry("Ophidien", ShrinkTable.Lookup(0x56), 0x56, 1015246, 0, 0, 0, 0, 0)); Caster.SendGump(new MetamorphoseGump(Caster, Scroll, entries, 4)); } else if (!CheckTransformation(Caster, Caster)) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(TransmutationSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } if (Caster is PlayerMobile) { PlayerMobile pm = (PlayerMobile)Caster; pm.Transformation.OnTransformationChange(m_NewBody, m_NameMod, m_HueMod, true); } else { Caster.BodyMod = m_NewBody; Caster.NameMod = m_NameMod; Caster.HueMod = m_HueMod; } Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); } } } FinishSequence(); }
public int GetSellPriceFor(Item item) { int price = 0; this.m_Table.TryGetValue(item.GetType(), out price); if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (armor.Quality == ItemQuality.Low) { price = (int)(price * 0.60); } else if (armor.Quality == ItemQuality.Exceptional) { price = (int)(price * 1.25); } price += 100 * (int)armor.Durability; price += 100 * (int)armor.ProtectionLevel; //daat99 OWLTR start - resources cost more if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RESOURCE_COST)) { double d_Mult = (int)armor.Resource; if (d_Mult > 1 && d_Mult < 101) { d_Mult = 10 + (d_Mult - 1); } else if (d_Mult > 101 && d_Mult < 201) { d_Mult = 10 + (d_Mult - 101); } else if (d_Mult > 201 && d_Mult < 300) { d_Mult = 10 + (d_Mult - 201); } else { d_Mult = 10; } price = (int)((d_Mult * price) / 10); } //daat99 OWLTR end - resources cost more if (price < 1) { price = 1; } } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (weapon.Quality == ItemQuality.Low) { price = (int)(price * 0.60); } else if (weapon.Quality == ItemQuality.Exceptional) { price = (int)(price * 1.25); } price += 100 * (int)weapon.DurabilityLevel; price += 100 * (int)weapon.DamageLevel; //daat99 OWLTR start - resources cost more if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RESOURCE_COST)) { double d_Mult = (int)weapon.Resource; if (d_Mult > 1 && d_Mult < 101) { d_Mult = 10 + (d_Mult - 1); } else if (d_Mult > 300 && d_Mult < 400) { d_Mult = 10 + (d_Mult - 300); } else { d_Mult = 10; } price = (int)((d_Mult * price) / 10); } //daat99 OWLTR end - resources cost more if (price < 1) { price = 1; } } else if (item is BaseBeverage) { int price1 = price, price2 = price; if (item is Pitcher) { price1 = 3; price2 = 5; } else if (item is BeverageBottle) { price1 = 3; price2 = 3; } else if (item is Jug) { price1 = 6; price2 = 6; } BaseBeverage bev = (BaseBeverage)item; if (bev.IsEmpty || bev.Content == BeverageType.Milk) { price = price1; } else { price = price2; } } return(price); }
protected override void OnTarget(Mobile from, object targeted) { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (targeted is UnidentifiedItem) { Container packs = from.Backpack; int nCost = 200; UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted; if (BeggingPose(from) > 0) // LET US SEE IF THEY ARE BEGGING - WIZARD { nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1) { nCost = 1; } } int toConsume = nCost; if (WhatIsIt.VendorCanID != "Blacksmith") { m_Armorer.SayTo(from, "Sorry, I cannot tell what that is."); } else if (packs.ConsumeTotal(typeof(Gold), toConsume)) { string MyItemName = "item"; Container pack = (Container)targeted; List <Item> items = new List <Item>(); foreach (Item item in pack.Items) { items.Add(item); } foreach (Item item in items) { MyItemName = item.Name; from.AddToBackpack(item); } if (MyItemName == "") { MyItemName = "item"; } from.SendMessage(String.Format("You pay {0} gold.", toConsume)); m_Armorer.SayTo(from, "Let me tell you about this item..."); WhatIsIt.Delete(); } else { m_Armorer.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume); from.SendMessage("You do not have enough gold."); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if (targeted is BaseArmor && from.Backpack != null) { BaseArmor ba = targeted as BaseArmor; Container pack = from.Backpack; int toConsume = 0; if (ba.HitPoints < ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(((Item)targeted))) { int nCost = 10; if (BeggingPose(from) > 0) // LET US SEE IF THEY ARE BEGGING - WIZARD { nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1) { nCost = 1; } toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost; } else { toConsume = (ba.MaxHitPoints - ba.HitPoints - 1) * nCost; } } else if (ba.HitPoints >= ba.MaxHitPoints && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(((Item)targeted))) { m_Armorer.SayTo(from, "That does not need to be repaired."); } else { m_Armorer.SayTo(from, "I cannot repair that."); } if (toConsume == 0) { return; } if (pack.ConsumeTotal(typeof(Gold), toConsume)) { if (BeggingPose(from) > 0) { Titles.AwardKarma(from, -BeggingKarma(from), true); } // DO ANY KARMA LOSS m_Armorer.SayTo(from, "Here is your armor."); from.SendMessage(String.Format("You pay {0} gold.", toConsume)); Effects.PlaySound(from.Location, from.Map, 0x2A); ba.MaxHitPoints -= 1; ba.HitPoints = ba.MaxHitPoints; } else { m_Armorer.SayTo(from, "It would cost you {0} gold to have that repaired.", toConsume); from.SendMessage("You do not have enough gold."); } } else { m_Armorer.SayTo(from, "I cannot repair that."); } }
public void CheckCancelMorph(Mobile m) { if (m == null) { return; } double minSkill, maxSkill; AnimalFormContext acontext = AnimalForm.GetContext(m); TransformContext context = TransformationSpellHelper.GetContext(m); if (context != null) { Spell spell = context.Spell as Spell; spell.GetCastSkills(out minSkill, out maxSkill); if (m.Skills[spell.CastSkill].Value < minSkill) { TransformationSpellHelper.RemoveContext(m, context, true); } } if (acontext != null) { int i; for (i = 0; i < AnimalForm.Entries.Length; ++i) { if (AnimalForm.Entries[i].Type == acontext.Type) { break; } } if (m.Skills[SkillName.Ninjitsu].Value < AnimalForm.Entries[i].ReqSkill) { AnimalForm.RemoveContext(m, true); } } if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1) { m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction(typeof(PolymorphSpell)); BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); } if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1) { if (m is PlayerMobile) { ((PlayerMobile)m).SetHairMods(-1, -1); } m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction(typeof(IncognitoSpell)); BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); BuffInfo.RemoveBuff(m, BuffIcon.Incognito); } return; }
public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage) { if (item == null) { return(EnhanceResult.BadItem); } if (!item.IsChildOf(from.Backpack)) { return(EnhanceResult.NotInBackpack); } if (!(item is BaseArmor) && !(item is BaseWeapon)) { return(EnhanceResult.BadItem); } if (item is IArcaneEquip) { IArcaneEquip eq = (IArcaneEquip)item; if (eq.IsArcane) { return(EnhanceResult.BadItem); } } if (CraftResources.IsStandard(resource)) { return(EnhanceResult.BadResource); } int num = craftSystem.CanCraft(from, tool, item.GetType()); if (num > 0) { resMessage = num; return(EnhanceResult.None); } CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType()); if (craftItem == null || craftItem.Resources.Count == 0) { return(EnhanceResult.BadItem); } bool allRequiredSkills = false; if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0) { return(EnhanceResult.NoSkill); } CraftResourceInfo info = CraftResources.GetInfo(resource); if (info == null || info.ResourceTypes.Length == 0) { return(EnhanceResult.BadResource); } CraftAttributeInfo attributes = info.AttributeInfo; if (attributes == null) { return(EnhanceResult.BadResource); } int resHue = 0, maxAmount = 0; if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage)) { return(EnhanceResult.NoResources); } if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0; int dura = 0, luck = 0, lreq = 0, dinc = 0; int baseChance = 0; bool physBonus = false; bool fireBonus = false; bool coldBonus = false; bool nrgyBonus = false; bool poisBonus = false; bool duraBonus = false; bool luckBonus = false; bool lreqBonus = false; bool dincBonus = false; if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (!CraftResources.IsStandard(weapon.Resource)) { return(EnhanceResult.AlreadyEnhanced); } baseChance = 20; dura = weapon.MaxHitPoints; luck = weapon.Attributes.Luck; lreq = weapon.WeaponAttributes.LowerStatReq; dinc = weapon.Attributes.WeaponDamage; fireBonus = (attributes.WeaponFireDamage > 0); coldBonus = (attributes.WeaponColdDamage > 0); nrgyBonus = (attributes.WeaponEnergyDamage > 0); poisBonus = (attributes.WeaponPoisonDamage > 0); duraBonus = (attributes.WeaponDurability > 0); luckBonus = (attributes.WeaponLuck > 0); lreqBonus = (attributes.WeaponLowerRequirements > 0); dincBonus = (dinc > 0); } else { BaseArmor armor = (BaseArmor)item; if (!CraftResources.IsStandard(armor.Resource)) { return(EnhanceResult.AlreadyEnhanced); } baseChance = 20; phys = armor.PhysicalResistance; fire = armor.FireResistance; cold = armor.ColdResistance; pois = armor.PoisonResistance; nrgy = armor.EnergyResistance; dura = armor.MaxHitPoints; luck = armor.Attributes.Luck; lreq = armor.ArmorAttributes.LowerStatReq; physBonus = (attributes.ArmorPhysicalResist > 0); fireBonus = (attributes.ArmorFireResist > 0); coldBonus = (attributes.ArmorColdResist > 0); nrgyBonus = (attributes.ArmorEnergyResist > 0); poisBonus = (attributes.ArmorPoisonResist > 0); duraBonus = (attributes.ArmorDurability > 0); luckBonus = (attributes.ArmorLuck > 0); lreqBonus = (attributes.ArmorLowerRequirements > 0); dincBonus = false; } int skill = from.Skills[craftSystem.MainSkill].Fixed / 10; if (skill >= 100) { baseChance -= (skill - 90) / 10; } EnhanceResult res = EnhanceResult.Success; if (physBonus) { CheckResult(ref res, baseChance + phys); } if (fireBonus) { CheckResult(ref res, baseChance + fire); } if (coldBonus) { CheckResult(ref res, baseChance + cold); } if (nrgyBonus) { CheckResult(ref res, baseChance + nrgy); } if (poisBonus) { CheckResult(ref res, baseChance + pois); } if (duraBonus) { CheckResult(ref res, baseChance + (dura / 40)); } if (luckBonus) { CheckResult(ref res, baseChance + 10 + (luck / 2)); } if (lreqBonus) { CheckResult(ref res, baseChance + (lreq / 4)); } if (dincBonus) { CheckResult(ref res, baseChance + (dinc / 4)); } switch (res) { case EnhanceResult.Broken: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage)) { return(EnhanceResult.NoResources); } item.Delete(); break; } case EnhanceResult.Success: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage)) { return(EnhanceResult.NoResources); } if (item is BaseWeapon) { BaseWeapon w = (BaseWeapon)item; w.Resource = resource; int hue = w.GetElementalDamageHue(); if (hue > 0) { w.Hue = hue; } } else if (item is BaseArmor) //Sanity { ((BaseArmor)item).Resource = resource; } break; } case EnhanceResult.Failure: { if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage)) { return(EnhanceResult.NoResources); } break; } } return(res); }
public override void OnCast() { if (!Caster.CanBeginAction(typeof(IncognitoSpell))) { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(1061631); // You can't do that while disguised. } else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(IncognitoSpell))) { DisguiseTimers.StopTimer(Caster); Caster.HueMod = Caster.Race.RandomSkinHue(); Caster.NameMod = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male"); var pm = Caster as PlayerMobile; if (pm != null && pm.Race != null) { pm.SetHairMods(pm.Race.RandomHair(pm.Female), pm.Race.RandomFacialHair(pm.Female)); pm.HairHue = pm.Race.RandomHairHue(); pm.FacialHairHue = pm.Race.RandomHairHue(); } Caster.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); Caster.PlaySound(0x3BD); BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); StopTimer(Caster); var timeVal = 6 * Caster.Skills.Magery.Fixed / 50 + 1; if (timeVal > 144) { timeVal = 144; } var length = TimeSpan.FromSeconds(timeVal); Timer t = new InternalTimer(Caster, length); m_Timers[Caster] = t; t.Start(); } else { Caster.SendLocalizedMessage(1079022); // You're already incognitoed! } } FinishSequence(); }
public override void OnCast() { if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { EndPolymorph(Caster); } else 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)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public override void OnTalk(PlayerMobile player, bool contextMenu) { Direction = GetDirectionTo(player); QuestSystem qs = player.Quest; if (qs is WitchApprenticeQuest) { if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective))) { PlaySound(0x259); PlaySound(0x206); qs.AddConversation(new HagDuringCorpseSearchConversation()); } else { QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective)); if (obj != null && !obj.Completed) { PlaySound(0x420); PlaySound(0x20); obj.Complete(); } else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective)) || qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective))) { PlaySound(0x259); PlaySound(0x206); qs.AddConversation(new HagDuringImpSearchConversation()); } else { obj = qs.FindObjective(typeof(ReturnRecipeObjective)); if (obj != null && !obj.Completed) { PlaySound(0x258); PlaySound(0x41B); obj.Complete(); } else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective))) { PlaySound(0x259); PlaySound(0x206); qs.AddConversation(new HagDuringIngredientsConversation()); } else { obj = qs.FindObjective(typeof(ReturnIngredientsObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); cont.DropItem(new BlackPearl(30)); cont.DropItem(new Bloodmoss(30)); cont.DropItem(new Garlic(30)); cont.DropItem(new Ginseng(30)); cont.DropItem(new MandrakeRoot(30)); cont.DropItem(new Nightshade(30)); cont.DropItem(new SulfurousAsh(30)); cont.DropItem(new SpidersSilk(30)); cont.DropItem(new Cauldron()); cont.DropItem(new MoonfireBrew()); cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), this.Map)); cont.DropItem(new Gold(2000, 2200)); if (Utility.RandomBool()) { BaseWeapon weapon = Loot.RandomWeapon(); if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30); } else { weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } cont.DropItem(weapon); } else { Item item; if (Core.AOS) { item = Loot.RandomArmorOrShieldOrJewelry(); if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30); } } else { BaseArmor armor = Loot.RandomArmorOrShield(); item = armor; armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3); armor.Durability = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } cont.DropItem(item); } if (player.BAC > 0) { cont.DropItem(new HangoverCure()); } if (player.PlaceInBackpack(cont)) { bool gainedPath = false; if (VirtueHelper.Award(player, VirtueName.Sacrifice, 250, ref gainedPath)) // TODO: Check amount on OSI. { player.SendLocalizedMessage(1054160); // You have gained in sacrifice. } PlaySound(0x253); PlaySound(0x20); obj.Complete(); } else { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. } } } } } } else { QuestSystem newQuest = new WitchApprenticeQuest(player); bool inRestartPeriod = false; if (qs != null) { newQuest.AddConversation(new DontOfferConversation()); } else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod)) { PlaySound(0x20); PlaySound(0x206); newQuest.SendOffer(); } else if (inRestartPeriod) { PlaySound(0x259); PlaySound(0x206); newQuest.AddConversation(new RecentlyFinishedConversation()); } } }
public static bool CannotMeditateWith(BaseArmor ar) { return(ar != null && ar.MeditationAllowance == ArmorMeditationAllowance.None && ar.Attributes.SpellChanneling == 0 && ar.ArmorAttributes.MageArmor == 0); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseWeapon) { BaseWeapon bw = targeted as BaseWeapon; Container pack = from.Backpack; int toConsume = 0; toConsume = (bw.MaxHitPoints - bw.HitPoints) * 3; //Adjuct price here by changing 3 to whatever you want. if (toConsume == 0) { m_Blacksmith.SayTo(from, "That weapon is not damaged."); } else if ((bw.HitPoints < bw.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } bw.HitPoints = bw.MaxHitPoints; m_Blacksmith.SayTo(from, "Here is your weapon."); from.SendMessage(String.Format("You pay {0}gp.", toConsume)); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your weapon repaired.", toConsume); from.SendMessage("You do not have enough gold."); } } if (targeted is BaseArmor) { BaseArmor ba = targeted as BaseArmor; Container pack = from.Backpack; int toConsume = 0; toConsume = (ba.MaxHitPoints - ba.HitPoints) * 3; //Adjuct price here by changing 3 to whatever you want. if ((toConsume == 0) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite)) { m_Blacksmith.SayTo(from, "That armor is not damaged."); } else if (ba.Resource == CraftResource.RegularLeather || ba.Resource == CraftResource.SpinedLeather || ba.Resource == CraftResource.HornedLeather || ba.Resource == CraftResource.BarbedLeather) { m_Blacksmith.SayTo(from, "I cannot repair that."); } else if ((ba.HitPoints < ba.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite))) { Item a = from.Backpack.FindItemByType(typeof(Gold)); if (a != null) { a.Consume(toConsume); } ba.HitPoints = ba.MaxHitPoints; m_Blacksmith.SayTo(from, "Here is your armor."); from.SendMessage(String.Format("You pay {0}gp.", toConsume)); Effects.PlaySound(from.Location, from.Map, 0x2A); } else { m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your armor repaired.", toConsume); from.SendMessage("You do not have enough gold."); } } }
public int GetSellPriceFor(Item item) { int price = 0; m_Table.TryGetValue(item.GetType(), out price); if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (armor.Quality == ArmorQuality.Low) { price = (int)(price * 0.60); } else if (armor.Quality == ArmorQuality.Exceptional) { price = (int)(price * 1.25); } price += 2 * (int)armor.Durability; price += 2 * (int)armor.ProtectionLevel; if (price < 1) { price = 1; } } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (weapon.Quality == WeaponQuality.Low) { price = (int)(price * 0.60); } else if (weapon.Quality == WeaponQuality.Exceptional) { price = (int)(price * 1.25); } price += 2 * (int)weapon.DurabilityLevel; price += 2 * (int)weapon.DamageLevel; if (price < 1) { price = 1; } } else if (item is BaseBeverage) { int price1 = price, price2 = price; if (item is Pitcher) { price1 = 3; price2 = 5; } else if (item is BeverageBottle) { price1 = 3; price2 = 3; } else if (item is Jug) { price1 = 6; price2 = 6; } BaseBeverage bev = (BaseBeverage)item; if (bev.IsEmpty || bev.Content == BeverageType.Milk) { price = price1; } else { price = price2; } } return(price); }
protected override void OnTarget(Mobile from, object targeted) { bool usingDeed = (this.m_Deed != null); bool toDelete = false; int number; if (this.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 (!this.CheckDeed(from)) { return; } if (!AllowsRepair(targeted, m_CraftSystem)) { from.SendLocalizedMessage(500426); // You can't repair that. return; } 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 (!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 = 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 && !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 (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 && !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 (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 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 = 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 && !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 (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 (targeted is BaseTalisman) { BaseTalisman talisman = (BaseTalisman)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 (!(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 (this.CheckWeaken(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { talisman.MaxHitPoints -= toWeaken; talisman.HitPoints = Math.Max(0, talisman.HitPoints - toWeaken); } if (this.CheckRepairDifficulty(from, skill, talisman.HitPoints, talisman.MaxHitPoints)) { number = 1044279; // You repair the item. this.m_CraftSystem.PlayCraftEffect(from); talisman.HitPoints = talisman.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 { 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 = 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 Armor(BaseArmor Item, uint ContainerID) { Item.UpdateLocalizedProperties(); Item.UpdateTextProperties(); //General ID = Item.Serial.Value; this.ContainerID = ContainerID; ItemName = Item.Tooltip.Split('|')[0].Replace("'", ""); CastingFocus = (sbyte)Item.Attributes.CastingFocus; 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; RPD = (sbyte)Item.Attributes.ReflectPhysical; 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; DamageEater = (sbyte)Item.AbsorptionAttributes.DamageEater; KineticEater = (sbyte)Item.AbsorptionAttributes.KineticEater; FireEater = (sbyte)Item.AbsorptionAttributes.FireEater; ColdEater = (sbyte)Item.AbsorptionAttributes.ColdEater; PoisonEater = (sbyte)Item.AbsorptionAttributes.PoisonEater; EnergyEater = (sbyte)Item.AbsorptionAttributes.EnergyEater; TotalStat = STR + INTEL + DEX + HP + Mana + Stam; TotalResist = PhysicalResist + FireResist + ColdResist + PoisonResist + EnergyResist; Added = DateTime.Now; //Skill Bonuses SkillBonuses = "none"; 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('_', ' '); }
public TreasureLevel3() : base(Utility.RandomList(0x9ab, 0xe40, 0xe42)) { RequiredSkill = 84; LockLevel = RequiredSkill - Utility.Random(1, 10); MaxLockLevel = RequiredSkill; TrapType = TrapType.MagicTrap; TrapPower = 3 * Utility.Random(1, 25); DropItem(new Gold(180, 240)); DropItem(new Arrow(10)); for (int i = Utility.Random(1, 3); i > 1; i--) { Item ReagentLoot = Loot.RandomReagent(); ReagentLoot.Amount = Utility.Random(1, 9); DropItem(ReagentLoot); } for (int i = Utility.Random(1, 3); i > 1; i--) { DropItem(Loot.RandomPotion()); } if (0.67 > Utility.RandomDouble()) //67% chance = 2/3 { for (int i = Utility.Random(12) + 1; i > 0; i--) { DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular)); } } if (0.67 > Utility.RandomDouble()) //67% chance = 2/3 { for (int i = Utility.Random(9) + 1; i > 0; i--) { DropItem(Loot.RandomGem()); } } for (int i = Utility.Random(1, 3); i > 1; i--) { DropItem(Loot.RandomWand()); } // Magical ArmorOrWeapon for (int i = Utility.Random(1, 3); i > 1; i--) { Item item = Loot.RandomArmorOrShieldOrWeapon(); if (!Core.AOS) { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(3); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(3); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(3); weapon.Quality = ItemQuality.Normal; } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(3); armor.Durability = (ArmorDurabilityLevel)Utility.Random(3); armor.Quality = ItemQuality.Normal; } } else { AddLoot(item); } } for (int i = Utility.Random(1, 2); i > 1; i--) { AddLoot(Loot.RandomClothing()); } for (int i = Utility.Random(1, 2); i > 1; i--) { AddLoot(Loot.RandomJewelry()); } // Magic clothing (not implemented) // Magic jewelry (not implemented) }
public override void OnCast() { /*if ( Caster.Mounted ) * { * Caster.SendLocalizedMessage( 1042561 ); //Please dismount first. * } * else */ if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { if (Core.ML) { EndPolymorph(Caster); } else { Caster.SendAsciiMessage("This spell is already in effect."); // This spell is already in effect. } } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendAsciiMessage("You cannot polymorph while in that form."); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendAsciiMessage("You cannot polymorph while disguised."); // 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)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); if (!Core.ML) { StopTimer(Caster); Timer t = new InternalTimer(Caster); m_Timers[Caster] = t; t.Start(); } } } else { Caster.SendAsciiMessage("This spell is already in effect."); // This spell is already in effect. } } FinishSequence(); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseWeapon) { if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { BaseWeapon weap = (BaseWeapon)targeted; if (weap.MaxHitPoints != 0) { int hp = (int)(weap.HitPoints / (double)weap.MaxHitPoints * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } int damage = (weap.MaxDamage + weap.MinDamage) / 2; int hand = weap.Layer == Layer.OneHanded ? 0 : 1; if (damage < 3) { damage = 0; } else { damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0); } /* * else if ( damage < 6 ) * damage = 1; * else if ( damage < 11 ) * damage = 2; * else if ( damage < 16 ) * damage = 3; * else if ( damage < 21 ) * damage = 4; * else if ( damage < 26 ) * damage = 5; * else * damage = 6; * */ WeaponType type = weap.Type; if (type == WeaponType.Ranged) { from.SendLocalizedMessage(1038224 + damage * 9); } else if (type == WeaponType.Piercing) { from.SendLocalizedMessage(1038218 + hand + damage * 9); } else if (type == WeaponType.Slashing) { from.SendLocalizedMessage(1038220 + hand + damage * 9); } else if (type == WeaponType.Bashing) { from.SendLocalizedMessage(1038222 + hand + damage * 9); } else { from.SendLocalizedMessage(1038216 + hand + damage * 9); } if (weap.Poison != null && weap.PoisonCharges > 0) { from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it. } } else { from.SendLocalizedMessage(500353); // You are not certain... } } else if (targeted is BaseArmor) { if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { BaseArmor arm = (BaseArmor)targeted; if (arm.MaxHitPoints != 0) { int hp = (int)(arm.HitPoints / (double)arm.MaxHitPoints * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0)); /* * if ( arm.ArmorRating < 1 ) * from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers. * else if ( arm.ArmorRating < 6 ) * from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection. * else if ( arm.ArmorRating < 11 ) * from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection. * else if ( arm.ArmorRating < 16 ) * from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows. * else if ( arm.ArmorRating < 21 ) * from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection. * else if ( arm.ArmorRating < 26 ) * from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack. * else if ( arm.ArmorRating < 31 ) * from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection. * else * from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection. * */ } else { from.SendLocalizedMessage(500353); // You are not certain... } } else { from.SendLocalizedMessage(500352); // This is neither weapon nor armor. } }
/** Base player level one stats **/ public BasePlayer() { this.playerName = "Mr. Default"; this.playerClass = "NPC"; this.playerProfile = "Images/generic"; this.playerLevel = 1; this.strength = 25; this.intelligence = 25; this.speed = 10; this.spirit = 10; this.defense = 25; this.hitPoints = 100; this.currentHP = this.hitPoints; this.magicPoints = 100; this.currentMP = this.magicPoints; this.fortitude = (defense / 2) + (speed / 2); this.attack = strength; this.magicDefense = spirit; this.magicAttack = intelligence; weapon = new BaseWeapon (); armor = new LeatherArmor (); accessory = new HPRing (); UpdatePlayer (); }