Welcome, Guest. Please login or register.
Did you miss your activation email?
November 29, 2024, 03:04:03 am *

Login with username, password and session length
Pages: 1 [2] 3
Print
Author Topic: Leaderboards  (Read 21817 times)
Fugitive
Legend
*******
Posts: 1807


TROLL KING


View Profile
« Reply #15 on: April 12, 2013, 03:36:21 pm »

shrug would be all over the place a geared player hard grinding can crank out 2-5k per hour with UW+ the 250% item.. where as others would be all over the place.
Logged


Quoted for the Brotherhood of Warriors
"I want my wizard to cast Fugitives instead of fireballs.
We can't always get what we want. ;-)"
-Hate"
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #16 on: April 14, 2013, 02:06:46 am »

I have 1 person already working on a webpage based leader boards and I'm probably going to make some in game leader boards.

With the coding aside, what would be a good way to get the information?

Query Cache?

What query to run, and when?

For example, how would we get everyones max hp? Add up all the hp on every item in inventory table slots 0-21? That'd take a while to get totals with inner join queries.

So yeah, need help to write up the queries I guess, which would be easiest and fastest.
Logged

Hunter - EZ Server GM
Natedog
Master
******
Posts: 830


View Profile
« Reply #17 on: April 14, 2013, 02:32:57 am »

Code:
my $hptotal = $client->GetMaxHP();
my $manatotal = $client->GetMaxMana();
my $actotal = $client->GetAC();


Not sure when to run it though...

I have an NPC that you can add yourself to the Leaderboard on my test server. Could add a Global so that you can only add yourself once per 24 hours.

Logged

Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #18 on: April 14, 2013, 03:40:55 am »

There is a good idea. Choose when to add yourself to leader boards, via 24 hour cool down.

When adding, all your statistics get added to a custom table which then can be queried for different stuff like HP.
Logged

Hunter - EZ Server GM
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #19 on: April 14, 2013, 08:39:31 am »

Currently Leaderboards only adds players that hail the Leaderboards NPC.

If you don't want your stats up on there, then don't hail with your character. Just an alt to hail with to see what is on it.

Hope makes sense.

Will need some more time to figure out who or how will be added to it later autmatically, maybe even give an opt-out option for players that want to be private.

Logged

Hunter - EZ Server GM
Natedog
Master
******
Posts: 830


View Profile
« Reply #20 on: April 14, 2013, 04:19:08 pm »

I hailed the Leaderboard on Paldail earlier and it gave me "Unknown" Race because I was a baddie and I was in skeleton illusion.

Guessing playable race illusions you could fake whatever race you are.

If you want to get a players Base Race can use this.


Code:
my $baserace = $client->GetBaseRace();
my %racelist = (
1 => ["Human"],
2 => ["Barbarian"],
3 => ["Erudite"],
4 => ["Wood Elf"],
5 => ["High Elf"],
6 => ["Dark Elf"],
7 => ["Half Elf"],
8 => ["Dwarf"],
9 => ["Troll"],
10 => ["Ogre"],
11 => ["Halfling"],
12 => ["Gnome"],
330 => ["Froglok"],
522 => ["Drakkin"],
);
my $baserace2 = $racelist{$baserace}[0];


So $baserace2 would spit out whatever their real race is... could even go as far as Shortening each Race name inside that list.  Can do the same thing for class as well if you wanted to shorten the way they show up.


Logged

Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #21 on: April 14, 2013, 06:20:05 pm »

Will use that!

Thanks Smiley
Logged

Hunter - EZ Server GM
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #22 on: April 14, 2013, 08:17:21 pm »

When I change from top 10 to top 15 via LIMIT 10 in the $query, then the leaderboards doesn't work anymore.

Here is the segment of the code, if anyone can figure out why?

Code:

my $query = "SELECT name, level, race, class, hp, mana, ac, played FROM leaderboards ORDER BY $ORDER_BY DESC LIMIT 10";
my $query_handle = $connect->prepare($query);
$query_handle->execute();

