DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • September 19, 2018, 01:16:34 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Spending Battlepoints  (Read 3717 times)
0 Members and 1 Guest are viewing this topic.
phudgee
Guest
« on: August 09, 2004, 01:06:05 PM »

Searched the forums and didn't find anything, so I'm posting this just as an FYI to anyone who might be looking for something similar.

I am using LonnyL's Battle Arena, and Anpera's PVP-Arena.

These both give battlepoints as a reward, and the only thing battlepoints seem to be good for is listing in the Hall of Fame (or equivilent Top X list).

So I took Anpera's spellshop and modded it a bit so it now used a new prototype called Batt.Prot and uses battlepoints as currency instead of gold and/or gems. I also linked it off of the Arena menu, so now players are able to spend their battlepoints for magical items/spells.

I can also use the Item Editor that came with Anpera's Spellshop to make the Batt.Prot items as well.

It's not difficult to do, but I just thought I would let anyone looking for something else to do with their battlepoints, that Anpera's SpellShop makes a great way to do it!

Thanks for the great mods guys!
Logged
phofire
Guest
« Reply #1 on: August 09, 2004, 06:56:11 PM »

and you have posted these new mods?
Logged
phudgee
Guest
« Reply #2 on: August 10, 2004, 05:44:42 AM »

I didn't post them because it is a real simple hack. But if you would like, I'll go thru and post the changes. Cheesy
Logged
phudgee
Guest
« Reply #3 on: August 10, 2004, 06:42:21 AM »

I think this is complete....

rename spellshop.php to battleshop.php (or whatever you want)

remove the sell logic:

