protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item item) { object message = null; EnhanceResult res = Enhance.Invoke(from, m_CraftSystem, m_Tool, item, m_Resource, m_ResourceType, ref message); switch (res) { case EnhanceResult.NotInBackpack: message = 1061005; break; // The item must be in your backpack to enhance it. case EnhanceResult.Transmogrified: message = 1159564; break; // You cannot enhance a transmogrified item. case EnhanceResult.AlreadyEnhanced: message = 1061012; break; // This item is already enhanced with the properties of a special material. case EnhanceResult.BadItem: message = 1061011; break; // You cannot enhance this type of item with the properties of the selected special material. case EnhanceResult.BadResource: message = 1061010; break; // You must select a special material in order to enhance an item with its properties. case EnhanceResult.Broken: message = 1061080; break; // You attempt to enhance the item, but fail catastrophically. The item is lost. case EnhanceResult.Failure: message = 1061082; break; // You attempt to enhance the item, but fail. Some material is lost in the process. case EnhanceResult.Success: message = 1061008; break; // You enhance the item with the properties of the special material. case EnhanceResult.NoSkill: message = 1044153; break; // You don't have the required skills to attempt this item. case EnhanceResult.Enchanted: message = 1080131; break; // You cannot enhance an item that is currently enchanted. } from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, message)); } }
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; } ArrayList lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { CraftItem((CraftItem)lastTen[index]); } break; } case 4: // Item details (last 10) { if (context == null) { break; } ArrayList lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { m_From.SendGump(new CraftGumpItem(m_From, system, (CraftItem)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 override void OnResponse(NetState 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 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 = this.m_CraftSystem; CraftGroupCol groups = system.CraftGroups; CraftContext context = system.GetContext(this.m_From); #region Stygian Abyss if (Locked) { if (type == 6 && index == 11) { // Cancel Make AutoCraftTimer.EndTimer(m_From); } return; } #endregion switch (type) { case 0: // Show group { if (context == null) { break; } if (index >= 0 && index < groups.Count) { context.LastGroupIndex = index; this.m_From.SendGump(new CraftGump(this.m_From, system, this.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) { this.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) { this.m_From.SendGump(new CraftGumpItem(this.m_From, system, group.CraftItems.GetAt(index), this.m_Tool)); } } break; } case 3: // Create item (last 10) { if (context == null) { break; } List <CraftItem> lastTen = context.Items; if (index >= 0 && index < lastTen.Count) { this.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) { this.m_From.SendGump(new CraftGumpItem(this.m_From, system, lastTen[index], this.m_Tool)); } break; } case 5: // Resource selected { if (this.m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes.GetAt(index); if (this.m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex = index; } this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, null)); } } else if (this.m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count) { int groupIndex = (context == null ? -1 : context.LastGroupIndex); CraftSubRes res = system.CraftSubRes2.GetAt(index); if (this.m_From.Skills[system.MainSkill].Base < res.RequiredSkill) { this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, res.Message)); } else { if (context != null) { context.LastResourceIndex2 = index; } this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, null)); } } break; } case 6: // Misc. buttons { switch (index) { case 0: // Resource selection { if (system.CraftSubRes.Init) { this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, null, CraftPage.PickResource)); } break; } case 1: // Smelt item { if (system.Resmelt) { Resmelt.Do(this.m_From, system, this.m_Tool); } break; } case 2: // Make last { if (context == null) { break; } CraftItem item = context.LastMade; if (item != null) { this.CraftItem(item); } else { this.m_From.SendGump(new CraftGump(this.m_From, this.m_CraftSystem, this.m_Tool, 1044165, this.m_Page)); // You haven't made anything yet. } break; } case 3: // Last 10 { if (context == null) { break; } context.LastGroupIndex = 501; this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, null)); break; } case 4: // Toggle use resource hue { if (context == null) { break; } context.DoNotColor = !context.DoNotColor; this.m_From.SendGump(new CraftGump(this.m_From, this.m_CraftSystem, this.m_Tool, null, this.m_Page)); break; } case 5: // Repair item { if (system.Repair) { Repair.Do(this.m_From, system, this.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; } this.m_From.SendGump(new CraftGump(this.m_From, this.m_CraftSystem, this.m_Tool, null, this.m_Page)); break; } case 7: // Resource selection 2 { if (system.CraftSubRes2.Init) { this.m_From.SendGump(new CraftGump(this.m_From, system, this.m_Tool, null, CraftPage.PickResource2)); } break; } case 8: // Enhance item { if (system.CanEnhance) { Enhance.BeginTarget(this.m_From, system, this.m_Tool); } break; } #region Stygian Abyss case 9: // Alter Item (Gargoyle) { if (system.CanAlter) { if (Server.SkillHandlers.Imbuing.CheckSoulForge(m_From, 1, false)) { AlterItem.BeginTarget(this.m_From, system, this.m_Tool); } else { m_From.SendLocalizedMessage(1111867); // You must be near a soulforge to alter an item. } } break; } case 10: // Quest Item/Non Quest Item toggle { //if (context == null || !system.QuestOption) //break; switch (context.QuestOption) { case CraftQuestOption.QuestItem: context.QuestOption = CraftQuestOption.NonQuestItem; break; case CraftQuestOption.NonQuestItem: context.QuestOption = CraftQuestOption.QuestItem; break; } this.m_From.SendGump(new CraftGump(this.m_From, this.m_CraftSystem, this.m_Tool, null, this.m_Page)); break; } case 11: // Cancel Make { AutoCraftTimer.EndTimer(m_From); break; } #endregion } break; } } }
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); //I ADDED if (context != null) { context.Count = 0; context.TotalCount = 0; TextRelay text = info.GetTextEntry(100); if (text.Text != null) { string keywordstring = text.Text; string[] keywords = keywordstring.Split(' '); if (keywords.Length > 0) { string keyword = keywords[0]; try { int value; if (Int32.TryParse(keyword, out value)) { if (value > 0) { context.TotalCount = value; } } } catch { } } } } //I ADDED 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; } //I ADDED case 11: // LOOP { if (context == null) { break; } context.AutoLoop = (!context.AutoLoop); m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, null, m_Page)); break; } //I ADDED } break; } } }