Adds assemblies config, fixes crash bugs. (#134)

This commit is contained in:
Kamron Batman 2020-05-09 12:55:56 -07:00 • committed by GitHub
parent 0140eb73b4
commit 8ec166bcd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3223 changed files with 191 additions and 191 deletions

View file

@ -1,83 +0,0 @@
using System;
using Server.Utilities;
namespace Server.Engines.VeteranRewards
{
public class RewardEntry
{
public RewardEntry(RewardCategory category, int name, Type itemType, params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
Name = name;
Args = args;
category.Entries.Add(this);
}
public RewardEntry(RewardCategory category, string name, Type itemType, params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = Expansion.None;
NameString = name;
Args = args;
category.Entries.Add(this);
}
public RewardEntry(RewardCategory category, int name, Type itemType, Expansion requiredExpansion,
params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
Name = name;
Args = args;
category.Entries.Add(this);
}
public RewardEntry(RewardCategory category, string name, Type itemType, Expansion requiredExpansion,
params object[] args)
{
Category = category;
ItemType = itemType;
RequiredExpansion = requiredExpansion;
NameString = name;
Args = args;
category.Entries.Add(this);
}
public RewardList List { get; set; }
public RewardCategory Category { get; }
public Type ItemType { get; }
public Expansion RequiredExpansion { get; }
public int Name { get; }
public string NameString { get; }
public object[] Args { get; }
public Item Construct()
{
try
{
Item item = ActivatorUtil.CreateInstance(ItemType, Args) as Item;
if (item is IRewardItem rewardItem)
rewardItem.IsRewardItem = true;
return item;
}
catch
{
// ignored
}
return null;
}
}
}