;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@IntEngraver]
{
#IF
#SAY
{FCOLOR/12}Want to engrave a special name into your items?\
{FCOLOR/12}Price: 500 Integral{FCOLOR/12}\
{FCOLOR/12}You must be wearing the item to continue!{FCOLOR/12}\
Please note that the Engraving will be in CAPITALS\
{FCOLOR/12}<[ Engrave ]/@StartWriteWerpon>{FCOLOR/12}\\
{FCOLOR/12}<[ Back ]/@IntegralMainMenu>{FCOLOR/12}\\

[@StartWriteWerpon]
#IF
#SAY
{FCOLOR/12}Please choose which item you which to Engrave{FCOLOR/12}\\
If you just want to Engrave your name, just leave it blank.\
<[ Weapon ]/@@WriteName(1)>  <[ Medal ]/@@WriteName(11)>\
<[ Helmet ]/@@WriteName(4)>  <[ Necklace ]/@@WriteName(3)>\
<[ Armour ]/@@WriteName(0)>  <[ FootWear ]/@@WriteName(10)>\
<[ Bracelet(L) ]/@@WriteName(5)>  <[ Bracelet(R) ]/@@WriteName(6)>\
<[ Ring(L) ]/@@WriteName(7)>  <[ Ring(R) ]/@@WriteName(8)>\
<[ Back ]/@IntegralMainMenu>\

[@@WriteName()]
#ACT
  Mov        D0       %ARG(1)
  MOV        A0       %INPUTSTR
  mov        D3       500
  goto @rinimabugei

[@rinimabugei]
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@rinimabugei1]
[@rinimabugei1()]
#ACT
;  mov    A0      %ARG(1)
   mov    D2      %ARG(2)
#IF
   Esmall D3 %D2
   HLSCRIPTCMD CHECKISTAKEITEM %D0  
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   mov   A8     %A9
   dec   D2     %D3
   mov   D4     %D2
   FormatStr "FLD_INTEGRAL='%s'" %D4
   UPDATEVALUESQL "TBL_INTEGRAL" %A8 %A9
   HLSCRIPTCMD ITEMWRITENAME %D0 %A0
   mov     A7  ""
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D3
   AddStr  A7 ",ItemEngrave,"
   AddStr  A7 %D0
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7
#SAY
Your chosen item has now been Engraved with {FCOLOR/10}<$OUTPUT(A0)>{FCOLOR/12}!\\
Your current Integral is {FCOLOR/10}<$OUTPUT(D4)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>\
#ELSESAY
You do not have enough Integral Points\
or, you are not wearing that item\
Your current Integral is {FCOLOR/10}<$OUTPUT(D2)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>\
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;