All pastes #834722 Raw Edit

Someone

public text v1 · immutable
#834722 ·published 2007-12-28 12:25 UTC
rendered paste body
on *:join:#TundraIRC: {
  if ($nick == airforceowns) {
    beep 30
  }
}






alias -l setdmcolours {
  ;###################################################################
  ;##########SET THE COLOUR NUMBER YOU WANT WHERE THE NUMBER IS#######
  ;###################################################################

  set %colour.overall 10
  set %colour.nicks 7
  set %colour.hits 3
  set %colour.hp 6
  set %colour.weapon 14
  set %colour.poison 4

  ;###################################################################
  ;###################################################################
  ;###################################################################

  set %c1 $+($chr(3),%colour.overall)
  set %c2 $+($chr(3),%colour.nicks)
  set %c3 $+($chr(3),%colour.hits)
  set %c4 $+($chr(3),%colour.hp)
  set %c5 $+($chr(3),%colour.weapon)
  set %c6 $+($chr(3),%colour.pois)
}


;#######################START DEATHMATCH#########################

on $*:text:/^[!.@](dm|deathmatch|chal(l)?(enge)?|fight)/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  if (*c*m*d* iswm $1-) { dmcommandslist $nick $1- | halt }
  if (*h*s* iswm $1-) { dmhighscores $nick $1- | halt }
  if ($network == Tundrairc) {
    if ($chan != #DM) {
      notice $nick %c1 $+ You only can do this in $+ %c2 #DM $+ %c1 .
      halt
    }
    setdmcolours
    set %dm.chan #DM
    if (%dmid. [ $+ [ $nick ] ] == 1) {
      if (%dmnick. [ $+ [ $nick ] ] == 1) {
        if (%dmwins. [ $+ [ $nick ] ] == $null) .set %dmwins. [ $+ [ $nick ] ] 0
        if (%dmloses. [ $+ [ $nick ] ] == $null) .set %dmloses. [ $+ [ $nick ] ] 0
        if (%dm.player1) {
          if (%dm.player1 == $nick && %dm.status != ON) { notice $nick %c1 $+ Please wait until somebody accepts your challange or your challenge times out. | halt }
          if (%dm.status == ON && $nick != %dm.player1 && $nick != %dm.player2) {
            notice $nick %c1 $+ Sorry, but there is already a $+ %c5 DeathMatch $+ %c1 running, please wait till that one is over, and try again.
            halt
          }
          elseif ($nick == %dm.player1 || $nick == %dm.player2) {
            notice $nick %c1 $+ You're already fighting in this $+ %c5 DeathMatch $+ %c1 $+ !
            halt
          }
          set %dm.status ON
          set %dm.player2 $nick
          if (%dminv. [ $+ [ $nick ] ] >= 10) .notice $nick %c2 $+ Notice: $+ %c1 You have $+ %c4 10 or more $+ %c1 items in your inventory, meaning you won't get any drops, in case you win the $+ %c5 DeathMatch $+ %c1 $+ . You can bank items in $+ %c3 #DM-bank $+ %c1 $+ .
          if (%dmlvl. [ $+ [ %dm.player1 ] ] == $null) {
            set %dmlvl. [ $+ [ %dm.player1 ] ] 1
          }
          if (%dmlvl. [ $+ [ %dm.player2 ] ] == $null) {
            set %dmlvl. [ $+ [ %dm.player2 ] ] 1
          }

          mode %dm.chan m
          if (%dm.player1 isreg %dm.chan && %dm.player2 isreg %dm.chan) { mode %dm.chan vv %dm.player1 %dm.player2 }
          elseif (%dm.player1 isreg %dm.chan && %dm.player2 !isreg %dm.chan) { mode %dm.chan v %dm.player1 | set %nodevoice1 %dm.player2 }
          elseif (%dm.player1 !isreg %dm.chan && %dm.player2 isreg %dm.chan) { mode %dm.chan v %dm.player2 | set %nodevoice2 %dm.player1 }
          else { set %nodevoice1 %dm.player1 | set %nodevoice2 %dm.player2 }
          timerturnswitch 1 60 turngone
          set %specuse. [ $+ [ %dm.player1 ] ] 3
          set %specuse. [ $+ [ %dm.player2 ] ] 3
          set %dmstarthealth. [ $+ [ %dm.player1 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.player1 ] ] ^1.2 * 30 + 80),1,46)
          set %dmstarthealth. [ $+ [ %dm.player2 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.player2 ] ] ^1.2 * 30 + 80),1,46)
          set %dmhealth. [ $+ [ %dm.player1 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.player1 ] ] ^1.2 * 30 + 80),1,46)
          set %dmhealth. [ $+ [ %dm.player2 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.player2 ] ] ^1.2 * 30 + 80),1,46)
          msg %dm.chan %c1 $+ The fight is: $+ %c5 A %c6 $+ level %dmlvl. [ $+ [ %dm.player1 ] ] $+ %c5 $+ : %c2 $+ %dm.player1 $+ %c5 ( $+ %c4 $+ Wins: $+ %c3 %dmwins. [ $+ [ %dm.player1 ] ] $+ %c5 $+ : $+ %c4 Loses: $+ %c3 %dmloses. [ $+ [ %dm.player1 ] ] $+ %c5 $+ ) Vs a %c6 $+ level %dmlvl. [ $+ [ %dm.player2 ] ] $+ %c5 $+ : %c2 $+ %dm.player2 $+ %c5 ( $+ %c4 $+ Wins: $+ %c3 %dmwins. [ $+ [ %dm.player2 ] ] $+ %c5 - $+ %c4 Loses: $+ %c3 %dmloses. [ $+ [ %dm.player2 ] ] $+ %c5 $+ ).
          var %dm.begin = $r(1,2)
          timerchallenge off
          if (%dm.begin == 1) {
            set %dm.startnick %dm.player1
          }
          if (%dm.begin == 2) {
            set %dm.startnick %dm.player2
            var %dm.player3 = %dm.player1
            set %dm.player1 %dm.player2
            set %dm.player2 %dm.player3
          }
          msg %dm.chan %c2 $+ %dm.startnick $+ %c1 starts the game!
          notice %dm.player1 %c1 $+ Dm started, you're fighting %c4 $+ %dm.player2 $+ %c1 $+ , who has $+ %c4 %dmhealth. [ $+ [ %dm.player2 ] ] $+ %c1 hitpoints.
          notice %dm.player2 %c1 $+ Dm started, you're fighting %c4 $+ %dm.player1 $+ %c1 $+ , who has $+ %c4 %dmhealth. [ $+ [ %dm.player1 ] ] $+ %c1 hitpoints.
        }
        else {
          set %dm.player1 $nick
          msg %dm.chan %c2 $+ %dm.player1 $+ %c1 ( $+ %c6 $+ level %dmlvl. [ $+ [ %dm.player1 ] ] $+ %c1 - %c4 $+ Wins: $+ %c3 %dmwins. [ $+ [ $nick ] ] $+ %c1 - $+ %c4 Loses: $+ %c3 %dmloses. [ $+ [ $nick ] ] $+ %c1 $+ ) has initiated a %c5 $+ DM Game $+ %c1 $+ . Type $+ %c6 !DM $+ %c1 to fight him!
          timerchallenge 1 30 tooslow
          if (%dminv. [ $+ [ $nick ] ] >= 10) .notice $nick %c2 $+ Notice: $+ %c1 You have $+ %c4 10 or more $+ %c1 items in your inventory, meaning you won't get any drops, in case you win the $+ %c5 DeathMatch $+ %c1 $+ . You can bank items in $+ %c3 #DM-bank $+ %c1 $+ .
        }
      }
      else {
        notice $nick %c1 $+ You need to register first. Type %c5 $+ `dm-register $+ %c1 first and follow the instructions.
      }
    }
    else {
      notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to connect to %c2 $+ irc.TundraIRC.net %c1 $+ to play a DeathMatch!
  }
}

;###################################END DeathMatch##############################
on $*:text:/^[`!@.]((s(top)?|halt|end)( |-)?(tour(ny|ament)?|D(eath)?M(atch)?))/Si:#DM, #DM-tournaments: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (*tour* iswm $1-) {
      if ($nick != supamagier && $nick != cnb6 && $address($me,2) != $addres($nick,2) && $nick !isop $chan) {
        notice $nick %c1 $+ Access denied, you are not allowed to use that command. 
        halt
      }
      Else {
        if (!%dm.tournament) {
          notice $nick %c1 $+ There's no Tournament running.
          halt
        }
        set %tourstoppedrem 1
        endtour
        msg $chan %c1 $+ Tournament stopped by $+ %c2 $nick $+ %c1 $+ .
      }
      halt
    }
    if ($nick ishop $chan || $nick isop $chan || $address($nick,2) == $address($me,2) || $nick == Supamagier || $nick == cnb6 || $nick == cnb6|bnc) {
      if (%dm.status != ON) { 
        notice $nick %c1 $+ There's no DeathMatch running.
        halt
      }
      if ($nick != %dm.player1 && $nick != %dm.player2) {
        msg $chan %c1 $+ DeathMatch stopped by $+ %c2 $nick $+ %c1 $+ .
        enddm
      }
      else {
        notice $nick %c1 $+ You can't do that as a player, $+ %c5 coward $+ %c1 $+ !
      }
    }
    else {
      notice $nick %c1 $+ You need to be a 7half-op or higher $+ %c1 to use this command.
    } 
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;#############################REGISTER AND ID TO PLAY###########################
on $*:text:/^[`](dm( reg(ister)?|reg(ister)?|-reg(ister)?)|register(dm)?)/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmnick. [ $+ [ $nick ] ] != 1) {
    set %tryreg. [ $+ [ $nick ] ] 1
    msg $nick %c1 $+ So you want to register? Great! Type $+ %c3 !setpass passyouwant $+ %c1 in my PM. You can't use any spaces in your password. Don't use your login password for any other thing. You'll also need to choose a class, you can choose between $+ %c6 Mage $+ %c1 $+ , $+ %c6 Range $+ %c1 and $+ %c6 Melee $+ %c1 $+ . Use $+ %c4 !setclass styleyouwant $+ %c1 to choose one.
  }
  else {
    notice $nick %c1 $+ You already registered!
  }
}
on *:text:!setpass*:?: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%tryreg. [ $+ [ $nick ] ] == 1) {
    if (%dmclass. [ $+ [ $nick ] ] == $null) { msg $nick %c1 $+ Please choose a class first. Use %c4 $+ !setclass classyouwant $+ %c1 $+ . | halt }
    msg $nick %c1 $+ Congrats! You just registered. Your name is $+ %c3 $nick $+ %c1 $+ , you class is $+ %c2 %dmclass. [ $+ [ $nick ] ] $+ %c1 and your pass is $+ %c2 $2 $+ %c1 $+ . If you want to change your pass, type $+ %c4 !changepass newpass $+ %c1 $+ . Use $+ %c4 /msg $me !identify yourpass $+ %c1 to identify next time.
    msg $nick %c1 $+ You get $+ %c4 100 coins $+ %c1 so you can buy your first weapon. Join $+ %c2 #DM-shop $+ %c1 to buy one!
    set %dmmoney. [ $+ [ $nick ] ] 100
    unset %tryreg. [ $+ [ $nick ] ]
    set %dmnick. [ $+ [ $nick ] ] 1
    set %dmpass. [ $+ [ $nick ] ] $2
    set %dmid. [ $+ [ $nick ] ] 1
    close -m $nick 
  }
  else {
    msg $nick %c1 $+ Please type $+ %c2 !dm register $+ %c1 in $+ %c4 #DM $+ %c1 first please.
  }
}

on *:text:!setclass*:?: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%tryreg. [ $+ [ $nick ] ] == 1) {
    if (%dmclass. [ $+ [ $nick ] ]) { msg $nick %c1 $+ You already set a class ($+ %c2 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ ), now you have to set a password. Use %c4 $+ !setpass passyouwant $+ %c1 $+ . | halt }
    if ($2 == range || $2 == mage || $2 == melee) {
      msg $nick %c1 $+ Congrats! You just chose a class. You chose $+ %c2 $2 $+ %c1 $+ . Now please choose a pass. Use %c4 $+ !setpass passyouwant $+ %c1 $+ .
      set %dmnick. [ $+ [ $nick ] ] 1
      set %dmclass. [ $+ [ $nick ] ] $2
    }
    else {
      msg $nick Please choose between $+ %c6 Mage $+ %c1 $+ , $+ %c6 Range $+ %c1 and $+ %c6 Melee $+ %c1 $+ .
    }
  }
  else {
    msg $nick %c1 $+ Please type $+ %c2 !dm register $+ %c1 in $+ %c4 #DM $+ %c1 first please.
  }
}

on *:text:!changepass*:?: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    msg $nick %c1 $+ Congrats! You just changed your pass to $+ %c2 $2 $+ %c1 $+ . If you want to change your pass again, type $+ %c4 !changepass newpass $+ %c1 $+ .
    set %dmpass. [ $+ [ $nick ] ] $2
    close -m $nick
  }
  else {
    msg $nick %c1 $+ You need to be identified if you want to change your pass! Use $+ %c4 /msg $me !identify yourpass $+ %c1 to identify.
  } 
}
on $*:text:/^[!@`.](id(entify)?)/Si:?: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmnick. [ $+ [ $nick ] ] != 1) { msg $nick %c1 $+ Please register first. Type %c5 $+ `dm-register $+ %c1 first,in #DM and follow the instructions. | halt }
  if (%dmid. [ $+ [ $nick ] ] == 1) { msg $nick %c1 $+ You are already identified! | close -m $nick | halt }
  if ($2 == %dmpass. [ $+ [ $nick ] ]) {
    msg $nick %c1 $+ You are now identified, have fun!.
    msg $nick %c1 $+ You will be auto-unidentified when you disconnect.
    set %dmid. [ $+ [ $nick ] ] 1
    unset %dmtrylog. [ $+ [ $nick ] ]
    close -m $nick
  }
  else {
    if (%dmtrylog. [ $+ [ $nick ] ] >= 5) {
      msg $nick %c3 Five $+ %c1 wrong passwords in a row, you'll be now ignored for $+ %c6 10 minutes $+ %c1 $+ .
      unset %dmtrylog. [ $+ [ $nick ] ]
      ignore -u600 $nick
      halt
    }
    msg $nick %c1 $+ Wrong password.
    inc %dmtrylog. [ $+ [ $nick ] ]
    close -m $nick
  }
}

on $*:text:/^[!@`.]((my)?(class))/Si:#DM, #DM-bank, #DM-shop, #DM-tournaments: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmnick. [ $+ [ $nick ] ] != 1) { notice $nick %c1 $+ Please register first. Type %c5 $+ `dm-register $+ %c1 first,in #DM and follow the instructions. | halt }
  if (%dmid. [ $+ [ $nick ] ] != 1) { notice $nick %c1 $+ Please identify first. Type %c5 $+ /msg Supabot !id <yourpass> $+ %c1 $+ . | halt }
  notice $nick %c1 $+ The class you chose is $+ %c2 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ .
}

on *:quit: {
  if ($network == TundraIRC) {
    unset %dmid. [ $+ [ $nick ] ]
  }
}
on *:disconnect: {
  if ($network == TundraIRC) {
    unset %dmid.*
    timerstopdmquit 1 120 enddm
  }
}
on *:connect: {
  timerstopdmquit off
}

