forked from neophoenix236/INVedit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.cs
69 lines (65 loc) · 1.34 KB
/
Item.cs
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Drawing;
namespace INVedit
{
public class Item
{
Data.Item item {
get {
if (Data.items.ContainsKey(ID)) {
if (Data.items[ID].ContainsKey(Damage))
return Data.items[ID][Damage];
else return Data.items[ID][0];
} else return null;
}
}
public short ID { get; set; }
public byte Count { get; set; }
public byte Slot { get; set; }
public short Damage { get; set; }
public bool Known { get { return (item != null); } }
public bool Alternative {
get {
if (!Known) return false;
return (Data.items[ID].Count > 1);
}
}
public string Name {
get {
if (!Known) return "Unknown item "+ID;
return item.name;
}
}
public byte Stack {
get {
if (!Known) return 64;
return item.stack;
}
}
public short MaxDamage {
get {
if (!Known) return 0;
return item.maxDamage;
}
}
public Image Image {
get {
if (!Known) return Data.unknown;
return Data.list.Images[item.imageIndex];
}
}
public Item(short id)
: this(id, 1, 0, 0) { }
public Item(short id, byte count)
: this(id, count, 0, 0) { }
public Item(short id, byte count, byte slot)
: this(id, count, slot, 0) { }
public Item(short id, byte count, byte slot, short damage)
{
ID = id;
Count = count;
Slot = slot;
Damage = damage;
}
}
}