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
|
|
@ -91,7 +91,7 @@ namespace Server.Spells
|
|||
|
||||
try
|
||||
{
|
||||
spm = ActivatorUtil.CreateInstance(type) as SpecialMove;
|
||||
spm = type.CreateInstance<SpecialMove>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -139,9 +139,9 @@ namespace Server.Spells
|
|||
|
||||
try
|
||||
{
|
||||
return (Spell)ActivatorUtil.CreateInstance(t, m_Params);
|
||||
return t.CreateInstance<Spell>(m_Params);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ namespace Server.Spells
|
|||
|
||||
try
|
||||
{
|
||||
return (Spell)ActivatorUtil.CreateInstance(t, m_Params);
|
||||
return t.CreateInstance<Spell>(m_Params);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace Server.Spells.Fifth
|
|||
{
|
||||
try
|
||||
{
|
||||
var creature = (BaseCreature)ActivatorUtil.CreateInstance(m_Types.RandomElement());
|
||||
var creature = m_Types.RandomElement().CreateInstance<BaseCreature>();
|
||||
|
||||
// creature.ControlSlots = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,18 +73,16 @@ namespace Server.Spells.First
|
|||
|
||||
public Item Create()
|
||||
{
|
||||
Item item;
|
||||
|
||||
try
|
||||
{
|
||||
item = (Item)ActivatorUtil.CreateInstance(Type);
|
||||
return Type.CreateInstance<Item>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
item = null;
|
||||
// ignored
|
||||
}
|
||||
|
||||
return item;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
try
|
||||
{
|
||||
summoned = ActivatorUtil.CreateInstance(toSummon) as Mobile;
|
||||
summoned = toSummon.CreateInstance<Mobile>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ namespace Server.Spells.Necromancy
|
|||
{
|
||||
try
|
||||
{
|
||||
var bc = (BaseCreature)ActivatorUtil.CreateInstance(entry.Type);
|
||||
var bc = entry.Type.CreateInstance<BaseCreature>();
|
||||
|
||||
// TODO: Is this right?
|
||||
bc.Skills.MagicResist.Base = m_From.Skills.MagicResist.Base;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
try
|
||||
{
|
||||
bc = ActivatorUtil.CreateInstance<T>();
|
||||
bc = typeof(T).CreateInstance<BaseCreature>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue