Castle Control Script

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
daedalus
Posts: 155
Joined: Sun Mar 12, 2006 12:16 pm

Castle Control Script

Post 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
Last edited by daedalus on Tue Jul 21, 2015 10:52 am, edited 7 times in total.
Daedalus
User avatar
daedalus
Posts: 155
Joined: Sun Mar 12, 2006 12:16 pm

Re: Castle Control Script

Post by daedalus »

I'm working on to update the script.
Daedalus
User avatar
Plague
Posts: 5
Joined: Fri Jul 04, 2008 10:51 am

Re: Castle Control Script

Post by Plague »

Mind giving a small description about what its for ?

thnx, Plague
User avatar
daedalus
Posts: 155
Joined: Sun Mar 12, 2006 12:16 pm

Re: Castle Control Script

Post by daedalus »

The script has been made for show status of castle likes owner, taxes, next siege date.
Daedalus
User avatar
Plague
Posts: 5
Joined: Fri Jul 04, 2008 10:51 am

Re: Castle Control Script

Post 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
xanthos
Posts: 24
Joined: Wed Apr 30, 2008 12:23 pm

Re: Castle Control Script

Post by xanthos »

daedalus wrote: You need to put attribute 777 to helios.js.
What do u mean with that?
User avatar
daedalus
Posts: 155
Joined: Sun Mar 12, 2006 12:16 pm

Re: Castle Control Script

Post by daedalus »

it's rights of the file

Code: Select all

chmod 777 helios.js
Daedalus
coolcat
Posts: 5
Joined: Sat Mar 21, 2009 5:43 am

Re: Castle Control Script

Post 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
Last edited by coolcat on Mon May 04, 2009 3:26 am, edited 1 time in total.
toastgodsupreme
Posts: 750
Joined: Sun Dec 07, 2008 7:01 pm
Location: Poland

Re: Castle Control Script

Post 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. :)
coolcat
Posts: 5
Joined: Sat Mar 21, 2009 5:43 am

Re: Castle Control Script

Post 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
toastgodsupreme
Posts: 750
Joined: Sun Dec 07, 2008 7:01 pm
Location: Poland

Re: Castle Control Script

Post 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. :)
User avatar
theone
Posts: 1384
Joined: Tue Aug 12, 2008 2:28 am
Location: Quebec, Canada

Re: Castle Control Script

Post 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.
Image
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Castle Control Script

Post 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
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 flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
User avatar
DrHouse
L2j Inner Circle
L2j Inner Circle
Posts: 912
Joined: Mon Jan 22, 2007 12:14 am
Location: Spain

Re: Castle Control Script

Post by DrHouse »

Uhm it looks commitable as a mod
Image

Leadership and management are not talk and talk, but talk and do

Proud of being a part of this project
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: Castle Control Script

Post by Zealar »

Yes is verry nice , maybe is will be great to make also for raid boss "live or death". :P
Post Reply