-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMCS-AutoLooter.txt
282 lines (249 loc) · 8.89 KB
/
MCS-AutoLooter.txt
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
;==============================================================================
; AutoLooter
;
; 1) Go within 2 tiles of a corpse you want to loot
; 2) Press the hotkey
;
; Configurable to prioritize looting:
; - Based on PvP vs. PvE mode
; - Based on item (e.g. loots valuable items fast and regs and potions slowly)
;
;==============================================================================
InitEvents ; Initialize Macro Events
Set #LPC 1000
;------------------------------------------------------------------------------
; Hotkeys
;------------------------------------------------------------------------------
Set %hk_autoloot F5 ; Hotkey for typical (automatic) full looting
Set %hk_manual F6 ; Hotkey for looting a specific corpse
Set %hk_switch_speed F7 ; Hotkey for switching between fast and slow drag speeds
Set %hk_switch_loot_mode F8 ; Hotkey for switching PvE <-> PvP modes
;------------------------------------------------------------------------------
; Delays
;------------------------------------------------------------------------------
Set %fast_delay 600 ; (ms) Delay for looting as fast as possible
Set %slow_delay 700 ; (ms) Delay for looting items slowly to avoid raising suspicion
;------------------------------------------------------------------------------
; Mode defaults
;------------------------------------------------------------------------------
Set %pvp_pvez_mode 1 ; Default loot mode to PvP
;------------------------------------------------------------------------------
; Item IDs
;------------------------------------------------------------------------------
Set %itid_corpses YFM_QNF_PNF_KNF_JNF_MNF_LNF_WNF_VNF_YNF ; Corpse and bone types
Set %itid_containers ZJF_CKF_YKK_LKF_CUD
Set %itid_weapons YPO_BNF_CPH_INF_FSF_OSF_ASF_HNF_FMH_CNF_LSF_NSF_ISF_SMH_RMH_CSF_ZRF_MPH_LPH_MSF_BSF_KPO_GUO_KTF_JTF_BPH_EPH_ZSF_ATF_JPH_SOH_POH_NMH_OMH_LPO_ZTO_XTH_YTH_HSF_KSF_NPO_XPO_FUO_JPO_QPF_NPF_KPH_FYG_RHM_SFR_SRH_AQF_PPF_TSF_WSF_BUO_VPO_WPO_WRH_VRH_XRH_YRH_LTF_MTF_OPO_RRH_CUO_OLH_JOH_URH_EMH_WTH_DMH_QMH_CFF_BFF_PMH_GMH_ZPF_CQF_FFF_RPF_TRH_YSF_XSF_FBG_VTH_AUH_ZTH_UOH_VOH_AUO_MPO_BUH_CUH_DMH_GFF_QOH_HFF_TLH_GBG_WOH_TOH_QPO_SPO_WOH_TOH_JSF_USF_LMH_MMH_QPO_SPO_PPO_RPO_JSF_USF_LMH_MMH_PPO_RPO_JSF_KTO
Set %itid_regs RZF_SZF_JZF_MZF_KZF_JUF_WZF_KUF
Set %itid_pots TUF_ZUF_UUF_YUF_NUF_XUF
Set %itid_gold POF
;==============================================================================
; Set up loot bag first
;==============================================================================
GoSub SetLootBag
;==============================================================================
; Main Event Loop
;==============================================================================
HotKeyLoop:
Repeat
onHotKey %hk_autoloot
{
Event SysMessage Looting corpses...
GoSub AutoLoot
}
onHotKey %hk_manual
{
Event SysMessage Choosing corpse to loot...
GoSub Manual
}
onHotKey %hk_switch_loot_mode
{
GoSub SwitchLootMode
}
Sleep 1
until #FALSE
;==============================================================================
; Automatically loot all corpses in a 2 tile radius
;==============================================================================
sub AutoLoot
Set %count 0
; Find a corpse nearby
GoSub FindCorpse
; If nothing was found, return
If %corpseID = #FALSE
return
; Decide what to loot
If %pvp_pvez_mode = 1
{
; What to loot in PvP mode:
; Loot stuff in order of importance, bags and weapons first etc.
;
; Weapons (ALL)
GoSub LootItems %fast_delay %itid_weapons
; Bags & containers
GoSub LootItems %fast_delay %itid_containers
; Reagents
GoSub LootItems %slow_delay %itid_regs
; Potions
;GoSub LootItems %slow_delay TUF ; Explos before rest of the pots
;GoSub LootItems %slow_delay ZUF_UUF_YUF_NUF_XUF
GoSub LootItems %slow_delay %itid_pots
; Gold
GoSub LootItems %fast_delay %itid_gold
}
Else
{
; What to loot in PvE mode:
; Reagents
GoSub LootItems %slow_delay %itid_regs
; Gold
GoSub LootItems %slow_delay %itid_gold
}
Event SysMessage Items looted: %count
return
;==============================================================================
; Manually select and loot a corpse
;==============================================================================
sub Manual
Set %count 0
GoSub TargetCorpse
GoSub LootItems %slow_delay *
Event SysMessage Items looted: %count
return
;==============================================================================
; Target a specific corpse for looting
;==============================================================================
sub TargetCorpse
Event SysMessage Target the corpse you wish to loot
Set #TARGCURS 1
targloop:
If #TARGCURS = 1
goto targloop
;Target
FindItem #LTARGETID G_2
If #FINDCNT > 0 && #FINDTYPE in %itid_corpses
{
GoSub OpenCorpse #LTARGETID
}
Else
{
Event SysMessage Error: that is not a corpse or it's too far
goto HotKeyLoop
}
return
;==============================================================================
; Find all corpses in a 2 tile radius, closest first
;==============================================================================
sub FindCorpse
Set %corpseID #FALSE
For %i 0 2
{
FindItem %itid_corpses G_ , %i
If #FINDCNT > 0
{
Set %corpseID #FINDID
GoSub OpenCorpse %corpseID
break
}
}
return
;==============================================================================
; Open corpse for looting (sets LOBJECTID if not set)
;==============================================================================
sub OpenCorpse
Set %corpseID %1
; Open the corpse only If it hasn't been opened yet
; by razor for example, saves some time
If #CONTID <> %corpseID
{
Set #LOBJECTID %corpseID
Event Macro 17
Sleep 800
}
return
;==============================================================================
; Automatically loot items from corpse
;==============================================================================
sub LootItems
Set %delay %1
Set %items %2
Repeat
FindItem %items C_ , %corpseID
If #FINDCNT > 0
{
GoSub LootItem #FINDID #FINDSTACK
Sleep %delay
Set %count %count + 1
}
until #FINDCNT < 1
return
;==============================================================================
; Drag individual item from corpse to container
;==============================================================================
sub LootItem
; Check that corpse is still in range
FindItem %corpseID G_2
If #FINDCNT = 0
{
Event SysMessage Error: The corpse is no longer in range, aborting.
goto HotKeyLoop
}
; Drag item and drop into loot bag
exEvent Drag %1 %2
If *lootBag <> #BACKPACKID
{
FindItem *lootBag C_ , #BACKPACKID
If #FINDCNT = 0
{
Event SysMessage Loot bag not found, using backpack as loot bag instead
Set *lootBag #BACKPACKID
}
}
exEvent DropC *lootBag
return
;==============================================================================
; Set loot bag
;==============================================================================
sub SetLootBag
; Check for existing loot bag
FindItem *lootBag C_ , #BACKPACKID
If #FINDCNT > 0
{
Event SysMessage Previous loot bag exists, using that.
return
}
; Pick a new loot bag
Event SysMessage Target the container in your backpack you wish to use as a loot bag, or target yourself
Set #TARGCURS 1
targloop:
If #TARGCURS = 1
goto targloop
;Target
; Analyze and set users choice
FindItem #LTARGETID C_ , #BACKPACKID
If #FINDCNT > 0 && #FINDTYPE in %itid_containers
{
Event SysMessage Using that as loot bag
Set *lootBag #FINDID
}
Else
{
Event SysMessage Using your backpack as a loot bag
Set *lootBag #BACKPACKID
}
return
;==============================================================================
; Switch looting mode
;==============================================================================
sub SwitchLootMode
Sleep 100
If %pvp_pvez_mode = 1
{
Event SysMessage Switched to mode: PvE
Set %pvp_pvez_mode 0
}
Else
{
Event SysMessage Switched to mode: PvP
Set %pvp_pvez_mode 1
}
return