Page 1 of 5

Castle Control Script

Posted: Wed Apr 15, 2009 8:59 am
by daedalus
An other Castle Control Script
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).

Code: Select all

MAILTO=""* */1 * * *    /home/god/castle
castle file

Code: Select all

wget http://localhost/castle/generator.phprm generator.php
Castle Script is inspirate of the retail castle info web page.


New Version : Castle Control Script
GitHub Version : l2j_castle

Re: Castle Control Script

Posted: Wed Apr 15, 2009 9:00 am
by daedalus
I'm working on to update the script.

Re: Castle Control Script

Posted: Thu Apr 16, 2009 11:25 am
by Plague
Mind giving a small description about what its for ?

thnx, Plague

Re: Castle Control Script

Posted: Thu Apr 16, 2009 11:45 am
by daedalus
The script has been made for show status of castle likes owner, taxes, next siege date.

Re: Castle Control Script

Posted: Thu Apr 16, 2009 6:47 pm
by Plague
right on, will have to give it a try, and if i like it convert it into summin that fits in with RN :P

Re: Castle Control Script

Posted: Tue Apr 21, 2009 4:04 pm
by xanthos
daedalus wrote: You need to put attribute 777 to helios.js.
What do u mean with that?

Re: Castle Control Script

Posted: Tue Apr 21, 2009 6:09 pm
by daedalus
it's rights of the file

Code: Select all

chmod 777 helios.js

Re: Castle Control Script

Posted: Mon May 04, 2009 2:33 am
by coolcat

Code: Select all

 <?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

Re: Castle Control Script

Posted: Mon May 04, 2009 3:22 am
by toastgodsupreme
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. :)

Re: Castle Control Script

Posted: Mon May 04, 2009 3:31 am
by coolcat
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

Re: Castle Control Script

Posted: Mon May 04, 2009 8:06 am
by toastgodsupreme
coolcat wrote:
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. :)

Re: Castle Control Script

Posted: Fri May 08, 2009 10:09 am
by theone
toastgodsupreme wrote:
coolcat wrote:
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.

Re: Castle Control Script

Posted: Fri May 08, 2009 12:00 pm
by janiii
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


Image

Re: Castle Control Script

Posted: Fri May 08, 2009 12:52 pm
by DrHouse
Uhm it looks commitable as a mod

Re: Castle Control Script

Posted: Fri May 08, 2009 1:15 pm
by Zealar
Yes is verry nice , maybe is will be great to make also for raid boss "live or death". :P