Fixes dupe exception (#258)
- [X] Cleans up ActivatorUtil - [X] Fixes dupe exception - [X] Fixes a bug in BasePotion - [X] Fixes a few possible memory leaks Bumps release version
This commit is contained in:
parent
4d6e584b6c
commit
e9c1e4cbba
66 changed files with 597 additions and 496 deletions
|
|
@ -244,7 +244,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
try
|
||||
{
|
||||
item = ActivatorUtil.CreateInstance(type) as Item;
|
||||
item = type.CreateInstance<Item>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1188,7 +1188,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
else
|
||||
{
|
||||
item = ActivatorUtil.CreateInstance(ItemType) as Item;
|
||||
item = ItemType.CreateInstance<Item>();
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
|
|
@ -1428,27 +1428,22 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (typeof(CustomCraft).IsAssignableFrom(m_CraftItem.ItemType))
|
||||
{
|
||||
CustomCraft cc = null;
|
||||
|
||||
try
|
||||
{
|
||||
cc = ActivatorUtil.CreateInstance(
|
||||
m_CraftItem.ItemType,
|
||||
m_CraftItem.ItemType.CreateInstance<CustomCraft>(
|
||||
m_From,
|
||||
m_CraftItem,
|
||||
m_CraftSystem,
|
||||
m_TypeRes,
|
||||
m_Tool,
|
||||
quality
|
||||
) as CustomCraft;
|
||||
)?.EndCraftAction();
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
// ignored
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
cc?.EndCraftAction();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
|
||||
var resourceType = info.ResourceTypes[0];
|
||||
var ingot = (Item)ActivatorUtil.CreateInstance(resourceType);
|
||||
var ingot = resourceType.CreateInstance<Item>();
|
||||
|
||||
if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed ||
|
||||
item is BaseWeapon weapon && weapon.PlayerConstructed ||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044009;
|
||||
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ??= new DefInscription();
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item) => 0.0;
|
||||
|
||||
|
|
@ -55,9 +55,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (typeItem != null)
|
||||
{
|
||||
var o = ActivatorUtil.CreateInstance(typeItem);
|
||||
var scroll = typeItem.CreateEntityInstance<SpellScroll>();
|
||||
|
||||
if (o is SpellScroll scroll)
|
||||
if (scroll != null)
|
||||
{
|
||||
var hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;
|
||||
|
||||
|
|
@ -65,11 +65,6 @@ namespace Server.Engines.Craft
|
|||
|
||||
return hasSpell ? 0 : 1042404; // null : You don't have that spell!
|
||||
}
|
||||
|
||||
if (o is Item item)
|
||||
{
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue