;;Ҫɾ
[@ADVRefineDCMain]
{

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

[@ADVRefineDcNxt]
#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_DESC0,FLD_COLORR"  [@WeaponType]

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

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

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

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

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

#IF
;Small A7 "75"
;Large A3 "70"
#ACT
goto @ADVRefineLevelOK
#ELSESAY
You can only use advanced refine when a \
weapon reachs its {FCOLOR/10}MAX{FCOLOR/12} level.\ \
<Leave/@exit>

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

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

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

[@ADVRefineDc1]
#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!\\
<Next/@ADVRefineDcNxt1(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!\\
<Next/@ADVRefineDcNxt1(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!\\
<Next/@ADVRefineDcNxt1(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!\\
<Next/@ADVRefineDcNxt1(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!\\
<Next/@ADVRefineDcNxt1(5)>
#ACT
Break

#IF
equal A8 "5"
#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!\\
<Next/@ADVRefineDcNxt1(6)>
#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!\\
<Next/@ADVRefineDcNxt1(7)>
#ACT
Break

#IF
equal A8 "7"
#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!\\
<Next/@ADVRefineDcNxt1(8)>
#ACT
Break

#IF
equal A8 "8"
#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!\\
<Next/@ADVRefineDcNxt1(9)>
#ACT
Break

#IF
equal A8 "9"
#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!\\
<Next/@ADVRefineDcNxt1(10)>
#ACT
Break

#IF
equal A8 "10"
#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!\\
<Next/@ADVRefineDcNxt1(11)>
#ACT
Break

#IF
equal A8 "11"
#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!\\
<Next/@ADVRefineDcNxt1(12)>
#ACT
Break

#IF
equal A8 "12"
#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!\\
<Next/@ADVRefineDcNxt1(13)>
#ACT
Break

#IF
equal A8 "13"
#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!\\
<Next/@ADVRefineDcNxt1(14)>
#ACT
Break

#IF
equal A8 "14"
#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!\\
<Next/@ADVRefineDcNxt1(15)>
#ACT
Break

#IF
equal A8 "15"
#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!\\
<Next/@ADVRefineDcNxt1(16)>
#ACT
Break

#IF
equal A8 "16"
#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!\\
<Next/@ADVRefineDcNxt1(17)>
#ACT
Break

#IF
equal A8 "17"
#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!\\
<Next/@ADVRefineDcNxt1(18)>
#ACT
Break

#IF
equal A8 "18"
#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!\\
<Next/@ADVRefineDcNxt1(19)>
#ACT
Break

#IF
equal A8 "19"
#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!\\
<Next/@ADVRefineDcNxt1(20)>
#ACT
Break

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

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

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

[@ADVRefineDcNxt1()]
#ACT
mov A0 %ARG(1)
goto @ADVRefineDcNxt2

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

[@ADVRefineDcNxt2]
#ACT
FormatStr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A1 %D0
ReadValueSql  "TBL_ITEM"  %A9 "FLD_CHARACTER,FLD_TYPE,FLD_DESC0"  [@ADVRefineDcNxt3]

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

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

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

[@ADVRefineDcNxt4]
#IF
Random 3
#ACT
Delaygoto [local] 1 @ADVRefineDcNxt5
#SAY
{FCOLOR/10}Please Wait...{FCOLOR/12}\
#ELSEACT
Goto @ADVRefineDcFAIL

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

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

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

[@ADVRefineDcFAIL1]
#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>

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

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

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

}
;;Ҫɾ