-
Notifications
You must be signed in to change notification settings - Fork 0
/
pawn.cmd
70 lines (56 loc) · 2.38 KB
/
pawn.cmd
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
include libmaster.cmd
var container $char.inv.container.pawn
var dryRun false
if_1 then {
var dryRun true
}
put .BurgleVariables
var donotsell $BURGLE.KEEP
var trashItems $BURGLE.TRASHITEMS
var sellables amulet|apron|bangles|bank|bathrobe|bear|blanket|blossom|bottoms|bowl|bracer|briquet|broom|brush|canvas tote|charts|choker|cloak|comb|cookbook|cowbell|cube|cudgel|cufflinks|cylinder|bodice dagger|diary|distaff|earrings|fan|hammer|handkerchief|haircomb|jug|kaleidoscope|knife|knives|lamp|leaflet|lens|locket|lunchbox|mirror|mortar|napkin|nightcap|nightgown|oil|opener|pajamas|paperweight|pestle|pillow|pins|plate|pot helm|prism|quill|rasp|razor|ring|rod|scissors|scroll|shakers|shaper|sieve|sipar|skillet|slate|slippers|snare|sphere|statuette|stick|stove|tankard|telescope|towel|top|twine|vase|yardstick
var soldItems null
action var items $1 when ^You rummage through.*and see (.*)\.$
if ($SpellTimer.RefractiveField.active = 1) then gosub release rf
gosub rummage my %container
pause
eval itemArr replace("%items", ",", "|")
eval itemLength count("%itemArr", "|")
var index 0
loop:
var item %itemArr(%index)
if (matchre ("%item", "\b(%donotsell)\b") then {
put #echo >Log [pawn] Keeping %item.
}
if (matchre ("%item", "\b(%trashItems)\b") then {
gosub get my %item from my %container
gosub put my %item in bucket
put #echo >Log [pawn] Trashing %item.
}
if (matchre("%item", "\b(%sellables)\b") then {
var sellItem $1
if (%dryRun != true) then {
gosub get my %sellItem from my %container
gosub sell my %sellItem
if ("$righthand" != "Empty") then gosub put my %sellItem in bucket
if ("$righthand" != "Empty") then gosub drop my %sellItem
if ("$righthand" != "Empty") then gosub put my %sellItem in my %container
} else {
put #echo >Log [pawn] Selling %sellItem -- %item
}
if ("%soldItems" = "null") then {
var soldItems %item
} else {
var soldItems %soldItems, %item
}
}
math index add 1
if (%index >= %itemLength) then goto done
goto loop
done:
if (%soldItems <> null) then {
put #echo >Log [pawn] Sold %soldItems
} else {
put #echo >Log [pawn] Nothing sold.
}
put #parse PAWN DONE
exit