public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40) { From = from; CraftSystem = craftSystem; CraftItem = craftItem; 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, 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(); DrawResource(); }
/// <summary> /// 加载工具 /// </summary> /// <param name="registerName"></param> public void UseTool(string registerName) { currentTool.UnLoadTool(); currentTool = registerTool[registerName]; currentTool.LoadTool(); }
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 static void BeginTarget(Mobile from, CraftSystem system, BaseTool tool) { from.Target = new AlterItemTarget(system, tool); from.SendLocalizedMessage(1094730); //Target the item to altar }
public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool) : base(100, 200) { from.CloseGump(typeof(QueryMakersMarkGump)); m_Quality = quality; m_From = from; m_CraftItem = craftItem; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; 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, 1011011, false, false); // CONTINUE AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0); }
/// <summary> /// 创建模型 /// </summary> /// <param name="tables">数据表</param> /// <param name="action">进度条委托</param> /// <returns>创建模型数量</returns> private int CreateModelIdentifierConversion(IEnumerable <Table> tables, Action action) { var pathList = new List <string>();//记录文件路径防止冲突 if (string.IsNullOrEmpty(_space)) { _space = "Default.Models"; } if (!BaseTool.IsValidPath(_path))//替换非法目录 { _path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Models"); } var ret = 0; var classNameList = new List <string>();//记录类名防止冲突 foreach (var table in tables) { var sb = new StringBuilder(); var sb1 = new StringBuilder(); var className = string.Empty; if (!string.IsNullOrEmpty(table.TableName)) { if (table.TableName.LastIndexOf('_') != -1) { className = table.TableName.Split('_').Where(str => !string.IsNullOrEmpty(str)).Aggregate(className, (current, str) => current + str.Substring(0, 1).ToUpper() + str.Substring(1).ToLower()); } else { className = table.TableName.Substring(0, 1).ToUpper() + table.TableName.Substring(1); } className = BaseTool.ReplaceIllegalCharacter(className); } else { className = "_"; } while (classNameList.Count(x => x.Equals(className)) > 0) { className = $"_{className}"; } classNameList.Add(className); sb.Append("using System;\r\nusing System.ComponentModel.DataAnnotations;\r\nusing System.ComponentModel.DataAnnotations.Schema;\r\n\r\nnamespace "); sb.Append(_space); sb.Append("\r\n{\r\n"); if (!string.IsNullOrEmpty(table.TableComment)) { sb.Append("\t/// <summary>\r\n"); sb.Append("\t/// ").Append(Regex.Replace(table.TableComment, @"[\r\n]", "")).Append("\r\n"); sb.Append("\t/// </summary>\r\n"); } sb.Append("\t[Table(\"").Append(table.TableName).Append("\")]\r\n"); //数据标记 sb.Append("\tpublic class "); sb.Append(className); sb.Append("\r\n\t{\r\n"); if (table.TableColumns.Length > 0) { sb.Append("\t\t#region Model\r\n"); var order = 0; //记录主键数量 var columnPropertieNameList = new List <string>(); //记录属性名称防止冲突 foreach (var column in table.TableColumns) { var propertieName = string.Empty; if (!string.IsNullOrEmpty(column.ColumnName)) { if (column.ColumnName.LastIndexOf('_') != -1) { propertieName = column.ColumnName.Split('_').Where(str => !string.IsNullOrEmpty(str)).Aggregate(propertieName, (current, str) => current + str.Substring(0, 1).ToUpper() + str.Substring(1).ToLower()); } else { propertieName = column.ColumnName.Substring(0, 1).ToUpper() + column.ColumnName.Substring(1); } propertieName = BaseTool.ReplaceIllegalCharacter(propertieName); } else { propertieName = "_"; } while (columnPropertieNameList.Count(x => x.Equals(propertieName)) > 0 || propertieName == className) { propertieName = $"_{propertieName}"; } columnPropertieNameList.Add(propertieName); if (!string.IsNullOrEmpty(column.Comments)) { sb.Append("\t\t/// <summary>\r\n"); sb.Append("\t\t/// ").Append(Regex.Replace(column.Comments, @"[\r\n]", "")).Append("\r\n"); sb.Append("\t\t/// </summary>\r\n"); } if (column.ConstraintType == "主键") { sb.Append("\t\t[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity), Column(\"").Append(column.ColumnName).Append("\", Order = ").Append(order).Append(")]\r\n"); order++; } else { sb.Append("\t\t[Column(\"").Append(column.ColumnName).Append("\")]\r\n"); //数据标记 } if (string.IsNullOrEmpty(column.DataType)) { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } else { switch (column.DataType.ToUpper()) { case "BIGINT": { sb.Append("\t\tpublic long? " + propertieName + "\r\n\t\t{\r\n"); } break; case "BINARY": { sb.Append("\t\tpublic byte? " + propertieName + "\r\n\t\t{\r\n"); } break; case "BIT": { sb.Append("\t\tpublic bool? " + propertieName + "\r\n\t\t{\r\n"); } break; case "CHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATE": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIME": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIME2": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIMEOFFSET": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DECIMAL": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "FILESTREAM": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "FLOAT": { sb.Append("\t\tpublic double? " + propertieName + "\r\n\t\t{\r\n"); } break; case "IMAGE": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "INT": { sb.Append("\t\tpublic int? " + propertieName + "\r\n\t\t{\r\n"); } break; case "MONEY": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "NCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "NTEXT": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "NUMERIC": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "NVARCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "REAL": { sb.Append("\t\tpublic float? " + propertieName + "\r\n\t\t{\r\n"); } break; case "ROWVERSION": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLDATETIME": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLINT": { sb.Append("\t\tpublic short? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLMONEY": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SQL_VARIANT": { sb.Append("\t\tpublic object " + propertieName + "\r\n\t\t{\r\n"); } break; case "TEXT": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "TIME": { sb.Append("\t\tpublic TimeSpan? " + propertieName + "\r\n\t\t{\r\n"); } break; case "TIMESTAMP": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "TINYINT": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "UNIQUEIDENTIFIER": { sb.Append("\t\tpublic Guid? " + propertieName + "\r\n\t\t{\r\n"); } break; case "VARBINARY": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "VARCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "XML": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; default: { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; } } sb.Append("\t\t\tset;\r\n"); sb.Append("\t\t\tget;\r\n"); sb.Append("\t\t}\r\n"); sb.Append("\r\n"); sb1.Append(propertieName); sb1.Append("=\" + "); sb1.Append(propertieName); sb1.Append(" + \","); } if (sb1.Length >= 5) { sb1.Remove(sb1.Length - 5, 5); } sb.Append("\t\tpublic override string ToString()\r\n"); sb.Append("\t\t{\r\n"); sb.Append("\t\t\treturn \""); sb.Append(sb1); sb.Append(";"); sb.Append("\r\n"); sb.Append("\t\t}\r\n"); sb.Append("\t\t#endregion Model\r\n"); } else { sb.Append("\r\n\r\n"); Loger.Debug($"表中不包含用户可见的列:表名 = {table.TableName}"); } sb.Append("\t}\r\n").Append("}"); var filePath = BaseTool.ReservedWordsReplace(Path.Combine(_path, $"{className}.cs")); while (pathList.Count(x => filePath == x) > 0) { filePath = $"_{filePath}"; } pathList.Add(filePath); if (WriteFile(filePath, sb.ToString())) { ret++; } action(); } return(ret); }
public CustomCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality) { m_From = from; m_CraftItem = craftItem; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; m_Quality = quality; }
public MakeNumberCraftPrompt(Mobile from, CraftSystem system, CraftItem item, BaseTool tool) { m_From = from; m_CraftSystem = system; m_CraftItem = item; m_Tool = tool; }
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); } }
static int EXTRA_CATS = 40;//extra space to add 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 + EXTRA_CATS, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 292 + EXTRA_CATS, 150, 45, 2624); //NOTICES BG AddImageTiled(165, 292 + EXTRA_CATS, 355, 45, 2624); //MSG AREA AddImageTiled(10, 342 + EXTRA_CATS, 510, 85, 2624); //large main sec bot AddImageTiled(10, 37, 200, 250 + EXTRA_CATS, 2624); // bg under the cats AddImageTiled(215, 37, 305, 250 + EXTRA_CATS, 2624); AddAlphaRegion(10, 10, 510, 417 + EXTRA_CATS); 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 + EXTRA_CATS, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER> AddButton(15, 402 + EXTRA_CATS, 4017, 4019, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 405 + EXTRA_CATS, 150, 18, 1011441, LabelColor, false, false); // EXIT AddButton(270, 402 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 405 + EXTRA_CATS, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST // Mark option if (craftSystem.MarkOption) { AddButton(270, 362 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 365 + EXTRA_CATS, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false); // MARK ITEM } // **************************************** // Resmelt option if (craftSystem.Resmelt) { AddButton(15, 342 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0); AddHtmlLocalized(50, 345 + EXTRA_CATS, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM } // **************************************** // Repair option if (craftSystem.Repair) { AddButton(270, 342 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 345 + EXTRA_CATS, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM } // **************************************** // Enhance option if (craftSystem.CanEnhance) { AddButton(270, 382 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 385 + EXTRA_CATS, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM } // **************************************** if (notice is int && (int)notice > 0) { AddHtmlLocalized(170, 295 + EXTRA_CATS, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { AddHtml(170, 295 + EXTRA_CATS, 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 + EXTRA_CATS, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0); if (nameNumber > 0) { AddHtmlLocalized(50, 365 + EXTRA_CATS, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { AddLabel(50, 362 + EXTRA_CATS, 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); } }
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 CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null ) * { * }*/ public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool, notice, CraftPage.None) { }
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. } }
public new int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { Quality = (WeaponQuality)quality; if (makersMark) { Crafter = from; } PlayerConstructed = true; if (Quality == WeaponQuality.Exceptional) { Attributes.WeaponDamage = 50; WeaponAttributes.HitHarm = 30; from.CheckSkill(SkillName.ArmsLore, 0, 100); } return(quality); }
public void SetToolByName(string toolName) { SelectedTool = ToolDictionary[toolName]; SelectedTool.CreateMode = true; }
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); }
/// <summary> /// 创建模型 /// </summary> /// <param name="tables">数据表</param> /// <param name="action">进度条委托</param> /// <returns>创建模型数量</returns> private int CreateModel(IEnumerable <Table> tables, Action action) { var pathList = new List <string>();//记录文件路径防止冲突 if (string.IsNullOrEmpty(_space)) { _space = "Default.Models"; } if (!BaseTool.IsValidPath(_path))//替换非法目录 { _path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Models"); } var ret = 0; var classNameList = new List <string>();//记录类名防止冲突 foreach (var table in tables) { var sb = new StringBuilder(); var sb1 = new StringBuilder(); var className = !string.IsNullOrEmpty(table.TableName) ? BaseTool.ReplaceIllegalCharacter(table.TableName) : "_"; while (classNameList.Count(x => x.Equals(className)) > 0) { className = $"_{className}"; } classNameList.Add(className); sb.Append("using System;\r\n\r\nnamespace "); sb.Append(_space); sb.Append("\r\n{\r\n"); if (!string.IsNullOrEmpty(table.TableComment)) { sb.Append("\t/// <summary>\r\n"); sb.Append("\t/// ").Append(Regex.Replace(table.TableComment, @"[\r\n]", "")).Append("\r\n"); sb.Append("\t/// </summary>\r\n"); } sb.Append("\tpublic class "); sb.Append(className); sb.Append("\r\n\t{\r\n"); if (table.TableColumns.Length > 0) { sb.Append("\t\t#region Model\r\n"); var columnPropertieNameList = new List <string>();//记录属性名称防止冲突 foreach (var column in table.TableColumns) { var propertieName = !string.IsNullOrEmpty(column.ColumnName) ? BaseTool.ReplaceIllegalCharacter(column.ColumnName) : "_"; while (columnPropertieNameList.Count(x => x.Equals(propertieName)) > 0 || propertieName == className) { propertieName = $"_{propertieName}"; } columnPropertieNameList.Add(propertieName); if (!string.IsNullOrEmpty(column.Comments)) { sb.Append("\t\t/// <summary>\r\n"); sb.Append("\t\t/// ").Append(Regex.Replace(column.Comments, @"[\r\n]", "")).Append("\r\n"); sb.Append("\t\t/// </summary>\r\n"); } if (string.IsNullOrEmpty(column.DataType)) { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } else { switch (column.DataType.ToUpper()) { case "BIGINT": { sb.Append("\t\tpublic long? " + propertieName + "\r\n\t\t{\r\n"); } break; case "BINARY": { sb.Append("\t\tpublic byte? " + propertieName + "\r\n\t\t{\r\n"); } break; case "BIT": { sb.Append("\t\tpublic bool? " + propertieName + "\r\n\t\t{\r\n"); } break; case "CHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATE": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIME": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIME2": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DATETIMEOFFSET": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "DECIMAL": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "FILESTREAM": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "FLOAT": { sb.Append("\t\tpublic double? " + propertieName + "\r\n\t\t{\r\n"); } break; case "IMAGE": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "INT": { sb.Append("\t\tpublic int? " + propertieName + "\r\n\t\t{\r\n"); } break; case "MONEY": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "NCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "NTEXT": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "NUMERIC": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "NVARCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "REAL": { sb.Append("\t\tpublic float? " + propertieName + "\r\n\t\t{\r\n"); } break; case "ROWVERSION": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLDATETIME": { sb.Append("\t\tpublic DateTime? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLINT": { sb.Append("\t\tpublic short? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SMALLMONEY": { sb.Append("\t\tpublic decimal? " + propertieName + "\r\n\t\t{\r\n"); } break; case "SQL_VARIANT": { sb.Append("\t\tpublic object " + propertieName + "\r\n\t\t{\r\n"); } break; case "TEXT": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "TIME": { sb.Append("\t\tpublic TimeSpan? " + propertieName + "\r\n\t\t{\r\n"); } break; case "TIMESTAMP": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "TINYINT": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "UNIQUEIDENTIFIER": { sb.Append("\t\tpublic Guid? " + propertieName + "\r\n\t\t{\r\n"); } break; case "VARBINARY": { sb.Append("\t\tpublic byte[] " + propertieName + "\r\n\t\t{\r\n"); } break; case "VARCHAR": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; case "XML": { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; default: { sb.Append("\t\tpublic string " + propertieName + "\r\n\t\t{\r\n"); } break; } } sb.Append("\t\t\tset;\r\n"); sb.Append("\t\t\tget;\r\n"); sb.Append("\t\t}\r\n"); sb.Append("\r\n"); sb1.Append(propertieName); sb1.Append("=\" + "); sb1.Append(propertieName); sb1.Append(" + \","); } if (sb1.Length >= 5) { sb1.Remove(sb1.Length - 5, 5); } sb.Append("\t\tpublic override string ToString()\r\n"); sb.Append("\t\t{\r\n"); sb.Append("\t\t\treturn \""); sb.Append(sb1); sb.Append(";"); sb.Append("\r\n"); sb.Append("\t\t}\r\n"); sb.Append("\t\t#endregion Model\r\n"); } else { sb.Append("\r\n\r\n"); Loger.Debug($"表中不包含用户可见的列:表名 = {table.TableName}"); } sb.Append("\t}\r\n").Append("}"); var filePath = BaseTool.ReservedWordsReplace(Path.Combine(_path, $"{className}.cs")); while (pathList.Count(x => filePath == x) > 0) { filePath = $"_{filePath}"; } pathList.Add(filePath); if (WriteFile(filePath, sb.ToString())) { ret++; } action(); } return(ret); }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue) { ItemID = 0x14F0; Faction = Faction.Find(from); return(1); }
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) { 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 (IsSpecial(item, craftSystem)) { craftItem = craftSystem.CraftItems.SearchForSubclass(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 abstract int CanCraft(Mobile from, BaseTool tool, Type itemType);
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, BaseTool tool) : base(1, false, TargetFlags.None) { this.m_System = system; this.m_Tool = tool; }
public void AddTool(BaseTool tool) { ToolDictionary.Add(tool.Name, tool); }
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 void UnselectTool() { SelectedTool = null; }
public InternalTarget(CraftSystem craftSystem, BaseTool tool) : base(2, false, TargetFlags.None) { m_CraftSystem = craftSystem; m_Tool = tool; }
public void SetTool(BaseTool tool) { SelectedTool = tool; }
public InternalTimer( Mobile from, CraftSystem craftSystem, CraftItem craftItem, Type typeRes, BaseTool tool, int iCountMax ) : base(TimeSpan.Zero, TimeSpan.FromSeconds(craftSystem.Delay), iCountMax) { m_From = from; m_CraftItem = craftItem; m_iCount = 0; m_iCountMax = iCountMax; m_CraftSystem = craftSystem; m_TypeRes = typeRes; m_Tool = tool; }
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40) { m_From = from; m_CraftSystem = craftSystem; m_Tool = tool; m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump <CraftGump>(); from.CloseGump <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); } else { AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString); } AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor); // <CENTER>CATEGORIES</CENTER> AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor); // <CENTER>SELECTIONS</CENTER> AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor); // <CENTER>NOTICES</CENTER> AddButton(15, 402, 4017, 4019, 0); AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor); // EXIT AddButton(270, 402, 4005, 4007, GetButtonID(6, 2)); AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor); // MAKE LAST // Mark option if (craftSystem.MarkOption) { AddButton(270, 362, 4005, 4007, GetButtonID(6, 6)); AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor); // MARK ITEM } // **************************************** // Resmelt option if (craftSystem.Resmelt) { AddButton(15, 342, 4005, 4007, GetButtonID(6, 1)); AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor); // SMELT ITEM } // **************************************** // Repair option if (craftSystem.Repair) { AddButton(270, 342, 4005, 4007, GetButtonID(6, 5)); AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor); // REPAIR ITEM } // **************************************** // Enhance option if (craftSystem.CanEnhance) { AddButton(270, 382, 4005, 4007, GetButtonID(6, 8)); AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor); // ENHANCE ITEM } // **************************************** if (notice is int noticeInt && noticeInt > 0) { AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor); }