-
Notifications
You must be signed in to change notification settings - Fork 7
/
Targeting.js
160 lines (150 loc) · 5.18 KB
/
Targeting.js
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
////////////////////////////////////////////////////////////////////////////////
// ~ Targeting ~ //
// - Taldor / Quin - //
////////////////////////////////////////////////////////////////////////////////
//
// PvP a PvM targetovaci script
// -Script se po 800ms resetuje, cas se da nastavit: var resetTime = 800;
// -PvM script targetuje vsechny NON-HUMAN gray/red enemy, ignoruje vsechny vase summony a pety
// -PvP script targetuje vsechny humany (na DP bude nejspis nutno pozmenit kvuli vampum a nebo na jejich targetovani pouzivat PvM verzi to stejny plati o morfech)
// -AttackLastTarget nastavi client a system target na lasttarget a vypise nad jeho hlavou >>> Attack: Jmeno <<<
//
// Pouziti:
// Hotkey -> Run script :
// TargetNextEnemy_PvM()
// TargetNextEnemy_PvP()
// AttackLastTarget()
//
////////////////////////////////////////////////////////////////////////////////
function FindNearestEnemy_PvM(a) //subfunction
{
//timer rest idea from Caleb
var resetTime = 800;
var currentTimeMs = Orion.Now();
var lastTimeMs = Orion.GetGlobal("FindNearestEnemy_PvM_LastTime");
var timeSpan = currentTimeMs - lastTimeMs;
if (timeSpan > resetTime) {
//Orion.Print('-1', 'TIMER RESET: ' + timeSpan); //debug
Orion.IgnoreReset();
}
Orion.Ignore('self');
//Orion.UseIgnoreList('ignoreProvoke'); //example usage of custom IgnoreList
var enemy = Orion.FindType("!0x0190|!0x0191", "-1", "ground", "near|mobile|ignorefriends", 18, "gray|red");
if (!enemy.length) {
Orion.Print('-1', 'no enemy found, resetting ignore list');
Orion.IgnoreReset();
return '';
}
var eSummon = (Orion.FindObject(enemy[0])).CanChangeName();
while (eSummon) {
//Orion.Print('[Summon:] ' + (Orion.FindObject(enemy[0])).Name()); //debug print
Orion.Ignore(enemy[0]);
enemy = Orion.FindType("!0x0190|!0x0191", "-1", "ground", "near|mobile|ignorefriends", 18, "gray|red");
if (!enemy.length) {
Orion.Print('-1', 'no enemy found, resetting ignore list');
Orion.IgnoreReset();
return '';
}
eSummon = (Orion.FindObject(enemy[0])).CanChangeName();
}
Orion.SetGlobal("FindNearestEnemy_PvM_LastTime", Orion.Now());
return enemy[0];
}
function TargetNextEnemy_PvM() {
if (Orion.HaveTarget()) {
//Orion.TargetObject(lasttarget);
Orion.TargetObject(Orion.GetGlobal('global_enemy'));
} else {
var serial = FindNearestEnemy_PvM(0);
if (!serial.length) return;
var enemy = Orion.FindObject(serial);
var notoColor;
switch (enemy.Notoriety()) {
case 1:
notoColor = 2119;
break;
case 3:
notoColor = 906;
break;
case 6:
notoColor = 33;
break;
default:
notoColor = 906;
}
var loop = 0;
while (loop < 5) {
Orion.CharPrint(self, notoColor, ' ');
Orion.CharPrint(lasttarget, notoColor, ' ');
loop++;
}
Orion.CharPrint(self, notoColor, '[Enemy:] ' + enemy.Name() + ' ' + enemy.Hits('%') + '%');
Orion.CharPrint(serial, notoColor, '>>> ' + enemy.Name() + ' <<<');
Orion.SetGlobal('global_enemy', serial);
Orion.ClientLastTarget(serial);
Orion.TargetSystemSerial(serial);
Orion.Ignore(serial);
}
}
function FindNearestEnemy_PvP(a) //subfunction
{
//timer rest idea from Caleb
var resetTime = 800;
var currentTimeMs = Orion.Now();
var lastTimeMs = Orion.GetGlobal("FindNearestEnemy_PvP_LastTime");
var timeSpan = currentTimeMs - lastTimeMs;
if (timeSpan > resetTime) {
//Orion.Print('-1', 'TIMER RESET'); //debug
Orion.IgnoreReset();
}
Orion.Ignore('self');
var enemy = Orion.FindType("-1", "-1", "ground", "human|near|mobile|ignorefriends", 18, "gray|criminal|orange|red");
if (!enemy.length) {
Orion.Print('-1', 'no enemy found, resetting ignore list');
Orion.IgnoreReset();
return '';
}
Orion.SetGlobal("FindNearestEnemy_PvP_LastTime", Orion.Now());
return enemy[0];
}
function TargetNextEnemy_PvP() {
if (Orion.HaveTarget()) {
//Orion.TargetObject(lasttarget);
Orion.TargetObject(Orion.GetGlobal('global_enemy'));
} else {
var serial = FindNearestEnemy_PvP();
if (!serial.length) return;
var enemy = Orion.FindObject(serial);
var notoColor;
switch (enemy.Notoriety()) {
case 1:
notoColor = 2119;
break;
case 3:
notoColor = 906;
break;
case 6:
notoColor = 33;
break;
default:
notoColor = 906;
}
var loop = 0;
while (loop < 5) {
Orion.CharPrint(self, notoColor, ' ');
Orion.CharPrint(lasttarget, notoColor, ' ');
loop++;
}
Orion.CharPrint(self, notoColor, '[Enemy:] ' + enemy.Name() + ' ' + enemy.Hits('%') + '% HP');
Orion.CharPrint(serial, notoColor, '*** Target: ' + enemy.Name() + ' ***');
Orion.SetGlobal('global_enemy', serial);
Orion.ClientLastTarget(serial);
Orion.TargetSystemSerial(serial);
Orion.Ignore(serial);
}
}
function AttackLastTarget() {
Orion.ClientLastTarget('lasttarget');
Orion.TargetSystemSerial('lasttarget');
Orion.CharPrint('lasttarget', 0x17, '>>> Attack: ' + Orion.RequestName(lasttarget, 500) + ' <<<');
}