forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemHandlerScript.cs
More file actions
77 lines (61 loc) · 1.98 KB
/
Copy pathItemHandlerScript.cs
File metadata and controls
77 lines (61 loc) · 1.98 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
77
using System.Collections.Generic;
using L2dotNET.Models.Player;
using NLog;
namespace L2dotNET.Models.Items
{
class ItemHandlerScript : ItemEffect
{
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
private int Id { get; }
public bool Pet { get; set; }
public bool Player { get; set; } = true;
public bool Destroy { get; set; } = true;
public int? PetId { get; set; }
public int? SummonId { get; set; }
public int? SummonStaticId { get; set; }
public int EffectId { get; set; }
public int EffectLvl { get; set; }
public int SkillId { get; set; }
public int SkillLvl { get; set; }
private readonly Dictionary<int, int> _exchangeItems;
public ItemHandlerScript(int id)
{
Id = id;
_exchangeItems = new Dictionary<int, int>();
}
public void AddExchangeItem(int itemId, int count)
{
_exchangeItems.Add(itemId, count);
}
public override void UsePlayer(L2Player player, L2Item item)
{
// TODO: Debug this code
if (!Player)
{
base.UsePlayer(player, item);
return;
}
if (Destroy)
{
player.DestroyItem(item, 1);
}
if (_exchangeItems != null)
{
foreach (int val in _exchangeItems.Keys)
player.AddItem(val, _exchangeItems[val]);
}
if (PetId.HasValue)
{
player.PetSummon(item, PetId.Value);
}
if (SummonId.HasValue)
{
player.PetSummon(item, SummonId.Value, false);
}
if (SummonStaticId.HasValue)
{
//NpcTable.Instance.SpawnNpc(SummonStaticID.Value, player.X, player.Y, player.Z, player.Heading);
}
}
}
}