forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemList.cs
More file actions
66 lines (58 loc) · 2.06 KB
/
Copy pathItemList.cs
File metadata and controls
66 lines (58 loc) · 2.06 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
using System.Collections.Generic;
using L2dotNET.Models.Items;
using L2dotNET.Models.Player;
namespace L2dotNET.Network.serverpackets
{
class ItemList : GameserverPacket
{
private readonly bool _showWindow;
private readonly List<ItemListItem> _items = new List<ItemListItem>();
private readonly List<int> _blocked = new List<int>();
public ItemList(L2Player player, bool showWindow)
{
_showWindow = showWindow;
foreach (L2Item item in player.Inventory.Items)
{
_items.Add(new ItemListItem
{
ObjectId = item.ObjectId,
ItemId = item.Template.ItemId,
Slot = item.SlotLocation,
Count = item.Count,
Type2 = (short)item.Template.Type2,
CType1 = item.CustomType1,
Equip = item.IsEquipped,
Bodypart = (int) item.Template.BodyPart,
Enchant = item.Enchant,
CType2 = item.CustomType2,
Augment = item.AugmentationId,
Mana = item.Durability,
TimeLeft = item.LifeTimeEnd()
});
if (item.Blocked)
_blocked.Add(item.ObjectId);
}
}
public override void Write()
{
WriteByte(0x1b);
WriteShort(_showWindow ? 1 : 0);
WriteShort(_items.Count);
foreach (ItemListItem item in _items)
{
WriteShort(item.CType1);
WriteInt(item.ObjectId);
WriteInt(item.ItemId);
WriteInt(item.Count);
WriteShort(item.Type2);
WriteShort(item.CType1);
WriteShort(item.Equip);
WriteInt(item.Bodypart);
WriteShort(item.Enchant);
WriteShort(item.CType2);
WriteInt(item.Augment);
WriteInt(item.Mana);
}
}
}
}