Guest User

Untitled

a guest
Sep 24th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 29.24 KB | None | 0 0
  1. ; Shop commands here (list, buy, etc)
  2.  
  3. on 2:TEXT:!shop*:*: { $set_chr_name($nick)
  4.   unset %shop.list
  5.   if ($2 = $null) { $gamehelp(Shop, $nick)  | halt  }
  6.   if ($2 = level) { .msg $nick 2Your current shop level is $readini($char($nick), stuff, shoplevel) | halt }
  7.  
  8.   if (($2 = buy) || ($2 = purchase)) {
  9.     if (%battleis = on) {
  10.       if ($nick isin $readini(battle2.txt, Battle, List)) { .msg $nick 4Error: You must wait til you're out of battle to use the shop. | halt }
  11.     }
  12.  
  13.     if ($3 = $null) { .msg $nick 4Error: Use !shop buy <items/techs/skills/stats/weapons> <what to buy>  }
  14.     if (($3 = items) || ($3 = item))  { $shop.items($nick, buy, $4, $5) | halt }
  15.     if (($3 = techs) || ($3 = techniques)) { $shop.techs($nick, buy, $4, $5) | halt  }
  16.     if (($3 = skills) || ($3 = skill)) { $shop.skills($nick, buy, $4, $5) | halt  }
  17.     if (($3 = stats) || ($3 = stat))  { $shop.stats($nick, buy, $4, $5) | halt }
  18.     if (($3 = weapons) || ($3 = weapon)) { $shop.weapons($nick, buy, $4, $5) }
  19.     if ($3 = orbs) { $shop.orbs($nick, buy) }
  20.     else { .msg $nick 4Error: Use !shop list <items/techs/skills/stats/weapons/orbs>  or !shop buy <items/techs/skills/stats/weapons> <what to buy>  | halt }
  21.   }
  22.  
  23.   if ($2 = list) {
  24.     if (($3 = stats) || ($3 = stat)) { $shop.stats($nick, list) }
  25.     if (($3 = items) || ($3 = item)) { $shop.items($nick, list) }
  26.     if (($3 = techs) || ($3 = techniques))  { $shop.techs($nick, list) }
  27.     if (($3 = skills) || ($3 = skill)) { $shop.skills($nick, list) }
  28.     if (($3 = weapons) || ($3 = weapon)) { $shop.weapons($nick, list) }
  29.     if ($3 = orbs) { $shop.orbs($nick, list) }
  30.   }
  31.   else { .msg $nick 4Error: Use !shop list <items/techs/skills/stats/weapons/orbs>  or !shop buy <items/techs/skills/stats/weapons> <what to buy> | halt }
  32.  
  33. }
  34.  
  35.  
  36. alias shop.items {
  37.   if ($2 = list) {
  38.     ; get the list of all the shop items..
  39.  
  40.     ; CHECKING HEALING ITEMS
  41.     unset %shop.list
  42.     var %healing.items $readini(items.db, items, HealingItems)
  43.     var %number.of.items $numtok(%healing.items, 46)
  44.  
  45.     var %value 1
  46.     while (%value <= %number.of.items) {
  47.       set %item.name $gettok(%healing.items, %value, 46)
  48.       set %item.price $readini(items.db, %item.name, cost)
  49.       %shop.list = $addtok(%shop.list, $+ %item.name $+ ( $+ %item.price $+ ),46)
  50.       inc %value 1
  51.     }
  52.  
  53.     if (%shop.list != $null) {  $shop.cleanlist
  54.       /.timerHealingItems $+ $nick 1 1 /.msg $nick 2Healing Items: %shop.list
  55.     }
  56.  
  57.     ; CHECKING BATTLE ITEMS
  58.     unset %shop.list | unset %item.name | unset %item_amount | unset %number.of.items | unset %value | unset %item.price
  59.     var %battle.items $readini(items.db, items, BattleItems)
  60.     var %number.of.items $numtok(%battle.items, 46)
  61.  
  62.     var %value 1
  63.     while (%value <= %number.of.items) {
  64.       set %item.name $gettok(%battle.items, %value, 46)
  65.       set %item.price $readini(items.db, %item.name, cost)
  66.       %shop.list = $addtok(%shop.list, $+ %item.name $+ ( $+ %item.price $+ ),46)
  67.       inc %value 1
  68.     }
  69.  
  70.     if (%shop.list != $null) {  $shop.cleanlist
  71.       /.timerBattleItems $+ $nick 1 1 /.msg $nick 2Battle Items: %shop.list
  72.     }
  73.  
  74.     ; CHECKING CONSUMABLE ITEMS
  75.     unset %shop.list | unset %item.name | unset %item_amount | unset %number.of.items | unset %value | unset %item.price | unset %consume.items
  76.     var %consume.items $readini(items.db, items, ConsumeItems)
  77.     var %number.of.items $numtok(%consume.items, 46)
  78.  
  79.     var %value 1
  80.     while (%value <= %number.of.items) {
  81.       set %item.name $gettok(%consume.items, %value, 46)
  82.       set %item.price $readini(items.db, %item.name, cost)
  83.       %shop.list = $addtok(%shop.list, $+ %item.name $+ ( $+ %item.price $+ ),46)
  84.       inc %value 1
  85.     }
  86.  
  87.     if (%shop.list != $null) {  $shop.cleanlist
  88.       /.timerConsumeItems $+ $nick 1 1 /.msg $nick 2Items Used For Skills: %shop.list
  89.     }
  90.  
  91.     unset %item.price | unset %item.name
  92.   }
  93.  
  94.   if (($2 = buy) || ($2 = purchase)) {
  95.     ; is it a valid item?
  96.     if ($readini(items.db, $3, type) = $null) { .msg $nick 4Error: Invalid item. Use! !shop list items to get a valid list | halt }
  97.  
  98.     ; do you have enough to buy it?
  99.     var %player.redorbs $readini($char($1), stuff, redorbs)
  100.     var %total.price $readini(items.db, $3, cost)
  101.       if ( $4 isnum && $4 > 1 ) { var %amount $4 }
  102.       else { var %amount 1 }
  103.    
  104.     while ( %amount > 0 ) {
  105.         if (%player.redorbs < %total.price) { .msg $nick 4You do not have enough red orbs to purchase this item! | halt }
  106.  
  107.         ; if so, increase the amount and add the item
  108.         var %player.items $readini($char($1), Item_Amount, $3)
  109.         inc %player.items 1
  110.         writeini $char($1) Item_Amount $3 %player.items
  111.  
  112.         ; decrease amount of orbs you have.
  113.         dec %player.redorbs %total.price
  114.         writeini $char($1) stuff redorbs %player.redorbs
  115.  
  116.         .msg $nick 3You spend %total.price  $+ $readini(system.dat, system, currency) for 1 $3 $+ !
  117.         $inc.redorbsspent($1, %total.price)
  118.     }
  119.   }
  120. }
  121.  
  122. alias shop.techs {
  123.   if ($2 = list) {
  124.     unset %shop.list
  125.     ; get the list of the techs for the weapon you have equipped
  126.     $weapon_equipped($1)
  127.     var %shop.level $readini($char($1), stuff, shoplevel)
  128.  
  129.     ; CHECKING TECHS
  130.     unset %shop.list
  131.     set %tech.list $readini(weapons.db, %weapon.equipped, Abilities)
  132.     var %number.of.items $numtok(%tech.list, 46)
  133.  
  134.     var %value 1
  135.     while (%value <= %number.of.items) {
  136.       set %tech.name $gettok(%tech.list, %value, 46)
  137.       set %tech.price $round($calc(%shop.level * $readini(techniques.db, %tech.name, cost)),0)
  138.       %shop.list = $addtok(%shop.list, $+ %tech.name $+ +1 ( $+ %tech.price $+ ),46)
  139.       inc %value 1
  140.     }
  141.  
  142.     ; display the list with the prices.
  143.     $shop.cleanlist
  144.     .msg $nick 2Stat Prices in $readini(system.dat, system, currency) $+ : %shop.list
  145.   }
  146.  
  147.   if (($2 = buy) || ($2 = purchase)) {
  148.     ; is it a valid tech?
  149.     $weapon_equipped($1)
  150.     if ($3 !isin $readini(weapons.db, %weapon.equipped, abilities)) { .msg $nick 4Error: Invalid item. Use! !shop list techs to get a valid list | halt }
  151.  
  152.     var %shop.level $readini($char($1), stuff, shoplevel)
  153.     ; do you have enough to buy it?
  154.     var %player.redorbs $readini($char($1), stuff, redorbs)
  155.       if ( $4 isnum && $4 > 1 ) { var %amount $4 }
  156.       else { var %amount 1 }
  157.    
  158.     while ( %amount > 0 ) {
  159.         var %total.price $round($calc(%shop.level * $readini(techniques.db, $3, cost)),0)
  160.  
  161.         if (%player.redorbs < %total.price) { .msg $nick 4You do not have enough $readini(system.dat, system, currency) to purchase this item! | halt }
  162.  
  163.         ; if so, increase the amount and add it to the list
  164.         var %current.techlevel $readini($char($1), techniques, $3))
  165.         inc %current.techlevel 1
  166.         writeini $char($1) techniques $3 %current.techlevel
  167.  
  168.         .msg $nick 3You spend %total.price  $+  $readini(system.dat, system, currency) for +1 to your $3 technique $+ !
  169.  
  170.         ; decrease amount of orbs you have.
  171.         dec %player.redorbs %total.price
  172.         writeini $char($1) stuff redorbs %player.redorbs
  173.         $inc.redorbsspent($1, %total.price)
  174.  
  175.         ; Increase the shop level.
  176.         $inc.shoplevel($1)
  177.     }
  178.   }
  179. }
  180.  
  181. alias shop.skills {
  182.   unset %shop.list.activeskills | unset %shop.list.passiveskills | unset %shop.list.resistanceskills
  183.   if ($2 = list) {
  184.     ; get the list of the skills
  185.     var %shop.level $readini($char($1), stuff, shoplevel)
  186.  
  187.     ; CHECKING PASSIVE SKILLS
  188.     unset %shop.list | unset %skill.list
  189.     set %skill.list $readini(skills.db, Skills, PassiveSkills)
  190.     var %number.of.items $numtok(%skill.list, 46)
  191.  
  192.     var %value 1
  193.     while (%value <= %number.of.items) {
  194.       set %skill.name $gettok(%skill.list, %value, 46)
  195.       set %skill.max $readini(skills.db, %skill.name, max)
  196.       set %skill.have $readini($char($1), skills, %skill.name)
  197.  
  198.       if (%skill.have >= %skill.max) { inc %value 1 }
  199.       else {
  200.         set %skill.price $round($calc(%shop.level * $readini(skills.db, %skill.name, cost)),0)
  201.         %shop.list.passiveskills = $addtok(%shop.list.passiveskills, $+ %skill.name $+ +1 ( $+ %skill.price $+ ),46)
  202.         inc %value 1
  203.       }
  204.     }
  205.  
  206.     set %replacechar $chr(044) $chr(032) |  %shop.list.passiveskills = $replace(%shop.list.passiveskills, $chr(046), %replacechar)
  207.  
  208.     ; CHECKING ACTIVE SKILLS
  209.     unset %skill.list | unset %value
  210.     set %skill.list $readini(skills.db, Skills, ActiveSkills)
  211.     var %number.of.items $numtok(%skill.list, 46)
  212.  
  213.     var %value 1
  214.     while (%value <= %number.of.items) {
  215.       set %skill.name $gettok(%skill.list, %value, 46)
  216.       set %skill.max $readini(skills.db, %skill.name, max)
  217.       set %skill.have $readini($char($1), skills, %skill.name)
  218.  
  219.       if (%skill.have >= %skill.max) { inc %value 1 }
  220.       else {
  221.         set %skill.price $round($calc(%shop.level * $readini(skills.db, %skill.name, cost)),0)
  222.         %shop.list.activeskills = $addtok(%shop.list.activeskills, $+ %skill.name $+ +1 ( $+ %skill.price $+ ),46)
  223.         inc %value 1
  224.       }
  225.     }
  226.  
  227.     set %replacechar $chr(044) $chr(032) |  %shop.list.activeskills = $replace(%shop.list.activeskills, $chr(046), %replacechar)
  228.  
  229.     ; CHECKING RESISTANCES
  230.     unset %skill.list | unset %value
  231.     set %skill.list $readini(skills.db, Skills, Resists)
  232.     var %number.of.items $numtok(%skill.list, 46)
  233.  
  234.     var %value 1
  235.     while (%value <= %number.of.items) {
  236.       set %skill.name $gettok(%skill.list, %value, 46)
  237.       set %skill.max $readini(skills.db, %skill.name, max)
  238.       set %skill.have $readini($char($1), skills, %skill.name)
  239.  
  240.       if (%skill.have >= %skill.max) { inc %value 1 }
  241.       else {
  242.         set %skill.price $round($calc(%shop.level * $readini(skills.db, %skill.name, cost)),0)
  243.         %shop.list.resistanceskills = $addtok(%shop.list.resistanceskills, $+ %skill.name $+ +1 ( $+ %skill.price $+ ),46)
  244.         inc %value 1
  245.       }
  246.     }
  247.  
  248.     set %replacechar $chr(044) $chr(032) |  %shop.list.resistanceskills = $replace(%shop.list.resistanceskills, $chr(046), %replacechar)
  249.  
  250.     ; display the list with the prices.
  251.     if (%shop.list.activeskills != $null) {  .msg $nick 2Active Skill Prices in $readini(system.dat, system, currency) $+ : %shop.list.activeskills }
  252.     if (%shop.list.passiveskills != $null) {  .msg $nick 2Passive Skill Prices in $readini(system.dat, system, currency) $+ : %shop.list.passiveskills }
  253.     if (%shop.list.resistanceskills != $null) {  .msg $nick 2Resistance Skill Prices in $readini(system.dat, system, currency) $+ : %shop.list.resistanceskills }
  254.  
  255.     unset %shop.list.activeskills | unset %shop.list.passiveskills | unset %shop.list.resistanceskills
  256.   }
  257.  
  258.  
  259.   if (($2 = buy) || ($2 = purchase)) {
  260.     ; is it a valid skill?
  261.     if ($readini(skills.db, $3, type) = $null) { .msg $nick 4Error: Invalid item. Use! !shop list skills to get a valid list | halt }
  262.  
  263.     var %shop.level $readini($char($1), stuff, shoplevel)
  264.     ; do you have enough to buy it?
  265.     var %player.redorbs $readini($char($1), stuff, redorbs)
  266.       if ( $4 isnum && $4 > 1 ) { var %amount $4 }
  267.       else { var %amount 1 }
  268.    
  269.     while ( %amount > 0 ) {
  270.         var %total.price $round($calc(%shop.level * $readini(skills.db, $3, cost)),0)
  271.  
  272.         if (%player.redorbs < %total.price) { .msg $nick 4You do not have enough $readini(system.dat, system, currency) to purchase this item! | halt }
  273.  
  274.         ; if so, increase the amount and add it to the list
  275.         var %current.skilllevel $readini($char($1), skills, $3))
  276.         var %max.skilllevel $readini(skills.db, $3, max)
  277.         if (%max.skilllevel = $null) { var %max.skilllevel 100000 }
  278.         if (%current.skilllevel = %max.skilllevel) { .msg $nick 4You cannot buy any more levels into this skill as you've hit the max amount. | halt }
  279.  
  280.         inc %current.skilllevel 1
  281.         writeini $char($1) skills $3 %current.skilllevel
  282.  
  283.         .msg $nick 3You spend %total.price  $+ $readini(system.dat, system, currency) for +1 to your $3 skill $+ !
  284.  
  285.         ; decrease amount of orbs you have.
  286.         dec %player.redorbs %total.price
  287.         writeini $char($1) stuff redorbs %player.redorbs
  288.         $inc.redorbsspent($1, %total.price)
  289.  
  290.         ; Increase the shop level.
  291.         $inc.shoplevel($1)
  292.     }
  293.   }
  294. }
  295.  
  296. alias shop.stats {
  297.   if ($2 = list) {
  298.     ; get the list of all the shop items..
  299.     var %shop.level $readini($char($1), stuff, shoplevel)
  300.     var %hp.price $round($calc(%shop.level * $readini(system.dat, statprices, hp)),0)
  301.     var %tp.price $round($calc(%shop.level * $readini(system.dat, statprices, tp)),0)
  302.     var %str.price $round($calc(%shop.level * $readini(system.dat, statprices, str)),0)
  303.     var %def.price $round($calc(%shop.level * $readini(system.dat, statprices, def)),0)
  304.     var %int.price $round($calc(%shop.level * $readini(system.dat, statprices, int)),0)
  305.     var %spd.price $round($calc(%shop.level * $readini(system.dat, statprices, spd)),0)
  306.     %shop.list = $addtok(%shop.list,HP+50 ( $+ %hp.price $+ ),46)
  307.     %shop.list = $addtok(%shop.list,TP+5 ( $+ %tp.price $+ ),46)
  308.     %shop.list = $addtok(%shop.list,Str+1 ( $+ %str.price $+ ),46)
  309.     %shop.list = $addtok(%shop.list,Def+1 ( $+ %def.price $+ ),46)
  310.     %shop.list = $addtok(%shop.list,Int+1 ( $+ %int.price $+ ),46)
  311.     %shop.list = $addtok(%shop.list,Spd+1 ( $+ %spd.price $+ ),46)
  312.  
  313.     ; display the list with the prices.
  314.     $shop.cleanlist
  315.     .msg $nick 2Stat Prices in $readini(system.dat, system, currency) $+ : %shop.list
  316.   }
  317.  
  318.   if (($2 = buy) || ($2 = purchase)) {
  319.     ; is it a valid item?
  320.     if ($readini(system.dat, statprices, $3) = $null) { .msg $nick 4Error: Invalid stat! Use! !shop list stats to get a valid list | halt }
  321.  
  322.     ; do you have enough to buy it?
  323.     var %shop.level $readini($char($1), stuff, shoplevel)
  324.     var %player.redorbs $readini($char($1), stuff, redorbs)
  325.       if ( $4 isnum && $4 > 1 ) { var %amount $4 }
  326.       else { var %amount 1 }
  327.    
  328.     while ( %amount > 0 ) {
  329.         var %total.price $round($calc(%shop.level * $readini(system.dat, statprices, $3)),0)
  330.  
  331.         if (%player.redorbs < %total.price) { .msg $nick 4You do not have enough $readini(system.dat, system, currency) to purchase this upgrade! | halt }
  332.  
  333.         ; if so, increase the amount and add the stat bonus
  334.         var %basestat.to.increase $readini($char($1), basestats, $3)
  335.         set %shop.statbonus 0
  336.  
  337.         if (($3 = str) || ($3 = def)) { set %shop.statbonus 1 }
  338.         if (($3 = int) || ($3 = spd)) { set %shop.statbonus 1 }
  339.         if ($3 = hp) { set %shop.statbonus 50  }
  340.         if ($3 = tp) { set %shop.statbonus 5 }
  341.  
  342.         inc %basestat.to.increase %shop.statbonus
  343.         writeini $char($1) basestats $3 %basestat.to.increase
  344.         $fulls($1)
  345.  
  346.         .msg $nick 3You spend %total.price  $+ $readini(system.dat, system, currency) for + $+ %shop.statbonus to your $3 $+ !
  347.  
  348.         ; decrease amount of orbs you have.
  349.         dec %player.redorbs %total.price
  350.         writeini $char($1) stuff redorbs %player.redorbs
  351.         $inc.redorbsspent($1, %total.price)
  352.         ; Increase the shop level.
  353.         $inc.shoplevel($1)
  354.     }
  355.   }
  356. }
  357.  
  358. alias shop.weapons {
  359.   if ($2 = list) {
  360.     .msg $nick 2New weapon prices are in Black Orbs.  Upgrades are listed in $readini(system.dat, system, currency)
  361.     unset %shop.list | unset %upgrade.list
  362.     ; get the list of the weapons.
  363.     var %shop.level $readini($char($1), stuff, shoplevel)
  364.  
  365.     ; CHECKING H2H
  366.     unset %shop.list | unset %weapon.list
  367.     set %weapon.list $readini(weapons.db, Weapons, HandToHand)
  368.     var %number.of.items $numtok(%weapon.list, 46)
  369.  
  370.     var %value 1
  371.     while (%value <= %number.of.items) {
  372.       set %weapon.name $gettok(%weapon.list, %value, 46)
  373.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  374.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  375.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  376.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  377.         inc %value 1
  378.       }
  379.       else {  
  380.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  381.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  382.         inc %value 1
  383.       }
  384.     }
  385.  
  386.     if (%shop.list != $null) {  $shop.cleanlist
  387.       /.timerH2H $+ $nick 1 1 /.msg $nick 2New Hand to Hand Weapons: %shop.list
  388.     }
  389.  
  390.     unset %shop.list
  391.  
  392.     ; CHECKING Swords
  393.     unset %weapon.list
  394.     set %weapon.list $readini(weapons.db, Weapons, Swords)
  395.     var %number.of.items $numtok(%weapon.list, 46)
  396.  
  397.     var %value 1
  398.     while (%value <= %number.of.items) {
  399.       set %weapon.name $gettok(%weapon.list, %value, 46)
  400.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  401.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  402.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  403.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  404.         inc %value 1
  405.       }
  406.       else {  
  407.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  408.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  409.         inc %value 1
  410.       }
  411.     }
  412.  
  413.     if (%shop.list != $null) {  $shop.cleanlist
  414.       /.timerSwords $+ $nick 1 1 /.msg $nick 2New Sword Weapons: %shop.list
  415.     }
  416.  
  417.     unset %shop.list
  418.  
  419.     ; CHECKING Whips
  420.     unset %weapon.list
  421.     set %weapon.list $readini(weapons.db, Weapons, Whips)
  422.     var %number.of.items $numtok(%weapon.list, 46)
  423.  
  424.     var %value 1
  425.     while (%value <= %number.of.items) {
  426.       set %weapon.name $gettok(%weapon.list, %value, 46)
  427.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  428.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  429.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  430.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  431.         inc %value 1
  432.       }
  433.       else {  
  434.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  435.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  436.         inc %value 1
  437.       }
  438.     }
  439.  
  440.     if (%shop.list != $null) {  $shop.cleanlist
  441.       /.timerWhips $+ $nick 1 1 /.msg $nick 2New Whip Weapons: %shop.list
  442.     }
  443.  
  444.     unset %shop.list
  445.  
  446.     ; CHECKING Guns
  447.     unset %weapon.list
  448.     set %weapon.list $readini(weapons.db, Weapons, Guns)
  449.     var %number.of.items $numtok(%weapon.list, 46)
  450.  
  451.     var %value 1
  452.     while (%value <= %number.of.items) {
  453.       set %weapon.name $gettok(%weapon.list, %value, 46)
  454.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  455.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  456.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  457.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  458.         inc %value 1
  459.       }
  460.       else {  
  461.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  462.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  463.         inc %value 1
  464.       }
  465.     }
  466.  
  467.     if (%shop.list != $null) {  $shop.cleanlist
  468.       /.timerGuns $+ $nick 1 1 /.msg $nick 2New Gun Weapons:  %shop.list
  469.     }
  470.  
  471.     unset %shop.list
  472.  
  473.     ; CHECKING Katanas
  474.     unset %weapon.list
  475.     set %weapon.list $readini(weapons.db, Weapons, Katanas)
  476.     var %number.of.items $numtok(%weapon.list, 46)
  477.  
  478.     var %value 1
  479.     while (%value <= %number.of.items) {
  480.       set %weapon.name $gettok(%weapon.list, %value, 46)
  481.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  482.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  483.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  484.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  485.         inc %value 1
  486.       }
  487.       else {  
  488.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  489.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  490.         inc %value 1
  491.       }
  492.     }
  493.  
  494.     if (%shop.list != $null) {  $shop.cleanlist
  495.       /.timerKatanas $+ $nick 1 1 /.msg $nick 2New Katana Weapons:  %shop.list
  496.     }
  497.  
  498.     unset %shop.list
  499.  
  500.     ; CHECKING Wands
  501.     unset %weapon.list
  502.     set %weapon.list $readini(weapons.db, Weapons, Wands)
  503.     var %number.of.items $numtok(%weapon.list, 46)
  504.  
  505.     var %value 1
  506.     while (%value <= %number.of.items) {
  507.       set %weapon.name $gettok(%weapon.list, %value, 46)
  508.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  509.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  510.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  511.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  512.         inc %value 1
  513.       }
  514.       else {  
  515.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  516.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  517.         inc %value 1
  518.       }
  519.     }
  520.  
  521.     if (%shop.list != $null) {  $shop.cleanlist
  522.       /.timerWands $+ $nick 1 1 /.msg $nick 2New Wand Weapons:  %shop.list
  523.     }
  524.  
  525.     unset %shop.list
  526.  
  527.     ; CHECKING Spears
  528.     unset %weapon.list
  529.     set %weapon.list $readini(weapons.db, Weapons, Spears)
  530.     var %number.of.items $numtok(%weapon.list, 46)
  531.  
  532.     var %value 1
  533.     while (%value <= %number.of.items) {
  534.       set %weapon.name $gettok(%weapon.list, %value, 46)
  535.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  536.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  537.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  538.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  539.         inc %value 1
  540.       }
  541.       else {  
  542.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  543.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  544.         inc %value 1
  545.       }
  546.     }
  547.  
  548.     if (%shop.list != $null) {  $shop.cleanlist
  549.       /.timerSpears $+ $nick 1 1 /.msg $nick 2New Spear Weapons: %shop.list
  550.     }
  551.  
  552.     unset %shop.list
  553.  
  554.     ; CHECKING Scythes
  555.     unset %weapon.list
  556.     set %weapon.list $readini(weapons.db, Weapons, Scythes)
  557.     var %number.of.items $numtok(%weapon.list, 46)
  558.  
  559.     var %value 1
  560.     while (%value <= %number.of.items) {
  561.       set %weapon.name $gettok(%weapon.list, %value, 46)
  562.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  563.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  564.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  565.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  566.         inc %value 1
  567.       }
  568.       else {  
  569.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  570.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  571.         inc %value 1
  572.       }
  573.     }
  574.  
  575.     if (%shop.list != $null) {  $shop.cleanlist
  576.       /.timerScythes $+ $nick 1 2 /.msg $nick 2New Scythe Weapons: %shop.list
  577.     }
  578.  
  579.     unset %shop.list
  580.  
  581.     ; CHECKING GreatSwords
  582.     unset %weapon.list
  583.     set %weapon.list $readini(weapons.db, Weapons, GreatSwords)
  584.     var %number.of.items $numtok(%weapon.list, 46)
  585.  
  586.     var %value 1
  587.     while (%value <= %number.of.items) {
  588.       set %weapon.name $gettok(%weapon.list, %value, 46)
  589.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  590.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  591.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  592.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  593.         inc %value 1
  594.       }
  595.       else {  
  596.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  597.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  598.         inc %value 1
  599.       }
  600.     }
  601.  
  602.     if (%shop.list != $null) {  $shop.cleanlist
  603.       /.timerGreatSwords $+ $nick 1 2 /.msg $nick 2New Great Sword Weapons: %shop.list
  604.     }
  605.  
  606.     unset %shop.list
  607.  
  608.     ; CHECKING Glyphs
  609.     unset %weapon.list
  610.     set %weapon.list $readini(weapons.db, Weapons, Glyphs)
  611.     var %number.of.items $numtok(%weapon.list, 46)
  612.  
  613.     var %value 1
  614.     while (%value <= %number.of.items) {
  615.       set %weapon.name $gettok(%weapon.list, %value, 46)
  616.       ; Does the player own this weapon?  If so, add it to the upgrade list.  If not,add it to the new weapon list.
  617.       if ($readini($char($1), weapons, %weapon.name) != $null) {
  618.         set %weapon.price $round($calc(%shop.level * $readini(weapons.db, %weapon.name, upgrade)),0)
  619.         %upgrade.list = $addtok(%upgrade.list, $+ %weapon.name $+ +1 ( $+ %weapon.price $+ ),46)
  620.         inc %value 1
  621.       }
  622.       else {  
  623.         set %weapon.price $readini(weapons.db, %weapon.name, cost)
  624.         %shop.list = $addtok(%shop.list, $+ %weapon.name $+  ( $+ %weapon.price $+ ),46)
  625.         inc %value 1
  626.       }
  627.     }
  628.  
  629.     if (%shop.list != $null) {  $shop.cleanlist
  630.       /.timerGlyphs $+ $nick 1 1 /.msg $nick 2New Glyph Weapons: %shop.list
  631.     }
  632.  
  633.     unset %shop.list
  634.  
  635.     if (%upgrade.list != $null) {  
  636.       set %replacechar $chr(044) $chr(032) |  %upgrade.list = $replace(%upgrade.list, $chr(046), %replacechar)
  637.       /.timerUpgradeList $+ $nick 1 2 /.msg $nick 2Weapons you can upgrade: %upgrade.list
  638.     }
  639.   }
  640.   if (($2 = buy) || ($2 = purchase)) {
  641.     if ($readini(weapons.db, $3, type) = $null) { .msg $nick 4Error: Invalid weapon! Use! !shop list weapons to get a valid list | halt }
  642.     var %weapon.level $readini($char($1), weapons, $3)
  643.     if (%weapon.level != $null) {
  644.    
  645.       var %shop.level $readini($char($1), stuff, shoplevel)
  646.       ; do you have enough to buy it?
  647.       var %player.redorbs $readini($char($1), stuff, redorbs)
  648.       if ( $4 isnum && $4 > 1 ) { var %amount $4 }
  649.       else { var %amount 1 }
  650.      
  651.       while ( %amount > 0 ) {
  652.           var %total.price $round($calc(%shop.level * $readini(weapons.db, $3, upgrade)),0)
  653.          
  654.           if (%player.redorbs < %total.price) { .msg $nick 4You do not have enough $readini(system.dat, system, currency) to purchase this item! | halt }
  655.           dec %player.redorbs %total.price
  656.           $inc.redorbsspent($1, %total.price)
  657.           inc %weapon.level 1
  658.           writeini $char($1) stuff redorbs %player.redorbs
  659.           writeini $char($1) weapons $3 %weapon.level
  660.           .msg $nick 3You spend %total.price  $+ $readini(system.dat, system, currency) to upgrade your $3 $+ !
  661.           $inc.shoplevel($1)
  662.       }
  663.       halt
  664.     }
  665.     else {
  666.       var %shop.level $readini($char($1), stuff, shoplevel)
  667.       ; do you have enough to buy it?
  668.       var %player.blackorbs $readini($char($1), stuff, blackorbs)
  669.       var %total.price $readini(weapons.db, $3, cost)
  670.      
  671.       if (%player.blackorbs < %total.price) { .msg $nick 4You do not have enough black orbs to purchase this item! | halt }
  672.       dec %player.blackorbs %total.price
  673.       writeini $char($1) stuff blackorbs %player.blackorbs
  674.       $inc.blackorbsspent($1, %total.price)
  675.       writeini $char($1) weapons $3 1
  676.       .msg $nick 3You spend %total.price black orb(s) to purchase $3 $+ !
  677.       halt
  678.     }
  679.   }
  680.  
  681. }
  682. alias inc.shoplevel {   var %shop.level $readini($char($1), stuff, shoplevel) | inc %shop.level .1 | writeini $char($1) stuff shoplevel %shop.level  | .msg $1 2Your Shop Level has been increased to %shop.level }
  683.  
  684. alias shop.cleanlist {
  685.   ; CLEAN UP THE LIST
  686.   if ($chr(046) isin %shop.list) { set %replacechar $chr(044) $chr(032)
  687.     %shop.list = $replace(%shop.list, $chr(046), %replacechar)
  688.   }
  689. }
  690.  
  691. alias inc.redorbsspent {  
  692.   var %orbs.spent $readini($char($1), stuff, RedOrbsSpent)
  693.   inc %orbs.spent $2
  694.   writeini $char($1) stuff RedOrbsSpent %orbs.spent
  695.   return
  696. }
  697. alias inc.blackorbsspent {
  698.   var %orbs.spent $readini($char($1), stuff, BlackOrbsSpent)
  699.   inc %orbs.spent $2
  700.   writeini $char($1) stuff BlackOrbsSpent %orbs.spent
  701.   return
  702. }
  703.  
  704. alias shop.orbs {
  705.   if ($2 = list) { .msg $nick 2You can exchange 1 black orb for 500 $readini(system.dat, system, currency) $+ .  To do so, use the command: !shop buy orbs  }
  706.  
  707.   if (($2 = buy) || ($2 = purchase)) {
  708.  
  709.     ; do you have enough to buy it?
  710.     var %total.price 1
  711.     var %player.blackorbs $readini($char($1), stuff, blackorbs)
  712.  
  713.     if (%player.blackorbs < %total.price) { .msg $nick 4You do not have enough black orbs to do the exchange! | halt }
  714.  
  715.     ; if so, increase the amount
  716.     var %player.redorbs $readini($char($1), stuff, redorbs)
  717.     inc %player.redorbs 500
  718.     dec %player.blackorbs 1
  719.     writeini $char($1) stuff redorbs %player.redorbs
  720.     writeini $char($1) stuff blackorbs %player.blackorbs
  721.  
  722.     .msg $nick 3You spend %total.price black orb for 500 $readini(system.dat, system, currency) $+ !
  723.     halt
  724.   }
  725. }
Add Comment
Please, Sign In to add comment