;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@IntMagicLevel1]
{
#IF
CheckJob Warrior
#SAY
<[ Remove Slaying ]/@RemoveSlay> - 200 Integral\\
;#IF
;CheckJob Wizard
;#SAY
;<[ Degrade to Level 4 ]/@DegradeTam(4,600)> - 600 Integral (Refund)\
;<[ Degrade to Level 3 ]/@DegradeTam(3,500)> - 500 Integral (Refund)\\
#IF
CheckJob Taoist
CheckLevel 20
#SAY
<[ Level to SummonShinso from 3 to 5 ]/@UpgradeShin(SummonShinso)> - Free!\
#IF
CheckJob Taoist
CheckLevel 30
#SAY
<[ Level to SummonJin from 3 to 5 ]/@UpgradeShin(SummonJin)> - Free!\
#IF
CheckJob Taoist
CheckLevel 45
#SAY
<[ Level to SummonTaoLord from 3 to 5 ]/@UpgradeShin(SummonTaoLord)> - Free!\
#IF
#SAY
<[ Upgrade to Level 1 ]/@Upgrade1(1,200)> - 200 Integral\
<[ Upgrade to Level 2 ]/@Upgrade1(2,300)> - 300 Integral\
<[ Upgrade to Level 3 ]/@Upgrade1(3,400)> - 400 Integral\
<[ Upgrade to Level 4 ]/@Upgrade1(4,500)> - 500 Integral\
<[ Upgrade to Level 5 ]/@Upgrade1(5,600)> - 600 Integral\\
<[ Degrade to Level 4 ]/@Degrade1(4,300)> - 300 Integral (Refund)\
<[ Degrade to Level 3 ]/@Degrade1(3,250)> - 250 Integral (Refund)\\
<[ Back ]/@IntegralMainMenu>\
<[ Exit ]/@exit>\\\


[@UpgradeShin()]
#ACT
   Mov A1 %ARG(1)
#IF
   CHKMAGICLEVEL %A1 3
   !CHKMAGICLEVEL %A1 4
#ACT
   HLSCRIPTCMD CHANGEMAGLEVEL %A1 5
#SAY
Your <$OUTPUT(A1)> Spell has been upgraded to 5\\
<[ Main Menu ]/@Main>\\\


[@DegradeTam()]
#ACT
MOV    D1  %ARG(1)              ;Level to go to
MOV    D5  %ARG(2)
MOV    D4  %D1
Inc    D4  1                    ;Level Currently At
MOV    D3  %D4
Inc    D3  1                    ;Level Can't be as it too high
#SAY
Do you want to Degrade your Taming skill to Level <$OUTPUT(D1)>?\
This service REFUNDS {FCOLOR/10}<$OUTPUT(D5)> Integrals{FCOLOR/12}\\
<[ Yes ]/@DegradeTam1>\
<[ Exit ]/@exit>\\\


[@DegradeTam1]
#IF
#ACT
  MOV        A1       "Stunning"
  FormatStr "FLD_CHARACTER='%s'" %USERNAME
  ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@AddInt1a]


