Code cleanup (#188)
This commit is contained in:
parent
df53c16620
commit
010fd9402a
185 changed files with 1052 additions and 1271 deletions
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public static class CraftCollectionExtensions
|
||||
{
|
||||
public static int SearchFor(this List<CraftGroup> list, TextDefinition groupName)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = list[i];
|
||||
|
||||
int nameNumber = craftGroup.NameNumber;
|
||||
string nameString = craftGroup.NameString;
|
||||
|
||||
if (nameNumber != 0 && nameNumber == groupName.Number ||
|
||||
nameString != null && nameString == groupName.String)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static CraftItem SearchForSubclass(this List<CraftItem> list, Type type)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
CraftItem craftItem = list[i];
|
||||
|
||||
if (craftItem.ItemType == type || type.IsSubclassOf(craftItem.ItemType))
|
||||
return craftItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CraftItem SearchFor(this List<CraftItem> list, Type type)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
CraftItem craftItem = list[i];
|
||||
if (craftItem.ItemType == type) return craftItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGroup
|
||||
|
|
@ -6,10 +8,10 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
NameNumber = groupName;
|
||||
NameString = groupName;
|
||||
CraftItems = new CraftItemCol();
|
||||
CraftItems = new List<CraftItem>();
|
||||
}
|
||||
|
||||
public CraftItemCol CraftItems { get; }
|
||||
public List<CraftItem> CraftItems { get; }
|
||||
|
||||
public string NameString { get; }
|
||||
|
||||
|
|
@ -20,4 +22,4 @@ namespace Server.Engines.Craft
|
|||
CraftItems.Add(craftItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGroupCol : CollectionBase
|
||||
{
|
||||
public int Add(CraftGroup craftGroup) => List.Add(craftGroup);
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
if (index > Count - 1 || index < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftGroup GetAt(int index) => (CraftGroup)List[index];
|
||||
|
||||
public int SearchFor(TextDefinition groupName)
|
||||
{
|
||||
for (int i = 0; i < List.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = (CraftGroup)List[i];
|
||||
|
||||
int nameNumber = craftGroup.NameNumber;
|
||||
string nameString = craftGroup.NameString;
|
||||
|
||||
if ((nameNumber != 0 && nameNumber == groupName.Number) ||
|
||||
(nameString != null && nameString == groupName.String))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
int index = i % 10;
|
||||
|
||||
CraftSubRes subResource = res.GetAt(i);
|
||||
CraftSubRes subResource = res[i];
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
|
|
@ -279,15 +279,14 @@ namespace Server.Engines.Craft
|
|||
return;
|
||||
}
|
||||
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt(selectedGroup);
|
||||
CraftItemCol craftItemCol = craftGroup.CraftItems;
|
||||
CraftGroup craftGroup = m_CraftSystem.CraftGroups[selectedGroup];
|
||||
List<CraftItem> craftItemCol = craftGroup.CraftItems;
|
||||
|
||||
for (int i = 0; i < craftItemCol.Count; ++i)
|
||||
{
|
||||
int index = i % 10;
|
||||
|
||||
CraftItem craftItem = craftItemCol.GetAt(i);
|
||||
CraftItem craftItem = craftItemCol[i];
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
|
|
@ -319,14 +318,14 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int CreateGroupList()
|
||||
{
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
List<CraftGroup> craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3));
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor); // LAST TEN
|
||||
|
||||
for (int i = 0; i < craftGroupCol.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt(i);
|
||||
CraftGroup craftGroup = craftGroupCol[i];
|
||||
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i));
|
||||
|
||||
|
|
@ -378,7 +377,7 @@ namespace Server.Engines.Craft
|
|||
int index = buttonID / 7;
|
||||
|
||||
CraftSystem system = m_CraftSystem;
|
||||
CraftGroupCol groups = system.CraftGroups;
|
||||
List<CraftGroup> groups = system.CraftGroups;
|
||||
CraftContext context = system.GetContext(m_From);
|
||||
|
||||
switch (type)
|
||||
|
|
@ -405,10 +404,10 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (groupIndex >= 0 && groupIndex < groups.Count)
|
||||
{
|
||||
CraftGroup group = groups.GetAt(groupIndex);
|
||||
CraftGroup group = groups[groupIndex];
|
||||
|
||||
if (index >= 0 && index < group.CraftItems.Count)
|
||||
CraftItem(group.CraftItems.GetAt(index));
|
||||
CraftItem(group.CraftItems[index]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -422,10 +421,10 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (groupIndex >= 0 && groupIndex < groups.Count)
|
||||
{
|
||||
CraftGroup group = groups.GetAt(groupIndex);
|
||||
CraftGroup group = groups[groupIndex];
|
||||
|
||||
if (index >= 0 && index < group.CraftItems.Count)
|
||||
m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems.GetAt(index), m_Tool));
|
||||
m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems[index], m_Tool));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
for (int i = 0; i < m_CraftItem.Skills.Count; i++)
|
||||
{
|
||||
CraftSkill skill = m_CraftItem.Skills.GetAt(i);
|
||||
CraftSkill skill = m_CraftItem.Skills[i];
|
||||
double minSkill = skill.MinSkill;
|
||||
|
||||
if (minSkill < 0)
|
||||
|
|
@ -191,7 +191,7 @@ namespace Server.Engines.Craft
|
|||
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||
|
||||
bool cropScroll = m_CraftItem.Resources.Count > 1
|
||||
&& m_CraftItem.Resources.GetAt(m_CraftItem.Resources.Count - 1).ItemType == typeofBlankScroll
|
||||
&& m_CraftItem.Resources[^1].ItemType == typeofBlankScroll
|
||||
&& typeofSpellScroll.IsAssignableFrom(m_CraftItem.ItemType);
|
||||
|
||||
for (int i = 0; i < m_CraftItem.Resources.Count - (cropScroll ? 1 : 0) && i < 4; i++)
|
||||
|
|
@ -200,7 +200,7 @@ namespace Server.Engines.Craft
|
|||
string nameString;
|
||||
int nameNumber;
|
||||
|
||||
CraftRes craftResource = m_CraftItem.Resources.GetAt(i);
|
||||
CraftRes craftResource = m_CraftItem.Resources[i];
|
||||
|
||||
type = craftResource.ItemType;
|
||||
nameString = craftResource.NameString;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ namespace Server.Engines.Craft
|
|||
|
||||
public CraftItem(Type type, TextDefinition groupName, TextDefinition name)
|
||||
{
|
||||
Resources = new CraftResCol();
|
||||
Skills = new CraftSkillCol();
|
||||
Resources = new List<CraftRes>();
|
||||
Skills = new List<CraftSkill>();
|
||||
|
||||
ItemType = type;
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int NameNumber { get; }
|
||||
|
||||
public CraftResCol Resources { get; }
|
||||
public List<CraftRes> Resources { get; }
|
||||
|
||||
public CraftSkillCol Skills { get; }
|
||||
public List<CraftSkill> Skills { get; }
|
||||
|
||||
public void AddRecipe(int id, CraftSystem system)
|
||||
{
|
||||
|
|
@ -452,7 +452,7 @@ namespace Server.Engines.Craft
|
|||
CraftRes res;
|
||||
for (int i = 0; i < types.Length; ++i)
|
||||
{
|
||||
CraftRes craftRes = Resources.GetAt(i);
|
||||
CraftRes craftRes = Resources[i];
|
||||
Type baseType = craftRes.ItemType;
|
||||
|
||||
// Resource Mutation
|
||||
|
|
@ -490,7 +490,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (maxAmount == 0)
|
||||
{
|
||||
res = Resources.GetAt(i);
|
||||
res = Resources[i];
|
||||
|
||||
if (res.MessageNumber > 0)
|
||||
message = res.MessageNumber;
|
||||
|
|
@ -599,7 +599,7 @@ namespace Server.Engines.Craft
|
|||
return true;
|
||||
}
|
||||
|
||||
res = Resources.GetAt(index);
|
||||
res = Resources[index];
|
||||
|
||||
if (res.MessageNumber > 0)
|
||||
message = res.MessageNumber;
|
||||
|
|
@ -692,7 +692,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
for (int i = 0; i < Skills.Count; i++)
|
||||
{
|
||||
CraftSkill craftSkill = Skills.GetAt(i);
|
||||
CraftSkill craftSkill = Skills[i];
|
||||
|
||||
double minSkill = craftSkill.MinSkill;
|
||||
double maxSkill = craftSkill.MaxSkill;
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftItemCol : CollectionBase
|
||||
{
|
||||
public int Add(CraftItem craftItem) => List.Add(craftItem);
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
if (index > Count - 1 || index < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftItem GetAt(int index) => (CraftItem)List[index];
|
||||
|
||||
public CraftItem SearchForSubclass(Type type)
|
||||
{
|
||||
for (int i = 0; i < List.Count; i++)
|
||||
{
|
||||
CraftItem craftItem = (CraftItem)List[i];
|
||||
|
||||
if (craftItem.ItemType == type || type.IsSubclassOf(craftItem.ItemType))
|
||||
return craftItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CraftItem SearchFor(Type type)
|
||||
{
|
||||
for (int i = 0; i < List.Count; i++)
|
||||
{
|
||||
CraftItem craftItem = (CraftItem)List[i];
|
||||
if (craftItem.ItemType == type) return craftItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftResCol : CollectionBase
|
||||
{
|
||||
public void Add(CraftRes craftRes)
|
||||
{
|
||||
List.Add(craftRes);
|
||||
}
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
if (index > Count - 1 || index < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftRes GetAt(int index) => (CraftRes)List[index];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSkillCol : CollectionBase
|
||||
{
|
||||
public void Add(CraftSkill craftSkill)
|
||||
{
|
||||
List.Add(craftSkill);
|
||||
}
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
if (index > Count - 1 || index < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftSkill GetAt(int index) => (CraftSkill)List[index];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSubResCol : CollectionBase
|
||||
public class CraftSubResCol : List<CraftSubRes>
|
||||
{
|
||||
public CraftSubResCol() => Init = false;
|
||||
|
||||
|
|
@ -15,33 +15,17 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int NameNumber { get; set; }
|
||||
|
||||
public void Add(CraftSubRes craftSubRes)
|
||||
{
|
||||
List.Add(craftSubRes);
|
||||
}
|
||||
|
||||
public void Remove(int index)
|
||||
{
|
||||
if (index > Count - 1 || index < 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftSubRes GetAt(int index) => (CraftSubRes)List[index];
|
||||
public CraftSubRes GetAt(int index) => this[index];
|
||||
|
||||
public CraftSubRes SearchFor(Type type)
|
||||
{
|
||||
for (int i = 0; i < List.Count; i++)
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
CraftSubRes craftSubRes = (CraftSubRes)List[i];
|
||||
CraftSubRes craftSubRes = this[i];
|
||||
if (craftSubRes.ItemType == type) return craftSubRes;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ namespace Server.Engines.Craft
|
|||
MaxCraftEffect = maxCraftEffect;
|
||||
Delay = delay;
|
||||
|
||||
CraftItems = new CraftItemCol();
|
||||
CraftGroups = new CraftGroupCol();
|
||||
CraftItems = new List<CraftItem>();
|
||||
CraftGroups = new List<CraftGroup>();
|
||||
CraftSubRes = new CraftSubResCol();
|
||||
CraftSubRes2 = new CraftSubResCol();
|
||||
|
||||
|
|
@ -40,9 +40,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
public double Delay { get; }
|
||||
|
||||
public CraftItemCol CraftItems { get; }
|
||||
public List<CraftItem> CraftItems { get; }
|
||||
|
||||
public CraftGroupCol CraftGroups { get; }
|
||||
public List<CraftGroup> CraftGroups { get; }
|
||||
|
||||
public CraftSubResCol CraftSubRes { get; }
|
||||
|
||||
|
|
@ -134,7 +134,8 @@ namespace Server.Engines.Craft
|
|||
craftItem.AddSkill(skillToMake, minSkill, maxSkill);
|
||||
|
||||
DoGroup(group, craftItem);
|
||||
return CraftItems.Add(craftItem);
|
||||
CraftItems.Add(craftItem);
|
||||
return CraftItems.Count - 1;
|
||||
}
|
||||
|
||||
private void DoGroup(TextDefinition groupName, CraftItem craftItem)
|
||||
|
|
@ -149,68 +150,58 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else
|
||||
{
|
||||
CraftGroups.GetAt(index).AddCraftItem(craftItem);
|
||||
CraftGroups[index].AddCraftItem(craftItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetItemHue(int index, int hue)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.ItemHue = hue;
|
||||
CraftItems[index].ItemHue = hue;
|
||||
}
|
||||
|
||||
public void SetManaReq(int index, int mana)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.Mana = mana;
|
||||
CraftItems[index].Mana = mana;
|
||||
}
|
||||
|
||||
public void SetStamReq(int index, int stam)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.Stam = stam;
|
||||
CraftItems[index].Stam = stam;
|
||||
}
|
||||
|
||||
public void SetHitsReq(int index, int hits)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.Hits = hits;
|
||||
CraftItems[index].Hits = hits;
|
||||
}
|
||||
|
||||
public void SetUseAllRes(int index, bool useAll)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.UseAllRes = useAll;
|
||||
CraftItems[index].UseAllRes = useAll;
|
||||
}
|
||||
|
||||
public void SetNeedHeat(int index, bool needHeat)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.NeedHeat = needHeat;
|
||||
CraftItems[index].NeedHeat = needHeat;
|
||||
}
|
||||
|
||||
public void SetNeedOven(int index, bool needOven)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.NeedOven = needOven;
|
||||
CraftItems[index].NeedOven = needOven;
|
||||
}
|
||||
|
||||
public void SetBeverageType(int index, BeverageType requiredBeverage)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.RequiredBeverage = requiredBeverage;
|
||||
CraftItems[index].RequiredBeverage = requiredBeverage;
|
||||
}
|
||||
|
||||
public void SetNeedMill(int index, bool needMill)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.NeedMill = needMill;
|
||||
CraftItems[index].NeedMill = needMill;
|
||||
}
|
||||
|
||||
public void SetNeededExpansion(int index, Expansion expansion)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.RequiredExpansion = expansion;
|
||||
CraftItems[index].RequiredExpansion = expansion;
|
||||
}
|
||||
|
||||
public void AddRes(int index, Type type, TextDefinition name, int amount)
|
||||
|
|
@ -220,26 +211,22 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void AddRes(int index, Type type, TextDefinition name, int amount, TextDefinition message)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.AddRes(type, name, amount, message);
|
||||
CraftItems[index].AddRes(type, name, amount, message);
|
||||
}
|
||||
|
||||
public void AddSkill(int index, SkillName skillToMake, double minSkill, double maxSkill)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.AddSkill(skillToMake, minSkill, maxSkill);
|
||||
CraftItems[index].AddSkill(skillToMake, minSkill, maxSkill);
|
||||
}
|
||||
|
||||
public void SetUseSubRes2(int index, bool val)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.UseSubRes2 = val;
|
||||
CraftItems[index].UseSubRes2 = val;
|
||||
}
|
||||
|
||||
private void AddRecipeBase(int index, int id)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.AddRecipe(id, this);
|
||||
CraftItems[index].AddRecipe(id, this);
|
||||
}
|
||||
|
||||
public void AddRecipe(int index, int id)
|
||||
|
|
@ -261,8 +248,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public void ForceNonExceptional(int index)
|
||||
{
|
||||
CraftItem craftItem = CraftItems.GetAt(index);
|
||||
craftItem.ForceNonExceptional = true;
|
||||
CraftItems[index].ForceNonExceptional = true;
|
||||
}
|
||||
|
||||
public void SetSubRes(Type type, string name)
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ namespace Server.Engines.Craft
|
|||
foreach (KeyValuePair<int, Recipe> kvp in Recipes)
|
||||
mobile.AcquireRecipe(kvp.Key);
|
||||
|
||||
m.SendMessage("You teach them all of the recipes.");
|
||||
from.SendMessage("You teach them all of the recipes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("That is not a player!");
|
||||
from.SendMessage("That is not a player!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -70,17 +70,17 @@ namespace Server.Engines.Craft
|
|||
Mobile m = e.Mobile;
|
||||
m.SendMessage("Target a player to have them forget all of the recipes they've learned.");
|
||||
|
||||
m.BeginTarget(-1, false, TargetFlags.None, delegate(Mobile from, object targeted)
|
||||
m.BeginTarget(-1, false, TargetFlags.None, (from, targeted) =>
|
||||
{
|
||||
if (targeted is PlayerMobile mobile)
|
||||
{
|
||||
mobile.ResetRecipes();
|
||||
|
||||
m.SendMessage("They forget all their recipes.");
|
||||
from.SendMessage("They forget all their recipes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("That is not a player!");
|
||||
from.SendMessage("That is not a player!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Server.Engines.Craft
|
|||
NoSkill
|
||||
}
|
||||
|
||||
public class Resmelt
|
||||
public static class Resmelt
|
||||
{
|
||||
public static void Do(Mobile from, CraftSystem craftSystem, BaseTool tool)
|
||||
{
|
||||
|
|
@ -61,7 +61,7 @@ namespace Server.Engines.Craft
|
|||
if (craftItem == null || craftItem.Resources.Count == 0)
|
||||
return SmeltResult.Invalid;
|
||||
|
||||
CraftRes craftResource = craftItem.Resources.GetAt(0);
|
||||
CraftRes craftResource = craftItem.Resources[0];
|
||||
|
||||
if (craftResource.Amount < 2)
|
||||
return SmeltResult.Invalid; // Not enough metal to resmelt
|
||||
|
|
@ -85,9 +85,9 @@ namespace Server.Engines.Craft
|
|||
Type resourceType = info.ResourceTypes[0];
|
||||
Item ingot = (Item)ActivatorUtil.CreateInstance(resourceType);
|
||||
|
||||
if (item is DragonBardingDeed || (item is BaseArmor armor && armor.PlayerConstructed) ||
|
||||
(item is BaseWeapon weapon && weapon.PlayerConstructed) ||
|
||||
(item is BaseClothing clothing && clothing.PlayerConstructed))
|
||||
if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed ||
|
||||
item is BaseWeapon weapon && weapon.PlayerConstructed ||
|
||||
item is BaseClothing clothing && clothing.PlayerConstructed)
|
||||
ingot.Amount = craftResource.Amount / 2;
|
||||
else
|
||||
ingot.Amount = 1;
|
||||
|
|
@ -144,7 +144,6 @@ namespace Server.Engines.Craft
|
|||
else if (targeted is DragonBardingDeed deed)
|
||||
{
|
||||
result = Resmelt(from, deed, deed.Resource);
|
||||
isStoreBought = false;
|
||||
}
|
||||
|
||||
message = result switch
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue