Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -19,17 +19,17 @@ namespace Server.Engines.Craft
LastGroupIndex = -1;
}
public List<CraftItem> Items{ get; }
public List<CraftItem> Items { get; }
public int LastResourceIndex{ get; set; }
public int LastResourceIndex { get; set; }
public int LastResourceIndex2{ get; set; }
public int LastResourceIndex2 { get; set; }
public int LastGroupIndex{ get; set; }
public int LastGroupIndex { get; set; }
public bool DoNotColor{ get; set; }
public bool DoNotColor { get; set; }
public CraftMarkOption MarkOption{ get; set; }
public CraftMarkOption MarkOption { get; set; }
public CraftItem LastMade
{

View file

@ -9,11 +9,11 @@ namespace Server.Engines.Craft
CraftItems = new CraftItemCol();
}
public CraftItemCol CraftItems{ get; }
public CraftItemCol CraftItems { get; }
public string NameString{ get; }
public string NameString { get; }
public int NameNumber{ get; }
public int NameNumber { get; }
public void AddCraftItem(CraftItem craftItem)
{

View file

@ -28,8 +28,8 @@ namespace Server.Engines.Craft
int nameNumber = craftGroup.NameNumber;
string nameString = craftGroup.NameString;
if (nameNumber != 0 && nameNumber == groupName.Number ||
nameString != null && nameString == groupName.String)
if ((nameNumber != 0 && nameNumber == groupName.Number) ||
(nameString != null && nameString == groupName.String))
return i;
}

View file

@ -11,11 +11,11 @@ namespace Server.Engines.Craft
private const int LabelHue = 0x480;
private const int LabelColor = 0x7FFF;
private const int FontColor = 0xFFFFFF;
private CraftSystem m_CraftSystem;
private Mobile m_From;
private readonly CraftSystem m_CraftSystem;
private readonly Mobile m_From;
private CraftPage m_Page;
private BaseTool m_Tool;
private readonly CraftPage m_Page;
private readonly BaseTool m_Tool;
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40)
{
@ -384,209 +384,209 @@ namespace Server.Engines.Craft
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));
}
if (context == null)
break;
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 (context == null)
break;
if (index >= 0 && index < group.CraftItems.Count)
CraftItem(group.CraftItems.GetAt(index));
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;
}
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 (context == null)
break;
if (index >= 0 && index < group.CraftItems.Count)
m_From.SendGump(new CraftGumpItem(m_From, system, group.CraftItems.GetAt(index), m_Tool));
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;
}
break;
}
case 3: // Create item (last 10)
{
if (context == null)
{
if (context == null)
break;
List<CraftItem> lastTen = context.Items;
if (index >= 0 && index < lastTen.Count)
CraftItem(lastTen[index]);
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)
{
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;
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)
{
CraftSubRes res = system.CraftSubRes.GetAt(index);
if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)
if (m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count)
{
m_From.SendGump(new CraftGump(m_From, system, m_Tool, res.Message));
}
else
{
if (context != null)
context.LastResourceIndex = index;
CraftSubRes res = system.CraftSubRes.GetAt(index);
m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));
}
}
else if (m_Page == CraftPage.PickResource2 && 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 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;
context.MarkOption = context.MarkOption switch
if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)
{
CraftMarkOption.MarkItem => CraftMarkOption.DoNotMark,
CraftMarkOption.DoNotMark => CraftMarkOption.PromptForMark,
CraftMarkOption.PromptForMark => CraftMarkOption.MarkItem,
_ => context.MarkOption
};
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, m_CraftSystem, m_Tool, null, m_Page));
break;
m_From.SendGump(new CraftGump(m_From, system, m_Tool, null));
}
}
case 7: // Resource selection 2
else if (m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count)
{
if (system.CraftSubRes2.Init)
m_From.SendGump(new CraftGump(m_From, system, m_Tool, null, CraftPage.PickResource2));
CraftSubRes res = system.CraftSubRes2.GetAt(index);
break;
}
case 8: // Enhance item
{
if (system.CanEnhance)
Enhance.BeginTarget(m_From, system, m_Tool);
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;
break;
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;
}
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;
context.MarkOption = context.MarkOption switch
{
CraftMarkOption.MarkItem => CraftMarkOption.DoNotMark,
CraftMarkOption.DoNotMark => CraftMarkOption.PromptForMark,
CraftMarkOption.PromptForMark => CraftMarkOption.MarkItem,
_ => context.MarkOption
};
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;
}
}
}

View file

@ -16,16 +16,16 @@ namespace Server.Engines.Craft
private const int GreyLabelColor = 0x3DEF;
private static Type typeofBlankScroll = typeof(BlankScroll);
private static Type typeofSpellScroll = typeof(SpellScroll);
private CraftItem m_CraftItem;
private CraftSystem m_CraftSystem;
private Mobile m_From;
private static readonly Type typeofBlankScroll = typeof(BlankScroll);
private static readonly Type typeofSpellScroll = typeof(SpellScroll);
private readonly CraftItem m_CraftItem;
private readonly CraftSystem m_CraftSystem;
private readonly Mobile m_From;
private int m_OtherCount;
private bool m_ShowExceptionalChance;
private BaseTool m_Tool;
private readonly BaseTool m_Tool;
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40)
{
@ -93,7 +93,7 @@ namespace Server.Engines.Craft
DrawResource();
/*
if ( craftItem.RequiresSE )
if (craftItem.RequiresSE)
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion
* */

View file

@ -24,7 +24,7 @@ namespace Server.Engines.Craft
public class CraftItem
{
private static Dictionary<Type, int> _itemIds = new Dictionary<Type, int>();
private static readonly Dictionary<Type, int> _itemIds = new Dictionary<Type, int>();
private int m_ResAmount;
private int m_ResHue;
@ -46,45 +46,45 @@ namespace Server.Engines.Craft
RequiredBeverage = BeverageType.Water;
}
public bool ForceNonExceptional{ get; set; }
public bool ForceNonExceptional { get; set; }
public Expansion RequiredExpansion{ get; set; }
public Expansion RequiredExpansion { get; set; }
public Recipe Recipe{ get; private set; }
public Recipe Recipe { get; private set; }
public BeverageType RequiredBeverage{ get; set; }
public BeverageType RequiredBeverage { get; set; }
public int Mana{ get; set; }
public int Mana { get; set; }
public int Hits{ get; set; }
public int Hits { get; set; }
public int Stam{ get; set; }
public int Stam { get; set; }
public bool UseSubRes2{ get; set; }
public bool UseSubRes2 { get; set; }
public bool UseAllRes{ get; set; }
public bool UseAllRes { get; set; }
public bool NeedHeat{ get; set; }
public bool NeedHeat { get; set; }
public bool NeedOven{ get; set; }
public bool NeedOven { get; set; }
public bool NeedMill{ get; set; }
public bool NeedMill { get; set; }
public Type ItemType{ get; }
public Type ItemType { get; }
public int ItemHue{ get; set; }
public int ItemHue { get; set; }
public string GroupNameString{ get; }
public string GroupNameString { get; }
public int GroupNameNumber{ get; }
public int GroupNameNumber { get; }
public string NameString{ get; }
public string NameString { get; }
public int NameNumber{ get; }
public int NameNumber { get; }
public CraftResCol Resources{ get; }
public CraftResCol Resources { get; }
public CraftSkillCol Skills{ get; }
public CraftSkillCol Skills { get; }
public void AddRecipe(int id, CraftSystem system)
{
@ -170,7 +170,6 @@ namespace Server.Engines.Craft
Resources.Add(craftRes);
}
public void AddSkill(SkillName skillToMake, double minSkill, double maxSkill)
{
CraftSkill craftSkill = new CraftSkill(skillToMake, minSkill, maxSkill);
@ -221,7 +220,7 @@ namespace Server.Engines.Craft
public bool IsMarkable(Type type)
{
if (ForceNonExceptional) //Don't even display the stuff for marking if it can't ever be exceptional.
if (ForceNonExceptional) // Don't even display the stuff for marking if it can't ever be exceptional.
return false;
for (int i = 0; i < m_MarkableTable.Length; ++i)
@ -282,27 +281,27 @@ namespace Server.Engines.Craft
return true;
for (int x = -2; x <= 2; ++x)
for (int y = -2; y <= 2; ++y)
{
int vx = from.X + x;
int vy = from.Y + y;
StaticTile[] tiles = map.Tiles.GetStaticTiles(vx, vy, true);
for (int i = 0; i < tiles.Length; ++i)
for (int y = -2; y <= 2; ++y)
{
int z = tiles[i].Z;
int id = tiles[i].ID;
int vx = from.X + x;
int vy = from.Y + y;
if (z + 16 > from.Z && from.Z + 16 > z && Find(id, itemIDs))
return true;
StaticTile[] tiles = map.Tiles.GetStaticTiles(vx, vy, true);
for (int i = 0; i < tiles.Length; ++i)
{
int z = tiles[i].Z;
int id = tiles[i].ID;
if (z + 16 > from.Z && from.Z + 16 > z && Find(id, itemIDs))
return true;
}
}
}
return false;
}
public bool Find(int itemID, int[] itemIDs)
public static bool Find(int itemID, int[] itemIDs)
{
bool contains = false;
@ -312,19 +311,8 @@ namespace Server.Engines.Craft
return contains;
}
public bool IsQuantityType(Type[][] types)
{
for (int i = 0; i < types.Length; ++i)
{
Type[] check = types[i];
for (int j = 0; j < check.Length; ++j)
if (typeof(IHasQuantity).IsAssignableFrom(check[j]))
return true;
}
return false;
}
public bool IsQuantityType(Type[][] types) =>
types.Any(check => check.Any(t => typeof(IHasQuantity).IsAssignableFrom(t)));
public int ConsumeQuantity(Container cont, Type[][] types, int[] amounts)
{
@ -461,6 +449,7 @@ namespace Server.Engines.Craft
CraftSubResCol resCol = UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes;
CraftRes res;
for (int i = 0; i < types.Length; ++i)
{
CraftRes craftRes = Resources.GetAt(i);
@ -501,7 +490,7 @@ namespace Server.Engines.Craft
if (maxAmount == 0)
{
CraftRes res = Resources.GetAt(i);
res = Resources.GetAt(i);
if (res.MessageNumber > 0)
message = res.MessageNumber;
@ -557,7 +546,6 @@ namespace Server.Engines.Craft
resHue = m_ResHue;
}
// Consume Half ( for use all resource craft type )
else if (consumeType == ConsumeType.Half)
{
@ -580,7 +568,6 @@ namespace Server.Engines.Craft
resHue = m_ResHue;
}
else // ConstumeType.None ( it's basically used to know if the crafter has enough resource before starting the process )
{
index = -1;
@ -612,18 +599,16 @@ namespace Server.Engines.Craft
return true;
}
{
CraftRes res = Resources.GetAt(index);
res = Resources.GetAt(index);
if (res.MessageNumber > 0)
message = res.MessageNumber;
else if (!string.IsNullOrEmpty(res.MessageString))
message = res.MessageString;
else
message = 502925; // You don't have the resources required to make that item.
if (res.MessageNumber > 0)
message = res.MessageNumber;
else if (!string.IsNullOrEmpty(res.MessageString))
message = res.MessageString;
else
message = 502925; // You don't have the resources required to make that item.
return false;
}
return false;
}
private void OnResourceConsumed(Item item, int amount)
@ -662,17 +647,17 @@ namespace Server.Engines.Craft
chance = chance * 0.5 - 0.1;
break;
case CraftECA.ChanceMinusSixtyToFourtyFive:
{
double offset = 0.60 - (from.Skills[system.MainSkill].Value - 95.0) * 0.03;
{
double offset = 0.60 - (from.Skills[system.MainSkill].Value - 95.0) * 0.03;
if (offset < 0.45)
offset = 0.45;
else if (offset > 0.60)
offset = 0.60;
if (offset < 0.45)
offset = 0.45;
else if (offset > 0.60)
offset = 0.60;
chance -= offset;
break;
}
chance -= offset;
break;
}
}
if (chance > 0)
@ -731,7 +716,7 @@ namespace Server.Engines.Craft
if (allRequiredSkills)
chance = craftSystem.GetChanceAtMin(this) + (valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) *
(1.0 - craftSystem.GetChanceAtMin(this));
(1.0 - craftSystem.GetChanceAtMin(this));
else
chance = 0.0;
@ -819,7 +804,7 @@ namespace Server.Engines.Craft
{
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool,
RequiredExpansionMessage(RequiredExpansion))); //The {0} expansion is required to attempt this item.
RequiredExpansionMessage(RequiredExpansion))); // The {0} expansion is required to attempt this item.
}
}
else
@ -828,12 +813,12 @@ namespace Server.Engines.Craft
}
}
//Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too. Not that it wouldn't be a bad idea.
// Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too. Not that it wouldn't be a bad idea.
private object RequiredExpansionMessage(Expansion expansion)
{
return expansion switch
{
Expansion.SE => (object)1063307, // The "Samurai Empire" expansion is required to attempt this item.
Expansion.SE => 1063307, // The "Samurai Empire" expansion is required to attempt this item.
Expansion.ML => 1072650, // The "Mondain's Legacy" expansion is required to attempt this item.
_ => $"The \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion is required to attempt this item."
};
@ -955,7 +940,7 @@ namespace Server.Engines.Craft
CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item),
craftSystem.GetType().Name);
//from.PlaySound( 0x57 );
// from.PlaySound( 0x57 );
}
if (num == 0)
@ -1052,13 +1037,13 @@ namespace Server.Engines.Craft
private class InternalTimer : Timer
{
private CraftItem m_CraftItem;
private CraftSystem m_CraftSystem;
private Mobile m_From;
private readonly CraftItem m_CraftItem;
private readonly CraftSystem m_CraftSystem;
private readonly Mobile m_From;
private int m_iCount;
private int m_iCountMax;
private BaseTool m_Tool;
private Type m_TypeRes;
private readonly int m_iCountMax;
private readonly BaseTool m_Tool;
private readonly Type m_TypeRes;
public InternalTimer(Mobile from, CraftSystem craftSystem, CraftItem craftItem, Type typeRes, BaseTool tool,
int iCountMax) : base(TimeSpan.Zero, TimeSpan.FromSeconds(craftSystem.Delay), iCountMax)
@ -1148,9 +1133,7 @@ namespace Server.Engines.Craft
}
}
#region Tables
private static int[] m_HeatSources =
private static readonly int[] m_HeatSources =
{
0x461, 0x48E, // Sandstone oven/fireplace
0x92B, 0x96C, // Stone oven/fireplace
@ -1159,27 +1142,27 @@ namespace Server.Engines.Craft
0x184A, 0x184C, // Heating stand (left)
0x184E, 0x1850, // Heating stand (right)
0x398C, 0x399F, // Fire field
0x2DDB, 0x2DDC, //Elven stove
0x2DDB, 0x2DDC, // Elven stove
0x19AA, 0x19BB, // Veteran Reward Brazier
0x197A, 0x19A9, // Large Forge
0x0FB1, 0x0FB1, // Small Forge
0x2DD8, 0x2DD8 // Elven Forge
};
private static int[] m_Ovens =
private static readonly int[] m_Ovens =
{
0x461, 0x46F, // Sandstone oven
0x92B, 0x93F, // Stone oven
0x2DDB, 0x2DDC //Elven stove
0x2DDB, 0x2DDC // Elven stove
};
private static int[] m_Mills =
private static readonly int[] m_Mills =
{
0x1920, 0x1921, 0x1922, 0x1923, 0x1924, 0x1295, 0x1926, 0x1928,
0x192C, 0x192D, 0x192E, 0x129F, 0x1930, 0x1931, 0x1932, 0x1934
};
private static Type[][] m_TypesTable =
private static readonly Type[][] m_TypesTable =
{
new[] { typeof(Log), typeof(Board) },
new[] { typeof(HeartwoodLog), typeof(HeartwoodBoard) },
@ -1199,13 +1182,13 @@ namespace Server.Engines.Craft
new[] { typeof(WoodenBowlOfPeas), typeof(PewterBowlOfPeas) }
};
private static Type[] m_ColoredItemTable =
private static readonly Type[] m_ColoredItemTable =
{
typeof(BaseWeapon), typeof(BaseArmor), typeof(BaseClothing),
typeof(BaseJewel), typeof(DragonBardingDeed)
};
private static Type[] m_ColoredResourceTable =
private static readonly Type[] m_ColoredResourceTable =
{
typeof(BaseIngot), typeof(BaseOre),
typeof(BaseLeather), typeof(BaseHides),
@ -1213,7 +1196,7 @@ namespace Server.Engines.Craft
typeof(BaseGranite), typeof(BaseScales)
};
private static Type[] m_MarkableTable =
private static readonly Type[] m_MarkableTable =
{
typeof(BaseArmor),
typeof(BaseWeapon),
@ -1227,11 +1210,9 @@ namespace Server.Engines.Craft
typeof(BaseQuiver)
};
private static Type[] m_NeverColorTable =
private static readonly Type[] m_NeverColorTable =
{
typeof(OrcHelm)
};
#endregion
}
}

View file

@ -7,6 +7,6 @@ namespace Server.Engines.Craft
{
public CraftItemIDAttribute(int itemID) => ItemID = itemID;
public int ItemID{ get; }
public int ItemID { get; }
}
}

View file

@ -16,17 +16,17 @@ namespace Server.Engines.Craft
MessageString = message;
}
public Type ItemType{ get; }
public Type ItemType { get; }
public string MessageString{ get; }
public string MessageString { get; }
public int MessageNumber{ get; }
public int MessageNumber { get; }
public string NameString{ get; }
public string NameString { get; }
public int NameNumber{ get; }
public int NameNumber { get; }
public int Amount{ get; }
public int Amount { get; }
public void SendMessage(Mobile from)
{

View file

@ -9,10 +9,10 @@ namespace Server.Engines.Craft
MaxSkill = maxSkill;
}
public SkillName SkillToMake{ get; }
public SkillName SkillToMake { get; }
public double MinSkill{ get; }
public double MinSkill { get; }
public double MaxSkill{ get; }
public double MaxSkill { get; }
}
}

View file

@ -19,16 +19,16 @@ namespace Server.Engines.Craft
Message = message;
}
public Type ItemType{ get; }
public Type ItemType { get; }
public string NameString{ get; }
public string NameString { get; }
public int NameNumber{ get; }
public int NameNumber { get; }
public int GenericNameNumber{ get; }
public int GenericNameNumber { get; }
public object Message{ get; }
public object Message { get; }
public double RequiredSkill{ get; }
public double RequiredSkill { get; }
}
}

View file

@ -7,13 +7,13 @@ namespace Server.Engines.Craft
{
public CraftSubResCol() => Init = false;
public bool Init{ get; set; }
public bool Init { get; set; }
public Type ResType{ get; set; }
public Type ResType { get; set; }
public string NameString{ get; set; }
public string NameString { get; set; }
public int NameNumber{ get; set; }
public int NameNumber { get; set; }
public void Add(CraftSubRes craftSubRes)
{

View file

@ -13,9 +13,9 @@ namespace Server.Engines.Craft
public abstract class CraftSystem
{
private Dictionary<Mobile, CraftContext> m_ContextTable = new Dictionary<Mobile, CraftContext>();
private List<int> m_RareRecipes;
private List<int> m_Recipes;
private readonly Dictionary<Mobile, CraftContext> m_ContextTable = new Dictionary<Mobile, CraftContext>();
private readonly List<int> m_RareRecipes;
private readonly List<int> m_Recipes;
public CraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
{
@ -34,34 +34,34 @@ namespace Server.Engines.Craft
InitCraftList();
}
public int MinCraftEffect{ get; }
public int MinCraftEffect { get; }
public int MaxCraftEffect{ get; }
public int MaxCraftEffect { get; }
public double Delay{ get; }
public double Delay { get; }
public CraftItemCol CraftItems{ get; }
public CraftItemCol CraftItems { get; }
public CraftGroupCol CraftGroups{ get; }
public CraftGroupCol CraftGroups { get; }
public CraftSubResCol CraftSubRes{ get; }
public CraftSubResCol CraftSubRes { get; }
public CraftSubResCol CraftSubRes2{ get; }
public CraftSubResCol CraftSubRes2 { get; }
public abstract SkillName MainSkill{ get; }
public abstract SkillName MainSkill { get; }
public virtual int GumpTitleNumber => 0;
public virtual string GumpTitleString => "";
public virtual CraftECA ECA => CraftECA.ChanceMinusSixty;
public bool Resmelt{ get; set; }
public bool Resmelt { get; set; }
public bool Repair{ get; set; }
public bool Repair { get; set; }
public bool MarkOption{ get; set; }
public bool MarkOption { get; set; }
public bool CanEnhance{ get; set; }
public bool CanEnhance { get; set; }
public abstract double GetChanceAtMin(CraftItem item);
@ -114,7 +114,6 @@ namespace Server.Engines.Craft
return m_RareRecipes[Utility.Random(m_RareRecipes.Count)];
}
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
Type typeRes, TextDefinition nameRes, int amount) =>
AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "");
@ -138,7 +137,6 @@ namespace Server.Engines.Craft
return CraftItems.Add(craftItem);
}
private void DoGroup(TextDefinition groupName, CraftItem craftItem)
{
int index = CraftGroups.SearchFor(groupName);
@ -155,7 +153,6 @@ namespace Server.Engines.Craft
}
}
public void SetItemHue(int index, int hue)
{
CraftItem craftItem = CraftItems.GetAt(index);
@ -268,7 +265,6 @@ namespace Server.Engines.Craft
craftItem.ForceNonExceptional = true;
}
public void SetSubRes(Type type, string name)
{
CraftSubRes.ResType = type;
@ -301,7 +297,6 @@ namespace Server.Engines.Craft
CraftSubRes.Add(craftSubRes);
}
public void SetSubRes2(Type type, string name)
{
CraftSubRes2.ResType = type;

View file

@ -16,17 +16,17 @@ namespace Server.Engines.Craft
Quality = quality;
}
public Mobile From{ get; }
public Mobile From { get; }
public CraftItem CraftItem{ get; }
public CraftItem CraftItem { get; }
public CraftSystem CraftSystem{ get; }
public CraftSystem CraftSystem { get; }
public Type TypeRes{ get; }
public Type TypeRes { get; }
public BaseTool Tool{ get; }
public BaseTool Tool { get; }
public int Quality{ get; }
public int Quality { get; }
public abstract void EndCraftAction();
public abstract Item CompleteCraft(out int message);

View file

@ -182,43 +182,43 @@ namespace Server.Engines.Craft
switch (res)
{
case EnhanceResult.Broken:
{
if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half,
ref resMessage))
return EnhanceResult.NoResources;
{
if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half,
ref resMessage))
return EnhanceResult.NoResources;
item.Delete();
break;
}
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;
if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All,
ref resMessage))
return EnhanceResult.NoResources;
int hue = w.GetElementalDamageHue();
if (hue > 0)
w.Hue = hue;
}
else
{
((BaseArmor)item).Resource = resource;
}
if (item is BaseWeapon w)
{
w.Resource = resource;
break;
}
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;
{
if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half,
ref resMessage))
return EnhanceResult.NoResources;
break;
}
break;
}
}
return res;
@ -231,7 +231,7 @@ namespace Server.Engines.Craft
int random = Utility.Random(100);
if (10 > random)
if (random < 10)
res = EnhanceResult.Failure;
else if (chance > random)
res = EnhanceResult.Broken;
@ -281,10 +281,10 @@ namespace Server.Engines.Craft
private class InternalTarget : Target
{
private CraftSystem m_CraftSystem;
private CraftResource m_Resource;
private Type m_ResourceType;
private BaseTool m_Tool;
private readonly CraftSystem m_CraftSystem;
private readonly CraftResource m_Resource;
private readonly Type m_ResourceType;
private readonly BaseTool m_Tool;
public InternalTarget(CraftSystem craftSystem, BaseTool tool, Type resourceType, CraftResource resource) : base(
2, false, TargetFlags.None)

View file

@ -7,12 +7,12 @@ namespace Server.Engines.Craft
{
public class QueryMakersMarkGump : Gump
{
private CraftItem m_CraftItem;
private CraftSystem m_CraftSystem;
private Mobile m_From;
private int m_Quality;
private BaseTool m_Tool;
private Type m_TypeRes;
private readonly CraftItem m_CraftItem;
private readonly CraftSystem m_CraftSystem;
private readonly Mobile m_From;
private readonly int m_Quality;
private readonly BaseTool m_Tool;
private readonly Type m_TypeRes;
public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes,
BaseTool tool) : base(100, 200)

View file

@ -22,16 +22,15 @@ namespace Server.Engines.Craft
LargestRecipeID = Math.Max(id, LargestRecipeID);
}
public static Dictionary<int, Recipe> Recipes { get; } = new Dictionary<int, Recipe>();
public static Dictionary<int, Recipe> Recipes{ get; } = new Dictionary<int, Recipe>();
public static int LargestRecipeID { get; private set; }
public static int LargestRecipeID{ get; private set; }
public CraftSystem CraftSystem { get; set; }
public CraftSystem CraftSystem{ get; set; }
public CraftItem CraftItem { get; set; }
public CraftItem CraftItem{ get; set; }
public int ID{ get; }
public int ID { get; }
public TextDefinition TextDefinition => m_TD ?? (m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString));
@ -48,7 +47,7 @@ namespace Server.Engines.Craft
Mobile m = e.Mobile;
m.SendMessage("Target a player to teach them all of the recipes.");
m.BeginTarget(-1, false, TargetFlags.None, delegate(Mobile from, object targeted)
m.BeginTarget(-1, false, TargetFlags.None, (from, targeted) =>
{
if (targeted is PlayerMobile mobile)
{
@ -86,4 +85,4 @@ namespace Server.Engines.Craft
});
}
}
}
}

View file

