forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmor.cs
More file actions
52 lines (46 loc) · 1.76 KB
/
Copy pathArmor.cs
File metadata and controls
52 lines (46 loc) · 1.76 KB
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
using System.Linq;
using L2dotNET.Enums;
using L2dotNET.Templates;
using L2dotNET.Utility;
namespace L2dotNET.Models.Items
{
public class Armor : ItemTemplate
{
public ArmorTypeId Type { get; set; }
private int AvoidModifier { get; set; }
private int Pdef { get; set; }
private int Mdef { get; set; }
private int MpBonus { get; set; }
private int HpBonus { get; set; }
public Armor(StatsSet set) : base(set)
{
Type = Utilz.GetEnumFromString(set.GetString("armor_type", "none"), ArmorTypeId.None);
AvoidModifier = set.GetInt("avoid_modify");
Pdef = set.GetInt("p_def");
Mdef = set.GetInt("m_def");
MpBonus = set.GetInt("mp_bonus");
HpBonus = set.GetInt("hp_bonus");
int bodyPart = BodyPart;
if ((bodyPart == SlotNeck) || (bodyPart == SlotFace) || (bodyPart == SlotHair) || (bodyPart == SlotHairall) || ((bodyPart & SlotREar) != 0) || ((bodyPart & SlotLFinger) != 0) || ((bodyPart & SlotBack) != 0))
{
Type1 = Type1WeaponRingEarringNecklace;
Type2 = Type2Accessory;
}
else
{
if ((Type == ArmorType.None.Id) && (BodyPart == SlotLHand)) // retail define shield as NONE
Type = ArmorType.Shield.Id;
Type1 = Type1ShieldArmor;
Type2 = Type2ShieldArmor;
}
}
public override int GetItemMask()
{
ArmorType orDefault = ArmorType.Values.FirstOrDefault(x => x.Id == Type);
if (orDefault == null)
return 0;
int firstOrDefault = orDefault.GetMask();
return firstOrDefault;
}
}
}