public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } if (!craftItem.ForceNonExceptional) { this.Resource = CraftResources.GetFromType(resourceType); } CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { this.Hue = 0; } if (1 < craftItem.Resources.Count) { resourceType = craftItem.Resources.GetAt(1).ItemType; if (resourceType == typeof(StarSapphire)) { this.GemType = GemType.StarSapphire; } else if (resourceType == typeof(Emerald)) { this.GemType = GemType.Emerald; } else if (resourceType == typeof(Sapphire)) { this.GemType = GemType.Sapphire; } else if (resourceType == typeof(Ruby)) { this.GemType = GemType.Ruby; } else if (resourceType == typeof(Citrine)) { this.GemType = GemType.Citrine; } else if (resourceType == typeof(Amethyst)) { this.GemType = GemType.Amethyst; } else if (resourceType == typeof(Tourmaline)) { this.GemType = GemType.Tourmaline; } else if (resourceType == typeof(Amber)) { this.GemType = GemType.Amber; } else if (resourceType == typeof(Diamond)) { this.GemType = GemType.Diamond; } } #region Mondain's Legacy this.m_Quality = (ArmorQuality)quality; if (makersMark) { this.m_Crafter = from; } #endregion return(1); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Ressources.GetAt(0).ItemType; } Resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } if (1 < craftItem.Ressources.Count) { resourceType = craftItem.Ressources.GetAt(1).ItemType; if (resourceType == typeof(StarSapphire)) { GemType = GemType.StarSapphire; } else if (resourceType == typeof(Emerald)) { GemType = GemType.Emerald; } else if (resourceType == typeof(Sapphire)) { GemType = GemType.Sapphire; } else if (resourceType == typeof(Ruby)) { GemType = GemType.Ruby; } else if (resourceType == typeof(Citrine)) { GemType = GemType.Citrine; } else if (resourceType == typeof(Amethyst)) { GemType = GemType.Amethyst; } else if (resourceType == typeof(Tourmaline)) { GemType = GemType.Tourmaline; } else if (resourceType == typeof(Amber)) { GemType = GemType.Amber; } else if (resourceType == typeof(Diamond)) { GemType = GemType.Diamond; } } return(1); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } if (!craftItem.ForceNonExceptional) { this.Resource = CraftResources.GetFromType(resourceType); } CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { this.Hue = 0; } //daat99 OWLTR start - runic jewels if (Core.AOS && tool is BaseRunicTool && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RECIPE_CRAFT)) { ((BaseRunicTool)tool).ApplyAttributesTo(this); } //daat99 OWLTR end - reunic jewels if (1 < craftItem.Resources.Count) { resourceType = craftItem.Resources.GetAt(1).ItemType; if (resourceType == typeof(StarSapphire)) { this.GemType = GemType.StarSapphire; } else if (resourceType == typeof(Emerald)) { this.GemType = GemType.Emerald; } else if (resourceType == typeof(Sapphire)) { this.GemType = GemType.Sapphire; } else if (resourceType == typeof(Ruby)) { this.GemType = GemType.Ruby; } else if (resourceType == typeof(Citrine)) { this.GemType = GemType.Citrine; } else if (resourceType == typeof(Amethyst)) { this.GemType = GemType.Amethyst; } else if (resourceType == typeof(Tourmaline)) { this.GemType = GemType.Tourmaline; } else if (resourceType == typeof(Amber)) { this.GemType = GemType.Amber; } else if (resourceType == typeof(Diamond)) { this.GemType = GemType.Diamond; } } #region Mondain's Legacy this.m_Quality = (ArmorQuality)quality; if (makersMark) { this.m_Crafter = from; } #endregion return(1); }
public bool OnCraft(bool exceptional, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Exceptional = exceptional; if (makersMark) { Crafter = from; } PlayerConstructed = true; Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Ressources.GetAt(0).ItemType; } Resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } if (1 < craftItem.Ressources.Count) { resourceType = craftItem.Ressources.GetAt(1).ItemType; if (resourceType == typeof(StarSapphire)) { GemType = GemType.StarSapphire; } else if (resourceType == typeof(Emerald)) { GemType = GemType.Emerald; } else if (resourceType == typeof(Sapphire)) { GemType = GemType.Sapphire; } else if (resourceType == typeof(Ruby)) { GemType = GemType.Ruby; } else if (resourceType == typeof(Citrine)) { GemType = GemType.Citrine; } else if (resourceType == typeof(Amethyst)) { GemType = GemType.Amethyst; } else if (resourceType == typeof(Tourmaline)) { GemType = GemType.Tourmaline; } else if (resourceType == typeof(Amber)) { GemType = GemType.Amber; } else if (resourceType == typeof(Diamond)) { GemType = GemType.Diamond; } } return(exceptional); }
public static void DoCraft(Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments) { CraftContext context = system.GetContext(from); if (context != null) { context.OnMade(craftItem); } bool allRequiredSkills = true; double chance = craftItem.GetSuccessChance(from, typeRes, system, true, ref allRequiredSkills); if (chance > 0.0) { chance += craftItem.GetTalismanBonus(from, system); } if (allRequiredSkills) { pigments.Consume(); if (chance < Utility.RandomDouble()) { from.SendGump(new CraftGump(from, system, tool, 1044043)); // You failed to create the item, and some of your materials are lost. } else { from.Backpack.ConsumeTotal(typeof(ColorFixative), 1); bool toolBroken = false; tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); from.SendLocalizedMessage(1044038); // You have worn out your tool! from.SendLocalizedMessage(1044154); // You create the item. } else { // You create the item. from.SendGump(new CraftGump(from, system, tool, 1044154)); } from.AddToBackpack(new NaturalDye(pigments.PlantHue)); } } else { // You don't have the required skills to attempt this item. from.SendGump(new CraftGump(from, system, tool, 1044153)); } }
protected override void OnTick() { m_iCount++; m_From.DisruptiveAction(); if (m_iCount < m_iCountMax) { m_CraftSystem.PlayCraftEffect(m_From); } else { m_From.EndAction <CraftSystem>(); var badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.ItemType); if (badCraft > 0) { if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0) { m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft)); } else { m_From.SendLocalizedMessage(badCraft); } return; } var quality = 1; var allRequiredSkills = true; m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, out allRequiredSkills, false); var context = m_CraftSystem.GetContext(m_From); if (context == null) { return; } if (typeof(CustomCraft).IsAssignableFrom(m_CraftItem.ItemType)) { try { m_CraftItem.ItemType.CreateInstance <CustomCraft>( m_From, m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool, quality )?.EndCraftAction(); } catch (Exception e) { Console.WriteLine(e); } return; } var makersMark = false; if (quality == 2 && m_From.Skills[m_CraftSystem.MainSkill].Base >= 100.0) { makersMark = m_CraftItem.IsMarkable(m_CraftItem.ItemType); } if (makersMark && context.MarkOption == CraftMarkOption.PromptForMark) { m_From.SendGump( new QueryMakersMarkGump( quality, m_From, m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool ) ); } else { if (context.MarkOption == CraftMarkOption.DoNotMark) { makersMark = false; } m_CraftItem.CompleteCraft(quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null); } } }
public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Quality = (ArmorQuality)quality; if (makersMark) { Crafter = from; } Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Ressources.GetAt(0).ItemType; } Resource = CraftResources.GetFromType(resourceType); PlayerConstructed = true; CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } if (Core.AOS && tool is BaseRunicTool) { ((BaseRunicTool)tool).ApplyAttributesTo(this); } switch (Resource) { case CraftResource.AshWood: ArmorAttributes.LowerStatReq += 20; break; case CraftResource.YewWood: Attributes.RegenHits += 1; break; case CraftResource.Heartwood: switch (Utility.Random(7)) { case 0: Attributes.BonusDex += 2; break; case 1: Attributes.BonusStr += 2; break; case 2: Attributes.ReflectPhysical += 5; break; case 3: Attributes.SpellChanneling = 1; Attributes.CastSpeed = -1; break; case 4: ArmorAttributes.SelfRepair += 2; break; case 5: PhysicalBonus += 5; break; case 6: ColdBonus += 3; break; } break; case CraftResource.Bloodwood: Attributes.RegenHits += 2; Attributes.Luck += 40; break; case CraftResource.Frostwood: Attributes.SpellChanneling = 1; Attributes.CastSpeed = -1; break; } return(quality); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { if (Core.ML) { Quality = (CraftQuality)quality; Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } Resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Resource = DefaultResource; } if (makersMark) { Crafter = from; } } if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0)) { from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable. Key key = new Key(KeyType.Copper, Key.RandomValue()); KeyValue = key.KeyValue; DropItem(key); double tinkering = from.Skills[SkillName.Tinkering].Value; int level = (int)(tinkering * 0.8); RequiredSkill = level - 4; LockLevel = level - 14; MaxLockLevel = level + 35; if (LockLevel == 0) { LockLevel = -1; } else if (LockLevel > 95) { LockLevel = 95; } if (RequiredSkill > 95) { RequiredSkill = 95; } if (MaxLockLevel > 95) { MaxLockLevel = 95; } } else { from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable. } return(quality); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue) { if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0)) { from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable. Key key = new Key(KeyType.Copper, Key.RandomValue()); KeyValue = key.KeyValue; DropItem(key); double tinkering = from.Skills[SkillName.Tinkering].Value; int level = (int)(tinkering * 0.8); RequiredSkill = level - 4; LockLevel = level - 14; MaxLockLevel = level + 35; if (LockLevel == 0) { LockLevel = -1; } else if (LockLevel > 95) { LockLevel = 95; } if (RequiredSkill > 95) { RequiredSkill = 95; } if (MaxLockLevel > 95) { MaxLockLevel = 95; } // A tinker trapped box should not explode until it is armed with a key Armed = false; } else { from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable. } // The lockable containers never took material color into account, so this fixes it Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } var resource = CraftResources.GetFromType(resourceType); CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } else { Hue = CraftResources.GetHue(resource); } return(1); }
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Quality = (WeaponQuality)quality; if (makersMark) // Add to CraftItem.cs mark table { Crafter = from; } Type resourceType = typeRes; if (resourceType == null) { resourceType = craftItem.Resources.GetAt(0).ItemType; } if (!craftItem.ForceNonExceptional) { Resource = CraftResources.GetFromType(resourceType); } CraftContext context = craftSystem.GetContext(from); if (context != null && context.DoNotColor) { Hue = 0; } if (craftItem != null) { if (tool is BaseRunicTool) { ((BaseRunicTool)tool).ApplyAttributesTo(this); } CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource); if (resInfo == null) { return(quality); } CraftAttributeInfo attrInfo = resInfo.AttributeInfo; if (attrInfo == null) { return(quality); } if (m_Resource != CraftResource.Heartwood) { m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; m_AosAttributes.RegenHits += attrInfo.WeaponRegenHits; } else { switch (Utility.Random(6)) { case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break; case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break; case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break; case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break; } } if ((m_Resource == CraftResource.Frostwood || m_Resource == CraftResource.Heartwood) && m_AosAttributes.SpellChanneling == 0) { Attributes.SpellChanneling = 1; Attributes.CastSpeed -= 1; } } return(quality); }
public void Craft(Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, ref bool success) { if (from.BeginAction(typeof(CraftSystem))) { bool allRequiredSkills = true; double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills); if (allRequiredSkills && chance >= 0.0) { var badCraft = craftSystem.CanCraft(from, tool, ItemType); if (badCraft <= 0) { int resHue = 0; int maxAmount = 0; object message = null; if (ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message)) { message = null; if (ConsumeAttributes(from, ref message, false)) { CraftContext context = craftSystem.GetContext(from); context?.OnMade(this); int iMin = craftSystem.MinCraftEffect; int iMax = craftSystem.MaxCraftEffect - iMin + 1; int iRandom = Utility.Random(iMax); iRandom += iMin + 1; success = true; tool.OnBeginCraft(from, this, craftSystem); new InternalTimer(from, craftSystem, this, typeRes, tool, iRandom).Start(); } else { success = false; from.EndAction(typeof(CraftSystem)); from.SendGump(new CraftGump(from, craftSystem, tool, message)); } } else { success = false; from.EndAction(typeof(CraftSystem)); from.SendGump(new CraftGump(from, craftSystem, tool, message)); } } else { success = false; from.EndAction(typeof(CraftSystem)); from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); } } else { success = false; from.EndAction(typeof(CraftSystem)); // You don't have the required skills to attempt this item. from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); } } else { success = false; from.SendLocalizedMessage(500119); // You must wait to perform another action } }