Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
82
Projects/Scripts/Engines/VeteranRewards/RewardEntry.cs
Normal file
82
Projects/Scripts/Engines/VeteranRewards/RewardEntry.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
|
||||
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 = Activator.CreateInstance(ItemType, Args) as Item;
|
||||
|
||||
if (item is IRewardItem rewardItem)
|
||||
rewardItem.IsRewardItem = true;
|
||||
|
||||
return item;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue