dexxerPoisonWeapon by tarouca

1@setvar lagTimer_ 500
2
3@setvar usingShelf_ 0
4if findtype "storage shelf" ground -1 -1 3 as myShelf__
5    @setvar myShelf_ myShelf__
6    @setvar usingShelf_ 1
7endif
8@setvar usingStockPile_ 0
9if findtype "resource container" ground -1 -1 3 as myStockPile__
10    @setvar myStockPile_ myStockPile__
11    @setvar usingStockPile_ 1
12endif
13@setvar usingAlchemistBag_ 0
14if findtype "alchemists satchel" self as myAlchemistBag__
15    @setvar myAlchemistBag_ myAlchemistBag__
16    @setvar usingAlchemistBag_ 1
17    if not find myAlchemistBag_ backpack
18        lift myAlchemistBag_
19        drop backpack
20    endif
21    dclick myAlchemistBag_
22    wait lagTimer_
23endif
24
25@setvar weaponFound_ 0
26while weaponFound_ = 0
27    if findlayer self righthand as weaponToApply__
28        @setvar weaponToApply_ weaponToApply__
29        overhead "FOUND WEAPON"
30        @setvar weaponFound_ 1
31    else 
32        overhead "EQUIP WEAPON TO POISON" 48
33        overhead "I'LL WAIT 3 SECONDS" 48
34        wait lagTimer_
35        wait lagTimer_
36    endif
37endwhile
38
39if not timerexists "cureTimer_"
40    createtimer "cureTimer_"
41    settimer "cureTimer_" 99999
42endif
43if not timerexists "healTimer_"
44    createtimer "healTimer_"
45    settimer "healTimer_" 99999
46endif
47if not timerexists "poisonTimer_"
48    createtimer "poisonTimer_"
49    settimer "poisonTimer_" 99999
50endif
51
52
53overhead "WAIT FOR: WEAPON POISONED" 48
54
55@setvar keepGoing_ 1
56while keepGoing_ = 1
57    if not poisoned
58        getlabel weaponToApply_ myWeaponLabel_
59        if "10 lethal" in myWeaponLabel_
60            if ".10 lethal" in myWeaponLabel_
61            else
62                @setvar keepGoing_ 0
63            endif
64            if keepGoing_ = 0
65                overhead "WEAPON POISONED"
66                if usingShelf_ = 1 and find myShelf_ ground -1 -1 3
67                    menu myShelf_ 1
68                    wait lagTimer_
69                    if usingStockPile_ = 1 and findtype 3854 backpack 0 as emptyBottle_
70                        menu myStockPile_ 0
71                        waitfortarget
72                        target emptyBottle_
73                        wait lagTimer_
74                    endif
75                elseif usingShelf_ = 0
76                    overhead "NOT USING SHELF" 48
77                else
78                    overhead "NOT NEAR SHEFL" 48
79                endif
80                stop
81            endif
82        endif
83    endif
84    if not poisoned and timer "poisonTimer_" > 5100
85        @setvar needToRestock_ 0
86        @setvar foundTargetPot_ 0
87        if usingAlchemistBag_ = 1 and findtype "Green Potion" myAlchemistBag_
88            @setvar foundTargetPot_ 1
89        elseif findtype "Green Potion" backpack
90            @setvar foundTargetPot_ 1
91        endif
92        if foundTargetPot_ = 1
93            menu weaponToApply_ 0
94            settimer "poisonTimer_" 0
95        else 
96            @setvar needToRestock_ 1
97        endif
98        if needToRestock_ = 1 
99            if usingShelf_ = 1 and find myShelf_ ground -1 -1 3
100                menu myShelf_ 1
101                wait lagTimer_
102            else 
103                overhead "NO POISON" 38
104                overhead "NOT NEAR/USING SHELF" 38
105            endif
106        endif
107    endif
108
109    if poisoned and timer "cureTimer_" > 3000
110        @setvar needToRestock_ 0
111        @setvar foundTargetPot_ 0
112        if usingAlchemistBag_ = 1 and findtype "Orange Potion" myAlchemistBag_ as pot_
113            @setvar foundTargetPot_ 1
114        elseif findtype "Orange Potion" backpack as pot_
115            @setvar foundTargetPot_ 1
116        endif
117        if foundTargetPot_ = 1
118            dclick pot_
119            settimer "cureTimer_" 0
120        else 
121            @setvar needToRestock_ 1
122        endif
123        if needToRestock_ = 1
124            if usingShelf_ = 1 and find myShelf_ ground -1 -1 3
125                menu myShelf_ 1
126                wait lagTimer_
127            else
128                overhead "NO CURE" 38
129                overhead "NOT NEAR/USING SHELF" 38
130            endif
131        endif
132    endif
133
134    if hp < maxhp
135        @setvar needToRestock_ 0
136        @setvar foundTargetPot_ 0
137        if not bandaging
138            if findtype "clean bandage%s%" backpack 
139                hotkey "Bandage Self"
140            else
141                @setvar needToRestock_ 1
142            endif
143        endif
144        if hp < 60
145            if timer "healTimer_" > 11000
146                if usingAlchemistBag_ = 1 and findtype "Yellow Potion" myAlchemistBag_ as pot_
147                    @setvar foundTargetPot_ 1
148                elseif findtype "Yellow Potion" backpack as pot_
149                    @setvar foundTargetPot_ 1
150                endif
151                if foundTargetPot_ = 1
152                    dclick pot_
153                    settimer "healTimer_" 0
154                else 
155                    @setvar needToRestock_ 1
156                endif
157            endif
158        endif
159        if needToRestock_ = 1
160            if usingShelf_ = 1 and find myShelf_ ground -1 -1 3
161                menu myShelf_ 1
162                wait lagTimer_
163            else
164                overhead "NO HEAL" 38
165                overhead "NOT NEAR/USING SHELF" 38
166            endif
167        endif        
168    endif
169endwhile