;################################SHOP AND BANK###########################
on $*:text:/^[!`@.](item(s)?|shop|sale|list)/Si:#DM-shop, #DM, #DM-bank, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-shop $+ %c1 .
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {

    ;###################WHAT DO WE HAVE TODAY?###############################
    if ($2 == $null) {
      notice $nick %c1 $+ Please Choose a category. Type $+ %c2 !item category $+ %c1 $+ . The categories we have today are: $+ %c3 Health potions $+ %c1 $+ , $+ %c3 Potions $+ %c1 $+ , %c3 $+ Warrior $+ %c1 $+ , %c3 $+ Ranger $+ %c1 $+ , %c3 $+ Mage $+ %c1 $+ , %c3 $+ Spells $+ %c1 and %c3 $+ Arrows.
    }
    if ($2 == food || $2 == eat || $2 == health || $2 == hp || recover isin $2) {
      if (%nobuycommandfood. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandfood. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The food we have today:
        msg $nick %c2 $+ Small health potion $+ %c1 - $+ %c5 10 coins $+ %c1 - $+ %c4 Heals 20 hp.
        msg $nick %c2 $+ Normal health potion $+ %c1 - $+ %c5 30 coins $+ %c1 - $+ %c4 Heals 50 hp.
        msg $nick %c2 $+ Large health potion $+ %c1 - $+ %c5 70 coins $+ %c1 - $+ %c4 Heals 80 hp. 
        msg $nick %c2 $+ Giant health potion $+ %c1 - $+ %c5 150 coins $+ %c1 - $+ %c4 Heals 150 hp. 
        msg $nick %c2 $+ Incredible fantastic Uber health potion $+ %c4 - $+ %c5 1000 coins $+ %c1 - $+ %c4 Heals 800 hp and the next time you're hit, it heals you inmediatly. Cant be used more than 3 times per fight.
        timer [ $+ [ $nick $+ food ] ] 1 180 set %nobuycommandfood. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ food).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == potions || $2 == pots || $2 == pot) {
      if (%nobuycommandpotions. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandpotions. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The potions we have today:
        msg $nick %c2 $+ Anti potion $+ %c1 - $+ %c5 100 coins $+ %c1 - $+ %c4 Cures a poison
        msg $nick %c2 $+ Special attack potion $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c4 Allows you to use 2 special attacks again.
        msg $nick %c2 $+ Mage potion $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c4 Increases your mage max hit with 10% for 5 turns.
        msg $nick %c2 $+ Strength potion $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c4 Increases your melee max hit with 10% for 5 turns.
        msg $nick %c2 $+ Ranged potion $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c4 Increases your range max hit with 10% for 5 turns.
        msg $nick %c2 $+ Defence potion $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c4 Increases your defence with 10% for 5 turns.
        timer [ $+ [ $nick $+ pot ] ] 1 180 set %nobuycommandpotions. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ pot).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == warrior || $2 == melee) {
      if (%nobuycommandwarrior. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandwarrior. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The melee weapons we have today:
        msg $nick %c2 $+ Dagger $+ %c1 - $+ %c5 50 coins $+ %c1 - $+ %c6 lvl 1 $+ %c1 - $+ %c4 Max hit 10
        msg $nick %c2 $+ Sword $+ %c1 - $+ %c5 100 coins $+ %c1 - $+ %c6 lvl 1 $+ %c1 - $+ %c4 Max hit 15 
        msg $nick %c2 $+ Battle axe $+ %c1 - $+ %c5 200 coins $+ %c1 - $+ %c6 lvl 5 $+ %c1 - $+ %c4 Max hit 25
        msg $nick %c2 $+ Home made sword $+ %c1 - $+ %c5 250 coins $+ %c1 - $+ %c6 lvl 10 $+ %c1 - $+ %c4 Max hit 50 (May break) 
        msg $nick %c2 $+ Scimitar $+ %c1 - $+ %c5 2000 coins $+ %c1 - $+ %c6 lvl 15 $+ %c1 - $+ %c4 Max hit 50
        msg $nick %c2 $+ Duel handed battle axes $+ %c1 - $+ %c5 5000 coins $+ %c1 - $+ %c6 lvl 25 $+ %c1 - $+ %c4 Max hit 200
        msg $nick %c2 $+ Godsword $+ %c1 - $+ %c5 25000 coins $+ %c1 - $+ %c6 lvl 40 $+ %c1 - $+ %c4 Max hit 550
        timer [ $+ [ $nick $+ war ] ] 1 180 set %nobuycommandwarrior. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ war).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == ranger || $2 == range || $2 == ranged) {
      if (%nobuycommandranger. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandranger. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The ranged weapons we have today:
        msg $nick %c2 $+ Bow $+ %c1 - $+ %c5 50 coins $+ %c1 - $+ %c4 Arrow max hit
        msg $nick %c2 $+ Large bow $+ %c1 - $+ %c5 500 coins $+ %c1 - $+ %c4 Arrow max hit
        msg $nick %c2 $+ Great bow $+ %c1 - $+ %c5 3000 coins $+ %c1 - $+ %c4 Arrow max hit
        msg $nick %c2 $+ Ultimate bow $+ %c1 - $+ %c5 15000 coins $+ %c1 - $+ %c4 Arrow max hit
        msg $nick %c2 $+ Triple arrowed bow $+ %c1 - $+ %c5 35000 coins $+ %c1 - $+ %c4 Arrow max hit (three arrows per shot).
        timer [ $+ [ $nick $+ rang ] ] 1 180 set %nobuycommandranger. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ rang).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == mage || $2 == mager || $2 == wizard || $2 == magic) {
      if (%nobuycommandmage. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandmage. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The mage weapons we have today:
        msg $nick %c2 $+ Newbie magic staff $+ %c1 - $+ %c5 100 coins $+ %c1 - $+ %c4 Spell max hit - 20%.
        msg $nick %c2 $+ Beginner magic staff $+ %c1 - $+ %c5 1000 coins $+ %c1 - $+ %c4 Spell max hit - 10%.
        msg $nick %c2 $+ Magic staff $+ %c1 - $+ %c5 2000 coins $+ %c1 - $+ %c4 Spell max hit. 
        msg $nick %c2 $+ Advanced magic staff $+ %c1 - $+ %c5 7000 coins $+ %c1 - $+ %c4 Spell max hit + 10%.
        msg $nick %c2 $+ Ultimate magic staff $+ %c1 - $+ %c5 15000 coins $+ %c1 - $+ %c4 Spell max hit + 20%.
        msg $nick %c2 $+ Two Duel handed magic wands $+ %c1 - $+ %c5 35000 coins $+ %c1 - $+ %c4 Spell max hit + 50%.
        timer [ $+ [ $nick $+ mage ] ] 1 180 set %nobuycommandmage. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ mage).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == spells || $2 == spell || $2 == cast) {
      if (%nobuycommandspells. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandspells. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The magic spells we have today:
        msg $nick %c2 $+ Blizz $+ %c1 - $+ %c5 50 coins $+ %c1 - $+ %c6 Newbie magic staff $+ %c1 - $+ %c4 Max hit 20 
        msg $nick %c2 $+ Blizztering cold $+ %c1 - $+ %c5 75 coins $+ %c6 Newbie magic staff $+ %c1 - $+ %c4 Max hit 25
        msg $nick %c2 $+ Fire fury $+ %c1 - $+ %c5 100 coins $+ %c1 - $+ %c6 Beginner magic staff $+ %c1 - $+ %c4 Max hit 50
        msg $nick %c2 $+ Blizztering freeze $+ %c1 - $+ %c5 400 coins $+ %c6 Magic staff $+ %c1 - $+ %c4 Max hit 70 & Freezes you opponent for 2 turns, so he can't attack you (unless he ranges).
        msg $nick %c2 $+ Venquence fury $+ %c1 - $+ %c5 500 coins $+ %c1 - $+ %c6 Magic staff $+ %c1 - $+ %c4 Max hit 100
        msg $nick %c2 $+ Health cast $+ %c1 - $+ %c5 2000 coins $+ %c1 - $+ %c6 Advanced magic staff $+ %c1 - $+ %c4 Heals you with 30% of your total hp.
        msg $nick %c2 $+ Life cast $+ %c1 - $+ %c5 4500 coins $+ %c1 - $+ %c6 Ultimate magic staff $+ %c1 - $+ %c4 Heals you with 60% of your total hp.
        msg $nick %c2 $+ Teleport $+ %c1 - $+ %c5 5000 coins $+ %c1 - $+ %c6 Ultimate magic staff $+ %c1 - $+ %c4 Allows you to teleport from your opponent away, which allows you to cast 4 spells before he can attack you (unless he ranges, than only 1).
        msg $nick %c2 $+ Avada kadavra $+ %c1 - $+ %c5 10000 coins $+ %c1 - $+ %c6 Two Duel handed magic wands $+ %c1 - $+ %c4 Max hit 700
        timer [ $+ [ $nick $+ spells ] ] 1 180 set %nobuycommandspells. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ spells).secs %c1 $+ seconds before using this command again.
      }
    }
    if ($2 == arrows || $2 == arrow || $2 == other) {
      if (%nobuycommandother. [ $+ [ $nick ] ] != 1) {
        set %nobuycommandother. [ $+ [ $nick ] ] 1
        msg $nick %c3 $+ The arrows we have today:
        msg $nick %c2 $+ Weak arrow $+ %c1 - $+ %c5 1 coin each $+ %c1 - $+ %c6 Bow $+ %c1 - $+ %c4 Max hit 10
        msg $nick %c2 $+ Normal arrow $+ %c1 - $+ %c5 2 coin each $+ %c1 - $+ %c6 Bow $+ %c1 - $+ %c4 Max hit 40
        msg $nick %c2 $+ Powerful arrow $+ %c1 - $+ %c5 2 coin each $+ %c1 - $+ %c6 Large bow $+ %c1 - $+ %c4 Max hit 75
        msg $nick %c2 $+ Powerful arrow (P) $+ %c1 - $+ %c5 5 coin each $+ %c1 - $+ %c6 Great bow $+ %c1 - $+ %c4 Max hit 100 + 10 damage poison (per round)
        msg $nick %c2 $+ Diamond arrow $+ %c1 - $+ %c5 10 coin each $+ %c1 - $+ %c6 Ultimate bow $+ %c1 - $+ %c4 Max hit 150
        msg $nick %c2 $+ Diamond arrow (P+) $+ %c1 - $+ %c5 15 coin each $+ %c1 - $+ %c6 Ultimate bow $+ %c1 - $+ %c4 Max hit 200 + 20 damage poison (per round)
        msg $nick %c2 $+ Cursed arrow (P++) $+ %c1 - $+ %c5 30 coin each $+ %c1 - $+ %c6 Ultimate bow $+ %c1 - $+ %c4 Max hit 450 + 40 damage poison (per round) that can't be cured.
        timer [ $+ [ $nick $+ oth ] ] 1 180 set %nobuycommandother. [ $+ [ $nick ] ] 0
      }
      else { 
        notice $nick %c1 $+ Please wait $+ %c6 $timer($nick $+ oth).secs %c1 $+ seconds before using this command again.
      }
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;############################## LET'S BUY STUFF! ########################
on $*:text:/^[!`@.](buy)/Si:#DM-bank, #DM, #DM-shop, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-shop $+ %c1 .
    halt
  }
  if ($nick == %dm.player1 || $nick == %dm.player2) {
    notice $nick %c1 $+ You can't buy stuff during a fight!
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (!$3) .goto buymsg
    var %dm.amount = $remove($right($1-,6),$chr(32),a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,+,$chr(40),$chr(41))
    if (%dm.amount == 0) {
      notice $nick %c1 $+ You can't buy $+ %c3 0 $+ %c1 of something.
      halt
    }
    if (%dm.amount isnum) {
      set %dm.item $remove($2-,1,2,3,4,5,6,7,8,9,0)
      set %dm.item $replace(%dm.item,$chr(32),_)
      if (%dmbuyfirsttime != 1) {
        set %dmbuyfirsttime 1
        setShop
      }
      set %dm.buyitem $read(dmshopitems.txt, w, %dm.item $+ *)
      if (%dm.buyitem) {
        if (%dmmoney. [ $+ [ $nick ] ] >= $calc($gettok(%dm.buyitem,2,64) * %dm.amount)) {
          set %dmwriteitem $replace(%dm.buyitem,$chr(32),_)
          set %dmwriteitem $gettok(%dmwriteitem,1,64)
          if ($readini(dminv.ini,$nick,%dmwriteitem) == $null) {
            inc %dminv. [ $+ [ $nick ] ]
            set %dm.amountt %dm.amount
          }
          else {
            set %dm.amountt $calc($readini(dminv.ini,$nick,%dmwriteitem) + %dm.amount)
          }
          if (%dminv. [ $+ [ $nick ] ] > 10) {
            dec %dminv. [ $+ [ $nick ] ] 
            notice $nick %c1 $+ Your inventory, which has $+ %c2 10 $+ %c1 slots, is full, you need to bank first. Join %c4 $+ #DM-bank $+ %c1 to do so.
            halt
          }
          writeini dminv.ini $nick %dmwriteitem %dm.amountt
          dec %dmmoney. [ $+ [ $nick ] ] $calc($gettok(%dm.buyitem,2,64) * %dm.amount)
          notice $nick %c1 $+ Congrats! You just bought $+ %c3 %dm.amount $+ %c4 $replace($gettok(%dm.buyitem,1,64),_,$chr(32)) $+ s %c1 $+ for $+ %c2 $calc($gettok(%dm.buyitem,2,64) * %dm.amount) coins $+ %c1 $+ . You now have $+ %c2 %dmmoney. [ $+ [ $nick ] ] coins $+ %c1 left.
          notice $nick %c1 $+ You now have a total of $+ %c3 %dm.amountt $+ %c4 $replace($gettok(%dm.buyitem,1,64),_,$chr(32)) $+ s $+ %c1 with you!
        }
        else {
          if (%dmmoney. [ $+ [ $nick ] ] == $null) {
            set %dmmoney. [ $+ [ $nick ] ] 0
          }
          notice $nick %c1 $+ Insufficient money. You need  $+ %c3 $calc($gettok(%dm.buyitem,2,64) * %dm.amount) coins $+ %c1 to buy $+ %c2 %dm.amount $gettok(%dm.buyitem,1,64) $+ s $+ %c1 $+ , while you only have $+ %c2 %dmmoney. [ $+ [ $nick ] ] coins $+ %c1 $+ .
        }
      }
      else {
        notice $nick %c1 $+ Sorry! We don't have %c3 $+ " $+ $replace(%dm.item,_,$chr(32)) $+ " $+ %c1 $+ . Maybe you spelled it wrong?
      }
    }
    else {
      :buymsg
      notice $nick %c1 $+ Please use $+ %c3 !buy <item> <amount(below 100000)> $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;####################### SELL SELL SELL! #############################
on $*:text:/^[!`@.](sell)/Si:#DM-shop, #DM, #DM-bank, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-shop $+ %c1 .
    halt
  }
  if ($nick == %dm.player1 || $nick == %dm.player2) {
    notice $nick %c1 $+ You can't sell stuff during a fight!
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (!$3) .goto sellmsg
    set %dm.amount $remove($right($1-,6),$chr(32),a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,+,$chr(40),$chr(41))
    if (%dm.amount == 0) {
      notice $nick %c1 $+ You can't sell $+ %c3 0 $+ %c1 of something.
      halt
    }
    if (%dm.amount isnum || $remove($right($1-,4),$chr(32)) == all) {
      set %dm.item $remove($2-,1,2,3,4,5,6,7,8,9,0,all)
      set %dm.item $replace(%dm.item,$chr(32),_)
      set %dm.sellitem $read(dmshopitems.txt, w, %dm.item $+ *)
      if (%dm.sellitem) {
        set %dmwriteitem $replace(%dm.sellitem,$chr(32),_)
        set %dmwriteitem $gettok(%dmwriteitem,1,64)
        if ($remove($right($1-,4),$chr(32)) == all) .set %dm.amount $readini(dminv.ini,$nick,%dmwriteitem)
        set %dm.amountt $calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount)
        if (!%dm.amount) {
          notice $nick %c1 $+ Sorry, you don't have any %c3 $+ $replace($gettok(%dm.sellitem,1,64),_,$chr(32)) $+ s %c1 $+ in your inventory, maybe in your bank?
          halt
        }
        if ($calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount) < 0) {
          set %dm.amountt 0
          notice $nick %c1 $+ Sorry! You don't have $+ %c2 %dm.amount %c3 $+ $replace($gettok(%dm.sellitem,1,64),_,$chr(32)) $+ s $+ %c1 on you, maybe on your bank?
          halt
        }
        elseif ($calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount) == 0) {
          dec %dminv. [ $+ [ $nick ] ]
          remini dminv.ini $nick %dmwriteitem
        }
        else {
          writeini dminv.ini $nick %dmwriteitem %dm.amountt
        }
        set %sellprice $calc((($gettok(%dm.sellitem,2,64) * 0.6) * %dm.amount) + 0.5)
        set %sellprice $gettok(%sellprice,1,46)
        inc %dmmoney. [ $+ [ $nick ] ] %sellprice
        notice $nick %c1 $+ Congrats! You just sold $+ %c3 %dm.amount $+ %c4 $replace($gettok(%dm.sellitem,1,64),_,$chr(32)) $+ s %c1 $+ for $+ %c2 %sellprice coins $+ %c1 $+ . You now have $+ %c2 %dmmoney. [ $+ [ $nick ] ] coins $+ %c1 $+ .
        notice $nick %c1 $+ You now have a total of $+ %c3 %dm.amountt $+ %c4 $replace($gettok(%dm.sellitem,1,64),_,$chr(32)) $+ s $+ %c1 with you!
      }
      else {
        notice $nick %c1 $+ Sorry! You don't have %c3 $+ " $+ $replace(%dm.item,_,$chr(32)) $+ " $+ %c1 on you. Maybe you spelled it wrong?
      }
    }
    else {
      :sellmsg
      notice $nick %c1 $+ Please use $+ %c3 !sell <item> <amount(below 100000)> $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;################## WHAT DO YOU HAVE? ############################
on $*:text:/^[!@`.](money|cash)/Si:#DM-shop, #DM, #DM-bank, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (%dmmoney. [ $+ [ $nick ] ]) {
      notice $nick %c1 $+ You currently have $+ %c3 %dmmoney. [ $+ [ $nick ] ] coins $+ %c1 $+ .
    }
    else {
      set %dmmoney. [ $+ [ $nick ] ] 0
      notice $nick %c1 $+ You currently have $+ %c3 0 coins $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;#################### INVENTORY ############################
on $*:text:/^[`!@.](inv((ent(ory)?)?)?|on)/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] != 1) { 
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
    halt
  }
  if (!%showinv. [ $+ [ $nick ] ]) {
    set %showinv. [ $+ [ $nick ] ] 1
    if ($read(dminv.ini, w, * $+ $nick $+ *)) {
      if (%dminv. [ $+ [ $nick ] ] >= 10) .set %dminv. [ $+ [ $nick ] ] 10
      msg $nick %c3 $+ In your inventory you have:
      set %dmslots. [ $+ [ $nick ] ] 0
      set %dmplaymsg. [ $+ [ $nick ] ] 1
      play -at $+ $nick dmplayway $nick dminv.ini 500
    }
    else {
      notice $nick %c1 $+ You don't have anything with you at the moment.
    }
    timerinv [ $+ [ $nick ] ] 1 300 unset %showinv. [ $+ [ $nick ] ] 
  }
  else {
    notice $nick %c1 $+ Please wait $+ %c6 $timer(inv $+ $nick).secs $+ %c1 seconds before using this command again.
  }
}

;############################## LET'S BANK DA SHIT! #######################
on $*:text:/^[!`.@](bank|store)/Si:#DM-bank, #DM, #DM-shop, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-bank) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-bank $+ %c1 .
    halt
  }
  if ($nick == %dm.player1 || $nick == %dm.player2) {
    notice $nick %c1 $+ You can't bank stuff during a fight!
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (!$2) {
      if (!%showbank. [ $+ [ $nick ] ]) {
        set %showbank. [ $+ [ $nick ] ] 1
        if ($read(dmbank.ini, w, * $+ $nick $+ *)) {
          msg $nick %c3 $+ On your bank you have $+ %c1 ( $+ %c4 %dmbank. [ $+ [ $nick ] ] $+ %c1 items ) $+ %c3 $+ :
          play -at $+ $nick dmplayway $nick dmbank.ini 500
          halt
        }
        else {
          notice $nick %c1 $+ You don't have anything on your bank at the moment.
          halt
        }
        timerbank [ $+ [ $nick ] ] 1 300 unset %showbank. [ $+ [ $nick ] ] 
      }
      else {
        notice $nick %c1 $+ Please wait $+ %c6 $timer(bank $+ $nick).secs $+ %c1 seconds before using this command again.
      }
    }
    if (!$3) .goto bankmsg
    set %dm.amount $remove($right($1-,6),$chr(32),a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,+,$chr(40),$chr(41))
    if (%dm.amount == 0) {
      notice $nick %c1 $+ You can't bank $+ %c3 0 $+ %c1 of something.
      halt
    }
    if (%dm.amount isnum || $remove($right($1-,4),$chr(32)) == all) {
      set %dm.item $remove($2-,1,2,3,4,5,6,7,8,9,0,all)
      set %dm.item $replace(%dm.item,$chr(32),_)
      set %dm.bankitem $read(dmshopitems.txt, w, %dm.item $+ *)
      if (%dm.bankitem) {
        set %dmwriteitem $replace(%dm.bankitem,$chr(32),_)
        set %dmwriteitem $gettok(%dmwriteitem,1,64)
        if ($remove($right($1-,4),$chr(32)) == all) .set %dm.amount $readini(dminv.ini,$nick,%dmwriteitem)
        if (!%dm.amount) {
          notice $nick %c1 $+ Sorry, you don't have any %c3 $+ $replace($gettok(%dm.bankitem,1,64),_,$chr(32)) $+ s %c1 $+ in your inventory.
          halt
        }
        set %dm.amountt $calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount)
        if ($calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount) < 0) {
          set %dm.amountt 0
          notice $nick %c1 $+ Sorry! You don't have $+ %c2 %dm.amount %c3 $+ $replace($gettok(%dm.bankitem,1,64),_,$chr(32)) $+ s $+ %c1 on you, maybe on your bank?
          halt
        }
        elseif ($calc($readini(dminv.ini,$nick,%dmwriteitem) - %dm.amount) == 0) {
          dec %dminv. [ $+ [ $nick ] ]
          remini dminv.ini $nick %dmwriteitem
        }
        else {
          writeini dminv.ini $nick %dmwriteitem %dm.amountt
        }
        if ($readini(dmbank.ini,$nick,%dmwriteitem) == $null) {
          set %dm.amounttt %dm.amount
          inc %dmbank. [ $+ [ $nick ] ]
        }
        else {
          set %dm.amounttt $calc($readini(dmbank.ini,$nick,%dmwriteitem) + %dm.amount)
        }
        writeini dmbank.ini $nick %dmwriteitem %dm.amounttt
        notice $nick %c1 $+ Congrats! You just banked $+ %c3 %dm.amount $+ %c4 $replace($gettok(%dm.bankitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
        notice $nick %c1 $+ You now have a total of $+ %c3 %dm.amountt $+ %c4 $replace($gettok(%dm.bankitem,1,64),_,$chr(32)) $+ s $+ %c1 with you and $+ %c3 %dm.amounttt $+ %c1 on your bank.
      }
      else {
        notice $nick %c1 $+ Sorry! You don't have %c3 $+ " $+ $replace(%dm.item,_,$chr(32)) $+ " $+ %c1 on you. Maybe you spelled it wrong?
      }
    }
    else {
      :bankmsg
      notice $nick %c1 $+ Please use $+ %c3 !bank <item> <amount (below 100000)> $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;############################ WITHDRAW YA JUNK ############################
on $*:text:/^[!`.@](with(d(raw)?)?)/Si:#DM-bank, #DM, #DM-shop, #DM-tournaments: {
  setdmcolours
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-bank) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-bank $+ %c1 .
    halt
  }
  if ($nick == %dm.player1 || $nick == %dm.player2) {
    notice $nick %c1 $+ You withdraw buy stuff during a fight!
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (!$3) .goto withdrawmsg
    if (%dminv. [ $+ [ $nick ] ] >= 10) {
      dec %dminv. [ $+ [ $nick ] ] 
      notice $nick %c1 $+ Your inventory, which has $+ %c2 10 $+ %c1 slots, is full, you need to bank first. Join %c4 $+ #DM-bank $+ %c1 to do so.
      halt
    }
    set %dm.amount $remove($right($1-,6),$chr(32),a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,+,$chr(40),$chr(41))
    if (%dm.amount == 0) {
      notice $nick %c1 $+ You can't withdraw $+ %c3 0 $+ %c1 of something.
      halt
    }
    if (%dm.amount isnum || $remove($right($1-,4),$chr(32)) == all) {
      set %dm.item $remove($2-,1,2,3,4,5,6,7,8,9,0,all)
      set %dm.item $replace(%dm.item,$chr(32),_)
      set %dm.withdrawitem $read(dmshopitems.txt, w, %dm.item $+ *)
      if (%dm.withdrawitem) {
        set %dmwriteitem $replace(%dm.withdrawitem,$chr(32),_)
        set %dmwriteitem $gettok(%dmwriteitem,1,64)
        if ($remove($right($1-,4),$chr(32)) == all) .set %dm.amount $readini(dmbank.ini,$nick,%dmwriteitem)
        if (!%dm.amount) {
          notice $nick %c1 $+ Sorry, you don't have any %c3 $+ $replace($gettok(%dm.withdrawitem,1,64),_,$chr(32)) $+ s %c1 $+ on your bank.
          halt
        }
        set %dm.amountt $calc($readini(dmbank.ini,$nick,%dmwriteitem) - %dm.amount)
        if ($calc($readini(dmbank.ini,$nick,%dmwriteitem) - %dm.amount) < 0) {
          set %dm.amountt 0
          notice $nick %c1 $+ Sorry! You don't have $+ %c2 %dm.amount %c3 $+ $replace($gettok(%dm.withdrawitem,1,64),_,$chr(32)) $+ s $+ %c1 on your bank.
          halt
        }
        elseif ($calc($readini(dmbank.ini,$nick,%dmwriteitem) - %dm.amount) == 0) {
          dec %dmbank. [ $+ [ $nick ] ]
          remini dmbank.ini $nick %dmwriteitem
        }
        else {
          writeini dmbank.ini $nick %dmwriteitem %dm.amountt
        }
        if ($readini(dminv.ini,$nick,%dmwriteitem) == $null) {
          set %dm.amounttt %dm.amount
          inc %dminv. [ $+ [ $nick ] ]
        }
        else {
          set %dm.amounttt $calc($readini(dminv.ini,$nick,%dmwriteitem) + %dm.amount)
        }
        writeini dminv.ini $nick %dmwriteitem %dm.amounttt
        notice $nick %c1 $+ Congrats! You just withdrawed $+ %c3 %dm.amount $+ %c4 $replace($gettok(%dm.withdrawitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
        notice $nick %c1 $+ You now have a total of $+ %c3 %dm.amountt $+ %c4 $replace($gettok(%dm.withdrawitem,1,64),_,$chr(32)) $+ s $+ %c1 on your bank and $+ %c3 %dm.amounttt $+ %c1 with you.
      }
      else {
        notice $nick %c1 $+ Sorry! You don't have %c3 $+ " $+ $replace(%dm.item,_,$chr(32)) $+ " $+ %c1 on your bank. Maybe you spelled it wrong?
      }
    }
    else {
      :withdrawmsg
      notice $nick %c1 $+ Please use $+ %c3 !withdraw <item> <amount (below 100000)> $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;##########################################################################
;#######################---NOW.... LET'S FIGHT!!---########################
;##########################################################################

;########################## EQUIP ITEMS ###################################
on $*:TEXT:/^[!`@.](equip(p)?(ed)?|wear)/Si:#DM, #DM-bank, #DM-shop, #DM-tournaments: {
  set %dmturnnick $nick 
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan == #DM-bank || $chan == #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM $+ %c1 and $+ %c2 #DM-tournaments $+ %c1 .
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (%dm.status == on) {
      if (!$2) {
        if (!%dmweapon. [ $+ [ $nick ] ]) .set %dmweapon. [ $+ [ $nick ] ] "piece of air"
        notice $nick %c1 $+ You currently have a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 equipped.
        halt
      }
      if ($2- == %dmweapon. [ $+ [ $nick ] ]) {
        notice $nick %c1 $+ You already have a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 equipped.
        halt
      }
      unset %unequip
      if (%dmweapon. [ $+ [ $nick ] ]) {
        set %unequip %dmweapon. [ $+ [ $nick ] ]
        if (%unequip == "piece of air") { unset %unequip }
      }

      set %weaprequest $replace($2-,$chr(32),_)
      set %dm.equipitem $read(dmshopitems.txt, w, %weaprequest $+ *)
      if ($replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) == $gettok(%dm.equipitem,1,64)) {
        notice $nick %c1 $+ You already have a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 equipped.
        halt
      }
      if (%dm.equipitem) {
        set %dmweapclass. [ $+ [ $nick ] ] $gettok(%dm.equipitem,3,64)
        if (%dmweapclass. [ $+ [ $nick ] ] != %dmclass. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You only can equip weapons that belong to your class, $+ %c3 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ .
          halt 
        }
        set %dmcheckweap $gettok($replace(%dm.equipitem,$chr(32),_),1,64)
        if ($readini(dminv.ini,$nick,%dmcheckweap)) { 
          if ($gettok(%dm.equipitem,3,64) == melee || $gettok(%dm.equipitem,3,64) == range || $gettok(%dm.equipitem,3,64) == mage) {
            set %dmweapon. [ $+ [ $nick ] ] $replace(%dm.equipitem,_,$chr(32))
            set %dmweapon. [ $+ [ $nick ] ] $gettok(%dmweapon. [ $+ [ $nick ] ],1,64)
            writeini dminv.ini $nick $gettok(%dm.equipitem,1,64) $calc($readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64)) - 1)
            var %amountleft = $readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64))
            if (%amountleft <= 0) { 
              remini dminv.ini $nick $gettok(%dm.equipitem,1,64)
              dec %dminv. [ $+ [ $nick ] ]
            }
            if ($gettok(%dm.equipitem,3,64) == melee) {
              if (%dmlvl. [ $+ [ $nick ] ] >= $gettok(%dm.equipitem,5,64)) {
                if (%unequip) {
                  msg $chan %c2 $+ %dmturnnick %c1 $+ un-equips his $+ %c5 %unequip $+ %c1 $+ .
                  if (%lastequipped. [ $+ [ $nick ] ]) { 
                    writeini dminv.ini $nick $gettok(%lastequipped. [ $+ [ $nick ] ],1,64) $calc($readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64)) + 1) 
                    var %amountnow = $readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64))
                  }
                  else {
                    var %amountnow == 1)
                  }
                  if (%amountnow == 1) .inc %dminv. [ $+ [ $nick ] ]
                }
                set %dmweapmax. [ $+ [ $nick ] ] $gettok($replace(%dm.equipitem,$chr(32),_),4,64)
                msg $chan %c2 $+ %dmturnnick %c1 $+ equipped a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ , which has a max hit of $+ %c3 %dmweapmax. [ $+ [ $nick ] ] $+ %c1 $+ .
                set %lastequipped. [ $+ [ $nick ] ] $gettok(%dm.equipitem,1,64)
              }
              else {
                notice $nick %c1 $+ Sorry, you need to be at least $+ %c4 level $gettok(%dm.equipitem,5,64) $+ %c1 to equip a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ , while you only are level $+ %c6 %dmlvl. [ $+ [ $nick ] ] $+ %c1 $+ .
                unset %dmweapon. [ $+ [ $nick ] ]
              }
            }
            elseif ($gettok(%dm.equipitem,3,64) == range) {
              if (%unequip) {
                msg $chan %c2 $+ %dmturnnick %c1 $+ un-equips his $+ %c5 %unequip $+ %c1 $+ .
                if (%lastequipped. [ $+ [ $nick ] ]) {
                  writeini dminv.ini $nick $gettok(%lastequipped. [ $+ [ $nick ] ],1,64) $calc($readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64)) + 1)
                  var %amountnow = $readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64))
                }
                else {
                  var %amountnow = 1
                }
                if (%amountnow == 1) .inc %dminv. [ $+ [ $nick ] ]
              }
              set %dmweaparrows. [ $+ [ $nick ] ] $gettok($replace(%dm.equipitem,$chr(32),_),4,64)
              msg $chan %c2 $+ %dmturnnick %c1 $+ equipped a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ .
              set %lastequipped. [ $+ [ $nick ] ] $gettok(%dm.equipitem,1,64)
            }
            elseif ($gettok(%dm.equipitem,3,64) == mage) {
              set %dmweapextra. [ $+ [ $nick ] ] $gettok($replace(%dm.equipitem,$chr(32),_),4,64)
              if (%dmweapextra. [ $+ [ $nick ] ] < 0) .set %dmextramage decreases
              if (%dmweapextra. [ $+ [ $nick ] ] > 0) .set %dmextramage increases
              if (%unequip) {
                msg $chan %c2 $+ %dmturnnick %c1 $+ un-equips his $+ %c5 %unequip $+ %c1 $+ .
                if (%lastequipped. [ $+ [ $nick ] ]) {
                  writeini dminv.ini $nick $gettok(%lastequipped. [ $+ [ $nick ] ],1,64) $calc($readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64)) + 1)
                  var %amountnow = $readini(dminv.ini,$nick,$gettok(%lastequipped. [ $+ [ $nick ] ],1,64))
                }
                else {
                  var %amountnow = 1
                }
                if (%amountnow == 1) .inc %dminv. [ $+ [ $nick ] ]
              }
              set %lastequipped. [ $+ [ $nick ] ] $gettok(%dm.equipitem,1,64)
              msg $chan %c2 $+ %dmturnnick %c1 $+ equipped a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ , which %dmextramage his spells max hit with $remove(%dmweapextra. [ $+ [ $nick ] ],-) $+ % $+ %c1 $+ .
              set %mayunequip. [ $+ [ $nick ] ] 1
            }
          }
          else {
            notice $nick %c1 $+ You can't equip a $+ %c3 $replace(%dmcheckweap,_,$chr(32)) $+ %c1 $+ .
          }
        } 
        else { 
          notice $nick %c1 $+ You dont have a $+ %c5 $replace(%dmcheckweap,_,$chr(32)) $+ %c1 $+ !
        }
      }
      else {
        notice $nick %c1 $+ Sorry! You don't have %c3 $+ " $+ $replace(%weaprequest,_,$chr(32)) $+ " $+ %c1 in your inventory. Maybe you spelled it wrong?
      }
    }
    else {
      notice $nick %c1 $+ You can only use this command when fighting.
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;########################### EQUIP ARROWS ################################
on $*:TEXT:/^[!`@.](arrow)/Si:#DM, #DM-bank, #DM-shop, #DM-tournaments: { 

  ;+++BASIC+++
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan == #DM-bank || $chan == #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM $+ %c1 and $+ %c2 #DM-tournaments $+ %c1 .
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (%dm.status == on) {
      if (!$2) {
        if (!%dmarrow. [ $+ [ $nick ] ]) {
          notice $nick %c1 You currently have $+ %c2 the basic arrows ( $+ %c4 $+ Max hit: $+ %c6 5 $+ %c2 $+ ) $+ %c1 equipped.
          halt
        }
        if (!%dmarrow.amount. [ $+ [ $nick ] ]) .set %dmarrow.amount. [ $+ [ $nick ] ] 0
        notice $nick %c1 $+ You currently have $+ %c3 %dmarrow.amount. [ $+ [ $nick ] ] $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 equipped.
        halt
      }
      ;+++ CHANGES  '!arrow weak arrow all/num' in 'weak_arrow' +++
      set %weaprequest $replace($2-,$chr(32),_)
      set %weaprequest $remove(%weaprequest,1,2,3,4,5,6,7,8,9,0,all)

      ;+++ GETS FULL NAME/DATA OF ITEM: 'weak' becomes 'weak_arrow@price@arrow@bow@hit' +++
      set %dm.equipitem $read(dmshopitems.txt, w, %weaprequest $+ *)

      ;+++ CHECKS IF THE ARROW YOU TRY TO EQUIP IS THE SAME AS THE ONE THAT IS EQUIPPED. IF YES, GOTO :CHECKBOW +++
      if ($gettok($replace(%dmarrow. [ $+ [ $nick ] ],$chr(32),_),1,64) == $gettok(%dm.equipitem,1,64)) {
        unset %unequip2
        goto checkbow
      }

      ;+++ IF IT ISNT, TELLS IT HAVE TO UN-EQUIP THE OLD ARROW +++
      if (%dmarrow. [ $+ [ $nick ] ]) {
        unset %dmarrow.amount. [ $+ [ $nick ] ]
        set %unequip2 %dmarrow. [ $+ [ $nick ] ]
      }

      ;+++ CHECKS IF THE ITEM GIVEN IS AN ARROW +++
      set %dmweapclass. [ $+ [ $nick ] ] $gettok(%dm.equipitem,3,64)
      if (!%dmweapclass. [ $+ [ $nick ] ] || %dmweapclass. [ $+ [ $nick ] ] == melee || %dmweapclass. [ $+ [ $nick ] ] == range || %dmweapclass. [ $+ [ $nick ] ] == mage || %dmweapclass. [ $+ [ $nick ] ] == spell) { goto sorrymsg }
      if (%dmweapclass. [ $+ [ $nick ] ] != arrow) {
        notice $nick %c1 $+ You only can equip arrows with the ranger class, while you have $+ %c3 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ .
        halt 
      }

      ;+++ START :CHECKBOW - CHECKS IF AN AMOUNT IS GIVEN +++
      :checkbow
      set %dmarrow.amount $remove($right($1-,5),$chr(32),a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,+,$chr(40),$chr(41))
      if (!%dmarrow.amount) {
        notice $nick %c1 $+ Please specify a number, $+ %c2 below 10000 $+ %c1 $+ , of arrows you want to equip.
        halt
      }

      ;+++ IF THE ITEM GIVIN EXISTS, CONTINUE, ELSE GOTO :SORRYMSG +++
      if (!%dm.equipitem) .goto sorrymsg
      if (%dm.equipitem) {

        ;+++ INCREASE THE CURRENT ARROW AMOUNT BY THE GIVEN +++ 
        inc %dmarrow.amount. [ $+ [ $nick ] ] %dmarrow.amount

        ;+++ CHANGES 'weak_arrow@price@arrow@bow@hit' in 'weak arrow' +++
        set %dmcheckweap $gettok($replace(%dm.equipitem,$chr(32),_),1,64)

        ;+++ IF YOU HAVE THE ARROW +++
        if ($readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64))) { 

          ;+++ CHANGES 'weak_arrow' TO 'weak arrow' +++
          set %dmarrow. [ $+ [ $nick ] ] $replace(%dm.equipitem,_,$chr(32))

          ;+++ TELLS WHAT BOW YOU NEED +++
          set %reqbow $gettok(%dm.equipitem,4,64)
          set %reqbow $replace(%reqbow,_,$chr(32))

          ;+++ CHECKS IF YOU HAVEN'T THE CORRECT BOW EQUIPPED +++
          if (%reqbow == bow && %dmweapon. [ $+ [ $nick ] ] != bow && %dmweapon. [ $+ [ $nick ] ] != large bow && %dmweapon. [ $+ [ $nick ] ] != great bow && %dmweapon. [ $+ [ $nick ] ] != ultimate bow && %dmweapon. [ $+ [ $nick ] ] != triple arrowed bow) {
            notice $nick %c1 $+ You need a $+ %c5 bow $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 $replace($gettok(%dm.equipitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
            dec %dmarrow.amount. [ $+ [ $nick ] ] %dmarrow.amount
            halt
          }
          elseif (%reqbow == large bow && %dmweapon. [ $+ [ $nick ] ] != large bow && %dmweapon. [ $+ [ $nick ] ] != great bow && %dmweapon. [ $+ [ $nick ] ] != ultimate bow && %dmweapon. [ $+ [ $nick ] ] != triple arrowed bow) {
            notice $nick %c1 $+ You need a $+ %c5 Large bow $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 $replace($gettok(%dm.equipitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
            dec %dmarrow.amount. [ $+ [ $nick ] ] %dmarrow.amount            
            halt
          }
          elseif (%reqbow == great bow && %dmweapon. [ $+ [ $nick ] ] != great bow && %dmweapon. [ $+ [ $nick ] ] != ultimate bow && %dmweapon. [ $+ [ $nick ] ] != triple arrowed bow) {
            notice $nick %c1 $+ You need a $+ %c5 Great bow $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 $replace($gettok(%dm.equipitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
            dec %dmarrow.amount. [ $+ [ $nick ] ] %dmarrow.amount           
            halt
          }
          elseif (%reqbow == ultimate bow && %dmweapon. [ $+ [ $nick ] ] != ultimate bow && %dmweapon. [ $+ [ $nick ] ] != triple arrowed bow) {
            notice $nick %c1 $+ You need an $+ %c5 Ultimate bow $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 $replace($gettok(%dm.equipitem,1,64),_,$chr(32)) $+ s $+ %c1 $+ .
            dec %dmarrow.amount. [ $+ [ $nick ] ] %dmarrow.amount           
            halt
          }

          ;+++ IF YOU ARE WIELDING THE CORRECT BOW +++
          else {
            if ($calc($readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64)) - %dmarrow.amount) < 0) {
              set %amountyouhave $readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64))
              if (!%amountyouhave) .set %amountyouhave 0
              notice $nick %c1 $+ Sorry, you don't have $+ %c3 %dmarrow.amount $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 $+ . You only have $+ %c3 %amountyouhave $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 $+ .
              halt
            }
            elseif $calc($readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64)) - %dmarrow.amount) == 0) {
              remini dminv.ini $nick $gettok(%dm.equipitem,1,64)
              dec %dminv. [ $+ [ $nick ] ]
            }
            set %amountleft $calc($readini(dminv.ini,$nick,$gettok(%dm.equipitem,1,64)) - %dmarrow.amount)
            if (%amountleft <= 0) { 
              remini dminv.ini $nick $gettok(%dm.equipitem,1,64)
              dec %dminv. [ $+ [ $nick ] ]
            }
            else {
              writeini dminv.ini $nick $gettok(%dm.equipitem,1,64) %amountleft
              inc %dminv. [ $+ [ $nick ] ]
            }
            if (%unequip2) {
              msg $chan %c2 $+ %dmturnnick %c1 $+ un-equips his $+ %c5 $gettok(%unequip2,1,64) $+ s $+ %c1 $+ .
              set %oldamount $readini(dminv.ini,$nick,$gettok(%lastequipped2. [ $+ [ $nick ] ],1,64))
              set %plusamount %lastarrowamount. [ $+ [ $nick ] ]
              set %newamount $calc(%oldamount + %plusamount)
              if (%lastequipped2. [ $+ [ $nick ] ]) {
                writeini dminv.ini $nick $gettok(%lastequipped2. [ $+ [ $nick ] ],1,64) %newamount
                var %amountnow = $readini(dminv.ini,$nick,$gettok(%lastequipped2. [ $+ [ $nick ] ],1,64))
              }
              else {
                var %amountnow = 1
              }
            }
            if ($gettok($replace(%dm.equipitem,$chr(32),_), 6, 64) == P) { set %addextra , and has $+ %c6 10 $+ %c1 damage poison. }
            elseif ($gettok($replace(%dm.equipitem,$chr(32),_), 6, 64) == P+) { set %addextra , and has $+ %c6 20 $+ %c1 damage poison. }
            elseif ($gettok($replace(%dm.equipitem,$chr(32),_), 6, 64) == P++) { set %addextra , and has $+ %c6 40 $+ %c1 damage poison, that can't be cured. }
            else { set %addextra . } 
            set %lastequipped2. [ $+ [ $nick ] ] $gettok(%dm.equipitem,1,64)
            set %lastarrowamount. [ $+ [ $nick ] ] %dmarrow.amount. [ $+ [ $nick ] ]
            set %dmarrowmax. [ $+ [ $nick ] ] $gettok($replace(%dm.equipitem,$chr(32),_),5,64)
            msg $chan %c2 $+ $nick %c1 $+ equips $+ %c3 %dmarrow.amount $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 $+ , which can max hit $+ %c3 %dmarrowmax. [ $+ [ $nick ] ] $+ %c1 $+ %addextra
          }
        } 

        ;+++ IF YOU DON'T HAVE THE ARROW +++
        else { 
          notice $nick %c1 $+ You dont have a $+ %c5 $replace(%dmcheckweap,_,$chr(32)) $+ %c1 $+ !
        }
      }
      else {
        :sorrymsg
        notice $nick %c1 $+ Sorry! You don't have %c3 $+ " $+ $replace(%weaprequest,_,$chr(32)) $+ " $+ %c1 in your inventory. Maybe you spelled it wrong?
      }
    }
    else {
      notice $nick %c1 $+ You can only use this command when fighting.
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;########################### UNEQUIP ####################################
on $*:text:/^[!`@.](un(eq(uip)?)|wear)/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan == #DM-bank || $chan == #DM-shop) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM $+ %c1 and $+ %c2 #DM-tournaments $+ %c1 .
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (%dm.status == on && ($nick == %dm.player1 || $nick == %dm.player2)) {
      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ]) {
        notice $nick %c1 $+ You don't have anything equipped!
        halt
      }
      set %dmwriteitemfight $replace(%dmweapon. [ $+ [ $nick ] ],Chr(32),_)
      var %checkitemfight = $readini(dminv.ini,$nick,$replace(%dmwriteitemfight,$chr(32),_))
      if (%dminv. [ $+ [ $nick ] ] >= 10 && !%checkitemfight) {
        notice $nick %c1 $+ Your inventory is full!
        halt
      }
      msg $chan %c2 $+ $nick $+ %c1 Unequips his $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ , which means he now is unarmed.
      if ($readini(dminv.ini,$nick,$replace(%dmwriteitemfight,$chr(32),_))) .inc %dminv. [ $+ [ $nick ] ]
      unset %mayunequip. [ $+ [ $nick ] ]
      unset %dmweapon. [ $+ [ $nick ] ]
      unset %lastequipped. [ $+ [ $nick ] ]
      set %oldamountfight $readini(dminv.ini,$nick,$replace(%dmwriteitemfight,$chr(32),_))
      writeini dminv.ini $nick $replace(%dmwriteitemfight,$chr(32),_) $calc(%oldamountfight + 1)
    }
    else {
      notice $nick %c1 $+ You can only use this command when fighting.
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}


