Welcome, Guest. Please login or register.
Did you miss your activation email?
November 25, 2024, 09:30:48 am *

Login with username, password and session length
Pages: 1 2 [3]
Print
Author Topic: Leaderboards  (Read 21733 times)
Hunter
EZ Server GM
Legend
*******
Posts: 8100


EZ Server GM


View Profile
« Reply #30 on: April 15, 2013, 07:16:16 am »

More testing, changing array @table to string $table via using '.' for concat, didn't make any difference, works for top 10 but not 15.

Still trying to figure out why large variable / array crashing popup window

void quest::popup(char *title, char *text, int32 popupid, int32 buttons, int32 Duration);

void $client->SendPopupToClient(const char *Title, const char *Text, int32 PopupID, int32 Buttons, int32 Duration);

Maybe max size of const char or something? Guessing its size issue in eqemu source code some where.

Logged

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


EZ Server GM


View Profile
« Reply #31 on: April 15, 2013, 08:13:17 am »

Just thought of an idea. Could turn players names into a website link to bring up the players Magelo.

Just a neat feature short cut idea, but would probably conflict with size of info being passed to the popup window which we need to fix first.

Showing 10 results per popup is good idea anyways.
Logged

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


View Profile
« Reply #32 on: April 15, 2013, 03:40:26 pm »

The text length in game is a client issue I think...

Sending a HUGE Array to chat WILL crash you... doing it in the Popup box just makes the box not work.  (Just a guess)

But this is what it seems like.
Logged

lerxst2112
Hero Member
*****
Posts: 724


View Profile
« Reply #33 on: April 15, 2013, 04:38:12 pm »


The client can handle just under 4k for a chat message from the server.  I'm not sure if the same limit applies to the popup box as I didn't test that.
Logged
Natedog
Master
******
Posts: 830


View Profile
« Reply #34 on: April 15, 2013, 06:34:44 pm »

I'd suggest a minimum level for the Leaderboard... when you create a Level 1 Wizard it has a bugged amount of AC lol

Erudite Wizards have 65,534 AC  which is odd... 1 more AC than a level 1 Gnome Wizard


#Mystats  .... Erudite Wizard starts with -2 AC

ATK they start with is 65,531


Going negative in stats makes them really high.



Level 2 Erudite Wizard has the most AC though at -1 AC heh... wonder why they start with negative AC.. =\
« Last Edit: April 15, 2013, 06:40:55 pm by Paldail » Logged

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


EZ Server GM


View Profile
« Reply #35 on: April 15, 2013, 08:48:49 pm »

Maybe minimum level 60, pointless for lower levels.
Logged

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


EZ Server GM


View Profile
« Reply #36 on: April 15, 2013, 08:52:32 pm »

Now that we have a working beta leaderboards, I can expand on it.

Make minimum level 60 to be on it.

Also other stats like HP regen and Mana Regen.

Since we're limited to 4k size of message, then maybe top 10's would combine hp and hp regen, then mana and mana regen. Either way, I can't display all stat cause we'd go over the 4k size limit.

So what do we want to see? How do we get the info?

We want hp/mana regens? Whats the code to get that info?

I could easily do who got killed most by buff bot but that'd only encourage spamming.

I could do who died most times via global_npc.pl, haven't tried yet but sure its possible.

I thought about money but some people said thats private info. Same with days played.

Logged

Hunter - EZ Server GM
red2
Full Member
***
Posts: 140


View Profile
« Reply #37 on: April 15, 2013, 10:29:13 pm »

have it do a unique query, to tell you what # you are on the list? have it just return you are #37 .. etc
Logged
Natedog
Master
******
Posts: 830


View Profile
« Reply #38 on: April 16, 2013, 12:35:23 am »

have it do a unique query, to tell you what # you are on the list? have it just return you are #37 .. etc


Code:
if ($text=~/MY RANK/i)
{
$sth = $dbh->prepare("SELECT hp from leaderboard WHERE name = '$name'");
$sth->execute();
my $rankedHP = $sth->fetchrow_array();
$sth = $dbh->prepare("SELECT COUNT(hp) from leaderboard WHERE hp > $rankedHP");
$sth->execute();
my $ranked = int($sth->fetchrow_array()+1);
$client->Message(315,"You are Ranked Number $ranked on HP!");
if ($ranked > 10)
{
$ranklist = int($ranked -10);
}
else
{
$ranklist = int(1);
}
@table = "<table><TR><TD>#<TD>$Yel NAME </c><TD>$grn HP </c><TD>$Blu MANA </c><TD>$Pink CLASS </c>/$orange Race </c><TD>$Red LEVEL </c><TD>AC<TD>$purp AA </c><TD>";
$sth = $dbh->prepare("SELECT  name, hp, mana, class, level, armor, aa, race FROM leaderboard ORDER BY hp DESC LIMIT $ranklist,10");
$sth->execute();
$n = $ranklist;
if ($n > 1)
{
$n = $n+1;
}
while (my ($pname, $php, $pmana, $pclass, $plevel, $pac, $paa, $prace) = $sth->fetchrow_array())
{
my $php2 = plugin::commify($php);
my $pmana2 = plugin::commify($pmana);
my $pac2 = plugin::commify($pac);
my $paa2 = plugin::commify($paa);
push(@table, "<TR><TD>$n<TD>$Yel $pname </c><TD>$grn $php2 </c><TD>$Blu $pmana2 </c><TD>$Pink $pclass </c>/$orange $prace </c><TD>$Red $plevel </c><TD>$pac2<TD>$purp $paa2 </c><TD>");
$n++;
}
push(@table, "</table>");
quest::popup("Your Rank", "@table");
$sth->finish ();
$dbh->disconnect();
}


This will show the 9 players AHEAD of you in HP.. its fairly sloppy and probably could be written better... but this works and gives you an idea of how I did it heh.


Heres what it looks like...

« Last Edit: April 16, 2013, 12:40:01 am by Paldail » Logged

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


EZ Server GM


View Profile
« Reply #39 on: April 16, 2013, 02:37:44 am »

Went out today and beat from the heat, but will probably use some of that code soon into our current leaderboards, thanks again! Smiley
Logged

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


View Profile
« Reply #40 on: April 16, 2013, 07:24:04 pm »

That code had a small error need to change how $n was calculated.

Code:
if ($text=~/MY RANK/i)
{
$sth = $dbh->prepare("SELECT hp from leaderboard WHERE name = '$name'");
$sth->execute();
my $rankedHP = $sth->fetchrow_array();
$sth = $dbh->prepare("SELECT COUNT(hp) from leaderboard WHERE hp > $rankedHP");
$sth->execute();
my $ranked = int($sth->fetchrow_array()+1);
$client->Message(315,"You are Ranked Number $ranked on HP!");
if ($ranked > 10)
{
$ranklist = int($ranked -10);
}
else
{
$ranklist = 0;
}
@table = "<table><TR><TD>#<TD>$Yel NAME </c><TD>$grn HP </c><TD>$Blu MANA </c><TD>$Pink CLASS </c>/$orange Race </c><TD>$Red LEVEL </c><TD>AC<TD>$purp AA </c><TD>";
$sth = $dbh->prepare("SELECT  name, hp, mana, class, level, armor, aa, race FROM leaderboard ORDER BY hp DESC LIMIT $ranklist,10");
$sth->execute();
$n = $ranklist;  #Set Rank to the Ranklist number
if ($ranked > 10)
{
$n = $n+1;   #If their rank is over 10 you must add 1 otherwise it won't be correct
}
if ($n == 0)
{
$n = 1;   #If they are in the top 10 need this part
}
while (my ($pname, $php, $pmana, $pclass, $plevel, $pac, $paa, $prace) = $sth->fetchrow_array())
{
my $php2 = plugin::commify($php);
my $pmana2 = plugin::commify($pmana);
my $pac2 = plugin::commify($pac);
my $paa2 = plugin::commify($paa);
push(@table, "<TR><TD>$n<TD>$Yel $pname </c><TD>$grn $php2 </c><TD>$Blu $pmana2 </c><TD>$Pink $pclass </c>/$orange $prace </c><TD>$Red $plevel </c><TD>$pac2<TD>$purp $paa2 </c><TD>");
$n++;
}
push(@table, "</table>");
quest::popup("Your Rank", "@table");
$sth->finish ();
$dbh->disconnect();
}


This one works better... had to find a way to get the numbered list to show up correctly for players ranked in the Top 10 when they checked their rank.
Logged

Natedog
Master
******
Posts: 830


View Profile
« Reply #41 on: April 16, 2013, 07:39:28 pm »

We want hp/mana regens? Whats the code to get that info?

I could do who died most times via global_npc.pl, haven't tried yet but sure its possible.


I don't see any Perl export for HP/Mana Regen.


Doing deaths would be awesome though!


Could maybe even do Boss kills?  Only for end bosses like OMM and such
Logged

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


EZ Server GM


View Profile
« Reply #42 on: April 19, 2013, 04:34:46 am »

Added Resist and Richest leaderboards.

Might get some other ideas here:

https://github.com/EQEmu/Server/blob/master/zone/client.h
Logged

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


View Profile
« Reply #43 on: May 10, 2013, 01:31:28 pm »

Took me all day... but I did it!


Used a bit of script from the AllaClone ... modified the script .. added some HTML and bam!

Hopefully EZs gets up soon! I wanna keep tabs on Fugitives HPz when I cant play! lol


http://108.239.155.107/AllaClone/leaderboard.php
« Last Edit: May 10, 2013, 01:33:54 pm by Paldail » Logged

Brokyn
Sr. Member
****
Posts: 405

Artificial intelligence beats real stupidity


View Profile
« Reply #44 on: May 10, 2013, 10:12:25 pm »

That is awesome Nate!  Any chance to add a guild tag in there?
Logged

We have enough youth, how about a fountain of smart?
Pages: 1 2 [3]
Print
Jump to:  

Recent

Stats

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