;;Ҫɾ
[@ADVRefineStrengthMain]
{
#IF
;CheckGold 50000
;CheckItem StrengthPotion 1
;CheckItem DragonEyeCrystal 1
#ACT
Delaygoto [local] 1 @ADVRefineStrengthNxt
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12} \
#ELSESAY
To use the Advanced Refining System You Need:\\
{FCOLOR/15}1){FCOLOR/10} 50000 Gold {FCOLOR/12}\
{FCOLOR/15}2){FCOLOR/10} StrengthPotion 1{FCOLOR/12}\
{FCOLOR/15}3){FCOLOR/10} DragonEyeCrystal 1{FCOLOR/12}\\
<Leave/@Exit>
;-----------------------------------------------------------------------------------------

[@ADVRefineStrengthNxt]
#ACT
;FormatStr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A1 %D0
FormatStr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A1 1
ReadValueSql  "TBL_ITEM"  %A9 "FLD_CHARACTER,FLD_TYPE,FLD_DESC7,FLD_COLORR"  [@WeaponTypeStrength]

;---------------------------------------------------------------

[@WeaponTypeStrength()]
#ACT
mov A4 %ARG(1)
mov D9 %ARG(2)
mov A8 %ARG(3)
mov A7 %ARG(4)

;---------------------------------------------------------------

#IF
equal A4 ""
#SAY
{FCOLOR/1} <$OUTPUT(A1)> is not wearing a weapon! {FCOLOR/12} \\
<Leave/@exit>
#ACT
break

;---------------------------------------------------------------

#IF
#ACT
goto @ADVRefineLevelStrengthOK

;---------------------------------------------------------------

[@ADVRefineLevelStrengthOK]
#ACT
Delaygoto [local] 1 @ADVRefineStrength1
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12}\

;---------------------------------------------------------------

[@ADVRefineStrength1]
#IF
equal A8 "0"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(1)>
#ACT
Break

#IF
equal A8 "1"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(2)>
#ACT
Break

#IF
equal A8 "2"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(3)>
#ACT
Break

#IF
equal A8 "3"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(4)>
#ACT
Break

#IF
equal A8 "4"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(5)>
#ACT
Break

#IF
equal A8 "6"
#SAY
The advanced refine has a chance of failure!\
Due to how skilled my work is i cannot afford\
to give refunds if it fails!\\
{FCOLOR/1}Note: Strength is harder to refine than \
DC and your weapon may curse!{FCOLOR/12}\
<Next/@ADVRefineStrengthNxt1(7)>
#ACT
Break

#IF
equal A8 "7"
#SAY
You can not refine any more Strength onto this weapon.
#ACT
Break

#ELSESAY
your weapon is not suitable for advanced refining..\

;---------------------------------------------------------------

[@ADVRefineStrengthNxt1()]
#ACT
mov A0 %ARG(1)

#IF
Random 3
#ACT
Dec A0 1
goto @ADVRefineStrengthNxt2

#ELSEACT
goto @ADVRefineStrengthNxt2

;---------------------------------------------------------------

[@ADVRefineStrengthNxt2]
#ACT
FormatStr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A1 %D0
ReadValueSql  "TBL_ITEM"  %A9 "FLD_CHARACTER,FLD_TYPE,FLD_DESC7"  [@ADVRefineStrengthNxt3]

;---------------------------------------------------------------

[@ADVRefineStrengthNxt3()]
#IF
;CheckGold 50000
;CheckItem StrengthPotion 1
;CheckItem DragonEyeCrystal 1
#ACT
;Take Gold 50000 
;TakeItem StrengthPotion 1
;TakeItem DragonEyeCrystal 1
Delaygoto [local] 1 @ADVRefineStrengthNxt4
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12}\
#ELSESAY
To use the Advanced Refining System You Need:\\
{FCOLOR/15}1){FCOLOR/10} 50000 Gold {FCOLOR/12}\
{FCOLOR/15}2){FCOLOR/10} StrengthPotion 1{FCOLOR/12}\
{FCOLOR/15}3){FCOLOR/10} DragonEyeCrystal 1{FCOLOR/12}\\
<Leave/@Exit>

;---------------------------------------------------------------

[@ADVRefineStrengthNxt4]
#IF
Random 3
#ACT
Delaygoto [local] 1 @ADVRefineStrengthNxt5
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12}\

#ELSEACT
Goto @ADVRefineStrengthFAIL

;---------------------------------------------------------------

[@ADVRefineStrengthFAIL]
#ACT
Delaygoto [local] 1 @ADVRefineStrengthFAIL1
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12}\


;---------------------------------------------------------------

[@ADVRefineStrengthFAIL1]
#SAY
{FCOLOR/10}<$OUTPUT(A1)>'s{FCOLOR/12} weapon has been {FCOLOR/10}failed{FCOLOR/12} to be {FCOLOR/10}upgraded!{FCOLOR/12}\\
<Leave/@exit>

;---------------------------------------------------------------

[@ADVRefineStrengthNxt5]
#ACT
FormatStr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A1 1
mov A6 %A9
FormatStr "FLD_DESC7='%s'" %A0
UPDATEVALUESQL "TBL_ITEM" %A6 %A9
#SAY
<$OUTPUT(A1)>'s weapon has been enhanced by {FCOLOR/10}1{FCOLOR/12} Strength\
This makes the total Strength: {FCOLOR/10}+<$OUTPUT(A0)>{FCOLOR/12}\\
<Leave/@exit>

;---------------------------------------------------------------

}
;;Ҫɾ