;######################## ATTACK - MELEE ################################
on $*:text:/^[?!@`.](at(t)?(ack)?|hit)/Si:#DM: {
  if (%dm.status == ON) {
    if ($nick == %dm.player1) {
      if (%dmclass. [ $+ [ $nick ] ] != melee) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch off
      timerstopdm off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.player2 $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        halt
      }

      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ])  { 
        set %dm.hit $rand(0,5) 
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused his fist.
        health.check
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != melee && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.player1 ] ],$chr(32),_) $+ *),4,64)
        set %dm.hit $rand(0, %dm.max)
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
        if (home isin %dmweapon. [ $+ [ %dm.player1 ] ] && $r(1,5) == 2) {
          timer 1 1 notice $nick %c1 $+ You broke your $+ %c3 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ , meaning you lost it.
          unset %dmweapon. [ $+ [ %dm.player1 ] ]
        }
      } 
      health.check
      set %dm.player1 %dm.player2
      set %dm.player2 $nick
      timerturnswitch 1 60 turngone
    }
    elseif ($nick == %dm.player2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this DM. 
    }
  }
  else {
    notice $nick %c1 $+ There is no DM running! Type $+ %c6 !DM $+ %c1 to start one.
  }
}

;################### ATTACK - SPECIALS (MELEE ONLY) ####################
on $*:text:/^[!@`.](spe(c(ial)?(s)?)?)/Si:#DM: {
  if (%dm.status == ON) {
    if ($nick == %dm.player1) {
      if (%dmclass. [ $+ [ $nick ] ] != melee) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      if (!$2) {
        notice $nick %c1 $+ Please choose the kind of special attack you want. Type $+ %c4 !DMcommands specials $+ %c1 to see a list of available special attacks.
        halt
      }
      if (%specuse. [ $+ [ $nick ] ] <= 0) {
        notice $nick %c1 $+ You can't use any more special attacks until you drink a $+ %c4 Special attack potion $+ %c1 $+ .
        halt
      }
      timerturnswitch off
      timerstopdm off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.player2 $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        halt
      }
      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ])  { 
        notice $nick %c1 $+ You need to have a weapon equipped if you want to use a $+ %c3 special attack $+ %c1 $+ .
        halt
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != melee && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.player1 ] ],$chr(32),_) $+ *),4,64)
        set %dm.hit $rand(0, %dm.max)
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        if (home isin %dmweapon. [ $+ [ %dm.player1 ] ] && $r(1,5) == 2) {
          timer 1 1 notice $nick %c1 $+ You broke your $+ %c3 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ , meaning you lost it.
          unset %dmweapon. [ $+ [ %dm.player1 ] ]
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
        :checkspec
        if (*ice* iswm $2-) {
          if ($r(1,100) <= 35) {
            timer -m 1 500 msg $chan %c2 $+ %dm.player2 $+ 's $+ %c1 weapon broke because of the cold!
            timer 1 1 notice %dm.player2 %c1 $+ Your weapon has been un-equipped automaticly.
            unset %dmweapon. [ $+ [ %dm.player2 ] ]
          }
          set %dmweapused the $+ %c4 special attack $+ %c6 "Sword of Ice" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
        }
        elseif (*fire* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Sword of Fire" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
          timer 1 1 msg $chan %c2 $+ %dm.player2 $+ 's $+ %c1 weapon is glowing from the heat! Not a chance he can hold it now.
          set %toohot. [ $+ [ %dm.player2 ] ] 2
        }
        elseif (*diam* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Diamond Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
          set %dm.max $gettok($calc(%dm.max * 1.3),1,46)
          set %dm.hit $rand(0, %dm.max)
          if ($r(1,100) <= 10) {
            set %moneymore $r(100,10000)
            inc %dmmoney. [ $+ [ $nick ] ] %moneymore
            timer 1 1 notice %dm.player1 %c3 $+ Congratz! $+ %c1 You found some diamonds, which are worth $+ %c5 %moneymore $+ %c1 coins.
          }
          else {
            timer 1 1 notice %dm.player1 %c3 $+ You didn't get any diamonds.
          }
        }
        elseif (*ramp* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Rampage Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
          set %dm.max $calc(%dm.max * 2)
          set %dm.hit $rand(0, %dm.max)
          if ($r(1,100) <= 10) {
            timer 1 1 notice $nick %c1 $+ Your $+ %c5 %dmweapon. [ $+ [ $nick ] ] %c1 $+ broke.
            unset %dmweapon. [ $+ [ $nick ] ]
          }
        }
        elseif (*clon* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Clone Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
          set %cloneamount $r(1,7)
          var %counter = %cloneamount
          set %dm.max $gettok($calc(%dm.max / 2),1,46)
          while (%counter > 0) {
            set %dm.hit [ $+ [ %counter ] ] $r(0,%dm.max)
            dec %counter
          }
          set %dm.totalhit $calc(%dm.hit1 + %dm.hit2 + %dm.hit3 + %dm.hit4 + %dm.hit5 + %dm.hit6 + %dm.hit7)
        }
        elseif (*life* iswm $2- || *live* iswm $2-) {
          set %healthmore $gettok($calc(%dm.hit * 0.8),1,46)
          inc %dmhealth. [ $+ [ %dm.player1 ] ] %healthmore
          if (%dmhealth. [ $+ [ %dm.player1 ] ] > %dmstarthealth. [ $+ [ %dm.player1 ] ]) {
            set %healthmore $calc(%dmstarthealth. [ $+ [ %dm.player1 ] ] - (%dmhealth. [ $+ [ %dm.player1 ] ] - %dm.heal))
            set %dmhealth. [ $+ [ %dm.player1 ] ] %dmstarthealth. [ $+ [ %dm.player1 ] ]
          }
          timer -m 1 500 msg $chan %c2 $+ %dm.player1 $+ %c1 used the $+ %c4 special attack $+ %c6 "Sword of Life" $+ %c1 $+ , which heals him with $+ %c4 80% $+ %c1 of his hit, being $+ %c5 %healthmore $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.player1 ] ] $+ %c1 hitpoints.  
        }
        else {
          notice $nick %c1 $+ Please choose a valid $+ %c5 special attack $+ %c1 $+ .
          halt
        }
      }
      health.check
      set %dm.player1 %dm.player2
      set %dm.player2 $nick
      dec %specuse. [ $+ [ $nick ] ]
      notice $nick %c1 $+ Unless you drink a $+ %c5 Special attack potion $+ %c1 $+ , you can use $+ %c4 %specuse. [ $+ [ $nick ] ] $+ %c2 more special attack $+ $iif(%specuse. [ $+ [ $nick ] ] != 1, s) $+ %c1 this $+ %c5 DeathMatch.
      timerturnswitch 1 60 turngone
    }
    elseif ($nick == %dm.player2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this DM. 
    }
  }
  else {
    notice $nick %c1 $+ There is no DM running! Type $+ %c6 !DM $+ %c1 to start one.
  }
}