@ -21,9 +21,9 @@ namespace Server.Engines.Craft
private class InternalTarget : Target
{
private CraftSystem m_CraftSystem;
private RepairDeed m_Deed;
private BaseTool m_Tool;
private readonly CraftSystem m_CraftSystem;
private readonly RepairDeed m_Deed;
private readonly BaseTool m_Tool;
public InternalTarget(CraftSystem craftSystem, BaseTool tool) : base(2, false, TargetFlags.None)
{
@ -47,7 +47,6 @@ namespace Server.Engines.Craft
{
double difficulty = GetRepairDifficulty(curHits, maxHits) * 0.1;
if (m_Deed != null)
{
double value = m_Deed.SkillLevel;
@ -105,20 +104,14 @@ namespace Server.Engines.Craft
|| weapon is BlackStaff
|| weapon is MagicWand
#region Temporary
// TODO: Make these items craftable
|| weapon is WildStaff;
#endregion
}
if (m_CraftSystem is DefBlacksmithy)
{
return weapon is Pitchfork
#region Temporary
// TODO: Make these items craftable
|| weapon is RadiantScimitar
|| weapon is WarCleaver
@ -129,19 +122,13 @@ namespace Server.Engines.Craft
|| weapon is ElvenMachete
|| weapon is OrnateAxe
|| weapon is DiamondMace;
#endregion
}
#region Temporary
// TODO: Make these items craftable
if (m_CraftSystem is DefBowFletching)
return weapon is ElvenCompositeLongbow
|| weapon is MagicalShortbow;
#endregion
return false;
}
@ -149,8 +136,6 @@ namespace Server.Engines.Craft
{
// Armor repairable but not craftable
#region Temporary
// TODO: Make these items craftable
if (m_CraftSystem is DefTailoring)
return armor is LeafTonlet
@ -179,8 +164,6 @@ namespace Server.Engines.Craft
|| armor is RoyalCirclet
|| armor is GemmedCirclet;
#endregion
return false;
}

View file

@ -32,8 +32,8 @@ namespace Server.Engines.Craft
private class InternalTarget : Target
{
private CraftSystem m_CraftSystem;
private BaseTool m_Tool;
private readonly CraftSystem m_CraftSystem;
private readonly BaseTool m_Tool;
public InternalTarget(CraftSystem craftSystem, BaseTool tool) : base(2, false, TargetFlags.None)
{
@ -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;
@ -151,7 +151,7 @@ namespace Server.Engines.Craft
{
SmeltResult.Invalid => 1044272,
SmeltResult.NoSkill => 1044269,
SmeltResult.Success => (isStoreBought ? 500418 : 1044270),
SmeltResult.Success => isStoreBought ? 500418 : 1044270,
_ => 1044272
};

View file

@ -7,7 +7,7 @@ namespace Server.Engines.Craft
{
private static CraftSystem m_CraftSystem;
private static Type typeofPotion = typeof(BasePotion);
private static readonly Type typeofPotion = typeof(BasePotion);
private DefAlchemy() : base(1, 1, 1.25) // base( 1, 1, 3.1 )
{

View file

@ -7,8 +7,8 @@ namespace Server.Engines.Craft
{
private static CraftSystem m_CraftSystem;
private static Type typeofAnvil = typeof(AnvilAttribute);
private static Type typeofForge = typeof(ForgeAttribute);
private static readonly Type typeofAnvil = typeof(AnvilAttribute);
private static readonly Type typeofForge = typeof(ForgeAttribute);
private DefBlacksmithy() : base(1, 1, 1.25) // base( 1, 2, 1.7 )
{
@ -16,9 +16,9 @@ namespace Server.Engines.Craft
base( MinCraftEffect, MaxCraftEffect, Delay )
MinCraftEffect : The minimum number of time the mobile will play the craft effect
MaxCraftEffect : The maximum number of time the mobile will play the craft effect
Delay : The delay between each craft effect
MinCraftEffect : The minimum number of time the mobile will play the craft effect
MaxCraftEffect : The maximum number of time the mobile will play the craft effect
Delay : The delay between each craft effect
Example: (3, 6, 1.7) would make the mobile do the PlayCraftEffect override
function between 3 and 6 time, with a 1.7 second delay each time.
@ -55,7 +55,7 @@ namespace Server.Engines.Craft
bool isAnvil = type.IsDefined(typeofAnvil, false) || item.ItemID == 4015 || item.ItemID == 4016 ||
item.ItemID == 0x2DD5 || item.ItemID == 0x2DD6;
bool isForge = type.IsDefined(typeofForge, false) || item.ItemID == 4017 ||
item.ItemID >= 6522 && item.ItemID <= 6569 || item.ItemID == 0x2DD8;
(item.ItemID >= 6522 && item.ItemID <= 6569) || item.ItemID == 0x2DD8;
if (isAnvil || isForge)
{
@ -73,28 +73,28 @@ namespace Server.Engines.Craft
eable.Free();
for (int x = -range; (!anvil || !forge) && x <= range; ++x)
for (int y = -range; (!anvil || !forge) && y <= range; ++y)
{
StaticTile[] tiles = map.Tiles.GetStaticTiles(from.X + x, from.Y + y, true);
for (int i = 0; (!anvil || !forge) && i < tiles.Length; ++i)
for (int y = -range; (!anvil || !forge) && y <= range; ++y)
{
int id = tiles[i].ID;
StaticTile[] tiles = map.Tiles.GetStaticTiles(from.X + x, from.Y + y, true);
bool isAnvil = id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6;
bool isForge = id == 4017 || id >= 6522 && id <= 6569 || id == 0x2DD8;
if (isAnvil || isForge)
for (int i = 0; (!anvil || !forge) && i < tiles.Length; ++i)
{
if (from.Z + 16 < tiles[i].Z || tiles[i].Z + 16 < from.Z ||
!from.InLOS(new Point3D(from.X + x, from.Y + y, tiles[i].Z + tiles[i].Height / 2 + 1)))
continue;
int id = tiles[i].ID;
anvil = anvil || isAnvil;
forge = forge || isForge;
bool isAnvil = id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6;
bool isForge = id == 4017 || (id >= 6522 && id <= 6569) || id == 0x2DD8;
if (isAnvil || isForge)
{
if (from.Z + 16 < tiles[i].Z || tiles[i].Z + 16 < from.Z ||
!from.InLOS(new Point3D(from.X + x, from.Y + y, tiles[i].Z + tiles[i].Height / 2 + 1)))
continue;
anvil = anvil || isAnvil;
forge = forge || isForge;
}
}
}
}
}
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
@ -117,9 +117,9 @@ namespace Server.Engines.Craft
public override void PlayCraftEffect(Mobile from)
{
// no animation, instant sound
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 9, 5, 1, true, false, 0 );
//new InternalTimer( from ).Start();
// if (from.Body.Type == BodyType.Human && !from.Mounted)
// from.Animate( 9, 5, 1, true, false, 0 );
// new InternalTimer( from ).Start();
from.PlaySound(0x2A);
}
@ -152,13 +152,13 @@ namespace Server.Engines.Craft
Syntax for a SIMPLE craft item
AddCraft( ObjectType, Group, MinSkill, MaxSkill, ResourceType, Amount, Message )
ObjectType : The type of the object you want to add to the build list.
Group : The group in which the object will be showed in the craft menu.
MinSkill : The minimum of skill value
MaxSkill : The maximum of skill value
ResourceType : The type of the resource the mobile need to create the item
Amount : The amount of the ResourceType it need to create the item
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
ObjectType : The type of the object you want to add to the build list.
Group : The group in which the object will be showed in the craft menu.
MinSkill : The minimum of skill value
MaxSkill : The maximum of skill value
ResourceType : The type of the resource the mobile need to create the item
Amount : The amount of the ResourceType it need to create the item
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
Syntax for a COMPLEX craft item. A complex item is an item that need either more than
only one skill, or more than only one resource.
@ -166,27 +166,17 @@ namespace Server.Engines.Craft
Coming soon....
*/
#region Ringmail
AddCraft(typeof(RingmailGloves), 1011076, 1025099, 12.0, 62.0, typeof(IronIngot), 1044036, 10, 1044037);
AddCraft(typeof(RingmailLegs), 1011076, 1025104, 19.4, 69.4, typeof(IronIngot), 1044036, 16, 1044037);
AddCraft(typeof(RingmailArms), 1011076, 1025103, 16.9, 66.9, typeof(IronIngot), 1044036, 14, 1044037);
AddCraft(typeof(RingmailChest), 1011076, 1025100, 21.9, 71.9, typeof(IronIngot), 1044036, 18, 1044037);
#endregion
#region Chainmail
AddCraft(typeof(ChainCoif), 1011077, 1025051, 14.5, 64.5, typeof(IronIngot), 1044036, 10, 1044037);
AddCraft(typeof(ChainLegs), 1011077, 1025054, 36.7, 86.7, typeof(IronIngot), 1044036, 18, 1044037);
AddCraft(typeof(ChainChest), 1011077, 1025055, 39.1, 89.1, typeof(IronIngot), 1044036, 20, 1044037);
#endregion
int index;
#region Platemail
AddCraft(typeof(PlateArms), 1011078, 1025136, 66.3, 116.3, typeof(IronIngot), 1044036, 18, 1044037);
AddCraft(typeof(PlateGloves), 1011078, 1025140, 58.9, 108.9, typeof(IronIngot), 1044036, 12, 1044037);
AddCraft(typeof(PlateGorget), 1011078, 1025139, 56.4, 106.4, typeof(IronIngot), 1044036, 10, 1044037);
@ -203,7 +193,7 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
index = AddCraft(typeof(PlateDo), 1011078, 1030184, 80.0, 130.0, typeof(IronIngot), 1044036, 28,
1044037); //Double check skill
1044037); // Double check skill
SetNeededExpansion(index, Expansion.SE);
index = AddCraft(typeof(PlateHiroSode), 1011078, 1030187, 80.0, 130.0, typeof(IronIngot), 1044036, 16,
@ -219,10 +209,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Helmets
AddCraft(typeof(Bascinet), 1011079, 1025132, 8.3, 58.3, typeof(IronIngot), 1044036, 15, 1044037);
AddCraft(typeof(CloseHelm), 1011079, 1025128, 37.9, 87.9, typeof(IronIngot), 1044036, 15, 1044037);
AddCraft(typeof(Helmet), 1011079, 1025130, 37.9, 87.9, typeof(IronIngot), 1044036, 15, 1044037);
@ -281,10 +267,6 @@ namespace Server.Engines.Craft
}
}
#endregion
#region Shields
AddCraft(typeof(Buckler), 1011080, 1027027, -25.0, 25.0, typeof(IronIngot), 1044036, 10, 1044037);
AddCraft(typeof(BronzeShield), 1011080, 1027026, -15.2, 34.8, typeof(IronIngot), 1044036, 12, 1044037);
AddCraft(typeof(HeaterShield), 1011080, 1027030, 24.3, 74.3, typeof(IronIngot), 1044036, 18, 1044037);
@ -298,10 +280,6 @@ namespace Server.Engines.Craft
AddCraft(typeof(OrderShield), 1011080, 1027108, 85.0, 135.0, typeof(IronIngot), 1044036, 25, 1044037);
}
#endregion
#region Bladed
if (Core.AOS)
AddCraft(typeof(BoneHarvester), 1011081, 1029915, 33.0, 83.0, typeof(IronIngot), 1044036, 10, 1044037);
@ -581,10 +559,6 @@ namespace Server.Engines.Craft
}
}
#endregion
#region Axes
AddCraft(typeof(Axe), 1011082, 1023913, 34.2, 84.2, typeof(IronIngot), 1044036, 14, 1044037);
AddCraft(typeof(BattleAxe), 1011082, 1023911, 30.5, 80.5, typeof(IronIngot), 1044036, 14, 1044037);
AddCraft(typeof(DoubleAxe), 1011082, 1023915, 29.3, 79.3, typeof(IronIngot), 1044036, 12, 1044037);
@ -622,10 +596,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.ML);
}
#endregion
#region Pole Arms
AddCraft(typeof(Bardiche), 1011083, 1023917, 31.7, 81.7, typeof(IronIngot), 1044036, 18, 1044037);
if (Core.AOS)
@ -651,11 +621,7 @@ namespace Server.Engines.Craft
AddCraft(typeof(WarFork), 1011083, 1025125, 42.9, 92.9, typeof(IronIngot), 1044036, 12, 1044037);
// Not craftable (is this an AOS change ??)
//AddCraft( typeof( Pitchfork ), 1011083, 1023720, 36.1, 86.1, typeof( IronIngot ), 1044036, 12, 1044037 );
#endregion
#region Bashing
// AddCraft( typeof( Pitchfork ), 1011083, 1023720, 36.1, 86.1, typeof( IronIngot ), 1044036, 12, 1044037 );
AddCraft(typeof(HammerPick), 1011084, 1025181, 34.2, 84.2, typeof(IronIngot), 1044036, 16, 1044037);
AddCraft(typeof(Mace), 1011084, 1023932, 14.5, 64.5, typeof(IronIngot), 1044036, 6, 1044037);
@ -714,10 +680,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.ML);
}
#endregion
#region Dragon Scale Armor
index = AddCraft(typeof(DragonGloves), 1053114, 1029795, 68.9, 118.9, typeof(RedScales), 1060883, 16, 1060884);
SetUseSubRes2(index, true);
@ -733,8 +695,6 @@ namespace Server.Engines.Craft
index = AddCraft(typeof(DragonChest), 1053114, 1029793, 85.0, 135.0, typeof(RedScales), 1060883, 36, 1060884);
SetUseSubRes2(index, true);
#endregion
// Set the overridable material
SetSubRes(typeof(IronIngot), 1044022);
@ -768,7 +728,7 @@ namespace Server.Engines.Craft
// Delay to synchronize the sound with the hit on the anvil
private class InternalTimer : Timer
{
private Mobile m_From;
private readonly Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;

View file

@ -34,8 +34,8 @@ namespace Server.Engines.Craft
public override void PlayCraftEffect(Mobile from)
{
// no animation
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 33, 5, 1, true, false, 0 );
// if (from.Body.Type == BodyType.Human && !from.Mounted)
// from.Animate( 33, 5, 1, true, false, 0 );
from.PlaySound(0x55);
}

View file

@ -32,8 +32,8 @@ namespace Server.Engines.Craft
public override void PlayCraftEffect(Mobile from)
{
// no animation
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 9, 5, 1, true, false, 0 );
// if (from.Body.Type == BodyType.Human && !from.Mounted)
// from.Animate( 9, 5, 1, true, false, 0 );
from.PlaySound(0x23D);
}
@ -99,10 +99,10 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
if (Core.AOS) //Duplicate Entries to preserve ordering depending on era
if (Core.AOS) // Duplicate Entries to preserve ordering depending on era
{
index = AddCraft(typeof(FishingPole), 1044294, 1023519, 68.4, 93.4, typeof(Log), 1044041, 5,
1044351); //This is in the categor of Other during AoS
1044351); // This is in the categor of Other during AoS
AddSkill(index, SkillName.Tailoring, 40.0, 45.0);
AddRes(index, typeof(Cloth), 1044286, 5, 1044287);
}
@ -288,10 +288,10 @@ namespace Server.Engines.Craft
AddCraft(typeof(WoodenShield), Core.ML ? 1062760 : 1044295, 1027034, 52.6, 77.6, typeof(Log), 1044041, 9,
1044351);
if (!Core.AOS) //Duplicate Entries to preserve ordering depending on era
if (!Core.AOS) // Duplicate Entries to preserve ordering depending on era
{
index = AddCraft(typeof(FishingPole), Core.ML ? 1044294 : 1044295, 1023519, 68.4, 93.4, typeof(Log), 1044041,
5, 1044351); //This is in the categor of Other during AoS
5, 1044351); // This is in the categor of Other during AoS
AddSkill(index, SkillName.Tailoring, 40.0, 45.0);
AddRes(index, typeof(Cloth), 1044286, 5, 1044287);
}

View file

@ -40,10 +40,10 @@ namespace Server.Engines.Craft
{
from.PlaySound(0x2B); // bellows
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 9, 5, 1, true, false, 0 );
// if (from.Body.Type == BodyType.Human && !from.Mounted)
// from.Animate( 9, 5, 1, true, false, 0 );
//new InternalTimer( from ).Start();
// new InternalTimer( from ).Start();
}
public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality,
@ -97,7 +97,7 @@ namespace Server.Engines.Craft
// Delay to synchronize the sound with the hit on the anvil
private class InternalTimer : Timer
{
private Mobile m_From;
private readonly Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;

View file

@ -10,13 +10,13 @@ namespace Server.Engines.Craft
{
private static CraftSystem m_CraftSystem;
private static Type typeofSpellScroll = typeof(SpellScroll);
private static readonly Type typeofSpellScroll = typeof(SpellScroll);
private int m_Circle, m_Mana;
private int m_Index;
private Type[] m_RegTypes =
private readonly Type[] m_RegTypes =
{
typeof(BlackPearl),
typeof(Bloodmoss),
@ -78,7 +78,7 @@ namespace Server.Engines.Craft
if (toolBroken)
from.SendLocalizedMessage(1044038); // You have worn out your tool
if (!typeofSpellScroll.IsAssignableFrom(item.ItemType)) // not a scroll
if (!typeofSpellScroll.IsAssignableFrom(item.ItemType)) // not a scroll
{
if (failed)
{
@ -156,7 +156,7 @@ namespace Server.Engines.Craft
{
int index = AddCraft(type, 1061677, 1060509 + spell, minSkill, minSkill + 1.0, regs[0],
CraftItem.LabelNumber(regs[0]), 1,
501627); //Yes, on OSI it's only 1.0 skill diff'. Don't blame me, blame OSI.
501627); // Yes, on OSI it's only 1.0 skill diff'. Don't blame me, blame OSI.
for (int i = 1; i < regs.Length; ++i)
AddRes(index, regs[i], CraftItem.LabelNumber(regs[0]), 1, 501627);
@ -331,7 +331,7 @@ namespace Server.Engines.Craft
if (Core.SE) AddCraft(typeof(Spellbook), 1044294, 1023834, 50.0, 126, typeof(BlankScroll), 1044377, 10, 1044378);
/* TODO
if ( Core.ML )
if (Core.ML)
{
index = AddCraft( typeof( ScrappersCompendium ), 1044294, 1072940, 75.0, 125.0, typeof( BlankScroll ), 1044377, 100, 1044378 );
AddRes( index, typeof( DreadHornMane ), 1032682, 1, 1044253 );

View file

@ -39,9 +39,9 @@ namespace Server.Engines.Craft
public override void PlayCraftEffect(Mobile from)
{
// no effects
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 9, 5, 1, true, false, 0 );
//new InternalTimer( from ).Start();
// if (from.Body.Type == BodyType.Human && !from.Mounted)
// from.Animate( 9, 5, 1, true, false, 0 );
// new InternalTimer( from ).Start();
}
public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality,
@ -111,7 +111,7 @@ namespace Server.Engines.Craft
// Delay to synchronize the sound with the hit on the anvil
private class InternalTimer : Timer
{
private Mobile m_From;
private readonly Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;

View file

@ -7,7 +7,7 @@ namespace Server.Engines.Craft
{
private static CraftSystem m_CraftSystem;
private static Type[] m_TailorColorables =
private static readonly Type[] m_TailorColorables =
{
typeof(GozaMatEastDeed), typeof(GozaMatSouthDeed),
typeof(SquareGozaMatEastDeed), typeof(SquareGozaMatSouthDeed),
@ -85,8 +85,6 @@ namespace Server.Engines.Craft
{
int index;
#region Hats
AddCraft(typeof(SkullCap), 1011375, 1025444, 0.0, 25.0, typeof(Cloth), 1044286, 2, 1044287);
AddCraft(typeof(Bandana), 1011375, 1025440, 0.0, 25.0, typeof(Cloth), 1044286, 2, 1044287);
AddCraft(typeof(FloppyHat), 1011375, 1025907, 6.2, 31.2, typeof(Cloth), 1044286, 11, 1044287);
@ -112,10 +110,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Shirts
AddCraft(typeof(Doublet), 1015269, 1028059, 0, 25.0, typeof(Cloth), 1044286, 8, 1044287);
AddCraft(typeof(Shirt), 1015269, 1025399, 20.7, 45.7, typeof(Cloth), 1044286, 8, 1044287);
AddCraft(typeof(FancyShirt), 1015269, 1027933, 24.8, 49.8, typeof(Cloth), 1044286, 8, 1044287);
@ -151,10 +145,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Pants
AddCraft(typeof(ShortPants), 1015279, 1025422, 24.8, 49.8, typeof(Cloth), 1044286, 6, 1044287);
AddCraft(typeof(LongPants), 1015279, 1025433, 24.8, 49.8, typeof(Cloth), 1044286, 8, 1044287);
AddCraft(typeof(Kilt), 1015279, 1025431, 20.7, 45.7, typeof(Cloth), 1044286, 8, 1044287);
@ -171,10 +161,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Misc
AddCraft(typeof(BodySash), 1015283, 1025441, 4.1, 29.1, typeof(Cloth), 1044286, 4, 1044287);
AddCraft(typeof(HalfApron), 1015283, 1025435, 20.7, 45.7, typeof(Cloth), 1044286, 6, 1044287);
AddCraft(typeof(FullApron), 1015283, 1025437, 29.0, 54.0, typeof(Cloth), 1044286, 10, 1044287);
@ -243,10 +229,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Footwear
if (Core.AOS)
AddCraft(typeof(FurBoots), 1015288, 1028967, 50.0, 75.0, typeof(Cloth), 1044286, 12, 1044287);
@ -263,10 +245,6 @@ namespace Server.Engines.Craft
AddCraft(typeof(Boots), 1015288, 1025899, 33.1, 58.1, typeof(Leather), 1044462, 8, 1044463);
AddCraft(typeof(ThighBoots), 1015288, 1025906, 41.4, 66.4, typeof(Leather), 1044462, 10, 1044463);
#endregion
#region Leather Armor
if (Core.ML)
{
index = AddCraft(typeof(SpellWovenBritches), 1015293, 1072929, 92.5, 117.5, typeof(Leather), 1044462, 15,
@ -338,10 +316,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Studded Armor
AddCraft(typeof(StuddedGorget), 1015300, 1025078, 78.8, 103.8, typeof(Leather), 1044462, 6, 1044463);
AddCraft(typeof(StuddedGloves), 1015300, 1025077, 82.9, 107.9, typeof(Leather), 1044462, 8, 1044463);
AddCraft(typeof(StuddedArms), 1015300, 1025076, 87.1, 112.1, typeof(Leather), 1044462, 10, 1044463);
@ -365,10 +339,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Female Armor
AddCraft(typeof(LeatherShorts), 1015306, 1027168, 62.2, 87.2, typeof(Leather), 1044462, 8, 1044463);
AddCraft(typeof(LeatherSkirt), 1015306, 1027176, 58.0, 83.0, typeof(Leather), 1044462, 6, 1044463);
AddCraft(typeof(LeatherBustierArms), 1015306, 1027178, 58.0, 83.0, typeof(Leather), 1044462, 6, 1044463);
@ -376,10 +346,6 @@ namespace Server.Engines.Craft
AddCraft(typeof(FemaleLeatherChest), 1015306, 1027174, 62.2, 87.2, typeof(Leather), 1044462, 8, 1044463);
AddCraft(typeof(FemaleStuddedChest), 1015306, 1027170, 87.1, 112.1, typeof(Leather), 1044462, 10, 1044463);
#endregion
#region Bone Armor
index = AddCraft(typeof(BoneHelm), 1049149, 1025206, 85.0, 110.0, typeof(Leather), 1044462, 4, 1044463);
AddRes(index, typeof(Bone), 1049064, 2, 1049063);
@ -398,8 +364,6 @@ namespace Server.Engines.Craft
index = AddCraft(typeof(OrcHelm), 1049149, 1027947, 90.0, 115.0, typeof(Leather), 1044462, 6, 1044463);
AddRes(index, typeof(Bone), 1049064, 4, 1049063);
#endregion
// Set the overridable material
SetSubRes(typeof(Leather), 1049150);

View file

@ -9,7 +9,7 @@ namespace Server.Engines.Craft
{
private static CraftSystem m_CraftSystem;
private static Type[] m_TinkerColorables =
private static readonly Type[] m_TinkerColorables =
{
typeof(ForkLeft), typeof(ForkRight),
typeof(SpoonLeft), typeof(SpoonRight),
@ -73,7 +73,7 @@ namespace Server.Engines.Craft
public override void PlayCraftEffect(Mobile from)
{
// no sound
//from.PlaySound( 0x241 );
// from.PlaySound( 0x241 );
}
public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality,
@ -139,8 +139,6 @@ namespace Server.Engines.Craft
{
int index;
#region Wooden Items
AddCraft(typeof(JointingPlane), 1044042, 1024144, 0.0, 50.0, typeof(Log), 1044041, 4, 1044351);
AddCraft(typeof(MouldingPlane), 1044042, 1024140, 0.0, 50.0, typeof(Log), 1044041, 4, 1044351);
AddCraft(typeof(SmoothingPlane), 1044042, 1024146, 0.0, 50.0, typeof(Log), 1044041, 4, 1044351);
@ -155,10 +153,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Tools
AddCraft(typeof(Scissors), 1044046, 1023998, 5.0, 55.0, typeof(IronIngot), 1044036, 2, 1044037);
AddCraft(typeof(MortarPestle), 1044046, 1023739, 20.0, 70.0, typeof(IronIngot), 1044036, 3, 1044037);
AddCraft(typeof(Scorp), 1044046, 1024327, 30.0, 80.0, typeof(IronIngot), 1044036, 2, 1044037);
@ -183,10 +177,6 @@ namespace Server.Engines.Craft
AddCraft(typeof(MapmakersPen), 1044046, 1044167, 25.0, 75.0, typeof(IronIngot), 1044036, 1, 1044037);
AddCraft(typeof(ScribesPen), 1044046, 1044168, 25.0, 75.0, typeof(IronIngot), 1044036, 1, 1044037);
#endregion
#region Parts
AddCraft(typeof(Gears), 1044047, 1024179, 5.0, 55.0, typeof(IronIngot), 1044036, 2, 1044037);
AddCraft(typeof(ClockParts), 1044047, 1024175, 25.0, 75.0, typeof(IronIngot), 1044036, 1, 1044037);
AddCraft(typeof(BarrelTap), 1044047, 1024100, 35.0, 85.0, typeof(IronIngot), 1044036, 2, 1044037);
@ -205,10 +195,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.ML);
}
#endregion
#region Utensils
AddCraft(typeof(ButcherKnife), 1044048, 1025110, 25.0, 75.0, typeof(IronIngot), 1044036, 2, 1044037);
AddCraft(typeof(SpoonLeft), 1044048, 1044158, 0.0, 50.0, typeof(IronIngot), 1044036, 1, 1044037);
AddCraft(typeof(SpoonRight), 1044048, 1044159, 0.0, 50.0, typeof(IronIngot), 1044036, 1, 1044037);
@ -222,10 +208,6 @@ namespace Server.Engines.Craft
AddCraft(typeof(PewterMug), 1044048, 1024097, 10.0, 60.0, typeof(IronIngot), 1044036, 2, 1044037);
AddCraft(typeof(SkinningKnife), 1044048, 1023781, 25.0, 75.0, typeof(IronIngot), 1044036, 2, 1044037);
#endregion
#region Misc
AddCraft(typeof(KeyRing), 1044050, 1024113, 10.0, 60.0, typeof(IronIngot), 1044036, 2, 1044037);
AddCraft(typeof(Candelabra), 1044050, 1022599, 55.0, 105.0, typeof(IronIngot), 1044036, 4, 1044037);
AddCraft(typeof(Scales), 1044050, 1026225, 60.0, 110.0, typeof(IronIngot), 1044036, 4, 1044037);
@ -260,10 +242,6 @@ namespace Server.Engines.Craft
SetNeededExpansion(index, Expansion.SE);
}
#endregion
#region Jewelry
AddJewelrySet(GemType.StarSapphire, typeof(StarSapphire));
AddJewelrySet(GemType.Emerald, typeof(Emerald));
AddJewelrySet(GemType.Sapphire, typeof(Sapphire));
@ -274,10 +252,6 @@ namespace Server.Engines.Craft
AddJewelrySet(GemType.Amber, typeof(Amber));
AddJewelrySet(GemType.Diamond, typeof(Diamond));
#endregion
#region Multi-Component Items
index = AddCraft(typeof(AxleGears), 1044051, 1024177, 0.0, 0.0, typeof(Axle), 1044169, 1, 1044253);
AddRes(index, typeof(Gears), 1044254, 1, 1044253);
@ -303,10 +277,6 @@ namespace Server.Engines.Craft
AddRes(index, typeof(BarrelLid), 1044251, 1, 1044253);
AddRes(index, typeof(BarrelTap), 1044252, 1, 1044253);
#endregion
#region Traps
// Dart Trap
index = AddCraft(typeof(DartTrapCraft), 1044052, 1024396, 30.0, 80.0, typeof(IronIngot), 1044036, 1, 1044037);
AddRes(index, typeof(Bolt), 1044570, 1, 1044253);
@ -349,8 +319,6 @@ namespace Server.Engines.Craft
1044253);
AddRes(index, typeof(IronIngot), 1044036, 10, 1044037);
#endregion
// Magic Jewelry
if (Core.ML)
{
@ -410,9 +378,9 @@ namespace Server.Engines.Craft
{
}
public LockableContainer Container{ get; private set; }
public LockableContainer Container { get; private set; }
public abstract TrapType TrapType{ get; }
public abstract TrapType TrapType { get; }
private int Verify(LockableContainer container)
{
@ -471,7 +439,7 @@ namespace Server.Engines.Craft
private class ContainerTarget : Target
{
private TrapCraft m_TrapCraft;
private readonly TrapCraft m_TrapCraft;
public ContainerTarget(TrapCraft trapCraft) : base(-1, false, TargetFlags.None) => m_TrapCraft = trapCraft;