blob: cc9ef45971ea2a0fd7a87b6556cdb58668dc13f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using StardewValley.Tools;
namespace TrainerMod.ItemData
{
/// <summary>A weapon that can be searched and added to the player's inventory through the console.</summary>
internal class SearchableWeapon : ISearchItem
{
/*********
** Properties
*********/
/// <summary>The underlying item.</summary>
private readonly MeleeWeapon Weapon;
/*********
** Accessors
*********/
/// <summary>Whether the item is valid.</summary>
public bool IsValid => this.Weapon != null;
/// <summary>The item ID.</summary>
public int ID => this.Weapon.initialParentTileIndex;
/// <summary>The item name.</summary>
public string Name => this.Weapon.Name;
/// <summary>The item type.</summary>
public ItemType Type => ItemType.Weapon;
/*********
** Accessors
*********/
/// <summary>Construct an instance.</summary>
/// <param name="id">The weapon ID.</param>
public SearchableWeapon(int id)
{
try
{
this.Weapon = new MeleeWeapon(id);
}
catch
{
// invalid
}
}
}
}
|