# GET THE 10 RECORDS
my $place_count = 1;
while(my $ref = $query_handle->fetchrow_hashref)
{
$GET_NAME = $ref->{'name'};
$GET_LEVEL = $ref->{'level'};
$GET_RACE = $ref->{'race'};
$GET_CLASS = $ref->{'class'};
$GET_HP = commify2($ref->{'hp'});
$GET_MANA = commify2($ref->{'mana'});
$GET_AC = commify2($ref->{'ac'});
$GET_PLAYED = $ref->{'played'};
$GetDays = commify2(int($GET_PLAYED/(24*60*60)));
$GetDays = "Blocked";

push(@table, "<TR><TD>$place_count
<TD><c \"#FE2E2E\"> $GET_NAME </c>
<TD><c \"#DF7401\"> $GET_LEVEL </c>
<TD><c \"#868A08\"> $GET_RACE </c>
<TD><c \"#088A08\"> $GET_CLASS </c>
<TD><c \"#0B615E\"> $GET_HP </c>
<TD><c \"#0431B4\"> $GET_MANA </c>
<TD><c \"#8904B1\"> $GET_AC </c>
<TD><c \"#DF013A\"> $GetDays </c>
<TD>");
$place_count++;
}
push(@table, "</table>");

quest::popup("Top Ten Players by $ORDER_BY", "@table");


Also, I did this and still didn't help:

Code:
mysql> set global max_allowed_packet=100000000;
Query OK, 0 rows affected (0.00 sec)

Just realized it might be a perl issue with array size, not mysql issue.

Printing the array in chat crashes client.
« Last Edit: April 14, 2013, 08:41:04 pm by Hunter » Logged

Hunter - EZ Server GM
Natedog
Master
******
Posts: 830


View Profile
« Reply #23 on: April 14, 2013, 11:29:54 pm »

Aye I did this same thing... and got the same results. Reason why I only do Top 10.  


I tried to have a "List all Players" ... and it just got mad at me ... lol



Seems I max out at .... 19 Rows  ... with 8 columns being pulled for each player.
« Last Edit: April 15, 2013, 12:05:37 am by Paldail » Logged

Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #24 on: April 15, 2013, 12:07:46 am »

Probably a reason some where. Size of array, in either perl or mysql. Some else must have had this problem, so there should be an answer some where on Google, just need to find it.
Logged

Hunter - EZ Server GM
Natedog
Master
******
Posts: 830


View Profile
« Reply #25 on: April 15, 2013, 12:21:32 am »

Code:
$sth = $dbh->prepare("SELECT  name, hp, mana, class, level, armor, aa, race FROM leaderboard ORDER BY hp DESC LIMIT 10,10");


This will do  11 - 20  if you want....

Can have it where you click "By HP"  then do different parts... 1-10, 11-20 , 21-30 .. ect
Logged

Natedog
Master
******
Posts: 830


View Profile
« Reply #26 on: April 15, 2013, 12:33:30 am »

Also I noticed I missed Vah Shir on that list of races if you used that and want to add it lol

I failed and missed Iksar as well...


Code:
128 => ["Iksar"],
130 => ["Vah Shir"],
« Last Edit: April 15, 2013, 12:38:13 am by Paldail » Logged

Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #27 on: April 15, 2013, 02:40:55 am »

Yeah, I saw the LIMIT 10,10 but didn't think to use that lol, sort of like next page.

Will add other races too.

Thanks for help!
Logged

Hunter - EZ Server GM
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #28 on: April 15, 2013, 04:59:05 am »

Leaderboards updated again.

Will now add profile of players that login / connect for first time.

You can hail the NPC and request to be removed.

Now can see Top HP/Mana/AC sorted by class, and top 20 (page of 1-10 and page of 11-20).

Top Played Days shows order of who has most played time, but doesn't show the actual time.

Top ROA shows top 15 players with highest RoA ranks.

See Leaderboards NPC in Nexus.

Mostly tested and should be working with no issues.
Logged

Hunter - EZ Server GM
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #29 on: April 15, 2013, 06:50:16 am »

I got the entire @table to print to text file via write() with no problem.

So probably is issue with perl / popup window?

Crashes on this line of code:

quest::popup("Top Ten", "@table");
Logged

Hunter - EZ Server GM
Pages: 1 [2] 3
Print
Jump to:  

Recent

Stats

Members
  • Total Members: 6156
  • Latest: Rin1
Stats
  • Total Posts: 65127
  • Total Topics: 5066
  • Online Today: 298
  • Online Ever: 8678
  • (December 19, 2022, 02:32:09 pm)
Users Online
Users: 0
Guests: 290
Total: 290
TinyPortal v1.0 beta 4 © Bloc