on *:text:*:*:{
  if (!$chan) close -m $nick
  var %t = $left($1,1),%1 = $right($1,-1)
  if (%t !isalnum) { 
    if ($hget($nick)) {
      if (%1 == browse) {
        if ($2 == info) {
          if ($ini(gundams.ini,$3)) {
            _msg $nick (Store) $3 Information: Price: $chr(36) $+ $bytes($g.price($3),db) HP: $g.hp($3) Power: $g.power($3) $&
              Agility: $g.agil($3) Armor: $g.armor($3)
          }
          elseif ($ini(weapons.ini,$3)) {
            var %price = $i.price($3),%d = $i.damage($3)
            if ($i.type($3) == Gun) {
              _msg $nick (Store) $3 Information: $chr(36) $+ $bytes(%price,db) Damage: %d Rate: $i.rate($3) FullClip: $i.full($3)
            }
            elseif ($i.type($3) == Sword) {
              _msg $nick (Store) $3 Information: $chr(36) $+ $bytes(%price,db) Damage: %d
            }
            elseif ($i.type($3) == Shield) _msg $nick (Store) $3 Information: $chr(36) $+ $bytes(%price,db) Protection: $i.prot($3) $+ $chr(37)
            else _msg $nick (Store) $iif($3,Invalid item selection,Syntax: browse info <item>)
          }
          elseif ($ini(items.ini,$3)) {
            _msg $nick (Store) $3 Information: Price: $chr(36) $+ $bytes($x.price($3),db) Increase: $x.inc($3) Stat: $x.istat($3)
          }
        }
        elseif ($2 == items) { 
          var %n = 1,%names
          while ($ini(items.ini,%n)) {
            var %price = $chr(36) $+ $bytes($x.price($v1),db),%i = $x.inc($v1)
            var %names = %names $+($v1,( $+ %price $+ ))
            if ($numtok(%names,32) >= 25) || (%n = $ini(items.ini,0)) { if (%names) _msg $nick (Store) Items: $v1 | var %names } 
            inc %n
          }
        }
        elseif ($len($2) > 3) && ($2 isin Gundams) {
          var %n = 1,%names 
          while ($ini(gundams.ini,%n)) {
            var %price = $chr(36) $+ $bytes($g.price($v1),db)
            var %names = %names $+($v1,( $+ %price $+ ))
            if ($numtok(%names,32) >= 25) || (%n = $ini(gundams.ini,0)) { if (%names) _msg $nick (Store) Gundams: $v1 | var %names } 
            inc %n
          }
        }
        elseif ($len($2) > 3) && ($2 isin weapons) {
          var %n = 1,%names 
          while ($ini(weapons.ini,%n)) {
            var %price = $chr(36) $+ $bytes($i.price($v1),db)
            var %names = %names $+($v1,( $+ %price $+ ))
            if ($numtok(%names,32) >= 25) || (%n = $ini(weapons.ini,0)) { if (%names) _msg $nick (Store) Weapons: $v1 | var %names } 
            inc %n
          }
        }
        else _msg $nick (Store) Syntax: %t $+ Browse <info|Gundams|Weapons|Items> [item name]
      }
      if (%1 == buy) {
        if ($ini(gundams.ini,$2)) {
          var %price = $readini(gundams.ini,$2,price)
          if ($u.mon($nick) >= %price) {
            hdec $nick money %price
            add_gundam $nick $2
            _msg $nick (Store) You've bought the $2 $+ ! To set $2 as your current gundam, type $+(,%t,SET $2,) 
          }
          else _msg $nick (Store) You're $chr(36) $+ $bytes($calc(%price - $u.mon($nick)),db) short of the $2
        }
        elseif ($ini(weapons.ini,$2)) {
          var %price = $readini(weapons.ini,$2,price)
          if ($u.mon($nick) >= %price) {
            hdec $nick money %price
            add_weapon $nick $2
            _msg $nick (Store) You've bought the $2 $+ !
          }
          else _msg $nick (Store) You're $chr(36) $+ $bytes($calc(%price - $u.mon($nick)),db) short of a $2
        }
        elseif ($ini(items.ini,$2)) {
          var %price = $x.price($2)
          if ($u.mon($nick) >= %price) {
            hdec $nick money %price
            add_item $nick $2 
            _msg $nick (Store) You've bought a $2 $+ !
          }
          else _msg $nick (Store) You're $chr(36) $+ $bytes($calc(%price - $u.mon($nick)),db) short of a $2
        }
      }
      if (%1 == set) {
        if ($left($2,4) == perc) && ($2 isin percents) {
          var %set = $iif($istok(on true 1 yes,$3,32),$true,$false)
          if ($u.perc($nick) != %set) {
            hadd $nick percents %set
            if (%set) _msg $nick You will now see perecentages (for health, and others) instead of fractions.
            elseif (!%set) _msg $nick You will not longer see percentages, but fractions instead.
          } 
          else _msg $nick $iif(%set,Percents are already being used.,The percent option was not previously set.)
        }
        elseif ($len($2) > 3 && $2 isin password) { 
          if ($3 == $u.pass($nick)) {
            hadd $nick password $$4
            _msg $nick Your password is now $4 $+ .
          }
          else _msg $nick Syntax: %t $+ password <old pass> <new new>
        }
        elseif ($istok($u.gunds($nick),$2,44)) {
          hadd $nick currentgundam $2
          _msg $nick You're now piloting the $2 $+ !
        }
        elseif ($2 == output) { 
          if ($istok(msg notice,$3,32)) {
            hadd $nick output $3
            _msg $nick Set output to $3 
          }
          else _msg $nick Output methods are notice and msg only.
        }
      }
      if (%1 == stats) _stats $nick $iif($2,$2,$nick)
      if (%1 == gstats) _gstats $nick $iif($2,$2-,$$u.cgund($nick))
      if (%1 == wstats) _wstats $nick $2-
      ; ATTACKS
      if (%1 == punch) _punch $nick $$2
      if (%1 == vulcan) _shoot $nick $2 Vulcan
      if (%1 == beamrifle) _shoot $nick $2 BeamRifle
      if (%1 == beamsaber) _slash $nick $2 BeamSaber
      if (%1 == beamscythe) _slash $nick $2 BeamScythe
      if (%1 == beamgatling) _shoot $nick $2 BeamGatling
      if (%1 == busterrifle) _shoot $nick $2 BusterRifle
      if (%1 == armyknife) _slash $nick $2 ArmyKnife
      if (%1 == beamglaive) _shoot $nick $2 BeamGlaive
      if (%1 == misslepod) _shoot $nick $2 MisslePod
      if (%1 == misslepodv2) _shoot $nick $2 MisslePodv2
      if (%1 == misslepodv3) _shoot $nick $2 MisslePodv3
      if (%1 == twinbeamscythe) _slash $nick $2 TwinBeamScythe
      if (%1 == shenlongshield) _shield $nick ShenlongShield
      if (%1 == bustershield) _shield $nick BusterShield
      if (%1 == gwingshield) _shield $nick GwingShield
      if (%1 == restorekitv3) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) RestoreKitV3 $iif($u.cgund($nick) || !$3,$2,$3) 
      if (%1 == restorekitv2) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) RestoreKitV2 $iif($u.cgund($nick) || !$3,$2,$3)
      if (%1 == restorekit) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) RestoreKit $iif($u.cgund($nick) || !$3,$2,$3)
      if (%1 == ammopack) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) AmmoPack $iif($u.cgund($nick) || !$3,$2-,$3-)
      if (%1 == BeamCannon) _shoot $nick $2 BeamCannon
      if (%1 == FlameThrower) _shoot $nick $2 FlameThrower
      if (%1 == torpedo) _shoot $nick $2 Torpedo
      if (%1 == ffield) _shield $nick FField
      if (%1 == Power+Stat) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) Power+Stat $iif($u.cgund($nick) || !$3,$2-,$3-)
      if (%1 == ArmorPatch) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) ArmorPatch $iif($u.cgund($nick) || !$3,$2-,$3-)
      if (%1 == Armor+Stat) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) Armor+Stat $iif($u.cgund($nick) || !$3,$2-,$3-)
      if (%1 == Weapmax+Stat) _item $nick $iif(!$u.cgund($nick) || $3,$2,$u.cgund($nick)) Weapmax+Stat $iif($u.cgund($nick) || !$3,$2-,$3-)
      ; /ATTACKS
      if (%1 == Gundams) {
        var %n = $iif($hget($2),$2,$nick)
        if ($hget(%n)) {
          tokenize 44 $u.gunds(%n)
          _msg $nick $iif(%n != $nick,%n $+ 's) Gundam(s): $iif($1-,$v1,N/A)
        }
      }
      if (%1 == Weapons) {
        var %n = $iif($hget($2),$2,$nick),%x = 1,%w
        while ($gettok($u.weap(%n),%x,44)) {
          var %_ = $v1,%ins = $+($ui.avail(%n,%_),/,$ui.total(%n,%_))
          var %w = %w %_ $+ ( $+ %ins $+ )
          inc %x
        }
        _msg $nick $iif(%n != $nick,%n $+ 's) Weapon(s): $iif(%w,%w,N/A)
      }
      if (%1 == Items) {
        var %n = $iif($hget($2),$2,$nick),%x = 1,%i
        while ($gettok($u.items(%n),%x,44)) {
          var %_ = $v1,%t = $ux.total(%n,%_)
          var %i = %i %_ $+ ( $+ %t $+ )
          inc %x
        }
        _msg $nick $iif(%n != $nick,%n $+ 's) Item(s): $iif(%i,$v1,N/A)
      }
      if (%1 == detonate) _msg $nick $del_gundam($nick,$$2)
      if (%1 == toss) _msg $nick $del_weapon($nick,$$2)
      if (%1 == install) _msg $nick $install_weapon($nick,$iif($3,$$2,$u.cgund($nick)),$iif($3,$3,$$2))
      if (%1 == uninstall) _msg $nick $uninstall_weapon($nick,$iif($3,$$2,$u.cgund($nick)),$iif($3 || !$u.cgund($nick),$3,$$2) )
    }
  }
}

; Statistical Gundam info
alias g.power return $readini(gundams.ini,$1,power)
alias g.agil return $readini(gundams.ini,$1,agility)
alias g.armor return $readini(gundams.ini,$1,armor)
; FOR G GUNDAMS ONLY.
; alias g.spec return $readini(gundams.ini,$1,specials)
alias g.hp return $readini(gundams.ini,$1,hp)
alias g.price return $readini(gundams.ini,$1,price)
alias g.weap return $readini(gundams.ini,$1,weapons)
alias g.wmax return $readini(gundams.ini,$1,weaponmax)
alias g.logo return $readini(gundams.ini,$1,logo)
; End 

; Statistical USER-GUNDAM info
alias ug.power return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.power))
alias ug.agil return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.agility))
alias ug.armor return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.armor))
alias ug.hp return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.hp))
alias ug.fhp return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.fhp))
; FOR G GUNDAMS ONLY.
; alias ug.spec return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.specials))
alias ug.kills return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.kills))
alias ug.logo return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.logo))
alias ug.weap return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.weapons))
alias ug.wmax return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.weaponmax))
alias ug.shield return $hget($1,$+($iif(!$2,$u.cgund($1),$2),.shield))
; Installed Weapon info
alias ugi.damage return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.damage))
alias ugi.rate return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.rate))
alias ugi.full return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.full))
alias ugi.type return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.type))
alias ugi.clip return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.clip))
alias ugi.prot return $hget($1,$+($iif(!$3,$u.cgund($1),$2),.,$iif($3,$3,$2),.protect))
; End

; Statistical Weapon info
alias i.price return $readini(weapons.ini,$1,price)
alias i.damage return $readini(weapons.ini,$1,damage)
alias i.rate return $readini(weapons.ini,$1,rate)
alias i.full return $readini(weapons.ini,$1,full)
alias i.type return $readini(weapons.ini,$1,type)
alias i.prot return $readini(weapons.ini,$1,protect)
; End

; Statistical Item info
alias x.price return $readini(items.ini,$1,price)
alias x.inc return $readini(items.ini,$1,increase)
alias x.istat return $readini(items.ini,$1,incstat)
alias x.pstat return $readini(items.ini,$1,percof)
; End

; Statistical USER-WEAPON info
/*
alias ui.damage return $hget($1,$+($2,.damage))
alias ui.rate return $hget($1,$+($2,.rate))
alias ui.full return $hget($1,$+($2,.full))
alias ui.type return $hget($1,$+($2,.type))
alias ui.clip return $hget($1,$+($2,.clip))
*/
alias ui.type return $hget($1,$+($2,.type))
alias ui.total return $hget($1,$+($2,.total))
alias ui.avail return $hget($1,$+($2,.available))
alias ui.gund return $hget($1,$+($2,.gundams))
; End

; Statistical USER-ITEM info
alias ux.inc return $hget($1,$+($2,.increase))
alias ux.istat return $hget($1,$+($2,.incstat))
alias ux.pstat return $hget($1,$+($2,.percof))
alias ux.total return $hget($1,$+($2,.total))
; End