;######################## ATTACK - RANGE ################################
on $*:text:/^[@`.?!](s(h)?((o)?o)?t)/Si:#DM: {
  if (%dm.status == ON) {
    if ($nick == %dm.player1) {
      if (%dmclass. [ $+ [ $nick ] ] != range) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !cast $+ %c1 $+ , $+ %c3 !attack $+ %c1 , $+ %c3 !special $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch off
      timerstopdm off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.player2 $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        halt
      }
      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ] || !%dmarrow. [ $+ [ $nick ] ])  { 
        set %dm.hit $rand(0,5) 
        if (!%dmarrow. [ $+ [ $nick ] ] && %dmweapon. [ $+ [ $nick ] ]) { set %dmweapused a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 with the $+ %c5 basic arrows $+ %c1 $+ . }
        else { set %dmweapused his fist. }
        if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
          dec %rangepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        health.check
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        halt
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != range && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !attack $+ %c1 $+ , $+ %c3 !cast $+ %c1 , $+ %c3 !special $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        dec %dmarrow.amount. [ $+ [ $nick ] ] 1
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmarrow. [ $+ [ %dm.player1 ] ],$chr(32),_) $+ *),5,64)
        set %dm.hit $rand(0, %dm.max)
        set %arrows.shot $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.player1 ] ],$chr(32),_) $+ *),4,64)
        if (%rangepotuse. [ $+ [ $nick ] ] > 0 && %arrows.shot == 1) {
          dec %rangepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dm.poison $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmarrow. [ $+ [ %dm.player1 ] ],$chr(32),_) $+ *),6,64)
        if (%dm.poison == P) .set %dm.poisondmg 10
        if (%dm.poison == P+) .set %dm.poisondmg 20
        if (%dm.poison == P++) .set %dm.poisondmg 40
        if (!%dmpoisoned. [ $+ [ %dm.player2 ] ] && %dm.poisondmg && $r(1,5) == 2) {
          set %addpoison 1
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 with $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 $+ .
        else {
          set %dmweapused %dmweapused $chr(32) | timer 1 1 notice %dm.player1 %c1 $+ You now have $+ %c3 %dmarrow.amount. [ $+ [ %dm.player1 ] ] $+ %c5 $gettok(%dmarrow. [ $+ [ %dm.player1 ] ],1,64) $+ s $+ %c1 left.
        }
        if (%arrows.shot == 3) {
          if (%dmarrow.amount. [ $+ [ $nick ] ] >= 2) {
            set %dm.hit $calc(%dm.hit * 0.9)
            set %dm.hit2 $rand(0, %dm.max)
            set %dm.hit3 $rand(0, %dm.max)
            set %dm.totalhit $calc(%dm.hit + %dm.hit2 + %dm.hit3)
            if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
              dec %rangepotuse. [ $+ [ $nick ] ]
              set %dm.totalhit $gettok($calc(%dm.totalhit * 1.1),1,46)
              timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
            }
            dec %dmarrow.amount. [ $+ [ $nick ] ] 2
          }
          else {
            notice $nick %c1 $+ You only have $+ %c3 $calc(%dmarrow.amount. [ $+ [ $nick ] ] + 1) $+ %c1 arrows left, while you need at least $+ %c3 3 $+ %c1 arrows.
            halt
          }
        }
        if (%dmarrow.amount. [ $+ [ $nick ] ] <= 0) {
          unset %dmarrow. [ $+ [ $nick ] ]
        }
      } 
      health.check
      set %dm.player1 %dm.player2
      set %dm.player2 $nick
      timerturnswitch 1 60 turngone
    }
    elseif ($nick == %dm.player2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this DM. 
    }
  }
  else {
    notice $nick %c1 $+ There is no DM running! Type $+ %c6 !DM $+ %c1 to start one.
  }
}


;######################## ATTACK - MAGE #################################
on $*:text:/^[?!@`.](cast|spell)/Si:#DM: {
  if (%dm.status == ON) {
    if ($nick == %dm.player1) {
      if (%dmclass. [ $+ [ $nick ] ] != mage) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !attack, $+ %c3 !special $+ %c1 $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch off
      timerstopdm off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.player2 $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.player1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.player2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.player1 %dm.player2
        set %dm.player2 $nick
        halt
      }
      if ($2) {
        set %dmspellname $read(dmshopitems.txt, w, $replace($2-,$chr(32),_) $+ *)
        set %dmspell2 $gettok(%dmspellname,1,64)
        set %dmspell $replace(%dmspell2,_,$chr(32))
        if (!%dmspell) {
          notice $nick %c1 $+ There's no such spell as %c4 $+ " $+ $2- $+ " $+ %c1 $+ .
          halt
        }
        if ($readini(dminv.ini,$nick,%dmspell2) <= 0 || !$readini(dminv.ini,$nick,%dmspell2)) { 
          notice $nick %c1 $+ You don't have any $+ %c3 %dmspell $+ s $+ %c1 $+ .
          halt
        } 
      }
      if ((!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ] && !$2) || !$2)  { 
        set %dm.hit $calc($rand(0,10) + $iif(rand(1,5) == 2, $rand(0,10), 0))
        if (%magepotuse. [ $+ [ $nick ] ] > 0) {
          dec %magepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 mage potion $+ %c1 will be active for $+ %c5 %magepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused the basic spell.
        health.check
      }
      else { 
        set %dm.weaponuse $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.weaponuse,3,64) != mage && Piece of air !isin %dmweapon. [ $+ [ $nick ] ] && !$2) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !attack, $+ %c3 !special $+ %c1 $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %reqstaff $gettok(%dmspellname,4,64)
        set %reqstaff $replace(%reqstaff,_,$chr(32))
        if (%reqstaff == Newbie magic staff && %dmweapon. [ $+ [ $nick ] ] != Newbie magic staff && %dmweapon. [ $+ [ $nick ] ] != Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Newbie magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Beginner magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need an $+ %c5 Advanced magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Two duel handed magic wands && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need $+ %c5 Two duel handed magic wands $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif ($gettok(%dmspellname,3,64) == aspell) {
          set %dm.max $gettok(%dmspellname,5,64)
          if (%dmweapon. [ $+ [ $nick ] ] == Newbie magic staff) .set %dm.max $calc(%dm.max * 0.8)
          if (%dmweapon. [ $+ [ $nick ] ] == Beginner magic staff) .set %dm.max $calc(%dm.max * 0.9)
          if (%dmweapon. [ $+ [ $nick ] ] == Advanced magic staff) .set %dm.max $calc(%dm.max * 1.1)
          if (%dmweapon. [ $+ [ $nick ] ] == Ultimate magic staff) .set %dm.max $calc(%dm.max * 1.2)
          if (%dmweapon. [ $+ [ $nick ] ] == Two duel handed magic wands) .set %dm.max $calc(%dm.max * 1.5)
          set %dm.hit $rand($calc(5 + $iif($r(1,2) == 2, (%dm.max * 0.1), 0)), %dm.max) 
          if (%magepotuse. [ $+ [ $nick ] ] > 0) {
            dec %magepotuse. [ $+ [ $nick ] ]
            set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
            timer 1 1 notice $nick %c1 $+ Your $+ %c3 mage potion $+ %c1 will be active for $+ %c5 %magepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
          }
          set %dmweapused %c3 $+ %dmspell $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.player1 ] ] $+ %c1 $+ .
          if ($gettok(%dmspellname,6,64) == freeze) {
            set %dmfreeze. [ $+ [ %dm.player2 ] ] 2
            if (%dmclass. [ $+ [ %dm.player2 ] ] != melee) .set %dmfreeze. [ $+ [ %dm.player2 ] ] 0
            set %dmweapused %dmweapused  | timerfreeze -m 1 500 msg $chan %c2 $+ %dm.player2 $+ %c1 has been frozen, meaning he can't use $+ %c3 melee attacks $+ %c1 for $+ %c5 2 $+ %c1 turns.
          }
          set %diddecspell 1
          writeini dminv.ini $nick %dmspell2 $calc($readini(dminv.ini,$nick,%dmspell2) - 1)
          set %dmweapused %dmweapused  | timer 1 1 notice %dm.player1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmspell2) $+ %c4 %dmspell $+ s $+ %c1 left. 
          if ($readini(dminv.ini,$nick,%dmspell2) <= 0) .remini dminv.ini $nick %dmspell2
          :health.check
          health.check
        }
        elseif ($gettok(%dmspellname,3,64) == hspell) {
          set %dm.heal $gettok($calc(%dmstarthealth. [ $+ [ %dm.player1 ] ] / 100 * $gettok(%dmspellname,5,64)),1,46)
          inc %dmhealth. [ $+ [ %dm.player1 ] ] %dm.heal
          if (%dmhealth. [ $+ [ %dm.player1 ] ] > %dmstarthealth. [ $+ [ %dm.player1 ] ]) {
            set %dm.heal $calc(%dmstarthealth. [ $+ [ %dm.player1 ] ] - (%dmhealth. [ $+ [ %dm.player1 ] ] - %dm.heal))
            set %dmhealth. [ $+ [ %dm.player1 ] ] %dmstarthealth. [ $+ [ %dm.player1 ] ]
          }
          msg $chan %c2 $+ %dm.player1 $+ %c1 casts $+ %c5 %dmspell $+ %c1 healing him with $+ %c4 %dm.heal $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.player1 ] ] $+ %c1 hitpoints.  
        }
        elseif ($gettok(%dmspellname,3,64) == tspell) {
          set %dmfreeze. [ $+ [ %dm.player2 ] ] 4
          if (%dmclass. [ $+ [ %dm.player2 ] ] != melee) .set %dmfreeze. [ $+ [ %dm.player2 ] ] 2
          msg $chan %c2 $+ %dm.player1 $+ %c5 teleports away $+ %c1 $+ , meaning $+ %c2 %dm.player2 $+ %c1 can't use $+ %c3 melee attacks $+ %c1 for $+ %c5 4 $+ %c1 $+ , and $+ %c3 ranged/magic attacks $+ %c1 for $+ %c5 2 $+ %c1 turns. 
        }
        if (%dmspell2 && !%diddecspell) {
          writeini dminv.ini $nick %dmspell2 $calc($readini(dminv.ini,$nick,%dmspell2) - 1)
          set %dmweapused %dmweapused  | timer 1 1 notice %dm.player1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmspell2) $+ %c4 %dmspell $+ s $+ %c1 left. 
          if ($readini(dminv.ini,$nick,%dmspell2) <= 0) .remini dminv.ini $nick %dmspell2 
        }
        unset %diddecspell
      } 
      set %dm.player1 %dm.player2
      set %dm.player2 $nick
      timerturnswitch 1 60 turngone
    }
    elseif ($nick == %dm.player2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this DM. 
    }
  }
  else {
    notice $nick %c1 $+ There is no DM running! Type $+ %c6 !DM $+ %c1 to start one.
  }
}

;############################ POTIONS & FOOD ############################
on $*:text:/^[!`@.?](eat|pot(ion)?|potions|use|drink)/Si:#DM: {
  if (cast isin $1-) { halt }
  if (%dm.status == ON) {
    if ($nick == %dm.player1) {
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 || %toohot. [ $+ [ $nick ] ] > 0) {
        timer 1 1 notice $nick %c1 $+ You can't attack for $+ %c3 $iif(%dmfreeze. [ $+ [ $nick ] ], %dmfreeze. [ $+ [ $nick ] ], %toohot. [ $+ [ $nick ] ]) $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1 && %dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        dec %dmfreeze. [ $+ [ $nick ] ]
        dec %toohot. [ $+ [ $nick ] ]
      }
      set %dmpotname $read(dmshopitems.txt, w, $replace($2-,$chr(32),_) $+ *)
      set %dmpot2 $gettok(%dmpotname,1,64)
      set %dmpot $replace(%dmpot2,_,$chr(32))
      if (!%dmpotname) {
        notice $nick %c1 $+ There's no such potion as $+ %c3 " $+ $2- $+ " $+ %c1 $+ .
        halt
      }
      if ($readini(dminv.ini,$nick,%dmpot2) <= 0 || !$readini(dminv.ini,$nick,%dmpot2)) { 
        notice $nick %c1 $+ You don't have any $+ %c3 %dmpot $+ s $+ %c1 $+ .
        halt
      } 
      timerturnswitch off
      timerstopdm off
      if (!%dmpot) {
        notice $nick %c1 $+ There's no such potion as %c4 $+ " $+ $2- $+ " $+ %c1 $+ .
        halt
      }
      if ($gettok(%dmpotname,3,64) == apot && %dmpoisoned. [ $+ [ $nick ] ] == 40) .goto skippoison 
      dm.poison
      :skippoison
      if ($gettok(%dmpotname,3,64) == hpot) {
        set %dm.heal $gettok(%dmpotname,4,64)
        inc %dmhealth. [ $+ [ %dm.player1 ] ] %dm.heal
        if (%dmhealth. [ $+ [ %dm.player1 ] ] > %dmstarthealth. [ $+ [ %dm.player1 ] ]) {
          set %dm.heal $calc(%dmstarthealth. [ $+ [ %dm.player1 ] ] - (%dmhealth. [ $+ [ %dm.player1 ] ] - %dm.heal))
          set %dmhealth. [ $+ [ %dm.player1 ] ] %dmstarthealth. [ $+ [ %dm.player1 ] ]
        }
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 healing him with $+ %c4 %dm.heal $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.player1 ] ] $+ %c1 hitpoints.  
        if (uber isin %dmpot) {
          if (%uberpotused. [ $+ [ $nick ] ] >= 3) {
            notice $nick %c1 $+ You can't drink a $+ %c5 %dmpot $+ %c1 another time this fight.
          }
          set %cantbehit. [ $+ [ %dm.player1 ] ] 1
          if (!%uberpotused. [ $+ [ $nick ] ]) .set %uberpotused. [ $+ [ $nick ] ] 0
          inc %uberpotused. [ $+ [ $nick ] ]
          notice $nick %c1 $+ You can drink a $+ %c5 %dmpot $+ %c6 $calc(3 - %uberpotused. [ $+ [ $nick ] ] ) $+ %c1 more times this fight.
        }
      }
      if ($gettok(%dmpotname,3,64) == apot) {
        if (%dmpoisoned. [ $+ [ $nick ] ] != 40) {
          msg $chan %c2 $+ %dm.player1 $+ %c1 drinks an $+ %c5 %dmpot $+ %c1 releasing him from his poison.
          unset %dmpoisoned. [ $+ [ $nick ] ]
        }
        else {
          notice $nick %c1 $+ You can't cure poison from $+ %c4 Cursed arrows $+ %c1 $+ .
          halt
        }  
      }
      if ($gettok(%dmpotname,3,64) == ppot) {
        if (%specuse. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if you're still able to use Special attacks.
          halt
        }
        set %specuse. [ $+ [ $nick ] ] 2
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 allowing him to use $+ %c4 2 more $+ %c1 Special attacks.
      }
      if ($gettok(%dmpotname,3,64) == mpot) {
        if (%magepotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %magepotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 mage max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == spot) {
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %strengthpotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 melee max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == rpot) {
        if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %rangepotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 ranged max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == dpot) {
        if (%defpotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %defpotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.player1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 defence $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      writeini dminv.ini $nick %dmpot2 $calc($readini(dminv.ini,$nick,%dmpot2) - 1)
      timer 1 1 notice %dm.player1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmpot2) $+ %c4 %dmpot $+ s $+ %c1 left. 
      if ($readini(dminv.ini,$nick,%dmpot2) <= 0) .remini dminv.ini $nick %dmpot2 
      set %dm.player1 %dm.player2
      set %dm.player2 $nick
      timerturnswitch 1 60 turngone
    }
    elseif ($nick == %dm.player2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this DM. 
    }
  }
  else {
    notice $nick %c1 $+ There is no DM running! Type $+ %c6 !DM $+ %c1 to start one.
  }
}


;######################## XP & LVL CHECK ################################
on $*:text:/^[!@`.](((e)?x)?p(oint)?(s)?|l(e)?v(e)?l)/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    var %dmxpchecknick = $nick
    if (($2 && $2 !isnum && !$3) || ($3 && $2 !isnum)) { var %dmxpchecknick = $2 }
    if (!%dm.xp. [ $+ [ %dmxpchecknick ] ]) .set %dm.xp. [ $+ [ %dmxpchecknick ] ] 0
    if (!%dmlvl. [ $+ [ %dmxpchecknick ] ]) .set %dmlvl. [ $+ [ %dmxpchecknick ] ] 1
    var %dmxpnow = %dm.xp. [ $+ [ %dmxpchecknick ] ]
    if ($3 isnum || ($2 isnum && !3)) {
      goto checkthis
    }
    if (%dmlvl. [ $+ [ %dmxpchecknick ] ] == 1 ) { 
      set %dm.lvl.req. [ $+ [ %dmxpchecknick ] ] 100 
    } 
    else { 
      set %dm.lvl.req. [ $+ [ %dmxpchecknick ] ] $calc(%dmlvl. [ $+ [ %dmxpchecknick ] ] ^ 3 * 0.6 + %dmlvl. [ $+ [ %dmxpchecknick ] ] * 100))
    }
    var %dmxpneed = %dm.lvl.req. [ $+ [ %dmxpchecknick ] ]
    set %xpleft. [ $+ [ %dmxpchecknick ] ] $calc(%dmxpneed - %dmxpnow)
    notice $nick %c3 $+ %dmxpchecknick $+ %c1 currently is level $+ %c5 %dmlvl. [ $+ [ %dmxpchecknick ] ] $+ %c1 $+ , and has $+ %c4 $gettok(%dm.xp. [ $+ [ %dmxpchecknick ] ],1,46) $+ %c1 expoints. For level $+ %c6 $calc(%dmlvl. [ $+ [ %dmxpchecknick ] ] + 1) $+ %c1 he needs a total of $+ %c5 $gettok(%dm.lvl.req. [ $+ [ %dmxpchecknick ] ],1,46) %c1 $+ expoints, which means he needs $+ %c2 $gettok(%xpleft. [ $+ [ %dmxpchecknick ] ],1,46) %c1 $+ expoints more.
    halt
    :checkthis
    if ($3 isnum) .set %asklvl $3
    if ($2 isnum) .set %asklvl $2
    goto checklvl
    if ((!$3 && $2 !isnum) || ($3 && $3 !isnum)) {
      notice $nick %c1 $+ You need to specify a lvl.
      halt
    }
    :checklvl
    if (%dmlvl. [ $+ [ %dmxpchecknick ] ] > %asklvl) {
      notice $nick %c2 $+ %dmxpchecknick $+ %c1 already is higher than lvl $+ %c3 %asklvl $+ %c1 $+ .
      halt
    }
    else {
      var %asklvl2 = $calc(%asklvl - 1)
      var %asklvlxp = $calc(%asklvl2 ^ 3 * 0.6 + %asklvl2 * 100)
      notice $nick %c1 $+ For lvl $+ %c4 %asklvl $+ %c1 $+ , $+ %c2 %dmxpchecknick $+ %c1 needs $+ %c6 $gettok($calc(%asklvlxp - %dmxpnow),1,46) %c1 $+ more expoints. He now has $+ %c6 $gettok(%dmxpnow,1,46) %c1 $+ expoints and is level $+ %c4 %dmlvl. [ $+ [ %dmxpchecknick ] ] $+ %c1 $+ .
      halt
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
}

;########################################################################
;########################### OTHER COMMANDS #############################
;########################################################################

;###################### GET/SET MONEY/WEAP/XP/LVL########################
on $*:text:/^[!`.@]((get|set))/Si:#DM, #DM-shop, #DM-bank, #DM-tournaments: {
  if (($nick == Supamagier || $nick == cnb6 || $address($nick,2) == $address($me,2)) || $nick isop $chan) {
    if (get isin $1-) {
      if (!$2 || # isin $2) {
        notice $nick %c1 $+ Please specify a valid nickname.
        halt
      }
      if (mon isin $1 || cash isin $1) {
        if (!%dmmoney. [ $+ [ $2 ] ]) .set %dmmoney. [ $+ [ $2 ] ] 0
        notice $nick %c2 $+ $2 $+ %c1 has $+ %c3 %dmmoney. [ $+ [ $2 ] ] $+ %c1 coins.
      }
      elseif (l*v*l iswm $1) {
        if (!%dmlvl. [ $+ [ $2 ] ]) .set %dmlvl. [ $+ [ $2 ] ] 1
        notice $nick %c2 $+ $2 $+ %c1 currently is level $+ %c3 %dmlvl. [ $+ [ $2 ] ] $+ %c1 $+ .
      }
      elseif (*xp* iswm $1) {
        if (!%dmxp. [ $+ [ $2 ] ]) .set %dmxp. [ $+ [ $2 ] ] 0
        notice $nick %c2 $+ $2 $+ %c1 currently has $+ %c3 %dmxp. [ $+ [ $2 ] ] $+ %c1 expoints.
      }
      elseif (*weap* iswm $1) {
        if (!%dmweapon. [ $+ [ $2 ] ]) .set %dmweapon. [ $+ [ $2 ] ] "Piece of Air"
        notice $nick %c2 $+ $2 $+ %c1 currently has a $+ %c3 %dmweapon. [ $+ [ $2 ] ] $+ %c1 equipped.
      }
    }
    if (set isin $1-) {
      if (!$2 || # isin $2) {
        notice $nick %c1 $+ Please specify a valid nickname.
        halt
      }
      if ($3 isnum) {
        if (mon isin $1 || cash isin $1) {
          set %dmmoney. [ $+ [ $2 ] ] $3
          notice $nick %c2 $+ $2 $+ `s %c1 $+ money set to $+ %c3 $3 $+ %c1 $+ .
        }
        elseif (lev isin $1) {
          set %dmlvl. [ $+ [ $2 ] ] $3
          notice $nick %c2 $+ $2 $+ `s %c1 $+ level set to $+ %c3 $3 $+ %c1 $+ .
        }
        elseif (*xp* iswm $1) {
          set %dmxp. [ $+ [ $2 ] ] $3
          notice $nick %c2 $+ $2 $+ `s %c1 $+ expoints set to $+ %c3 $3 $+ %c1 $+ .
        }
      }
      elseif (weap !isin $1) {
        notice $nick %c1 $+ Please specify a valid nickname and amount.
      }
      if (*weap* iswm $1) {
        if (!$2 || !$3) {
          notice %nick %c1 $+ Please specify a nickname and weapon.
          halt
        }
        set %posweap $read(dmshopitems.txt, w, $3- $+ *)
        set %classthingy $gettok(%posweap,3,64)
        if ((%classthingy != melee && %classthingy != mage && %classthingy != range) || !%classthingy) {
          notice $nick %c1 $+ Please specify a valid weapon.
          halt
        }
        set %dmweapon. [ $+ [ $2 ] ] $gettok(%posweap,1,64)
        notice $nick %c2 $+ $2 $+ `s %c1 $+ weapon set to $+ %c3 $gettok(%posweap,1,64) $+ %c1 $+ .
      }
    }
  }
  else {
    notice $nick %c1 $+ You are not authorized to use this command.
  }
}

;############################## GET RANKS ###############################
on $*:text:/^[!@`.](rank(ed)?)/Si:#DM, #DM-tournaments, #DM-bank, #DM-shop: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    set %lookupplayer $2
    if (!$2) .set %lookupplayer $nick
    if (!$read(dmwins.txt, w, %lookupplayer $+ *)) {
      notice $nick %c1 $+ You have no wins, which means no rank.
      halt
    }
    notice $nick %c6 $+ Rank wins: %c1 $+ With $+ %c3 %dmwins. [ $+ [ %lookupplayer ] ] $+ %c1 wins, $+ %c2 %lookupplayer $+ %c1 is ranked $+ %c4 $readn $+ $iif($readn == 1, st, $iif($readn == 2, nd, $iif($readn == 3, rd, th))) $+ %c1 out of $+ %c2 $lines(dmwins.txt) $+ %c1 people.
    if (!$read(dmloses.txt, w, %lookupplayer $+ *)) {
      notice $nick %c1 $+ You have no loses, which means no rank.
      halt
    }
    notice $nick %c6 $+ Rank loses: %c1 $+ With $+ %c3 %dmloses. [ $+ [ %lookupplayer ] ] $+ %c1 loses, $+ %c2 %lookupplayer $+ %c1 is ranked $+ %c4 $readn $+ $iif($readn == 1, st, $iif($readn == 2, nd, $iif($readn == 3, rd, th))) $+ %c1 out of $+ %c2 $lines(dmloses.txt) $+ %c1 people.
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }
} 