[@Upgrade1()]
#IF
MOV    D1  %ARG(1)
MOV    D5  %ARG(2)
MOV    D4  %D1
DEC    D4  1
#SAY
Do you want to upgrade your skill to Level <$OUTPUT(D1)>?\
This service costs {FCOLOR/10}<$OUTPUT(D5)> Integrals{FCOLOR/12}\\
Please select a skill\\
#IF
CHECKJOB Taoist
#SAY
<[ Healing (LV7) ]/@Upgrade1a(Healing,7)>\
<[ SpiritSword (LV8) ]/@Upgrade1a(SpiritSword,8)>\
<[ Poisoning (LV12) ]/@Upgrade1a(Poisoning,12)>\
<[ TaoExplosion (LV13) ]/@Upgrade1a(TaoExplosion,13)>\
<[ EvilSlayer (LV14) ]/@Upgrade1a(EvilSlayer,14)>\
<[ Invisibility (LV20) ]/@Upgrade1a(Invisibility,20)>\
<[ SummonShinso (LV20) ]/@Upgrade1a(SummonShinso,20)>\
<[ MagicProtect (LV21) ]/@Upgrade1a(MagicProtect,21)>\
<[ MassInvisibility (LV23) ]/@Upgrade1a(MassInvis,23)>\
<[ GreatEvilSlayer (LV24) ]/@Upgrade1a(GtEvilSlayer,24)>\
<[ Resilience (LV25) ]/@Upgrade1a(Resilience,25)>\
<[ TrapOctagon (LV27) ]/@Upgrade1a(TrapOctagon,27)>\
<[ TaoCombatKick (LV28) ]/@Upgrade1a(CombatKick,28)>\
<[ ElementalSuperiority (LV29) ]/@Upgrade1a(ElementalSup,29)>\
<[ SummonJin (LV30) ]/@Upgrade1a(SummonJin,30)>\
<[ MassHealing (LV31) ]/@Upgrade1a(MassHealing,31)>\
<[ BloodLust (LV34) ]/@Upgrade1a(BloodLust,34)>\
<[ Resurrection (LV35) ]/@Upgrade1a(Resurrection,35)>\
<[ Purification (LV38) ]/@Upgrade1a(Purification,38)>6\
<[ Strength (LV40) ]/@Upgrade1a(Strength,40)>\
<[ Transparency (LV43) ]/@Upgrade1a(Transparency,43)>\
<[ SummonTaoLord (LV45) ]/@Upgrade1a(SummonTaoLord,45)>\
<[ Celestial (LV46) ]/@Upgrade1a(Celestial,46)>\
<[ GreatTaoExplosion (LV49) ]/@Upgrade1a(GtExplosion,49)>\\
#IF
CHECKJOB Warrior
#SAY
<[ SwordmanShip (LV7) ]/@Upgrade1a(SwordmanShip,7)>\
<[ Slaying (LV14) ]/@Upgrade1a(Slaying,14)>\
<[ AdvancedSlay (LV19) ]/@Upgrade1a(AdvancedSlay,19)>\
<[ Halfmoon (LV24) ]/@Upgrade1a(Halfmoon,24)>\
<[ ShoulderDash (LV27) ]/@Upgrade1a(ShoulderDash,27)>\
<[ FlamingSword (LV32) ]/@Upgrade1a(FlamingSword,32)>\
<[ DragonRise (LV35) ]/@Upgrade1a(DragonRise,35)>\
<[ BladeStorm (LV38) ]/@Upgrade1a(BladeStorm,38)>\
<[ DestructSurge (LV40) ]/@Upgrade1a(DestructSurge,40)>\
<[ Interchange (LV42) ]/@Upgrade1a(Interchange,42)>\
<[ Defiance (LV44) ]/@Upgrade1a(Defiance,44)>\
<[ Beacon (LV46) ]/@Upgrade1a(Beacon,46)>\
<[ Might (LV48) ]/@Upgrade1a(Might,48)>\
<[ Assault (LV50) ]/@Upgrade1a(Assault,50)>\\
#IF
CHECKJOB Wizard
#SAY
<[ FireBall (LV7) ]/@Upgrade1a(FireBall,7)>\
<[ LightningBall (LV8) ]/@Upgrade1a(LightninBall,8)>\
<[ IceBall (LV9) ]/@Upgrade1a(IceBall,9)>\
<[ PowerBurst (LV10) ]/@Upgrade1a(PowerBurst,10)>\
<[ FlameRepulser (LV12) ]/@Upgrade1a(FlameRepulse,12)>\
;<[ Stunning (LV13) ]/@Upgrade1a(Stunning,13)>\
<[ Teleport (LV14) ]/@Upgrade1a(Teleport,14)>\
<[ AdamantineFB (LV15) ]/@Upgrade1a(AdamantineFB,15)>\
<[ LightningBolt (LV16) ]/@Upgrade1a(LightninBolt,16)>\
<[ IceBlades (LV17) ]/@Upgrade1a(IceBlades,17)>\
<[ GreatPowerBurst (LV18) ]/@Upgrade1a(GtPowerBurst,18)>\
<[ LightningBeam (LV21) ]/@Upgrade1a(LightninBeam,21)>\
<[ FrozenEarth (LV22) ]/@Upgrade1a(FrozenEarth,22)>\
<[ BlowEarth (LV23) ]/@Upgrade1a(BlowEarth,23)>\
<[ FireCloud (LV24) ]/@Upgrade1a(FireCloud,24)>\
<[ TurnUndead (LV26) ]/@Upgrade1a(TurnUndead,26)>\
<[ GeoManipulation (LV27) ]/@Upgrade1a(GeoManip,27)>\
<[ MagicShield (LV29) ]/@Upgrade1a(MagicShield,29)>\
<[ Explosion (LV32) ]/@Upgrade1a(Explosion,32)>\
<[ LightningFlower (LV33) ]/@Upgrade1a(LightninFlo,33)>\
<[ IceStorm (LV34) ]/@Upgrade1a(IceStorm,34)>\
<[ DragonTornado (LV35) ]/@Upgrade1a(DragonTorn,35)>\
<[ GreatFrozenEarth (LV38) ]/@Upgrade1a(GtFrozeEarth,38)>\
<[ ChainLightning (LV40) ]/@Upgrade1a(ChainLight,40)>\
<[ MeteorShower (LV43) ]/@Upgrade1a(MeteorShower,43)>\
;<[ Renounce (LV46) ]/@Upgrade1a(Renounce,46)>\
<[ Tempest (LV49) ]/@Upgrade1a(Tempest,49)>\
<[ FireTrail (LV52) ]/@Upgrade1a(FireTrail,52)>\\
#IF
#SAY
<[ Back ]/@IntMagicLevel1>\\\


