public QueryMakersMarkGump( bool exceptional, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, bool questItem ) : base(100, 200) { from.CloseGump( typeof( QueryMakersMarkGump ) ); m_Exceptional = exceptional; m_From = from; m_CraftItem = craftItem; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; m_QuestItem = questItem; AddPage( 0 ); AddBackground( 0, 0, 220, 170, 5054 ); AddBackground( 10, 10, 200, 150, 3000 ); AddHtmlLocalized( 20, 20, 180, 80, 1018317, false, false ); // Do you wish to place your maker's mark on this item? AddHtmlLocalized( 55, 100, 140, 25, 1011036, false, false ); // OKAY AddButton( 20, 100, 4005, 4007, 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 55, 125, 140, 25, 1011012, false, false ); // CANCEL AddButton( 20, 125, 4005, 4007, 1, GumpButtonType.Reply, 0 ); }
public override bool OnCraft( bool exceptional, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { if ( exceptional ) ArmorAttributes.MageArmor = 1; return base.OnCraft( exceptional, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue ); }
public RepairSkillInfo( CraftSystem system, Type[] nearbyTypes, TextDefinition notNearbyMessage, TextDefinition name ) { m_System = system; m_NearbyTypes = nearbyTypes; m_NotNearbyMessage = notNearbyMessage; m_Name = name; }
public static void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem ) { if ( from.Backpack == null ) { from.EndAction( typeof( CraftSystem ) ); return; } Timer.DelayCall( TimeSpan.FromSeconds( craftSystem.Delay ), new TimerCallback( delegate { if ( from.Backpack.GetAmount( typeof( Bottle ) ) < 1 || from.Backpack.GetAmount( typeof( PlantClippings ) ) < 1 ) { from.EndAction( typeof( CraftSystem ) ); // You don't have the components needed to make that. from.SendGump( new CraftGump( from, craftSystem, tool, 1044253 ) ); } else if ( ShouldChooseHue( from ) ) { from.SendLocalizedMessage( 1074794 ); // Target the material to use: from.Target = new ClippingsTarget( craftSystem, typeRes, tool, craftItem ); } else { from.EndAction( typeof( CraftSystem ) ); DoCraft( from, craftSystem, typeRes, tool, craftItem, from.Backpack.FindItemByType<PlantClippings>() ); } } ) ); }
public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { double magery = from.Skills.Magery.Value - 100; if ( magery < 0 ) magery = 0; int count = (int) Math.Round( magery * Utility.RandomDouble() / 5 ); if ( count > 2 ) count = 2; if ( Utility.RandomDouble() < 0.5 ) count = 0; else BaseRunicTool.ApplyAttributesTo( this, false, 0, count, 70, 80 ); Attributes.SpellDamage = 25; Attributes.LowerManaCost = 10; Attributes.CastSpeed = 1; Attributes.CastRecovery = 1; if ( makersMark ) Crafter = from; return quality; }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { this.ItemID = 0x14F0; this.Faction = Faction.Find(from); return 1; }
public MakeNumberCraftPrompt(Mobile from, CraftSystem system, CraftItem item, BaseTool tool) { m_From = from; m_CraftSystem = system; m_CraftItem = item; m_Tool = tool; }
public static void Process( CraftSystem system, Mobile from, object targeted, bool playSound, out bool success, out bool isStoreBought, out bool lackMining ) { success = false; isStoreBought = false; lackMining = false; if ( targeted is BaseArmor ) { success = DoResmelt( system, from, (BaseArmor) targeted, ( (BaseArmor) targeted ).Resource, playSound ); isStoreBought = !( (BaseArmor) targeted ).PlayerConstructed; lackMining = !( CheckResourceSkill( ( (BaseArmor) targeted ).Resource, from.Skills[SkillName.Mining].Value ) ); } else if ( targeted is BaseWeapon ) { success = DoResmelt( system, from, (BaseWeapon) targeted, ( (BaseWeapon) targeted ).Resource, playSound ); isStoreBought = !( (BaseWeapon) targeted ).PlayerConstructed; lackMining = !( CheckResourceSkill( ( (BaseWeapon) targeted ).Resource, from.Skills[SkillName.Mining].Value ) ); } else if ( targeted is DragonBardingDeed ) { success = DoResmelt( system, from, (DragonBardingDeed) targeted, ( (DragonBardingDeed) targeted ).Resource, playSound ); isStoreBought = false; lackMining = false; } }
public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool) : base(100, 200) { from.CloseGump(typeof(QueryMakersMarkGump)); this.m_Quality = quality; this.m_From = from; this.m_CraftItem = craftItem; this.m_CraftSystem = craftSystem; this.m_TypeRes = typeRes; this.m_Tool = tool; this.AddPage(0); this.AddBackground(0, 0, 220, 170, 5054); this.AddBackground(10, 10, 200, 150, 3000); this.AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item? this.AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE this.AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0); this.AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL this.AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0); }
public AutoCraftTimer(Mobile from, CraftSystem system, CraftItem item, BaseTool tool, int amount, TimeSpan delay, TimeSpan interval) : base(delay, interval) { m_From = from; m_CraftSystem = system; m_CraftItem = item; m_Tool = tool; m_Amount = amount; m_Ticks = 0; m_Success = 0; CraftContext context = m_CraftSystem.GetContext(m_From); if (context != null) { CraftSubResCol res = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes); int resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex); if (resIndex > -1) m_TypeRes = res.GetAt(resIndex).ItemType; } m_AutoCraftTable[from] = this; this.Start(); }
public static void CheckSkill( ref int baseChance, Mobile from, CraftSystem craftSystem ) { int skill = from.Skills[craftSystem.MainSkill].Fixed / 10; if ( skill >= 100 ) baseChance -= (skill - 90) / 10; }
public InternalTarget( CraftSystem craftSystem, double skill_level, Item contract ) : base(2, false, TargetFlags.None) { m_CraftSystem = craftSystem; m_Tool = null; m_SkillLevel = skill_level; m_Contract = contract; }
protected void AddRecipe( CraftSystem system ) { // TODO: change craftable artifact recipes to a rarer drop int recipeID = system.RandomRecipe(); if ( recipeID != -1 ) DropItem( new RecipeScroll( recipeID ) ); }
public CraftGumpItem( Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool ) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_CraftItem = craftItem; m_Tool = tool; from.CloseGump( typeof( CraftGump ) ); from.CloseGump( typeof( CraftGumpItem ) ); AddPage( 0 ); AddBackground( 0, 0, 530, 417, 5054 ); AddImageTiled( 10, 10, 510, 22, 2624 ); AddImageTiled( 10, 37, 150, 148, 2624 ); AddImageTiled( 165, 37, 355, 90, 2624 ); AddImageTiled( 10, 190, 155, 22, 2624 ); AddImageTiled( 10, 217, 150, 53, 2624 ); AddImageTiled( 165, 132, 355, 80, 2624 ); AddImageTiled( 10, 275, 155, 22, 2624 ); AddImageTiled( 10, 302, 150, 53, 2624 ); AddImageTiled( 165, 217, 355, 80, 2624 ); AddImageTiled( 10, 360, 155, 22, 2624 ); AddImageTiled( 165, 302, 355, 80, 2624 ); AddImageTiled( 10, 387, 510, 22, 2624 ); AddAlphaRegion( 10, 10, 510, 399 ); AddHtmlLocalized( 170, 40, 150, 20, 1044053, LabelColor, false, false ); // ITEM AddHtmlLocalized( 10, 192, 150, 22, 1044054, LabelColor, false, false ); // <CENTER>SKILLS</CENTER> AddHtmlLocalized( 10, 277, 150, 22, 1044055, LabelColor, false, false ); // <CENTER>MATERIALS</CENTER> AddHtmlLocalized( 10, 362, 150, 22, 1044056, LabelColor, false, false ); // <CENTER>OTHER</CENTER> if ( craftSystem.GumpTitleNumber > 0 ) AddHtmlLocalized( 10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false ); else AddHtml( 10, 12, 510, 20, craftSystem.GumpTitleString, false, false ); AddButton( 15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 390, 150, 18, 1044150, LabelColor, false, false ); // BACK AddButton( 270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 305, 390, 150, 18, 1044151, LabelColor, false, false ); // MAKE NOW if ( craftItem.NameNumber > 0 ) AddHtmlLocalized( 330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false ); else AddLabel( 330, 40, LabelHue, craftItem.NameString ); if ( craftItem.UseAllRes ) AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1048176, LabelColor, false, false ); // Makes as many as possible at once DrawItem(); DrawSkill(); DrawRessource(); if( craftItem.RequiresSE ) AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion }
public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { if ( makersMark ) Crafter = from; m_Quality = (RuneQuality)quality; return quality; }
public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, bool exceptional ) { m_From = from; m_CraftItem = craftItem; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; m_Exceptional = exceptional; }
public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue ) { Quality = (ClothingQuality)quality; if( Quality == ClothingQuality.Exceptional ) DistributeBonuses( (tool is BaseRunicTool ? 6 : (Core.SE ? 15 : 14)) ); //BLAME OSI. (We can't confirm it's an OSI bug yet.) return base.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue ); }
public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, IBaseTool tool, int quality ) { m_From = from; m_CraftItem = craftItem; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; m_Quality = quality; }
public void AddRecipe( int id, CraftSystem system ) { if( m_Recipe != null ) { Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, this.m_Type.Name, system ); return; } m_Recipe = new Recipe( id, system, this ); }
public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool ) { int num = craftSystem.CanCraft( from, tool, null ); if (num > 0 && num != 1044267) from.SendGump(new CraftGump(from, craftSystem, tool, num)); else { from.Target = new InternalTarget( craftSystem, tool ); from.SendLocalizedMessage( 1044273 ); // Target an item to recycle. } }
public Recipe( int id, CraftSystem system, CraftItem item ) { m_ID = id; m_System = system; m_CraftItem = item; if ( m_Recipes.ContainsKey( id ) ) throw new Exception( "Attempting to create recipe with preexisting ID." ); m_Recipes.Add( id, this ); m_LargestRecipeID = Math.Max( id, m_LargestRecipeID ); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { int charges = 5 + quality + (int)(from.Skills[SkillName.Inscribe].Value / 30); if (charges > 10) { charges = 10; } MaxCharges = (Core.SE ? charges * 2 : charges); return quality; }
public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue) { Quality = (ClothingQuality)quality; return base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue); }
public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool ) { string num = craftSystem.CanCraft( from, tool, null ); if ( num != "" ) { from.SendGump( new CraftGump( from, craftSystem, tool, num ) ); } else { from.Target = new InternalTarget( craftSystem, tool ); from.SendAsciiMessage( "Target an item to recycle." ); } }
public static bool CanReforge(Mobile from, Item item, CraftSystem crsystem) { CraftItem crItem = null; bool allowableSpecial = m_AllowableTable.ContainsKey(item.GetType()); if (!allowableSpecial) { foreach (CraftSystem system in CraftSystem.Systems) { if (system == crsystem && system != null && system.CraftItems != null) crItem = system.CraftItems.SearchFor(item.GetType()); if (crItem != null) break; } } if (crItem == null && !allowableSpecial) { from.SendLocalizedMessage(1152279); // You cannot re-forge that item with this tool. return false; } bool goodtogo = true; int mods = GetTotalMods(item); int maxmods = item is JukaBow ||item is BaseWeapon && !((BaseWeapon)item).DImodded ? 1 : 0; if(m_AllowableTable.ContainsKey(item.GetType()) && m_AllowableTable[item.GetType()] != crsystem) goodtogo = false; else if (mods > maxmods) goodtogo = false; else if (item.LootType == LootType.Blessed || item.LootType == LootType.Newbied) goodtogo = false; else if (item is BaseWeapon && Server.Spells.Mystic.EnchantSpell.IsUnderSpellEffects(from, (BaseWeapon)item)) goodtogo = false; else if (item is BaseWeapon && ((BaseWeapon)item).FocusWeilder != null) goodtogo = false; else if (!allowableSpecial && ((item is BaseWeapon && !((BaseWeapon)item).PlayerConstructed) || (item is BaseArmor && !((BaseArmor)item).PlayerConstructed))) goodtogo = false; else if (!allowableSpecial && item is BaseClothing && !(item is BaseHat)) goodtogo = false; else if (Imbuing.IsInNonImbueList(item.GetType())) goodtogo = false; if (!goodtogo) from.SendLocalizedMessage(1152113); // You cannot reforge that item. return goodtogo; }
public virtual 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; Resource = CraftResources.GetFromType( resourceType ); CraftContext context = craftSystem.GetContext( from ); if ( context != null && context.DoNotColor ) Hue = 0; return quality; }
public int OnCraft(int quality, bool markersMark, Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Console.WriteLine("Hue: {0}", resHue.ToString()); switch (resHue) { default: m_LenseType = LenseType.Limited; break; case 2223: m_LenseType = LenseType.Regular; break; case 1266: m_LenseType = LenseType.Enhanced; break; } Hue = resHue; return quality; }
public static void BeginTarget( Mobile from, CraftSystem craftSystem, BaseTool tool ) { CraftContext context = craftSystem.GetContext( from ); PlayerMobile user = from as PlayerMobile; if ( context == null ) return; int lastRes = context.LastResourceIndex; CraftSubResCol subRes = craftSystem.CraftSubRes; if ( lastRes >= 0 && lastRes < subRes.Count ) { CraftSubRes res = subRes.GetAt( lastRes ); if ( from.Skills[craftSystem.MainSkill].Value < res.RequiredSkill ) { from.SendGump( new CraftGump( from, craftSystem, tool, res.Message ) ); } else { CraftResource resource = CraftResources.GetFromType( res.ItemType ); if ( resource != CraftResource.None ) { from.Target = new InternalTarget( craftSystem, tool, res.ItemType, resource ); if ( user.NextEnhanceSuccess ) { from.SendLocalizedMessage( 1149869, "100" ); // Target an item to enhance with the properties of your selected material (Success Rate: ~1_VAL~%). } else { from.SendLocalizedMessage( 1061004 ); // Target an item to enhance with the properties of your selected material. } } else { from.SendGump( new CraftGump( from, craftSystem, tool, 1061010 ) ); // You must select a special material in order to enhance an item with its properties. } } } else { from.SendGump( new CraftGump( from, craftSystem, tool, 1061010 ) ); // You must select a special material in order to enhance an item with its properties. } }
public virtual int OnCraft( int quality, bool makersMark, Mobile m, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { if (makersMark) { Crafter = m; } return quality; }
public CraftContext(Mobile owner, CraftSystem system) { Owner = owner; System = system; this.m_Items = new List<CraftItem>(); this.m_LastResourceIndex = -1; this.m_LastResourceIndex2 = -1; this.m_LastGroupIndex = -1; this.m_CheckedHues = false; this.m_Hues = new List<int>(); this.m_CompareHueTo = null; this.m_QuestOption = CraftQuestOption.NonQuestItem; Contexts.Add(this); }
public ExplosionTrapCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality) : base(from, craftItem, craftSystem, typeRes, tool, quality) { }
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 eq && 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); } if (craftItem.GetSuccessChance(from, resType, craftSystem, false, out _) <= 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) { if (from.FindItemOnLayer(Layer.OneHanded) is AncientSmithyHammer hammer) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0; int dura, luck, lreq, dinc = 0; int baseChance; bool physBonus = false; bool fireBonus; bool coldBonus; bool nrgyBonus; bool poisBonus; bool duraBonus; bool luckBonus; bool lreqBonus; bool dincBonus; if (item is BaseWeapon weapon) { 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 w) { w.Resource = resource; int hue = w.GetElementalDamageHue(); if (hue > 0) { w.Hue = hue; } } else { ((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 CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_CraftItem = craftItem; m_Tool = tool; from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage(0); AddBackground(0, 0, 530, 417, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 37, 150, 148, 2624); AddImageTiled(165, 37, 355, 90, 2624); AddImageTiled(10, 190, 155, 22, 2624); AddImageTiled(10, 217, 150, 53, 2624); AddImageTiled(165, 132, 355, 80, 2624); AddImageTiled(10, 275, 155, 22, 2624); AddImageTiled(10, 302, 150, 53, 2624); AddImageTiled(165, 217, 355, 80, 2624); AddImageTiled(10, 360, 155, 22, 2624); AddImageTiled(165, 302, 355, 80, 2624); AddImageTiled(10, 387, 510, 22, 2624); AddAlphaRegion(10, 10, 510, 399); AddHtml(170, 40, 150, 20, "<h3><basefont color=#FFFFFF>Objet<basefont></h3>", false, false); AddHtml(10, 192, 150, 22, "<h3><basefont color=#FFFFFF><center>Compétences</center><basefont></h3>", false, false); AddHtml(10, 277, 150, 22, "<h3><basefont color=#FFFFFF><center>Matériaux</center><basefont></h3>", false, false); AddHtml(10, 362, 150, 22, "<h3><basefont color=#FFFFFF><center>Autre</center><basefont></h3>", false, false); if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { AddHtml(10, 12, 510, 20, "<h3><basefont color=#FFFFFF><center>" + craftSystem.GumpTitleString + "</center><basefont></h3>", false, false); } AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0); AddHtml(50, 390, 150, 20, "<h3><basefont color=#FFFFFF>Retour<basefont></h3>", false, false); bool needsRecipe = (craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe(craftItem.Recipe)); if (needsRecipe) { AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0); AddHtml(305, 390, 150, 20, "<h3><basefont color=#FFFFFF>Fabriquer<basefont></h3>", false, false); } else { AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtml(305, 390, 150, 20, "<h3><basefont color=#FFFFFF>Fabriquer<basefont></h3>", false, false); } if (craftItem.NameNumber > 0) { AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false); } else { AddHtml(330, 40, 150, 20, "<h3><basefont color=#FFFFFF><center>" + craftItem.NameString + "</center><basefont></h3>", false, false); } if (craftItem.UseAllRes) { AddHtml(170, 302 + (m_OtherCount++ *20), 300, 20, "<h3><basefont color=#FFFFFF><center>Fabriquer le plus possible</center><basefont></h3>", false, false); } DrawItem(); DrawSkill(); DrawResource(); if (needsRecipe) { //AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1073620, RedLabelColor, false, false ); // You have not learned this recipe. AddHtml(170, 302 + (m_OtherCount++ *20), 300, 20, "<h3><basefont color=#FFFFFF><center>Vous n'avez pas la recette</center><basefont></h3>", false, false); } }
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool, notice, CraftPage.None) { }
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; PlayerMobile user = from as PlayerMobile; 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)); } if (user.NextEnhanceSuccess) { user.NextEnhanceSuccess = false; user.SendLocalizedMessage(1149969); // The magical aura that surrounded you disipates and you feel that your item enhancement chances have returned to normal. res = EnhanceResult.Success; } 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 static void Do(Mobile from, CraftSystem craftSystem, RepairBenchAddon addon) { from.Target = new InternalTarget(craftSystem, addon); from.SendLocalizedMessage(500436); // Select item to repair. }
public InternalTarget(CraftSystem craftSystem, RepairDeed deed) : base(2, false, TargetFlags.None) { m_CraftSystem = craftSystem; m_Deed = deed; }
public AutoCraftTimer(Mobile from, CraftSystem system, CraftItem item, BaseTool tool, int amount) : this(from, system, item, tool, amount, TimeSpan.FromSeconds(2.5), TimeSpan.FromSeconds(2.5)) { }
public static void BeginTarget(Mobile from, CraftSystem system, BaseTool tool) { from.Target = new AlterItemTarget(system, tool); from.SendLocalizedMessage(1094730); //Target the item to altar }
public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, ITool tool, Item item, CraftResource resource, Type resType, ref object resMessage) { if (item == null) { return(EnhanceResult.BadItem); } if (item is GargishNecklace || item is GargishEarrings) { return(EnhanceResult.BadItem); } if (!item.IsChildOf(from.Backpack)) { return(EnhanceResult.NotInBackpack); } if (item.HasSocket <Transmogrified>()) { return(EnhanceResult.Transmogrified); } IResource ires = item as IResource; if (!CanEnhance(item) || ires == null) { return(EnhanceResult.BadItem); } if (item is IArcaneEquip eq && eq.IsArcane) { return(EnhanceResult.BadItem); } if (item is BaseWeapon bw && Spells.Mysticism.EnchantSpell.IsUnderSpellEffects(from, bw)) { return(EnhanceResult.Enchanted); } 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 (IsSpecial(item, craftSystem)) { craftItem = craftSystem.CraftItems.SearchForSubclass(item.GetType()); } if (craftItem == null || craftItem.Resources.Count == 0) { return(EnhanceResult.BadItem); } if (craftItem.ForceNonExceptional) { 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 (!CraftResources.IsStandard(ires.Resource)) { return(EnhanceResult.AlreadyEnhanced); } 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 weapon) { if (weapon.ExtendedWeaponAttributes.AssassinHoned > 0) { return(EnhanceResult.BadItem); } 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 if (item is BaseArmor armor) { 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; } else if (item is FishingPole pole) { baseChance = 20; luck = pole.Attributes.Luck; 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; PlayerMobile user = from as PlayerMobile; 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)); } if (user.NextEnhanceSuccess) { user.NextEnhanceSuccess = false; user.SendLocalizedMessage(1149969); // The magical aura that surrounded you disipates and you feel that your item enhancement chances have returned to normal. res = EnhanceResult.Success; } 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 (craftItem.CaddelliteCraft) { Caddellite.TryInfuse(from, item, craftSystem); } if (item is IResource resour) { resour.Resource = resource; } if (item is BaseWeapon w) { w.DistributeMaterialBonus(attributes); int hue = w.GetElementalDamageHue(); if (hue > 0) { w.Hue = hue; } } else if (item is BaseArmor armor) { armor.DistributeMaterialBonus(attributes); } else if (item is FishingPole pole) { pole.DistributeMaterialBonus(attributes); } 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 static void Do(Mobile from, CraftSystem craftSystem, BaseTool tool) { from.Target = new InternalTarget(craftSystem, tool); from.SendLocalizedMessage(1044276); // Target an item to repair. }
public AlterItemTarget(CraftSystem system, ITool tool) : base(1, false, TargetFlags.None) { this.m_System = system; this.m_Tool = tool; }
public AlterItemTarget(CraftSystem system, Item contract) : base(2, false, TargetFlags.None) { m_System = system; m_Contract = contract; }
public static void BeginTarget(Mobile from, CraftSystem system, Item contract) { from.Target = new AlterItemTarget(system, contract); from.SendLocalizedMessage(1094730); //Target the item to altar }
public override void OnResponse(NetState sender, RelayInfo info) { //Cancel if (info.ButtonID <= 0) { return; } int buttonID = info.ButtonID - 1; int type = buttonID % 7; int index = buttonID / 7; CraftSystem system = m_CraftSystem; CraftGroupCol groups = system.CraftGroups; CraftContext context = system.GetContext(m_From); //Guide if (info.ButtonID == 1000) { return; } //Crafting else { switch (type) { //Group case 0: { if (context == null) { break; } if (index >= 0 && index < groups.Count) { context.LastGroupIndex = index; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } break; } //Create Item case 1: { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { CraftGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.CraftItems.Count) { CraftItem(group.CraftItems.GetAt(index)); } } break; } //Item Details case 2: { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { CraftGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.CraftItems.Count) { m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems.GetAt(index), m_Tool)); } } break; } //Create Item: Last 10 case 3: { if (context == null) { break; } List <CraftItem> lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { CraftItem(lastTen[index]); } break; } //Item Details: Last Ten case 4: { if (context == null) { break; } List <CraftItem> lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { m_From.SendGump(new CraftGumpItem(m_From, system, lastTen[index], m_Tool)); } break; } //Resource Selected case 5: { if (m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } else if (m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes2.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex2 = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } break; } //Main Controls case 6: { switch (index) { //Resource Selection case 0: { if (system.CraftSubRes.Init) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource)); } break; } //Recyle Item case 1: { if (system.Recycle) { Recycle.RecyclePrompt(m_From, system, m_Tool); } break; } //Make Last case 2: { if (context == null) { break; } CraftItem item = context.LastMade; if (item != null) { CraftItem(item); } else { m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, 1044165, m_Page)); // You haven't made anything yet. } break; } //Last Ten case 3: { if (context == null) { break; } context.LastGroupIndex = 501; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); break; } //Toggle Resource Hue case 4: { if (context == null) { break; } context.DoNotColor = !context.DoNotColor; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } //Repair Item case 5: { if (system.Repair) { Repair.Do(m_From, system, m_Tool); } break; } //Toggle Mark Option case 6: { if (context == null || !system.MarkOption) { break; } switch (context.MarkOption) { case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break; case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break; case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } //Toggle Smelt option case 9: { if (context == null || !system.Recycle) { break; } switch (context.RecycleOption) { case CraftRecycleOption.RecycleSingle: context.RecycleOption = CraftRecycleOption.RecycleRegularByType; break; case CraftRecycleOption.RecycleRegularByType: context.RecycleOption = CraftRecycleOption.RecycleExceptionalByType; break; case CraftRecycleOption.RecycleExceptionalByType: context.RecycleOption = CraftRecycleOption.RecycleMagicalByType; break; case CraftRecycleOption.RecycleMagicalByType: context.RecycleOption = CraftRecycleOption.RecycleAnyByType; break; case CraftRecycleOption.RecycleAnyByType: context.RecycleOption = CraftRecycleOption.RecycleEverything; break; case CraftRecycleOption.RecycleEverything: context.RecycleOption = CraftRecycleOption.RecycleSingle; break; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } //Highlight Skill Gain case 10: { if (context == null) { break; } context.HighlightSkillGainItems = !context.HighlightSkillGainItems; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } } break; } } } }
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 (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); } 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; duraBonus = attributes.WeaponDurability > 0; lreqBonus = attributes.WeaponLowerRequirements > 0; dincBonus = dinc > 0; } else { BaseArmor armor = (BaseArmor)item; if (!CraftResources.IsStandard(armor.Resource)) { return(EnhanceResult.AlreadyEnhanced); } baseChance = 20; dura = armor.MaxHitPoints; duraBonus = attributes.ArmorDurability > 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 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 InternalTarget(CraftSystem craftSystem, RepairBenchAddon addon) : base(2, false, TargetFlags.None) { m_CraftSystem = craftSystem; m_Addon = addon; }
protected override void OnTarget(Mobile from, object targeted) { int number; if (!CheckDeed(from)) { return; } bool usingDeed = (m_Deed != null); bool toDelete = false; // TODO: Make an IRepairable if (m_CraftSystem.CanCraft(from, m_Tool, targeted.GetType()) == 1044267) { number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's * } else if (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) ? 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; CraftSystem.OnRepair(from, m_Tool, m_Deed, null, g); 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 = (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) && (!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 (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; CraftSystem.OnRepair(from, m_Tool, m_Deed, null, weapon); } 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 && !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 (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; CraftSystem.OnRepair(from, m_Tool, m_Deed, null, armor); } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (targeted is BaseClothing) { BaseClothing clothing = (BaseClothing)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; if (Core.AOS) { toWeaken = 1; } else if (skill != SkillName.Tailoring) { double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base; if (skillLevel >= 90.0) { toWeaken = 1; } else if (skillLevel >= 70.0) { toWeaken = 2; } else { toWeaken = 3; } } if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !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 (CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { clothing.MaxHitPoints -= toWeaken; clothing.HitPoints = Math.Max(0, clothing.HitPoints - toWeaken); } if (CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints)) { number = 1044279; // You repair the item. m_CraftSystem.PlayCraftEffect(from); clothing.HitPoints = clothing.MaxHitPoints; CraftSystem.OnRepair(from, m_Tool, m_Deed, null, clothing); } else { number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed] m_CraftSystem.PlayCraftEffect(from); } toDelete = true; } } else if (!usingDeed && targeted is BlankScroll) { SkillName skill = m_CraftSystem.MainSkill; if (from.Skills[skill].Value >= 50.0) { ((BlankScroll)targeted).Consume(1); RepairDeed deed = new RepairDeed(RepairDeed.GetTypeFor(m_CraftSystem), from.Skills[skill].Value, from); from.AddToBackpack(deed); number = 500442; // You create the item and put it in your backpack. } else { number = 1047005; // You must be at least apprentice level to create a repair service contract. } } else 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 = m_CraftSystem.GetContext(from); from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number)); } else { from.SendLocalizedMessage(number); if (toDelete) { m_Deed.Delete(); } } }
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_CraftItem = craftItem; m_Tool = tool; from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage(0); AddBackground(0, 0, 530, 417, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 37, 150, 148, 2624); AddImageTiled(165, 37, 355, 90, 2624); AddImageTiled(10, 190, 155, 22, 2624); AddImageTiled(10, 217, 150, 53, 2624); AddImageTiled(165, 132, 355, 80, 2624); AddImageTiled(10, 275, 155, 22, 2624); AddImageTiled(10, 302, 150, 53, 2624); AddImageTiled(165, 217, 355, 80, 2624); AddImageTiled(10, 360, 155, 22, 2624); AddImageTiled(165, 302, 355, 80, 2624); AddImageTiled(10, 387, 510, 22, 2624); AddAlphaRegion(10, 10, 510, 399); AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor, false, false); // <CENTER>SKILLS</CENTER> AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER> AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER> if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK bool needsRecipe = craftItem.Recipe != null && @from is PlayerMobile && !((PlayerMobile)@from).HasRecipe(craftItem.Recipe); if (needsRecipe) { AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0); AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW } else { AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW } if (craftItem.NameNumber > 0) { AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false); } else { AddLabel(330, 40, LabelHue, craftItem.NameString); } if (craftItem.UseAllRes) { AddHtmlLocalized(170, 302 + m_OtherCount++ *20, 310, 18, 1048176, LabelColor, false, false); // Makes as many as possible at once } DrawItem(); DrawSkill(); DrawResource(); if (needsRecipe) { AddHtmlLocalized(170, 302 + m_OtherCount++ *20, 310, 18, 1073620, RedLabelColor, false, false); // You have not learned this recipe. } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID <= 0) { return; // Canceled } int buttonID = info.ButtonID - 1; int type = buttonID % 7; int index = buttonID / 7; CraftSystem system = m_CraftSystem; CraftGroupCol groups = system.CraftGroups; CraftContext context = system.GetContext(m_From); switch (type) { case 0: // Show group { if (context == null) { break; } if (index >= 0 && index < groups.Count) { context.LastGroupIndex = index; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } break; } case 1: // Create item { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { CraftGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.CraftItems.Count) { CraftItem(group.CraftItems.GetAt(index)); } } break; } case 2: // Item details { if (context == null) { break; } int groupIndex = context.LastGroupIndex; if (groupIndex >= 0 && groupIndex < groups.Count) { CraftGroup group = groups.GetAt(groupIndex); if (index >= 0 && index < group.CraftItems.Count) { m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems.GetAt(index), m_Tool)); } } break; } case 3: // Create item (last 10) { if (context == null) { break; } List <CraftItem> lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { CraftItem(lastTen[index]); } break; } case 4: // Item details (last 10) { if (context == null) { break; } List <CraftItem> lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { m_From.SendGump(new CraftGumpItem(m_From, system, lastTen[index], m_Tool)); } break; } case 5: // Resource selected { if (m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } else if (m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes2.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex2 = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } break; } case 6: // Misc. buttons { switch (index) { case 0: // Resource selection { if (system.CraftSubRes.Init) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource)); } break; } case 1: // Smelt item { if (system.Resmelt) { Resmelt.Do(m_From, system, m_Tool); } break; } case 2: // Make last { if (context == null) { break; } CraftItem item = context.LastMade; if (item != null) { CraftItem(item); } else { m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, 1044165, m_Page)); // You haven't made anything yet. } break; } case 3: // Last 10 { if (context == null) { break; } context.LastGroupIndex = 501; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); break; } case 4: // Toggle use resource hue { if (context == null) { break; } context.DoNotColor = !context.DoNotColor; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 5: // Repair item { if (system.Repair) { Repair.Do(m_From, system, m_Tool); } break; } case 6: // Toggle mark option { if (context == null || !system.MarkOption) { break; } switch (context.MarkOption) { case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break; case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break; case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 7: // Resource selection 2 { if (system.CraftSubRes2.Init) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource2)); } break; } case 8: // Enhance item { if (system.CanEnhance) { Enhance.BeginTarget(m_From, system, m_Tool); } break; } } break; } } }
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_CraftItem = craftItem; m_Tool = tool; from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage(0); AddBackground(0, 0, 530, 417, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 37, 150, 148, 2624); AddImageTiled(165, 37, 355, 90, 2624); AddImageTiled(10, 190, 155, 22, 2624); #region SA; //AddImageTiled( 10, 217, 150, 53, 2624 ); AddImageTiled(165, 132, 355, 80, 2624); AddImageTiled(10, 237, 155, 60, 2624); //AddImageTiled( 10, 302, 150, 53, 2624 ); AddImageTiled(165, 217, 355, 80, 2624); AddImageTiled(10, 322, 155, 60, 2624); #endregion AddImageTiled(165, 302, 355, 80, 2624); AddImageTiled(10, 387, 510, 22, 2624); AddAlphaRegion(10, 10, 510, 399); AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM #region SA; //AddHtmlLocalized( 10, 192, 150, 22, 1044054, LabelColor, false, false ); // <CENTER>SKILLS</CENTER> AddHtmlLocalized(10, 215, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER> AddHtmlLocalized(10, 300, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER> #endregion if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK bool needsRecipe = (craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe(craftItem.Recipe)); if (needsRecipe) { AddButton(135, 387, 4005, 4007, 0, GumpButtonType.Page, 0); AddHtmlLocalized(440, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW } else { AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(440, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW } if (craftItem.NameNumber > 0) { AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false); } else { AddLabel(330, 40, LabelHue, craftItem.NameString); } if (craftItem.UseAllRes) { AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1048176, LabelColor, false, false); // Makes as many as possible at once } DrawItem(); DrawSkill(); DrawResource(); /* * if( craftItem.RequiresSE ) * AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion * */ if (craftItem.RequiredExpansion != Expansion.None) { bool supportsEx = (from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion)); TextDefinition.AddHtmlText(this, 170, 302 + (m_OtherCount++ *20), 310, 18, RequiredExpansionMessage(craftItem.RequiredExpansion), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue); } if (needsRecipe) { AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1073620, RedLabelColor, false, false); // You have not learned this recipe. } }
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_Tool = tool; m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage(0); AddBackground(0, 0, 530, 437, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 292, 150, 45, 2624); AddImageTiled(165, 292, 355, 45, 2624); AddImageTiled(10, 342, 510, 85, 2624); AddImageTiled(10, 37, 200, 250, 2624); AddImageTiled(215, 37, 305, 250, 2624); AddAlphaRegion(10, 10, 510, 417); if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER> AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER> AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER> AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST // Mark option if (craftSystem.MarkOption) { AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false); // MARK ITEM } // **************************************** // Resmelt option if (craftSystem.Resmelt) { AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0); AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM } // **************************************** // Repair option if (craftSystem.Repair) { AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM } // **************************************** // Enhance option if (craftSystem.CanEnhance) { AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM } // **************************************** if (notice is int && (int)notice > 0) { AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false); } // If the system has more than one resource if (craftSystem.CraftSubRes.Init) { string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex); Type resourceType = craftSystem.CraftSubRes.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } } AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0); if (nameNumber > 0) { AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { AddLabel(50, 362, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** // For dragon scales if (craftSystem.CraftSubRes2.Init) { string nameString = craftSystem.CraftSubRes2.NameString; int nameNumber = craftSystem.CraftSubRes2.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex2); Type resourceType = craftSystem.CraftSubRes2.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } } AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0); if (nameNumber > 0) { AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { AddLabel(50, 385, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** CreateGroupList(); if (page == CraftPage.PickResource) { CreateResList(false, from); } else if (page == CraftPage.PickResource2) { CreateResList(true, from); } else if (context != null && context.LastGroupIndex > -1) { CreateItemList(context.LastGroupIndex); } }
private void MakeBolt(CraftSystem sys, Mobile from) { Make(from, 1, typeof(Bolt)); }
public InternalTarget(CraftSystem craftSystem, BaseTool tool) : base(2, false, TargetFlags.None) { m_CraftSystem = craftSystem; m_Tool = tool; }
public override void OnResponse(GameClient sender, RelayInfo info) { if (m_MakeTimer != null) { m_MakeTimer.Stop(); } if (info.ButtonID <= 0) { return; // Canceled } int type = info.ButtonID / 1000; int index = info.ButtonID % 1000; CraftSystem system = m_CraftSystem; CraftGroupCol groups = system.CraftGroups; CraftContext context = system.GetContext(m_From); switch (type) { case 0: // Create Item { if (context == null) { break; } CraftItem item = system.CraftItems.GetAt(index); if (item != null) { CraftItem(item); } break; } case 1: // Item Details && Make Last { if (context == null) { break; } switch (index) { case 999: // Make Last { CraftItem item = context.LastMade; if (item != null) { CraftItem(item); } else { // You haven't made anything yet. m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, 1044165, m_Page)); } break; } default: // Item Details { CraftItem item = system.CraftItems.GetAt(index); if (item != null) { m_From.SendGump(new CraftGumpItem(m_From, system, item, m_Tool)); } break; } } break; } case 2: // Enhance Item { if (system.CanEnhance) { Enhance.BeginTarget(m_From, system, m_Tool); } break; } case 3: // Toggle use resource hue { if (context == null) { break; } context.DoNotColor = !context.DoNotColor; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 4: // 2nd resource selected { if (index >= 0 && index < system.CraftSubRes2.Count) { CraftSubRes res = system.CraftSubRes2.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex2 = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } break; } case 5: // Resource selected { if (index >= 0 && index < system.CraftSubRes.Count) { CraftSubRes res = system.CraftSubRes.GetAt(index); if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex = index; } m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } } break; } case 6: // Craft system features { if (context == null) { break; } switch (index) { case 0: // Toggle mark option { if (!system.MarkOption) { break; } switch (context.MarkOption) { case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break; case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break; case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 1: // Toggle mark option (KR Version) { if (!system.MarkOption) { break; } switch (context.MarkOption) { case CraftMarkOption.PromptForMark: case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break; case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.MarkItem; break; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 2: // Toggle quest item option { context.QuestItem = !context.QuestItem; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 3: // Make last { context.MakeLast = !context.MakeLast; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 4: // Reset Make number { context.Total = 1; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } case 5: // Make Max { if (!context.MakeMax) { context.Total = 9999; } else { context.Total = 1; context.Making = null; } m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } default: // Make number { int amount = index - 100; Utility.FixMinMax(ref amount, 1, 100); context.Total = amount; m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } } break; } case 7: // Smelt item { if (system.Resmelt) { Resmelt.Do(m_From, system, m_Tool); } break; } case 8: // Repair item { if (system.Repair) { Repair.Do(m_From, system, m_Tool); } break; } case 9: // Show group && Last 10 { if (context == null) { break; } switch (index) { case 0: // Alter Item (Gargoyle) { if (system.Alter) { Alter.Do(m_From, system, m_Tool); } break; } case 99: // Last 10 { context.LastGroupIndex = 501; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); break; } default: // Show group { index--; if (index >= 0 && index < groups.Count) { context.LastGroupIndex = index; m_From.SendGump(new CraftGump(m_From, system, m_Tool, null)); } break; } } break; } case 12: // Cancel Make { context.Total = 1; m_From.SendLocalizedMessage(501806); // Request cancelled. m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } } }
public static void Do(Mobile from, CraftSystem craftSystem, RepairDeed deed) { from.Target = new InternalTarget(craftSystem, deed); from.SendLocalizedMessage(1044276); // Target an item to repair. }
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_CraftItem = craftItem; m_Tool = tool; from.CloseGump <CraftGump>(); from.CloseGump <CraftGumpItem>(); AddPage(0); AddBackground(0, 0, 530, 417, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 37, 150, 148, 2624); AddImageTiled(165, 37, 355, 90, 2624); AddImageTiled(10, 190, 155, 22, 2624); AddImageTiled(10, 217, 150, 53, 2624); AddImageTiled(165, 132, 355, 80, 2624); AddImageTiled(10, 275, 155, 22, 2624); AddImageTiled(10, 302, 150, 53, 2624); AddImageTiled(165, 217, 355, 80, 2624); AddImageTiled(10, 360, 155, 22, 2624); AddImageTiled(165, 302, 355, 80, 2624); AddImageTiled(10, 387, 510, 22, 2624); AddAlphaRegion(10, 10, 510, 399); AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER> AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER> AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER> if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString); } AddButton(15, 387, 4014, 4016, 0); AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK var needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile && !mobile.HasRecipe(craftItem.Recipe); if (needsRecipe) { AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page); AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW } else { AddButton(270, 387, 4005, 4007, 1); AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW } if (craftItem.NameNumber > 0) { AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor); } else { AddLabel(330, 40, LabelHue, craftItem.NameString); } if (craftItem.UseAllRes) { AddHtmlLocalized( 170, 302 + m_OtherCount++ *20, 310, 18, 1048176, // Makes as many as possible at once LabelColor ); } DrawItem(); DrawSkill(); DrawResource(); if (craftItem.RequiredExpansion != Expansion.None) { var supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true; TextDefinition.AddHtmlText( this, 170, 302 + m_OtherCount++ *20, 310, 18, RequiredExpansionMessage(craftItem.RequiredExpansion), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue ); } if (needsRecipe) { AddHtmlLocalized( 170, 302 + m_OtherCount++ *20, 310, 18, 1073620, // You have not learned this recipe. RedLabelColor ); } }
public PoisonTrapCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, ITool tool, int quality) : base(from, craftItem, craftSystem, typeRes, tool, quality) { }
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_Tool = tool; m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage(0); AddBackground(0, 0, 530, 437, 5054); AddImageTiled(10, 10, 510, 22, 2624); // AddImageTiled(10, 292, 150, 45, 2624); // AddImageTiled(165, 292, 355, 45, 2624); AddImageTiled(10, 342, 510, 85, 2624); AddImageTiled(10, 37, 200, 250, 2624); AddImageTiled(215, 37, 305, 250, 2624); AddAlphaRegion(10, 10, 510, 417); if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER> AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER> AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER> int textHue = 2499; int highlightColor = 2599; //Guide AddButton(10, 0, 2094, 2095, 1000, GumpButtonType.Reply, 0); AddLabel(35, 5, textHue, "Guide"); #region Left Side Button Controls //Smelt Mode if (craftSystem.Recycle) { AddButton(15, 342, 4005, 4007, GetButtonID(6, 9), GumpButtonType.Reply, 0); switch (context.RecycleOption) { case CraftRecycleOption.RecycleSingle: AddLabel(50, 345, textHue, "Recycle Mode: Single Item"); break; case CraftRecycleOption.RecycleRegularByType: AddLabel(50, 345, textHue, "Recycle Mode: Regular (of Type)"); break; case CraftRecycleOption.RecycleExceptionalByType: AddLabel(50, 345, textHue, "Recycle Mode: Exceptional (of Type)"); break; case CraftRecycleOption.RecycleMagicalByType: AddLabel(50, 345, textHue, "Recycle Mode: Magical (of Type)"); break; case CraftRecycleOption.RecycleAnyByType: AddLabel(50, 345, textHue, "Recycle Mode: Any (of Type)"); break; case CraftRecycleOption.RecycleEverything: AddLabel(50, 345, textHue, "Recycle Mode: Entire Backpack"); break; } } //Smelt Button if (craftSystem.Recycle) { AddButton(15, 362, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0); AddLabel(50, 365, textHue, "Begin Recycling"); /* * if (context.RecycleOption == CraftRecycleOption.RecycleSingle) * AddLabel(50, 365, textHue, "Begin Recycling"); * * else if (context.RecycleOption == CraftRecycleOption.RecycleEverything) * AddLabel(50, 365, textHue, "Recycle Entire Backpack"); * * else * AddLabel(50, 365, textHue, "Recyle (Select Target Type)"); */ } //Repair Button if (craftSystem.Repair) { AddButton(15, 382, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0); AddLabel(50, 385, textHue, "Repair Item"); } //Exit Button AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0); AddLabel(50, 405, textHue, "Exit"); #endregion #region Right Side Button Controls //Material Selection if (craftSystem.CraftSubRes.Init) { string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex); Type resourceType = craftSystem.CraftSubRes.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } } AddButton(270, 342, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0); AddLabel(305, 345, textHue, nameString + " (" + resourceCount + " Available)"); } // Highlight Skillgain AddButton(270, 362, 4005, 4007, GetButtonID(6, 10), GumpButtonType.Reply, 0); if (context.HighlightSkillGainItems) { AddLabel(305, 365, highlightColor, "Highlight Skillgain Items"); } else { AddLabel(305, 365, textHue, "Do Not Highlight Skillgain Items"); } // Mark Button if (craftSystem.MarkOption) { AddButton(270, 382, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0); if (context == null) { AddLabel(305, 385, textHue, "Do Not Mark"); } else { switch (context.MarkOption) { case CraftMarkOption.DoNotMark: AddLabel(305, 385, textHue, "Do Not Mark"); break; case CraftMarkOption.MarkItem: AddLabel(305, 385, textHue, "Mark Item"); break; case CraftMarkOption.PromptForMark: AddLabel(305, 385, textHue, "Prompt For Mark"); break; } } } //Make Last AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0); AddLabel(305, 405, textHue, "Make Last Item"); #endregion if (notice is int && (int)notice > 0) { AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false); } CreateGroupList(); if (page == CraftPage.PickResource) { CreateResList(false, from); } else if (page == CraftPage.PickResource2) { CreateResList(true, from); } else if (context != null && context.LastGroupIndex > -1) { CreateItemList(context.LastGroupIndex); } }
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(50, 50) { m_From = from; m_CraftSystem = craftSystem; m_Tool = tool; m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); AddPage((int)CraftPage.None); AddBackground(0, 0, 530, 497, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 292, 150, 45, 2624); AddImageTiled(165, 292, 355, 45, 2624); AddImageTiled(10, 342, 510, 145, 2624); AddImageTiled(10, 37, 200, 250, 2624); AddImageTiled(215, 37, 305, 250, 2624); AddAlphaRegion(10, 10, 510, 497); if (craftSystem.GumpTitleNumber > 0) { AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, FontColor, false, false); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddHtmlLocalized(10, 302, 150, 25, 1044012, FontColor, false, false); // <CENTER>NOTICES</CENTER> AddButton(15, 442, 4017, 4019, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 445, 150, 18, 1011441, FontColor, false, false); // EXIT AddButton(270, 442, 4005, 4007, 1999, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 445, 150, 18, 1044013, FontColor, false, false); // MAKE LAST AddButton(115, 442, 4017, 4019, 12000, GumpButtonType.Reply, 0); AddHtmlLocalized(150, 445, 150, 18, 1112698, FontColor, false, false); // CANCEL MAKE // Resmelt option if (craftSystem.Resmelt) { AddButton(15, 342, 4005, 4007, 7000, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 345, 150, 18, 1044259, FontColor, false, false); // SMELT ITEM } // **************************************** // Repair option if (craftSystem.Repair) { AddButton(270, 342, 4005, 4007, 8000, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 345, 150, 18, 1044260, FontColor, false, false); // REPAIR ITEM } // **************************************** // Alter option if (craftSystem.Alter) { AddButton(270, 402, 4005, 4007, 9000, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 405, 300, 18, 1094726, FontColor, false, false); // ALTER ITEM (GARGOYLE) } // **************************************** AddHtmlLocalized(10, 37, 200, 22, 1044010, FontColor, false, false); // <CENTER>CATEGORIES</CENTER> CreateGroupList(); if (craftSystem.CraftSubRes.Init) { CreateResList(false); } if (craftSystem.CraftSubRes2.Init) { CreateResList(true); } AddPage(0); // Enhance option if (craftSystem.CanEnhance) { AddButton(270, 382, 4005, 4007, 2000, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 385, 150, 18, 1061001, FontColor, false, false); // ENHANCE ITEM } // **************************************** if (craftSystem.CraftSubRes2.Init) { AddButton(15, 382, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 10); } if (craftSystem.CraftSubRes.Init) { AddButton(15, 362, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 9); } if (context != null && context.LastGroupIndex > -1) { CreateItemList(context.LastGroupIndex); } // If the system has more than one resource if (craftSystem.CraftSubRes.Init) { AddPage(0); string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; int amount; int resIndex = (context == null ? -1 : context.LastResourceIndex); if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; amount = GetAmount(subResource.ItemType); } else { amount = GetAmount(craftSystem.CraftSubRes.ResType); } if (nameNumber > 0) { AddHtmlLocalized(50, 365, 170, 18, nameNumber, amount.ToString(), LabelColor, false, false); AddKRHtmlLocalized(50, 365, 170, 18, nameNumber, LabelColor, false, false); } else { AddLabel(50, 362, LabelHue, nameString); } AddPage(9); AddButton(220, 260, 4005, 4007, 3000, GumpButtonType.Reply, 0); AddHtmlLocalized(255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false); } // **************************************** // For dragon scales if (craftSystem.CraftSubRes2.Init) { AddPage(0); string nameString = craftSystem.CraftSubRes2.NameString; int nameNumber = craftSystem.CraftSubRes2.NameNumber; int amount; int resIndex = (context == null ? -1 : context.LastResourceIndex2); if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; amount = GetAmount(subResource.ItemType); } else { amount = GetAmount(craftSystem.CraftSubRes2.ResType); } if (nameNumber > 0) { AddHtmlLocalized(50, 385, 150, 18, nameNumber, amount.ToString(), LabelColor, false, false); AddKRHtmlLocalized(50, 385, 150, 18, nameNumber, LabelColor, false, false); } else { AddLabel(50, 385, LabelHue, nameString); } AddPage(10); AddButton(220, 260, 4005, 4007, 3001, GumpButtonType.Reply, 0); AddHtmlLocalized(255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false); } // **************************************** // Notice if (notice is int && (int)notice > 0) { AddPage(0); AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { AddPage(0); AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false); } // **************************************** // Mark option if (craftSystem.MarkOption) { AddPage(0); AddButton(270, 362, 4005, 4007, 6000, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false); // MARK ITEM if (context != null && context.MarkOption == CraftMarkOption.MarkItem) { AddKRButton(0, 0, 0, 0, 6001, GumpButtonType.Page, 0); } } // **************************************** // Quest Item option bool questItem = (context != null && context.QuestItem); AddPage(0); AddButton(270, 422, 0xFA5, 0xFA7, 6002, GumpButtonType.Reply, 0); AddHtmlLocalized(305, 425, 150, 18, questItem ? 1112534 : 1112533, LabelColor, false, false); // **************************************** if (context != null) { if (context.MakeLast) { AddKRButton(0, 0, 0, 0, 6003, GumpButtonType.Page, 0); } if (context.MakeNumber) { AddKRButton(0, 0, 0, 0, context.Total + 6100, GumpButtonType.Page, 0); } if (context.MakeMax) { AddKRButton(0, 0, 0, 0, 6005, GumpButtonType.Page, 0); } } if (context != null) { if (context.Success) { context.Done++; } int done = 0, total = 1; done = context.Done; total = context.Total; AddHtmlLocalized(270, 465, 200, 18, 1079443, String.Format("{0}@{1}", done, total), FontColor, false, false); // ~1_DONE~/~2_TOTAL~ COMPLETED if (context.Making != null && context.Success) { m_MakeTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.25), new TimerCallback(DoMake)); } context.Success = false; } }