;############################### GIVE CASH ##############################
on $*:text:/^[!`@.](give(cash|mon(ey)?)?|hand(over)?)/Si:#DM, #DM-tournaments, #DM-shop, #DM-bank: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $nick ] ] == 1) {
    if (!%dmmoney. [ $+ [ $nick ] ] || %dmmoney. [ $+ [ $nick ] ] <= 0) {
      notice $nick %c1 $+ You don't have any money to give.
      halt
    }
    var %giveamount = $3
    if (!$3) {
      notice $nick %c1 $+ Please use $+ %c4 !givecash <nick> <amount>
      halt
    }
    if ($nick == $2) {
      notice $nick %c1 $+ You can't give money to yourself.
      halt
    }
    if (%giveamount > %dmmoney. [ $+ [ $nick ] ]) {
      notice $nick %c1 $+ You can't give away $+ %c3 %giveamount $+ %c1 coins, if you have only $+ %c4 %dmmoney. [ $+ [ $nick ] ] $+ %c1 coins. 
      halt
    }
    if ($2 ison $chan) {
      dec %dmmoney. [ $+ [ $nick ] ] %giveamount
      inc %dmmoney. [ $+ [ $2 ] ] %giveamount
      notice $2 %c2 $+ $nick $+ %c1 has given you $+ %c3 %giveamount $+ %c1 coins.
      msg $chan %c2 $+ $nick $+ %c1 hands over $+ %c3 %giveamount $+ %c1 coins to $+ %c2 $2 $+ %c1 $+ .
    }
    else {
      notice $nick %c2 $+ $2 $+ %c1 isn't on $+ %c5 $chan $+ %c1 $+ .
    }
  }
  else {
    notice $nick %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ .
  }


}

;########################################################################
;#####################---ALIASES --- ALIASES ---#########################
;########################################################################

;####################### DEATHMATCH HIGHSCORES #########################
alias dmhighscores {
  if (win isin $2-) {
    if (%nowinview. [ $+ [ $1 ] ]) {
      notice $1 %c1 $+ Please wait $+ %c4 $timer(wins $+ $1).secs $+ %c1 seconds before using this command again.
      halt
    }
    set %nowinview. [ $+ [ $1 ] ] 1
    timerwins [ $+ [ $1 ] ] 1 180 unset %nowinview. [ $+ [ $1 ] ]
    msg $1 %c3 $+ The top 10 winners:
    set %playline. [ $+ [ $1 ] ] 1
    while (%playline. [ $+ [ $1 ] ] <= 10) {
      msg $1 $+(%c5,%playline. [ $+ [ $1 ] ],.) %c2 $+ $gettok($read(dmwins.txt, %playline. [ $+ [ $1 ] ]),1,32) $+ %c4 $gettok($read(dmwins.txt, %playline. [ $+ [ $1 ] ]),2,32)
      inc %playline. [ $+ [ $1 ] ]
    }
  }
  elseif (los isin $2-) {
    if (%noloseview. [ $+ [ $1 ] ]) {
      notice $1 %c1 $+ Please wait $+ %c4 $timer(loses $+ $1).secs $+ %c1 seconds before using this command again.
      halt
    }
    set %noloseview. [ $+ [ $1 ] ] 1
    timerloses [ $+ [ $1 ] ] 1 180 unset %noloseview. [ $+ [ $1 ] ]
    msg $1 %c3 $+ The top 10 losers:
    set %playline2. [ $+ [ $1 ] ] 1
    while (%playline2. [ $+ [ $1 ] ] <= 10) {
      msg $1 $+(%c5,%playline2. [ $+ [ $1 ] ],.) %c2 $+ $gettok($read(dmloses.txt, %playline2. [ $+ [ $1 ] ]),1,32) $+ %c4 $gettok($read(dmloses.txt, %playline2. [ $+ [ $1 ] ]),2,32)
      inc %playline2. [ $+ [ $1 ] ]
    }
  }
  else {
    notice $nick %c1 $+ Please choose if you want to see the $+ %c3 top 10 $+ %c4 wins $+ %c1 or $+ %c4 loses $+ %c1 $+ .
  }

}

;################# NOT ACCEPTED WITHIN 30 SECONDS / INV PLAY ############
alias dmplayway {
  msg $replace($1-,=,: $+ %c2 $+ $chr(32),_,$chr(32))
  set %playnick $pnick
  timer -m 1 500 inc %dmslots. [ $+ [ %playnick ] ]
  if (%dmplaymsg. [ $+ [ %playnick ] ]) {
    timer -m 1 6000 dmplayway2 %playnick
    timer -m 1 10000 dmcheckslots
    unset %dmplaymsg. [ $+ [ %playnick ] ]
  }
}

alias -l dmplayway2 {
  msg $1 %c1 $+ Currently, you have used $+ %c4 %dmslots. [ $+ [ $1 ] ] $+ %c1 / $+ %c4 10 $+ %c1 inventory slots.
  set %dminv. [ $+ [ $1 ] ] %dmslots. [ $+ [ $1 ] ]
} 

alias -l dmcheckslots {
  set %dminv. [ $+ [ $1 ] ] %dmslots. [ $+ [ $1 ] ]
}
alias -l tooSlow {
  msg %dm.chan %c1 $+ Nobody accepted $+ %c2 %dm.player1 $+ 's $+ %c1 challenge within $+ %c4 30 $+ %c1 seconds. Challenge timed out.
  unset %dm.player*
  unset %dm.status*
  unset %dm.chan
}

alias play2file {
  write invnick.txt $replace($3-,=,$chr(32))
}



;######################### SET THE ITEMS YOU CAN USE ####################
alias setDMShop {
  write -c dmshopitems.txt

  ; +++ NAME@PRICE +++
  write dmshopitems.txt Small_health_potion@10@hpot@20
  write dmshopitems.txt Normal_health_potion@30@hpot@50
  write dmshopitems.txt Large_health_potion@70@hpot@80
  write dmshopitems.txt Giant_health_potion@150@hpot@150
  write dmshopitems.txt Incredible_fantastic_Uber_health_potion@1000@hpot@800
  write dmshopitems.txt Anti_potion@100@apot
  write dmshopitems.txt Special_attack_potion@200@ppot
  write dmshopitems.txt Mage_potion@200@mpot
  write dmshopitems.txt Strength_potion@200@spot
  write dmshopitems.txt Ranged_potion@200@rpot
  write dmshopitems.txt Defence_potion@200@dpot

  ; +++ NAME@PRICE@CLASS@MAX HIT@STR REQ +++
  write dmshopitems.txt Dagger@50@melee@10@1
  write dmshopitems.txt Sword@100@melee@15@1
  write dmshopitems.txt Battle_axe@200@melee@25@5
  write dmshopitems.txt Home_made_sword@250@melee@50@10
  write dmshopitems.txt Scimitar@2000@melee@50@15
  write dmshopitems.txt Duel_handed_battle_axes@5000@melee@200@25
  write dmshopitems.txt Godsword@25000@melee@550@40

  ; +++ NAME@PRICE@CLASS@AMOUNNT ARROW
  write dmshopitems.txt Bow@50@range@1
  write dmshopitems.txt Large_bow@500@range@1
  write dmshopitems.txt Great_bow@3000@range@1
  write dmshopitems.txt Ultimate_bow@15000@range@1
  write dmshopitems.txt Triple_arrowed_bow@35000@range@3

  ; +++ NAME@PRICE@CLASS@HIT INCREASE IN % +++
  write dmshopitems.txt Newbie_magic_staff@100@mage@-20
  write dmshopitems.txt Beginner_magic_staff@1000@mage@-10
  write dmshopitems.txt Magic_staff@2000@mage@0
  write dmshopitems.txt Advanced_magic_staff@7000@mage@10
  write dmshopitems.txt Ultimate_magic_staff@15000@mage@20
  write dmshopitems.txt Two_Duel_handed_magic_wands@35000@mage@50

  ; +++ NAME@PRICE@SORT SPELL@STAFF REQ@MAX HIT/HEALTH RECOVER +++
  write dmshopitems.txt Blizz@50@aspell@newbie_magic_staff@20
  write dmshopitems.txt Blizztering_cold@75@aspell@newbie_magic_staff@25
  write dmshopitems.txt Fire_fury@100@aspell@beginner_magic_staff@50
  write dmshopitems.txt Blizztering_freeze@400@aspell@magic_staff@70@freeze
  write dmshopitems.txt Venquence_fury@500@aspell@magic_staff@100
  write dmshopitems.txt Health_cast@2000@hspell@advanced_magic_staff@30
  write dmshopitems.txt Life_cast@4500@hspell@ultimate_magic_staff@60
  write dmshopitems.txt Teleport@5000@tspell@ultimate_magic_staff@
  write dmshopitems.txt Avada_kadavra@10000@aspell@two_duel_handed_magic_wands@700

  ; +++ NAME@PRICE@ARROW@BOW REQ@MAX HIT@POISON? +++
  write dmshopitems.txt Weak_arrow@1@arrow@bow@10
  write dmshopitems.txt Normal_arrow@2@arrow@bow@40
  write dmshopitems.txt powerful_arrow@2@arrow@large_bow@75
  write dmshopitems.txt powerful_arrow_(P)@5@arrow@great_bow@100@P
  write dmshopitems.txt Diamond_arrow@10@arrow@ultimate_bow@150
  write dmshopitems.txt Diamond_arrow_(P+)@15@arrow@ultimate_bow@200@P+
  write dmshopitems.txt Cursed_arrow@30@arrow@ultimate_bow@450@P++
}

;###################### SWITCH TURN / END FIGHT IF TOO SLOW #######################
alias -l turngone {
  dm.poison
  msg %dm.chan %c1 $+ Turn goes to $+ %c2 %dm.player2 $+ %c1 $+ ; $+ %c2 %dm.player1 $+ %c1 hasn't attacked or used a potion/spell within $+ %c3 1 minute $+ %c1 $+ .
  timerstopdm 1 60 turngone2 
  var %dm.player3 = %dm.player1
  set %dm.player1 %dm.player2
  set %dm.player2 %dm.player3
}
alias -l turngone2 {
  msg %dm.chan %c2 $+ %dm.player1 $+ %c1 nor $+ %c2 %dm.player2 %c1 $+ has attacked or used a potion/spell within $+ %c3 2 minutes $+ %c1 $+ ; DeathMatch halted.
  enddm
}

;##################### TAKES CARE OF HEALTH PLAYERS ###########################
alias -l health.check {
  dm.poison
  if (%defpotuse. [ $+ [ %dm.player2 ] ] > 0) {
    dec %defpotuse. [ $+ [ %dm.player2 ] ]
    set %dm.hit $gettok($calc(%dm.hit * 0.9),1,46)
    set %dm.totalhit $gettok($calc(%dm.totalhit * 0.9),1,46)
    set %dm.totalhit $gettok(%dm.totalhit,1,46)
    set %dm.hit $gettok(%dm.hit,1,46)
    timer 1 1 notice %dm.player2 %c1 $+ Your $+ %c3 defence potion $+ %c1 will be active for $+ %c5 %defpotuse. [ $+ [ %dm.player2 ] ] $+ %c1 more rounds.
  }
  set %dm.totalhit $gettok(%dm.totalhit,1,46)
  set %dm.hit $gettok(%dm.hit,1,46)
  if (%cloneamount) {
    if (%dm.totalhit > %dmhealth. [ $+ [ %dm.player2 ] ]) {
      set %dm.totalhit %dmhealth. [ $+ [ %dm.player2 ] ]
    }
    dec %dmhealth. [ $+ [ %dm.player2 ] ] %dm.totalhit
    msg %dm.chan %c2 $+ %dm.player1 $+ %c1 has hit, with $+ %c6 %cloneamount $+ %c1 sword $+ $iif(%cloneamount > 1,s $+), a total of $+ %c3 $gettok(%dm.totalhit,1,46) $+ %c1 on $+ %c2 %dm.player2 $+ %c1 using %dmweapused
    msg %dm.chan %c2 $+ %dm.player2 $+ %c1 has $+ %c4 %dmhealth. [ $+ [ %dm.player2 ] ] $+ %c1 hitpoints left!     
    unset %cloneamount
    unset %dm.hit*
    unset %dm.totalhit
    return
  }
  if (%arrows.shot == 3) {
    unset %arrows.shot
    if (%dm.totalhit > %dmhealth. [ $+ [ %dm.player2 ] ]) {
      set %dm.totalhit %dmhealth. [ $+ [ %dm.player1 ] ]
    }
    dec %dmhealth. [ $+ [ %dm.player2 ] ] %dm.totalhit
    msg %dm.chan %c2 $+ %dm.player1 $+ %c1 has hit, with $+ %c6 3 $+ %c1 arrows, a total of $+ %c3 $gettok(%dm.totalhit,1,46) $+ %c1 on $+ %c2 %dm.player2 $+ %c1 using %dmweapused
  }
  else {
    if (%dm.hit > %dmhealth. [ $+ [ %dm.player2 ] ]) { 
      set %dm.hit %dmhealth. [ $+ [ %dm.player2 ] ] 
    }
    msg %dm.chan %c2 $+ %dm.player1 $+ %c1 has hit $+ %c3 %dm.hit $+ %c1 on $+ %c2 %dm.player2 $+ %c1 using %dmweapused
    dec %dmhealth. [ $+ [ %dm.player2 ] ] %dm.hit
  }
  if (!%dm.totalhit) .set %dm.totalhit %dm.hit
  if (%cantbehit. [ $+ [ %dm.player2 ] ]) {
    set %dm.hit %dm.totalhit
    inc %dmhealth. [ $+ [ %dm.player2 ] ] %dm.hit
    unset %cantbehit. [ $+ [ %dm.player2 ] ]
    msg %dm.chan %c2 $+ %dm.player2 $+ s $+ %c3 Incredible fantastic Uber health potion $+ %c1 heals him with $+ %c4 %dm.hit $+ %c1 hitpoints inmediatly. 
  }
  if (%addpoison) {
    msg %dm.chan %c2 $+ %dm.player2 $+ %c1 is poisoned with $+ %c6 %dm.poisondmg $+ %c1 poison damage each turn!
    set %dmpoisoned. [ $+ [ %dm.player2 ] ] %dm.poisondmg
    unset %addpoison
  }
  if  (%dmhealth. [ $+ [ %dm.player2 ] ] <= 0) { 
    msg %dm.chan %c2 $+ %dm.player2 $+ %c1 has been defeated! $+ %c2 %dm.player1 $+ %c1 gets $+ %c3 $calc(%dmlvl. [ $+ [ %dm.player1 ] ] * 15) $+ %c1 bonus expoints for this fight! 
    set %winfight 1
    inc %dmloses. [ $+ [ %dm.player2 ] ] 
    inc %dmwins. [ $+ [ %dm.player1 ] ]
    update.score
    write -c invnick.txt
    play -sat $+ %dm.player2 play2file dminv.ini 0
    timer 1 2 dmdrops
    timer 1 1 notice %dm.player1 %c1 $+ You gained $+ %c6 $gettok($calc(%dm.hit / 2 + 1),1,46) $+ %c1 XP.
    inc %dm.xp. [ $+ [ %dm.player1 ] ] $gettok($calc(%dm.hit / 2 + 1),1,46)
    xp.check 
    return
  }
  msg %dm.chan %c2 $+ %dm.player2 $+ %c1 has $+ %c4 %dmhealth. [ $+ [ %dm.player2 ] ] $+ %c1 hitpoints left! 
  if (%dm.totalhit) .set %dm.hit %dm.totalhit
  unset %dm.totalhit
}

;################################## POISON STUFF ###################################
alias -l dm.poison {
  if (%dmpoisoned. [ $+ [ %dm.player1 ] ]) {
    if (%dmpoisoned. [ $+ [ %dm.player1 ] ] > %dmhealth. [ $+ [ %dm.player1 ] ]) { 
      timerfreeze off
      set %dmpoisoned. [ $+ [ %dm.player1 ] ] %dmhealth. [ $+ [ %dm.player1 ] ]
      dec %dmhealth. [ $+ [ %dm.player1 ] ] %dmpoisoned. [ $+ [ %dm.player1 ] ]
      var %dm.player3 = %dm.player1
      set %dm.player1 %dm.player2
      set %dm.player2 %dm.player3 
      msg %dm.chan %c2 $+ %dm.player2 $+ %c1 gets $+ %c6 %dmpoisoned. [ $+ [ %dm.player2 ] ] $+ %c1 damage from poison. He now has $+ %c4 %dmhealth. [ $+ [ %dm.player2 ] ] $+ %c1 hitpoints left.
      msg %dm.chan %c2 $+ %dm.player2 $+ %c1 has died because of poison! $+ %c2 %dm.player1 $+ %c1 gets $+ %c3 $calc(%dmlvl. [ $+ [ %dm.player1 ] ] * 15) $+ %c1 bonus expoints for this fight! 
      inc %dmloses. [ $+ [ %dm.player2 ] ] 
      inc %dmwins. [ $+ [ %dm.player1 ] ]
      update.score
      write -c invnick.txt
      play -sat $+ %dm.player2 play2file dminv.ini 0
      timer 1 2 dmdrops
      halt

    }
    else {
      dec %dmhealth. [ $+ [ %dm.player1 ] ] %dmpoisoned. [ $+ [ %dm.player1 ] ]
      msg %dm.chan %c2 $+ %dm.player1 $+ %c1 gets $+ %c6 %dmpoisoned. [ $+ [ %dm.player1 ] ] $+ %c1 damage from poison. He now has $+ %c4 %dmhealth. [ $+ [ %dm.player1 ] ] $+ %c1 hitpoints left.
    }
  }
}


;######################### TAKES CARE OF EXP PLAYERS (IN DM) ###############################
alias -l xp.check { 
  if (%winfight) .inc %dm.xp. [ $+ [ %dm.player1 ] ] $calc(%dmlvl. [ $+ [ %dm.player1 ] ] * 15)
  if (%dmlvl. [ $+ [ %dm.player1 ] ] == 1 ) { 
    set %dm.lvl.req. [ $+ [ %dm.player1 ] ] 100 
  } 
  else { 
    set %dm.lvl.req. [ $+ [ %dm.player1 ] ] $calc(%dmlvl. [ $+ [ $nick ] ] ^ 3 * 0.6 + %dmlvl. [ $+ [ $nick ] ] * 100)) 
  }
  lvl.check
}

;######################### TAKES CARE OF LVLS PLAYERS (IN DM) ##############################
alias -l lvl.check {
  if (%dm.xp. [ $+ [ %dm.player1 ] ] >= %dm.lvl.req. [ $+ [ %dm.player1 ] ]) {  
    inc %dmlvl. [ $+ [ %dm.player1 ] ] 
    msg %dm.chan %c6 $+ Congratulations! $+ %c2 %dm.player1 $+ %c6 just leveled up! He now is level $+ %c5 %dmlvl. [ $+ [ %dm.player1 ] ] $+ %c6 $+ ! 
    notice %dm.player1 %c1 $+ From now on, you'll have $+ %c4 $gettok($calc(%dmlvl. [ $+ [ %dm.player1 ] ]  ^1.2 * 30 + 80),1,46) $+ %c1 hitpoints.
  }
}

;######################### TAKES CARE OF THE DROPS #################################
alias -l dmdrops {
  var %dm.player3 = %dm.player1
  set %dm.player1 %dm.player2
  set %dm.player2 %dm.player3
  set %otheritem $read(invnick.txt)
  set %oitemname2 $gettok($gettok(%otheritem,1,64),1,32)
  set %oitemname $replace(%oitemname2,_,$chr(32))
  set %oitemamount $gettok(%otheritem,2,32)
  set %getmoney $calc(%dmlvl. [ $+ [ %dm.player1 ] ] * 10 + %dmlvl. [ $+ [ %dm.player2 ] ] * 100)
  if (%dmweapon. [ $+ [ %dm.player2 ] ]) .set %getweapon %dmweapon. [ $+ [ %dm.player2 ] ]
  if (%dmarrow. [ $+ [ %dm.player2 ] ]) .set %getarrow %dmarrow. [ $+ [ %dm.player2 ] ]
  inc %dmmoney. [ $+ [ %dm.player1 ] ] %getmoney
  if (!%getitems) {
    if (!$readini(dminv.ini,%dm.player1,$replace(%getweapon,$chr(32),_))) .inc %dminv. [ $+ [ %dm.player1 ] ]
    if (%getweapon) {
      writeini dminv.ini %dm.player1 $replace(%getweapon,$chr(32),_) $calc($readini(dminv.ini,%dm.player1,$replace(%getweapon,$chr(32),_)) + 1)
    }
    if (%getarrow) { 
      writeini dminv.ini %dm.player1 $gettok($replace(%getarrow,$chr(32),_),1,64) $calc($readini(dminv.ini,%dm.player1,$gettok($replace(%getarrow,$chr(32),_),1,64)) + %dmarrow.amount. [ $+ [ %dm.player1 ] ])
    }
    if (!$readini(dminv.ini,%dm.player1,%oitemname2)) { inc %dminv. [ $+ [ %dm.player1 ] ] }
    if (%oitemname2) {     
      writeini dminv.ini %dm.player1 %oitemname2 $calc($readini(dminv.ini,%dm.player1,%oitemname2) + %oitemamount)
    }
  }
  else {
    timer 1 1 notice %dm.player2 %c1 $+ Because $+ %c2 %dm.player2 $+ s $+ %c1 inventory is full, he didn't get any items, although, you did lose: $iif(%getarrow, $+ %c2 Your $+ 's $+ %c1 equipped arrows: $+ %c3 %dmarrow.amount. [ $+ [ %dm.player2 ] ] $+ %c4 $gettok(%getarrow,1,64) $+ s $+ %c1 -) $iif(%getweapon, $+ %c2 Your $+ 's $+ %c1 weapon: $+ %c3 1 $+ %c4 $gettok(%getweapon,1,64) $+ %c1 -) $iif(%oitemname, everything from a random slot from $+ %c2 your $+ 's $+ %c1 inventory: $+ %c3 %oitemamount $+ %c4 %oitemname $+ $iif($right(%oitemname,1) != s && %oitemamount > 1, s) $+ %c1 $+) $+ .
  }
  msg %dm.chan %c2 $+ %dm.player1 $+ %c1 gets the following as a $+ %c6 reward $+ %c1 $+ : $iif(%getarrow, $+ %c2 %dm.player2 $+ 's $+ %c1 equipped arrows: $+ %c3 %dmarrow.amount. [ $+ [ %dm.player2 ] ] $+ %c4 $gettok(%getarrow,1,64) $+ s $+ %c1 -) $iif(%getweapon, $+ %c2 %dm.player2 $+ 's $+ %c1 weapon: $+ %c3 1 $+ %c4 $gettok(%getweapon,1,64) $+ %c1 -) $iif(%oitemname, everything from a random slot from $+ %c2 %dm.player2 $+ 's $+ %c1 inventory: $+ %c3 %oitemamount $+ %c4 %oitemname $+ $iif($right(%oitemname,1) != s && %oitemamount > 1, s) $+ %c1 $+ $chr(44) and) $+ %c4 %getmoney $+ %c1 coins (not from $+ %c2 %dm.player2 $+ %c1 $+ ).
  remini dminv.ini %dm.player2 %oitemname2
  dec %dminv. [ $+ [ %dm.player2 ] ]   
  unset %dmweapon. [ $+ [ %dm.player2 ] ]
  unset %dmarrow. [ $+ [ %dm.player2 ] ]
  unset %dmarrow.amount. [ $+ [ %dm.player2 ] ]
  unset %getarrow
  unset %getmoney
  unset %getweapon
  unset %oitem*
  timer -m 1 1500 %c2 $+ %dm.player1 $+ %c1 now has $+ %c3 %dmwins. [ $+ [ %dm.player1 ] ] $+ %c4 wins $+ %c1 - $+ %c3 %dmloses. [ $+ [ %dm.player1 ] ] $+ %c4 loses $+ %c1 and $+ %c2 %dm.player2 $+ %c1 now has $+ %c3 %dmwins. [ $+ [ %dm.player2 ] ] $+ %c4 wins $+ %c1 - $+ %c3 %dmloses. [ $+ [ %dm.player2 ] ] $+ %c4 loses $+ %c1 $+ .
  timer -m 1 1500 enddm
}

;###################### WRITES SCORE IN FILE DMSCORE.TXT ############################
alias -l update.score {
  var %nicksscore = $read(dmwins.txt, w, * $+ %dm.player1 $+ *)
  if (%nicksscore) {
    write -l $+ $readn dmwins.txt %dm.player1 %dmwins. [ $+ [ %dm.player1 ] ]
  }
  else {
    write dmwins.txt %dm.player1 %dmwins. [ $+ [ %dm.player1 ] ]
  }
  var %nicksscore2 = $read(dmloses.txt, w, * $+ %dm.player1 $+ *)
  if (%nicksscore2) {
    write -l $+ $readn dmloses.txt %dm.player1 %dmloses. [ $+ [ %dm.player1 ] ]
  }
  else {
    write dmloses.txt %dm.player1 %dmloses. [ $+ [ %dm.player1 ] ]
  }
  unset %nicksscore*
  var %nicksscore = $read(dmwins.txt, w, * $+ %dm.player2 $+ *)
  if (%nicksscore) {
    write -l $+ $readn dmwins.txt %dm.player2 %dmwins. [ $+ [ %dm.player2 ] ]
  }
  else {
    write dmwins.txt %dm.player2 %dmwins. [ $+ [ %dm.player2 ] ]
  }
  var %nicksscore2 = $read(dmloses.txt, w, * $+ %dm.player2 $+ *)
  if (%nicksscore2) {
    write -l $+ $readn dmloses.txt %dm.player2 %dmloses. [ $+ [ %dm.player2 ] ]
  }
  else {
    write dmloses.txt %dm.player2 %dmloses. [ $+ [ %dm.player2 ] ]
  }
  filter -ceut 2 32 dmwins.txt dmwins.txt
  filter -ceut 2 32 dmloses.txt dmloses.txt
}

;######################### UNSETS THE DM VARS (STOP DM) #############################
alias enddm {
  timerturnswitch off
  timerstopdm off
  if (!%nodevoice1 && !%nodevoice2) { timer 1 2 mode %dm.chan -mvv %dm.player1 %dm.player2 }
  if (!%nodevoice1 && %nodevoice2) { timer 1 2 mode %dm.chan -mv %dm.player1 }
  if (%nodevoice1 && !%nodevoice2) { timer 1 2 mode %dm.chan -mv %dm.player2 }
  if (%nodevoice1 && %nodevoice2) { timer 1 2 mode %dm.chan -m }
  unset %nodevoice*
  unset %dm.player*
  unset %dm.status
  unset %winfight
  unset %dmpoison*
  unset %dmfreeze*
  unset %dm*potuse*
  unset %cantbehit*
  unset %diddecspell
  unset %dm.chan
}

;#############################################
;####   LIST OF ALL DEATHMATCH COMMANDS   #### 
;####      MADE BY Supamagier & cnb6      ####
;#############################################

alias -l dmcommandslist {
  if ($network != TundraIRC) {
    notice $1 %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmid. [ $+ [ $1 ] ] == 1) {

    ;########################### SPECIAL ATTACK-COMMANDS ########################
    if (*sp*c* iswm $2-) {
      if (%nospecsview. [ $+ [ $1 ] ]) {
        notice $1 %c1 $+ Please wait $+ %c6 $timer($1 $+ specs).secs %c1 $+ seconds before using this command again.
        halt
      }
      set %nospecsview. [ $+ [ $1 ] ] 1
      timer [ $+ [ $1 $+ specs ] ] 1 180 unset %nospecsview. [ $+ [ $1 ] ] 
      msg $1 %c5 $+ Sword of Ice $+ %c1 $+ : Makes your opponents weapon so cold, that there's a chance of $+ %c3 35% $+ %c1 his weapon breaks, because of the cold.
      msg $1 %c5 $+ Sword of Fire $+ %c1 $+ : Makes your opponents weapon so hot, that he can't use it for $+ %c3 2 $+ %c1 turns.
      msg $1 %c5 $+ Diamond Sword $+ %c1 $+ : Turns your sword into a diamond sword; your max hit increases by $+ %c3 30% $+ %c1 and you have a chance of $+ %c3 10% $+ %c1 a piece of diamond falls from your sword, which gives you $+ %c4 100 - 10000 $+ %c1  coins.
      msg $1 %c5 $+ Rampage Sword $+ %c1 $+ : This special attack increases your max hit by $+ %c3 100% $+ %c1 $+ . However, there's $+ %c3 10% $+ %c1 chance your sword breaks.
      msg $1 %c5 $+ Clone Sword $+ %c1 $+ : Decreases your max hit with $+ %c3 50% $+ %c1 $+ , but when you attack, you attack with $+ %c4 1 - 7 $+ %c1 swords (this means your max hit varies from $+ %c3 50% - 300% $+ %c1 $+ ) at the same time.
      msg $1 %c5 $+ Sword of Life $+ %c1 $+ : Heals you with $+ %c3 80% $+ %c1 of your hit.
    }
  }

  ;############################ NEXT COMMANDS #################################
  elseif (* iswm $2-) {

  }

  else {
    notice $1 %c1 $+ You need to identify first! Type $+ %c3 /msg $me !id(entify) yourpass $+ %c1 $+ 
  }
}


;########################################################
;################ TO BE USED LATER ######################
;########################################################

[none]nothing[/none]


;##############################################################
;###################### BACK UPS ##############################
;##############################################################

; +++ MAYBE IN SCRIPT 'INVENTORY' +++
You used: $+ %c1 ( $+ %c4 %dminv. [ $+ [ $nick ] ] $+ %c6 / $+ %c4 10 $+ %c1 items ) $+ %c3 $+ 

; +++ MAYBE IN ALIAS 'TURNGONE' +++
;if (%dmhealth. [ $+ [ %dm.player1 ] ] <= 0 || %dmhealth. [ $+ [ %dm.player2 ] ] <= 0) { halt }

; +++ MAYBE IN SCRIPT 'RANGE ATTACK' +++
if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
  dec %rangepotuse. [ $+ [ $nick ] ]
  set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
  timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
}

;+++ CHANGE CHANNELS +++
if (%dm.chan2) {
  var %dm.chan3 = %dm.chan2
  set %dm.chan2 %dm.chan
  set %dm.chan %dm.chan3
}
if (!%dm.chan2) .set %dm.chan #DM
if (!%dm.chan) .set %dm.chan #DM-tournaments






































;############################### STARTING A TOURNAMENT #################################
on $*:TEXT:/^[@.`!](tour((n)?(y|ament)?))/Si:#DM-tournaments, #DM, #DM-shop, #DM-bank: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if (%dmnick. [ $+ [ $nick ] ] == 1) {
    if (%dmid. [ $+ [ $nick ] ] == 1) { 
      if ($chan != #DM-tournaments) {
        notice $nick %c1 $+ You only can do this in $+ %c2 #DM-tournaments $+ %c1 .
        halt
      }
      if (%dm.tournament == on) { 
        notice $nick %c1 $+ There is already a $+ %c5 tournament $+ %c1 running, please wait.
        halt
      }
      if (!$2 || !$3 || $3 < 100 || $3 !isnum) { 
        if (%dm.tournament == on) {
          halt
        }   
        notice $nick %c1 $+ Please type this: $+ %c3 !tournament <people to join> <stake (at least 100)>
        halt 
      }

      if ($2 != 4 && $2 != 8 && $2 != 16) { 
        notice $nick %c1 $+ Please choose $+ %c4 4 $+ %c1 $+ , $+ %c4 8 $+ %c1 or $+ %c4 16 $+ %c1 people to join!   
        HALT
      }
      if (%dmmoney. [ $+ [ $nick ] ] < $3) {
        notice $nick %c1 $+ You can't stake $+ %c3 $3 $+ %c1 coins, if you only have $+ %c4 %dmmoney. [ $+ [ $nick ] ] $+ %c1 coins.
        halt
      }
      set %dm.tournicks $nick
      set %dm.chan2 #DM-tournaments
      set %dm.tournament On
      set %dm.tournament.starter $nick     
      set %dm.tournament.player.1 $nick    
      set %dm.tournamentppl 1
      set %dm.tournament.stake $3 
      set %dm.tournament.prize $3
      set %dm.tournament.people $2
      msg $chan %c2 $+ $nick $+ %c1 started a tournament. Stake: $+ %c3 %dm.tournament.stake $+ %c1 coins. Type $+ %c3 !join-tournament $+ %c1 to join it!    
      timerchallenge2 1 120 tooSlowTour
    }
    else { 
      notice $nick %c1 $+ You need to identify first! Type $+ %c3 !id(entify) yourpass $+ %c1 in my PM. 
    } 
  }
  else { 
    notice $nick %c1 $+ You need to register first. Type %c5 $+ `dm-register $+ %c1 first and follow the instructions. 
  }
}

;###################################### JOINING A TOURNAMENT #########################################
on $*:TEXT:/^[!@`.](j(oin)?(-| )?tour(n|nam(ent)?|ny)?)/Si:#DM-tournaments, #DM, #DM-shop, #DM-bank: {
  if ($network != TundraIRC) {
    notice $nick %c1 $+ You only can do this on the great $+ %c3 TundraIRC network $+ %c1 $+ , Type $+ %c6 /server irc.TundraIRC.net $+ %c1 to get there.
    halt
  }
  if ($chan != #DM-tournaments) {
    notice $nick %c1 $+ You only can do this in $+ %c2 #DM-tournaments $+ %c1 .
    halt
  }


  if (%dmnick. [ $+ [ $nick ] ] == 1) {
    if (%dmid. [ $+ [ $nick ] ] == 1) { 
      if (%dm.tournament != on) {
        notice $nick %c1 $+ There's no tournament running. Type $+ %c3 !tournament <people to join> <stake (at least 100)> $+ %c1 to start one.
        halt
      }
      if ($nick isin %dm.tournicks) {
        notice $nick %c1 $+ You're already in the tournament, please wait until it starts.
        halt
      }
      if ($calc(%dmmoney. [ $+ [ $nick ] ] - %dm.tournament.stake) < 0) {
        if (!%dmmoney. [ $+ [ $nick ] ]) .set %dmmoney. [ $+ [ $nick ] ] 0
        notice $nick %c1 $+ Insufficient money. You need $+ %c3 %dm.tournament.stake $+ %c1 coins, while you have only $+ %c3 %dmmoney. [ $+ [ $nick ] ] $+ %c1 coins.
        halt
      }
      if (%dm.tournament.needppl == 0) {
        notice $nick %c1 $+ The tournament is full, please wait until the next starts.
        halt
      }
      if (%dm.tournamentwins. [ $+ [ $nick ] ] == $null) { .set %dm.tournamentwins. [ $+ [ $nick ] ] 0 }
      inc %dm.tournament.prize %dm.tournament.stake
      inc %dm.tournamentppl 1 
      set %dm.tournicks %dm.tournicks $nick
      dec %dmmoney. [ $+ [ $nick ] ] %dm.tournament.stake
      if (%dm.tournamentppl == 2) {
        Set %dm.tournament.player.2 $nick
      }
      if (%dm.tournamentppl == 3) {
        Set %dm.tournament.player.3 $nick
      }
      if (%dm.tournamentppl == 4) {
        Set %dm.tournament.player.4 $nick
      }
      if (%dm.tournamentppl == 5) {
        Set %dm.tournament.player.5 $nick
      }
      if (%dm.tournamentppl == 6) {
        Set %dm.tournament.player.6 $nick
      }
      if (%dm.tournamentppl == 7) {
        Set %dm.tournament.player.7 $nick
      }
      if (%dm.tournamentppl == 8) {
        Set %dm.tournament.player.8 $nick
      }
      if (%dm.tournamentppl == 9) {
        Set %dm.tournament.player.9 $nick
      }
      if (%dm.tournamentppl == 10) {
        Set %dm.tournament.player.10 $nick
      }
      if (%dm.tournamentppl == 11) {
        Set %dm.tournament.player.11 $nick
      }
      if (%dm.tournamentppl == 12) {
        Set %dm.tournament.player.12 $nick
      }
      if (%dm.tournamentppl == 13) {
        Set %dm.tournament.player.13 $nick
      }
      if (%dm.tournamentppl == 14) {
        Set %dm.tournament.player.14 $nick
      }
      if (%dm.tournamentppl == 15) {
        Set %dm.tournament.player.15 $nick
      }
      if (%dm.tournamentppl == 16) {
        Set %dm.tournament.player.16 $nick
      }
      set %dm.tournament.needppl $calc(%dm.tournament.people - %dm.tournamentppl)
      msg $chan %c2 $+ $nick $+ %c1 joined the tournament, we need $+ %c3 %dm.tournament.needppl $+ %c1 people more.
      if (%dm.tournament.needppl == 0) {
        msg $chan %c4 $+ The tournament is starting! $+ %c5 Have fun!
        fight1
      }
    } 
    else { 
      notice $nick %c1 $+ You need to identify first! Type $+ %c3 !id(entify) yourpass $+ %c1 in my PM. 
    } 
  }
  else { 
    notice $nick %c1 $+ You need to register first. Type %c5 $+ `dm-register $+ %c1 first and follow the instructions. 
  }
}

;########################## CHECK WHO FIGHTS NEXT #######################
alias -l nextround {
  health.start
  if (%dm.tournament.people == 8 && %fight == 1) {
    fight2
  }
  if (%dm.tournament.people == 8 && %fight == 2) {
    fight3
  }
  if (%dm.tournament.people == 8 && %fight == 3) {
    fight4
  }
  if (%dm.tournament.people == 8 && %fight == 4) {
    fight5.semi
  }
  if (%dm.tournament.people == 8 && %fight == 5) {
    fight6.semi
  }
  if (%dm.tournament.people == 8 && %fight == 6) {
    fight7.final
  }
  if (%dm.tournament.people == 8 && %fight == 7) {
    msg $chan %c2 $+ %dm.tournament.winner.7 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 $+ !
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.7 ] ]
    inc %dM.money. [ $+ [ %dm.tournament.winner.7 ] ]
  }
  if (%dm.tournament.people == 4 && %fight == 1) {
    fight2
  }
  if (%dm.tournament.people == 4 && %fight == 2) {
    fight3.final
  }
  if (%dm.tournament.people == 4 && %fight == 3) {
    msg $chan %c2 $+ %dm.tournament.winner.3 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 $+ !
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.3 ] ]
    inc %dm.money. [ $+ [ %dm.tournament.winner.3 ] ]
  }
  if (%dm.tournament.people == 16 && %fight == 1) {
    fight2
  }
  if (%dm.tournament.people == 16 && %fight == 2) {
    fight3
  }
  if (%dm.tournament.people == 16 && %fight == 3) {
    fight4
  }
  if (%dm.tournament.people == 16 && %fight == 4) {
    fight5
  }
  if (%dm.tournament.people == 16 && %fight == 5) {
    fight6
  }
  if (%dm.tournament.people == 16 && %fight == 6) {
    fight7
  }
  if (%dm.tournament.people == 16 && %fight == 7) {
    fight8
  }
  if (%dm.tournament.people == 16 && %fight == 8) {
    fight9.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 9) {
    fight10.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 10) {
    fight11.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 11) {
    fight12.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 12) {
    fight13.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 13) {
    fight14.kwart
  }
  if (%dm.tournament.people == 16 && %fight == 14) {
    fight15.final
  }
  if (%dm.tournament.people == 16 && %fight == 15) {
    msg $chan %c2 $+ %dm.tournament.winner.3 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 $+ !
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.15 ] ]
    inc %dM.money. [ $+ [ %dm.tournament.winner.15 ] ]
  }
}



;########################## NEXT FIGHT ALIASES ###########################
alias -l fight1 {
  set %dm.tplayer1 %dm.tournament.player.1
  set %dm.tplayer2 %dm.tournament.player.2
  msg %dm.chan2 %c1 $+ Now fighting in the first battle of this tournament: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 1
  return 
}
alias -l fight2 {
  set %dm.tplayer1 %dm.tournament.player.3
  set %dm.tplayer2 %dm.tournament.player.4
  msg %dm.chan2 %c1 $+ The 2 people that will now compeet are $+ %c2 %dm.tplayer1 %c4 $+ and $+ %c2 %dm.tplayer2 $+ %c4 $+ !
  start.health
  set %fight 2
  return 
}
alias -l fight3 {
  set %dm.tplayer1 %dm.tournament.player.5
  set %dm.tplayer2 %dm.tournament.player.6
  msg %dm.chan2 %c1 $+ This is already the $+ %c5 third fight $+ %c1 of this tournament, $+ %c2 %dm.tplayer1 $+ %c4 and $+ %c2 %dm.tplayer2 $+ %c1 will compeet.
  start.health
  set %fight 3
  return 
}
alias -l fight4 {
  set %dm.tplayer1 %dm.tournament.player.7
  set %dm.tplayer2 %dm.tournament.player.8
  msg %dm.chan2 %c1 $+ Now compeeting are $+ %c2 %dm.tplayer1 $+ %c4 and $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 4
  return 
}
alias -l fight5 {
  set %dm.tplayer1 %dm.tournament.player.9
  set %dm.tplayer2 %dm.tournament.player.10
  msg %dm.chan2 %c1 $+ The fight we're gonna see now is: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c1 %dm.tplayer2 $+ %c4 $+ !   
  start.health 
  set %fight 5
  return 
}
alias -l fight6 {
  set %dm.tplayer1 %dm.tournament.player.11
  set %dm.tplayer2 %dm.tournament.player.12
  msg %dm.chan2 %c1 $+ Next fight is between: $+ %c2 %dm.tplayer1 $+ %c4 and $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 6
  return 
}
alias -l fight7 {
  set %dm.tplayer1 %dm.tournament.player.13
  set %dm.tplayer2 %dm.tournament.player.14
  msg %dm.chan2 %c1 $+ What a fantastic fight this is gonna be! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health 
  set %fight 7
  return 
}
alias -l fight8 {
  set %dm.tplayer1 %dm.tournament.player.15
  set %dm.tplayer2 %dm.tournament.player.16
  msg %dm.chan2 %c1 $+ This is the last fight until the next rounds! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ ! 
  start.health 
  set %fight 8
  return 
}
alias fight5.semi {
  set %dm.tplayer1 %dm.tournament.winner.1
  set %dm.tplayer2 %dm.tournament.winner.2
  msg %dm.chan2 %c1 $+ It's now the semi finals! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 dm.player2 $+ %c4 $+ !    
  start.health
  set %fight 5 
  return 
}
alias fight6.semi {
  set %dm.tplayer1 %dm.tournament.winner.3
  set %dm.tplayer2 %dm.tournament.winner.4
  msg %dm.chan2 %c1 $+ They have come so far, but now one of them will have to die! %c2 $+ %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 6
  return  
}
alias fight7.final {
  set %dm.tplayer1 %dm.tournament.winner.5
  set %dm.tplayer2 %dm.tournament.winner.6
  msg %dm.chan2 %c1 $+ This is the one and only final! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 7 
  return 
}
alias fight3.final {
  set %dm.tplayer1 %dm.tournament.winner.1
  set %dm.tplayer2 %dm.tournament.winner.2
  msg %dm.chan2 %c1 $+ This is the one and only final! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !   
  start.health
  set %fight 3
  return
}
alias -l fight9.kwart {
  set %dm.tplayer1 %dm.tournament.winner.1
  set %dm.tplayer2 %dm.tournament.winner.2
  msg %dm.chan2 %c1 $+ Now fighting: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !
  start.health
  set %fight 9  
  return 
}
alias -l fight10.kwart {
  set %dm.tplayer1 %dm.tournament.winner.3
  set %dm.tplayer2 %dm.tournament.winner.4
  msg %dm.chan2 %c1 $+ Now fighting: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ ! 
  start.health
  set %fight 10  
  return 
}
alias -l fight11.kwart {
  set %dm.tplayer1 %dm.tournament.winner.5
  set %dm.tplayer2 %dm.tournament.winner.6
  msg %dm.chan2 %c1 $+ Now fighting: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ ! 
  start.health
  set %fight 11 
  return 
}
alias -l fight12.kwart {
  set %dm.tplayer1 %dm.tournament.winner.7
  set %dm.tplayer2 %dm.tournament.winner.8
  msg %dm.chan2 %c1 $+ Now fighting: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ ! 
  start.health
  set %fight 12 
  return
}
alias -l fight13.semi {
  set %dm.tplayer1 %dm.tournament.winner.9
  set %dm.tplayer2 %dm.tournament.winner.10
  msg %dm.chan2 %c1 $+ Now fighting: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !
  start.health
  set %fight 13  
  return
}
alias -l fight14.semi {
  set %dm.tplayer1 %dm.tournament.winner.11
  set %dm.tplayer2 %dm.tournament.winner.12
  msg %dm.chan2 %c1 $+ And last but not least: $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !
  start.health
  set %fight 14 
  return
}
alias -l fight15.final {
  set %dm.tplayer1 %dm.tournament.winner.13
  set %dm.tplayer2 %dm.tournament.winner.14
  msg %dm.chan2 %c1 $+ This is the one and only final! $+ %c2 %dm.tplayer1 $+ %c4 Vs. $+ %c2 %dm.tplayer2 $+ %c4 $+ !
  start.health
  set %fight 15
  return
}

alias -l start.health {
  if (!%dmlvl. [ $+ [ %dm.tplayer1 ] ]) .set %dmlvl. [ $+ [ %dm.tplayer1 ] ] 1
  if (!%dmlvl. [ $+ [ %dm.tplayer2 ] ]) .set %dmlvl. [ $+ [ %dm.tplayer2 ] ] 1
  set %dmhealth. [ $+ [ %dm.tplayer1 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ] ^1.2 * 30 + 80),1,46)
  set %dmhealth. [ $+ [ %dm.tplayer2 ] ] $gettok($calc(%dmlvl. [ $+ [ %dm.tplayer2 ] ] ^1.2 * 30 + 80),1,46)
  set %specuse. [ $+ [ %dm.tplayer1 ] ] 3
  set %specuse. [ $+ [ %dm.tplayer2 ] ] 3
  set %dmstarthealth. [ $+ [ %dm.tplayer1 ] ] %dmhealth. [ $+ [ %dm.tplayer1 ] ]
  set %dmstarthealth. [ $+ [ %dm.tplayer2 ] ] %dmhealth. [ $+ [ %dm.tplayer2 ] ]
  var %dm.begin = $r(1,2)
  timerchallenge2 off
  if (%dm.begin == 1) {
    set %dm.startnick %dm.tplayer1
  }
  if (%dm.begin == 2) {
    set %dm.startnick %dm.tplayer2
    var %dm.tplayer3 = %dm.tplayer1
    set %dm.tplayer1 %dm.tplayer2
    set %dm.tplayer2 %dm.tplayer3
  }
  msg %dm.chan2 %c2 $+ %dm.startnick $+ %c1 starts the game!
  notice %dm.tplayer1 %c1 $+ Fight started, you're fighting %c4 $+ %dm.tplayer2 $+ %c1 $+ , who has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer2 ] ] $+ %c1 hitpoints.
  notice %dm.tplayer2 %c1 $+ Fight started, you're fighting %c4 $+ %dm.tplayer1 $+ %c1 $+ , who has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer1 ] ] $+ %c1 hitpoints.
  timerturnswitch2 1 60 tooSlowTour
}













;######################## ATTACK - MELEE (TOURNAMENTS) ############################
on $*:text:/^[?!@`.](at(t)?(ack)?|hit)/Si:#DM-tournaments: {
  if (%dm.status == ON) {
    if ($nick == %dm.tplayer1) {
      if (%dmclass. [ $+ [ $nick ] ] != melee) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch2 off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.tplayer2 $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        halt
      }

      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ])  { 
        set %dm.hit $rand(0,5) 
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused his fist.
        health.check2
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        return
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != melee && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.tplayer1 ] ],$chr(32),_) $+ *),4,64)
        set %dm.hit $rand(0, %dm.max)
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
        if (home isin %dmweapon. [ $+ [ %dm.tplayer1 ] ] && $r(1,5) == 2) {
          timer 1 1 notice $nick %c1 $+ You broke your $+ %c3 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ , meaning you lost it.
          unset %dmweapon. [ $+ [ %dm.tplayer1 ] ]
        }
      } 
      health.check2
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 $nick
      timerturnswitch2 1 60 turngonetour
    }
    elseif ($nick == %dm.tplayer2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this Tournament. 
    }
  }
  else {
    notice $nick %c1 $+ There is no Tournament running! Type $+ %c6 !Tournament <players> <stake> $+ %c1 to start one.
  }
}