[@Upgrade1a()]
#IF
#ACT
  MOV        A1       %ARG(1)
  MOV        D3       %ARG(2)
  FormatStr "FLD_CHARACTER='%s'" %USERNAME
  ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@SubInt1a]

[@SubInt1a()]
#IF
CheckLevel %D3
#ACT
   mov    A0      %ARG(1)
   mov    D6      %ARG(2)
#ELSEACT
Break
#ELSESAY
You do not have the minimum level requirement for that spell\
<[ Back ]/@IntegralMainMenu>\

#IF
   CHKMAGICLEVEL %A1 %D4
   !CHKMAGICLEVEL %A1 %D1
   esmall D5 %D6
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   mov   A8     %A9
   dec   D6     %D5
   mov   D3     %D6
   FormatStr "FLD_INTEGRAL='%s'" %D3
   UPDATEVALUESQL "TBL_INTEGRAL" %A8 %A9

   HLSCRIPTCMD CHANGEMAGLEVEL %A1 %D1
   mov     A7  ""
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D5
   AddStr  A7 ",MagicLevel,"
   AddStr  A7 %A1
   AddStr  A7 ",Up To,"
   AddStr  A7 %D1
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7

#SAY
The {FCOLOR/1}<$OUTPUT(A4)>{FCOLOR/12} skill has been upgraded.\
You now have {FCOLOR/1}<$OUTPUT(D6)>{FCOLOR/12} Integral Remaining.\\
<[ Back ]/@IntMagicLevel1>\\
#ELSESAY
You do not have enough Integral or your skill\
is not at level <$OUTPUT(D4)>\
<[ Back ]/@IntMagicLevel1>\\


