DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • September 09, 2010, 12:25:28 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Question on DK points and newday.php  (Read 747 times)
0 Members and 1 Guest are viewing this topic.
Voratus
Guest
« on: June 12, 2004, 04:26:15 PM »

Does the following (from near the top of newday.php):
Code:
if (count($session['user']['dragonpoints']) <$session['user']['dragonkills']&&$_GET['dk']!=""){
   array_push($session['user']['dragonpoints'],$_GET[dk]);
   switch($_GET['dk']){
   case "hp":
      $session['user']['maxhitpoints']+=5;
      break;
   case "at":
      $session['user']['attack']++;
      break;
   case "de":
      $session['user']['defence']++;
      break;   
   }
}
...get run once per game day ("resetting" character), or only one time when the player has just spent a DK point?
The reason for the question is that I want to add an account field that tallies the number of times the HP option is selected (as I have no clue how to pull it out of the dragonpoints array thing). So should I be able to add in the case for HP a simple $session['user']['hpdk']++; (once I have added that field to the table, of course)?
Logged
dvd871
Guest
« Reply #1 on: June 12, 2004, 06:05:51 PM »

Well, I'm still a bit of a newbie to the inner workings, but I would guess that everything in newday.php is run everytime that there is a refresh.  I think the default was a refresh every 6 hours, or 4 times a day.

Anyone please correct me if I'm wrong...   Undecided
« Last Edit: June 12, 2004, 06:07:07 PM by dvd871 » Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #2 on: June 13, 2004, 03:14:09 AM »

That code will be executed only when you kill the dragon, because your DP (DragonPoints) are lower then DK (DragonKill) and not each newday.


Anyway if you need to know how many DK has been spent into HP you can do this:

Code:
while (list($key, $val) = each($session[user][dragonpoints])) {
        if ($val == "hp") {
            $yourvariable ++;
        }
    }
Now you're able to use $yourvariable for your need.

Rgds Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5227



View Profile WWW
« Reply #3 on: June 13, 2004, 10:09:45 AM »

I would achieve it this way:

Before switch($_GET['dk']){ add $session['user']['hpdk']=0;

After $session['user']['maxhitpoints']+=5;add $session['user']['hpdk']++

Remember that it won't be calculated until the user actually DKs.
Logged

Play the latest beta version here on DragonPrime
Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #4 on: June 13, 2004, 10:35:48 AM »

Talisman, with your suggestion they would need to add a database field 'hpdk'.

In general, it's not the right solution to add a database field for something which is trivial to calculate.

Excalibur's solution is the 'right' one Smiley
Logged

Ex co-developer of LotGD
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #5 on: June 13, 2004, 11:37:56 AM »

Excalibur's solution is the 'right' one Smiley
Wow  Cheesy Cheesy
That is something to frame and show to friends  Cheesy Cheesy
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

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