;################### ATTACK - SPECIALS (MELEE ONLY) (TOURNAMENTS) #################
on $*:text:/^[!@`.](spe(c(ial)?(s)?)?)/Si:#DM-tournaments: {
  if (%dm.tournament == ON) {
    if ($nick == %dm.tplayer1) {
      if (%dmclass. [ $+ [ $nick ] ] != melee) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      if (!$2) {
        notice $nick %c1 $+ Please choose the kind of special attack you want. Type $+ %c4 !DMcommands specials $+ %c1 to see a list of available special attacks.
        halt
      }
      if (%specuse. [ $+ [ $nick ] ] <= 0) {
        notice $nick %c1 $+ You can't use any more special attacks until you drink a $+ %c4 Special attack potion $+ %c1 $+ .
        halt
      }
      timerturnswitch2 off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.tplayer2 $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        halt
      }
      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ])  { 
        notice $nick %c1 $+ You need to have a weapon equipped if you want to use a $+ %c3 special attack $+ %c1 $+ .
        halt
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != melee && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !cast $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.tplayer1 ] ],$chr(32),_) $+ *),4,64)
        set %dm.hit $rand(0, %dm.max)
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          dec %strengthpotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 strength potion $+ %c1 will be active for $+ %c5 %strengthpotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        if (home isin %dmweapon. [ $+ [ %dm.tplayer1 ] ] && $r(1,5) == 2) {
          timer 1 1 notice $nick %c1 $+ You broke your $+ %c3 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ , meaning you lost it.
          unset %dmweapon. [ $+ [ %dm.tplayer1 ] ]
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
        :checkspec
        if (*ice* iswm $2-) {
          if ($r(1,100) <= 35) {
            timer -m 1 500 msg $chan %c2 $+ %dm.tplayer2 $+ 's $+ %c1 weapon broke because of the cold!
            timer 1 1 notice %dm.tplayer2 %c1 $+ Your weapon has been un-equipped automaticly.
            unset %dmweapon. [ $+ [ %dm.tplayer2 ] ]
          }
          set %dmweapused the $+ %c4 special attack $+ %c6 "Sword of Ice" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
        }
        elseif (*fire* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Sword of Fire" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
          timer 1 1 msg $chan %c2 $+ %dm.tplayer2 $+ 's $+ %c1 weapon is glowing from the heat! Not a chance he can hold it now.
          set %toohot. [ $+ [ %dm.tplayer2 ] ] 2
        }
        elseif (*diam* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Diamond Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
          set %dm.max $gettok($calc(%dm.max * 1.3),1,46)
          set %dm.hit $rand(0, %dm.max)
          if ($r(1,100) <= 10) {
            set %moneymore $r(100,10000)
            inc %dmmoney. [ $+ [ $nick ] ] %moneymore
            timer 1 1 notice %dm.tplayer1 %c3 $+ Congratz! $+ %c1 You found some diamonds, which are worth $+ %c5 %moneymore $+ %c1 coins.
          }
          else {
            timer 1 1 notice %dm.tplayer1 %c3 $+ You didn't get any diamonds.
          }
        }
        elseif (*ramp* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Rampage Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
          set %dm.max $calc(%dm.max * 2)
          set %dm.hit $rand(0, %dm.max)
          if ($r(1,100) <= 10) {
            timer 1 1 notice $nick %c1 $+ Your $+ %c5 %dmweapon. [ $+ [ $nick ] ] %c1 $+ broke.
            unset %dmweapon. [ $+ [ $nick ] ]
          }
        }
        elseif (*clon* iswm $2-) {
          set %dmweapused the $+ %c4 special attack $+ %c6 "Clone Sword" $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
          set %cloneamount $r(1,7)
          var %counter = %cloneamount
          set %dm.max $gettok($calc(%dm.max / 2),1,46)
          while (%counter > 0) {
            set %dm.hit [ $+ [ %counter ] ] $r(0,%dm.max)
            dec %counter
          }
          set %dm.totalhit $calc(%dm.hit1 + %dm.hit2 + %dm.hit3 + %dm.hit4 + %dm.hit5 + %dm.hit6 + %dm.hit7)
        }
        elseif (*life* iswm $2- || *live* iswm $2-) {
          set %healthmore $gettok($calc(%dm.hit * 0.8),1,46)
          inc %dmhealth. [ $+ [ %dm.tplayer1 ] ] %healthmore
          if (%dmhealth. [ $+ [ %dm.tplayer1 ] ] > %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]) {
            set %healthmore $calc(%dmstarthealth. [ $+ [ %dm.tplayer1 ] ] - (%dmhealth. [ $+ [ %dm.tplayer1 ] ] - %dm.heal))
            set %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]
          }
          timer -m 1 500 msg $chan %c2 $+ %dm.tplayer1 $+ %c1 used the $+ %c4 special attack $+ %c6 "Sword of Life" $+ %c1 $+ , which heals him with $+ %c4 80% $+ %c1 of his hit, being $+ %c5 %healthmore $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer1 ] ] $+ %c1 hitpoints.  
        }
        else {
          notice $nick %c1 $+ Please choose a valid $+ %c5 special attack $+ %c1 $+ .
          halt
        }
      }
      health.check2
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 $nick
      dec %specuse. [ $+ [ $nick ] ]
      notice $nick %c1 $+ Unless you drink a $+ %c5 Special attack potion $+ %c1 $+ , you can use $+ %c4 %specuse. [ $+ [ $nick ] ] $+ %c2 more special attack $+ $iif(%specuse. [ $+ [ $nick ] ] != 1, s) $+ %c1 this $+ %c5 DeathMatch.
      timerturnswitch2 1 60 turngonetour
    }
    elseif ($nick == %dm.tplayer2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this Tournament. 
    }
  }
  else {
    notice $nick %c1 $+ There is no Tournament running! Type $+ %c6 !Tournament <players> <stake> $+ %c1 to start one.
  }
}



;######################## ATTACK - RANGE (TOURNAMENTS) ############################
on $*:text:/^[@`.?!](s(h)?((o)?o)?t)/Si:#DM-tournaments: {
  if (%dm.tournament == ON) {
    if ($nick == %dm.tplayer1) {
      if (%dmclass. [ $+ [ $nick ] ] != range) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !cast $+ %c1 $+ , $+ %c3 !attack $+ %c1 , $+ %c3 !special $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch2 off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.tplayer2 $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        dec %dmfreeze. [ $+ [ $nick ] ]
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        halt
      }
      if (!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ] || !%dmarrow. [ $+ [ $nick ] ])  { 
        set %dm.hit $rand(0,5) 
        if (!%dmarrow. [ $+ [ $nick ] ] && %dmweapon. [ $+ [ $nick ] ]) { set %dmweapused a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 with the $+ %c5 basic arrows $+ %c1 $+ . }
        else { set %dmweapused his fist. }
        if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
          dec %rangepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        health.check2
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        halt
      }
      else { 
        var %dm.equipitem = $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.equipitem,3,64) != range && Piece of air !isin %dmweapon. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !attack $+ %c1 $+ , $+ %c3 !cast $+ %c1 , $+ %c3 !special $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        dec %dmarrow.amount. [ $+ [ $nick ] ] 1
        set %dm.max $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmarrow. [ $+ [ %dm.tplayer1 ] ],$chr(32),_) $+ *),5,64)
        set %dm.hit $rand(0, %dm.max)
        set %arrows.shot $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ %dm.tplayer1 ] ],$chr(32),_) $+ *),4,64)
        if (%rangepotuse. [ $+ [ $nick ] ] > 0 && %arrows.shot == 1) {
          dec %rangepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dm.poison $gettok($read(dmshopitems.txt, w, * $+ $replace(%dmarrow. [ $+ [ %dm.tplayer1 ] ],$chr(32),_) $+ *),6,64)
        if (%dm.poison == P) .set %dm.poisondmg 10
        if (%dm.poison == P+) .set %dm.poisondmg 20
        if (%dm.poison == P++) .set %dm.poisondmg 40
        if (!%dmpoisoned. [ $+ [ %dm.tplayer2 ] ] && %dm.poisondmg && $r(1,5) == 2) {
          set %addpoison 1
        }
        set %dmweapused a $+ %c5 %dmweapon. [ $+ [ $nick ] ] $+ %c1 with $+ %c5 $gettok(%dmarrow. [ $+ [ $nick ] ],1,64) $+ s $+ %c1 $+ .
        else {
          set %dmweapused %dmweapused $chr(32) | timer 1 1 notice %dm.tplayer1 %c1 $+ You now have $+ %c3 %dmarrow.amount. [ $+ [ %dm.tplayer1 ] ] $+ %c5 $gettok(%dmarrow. [ $+ [ %dm.tplayer1 ] ],1,64) $+ s $+ %c1 left.
        }
        if (%arrows.shot == 3) {
          if (%dmarrow.amount. [ $+ [ $nick ] ] >= 2) {
            set %dm.hit $calc(%dm.hit * 0.9)
            set %dm.hit2 $rand(0, %dm.max)
            set %dm.hit3 $rand(0, %dm.max)
            set %dm.totalhit $calc(%dm.hit + %dm.hit2 + %dm.hit3)
            if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
              dec %rangepotuse. [ $+ [ $nick ] ]
              set %dm.totalhit $gettok($calc(%dm.totalhit * 1.1),1,46)
              timer 1 1 notice $nick %c1 $+ Your $+ %c3 range potion $+ %c1 will be active for $+ %c5 %rangepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
            }
            dec %dmarrow.amount. [ $+ [ $nick ] ] 2
          }
          else {
            notice $nick %c1 $+ You only have $+ %c3 $calc(%dmarrow.amount. [ $+ [ $nick ] ] + 1) $+ %c1 arrows left, while you need at least $+ %c3 3 $+ %c1 arrows.
            halt
          }
        }
        if (%dmarrow.amount. [ $+ [ $nick ] ] <= 0) {
          unset %dmarrow. [ $+ [ $nick ] ]
        }
      } 
      health.check2
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 $nick
      timerturnswitch2 1 60 turngonetour
    }
    elseif ($nick == %dm.tplayer2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this Tournament. 
    }
  }
  else {
    notice $nick %c1 $+ There is no Tournament running! Type $+ %c6 !Tournament <players> <stake> $+ %c1 to start one.
  }
}