[@Degrade1()]
#IF
MOV    D1  %ARG(1)              ;Level to go to
MOV    D5  %ARG(2)
MOV    D4  %D1
Inc    D4  1                    ;Level Currently At
MOV    D3  %D4
Inc    D3  1                    ;Level Can't be as it too high
#SAY
Do you want to Degrade your skill to Level <$OUTPUT(D1)>?\
This service REFUNDS {FCOLOR/10}<$OUTPUT(D5)> Integrals{FCOLOR/12}\\
Please select a skill\\
#IF
CHECKJOB Taoist
#SAY
<[ Healing (LV7) ]/@Degrade1a(Healing)>\
<[ SpiritSword (LV8) ]/@Degrade1a(SpiritSword)>\
<[ Poisoning (LV12) ]/@Degrade1a(Poisoning)>\
<[ TaoExplosion (LV13) ]/@Degrade1a(TaoExplosion)>\
<[ EvilSlayer (LV14) ]/@Degrade1a(EvilSlayer)>\
<[ Invisibility (LV20) ]/@Degrade1a(Invisibility)>\
;<[ SummonShinso (LV20) ]/@Degrade1a(SummonShinso)>\
<[ MagicProtect (LV21) ]/@Degrade1a(MagicProtect)>\
<[ MassInvisibility (LV23) ]/@Degrade1a(MassInvis)>\
<[ GreatEvilSlayer (LV24) ]/@Degrade1a(GtEvilSlayer)>\
<[ Resilience (LV25) ]/@Degrade1a(Resilience)>\
<[ TrapOctagon (LV27) ]/@Degrade1a(TrapOctagon)>\
<[ TaoCombatKick (LV28) ]/@Degrade1a(CombatKick)>\
<[ ElementalSuperiority (LV29) ]/@Degrade1a(ElementalSDe)>\
;<[ SummonJin (LV30) ]/@Degrade1a(SummonJin)>\
<[ MassHealing (LV31) ]/@Degrade1a(MassHealing)>\
<[ BloodLust (LV34) ]/@Degrade1a(BloodLust)>\
<[ Resurrection (LV35) ]/@Degrade1a(Resurrection)>\
<[ Purification (LV38) ]/@Degrade1a(Purification)>6\
<[ Strength (LV40) ]/@Degrade1a(Strength)>\
<[ Transparency (LV43) ]/@Degrade1a(Transparency)>\
<[ Celestial (LV46) ]/@Degrade1a(Celestial)>\
;<[ SummonTaoLord (LV48) ]/@Degrade1a(SummonTaoLord)>\
<[ GreatTaoExplosion (LV49) ]/@Degrade1a(GtExplosion)>\\
#IF
CHECKJOB Warrior
#SAY
<[ SwordmanShip (LV7) ]/@Degrade1a(SwordmanShip)>\
<[ Slaying (LV14) ]/@Degrade1a(Slaying)>\
<[ AdvancedSlay (LV19) ]/@Degrade1a(AdvancedSlay)>\
<[ Halfmoon (LV24) ]/@Degrade1a(Halfmoon)>\
<[ ShoulderDash (LV27) ]/@Degrade1a(ShoulderDash)>\
<[ FlamingSword (LV32) ]/@Degrade1a(FlamingSword)>\
<[ DragonRise (LV35) ]/@Degrade1a(DragonRise)>\
<[ BladeStorm (LV38) ]/@Degrade1a(BladeStorm)>\
<[ DestructSurge (LV40) ]/@Degrade1a(DestructSurge)>\
<[ Interchange (LV42) ]/@Degrade1a(Interchange)>\
<[ Defiance (LV44) ]/@Degrade1a(Defiance)>\
<[ Beacon (LV46) ]/@Degrade1a(Beacon)>\
<[ Might (LV48) ]/@Degrade1a(Might)>\
<[ Assault (LV50) ]/@Degrade1a(Assault)>\\
#IF
CHECKJOB Wizard
#SAY
<[ FireBall (LV7) ]/@Degrade1a(FireBall)>\
<[ LightningBall (LV8) ]/@Degrade1a(LightninBall)>\
<[ IceBall (LV9) ]/@Degrade1a(IceBall)>\
<[ PowerBurst (LV10) ]/@Degrade1a(PowerBurst)>\
<[ FlameRepulser (LV12) ]/@Degrade1a(FlameRepulse)>\
<[ Stunning (LV13) ]/@Degrade1a(Stunning)>\
<[ Teleport (LV14) ]/@Degrade1a(Teleport)>\
<[ AdamantineFB (LV15) ]/@Degrade1a(AdamantineFB)>\
<[ LightningBolt (LV16) ]/@Degrade1a(LightninBolt)>\
<[ IceBlades (LV17) ]/@Degrade1a(IceBlades)>\
<[ GreatPowerBurst (LV18) ]/@Degrade1a(GtPowerBurst)>\
<[ LightningBeam (LV21) ]/@Degrade1a(LightninBeam)>\
<[ FrozenEarth (LV22) ]/@Degrade1a(FrozenEarth)>\
<[ BlowEarth (LV23) ]/@Degrade1a(BlowEarth)>\
<[ FireCloud (LV24) ]/@Degrade1a(FireCloud)>\
<[ TurnUndead (LV26) ]/@Degrade1a(TurnUndead)>\
<[ GeoManipulation (LV27) ]/@Degrade1a(GeoManip)>\
<[ MagicShield (LV29) ]/@Degrade1a(MagicShield)>\
<[ Explosion (LV32) ]/@Degrade1a(Explosion)>\
<[ LightningFlower (LV33) ]/@Degrade1a(LightninFlo)>\
<[ IceStorm (LV34) ]/@Degrade1a(IceStorm)>\
<[ DragonTornado (LV35) ]/@Degrade1a(DragonTorn)>\
<[ GreatFrozenEarth (LV38) ]/@Degrade1a(GtFrozeEarth)>\
<[ ChainLightning (LV40) ]/@Degrade1a(ChainLight)>\
<[ MeteorShower (LV43) ]/@Degrade1a(MeteorShower)>\
;<[ Renounce (LV46) ]/@Degrade1a(Renounce)>\
<[ Tempest (LV49) ]/@Degrade1a(Tempest)>\
<[ FlameTrail (LV52) ]/@Degrade1a(FlameTrail)>\\
#IF
#SAY
<[ Back ]/@IntMagicLevel1>\\\