Code:
if ($_GET[action]=="sell"){ // Zauberladen (written on a cassiopeia while taking a bath)
   if (isset($_GET[id])){
      $sql="SELECT * FROM items WHERE id=$_GET[id]";
      $result=db_query($sql);
        $row = db_fetch_assoc($result);
      output("`2$shopowner takes $row[name]`2 and gives you ".($row[gold]?"`^$row[gold] `2gold":"")." ".($row[gems]?"`#$row[gems]`2 gems":"").". ");
      addnav("Sell more","spellshop.php?action=sell");
      $sql="DELETE FROM items WHERE id=$_GET[id]";
      $session[user][gold]+=$row[gold];
      $session[user][gems]+=$row[gems];
      db_query($sql);
   }else{
      $sql="SELECT * FROM items WHERE owner=".$session[user][acctid]." AND (gold>0 OR gems>0) AND class='Spell' ORDER BY name ASC";
      $result=db_query($sql);
      if (db_num_rows($result)){
         output("`2 You show $shopowner your spells and he tells you what he's willing to pay.`n`n");
         output("<table border='0' cellpadding='1' cellspacing='3'>",true);
         output("<tr class='trhead'><td>`bName`b</td><td>`bPreis`b</td></tr>",true);
         for ($i=0;$i<db_num_rows($result);$i++){
              $row = db_fetch_assoc($result);
            $bgcolor=($i%2==1?"trlight":"trdark");
            output("<tr class='$bgcolor'><td><a href='spellshop.php?action=sell&id=$row[id]'>$row[name]</a></td><td align='right'>`^$row[gold]`0 Gold, `#$row[gems]`0 Edelsteine</td></tr><tr class='$bgcolor'><td colspan='2'>$row[description]</td></tr>",true);
            addnav("","spellshop.php?action=sell&id=$row[id]");
         }
            output("</table>",true);
      } else {
         output("`2You don't have any interesting spells.");
      }
   }
   addnav("To Shop","spellshop.php");

change:

Code:
}else if ($_GET[action]=="buy"){ // ok, water's getting cold ^^

to:

Code:
if ($_GET[action]=="buy"){ // ok, water's getting cold ^^

in the buy logic, change:

Code:
if ($session[user][gems]<$row[gems] || $session[user][gold]<$row[gold]){

to:

Code:
if ($session[user][battlepoints]<$row[gold]){

also change:

Code:
}else if (db_num_rows(db_query("SELECT id FROM items WHERE name='$row[name]' AND owner=".$session[user][acctid]." AND class='Spell'"))>0){

to:

Code:
}else if (db_num_rows(db_query("SELECT id FROM items WHERE name='$row[name]' AND owner=".$session[user][acctid]." AND class='BattleItem'"))>0){

change:

Code:
output("`2You point on \"`3$row[name]`2\". $shopowner gives it to you and you hand him ".($row[gold]?"`^$row[gold] `2gold":"")." ".($row[gems]?"`#$row[gems]`2 gems":"")." over. ");

to:

Code:
output("`2You point to\"`3$row[name]`2\". $shopowner gives it to you and you lose ".($row[gold]?"`^$row[gold] `2battle points":""));

change:

Code:
$sql="INSERT INTO items(name,class,owner,value1,value2,hvalue,gold,gems,description,buff) VALUES ('$row[name]','Spell',".$session[user][acctid].",$row[value1],$row[value2],$row[hvalue],$row[gold],$row[gems],'".addslashes($row[description])."','".addslashes($row[buff])."')";

to:

Code:
$sql="INSERT INTO items(name,class,owner,value1,value2,hvalue,gold,gems,description,buff) VALUES ('$row[name]','BattleItem',".$session[user][acctid].",$row[value1],$row[value2],$row[hvalue],$row[gold],$row[gems],'".addslashes($row[description])."','".addslashes($row[buff])."')";

change:

Code:
$session[user][gold]-=$row[gold];
$session[user][gems]-=$row[gems];

to:

Code:
$session[user][battlepoints]-=$row[gold];

change:

Code:
output("`2What do you want?`n`n");

to:

Code:
output("`2What do you want?`n`n");
output("`3You have ".$session[user][battlepoints]." battlepoints you can spend!`n`n");
change:

Code:
$sql="SELECT * FROM items WHERE (owner=0 AND class='Spell') OR class='Spell.Prot' AND gold<=".$session[user][gold]." AND gems<=".$session[user][gems]." ORDER BY class,name ASC LIMIT $limit";

to:

Code:
$sql="SELECT * FROM items WHERE (owner=0 AND class='BattleItem') OR class='Batt.Prot' AND gold<=".$session[user][battlepoints]." ORDER BY class,name ASC LIMIT $limit";
change:

Code:
output("<tr class='$bgcolor'><td><a href='spellshop.php?action=buy&id=$row[id]'>$row[name]</a></td><td align='right'>`^$row[gold]`0 Gold, `#$row[gems]`0 Edelsteine</td></tr><tr class='$bgcolor'><td colspan='2'>$row[description]</td></tr>",true);

to:

Code:
output("<tr class='$bgcolor'><td><a href='battleshop.php?action=buy&id=$row[id]'>$row[name]</a></td><td align='right'>`^$row[gold]`0 Battle Points</td></tr><tr class='$bgcolor'><td colspan='2'>$row[description]</td></tr>",true);

change:

Code:
output("`2\"`3We don't have any spells for you that you can afford`2\"");

to:

Code:
output("`2\"`3You don't have enough battle points to get any items!`2\"");

Remove:

Code:
addnav("Sell spell","spellshop.php?action=sell");

Change:

Code:
all references to spellshop.php

to:

Code:
battleshop.php (or whatever you called it)


In common.php, right after:

Code:
// spells by anpera
      $sql="SELECT * FROM items WHERE (class='Spell') AND owner=".$session[user][acctid]." AND value1>0 ORDER BY class,name ASC";
      $result=db_query($sql) or die(db_error(LINK));
      if (db_num_rows($result)>0) addnav("Spells & Moves");
      for ($i=0;$i<db_num_rows($result);$i++){
           $row = db_fetch_assoc($result);
         $spellbuff=unserialize($row[buff]);
         addnav("`2$spellbuff[name] `0(".$row[value1]."x)","$script?op=fight&skill=zauber&itemid=$row[id]");
      }
// end spells

add:

Code:
// Battle Items
      $sql="SELECT * FROM items WHERE (class='BattleItem') AND owner=".$session[user][acctid]." AND value1>0 ORDER BY class,name ASC";
      $result=db_query($sql) or die(db_error(LINK));
      if (db_num_rows($result)>0) addnav("Battle Items");
      for ($i=0;$i<db_num_rows($result);$i++){
           $row = db_fetch_assoc($result);
         $spellbuff=unserialize($row[buff]);
         addnav("`2$spellbuff[name] `0(".$row[value1]."x)","$script?op=fight&skill=zauber&itemid=$row[id]");
      }
// end Battle Items

If you want the players to lose their battle items on a DK, then in dragon.php, somewhere around the DK part, you'll need to add:

Code:
   $sql = "DELETE FROM items WHERE owner=".$session[user][acctid]." AND class='BattleItem'";
   db_query($sql) or die(db_error(LINK));

in newday.php, after:

Code:
$session['user']['bounties']=0;

add:

Code:
      // Handle buffs from Battle items
      $sql="SELECT * FROM items WHERE (class='BattleItem' OR class='Move') AND owner=".$session[user][acctid]." ORDER BY id";
      $result=db_query($sql);
      for ($i=0;$i<db_num_rows($result);$i++){
           $row = db_fetch_assoc($result);
         if ($row[hvalue]>0){
            $row[hvalue]--;
            if ($row[hvalue]<=0 && $row['class']=="BattleItem"){
               db_query("DELETE FROM items WHERE id=$row[id]");
               output("`n`2$row[name]`2 has turned to dust and crumbled.`n");
            }else{
               $what="hvalue=$row[hvalue]";
               if ($row['class']=='BattleItem') $what.=", value1=$row[value2]";
               db_query("UPDATE items SET $what WHERE id=$row[id]");
            }
         }
      }

I added a link in my pvparena.php as "Spend Battle Points". You can put it wherever.

You can use the Item editor from spellshop, just make your prototypes in class Batt.Prot

Put the number of battlepoints it costs in the Item Cost (Gold) spot. Item Cost (Gems) is not used. Everything else works like Anpera's Spells.

Again, this was originally posted to merely give ideas, not for me to post the actual changes I made.

I think I have listed everything here, I didn't actually keep track of the changes I made because I didn't think I would be posting them. But if I did miss something, I'm sure you get the jist, and thanks again to Anpera and LonnyL for sweet mods!

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
32 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search