Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Tools

Development::Tools 3rd Party Tools for EQEMu (DB management tools, front ends, etc...)

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2011, 03:10 PM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default The KMRA Browser and PHP NPC of the Day

Alright well thanks to several people who helped out with this project including the original creator of the Browser I am proud to release my entire setup for the Raid Addicts website as far as the Browser goes and the NPC of the Day Feature that we use.

Just a few notes:

* This thing is not perfect of course but everyone is free to upgrade and revise it would appreciate you keep me apprised as to those changes!

* Unpack the contents of the Zip in your Web Directory make sure you have PHP installed and SQL .. Modify the ./includes/config.php to your settings and enjoy ! The PHP Script you can install on your website like I did , it pulls data from that config.php as well.


The KMRABrowser can be found Here modified and tweaked by Myself, Plutarch and Muuss : www.raidaddicts.org/files/kmrabrowser.rar

NOW TO INSTALL THE NPC OF THE DAY SCRIPT

Step 1: Source the Database it uses
Code:
CREATE TABLE IF NOT EXISTS `week_of_the_npc` (
  `npcid` int(11) NOT NULL default '0',
  `expiry_date` date default NULL,
  UNIQUE KEY `npcid` (`npcid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
(originally started out maybe having it every week, ignore what it's called or you can fix that if you want hehe)

And Here is the PHP Script for the main page written by Rainbow
Simply change the top lines to point to your includes dir for the browser on your website.

Code:
<?php
include('./kmrabrowser/includes/constantes.php');
include('./kmrabrowser/includes/config.php');
include('./kmrabrowser/includes/mysql.php');
include('./kmrabrowser/includes/functions.php');

$npcid = 0;
$npcname = "";

$query = "SELECT week_of_the_npc.npcid FROM week_of_the_npc WHERE DATEDIFF(CURDATE(), week_of_the_npc.expiry_date) < 0";
$result = mysql_query($query) or message_die('npc_of_the_week.php', 'MYSQL_QUERY', $query, mysql_error());
if(mysql_num_rows($result) > 0){
   $row = mysql_fetch_array($result);
   $npcid = $row["npcid"];
} else {
   $query = "SELECT npc_types.id, npc_types.name, npc_types.loottable_id FROM npc_types WHERE npc_types.loottable_id != 0 and hp >= 50000 and (select count(*) from loottable_entries, lootdrop_entries where loottable_entries.loottable_id = npc_types.loottable_id and loottable_entries.lootdrop_id = lootdrop_entries.lootdrop_id) > 0";
   $result = mysql_query($query) or message_die('npc_of_the_week.php', 'MYSQL_QUERY', $query, mysql_error());
   $totalrows = mysql_num_rows($result) - 1;
   $randnum = rand(0, intval($totalrows));
   $counter = 0;
   while($row = mysql_fetch_array($result)) {
      if ($counter == $randnum) {
         $npcid = $row["id"];
         $npcname = $row["name"];
         $loottable = $row["loottable_id"];
         $query = "SELECT * FROM week_of_the_npc where npcid = $npcid";
         $result = mysql_query($query) or message_die('npc_of_the_week.php', 'MYSQL_QUERY', $query, mysql_error());
         if(mysql_num_rows($result) >0){
            print "update </br>";
            $query = "UPDATE week_of_the_npc SET expiry_date = DATE_ADD(CURDATE(), INTERVAL 1 DAY) WHERE npcid = '$npcid'";
         } else {
            print "insert </br>";
            $query = "INSERT INTO week_of_the_npc (npcid, expiry_date) value ($npcid, DATE_ADD(CURDATE(), INTERVAL 1 DAY))";
         }
         $result = mysql_query($query) or message_die('npc_of_the_week.php', 'MYSQL_QUERY', $query, mysql_error());
      }
      $counter++;
   }
}
print "NPC of the Day</br></br>";
$query = "SELECT name, level, hp FROM npc_types WHERE id = '$npcid'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$npcname = $row["name"];
$npclv = $row["level"];
$npchp = $row["hp"];

$npcfinalname = str_replace("_", " ", $npcname);
$image = "./kmrabrowser/npcs/$npcid.jpg";
if (!file_exists($image)){
   $image = "/images/npcweek.PNG";
}
print "<a href='http://www.raidaddicts.org/kmrabrowser/npc.php?id=$npcid'><img src='$image' width=150 height=250></a> </br></br>";
print "<a href='http://www.raidaddicts.org/kmrabrowser/npc.php?id=$npcid'>$npcfinalname</a> </br></br>";
print "Level: $npclv </br>";
print "   HP: $npchp </br>";

$query = "SELECT distinct zone.long_name, zone.short_name from zone, spawnentry, spawn2, spawngroup where spawnentry.npcID = $npcid and spawnentry.spawngroupID = spawn2.spawngroupID and spawn2.zone = zone.short_name and spawnentry.spawngroupID = spawngroup.id";
$result = mysql_query($query);
$counter = 0;
if(mysql_num_rows($result)>0) {
   print "Spawn in: ";
   while($row=mysql_fetch_array($result)){
      if($counter ==0){
         print $row["long_name"];
      } else {
         print ", ".$row["long_name"];
      }
      $counter++;
   }
}
print "<hr>";

?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:10 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3