-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTurboKey.mac
More file actions
70 lines (60 loc) · 3.03 KB
/
Copy pathTurboKey.mac
File metadata and controls
70 lines (60 loc) · 3.03 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
67
68
69
70
| * * * * * * * * * * [ T u r b o K e y ] * * * * * * * * * *
| _____ _ _____________ _____ _ __ _______ __
| |_ _| | | | ___ \ ___ \| _ | | / /| ___\ \ / /
| | | | | | | |_/ / |_/ /| | | | |/ / | |__ \ V /
| | | | | | | /| ___ \| | | | \ | __| \ /
| | | | |_| | |\ \| |_/ /\ \_/ / |\ \| |___ | |
| \_/ \___/\_| \_\____/ \___/\_| \_/\____/ \_/
|---------------------------------------------------------------------------------->
| https://www.github.com/drel-git/TurboLoot (INI tag helper)
| TurboKey v3.7.9 - cursor -> [ItemLimits]
|---------------------------------------------------------------------------------->
|
| Usage: /mac TurboKey KEEP|SELL|IGNORE|SKIP|BANK|TRIBUTE|ALL|DESTROY
| Writes to: turboloot.ini -> [ItemLimits] (same path as TurboLoot)
| For DESTROY/IGNORE/SKIP: marks in INI then destroys item on cursor
| For others: marks in INI then /autoinv
| Overwrites existing rule for the exact same item name
Sub Main(string RuleIn)
/declare section string local ItemLimits
/declare rule string local ${String[${RuleIn}].Upper}
/declare itemName string local ${Cursor.Name}
| Resolve INI path (match turboLoot: Config first, then Macros)
/declare tlIniFile string local "../Config/turboloot.ini"
/if (!${Ini.File[${tlIniFile}].Exists}) {
/varset tlIniFile "../Macros/turboloot.ini"
}
/if (!${rule.Length} || ${rule.Equal[HELP]}) {
/echo \at[TurboKey] \auUsage:\ax /mac TurboKey \agKEEP\ax|\agSELL\ax|\apBANK\ax|\ayTRIBUTE\ax|\arDESTROY\ax|\aoIGNORE\ax|\aoSKIP\ax|\awALL\ax
/echo \at[TurboKey] \awHold item on cursor, then run command to add it to turboloot.ini\ax
/echo \at[TurboKey] \awSee /mac turboloot help for full command list\ax
/return
}
/if (!${rule.Equal[KEEP]} && !${rule.Equal[SELL]} && !${rule.Equal[IGNORE]} && !${rule.Equal[SKIP]} && !${rule.Equal[BANK]} && !${rule.Equal[TRIBUTE]} && !${rule.Equal[ALL]} && !${rule.Equal[DESTROY]}) {
/echo \arInvalid rule: \ay${rule}\ar. Valid: KEEP SELL IGNORE SKIP BANK TRIBUTE ALL DESTROY
/return
}
/if (!${itemName.Length} || ${itemName.Equal[NULL]}) {
/echo \arYou have nothing valid on your cursor.
/return
}
| Read any existing value (if present) so we can message clearly
/declare oldRule string local ${Ini["${tlIniFile}","${section}","${itemName}"]}
| This SETS the value; if the key already exists it is overwritten in-place
/ini "${tlIniFile}" "${section}" "${itemName}" "${rule}"
/if (${oldRule.Length}) {
/echo \atUpdated \ag${itemName}\at in \ag[${section}]\at: \ay${oldRule}\at -> \ag${rule}\at.
} else {
/echo \atAdded \ag${itemName}\at to \ag[${section}]\at as \ag${rule}\at.
}
| DESTROY and IGNORE: destroy item on cursor (fast path)
/if (${rule.Equal[DESTROY]} || ${rule.Equal[IGNORE]} || ${rule.Equal[SKIP]}) {
/destroy
/delay 1
/if (${Window[ConfirmationDialogBox].Open}) /notify ConfirmationDialogBox Yes_Button leftmouseup
/delay 5 !${Cursor.ID}
/return
}
| All other rules: return item to inventory
/autoinv
/return