forked from mochja/l2.net-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuyItem - kópia.l2s
103 lines (89 loc) · 2.69 KB
/
BuyItem - kópia.l2s
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Kratky popis
// Server:
// Autor: mochitto
// Date:
// Special thanks for L2.NET contributors
// rev.: 0
PRINT_TEXT "SCRIPT STARTED!]"
SET_EVENT "<&SCRIPTEVENT_SERVERPACKETEX&>" "<&SYSTEM_CURRENTFILE&>" BuyList 183
include "class/tradeitem.l2c"
DEFINE_GLOBAL ARRAYLIST ITEM_LIST
DEFINE_GLOBAL ARRAYLIST BUY_ITEM_LIST
// Main section
// ===============================
//bsoe
BUY_ITEM VOID 2 1829 -1
SLEEP 8973234
PRINT_TEXT "SCRIPT STOPED!]"
END_SCRIPT
FUNCTION BuyList
define int size
define int ListId
PACKET.READ_BYTE NULL //writeC(0xFE);
PACKET.READ_INT16 NULL //writeH(0xB7);
PACKET.READ_INT64 NULL //writeQ(_money); // current money
PACKET.READ_INT32 ListId //writeD(_listId);
PACKET.READ_INT16 size //writeH(_list.size());
print_text "<&size&>"
FOR A 0 "<&size&>" 1
DEFINE TRADEITEM ITEM
PACKET.READ_INT16 NULL
PACKET.READ_INT32 NULL
PACKET.READ_INT32 ITEM.ITEMID
PACKET.READ_INT64 ITEM.CurrentCount
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT32 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT64 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
PACKET.READ_INT16 NULL
ITEM_LIST.ADD ITEM
DELETE ITEM
NEXT
sleep 1000
define string name
FOREACH A TRADEITEM ITEM_LIST
FOREACH B TRADEITEM BUY_ITEM_LIST
IF ITEM_LIST.A.ITEMID == BUY_ITEM_LIST.B.ITEMID
PRINT_TEXT "<&NAME&> <&ITEM_LIST.A.ITEMID&> <&ITEM_LIST.A.CurrentCount&>"
DEFINE BYTEBUFFER RequestBuyItem 256
RequestBuyItem.WRITE_BYTE #i64
RequestBuyItem.WRITE_INT32 ListId
RequestBuyItem.WRITE_INT32 1
RequestBuyItem.WRITE_INT32 BUY_ITEM_LIST.B.ITEMID
IF ITEM_LIST.A.CurrentCount > 0
IF BUY_ITEM_LIST.B.CurrentCount == -1
RequestBuyItem.WRITE_INT64 ITEM_LIST.A.CurrentCount
ENDIF
ELSE
RequestBuyItem.WRITE_INT64 BUY_ITEM_LIST.B.CurrentCount
ENDIF
RequestBuyItem.TRIM_TO_INDEX
INJECTBB RequestBuyItem
DELETE RequestBuyItem
ENDIF
NEXTEACH
NEXTEACH
// TODO BUY ITEM
INJECT "D0 76 00"
//23:06:04 :[Scroll of Escape: Clan Hall 1829 5
RETURN VOID
FUNCTION BUY_ITEM 2 ID COUNT
DEFINE TRADEITEM ITEM
ITEM.ITEMID = "<&ID&>"
ITEM.CURRENTCOUNT = "<&COUNT&>"
BUY_ITEM_LIST.ADD ITEM
DELETE ITEM
RETURN VOID