The script has been made for show status of castle likes owner, taxes, next siege date.
This script generate a javascript file and can be read everywhere.
Edit generator.php
You need to put attribute 777 to helios.js.
You can use crontab to make an update every 1 hours (don't forget to delete <?php require 'generator.php'; ?> in start to index.php you can rename to index.html after that).
<?php //---------------// Made by Daedalus email : daedalus at hotmail dot fr//--------------- $db_serv = 'x'; //the address of the database goes here $db_user = 'x'; //your sql username goes here$db_pass = 'x'; //your sql password goes here $db_name = 'l2jdb'; //your database name goes here $filename = './helios.js'; //generated javascript file you need to put attribute 777 in your folder //----------------------------------------------------------------------------------------------- @mysql_connect ( $db_serv, $db_user, $db_pass ) or die ('Coudn\'t connect to host');@mysql_select_db( $db_name ) or die ('Couldn\'t select database'); $sql = @mysql_query('SELECT id,name,taxPercent,siegeDate,siegeHourOfDay FROM `castle`') or die('Query failed!'); $gen = "\n"; while ($castle = @mysql_fetch_array($sql)){ $gen .= "\n".strtolower($castle['name']) . 'info = \'<div class="castleWrapper">'; $gen .= '<div class="castlePic" id="' . ucfirst(strtolower($castle['name'])) . 'Pic"></div>'; $gen .= '<div class="castleInfo">'; $gen .= '<div class="castleName"><strong>' . ucfirst(strtolower($castle['name'])) . ' Castle</strong></div>'; $clan = @mysql_fetch_array(mysql_query('SELECT clan_name,hasCastle FROM `clan_data` WHERE hasCastle = ' . $castle['id'])); $clan_name = (isset($clan['clan_name'])) ? htmlspecialchars($clan['clan_name'], ENT_QUOTES) : 'UNCLAIMED'; $gen .= '<div><strong>Controlled by:</strong> ' . $clan_name . '</div>'; if (isset($clan['clan_name'])) $gen .= '<div><strong>Tax Rate:</strong> ' . $castle['taxPercent'] . '%</div>'; $gen .= '<div><strong>Next Siege:</strong> ' . date('M d Y ',$castle['siegeDate']/1000) . $castle['siegeHourOfDay'] . date(':00 T') . '</div>'; $gen .= '</div></div>\';'."\n\n";} $handle = @fopen($filename, 'w+');@fwrite($handle, $gen);@fclose($handle); ?>
were the bold is is where i feel that this is where I'm getting a Query failed! but i can not be for sure what to stick in there and yes the helios.js file is setup correctly
Last edited by coolcat on Mon May 04, 2009 3:26 am, edited 1 time in total.
Just as an idea, it may be best to include a voice command in game that pops up a window (html generated from the voice command) to show all castle ownerships, taxes, and siegedates.
It's been something on my todo list that I had forgotten about until seeing your thread.
toastgodsupreme wrote:Just as an idea, it may be best to include a voice command in game that pops up a window (html generated from the voice command) to show all castle ownerships, taxes, and siegedates.
It's been something on my todo list that I had forgotten about until seeing your thread.
it seems that my todo list get bigger and bigger every day
toastgodsupreme wrote:Just as an idea, it may be best to include a voice command in game that pops up a window (html generated from the voice command) to show all castle ownerships, taxes, and siegedates.
It's been something on my todo list that I had forgotten about until seeing your thread.
it seems that my todo list get bigger and bigger every day
lol, sorry you should see my todo list!
but yeah, if you make it, remember to include the good spelling and bad one, people often mistype it. so siege and seige for the command. Oh, and show the server's current time at the top so people have a time to reference the siege dates by. I think I'll do that this week if i get time. got a lot of little projects i'm playing with.
toastgodsupreme wrote:Just as an idea, it may be best to include a voice command in game that pops up a window (html generated from the voice command) to show all castle ownerships, taxes, and siegedates.
It's been something on my todo list that I had forgotten about until seeing your thread.
it seems that my todo list get bigger and bigger every day
lol, sorry you should see my todo list!
but yeah, if you make it, remember to include the good spelling and bad one, people often mistype it. so siege and seige for the command. Oh, and show the server's current time at the top so people have a time to reference the siege dates by. I think I'll do that this week if i get time. got a lot of little projects i'm playing with.
That's a really good idea actually... if you need a hand or dont have time to do it, let me know.
i am not really a design guru, so feel free to change the design
is only basic functionality, so if someone makes it better, i would be happy to see it or if someone has ideas how it should look like, me (or someone else) can change the code
v2 - cache version (better use this one):
data is read from objects already loaded by gameserver
voice commands: .castle and .siege
You do not have the required permissions to view the files attached to this post.
Last edited by janiii on Fri May 08, 2009 2:11 pm, edited 6 times in total.
DO NOT EVEN TRY TO MESS WITH ME! forum flOOderdancing dEVILoper♀ I don't give private support - PM will be ignored!