;######################## ATTACK - MAGE (TOURNAMENTS) ##############################
on $*:text:/^[?!@`.](cast|spell)/Si:#DM-tournaments: {
  if (%dm.tournament == ON) {
    if ($nick == %dm.tplayer1) {
      if (%dmclass. [ $+ [ $nick ] ] != mage) {
        notice $nick %c1 $+ As a $+ %c5 %dmclass. [ $+ [ $nick ] ] $+ %c1 $+ , you can't use this command. Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !attack, $+ %c3 !special $+ %c1 $+ %c1 or %c3 $+ !use $+ %c1 instead.
        halt
      }
      timerturnswitch2 off
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 ) {
        dec %toohot. [ $+ [ $nick ] ]
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he can't reach $+ %c2 %dm.tplayer2 $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %dmfreeze. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        halt
      }
      if (%toohot. [ $+ [ $nick ] ] > 0 ) {
        msg $chan %c1 $+ %dm.tplayer1 $+ %c1 Tries to attack but he still can't hold his weapon because of the heat $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ %c1 gets the turn.
        notice $nick %c1 $+ Please wait $+ %c3 %toohot. [ $+ [ $nick ] ] $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1,s) $+ .
        set %dm.tplayer1 %dm.tplayer2
        set %dm.tplayer2 $nick
        dec %toohot. [ $+ [ $nick ] ]
        halt
      }
      if ($2) {
        set %dmspellname $read(dmshopitems.txt, w, $replace($2-,$chr(32),_) $+ *)
        set %dmspell2 $gettok(%dmspellname,1,64)
        set %dmspell $replace(%dmspell2,_,$chr(32))
        if (!%dmspell) {
          notice $nick %c1 $+ There's no such spell as %c4 $+ " $+ $2- $+ " $+ %c1 $+ .
          halt
        }
        if ($readini(dminv.ini,$nick,%dmspell2) <= 0 || !$readini(dminv.ini,$nick,%dmspell2)) { 
          notice $nick %c1 $+ You don't have any $+ %c3 %dmspell $+ s $+ %c1 $+ .
          halt
        } 
      }
      if ((!%dmweapon. [ $+ [ $nick ] ] || piece isin %dmweapon. [ $+ [ $nick ] ] && !$2) || !$2)  { 
        set %dm.hit $calc($rand(0,10) + $iif(rand(1,5) == 2, $rand(0,10), 0))
        if (%magepotuse. [ $+ [ $nick ] ] > 0) {
          dec %magepotuse. [ $+ [ $nick ] ]
          set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
          timer 1 1 notice $nick %c1 $+ Your $+ %c3 mage potion $+ %c1 will be active for $+ %c5 %magepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
        }
        set %dmweapused the basic spell.
        health.check2
      }
      else { 
        set %dm.weaponuse $read(dmshopitems.txt, w, * $+ $replace(%dmweapon. [ $+ [ $nick ] ],$chr(32),_) $+ *)
        if ($gettok(%dm.weaponuse,3,64) != mage && Piece of air !isin %dmweapon. [ $+ [ $nick ] ] && !$2) {
          notice $nick %c1 $+ You can't use this command with a $+ %c4 %dmweapon. [ $+ [ $nick ] ] $+ %c1 $+ . Use %c3 $+ !shoot $+ %c1 $+ , $+ %c3 !attack, $+ %c3 !special $+ %c1 $+ %c1 or %c3 $+ !use $+ %c1 instead.
          halt
        }
        set %reqstaff $gettok(%dmspellname,4,64)
        set %reqstaff $replace(%reqstaff,_,$chr(32))
        if (%reqstaff == Newbie magic staff && %dmweapon. [ $+ [ $nick ] ] != Newbie magic staff && %dmweapon. [ $+ [ $nick ] ] != Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Newbie magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Beginner magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Beginner magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Magic staff && %dmweapon. [ $+ [ $nick ] ] != Magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need a $+ %c5 Magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Advanced magic staff && %dmweapon. [ $+ [ $nick ] ] != Ultimate magic staff && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need an $+ %c5 Advanced magic staff $+ %c2 or higher $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif (%reqstaff == Two duel handed magic wands && %dmweapon. [ $+ [ $nick ] ] != Two duel handed magic wands) {
          notice $nick %c1 $+ You need $+ %c5 Two duel handed magic wands $+ %c1 equipped, $+ %c1 to use $+ %c6 %dmspell $+ s $+ %c1 $+ .
          halt
        }
        elseif ($gettok(%dmspellname,3,64) == aspell) {
          set %dm.max $gettok(%dmspellname,5,64)
          if (%dmweapon. [ $+ [ $nick ] ] == Newbie magic staff) .set %dm.max $calc(%dm.max * 0.8)
          if (%dmweapon. [ $+ [ $nick ] ] == Beginner magic staff) .set %dm.max $calc(%dm.max * 0.9)
          if (%dmweapon. [ $+ [ $nick ] ] == Advanced magic staff) .set %dm.max $calc(%dm.max * 1.1)
          if (%dmweapon. [ $+ [ $nick ] ] == Ultimate magic staff) .set %dm.max $calc(%dm.max * 1.2)
          if (%dmweapon. [ $+ [ $nick ] ] == Two duel handed magic wands) .set %dm.max $calc(%dm.max * 1.5)
          set %dm.hit $rand($calc(5 + $iif($r(1,2) == 2, (%dm.max * 0.1), 0)), %dm.max) 
          if (%magepotuse. [ $+ [ $nick ] ] > 0) {
            dec %magepotuse. [ $+ [ $nick ] ]
            set %dm.hit $gettok($calc(%dm.hit * 1.1),1,46)
            timer 1 1 notice $nick %c1 $+ Your $+ %c3 mage potion $+ %c1 will be active for $+ %c5 %magepotuse. [ $+ [ $nick ] ] $+ %c1 more rounds.
          }
          set %dmweapused %c3 $+ %dmspell $+ %c1 with a $+ %c5 %dmweapon. [ $+ [ %dm.tplayer1 ] ] $+ %c1 $+ .
          if ($gettok(%dmspellname,6,64) == freeze) {
            set %dmfreeze. [ $+ [ %dm.tplayer2 ] ] 2
            if (%dmclass. [ $+ [ %dm.tplayer2 ] ] != melee) .set %dmfreeze. [ $+ [ %dm.tplayer2 ] ] 0
            set %dmweapused %dmweapused  | timerfreeze -m 1 500 msg $chan %c2 $+ %dm.tplayer2 $+ %c1 has been frozen, meaning he can't use $+ %c3 melee attacks $+ %c1 for $+ %c5 2 $+ %c1 turns.
          }
          set %diddecspell 1
          writeini dminv.ini $nick %dmspell2 $calc($readini(dminv.ini,$nick,%dmspell2) - 1)
          set %dmweapused %dmweapused  | timer 1 1 notice %dm.tplayer1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmspell2) $+ %c4 %dmspell $+ s $+ %c1 left. 
          if ($readini(dminv.ini,$nick,%dmspell2) <= 0) .remini dminv.ini $nick %dmspell2
          :health.check2
          health.check2
        }
        elseif ($gettok(%dmspellname,3,64) == hspell) {
          set %dm.heal $gettok($calc(%dmstarthealth. [ $+ [ %dm.tplayer1 ] ] / 100 * $gettok(%dmspellname,5,64)),1,46)
          inc %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dm.heal
          if (%dmhealth. [ $+ [ %dm.tplayer1 ] ] > %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]) {
            set %dm.heal $calc(%dmstarthealth. [ $+ [ %dm.tplayer1 ] ] - (%dmhealth. [ $+ [ %dm.tplayer1 ] ] - %dm.heal))
            set %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]
          }
          msg $chan %c2 $+ %dm.tplayer1 $+ %c1 casts $+ %c5 %dmspell $+ %c1 healing him with $+ %c4 %dm.heal $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer1 ] ] $+ %c1 hitpoints.  
        }
        elseif ($gettok(%dmspellname,3,64) == tspell) {
          set %dmfreeze. [ $+ [ %dm.tplayer2 ] ] 4
          if (%dmclass. [ $+ [ %dm.tplayer2 ] ] != melee) .set %dmfreeze. [ $+ [ %dm.tplayer2 ] ] 2
          msg $chan %c2 $+ %dm.tplayer1 $+ %c5 teleports away $+ %c1 $+ , meaning $+ %c2 %dm.tplayer2 $+ %c1 can't use $+ %c3 melee attacks $+ %c1 for $+ %c5 4 $+ %c1 $+ , and $+ %c3 ranged/magic attacks $+ %c1 for $+ %c5 2 $+ %c1 turns. 
        }
        if (%dmspell2 && !%diddecspell) {
          writeini dminv.ini $nick %dmspell2 $calc($readini(dminv.ini,$nick,%dmspell2) - 1)
          set %dmweapused %dmweapused  | timer 1 1 notice %dm.tplayer1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmspell2) $+ %c4 %dmspell $+ s $+ %c1 left. 
          if ($readini(dminv.ini,$nick,%dmspell2) <= 0) .remini dminv.ini $nick %dmspell2 
        }
        unset %diddecspell
      } 
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 $nick
      timerturnswitch2 1 60 turngonetour
    }
    elseif ($nick == %dm.tplayer2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this Tournament. 
    }
  }
  else {
    notice $nick %c1 $+ There is no Tournament running! Type $+ %c6 !Tournament <players> <stake> $+ %c1 to start one.
  }
}

;############################ POTIONS & FOOD (TOURNAMENTS) #########################
on $*:text:/^[!`@.?](eat|pot(ion)?|potions|use|drink)/Si:#DM-tournaments: {
  if (cast isin $1-) { halt }
  if (%dm.tournament == ON) {
    if ($nick == %dm.tplayer1) {
      if (%dmfreeze. [ $+ [ $nick ] ] > 0 || %toohot. [ $+ [ $nick ] ] > 0) {
        timer 1 1 notice $nick %c1 $+ You can't attack for $+ %c3 $iif(%dmfreeze. [ $+ [ $nick ] ], %dmfreeze. [ $+ [ $nick ] ], %toohot. [ $+ [ $nick ] ]) $+ %c1 more turn $+ $iif(%toohot. [ $+ [ $nick ] ] != 1 && %dmfreeze. [ $+ [ $nick ] ] != 1,s) $+ .
        dec %dmfreeze. [ $+ [ $nick ] ]
        dec %toohot. [ $+ [ $nick ] ]        
      }
      set %dmpotname $read(dmshopitems.txt, w, $replace($2-,$chr(32),_) $+ *)
      set %dmpot2 $gettok(%dmpotname,1,64)
      set %dmpot $replace(%dmpot2,_,$chr(32))
      if (!%dmpotname) {
        notice $nick %c1 $+ There's no such potion as $+ %c3 " $+ $2- $+ " $+ %c1 $+ .
        halt
      }
      if ($readini(dminv.ini,$nick,%dmpot2) <= 0 || !$readini(dminv.ini,$nick,%dmpot2)) { 
        notice $nick %c1 $+ You don't have any $+ %c3 %dmpot $+ s $+ %c1 $+ .
        halt
      } 
      timerturnswitch2 off
      if (!%dmpot) {
        notice $nick %c1 $+ There's no such potion as %c4 $+ " $+ $2- $+ " $+ %c1 $+ .
        halt
      }
      if ($gettok(%dmpotname,3,64) == apot && %dmpoisoned. [ $+ [ $nick ] ] == 40) .goto skippoison 
      dm.poison
      :skippoison
      if ($gettok(%dmpotname,3,64) == hpot) {
        set %dm.heal $gettok(%dmpotname,4,64)
        inc %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dm.heal
        if (%dmhealth. [ $+ [ %dm.tplayer1 ] ] > %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]) {
          set %dm.heal $calc(%dmstarthealth. [ $+ [ %dm.tplayer1 ] ] - (%dmhealth. [ $+ [ %dm.tplayer1 ] ] - %dm.heal))
          set %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dmstarthealth. [ $+ [ %dm.tplayer1 ] ]
        }
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 healing him with $+ %c4 %dm.heal $+ %c1 hitpoints. He now has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer1 ] ] $+ %c1 hitpoints.  
        if (uber isin %dmpot) {
          if (%uberpotused. [ $+ [ $nick ] ] >= 3) {
            notice $nick %c1 $+ You can't drink a $+ %c5 %dmpot $+ %c1 another time this fight.
          }
          set %cantbehit. [ $+ [ %dm.tplayer1 ] ] 1
          if (!%uberpotused. [ $+ [ $nick ] ]) .set %uberpotused. [ $+ [ $nick ] ] 0
          inc %uberpotused. [ $+ [ $nick ] ]
          notice $nick %c1 $+ You can drink a $+ %c5 %dmpot $+ %c6 $calc(3 - %uberpotused. [ $+ [ $nick ] ] ) $+ %c1 more times this fight.
        }
      }
      if ($gettok(%dmpotname,3,64) == apot) {
        if (%dmpoisoned. [ $+ [ $nick ] ] != 40) {
          msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks an $+ %c5 %dmpot $+ %c1 releasing him from his poison.
          unset %dmpoisoned. [ $+ [ $nick ] ]
        }
        else {
          notice $nick %c1 $+ You can't cure poison from $+ %c4 Cursed arrows $+ %c1 $+ .
          halt
        }  
      }
      if ($gettok(%dmpotname,3,64) == ppot) {
        if (%specuse. [ $+ [ $nick ] ]) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if you're still able to use Special attacks.
          halt
        }
        set %specuse. [ $+ [ $nick ] ] 2
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 allowing him to use $+ %c4 2 more $+ %c1 Special attacks.
      }
      if ($gettok(%dmpotname,3,64) == mpot) {
        if (%magepotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %magepotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 mage max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == spot) {
        if (%strengthpotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %strengthpotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 melee max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == rpot) {
        if (%rangepotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %rangepotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 ranged max hit $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      if ($gettok(%dmpotname,3,64) == dpot) {
        if (%defpotuse. [ $+ [ $nick ] ] > 0) {
          notice $nick %c1 $+ There's no need to drink a $+ %c5 %dmpot $+ %c1 if your last $+ %c5 %dmpot $+ %c1 is still active.
          halt
        }
        set %defpotuse. [ $+ [ $nick ] ] 5
        msg $chan %c2 $+ %dm.tplayer1 $+ %c1 drinks a $+ %c5 %dmpot $+ %c1 increasing his $+ %c3 defence $+ %c1 with $+ %c4 10% $+ %c1 $+ .
      }
      writeini dminv.ini $nick %dmpot2 $calc($readini(dminv.ini,$nick,%dmpot2) - 1)
      timer 1 1 notice %dm.tplayer1 %c1 $+ You have $+ %c3 $readini(dminv.ini,$nick,%dmpot2) $+ %c4 %dmpot $+ s $+ %c1 left. 
      if ($readini(dminv.ini,$nick,%dmpot2) <= 0) .remini dminv.ini $nick %dmpot2 
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 $nick
      timerturnswitch2 1 60 turngonetour
    }
    elseif ($nick == %dm.tplayer2) { 
      notice $nick %c1 $+ Its not your turn! 
    }
    else { 
      notice $nick %c1 $+ You are not fighting in this Tournament. 
    }
  }
  else {
    notice $nick %c1 $+ There is no Tournament running! Type $+ %c6 !Tournament <players> <stake> $+ %c1 to start one.
  }
}

;#################################################################################
;############################ ALIASES OF TOURNY's#################################
;#################################################################################

;##################### TAKES CARE OF HEALTH PLAYERS ###########################
alias -l health.check2 {
  dm.poison2
  if (%defpotuse. [ $+ [ %dm.tplayer2 ] ] > 0) {
    dec %defpotuse. [ $+ [ %dm.tplayer2 ] ]
    set %dm.hit $gettok($calc(%dm.hit * 0.9),1,46)
    set %dm.totalhit $gettok($calc(%dm.totalhit * 0.9),1,46)
    set %dm.totalhit $gettok(%dm.totalhit,1,46)
    set %dm.hit $gettok(%dm.hit,1,46)
    timer 1 1 notice %dm.tplayer2 %c1 $+ Your $+ %c3 defence potion $+ %c1 will be active for $+ %c5 %defpotuse. [ $+ [ %dm.tplayer2 ] ] $+ %c1 more rounds.
  }
  set %dm.totalhit $gettok(%dm.totalhit,1,46)
  set %dm.hit $gettok(%dm.hit,1,46)
  if (%cloneamount) {
    if (%dm.totalhit > %dmhealth. [ $+ [ %dm.tplayer2 ] ]) {
      set %dm.totalhit %dmhealth. [ $+ [ %dm.tplayer2 ] ]
    }
    dec %dmhealth. [ $+ [ %dm.tplayer2 ] ] %dm.totalhit
    msg %dm.chan2 %c2 $+ %dm.tplayer1 $+ %c1 has hit, with $+ %c6 %cloneamount $+ %c1 sword $+ $iif(%cloneamount > 1,s $+), a total of $+ %c3 $gettok(%dm.totalhit,1,46) $+ %c1 on $+ %c2 %dm.tplayer2 $+ %c1 using %dmweapused
    msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer2 ] ] $+ %c1 hitpoints left!     
    unset %cloneamount
    unset %dm.hit*
    unset %dm.totalhit
    set %hpmsged 1
    goto checkhp
  }
  if (%arrows.shot == 3) {
    unset %arrows.shot
    if (%dm.totalhit > %dmhealth. [ $+ [ %dm.tplayer2 ] ]) {
      set %dm.totalhit %dmhealth. [ $+ [ %dm.tplayer1 ] ]
    }
    dec %dmhealth. [ $+ [ %dm.tplayer2 ] ] %dm.totalhit
    msg %dm.chan2 %c2 $+ %dm.tplayer1 $+ %c1 has hit, with $+ %c6 3 $+ %c1 arrows, a total of $+ %c3 $gettok(%dm.totalhit,1,46) $+ %c1 on $+ %c2 %dm.tplayer2 $+ %c1 using %dmweapused
  }
  else {
    if (%dm.hit > %dmhealth. [ $+ [ %dm.tplayer2 ] ]) { 
      set %dm.hit %dmhealth. [ $+ [ %dm.tplayer2 ] ] 
    }
    msg %dm.chan2 %c2 $+ %dm.tplayer1 $+ %c1 has hit $+ %c3 %dm.hit $+ %c1 on $+ %c2 %dm.tplayer2 $+ %c1 using %dmweapused
    dec %dmhealth. [ $+ [ %dm.tplayer2 ] ] %dm.hit
  }
  if (!%dm.totalhit) .set %dm.totalhit %dm.hit
  if (%cantbehit. [ $+ [ %dm.tplayer2 ] ]) {
    set %dm.hit %dm.totalhit
    inc %dmhealth. [ $+ [ %dm.tplayer2 ] ] %dm.hit
    unset %cantbehit. [ $+ [ %dm.tplayer2 ] ]
    msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ s $+ %c3 Incredible fantastic Uber health potion $+ %c1 heals him with $+ %c4 %dm.hit $+ %c1 hitpoints inmediatly. 
  }
  if (%addpoison) {
    msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 is poisoned with $+ %c6 %dm.poisondmg $+ %c1 poison damage each turn!
    set %dmpoisoned. [ $+ [ %dm.tplayer2 ] ] %dm.poisondmg
    unset %addpoison
  }
  :checkhp
  inc %dm.xp. [ $+ [ %dm.tplayer1 ] ] $gettok($calc(%dm.hit / 2 + 1),1,46)
  timer 1 1 notice %dm.tplayer1 %c1 $+ You gained $+ %c6 $gettok($calc(%dm.hit / 2 + 1),1,46) $+ %c1 expoints.
  if  (%dmhealth. [ $+ [ %dm.tplayer2 ] ] <= 0) { 
    msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 has been defeated! $+ %c2 %dm.tplayer1 $+ %c1 gets $+ %c3 $calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ] * 15) $+ %c1 bonus expoints for this fight! 
    set %winfight 1
    inc %dmloses. [ $+ [ %dm.tplayer2 ] ] 
    inc %dmwins. [ $+ [ %dm.tplayer1 ] ]
    update.score
    inc %dm.xp. [ $+ [ %dm.tplayer1 ] ] $calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ] * 15)
    timerturnswitch2 off
    xp.check2 
    goto nextround
  }
  if (!%hpmsged) .msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer2 ] ] $+ %c1 hitpoints left! 
  unset %hpmsged
  if (%dm.totalhit) .set %dm.hit %dm.totalhit
  unset %dm.totalhit
  return
  :nextround
  inc %fight
  if (%dm.tournament.winner.13) { set %dm.tournament.winner.14 $nick }
  elseif (%dm.tournament.winner.12) { set %dm.tournament.winner.13 $nick }
  elseif (%dm.tournament.winner.11) { set %dm.tournament.winner.12 $nick }
  elseif (%dm.tournament.winner.10) { set %dm.tournament.winner.11 $nick }
  elseif (%dm.tournament.winner.9) { set %dm.tournament.winner.10 $nick }
  elseif (%dm.tournament.winner.8) { set %dm.tournament.winner.9 $nick }
  elseif (%dm.tournament.winner.7) { set %dm.tournament.winner.8 $nick }
  elseif (%dm.tournament.winner.6) { set %dm.tournament.winner.7 $nick }
  elseif (%dm.tournament.winner.5) { set %dm.tournament.winner.6 $nick }
  elseif (%dm.tournament.winner.4) { set %dm.tournament.winner.5 $nick }
  elseif (%dm.tournament.winner.3) { set %dm.tournament.winner.4 $nick }
  elseif (%dm.tournament.winner.2) { set %dm.tournament.winner.3 $nick }
  elseif (%dm.tournament.winner.1) { set %dm.tournament.winner.2 $nick }
  else { set %dm.tournament.winner.1 $nick }
  timer 1 2 checkroundnext
}

