DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 27, 2018, 01:40:30 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Hall of Fame Hooks  (Read 3307 times)
0 Members and 1 Guest are viewing this topic.
mattbots
Guest
« on: October 22, 2005, 07:55:09 PM »

LonnyL wrote an inspired module called 'amulets' and added a good idea: hooking the HOF to display amulet holder stats.

However, it breaks the standard HOF form.  It doesn't have all the navs for other HOF selections, doesn't format the table in the same way.


I'm adding a HOF hook in my custom module "Altar to Ramius" (available at http://www.mattmullen.net/), but I want all the standard HOF features without rewriting them.  For instance, I want it to handle multiple pages if the site has many, many users, and I want it to screen out non-HOF-enabled users (administrators with certain superuser flags).

Can I call a function in hof.php to just make it happen, or is it not that simple?

If you download the existing "Altar to Ramius", you can see how far I've gotten.
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: October 22, 2005, 08:03:55 PM »

Hall of Fame currently has no hooks, outside of the "header-hof" and "footer-hof."

If you wish to omit certain users, then I suggest adopting the current HOF way to remove them, until a suitable function comes out.

You could also just add into your code and SQL queries:
Code:
$superusermask = SU_HIDE_FROM_LEADERBOARD;
$standardwhere = "(locked=0 AND (superuser & $superusermask) = 0)";
Which is how it is done in the hof.php
« Last Edit: October 22, 2005, 08:08:11 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

mattbots
Guest
« Reply #2 on: October 22, 2005, 08:56:40 PM »

Sichae, I saw that, but it's in an SQL lookup in the table "accounts", which has the field "superuser" available.  My lookup is from my module preferences, so I have to lookup in the table "module_prefs", which doesn't have the "superuser" field to compare, so I can't add the WHERE superuser=$superuser line to my query.
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #3 on: October 22, 2005, 09:02:29 PM »

Yes, you can...

Code:
$sql = "SELECT value FROM ".db_prefix("module_userprefs")." INNER JOIN ".db_prefix("accounts")." ON userid=acctid WHERE (locked=0 AND (superuser & ".SU_HIDE_FROM_LEADERBOARD.") = 0)";

Edit: Just added in the extra stuff to make the SQL query more C&P ready. Wink
« Last Edit: October 22, 2005, 09:20:20 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

DaveS
Mod God
*****
Offline Offline

Posts: 1544


Dfly... you know, as in DaveFly


View Profile
« Reply #4 on: October 22, 2005, 09:06:19 PM »

Sichae = sql master.
Logged

Check out my Last Module:
The Dragon Eggs Expansion
http://dragonprime.net/index.php?topic=8474.0

About my Retirement:
http://dragonprime.net/index.php?topic=9080

See my complete module list here:
http://dragonprime.net/index.php?topic=3038.0
mattbots
Guest
« Reply #5 on: October 22, 2005, 10:00:31 PM »

Sichae, I wasn't able to make your solution work with the joining of tables (probably just my lack of SQL mastery to blame), but I was able to get what I wanted with two seperate SQL lookups.

Now my "Altar to Ramius" module is finally done, with all the polish of a nice HOF listing and admin-configurable settings.

I only have one lingering bug: I wanted a "note" in the grotto settings explaining the calculation (like they do in the dragon buffercizer module), but it keeps drawing a textfield next to my note, and it doesn't italicise it the way dragonbuffercizer does.  I can't figure out why as I copied the buffercizer code to look like so (snippett):
Code:
"settings"=>array(
   "reward = minimumguaranteedreward + random(0,maximumrandombonus),note",
};

Otherwise, it looks good.  Dig it:
http://www.mattmullen.net/files/ramiusaltar.php.txt
« Last Edit: October 22, 2005, 11:07:58 PM by mattbots » Logged
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #6 on: November 10, 2005, 10:16:16 PM »

I can't figure out why as I copied the buffercizer code to look like so (snippett):
Code:
"settings"=>array(
   "reward = minimumguaranteedreward + random(0,maximumrandombonus),note",
};

Otherwise, it looks good.  Dig it:
http://www.mattmullen.net/files/ramiusaltar.php.txt
You must not use any "," in the description... Wink
Logged

Running for more than three years now:
mattbots
Guest
« Reply #7 on: November 15, 2005, 03:49:20 PM »

Thanks for the fix!  That did it.  It now seems obvious why.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

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