Guest User

Untitled

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