;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@changesky]
{
#IF
#SAY
Do you want to change the weather?\
This will change it on every town map!\
Costs is just a modest 10 Integral!\
<[ Change Weather ]/@changesky1>\
<[ Exit ]/@exit>


[@changesky1]
#IF
#SAY
{FCOLOR/10}Please choose the equipment you wish to protect:{FCOLOR/12}\
<[ Day ]/@changesky2(Day,DayTime)>  <[ Night ]/@changesky2(DARK,NightTime)>\
<[ Rain ]/@changesky2(Rain,Raining)>  <[ Fog ]/@changesky2(Fog,Foggy)>\
<[ Clear ]/@ClearSky>  <[ Snow ]/@changesky2(Snow,Snowing)>\
<[ Back ]/@IntegralMainMenu>\\


[@changesky2()]
#ACT
  Mov        A0       %ARG(1)
  Mov        A1       %ARG(2)
  Mov        D3       10
  mov     A7  ""
  goto @CheckExIntchangesky

[@CheckExIntchangesky]
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@CheckExIntchangesky1]
[@CheckExIntchangesky1()]
#IF
#ACT
   mov    D2      %ARG(2)
#IF
   Esmall D3 %D2
#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
   ChangeMapAttr 0 "%A0"
   ChangeMapAttr 1 "%A0"
   ChangeMapAttr 2 "%A0"
   ChangeMapAttr 3 "%A0"
   ChangeMapAttr 4 "%A0"
   ChangeMapAttr 5 "%A0"
   ChangeMapAttr 6 "%A0"
   ChangeMapAttr 7 "%A0"
   ChangeMapAttr 8 "%A0"
   ChangeMapAttr 10 "%A0"
   Eventmsg Grobal "<$USERNAME> has changed the weather!!  It is now <$OUTPUT(A1)>" 10015
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D3
   AddStr  A7 ",WeatherMachine,"
   AddStr  A7 %A1
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7
#SAY
Weather Changed to <$OUTPUT(A1)>\
You have spent {FCOLOR/10}<$OUTPUT(D3)>{FCOLOR/12} Integral\
Your current Integral is {FCOLOR/10}<$OUTPUT(D4)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>
#ELSESAY
You do not have enough Integral Points\
Your current Integral is {FCOLOR/10}<$OUTPUT(D2)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>


[@ClearSky]
#ACT
  Mov        A0       "Clear"
  Mov        A1       "Clear Skies"
  Mov        D3       10
  mov     A7  ""
  goto @CheckExIntchangesky2

[@CheckExIntchangesky2]
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@CheckExIntchangesky12]
[@CheckExIntchangesky12()]
#IF
#ACT
   mov    D2      %ARG(2)
#IF
   Esmall D3 %D2
#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
   ResetMapAttr 0 
   ResetMapAttr 1 
   ResetMapAttr 2 
   ResetMapAttr 3 
   ResetMapAttr 4 
   ResetMapAttr 5 
   ResetMapAttr 6 
   ResetMapAttr 7 
   ResetMapAttr 8 
   ResetMapAttr 10 
   Eventmsg Grobal "<$USERNAME> has changed the weather!!  It is now <$OUTPUT(A1)>" 10015
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D3
   AddStr  A7 ",WeatherMachine,"
   AddStr  A7 %A1
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7
#SAY
Weather Changed to <$OUTPUT(A1)>\
You have spent {FCOLOR/10}<$OUTPUT(D3)>{FCOLOR/12} Integral\
Your current Integral is {FCOLOR/10}<$OUTPUT(D4)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>
#ELSESAY
You do not have enough Integral Points\
Your current Integral is {FCOLOR/10}<$OUTPUT(D2)>{FCOLOR/12}\
<[ Back ]/@IntegralMainMenu>
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
