Code: Select all
hook in_game
exclusive 1
run-once 1
call openkey
}
automacro buyTSURUGI {
location prontera, prt_in
weight <= 85%
set dconWEIGHT 0.85
set itemWEIGHT 120
set zenyMIN 40000
set lockBUY 0
exclusive 1
run-once 1
call buyTSURUGInow
}
macro buyTSURUGInow {
:start
if (@npc(172 130) >= 0) goto contBUY0
[
do move prt_in @rand(168, 172) @rand(138, 142)
]
goto start
:contBUY0
if (@inventory(Steel) >= 0) goto moveSTEEL
goto contBUY1
:moveSTEEL
[
do eval $::Macro::Data::varStack{cartWEIGHT} = int($::cart{'weight'});
$itemTRANS = @eval(@eval(8000-$cartWEIGHT)/10)
do eval $::Macro::Data::varStack{itemTRANS} = int($itemTRANS);
]
if ($itemTRANS > 0) goto moveSTEEL2
goto contBUY1
:moveSTEEL2
do cart add @inventory(Steel) $itemTRANS
:contBUY1
do talk @npc(172 130)
pause 3
do store
[
call itemNUMBERINV
$amountTSU = @invamount(Tsurugi [1])
log === Tsurugi [1] @ inventory: $amountTSU ===
log === Tsurugi [1] to buy: $istackNUMBER
]
while ($istackNUMBER >= 0) as loopBUY
do eval $::Macro::Data::varStack{zeny} = $::char->{'zeny'};
if ($zeny >= $zenyMIN) goto contBUY2
$lockBUY = 1
goto endBUY
:contBUY2
do buy 13 1
$istackNUMBER--
end loopBUY
:endBUY
}
automacro makeSTEEL {
location prontera, prt_in
weight <= 90%
sp > 5
inventory "Tsurugi [1]" > 5
exclusive 1
run-once 1
delay 3
call makeSTEELnow
}
macro makeSTEELnow {
:start
if (@npc(172 130) >= 0) goto contMAKE0
[
do move prt_in @rand(168, 172) @rand(138, 142)
]
goto start
:contMAKE0
$counter = @rand(1, 10)
while ($counter <= 10) as loopMAKE
[
$amountSTART = @invamount(Tsurugi [1])
if ($counter == 1) goto one
if ($counter == 2) goto two
if ($counter == 3) goto three
if ($counter == 4) goto four
if ($counter == 5) goto five
if ($counter == 6) goto six
if ($counter == 7) goto seven
if ($counter == 8) goto eight
if ($counter == 9) goto nine
if ($counter == 10) goto ten
log === variable $counter error ===
stop
:one
$hex = 0C
goto sendNOW
:two
$hex = 0D
goto sendNOW
:three
$hex = 0E
goto sendNOW
:four
$hex = 0F
goto sendNOW
:five
$hex = 1A
goto sendNOW
:six
$hex = 1B
goto sendNOW
:seven
$hex = 1C
goto sendNOW
:eight
$hex = 1D
goto sendNOW
:nine
$hex = 1E
goto sendNOW
:ten
$hex = 1F
goto sendNOW
]
:sendNOW
[
log === steel: $amountSTART ===
log === $hex ===
]
do send E4 07 10 00 00 00 00 00 01 00 00 00 $hex 00 01 00
#pause 1
[
$counter++
if ($counter != 11) goto contMAKE
$counter = 1
#do relog
#release makeSTEEL
:contMAKE
]
:contMAKE21
$amountEND = @invamount(Tsurugi [1])
if ($amountSTART != $amountEND) goto contMAKE2
do relog
goto end
#release makeSTEEL
#stop
:contMAKE2
if (@invamount(Tsurugi [1]) > 0) goto contMAKE3
goto end
:contMAKE3
end loopMAKE
:end
release makeSTEEL
if ($lockBUY == 0) goto contMAKE4
call goNOW
log === no more money ===
stop
:contMAKE4
release buyTSURUGI
}
automacro gotoKAFRA {
location prontera, prt_in
weight >= 85%
inventory "Steel" >= 1
set kafraMAX 30000
exclusive 1
run-once 1
call goNOW
}
macro goNOW {
:start
[
do move prontera 150 85
]
if (@npc(146 89) >= 0) goto contKAFRA
goto start
:contKAFRA
do talknpc 146 89 w1 r1 w1 n
$tx = 0
:loopback
if (@eval(exists $::storage{opened}?1:0)) goto open
log === wait a moment ===
pause 1
$tx++
if ($tx == 3) goto start
goto loopback
:open
if (@storamount(Steel) == $kafraMAX) goto contSTORAGEend
if (@inventory(Steel) < 0) goto contSTORAGE1
do storage add @inventory(Steel) @eval($kafraMAX-@storamount(Steel))
if (@storamount(Steel) == $kafraMAX) goto contSTORAGEend
:contSTORAGE1
#pause 1
if (@cart(Steel) < 0) goto contSTORAGE2
do storage addfromcart @cart(Steel) @eval($kafraMAX-@storamount(Steel))
if (@storamount(Steel) == $kafraMAX) goto contSTORAGEend
goto contSTORAGE2
:confSTORAGEend
do conf char 1
do relog
pause 2
release all
stop
:contSTORAGE2
if ($lockBUY == 1) goto confSTORAGEend
release gotoKAFRA
release buyTSURUGI
}
######===================================================================
macro decWEIGHT {
$dWEIGHT = @eval($.weight/$.maxweight)
}
macro looseWEIGHT {
$losWEIGHT = @eval(@eval($.maxweight*$dconWEIGHT)-$.weight)
}
macro itemNUMBERINV {
call looseWEIGHT
$istackNUMBER = @eval($losWEIGHT/$itemWEIGHT)
do eval $::Macro::Data::varStack{istackNUMBER} = int($istackNUMBER)
}
##============================================================================
##############################################################################
##============================================================================
automacro begin {
hook in_game
location payon
exclusive 1
run-once 1
delay 7
call {
if ($.pos == "160 230") goto cont
[
do move 160 230 payon
]
:cont
if (@cart(Steel) >= 0) goto next
call storagenow
goto end
:next
do openshop
:end
release begin
lock vendingan2
}
}
automacro vendingan3 {
soldout == 1
location payon
exclusive 1
run-once 1
delay 3
call storagenow
}
automacro thanks {
console /^sold: (\d+) - (.*) (\d+)z/i
location payon
delay 10
exclusive 1
run-once 1
call {
if (@shopamount(Steel) ~ 600 .. 799) goto revend
goto end
:revend
release vendingan2
:end
if (@shopamount(Steel) > 0) goto contEND
call storagenow
:contEND
}
}
automacro vendingan {
shop "Steel" < 600
location payon
exclusive 1
run-once 1
delay 3
timeout 30
call storagenow
}
automacro vendingan2 {
shop "Steel" < 800
location payon
exclusive 1
run-once 1
delay 3
timeout 600
call storagenow
}
macro storagenow {
do closeshop
pause 3
if ($lockBUY < 2) goto talkNPC
if (@cart(Steel) < 0) goto changeCHAR
release all
goto enddown
:changeCHAR
if ($lockBUY == 3) goto endSELLING
$lockBUY = 0
do conf char 0
do relog
stop
:endSELLING
log === no more money to make STEEL ===
relog 1000000
stop
:talkNPC
$t = 0
do talknpc 175 226 w3 r1 w3 n
pause 2
:loopback
if (@eval(exists $::storage{opened}?1:0)) goto open
log === wait a moment ===
pause 0.5
$t++
if ($t == 3) goto talkNPC
goto loopback
:open
if (@cartamount(Steel) >= 800) goto next
do storage gettocart @storage(Steel) @eval(800 - @cartamount(Steel))
pause 2
if (@storage(Steel) >= 0 ) goto next
lock vendingan
lock vendingan2
goto end
:next
do storage close
release vendingan
release vendingan3
release thanks
:end
if (@storage(Steel) >= 0) goto enddown
if ($lockBUY == 1) goto nextLOCKBUY
$lockBUY = 2
goto nextLOCKBUY2
:nextLOCKBUY
$lockBUY = 3
goto nextLOCKBUY2
:nextLOCKBUY2
goto enddown
:enddown
pause 2
do openshop
}
macro openkey {
$lockBUY = 0
log === key is opened ===
}
macro statuskey {
if ($lockBUY == "") goto undefine
log === lockBUY: $lockBUY ===
stop
:undefine
log === variable is not found ===
}