;################################## POISON STUFF ###################################
alias -l dm.poison2 {
  if (%dmpoisoned. [ $+ [ %dm.tplayer1 ] ]) {
    if (%dmpoisoned. [ $+ [ %dm.tplayer1 ] ] > %dmhealth. [ $+ [ %dm.tplayer1 ] ]) { 
      timerfreeze off
      set %dmpoisoned. [ $+ [ %dm.tplayer1 ] ] %dmhealth. [ $+ [ %dm.tplayer1 ] ]
      dec %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dmpoisoned. [ $+ [ %dm.tplayer1 ] ]
      var %dm.tplayer3 = %dm.tplayer1
      set %dm.tplayer1 %dm.tplayer2
      set %dm.tplayer2 %dm.tplayer3 
      msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 gets $+ %c6 %dmpoisoned. [ $+ [ %dm.tplayer2 ] ] $+ %c1 damage from poison. He now has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer2 ] ] $+ %c1 hitpoints left.
      msg %dm.chan2 %c2 $+ %dm.tplayer2 $+ %c1 has died because of poison! $+ %c2 %dm.tplayer1 $+ %c1 gets $+ %c3 $calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ] * 15) $+ %c1 bonus expoints for this fight! 
      inc %dmloses. [ $+ [ %dm.tplayer2 ] ] 
      inc %dmwins. [ $+ [ %dm.tplayer1 ] ]
      update.score
      if (%dm.tournament.winner.13) { set %dm.tournament.winner.14 $nick }
      elseif (%dm.tournament.winner.12) { set %dm.tournament.winner.13 $nick }
      elseif (%dm.tournament.winner.11) { set %dm.tournament.winner.12 $nick }
      elseif (%dm.tournament.winner.10) { set %dm.tournament.winner.11 $nick }
      elseif (%dm.tournament.winner.9) { set %dm.tournament.winner.10 $nick }
      elseif (%dm.tournament.winner.8) { set %dm.tournament.winner.9 $nick }
      elseif (%dm.tournament.winner.7) { set %dm.tournament.winner.8 $nick }
      elseif (%dm.tournament.winner.6) { set %dm.tournament.winner.7 $nick }
      elseif (%dm.tournament.winner.5) { set %dm.tournament.winner.6 $nick }
      elseif (%dm.tournament.winner.4) { set %dm.tournament.winner.5 $nick }
      elseif (%dm.tournament.winner.3) { set %dm.tournament.winner.4 $nick }
      elseif (%dm.tournament.winner.2) { set %dm.tournament.winner.3 $nick }
      elseif (%dm.tournament.winner.1) { set %dm.tournament.winner.2 $nick }
      else { set %dm.tournament.winner.1 $nick }
      timer 1 2 checkroundnext
      return
    }
    else {
      dec %dmhealth. [ $+ [ %dm.tplayer1 ] ] %dmpoisoned. [ $+ [ %dm.tplayer1 ] ]
      msg %dm.chan2 %c2 $+ %dm.tplayer1 $+ %c1 gets $+ %c6 %dmpoisoned. [ $+ [ %dm.tplayer1 ] ] $+ %c1 damage from poison. He now has $+ %c4 %dmhealth. [ $+ [ %dm.tplayer1 ] ] $+ %c1 hitpoints left.
    }
  }
}

;################################# WHAT'S NEXT... ###############################
alias -l checkroundnext {
  if (%dm.tournament.people == 8 && %fight == 2) {
    fight2
    return
  }
  if (%dm.tournament.people == 8 && %fight == 3) {
    fight3
    return
  }
  if (%dm.tournament.people == 8 && %fight == 4) {
    fight4
    return
  }
  if (%dm.tournament.people == 8 && %fight == 5) {
    fight5.semi
    return
  }
  if (%dm.tournament.people == 8 && %fight == 6) {
    fight6.semi
    return
  }
  if (%dm.tournament.people == 8 && %fight == 7) {
    fight7.final
    return
  }
  if (%dm.tournament.people == 8 && %fight == 8) {
    msg %dm.chan2 %c2 $+ %dm.tournament.winner.7 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 coins!
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.7 ] ]
    inc %dmmoney. [ $+ [ %dm.tournament.winner.7 ] ] %dm.tournament.prize
    endtour
    return
  }
  if (%dm.tournament.people == 4 && %fight == 2) {
    fight2
    return
  }
  if (%dm.tournament.people == 4 && %fight == 3) {
    fight3.final
    return
  }
  if (%dm.tournament.people == 4 && %fight == 4) {                                                             
    msg %dm.chan2 %c2 $+ %dm.tournament.winner.3 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 coins!
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.3 ] ]
    inc %dmmmoney. [ $+ [ %dm.tournament.winner.3 ] ] %dm.tournament.prize
    endtour    
    return  
  }
  if (%dm.tournament.people == 16 && %fight == 2) {
    fight2
    return
  }
  if (%dm.tournament.people == 16 && %fight == 3) {
    fight3
    return
  }
  if (%dm.tournament.people == 16 && %fight == 4) {
    fight4
    return
  }
  if (%dm.tournament.people == 16 && %fight == 5) {
    fight5
    return
  }
  if (%dm.tournament.people == 16 && %fight == 6) {
    fight6
    return
  }
  if (%dm.tournament.people == 16 && %fight == 7) {
    fight7
    return
  }
  if (%dm.tournament.people == 16 && %fight == 8) {
    fight8
    return
  }
  if (%dm.tournament.people == 16 && %fight == 9) {
    fight9.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 10) {
    fight10.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 11) {
    fight11.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 12) {
    fight12.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 13) {
    fight13.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 14) {
    fight14.kwart
    return
  }
  if (%dm.tournament.people == 16 && %fight == 15) {
    fight15.final
    return
  }
  if (%dm.tournament.people == 16 && %fight == 16) {
    msg %dm.chan2 %c2 $+ %dm.tournament.winner.15 $+ %c1 has won the $+ %c5 Tournament $+ %c1 $+ ! Therefor he gets $+ %c4 %dm.tournament.prize $+ %c1 coins!
    timerstopdm2 off
    timerturnswitch2 off
    inc %dm.tournament.wins. [ $+ [ %dm.tournament.winner.15 ] ]
    inc %dmmoney. [ $+ [ %dm.tournament.winner.15 ] ] %dm.tournament.prize
    endtour
    return
  }
}

;#################################### XP CHECK IN A TOURNAMENT ##################################
alias -l xp.check2 { 
  if (%winfight) .inc %dm.xp. [ $+ [ %dm.tplayer1 ] ] $calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ] * 15)
  if (%dmlvl. [ $+ [ %dm.tplayer1 ] ] == 1 ) { 
    set %dm.lvl.req. [ $+ [ %dm.tplayer1 ] ] 100 
  } 
  else { 
    set %dm.lvl.req. [ $+ [ %dm.tplayer1 ] ] $calc(%dmlvl. [ $+ [ $nick ] ] ^ 3 * 0.6 + %dmlvl. [ $+ [ $nick ] ] * 100)) 
  }
  lvl.check2
}

;##################################### LVL CHECK IN A TOURNAMENT #################################
alias -l lvl.check2 {
  if (%dm.xp. [ $+ [ %dm.tplayer1 ] ] >= %dm.lvl.req. [ $+ [ %dm.tplayer1 ] ]) {  
    inc %dmlvl. [ $+ [ %dm.tplayer1 ] ] 
    msg %dm.chan2 %c6 $+ Congratulations! $+ %c2 %dm.tplayer1 $+ %c6 just leveled up! He now is level $+ %c5 %dmlvl. [ $+ [ %dm.tplayer1 ] ] $+ %c6 $+ ! 
    notice %dm.tplayer1 %c1 $+ From now on, you'll have $+ %c4 $gettok($calc(%dmlvl. [ $+ [ %dm.tplayer1 ] ]  ^1.2 * 30 + 80),1,46) $+ %c1 hitpoints.
  }
}

;############################ NOT ATTACK WITHIN 1 MINUTE #########################################
alias -l turngonetour {
  if (%dm.tournament == ON) {
    dm.poison2  
    msg %dm.chan2 %c2 $+ %dm.tplayer1 $+ %c1 hasn't attacked or used a potion/spell within $+ %c3 1 minute $+ %c1 $+ ; $+ %c2 %dm.tplayer2 $+ 's $+ %c1 turn.
    var %dm.tplayer3 = %dm.tplayer1
    set %dm.tplayer1 %dm.tplayer2
    set %dm.tplayer2 %dm.tplayer3
  }
}

;############################## TOURNAMENT NOT FULL WITHIN 1 MINUTE ###############################
alias -l tooSlowTour {
  msg %dm.chan2 %c1 $+ Not enough people signed up for the tournament $+ %c2 %dm.tournament.starter $+ %c1 started, within $+ %c4 2 $+ %c1 minutes. Tournament Challenge timed out.
  if (!%tourstoppedrem) {
    inc %dmmoney. [ $+ [ %DM.tournament.player.1 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.2 ] ] %dm.tournament.stake)
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.3 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.4 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.5 ] ] %dm.tournament.stake
    if (%DM.tournament.player.6) .inc %dmmoney. [ $+ [ %DM.tournament.player.6 ] ] %dm.tournament.stake
    if (%DM.tournament.player.7) .inc %dmmoney. [ $+ [ %DM.tournament.player.7 ] ] %dm.tournament.stake
    if (%DM.tournament.player.8) .inc %dmmoney. [ $+ [ %DM.tournament.player.8 ] ] %dm.tournament.stake
    if (%DM.tournament.player.9) .inc %dmmoney. [ $+ [ %DM.tournament.player.9 ] ] %dm.tournament.stake
    if (%DM.tournament.player.10) .inc %dmmoney. [ $+ [ %DM.tournament.player.10 ] ] %dm.tournament.stake
    if (%DM.tournament.player.11) .inc %dmmoney. [ $+ [ %DM.tournament.player.11 ] ] %dm.tournament.stake
    if (%DM.tournament.player.12) .inc %dmmoney. [ $+ [ %DM.tournament.player.12 ] ] %dm.tournament.stake
    if (%DM.tournament.player.13) .inc %dmmoney. [ $+ [ %DM.tournament.player.13 ] ] %dm.tournament.stake
    if (%DM.tournament.player.14) .inc %dmmoney. [ $+ [ %DM.tournament.player.14 ] ] %dm.tournament.stake
    if (%DM.tournament.player.15) .inc %dmmoney. [ $+ [ %DM.tournament.player.15 ] ] %dm.tournament.stake
    if (%DM.tournament.player.16) .inc %dmmoney. [ $+ [ %DM.tournament.player.16 ] ] %dm.tournament.stake
  }
  unset %dm.tplayer*
  unset %dm.tour*
  unset %dm.chan2
}

;###################################### STOP THE TOURNAMENT #######################################
alias -l endtour {
  timerturnswitch2 off
  if (!%tourstoppedrem) {
    inc %dmmoney. [ $+ [ %DM.tournament.player.1 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.2 ] ] %dm.tournament.stake)
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.3 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.4 ] ] %dm.tournament.stake
    if (%DM.tournament.player.5) .inc %dmmoney. [ $+ [ %DM.tournament.player.5 ] ] %dm.tournament.stake
    if (%DM.tournament.player.6) .inc %dmmoney. [ $+ [ %DM.tournament.player.6 ] ] %dm.tournament.stake
    if (%DM.tournament.player.7) .inc %dmmoney. [ $+ [ %DM.tournament.player.7 ] ] %dm.tournament.stake
    if (%DM.tournament.player.8) .inc %dmmoney. [ $+ [ %DM.tournament.player.8 ] ] %dm.tournament.stake
    if (%DM.tournament.player.9) .inc %dmmoney. [ $+ [ %DM.tournament.player.9 ] ] %dm.tournament.stake
    if (%DM.tournament.player.10) .inc %dmmoney. [ $+ [ %DM.tournament.player.10 ] ] %dm.tournament.stake
    if (%DM.tournament.player.11) .inc %dmmoney. [ $+ [ %DM.tournament.player.11 ] ] %dm.tournament.stake
    if (%DM.tournament.player.12) .inc %dmmoney. [ $+ [ %DM.tournament.player.12 ] ] %dm.tournament.stake
    if (%DM.tournament.player.13) .inc %dmmoney. [ $+ [ %DM.tournament.player.13 ] ] %dm.tournament.stake
    if (%DM.tournament.player.14) .inc %dmmoney. [ $+ [ %DM.tournament.player.14 ] ] %dm.tournament.stake
    if (%DM.tournament.player.15) .inc %dmmoney. [ $+ [ %DM.tournament.player.15 ] ] %dm.tournament.stake
    if (%DM.tournament.player.16) .inc %dmmoney. [ $+ [ %DM.tournament.player.16 ] ] %dm.tournament.stake
  }
  unset %tourstoppedrem
  unset %dm*tour*
  unset %dm.tplayer*
  timerchallenge2 off
}