alias _shoot {
  if ($istok(%fighting,$1,32)) {
    if ($istok(%fighting,$2,32)) {
      if ($istok($ug.weap($1),$3,44)) {
        if ($ugi.clip($1,$3) > 0) {
          if (!$timer( $($+(shoot.,$1,.,$3),2) )) {
            if (!$ug.shield($1)) {
              var %rate = $ugi.rate($1,$3),%dmg = $ugi.damage($1,$3),%n = 1,%shots = $r(1,%rate),%hits,%rand
              if ($ugi.clip($1,$3) < %shots) var %shots = $ugi.clip($1,$u.cgund($1),$3)
              while (%n <= %shots) { if ($r(1,4) != 4) inc %hits | inc %rand $r(5,20) | inc %n }
              hdec $1 $+($u.cgund($1),.,$3,.clip) %shots
              var %dmg = $calc(%dmg * %hits + %rand)
              if (%hits > 0) {
                ; Some output modification
                if ($3 == vulcan) var %out = Vulcan cannons
                else var %out = $3
                ; End of
                var %per = $_per($ug.hp($2),%dmg)
                if ($ug.shield($2)) {
                  var %sperc = $ugi.prot($2,$v1),%minus = $ceil($calc(%dmg * $+(.,%sperc)))
                  if (%minus > %dmg) var %minus = %dmg
                  var %end = $+(11,$chr(123),15) $+ $_nick($2) $+ 's $ug.shield($2) protects against11 %minus 15damage! $+ $+(11,$chr(125),15),%dmg = $calc(%dmg - %minus)
                }
                var %damage = $calc($ug.hp($2) - %dmg)
                if (%damage < 0) var %damage = 0
                hadd $2 $+($u.cgund($2),.hp) %damage
                amsgx * $_nick($1) fires their %out at $_nick($2) hitting $+(%hits,/,%shots) shot(s), doing04 %dmg $+ 15(04 $+ %per $+ % $+ 15) damage! %end
                _dcheck $1 $2
                .signal 107 $1 $2 $3
              }
              else amsgx ? $_nick($1) fires at $_nick($2) with their $3 and misses %shots shot(s)....
              $+(.timershoot.,$1,.,$3) 1 $r(5,10) _msg $1 You can use your $+(,$3,) again!
            }
            else _msg $nick You may not attack while using a shield.
          }
          else _msg $nick You cannot use your $+(,$3,) for $timer($+(shoot.,$1,.,$3)).secs seconds...
        }
        else _msg $1 Your $3 is out of Ammo
      }
      else _msg $1 You do not have a $3
    }
    else _msg $1 $qt($2) is not in combat 
  }
  else _msg $1 You must be in combat
}
alias _nick { 
  var %g = $u.cgund($1)
  if ($ug.logo($1)) var %g = $v1
  return $+($1,( $+ %g $+ ))
}
alias _slash {
  if ($istok(%fighting,$1,32)) {
    if ($istok(%fighting,$2,32)) {
      if ($istok($ug.weap($1),$3,44)) {
        if (!$timer( $($+(slash.,$1,.,$3),2) )) {
          if (!$ug.shield($1)) {
            var %rand = $r(10,30)
            var %attack = $calc(($ug.power($1) / 2) + ($ug.agil($1)) + $ugi.damage($1,$3) + %rand)
            if (%attack > $ug.armor($2)) {
              var %dmg = $calc(%attack - $ug.armor($2)),%g = $u.cgund($2),%damage = $calc($ug.hp($2) - %dmg)
              var %per = $_per($ug.hp($2),%dmg)
              if ($ug.shield($2)) {
                var %sperc = $ugi.prot($2,$v1),%minus = $ceil($calc(%dmg * $+(.,%sperc)))
                if (%minus > %dmg) var %minus = %dmg
                var %end = $+(11,$chr(123),15) $+ $_nick($2) $+ 's $ug.shield($2) protects against11 %minus 15damage! $+ $+(11,$chr(125),15),%dmg = $calc(%dmg - %minus)
              }
              var %damage = $calc($ug.hp($2) - %dmg)
              if (%damage < 0) var %damage = 0
              hadd $2 $+($u.cgund($2),.hp) %damage
              amsgx * $_nick($1) slashes $_nick($2) with their $3 doing04 %dmg $+ 15(04 $+ %per $+ % $+ 15) damage! %end
              _dcheck $1 $2
              .signal 107 $1 $2 $3
            }
            else amsgx ? $_nick($1) strikes at $_nick($2) with their $3 but misses....
            $+(.timerslash.,$1,.,$3) 1 $r(5,10) _msg $1 You can use your $+(,$3,) again!
          }
          else _msg $1 You cannot attack while using a shield.
        }
        else _msg $1 You cannot use your $+(,$3,) for $timer($+(slash.,$1,.,$3)).secs seconds...
      }
      else _msg $1 You do not have a $3
    }
    else _msg $1 $qt($2) is not in combat
  }
  else _msg $1 You must be in combat
}
alias _shield {
  if ($istok(%fighting,$1,32)) {
    if ($istok($ug.weap($1),$2,44)) {
      if ($ug.shield($1) != $2) {
        hadd $1 $+($u.cgund($1),.shield) $2
        amsgx ! $_nick($1) defends with their $2 protecting11 $ugi.prot($1,$2) $+ $chr(37) 15of damage!       
      }
      else {
        hdel $1 $+($u.cgund($1),.shield) $2
        amsgx ! $_nick($1) has lifted their $2 $+ !
      }
    }
    else _msg $1 You do not have a $3
  }
}
alias _item {
  if ($istok($u.gunds($1),$2,44)) {
    var %i = $3,%e = $4
    if ($istok($u.items($1),$3,44)) {
      if ($ux.total($1,$3) >= 1) {
        var %p = $iif(!$4,$hget($1,$+($2,.,$ux.pstat($1,%i))),$hget($1,$+($2,.,%e,.,$ux.pstat($1,%i))))
        var %_i = $iif(!$4,$hget($1,$+($2,.,$ux.istat($1,%i))),$hget($1,$+($2,.,%e,.,$ux.istat($1,%i))))
        var %item = $iif(!$4,$+($2,.,$ux.istat($1,%i)),$+($2,.,$4,.,$ux.istat($1,%i)))
        if (%p) {
          var %uxi = $iif($ux.inc($1,$3) == 100,1,$+(.,$v1))       
          var %per = $ceil($calc(%p * %uxi))
          if (%p < %per) var %per = %p
          var %ptotal = $calc(%per + %_i)
          if (%ptotal < %p) var %ptotal = %p
        }
        else var %ptotal = $calc($ux.inc($1,$3) + $hget($1,%item))
        hadd $1 %item %ptotal
        hdec $1 $+(%i,.total)
        var %chr = $iif($ux.pstat($1,$3),$chr(37))
        _msg $nick The $ux.istat($1,$3) for $iif($4,$2 $+ 's %e,$2) grew by %per $+ (07 $+ $ux.inc($1,%i) $+ %chr $+ 15) points!
        if ($ux.total($1,$3) <= 0) del_item $1 $3
      }
      else _msg $1 You do not have anymore $3 $+ 's
    }
    else _msg $1 You do not have a $3
  }
  else _msg $1 You do not have the $2
}
alias _punch {
  if ($istok(%fighting,$1,32)) {
    if ($istok(%fighting,$2,32)) {
      var %addition = $r(10,30),%attack = $calc($ug.power($1) + %addition)
      if (%attack > $ug.armor($2)) {
        var %dmg = $calc(%attack - $ug.armor($2)),%g = $u.cgund($2),%per = $_per($ug.fhp($2),%dmg)
        hadd $2 $+(%g,.hp) $calc($ug.hp($2) - %dmg)
        amsgx * $_nick($1) $+ 's fist crashes into $_nick($2) $+ 's domepiece doing %dmg $+ ( $+ %per $+ % $+ ) damage!
        _dcheck $1 $2
      }
      else amsgx ? $_nick($1) punches... and misses $_nick($2) $+ ...
    }
    else _msg $1 $qt($2) is not in combat.
  }
  else _msg $1 You must be in combat to attack.
}
alias _dcheck {
  if ($ug.hp($2) <= 0) {
    hadd $2 $+($u.cgund($2),.hp) $ug.fhp($2)
    hinc $1 kills
    hinc $1 $+($u.cgund($1),.kills)
    var %money = $r(500,3000) 
    hinc $1 money %money
    hdel $2 $+($u.cgund($2),.shield) 
    amsgx * $_nick($1) has defeated $_nick($2) $+ ! $+(+,$chr(36),%money)
    set %fighting $remtok(%fighting,$2,32)
    if ($hget($2,name) == NPC) npc_destroy $2 Defeated by $1
    .signal -n 104 $2 $1
  }
}
alias add_item {
  if ($hget($1)) {
    if ($ini(items.ini,$2)) {
      if (!$hfind($1,$+($2,.*),0,w)) {
        var %c = hadd $1 $+($2,.)
        %c $+ total 1
        %c $+ increase $x.inc($2)
        %c $+ incstat $x.istat($2)
        %c $+ percof $x.pstat($2)
        hadd $1 items $addtok($u.items($1),$2,44)
        return Successfully added new item $qt($2)
      }
      else { 
        hinc $1 $+($2,.total)
        return Successfully added another $qt($2)
      }
    }
    else return Invalid item
  }
  else return $1 is not registered
}
alias del_item {
  if ($istok($u.items($1),$2,44)) {
    hdel -w $1 $+($2,.*)
    hadd $1 items $remtok($u.items($1),$2,1,44)
    return Successfully deleted item $qt($2)
  }
  else return No such weapon $qt($2)
}
alias add_weapon {
  if ($hget($1)) {
    if ($ini(weapons.ini,$2)) {
      if (!$hfind($1,$+($2,.*),0,w)) {
        var %c = hadd $1 $+($2,.)
        %c $+ total 1
        %c $+ type $i.type($2)
        %c $+ available 1
        hadd $1 weapons $addtok($u.weap($1),$2,44)
        return Successfully added weapon
      }
      else { 
        hinc $1 $+($2,.available)
        hinc $1 $+($2,.total) 
        return Successfully added weapon
      }
    }
    else return Invalid weapon
  }
  else return $1 is not registered
}
alias del_weapon {
  if ($istok($u.weap($1),$2,44)) {
    var %n = 1
    while ($gettok($ui.gund($1,$2),%n,44)) {
      echo -a $uninstall_weapon($1,$v1,$2) 
      inc %n
    }
    hdel -w $1 $+($2,.*)
    hadd $1 weapons $remtok($u.weap($1),$2,1,44)
    return Successfully deleted weapon $2
  }
  else return No such weapon $qt($2)
}
alias install_weapon {
  if ($hget($1)) {
    if (!$istok($ug.weap($1,$2),$3,32)) { 
      if ($ui.avail($1,$3) >= 1) {
        if ($numtok($ug.weap($1,$2),44) < $ug.wmax($1,$2)) {
          var %c = hadd $1 $+($2,.,$3,.),%n = 1
          while ($ini(weapons.ini,$$3,%n)) {
            var %v1 = $v1
            if (%v1 != Price) %c $+ %v1 $readini(weapons.ini,$3,%v1)
            inc %n
          }
          hadd $1 $+($2,.weapons) $addtok($ug.weap($1,$2),$3,44)
          hdec $1 $+($3,.available) 1
          hadd $1 $+($3,.gundams) $addtok($ui.gund($1,$3),$2,44)
          return Successfully installed $qt($3) to $2 $+ .
        }
        else return Too many weapons installed!
      }
      else return No more available $3 $+ s
    }
    else return Weapon is already installed to $2
  }
  else return $1 is not registered
}
alias uninstall_weapon {
  if ($hget($1)) {
    if ($istok($u.gunds($1),$2,32)) {
      if ($istok($ui.gund($1,$3),$2,44)) {
        hdel -w $1 $+($2,.,$3,.*) 
        hadd $1 $+($2,.weapons) $remtok($ug.weap($1,$2),$3,44)
        hadd $1 $+($3,.gundams) $remtok($ui.gund($1,$3),$2,44)
        hinc $1 $+($3,.available)
        return Successfully uninstalled $qt($3) from $2 $+ .
      }
      else return $qt($3) is not installed on $2 $+ !
    }
    else return Invalid Gundam
  }
  else return $1 is not registered
}
alias add_gundam {
  if ($hget($1)) {
    if ($ini(gundams.ini,$2)) {
      hadd $1 gundams $addtok($u.gunds($1),$2,44)
      var %c = hadd $1 $+($2,.)
      %c $+ power $g.power($2)    
      %c $+ agility $g.agil($2)
      %c $+ armor $g.armor($2)
      ; For G Gundam Only
      ; %c $+ specials $g.spec($2)
      %c $+ hp $g.hp($2)
      %c $+ fhp $g.hp($2)
      %c $+ kills 0
      %c $+ weaponmax $g.wmax($2)
      %c $+ weapons $g.weap($2)
      if ($g.logo($2)) %c $+ logo  $+ $v1
      var %n = 1
      while ($gettok($g.weap($2),%n,44)) {
        var %w = $v1
        add_weapon $1 %w
        install_weapon $1 $2 %w   
        inc %n
      }
      return Successfully added Gundam                
    }
    else return Invalid Gundam
  }
  else return $1 is not registered
}
alias del_gundam {
  if ($hget($1)) {
    if ($istok($u.gunds($1),$2,44)) {
      var %ug = $ug.weap($1,$2),%n = 1
      if (%n) && (%ug) {
        while (%n <= $numtok(%ug,44)) {
          uninstall_weapon $1 $2 $gettok(%ug,%n,44)
          inc %n
        }
      }
      hdel -w $1 $+($2,.*) 
      hadd $1 gundams $remtok($u.gunds($1),$2,44)
      if ($u.cgund($1) == $2) hdel $1 currentgundam
      return Mobile Suit $2 has been blown up!
    }
    else return Invalid Gundam
  }
  else return $1 is not registered
}
alias _stats {
  if ($hget($2)) {
    var %cg = $u.cgund($2),%m = $+($chr(36),$bytes($u.mon($2),db))
    _msg $1 (Stats) $iif($2 != $1,Name: $2) $iif(%cg,Current Gundam: %cg) Money: %m
  }
  else _msg $1 (Stats) Syntax: !stats [nick]; [nick] is optional
}
alias _gstats {
  var %n = $iif($hget($2),$2,$1),%g = $iif(%n == $2,$3,$2)
  if (!%g) var %g = $u.cgund(%n)
  if ($istok($u.gunds(%n),%g,44)) {
    var %hp = $ug.hp(%n,%g),%fhp = $ug.fhp(%n,%g),%p = $ug.power(%n,%g),%a = $ug.armor(%n,%g),%ag = $ug.agil(%n,%g),%k = $ug.kills(%n,%g)
    var %wmax = $ug.wmax(%n,%g),%watm = $numtok($ug.weap(%n,%g),44),%wout = $iif($u.perc($1),$_per(%wmax,%watm) $+ %,$+(%watm,/,%wmax))
    var %shield = $iif($ug.shield(%n,%g),Shield: $ugi.prot(%n,%g,$v1) $+ $chr(37)),%logo = $iif($ug.logo(%n,%g),Logo: $v1)
    _msg $1 (GStats) $iif(!%logo,Name: %g,%logo) Kills: %k %shield HP: $iif($u.perc($1),$_per(%fhp,%hp) $+ %,$+(%hp,/,%fhp)) Weapons: %wout Power: %p Armor: %a Agility: %ag 
  }
  else _msg $1 (GStats) Syntax: !gstats [nick] [gundam]; Both the [nick] and [gundam] are optional.
}
alias _wstats {
  var %n = $iif($hget($2),$2,$1),%w = $iif(%n == $2,$3,$2)
  if ($istok($u.weap(%n),%w,44)) {
    var %dmg = $ugi.damage(%n,%w)
    if ($ugi.type(%n,%w) == Gun) {
      var %rate = $ugi.rate(%n,%w),%clip = $ugi.clip(%n,%w),%full = $ugi.full(%n,%w),%ins = $replace($ui.gund(%n,%w),$chr(44),/)
      _msg $1 (WStats) Name: %w Damage: %dmg Clip: $iif($u.perc($1),$_per(%full,%clip) $+ %,$+(%clip,/,%full)) Rate: %rate $iif(%ins,Installed: %ins)
    }
    elseif ($ugi.type(%n,%w) == Sword) {
      _msg $1 (WStats) Name: %w Damage: %dmg
    }
    elseif ($ugi.type(%n,%w) == Shield) {
      _msg $1 (WStats) Name: %w Protection: $ugi.prot(%n,%w) $+ $chr(37) $iif($ug.shield(%n) == %w,( $+ In Use! $+ ))
    }
  }
  else _msg $1 (WStats) Syntax: !wstats [nick] <weapon>; [nick] is optional
}
alias _per {
  return $ceil($calc($2 * $+(.,$1)))
}
