forked from mochja/l2.net-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomAutoTargeting.l2s
82 lines (72 loc) · 2.01 KB
/
CustomAutoTargeting.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
// Kratky popis
// Server:
// Autor: mochitto
// Date:
// Special thanks for L2.NET contributors
// rev.: 0
PRINT_TEXT "SCRIPT STARTED!]"
INCLUDE StdLib/npc.l2c
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" SystemMessage 98
DEFINE_GLOBAL ARRAYLIST ALL_MOBLIST 0
DEFINE_GLOBAL SORTEDLIST RANGE_MOBLIST 0
DEFINE_GLOBAL INT MOB_DIST 0
DEFINE_GLOBAL INT MAX_MOB_DIST 100
DEFINE_GLOBAL INT NPC_DIST 10
DEFINE_GLOBAL INT MOB_DEAD 0
DEFINE_GLOBAL STRING ATTACK_SUBJECT 0
DEFINE_GLOBAL STRING MOB_DIST_STRING 0
// Main section
// ===============================
DO
CALLSUB DETECT_RANGE_MOBS
SLEEP 100
CALLSUB DESTROY_RANGE_MOBS
SLEEP 1000
LOOP CHAR_CUR_HP != ZERO
SLEEP 1000
END_SCRIPT
FUNCTION SystemMessage
DEFINE INT PacketType 0
DEFINE INT MsgID 0
DEFINE INT typesCount 0
PACKET.READ_BYTE PacketType
PACKET.READ_INT32 MsgID
PACKET.READ_INT32 typesCount
IF MsgID == #i181
PRINT_TEXT ">>>> recieved cantsee_sysmsg"
ENDIF
RETURN VOID
FUNCTION CONVERT_DIST 2 INTVALUE STRLENGTH
DEFINE STRING RETURNSTRING "<&INTVALUE&>"
DEFINE INT REST 0
REST = STRLENGTH - RETURNSTRING.LENGTH
FOR I 0 "<&REST&>" 1
RETURNSTRING = "#$0<&RETURNSTRING&>"
NEXT
RETURN RETURNSTRING
SUB DETECT_RANGE_MOBS
ALL_MOBLIST.CLEAR
RANGE_MOBLIST.CLEAR
GET_NPCS ALL_MOBLIST
sleep 100
PRINT_TEXT "moblist detected..."
FOREACH B NPC ALL_MOBLIST
IF ALL_MOBLIST.B.ATTACKABLE == ONE
DISTANCE MOB_DIST CHAR_X CHAR_Y CHAR_Z ALL_MOBLIST.B.X ALL_MOBLIST.B.Y ALL_MOBLIST.B.Z
IF MOB_DIST <= MAX_MOB_DIST
CONVERT_DIST MOB_DIST_STRING 2 MOB_DIST #i6
RANGE_MOBLIST.ADD ALL_MOBLIST.B.ID "<&MOB_DIST_STRING&>"
ENDIF
ENDIF
NEXTEACH
RETURNSUB
SUB DESTROY_RANGE_MOBS
IF TARGET_CUR_HP != ZERO
FOREACH D INT RANGE_MOBLIST
PRINT_TEXT "targetting <&RANGE_MOBLIST.D&>"
ATTACK_SUBJECT = RANGE_MOBLIST.D
PRINT_TEXT "<&RANGE_MOBLIST.GET_KEY D&>"
//TARGET "<&ATTACK_SUBJECT&>"
NEXTEACH
ENDIF
RETURNSUB