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
72 lines (57 loc) · 1.83 KB
/
ItemHandlerScript.cs
File metadata and controls
72 lines (57 loc) · 1.83 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
using System.Collections.Generic;
using log4net;
using L2dotNET.model.player;
using L2dotNET.Network.serverpackets;
using L2dotNET.world;
namespace L2dotNET.model.items
{
class ItemHandlerScript : ItemEffect
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ItemHandlerScript));
private readonly int _id;
public int EffectId = -1;
public int EffectLv;
public bool Pet = false;
public bool Player = true;
public bool Destroy = true;
public int PetId = -1;
public int SummonId = -1;
public int SummonStaticId = -1;
private SortedList<int, int> _exchangeItems;
public int SkillId;
public int SkillLv;
public ItemHandlerScript(int id)
{
_id = id;
}
public void AddExchangeItem(int itemId, int count)
{
if (_exchangeItems == null)
_exchangeItems = new SortedList<int, int>();
_exchangeItems.Add(itemId, count);
}
public override void UsePlayer(L2Player player, L2Item item)
{
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 != -1)
player.PetSummon(item, PetId);
if (SummonId != -1)
player.PetSummon(item, SummonId, false);
if (SummonStaticId != -1)
{
//NpcTable.Instance.SpawnNpc(SummonStaticID, player.X, player.Y, player.Z, player.Heading);
}
}
}
}