forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemTemplate.cs
More file actions
76 lines (64 loc) · 2.36 KB
/
Copy pathItemTemplate.cs
File metadata and controls
76 lines (64 loc) · 2.36 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System.Linq;
using L2dotNET.DataContracts.Shared.Enums;
using L2dotNET.Enums;
using L2dotNET.Templates;
namespace L2dotNET.Models.Items
{
public abstract class ItemTemplate
{
public int ItemId { get; set; }
public string Name { get; set; }
public int Type1 { get; set; }
public int Type2 { get; set; }
public int Weight { get; set; }
public int Duration { get; set; }
public int Price { get; set; }
public CrystalTypeId CrystalType { get; set; }
public int CrystalCount { get; set; }
public bool Crystallizable { get; set; }
public bool Stackable { get; set; }
public bool Sellable { get; set; }
public bool Dropable { get; set; }
public bool Destroyable { get; set; }
public bool Tradeable { get; set; }
public bool Depositable { get; set; }
public BodyPartType BodyPart { get; set; }
public bool HeroItem => ItemId >= 6611 && ItemId <= 6621 || ItemId == 6842;
public bool IsOlyRestricted { get; set; }
public ActionType DefaultAction { get; set; }
public abstract int GetItemMask();
public CrystalType GetCrystalType()
{
return Enums.CrystalType.Values.First(x => x.Id == CrystalType);
}
public int GetCrystalCount(int enchantLevel)
{
CrystalType crystalType = GetCrystalType();
if (enchantLevel > 3)
{
switch (Type2)
{
case 1:
case 2:
return CrystalCount + crystalType.CrystalEnchantBonusArmor * (3 * enchantLevel - 6);
case 0:
return CrystalCount + crystalType.CrystalEnchantBonusWeapon * (2 * enchantLevel - 3);
default:
return CrystalCount;
}
}
if (enchantLevel <= 0)
return CrystalCount;
switch (Type2)
{
case 1:
case 2:
return CrystalCount + crystalType.CrystalEnchantBonusArmor * enchantLevel;
case 0:
return CrystalCount + crystalType.CrystalEnchantBonusWeapon * enchantLevel;
default:
return CrystalCount;
}
}
}
}