[@Degrade1a()]
#IF
#ACT
  MOV        A1       %ARG(1)
  FormatStr "FLD_CHARACTER='%s'" %USERNAME
  ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@AddInt1a]

[@AddInt1a()]
#IF
#ACT
   mov    A0      %ARG(1)
   MOV    D6      %ARG(2)
#IF
   CHKMAGICLEVEL %A1 %D4
   !CHKMAGICLEVEL %A1 %D3
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   mov   A8     %A9
   Inc   D6     %D5
   mov   D3     %D6
   FormatStr "FLD_INTEGRAL='%s'" %D3
   UPDATEVALUESQL "TBL_INTEGRAL" %A8 %A9

   HLSCRIPTCMD CHANGEMAGLEVEL %A1 %D1
   mov     A7  ""
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D5
   AddStr  A7 ",MagicLevel,"
   AddStr  A7 %A1
   AddStr  A7 ",DownTo,-"
   AddStr  A7 %D1
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7

#SAY
The {FCOLOR/1}<$OUTPUT(A4)>{FCOLOR/12} skill has been Degraded.\
You now have {FCOLOR/1}<$OUTPUT(D6)>{FCOLOR/12} Integral Remaining.\\
<[ Back ]/@IntMagicLevel1>\
#ELSESAY
Please check your skill level is <$OUTPUT(D4)>\
<[ Back ]/@IntegralMainMenu>\


[@RemoveSlay]
#SAY
Are you sure you want to remove the Skill {FCOLOR/10}SLAYING{FCOLOR/12}\\
<[ Yes.. take it! ]/@CheckIntSlay(Slaying,200)>\
<[ Integral Main Menu ]/@IntegralMainMenu>\\\

[@CheckIntSlay()]
#IF
#ACT
  MOV        A1       %ARG(1)
  MOV        D5       %ARG(2)
  FormatStr "FLD_CHARACTER='%s'" %USERNAME
  ReadValueSql  "TBL_INTEGRAL"  %A9  "FLD_CHARACTER,FLD_INTEGRAL"  [@RemoveSlay1]

[@RemoveSlay1()]
#IF
#ACT
   mov    A0      %ARG(1)
   mov    D6      %ARG(2)

#IF
   esmall D5 %D6
#ACT
   FormatStr "FLD_CHARACTER='%s'" %USERNAME
   mov   A8     %A9
   dec   D6     %D5
   mov   D3     %D6
   FormatStr "FLD_INTEGRAL='%s'" %D3
   UPDATEVALUESQL "TBL_INTEGRAL" %A8 %A9
   HLSCRIPTCMD DELSKILL %A1
   mov     A7  ""
   AddStr  A7 %USERNAME
   AddStr  A7 ","
   AddStr  A7 %D5
   AddStr  A7 ",RemoveSkill,"
   AddStr  A7 %A1
   Savelog "QuestDiary\IntegralSystem\IntegralLog.txt" %A7

#SAY
The {FCOLOR/1}<$OUTPUT(A4)>{FCOLOR/12} skill has been upgraded.\
You now have {FCOLOR/1}<$OUTPUT(D6)>{FCOLOR/12} Integral Remaining.\\
<[ Back ]/@IntMagicLevel1>\\
#ELSESAY
You do not have enough Integral\
<[ Back ]/@IntMagicLevel1>\\

}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
