Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -35,8 +35,8 @@ namespace Server.Engines.Craft
CraftContext context = craftSystem.GetContext(from);
from.CloseGump(typeof(CraftGump));
from.CloseGump(typeof(CraftGumpItem));
from.CloseGump<CraftGump>();
from.CloseGump<CraftGumpItem>();
AddPage(0);
@ -125,7 +125,7 @@ namespace Server.Engines.Craft
if (from.Backpack != null)
{
Item[] items = from.Backpack.FindItemsByType(resourceType, true);
Item[] items = from.Backpack.FindItemsByType(resourceType);
for (int i = 0; i < items.Length; ++i)
resourceCount += items[i].Amount;
@ -163,7 +163,7 @@ namespace Server.Engines.Craft
if (from.Backpack != null)
{
Item[] items = from.Backpack.FindItemsByType(resourceType, true);
Item[] items = from.Backpack.FindItemsByType(resourceType);
for (int i = 0; i < items.Length; ++i)
resourceCount += items[i].Amount;
@ -219,7 +219,7 @@ namespace Server.Engines.Craft
if (from.Backpack != null)
{
Item[] items = from.Backpack.FindItemsByType(subResource.ItemType, true);
Item[] items = from.Backpack.FindItemsByType(subResource.ItemType);
for (int j = 0; j < items.Length; ++j)
resourceCount += items[j].Amount;
@ -471,8 +471,6 @@ namespace Server.Engines.Craft
{
if (m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count)
{
int groupIndex = context?.LastGroupIndex ?? -1;
CraftSubRes res = system.CraftSubRes.GetAt(index);
if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)
@ -489,8 +487,6 @@ namespace Server.Engines.Craft
}
else if (m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count)
{
int groupIndex = context?.LastGroupIndex ?? -1;
CraftSubRes res = system.CraftSubRes2.GetAt(index);
if (m_From.Skills[system.MainSkill].Base < res.RequiredSkill)

View file

@ -34,8 +34,8 @@ namespace Server.Engines.Craft
m_CraftItem = craftItem;
m_Tool = tool;
from.CloseGump(typeof(CraftGump));
from.CloseGump(typeof(CraftGumpItem));
from.CloseGump<CraftGump>();
from.CloseGump<CraftGumpItem>();
AddPage(0);
AddBackground(0, 0, 530, 417, 5054);
@ -143,7 +143,7 @@ namespace Server.Engines.Craft
for (int i = 0; i < m_CraftItem.Skills.Count; i++)
{
CraftSkill skill = m_CraftItem.Skills.GetAt(i);
double minSkill = skill.MinSkill, maxSkill = skill.MaxSkill;
double minSkill = skill.MinSkill;
if (minSkill < 0)
minSkill = 0;

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Commands;
using Server.Factions;
using Server.Items;
@ -142,6 +141,7 @@ namespace Server.Engines.Craft
}
catch
{
// ignored
}
if (item != null)
@ -177,9 +177,9 @@ namespace Server.Engines.Craft
public bool ConsumeAttributes(Mobile from, ref object message, bool consume)
{
bool consumMana = false;
bool consumHits = false;
bool consumStam = false;
bool consumMana;
bool consumHits;
bool consumStam;
if (Hits > 0 && from.Hits < Hits)
{
@ -755,7 +755,7 @@ namespace Server.Engines.Craft
public void Craft(Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
{
if (from.BeginAction(typeof(CraftSystem)))
if (from.BeginAction<CraftSystem>())
{
if (RequiredExpansion == Expansion.None ||
from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion))
@ -794,39 +794,39 @@ namespace Server.Engines.Craft
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool, message));
}
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool, message));
}
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
}
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool,
1072847)); // You must learn that recipe from a scroll.
}
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool,
1044153)); // You don't have the required skills to attempt this item.
}
}
else
{
from.EndAction(typeof(CraftSystem));
from.EndAction<CraftSystem>();
from.SendGump(new CraftGump(from, craftSystem, tool,
RequiredExpansionMessage(RequiredExpansion))); //The {0} expansion is required to attempt this item.
}
@ -1098,7 +1098,7 @@ namespace Server.Engines.Craft
}
else
{
m_From.EndAction(typeof(CraftSystem));
m_From.EndAction<CraftSystem>();
int badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.ItemType);

View file

@ -80,18 +80,18 @@ namespace Server.Engines.Craft
}
int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
int dura = 0, luck = 0, lreq = 0, dinc = 0;
int baseChance = 0;
int dura, luck, lreq, dinc = 0;
int baseChance;
bool physBonus = false;
bool fireBonus = false;
bool coldBonus = false;
bool nrgyBonus = false;
bool poisBonus = false;
bool duraBonus = false;
bool luckBonus = false;
bool lreqBonus = false;
bool dincBonus = false;
bool fireBonus;
bool coldBonus;
bool nrgyBonus;
bool poisBonus;
bool duraBonus;
bool luckBonus;
bool lreqBonus;
bool dincBonus;
if (item is BaseWeapon weapon)
{

View file

@ -17,7 +17,7 @@ namespace Server.Engines.Craft
public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes,
BaseTool tool) : base(100, 200)
{
from.CloseGump(typeof(QueryMakersMarkGump));
from.CloseGump<QueryMakersMarkGump>();
m_Quality = quality;
m_From = from;

View file

@ -56,7 +56,7 @@ namespace Server.Engines.Craft
private static void LearnAllRecipes_OnCommand(CommandEventArgs e)
{
Mobile m = e.Mobile;
m.SendMessage("Target a player to teach them all of the recipies.");
m.SendMessage("Target a player to teach them all of the recipes.");
m.BeginTarget(-1, false, TargetFlags.None, delegate(Mobile from, object targeted)
{
@ -65,7 +65,7 @@ namespace Server.Engines.Craft
foreach (KeyValuePair<int, Recipe> kvp in Recipes)
mobile.AcquireRecipe(kvp.Key);
m.SendMessage("You teach them all of the recipies.");
m.SendMessage("You teach them all of the recipes.");
}
else
{
@ -75,11 +75,11 @@ namespace Server.Engines.Craft
}
[Usage("ForgetAllRecipes")]
[Description("Makes a player forget all the recipies they've learned.")]
[Description("Makes a player forget all the recipes they've learned.")]
private static void ForgetAllRecipes_OnCommand(CommandEventArgs e)
{
Mobile m = e.Mobile;
m.SendMessage("Target a player to have them forget all of the recipies they've learned.");
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)
{
@ -87,7 +87,7 @@ namespace Server.Engines.Craft
{
mobile.ResetRecipes();
m.SendMessage("They forget all their recipies.");
m.SendMessage("They forget all their recipes.");
}
else
{

View file

@ -37,11 +37,6 @@ namespace Server.Engines.Craft
m_Deed = deed;
}
private static void EndGolemRepair(object state)
{
((Mobile)state).EndAction(typeof(Golem));
}
private int GetWeakenChance(Mobile mob, SkillName skill, int curHits, int maxHits)
{
// 40% - (1% per hp lost) - (1% per 10 craft skill)
@ -229,14 +224,14 @@ namespace Server.Engines.Craft
}
else
{
double skillValue = usingDeed ? m_Deed.SkillLevel : from.Skills[SkillName.Tinkering].Value;
double skillValue = usingDeed ? m_Deed.SkillLevel : from.Skills.Tinkering.Value;
if (skillValue < 60.0)
{
number =
1044153; // You don't have the required skills to attempt this item. //TODO: How does OSI handle this with deeds with golems?
}
else if (!from.CanBeginAction(typeof(Golem)))
else if (!from.CanBeginAction<Golem>())
{
number = 501789; // You must wait before trying again.
}
@ -263,9 +258,8 @@ namespace Server.Engines.Craft
number = 1044279; // You repair the item.
toDelete = true;
from.BeginAction(typeof(Golem));
Timer.DelayCall(TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndGolemRepair),
from);
from.BeginAction<Golem>();
Timer.DelayCall(TimeSpan.FromSeconds(12.0), from.EndAction<Golem>);
}
else
{

View file

@ -95,7 +95,7 @@ namespace Server.Engines.Craft
break;
}
if (difficulty > from.Skills[SkillName.Mining].Value)
if (difficulty > from.Skills.Mining.Value)
return SmeltResult.NoSkill;
Type resourceType = info.ResourceTypes[0];
@ -130,9 +130,7 @@ namespace Server.Engines.Craft
{
if (num == 1044267)
{
bool anvil, forge;
DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);
DefBlacksmithy.CheckAnvilAndForge(from, 2, out bool anvil, out bool forge);
if (!anvil)
num = 1044266; // You must be near an anvil

View file

@ -84,7 +84,7 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
int index = -1;
int index;
// Refresh Potion
index = AddCraft(typeof(RefreshPotion), 1044530, 1044538, -25, 25.0, typeof(BlackPearl), 1044353, 1, 1044361);

View file

@ -118,8 +118,7 @@ namespace Server.Engines.Craft
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
bool anvil, forge;
CheckAnvilAndForge(from, 2, out anvil, out forge);
CheckAnvilAndForge(from, 2, out bool anvil, out bool forge);
if (anvil && forge)
return 0;

View file

@ -76,7 +76,7 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
int index = -1;
int index;
// Materials
AddCraft(typeof(Kindling), 1044457, 1023553, 0.0, 00.0, typeof(Log), 1044041, 1, 1044351);

View file

@ -71,7 +71,7 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
int index = -1;
int index;
/* Begin Ingredients */
index = AddCraft(typeof(SackFlour), 1044495, 1024153, 0.0, 100.0, typeof(WheatSheaf), 1044489, 2, 1044490);

View file

@ -41,14 +41,12 @@ namespace Server.Engines.Craft
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckTool(tool, from))
return 1048146; // If you have a tool equipped, you must use that tool.
if (!(from is PlayerMobile mobile && mobile.Glassblowing && mobile.Skills[SkillName.Alchemy].Base >= 100.0))
if (!(from is PlayerMobile mobile && mobile.Glassblowing && mobile.Skills.Alchemy.Base >= 100.0))
return 1044634; // You havent learned glassblowing.
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.
bool anvil, forge;
DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);
DefBlacksmithy.CheckAnvilAndForge(from, 2, out _, out bool forge);
if (forge)
return 0;

View file

@ -43,7 +43,7 @@ namespace Server.Engines.Craft
return 1044038; // You have worn out your tool!
if (!BaseTool.CheckTool(tool, from))
return 1048146; // If you have a tool equipped, you must use that tool.
if (!(from is PlayerMobile mobile && mobile.Masonry && mobile.Skills[SkillName.Carpentry].Base >= 100.0))
if (!(from is PlayerMobile mobile && mobile.Masonry && mobile.Skills.Carpentry.Base >= 100.0))
return 1044633; // You havent learned stonecraft.
if (!BaseTool.CheckAccessible(tool, from))
return 1044263; // The tool must be on your person to use.

View file

@ -95,7 +95,7 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
int index = -1;
int index;
#region Hats

View file

@ -146,7 +146,7 @@ namespace Server.Engines.Craft
public override void InitCraftList()
{
int index = -1;
int index;
#region Wooden Items
@ -489,9 +489,7 @@ namespace Server.Engines.Craft
protected override void OnTarget(Mobile from, object targeted)
{
int message;
if (m_TrapCraft.Acquire(targeted, out message))
if (m_TrapCraft.Acquire(targeted, out int message))
m_TrapCraft.CraftItem.CompleteCraft(m_TrapCraft.Quality, false, m_TrapCraft.From,
m_TrapCraft.CraftSystem, m_TrapCraft.TypeRes, m_TrapCraft.Tool, m_TrapCraft);
else