+ The new game has been created; however, it is not visible from the interface yet, you will have to
+ make it visible
+
+ The server is still in maintenance mode, you will have to disable it manually.
+
+ Main admin page
+
Please indicate the speed of the game and the day the game will begin on.
+
+
diff --git a/admin/cg_user_dsp_5.inc b/admin/cg_user_dsp_5.inc
new file mode 100644
index 0000000..741b8ea
--- /dev/null
+++ b/admin/cg_user_dsp_5.inc
@@ -0,0 +1,43 @@
+DATABASE CONNECTION ERROR";
+ exit(1);
+ }
+ $query = pg_query("SELECT id,name FROM main.account WHERE admin AND NOT name LIKE 'AI>%' ORDER BY name");
+ if (!$query) {
+ print "DATABASE CONNECTION ERROR";
+ exit(1);
+ }
+
+ $allAdmins = array();
+ while ($r = pg_fetch_row($query)) {
+ $allAdmins[$r[0]] = $r[1];
+ }
+
+ pg_close($cnx);
+}
+
+?>
+
Step 5 / 6 : silent admins
+
"Silent admins" are admins that will join the game for administrative purposes but won't play it. Please beware with this function, as a silent admin will no longer be able to join the game as a player.
+
diff --git a/admin/cg_user_dsp_6.inc b/admin/cg_user_dsp_6.inc
new file mode 100644
index 0000000..5190370
--- /dev/null
+++ b/admin/cg_user_dsp_6.inc
@@ -0,0 +1,213 @@
+DATABASE CONNECTION ERROR";
+ exit(1);
+}
+$query = pg_query("SELECT id,name FROM main.account WHERE admin AND NOT name LIKE 'AI>%' ORDER BY name");
+if (!$query) {
+ print "DATABASE CONNECTION ERROR";
+ exit(1);
+}
+
+$allAdmins = array();
+while ($r = pg_fetch_row($query)) {
+ $allAdmins[$r[0]] = $r[1];
+}
+
+$query = pg_query("SELECT * FROM main.ctf_map_def ORDER BY name");
+if (!$query) {
+ print "DATABASE ERROR";
+ exit(1);
+}
+
+$ctfMaps = array();
+while ($r = pg_fetch_assoc($query)) {
+ $ctfMaps[$r['id']] = $r;
+ $query2 = pg_query("SELECT COUNT(*) FROM main.ctf_map_layout WHERE map={$r['id']} AND spawn_here");
+ if (!$query2) {
+ print "DATABASE ERROR";
+ exit(1);
+ }
+ list($ctfMaps[$r['id']]['players']) = pg_fetch_array($query2);
+ pg_free_result($query2);
+}
+pg_free_result($query);
+
+pg_close($cnx);
+
+
+function __start($title) {
+?>
+
+ The Death of Rats is still in an experimental stage at this time, and no actual action is taken. What
+ it would do if it were fully enabled is logged on the "Actions taken" page nonetheless.
+ Most of the information it provides can be trusted, tho; however, if you suspect it sent a warning or "punished" a
+ player for no good reason, manual checks should be performed.
+
+
+ The following checks are performed:
+
+
+
use of open proxies
+
cookie deletion
+
trying to log on with a banned account
+
passwords shared between multiple accounts
+
simple multiing, as well as pass sharing
+
"vicious" multiing, implying that the cookies are cleared between each use
+
in-game checks for donations, tech exchanges, gifts and sales, and planet retake after abandon
+
+
+ Checks for concurrent session from the same IP as well as more in-game checks (alliance, posts, messages,
+ TA list, battles) are still missing.
+
+
About the different pages
+
+ This tool consists in a few different pages which give different information about the Death of Rats' current status.
+ These pages are:
+
+
+
+ Actions taken: the log of all actions the Death of Rats performed. This includes sending
+ warnings and deciding to punish players.
+
+
+ Decision points: the current amount of points for each pair of players that has been investigated thoroughly
+ by the Death of Rats. Pairs with over 100 points will cause the Death of Rats to act.
+
+
+ In-game checks log: the latest 400 entries of the checks performed in-game on suspicious players as well
+ as the results of these checks.
+
+
+ Multiplayer points: the current amount of points for each pair of accounts that could be multiing or
+ abusing pass-sharing.
+
+
+ Multiplayer log: the latest 200 entries of the suspicious events detected between pairs of accounts.
+
+
+ Single player points: the current amount of points for each account that has performed suspicious actions.
+ While these points are normally not a problem, they influence multiplayer scores.
+
+
+ Single player log: the latest 200 suspicious events detected for single accounts.
+
+
+ Execution log: the latest 200 runs of the Death of Rats.
+
+ This page shows the log of the previous 200 executions of the Death of Rats tick. The Changes column indicates
+ the amount of changes (connection records, password updates) examined; the Events column indicates the amount
+ of entries added to either the single player log or the multiplayer log.
+
+
+}
+
+function showSingleLog() {
+ $db = __dbConnect();
+ $entries = array();
+ $q = pg_query($db, "SELECT a.name,l.message,l.ts FROM main.dor_single l, main.account a WHERE a.id = l.account AND a.status NOT IN ('QUIT', 'INAC', 'KICKED') ORDER BY l.ts DESC,a.name ASC LIMIT 200");
+ while ($r = pg_fetch_assoc($q)) {
+ $entries[] = $r;
+ }
+ pg_close($db);
+?>
+
Previous 200 single player log entries
+
+ This page shows the log of the previous 200 log entries generated for single players.
+
+
+
+
Time & date
+
Account
+
Message
+
+
+
+ $messages = array(
+ "ASSHOLE" => "Tried to log on using a banned account",
+ "PROXY" => "Currently using an open proxy",
+ "CLCOOK-SIP" => "Cleared cookies from the same IP",
+ "CLCOOK-DIP" => "Cleared cookies from a different (but close) IP",
+ );
+
+ foreach ($entries as $entry) {
+?>
+
+
+}
+
+function showSinglePoints() {
+ $db = __dbConnect();
+ $entries = array();
+ $q = pg_query($db, "SELECT a.name,l.points FROM main.dor_single_points l, main.account a WHERE a.id = l.account AND a.status NOT IN ('QUIT', 'INAC', 'KICKED') ORDER BY l.points DESC,a.name ASC");
+ while ($r = pg_fetch_assoc($q)) {
+ $entries[] = $r;
+ }
+ pg_close($db);
+?>
+
Single player "badness points"
+
+ These points correspond to recent suspicious activities from active accounts.
+
+
+
+
Account
+
Points
+
+
+ foreach ($entries as $entry) {
+?>
+
+
=htmlentities($entry['name'])?>
+
=$entry['points']?>
+
+
+ }
+?>
+
+
+}
+
+function showInGameChecks() {
+ $db = __dbConnect();
+ $entries = array();
+ $q = pg_query($db, "SELECT a1.name as name1, a2.name as name2, l.message, l.ts, l.game FROM main.dor_ingame_check l, main.account a1, main.account a2 WHERE a1.id = l.account1 AND a2.id = l.account2 AND a1.status NOT IN ('QUIT', 'INAC', 'KICKED') AND a2.status NOT IN ('QUIT', 'INAC', 'KICKED') ORDER BY l.ts DESC,a1.name ASC, a2.name ASC LIMIT 400");
+ while ($r = pg_fetch_assoc($q)) {
+ $entries[] = $r;
+ }
+ pg_close($db);
+?>
+
Latest 400 in-game checks log entries
+
+ This page shows the log of the latest 400 log entries generated by in-game checks on players. Events logged here
+ belong to different categories:
+
+
+
Somewhat suspicious events: donations of less than €100,000; rejected tech offers
+
+ Suspicious events: donations of less than €1,000,000; pending tech offers; accepted techs offer with
+ a price greater than €1,000; planets taken by a player within 5 days of being abandonned by the other; sales
+ of planets or fleets.
+
+
+ Highly suspicious events: donations of less than €10,000,000; gifts; tech offers with a price lower
+ than €1,000.
+
+
+ Extremely suspicious events: donations of more than €10,000,000.
+
+
+}
+
+function showFinalPoints() {
+ $db = __dbConnect();
+ $entries = array();
+ $q = pg_query($db, "SELECT a1.name as name1, a2.name as name2, l.points FROM main.dor_final_points l, main.account a1, main.account a2 WHERE a1.id = l.account1 AND a2.id = l.account2 AND a1.status NOT IN ('QUIT', 'INAC', 'KICKED') AND a2.status NOT IN ('QUIT', 'INAC', 'KICKED') ORDER BY l.points DESC,a1.name ASC, a2.name ASC");
+ while ($r = pg_fetch_assoc($q)) {
+ $entries[] = $r;
+ }
+ pg_close($db);
+?>
+
Final decision points
+
+ This page displays the current amount of points for each pair of players that has been investigated thoroughly
+ by the Death of Rats. Pairs will over 100 points will cause the Death of Rats to act.
+
+
+
+
Account 1
+
Account 2
+
Points
+
+
+ foreach ($entries as $entry) {
+?>
+
+
=htmlentities($entry['name1'])?>
+
=htmlentities($entry['name2'])?>
+
=$entry['points']?>
+
+
+ }
+?>
+
+
+}
+
+
+function showMultiPoints() {
+ $db = __dbConnect();
+ $entries = array();
+ $q = pg_query($db, "SELECT (a1.id || ',' || a2.id) as id, a1.name as name1, a2.name as name2, l.points FROM main.dor_multi_points l, main.account a1, main.account a2 WHERE a1.id = l.account1 AND a2.id = l.account2 AND a1.status NOT IN ('QUIT', 'INAC', 'KICKED') AND a2.status NOT IN ('QUIT', 'INAC', 'KICKED') ORDER BY l.points DESC,a1.name ASC, a2.name ASC");
+ while ($r = pg_fetch_assoc($q)) {
+ $entries[] = $r;
+ }
+ pg_close($db);
+ $displayed = array();
+?>
+
Multiplayer "badness points"
+
+ This page shows the list of "badness points" between pairs of accounts. The higher the badness points, the more likely
+ the accounts are multis.
+
+ WARNING: make sure you know what you're doing here - there are no second chances on this page;
+ if you click something, that "something" will happen at once.
+
Tick manager status:
+
+if ($mRunning === false) {
+?>
+not running - Start manager
+
+} else {
+?> running, process ID #=$mRunning?> - Kill manager
+
+ if ($tActive === 'pending') {
+?> Ticks status change pending; please reload the page.
+ This can take up to 20 seconds, be patient.
+
+ } elseif ($tActive) {
+?> Ticks are active - Disable ticks
+
+ } else {
+?> Ticks are inactive - Enable ticks
+
+ }
+}
+
+?>
+
+
Manual controls
+$statusMessage\n";
+}
+?>
+
+
+
+
+
+
diff --git a/ircbot/bot.conf b/ircbot/bot.conf
new file mode 100644
index 0000000..357d3e3
--- /dev/null
+++ b/ircbot/bot.conf
@@ -0,0 +1,147 @@
+;+---------------------------------------------------------------------------
+;| PHP-IRC v2.2.1 Service Release
+;| =======================================================
+;| by Manick
+;| (c) 2001-2006 by http://www.phpbots.org/
+;| Contact: manick@manekian.com
+;| irc: #manekian@irc.rizon.net
+;| ========================================
+;| Special Contributions were made by:
+;| cortex
+;+---------------------------------------------------------------------------
+;| > Configuration File
+;+---------------------------------------------------------------------------
+;| > This program is free software; you can redistribute it and/or
+;| > modify it under the terms of the GNU General Public License
+;| > as published by the Free Software Foundation; either version 2
+;| > of the License, or (at your option) any later version.
+;| >
+;| > This program is distributed in the hope that it will be useful,
+;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;| > GNU General Public License for more details.
+;| >
+;| > You should have received a copy of the GNU General Public License
+;| > along with this program; if not, write to the Free Software
+;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;+---------------------------------------------------------------------------
+;| Changes
+;| =======-------
+;| > If you wish to suggest or submit an update/change to the source
+;| > code, email me at manick@manekian.com with the change, and I
+;| > will look to adding it in as soon as I can.
+;+---------------------------------------------------------------------------
+
+
+;====Bot config file
+
+;====Contains the nickname of the Bot
+nick LW-Bot
+
+;====The nickserv password, if any (autoident)..
+password ...
+
+;====Real name..
+realname Legacy Worlds Bot
+
+;====The server you are going to connect to
+server localhost
+
+;====The server port
+port 6667
+
+;====The server password you are going to connect to
+;serverpassword test
+
+;====NAT IP
+;natip 192.168.1.101
+
+;===BIND IP
+;Specify the IP this bot should bind to when connecting to a server
+;bind 127.0.0.1
+
+;====DCC Range start for chats/files
+;dccrangestart 6081
+
+;====DCC Reverse Protocl
+;This follows the mIRC DCC Server Protocol
+;When this is set, you will connect to this port
+;on the users machine, and send them the file, similar to
+;sysreset's firewall workaround.
+;This function is EXPERIMENTAL
+;====
+;mircdccreverse 4000
+
+;====Who on join?
+;After joining a channel, populate the host lists
+;with /WHO information? This probably isn't so good
+;for larger channels...
+;This function populates host/ident information for
+;all users in a channel. Useful for running channel protection
+;scripts and such. The DCC Reverse setting above using a WHOIS
+;command to get user hosts, so this doesn't have to be set
+;to use the above setting.
+;====
+;populatewho
+
+;====Populate ban list?
+;This will make php-irc run MODE #chan +b upon joining, populating
+;the ban list. This is useful for running channel protection or ban
+;rotating scripts.
+;====
+;populatebans
+
+;====Flood lines
+;when someone types text that is a trigger for the bot, how many times can they type
+;different triggers (within a 10 second period) before the bot ignores them for spamming the bot
+floodlines 500
+
+;====Time to ban user in seconds for abusing the bots triggers
+floodtime 60
+
+;====Channels.. unlimited
+;====i.e., channel #channel key
+;====but you don't have to specify a key
+channel #testing meeeh
+
+;====Your ident
+ident lwbot
+
+;====Log file
+logfile __CFG:cachedir__/ircbot.log
+
+;====uncomment the following lines to use a database
+;either 'usedatabase mysql' or 'usedatabase postgre'
+;usedatabase mysql
+
+;dbuser root
+;dbpass none
+;db question
+;dbprefix bot_
+;dbhost localhost
+;dbport
+
+;====Send queue timeout
+;How often to send more text to the irc server. This handles the 'notice'
+;and 'privMsg' commands sent from modules and such (in seconds)
+queuetimeout 1
+
+;====Send queue buffer
+;How many bytes of text to send to the server every 'queuetimeout' period.
+queuebuffer 225
+
+;====Perm. Ignore (These hosts will always be ignored, forever)
+;example:
+;ignore *!*@*
+
+;====DCC Admin password //default is 'mypass'
+;dccadminpass a029d0df84eb5549c641e04a9ef389e5
+
+;====set this to your function file
+functionfile function.conf
+
+;====whether this bot accepts sends from other people
+upload no
+
+;====The place where uploaded files are put.
+;uploaddir /home/my/dir/
diff --git a/ircbot/bot.php b/ircbot/bot.php
new file mode 100644
index 0000000..1719a6a
--- /dev/null
+++ b/ircbot/bot.php
@@ -0,0 +1,476 @@
+ Main module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+error_reporting(E_ALL);
+set_time_limit(0);
+
+
+$oldDir = getcwd();
+chdir("../scripts");
+$__logPrefix = "lwBot";
+$__loader = array(
+ 'log', 'classloader', 'version', 'game', 'tick', 'config',
+ 'db_connection', 'db_accessor', 'db', 'library'
+);
+require_once('loader.inc');
+chdir($oldDir);
+
+require('./defines.php');
+require('./queue.php');
+require('./module.php');
+require('./irc.php');
+require('./socket.php');
+require('./timers.php');
+require('./dcc.php');
+require('./chat.php');
+require('./file.php');
+require('./parser.php');
+require('./databases/ini.php');
+require('./error.php');
+require('./connection.php');
+require('./remote.php');
+
+
+final class bot {
+
+ /* Global socket class used by all bots */
+ private $socketClass;
+
+ /* Global process Queue used by all bots, timers, dcc classes */
+ private $procQueue;
+
+ /* Whether we are running in background mode or not. (not sure if this is used anymore */
+ private $background = 0;
+
+ //contain all the bots
+ private $bots = array();
+
+ // save the only one instance of bot (singleton)
+ private static $_instance;
+
+ public static function getInstance()
+ {
+ if (!isset (self :: $_instance))
+ {
+ self :: $_instance = new bot();
+ }
+ return self :: $_instance;
+ }
+
+
+ //Main Method
+ private function __construct()
+ {
+
+ $this->socketClass = new socket();
+ $this->procQueue = new processQueue();
+
+ $this->socketClass->setProcQueue($this->procQueue);
+
+ $this->readConfig();
+ }
+
+ public function launch(){
+
+ foreach($this->bots as $bot)
+ {
+ $this->createBot($bot);
+ }
+
+ try
+ {
+
+ /* Main program loop */
+
+ while (1)
+ {
+ //Get data from sockets, and trigger procQueue's for new data to be read
+ $this->socketClass->handle();
+
+ //The bots main process loop. Run everything we need to!
+ $timeout = $this->procQueue->handle();
+
+ //Okay, set the socketclass timeout based on the next applicable process
+ if ($timeout !== true)
+ {
+ $this->socketClass->setTimeout($timeout);
+ }
+
+ //echo $this->procQueue->getNumQueued() . "\n";
+ //$this->procQueue->displayQueue();
+
+ //Aight, if we don't have any sockets open/in use, and
+ //we have no processes in the process queue, then there are
+ //obviously no bots running, so just exit!
+ if ($this->socketClass->getNumSockets() == 0 && $this->procQueue->getNumQueued() == 0)
+ {
+ break;
+ }
+ }
+
+ }
+ catch (Exception $e)
+ {
+ $this->ircClass->log($e->_toString());
+ }
+
+ }
+
+
+ public static function addBot($filename){
+ $bot = bot::getInstance();
+ $config = bot::parseConfig($filename);
+ if ($config == false)
+ {
+ return false;
+ }
+
+ $newBot = new botClass();
+ $newBot->config = $config;
+ $newBot->configFilename = $filename;
+
+ $bot->bots[] = $newBot;
+ $bot->createBot($newBot);
+ return true;
+ }
+
+
+ private function createBot($bot)
+ {
+ $this->connectToDatabase($bot);
+
+ $bot->socketClass = $this->socketClass;
+ $bot->timerClass = new timers();
+ $bot->parserClass = new parser();
+
+ $bot->dccClass = new dcc();
+ $bot->ircClass = new irc();
+
+ $bot->ircClass->setConfig($bot->config, $bot->configFilename);
+ $bot->ircClass->setSocketClass($this->socketClass);
+ $bot->ircClass->setParserClass($bot->parserClass);
+ $bot->ircClass->setDccClass($bot->dccClass);
+ $bot->ircClass->setTimerClass($bot->timerClass);
+ $bot->ircClass->setProcQueue($this->procQueue);
+
+ $bot->dccClass->setSocketClass($this->socketClass);
+ $bot->dccClass->setTimerClass($bot->timerClass);
+ $bot->dccClass->setParserClass($bot->parserClass);
+ $bot->dccClass->setProcQueue($this->procQueue);
+
+ $bot->parserClass->setTimerClass($bot->timerClass);
+ $bot->parserClass->setSocketClass($this->socketClass);
+ $bot->parserClass->setDatabase($bot->db);
+
+ $bot->timerClass->setIrcClass($bot->ircClass);
+ $bot->timerClass->setSocketClass($this->socketClass);
+ $bot->timerClass->setProcQueue($this->procQueue);
+
+ $bot->parserClass->init();
+
+ //Okay, this function adds the connect timer and starts up this bot class.
+ $bot->ircClass->init();
+
+ bot::createChannelArray($bot->ircClass);
+
+ }
+
+
+ private function readConfig()
+ {
+ global $argc, $argv;
+
+ if ($argc < 2) {
+ $args = array(config::$main['scriptdir'] . "/../ircbot/bot.conf");
+ } else {
+ $args = $argv;
+ array_shift($args);
+ }
+
+ $isPasswordEncrypt = false;
+
+ foreach ($args AS $filename)
+ {
+ if ($filename == "")
+ {
+ continue;
+ }
+
+ if ($isPasswordEncrypt == true)
+ {
+ die("Encrypted Password: " . md5($filename) . "\nReplace this as 'dccadminpass' in bot.conf!");
+ }
+
+ if ($filename == "-c")
+ {
+ $isPasswordEncrypt = true;
+ continue;
+ }
+
+ if ($filename == "-b" && $this->background != 1)
+ {
+ $this->background = 1;
+ $this->doBackground();
+ continue;
+ }
+
+ $config = bot::parseConfig($filename);
+
+ if ($config == false)
+ {
+ echo "Could not spawn bot $filename";
+ die();
+ }
+
+ $bot = new botClass();
+ $bot->config = $config;
+ $bot->configFilename = $filename;
+
+ $this->bots[] = $bot;
+ }
+
+ if ($isPasswordEncrypt == true) {
+ die("No password submitted on command line! Syntax: bot.php -c \n");
+ }
+
+ if (! $this->background && PID != '') {
+ $file = fopen(PID, "w+");
+ fwrite($file, getmypid());
+ fclose($file);
+ }
+ }
+
+
+
+
+ private function connectToDatabase($bot)
+ {
+ if (isset($bot->config['usedatabase']))
+ {
+ if (!file_exists("./databases/" . $bot->config['usedatabase']. ".php"))
+ {
+ die("Couldn't find the database file! Make sure it exists!");
+ }
+
+ require_once("./databases/" . $bot->config['usedatabase']. ".php");
+
+ $dbType = $bot->config['usedatabase'];
+
+ if (!isset($bot->config['dbhost']))
+ $bot->config['dbhost'] = "localhost";
+ if (!isset($bot->config['dbuser']))
+ $bot->config['dbuser'] = "root";
+ if (!isset($bot->config['dbpass']))
+ $bot->config['dbpass'] = "";
+ if (!isset($bot->config['db']))
+ $bot->config['db'] = "test";
+ if (!isset($bot->config['dbprefix']))
+ $bot->config['dbprefix'] = "";
+ if (!isset($bot->config['dbport']))
+ {
+ $bot->db = new $dbType($bot->config['dbhost'],
+ $bot->config['db'],
+ $bot->config['dbuser'],
+ $bot->config['dbpass'],
+ $bot->config['dbprefix']);
+ }
+ else
+ {
+ $bot->db = new $dbType($bot->config['dbhost'],
+ $bot->config['db'],
+ $bot->config['dbuser'],
+ $bot->config['dbpass'],
+ $bot->config['dbprefix'],
+ $bot->config['dbport']);
+ }
+
+ if (!$bot->db->isConnected())
+ {
+ die("Couldn't connect to database...");
+ }
+
+ }
+ }
+
+
+ public static function createChannelArray($ircClass)
+ {
+ $channels = $ircClass->getClientConf('channel');
+
+ if ($channels != "")
+ {
+ if (!is_array($channels))
+ {
+ $channels = array($channels);
+ }
+
+ foreach ($channels AS $channel)
+ {
+ $chan = $channel;
+ $key = "";
+
+ if (strpos($channel, chr(32)) !== false)
+ {
+ $channelVars = explode(chr(32), $channel);
+ $chan = $channelVars[0];
+ $key = $channelVars[1];
+ }
+
+ $ircClass->maintainChannel($chan, $key);
+ }
+ }
+ }
+
+ public static function parseConfig($filename)
+ {
+ $configFPtr = @fopen($filename, "rt");
+
+ if ($configFPtr == null)
+ {
+ // echo "Could not find config file '".$filename."'\n";
+ return false;
+ }
+
+ $configRaw = "";
+
+ try
+ {
+
+ while (!feof($configFPtr))
+ {
+ $configRaw .= fgets($configFPtr, 1024);
+ }
+
+ fclose($configFPtr);
+
+ }
+ catch (Exception $e)
+ {
+ // echo "A fatal IO Exception occured.";
+ return false;
+ }
+
+ $config = array();
+
+ $configRaw = str_replace("\r", "", $configRaw);
+
+ $confLines = explode("\n", $configRaw);
+
+ foreach ($confLines AS $line)
+ {
+ $line = trim($line);
+
+ if ($line == "" || substr($line, 0, 1) == ";")
+ {
+ continue;
+ }
+
+ $offsetA = strpos($line, chr(32));
+
+ if ($offsetA != false)
+ {
+ $confVar = substr($line, 0, $offsetA);
+ $confParams = substr($line, $offsetA + 1);
+ }
+ else
+ {
+ $confVar = $line;
+ $confParams = "";
+ }
+
+ if (preg_match('/__CFG:([a-zA-Z_]+)__/', $confParams, $matches)) {
+ $src = array(); $dst = array();
+ array_shift($matches);
+ foreach ($matches as $cfgSubst) {
+ array_push($src, "/__CFG:{$cfgSubst}__/");
+ array_push($dst, config::$main[$cfgSubst]);
+ }
+ $confParams = preg_replace($src, $dst, $confParams);
+ }
+
+ if (isset($config[$confVar]))
+ {
+ if (!is_array($config[$confVar]))
+ {
+ $prevParam = $config[$confVar];
+ $config[$confVar] = array();
+ $config[$confVar][] = $prevParam;
+ }
+
+ $config[$confVar][] = $confParams;
+
+ }
+ else
+ {
+ $config[$confVar] = $confParams;
+ }
+ }
+
+ return $config;
+ }
+
+
+ private function doBackground()
+ {
+ $pid = pcntl_fork();
+ if ($pid == -1) {
+ die("Error: could not fork\n");
+ } else if ($pid) {
+ if (PID != "") {
+ $file = fopen(PID, "w+");
+ fwrite($file, $pid);
+ fclose($file);
+ }
+
+ exit(); // Parent
+ }
+
+ if (!posix_setsid()) {
+ die("Error: Could not detach from terminal\n");
+ }
+
+ fclose(STDIN);
+ fclose(STDOUT);
+ fclose(STDERR);
+ }
+
+}
+
+$ircBot = bot::getInstance();
+$ircBot->launch();
+
+?>
diff --git a/ircbot/chat.php b/ircbot/chat.php
new file mode 100644
index 0000000..cd5abaf
--- /dev/null
+++ b/ircbot/chat.php
@@ -0,0 +1,364 @@
+ dcc chat module
+| > Module written by Manick
+| > Module Version Number: 2.2.1 beta
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class chat {
+
+ /* Chat specific Data */
+ public $id;
+ public $status;
+ public $sockInt;
+ public $isAdmin;
+ public $timeConnected;
+ public $verified;
+ public $readQueue;
+ public $floodQueue;
+ public $floodQueueTime;
+ public $port;
+ public $type;
+ public $nick;
+ public $timeOutLevel;
+ public $removed;
+ public $connection;
+
+ public $handShakeSent;
+ public $handShakeTime;
+ public $reverse;
+ public $connectHost;
+
+ /* Classes */
+ private $dccClass;
+ private $parserClass;
+ private $ircClass;
+ private $socketClass;
+ private $timerClass;
+
+ //class handler
+ private $handler;
+
+ /* Constructor */
+ public function __construct($id, $nick, $admin, $sockInt, $host, $port, $handler, $reverse)
+ {
+ $this->id = $id;
+ $this->handler = $handler;
+ $this->nick = $nick;
+ $this->isAdmin = $admin;
+ $this->sockInt = $sockInt;
+ $this->port = $port;
+ $this->connectHost = $host;
+ $this->reverse = $reverse;
+ $this->handShakeSent = false;
+
+ $this->sendQueue = array();
+ $this->sendQueueCount = 0;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setDccClass($class)
+ {
+ $this->dccClass = $class;
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setParserClass($class)
+ {
+ $this->parserClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ private function sendUserGreeting()
+ {
+ if ($this->verified == true)
+ {
+ return;
+ }
+
+ $this->dccSend("Welcome to " . $this->ircClass->getNick());
+ $this->dccSend("PHP-iRC v". VERSION ." [". VERSION_DATE ."]");
+ $time = $this->ircClass->timeFormat($this->ircClass->getRunTime(), "%d days, %h hrs, %m min, %s sec");
+ $this->dccSend("running " . $time);
+ $this->dccSend("You are currently in the dcc chat interface. Type 'help' to begin.");
+ }
+
+ private function sendAdminGreeting()
+ {
+ if ($this->verified == true)
+ {
+ return;
+ }
+
+ $this->dccSend("Welcome to " . $this->ircClass->getNick());
+ $this->dccSend("PHP-iRC v". VERSION ." [". VERSION_DATE ."]");
+ $time = $this->ircClass->timeFormat($this->ircClass->getRunTime(), "%d days, %h hrs, %m min, %s sec");
+ $this->dccSend("running " . $time);
+ $this->dccSend("Enter Your Password:");
+ }
+
+ public function dccSend($data, $to = null)
+ {
+ if ($this->status != DCC_CONNECTED)
+ {
+ return;
+ }
+
+ if ($to == null)
+ {
+ $to = $this;
+ }
+
+ $this->dccClass->dccSend($to, "--> " . $data . "\n");
+ }
+
+ public function dccSendRaw($data, $to = null)
+ {
+ if ($this->status != DCC_CONNECTED)
+ {
+ return;
+ }
+
+ if ($to == null)
+ {
+ $to = $this;
+ }
+
+ $this->dccClass->dccSend($to, $data);
+ }
+
+
+ public function disconnect($msg = "")
+ {
+
+ $msg = str_replace("\r", "", $msg);
+ $msg = str_replace("\n", "", $msg);
+
+ if (is_object($this->handler) && $this->status == DCC_CONNECTED)
+ {
+ $this->handler->disconnected($this);
+ }
+
+ $this->status = false;
+
+ if ($msg != "")
+ {
+ $this->dccClass->dccInform("DCC: " . $this->nick . " closed DCC Chat (" . $msg . ")", $this);
+ $this->ircClass->notice($this->nick, "DCC session ended: " . $msg, 1);
+ }
+ else
+ {
+ $this->dccClass->dccInform("DCC: " . $this->nick . " closed DCC Chat", $this);
+ }
+
+ $this->dccClass->disconnect($this);
+
+ $this->connection = null;
+
+ return true;
+ }
+
+
+
+ private function doHandShake()
+ {
+ $this->dccSendRaw("100 ".$this->ircClass->getNick()."\n");
+ $this->handShakeSent = true;
+ $this->timerClass->addTimer(irc::randomHash(), $this, "handShakeTimeout", "", 8);
+ }
+
+ private function processHandShake()
+ {
+ if ($this->readQueue == "")
+ {
+ return;
+ }
+
+ $response = $this->readQueue;
+ $this->readQueue = "";
+ $responseArray = explode(chr(32), $response);
+ if ($responseArray[0] == "101")
+ {
+ $this->reverse = false;
+ $this->onConnect($this->connection);
+ return;
+ }
+
+ $this->disconnect("DCC Client Server reported error on attempt to start chat");
+ }
+
+ public function handShakeTimeout()
+ {
+ if ($this->status != false)
+ {
+ if ($this->reverse == true)
+ {
+ $this->disconnect("DCC Reverse handshake timed out");
+ }
+ }
+ return false;
+ }
+
+ /* Main events */
+ public function onTimeout($conn)
+ {
+ $this->disconnect("Connection transfer timed out");
+ }
+
+ public function onDead($conn)
+ {
+ $this->disconnect($this->connection->getErrorMsg());
+ }
+
+ public function onRead($conn)
+ {
+ if ($this->socketClass->hasLine($this->sockInt))
+ {
+ $this->readQueue .= $this->socketClass->getQueueLine($this->sockInt);
+ }
+
+ if ($this->status == DCC_CONNECTED)
+ {
+ if ($this->reverse != false)
+ {
+ if ($this->handShakeSent != false)
+ {
+ $this->processHandShake();
+ }
+ }
+ else
+ {
+ if ($this->readQueue != "")
+ {
+ $this->parserClass->parseDcc($this, $this->handler);
+ }
+ }
+
+ }
+
+ if ($this->socketClass->hasLine($this->sockInt))
+ {
+ return true;
+ }
+ }
+
+ public function onWrite($conn)
+ {
+ //do nothing
+ }
+
+ public function onAccept($oldConn, $newConn)
+ {
+ $this->dccClass->accepted($oldConn, $newConn);
+ $this->connection = $newConn;
+ $oldConn->disconnect();
+ $this->sockInt = $newConn->getSockInt();
+ $this->onConnect($newConn);
+ }
+
+ public function onConnectTimeout($conn)
+ {
+ $this->disconnect("Connection attempt timed out");
+ }
+
+ public function onConnect($conn)
+ {
+ $this->status = DCC_CONNECTED;
+
+ if ($this->reverse != false)
+ {
+ $this->dccClass->dccInform("DCC CHAT: " . $this->nick . " handling dcc server request");
+ $this->doHandShake();
+ return;
+ }
+
+ $this->dccClass->dccInform("DCC CHAT: " . $this->nick . " connection established");
+
+ if ($this->handler === false || $this->handler == null)
+ {
+ if ($this->isAdmin == true)
+ {
+ $this->sendAdminGreeting();
+ }
+ else
+ {
+ $this->sendUserGreeting();
+ }
+ }
+ else
+ {
+
+ if (is_object($this->handler))
+ {
+ $this->handler->connected($this);
+ }
+ }
+
+ }
+
+
+ public function initialize()
+ {
+
+ $this->dccClass->dccInform("DCC: " . $this->nick . " is attempting to login");
+
+ if ($this->status == DCC_LISTENING)
+ {
+ $this->ircClass->privMsg($this->nick, "\1DCC CHAT chat " . $this->ircClass->getClientIP(1) . " " . $this->port . "\1", 0);
+ $this->ircClass->notice($this->nick, "DCC Chat (" . $this->ircClass->getClientIP(0) . ")", 0);
+ }
+
+ $this->timeConnected = time();
+ $this->timeOutLevel = 0;
+ $this->verified = 0;
+ $this->readQueue = "";
+ $this->floodQueue = "";
+ $this->floodQueueTime = 0;
+ $this->type = CHAT;
+ }
+
+
+}
+
+?>
diff --git a/ircbot/command_reference.txt b/ircbot/command_reference.txt
new file mode 100644
index 0000000..72611e2
--- /dev/null
+++ b/ircbot/command_reference.txt
@@ -0,0 +1,870 @@
++---------------------------------------------------------------------------
+| PHP-IRC v2.2.1 Service Release
+| ========================================================
+| by Manick
+| (c) 2001-2006 by http://www.phpbots.org/
+| Contact: manick@manekian.net
+| irc: #manekian@irc.rizon.net
+| ========================================================
++---------------------------------------------------------------------------
+| > Module Command Reference
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+
+The following file is a quickly put together command reference of all the functions that you can use to complement the php scripting language while writing your modules.
+
+===============
+Quick Reference (See below the quick reference for function descriptions)
+===============
+
+irc.php (Accessed with $this->ircClass->)
+-----------------------------------------
+array parseModes($modeString)
+array getMaintainedChannels()
+string getClientConf($var = "")
+string getNick()
+string getServerConf($var)
+string getStatusString($status)
+string getClientIP($long = 1)
+class getChannelData($channel)
+class getUserData($user, $channel = "")
+void disconnect()
+void setClientConfigVar($var, $value)
+void joinChannel($chan)
+void sendRaw($text, $force = false)
+void privMsg($who, $msg, $queue = 1)
+void action($who, $msg, $queue = 1)
+void notice($who, $msg, $queue = 1)
+void log($text)
+void maintainChannel($channel, $key = "")
+void removeMaintain($channel)
+void addQuery($host, $port, $query, $line, $class, $function)
+int getStatusRaw()
+bool changeMode($chan, $act, $mode, $user)
+bool isOnline($nick, $chan)
+bool isMode($nick, $channel, $mode)
+bool isChanMode($channel, $mode, $extra = "")
+bool hasModeSet($chan, $user, $modes);
+bool hostMasksMatch($mask1, $mask2)
+bool checkIgnore($mask)
+
+socket.php (Accessed with $this->socketClass->)
+-----------------------------------------------
+string getHost($sockInt)
+string getQueue($sockInt)
+string getQueueLine($sockInt)
+int sendSocket($sockInt, $data)
+int getSockStatus($sockInt)
+object getSockData($sockInt)
+bool hasWriteQueue($sockInt)
+bool hasLine($sockInt)
+
+timers.php (Accessed with $this->timerClass->)
+----------------------------------------------
+class addTimer($name, $class, $function, $args, $interval, $runRightAway = false)
+class getTimers()
+void removeTimer($timer) (MUST be name)
+
+mysql/postgre.php (Accessed with $this->db->)
+---------------------------------------------
+array queryFetch($query)
+array fetchArray($object)
+array fetchRow($object)
+string getError()
+bool isConnected()
+int lastID()
+int numRows($toFetch)
+int numQueries()
+void close()
+object query($query)
+
+dcc.php (Accessed with $this->dccClass->)
+-----------------------------------------
+array getDccList()
+int getDownloadCount()
+int getUploadCount()
+int getChatCount()
+int getBytesDown()
+int getBytesUp()
+int addChat($nick, $host, $port, $admin, $handler)
+int addFile($nick, $host, $port, $type, $filename, $size)
+int sendFile($nick, $file)
+class getDcc($dcc)
+void dccInform($text, $from = null)
+
+chat.php
+----------
+void disconnect($msg = "")
+void dccSend($msg)
+
+file.php
+----------
+void disconnect($msg = "")
+
+ini.php
+----------
+bool getError()
+bool sectionExists($section)
+bool deleteSection($section)
+bool deleteVar($section, $var)
+bool setIniVal($section, $var, $val)
+bool writeIni()
+array getSections()
+array getVars($section)
+array getSection($section)
+array randomSection($num = 1)
+array searchSections($search, $type = EXACT_MATCH)
+array searchVars($section, $search, $type = EXACT_MATCH)
+array searchSectionsByVar($var, $search, $type = EXACT_MATCH)
+array searchVals($section, $search, $type = EXACT_MATCH)
+mixed randomVar($section, $num = 1)
+mixed getIniVal($section, $var)
+int numSections()
+int numVars($section)
+
+Useful Static Routines
+-----------------------
+string socket::generatePostQuery($query, $host, $path, $httpVersion)
+string socket::generateGetQuery($query, $host, $path, $httpVersion)
+string irc::intToSizeString($size)
+string irc::myStrToLower($text)
+string irc::myStrToUpper($text)
+string irc::timeFormat($time, $format)
+string irc::randomHash()
+array irc::multiLine($text)
+
+
+=========================
+Full Function Definitions
+=========================
+
+irc.php (Accessed with $this->ircClass->)
+-----------------------------------------
+
+-------------------------------
+array parseModes($modeString)
+-------------------------------
+
+Mode strings usually come from the $line['params'] variable. However, they look like this:
+
++o-b Manick blah!*@*
+
+This is a real mess to parse. Thus, this function takes the line and returns an array of each mode being operated. The format is as follows:
+
+$modesArray = array(
+
+ [0] = array( 'ACTION' => '+',
+ 'MODE' => 'o',
+ 'EXTRA' => 'Manick',
+ 'TYPE' => USER_MODE,
+ )
+
+ [1] = array( 'ACTION' => '-',
+ 'MODE' => 'b',
+ 'EXTRA' => 'blah!*@*',
+ 'TYPE' => CHANNEL_MODE,
+ )
+)
+
+
+--------------------------------
+array getMaintainedChannels()
+--------------------------------
+This will return an array of all the channels that php-irc will attempt to stay in. Every sixty seconds or so, the bot will attempt to join these channels if it is not currently in them. See 'maintainChannel()' and 'removeMaintain()' for more information.
+
+
+--------------------------------
+string getClientConf($var = "")
+--------------------------------
+
+Will return the corresponding value for the setting of $var in bot.conf. If $var == "", the full configuration array is returned as an array. Also, if the setting does not exist in the configuration, this function will return an empty string, "".
+
+
+--------------------------------
+string getNick()
+--------------------------------
+
+Returns the bots current, IRC recognized nick.
+
+
+--------------------------------
+string getServerConf($var)
+--------------------------------
+
+When connecting to a server, it will send these lines upon connection:
+NETWORK=Rizon STATUSMSG=@%+ MODES=4 CHANLIMIT=#:30 MAXCHANNELS=30 MAXLIST=beI:100 MAXBANS=100 MAXTARGETS=4 NICKLEN=30 TOPICLEN=400 KICKLEN=400 CHANNELLEN=50 AWAYLEN=90 are supported by this server
+CHANTYPES=# KNOCK EXCEPTS INVEX PREFIX=(ohv)@%+ CHANMODES=eIb,k,l,cimnpstMNORZ CASEMAPPING=rfc1459 CALLERID WALLCHOPS FNC PENALTY ETRACE are supported by this server
+
+(These are just samples). So, you can retrieve the value for say, CHANMODES by doing this:
+
+getServerConf("CHANMODES");
+
+This will return a string, "eIb,k,l,cimnpstMNORZ".
+
+
+----------------------------------
+string getStatusString($status)
+----------------------------------
+
+After using getStatusRaw(), you can feed its value to this function, and it'll send back what it means, like "Connecting to Server..."
+
+
+----------------------------------
+string getClientIP($long = 1)
+----------------------------------
+
+This function returns the IP that the bot is using. if you specify $long as 1, then the ip address converted to long integer form is returned.
+
+
+----------------------------------
+class getChannelData($channel)
+----------------------------------
+
+This will search the channel database for the channel $channel, and then if it finds it, it will return that channels object. See the "channelLink" class in defines.php for member information.
+
+
+----------------------------------
+class getUserData($user, $channel = "")
+----------------------------------
+
+If a channel is specified, this will search the channel for the specified user's data. If it is found, it will return it as an object. See the "memberLink" class in defines.php for member information. If no channel is specified, this will search the entire channel database until the member is found, and then return that object.
+
+
+----------------------------------
+void disconnect()
+----------------------------------
+
+Disconnect the bot from the server...
+
+
+----------------------------------
+void setClientConfigVar($var, $value)
+----------------------------------
+
+This will overwrite a configuration setting from bot.conf that the bot is currently using. Self-explanitory.
+
+
+----------------------------------
+void joinChannel($chan)
+----------------------------------
+
+Join the channel $chan
+
+
+----------------------------------
+void sendRaw($text, $force = false)
+----------------------------------
+
+Send the raw text $text to the server. If $force is true, then the data is sent RIGHT away, it totally bypasses the queue, everything. It goes right to the send function, even through the socket class. Use this if you need lightning fast responses, such as writing a channel guard script.
+
+
+----------------------------------
+void privMsg($who, $msg, $queue = 1)
+----------------------------------
+
+$who = nick of user/name of channel
+
+Send text to a channel or user. If $queue is 1, then the data will be put at the end of the text queue, if it is 0, it'll be pushed onto the beginning of the queue.
+
+----------------------------------
+void action($who, $msg, $queue = 1)
+----------------------------------
+
+Same as privMsg... emulates the /me command from mIRC
+
+
+----------------------------------
+void notice($who, $msg, $queue = 1)
+----------------------------------
+
+Same as privMsg, except a notice.
+
+
+----------------------------------
+void log($text)
+----------------------------------
+
+Write something to the log file.
+
+----------------------------------
+void maintainChannel($channel, $key = "")
+----------------------------------
+
+Attempt to stay in channel $channel. The bot will attempt rejoining every 60 seconds. You may specify a $key or leave it blank.
+
+----------------------------------
+void removeMaintain($channel)
+----------------------------------
+
+No longer attempt to say in channel $channel.
+
+----------------------------------
+void addQuery($host, $port, $query, $line, $class, $function)
+----------------------------------
+
+Also make sure you read the text about this function in the readme.txt, "Querying remote servers". This function takes 6 arguments.
+
+$host = the host machine you want to connect to
+$port = the port you want to connect to
+$query = the raw data that will be sent to the server upon connection
+$line = the $line argument that was passed to your module's function (just pass this right along with addQuery)
+$class = usually '$this'..
+$function = the function to run after the query is complete.
+
+See sections 8 and 9 of readme.txt for information related to writing 'query' function types.
+
+
+----------------------------------
+int getStatusRaw()
+----------------------------------
+
+Returns an integer corresponding to current server status. See defines.php for meanings
+
+
+----------------------------------
+bool changeMode($chan, $act, $mode, $user)
+----------------------------------
+
+Changes the mode of $user on $chan
+
+$act = either "+" or "-"
+$mode = some mode, like "o" (ops), or "b" (ban), or something else.
+$user = whatever the mode is being applied to
+
+
+----------------------------------
+bool isOnline($nick, $chan)
+----------------------------------
+
+Send back whether the nick is on the channel $chan (true or false)
+
+
+----------------------------------
+bool isMode($nick, $channel, $mode)
+----------------------------------
+
+See if some $user has some $mode activated on him in $channel
+
+$user = nick of user
+$mode = any mode, such as "o", "h", "v"
+
+
+----------------------------------
+bool isChanMode($channel, $mode, $extra = "")
+----------------------------------
+
+Sends back whether a specific mode is set in a channel
+
+$mode = "b" or "s" or any other chan mode
+
+$extra = (if you're using "b" for $mode, specify mask here)
+
+
+----------------------------------
+bool hasModeSet($chan, $nick, $modes)
+----------------------------------
+
+If any of the modes specified in "$modes" are set on a user in a channel, this will return true.
+For instance:
+
+If Manick is +vo in channel #manekian,
+
+hasModeSet("#manekian", "Manick", "oh")
+
+will return true. I'm asking php-irc if Manick is either mode o or mode h. Which he's mode o, so it returns true.
+
+
+----------------------------------
+bool hostMasksMatch($mask1, $mask2)
+----------------------------------
+
+Use this to determine whether two host masks match
+
+
+----------------------------------
+bool checkIgnore($mask)
+----------------------------------
+Check whether a hostmask is on the bot.conf ignore list.
+
+
+socket.php (Accessed with $this->socketClass->)
+-----------------------------------------------
+
+----------------------------------
+string getHost($sockInt)
+----------------------------------
+Return the IP address of the current socket integer of a connection. You can use connection::getSockInt() to get the sock int.
+
+
+----------------------------------
+string getQueue($sockInt)
+----------------------------------
+Retrieve the current read queue for a socket. The queue is then purged.
+
+
+----------------------------------
+string getQueueLine($sockInt)
+----------------------------------
+Get the next line in the queue, purging it from the read buffer and returning it (without crlf)
+
+
+----------------------------------
+int sendSocket($sockInt, $data)
+----------------------------------
+Send data to a socket
+
+
+----------------------------------
+int getSockStatus($sockInt)
+----------------------------------
+Get the status of a socket. See defines.php for list of constants.
+
+
+----------------------------------
+object getSockData($sockInt)
+----------------------------------
+Return the object that retains all data about socket "$sockInt". This is a php-irc maintained list.
+
+
+----------------------------------
+bool hasWriteQueue($sockInt)
+----------------------------------
+Return true or false depending on whether the bot has data to write to the socket. If this is true, you should restrain yourself from sending more data to the socket. An onWrite() call will be sent every time data is written, and each time "hasWriteQueue()" should be called to see if the queue is empty before sending data.
+
+
+----------------------------------
+bool hasLine($sockInt)
+----------------------------------
+Return true or false depending on if there is a newline in the buffer.
+
+
+timers.php (Accessed with $this->timerClass->)
+----------------------------------------------
+
+----------------------------------
+class addTimer($name, $class, $function, $args, $interval, $runRightAway = false)
+----------------------------------
+
+Add a timer. Please view the readme.txt documentation on this.
+
+----------------------------------
+class getTimers()
+----------------------------------
+
+This function will return a pointer to all the active timers. See the class "timer" in defines.php for member information.
+
+
+----------------------------------
+void removeTimer($timer) (MUST be timer name)
+----------------------------------
+
+Remove a timer $timer <-- can only be the name of timer, unlike in 2.1.1 where it could be the object itself.
+
+
+mysql/postgre.php (Accessed with $this->db->)
+---------------------------------------------
+Some items for postgre aren't fully implemented or work yet... most notably queryFetch(), and some others. See postgre.php for more details.
+
+----------------------------------
+array queryFetch($query)
+----------------------------------
+
+Runs a query and returns the first row. Basically does query() and then mysql_fetch_array()
+
+
+----------------------------------
+array fetchArray($object)
+----------------------------------
+
+Does mysql_fetch_array() (see php.net for help)
+
+
+----------------------------------
+array fetchRow($object)
+----------------------------------
+
+Does mysql_fetch_row()
+
+
+----------------------------------
+string getError()
+----------------------------------
+
+Does mysql_error();
+
+
+----------------------------------
+bool isConnected()
+----------------------------------
+
+Returns whether the database is connected
+
+----------------------------------
+int lastID()
+----------------------------------
+
+Gets the last inserted 'id' row from the database.
+
+
+----------------------------------
+int numRows($toFetch)
+----------------------------------
+
+Does mysql_num_rows()
+
+
+----------------------------------
+int numQueries()
+----------------------------------
+
+sends back an integer of all the queries since the database class was spawned.
+
+
+----------------------------------
+void close()
+----------------------------------
+
+Closes the database connection
+
+
+----------------------------------
+object query($query)
+----------------------------------
+
+Runs a query, and returns the result as an object.
+
+
+dcc.php (Accessed with $this->dccClass->)
+-----------------------------------------
+
+----------------------------------
+array getDccList()
+----------------------------------
+
+Returns an array of all current dcc's in progress (chat and file)
+
+
+----------------------------------
+int getDownloadCount()
+----------------------------------
+
+Number of all current downloads
+
+
+----------------------------------
+int getUploadCount()
+----------------------------------
+
+Number of all current uploads
+
+
+----------------------------------
+int getChatCount()
+----------------------------------
+
+Number of all current dcc chat sessions
+
+
+----------------------------------
+int getBytesDown()
+----------------------------------
+
+Returns number of bytes downloaded since bot was started
+
+
+----------------------------------
+int getBytesUp()
+----------------------------------
+
+Returns number of bytes uploaded since bot was started
+
+
+----------------------------------
+int addChat($nick, $host, $port, $admin, $handler)
+----------------------------------
+
+Use this to create a dcc chat session.
+
+$nick = nick of user to chat with
+$host = host of user to chat with
+$port = port to connect to
+$admin = whether the user is admin (use admin dcc chat administration)
+$handler = null, usually, unless you are creating a custom dcc chat handler. See readme.txt for more information.
+
+If $host or $port is null, then addChat will think you are setting up a listening connection, otherwise it will try to connect to the host/port specified.
+
+
+----------------------------------
+int addFile($nick, $host, $port, $type, $filename, $size)
+----------------------------------
+
+Send a file to someone, or recieve a file.
+
+$nick = nick of person sending/receiving file
+$host = host of person sending/receiving file
+$port = port of transfer
+$type = either UPLOAD or DOWNLOAD
+$filename = full filename with full path to file
+$size = size of the file, can be null if its an UPLOAD type.
+
+See readme.txt for more information regarding file transfers.
+
+
+----------------------------------
+int sendFile($nick, $file)
+----------------------------------
+Alias for addFile($nick, null, null, UPLOAD, $file, null)... basically just an easier way of sending files.
+
+
+----------------------------------
+class getDcc($dcc)
+----------------------------------
+
+$dcc = sockInt of the transfer
+
+Returns dcc object for some sockInt, see fileserver.php for example.
+
+
+----------------------------------
+void dccInform($text)
+----------------------------------
+
+Send a message to all administrators
+
+
+chat.php
+----------
+
+----------------------------------
+void disconnect($msg = "")
+----------------------------------
+
+End the chat session
+
+----------------------------------
+void dccSend($msg)
+----------------------------------
+
+Send text to the user
+
+
+file.php
+----------
+
+----------------------------------
+void disconnect($msg = "")
+----------------------------------
+
+End the dcc file transfer session
+
+
+ini.php
+----------
+Please see readme.txt for more information on create ini objects.
+
+
+----------------------------------
+bool getError()
+----------------------------------
+An ini object will not operate after a fatal error. You can use this to retrieve whether a fatal error has happened.
+
+
+----------------------------------
+bool sectionExists($section)
+----------------------------------
+Return true if the section exists, or false if it doesn't.
+
+
+----------------------------------
+bool deleteSection($section)
+----------------------------------
+Delete a section.
+
+
+----------------------------------
+bool deleteVar($section, $var)
+----------------------------------
+Delete a var in a section.
+
+
+----------------------------------
+bool setIniVal($section, $var, $val)
+----------------------------------
+Set the '$var' value '$val' in section $section.
+
+
+----------------------------------
+bool writeIni()
+----------------------------------
+Write all of the ini changes to a file
+
+
+----------------------------------
+array getSections()
+----------------------------------
+Return an array of all the section names.
+
+
+----------------------------------
+array getVars($section)
+----------------------------------
+Return all the vars/vals in an associative array for $section.
+
+
+----------------------------------
+array getSection($section)
+----------------------------------
+Alias for getVars()
+
+
+----------------------------------
+array randomSection($num = 1)
+----------------------------------
+Does same as getVars(), but returns random section. $num is the number of random sections to return. Default 1.
+
+
+----------------------------------
+array searchSections($search, $type = EXACT_MATCH)
+----------------------------------
+Search section names for $search, can do 4 types of searches: Exact, and, or, contains:
+
+Exact: the section and search match completely
+And: the section name contains all componants of search (separated by space)
+Or: the section name contains at least one of the componants of search (separated by space)
+Contains: the section contains the search string within it
+
+
+----------------------------------
+array searchVars($section, $search, $type = EXACT_MATCH)
+----------------------------------
+Search the variable names of a section for $search, same as searchSections() except with vars.
+
+
+----------------------------------
+array searchSectionsByVar($var, $search, $type = EXACT_MATCH)
+----------------------------------
+In every section that has '$var' as a varaible, see if the var's value matches $search.
+
+
+----------------------------------
+array searchVals($section, $search, $type = EXACT_MATCH)
+----------------------------------
+Search all the values of a section for '$search'. Return list of vars.
+
+
+----------------------------------
+mixed randomVar($section, $num = 1)
+----------------------------------
+Return a random var in a section.
+
+
+----------------------------------
+mixed getIniVal($section, $var)
+----------------------------------
+Retrieve an ini value '$var' in section '$section'. False if non-existant.
+
+
+----------------------------------
+int numSections()
+----------------------------------
+Return number of sections.
+
+
+----------------------------------
+int numVars($section)
+----------------------------------
+Return number of vars in a section.
+
+
+Useful Static Routines
+-----------------------
+
+----------------------------------
+string socket::generatePostQuery($query, $host, $path, $httpVersion = "")
+----------------------------------
+
+Takes a query, like so:
+
+$query = "search=blah&somesetting=5";
+
+And turns it into a POST query you can send off to addQuery
+
+$host = host of server you will be accessing, like "www.manekian.com"
+$path = script + path of script you will be accessing, like "/search.php" or "/index.php", or just "/"
+$httpVersion, you can ignore this, but sometimes you might want to set this to "1.0"
+
+
+----------------------------------
+string socket::generateGetQuery($query, $host, $path, $httpVersion)
+----------------------------------
+
+Same as generatePostQuery except with Get String
+
+
+----------------------------------
+string irc::intToSizeString($size)
+----------------------------------
+
+Takes a large size, and then changes it into MB, GB, KB, depending on the size.
+
+
+----------------------------------
+string irc::myStrToLower($text)
+----------------------------------
+
+RFC1459 complient strtolower()
+
+
+----------------------------------
+string irc::myStrToUpper($text)
+----------------------------------
+
+RFC1459 complient strtoupper()
+
+
+----------------------------------
+string irc::timeFormat($time, $format)
+----------------------------------
+Feed this thing a timestring, and a format, and it'll send back a user friendly representation of the timestamp.
+
+for example:
+
+timeFormat(5, "%d days, %h hours, %m minutes, %s seconds")
+
+This will return a string, "0 days, 0 hours, 0 minutes, 5 seconds".
+
+
+----------------------------------
+string irc::randomHash()
+----------------------------------
+
+Generates a 32 char random md5 hash
+
+
+----------------------------------
+array irc::multiLine($text)
+----------------------------------
+
+Feed this a huge text string, and it will split it up into 255 max char increment lines you can send to the irc server. It returns an array of all of these.
+
+
+
diff --git a/ircbot/connection.php b/ircbot/connection.php
new file mode 100644
index 0000000..1a248df
--- /dev/null
+++ b/ircbot/connection.php
@@ -0,0 +1,432 @@
+ connection class module
+| > Module written by Manick
+| > Module Version Number: 2.1.2
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+/* Connection class. A Layer between dcc/irc class and socket class. */
+/* To use, simply create an object, call the calls listed under the constructor in order. */
+/* Damn I'm hungry... */
+
+class connection {
+
+ //External Classes
+ private $socketClass;
+ private $ircClass;
+ private $timerClass;
+
+ //Internal variables
+ private $callbackClass;
+ private $host;
+ private $port;
+ private $connTimeout;
+ private $transTimeout;
+ private $sockInt;
+
+ //Function specific
+ private $connected;
+ private $connStartTime;
+ private $lastTransTime;
+
+ //If this is set to true, this connection class will no longer function.
+ private $error;
+ private $errorMsg;
+
+ //Called first
+ function __construct($host, $port, $connTimeout)
+ {
+ $this->error = true;
+ $this->errorMsg = "Connection not initialized";
+ $this->host = $host;
+ $this->port = $port;
+ $this->connTimeout = $connTimeout;
+ $this->transTimeout = 0;
+ $this->connected = false;
+ $this->sockInt = false;
+ }
+
+ //Called second
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ //Called third
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ //Called fourth
+ public function setCallbackClass($class)
+ {
+ $this->callbackClass = $class;
+ }
+
+ //Called fifth
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ //Called sixth
+ public function init()
+ {
+ $this->error = false;
+
+ if ($this->host != null)
+ {
+ if ($this->connTimeout <= 0)
+ {
+ $this->setError("Must set connection timeout > 0 for non-listening sockets");
+ return;
+ }
+ }
+ else
+ {
+ if ($this->connTimeout < 0)
+ {
+ $this->setError("Must set connection timeout >= 0 for listening sockets");
+ return;
+ }
+ }
+
+ if (!is_object($this->callbackClass))
+ {
+ $this->setError("Specified callback class is not an object");
+ return;
+ }
+
+ if (!is_object($this->socketClass))
+ {
+ $this->setError("Specified socket class is not an object");
+ return;
+ }
+
+ if (!is_object($this->ircClass))
+ {
+ $this->setError("Specified irc class is not an object");
+ return;
+ }
+
+ $sockInt = $this->socketClass->addSocket($this->host, $this->port); // add socket
+ if ($sockInt == false)
+ {
+ $this->setError("Could not create socket");
+ return;
+ }
+
+ $sockData = $this->socketClass->getSockData($sockInt);
+
+ $this->socketClass->setHandler($sockInt, $this->ircClass, $this, "handle");
+
+ //Set internal variables
+ if ($this->port == NULL)
+ {
+ $this->port = $sockData->port;
+ }
+ $this->sockInt = $sockInt;
+
+ return $this->port;
+ }
+
+ public function bind($ip)
+ {
+ if ($this->error != false || $this->sockInt == false)
+ {
+ return;
+ }
+
+ if ($this->connected == true)
+ {
+ return;
+ }
+
+ $this->socketClass->bindIP($this->sockInt, $ip);
+ }
+
+ //Called to listen, only called by onAccept() function in this class
+ public function listen()
+ {
+ $this->error = false;
+ $this->connected = true;
+ }
+
+ //Called last, and only to start connection to another server
+ public function connect()
+ {
+ if ($this->error == true)
+ {
+ return false;
+ }
+
+ if ($this->connTimeout > 0)
+ {
+ $this->timerClass->addTimer(irc::randomHash(), $this, "connTimeout", "", $this->connTimeout);
+ }
+
+ $this->timerClass->addTimer(irc::randomHash(), $this->socketClass, "connectSocketTimer", $this->sockInt, 1);
+
+ /* $this->socketClass->beginConnect($this->sockInt); */
+ $this->connStartTime = time();
+ }
+
+ public function disconnect()
+ {
+ unset($this->callbackClass);
+ $this->socketClass->killSocket($this->sockInt);
+ $this->socketClass->removeSocket($this->sockInt);
+ $this->setError("Disconnected from server");
+ }
+
+ public function getSockInt()
+ {
+ return $this->sockInt;
+ }
+
+ public function setSockInt($sockInt)
+ {
+ $this->sockInt = $sockInt;
+ }
+
+ public function setTransTimeout($time)
+ {
+ $this->transTimeout = ($time < 0 ? 0 : $time);
+ }
+
+ /* Timers */
+
+ public function connTimeout()
+ {
+ if ($this->connected == false)
+ {
+ $this->handle(CONN_CONNECT_TIMEOUT);
+ }
+ }
+
+ public function transTimeout()
+ {
+ if ($this->error == true)
+ {
+ return false;
+ }
+
+ if ($this->connected == false)
+ {
+ return true;
+ }
+
+ if ($this->transTimeout > 0)
+ {
+ if (time() > $this->transTimeout + $this->lastTransTime)
+ {
+ $this->handle(CONN_TRANSFER_TIMEOUT);
+ }
+ }
+
+ return true;
+ }
+
+ //handle function, handles all calls from socket class, and calls appropriate
+ //functions in the callback class
+ public function handle($msg)
+ {
+
+ if ($this->socketClass->getSockStatus($this->sockInt) === false)
+ {
+ return false;
+ }
+
+ $stat = false;
+
+ if ($this->error == true)
+ {
+ return false;
+ }
+
+ switch ($msg)
+ {
+ case CONN_CONNECT:
+ $stat = $this->onConnect();
+ break;
+ case CONN_READ:
+ $stat = $this->onRead();
+ break;
+ case CONN_WRITE:
+ $stat = $this->onWrite();
+ break;
+ case CONN_ACCEPT:
+ $stat = $this->onAccept();
+ break;
+ case CONN_DEAD:
+ $stat = $this->onDead();
+ break;
+ case CONN_TRANSFER_TIMEOUT:
+ $stat = $this->onTransferTimeout();
+ break;
+ case CONN_CONNECT_TIMEOUT:
+ $stat = $this->onConnectTimeout();
+ break;
+ default:
+ return false;
+ break;
+ }
+
+ return $stat;
+ }
+
+ /* Specific handling functions */
+
+ private function onTransferTimeout()
+ {
+ $this->callbackClass->onTransferTimeout($this);
+ }
+
+ private function onConnectTimeout()
+ {
+ $this->callbackClass->onConnectTimeout($this);
+ }
+
+ private function onConnect()
+ {
+ $this->connected = true;
+
+ if ($this->transTimeout > 0)
+ {
+ $this->timerClass->addTimer(irc::randomHash(), $this, "transTimeout", "", $this->transTimeout);
+ }
+
+ $this->callbackClass->onConnect($this);
+ return false;
+ }
+
+ //For this function, true can be returned from onRead() to input more data.
+ private function onRead()
+ {
+ $this->lastTransTime = time();
+
+ $stat = $this->callbackClass->onRead($this);
+ if ($stat !== true)
+ {
+ $this->socketClass->clearReadSchedule($this->sockInt);
+ }
+
+ return $stat;
+ }
+
+ private function onWrite()
+ {
+ $this->socketClass->clearWriteSchedule($this->sockInt);
+ $this->lastTransTime = time();
+ $this->callbackClass->onWrite($this);
+ return false;
+ }
+
+ private function onAccept()
+ {
+ //Get the sockInt from the socketClass
+ $newSockInt = $this->socketClass->hasAccepted($this->sockInt);
+
+ if ($newSockInt === false)
+ {
+ //False alarm.. just ignore it.
+ return false;
+ }
+
+ //Create a new connection object for the new socket connection, then return it to onAccept
+ //We must assume that onAccept will handle the connection object. Otherwise it'll die, and the
+ //connection will be orphaned.
+
+ $newConn = new connection(null, null, 0);
+ $newConn->setSocketClass($this->socketClass);
+ $newConn->setIrcClass($this->ircClass);
+ $newConn->setCallbackClass($this->callbackClass); //Can be overwritten in the onAccept function
+ $newConn->setTimerClass($this->timerClass);
+ $newConn->listen();
+ //We don't need to call init(), we're already setup.
+
+ //Setup our connection transmission timeout thing.
+ if ($this->transTimeout > 0)
+ {
+ $this->timerClass->addTimer(irc::randomHash(), $newConn, "transTimeout", "", $this->transTimeout);
+ }
+
+ $newConn->setTransTimeout($this->transTimeout);
+
+ //Set handler for our new sockInt to new connection class
+ $this->socketClass->setHandler($newSockInt, $this->ircClass, $newConn, "handle");
+
+ //Set our new sockInt
+ $newConn->setSockInt($newSockInt);
+
+ //Call our callback function for accepting with old object, and new object.
+ $this->callbackClass->onAccept($this, $newConn);
+ return false;
+ }
+
+ private function onDead()
+ {
+ if ($this->connected == true)
+ {
+ $this->setError("Connection is dead");
+ }
+ else
+ {
+ $this->setError("Could not connect: " . $this->socketClass->getSockStringError($this->sockInt));
+ }
+ $this->callbackClass->onDead($this);
+ return false;
+ }
+
+ /* Error handling routines */
+
+ private function setError($msg)
+ {
+ $this->error = true;
+ $this->errorMsg = $msg;
+ }
+
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ public function getErrorMsg()
+ {
+ return $this->errorMsg;
+ }
+
+}
+
+?>
diff --git a/ircbot/databases/ini.php b/ircbot/databases/ini.php
new file mode 100644
index 0000000..a2712f8
--- /dev/null
+++ b/ircbot/databases/ini.php
@@ -0,0 +1,515 @@
+ ini-file database module
+| > Module written by Manick
+| > Module Version Number: 2.2.1 alpha
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class ini {
+
+ private $filename;
+ private $error;
+ private $ini = array();
+ private $numSections;
+
+ //used in isMatched()
+ private $search;
+ private $searchParts;
+
+
+ //Load ini into memory
+ public function __construct($filename)
+ {
+ $this->error = false;
+ $this->filename = $filename;
+
+ $filePtr = @fopen($filename, "r");
+
+ if ($filePtr === false)
+ {
+ $filePtr = @fopen($filename, "a");
+
+ if ($filePtr === false)
+ {
+ $this->error = true;
+ return;
+ }
+ else
+ {
+ fclose($filePtr);
+ return;
+ }
+ }
+
+ $fileData = "";
+
+ while (!feof($filePtr))
+ {
+ $fileData .= fread($filePtr, 4096);
+ }
+
+ fclose($filePtr);
+
+ $fileData = str_replace("\r", "", $fileData);
+
+ $lines = explode("\n", $fileData);
+
+ $currSection = "";
+ $this->numSections = 0;
+
+ foreach($lines AS $line)
+ {
+ $line = trim($line);
+
+ $offsetA = strpos($line, "[");
+ $offsetB = strpos($line, "]");
+
+ if ($offsetA === 0)
+ {
+ $currSection = substr($line, 1, $offsetB - 1);
+ $this->numSections++;
+ $this->ini[$currSection] = array();
+ }
+ else
+ {
+ if ($currSection != "")
+ {
+ $offsetC = strpos($line, "=");
+
+ if ($offsetC !== false)
+ {
+ $var = trim(substr($line, 0, $offsetC));
+ $val = substr($line, $offsetC + 1);
+
+ if ($var != "")
+ {
+ $this->ini[$currSection][$var] = $val;
+ }
+ }
+ else
+ {
+ $this->ini[$currSection][$line] = true;
+ }
+ }
+ }
+ }
+ }
+
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ public function getSections()
+ {
+ $sections = array();
+
+ if ($this->numSections == 0)
+ {
+ return $sections;
+ }
+
+ foreach ($this->ini AS $section => $vals)
+ {
+ $sections[] = $section;
+ }
+
+ return $sections;
+ }
+
+ public function getVars($section)
+ {
+ if (!isset($this->ini[$section]))
+ {
+ return false;
+ }
+
+ return $this->ini[$section];
+ }
+
+ public function sectionExists($section)
+ {
+ if (isset($this->ini[$section]) && is_array($this->ini[$section]))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public function getSection($section)
+ {
+ return $this->getVars($section);
+ }
+
+ public function randomSection($num = 1)
+ {
+ if ($this->numSections == 0 || $num < 1 || $num > $this->numSections)
+ {
+ return false;
+ }
+
+ return array_rand($this->ini, $num);
+ }
+
+ public function randomVar($section, $num = 1)
+ {
+ if (!isset($this->ini[$section]))
+ {
+ return false;
+ }
+
+ $count = count($this->ini[$section]);
+
+ if ($count == 0 || $num < 1 || $num > $count)
+ {
+ return false;
+ }
+
+ return array_rand($this->ini[$section], $num);
+ }
+
+
+ public function searchSections($search, $type = EXACT_MATCH)
+ {
+ $results = array();
+
+ if (trim($search) == "")
+ {
+ return $results;
+ }
+
+ if ($this->numSections == 0)
+ {
+ return;
+ }
+
+ foreach($this->ini AS $section => $vars)
+ {
+ if ($this->isMatched($search, $section, $type))
+ {
+ $results[] = $section;
+ }
+ }
+
+ return $results;
+ }
+
+ public function searchVars($section, $search, $type = EXACT_MATCH)
+ {
+ $results = array();
+
+ if (trim($search) == "")
+ {
+ return $results;
+ }
+
+ if (!isset($this->ini[$section]))
+ {
+ return $results;
+ }
+
+ if ($this->numSections == 0)
+ {
+ return;
+ }
+
+ if (count($this->ini[$section]) == 0)
+ {
+ return $results;
+ }
+
+ foreach($this->ini[$section] AS $var => $val)
+ {
+ if ($this->isMatched($search, $var, $type))
+ {
+ $results[] = $var;
+ }
+ }
+
+ return $results;
+ }
+
+ public function searchSectionsByVar($var, $search, $type = EXACT_MATCH)
+ {
+ $results = array();
+
+ if ($this->numSections == 0)
+ {
+ return $results;
+ }
+
+ foreach($this->ini AS $section => $vars)
+ {
+ if (isset($vars[$var]))
+ {
+ if ($this->isMatched($search, $vars[$var], $type))
+ {
+ $results[] = $section;
+ }
+ }
+ }
+
+ return $results;
+
+ }
+
+ public function searchVals($section, $search, $type = EXACT_MATCH)
+ {
+ $results = array();
+
+ if (trim($search) == "")
+ {
+ return $results;
+ }
+
+ if (!isset($this->ini[$section]))
+ {
+ return $results;
+ }
+
+ if ($this->numSections == 0)
+ {
+ return;
+ }
+
+ if (count($this->ini[$section]) == 0)
+ {
+ return $results;
+ }
+
+ foreach($this->ini[$section] AS $var => $val)
+ {
+ if ($this->isMatched($search, $val, $type))
+ {
+ $results[] = $var;
+ }
+ }
+
+ return $results;
+ }
+
+ private function isMatched(&$needle, &$haystack, $type = EXACT_MATCH)
+ {
+
+ if ($type == EXACT_MATCH)
+ {
+ if ($haystack == $needle)
+ {
+ return true;
+ }
+ }
+
+ if ($type == CONTAINS_MATCH)
+ {
+ if (strpos(strtolower($haystack), strtolower($needle)) !== false)
+ {
+ return true;
+ }
+ }
+
+ if ($search != $this->search)
+ {
+ $this->searchParts = explode(chr(32), $search);
+ $this->search = $search;
+ }
+
+ if ($type == AND_MATCH)
+ {
+ $foundAll = true;
+
+ foreach($this->searchParts AS $part)
+ {
+ if (strpos($val, $part) === false)
+ {
+ $foundAll = false;
+ break;
+ }
+ }
+
+ if ($foundAll == true)
+ {
+ return true;
+ }
+ }
+ else if ($type == OR_MATCH)
+ {
+ foreach($this->searchParts AS $part)
+ {
+ if (strpos($val, $part) !== false)
+ {
+ return true;
+ break;
+ }
+ }
+ }
+
+ return false;
+ }
+
+
+ public function deleteSection($section)
+ {
+ if (isset($this->ini[$section]))
+ {
+ unset($this->ini[$section]);
+ return true;
+ }
+
+ return false;
+ }
+
+ public function deleteVar($section, $var)
+ {
+ if (isset($this->ini[$section]))
+ {
+ if (isset($this->ini[$section][$var]))
+ {
+ unset($this->ini[$section][$var]);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public function numSections()
+ {
+ return $this->numSections;
+ }
+
+ public function numVars($section)
+ {
+ if (isset($this->ini[$section]))
+ {
+ return count($this->ini[$section]);
+ }
+ return 0;
+ }
+
+ public function setIniVal($section, $var, $val)
+ {
+ if ($this->error == true)
+ {
+ return;
+ }
+
+ if (!isset($this->ini[$section]))
+ {
+ $this->numSections++;
+ $this->ini[$section] = array();
+ }
+
+ if (strpos($var, "=") !== false)
+ {
+ return false;
+ }
+
+ $this->ini[$section][$var] = $val;
+
+ return true;
+ }
+
+ public function getIniVal($section, $var)
+ {
+ if ($this->error == true)
+ {
+ return;
+ }
+
+ if (isset($this->ini[$section])
+ && isset($this->ini[$section][$var]))
+ {
+ return $this->ini[$section][$var];
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ //Update and write ini to file
+ public function writeIni()
+ {
+ if ($this->error == true)
+ {
+ return;
+ }
+
+ if ($this->numSections == 0)
+ {
+ return;
+ }
+
+ $output = "";
+
+ foreach ($this->ini AS $section => $vars)
+ {
+
+ $output .= "[" . $section . "]\n";
+
+ if (count($vars))
+ {
+ foreach ($vars AS $var => $val)
+ {
+ $output .= $var . "=" . $val . "\n";
+ }
+ }
+ }
+
+ $filePtr = fopen($this->filename, "at");
+
+ if ($filePtr === false)
+ {
+ $this->error = true;
+ return false;
+ }
+
+ flock($filePtr, LOCK_EX);
+
+ ftruncate($filePtr, 0);
+
+ if (fwrite($filePtr, $output) === FALSE)
+ {
+ $this->error = true;
+ }
+
+ flock($filePtr, LOCK_UN);
+
+ fclose($filePtr);
+
+ return !$this->error;
+ }
+
+}
+
+?>
diff --git a/ircbot/databases/mysql.php b/ircbot/databases/mysql.php
new file mode 100644
index 0000000..7ffaa3a
--- /dev/null
+++ b/ircbot/databases/mysql.php
@@ -0,0 +1,169 @@
+ database module
+| > Module written by Manick
+| > Module Version Number: 2.2.0 alpha1
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class mysql {
+
+ private $dbIndex;
+ private $prefix;
+ private $queries = 0;
+ private $isConnected = false;
+
+ private $user;
+ private $pass;
+ private $database;
+ private $host;
+ private $port;
+
+ public function __construct($host, $database, $user, $pass, $prefix, $port = 3306)
+ {
+ $this->user = $user;
+ $this->pass = $pass;
+ $this->host = $host;
+ $this->database = $database;
+ $this->port = $port;
+
+ $db = mysql_connect($host . ":" . $port, $user, $pass);
+
+ if (!$db)
+ {
+ return;
+ }
+
+ $dBase = mysql_select_db($database, $db);
+
+ if (!$dBase)
+ {
+ return;
+ }
+
+ $this->prefix = $prefix;
+ $this->dbIndex = $db;
+ $this->isConnected = true;
+ }
+
+ public function getError()
+ {
+ return (@mysql_error($this->dbIndex));
+ }
+
+ public function isConnected()
+ {
+ return $this->isConnected;
+ }
+
+ //Call by reference switched to function declaration, 05/13/05
+ private function fixVar($id, &$values)
+ {
+ return mysql_real_escape_string($values[intval($id)-1], $this->dbIndex);
+ }
+
+ public function query($query, $values = array())
+ {
+
+ if (!is_array($values))
+ $values = array($values);
+
+ $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, \$values)", $query);
+
+ $this->queries++;
+
+ $data = mysql_query($query, $this->dbIndex);
+
+ if (!$data)
+ {
+ return false;
+ }
+
+ return $data;
+ }
+
+
+ public function queryFetch($query, $values = array())
+ {
+
+ if (!is_array($values))
+ $values = array($values);
+
+ $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, &\$values)", $query);
+
+ $this->queries++;
+
+ $data= mysql_query($query, $this->dbIndex);
+
+ if (!$data)
+ {
+ return false;
+ }
+
+ return mysql_fetch_array($data);
+ }
+
+
+ public function fetchArray($toFetch)
+ {
+ return mysql_fetch_array($toFetch);
+ }
+
+ public function fetchRow($toFetch)
+ {
+ return mysql_fetch_row($toFetch);
+ }
+
+ public function close()
+ {
+ @mysql_close($this->dbIndex);
+ }
+
+ public function lastID()
+ {
+ return mysql_insert_id();
+ }
+
+ public function numRows($toFetch)
+ {
+ return mysql_num_rows($toFetch);
+ }
+
+ public function numQueries()
+ {
+ return $this->queries;
+ }
+
+}
+
+?>
+
diff --git a/ircbot/databases/postgre.php b/ircbot/databases/postgre.php
new file mode 100644
index 0000000..1bb3e51
--- /dev/null
+++ b/ircbot/databases/postgre.php
@@ -0,0 +1,162 @@
+ database module
+| > Module written by Manick
+| > Module Version Number: 2.1.1
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class postgre {
+
+ private $dbIndex;
+ private $prefix;
+ private $queries = 0;
+ private $isConnected = false;
+ private $error;
+
+ public function __construct($host, $database, $user, $pass, $prefix, $port = 5432)
+ {
+ $this->error = true;
+
+ $connect = "host=" . $host . " ".
+ "port=" . $port . " ".
+ "dbname=" . $database . " ".
+ "user=" . $user . " ".
+ "password=" . $pass;
+
+ $this->error = pg_connect($connect);
+
+ if (!$this->error)
+ {
+ return;
+ }
+
+ $this->prefix = $prefix;
+ $this->dbIndex = $this->error;
+ $this->isConnected = true;
+ }
+
+ public function getError()
+ {
+ return $this->error === false ? true : false;
+ //return (@mysql_error($this->dbIndex));
+ }
+
+ public function isConnected()
+ {
+ return $this->isConnected;
+ }
+
+ private function fixVar($id, $values)
+ {
+ return pg_escape_string($values[intval($id)-1]);
+ }
+
+ public function query($query, $values = array())
+ {
+
+ if (!is_array($values))
+ $values = array($values);
+
+ $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, &\$values)", $query);
+
+ $this->queries++;
+
+ $data = pg_query($this->dbIndex, $query);
+
+ if (!$data)
+ {
+ $this->error = $data;
+ return false;
+ }
+
+ return $data;
+ }
+
+
+ public function queryFetch($query, $values = array())
+ {
+
+ if (!is_array($values))
+ $values = array($values);
+
+ $query = preg_replace('/\[([0-9]+)]/e', "\$this->fixVar(\\1, &\$values)", $query);
+
+ $this->queries++;
+
+ $data = pg_query($query, $this->dbIndex);
+
+ if (!$data)
+ {
+ $this->error = false;
+ return false;
+ }
+
+ return pg_fetch_array($data);
+ }
+
+
+ public function fetchArray($toFetch)
+ {
+ return pg_fetch_array($toFetch);
+ }
+
+ public function fetchRow($toFetch)
+ {
+ return pg_fetch_row($toFetch);
+ }
+
+ public function close()
+ {
+ @pg_close($this->dbIndex);
+ }
+
+ public function lastID()
+ {
+ //ehhh. don't use this.
+ return null;
+ }
+
+ public function numRows($toFetch)
+ {
+ return pg_num_rows($toFetch);
+ }
+
+ public function numQueries()
+ {
+ return $this->queries;
+ }
+
+}
+
+?>
+
diff --git a/ircbot/databases/postgres.php b/ircbot/databases/postgres.php
new file mode 100644
index 0000000..92264c2
--- /dev/null
+++ b/ircbot/databases/postgres.php
@@ -0,0 +1,148 @@
+ database module
+| > Module written by Manick
+| > Module Version Number: 2.1.1
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+// *** Modified by Nemesis128_at_atarax_dot_org
+
+class postgresql {
+
+ private $dbRes;
+ private $prefix;
+ private $numQueries = 0;
+ private $isConnected = false;
+ private $error = false;
+
+ private $user;
+ private $pswd;
+ private $dbase;
+ private $host;
+ private $port;
+
+ public function __construct ($user,$pswd,$dbase,$prefix,$host = null,$port = 5432) {
+
+ $this->user = $user;
+ $this->pswd = $pswd;
+ $this->dbase = $dbase;
+ $this->prefix = $prefix;
+ $this->host = $host;
+ $this->port = $port;
+
+ $conn_str = '';
+
+ if (!is_null($host)) { // connect thru TCP/IP
+ $conn_str .= 'host='.$host;
+ $conn_str .= ' port='.$port;
+ } // else thru intern sockets
+ $conn_str .= ' user='.$user;
+ $conn_str .= ' password='.$pswd;
+ $conn_str .= ' dbname='.$dbase;
+
+ $this->dbRes = pg_connect($conn_str);
+
+ if (!is_resource($this->dbRes)) {
+ $this->error = 'PgSQL Connection error';
+ return;
+ }
+
+ $this->isConnected = true;
+ }
+
+ public function getError () {
+ if ($this->error) {
+ $err = $this->error."\n\n";
+ return ($err.@pg_last_error($this->dbIndex));
+ } else {
+ return null;
+ }
+ }
+
+ public function isConnected () {
+ return $this->isConnected;
+ }
+
+ public static function esc ( $var ) {
+ return pg_escape_string ( $var );
+ }
+
+ public function query ( $query_str ) {
+
+ if (pg_connection_status($this->dbRes) === PGSQL_CONNECTION_BAD) {
+ if (!pg_connection_reset($this->dbRes)) {
+ $this->error = 'Connection lost';
+ $this->isConnected = false;
+ return false;
+ }
+ }
+
+ $this->numQueries++;
+
+ $res = @pg_query($this->dbRes,$query_str);
+
+ if (!$res) {
+ $this->error = 'Query failed: '.pg_last_error().' ('.$query_str.')';
+ return false;
+ }
+
+ return $res;
+ }
+
+ public function fetchArray ( $toFetch ) {
+ return pg_fetch_assoc($toFetch);
+ }
+
+ public function fetchObject ( $toFetch ) {
+ return pg_fetch_object($toFetch);
+ }
+
+ public function fetchRow ( $toFetch ) {
+ return pg_fetch_row($toFetch);
+ }
+
+ public function numRows ( $toFetch ) {
+ return pg_num_rows($toFetch);
+ }
+
+ public function numQueries () {
+ return $this->numQueries;
+ }
+
+ public function close () {
+ @pg_close($this->dbRes);
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/ircbot/dcc.php b/ircbot/dcc.php
new file mode 100644
index 0000000..5ec3282
--- /dev/null
+++ b/ircbot/dcc.php
@@ -0,0 +1,579 @@
+ dcc module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class dcc {
+
+ private $dccList = array(); //holds all connected sockets
+ private $dccChangedList = array();
+ private $dccChangedCount = 0;
+
+ private $fileDlCount = 0;
+ private $fileUlCount = 0;
+ private $chatCount = 0;
+
+ //Classes
+ private $timerClass;
+ private $socketClass;
+ private $ircClass;
+ private $parserClass;
+
+ //Bytes Transferred
+ private $bytesUp = 0;
+ private $bytesDown = 0;
+
+ //Process Queue
+ private $procQueue;
+
+ public function __construct()
+ {
+ // do nothing...
+ }
+
+ public function setProcQueue($class)
+ {
+ $this->procQueue = $class;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setParserClass($class)
+ {
+ $this->parserClass = $class;
+ $this->parserClass->setDccClass($this);
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ public function getDownloadCount()
+ {
+ return $this->fileDlCount;
+ }
+
+ public function getUploadCount()
+ {
+ return $this->fileUlCount;
+ }
+
+ public function getChatCount()
+ {
+ return $this->chatCount;
+ }
+
+ public function closeAll()
+ {
+ foreach ($this->dccList AS $dcc)
+ {
+ $dcc->disconnect("Owner Requsted Close");
+ }
+ }
+
+ public function addBytesUp($num)
+ {
+ $this->bytesUp += $num;
+ }
+
+ public function addBytesDown($num)
+ {
+ $this->bytesDown += $num;
+ }
+
+ public function getBytesDown()
+ {
+ return $this->bytesDown;
+ }
+
+ public function getBytesUp()
+ {
+ return $this->bytesUp;
+ }
+
+
+ public function getDcc($someDcc)
+ {
+ if (isset($this->dccList[$someDcc]))
+ {
+ return $this->dccList[$someDcc];
+ }
+
+ return false;
+ }
+
+
+ public function dccInform($data, $from = null)
+ {
+ foreach ($this->dccList AS $dcc)
+ {
+ if ($dcc->type == CHAT && $dcc->verified == true && $dcc->isAdmin == true)
+ {
+ if ($from != null)
+ {
+ if ($dcc->sockInt != $from->sockInt)
+ {
+ $dcc->dccSend($data);
+ }
+ }
+ else
+ {
+ $dcc->dccSend($data);
+ }
+
+ }
+
+ }
+ }
+
+ //Works in conjunction with $oldConn->connected
+ public function accepted($oldConn, $newConn)
+ {
+ $sockInt = $oldConn->getSockInt();
+ $hasAccepted = $newConn->getSockInt();
+
+ $dcc = $this->dccList[$sockInt];
+ $this->dccList[$hasAccepted] = $dcc;
+ $dcc->status = DCC_CONNECTED;
+ $dcc->sockInt = $hasAccepted;
+ unset($this->dccList[$sockInt]);
+ }
+
+ //CheckDccTimeout function
+ public function checkDccTimeout($dcc)
+ {
+ if (!is_object($dcc) || $dcc->removed == true)
+ {
+ return false;
+ }
+
+ if ($dcc->status != DCC_LISTENING)
+ {
+ return false;
+ }
+
+ switch ($dcc->timeOutLevel)
+ {
+ case 0:
+ $dcc->timeOutLevel++;
+ break;
+ case 1:
+ $dcc->timeOutLevel++;
+ $this->ircClass->notice($dcc->nick, "You have a DCC session pending. Set your client to connect. 60 seconds before timeout.", 1);
+ break;
+ case 2:
+ $dcc->timeOutLevel++;
+ $this->ircClass->notice($dcc->nick, "You have a DCC session pending. Set your client to connect. 30 seconds before timeout.", 1);
+ break;
+ case 3:
+ $dcc->timeOutLevel = 0;
+ $dcc->disconnect("DCC Session timed out (90 Seconds)");
+ return false;
+ break;
+ default:
+ break;
+ }
+
+ return true;
+
+ }
+
+ public function getDccList()
+ {
+ return $this->dccList;
+ }
+
+ private function removeDcc($dcc)
+ {
+ $sockInt = $dcc->sockInt;
+ unset($this->dccList[$sockInt]);
+ }
+
+ public function dccSend($to, $data)
+ {
+ if (($len = $this->socketClass->sendSocket($to->sockInt, $data)) === false)
+ {
+ $to->disconnect();
+ }
+ return $len;
+ }
+
+
+ private function highestId()
+ {
+ $highest = 0;
+
+ foreach ($this->dccList AS $index => $dcc)
+ {
+ $highest = ($dcc->id > $highest ? $dcc->id : $highest);
+ }
+
+ return $highest + 1;
+ }
+
+
+ public function addChat($nick, $host, $port, $admin, $handler, $fromTimer = false)
+ {
+ $lnick = irc::myStrToLower($nick);
+
+ foreach ($this->dccList AS $index => $dcc)
+ {
+ if ($dcc->type == CHAT)
+ {
+ if (irc::myStrToLower($dcc->nick) == $lnick)
+ {
+ $dcc->disconnect();
+ break;
+ }
+ }
+ }
+
+ $reverse = false;
+
+ if ($this->ircClass->getClientConf("mircdccreverse") != "" && $fromTimer == false)
+ {
+ $port = intval($this->ircClass->getClientConf("mircdccreverse"));
+ if ($port == 0)
+ {
+ return NULL;
+ }
+
+ $args = new argClass;
+
+ $args->arg1 = $nick;
+ $args->arg2 = $host;
+ $args->arg3 = $port;
+ $args->arg4 = $admin;
+ $args->arg5 = $handler;
+ $args->arg7 = time();
+ $args->arg8 = CHAT;
+
+ $this->ircClass->notice($nick, "DCC: NOTICE: This server is using the mIRC Chat Server Protocol. Please use ' /dccserver +c on " . $this->ircClass->getClientConf("mircdccreverse") . " ' to chat with me! Starting 6 second delay...", 0);
+
+ $this->ircClass->sendRaw("WHOIS " . $nick);
+ $this->timerClass->addTimer(irc::randomHash(), $this, "reverseTimer", $args, 6, false);
+ return;
+ }
+
+ if ($fromTimer == true)
+ {
+ $reverse = DCC_REVERSE; // using mIRC dcc reverse protocol
+ }
+
+ if ($host == NULL || $port == NULL)
+ {
+ $conn = new connection(null, null, 0);
+ $listening = true;
+ $status = DCC_LISTENING;
+ }
+ else
+ {
+ $conn = new connection($host, $port, CONNECT_TIMEOUT);
+ $listening = false;
+ $status = DCC_CONNECTING;
+ }
+
+ $conn->setSocketClass($this->socketClass);
+ $conn->setIrcClass($this->ircClass);
+ $conn->setCallbackClass($this);
+ $conn->setTimerClass($this->timerClass);
+ $port = $conn->init();
+
+ if ($conn->getError())
+ {
+ $this->ircClass->log("Start Chat Error: " . $conn->getErrorMsg());
+ return false;
+ }
+
+ $sockInt = $conn->getSockInt();
+
+ $this->chatCount++;
+
+ $id = $this->highestId();
+
+ $chat = new chat($id, $nick, $admin, $sockInt, $host, $port, $handler, $reverse);
+ $chat->setIrcClass($this->ircClass);
+ $chat->setDccClass($this);
+ $chat->setParserClass($this->parserClass);
+ $chat->setSocketClass($this->socketClass);
+ $chat->setTimerClass($this->timerClass);
+ $chat->connection = $conn;
+ $chat->status = $status;
+ $chat->removed = false;
+
+ $this->dccList[$sockInt] = $chat;
+
+ $chat->initialize();
+
+ $conn->setCallbackClass($chat);
+
+ if ($listening == true)
+ {
+ $this->timerClass->addTimer(irc::randomHash(), $this, "checkDccTimeout", $chat, 30, true);
+ }
+ else
+ {
+ $conn->connect();
+ }
+
+ return $port;
+ }
+
+ public function addFile($nick, $host, $port, $type, $filename, $size, $fromTimer = false) // <-- ignore fromTimer, it is sent by reverseTimer() above
+ {
+ $reverse = false;
+
+ if ($this->ircClass->getClientConf("mircdccreverse") != "" && $fromTimer == false && $type != DOWNLOAD)
+ {
+ $port = intval($this->ircClass->getClientConf("mircdccreverse"));
+ if ($port == 0)
+ {
+ return NULL;
+ }
+
+ $args = new argClass;
+
+ $args->arg1 = $nick;
+ $args->arg2 = $host;
+ $args->arg3 = $port;
+ $args->arg4 = $type;
+ $args->arg5 = $filename;
+ $args->arg6 = $size;
+ $args->arg7 = time();
+ $args->arg8 = FILE;
+
+ $this->ircClass->notice($nick, "DCC: NOTICE: This server is using the mIRC File Server Protocol. Please use ' /dccserver +s on " . $this->ircClass->getClientConf("mircdccreverse") . " ' to recieve files from me! Starting 6 second delay...", 0);
+
+ $this->ircClass->sendRaw("WHOIS " . $nick);
+ $this->timerClass->addTimer(irc::randomHash(), $this, "reverseTimer", $args, 6);
+ return;
+ }
+
+ if ($fromTimer == true)
+ {
+ $reverse = DCC_REVERSE; // using mIRC dcc reverse protocol
+ }
+
+ if ($host == NULL || $port == NULL)
+ {
+ $conn = new connection(null, null, 0);
+ $listening = true;
+ $status = DCC_LISTENING;
+ }
+ else
+ {
+ $conn = new connection($host, $port, CONNECT_TIMEOUT);
+ $listening = false;
+ $status = DCC_CONNECTING;
+ }
+
+ $conn->setSocketClass($this->socketClass);
+ $conn->setIrcClass($this->ircClass);
+ $conn->setCallbackClass($this);
+ $conn->setTransTimeout(30);
+ $conn->setTimerClass($this->timerClass);
+ $port = $conn->init();
+
+ if ($conn->getError())
+ {
+ $this->ircClass->log("File transfer start error: " . $conn->getErrorMsg());
+ return false;
+ }
+
+ $sockInt = $conn->getSockInt();
+
+ $id = $this->highestId();
+
+ $file = new file($id, $nick, $sockInt, $host, $port, $type, $reverse);
+
+ if ($file->transferType == UPLOAD)
+ {
+ $this->fileUlCount++;
+ }
+ else
+ {
+ $this->fileDlCount++;
+ }
+
+ $file->setIrcClass($this->ircClass);
+ $file->setDccClass($this);
+ $file->setSocketClass($this->socketClass);
+ $file->setProcQueue($this->procQueue);
+ $file->setTimerClass($this->timerClass);
+ $file->connection = $conn;
+ $file->status = $status;
+ $file->removed = false;
+
+ $this->dccList[$sockInt] = $file;
+
+ $file->initialize($filename, $size);
+
+ $conn->setCallbackClass($file);
+
+ if ($listening == true)
+ {
+ $this->timerClass->addTimer(irc::randomHash(), $this, "checkDccTimeout", $file, 30, true);
+ }
+
+ if ($reverse == true)
+ {
+ $conn->connect();
+ }
+
+ return $port;
+ }
+
+
+ public function alterSocket($sockInt, $level, $opt, $val)
+ {
+ return $this->socketClass->alterSocket($sockInt, $level, $opt, $val);
+ }
+
+
+ public function reverseTimer($args)
+ {
+ $memData = $this->ircClass->getUserData($args->arg1);
+
+ if ($memData == NULL || ($memData->host == "" || $memData->host == NULL))
+ {
+ $this->ircClass->notice($args->arg1, "DCC: ERROR: Couldn't resolve your hostname. Try again?");
+ }
+ else
+ {
+
+ if ($args->arg8 == FILE)
+ {
+ $this->addFile( $args->arg1,
+ $memData->host,
+ $this->ircClass->getClientConf("mircdccreverse"),
+ $args->arg4,
+ $args->arg5,
+ $args->arg6,
+ true);
+ }
+ else
+ {
+ $this->addChat( $args->arg1,
+ $memData->host,
+ $this->ircClass->getClientConf("mircdccreverse"),
+ $args->arg4,
+ $args->arg5,
+ true);
+ }
+ }
+
+ return false;
+ }
+
+ public function sendFile($nick, $file)
+ {
+ return $this->addFile($nick, null, null, UPLOAD, $file, NULL);
+ }
+
+
+ public function dccResume($port, $size)
+ {
+ foreach ($this->dccList AS $dcc)
+ {
+ if ($dcc->type == FILE)
+ {
+ if ($dcc->port == $port)
+ {
+ $dcc->resume($size);
+ break;
+ }
+ }
+ }
+ }
+
+ public function dccAccept($port)
+ {
+ foreach ($this->dccList AS $dcc)
+ {
+ if ($dcc->type == FILE)
+ {
+ if ($dcc->port == $port)
+ {
+ $dcc->accepted();
+ break;
+ }
+ }
+ }
+ }
+
+ public function disconnect($dcc)
+ {
+
+ switch ($dcc->type)
+ {
+ case CHAT:
+ $this->chatCount--;
+ break;
+ case FILE:
+ switch($dcc->transferType)
+ {
+ case UPLOAD:
+ $this->fileUlCount--;
+ break;
+ case DOWNLOAD:
+ $this->fileDlCount--;
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ $dcc->removed = true;
+
+ $dcc->connection->disconnect();
+ $this->removeDcc($dcc);
+
+ return true;
+ }
+
+
+}
+
+?>
diff --git a/ircbot/defines.php b/ircbot/defines.php
new file mode 100644
index 0000000..15d283e
--- /dev/null
+++ b/ircbot/defines.php
@@ -0,0 +1,314 @@
+ defines module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+// Debug Mode
+define('DEBUG', 1);
+
+// PID file
+define('PID', config::$main['cs_path'] . "/ircbot.pid");
+
+// OS Type (windows/unix/linux/freebsd/unknown/auto)
+define('OS', 'auto');
+
+//YOU SHOULD NOT HAVE TO EDIT BELOW THIS POINT UNLESS YOU SPECIFY "unknown" AS OS!
+
+if (OS == "auto")
+{
+ switch (PHP_OS)
+ {
+ case "Windows NT":
+ $OS = "windows";
+ break;
+ case "Linux":
+ $OS = "linux";
+ break;
+ case "FreeBSD":
+ $OS = "freebsd";
+ break;
+ case "Unix":
+ $OS = "unix";
+ break;
+ //Thx OrochiTux for below
+ case "Darwin":
+ $OS = "freebsd";
+ break;
+ default:
+ $OS = "windows";
+ break;
+ }
+}
+else
+{
+ $OS = OS;
+}
+
+if ($OS == 'unknown')
+{
+ define('EAGAIN', 0); /* Try again */
+ define('EISCONN', 0); /* Transport endpoint is already connected */
+ define('EALREADY', 0); /* Operation already in progress */
+ define('EINPROGRESS', 0); /* Operation now in progress */
+}
+else if ($OS == 'windows')
+{
+ //http://developer.novell.com/support/winsock/doc/appenda.htm
+ define('EAGAIN', 10035); //EWOULDBLOCK.. kinda like EAGAIN in windows?
+ define('EISCONN', 10056); /* Transport endpoint is already connected */
+ define('EALREADY', 10037); /* Operation already in progress */
+ define('EINPROGRESS', 10036); /* Operation now in progress */
+}
+else if ($OS == 'freebsd')
+{
+ //Thanks to ryguy@efnet
+ ///usr/include/errno.h (freebsd)
+ define('EAGAIN', 35); /* Try again */
+ define('EISCONN', 56); /* Transport endpoint is already connected */
+ define('EALREADY', 37); /* Operation already in progress */
+ define('EINPROGRESS', 36); /* Operation now in progress */
+}
+else if ($OS == 'linux')
+{
+ ///usr/include/sys/errno.h (sparc)
+ define('EAGAIN', 11); /* Try again */
+ define('EISCONN', 106); /* Transport endpoint is already connected */
+ define('EALREADY', 114); /* Operation already in progress */
+ define('EINPROGRESS', 115); /* Operation now in progress */
+}
+else if ($OS == 'unix')
+{
+ ///usr/include/asm/errno.h (mandrake 9.0)
+ define('EAGAIN', 11); /* Try again */
+ define('EISCONN', 133); /* Transport endpoint is already connected */
+ define('EALREADY', 149); /* Operation already in progress */
+ define('EINPROGRESS', 150); /* Operation now in progress */
+}
+
+// Version Definition
+define('VERSION', '2.2.1');
+define('VERSION_DATE', '04/08/06');
+
+// Timer declarations
+define('NICK_CHECK_TIMEOUT', 120); //seconds
+define('CHAN_CHECK_TIMEOUT', 60); //seconds
+define('PING_TIMEOUT', 130); //seconds (check every 130 seconds if we're still connected)
+
+// Parser definitions
+define('MAX_ARGS', 4);
+
+// Status definitions
+define('STATUS_IDLE', 0);
+define('STATUS_ERROR', 1);
+define('STATUS_CONNECTING', 2);
+define('STATUS_CONNECTED', 3);
+define('STATUS_CONNECTED_SENTREGDATA', 4);
+define('STATUS_CONNECTED_REGISTERED', 5);
+
+// Constant Definitions
+define('ERROR_TIMEOUT', 60);
+define('CONNECT_TIMEOUT', 45);
+define('REGISTRATION_TIMEOUT', 60);
+define('TIMEOUT_CHECK_TIME', 85); //85
+
+//Constants for Channel Modes
+define('BY_MASK', 0);
+define('BY_STRING', 1);
+define('BY_INT', 2);
+define('BY_NONE', 3);
+
+//Used with $ircClass->parseMode
+define('USER_MODE', 0);
+define('CHANNEL_MODE', 1);
+
+//Random Vars
+define('STATUS_JUST_BANNED', 1);
+define('STATUS_ALREADY_BANNED', 2);
+define('STATUS_NOT_BANNED', 3);
+
+//Socket Class defines
+define('SOCK_DEAD', 1);
+define('SOCK_CONNECTING', 2);
+define('SOCK_LISTENING', 3);
+define('SOCK_ACCEPTED', 4);
+define('SOCK_ACCEPTING', 5);
+define('SOCK_CONNECTED', 6);
+define('HIGHEST_PORT', 1000); // this is tcpRangeStart + HIGHEST_PORT
+
+//DCC Class defines
+define('FILE', 0);
+define('CHAT', 1);
+define('DCC_WAITING', 3);
+define('DCC_REVERSE', 4);
+define('DCC_CONNECTING', 0);
+define('DCC_CONNECTED', 1);
+define('DCC_LISTENING', 2);
+
+//Connection class defines
+define('CONN_READ', 0);
+define('CONN_WRITE', 1);
+define('CONN_ACCEPT', 2);
+define('CONN_CONNECT', 3);
+define('CONN_DEAD', 4);
+define('CONN_CONNECT_TIMEOUT', 5);
+define('CONN_TRANSFER_TIMEOUT', 6);
+
+//Parser Class defines
+define('BRIGHT', chr(3) . "13");
+define('DARK', chr(3) . "03");
+define('NORMAL', chr(16));
+define('BOLD', chr(2));
+define('UNDERLINE', chr(31));
+define('PRIV', 1);
+define('DCC', 2);
+
+//File Class defines
+define('UPLOAD', 0);
+define('DOWNLOAD', 1);
+
+//Used with $ircClass->addQuery
+define('QUERY_SUCCESS', 0);
+define('QUERY_ERROR', 1);
+
+//Used in ini
+define('EXACT_MATCH', 0);
+define('AND_MATCH', 1);
+define('OR_MATCH', 2);
+define('CONTAINS_MATCH', 3);
+
+//Used in socket class to keep track of sockets
+
+class socketInfo {
+ public $socket;
+ public $status;
+ public $readQueue;
+ public $readLength;
+ public $writeQueue;
+ public $writeLength;
+ public $host;
+ public $port;
+ public $newSockInt;
+ public $listener;
+ public $owner;
+ public $class;
+ public $func;
+ public $readScheduled; //Used so we don't add infinite queues to the process queue.
+ public $writeScheduled;
+}
+
+//Channel and Username Linked List (Links) Definitions
+
+class channelLink {
+ public $name;
+ public $count;
+ public $memberList = array();
+ public $banList = array();
+ public $whoComplete;
+ public $banComplete;
+ public $modes;
+ public $created;
+ public $topic;
+ public $topicBy;
+}
+
+class memberLink {
+ public $nick;
+ public $realNick;
+ public $host;
+ public $ident;
+ public $banned;
+ public $bantime;
+ public $status;
+ public $ignored;
+}
+
+// Used in timer class
+
+class timer {
+ public $name;
+ public $class;
+ public $args;
+ public $interval;
+ public $lastTimeRun;
+ public $nextRunTime;
+ public $func;
+}
+
+class usageLink {
+ public $isBanned;
+ public $timeBanned;
+ public $lastTimeUsed;
+ public $timesUsed;
+}
+
+
+// Useful for sending arguments with timers
+class argClass
+{
+ public $arg1;
+ public $arg2;
+ public $arg3;
+ public $arg4;
+ public $arg5;
+ public $arg6;
+ public $arg7;
+ public $arg8;
+ public $timer;
+}
+
+// Used to instantiate a bot
+class botClass {
+ public $timerClass;
+ public $ircClass;
+ public $dccClass;
+ public $parserClass;
+ public $socketClass;
+ public $configFilename;
+ public $db;
+ public $config;
+}
+
+// Used with processQueue
+class queueItem {
+ public $owner; //IRC Class of owner
+ public $callBack_class; //CALL BACK class/function to use
+ public $callBack_function;
+ public $nextRunTime; //The next getMicroTime() time to run
+ public $removed;
+ public $next;
+ public $prev;
+}
+
+?>
diff --git a/ircbot/error.php b/ircbot/error.php
new file mode 100644
index 0000000..789b7fb
--- /dev/null
+++ b/ircbot/error.php
@@ -0,0 +1,107 @@
+ error module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class ConnectException extends Exception {
+
+ private $exceptionTime = 0;
+
+ function __construct($message)
+ {
+ parent::__construct($message);
+ $this->exceptionTime = time();
+ }
+
+ function getTime()
+ {
+ return $this->exceptionTime;
+ }
+}
+
+
+class SendDataException extends Exception {
+
+ private $exceptionTime = 0;
+
+ function __construct($message)
+ {
+ parent::__construct($message);
+ $this->exceptionTime = time();
+ }
+
+ function getTime()
+ {
+ return $this->exceptionTime;
+ }
+}
+
+
+
+class ConnectionTimeout extends Exception {
+
+ private $exceptionTime = 0;
+
+ function __construct($message)
+ {
+ parent::__construct($message);
+ $this->exceptionTime = time();
+ }
+
+ function getTime()
+ {
+ return $this->exceptionTime;
+ }
+}
+
+
+
+class ReadException extends Exception {
+
+ private $exceptionTime = 0;
+
+ function __construct($message)
+ {
+ parent::__construct($message);
+ $this->exceptionTime = time();
+ }
+
+ function getTime()
+ {
+ return $this->exceptionTime;
+ }
+}
+
+?>
diff --git a/ircbot/file.php b/ircbot/file.php
new file mode 100644
index 0000000..0b7f84c
--- /dev/null
+++ b/ircbot/file.php
@@ -0,0 +1,663 @@
+ dcc chat module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class file {
+
+ /* Chat specific Data */
+ public $id;
+ public $status;
+ public $sockInt;
+ public $timeConnected;
+ public $readQueue;
+ public $port;
+ public $dccString;
+ public $type;
+ public $transferType;
+ public $nick;
+ public $timeOutLevel;
+ public $removed;
+ public $connection;
+
+ public $reverse; // reverse dcc?
+ private $handShakeSent;
+ private $handShakeTime;
+
+ public $filename;
+ public $filenameNoDir;
+ public $filePointer;
+ public $filesize;
+ public $bytesTransfered;
+ public $resumedSize;
+ public $completed;
+ public $reportedRecieved;
+
+ public $connectHost;
+
+ //private $resumed;
+ private $started;
+
+ private $sendQueue;
+ private $sendQueueCount;
+
+ //keep track of speed;
+ private $speed_sec_add;
+ public $speed_lastavg;
+ private $speed_starttime;
+
+ /* Classes */
+ private $dccClass;
+ private $ircClass;
+ private $socketClass;
+ private $procQueue;
+ private $timerClass;
+
+ /* Constructor */
+ public function __construct($id, $nick, $sockInt, $host, $port, $type, $reverse)
+ {
+ $this->id = $id;
+ $this->nick = $nick;
+ $this->sockInt = $sockInt;
+ $this->connectHost = $host;
+ $this->port = $port;
+ $this->transferType = $type;
+ $this->filesize = 0;
+ $this->bytesTransfered = 0;
+ $this->resumedSize = 0;
+ $this->started = false;
+ $this->status = DCC_WAITING;
+ $this->reverse = $reverse;
+ $this->handShakeSent = false;
+
+ $this->speed_sec_add = 0;
+ $this->speed_lastavg = 0;
+ $this->speed_starttime = 0;
+
+ if ($type == UPLOAD)
+ {
+ $this->dccString = "DCC UPLOAD[".$this->id."]: ";
+ }
+ else
+ {
+ $this->dccString = "DCC DOWNLOAD[".$this->id."]: ";
+ }
+
+ }
+
+ public function setProcQueue($class)
+ {
+ $this->procQueue = $class;
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ public function setDccClass($class)
+ {
+ $this->dccClass = $class;
+ }
+
+ public function dccSend($data)
+ {
+ return $this->dccClass->dccSend($this, $data);
+ }
+
+ public function disconnect($msg = "")
+ {
+
+ $msg = str_replace("\r", "", $msg);
+ $msg = str_replace("\n", "", $msg);
+
+ if ($this->started == true)
+ {
+ fclose($this->filePointer);
+ }
+
+ if ($msg != "")
+ {
+ $this->dccClass->dccInform($this->dccString . "DCC session ended with " . $this->nick . " (" . $msg . ")", $this);
+ $this->ircClass->notice($this->nick, "DCC session ended: " . $msg, 1);
+ }
+ else
+ {
+ $this->dccClass->dccInform($this->dccString . "DCC session ended with " . $this->nick, $this);
+ }
+
+ $this->status = false;
+
+ $this->dccClass->disconnect($this);
+
+ $this->connection = null;
+
+ return true;
+ }
+
+ function xferUpload()
+ {
+
+ while ($this->readQueue != "")
+ {
+ $unsignedLong = substr($this->readQueue, 0, 4);
+
+ if (strlen($unsignedLong) < 4)
+ {
+ break;
+ }
+
+ $sizeArray = unpack("N", $unsignedLong);
+
+ $this->reportedRecieved = $sizeArray[1];
+
+ $this->readQueue = substr($this->readQueue, 4);
+ }
+
+ if ($this->completed == 1)
+ {
+ if ($this->reportedRecieved >= $this->filesize)
+ {
+ $avgspeed = "";
+ if ($this->speed_lastavg != 0)
+ {
+ $size = irc::intToSizeString($this->speed_lastavg);
+ $avgspeed = " (" . $size . "/s)";
+ }
+
+ $totalTime = $this->ircClass->timeFormat(time() - $this->timeConnected, "%h hrs, %m min, %s sec");
+ $size = irc::intToSizeString($this->bytesTransfered - $this->resumedSize);
+ $this->disconnect("Transfer Completed, Sent " . $size . " in " . $totalTime . $avgspeed);
+ }
+ return;
+ }
+
+ if ($this->status != DCC_CONNECTED)
+ {
+ return;
+ }
+
+ if ($this->socketClass->hasWriteQueue($this->sockInt))
+ {
+ return;
+ }
+
+ if ($this->bytesTransfered >= $this->filesize)
+ {
+ $this->completed = 1;
+ return;
+ }
+
+ if (time() >= $this->speed_starttime + 3)
+ {
+ $this->speed_lastavg = $this->speed_sec_add / 3.0;
+ $this->speed_sec_add = 0;
+ $this->speed_starttime = time();
+ }
+
+ if (!is_resource($this->filePointer))
+ {
+ $this->disconnect("File pointer is not a resource");
+ return;
+ }
+
+ for ($i = 0; $i < 30; $i++)
+ {
+ if (($data = fread($this->filePointer, 4096)) === false)
+ {
+ $this->disconnect("Read error: Could not access file");
+ return;
+ }
+
+ $this->dccSend($data);
+
+ $dataSize = strlen($data);
+
+ $this->bytesTransfered += $dataSize;
+ $this->dccClass->addBytesUp($dataSize);
+ $this->speed_sec_add += $dataSize;
+
+ if ($this->socketClass->hasWriteQueue($this->sockInt))
+ {
+ break;
+ }
+ }
+
+ }
+
+ function xferDownload()
+ {
+
+ if ($this->status != DCC_CONNECTED)
+ {
+ return;
+ }
+
+ $readQueueSize = strlen($this->readQueue);
+
+ if ($readQueueSize <= 0)
+ {
+ return;
+ }
+
+ if (fwrite($this->filePointer, $this->readQueue, $readQueueSize) === false)
+ {
+ $this->disconnect("Write error: Could not access file");
+ }
+
+ $this->speed_sec_add += $readQueueSize;
+ $this->dccClass->addBytesDown($readQueueSize);
+ $this->bytesTransfered += $readQueueSize;
+ $this->readQueue = "";
+
+ $this->dccSend(pack("N", $this->bytesTransfered));
+
+ if ($this->bytesTransfered >= $this->filesize)
+ {
+ $avgspeed = "";
+ if ($this->speed_lastavg != 0)
+ {
+ $size = irc::intToSizeString($this->speed_lastavg);
+ $avgspeed = " (" . $size . "/s)";
+ }
+
+ $totalTime = $this->ircClass->timeFormat(time() - $this->timeConnected, "%h hrs, %m min, %s sec");
+ $size = irc::intToSizeString($this->bytesTransfered - $this->resumedSize);
+ $this->disconnect("Transfer Completed, Recieved " . $size . " in " . $totalTime . $avgspeed);
+ }
+
+ if (time() >= $this->speed_starttime + 3)
+ {
+ $this->speed_lastavg = $this->speed_sec_add / 3.0;
+ $this->speed_sec_add = 0;
+ $this->speed_starttime = time();
+ }
+ }
+
+
+ private function doHandShake()
+ {
+ $this->dccSend("120 ".$this->ircClass->getNick()." ".$this->filesize." ".$this->filenameNoDir."\n");
+ $this->handShakeSent = true;
+ $this->timerClass->addTimer(irc::randomHash(), $this, "handShakeTimeout", "", 8);
+ }
+
+ private function processHandShake()
+ {
+ if ($this->readQueue == "")
+ {
+ return;
+ }
+
+ $response = $this->readQueue;
+ $this->readQueue = "";
+ $responseArray = explode(chr(32), $response);
+ if ($responseArray[0] == "121")
+ {
+ $this->resumedSize = intval($responseArray[2]);
+ $this->reverse = false;
+ $this->onConnect($conn);
+ return;
+ }
+
+ $this->disconnect("DCC Client Server reported error on attempt to send file");
+ }
+
+ public function handShakeTimeout()
+ {
+ if ($this->status != false)
+ {
+ if ($this->reverse == true)
+ {
+ $this->disconnect("DCC Reverse handshake timed out");
+ }
+ }
+ return false;
+ }
+
+
+
+ /* Main events */
+ public function onDead($conn)
+ {
+ if ($this->completed == 1)
+ {
+ $avgspeed = "";
+ if ($this->speed_lastavg != 0)
+ {
+ $size = irc::intToSizeString($this->speed_lastavg);
+ $avgspeed = " (" . $size . "/s)";
+ }
+
+ $totalTime = $this->ircClass->timeFormat(time() - $this->timeConnected, "%h hrs, %m min, %s sec");
+ $size = irc::intToSizeString($this->bytesTransfered - $this->resumedSize);
+ $this->disconnect("Transfer Completed, Sent " . $size . " in " . $totalTime . $avgspeed);
+ }
+ else
+ {
+ $this->disconnect($this->connection->getErrorMsg());
+ }
+ }
+
+ public function onRead($conn)
+ {
+
+ $this->readQueue .= $this->socketClass->getQueue($this->sockInt);
+
+ if ($this->status == DCC_CONNECTED)
+ {
+
+ if ($this->transferType == UPLOAD)
+ {
+ if ($this->reverse != false)
+ {
+ if ($this->handShakeSent != false)
+ {
+ $this->processHandShake();
+ }
+ }
+ }
+ else
+ {
+ $this->xferDownload();
+ }
+ }
+ return false;
+ }
+
+ public function onWrite($conn)
+ {
+ if ($this->status == DCC_CONNECTED && $this->reverse == false)
+ {
+ $this->xferUpload();
+ }
+ }
+
+ public function onAccept($oldConn, $newConn)
+ {
+ $this->dccClass->accepted($oldConn, $newConn);
+ $this->connection = $newConn;
+ $oldConn->disconnect();
+ $this->sockInt = $newConn->getSockInt();
+ $this->onConnect($newConn);
+ }
+
+ public function onTransferTimeout($conn)
+ {
+ $this->disconnect("Transfer timed out");
+ }
+
+ public function onConnectTimeout($conn)
+ {
+ $this->disconnect("Connection attempt timed out");
+ }
+
+ public function onConnect($conn)
+ {
+ $this->status = DCC_CONNECTED;
+
+ $this->dccClass->dccInform($this->dccString . $this->nick . " connection established");
+
+ if ($this->reverse != false)
+ {
+ $this->doHandShake();
+ return;
+ }
+
+ if ($this->transferType == UPLOAD)
+ {
+ $this->dccClass->alterSocket($this->sockInt, SOL_SOCKET, SO_SNDBUF, 32768);
+
+ $this->filePointer = fopen($this->filename, "rb");
+
+ if ($this->filePointer === false)
+ {
+ $this->disconnect("Error opening local file for reading");
+ return;
+ }
+
+ if ($this->resumedSize > 0)
+ {
+ if (fseek($this->filePointer, $this->resumedSize, SEEK_SET) == -1)
+ {
+ $this->disconnect("Error seeking to resumed file position in file");
+ return;
+ }
+ }
+
+ $this->xferUpload();
+
+ }
+ else
+ {
+ $this->dccClass->alterSocket($this->sockInt, SOL_SOCKET, SO_RCVBUF, 32768);
+
+ $this->filePointer = fopen($this->filename, "ab");
+
+ $this->ircClass->notice($this->nick, "DCC: Upload connection established", 0);
+
+ if ($this->filePointer === false)
+ {
+ $this->disconnect("Error opening local file for writing");
+ return;
+ }
+
+ }
+
+ $this->started = true;
+ $this->speed_starttime = time();
+
+ }
+
+
+ public function initialize($filename, $size = 0)
+ {
+ $this->reportedRecieved = 0;
+ $this->completed = 0;
+ $this->filesize = $size;
+ $this->timeConnected = time();
+ $this->timeOutLevel = 0;
+ $this->readQueue = "";
+ $this->type = FILE;
+
+ if ($this->transferType == UPLOAD)
+ {
+ $this->filename = $filename;
+
+ if (strpos($filename, "/") !== false)
+ {
+ $filenameArray = explode("/", $filename);
+ $this->filenameNoDir = $filenameArray[count($filenameArray) - 1];
+ }
+ else if (strpos($filename, "\\") !== false)
+ {
+ $filenameArray = explode("\\", $filename);
+ $this->filenameNoDir = $filenameArray[count($filenameArray) - 1];
+ }
+ else
+ {
+ $this->filenameNoDir = $filename;
+ }
+
+ $this->filenameNoDir = $this->cleanFilename($this->filenameNoDir);
+
+ $this->dccClass->dccInform($this->dccString . "Initiating file transfer of (".$this->filenameNoDir.") to " . $this->nick);
+
+ if (!$this->file_exists($this->filename))
+ {
+ $this->disconnect("File does not exist");
+ return;
+ }
+
+ $fileSize = $this->filesize($this->filename);
+ if ($fileSize === false)
+ {
+ $this->disconnect("File does not exist");
+ return;
+ }
+
+ $this->filesize = $fileSize;
+
+
+ $kbSize = irc::intToSizeString($fileSize);
+
+ if ($this->reverse == false)
+ {
+ $this->ircClass->privMsg($this->nick, "\1DCC SEND " . $this->filenameNoDir . " " . $this->ircClass->getClientIP(1) . " " . $this->port . " " . $fileSize . "\1", 0);
+ }
+
+ $this->ircClass->notice($this->nick, "DCC: Sending you (\"" . $this->filenameNoDir . "\") which is " . $kbSize . " (resume supported)", 0);
+
+ }
+ else
+ {
+ $uldir = $this->ircClass->getClientConf('uploaddir');
+
+ $lastChar = substr($uldir, strlen($uldir) - 1, 1);
+
+ if ($lastChar != "\\" || $lastChar != "/")
+ {
+ $uldir .= "/";
+ }
+
+ $filename = $this->cleanFilename($filename);
+
+ $this->filename = $uldir . $filename;
+ $this->dccClass->dccInform($this->dccString . "Initiating file transfer of (".$filename.") from " . $this->nick);
+
+ if ($this->file_exists($this->filename))
+ {
+ $bytesFinished = $this->filesize($this->filename);
+ if ($bytesFinished >= $this->filesize)
+ {
+ $this->disconnect("Connection aborted. I already have that file.");
+ return;
+ }
+ else
+ {
+ $this->status = DCC_WAITING;
+ $this->bytesTransfered = $bytesFinished;
+ $this->resumedSize = $bytesFinished;
+ $this->ircClass->privMsg($this->nick, "\1DCC RESUME file.ext " . $this->port . " " . $bytesFinished . "\1", 0);
+ }
+ return;
+ }
+
+ $this->ircClass->notice($this->nick, "DCC: Upload accepted, connecting to you (" . $this->connectHost . ") on port " . $this->port . ".",0);
+
+
+ $this->status = DCC_CONNECTING;
+ $this->connection->connect();
+
+ }
+
+ }
+
+ public function accepted()
+ {
+ $this->status = DCC_CONNECTING;
+ $this->connection->connect();
+ }
+
+ public function resume($size)
+ {
+ $this->resumedSize = $size;
+ $this->bytesTransfered = $size;
+
+ $resumePlace = round($size / 1000, 0);
+ $this->dccClass->dccInform($this->dccString . "Resumed at " . $resumePlace . "K");
+ $this->ircClass->privMsg($this->nick, "\1DCC ACCEPT file.ext " . $this->port . " " . $size . "\1", 0);
+ }
+
+ public static function cleanFilename($filename)
+ {
+ $filename = str_replace("..", "__", $filename);
+ $filename = str_replace(chr(47), "_", $filename);
+ $filename = str_replace(chr(92), "_", $filename);
+ $filename = str_replace(chr(58), "_", $filename);
+ $filename = str_replace(chr(63), "_", $filename);
+ $filename = str_replace(chr(34), "_", $filename);
+ $filename = str_replace(chr(62), "_", $filename);
+ $filename = str_replace(chr(60), "_", $filename);
+ $filename = str_replace(chr(124), "_", $filename);
+ $filename = str_replace(chr(32), "_", $filename);
+
+ return $filename;
+ }
+
+ private function file_exists($filename)
+ {
+ $fp = @fopen($filename, "rb");
+ if ($fp === false)
+ {
+ return false;
+ }
+ else
+ {
+ fclose($fp);
+ return true;
+ }
+ }
+
+ private function filesize($filename)
+ {
+
+ $fp = @fopen($filename, "rb");
+ if ($fp === false)
+ {
+ return false;
+ }
+ else
+ {
+ $fstat = fstat($fp);
+ fclose($fp);
+ return $fstat['size'];
+ }
+
+ }
+
+}
+
+?>
diff --git a/ircbot/function.conf b/ircbot/function.conf
new file mode 100644
index 0000000..c940125
--- /dev/null
+++ b/ircbot/function.conf
@@ -0,0 +1,58 @@
+;+---------------------------------------------------------------------------
+;| PHP-IRC v2.2.1 Service Release
+;| =======================================================
+;| by Manick
+;| (c) 2001-2006 by http://www.phpbots.org/
+;| Contact: manick@manekian.com
+;| irc: #manekian@irc.rizon.net
+;| ========================================
+;| Special Contributions were made by:
+;| cortex
+;+---------------------------------------------------------------------------
+;| > Function File
+;+---------------------------------------------------------------------------
+;| > This program is free software; you can redistribute it and/or
+;| > modify it under the terms of the GNU General Public License
+;| > as published by the Free Software Foundation; either version 2
+;| > of the License, or (at your option) any later version.
+;| >
+;| > This program is distributed in the hope that it will be useful,
+;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;| > GNU General Public License for more details.
+;| >
+;| > You should have received a copy of the GNU General Public License
+;| > along with this program; if not, write to the Free Software
+;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;+---------------------------------------------------------------------------
+;| Changes
+;| =======-------
+;| > If you wish to suggest or submit an update/change to the source
+;| > code, email me at manick@manekian.com with the change, and I
+;| > will look to adding it in as soon as I can.
+;+---------------------------------------------------------------------------
+
+; some notes:
+; the ~ operater spans definitions over multiple lines. the ; operator
+; denotes a comment. it can be placed anywhere. you must escape
+; your single quotes in quoted entries with a backslash \. the first
+; type of every statement is explained
+
+; NOTE: as of 2.2.0, all function configuration was moved to specific files using
+; the 'include' function. General type definitions can be found in typedefs.conf
+
+include typedefs.conf
+
+include modules/lw/lw_mod.conf
+;include modules/default/priv_mod.conf
+;include modules/default/dcc_mod.conf
+;include modules/bad_words/bad_words.conf
+;include modules/peak_mod/peak_mod.conf
+;include modules/seen/seen_mod.conf
+;include modules/news/news_mod.conf
+;include modules/imdb/imdb_mod.conf
+;include modules/quotes_ini/quote_mod.conf
+;include modules/quotes_sql/quote_mod.conf
+;include modules/httpd/httpd_mod.conf
+;include modules/fileserver/fileserver.conf
+;include modules/bash/bash_mod.conf
diff --git a/ircbot/irc.php b/ircbot/irc.php
new file mode 100644
index 0000000..432dca5
--- /dev/null
+++ b/ircbot/irc.php
@@ -0,0 +1,2501 @@
+ irc module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class irc {
+
+ // Config Vars
+ private $clientConfig = array();
+ private $configFilename = "";
+ // nick, realname, localhost, remotehost, ident, host, port
+ private $serverConfig = array();
+ private $nick = "";
+ private $tempNick = "";
+ // only used if our nick is taken initially
+ private $clientIP;
+ private $clientLongIP;
+ // Above address related determined on runtime..
+ private $startTime = 0; //when the bot was started
+
+ // Status Vars
+ private $status = STATUS_IDLE;
+ private $exception;
+ private $reportedStatus = STATUS_IDLE;
+
+ //Classes
+ private $timerClass = null;
+ private $socketClass = null;
+ private $dccClass = null;
+ private $parserClass = null;
+
+ //Socket Vars
+ private $sockInt; //old pre 2.1.2 method
+ private $conn; //new 2.1.2 method
+ private $connectStartTime = 0;
+ private $lagTime = 0;
+ private $timeConnected = 0;
+
+ //Queue Vars
+ private $textQueueTime = 0;
+ private $textQueue = array();
+ private $textQueueLength = 0;
+
+ /* This variable will be set when new text is sent to be sent to the irc server, its so we don't
+ have to call addQueue() more than once. */
+ private $textQueueAdded = false;
+ private $modeQueueAdded = false;
+
+ private $modeQueue = array();
+ private $modeQueueLength = 0;
+ private $modeTimerAdded = false;
+
+ //Stats Var
+ private $stats = array();
+
+ //Parsing Vars
+ private $lVars = array();
+ private $modeArray;
+ private $prefixArray;
+
+ //Channel and User Linked Lists
+ private $chanData = array();
+ private $maintainChannels = array();
+/* private $chanData = null; */
+
+ private $usageList = array();
+
+ //Timers
+ private $timeoutTimer = 0;
+ private $lastPing = 0;
+ private $lastPingTime = 0;
+ private $nickTimer = 0;
+ private $checkChansTimer = 0;
+
+ //Kill
+ private $setKill = false;
+
+ //My process id
+ private $pid;
+
+ //Process Queue
+ private $procQueue;
+
+ function __construct()
+ {
+
+ $this->startTime = time();
+
+ // Initialize the stats array
+ $this->stats = array( 'BYTESUP' => 0,
+ 'BYTESDOWN' => 0,
+ );
+
+ $this->pid = getmypid();
+
+ return;
+
+ }
+
+ public function init()
+ {
+ $this->socketClass->setTcpRange( $this->getClientConf('dccrangestart') );
+
+ /* Add other timers */
+ $this->timerClass->addTimer("check_nick_timer", $this, "checkNick", "", NICK_CHECK_TIMEOUT);
+ $this->timerClass->addTimer("check_channels_timer", $this, "checkChans", "", CHAN_CHECK_TIMEOUT);
+ $this->timerClass->addTimer("check_ping_timeout_timer", $this, "checkPingTimeout", "", PING_TIMEOUT+1);
+
+ /* Timer that makes sure we're connected every 1:15 minutes */
+ $this->reconnect();
+ //$this->timerClass->addTimer("check_connection", $this, "checkConnection", "", 75, true);
+ }
+
+ public function pid()
+ {
+ return $this->pid;
+ }
+
+ public function setConfig($config, $filename = "")
+ {
+ $this->clientConfig = $config;
+ $this->configFilename = $filename;
+ $this->nick = $config['nick'];
+ }
+
+ public function setProcQueue($class)
+ {
+ $this->procQueue = $class;
+ }
+
+ public function setDccClass($class)
+ {
+ $this->dccClass = $class;
+ $this->dccClass->setIrcClass($this);
+ }
+
+ public function setParserClass($class)
+ {
+ $this->parserClass = $class;
+ $this->parserClass->setIrcClass($this);
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ public function setClientConfigVar($var, $value)
+ {
+ $this->clientConfig[$this->myStrToLower($var)] = $value;
+ }
+
+ public function getNick()
+ {
+ return $this->nick;
+ }
+
+ public function getMaintainedChannels()
+ {
+ return $this->maintainChannels;
+ }
+
+ public function getServerConf($var)
+ {
+ if (isset($this->serverConfig[$this->myStrToUpper($var)]))
+ {
+ return $this->serverConfig[$this->myStrToUpper($var)];
+ }
+
+ return "";
+ }
+
+
+ public function getConfigFilename()
+ {
+ return $this->configFilename;
+ }
+
+ public function getClientConf($var = "")
+ {
+
+ if ($var != "")
+ {
+ if (isset($this->clientConfig[$var]))
+ {
+ return $this->clientConfig[$var];
+ }
+ }
+ else
+ {
+ return $this->clientConfig;
+ }
+
+ return "";
+
+ }
+
+
+ //debug only!
+ public function displayUsers()
+ {
+ $toReturn = "";
+
+ foreach($this->chanData AS $chanPtr)
+ {
+
+ $toReturn .= $chanPtr->name . "\n";
+
+ foreach($chanPtr->memberList AS $memPtr)
+ {
+ $toReturn .= $memPtr->realNick . " -- ";
+ $toReturn .= $memPtr->status . "\n";
+ }
+
+ }
+
+ return trim($toReturn);
+ }
+
+
+
+ private function addMember($channel, $nick, $ident, $status, $host = "")
+ {
+ $channel = $this->myStrToLower($channel);
+ $realNick = trim($nick);
+ $nick = trim($this->myStrToLower($nick));
+
+ $newMember = new memberLink;
+ if ($host != "")
+ {
+ $newMember->host = $host;
+ }
+ $newMember->nick = $nick;
+ $newMember->realNick = $realNick;
+ $newMember->ident = $ident;
+ $newMember->status = $status;
+
+ if (!isset($this->chanData[$channel]))
+ {
+ $chanPtr = new channelLink;
+ $chanPtr->count = 1;
+ $chanPtr->memberList = NULL;
+ $chanPtr->banComplete = 1;
+ $chanPtr->name = $channel;
+ $this->chanData[$channel] = $chanPtr;
+ }
+ else
+ {
+ $chanPtr = $this->chanData[$channel];
+
+ if (!isset($chanPtr->memberList[$nick]))
+ {
+ $chanPtr->count++;
+ }
+ }
+
+ $chanPtr->memberList[$nick] = $newMember;
+
+ return $chanPtr->count;
+
+ }
+
+ public function &getChannelData($channel = "")
+ {
+
+ if ($channel == "")
+ {
+ return $this->chanData;
+ }
+
+ $channel = $this->myStrToLower($channel);
+
+ if (isset($this->chanData[$channel]))
+ {
+ return $this->chanData[$channel];
+ }
+
+ return NULL;
+
+ }
+
+
+ public function setMemberData($nick, $ident, $host)
+ {
+ $nick = $this->myStrToLower($nick);
+
+ foreach($this->chanData AS $chanPtr)
+ {
+ if (isset($chanPtr->memberList[$nick]))
+ {
+ $chanPtr->memberList[$nick]->ident = $ident;
+ $chanPtr->memberList[$nick]->host = $host;
+ }
+ }
+
+ }
+
+
+ public function getUserData($user, $channel = "")
+ {
+ if ($user == "")
+ {
+ return NULL;
+ }
+
+ $channel = $this->myStrToLower($channel);
+ $user = $this->myStrToLower($user);
+
+ if ($channel == "")
+ {
+ foreach ($this->chanData AS $chanPtr)
+ {
+ if (isset($chanPtr->memberList[$user]))
+ {
+ return $chanPtr->memberList[$user];
+ }
+ }
+ return NULL;
+ }
+
+ if (isset($this->chanData[$channel]))
+ {
+ if (isset($this->chanData[$channel]->memberList[$user]))
+ {
+ return $this->chanData[$channel]->memberList[$user];
+ }
+ return NULL;
+ }
+ }
+
+
+
+
+
+
+ private function changeMember( $channel, $oldNick, $newNick, $ident,
+ $newStatus, $action, $newHost = "")
+ {
+
+ $channel = $this->myStrToLower($channel);
+ $ident = trim($ident);
+ $oldNick = trim($this->myStrToLower($oldNick));
+ $realNick = trim($newNick);
+ $newNick = trim($this->myStrToLower($newNick));
+
+ // See if we have a valid usermode
+
+ if ($newStatus != "")
+ {
+ if (strpos($this->getServerConf('PREFIX'), $newStatus) === false)
+ {
+ $newStatus = "";
+ $action = "";
+ }
+ }
+
+ //Find our channel, also change user name if no channel name given
+
+ if ($channel == "")
+ {
+ foreach($this->chanData AS $chanPtr)
+ {
+ if (isset($chanPtr->memberList[$oldNick]))
+ {
+ $memPtr = $chanPtr->memberList[$oldNick];
+
+ if ($newHost != "")
+ {
+ $memPtr->host = $newHost;
+ }
+ if ($ident != "")
+ {
+ $memPtr->ident = $ident;
+ }
+ $memPtr->nick = $newNick;
+ $memPtr->realNick = $realNick;
+
+ $chanPtr->memberList[$newNick] = $memPtr;
+ unset($chanPtr->memberList[$oldNick]);
+ }
+ }
+ return;
+ }
+
+ if (isset($this->chanData[$channel]))
+ {
+ $chanPtr = $this->chanData[$channel];
+
+ if (isset($chanPtr->memberList[$oldNick]))
+ {
+ $memPtr = $chanPtr->memberList[$oldNick];
+
+ if ($newHost != "")
+ {
+ $memPtr->host = $newHost;
+ }
+ if ($ident != "")
+ {
+ $memPtr->ident = $ident;
+ }
+
+ if ($newStatus != "")
+ {
+ if ($action == "+")
+ {
+ if (strpos($memPtr->status, $newStatus) === false)
+ {
+ $memPtr->status .= $newStatus;
+ }
+ }
+ else
+ {
+ $memPtr->status = str_replace($newStatus, "", $memPtr->status);
+ }
+ }
+
+ }
+
+ }
+
+
+ }
+
+ private function setChannelData($channel, $item, $val)
+ {
+ $channel = $this->myStrToLower($channel);
+ $item = $this->myStrToLower($item);
+
+ if (isset($this->chanData[$channel]))
+ {
+ $chanPtr = $this->chanData[$channel];
+
+ switch ($item)
+ {
+ case "topicby":
+ $chanPtr->topicBy = $val;
+ break;
+
+ case "topic":
+ $chanPtr->topic = $val;
+ break;
+
+ case "bancomplete":
+ $chanPtr->banComplete = $val;
+ break;
+
+ case "created":
+ $chanPtr->created = $val;
+ break;
+
+ case "modes":
+ unset($chanPtr->modes);
+ $chanPtr->modes = array();
+ $chanPtr->modes['MODE_STRING'] = substr($val, 1);
+ break;
+ }
+
+ }
+
+ }
+
+
+ private function clearBanList($channel)
+ {
+ $channel = $this->myStrToLower($channel);
+
+ if (isset($this->chanData[$channel]))
+ {
+ unset($this->chanData[$channel]->banList);
+ $this->chanData[$channel]->banList = array();
+ }
+ }
+
+ private function changeChannel($channel, $action, $newStatus, $extraStatus = "")
+ {
+
+ $channel = $this->myStrToLower($channel);
+ $newStatus = trim($newStatus); // i.e, l, b
+
+ if (!is_array($extraStatus))
+ {
+ $extraStatus = trim($extraStatus); // i.e, 50, *!*@*
+ }
+
+
+
+ //ex. CHANMODES=eIb,k,l,cimnpstMNORZ
+
+ if ($newStatus == "" || $action == "")
+ {
+ return;
+ }
+
+ if (!isset($this->modeArray[$newStatus]))
+ {
+ return;
+ }
+
+ $type = $this->modeArray[$newStatus];
+
+ if ($type != BY_NONE && $extraStatus == "")
+ {
+ return;
+ }
+
+ if (strpos($this->getServerConf('CHANMODES'), $newStatus) === false)
+ {
+ return;
+ }
+
+ //Find our channel
+
+ if (isset($this->chanData[$channel]))
+ {
+ $chanPtr = $this->chanData[$channel];
+
+ if (!is_array($chanPtr->modes))
+ {
+ unset($chanPtr->modes);
+ $chanPtr->modes = array();
+ }
+
+ if (!isset($chanPtr->modes['MODE_STRING']))
+ {
+ $chanPtr->modes['MODE_STRING'] = "";
+ }
+
+ if ($type == BY_MASK)
+ {
+
+ if ($newStatus == "b")
+ {
+ if ($action == "+")
+ {
+ if (is_array($extraStatus))
+ {
+ $ban = $extraStatus[0];
+ $time = $extraStatus[1];
+ }
+ else
+ {
+ $ban = $extraStatus;
+ $time = time();
+ }
+
+ $chanPtr->banList[] = array( 'HOST' => $ban,
+ 'TIME' => $time,
+ );
+
+
+ }
+ else
+ {
+ foreach ($chanPtr->banList AS $index => $data)
+ {
+ if ($data['HOST'] == $extraStatus)
+ {
+ unset($chanPtr->banList[$index]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ($action == "+")
+ {
+ if (strpos($chanPtr->modes['MODE_STRING'], $newStatus) === false)
+ {
+ $chanPtr->modes['MODE_STRING'] .= $newStatus;
+ if ($type != BY_NONE)
+ {
+ $chanPtr->modes[$newStatus] = $extraStatus;
+ }
+ }
+ }
+ else
+ {
+ $chanPtr->modes['MODE_STRING'] = str_replace($newStatus, "", $chanPtr->modes['MODE_STRING']);
+ if ($type != BY_NONE)
+ {
+ unset($chanPtr->modes[$newStatus]);
+ }
+ }
+ }
+
+ }
+
+
+ }
+
+ private function purgeChanList()
+ {
+ foreach ($this->chanData AS $cIndex => $chanPtr)
+ {
+ foreach ($chanPtr->memberList AS $mIndex => $memPtr)
+ {
+ unset($chanPtr->memberList[$mIndex]);
+ }
+
+ unset($this->chanData[$cIndex]);
+ }
+
+ unset($this->chanData);
+ $this->chanData = array();
+ }
+
+ private function removeMember($channel, $nick)
+ {
+
+ $channel = $this->myStrToLower($channel);
+ $nick = trim($this->myStrToLower($nick));
+
+ if ($channel == "")
+ {
+ foreach($this->chanData AS $chanPtr)
+ {
+ if (isset($chanPtr->memberList[$nick]))
+ {
+ unset($chanPtr->memberList[$nick]);
+ $chanPtr->count--;
+ }
+ }
+
+ }
+ else
+ {
+ if (isset($this->chanData[$channel]))
+ {
+ if (isset($this->chanData[$channel]->memberList[$nick]))
+ {
+ unset($this->chanData[$channel]->memberList[$nick]);
+ $this->chanData[$channel]->count--;
+ }
+ }
+ }
+
+ }
+
+ private function removeChannel($channel)
+ {
+ $channel = $this->myStrToLower($channel);
+
+ if (isset($this->chanData[$channel]))
+ {
+ $chanPtr = $this->chanData[$channel];
+
+ foreach ($chanPtr->memberList AS $mIndex => $memPtr)
+ {
+ $this->removeMember($channel, $mIndex);
+ }
+
+ unset($chanPtr->banList);
+ unset($chanPtr->modes);
+
+ unset($this->chanData[$channel]);
+ }
+ }
+
+ public function isChanMode($channel, $mode, $extra = "")
+ {
+ $channel = $this->myStrToLower($channel);
+ $extra = $this->myStrToLower($extra);
+
+ if (!isset($this->chanData[$channel]))
+ {
+ return;
+ }
+
+ $chanPtr = $this->chanData[$channel];
+
+ if (!isset($this->modeArray[$mode]))
+ {
+ return false;
+ }
+
+ $type = $this->modeArray[$mode];
+
+ if ($type == BY_MASK)
+ {
+ if ($mode == "b")
+ {
+
+ foreach ($chanPtr->banList AS $index => $ban)
+ {
+
+ if ($this->hostMasksMatch($ban['HOST'], $extra))
+ {
+ return true;
+ }
+
+ }
+ }
+ }
+ else
+ {
+ if (strpos($chanPtr->modes['MODE_STRING'], $mode) !== false)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public function hasModeSet($chan, $nick, $modes)
+ {
+ $channel = $this->myStrToLower($chan);
+ $nick = $this->myStrToLower($nick);
+
+ if (isset($this->chanData[$channel]))
+ {
+ if (isset($this->chanData[$channel]->memberList[$nick]))
+ {
+ $memPtr = $this->chanData[$channel]->memberList[$nick];
+
+ while ($modes != "")
+ {
+ $mode = substr($modes, 0, 1);
+ $modes = substr($modes, 1);
+
+ if (strpos($memPtr->status, $mode) !== false)
+ {
+ return true;
+ }
+ }
+
+ }
+ }
+
+ return false;
+
+ }
+
+ public function isMode($nick, $channel, $mode)
+ {
+ $channel = $this->myStrToLower($channel);
+ $nick = $this->myStrToLower($nick);
+
+ if (isset($this->chanData[$channel]))
+ {
+ if (isset($this->chanData[$channel]->memberList[$nick]))
+ {
+ $memPtr = $this->chanData[$channel]->memberList[$nick];
+
+ if ($mode == "online")
+ {
+ return true;
+ }
+ else
+ {
+ if (strpos($memPtr->status, $mode) !== false)
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private function getHostMask($mask)
+ {
+ $offsetA = strpos($mask, "!");
+ $offsetB = strpos($mask, "@");
+
+ $myMask = array();
+
+ $myMask['nick'] = $this->myStrToLower(substr($mask, 0, $offsetA));
+ $myMask['ident'] = $this->myStrToLower(substr($mask, $offsetA + 1, $offsetB - $offsetA - 1));
+ $myMask['host'] = $this->myStrToLower(substr($mask, $offsetB + 1));
+
+ return $myMask;
+ }
+
+ public function hostMasksMatch($mask1, $mask2)
+ {
+
+ $maskA = $this->getHostMask($mask1);
+ $maskB = $this->getHostMask($mask2);
+
+ $ident = false;
+ $nick = false;
+ $host = false;
+
+ if ($maskA['ident'] == $maskB['ident']
+ || $maskA['ident'] == "*" || $maskB['ident'] == "*")
+ {
+ $ident = true;
+ }
+
+ if ($maskA['nick'] == $maskB['nick']
+ || $maskA['nick'] == "*" || $maskB['nick'] == "*")
+ {
+ $nick = true;
+ }
+
+ if ($maskA['host'] == $maskB['host']
+ || $maskA['host'] == "*" || $maskB['host'] == "*")
+ {
+ $host = true;
+ }
+
+ if ($host && $nick && $ident)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+
+ public function setToIdleStatus()
+ {
+ $this->status = STATUS_IDLE;
+ }
+
+
+ private function getStatus()
+ {
+ $this->reportedStatus = $this->status;
+ return $this->status;
+ }
+
+ private function getStatusChange()
+ {
+ return ($this->reportedStatus != $this->status);
+ }
+
+ private function getException()
+ {
+ return $this->exception;
+ }
+
+ private function updateContext()
+ {
+
+ if ($this->getStatusChange())
+ {
+ $status = $this->getStatus();
+ $statusStr = $this->getStatusString($status);
+ $this->log("STATUS: " . $statusStr);
+ $this->dccClass->dccInform("Status: " . $statusStr);
+
+ switch($status)
+ {
+ case STATUS_ERROR:
+ $exception = $this->getException();
+ $this->log("Error: " . $exception->getMessage());
+ $this->dccClass->dccInform("Error: " . $exception->getMessage());
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ }
+
+ public function reconnect()
+ {
+ $this->updateContext();
+
+ try {
+
+ $this->connectStartTime = time();
+
+ $conn = new connection($this->getClientConf('server'), $this->getClientConf('port'), CONNECT_TIMEOUT);
+
+ $this->conn = $conn;
+
+ $conn->setSocketClass($this->socketClass);
+ $conn->setIrcClass($this);
+ $conn->setCallbackClass($this);
+ $conn->setTimerClass($this->timerClass);
+ $conn->init();
+
+ if ($conn->getError())
+ {
+ throw new ConnectException($conn->getErrorMsg());
+ }
+
+ //Bind socket...
+ if ($this->getClientConf('bind') != "")
+ {
+ $conn->bind($this->getClientConf('bind'));
+ }
+
+ $this->sockInt = $conn->getSockInt();
+ $conn->connect();
+
+
+ }
+ catch (ConnectException $e)
+ {
+ $this->beginReconnectTimer();
+ $this->status = STATUS_ERROR;
+ $this->exception = $e;
+ return;
+ }
+
+ $this->status = STATUS_CONNECTING;
+
+ $this->updateContext();
+
+ return;
+ }
+
+ public function onConnect($conn)
+ {
+ $this->status = STATUS_CONNECTED;
+
+ $this->updateContext();
+
+ $this->timeoutTimer = time();
+ $ip = "";
+ if ($this->getClientConf('natip') != "")
+ {
+ $ip = $this->getClientConf('natip');
+ }
+ $this->setClientIP($ip);
+
+ $this->register();
+ //TODO: Add registration timeout timer (with $conn to check identity)
+
+ return false;
+ }
+
+ public function onRead($conn)
+ {
+ $this->updateContext();
+
+ return $this->readInput();
+ }
+
+ public function onWrite($conn)
+ {
+ //Do nothing.. this function has no purpose for the ircClass
+ return false;
+ }
+
+ public function onAccept($listenConn, $newConn)
+ {
+ //Do nothing.. this function has no purpose for the ircClass
+ return false;
+ }
+
+ public function onDead($conn)
+ {
+ if ($conn->getError())
+ {
+ $this->status = STATUS_ERROR;
+ $this->exception = new ConnectException($conn->getErrorMsg());
+ }
+
+ $this->disconnect();
+ return false;
+ }
+
+ public function onConnectTimeout($conn)
+ {
+ $this->status = STATUS_ERROR;
+ $this->exception = new ConnectException("Connection attempt timed out");
+ $this->disconnect();
+ }
+
+ private function beginReconnectTimer()
+ {
+ $this->timerClass->addTimer(self::randomHash(), $this, "reconnectTimer", $this->conn, ERROR_TIMEOUT);
+ }
+
+ public function reconnectTimer($conn)
+ {
+ //If curr connection is equal to the stored connection, then no forced
+ //connect was attempted, so attempt another.
+
+ if ($this->conn === $conn)
+ {
+ $this->reconnect();
+ }
+
+ return false;
+ }
+
+
+ public function disconnect()
+ {
+ $this->conn->disconnect();
+
+ $this->updateContext();
+
+ $this->status = STATUS_ERROR;
+ $this->exception = new ConnectException("Disconnected from server");
+
+ $this->updateContext();
+
+ //reset all vars
+ $this->purgeChanList();
+ $this->timeoutTimer = 0;
+ $this->lastPing = 0;
+ $this->lastPingTime = 0;
+ $this->nickTimer = 0;
+ $this->connectStartTime = 0;
+ $this->lagTime = 0;
+ $this->checkChansTimer = 0;
+ $this->purgeTextQueue();
+ $this->nick = $this->getClientConf('nick');
+ $this->tempNick = "";
+ unset($this->modeArray);
+ unset($this->prefixArray);
+ unset($this->serverConfig);
+ $this->modeArray = array();
+ $this->prefixArray = array();
+ $this->serverConfig = array();
+
+ $this->beginReconnectTimer();
+
+ return;
+ }
+
+ private function register()
+ {
+ $login_string = "NICK ".$this->getClientConf('nick')."\r\n"."USER ".$this->getClientConf('ident')." "."localhost"." ".$this->getClientConf('server')." :".$this->getClientConf('realname');
+ if ($this->getClientConf('serverpassword') != "")
+ $login_string = "PASS ".$this->getClientConf('serverpassword')."\r\n".$login_string;
+
+ $validate = $this->clientFormat($login_string);
+
+ $this->timeConnected = time();
+ $this->pushAfter($validate);
+ $this->status = STATUS_CONNECTED_SENTREGDATA;
+
+ $this->timerClass->addTimer($this->randomHash(), $this, "regTimeout", $this->sockInt, REGISTRATION_TIMEOUT);
+ }
+
+
+ public function regTimeout($sockInt)
+ {
+ if ($sockInt != $this->sockInt)
+ {
+ return false;
+ }
+
+ if ($this->status != STATUS_CONNECTED_SENTREGDATA)
+ {
+ return false;
+ }
+
+ $this->disconnect();
+
+ $this->status = STATUS_ERROR;
+ $this->exception = new ConnectionTimeout("Session Authentication Timed out");
+
+ return false;
+ }
+
+ //The following function kills this irc object, but ONLY if there is no send queue.
+ //A good way to use it is with a timer, say, ever second or so.
+ public function shutDown()
+ {
+ if (!$this->conn->getError())
+ {
+ return;
+ }
+
+ /*
+ if ($this->socketClass->hasWriteQueue($this->sockInt))
+ {
+ return true;
+ }
+
+ $this->disconnect();
+ */
+ $this->parserClass->destroyModules();
+ $this->dccClass->closeAll();
+ $this->procQueue->removeOwner($this);
+ $date = date("h:i:s a, m-d-y");
+ $this->log("The bot successfully shutdown, $date");
+
+ //Okay.. now the bot is PSEUDO dead. It still exists, however it has no open sockets, it will not
+ //attempt to reconnect to the server, and all dcc sessions, modules, timers, and processes related to it
+ //have been destroyed.
+
+ return false;
+
+ }
+
+ /* Some assorted timers */
+
+ public function checkNick()
+ {
+ if ($this->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
+ {
+ return true;
+ }
+
+ if ($this->nick != $this->getClientConf('nick'))
+ {
+ $this->changeNick($this->getClientConf('nick'));
+ }
+
+ return true;
+ }
+
+ public function checkPingTimeout()
+ {
+ if ($this->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
+ {
+ return true;
+ }
+
+ try {
+ if ($this->lastPing == 1)
+ {
+ $this->lastPing = 0;
+ throw new ConnectionTimeout("The connection with the server timed out.");
+ }
+ else
+ {
+ if (time() > $this->timeoutTimer + PING_TIMEOUT + $this->lagTime)
+ {
+ $this->pushBefore($this->clientFormat("PING :Lagtime"));
+ $this->lastPingTime = time();
+ $this->lastPing = 1;
+ }
+ }
+ }
+ catch (ConnectionTimeout $e)
+ {
+ $this->disconnect();
+ $this->status = STATUS_ERROR;
+ $this->exception = $e;
+ }
+
+ return true;
+ }
+
+ public function getStatusRaw()
+ {
+ return $this->status;
+ }
+
+
+ public function getLine()
+ {
+ return $this->lVars;
+ }
+
+ private function readInput()
+ {
+ if ($this->status != STATUS_CONNECTED_REGISTERED && $this->status != STATUS_CONNECTED_SENTREGDATA)
+ {
+ return false;
+ }
+
+ if ($this->socketClass->isDead($this->sockInt) && !$this->socketClass->hasLine($this->sockInt))
+ {
+ $this->disconnect();
+ $this->status = STATUS_ERROR;
+ $this->exception = new ReadException("Failed while reading from socket");
+ return false;
+ }
+
+ if ($this->socketClass->hasLine($this->sockInt))
+ {
+ $this->timeoutTimer = time();
+
+ if ($this->lastPing == 1)
+ {
+ $this->lagTime = time() - $this->lastPingTime;
+ }
+ $this->lastPing = 0;
+
+ $line = $this->socketClass->getQueueLine($this->sockInt);
+
+ $this->stats['BYTESDOWN'] += strlen($line);
+
+ $this->log($line);
+
+ if (substr($line, 0, 1) != ":")
+ {
+ $line = ":Server " . $line;
+ }
+
+ $line = substr($line, 1);
+
+ $parts = explode(chr(32), $line);
+
+ $params = substr($line, strlen($parts[0]) + strlen($parts[1]) + strlen($parts[2]) + 3);
+ if (strpos($params, " :"))
+ {
+ $params = substr($params, 0, strpos($params, " :"));
+ }
+
+ $offset1 = strpos($parts[0], '!');
+ $offset2 = $offset1 + 1;
+ $offset3 = strpos($parts[0], '@') + 1;
+ $offset4 = $offset3 - $offset2 - 1;
+ $offset5 = strpos($line, " :") + 2;
+
+ unset($this->lVars);
+
+ $this->lVars = array( 'from' => $parts[0],
+ 'fromNick' => substr($parts[0], 0, $offset1),
+ 'fromIdent' => substr($parts[0], $offset2, $offset4),
+ 'fromHost' => substr($parts[0], $offset3),
+ 'cmd' => $parts[1],
+ 'to' => $parts[2],
+ 'text' => substr($line, $offset5),
+ 'params' => trim($params),
+ 'raw' => ":" . $line,
+ );
+
+ if ($offset5 === false)
+ {
+ $line['text'] = "";
+ }
+
+ if (intval($this->lVars['cmd']) > 0)
+ {
+ $this->parseServerMsgs($this->lVars['cmd']);
+ }
+ else
+ {
+ $this->parseMsgs();
+ }
+
+ $this->parserClass->parseLine($this->lVars);
+ }
+
+ if ($this->socketClass->hasQueue($this->sockInt))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ private function parseServerMsgs($cmd)
+ {
+ switch ($cmd)
+ {
+ case 004:
+ $this->status = STATUS_CONNECTED_REGISTERED;
+ if ($this->tempNick != "")
+ {
+ $this->nick = $this->tempNick;
+ }
+ break;
+
+ case 005:
+ $this->parseServerConfig();
+ if (!isset($this->modeArray) || !is_array($this->modeArray) || count($this->modeArray) <= 0)
+ {
+ if ($this->getServerConf("CHANMODES") != "")
+ {
+ $this->createModeArray();
+ $this->checkChans();
+ }
+ }
+ break;
+
+ case 311:
+ $params = explode(chr(32), $this->lVars['params']);
+ $this->setMemberData($params[0], $params[1], $params[2]);
+
+ case 324:
+ $params = explode(chr(32), $this->lVars['params']);
+ $channel = $params[0];
+ $query = substr($this->lVars['params'], strlen($channel) + 1);
+ $this->setChannelData($channel, "modes", $query);
+ break;
+
+ case 329:
+ $params = explode(chr(32), $this->lVars['params']);
+ $channel = $params[0];
+ $query = substr($this->lVars['params'], strlen($channel) + 1);
+ $this->setChannelData($channel, "created", $query);
+ break;
+
+ case 332:
+ $this->setChannelData(trim($this->lVars['params']), "topic", $this->lVars['text']);
+ break;
+
+ case 333:
+ $params = explode(chr(32), $this->lVars['params']);
+ $channel = $params[0];
+ $query = substr($this->lVars['params'], strlen($channel) + 1);
+ $this->setChannelData($channel, "topicby", $query);
+ break;
+
+ case 352:
+ $params = explode(chr(32), $this->lVars['params']);
+ $this->changeMember($params[0], $params[4], $params[4], $params[1], "", "", $params[2]);
+ break;
+
+ case 353:
+ $channel = substr($this->lVars['params'], 2);
+ $this->updateOpList($channel);
+ break;
+
+ case 367:
+ $params = explode(chr(32), $this->lVars['params']);
+ $data = $this->getChannelData($params[0]);
+ if ($data != NULL)
+ {
+ if ($data->banComplete == 1)
+ {
+ $this->clearBanList($params[0]);
+ $data->banComplete = 0;
+ }
+
+ $this->changeChannel($params[0], "+", "b", array($params[1], $params[3]));
+ }
+ break;
+
+ case 368:
+ $params = explode(chr(32), $this->lVars['params']);
+ $channel = $params[0];
+ $this->setChannelData($channel, "bancomplete", 1);
+ break;
+
+ case 401:
+ $this->removeQueues($this->lVars['params']);
+ break;
+
+ case 433:
+ if ($this->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
+ {
+ if ($this->nick == $this->getClientConf('nick'))
+ {
+ $this->changeNick($this->nick . rand() % 1000);
+ }
+ $this->nickTimer = time();
+ }
+ break;
+ }
+
+ }
+
+ public function isOnline($nick, $chan)
+ {
+ return $this->isMode($nick, $chan, "online");
+ }
+
+
+ private function updateOpList($channel)
+ {
+ $channel = $this->myStrToLower($channel);
+ $users = explode(chr(32), $this->lVars['text']);
+
+ if (!isset($this->prefixArray) || count($this->prefixArray) <= 0)
+ {
+ $this->createPrefixArray();
+ }
+
+ foreach ($users AS $user)
+ {
+ if (trim($user) == "")
+ {
+ continue;
+ }
+
+ $userModes = "";
+ $userNick = "";
+
+ for ($currIndex = 0; $currIndex < strlen($user); $currIndex++)
+ {
+ $currChar = substr($user, $currIndex, 1);
+
+ if (!isset($this->prefixArray[$currChar]))
+ {
+ $userNick = substr($user, $currIndex);
+ break;
+ }
+
+ $userModes .= $currChar;
+ }
+
+ if ($userNick != $this->nick)
+ {
+ $this->addmember($channel, $userNick, "", $this->convertUserModes($userModes));
+ }
+
+ }
+
+ }
+
+
+ private function convertUserModes($modes)
+ {
+ $newModes = "";
+
+ for ($index = 0; $index < strlen($modes); $index++)
+ {
+ $newModes .= $this->prefixArray[$modes[$index]];
+ }
+
+ return $newModes;
+ }
+
+
+ private function createPrefixArray()
+ {
+ $modeSymbols = substr($this->getServerConf('PREFIX'), strpos($this->getServerConf('PREFIX'), ")") + 1);
+
+ $leftParan = strpos($this->getServerConf('PREFIX'), "(");
+ $rightParan = strpos($this->getServerConf('PREFIX'), ")");
+ $modeLetters = substr($this->getServerConf('PREFIX'), $leftParan + 1, $rightParan - $leftParan - 1);
+
+ for ($index = 0; $index < strlen($modeLetters); $index++)
+ {
+ $this->prefixArray[$modeSymbols[$index]] = $modeLetters[$index];
+ }
+
+ }
+
+
+ public function doMode()
+ {
+ $this->modeQueueAdded = false;
+
+ $currAct = "";
+ $currChan = "";
+
+ $modeLineModes = "";
+ $modeLineParams = "";
+
+ $maxModesPerLine = ($this->getServerConf('MODES') == "" ? 1 : $this->getServerConf('MODES'));
+ $currLineModes = 0;
+
+ foreach($this->modeQueue AS $modeChange)
+ {
+ if ($modeLineModes != "" && ($currChan != $modeChange['CHANNEL'] || $currLineModes >= $maxModesPerLine))
+ {
+ $this->pushAfter($this->clientFormat("MODE " . $currChan . " " . $modeLineModes . " " . trim($modeLineParams)));
+ $modeLineModes = "";
+ $currAct = "";
+ $currChan = "";
+ $modeLineParams = "";
+ $currLineModes = 0;
+ }
+
+ if ($currAct != $modeChange['ACT'])
+ {
+ $modeLineModes .= $modeChange['ACT'];
+ }
+
+ $modeLineModes .= $modeChange['MODE'];
+
+ if ($modeChange['USER'] != "")
+ {
+ $modeLineParams .= $modeChange['USER'] . " ";
+ }
+
+ $currLineModes++;
+
+ $currAct = $modeChange['ACT'];
+ $currChan = $modeChange['CHANNEL'];
+
+ }
+
+ if ($modeLineModes != "")
+ {
+ $this->pushAfter($this->clientFormat("MODE " . $currChan . " " . $modeLineModes . " " . trim($modeLineParams)));
+ }
+
+ unset($this->modeQueue);
+ $this->modeQueue = array();
+ $this->modeQueueLength = 0;
+
+ return false;
+
+ }
+
+ public function changeMode($chan, $act, $mode, $user)
+ {
+ $user = trim($user);
+ $chan = trim($chan);
+ $act = trim($act);
+ $mode = trim($mode);
+
+ if ($chan == "" || $mode == "")
+ {
+ return false;
+ }
+
+ if (!($act == "+" || $act == "-"))
+ {
+ return false;
+ }
+
+ if (strlen($mode) > 1)
+ {
+ return false;
+ }
+
+ if (!isset($this->modeArray[$mode]))
+ {
+ if ($user == "")
+ {
+ return false;
+ }
+ }
+
+ if ($this->modeQueueAdded != true)
+ {
+ $this->timerClass->addTimer("mode_timer", $this, "doMode", "", 0, true);
+ $this->modeQueueAdded = true;
+ }
+
+ $this->modeQueue[] = array('USER' => $user, 'CHANNEL' => $chan, 'ACT' => $act, 'MODE' => $mode);
+ $this->modeQueueLength++;
+
+ return true;
+
+ }
+
+ public function parseModes($modeString)
+ {
+ $modeString .= " ";
+
+ $offset = strpos($modeString, chr(32));
+ $modes = substr($modeString, 0, $offset);
+ $users = substr($modeString, $offset + 1);
+ $userArray = explode(chr(32), $users);
+
+ if (count($this->modeArray) <= 0)
+ {
+ $this->createModeArray();
+ }
+
+ $action = "";
+ $returnModes = array();
+
+ while (trim($modes) != "")
+ {
+ $thisMode = substr($modes, 0, 1);
+
+ $modes = substr($modes, 1);
+
+ if ($thisMode == "-" || $thisMode == "+")
+ {
+ $action = $thisMode;
+ continue;
+ }
+
+ if (strpos($this->getServerConf('CHANMODES'), $thisMode) !== false)
+ {
+ if (!isset($this->modeArray[$thisMode]))
+ {
+ return false;
+ }
+
+ $type = $this->modeArray[$thisMode];
+ $extra = "";
+ if ($type != BY_NONE)
+ {
+ $extra = array_shift($userArray);
+ }
+
+ $type = CHANNEL_MODE;
+
+ }
+ else
+ {
+ $extra = array_shift($userArray);
+ $type = USER_MODE;
+ }
+
+ $returnModes[] = array( 'ACTION' => $action,
+ 'MODE' => $thisMode,
+ 'EXTRA' => $extra,
+ 'TYPE' => $type,
+ );
+
+ }
+
+ return $returnModes;
+ }
+
+ public static function intToSizeString($size)
+ {
+
+ $i = 20;
+ while ($size > pow(2, $i))
+ {
+ $i += 10;
+ }
+
+ switch ($i)
+ {
+ case 20: //kb
+ $num = $size / 1000;
+ $type = "KB";
+ break;
+ case 30: //mb
+ $num = $size / 1000000;
+ $type = "MB";
+ break;
+ case 40: //gb
+ $num = $size / 1000000000;
+ $type = "GB";
+ break;
+ case 50: //tb
+ $num = $size / 1000000000000;
+ $type = "TB";
+ break;
+ default: //pb
+ $num = $size / 1000000000000000;
+ $type = "PB";
+ break;
+ }
+
+ $stringSize = round($num, 2) . $type;
+
+ return $stringSize;
+
+ }
+
+
+ public function checkIgnore($mask)
+ {
+ $ignore = $this->getClientConf('ignore');
+
+ if ($ignore == "")
+ {
+ return false;
+ }
+
+ if (!is_array($ignore))
+ {
+ $ignore = array($ignore);
+ }
+
+ foreach($ignore AS $ig)
+ {
+ $case = $this->hostMasksMatch($mask, $ig);
+
+ if ($case)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ private function parseMsgs()
+ {
+
+ switch($this->lVars['cmd'])
+ {
+ case "JOIN":
+ $chan = $this->lVars['to'];
+ if (substr($this->lVars['to'], 0, 1) == ":")
+ {
+ $chan = substr($this->lVars['to'], 1);
+ }
+ $this->addMember($chan, $this->lVars['fromNick'], $this->lVars['fromIdent'], "", $this->lVars['fromHost']);
+ if ($this->lVars['fromNick'] == $this->getNick())
+ {
+ $this->sendRaw("MODE " . $chan);
+
+ if (isset($this->clientConfig['populatebans']))
+ {
+ $this->sendRaw("MODE " . $chan . " +b");
+ }
+
+ if (isset($this->clientConfig['populatewho']))
+ {
+ $this->sendRaw("WHO " . $chan);
+ }
+ }
+ break;
+
+ case "PART":
+ if ($this->lVars['fromNick'] == $this->nick)
+ {
+ $this->removeChannel($this->lVars['to']);
+ }
+ else
+ {
+ $this->removeMember($this->lVars['to'], $this->lVars['fromNick']);
+ }
+ break;
+
+ case "QUIT":
+ if ($this->lVars['fromNick'] == $this->nick)
+ {
+ $this->purgeChanList();
+ }
+ else
+ {
+ $this->removeMember("", $this->lVars['fromNick']);
+ }
+ break;
+
+ case "NICK":
+ if ($this->lVars['fromNick'] == $this->nick)
+ {
+ $this->nick = $this->lVars['text'];
+ }
+ $this->changeMember("", $this->lVars['fromNick'], $this->lVars['text'], "", "", "");
+ break;
+
+ case "KICK":
+ if ($this->myStrToLower($this->lVars['params']) == $this->myStrToLower($this->nick))
+ {
+ $this->removeChannel($this->lVars['to']);
+ $this->joinChannel($this->lVars['to']);
+ }
+ else
+ {
+ $this->removeMember($this->lVars['to'], $this->lVars['params']);
+ }
+ break;
+
+ case "MODE":
+ $channel = $this->myStrToLower($this->lVars['to']);
+ if ($channel == $this->myStrToLower($this->nick))
+ break;
+ $modes = $this->parseModes($this->lVars['params']);
+ foreach($modes AS $mode)
+ {
+ if ($mode['TYPE'] == CHANNEL_MODE)
+ {
+ $this->changeChannel($channel, $mode['ACTION'], $mode['MODE'], $mode['EXTRA']);
+ }
+ else
+ {
+ $this->changeMember($channel, $mode['EXTRA'], $mode['EXTRA'], "", $mode['MODE'], $mode['ACTION']);
+ }
+ unset($mode);
+ }
+ unset($modes);
+ break;
+ case "NOTICE":
+ if ($this->checkIgnore($this->lVars['from']))
+ {
+ return;
+ }
+ if ($this->myStrToLower($this->lVars['fromNick']) == "nickserv")
+ {
+ if (strpos($this->myStrToLower($this->lVars['text']), "identify") !== false)
+ {
+ if ($this->getClientConf('password') != "")
+ {
+ $this->pushBefore($this->clientFormat("PRIVMSG HostServ :ON"));
+ $this->pushBefore($this->clientFormat("PRIVMSG NickServ :IDENTIFY " . $this->getClientConf('password')));
+ $this->pushBefore($this->clientFormat("MODE " . $this->getClientConf('nick') . " +B"));
+ }
+ }
+ }
+ break;
+ case "PRIVMSG":
+ if ($this->checkIgnore($this->lVars['from']))
+ {
+ return;
+ }
+ if (strpos($this->lVars['text'], chr(1)) !== false)
+ {
+ $this->parseCtcp();
+ }
+ break;
+ case "TOPIC":
+ $this->setChannelData($this->lVars['to'], "topic", $this->lVars['text']);
+ break;
+
+ case "PING":
+ if ($this->lVars['from'] == "Server")
+ {
+ $this->pushBefore($this->clientFormat("PONG :" . $this->lVars['text']));
+ }
+
+ default:
+ break;
+
+
+ }
+
+
+
+
+ }
+
+
+
+ private function parseCtcp()
+ {
+ $cmd = str_replace(chr(1), "", $this->lVars['text']) . " ";
+ $query = trim(substr($cmd, strpos($cmd, chr(32)) + 1));
+ $cmd = substr($this->myStrToLower($cmd), 0, strpos($cmd, chr(32)));
+
+ $msg = "";
+
+ switch($cmd)
+ {
+ case "version":
+ // PLEASE DO NOT CHANGE THE FOLLOWING LINE OF CODE. It is the only way for people to know that this project
+ // exists. If you would like to change it, please leave the project name/version or url in there somewhere,
+ // so that others may find this project as you have. :)
+ $msg = "PHP-iRC v" . VERSION . " [".VERSION_DATE."] by Manick (visit http://www.phpbots.org/ to download)";
+ $this->notice($this->lVars['fromNick'], chr(1) . $msg . chr(1));
+ $msg = "";
+ $this->showModules($this->lVars['fromNick']);
+ break;
+
+ case "time":
+ $msg = "My current time is " . date("l, F jS, Y @ g:i a O", time()) . ".";
+ break;
+
+ case "uptime":
+ $msg = "My uptime is " . $this->timeFormat($this->getRunTime(), "%d days, %h hours, %m minutes, and %s seconds.");
+ break;
+
+ case "ping":
+ $msg = "PING " . $query;
+
+ }
+
+ if ($msg != "")
+ {
+ $this->notice($this->lVars['fromNick'], chr(1) . $msg . chr(1));
+ }
+
+ }
+
+ //Split huge lines up by spaces 255 by default
+ public static function multiLine($text, $separator = " ")
+ {
+ $returnArray = array();
+ $text = trim($text);
+ $strlen = strlen($text);
+ $sepSize = strlen($separator);
+
+ while ($strlen > 0)
+ {
+ if (256 > $strlen)
+ {
+ $returnArray[] = $text;
+ break;
+ }
+
+ for ($i = 255; $i > 0; $i--)
+ {
+ if (substr($text, $i, $sepSize) == $separator)
+ {
+ break;
+ }
+ }
+
+ if ($i <= 0)
+ {
+ $returnArray[] = substr($text, 0, 255);
+ $text = substr($text, 254);
+ $strlen -= 255;
+ }
+ else
+ {
+ $returnArray[] = substr($text, 0, $i);
+ $text = substr($text, $i - 1);
+ $strlen -= $i;
+ }
+ }
+
+ return $returnArray;
+ }
+
+
+ private function showModules($nick)
+ {
+ $cmdList = $this->parserClass->getCmdList();
+
+ if (isset($cmdList['file']))
+ {
+ $mod = "";
+
+ foreach($cmdList['file'] AS $module)
+ {
+ $class = $module['class'];
+
+ if (isset($class->dontShow) && $class->dontShow == true)
+ {
+ continue;
+ }
+ $mod .= "[" . $class->title . " " . $class->version . "] ";
+ }
+
+ if ($mod != "")
+ {
+ $modArray = $this->multiLine("Running Modules: " . $mod);
+
+ foreach ($modArray AS $myMod)
+ {
+ $this->notice($nick, chr(1) . $myMod . chr(1));
+ }
+ }
+ }
+ unset($cmdList);
+ }
+
+
+ public function getRunTime()
+ {
+ return (time() - $this->startTime);
+ }
+
+
+ public static function timeFormat($time, $format)
+ {
+
+ $days = 0;
+ $seconds = 0;
+ $minutes = 0;
+ $hours = 0;
+
+ if (strpos($format, "%d") !== FALSE)
+ {
+ $days = (int) ($time / (3600 * 24));
+ $time -= ($days * (3600 * 24));
+ }
+
+ if (strpos($format, "%h") !== FALSE)
+ {
+ $hours = (int) ($time / (3600));
+ $time -= ($hours * (3600));
+ }
+
+ if (strpos($format, "%m") !== FALSE)
+ {
+ $minutes = (int) ( $time / (60));
+ $time -= ($minutes * (60));
+ }
+
+ $seconds = $time;
+
+ $format = str_replace("%d", $days, $format);
+ $format = str_replace("%s", $seconds, $format);
+ $format = str_replace("%m", $minutes, $format);
+ $format = str_replace("%h", $hours, $format);
+
+ return $format;
+
+ }
+
+
+ private function createModeArray()
+ {
+ $modeArray = explode(",", $this->getServerConf('CHANMODES'));
+
+ for ($i = 0; $i < count($modeArray); $i++)
+ {
+ for ($j = 0; $j < strlen($modeArray[$i]); $j++)
+ {
+ $this->modeArray[$modeArray[$i][$j]] = $i;
+ }
+
+ }
+ }
+
+ public function checkChans()
+ {
+ if ($this->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
+ {
+ return true;
+ }
+
+ foreach ($this->maintainChannels AS $index => $channel)
+ {
+ if ($this->isOnline($this->nick, $channel['CHANNEL']) === false)
+ {
+ if ($channel['KEY'] != "")
+ {
+ $this->joinChannel($channel['CHANNEL'] . " " . $channel['KEY']);
+ }
+ else
+ {
+ $this->joinChannel($channel['CHANNEL']);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public function getStatusString($status)
+ {
+ $msg = "";
+
+ switch ($status)
+ {
+ case STATUS_IDLE:
+ $msg = "Idle";
+ break;
+ case STATUS_ERROR:
+ $msg = "Error";
+ break;
+ case STATUS_CONNECTING:
+ $msg = "Connecting to server...";
+ break;
+ case STATUS_CONNECTED:
+ $msg = "Connected to server: " . $this->getClientConf('server') . " " . $this->getClientConf('port');
+ break;
+ case STATUS_CONNECTED_SENTREGDATA:
+ $msg = "Sent registration data, awaiting reply...";
+ break;
+ case STATUS_CONNECTED_REGISTERED:
+ $msg = "Authenticated";
+ break;
+ default:
+ $msg = "Unknown";
+ }
+
+ return $msg;
+ }
+
+
+ public function purgeMaintainList()
+ {
+ unset($this->maintainChannels);
+ $this->maintainChannels = array();
+ }
+
+
+ public function removeMaintain($channel)
+ {
+ $channel = $this->myStrToLower($channel);
+
+ foreach ($this->maintainChannels AS $index => $chan)
+ {
+ if ($chan['CHANNEL'] == $channel)
+ {
+ unset($this->maintainChannels[$index]);
+ break;
+ }
+ }
+ }
+
+
+ public function maintainChannel($channel, $key = "")
+ {
+ $channel = $this->myStrToLower($channel);
+ $this->maintainChannels[] = array('CHANNEL' => $channel, 'KEY' => $key);
+ }
+
+
+ public function joinChannel($chan)
+ {
+ $this->pushBefore($this->clientFormat("JOIN " . $chan));
+ }
+
+ public function changeNick($nick)
+ {
+ $this->pushBefore($this->clientFormat("NICK " . $nick));
+ $this->tempNick = $nick;
+ }
+
+
+ private function parseServerConfig()
+ {
+ $args = explode(chr(32), $this->lVars['params']);
+
+ foreach ($args AS $arg)
+ {
+
+ if (strpos($arg, "=") === false)
+ {
+ $arg .= "=1";
+ }
+
+ $argParts = explode("=", $arg);
+
+ $this->serverConfig[$argParts[0]] = $argParts[1];
+
+ }
+ }
+
+ private function clientFormat($text)
+ {
+ return array("USER" => "*", "TEXT" => $text);
+ }
+
+
+
+ public function removeQueues($nick)
+ {
+ $nick = $this->myStrToLower($nick);
+
+ foreach ($this->textQueue AS $index => $queue)
+ {
+ if ($this->myStrToLower($queue['USER']) == $nick)
+ {
+ unset($this->textQueue[$index]);
+ $this->textQueueLength--;
+ }
+ }
+
+
+ }
+
+ public function getStats()
+ {
+ return $this->stats;
+ }
+
+ public function doQueue()
+ {
+ if ($this->status < STATUS_CONNECTED)
+ {
+ $this->textQueueAdded = false;
+ return false;
+ }
+
+ if ($this->socketClass->hasWriteQueue($this->sockInt) !== false)
+ {
+ return true;
+ }
+
+ if ($this->textQueueLength < 0)
+ {
+ if (is_array($this->textQueue))
+ {
+ unset($this->textQueue);
+ $this->textQueue = array();
+ }
+ $this->textQueueAdded = false;
+ return false;
+ }
+
+ $bufferSize = $this->getClientConf("queuebuffer");
+
+ $bufferSize = $bufferSize <= 0 ? 0 : $bufferSize;
+
+ $sendData = "";
+
+ $nextItem = array_shift($this->textQueue);
+
+ if (trim($nextItem['TEXT']) != "")
+ {
+ $sendData .= $nextItem['TEXT'] . "\r\n";
+ }
+
+ unset($nextItem);
+
+ $this->textQueueLength--;
+
+ while ($this->textQueueLength > 0 && ((strlen($this->textQueue[0]['TEXT']) + strlen($sendData)) < $bufferSize))
+ {
+
+ $nextItem = array_shift($this->textQueue);
+
+ if (trim($nextItem['TEXT']) != "")
+ {
+ $sendData .= $nextItem['TEXT'] . "\r\n";
+ unset($nextItem);
+ }
+
+ $this->textQueueLength--;
+
+ }
+
+ $this->stats['BYTESUP'] += strlen($sendData);
+
+ $this->writeToSocket($sendData);
+
+ unset($sendData);
+
+ return true;
+ }
+
+
+ private function writeToSocket($sendData)
+ {
+
+ if (DEBUG == 1)
+ {
+ $this->log($sendData);
+ }
+
+ try
+ {
+ if ($this->socketClass->sendSocket($this->sockInt, $sendData) === false)
+ {
+ throw new SendDataException("Could not write to socket");
+ }
+ }
+ catch (SendDataException $e)
+ {
+ $this->disconnect();
+ $this->exception = $e;
+ $this->status = STATUS_ERROR;
+ }
+
+ }
+
+
+ private function pushAfter($data)
+ {
+ $this->textQueueLength++;
+ $this->textQueue[] = $data;
+
+ if ($this->textQueueAdded == false)
+ {
+ $this->timerClass->addTimer("queue_timer", $this, "doQueue", "", $this->getQueueTimeout(), true);
+ $this->textQueueAdded = true;
+ }
+
+ }
+
+
+ private function pushBefore($data)
+ {
+ $this->textQueueLength++;
+ $this->textQueue = array_merge(array($data), $this->textQueue);
+
+ if ($this->textQueueAdded == false)
+ {
+ $this->timerClass->addTimer("queue_timer", $this, "doQueue", "", $this->getQueueTimeout(), true);
+ $this->textQueueAdded = true;
+ }
+ }
+
+ public function sendRaw($text, $force = false)
+ {
+ if ($force == false)
+ {
+ $format = $this->clientFormat($text);
+ $this->pushBefore($format);
+ }
+ else
+ {
+ $this->writeToSocket($text . "\r\n");
+ }
+ }
+
+
+ public function privMsg($who, $msg, $queue = 1)
+ {
+ $text = array( 'USER' => $who,
+ 'TEXT' => 'PRIVMSG ' . $who . ' :' . $msg);
+
+ if ($queue)
+ {
+ $this->pushAfter($text);
+ }
+ else
+ {
+ $this->pushBefore($text);
+ }
+ }
+
+
+ public function action($who, $msg, $queue = 1)
+ {
+ $text = array( 'USER' => $who,
+ 'TEXT' => 'PRIVMSG ' . $who . ' :' . chr(1) . 'ACTION ' .$msg . chr(1));
+
+ if ($queue)
+ {
+ $this->pushAfter($text);
+ }
+ else
+ {
+ $this->pushBefore($text);
+ }
+ }
+
+
+ public function notice($who, $msg, $queue = 1)
+ {
+
+ $text = array( 'USER' => $who,
+ 'TEXT' => 'NOTICE ' . $who . ' :' . $msg);
+
+ if ($queue)
+ {
+ $this->pushAfter($text);
+ }
+ else
+ {
+ $this->pushBefore($text);
+ }
+ }
+
+ public function getClientIP($long = 1)
+ {
+ if ($long == 1)
+ {
+ return $this->clientLongIP;
+ }
+ else
+ {
+ return $this->clientIP;
+ }
+ }
+
+ public function setClientIP($ip = "")
+ {
+ if ($ip == "")
+ {
+ $ip = $this->socketClass->getHost($this->sockInt);
+ }
+
+ $this->clientIP = $ip;
+
+ $this->clientLongIP = ip2long($this->clientIP);
+
+ if ($this->clientLongIP <= 0)
+ {
+ $this->clientLongIP += pow(2,32);
+ }
+ }
+
+
+
+ public function purgeTextQueue()
+ {
+ $this->textQueueTime = 0;
+ unset($this->textQueue);
+ $this->textQueue = array();
+ $this->textQueueLength = 0;
+ }
+
+ public function getTextQueueLength()
+ {
+ return $this->textQueueLength;
+ }
+
+ public function log($data)
+ {
+ $network = $this->getServerConf('Network') == "" ? $this->getClientConf('server') : $this->getServerConf('Network');
+
+ if (DEBUG == 1)
+ {
+ echo "[".date("h:i:s")."] " . "({$this->nick}@$network) > " . $data . "\n";
+ }
+ else
+ {
+ if ($this->getClientConf('logfile') != "")
+ {
+ error_log("[".date("h:i:s")."] " . "({$this->nick}@$network) > " . $data . "\n", 3, $this->getClientConf('logfile'));
+ }
+ }
+ }
+
+ public function getUsageList()
+ {
+ return $this->usageList;
+ }
+
+ public function floodCheck($line)
+ {
+ $host = $line['fromHost'];
+
+ if (!array_key_exists($host, $this->usageList))
+ {
+ $this->usageList[$host] = new usageLink;
+ $this->usageList[$host]->isBanned = false;
+ $this->usageList[$host]->lastTimeUsed = time();
+ $this->usageList[$host]->timesUsed = 1;
+ $user = $this->usageList[$host];
+ }
+ else
+ {
+ $user = $this->usageList[$host];
+
+ $floodTime = intval($this->getClientConf('floodtime'));
+ if ($floodTime <= 0)
+ {
+ $floodTime = 60;
+ }
+
+ if ($user->isBanned == true)
+ {
+ if ($user->timeBanned > time() - $floodTime)
+ {
+ return STATUS_ALREADY_BANNED;
+ }
+ $user->isBanned = false;
+ }
+
+
+ if ($user->lastTimeUsed < time() - 10)
+ {
+ $user->timesUsed = 0;
+ }
+ $user->lastTimeUsed = time();
+ $user->timesUsed++;
+ }
+
+ $numLines = intval($this->getClientConf('floodlines'));
+ if ($numLines <= 0)
+ {
+ $numLines = 5;
+ }
+
+ if ($user->timesUsed > $numLines)
+ {
+ $user->isBanned = true;
+ $user->timeBanned = time();
+ $user->timesUsed = 0;
+ $user->lastTimeUsed = 0;
+ $this->removeQueues($line['fromNick']);
+ return STATUS_JUST_BANNED;
+ }
+
+ return STATUS_NOT_BANNED;
+ }
+
+ public static function myStrToLower($text)
+ {
+ $textA = strtolower($text);
+
+ $textA = str_replace("\\", "|", $textA);
+ $textA = str_replace("[", "{", $textA);
+ $textA = str_replace("]", "}", $textA);
+ $textA = str_replace("~", "^", $textA);
+
+ return $textA;
+ }
+
+ public static function myStrToUpper($text)
+ {
+ $textA = strtoupper($text);
+
+ $textA = str_replace("|", "\\", $textA);
+ $textA = str_replace("{", "[", $textA);
+ $textA = str_replace("}", "]", $textA);
+ $textA = str_replace("^", "~", $textA);
+
+ return $textA;
+ }
+
+ public static function randomHash()
+ {
+ return md5(uniqid(rand(), true));
+ }
+
+ private function getQueueTimeout()
+ {
+ $timeout = $this->getClientConf("queuetimeout");
+ $timeout = $timeout <= 0 ? 0 : $timeout;
+ return $timeout;
+ }
+
+ public function addQuery($host, $port, $query, $line, $class, $function)
+ {
+ $remote = new remote($host, $port, $query, $line, $class, $function, 8);
+ $remote->setIrcClass($this);
+ $remote->setTimerClass($this->timerClass);
+ $remote->setSocketClass($this->socketClass);
+ return $remote->connect();
+ }
+
+}
+
diff --git a/ircbot/module.php b/ircbot/module.php
new file mode 100644
index 0000000..0cdee92
--- /dev/null
+++ b/ircbot/module.php
@@ -0,0 +1,126 @@
+ module class
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+abstract class module {
+
+ public $title = "";
+ public $author = "";
+ public $version = "";
+ public $dontShow = false;
+
+ public $ircClass;
+ public $dccClass;
+ public $timerClass;
+ public $parserClass;
+ public $socketClass;
+ public $db;
+
+ public function __construct()
+ {
+ //Nothing here...
+ }
+
+ public function __destruct()
+ {
+ $this->ircClass = null;
+ $this->dccClass = null;
+ $this->timerClass = null;
+ $this->parserClass = null;
+ $this->socketClass = null;
+ $this->db = null;
+ //Nothing here
+ }
+
+ public final function __setClasses($ircClass, $dccClass, $timerClass, $parserClass,
+ $socketClass, $db)
+ {
+ $this->ircClass = $ircClass;
+ $this->dccClass = $dccClass;
+ $this->timerClass = $timerClass;
+ $this->parserClass = $parserClass;
+ $this->socketClass = $socketClass;
+ $this->db = $db;
+ }
+
+ public final function getModule($modName)
+ {
+ $mods = $this->parserClass->getCmdList("file");
+
+ if ($mods === false)
+ {
+ return false;
+ }
+
+ if (isset($mods[$modName]))
+ {
+ return $mods[$modName]['class'];
+ }
+
+ return false;
+ }
+
+ public function handle($chat, $args)
+ {
+ }
+
+ public function connected($chat)
+ {
+ }
+
+ public function main($line, $args)
+ {
+ $port = $this->dccClass->addChat($line['fromNick'], null, null, false, $this);
+
+ if ($port === false)
+ {
+ $this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
+ }
+ }
+
+ public function init()
+ {
+ //Global.. this needs to be overwritten
+ }
+
+ public function destroy()
+ {
+ //Global.. this needs to be overwritten
+ }
+
+}
+
+?>
diff --git a/ircbot/modules/default/ads.ini b/ircbot/modules/default/ads.ini
new file mode 100644
index 0000000..e69de29
diff --git a/ircbot/modules/default/dcc_mod.conf b/ircbot/modules/default/dcc_mod.conf
new file mode 100644
index 0000000..7caeedb
--- /dev/null
+++ b/ircbot/modules/default/dcc_mod.conf
@@ -0,0 +1,81 @@
+;+---------------------------------------------------------------------------
+;| PHP-IRC Internal DCC Function Configuration File
+;| ========================================================
+;| by Manick
+;| (c) 2001-2004 by http://phpbots.sf.net
+;| Contact: manick@manekian.com
+;| irc: #manekian@irc.rizon.net
+;| ========================================
+;+---------------------------------------------------------------------------
+;| > This program is free software; you can redistribute it and/or
+;| > modify it under the terms of the GNU General Public License
+;| > as published by the Free Software Foundation; either version 2
+;| > of the License, or (at your option) any later version.
+;| >
+;| > This program is distributed in the hope that it will be useful,
+;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;| > GNU General Public License for more details.
+;| >
+;| > You should have received a copy of the GNU General Public License
+;| > along with this program; if not, write to the Free Software
+;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;+---------------------------------------------------------------------------
+
+file dcc_mod modules/default/dcc_mod.php
+
+privmsg dcc_mod monitor_check
+mode dcc_mod monitor_check
+join dcc_mod monitor_check
+kick dcc_mod monitor_check
+part dcc_mod monitor_check
+
+;new feature in 2.2.0, section definitions
+section standard "Standard Functions"
+section channel "Channel Functions"
+section dcc "DCC Functions"
+section info "Information Functions"
+section admin "Administrative Functions"
+section comm "IRC/Communication Functions"
+
+dcc monitor ~; command text (typed in dcc iface)
+ 0 ~; number of required arguments
+ "" ~; argument descriptions (or however you damn well please to do it hehe ;)
+ "Show messages from channel in dcc chat interface" ~; description of command
+ true ~; must be admin to use this command?
+ dcc_mod ~; class name (see file import section above)
+ dcc_monitor ~; function name
+ channel ; section name
+
+dcc exit 0 "" "Exits the DCC interface" false dcc_mod dcc_exit standard
+dcc raw 1 "" "Sends raw query to server" true dcc_mod dcc_raw comm
+dcc who 0 "" "See who\'s online" false dcc_mod dcc_who standard
+dcc ignore 0 "" "View ignore list" true dcc_mod dcc_ignore admin
+dcc rignore 1 "" "Remove ignore for a specified host" true dcc_mod dcc_rignore admin
+dcc clearqueue 0 "" "Removes all text queues, or queues for a specified user." true dcc_mod dcc_clearqueue admin
+dcc server 1 "" "Change server to specified server" true dcc_mod dcc_server admin
+dcc chat 1 "" "Sends message to all admin users using the DCC interface" true dcc_mod dcc_chat comm
+dcc restart 0 "" "Reconnect to the current server" true dcc_mod dcc_restart admin
+dcc say 2 "" "Sends text to some channel" true dcc_mod dcc_say comm
+dcc action 2 "" "Sends text to some channel in /me format" true dcc_mod dcc_action comm
+dcc users 0 "" "Shows users in all channels" true dcc_mod dcc_users info
+dcc maintain 0 "" "Shows maintained channels, and adds or removes one" true dcc_mod dcc_maintain channel
+dcc help 0 "" "Get information about command(s)" false dcc_mod dcc_help standard
+dcc join 1 "" "Join a channel" true dcc_mod dcc_join channel
+dcc part 1 "" "Part a channel" true dcc_mod dcc_part channel
+dcc rejoin 1 "" "Rejoin a channel" true dcc_mod dcc_rejoin channel
+dcc status 0 "" "Get status of bot, same as 5 minute status update" true dcc_mod dcc_status info
+dcc function 0 "" "See which functions are activated, or activate/deactivate a function" true dcc_mod dcc_function admin
+dcc reloadfunc 0 "" "Reloads function definition file" true dcc_mod dcc_reloadfunc admin
+dcc shutdown 0 "" "Shuts the bot down" true dcc_mod dcc_shutdown admin
+dcc connect 0 "" "Force connection to server when disconnected" true dcc_mod dcc_connect admin
+dcc rehash 0 "" "Reload the configuration file" true dcc_mod dcc_rehash admin
+dcc send 2 "" "Send a user a file" true dcc_mod dcc_send dcc
+dcc dcc 0 "" "Check current dcc status" true dcc_mod dcc_dccs dcc
+dcc close 1 "" "Close a download, upload, or chat window" true dcc_mod dcc_close dcc
+dcc upload 1 "" "Allow files to be sent to this bot" true dcc_mod dcc_upload dcc
+dcc botinfo 0 "" "View information about the bot" true dcc_mod dcc_botinfo info
+dcc timers 0 "" "View active timer information" true dcc_mod dcc_timers info
+dcc listul 0 "" "List upload directory contents" true dcc_mod dcc_listul dcc
+dcc modules 0 "" "List installed modules" true dcc_mod dcc_modules info
+dcc spawn 1 "" "Spawn a new bot in this process" true dcc_mod dcc_spawn admin
\ No newline at end of file
diff --git a/ircbot/modules/default/dcc_mod.php b/ircbot/modules/default/dcc_mod.php
new file mode 100644
index 0000000..68002d7
--- /dev/null
+++ b/ircbot/modules/default/dcc_mod.php
@@ -0,0 +1,1057 @@
+ dcc_mod module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class dcc_mod extends module {
+
+ public $title = "DCC Chat Utils";
+ public $author = "Manick";
+ public $version = "2.1.1";
+ public $dontShow = true;
+
+ public function init()
+ {
+ $this->timerClass->addTimer("dccstatus", $this, "sendStatus", "", 5*60);
+ }
+
+ public function destroy()
+ {
+ $this->timerClass->removeTimer("dccstatus");
+ }
+
+ /* DCC Functions */
+
+ public $monitorList = array();
+
+ public function monitor_check($line, $args)
+ {
+ switch($line['cmd'])
+ {
+ case "PRIVMSG":
+ if (isset($this->monitorList[irc::myStrToLower($line['to'])]))
+ {
+ if (preg_match("/\1ACTION (.+?)\1/", $line['text'], $match))
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['to'] . ": * " . $line['fromNick'] . " " . $match[1]);
+ }
+ else
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['to'] . ": <" . $line['fromNick'] . "> " . $line['text']);
+ }
+ }
+ break;
+
+ case "MODE":
+ if ($line['fromNick'] != $this->ircClass->getNick())
+ {
+ if (isset($this->monitorList[irc::myStrToLower($line['to'])]))
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['to'] . ": *** " . $line['fromNick'] . " sets mode: ".$line['params']);
+ }
+ }
+ break;
+
+ case "JOIN":
+ if ($line['fromNick'] != $this->ircClass->getNick())
+ {
+ if (isset($this->monitorList[irc::myStrToLower($line['text'])]))
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['text'] . ": *** " . $line['fromNick'] . " joined channel.");
+ }
+ }
+ break;
+
+ case "PART":
+ if ($line['fromNick'] != $this->ircClass->getNick())
+ {
+ if (isset($this->monitorList[irc::myStrToLower($line['to'])]))
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['to'] . ": *** " . $line['fromNick'] . " parted channel.");
+ }
+ }
+ break;
+
+ case "KICK":
+ if ($line['params'] != $this->ircClass->getNick())
+ {
+ if (isset($this->monitorList[irc::myStrToLower($line['to'])]))
+ {
+ $this->dccClass->dccInform("CHAN: " . $line['to'] . ": *** " . $line['params'] . " was kicked by ".$line['fromNick']." (".$line['text'].").");
+ }
+ }
+
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+
+ public function dcc_botinfo($chat, $args)
+ {
+
+ $chat->dccSend("PHP-IRC v" . VERSION . " [".VERSION_DATE."] by Manick (visit http://phpbots.sf.net/ to download)");
+ $chat->dccSend("total running time of " . $this->ircClass->timeFormat($this->ircClass->getRunTime(), "%d days, %h hours, %m minutes, and %s seconds."));
+
+ $fd = @fopen("/proc/" . $this->ircClass->pid() . "/stat", "r");
+ if ($fd !== false)
+ {
+ $stat = fread($fd, 1024);
+ fclose($fd);
+
+ $stat_array = explode(" ", $stat);
+
+ $pid = $stat_array[0];
+ $comm = $stat_array[1];
+ $utime = $stat_array[13];
+ $stime = $stat_array[14];
+ $vsize = $stat_array[22];
+ $meminfo = number_format($vsize, 0, '.',',');
+ $u_time = number_format($utime / 100, 2,'.',',');
+ $s_time = number_format($stime / 100, 2,'.',',');
+
+ $fd = @fopen("/proc/stat", "r");
+ if ($fd !== false)
+ {
+ $stat = fread($fd, 1024);
+ fclose($fd);
+
+ $stat = str_replace(" ", " ", $stat);
+ $stat_array_2 = explode(" ", $stat);
+ $totalutime = $stat_array_2[1];
+ $totalstime = $stat_array_2[3];
+ $u_percent = number_format($utime / $totalutime, 6,'.',',');
+ $s_percent = number_format($stime / $totalstime, 6,'.',',');
+
+ $chat->dccSend("cpu usage: " . $u_time . "s user (" . $u_percent . "%), " . $s_time . "s system (" . $s_percent . "%)");
+ }
+
+ $chat->dccSend("memory usage: " . $meminfo . " bytes");
+
+ }
+
+ $fd = @fopen("/proc/loadavg", "r");
+ if ($fd !== false)
+ {
+ $loadavg = fread($fd, 1024);
+ $loadavg_array = explode(" ", $loadavg);
+ $loadavgs = $loadavg_array[0] . " " . $loadavg_array[1] . " " .$loadavg_array[2];
+ fclose($fd);
+
+ $chat->dccSend("cpu load averages: " . $loadavgs);
+ }
+
+ $realname = $this->ircClass->getClientConf('realname') == "" ? "n/a" : $this->ircClass->getClientConf('realname');
+ $upload = $this->ircClass->getClientConf('upload') == "yes" ? "yes" : "no";
+
+ $chat->dccSend("configured nick: " . $this->ircClass->getClientConf('nick') . ", " .
+ "actual nick: " . $this->ircClass->getNick() . ", realname: " . $realname);
+
+ $chat->dccSend("upload is currently set to " . $upload);
+
+ if ($this->ircClass->getStatusRaw() == STATUS_CONNECTED_REGISTERED)
+ {
+ $network = $this->ircClass->getServerConf('Network') == "" ? $this->ircClass->getClientConf('server') : $this->ircClass->getServerConf('Network');
+ $chat->dccSend("current server: " . $network . "(" . $this->ircClass->getClientConf('server') . ") port: " . $this->ircClass->getClientConf('port'));
+ }
+ else
+ {
+ $chat->dccSend("current server: none");
+ }
+
+ $maintain = $this->ircClass->getMaintainedChannels();
+
+ $maintained = "n/a";
+
+ if (isset($maintain[0]))
+ {
+ $maintained = "";
+ foreach ($maintain AS $chan)
+ {
+ $maintained .= $chan['CHANNEL'] . " ";
+ }
+ $maintained = trim($maintained);
+ $chat->dccSend("configured channels: " . $maintained);
+ }
+
+ $channels = $this->ircClass->getChannelData();
+
+ foreach($channels AS $chanPtr)
+ {
+ $chat->dccSend("in channel " . strtoupper($chanPtr->name) . ": users: " . $chanPtr->count);
+ }
+
+ $chat->dccSend("status line: " . $this->getStatus());
+ $chat->dccSend("config file: " . $this->ircClass->getConfigFilename());
+
+ return;
+
+ }
+
+ public function dcc_connect($chat, $args)
+ {
+ $status = $this->ircClass->getStatusRaw();
+
+ if ($status == STATUS_ERROR)
+ {
+ $this->ircClass->reconnect();
+ }
+ }
+
+
+ public function dcc_monitor($chat, $args)
+ {
+ if ($args['nargs'] == 0)
+ {
+ $chat->dccSend("The following channels are being monitored:");
+ foreach ($this->monitorList AS $channel => $random)
+ {
+ $chat->dccSend($channel);
+ }
+ }
+ else
+ {
+
+ $chan = irc::myStrToLower($args['arg1']);
+
+ if (!isset($this->monitorList[$chan]))
+ {
+ $this->monitorList[$chan] = 1;
+ $chat->dccSend("The channel '" . $chan . "' is now being monitored.");
+ }
+ else
+ {
+ $chat->dccSend("The channel '" . $chan . "' was removed from the monitored list.");
+ unset($this->monitorList[$chan]);
+ }
+ }
+
+ }
+
+
+
+ public function dcc_who($chat, $args)
+ {
+ $dccList = $this->dccClass->getDccList();
+
+ $chat->dccSend("--- Users Online ---");
+ $chat->dccSend("[id] ");
+ foreach ($dccList AS $chatBox)
+ {
+ if ($chatBox->type == CHAT)
+ {
+ $chat->dccSend("[" . $chatBox->id . "] " . $chatBox->nick . ($chatBox->isAdmin ? " (admin)" : ""));
+ }
+ }
+ }
+
+ public function dcc_timers($chat, $args)
+ {
+ $timers = $this->timerClass->getTimers();
+
+ $chat->dccSend("Active Timers:");
+
+ if (count($timers) > 0)
+ {
+ $time = timers::getMicroTime();
+ foreach ($timers AS $timer)
+ {
+ $interval = "interval(" . $timer->interval . " sec)";
+
+ $timeTillNext = round(($timer->nextRunTime - $time < 0 ? 0 : $timer->nextRunTime - $time), 0);
+
+ $ttnext = irc::timeFormat($timeTillNext, "%m min, %s sec");
+
+ if (is_object($timer->class))
+ {
+ $cName = get_class($timer->class);
+ }
+ else
+ {
+ $cName = "";
+ }
+
+ $tName = preg_replace("/([a-z0-9]){32}/", "", $timer->name);
+ if ($tName == "")
+ {
+ $tName = "(random hash)";
+ }
+
+ $cName = preg_replace("/_([a-z0-9]){32}/", "", $cName);
+
+ $chat->dccSend("Timer " . BOLD . $tName . BOLD . ": func(" . $cName . "::" . $timer->func . ") " . $interval . ", Time till next run: " . $ttnext);
+ }
+ }
+ else
+ {
+ $chat->dccSend("There are currently no timers.");
+ }
+
+ }
+
+ public function dcc_reloadfunc($chat, $args)
+ {
+ if ($this->ircClass->getClientConf('functionfile') != "")
+ {
+ $stat = $this->parserClass->loadFuncs($this->ircClass->getClientConf('functionfile'));
+ $chat->dccSend("Function reload complete");
+ if ($stat == true)
+ {
+ $chat->dccSend("There were errors loading a function file! Cached version may still be in use!");
+ }
+ }
+ else
+ {
+ $chat->dccSend("No function file defined in config file.");
+ }
+ }
+
+ public function dcc_rehash($chat, $args)
+ {
+
+ $chat->dccSend("Rehashing main config file, please wait...");
+
+ $currConfig = $this->ircClass->getClientConf();
+ $newConfig = bot::parseConfig($this->ircClass->getConfigFilename());
+
+ if ($newConfig == false)
+ {
+ $chat->dccSend("Could not find config file or IO error.");
+ return;
+ }
+
+ $this->ircClass->setConfig($newConfig, $this->ircClass->getConfigFilename());
+
+ if ($currConfig['nick'] != $newConfig['nick'])
+ {
+ $chat->dccSend("Changing nick...");
+ $this->ircClass->changeNick($newConfig['nick']);
+ }
+
+ if ($currConfig['server'] != $newConfig['server'])
+ {
+ $chat->dccSend("Connecting to new server...");
+ $this->ircClass->disconnect();
+ $this->ircClass->reconnect();
+ }
+ else
+ {
+ if (isset($currConfig['channel']))
+ {
+ if (!is_array($currConfig['channel']))
+ {
+ $currConfig['channel'] = array($currConfig['channel']);
+ }
+ if (!is_array($newConfig['channel']))
+ {
+ $newConfig['channel'] = array($newConfig['channel']);
+ }
+
+ foreach($currConfig['channel'] AS $chan)
+ {
+ if (!in_array($chan, $newConfig['channel']))
+ {
+ $chan = trim($chan) . " ";
+ $chan = trim(substr($chan, 0, strpos($chan, chr(32)) + 1));
+ $this->ircClass->sendRaw("PART " . $chan);
+ }
+
+ }
+ }
+ }
+
+ $this->ircClass->purgeMaintainList();
+
+ $chat->dccSend("Rehashing channel list...");
+ bot::createChannelArray($this->ircClass);
+
+ $chat->dccSend("Rehashing IP address...");
+ if (isset($newConfig['natip']))
+ {
+ if (isset($currConfig['natip']))
+ {
+ if ($currConfig['natip'] != $newConfig['natip'])
+ {
+ $this->ircClass->setClientIP($newConfig['natip']);
+ }
+ }
+ else
+ {
+ $this->ircClass->setClientIP($newConfig['natip']);
+ }
+ }
+ else
+ {
+ if ($this->ircClass->getStatusRaw() != STATUS_CONNECTED_REGISTERED)
+ {
+ $chat->dccSend("NOTICE: Cannot reset IP address unless connected to server. No change made.");
+ }
+ else
+ {
+ $this->ircClass->setClientIP();
+ }
+ }
+
+ if (isset($newConfig['dccrangestart']) && $newConfig['dccrangestart'] != $currConfig['dccrangestart'])
+ {
+ $chat->dccSend("Updating TCP Range...");
+ $this->socketClass->setTcpRange($newConfig['dccrangestart']);
+ }
+
+ if (isset($newConfig['logfile']) && $newConfig['logfile'] != $currConfig['logfile'])
+ {
+ $chat->dccSend("Changing log file...");
+ $this->ircClass->closeLog();
+ }
+
+ if (isset($newConfig['functionfile']))
+ {
+ if ($newConfig['functionfile'] != $currConfig['functionfile'])
+ {
+ $this->parserClass->loadFuncs($newConfig['functionfile']);
+ }
+ }
+ else
+ {
+ $chat->dccSend("Fatal Error, functionfile directive not set. The performance of this bot is no longer guaranteed (please restart and fix your error)");
+ return;
+ }
+
+ $chat->dccSend("Main config rehash complete.");
+
+ }
+
+ public function dcc_join($chat, $args)
+ {
+ $chat->dccSend("Joining: " . $args['query']);
+ $this->ircClass->sendRaw("JOIN " . $args['query']);
+ }
+
+ public function dcc_part($chat, $args)
+ {
+ $this->ircClass->sendRaw("PART " . $args['query']);
+ }
+
+ public function dcc_rejoin($chat, $args)
+ {
+ $chanPtr = $this->ircClass->getChannelData($args['arg1']);
+
+ if ($chanPtr == NULL)
+ {
+ $chat->dccSend("You are not on channel '" . $args['arg1'] . "'");
+ }
+ else
+ {
+ $chat->dccSend("Rejoining: " . $args['arg1']);
+ $this->ircClass->sendRaw("JOIN " . $args['arg1']);
+ $this->ircClass->sendRaw("PART " . $args['arg1']);
+ }
+ }
+
+
+ public function dcc_shutdown($chat, $args)
+ {
+ $chat->dccSend("Shutting down, sending kill command to irc class.");
+
+ if ($this->ircClass->getStatusRaw() == STATUS_CONNECTED_REGISTERED)
+ {
+ $time = $this->ircClass->timeFormat($this->ircClass->getRunTime(), "%dd%hh%mm%ss");
+ $msg = "php-irc v" . VERSION . " by Manick, running ".$time;
+ $this->ircClass->sendRaw("QUIT :" . $msg);
+ }
+
+ $chat->dccSend("Waiting for server queue to flush...");
+
+ $this->timerClass->addTimer("shutdown", $this->ircClass, "shutdown", "", 1);
+ }
+
+ public function dcc_ignore($chat, $args)
+ {
+ $usageList = $this->ircClass->getUsageList();
+
+ $chat->dccSend("--- Usage List (* denotes active ignore) ---");
+
+ foreach($usageList AS $host => $user)
+ {
+ if (trim($host) != "")
+ {
+ if (intval($user->timeBanned) > 5)
+ {
+ $chat->dccSend(($user->isBanned == true ? "*" : "") . $host . ": " . (intval($user->timeBanned) > 5 ? date("m-d-y h:i:s a", $user->timeBanned) : "never banned"));
+ }
+ }
+ }
+
+
+ }
+
+ public function dcc_rignore($chat, $args)
+ {
+ $usageList = $this->ircClass->getUsageList();
+
+ if (array_key_exists($args['arg1'], $usageList))
+ {
+ $usageList[$args['arg1']]->isBanned = false;
+ $chat->dccSend("Ignore for " . $args['arg1'] . " successfully removed.");
+ }
+ else
+ {
+ $chat->dccSend("No such ignore.");
+ }
+
+ }
+
+ public function dcc_clearqueue($chat, $args)
+ {
+ if ($args['nargs'] > 0)
+ {
+ $this->ircClass->removeQueues($args['arg1']);
+ $chat->dccSend("All text queues for " . $args['arg1'] . " removed.");
+ }
+ else
+ {
+ $this->ircClass->purgeTextQueue();
+ $chat->dccSend("All text queues purged.");
+ }
+ }
+
+
+ public function dcc_status($chat, $args)
+ {
+ $chat->dccSend($this->getStatus());
+ }
+
+ public function dcc_server($chat, $args)
+ {
+ $server = $args['arg1'];
+ $port = 6667;
+
+ if ($args['nargs'] > 1)
+ {
+ $port = intval($args['arg2']);
+ if ($port == 0)
+ {
+ $port = 6667;
+ }
+ }
+
+ $chat->dccSend("Changing server to: " . $server . ":" . $port);
+ $this->ircClass->setClientConfigVar('server', $server);
+ $this->ircClass->setClientConfigVar('port', $port);
+ $this->ircClass->disconnect();
+ $this->ircClass->reconnect();
+ }
+
+ public function dcc_exit($chat, $args)
+ {
+ $this->dccClass->dccInform("DCC: " . $chat->nick . " logged off", $chat);
+ $chat->disconnect("User quit");
+ }
+
+ public function dcc_action($chat, $args)
+ {
+ $this->ircClass->action($args['arg1'], substr($args['query'], strlen($args['arg1']) + 1));
+ }
+
+ public function dcc_restart($chat, $args)
+ {
+ $this->ircClass->disconnect();
+ }
+
+ public function dcc_chat($chat, $args)
+ {
+ $this->dccClass->dccInform("CHAT: (" . $chat->nick . ")> " . $args['query'], $chat);
+ }
+
+ public function dcc_raw($chat, $args)
+ {
+ $this->ircClass->sendRaw($args['query']);
+ }
+
+ public function dcc_say($chat, $args)
+ {
+ $this->ircClass->privMsg($args['arg1'], substr($args['query'], strlen($args['arg1']) + 1));
+ }
+
+ public function dcc_users($chat, $args)
+ {
+ $chat->dccSend($this->ircClass->displayUsers());
+ }
+
+ public function dcc_upload($chat, $args)
+ {
+ $args['arg1'] = irc::myStrToLower($args['arg1']);
+
+ if ($args['arg1'] == "yes")
+ {
+ $this->ircClass->setClientConfigVar('upload', 'yes');
+ $chat->dccSend("Upload is now set to allow.");
+ }
+ else if ($args['arg1'] == "no")
+ {
+ $this->ircClass->setClientConfigVar('upload', 'no');
+ $chat->dccSend("Upload is now set to deny.");
+ }
+ else
+ {
+ $chat->dccSend("Upload is currently set to: " . $this->ircClass->getClientConf('upload'));
+ $chat->dccSend("Valid syntax is 'yes' or 'no'.");
+ }
+ }
+
+
+ public function dcc_maintain($chat, $args)
+ {
+ if ($args['nargs'] == 0)
+ {
+
+ $chat->dccSend("-- Maintained Channels --");
+ $chans = $this->ircClass->getMaintainedChannels();
+
+ $num = 0;
+ foreach($chans AS $chan)
+ {
+ $chat->dccSend($chan['CHANNEL'] .
+ ($chan['KEY'] != "" ? " with key " . $chan['KEY'] : ""));
+ $num++;
+ }
+
+ $chat->dccSend($num . " total channels");
+
+ }
+ else
+ {
+ $chanArg = irc::myStrToLower($args['arg1']);
+
+ $chans = $this->ircClass->getMaintainedChannels();
+
+ $found = false;
+ foreach($chans AS $chan)
+ {
+ if ($chan['CHANNEL'] == $chanArg)
+ {
+ $found = true;
+ break;
+ }
+ }
+
+ if ($found == true)
+ {
+ $this->ircClass->removeMaintain($chanArg);
+ $chat->dccSend("Channel " . $chanArg . " successfully removed from maintain list.");
+ }
+ else
+ {
+ $this->ircClass->maintainChannel($chanArg, ($args['nargs'] >= 2 ? $args['arg2'] : ""));
+ $chat->dccSend("Channel " . $chanArg . " is now being maintained"
+ . ($args['nargs'] >= 2 ? " with key " . $args['arg2'] : "."));
+
+ if ($this->ircClass->isOnline($this->ircClass->getNick(), $chanArg) == false)
+ {
+ $this->ircClass->joinChannel($chanArg . ($args['nargs'] >= 2 ? " " . $args['arg2'] : ""));
+ }
+
+ }
+
+ }
+
+
+ }
+
+ public function dcc_help($chat, $args)
+ {
+ $cmdList = $this->parserClass->getCmdList('dcc');
+ $sectionList = $this->parserClass->getCmdList('section');
+
+ if ($args['nargs'] > 0)
+ {
+ $cmd = $args['arg1'];
+
+ if (isset($cmdList[$cmd]))
+ {
+ $chat->dccSend("Usage: " . $cmd . " " . $cmdList[$cmd]['usage']);
+ $chat->dccSend("Section: " . $sectionList[$cmdList[$cmd]['section']]['longname']);
+ $chat->dccSend("Description: " . $cmdList[$cmd]['help']);
+ }
+ else
+ {
+ $chat->dccSend("Invalid Command: " . $line['arg1']);
+ }
+
+ return;
+ }
+
+ $chat->dccSend("Commands:");
+
+ $sections = array();
+
+ foreach ($cmdList AS $cmd => $cmdData)
+ {
+ if (!$chat->isAdmin && $cmdData['admin'] == true)
+ {
+ continue;
+ }
+
+ $sections[$cmdData['section']][] = strtoupper($cmd) . " - " . $cmdData['help'];
+ }
+
+ foreach ($sections AS $section => $data)
+ {
+ $chat->dccSend($sectionList[$section]['longname']);
+
+ foreach ($data AS $cmd)
+ {
+ $chat->dccSend("-- " . $cmd);
+ }
+ }
+
+ $chat->dccSend("Use HELP for a list of arguments");
+
+
+ }
+
+ public function dcc_modules($chat, $args)
+ {
+ $cmdList = $this->parserClass->getCmdList();
+
+ if (isset($cmdList['file']))
+ {
+ $chat->dccSend("Installed Modules:");
+
+ foreach($cmdList['file'] AS $module)
+ {
+ $class = $module['class'];
+
+ $chat->dccSend("-- " . $class->title . " " . $class->version . " by " . $class->author);
+ }
+ }
+ else
+ {
+ $chat->dccSend("There are no installed modules.");
+ }
+ }
+
+
+ public function dcc_close($chat, $args)
+ {
+ $dccList = $this->dccClass->getDccList();
+
+ foreach ($dccList AS $sockInt => $dcc)
+ {
+ if ($args['arg1'] == $dcc->id)
+ {
+ if ($dcc->type == CHAT && $dcc->isAdmin == true)
+ {
+ $chat->dccSend("Cannot close admin session!");
+ return;
+ }
+
+ $dcc->disconnect("Owner Requested Close");
+ break;
+ }
+ }
+ }
+
+ public function dcc_listul($chat, $args)
+ {
+
+ $uldir = $this->ircClass->getClientConf('uploaddir');
+
+ if ($uldir != "")
+ {
+ $chat->dccSend("Directory Contents, " . $uldir);
+
+ $dir = @scandir($uldir);
+
+ $dirs = 0;
+ $files = 0;
+
+ if (count($dir))
+ {
+
+ foreach ($dir AS $file)
+ {
+ if (is_dir($uldir . "/" . $file))
+ {
+ $dirs++;
+ $chat->dccSend(BOLD . "dir: " . BOLD . $file);
+ }
+ else if (is_file($uldir . "/" . $file))
+ {
+ $files++;
+ $chat->dccSend($file);
+ }
+ }
+ }
+ $chat->dccSend($dirs . " directories, " . $files . " files");
+
+ }
+ else
+ {
+ $chat->dccSend("Error, no uploaddir configuration directive set in config file.");
+ }
+ }
+
+
+ public function dcc_dccs($chat, $args)
+ {
+ $dccList = $this->dccClass->getDccList();
+ $currDcc = false;
+
+ foreach ($dccList AS $sockInt => $dcc)
+ {
+ if ($dcc->type == FILE)
+ {
+ $currDcc = true;
+
+ if ($dcc->speed_lastavg == 0)
+ {
+ $percent = "0%";
+ $eta = "n/a";
+ $speed = 0.0;
+ }
+ else
+ {
+ $percent = round(($dcc->bytesTransfered/$dcc->filesize)*100, 1) . "%";
+ $eta = $this->ircClass->timeFormat(round(($dcc->filesize - $dcc->bytesTransfered)/$dcc->speed_lastavg, 0), "%hh,%mm,%ss");
+ $speed = irc::intToSizeString($dcc->speed_lastavg);
+ }
+
+ if ($dcc->transferType == UPLOAD)
+ {
+ $chat->dccSend("Upload[{$dcc->id}]: " . $dcc->nick . " " . $dcc->filenameNoDir . " ".$percent." " . $speed . "/s eta:" . $eta);
+ }
+ else
+ {
+ $chat->dccSend("Download[{$dcc->id}]: " . $dcc->nick . " " . $dcc->filenameNoDir . " ".$percent." " . $speed . "/s eta:" . $eta);
+ }
+ }
+ }
+
+ if ($currDcc == false)
+ {
+ $chat->dccSend("No dcc transfers in progress");
+ }
+ }
+
+
+ public function dcc_send($chat, $args)
+ {
+ $filename = substr($args['query'], strlen($args['arg1']) + 1);
+
+ $this->dccClass->addFile($args['arg1'], null, null, UPLOAD, $filename, null);
+ }
+
+ public function dcc_function($chat, $args)
+ {
+ $cmdList = $this->parserClass->getCmdList();
+
+ if ($args['nargs'] == 0)
+ {
+ $chat->dccSend("-- All user-defined function status --");
+
+ $num = 0;
+ foreach ($cmdList['priv'] AS $cmd => $data)
+ {
+ $chat->dccSend($cmd . " => " . ($data['active'] == true ? "active" : "inactive") . ", Usage: " . $data['usage']);
+ $num++;
+ }
+ $chat->dccSend($num . " total functions.");
+
+ }
+ else if ($args['nargs'] == 2)
+ {
+ if ($args['arg1'] == "activate")
+ {
+ if ($args['arg2'] == "all")
+ {
+ foreach($cmdList['priv'] AS $cmd => $data)
+ {
+ //$cmdList['priv'][$cmd]['active'] = true;
+ $this->parserClass->setCmdListValue('priv', $cmd, 'active', true);
+ }
+ $chat->dccSend("All functions activated.");
+ }
+ else
+ {
+ $cmdLower = irc::myStrToLower($args['arg2']);
+
+ if (isset($cmdList['priv'][$cmdLower]))
+ {
+ $this->parserClass->setCmdListValue('priv', $cmdLower, 'active', true);
+ //$cmdList['priv'][$cmdLower]['active'] = true;
+ $chat->dccSend("Function " . $cmdLower . " activated.");
+ }
+ else
+ {
+ $chat->dccSend("Invalid function specified.");
+ }
+ }
+ }
+ else if ($args['arg1'] == "deactivate")
+ {
+ if ($args['arg2'] == "all")
+ {
+ foreach($cmdList['priv'] AS $cmd => $data)
+ {
+ if ($data['canDeactivate'] != false)
+ {
+ $this->parserClass->setCmdListValue('priv', $cmd, 'active', false);
+ //$cmdList['priv'][$cmd]['active'] = false;
+ }
+ }
+ $chat->dccSend("All functions deactivated.");
+ }
+ else
+ {
+ $cmdLower = irc::myStrToLower($args['arg2']);
+
+ if (isset($cmdList['priv'][$cmdLower]))
+ {
+ if ($cmdList['priv'][$cmdLower]['canDeactivate'] != false)
+ {
+ $this->parserClass->setCmdListValue('priv', $cmdLower, 'active', false);
+ //$cmdList['priv'][$cmdLower]['active'] = false;
+ $chat->dccSend("Function " . $cmdLower . " deactivated.");
+ }
+ else
+ {
+ $chat->dccSend("Cannot modify read-only function " . $cmdLower . ".");
+ }
+ }
+ else
+ {
+ $chat->dccSend("Invalid function specified.");
+ }
+ }
+ }
+ else
+ {
+ $chat->dccSend("Invalid Syntax, use 'all', or specify a function name.");
+ }
+
+ }
+ else
+ {
+ $chat->dccSend("Invalid Syntax, use 'activate' or 'deactivate'.");
+ }
+ }
+
+ public function dcc_spawn($chat, $args)
+ {
+ $chat->dccSend("Spawning " . $args['query'] . "...");
+ $result= bot::addBot($args['query']);
+ if($result === true)
+ $chat->dccSend($args['query'] . " successfully spawned");
+ else
+ $chat->dccSend($args['query'] . " was not spawned");
+ }
+
+ private function getStatus()
+ {
+ $sqlCount = 0;
+ $bwStats = $this->ircClass->getStats();
+
+ if (is_object($this->db))
+ {
+ $sqlCount = $this->db->numQueries();
+ }
+
+ $bwUp = irc::intToSizeString($bwStats['BYTESUP']);
+ $bwDown = irc::intToSizeString($bwStats['BYTESDOWN']);
+
+ $fileBwUp = irc::intToSizeString($this->dccClass->getBytesUp());
+ $fileBwDown = irc::intToSizeString($this->dccClass->getBytesDown());
+
+ $txtQueue = $this->ircClass->getTextQueueLength() + 1;
+
+ $ircStat = $this->ircClass->getStatusString($this->ircClass->getStatusRaw());
+
+ $status = "Status: [" . $ircStat . "] ". $sqlCount .
+ " SQL, " . $txtQueue . " SrQ, (irc BW: " . $bwUp . " up, " . $bwDown . " down, file BW: " . $fileBwUp . " up, " . $fileBwDown . " down)";
+ return $status;
+ }
+
+ public function sendStatus()
+ {
+ $this->dccClass->dccInform($this->getStatus());
+ return true;
+ }
+
+/*
+ NOTE: If you're reading this, you're really bored. Anyway, this is just something I'm keeping in here
+ in case I ever need it again. It was a debug mechanism for a hash class I wrote to replace the associative arrays
+ that the bot currently uses.
+
+ dcc debug 1 " []" "Debug channel/member hash tables" true dcc_mod dcc_debug info
+ public function dcc_debug($chat, $args)
+ {
+ if ($args['arg1'] == "chan")
+ {
+ $chanData = $this->ircClass->getChannelData();
+
+ $chat->dccSend($chanData->getCount() . " total buckets");
+
+ foreach ($chanData->debug() AS $debug)
+ {
+ $chat->dccSend($debug);
+ }
+ }
+ else if ($args['arg1'] == "mem")
+ {
+ if ($args['nargs'] > 1)
+ {
+ $chanData = $this->ircClass->getChannelData();
+
+ $chanPtr = $chanData->find($args['arg2']);
+
+ if ($chanPtr !== false)
+ {
+ $chat->dccSend($chanPtr->memberList->getCount() . " total buckets");
+
+ foreach ($chanPtr->memberList->debug() AS $debug)
+ {
+ $chat->dccSend($debug);
+ }
+ }
+ }
+ }
+ }
+*/
+}
+?>
diff --git a/ircbot/modules/default/priv_mod.conf b/ircbot/modules/default/priv_mod.conf
new file mode 100644
index 0000000..a62cfd8
--- /dev/null
+++ b/ircbot/modules/default/priv_mod.conf
@@ -0,0 +1,35 @@
+;+---------------------------------------------------------------------------
+;| PHP-IRC Internal PRIVMSG Function Configuration File
+;| ========================================================
+;| by Manick
+;| (c) 2001-2004 by http://phpbots.sf.net
+;| Contact: manick@manekian.com
+;| irc: #manekian@irc.rizon.net
+;| ========================================
+;+---------------------------------------------------------------------------
+;| > This program is free software; you can redistribute it and/or
+;| > modify it under the terms of the GNU General Public License
+;| > as published by the Free Software Foundation; either version 2
+;| > of the License, or (at your option) any later version.
+;| >
+;| > This program is distributed in the hope that it will be useful,
+;| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+;| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;| > GNU General Public License for more details.
+;| >
+;| > You should have received a copy of the GNU General Public License
+;| > along with this program; if not, write to the Free Software
+;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;+---------------------------------------------------------------------------
+
+file priv_mod modules/default/priv_mod.php
+
+priv admin ~; text typed in the channel/pm (admin)
+ true ~; active command on statup?
+ false ~; inform admins in dcc chat iface if this command is used
+ false ~; can be deactivated with 'function' dcc command
+ 0 ~; times used.. just leave this 0 (its for stats).
+ priv_mod ~; class name (see file import section above)
+ priv_admin ; function name
+
+priv !ad true true true 0 priv_mod priv_ad
\ No newline at end of file
diff --git a/ircbot/modules/default/priv_mod.php b/ircbot/modules/default/priv_mod.php
new file mode 100644
index 0000000..8aa76f5
--- /dev/null
+++ b/ircbot/modules/default/priv_mod.php
@@ -0,0 +1,315 @@
+ priv_mod module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class priv_mod extends module {
+
+ public $title = "Privmsg Utils";
+ public $author = "Manick";
+ public $version = "2.1.1";
+ public $dontShow = true;
+
+ private $ads;
+
+ public function init()
+ {
+ $this->loadAds();
+ }
+
+ public function destroy()
+ {
+ $this->destroyAds();
+ }
+
+ private function loadAds()
+ {
+ $ads = new ini("./modules/default/ads.ini");
+
+ if ($ads->getError())
+ {
+ return;
+ }
+
+ $sections = $ads->getSections();
+
+ foreach ($sections AS $ad)
+ {
+
+ $int = $ads->getIniVal($ad, "int");
+ $channel = $ads->getIniVal($ad, "chan");
+ $msg = $ads->getIniVal($ad, "msg");
+
+ $argArray = array('msg' => $msg, 'channel' => $channel);
+
+ $this->timerClass->addTimer($ad, $this, "misc_adTimer", $argArray, $int);
+
+ }
+
+ $this->ads = $ads;
+
+ }
+
+ private function destroyAds()
+ {
+ $sections = $this->ads->getSections();
+
+ foreach ($sections AS $ad)
+ {
+ $this->timerClass->removeTimer($ad);
+ }
+ }
+
+ // Misc Timer
+
+ public function misc_adTimer($msg)
+ {
+
+ $ad = DARK . "[" . BRIGHT . "Request" . DARK . "] - [" . BRIGHT .
+ $msg['msg'] . DARK .
+ "] - PHP-IRC v" . VERSION;
+
+ $raw = "PRIVMSG " . $msg['channel'] . " :" . $ad;
+
+ $this->ircClass->sendRaw($raw);
+
+ return true;
+ }
+
+ /* public Message/Channel Functions */
+
+ // This function is an example, it will display an add with timer
+ public function priv_ad($line, $args)
+ {
+ $channel = irc::myStrToLower($line['to']);
+ if ($channel == $this->ircClass->getNick())
+ {
+ return;
+ }
+ if (!$this->ircClass->isMode($line['fromNick'], $channel, "o"))
+ {
+ return;
+ }
+
+ if ($args['nargs'] == 0)
+ {
+ $timerString = "";
+ $timers = $this->timerClass->getTimers();
+ foreach ($timers AS $timer)
+ {
+ if (substr($timer->name, 0, 2) == "ad")
+ {
+ if ($timer->args['channel'] == $channel)
+ {
+ $timerString .= $timer->name . " ";
+ }
+ }
+ }
+ if ($timerString == "")
+ {
+ $this->ircClass->notice($line['fromNick'], "No ads currently for " . $channel . ".");
+ }
+ else
+ {
+ $this->ircClass->notice($line['fromNick'], "Current ads for " . $channel .":");
+ $this->ircClass->notice($line['fromNick'], $timerString);
+ }
+
+ $this->ircClass->notice($line['fromNick'], "Type !ad to add an ad, or !ad to view an ad.");
+ }
+ else if ($args['nargs'] >= 1)
+ {
+ if (substr($args['arg1'], 0, 2) == "ad" && strlen($args['arg1']) > 2)
+ {
+ $id = $args['arg1'];
+
+ $timers = $this->timerClass->getTimers();
+ foreach ($timers AS $timer)
+ {
+ if ($timer->name == $id)
+ {
+ break;
+ }
+ }
+
+ if ($timer == null || $channel != $timer->args['channel'])
+ {
+ $this->ircClass->notice($line['fromNick'], "There is no ad by that id.");
+ }
+ else
+ {
+ if ($args['nargs'] >= 2)
+ {
+ if (irc::myStrToLower($args['arg2']) == "delete")
+ {
+ $this->ads->deleteSection($timer->name);
+ $this->ads->writeIni();
+
+ $this->timerClass->removeTimer($timer->name);
+
+ $this->ircClass->notice($line['fromNick'], "Ad successfully deleted.");
+ }
+ else
+ {
+ $this->ircClass->notice($line['fromNick'], "Invalid option. Valid options: delete");
+ }
+ }
+ else
+ {
+ $this->ircClass->notice($line['fromNick'], "Ad: " . $timer->name);
+ $this->ircClass->notice($line['fromNick'], $timer->args['msg']);
+ $this->ircClass->notice($line['fromNick'], "Use '!ad " . $timer->name . " delete' to delete this ad.");
+ }
+ }
+
+ }
+ else
+ {
+ if ($args['nargs'] == 1)
+ {
+ $this->ircClass->notice($line['fromNick'], "You must specify a message!");
+ }
+ else
+ {
+ $int = intval($args['arg1']);
+
+ if ($int <= 5)
+ {
+ $this->ircClass->notice($line['fromNick'], "Invalid Interval. Interval must be greater than 5 seconds.");
+ }
+ else
+ {
+ $ad = substr($args['query'], strlen($args['arg1']) + 1);
+
+ $argArray = array('msg' => $ad, 'channel' => $channel);
+
+ //Find next id
+ $highest = 0;
+ $timers = $this->timerClass->getTimers();
+ foreach ($timers AS $timer)
+ {
+ if (substr($timer->name, 0, 2) == "ad")
+ {
+ $id = intval(substr($timer->name, 2));
+ if ($id > $highest)
+ {
+ $highest = $id;
+ }
+ }
+ }
+ $highest++;
+
+ $this->timerClass->addTimer('ad' . $highest, $this, "misc_adTimer", $argArray, $int, true);
+ $this->ircClass->notice($line['fromNick'], "The ad was successfully added.");
+
+ $this->ads->setIniVal('ad' . $highest, "int", $int);
+ $this->ads->setIniVal('ad' . $highest, "chan", $channel);
+ $this->ads->setIniVal('ad' . $highest, "msg", $ad);
+ $this->ads->writeIni();
+ }
+ }
+
+ }
+
+
+ }
+ }
+
+ public function priv_admin($line, $args)
+ {
+ if ($args['nargs'] < 2)
+ {
+ return;
+ }
+
+ if ($this->ircClass->getClientConf('dccadminpass') == "")
+ {
+ return;
+ }
+
+ if (md5($args['arg1']) != $this->ircClass->getClientConf('dccadminpass'))
+ {
+ return;
+ }
+
+ $query = substr($args['query'], strlen($args['arg1']) + 1);
+ $myArgs = parser::createLine($query);
+
+ switch ($args['arg2'])
+ {
+ case "chatme":
+ $port = $this->dccClass->addChat($line['fromNick'], null, null, true, null);
+ if ($port === false)
+ {
+ $this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
+ }
+ break;
+ default:
+ $chat = new chat_wrapper($line['fromNick'], $this->ircClass);
+
+ $cmdList = $this->parserClass->getCmdList();
+
+ $cmdLower = $myArgs['cmd'];
+
+ if (isset($cmdList['dcc'][$cmdLower]))
+ {
+
+ if ($myArgs['nargs'] < $cmdList['dcc'][$cmdLower]['numArgs'])
+ {
+ $chat->dccSend("Usage: " . $cmdLower . " " . $cmdList['dcc'][$cmdLower]['usage']);
+ break;
+ }
+
+ $module = $cmdList['dcc'][$cmdLower]['module'];
+ $class = $cmdList['file'][$module]['class'];
+ $func = $cmdList['dcc'][$cmdLower]['function'];
+
+ $class->$func($chat, $myArgs);
+
+ $chat->dccSend("ADMIN " . irc::myStrToUpper($cmdLower) . " Requested");
+ }
+ else
+ {
+ $chat->dccSend("Invalid Command: " . $myArgs['cmd']);
+ }
+
+ break;
+ }
+
+ }
+
+
+}
+?>
diff --git a/ircbot/modules/lw/lw_mod.conf b/ircbot/modules/lw/lw_mod.conf
new file mode 100644
index 0000000..44670c6
--- /dev/null
+++ b/ircbot/modules/lw/lw_mod.conf
@@ -0,0 +1,21 @@
+file lw_mod modules/lw/lw_mod.php
+
+priv !r true false false 0 lw_mod getRank
+priv !rank true false false 0 lw_mod getRank
+
+priv !civ true false false 0 lw_mod getCivRank
+priv !mil true false false 0 lw_mod getMilRank
+priv !fin true false false 0 lw_mod getFinRank
+priv !idr true false false 0 lw_mod getIDR
+
+priv !a true false false 0 lw_mod getAllianceRank
+priv !arank true false false 0 lw_mod getAllianceRank
+
+priv !t true false false 0 lw_mod nextTick
+priv !tick true false false 0 lw_mod nextTick
+
+priv !g true false false 0 lw_mod listGames
+priv !games true false false 0 lw_mod listGames
+
+priv !h true false false 0 lw_mod help
+priv !help true false false 0 lw_mod help
diff --git a/ircbot/modules/lw/lw_mod.php b/ircbot/modules/lw/lw_mod.php
new file mode 100644
index 0000000..e8340c2
--- /dev/null
+++ b/ircbot/modules/lw/lw_mod.php
@@ -0,0 +1,438 @@
+ticks as $tick) {
+ if (! $tick->definition->public) {
+ continue;
+ }
+ $tick->computeNext();
+ if (is_null($tick->next)) {
+ continue;
+ }
+ if (is_null($minTick) || $minTick->next > $tick->next) {
+ $minTick = $tick;
+ }
+ }
+
+ if (is_null($minTick)) {
+ $msg = "[" . BOLD . $game->text . BOLD . "] No more ticks on this game";
+ } else {
+ $msg = "[" . BOLD . $game->text . BOLD . "] Next tick: " . BOLD
+ . $minTick->definition->getName('en') . BOLD . " at " . BOLD
+ . gmstrftime("%H:%M:%S", $minTick->next) . BOLD;
+ if (gmstrftime("%Y-%m-%d", $minTick->next) != gmstrftime("%Y-%m-%d", time())) {
+ $msg .= " on " . BOLD . gmstrftime("%d/%m/%Y", $minTick->next) . BOLD;
+ }
+ }
+ }
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function listGames($line, $args) {
+ static $statusText = array(
+ "READY" => "open for registration",
+ "RUNNING" => "running",
+ "VICTORY" => "victory conditions reached",
+ "ENDING" => "being terminated",
+ "FINISHED" => "terminated"
+ );
+
+ $to = $line['fromNick'];
+
+ dbConnect();
+ foreach (config::getGames() as $game) {
+ if ($game->name == 'main' || $game->status() == 'PRE') {
+ continue;
+ }
+
+ $msg = "(" . BOLD . $game->name . BOLD . ") " . BOLD . $game->text . BOLD . " - Status: "
+ . BOLD . $statusText[$game->status()] . BOLD;
+ if ($game->status() == "READY") {
+ $msg .= " - Starting at " . BOLD . gmstrftime("%H:%M:%S", $game->firstTick())
+ . BOLD . " on " . BOLD . gmstrftime("%d/%m/%Y", $game->firstTick()) . BOLD;
+ } elseif ($game->status() == "ENDING") {
+ $msg .= " - Ending at " . BOLD . gmstrftime("%H:%M:%S", $game->lastTick())
+ . BOLD . " on " . BOLD . gmstrftime("%d/%m/%Y", $game->lastTick()) . BOLD;
+ }
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+ }
+
+ public function getRank($line, $args) {
+ list($player, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchGenRank($player, $game);
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Player " . BOLD . $player . BOLD
+ . ": " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ if (! is_null($rv[2])) {
+ $msg .= " - Overall round ranking: " . BOLD . "#{$rv[2]['ranking']}"
+ . BOLD . " (" . BOLD . number_format($rv[2]['points'])
+ . BOLD . " points)";
+ }
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Player " . BOLD . $player . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function getCivRank($line, $args) {
+ list($player, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchDetRank($player, $game, 'p_civ');
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Player " . BOLD . $player . BOLD
+ . " (civilisation): " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Player " . BOLD . $player . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function getFinRank($line, $args) {
+ list($player, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchDetRank($player, $game, 'p_financial');
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Player " . BOLD . $player . BOLD
+ . " (financial): " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Player " . BOLD . $player . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function getMilRank($line, $args) {
+ list($player, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchDetRank($player, $game, 'p_military');
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Player " . BOLD . $player . BOLD
+ . " (military): " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Player " . BOLD . $player . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function getIDR($line, $args) {
+ list($player, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchDetRank($player, $game, 'p_idr');
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Player " . BOLD . $player . BOLD
+ . " (inflicted damage): " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Player " . BOLD . $player . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+
+ private function getParams($line, $args) {
+ if ($args['nargs'] == 0) {
+ $player = $line['fromNick'];
+ $game = null;
+ } else {
+ $query = explode(' ', trim(preg_replace('/\s+/', ' ', $args['query'])));
+ if (preg_match('/^{[a-z0-9]+}$/', $query[0], $matches)) {
+ $game = preg_replace('/[{}]/', '', array_shift($query));
+ } else {
+ $game = null;
+ }
+ $player = join(' ', $query);
+ if ($player == '') {
+ $player = $line['fromNick'];
+ }
+ }
+ return array($player, $game);
+ }
+
+
+ private function fetchGenRank($player, $gameID) {
+ // Get the game
+ $game = is_null($gameID) ? config::getDefaultGame() : config::getGame($gameID);
+ if (is_null($game)) {
+ return 1;
+ }
+
+ // Access the rankings library
+ $rLib = $game->getLib('main/rankings');
+
+ // Get player ranking
+ $rType = $rLib->call('getType', 'p_general');
+ $genRank = $rLib->call('get', $rType, $player);
+ if (is_null($genRank['points'])) {
+ return 2;
+ }
+
+ // Try getting the overall round rankings
+ $rType = $rLib->call('getType', 'p_round');
+ $orRank = $rLib->call('get', $rType, $player);
+ if (is_null($orRank['points'])) {
+ $orRank = null;
+ }
+ return array($game->text, $genRank, $orRank);
+ }
+
+
+ private function fetchDetRank($player, $gameID, $type) {
+ // Get the game
+ $game = is_null($gameID) ? config::getDefaultGame() : config::getGame($gameID);
+ if (is_null($game)) {
+ return 1;
+ }
+
+ // Access the rankings library
+ $rLib = $game->getLib('main/rankings');
+
+ // Get player ranking
+ $rType = $rLib->call('getType', $type);
+ $rank = $rLib->call('get', $rType, $player);
+ if (is_null($rank['points'])) {
+ return 2;
+ }
+ return array($game->text, $rank);
+ }
+
+
+ public function getAllianceRank($line, $args) {
+ list($alliance, $game) = $this->getParams($line, $args);
+
+ dbConnect();
+ $rv = $this->fetchDetRank($alliance, $game, 'a_general');
+ dbClose();
+
+ if ($line['to'] == $this->ircClass->getClientConf('nick')) {
+ $to = $line['fromNick'];
+ } else {
+ $to = $line['to'];
+ }
+
+ if (is_array($rv)) {
+ $msg = "[" . BOLD . $rv[0] . BOLD . "] Alliance " . BOLD . $alliance . BOLD
+ . ": " . BOLD . "#{$rv[1]['ranking']}" . BOLD . " (" . BOLD
+ . number_format($rv[1]['points']) . BOLD . " points)";
+ } elseif ($rv == 1) {
+ $msg = "Game ID '" . BOLD . $game . BOLD . "' not found";
+ } elseif ($rv == 2) {
+ $msg = "Alliance " . BOLD . $alliance . BOLD . " not found";
+ }
+
+ $this->ircClass->sendRaw("PRIVMSG $to :$msg");
+ }
+
+ public function help($line, $args) {
+ $help = array(
+ "" => array(
+ "This bot allows you to get some information from the",
+ "Legacy Worlds game directly here, on IRC!",
+ " ",
+ "You can use any of the following commands:",
+ " ",
+ " " . BOLD . "Displaying rankings" . BOLD,
+ " " . BOLD . "rank" . BOLD . " - displays players' general and round rankings",
+ " " . BOLD . "civ" . BOLD . " - displays players' civilian rankings",
+ " " . BOLD . "mil" . BOLD . " - displays players' military rankings",
+ " " . BOLD . "fin" . BOLD . " - displays players' financial rankings",
+ " " . BOLD . "idr" . BOLD . " - displays players' inflicted damage rankings",
+ " " . BOLD . "arank" . BOLD . " - displays alliances' rankings",
+ " ",
+ " " . BOLD . "General information" . BOLD,
+ " " . BOLD . "games" . BOLD . " - lists available games",
+ " " . BOLD . "tick" . BOLD . " - displays the time and date of the next tick",
+ " " . BOLD . "help" . BOLD . " - help access",
+ " ",
+ "All commands must start with the '!' character. To get more",
+ "information on a specific command, type '!help '"
+ ),
+ "arank" => array(
+ "Syntax: " . BOLD . "!arank [{game}] tag",
+ " " . BOLD . "!a [{game}] tag",
+ " ",
+ "This command gives information about an alliance's ranking.",
+ " ",
+ "It is possible to select the game by adding the game's ID between",
+ "brackets just before the player's name.",
+ ),
+ "rank" => array(
+ "Syntax: " . BOLD . "!rank [{game}] [player]",
+ " " . BOLD . "!r [{game}] [player]",
+ " ",
+ "This command gives information about a player's general ranking",
+ "as well as his round ranking if he has one.",
+ " ",
+ "Using the command without parameters will cause the bot to look",
+ "for your current nick, if it's the same as your in-game name.",
+ " ",
+ "It is possible to select the game by adding the game's ID between",
+ "brackets just before the player's name.",
+ " ",
+ "Examples: !r TSeeker",
+ " -> Displays TSeeker's rankings in the default game",
+ " !r {b5m2}",
+ " -> Displays your rankings in Match 2",
+ ),
+ "civ" => array(
+ "Syntax: " . BOLD . "!civ [{game}] [player]",
+ " ",
+ "This command gives information about a player's civilisation",
+ "ranking.",
+ " ",
+ "Using the command without parameters will cause the bot to look",
+ "for your current nick, if it's the same as your in-game name.",
+ " ",
+ "It is possible to select the game by adding the game's ID between",
+ "brackets just before the player's name.",
+ " ",
+ "See also: " . BOLD . "!help rank" . BOLD
+ ),
+ "mil" => array(
+ "Syntax: " . BOLD . "!mil [{game}] [player]",
+ " ",
+ "This command gives information about a player's military",
+ "ranking.",
+ " ",
+ "Using the command without parameters will cause the bot to look",
+ "for your current nick, if it's the same as your in-game name.",
+ " ",
+ "It is possible to select the game by adding the game's ID between",
+ "brackets just before the player's name.",
+ " ",
+ "See also: " . BOLD . "!help rank" . BOLD
+ ),
+ "fin" => array(
+ "Syntax: " . BOLD . "!fin [{game}] [player]",
+ " ",
+ "This command gives information about a player's financial",
+ "ranking.",
+ " ",
+ "Using the command without parameters will cause the bot to look",
+ "for your current nick, if it's the same as your in-game name.",
+ " ",
+ "It is possible to select the game by adding the game's ID between",
+ "brackets just before the player's name.",
+ " ",
+ "See also: " . BOLD . "!help rank" . BOLD
+ ),
+ "tick" => array(
+ "Syntax: " . BOLD . "!tick [game]",
+ " " . BOLD . "!t [game]",
+ " ",
+ "This command displays the next tick.",
+ " ",
+ "It is possible to select the game by adding the game's ID",
+ "after the command.",
+ ),
+ "games" => array(
+ "Syntax: " . BOLD . "!games",
+ " " . BOLD . "!g",
+ " ",
+ "This command displays the list of available games.",
+ ),
+ );
+
+ $topic = $args['query'];
+ if (! array_key_exists($topic, $help)) {
+ $topic = "";
+ }
+
+ $to = $line['fromNick'];
+ for ($i = 0; $i < count($help[$topic]); $i ++) {
+ $this->ircClass->privMsg($to, $help[$topic][$i]);
+ }
+ }
+}
+
+?>
+
diff --git a/ircbot/modules/more_mods.txt b/ircbot/modules/more_mods.txt
new file mode 100644
index 0000000..c176cd7
--- /dev/null
+++ b/ircbot/modules/more_mods.txt
@@ -0,0 +1 @@
+For More Modules, see the website: http://www.phpbots.org
\ No newline at end of file
diff --git a/ircbot/modules/seen/seen_mod.conf b/ircbot/modules/seen/seen_mod.conf
new file mode 100644
index 0000000..40becc1
--- /dev/null
+++ b/ircbot/modules/seen/seen_mod.conf
@@ -0,0 +1,11 @@
+
+file seen_mod modules/seen/seen_mod.php
+
+privmsg seen_mod seen
+;notice seen_mod seen
+join seen_mod seen
+kick seen_mod seen
+part seen_mod seen
+quit seen_mod seen
+
+priv !seen true true true 0 seen_mod priv_seen
\ No newline at end of file
diff --git a/ircbot/modules/seen/seen_mod.php b/ircbot/modules/seen/seen_mod.php
new file mode 100644
index 0000000..fb0c31b
--- /dev/null
+++ b/ircbot/modules/seen/seen_mod.php
@@ -0,0 +1,234 @@
+ Seen Mod
+| > Module written by Manick
+| > Module Version Number: 0.1
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class seen_mod extends module {
+
+ public $title = "Seen Mod";
+ public $author = "Manick";
+ public $version = "0.1";
+
+ private $seen;
+
+ public function init()
+ {
+ $this->timerClass->addTimer("seen_mod_updateini", $this, "seen_update", "", 60*15, false);
+ $this->seen = new ini("modules/seen/seen.ini");
+ }
+
+ public function destroy()
+ {
+ $this->timerClass->removeTimer("seen_mod_updateini");
+ }
+
+ // Write to file
+ public function seen_update($args)
+ {
+ if ($this->seen->getError())
+ {
+ return;
+ }
+
+ $this->seen->writeIni();
+ $this->dccClass->dccSend("Updated Seen Mod ini database file");
+
+ return true;
+ }
+
+ // Update actions
+ public function seen($line, $args)
+ {
+ if ($this->seen->getError())
+ {
+ if (DEBUG == 1)
+ {
+ echo "Seen error!\n";
+ }
+ return;
+ }
+
+ if (strtolower($line['cmd']) == "join")
+ {
+ $line['text'] = "";
+ }
+
+ if (strtolower($line['cmd']) == "kick")
+ {
+ $offsetA = strpos($line['params'], chr(32));
+
+ $act = "kick";
+ $user = substr($line['params'], $offsetA + 1);
+
+ $this->addLast($user, $act, $line['text']);
+
+ }
+ else
+ {
+ $this->addLast($line['fromNick'], strtolower($line['cmd']), $line['text']);
+ }
+
+ $this->getLast($line['fromNick']);
+ }
+
+ private function getLast($user)
+ {
+ $user = irc::myStrToLower($user);
+
+ if (!$this->seen->sectionExists("seen"))
+ {
+ return;
+ }
+
+ $var = $this->seen->getIniVal("seen", $user);
+
+ if ($var == false)
+ {
+ return false;
+ }
+
+ $offsetA = strpos($var, "=");
+ $offsetB = strpos($var, "=", $offsetA + 1);
+ $offsetC = strpos($var, "=", $offsetB + 1);
+
+ $info = array();
+
+ $info['user'] = substr($var, 0, $offsetA);
+ $info['time'] = substr($var, $offsetA + 1, $offsetB - $offsetA - 1);
+ $info['act'] = substr($var, $offsetB + 1, $offsetC - $offsetB - 1);
+ $info['txt'] = substr($var, $offsetC + 1);
+
+ return $info;
+ }
+
+ private function addLast($user, $act, $txt)
+ {
+ $Suser = irc::myStrToLower($user);
+
+ $tAction = $user . "=" . time() . "=" . irc::myStrToLower($act) . "=" . $txt;
+ $this->seen->setIniVal("seen", $Suser, $tAction);
+ }
+
+ // User interface
+ public function priv_seen($line, $args)
+ {
+ if ($this->seen->getError())
+ {
+ $this->ircClass->notice($line['fromNick'], "There was an error while attempting to access the seen database.");
+ return;
+ }
+
+ if ($line['to'] == $this->ircClass->getNick())
+ {
+ return;
+ }
+
+ if ($args['nargs'] <= 0)
+ {
+ $this->ircClass->notice($line['fromNick'], "Usage: !seen ");
+ return;
+ }
+
+ $user = irc::myStrToLower($args['arg1']);
+
+ if ($user == irc::myStrToLower($line['fromNick']))
+ {
+ $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", umm... O..kay...");
+ $this->ircClass->action($line['to'], "points at " . $line['fromNick'] . "...");
+ return;
+ }
+
+ $data = $this->getLast($user);
+
+ if ($data === false)
+ {
+ $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", I have never seen " . $args['arg1'] . " before.");
+ return;
+ }
+
+ $time = time() - $data['time'];
+
+ if ($time > 3600*24)
+ {
+ $timeString = irc::timeFormat($time, "%d days %h hours %m min %s sec");
+ }
+ else if ($time > 3600)
+ {
+ $timeString = irc::timeFormat($time, "%h hours %m min %s sec");
+ }
+ else if ($time > 60)
+ {
+ $timeString = irc::timeFormat($time, "%m min %s sec");
+ }
+ else
+ {
+ $timeString = irc::timeFormat($time, "%s sec");
+ }
+
+ $action = "";
+
+ switch ($data['act'])
+ {
+ case "privmsg":
+ $action = "saying in a channel";
+ break;
+ case "notice":
+ $action = "noticing a channel";
+ break;
+ case "join":
+ $action = "joining a channel";
+ break;
+ case "kick":
+ $action = "being kicked from a channel";
+ break;
+ case "part":
+ $action = "parting a channel";
+ break;
+ case "quit":
+ $action = "quitting";
+ break;
+ }
+
+ if ($data['txt'] != "")
+ {
+ $action .= ": " . $data['txt'];
+ }
+
+ $this->ircClass->privMsg($line['to'], $line['fromNick'] . ", I last saw " . $data['user'] . " " . $timeString . " ago " . $action . ".");
+
+ }
+}
+
+?>
diff --git a/ircbot/modules/template.txt b/ircbot/modules/template.txt
new file mode 100644
index 0000000..4afaeb7
--- /dev/null
+++ b/ircbot/modules/template.txt
@@ -0,0 +1,39 @@
+";
+ public $author = "";
+ public $version = "";
+
+ public function init()
+ {
+ // Add your timer declarations and whatever
+ // else here...
+ }
+
+ public function destroy()
+ {
+ // Put code here to destroy the timers that you created in init()
+ // and whatever else cleanup code you want.
+ }
+
+ //Methods here:
+}
+
+?>
\ No newline at end of file
diff --git a/ircbot/parser.php b/ircbot/parser.php
new file mode 100644
index 0000000..f8311c2
--- /dev/null
+++ b/ircbot/parser.php
@@ -0,0 +1,1143 @@
+ parser module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class parser {
+
+ private $cmd;
+ private $args;
+ private $timers = array();
+
+ private $cmdList = array();
+ private $cmdTypes = array();
+
+ private $fileModified = array();
+ private $loadDefError = false;
+
+ //Classes
+ private $ircClass;
+ private $dccClass;
+ private $timerClass;
+ private $socketClass;
+ private $db;
+
+/* Part of easy alias idea I've been working on..., look below for large bit of commented out code
+ for info...
+
+ private $aliasArray = array( "notice" => "ircClass",
+ "privMsg" => "ircClass",
+ "action" => "ircClass",
+ "sendRaw" => "ircClass",
+ "getNick" => "ircClass",
+ "isOnline" => "ircClass",
+ "isMode" => "ircClass",
+ "isChanMode" => "ircClass",
+ "sendFile" => "dccClass",
+ "dccInform" => "dccClass",
+ "addTimer" => "timerClass",
+ "addListener" => "socketClass",
+ "removeTimer" => "timerClass",
+ );
+*/
+
+ public function __construct() {
+ $this->fileModified = array();
+ }
+
+ public function init()
+ {
+
+ if ($this->ircClass->getClientConf('functionfile') != "")
+ {
+ $this->loadFuncs($this->ircClass->getClientConf('functionfile'));
+ }
+
+ }
+
+ public function setDccClass($class)
+ {
+ $this->dccClass = $class;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setDatabase($class)
+ {
+ $this->db = $class;
+ }
+
+ public function getCmdList($type = "")
+ {
+ if ($type == "")
+ {
+ return $this->cmdList;
+ }
+ else
+ {
+ if (isset($this->cmdList[$type]))
+ {
+ return $this->cmdList[$type];
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ public function destroyModules()
+ {
+ if (is_array($this->cmdList) && count($this->cmdList) > 0)
+ {
+ if (isset($this->cmdList['file']) && is_array($this->cmdList['file']))
+ {
+ foreach ($this->cmdList['file'] AS $index => $data)
+ {
+ if (is_object($data['class']))
+ {
+ $data['class']->destroy();
+ }
+ }
+ }
+ }
+ }
+
+ private function readFile($file)
+ {
+
+ $configRaw = file_get_contents($file);
+
+ if ($configRaw === false)
+ {
+ if (DEBUG == 1)
+ {
+ echo "Could not find function file '$file' or error.\n";
+ }
+ $this->dccClass->dccInform("Could not find function file '$file' or error.");
+ return false;
+ }
+
+ return $configRaw;
+
+ }
+
+ public function include_recurse($file)
+ {
+ $configRaw = $this->readFile($file);
+
+ if ($configRaw === false)
+ {
+ return false;
+ }
+
+ $configRaw = preg_replace("/;(.*\n?)?/", "\n", $configRaw);
+ $configRaw = preg_replace("/~.*\n/", "", $configRaw);
+
+ $configRaw = trim($configRaw);
+
+ $lines = explode("\n", $configRaw);
+
+ $num = 0;
+ $lineNo = 1;
+ $extra = 0;
+ $fullLine = "";
+ foreach ($lines as $line)
+ {
+ $line = trim($line);
+
+ if ($line == "")
+ {
+ $lineNo++;
+ continue;
+ }
+
+ $line = trim($fullLine . " " . $line);
+
+ $newLine = $this->parseFunc($file, $lineNo, $line);
+
+ $lineNo += $extra + 1;
+ $extra = 0;
+ $fullLine = "";
+
+ if ($newLine === false)
+ {
+ continue;
+ }
+
+ if ($newLine['type'] == "type")
+ {
+ $this->cmdTypes[$newLine['typeArray']['name']]['numArgs'] = count($newLine['typeArray']);
+ $this->cmdTypes[$newLine['typeArray']['name']]['args'] = $newLine['typeArray'];
+ }
+ else if ($newLine['type'] == "include")
+ {
+ if (isset($newLine['typeArray'][0]))
+ {
+ $num += $this->include_recurse($newLine['typeArray'][0]);
+ }
+ else
+ {
+ if (DEBUG == 1)
+ {
+ echo "Malformed include line on line " . $lineNo . " of function file: " . $file . "\n";
+ }
+ $this->dccClass->dccInform("Malformed include line on line " . $lineNo . " of function file: " . $file);
+ }
+ }
+ else
+ {
+ if (!isset($newLine['typeArray']['name']))
+ {
+ $name = irc::randomHash() . "_" . rand(1,1024);
+ }
+ else
+ {
+ $name = $newLine['typeArray']['name'];
+ }
+
+ unset($newLine['typeArray']['name']);
+
+ $this->cmdList[$newLine['type']][$name] = $newLine['typeArray'];
+
+ if (isset($this->cmdList[$newLine['type']][$name]['usage']))
+ {
+ if (isset($oldCmdList[$newLine['type']][$name]['usage']))
+ {
+ $this->cmdList[$newLine['type']][$name]['usage'] = $oldCmdList[$newLine['type']][$name]['usage'];
+ }
+ }
+
+ }
+
+ $num++;
+ }
+
+ return $num;
+ }
+
+
+
+
+ public function loadFuncs($file)
+ {
+ $error = false;
+
+ clearstatcache();
+
+ $this->destroyModules();
+
+ $oldCmdList = $this->cmdList;
+ if (!is_array($oldCmdList))
+ {
+ $oldCmdList = array();
+ }
+
+ unset($this->cmdList);
+ unset($this->cmdTypes);
+ $this->cmdList = array();
+ $this->cmdTypes = array();
+
+ $this->dccClass->dccInform("Rehashing Function File, please wait...");
+ if (DEBUG == 1)
+ {
+ echo "Rehashing Function File, please wait...\n";
+ }
+
+ //Read in main function file
+ $num = $this->include_recurse($file);
+
+ //Book keeping
+ foreach ($this->cmdList AS $cmd => $data)
+ {
+ ksort($this->cmdList[$cmd]);
+ }
+
+ if (isset($this->cmdList['file']))
+ {
+ foreach ($this->cmdList['file'] AS $file => $data)
+ {
+
+ $classDef = $this->loadClassDef($data['filename'], $file);
+
+ if ($this->loadDefError == true)
+ {
+ $error = true;
+ }
+ $this->loadDefError = false;
+
+ if ($classDef === false)
+ {
+ continue;
+ }
+
+ //require_once($data['filename']);
+
+ $this->cmdList['file'][$file]['class'] = new $classDef;
+
+ $this->cmdList['file'][$file]['class']->__setClasses( $this->ircClass,
+ $this->dccClass,
+ $this->timerClass,
+ $this,
+ $this->socketClass,
+ $this->db
+ );
+ $this->cmdList['file'][$file]['class']->init();
+ }
+ }
+
+ $this->dccClass->dccInform("Successfully loaded " . $num . " functions into memory.");
+ if (DEBUG == 1)
+ {
+ echo "Successfully loaded " . $num . " functions into memory.\n";
+ }
+
+ return $error;
+
+ }
+
+ private function loadClassError($filename, $msg)
+ {
+ $this->ircClass->log("Error loading $filename: $msg");
+ $this->dccClass->dccInform("Error loading $filename: $msg");
+ }
+
+ /* Okay..
+ * This method is really freaking cool. It loads a module file with fopen, then
+ * it finds the classname, and gives it a random name (changes it) so that you can
+ * include functions you've changed multiple times without having to restart the bot!
+ * Also, easier names than having to use $this->ircClass->blah() all the time, you can
+ * just use blah()... These are defined in an array somewhere... I'm not sure where yet...
+ * because I haven't written that yet!!!!!!!!!!!!111oneone.
+ */
+
+ private function loadClassDef($filename, $classname)
+ {
+
+ $stat = stat($filename);
+
+ if ($stat === false)
+ {
+ $this->loadClassError($filename, "Could not find function file");
+ return false;
+ }
+
+ $modified = $stat['mtime'];
+
+ if (isset($this->fileModified[$filename]))
+ {
+ if ($modified == $this->fileModified[$filename]['modified'])
+ {
+ return $this->fileModified[$filename]['classdef'];
+ }
+ }
+
+ $fileData = file_get_contents($filename);
+
+ if ($fileData === false)
+ {
+ $this->loadClassError($filename, "Could not find function file");
+ return false;
+ }
+
+ //Okay, we have the module now.. now we need to find some stuff.
+
+ if (!preg_match("/class[\s]+?".$classname."[\s]+?extends[\s]+?module[\s]+?{/", $fileData))
+ {
+ $this->loadClassError($filename, "Could not find valid classdef in function file");
+ return false;
+ }
+
+ //Okay, our module is in the file... replace it with random hash.
+
+ $newHash = irc::randomHash();
+
+ $newClassDef = $classname . "_" . $newHash;
+
+ $fileData = preg_replace("/(class[\s]+?)".$classname."([\s]+?extends[\s]+?module[\s]+?{)/", "\\1" . $newClassDef . "\\2", $fileData);
+
+ /* Interesting idea, but lets leave it out for now
+ foreach($this->aliasArray AS $func => $class)
+ {
+ $fileData = preg_replace("/([=\n\(\t\s]+?)".$func."[\s\t\n\r]*?\(/s", "\\1\$this->" . $class . "->" . $func . "(", $fileData);
+ }
+ */
+
+ $success = eval("?>" . $fileData . "loadClassError($filename, "Error in function file");
+
+ /* Attempt to fallback on a previous revision that worked! */
+ if (isset($this->fileModified[$filename]))
+ {
+ $this->loadClassError($filename, "Using a cached version of the class definition");
+ $this->loadDefError = true;
+ return $this->fileModified[$filename]['classdef'];
+ }
+
+ return false;
+ }
+
+ $this->fileModified[$filename]['modified'] = $modified;
+ $this->fileModified[$filename]['classdef'] = $newClassDef;
+
+ return $newClassDef;
+
+ }
+
+ //Used to show array, as there seems to be some crazy bug in var_dump/print_r that
+ //shows EVERY variable in my program when I do var_dump($this->cmdList) or use print_r the same way
+ //This isn't used anywhere in the production copy of this script. (DEBUG ONLY!)
+ private function show_all($title, $array, $level)
+ {
+ echo $title . " = array(" . "\r\n";
+
+ foreach($array AS $index => $val)
+ {
+ for ($i = 0; $i < $level; $i++)
+ {
+ echo " ";
+ }
+
+ if (is_array($val))
+ {
+ $this->show_all($index, $val, $level + 1);
+ }
+ else if (is_object($val))
+ {
+ echo "[$index] => [object]\r\n";
+ }
+ else
+ {
+ echo "[$index] => [$val]\r\n";
+ }
+ }
+
+ for ($i = 0; $i < $level; $i++)
+ {
+ echo " ";
+ }
+
+ echo ")\r\n";
+
+ }
+
+ public function setCmdListValue($type, $cmd, $var, $value)
+ {
+ if (isset($this->cmdList[$type][$cmd][$var]))
+ {
+ $this->cmdList[$type][$cmd][$var] = $value;
+ return true;
+ }
+ return false;
+ }
+
+ private function parseFunc($file, $lineNo, $line)
+ {
+ $strings = array();
+ $line = str_replace("\t", " ", $line);
+
+ $quotes = array("'", "\"");
+
+ foreach($quotes AS $quote)
+ {
+ $currPos = 0;
+ $extraPos = 0;
+ while (($firstPos = strpos($line, $quote, $currPos)) !== false && substr($line, strpos($line, $quote, $currPos)-1, 1) != "\\")
+ {
+
+ while (($secondPos = strpos($line, $quote, $firstPos + 1 + $extraPos)) !== false && substr($line, strpos($line, $quote, $firstPos + 1 + $extraPos)-1, 1) == "\\")
+ {
+ $extraPos = $secondPos;
+ }
+
+ if ($secondPos === false)
+ {
+ if (DEBUG == 1)
+ {
+ echo "Syntax Error on line " . $lineNo . " of function file: " . $file . ". Expected '".$quote."', got end of line.\n";
+ }
+ $this->dccClass->dccInform("Syntax Error on line " . $lineNo . " of function file: " . $file . ". Expected '".$quote."', got end of line.");
+ return false;
+ }
+
+ $strings[$quote][] = substr($line, $firstPos + 1, $secondPos - $firstPos - 1);
+ $currPos = $secondPos + 1;
+ }
+ }
+
+ foreach ($strings AS $string)
+ {
+ $line = str_replace($string, "", $line);
+ }
+
+ $lineElements = explode(chr(32), $line);
+
+ $type = "";
+ $currElement = 0;
+ $typeArray = array();
+
+ foreach($lineElements AS $element)
+ {
+ if (trim($element) == "")
+ {
+ continue;
+ }
+
+ $currElement++;
+
+ if ($currElement == 1)
+ {
+ $element = irc::myStrToLower($element);
+
+ if ($element == "type")
+ {
+ $type = "type";
+ }
+ else if ($element == "include")
+ {
+ $type = "include";
+ }
+ else
+ {
+ if (isset($this->cmdTypes[$element]))
+ {
+ $type = $element;
+ }
+ else
+ {
+ if (DEBUG == 1)
+ {
+ echo "Error: Undefined type, '" . $element . "' on line " . $lineNo . " of function file: " . $file . "\n";
+ }
+ $this->dccClass->dccInform("Error: Undefined type, '" . $element . "' on line " . $lineNo . " of function file: " . $file . "");
+ return false;
+ }
+ }
+ continue;
+ }
+
+ if ($element == "\"\"")
+ {
+ $element = array_shift($strings["\""]);
+ }
+ else if ($element == "''")
+ {
+ $element = array_shift($strings["'"]);
+ }
+
+ $element = str_replace("\\" . "'", "'", $element);
+ $element = str_replace("\\" . '"', '"', $element);
+
+ if ($type == "type")
+ {
+ if ($currElement == 2)
+ {
+ $typeArray['name'] = $element;
+ }
+ else
+ {
+ $typeArray[] = $element;
+ }
+ }
+ else if ($type == "include")
+ {
+ $typeArray[] = $element;
+ }
+ else
+ {
+ if ($currElement > $this->cmdTypes[$type]['numArgs'])
+ {
+ if (DEBUG == 1)
+ {
+ echo "Error on line " . $lineNo . " of function file: " . $file . ", too many arguments\n";
+ }
+ $this->dccClass->dccInform("Error on line " . $lineNo . " of function file: " . $file . ", too many arguments");
+ return false;
+ }
+
+ $element = (irc::myStrToLower($element) == "true" ? true : $element);
+ $element = (irc::myStrToLower($element) == "false" ? false : $element);
+
+ $typeArray[$this->cmdTypes[$type]['args'][ $currElement - 2 ]] = $element;
+ }
+
+
+ }
+
+ if ($type != "type" && $type != "include")
+ {
+ if ($currElement < $this->cmdTypes[$type]['numArgs'])
+ {
+ if (DEBUG == 1)
+ {
+ echo "Error on line " . $lineNo . " of function file: " . $file . ", not enough arguments\n";
+ }
+ $this->dccClass->dccInform("Error on line " . $lineNo . " of function file: " . $file . ", not enough arguments");
+ return false;
+ }
+ }
+
+ return array('type' => $type, 'typeArray' => $typeArray);
+
+ }
+
+
+
+ public function parseDcc($chat, $handler)
+ {
+
+ $chat->readQueue = str_replace("\r", "", $chat->readQueue);
+
+// if (!($offSet = strpos($chat->readQueue, "\n")))
+// {
+// return false;
+// }
+// $rawLine = trim(substr($chat->readQueue, 0, $offSet));
+// $chat->readQueue = substr($chat->readQueue, $offSet + 1);
+
+ $rawLine = $chat->readQueue;
+ $chat->readQueue = "";
+
+ $this->ircClass->log("DCC Chat(" . $chat->nick . "): " . $rawLine);
+
+ $line = $this->createLine($rawLine);
+
+ if ($line == false)
+ {
+ return;
+ }
+
+ if ($handler != false)
+ {
+ if (is_object($handler))
+ {
+ $handler->handle($chat, $line);
+ return;
+ }
+ }
+
+ if ($chat->isAdmin == true && $chat->verified == false)
+ {
+ if (md5($line['cmd']) == $this->ircClass->getClientConf('dccadminpass'))
+ {
+ $this->dccClass->dccInform("DCC: " . $chat->nick . " has successfully logged in.");
+ $chat->verified = true;
+ $chat->dccSend("You have successfully logged in.");
+
+ }
+ else
+ {
+ $chat->dccSend("Invalid password, bye bye.");
+ $this->dccClass->disconnect($chat);
+ }
+ return;
+ }
+
+ $cmdLower = irc::myStrToLower($line['cmd']);
+
+ if (isset($this->cmdList['dcc'][$cmdLower]))
+ {
+ if ($this->cmdList['dcc'][$cmdLower]['admin'] == 1 && !$chat->isAdmin)
+ {
+ $chat->dccSend("Request Denied. You must have admin access to use this function.");
+ return;
+ }
+
+ if ($line['nargs'] < $this->cmdList['dcc'][$cmdLower]['numArgs'])
+ {
+ $chat->dccSend("Usage: " . $cmdLower . " " . $this->cmdList['dcc'][$cmdLower]['usage']);
+ return;
+ }
+
+ $module = $this->cmdList['dcc'][$cmdLower]['module'];
+ $class = $this->cmdList['file'][$module]['class'];
+ $func = $this->cmdList['dcc'][$cmdLower]['function'];
+
+ $class->$func($chat, $line);
+
+ if ($chat->isAdmin)
+ {
+ $chat->dccSend("ADMIN " . irc::myStrToUpper($cmdLower) . " Requested");
+ }
+ else
+ {
+ $chat->dccSend("CLIENT " . irc::myStrToUpper($cmdLower) . " Requested");
+ }
+ }
+ else
+ {
+ $chat->dccSend("Invalid Command: " . $line['cmd']);
+ }
+
+ }
+
+
+ public static function createLine($rawLine)
+ {
+
+ $line = array();
+ $rawLineArray = explode(chr(32), $rawLine);
+ $lineCount = count($rawLineArray);
+
+ if ($lineCount < 1)
+ {
+ return false;
+ }
+ else if ($lineCount == 1)
+ {
+ $line['cmd'] = irc::myStrToLower($rawLine);
+ $line['nargs'] = 0;
+ $line['query'] = "";
+ }
+ else
+ {
+ $line['nargs'] = 0;
+ $line['cmd'] = irc::myStrToLower(array_shift($rawLineArray));
+ while (($arg = array_shift($rawLineArray)) !== NULL) // NULL fixed contributed by cortex, 05/01/05
+ {
+ if (trim($arg) == "")
+ {
+ continue;
+ }
+
+ $line['arg' . ++$line['nargs']] = $arg;
+ if ($line['nargs'] > MAX_ARGS-1)
+ {
+ break;
+ }
+ }
+ $line['query'] = trim(substr($rawLine, strlen($line['cmd']) + 1));
+ }
+
+ return $line;
+
+ }
+
+ public function parseLine($line)
+ {
+ if (DEBUG==1)
+ {
+ //print_r($line);
+ }
+
+ if ($this->ircClass->checkIgnore($line['from']))
+ {
+ return;
+ }
+
+ switch($line['cmd'])
+ {
+ case "PRIVMSG":
+ $args = $this->createLine($line['text']);
+ $cmdLower = irc::myStrToLower($args['cmd']);
+ if (isset($this->cmdList['priv'][$cmdLower]))
+ {
+ if ($this->cmdList['priv'][$cmdLower]['active'] == true)
+ {
+ $theCase = $this->ircClass->floodCheck($line);
+
+ switch ($theCase)
+ {
+ case STATUS_NOT_BANNED:
+ if ($this->cmdList['priv'][$cmdLower]['inform'] == true)
+ {
+ $this->dccClass->dccInform("Sending " . irc::myStrToUpper($line['text']) . " to " . $line['fromNick']);
+ }
+ $this->cmdList['priv'][$cmdLower]['usage']++;
+ $func = $this->cmdList['priv'][$cmdLower]['function'];
+ $module = $this->cmdList['priv'][$cmdLower]['module'];
+ $class = $this->cmdList['file'][$module]['class'];
+
+ if ($this->ircClass->getTextQueueLength() > 5)
+ {
+ $this->ircClass->notice($line['fromNick'], "Request Queued. Please wait " . $this->ircClass->getTextQueueLength() . " seconds for your data.", 0);
+ }
+
+ $class->$func($line, $args);
+ break;
+ case STATUS_JUST_BANNED:
+ $this->ircClass->notice($line['fromNick'], "Flood Detected. All of your queues have been discarded and you have been banned from using this bot for ". $this->ircClass->getClientConf('floodtime') . " seconds.");
+ $this->dccClass->dccInform("BAN: (*!". irc::myStrToUpper($line['fromHost']) . "): " . $line['fromNick'] . " is on ignore for " . $this->ircClass->getClientConf('floodtime') . " seconds.");
+ break;
+ case STATUS_ALREADY_BANNED:
+ break;
+ }
+ }
+ else
+ {
+ $this->dccClass->dccInform("FUNCTION: " . $line['fromNick'] . " attempted to use deactivated command '" . $cmdLower . "'");
+ }
+ }
+ else
+ {
+ if ($line['to'] == $this->ircClass->getNick())
+ {
+ if (strpos($line['text'], chr(1)) !== false)
+ {
+ $this->ircClass->floodCheck($line);
+ $this->parseCtcp($line);
+ }
+ else
+ {
+ $this->dccClass->dccInform("PRIVMSG: <" . $line['fromNick'] . "> " . $line['text']);
+ }
+ }
+ else
+ {
+ if (strpos($line['text'], chr(1)) !== false)
+ {
+ $this->parseCtcp($line, "CHAN: " . $line['to']);
+ }
+ else
+ {
+ $chanData = $this->ircClass->getChannelData($line['to']);
+
+ if ($chanData == NULL)
+ {
+ $this->dccClass->dccInform("CHAN PRIVMSG [".$line['to']."]: <" . $line['fromNick'] . "> " . $line['text']);
+ }
+ }
+ }
+ }
+ break;
+
+ case "MODE":
+ break;
+
+ case "NOTICE":
+ $chan = $line['to'] != $this->ircClass->getNick() ? ":" . $line['to'] : "";
+ $this->dccClass->dccInform("NOTICE: <" . ($line['fromNick'] == "" ? $line['from'] : $line['fromNick']) . $chan . "> " . $line['text']);
+ break;
+
+ case "JOIN":
+ if ($line['fromNick'] == $this->ircClass->getNick())
+ {
+ $this->dccClass->dccInform("Joined: " . irc::myStrToUpper($line['text']));
+ }
+ break;
+
+ case "PART":
+ if ($line['fromNick'] == $this->ircClass->getNick())
+ {
+ $this->dccClass->dccInform("Parted: " . irc::myStrToUpper($line['to']));
+ }
+ break;
+
+ case "KICK":
+ if ($line['params'] == $this->ircClass->getNick())
+ {
+ $this->dccClass->dccInform("Kicked: " . $line['fromNick'] . " kicked you from " . $line['to']);
+ }
+ break;
+
+ case "ERROR":
+ $this->dccClass->dccInform("Server Error: " . $line['text']);
+ break;
+
+ case "366":
+ $params = explode(chr(32), $line['params']);
+ $channel = $params[0];
+ $this->dccClass->dccInform("Finished receiving NAMES list for " . $channel);
+ break;
+
+ case "005":
+ if ($this->ircClass->getServerConf("NETWORK") != "")
+ {
+ //Only show this once...
+ if (strpos($line['params'],"NETWORK") !== false)
+ {
+ $this->dccClass->dccInform("Parsing IRC-Server specific configuration...");
+ $this->dccClass->dccInform("Network has been identified as " . $this->ircClass->getServerConf("NETWORK") .
+ "(" . $line['from'] . ")");
+ }
+ }
+ break;
+
+ case "315":
+ $params = explode(chr(32), $line['params']);
+ $this->dccClass->dccInform("Finished receiving WHO list for: " . $params[0]);
+ break;
+
+ case "368":
+ $params = explode(chr(32), $line['params']);
+ $this->dccClass->dccInform("Finished receiving ban list for: " . $params[0]);
+ break;
+
+ case "433":
+ $this->dccClass->dccInform("Nick collision! Unable to change your nick. Nickname already in use!");
+ break;
+
+ default:
+ break;
+
+ }
+
+ // Lets alias 004 to CONNECT, for the n00bs
+
+ if ($line['cmd'] == "004")
+ {
+ $line['cmd'] = "connect";
+ }
+ if ($line['cmd'] == "error")
+ {
+ $line['cmd'] = "disconnect";
+ }
+
+ // Action type handler
+ if (isset($this->cmdList['action']) && strtolower($line['cmd']) == "privmsg")
+ {
+ if (substr($line['text'], 0, 8) == chr(1) . "ACTION ")
+ {
+ $newLine = $line;
+ $newLine['text'] = substr($line['text'], 8, strlen($line['text']) - 9);
+
+ $sArgs = $this->createLine($newLine['text']);
+
+ foreach($this->cmdList['action'] AS $item)
+ {
+ $func = $item['function'];
+ $class = $this->cmdList['file'][$item['module']]['class'];
+ $class->$func($newLine, $sArgs);
+ }
+ }
+ }
+
+ // Raw type handler
+ if (isset($this->cmdList['raw']))
+ {
+ if (!isset($args))
+ {
+ $args = $this->createLine($line['text']);
+ }
+
+ foreach($this->cmdList['raw'] AS $item)
+ {
+ $func = $item['function'];
+ $class = $this->cmdList['file'][$item['module']]['class'];
+ $class->$func($line, $args);
+ }
+ }
+
+
+ // Here we will call any type
+
+ if (isset($this->cmdList[irc::myStrToLower($line['cmd'])]))
+ {
+ if (!isset($args))
+ {
+ $args = $this->createLine($line['text']);
+ }
+
+ foreach($this->cmdList[irc::myStrToLower($line['cmd'])] AS $item)
+ {
+ $func = $item['function'];
+ $class = $this->cmdList['file'][$item['module']]['class'];
+ $class->$func($line, $args);
+ }
+ }
+
+ if (isset($args))
+ {
+ unset($args);
+ }
+
+ }
+
+
+ /* Misc Functions */
+
+ private function parseCtcp($line, $msgs = "PRIVMSG")
+ {
+ $cmd = str_replace(chr(1), "", $line['text']) . " ";
+ $query = trim(substr($cmd, strpos($cmd, chr(32)) + 1));
+ $cmd = substr(irc::myStrToLower($cmd), 0, strpos($cmd, chr(32)));
+
+ $msg = "";
+
+ switch($cmd)
+ {
+ case "version":
+ $this->dccClass->dccInform("CTCP VERSION: " . $line['fromNick'] . " versioned us.");
+ break;
+
+ case "time":
+ $this->dccClass->dccInform("CTCP TIME: " . $line['fromNick'] . " requested the time.");
+ break;
+
+ case "uptime":
+ $this->dccClass->dccInform("CTCP UPTIME: " . $line['fromNick'] . " requested our uptime.");
+ break;
+
+ case "ping":
+ $this->dccClass->dccInform("CTCP PING: " . $line['fromNick'] . " pinged us.");
+ break;
+
+ case "dcc":
+ $vars = explode(chr(32), $query);
+ $this->dccParse($line, $vars, $query);
+ break;
+
+ }
+
+ if ($msg != "")
+ {
+ $this->notice($this->lVars['fromNick'], chr(1) . $msg . chr(1));
+ }
+
+ if (isset($this->cmdList['ctcp'][$cmd]))
+ {
+ $func = $this->cmdList['ctcp'][$cmd]['function'];
+ $class = $this->cmdList['file'][$this->cmdList['ctcp'][$cmd]['module']]['class'];
+ $args = $this->createLine($cmd . " " . $query);
+ $class->$func($line, $args);
+ }
+
+ }
+
+ function dccParse($line, $vars, $txt)
+ {
+ $cVars = count($vars);
+
+ if ($cVars < 1)
+ {
+ return;
+ }
+
+ $cmd = irc::myStrToUpper($vars[0]);
+
+ switch ($cmd)
+ {
+ case "CHAT":
+ if ($cVars == 4)
+ {
+ $iplong = long2ip( (double) $vars[2]);
+ $port = $vars[3];
+ $this->dccClass->addChat($line['fromNick'], $iplong, (int) $port, false, null);
+ }
+ break;
+ case "SEND":
+ if ($this->ircClass->getClientConf('upload') != 'yes')
+ {
+ $this->ircClass->notice($line['fromNick'], "DCC: I do not accept dcc transfers at this time.", 0);
+ break;
+ }
+ if ($cVars >= 5)
+ {
+ //Some bastard sent a file with spaces. Shit. Ass.
+ if (strpos($query, chr(34)) !== false)
+ {
+ $first = strpos($query, chr(34));
+ $second = strpos($query, chr(34), $first + 1);
+ $filename = substr($query, $first + 1, $second - $first - 1);
+ $query = str_replace("\"".$filename."\"", "file.ext", $query);
+ $vars = explode(chr(32), $query);
+ }
+ else
+ {
+ $filename = $vars[1];
+ }
+
+ $iplong = long2ip( (double) $vars[2]);
+ $port = $vars[3];
+ $filesize = $vars[4];
+
+ $this->dccClass->addFile($line['fromNick'], $iplong, (int) $port, DOWNLOAD, $filename, $filesize);
+ }
+ break;
+ case "ACCEPT":
+ if ($cVars == 4)
+ {
+ $port = $vars[2];
+ $bytes = $vars[3];
+ $this->dccClass->dccAccept($port, $bytes);
+ }
+ break;
+ case "RESUME":
+ if ($cVars == 4)
+ {
+ $port = $vars[2];
+ $bytes = $vars[3];
+ $this->dccClass->dccResume($port, $bytes);
+ }
+ break;
+ }
+
+ }
+
+}
+
+/* Used to access dcc admin commands via private message */
+class chat_wrapper {
+
+ public $nick;
+ private $ircClass;
+ public $isAdmin;
+
+ public function __construct($nick, $ircClass)
+ {
+ $this->nick = $nick;
+ $this->ircClass = $ircClass;
+ $this->isAdmin = 1;
+ }
+
+ public function dccSend($data, $to = null)
+ {
+ $this->ircClass->privMsg($this->nick, "--> " . $data);
+ }
+
+ public function disconnect($msg = "")
+ {
+ $this->ircClass->privMsg($this->nick, "Right........");
+ }
+
+}
+
+?>
diff --git a/ircbot/queue.php b/ircbot/queue.php
new file mode 100644
index 0000000..e41101c
--- /dev/null
+++ b/ircbot/queue.php
@@ -0,0 +1,339 @@
+ queue module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+/* This module is my response to a big problem. PHP-IRC, on idling, would use
+ * 2.0% or more of the CPU on a 500mhz machine. This annoyed me, and I decided
+ * to do something about it. So, I changed the way that PHP-IRC works, from a
+ * "round-robin" approach to an "interrupt" type approach. Whenever something
+ * happens, say, new data is read from a socket, a process Queue is added with
+ * a pointer to the function that reads input for that socket; or for
+ * another example, if a file transfer is in effect, and new data is read from
+ * that socket, but we also have a dcc chat going, we will only handle data for
+ * the file transfer, instead of wasting CPU cycles on the dcc chat, like is
+ * currently done in <=2.1.1. I've learned a bit more about timers and socket
+ * timeouts since then. Also, we have to handle timers in a different way now.
+ * There will still be a "timers" class, for re-occuring processes, but the
+ * next timer is inserted into this process queue, and the callback for the timer
+ * will be a pointer to the timer class which handles the timer. Then, the timer
+ * class will do the appropriate stuff for the timer, and then add the next timer
+ * into the process Queue. --Manick
+ *
+ * P.S.; I never knew this would change so much code... I figured adding in select()
+ * timeouts would be a piece of cake... until I realized that my whole framework
+ * was incompatible with the idea. What a pain in the ass -_-.
+ */
+
+ /* Module Written 11/30/04 by Manick */
+
+class processQueue {
+
+ private $numQueued;
+ private $queuedItems;
+ private $currProc;
+
+ function __construct()
+ {
+ $this->queuedItemsArray = array();
+ $this->queuedItems = NULL;
+ $this->currProc = NULL;
+ $this->numQueued = 0;
+ }
+
+ public function getNumQueued()
+ {
+ return $this->numQueued;
+ }
+
+ public static function getMicroTime()
+ {
+ return microtime(true);
+ }
+
+ /* Only allow removal of entire irc class (as in we shut down the bot.. otherwise, we don't
+ want to deal with shutting down specific queues during the queueing process. Have the callbacks
+ handle that themselves. We only have to worry when the callbacks won't exist anymore, as when an
+ irc bot is shut down, and the ircclass is discarded
+ */
+ public function removeOwner($class)
+ {
+ $next = NULL;
+
+ for ($queue = $this->queuedItems; $queue != NULL; )
+ {
+ $next = $queue->next;
+
+ if ($queue->owner === $class)
+ {
+ $this->removeQueue($queue);
+ }
+
+ $queue = $next;
+
+ }
+ }
+
+ /* Remove reference to queued item, let PHP5 do the rest */
+ private function removeQueue($item)
+ {
+ if ($item->prev == NULL)
+ {
+ $this->queuedItems = $item->next;
+
+ if ($item->next != NULL)
+ {
+ $item->next->prev = NULL;
+ }
+ }
+ else
+ {
+ $item->prev->next = $item->next;
+
+ if ($item->next != NULL)
+ {
+ $item->next->prev = $item->prev;
+ }
+ }
+
+ $item->removed = true;
+
+ unset($item->args);
+ unset($item->owner);
+ unset($item->callBack_class);
+ unset($item->next);
+ unset($item->prev);
+
+ unset($item);
+
+ $this->numQueued--;
+ }
+
+ /* Add an item to the process queue */
+ public function addQueue($owner, $class, $function, $args, $nextRunTime)
+ {
+// echo "Queue Added: $function with $nextRunTime\n";
+
+ if ($function == "" || $function == NULL)
+ {
+ return false;
+ }
+
+ if (!is_object($class))
+ {
+ $class = null;
+ }
+
+ $nextRunTime = floatval($nextRunTime);
+
+ $queue = new queueItem;
+
+ $queue->args = $args;
+ $queue->owner = $owner;
+ $queue->removed = false;
+ $queue->callBack_class = $class;
+ $queue->callBack_function = $function;
+ $queue->nextRunTime = self::getMicroTime() + $nextRunTime;
+
+ //Now insert as sorted into queue
+
+ $prev = NULL;
+
+ for ($item = $this->queuedItems; $item != NULL; $item = $item->next)
+ {
+ if ($queue->nextRunTime < $item->nextRunTime)
+ {
+ break;
+ }
+
+ $prev = $item;
+ }
+
+ if ($item == NULL)
+ {
+ if ($prev == NULL)
+ {
+ $queue->next = NULL;
+ $queue->prev = NULL;
+ $this->queuedItems = $queue;
+ }
+ else
+ {
+ $queue->next = NULL;
+ $queue->prev = $prev;
+ $prev->next = $queue;
+ }
+ }
+ else
+ {
+ if ($item->prev == NULL)
+ {
+ $queue->next = $this->queuedItems;
+ $queue->prev = NULL;
+
+ $item->prev = $queue;
+ $this->queuedItems = $queue;
+ }
+ else
+ {
+ $queue->next = $item;
+ $queue->prev = $item->prev;
+
+ $item->prev = $queue;
+ $queue->prev->next = $queue;
+ }
+ }
+
+ //Okay, we're inserted, return true;
+
+ $this->numQueued++;
+
+ return true;
+ }
+
+ public function displayQueue()
+ {
+ //Used for debug
+ echo "Current Time: " . self::getMicroTime() . "\n";
+
+ echo "\n\n";
+ for ($i = $this->queuedItems; $i != NULL; $i = $i->next)
+ {
+ echo $i->callBack_function . "-" . $i->nextRunTime . "\n";
+ echo "---" . "Prev: " . $i->prev . " Next: " . $i->next . " Me: " . $i . "\n";
+ }
+ echo "\n\n";
+ }
+
+ /* Handle the process queue, return the time until the next item */
+ public function handle()
+ {
+ // Handle all items with $queue->nextRunTime < getMicroTime(), then return with time until next item must
+ // be run
+
+ // Populate a runQueue with all current items that need to be run. We need to do this because some of these
+ // callback functions might add another process to the queue, and if the runtime is < 0, we would run that item
+ // instead of timing out before we do. If we have something like a file transfer, this could be a bad thing.
+ $runQueue = array();
+
+ $time = self::getMicroTime();
+
+ for ($item = $this->queuedItems; $item != NULL; $item = $item->next)
+ {
+ if ($item->nextRunTime <= $time)
+ {
+ $runQueue[] = $item;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ //Okay, now run each item.
+
+ foreach ($runQueue AS $index => $item)
+ {
+ if (!is_object($item) || $item->removed === true)
+ {
+ if (is_object($item))
+ {
+ unset($item);
+ }
+ continue;
+ }
+
+ self::handleQueueItem($item);
+ }
+
+ unset($runQueue);
+
+ //Return time until next item needs to be run, or true if there are no queued items
+ //Hmm, true returned here, means we'll just sleep for like an hour or something until data
+ //is recieved from the sockets, because we have no active timers
+ if ($this->queuedItems == null)
+ {
+ return true;
+ }
+
+ //Get new time
+ $time = self::getMicroTime();
+
+ $timeTillNext = $this->queuedItems->nextRunTime - $time;
+
+ if ($timeTillNext < 0)
+ {
+ $timeTillNext = 0;
+ }
+
+ //When zero is returned, we'll always sleep at least 50000 usec in the socket class anyway
+ return $timeTillNext;
+
+ }
+
+ /* Specific function to deal with queued items */
+ private function handleQueueItem($item)
+ {
+ $this->currTimer = $item;
+
+ $class = $item->callBack_class;
+ $func = $item->callBack_function;
+
+ //Call the callback function! Now the callback function will check all possible triggers,
+ //such as socket input, etc, and add new queued items if it needs more processing/other processing
+
+ if ($class == null)
+ {
+ $status = $func($item->args);
+ }
+ else
+ {
+ $status = $class->$func($item->args);
+ }
+
+ //If true is returned from the function, then keep the bitch in the queue. This is useful when a
+ //function has not completed processing (i.e., irc->connection waiting on socket class to return
+ //the fact that its connected.
+
+ if ($item->removed !== true && $status !== true)
+ {
+ self::removeQueue($item);
+ }
+
+ }
+
+}
+
+?>
diff --git a/ircbot/readme.txt b/ircbot/readme.txt
new file mode 100644
index 0000000..69de0ae
--- /dev/null
+++ b/ircbot/readme.txt
@@ -0,0 +1,1364 @@
++---------------------------------------------------------------------------
+| PHP-IRC v2.2.1 Service Release
+| ========================================================
+| by Manick
+| (c) 2001-2006 by http://www.phpbots.org/
+| Contact: manick@manekian.com
+| irc: #manekian@irc.rizon.net
+| ========================================
+| Special Contributions were made by:
+| cortex
++---------------------------------------------------------------------------
+| > Documentation
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+
+NOTE! Please enable word-wrap to view this file.
+NOTE! PLEASE READ SECTION '3. Installation - A few things to consider' BEFORE USING.
+
+Please visit our new mods/forums website here: http://www.phpbots.org/
+
+Table of Contents
+-----------------
+
+1. Introduction and Release Notes
+1-a. What's new in 2.2.1!
+1-b. Features
+2. Included
+3. Installation - A few things to consider
+3-a. Quick Install
+3-b. Installing PHP 5
+3-c. Using alternate PHP.INI (PHP Configuration) file
+3-d. Installing PHP-IRC
+4. Configuration
+5. Running
+6. Remote Administration (via DCC and Private Message)
+7. File Transfer
+7-a. File Transfer behind a firewall or NAT
+8. Modules and User-defined functions
+8-a. Submitting modules for others to download
+9. Querying outside servers (alternative to fopen, fsockopen, etc) READ THIS if you need this functionality!
+9-a. Basic Queries, using the addQuery() function
+9-b. Intro to Connection Class, Advanced Queries
+10. Custom DCC Chat Sessions
+10-a. Custom DCC Chat Example: Simple File Server (SFS)
+11. Database support
+11-a. Mysql Database
+11-b. Postgre Database
+11-c. Serverless, mIRC compatible ini-file based Database
+12. Timers
+13. Multiple servers under one process
+14. Provided Sample Modules
+14-a. IMDB Parser
+14-b. Quotes mod with mysql/ini file system
+14-c. Simple http server
+14-d. Bash.org Parser
+14-e. News System/Rules Script
+14-f. Seen System (beta!)
+14-g. Request Ads System
+15. Function Reference
+16. Special Thanks
+
+=================================
+1. Introduction and Release Notes
+=================================
+Please visit our new website: http://www.phpbots.org/ for support and user-submitted modules.
+
+PHP-IRC is a totally php based irc bot meant to automate some applications related to irc. I've personally programmed several modules which I currently use on irc.rizon.net. This version is my attempt at bringing such a device to the public. I hope you find it as useful as I do. I have begun work on a module submission site which will be hosted at http://www.phpbots.org once finished. I have already recieved modules from serveral enthusiastic people wishing to contribute in some way to the project. Thank you for your time and effort.
+
+It has always been my opinion that IRC scripting has long needed a simple programming interface that people with already existent skills could utilize. There are two main reasons that PHP was selected as the primary language. First off, I wanted to provide novice programmers a way to code their own functions and algorithms into a powerful platform without having to worry about such things as memory management and compilers. Secondly, I wanted to do something that no one has done before--create a fully featured bot in php. I don't know if I will ever complete the second objective, but I will keep on developing, as it will always be the main goal of this project.
+
+If I have left out information in this file, or there is something I said that confused you, please email me your concerns at manick@manekian.com, and I will try to clarify where you were confused. This will also help me determine what I need to fix in this file for the next version.
+
+
+=========================
+1-a. What's new in 2.2.1!
+=========================
+As this is a service update and not a full release, the readme file included below has not been altered from the 2.2.0 version. Version 2.2.1 brings several bug fixes (which are viewable in changes.txt).
+
+Development on PHP-IRC is not halted, simply stalled, as I am approaching the culmination of my college career. Thank you for your continued interest in PHP-IRC.
+
+We have a new website! Please view it here: http://www.phpbots.org/
+
+=============
+1-b. Features
+=============
+For a full list of current major features, please visit: http://www.phpbots.org/
+
+===========
+2. Included
+===========
+
+Core Files:
+ ==============
+ Config Files
+ --------------
+ bot.conf
+ function.conf
+ typedefs.conf (added 2.2.0)
+ modules/default/priv_mod.conf (added 2.2.0)
+ modules/default/dcc_mod.conf (added 2.2.0)
+ ==============
+ Readme Files
+ --------------
+ readme.txt
+ modules/template.txt (added 2.1)
+ gpl.txt (added 2.1)
+ command_reference.txt (added 2.1.1)
+ changes.txt (added 2.1.1)
+ upgrade-2.1.1-2.2.0.txt (added 2.2.0)
+ install.txt (added 2.2.0)
+ ==============
+ Source code
+ --------------
+ bot.php
+ chat.php (added 2.1)
+ connection.php (added 2.2.0)
+ dcc.php
+ defines.php (added 2.0.1/2)
+ error.php
+ file.php (added 2.1)
+ irc.php
+ module.php (added 2.2.0)
+ parser.php
+ queue.php (added 2.2.0)
+ remote.php (added 2.2.0)
+ socket.php
+ timers.php
+ modules/default/dcc_mod.php (added 2.1)
+ modules/default/priv_mod.php (added 2.1)
+
+==========================================
+3. Installation - A few things to consider
+==========================================
+
+I've been getting a lot of emails and private messages on rizon about how to run this bot via a web browser. However, most webhosts do not compile php with socket support enabled, and for that matter, most web hosts don't have php5 as of yet. Even so, in order to start the bot, you have to specify a config file on the command line. Thus, running this bot from a web browser without modification is impossible. I will not make this possible, so in other words, please stop asking.
+
+Another thing that might deter people from using this script is the enourmous memory requirement by php to keep
+a script loaded in memory. PHP5 loads all of the program and everything it could possibly use into memory. This can take up quite a bit of space! I've had a bot use 8 megs of ram on the low end, and up to 15 megs on the high end. If you don't mind dropping 15 megs of ram for this bot, then continue on. Otherwise, don't whine to me that its a resource hog. I believe the advantages far outweigh the disadvantages--how else could I have gotten this far?
+
+In order to run this bot, you must have shell access to the box you will be running it on. For instructions on how to install php5 for use with this bot, please see the next section, "Installing PHP 5".
+
+A note about errno constants:
+-----------------------------
+
+In unix/windows/etc, when trying to write or read from a socket sometimes (a socket is the connection between your computer and another computer), errors occur. In order to be able to determine what these errors are, all systems have something called 'errno' constants. Unfortunatly, PHP5 does not know these constants, so we have to set them manually in order for this program to run. In the defines.php file, I have set common values for windows, freebsd, linux, and unix. If you are using one of these systems, an autodetection script should take care of detecting which system you are running the bot on, and set the appropriate values. If this does not work, and you cannot connect to a server, you may need to set your OS type to either "windows", "freebsd", "linux", or "unix". If you do not experience problems with this, then skip down to "Installing PHP 5". Otherwise, keep reading.
+
+I have run this successfully on Windows XP, Mandrake 9.0 Linux, and Debian. If this program does not work with any of the os settings for OS in defines.php, you need to find the correct values for EAGAIN, EINPROGRESS, EALREADY, and EISCONN(these are those error constants that I was talking about earlier) for your system.
+
+They are usually in /usr/include. You can find them by using a command sequence such as this:
+
+-------------------------------------------------------------------------------
+grep -r 'EAGAIN' /usr/include/*
+grep -r 'EINPROGRESS' /usr/include/*
+grep -r 'EALREADY' /usr/include/*
+grep -r 'EISCONN' /usr/include/*
+-------------------------------------------------------------------------------
+
+After doing this, you'll get a line that looks like this:
+
+-------------------------------------------------------------------------------
+/usr/include/asm/errno.h:#define EISCONN 106 /* Transport endpoint is already connected */
+-------------------------------------------------------------------------------
+
+The constant we are looking for is 106. Now, after finding all those numbers, go into defines.php. Set your OS type to "unknown"; then, scroll down a bit till you find this code:
+
+-------------------------------------------------------------------------------
+if ($OS == 'unknown')
+{
+ define('EAGAIN', 0); /* Try again */
+ define('EISCONN', 0); /* Transport endpoint is already connected */
+ define('EALREADY', 0); /* Operation already in progress */
+ define('EINPROGRESS', 0); /* Operation now in progress */
+}
+-------------------------------------------------------------------------------
+
+Now, change the numbers, etc, with the corresponding values you got when you found the constants above. Do this with all four constants, and then move on to the next section.
+
+==================
+3-a. Quick Install
+==================
+
+Running php-irc consists of 6 general steps (EXPERTS ONLY!):
+
+1) Download and unpack, compile the php 5 5.0.2+ package with sockets and pcntl.
+2) Edit the php.ini file following the steps in section 3-b (bottom half of section under "First, locate this line in the file:")
+3) Unzip php irc
+4) If the bot does not start up and connect to the server, you may have to set the OS parameter in the defines.php file. Read the previous section.
+5) Change server/port information in bot.conf. You can run php-irc with the -c switch to get an md5 password hash to set dccadminpass with.
+6) run php-irc with: /path/to/php/php.exe bot.php bot.conf from the php-irc directory, or edit the shebang line and change it to reflect your php location, (also use -c switch to specify php.ini location), and then chmod the bot.php file 755, and run with ./bot.php bot.conf
+
+Of course, I recommend that you read the rest of this file, as it provides some very important information.
+
+=====================
+3-b. Installing PHP 5
+=====================
+
+Please read the following notices before continuing to install:
+
+Notice 1:
+---------
+Do not use this bot with alpha/beta versions of php5. I have successfully run it on rc2/rc3, however.
+
+Notice 2:
+---------
+Do not use this bot with php 5.0.0 or 5.0.1. These versions have a bug which makes it work incorrectly. If you would like to find out more about this bug, view this page: http://bugs.php.net/bug.php?id=28892
+
+Installation: (see below for installations on linux)
+
+---------------------
+Installing on Windows
+---------------------
+Download PHP5 from this location: 'http://www.php.net/downloads.php'. Select the latest PHP 5 zip package under "Windows Binaries". Unzip this to a folder, c:\php, for instance.
+
+Then, copy the included 'php.ini-dist' file in the c:\php directory to 'c:\windows\php.ini'. Open this file with notepad or your favorite text editor. (Usually, you can right click the file and hit 'open with').
+
+First, locate this line in the file:
+---------------------------------------------------------------------------
+; This directive tells PHP whether to declare the argv&argc variables (that
+---------------------------------------------------------------------------
+
+A few lines below this, you'll see this directive:
+--------------------------------
+register_argc_argv
+--------------------------------
+Make sure that this line says:
+--------------------------------
+register_argc_argv = On
+--------------------------------
+
+Now, locate this line:
+--------------------------------
+extension_dir = "./"
+--------------------------------
+Change this to:
+--------------------------------
+extension_dir = "./ext"
+--------------------------------
+
+If you are going to use a mysql database, find:
+------------------------
+;extension=php_mysql.dll
+------------------------
+And change to:
+------------------------
+extension=php_mysql.dll
+------------------------
+
+Then find:
+--------------------------------
+;extension=php_sockets.dll
+--------------------------------
+And change to:
+--------------------------------
+extension=php_sockets.dll
+--------------------------------
+
+You are now set to run PHP-IRC. See section "Configuration" for information related to configuring the bot.
+
+-------------------
+Installing on Linux
+-------------------
+Download php from php website, here: 'http://www.php.net/downloads.php'. Select the latest php5 tar.gz package under "Complete Source Code".
+
+Extract this file. To do this, copy the file to your home directory. Then, extract it using this command:
+
+tar -zxf php-.tar.gz
+
+Replace with your version of PHP. Make sure it is 5.0.2 or greater!
+Now, run this command:
+
+cd php-/
+
+Also make sure to replace with your php5 version.
+Now, we have a few things to consider here. Do you want to run a mysql database or not? If you do, then use this command:
+
+./configure --enable-sockets --enable-pcntl --with-mysql
+
+However, if you do not have mysql installed on your system, do this:
+
+./configure --enable-sockets --enable-pcntl
+
+If for any reason this fails, please read below. If it does not, skip these next few paragraphs.
+
+Usually the configure script fails when it cannot find a module or package it needs to compile. Sometimes I have had it fail with the 'XML LIB' package, saying it could not be found. In order to rectify this, use this command:
+
+./configure --help
+
+And then search through the output, looking for the package that failed. See if there is a --disable- option that you can add to the ./configure command above, which will make it skip that package. Then, run the configure command again, until you remove all packages that do not work with your system.
+
+Continuing on
+-------------
+
+Now, after you see the "Thanks for using PHP" message, run the following command:
+
+make
+
+After this is completed, you are all done installing php! You will need to copy the binary to a usable and NON WEB ACCESSABLE directory, by using this command:
+
+cp sapi/cli/php //
+
+Where is the directory you wish to copy it to. When I say NON WEB ACCESSABLE, I mean that you could not access this file directly from the web.
+
+You are now set to run PHP-IRC. See section "Configuration" for information related to configuring the bot.
+
+=====================================================
+3-c. Using alternate PHP.INI (PHP Configuration) file
+=====================================================
+
+You may be running another version of php on the server that you run this on specifically for apache, or some other purpose. In this case, you already have a php.ini file in /etc. You can use an alternate php.ini file by using this syntax when running php:
+
+/path/to/php.exe -c /dir/of/php.ini/ bot.php bot.conf
+
+If on linux, you can also chmod bot.php 755, and then edit the #! line at the top of the file to look like this:
+
+#!/path/to/php -c /dir/of/php.ini/
+
+And then you can run php-irc like this:
+
+./bot.php bot.conf
+
+=======================
+3-d. Installing PHP-IRC
+=======================
+If you are reading this file, you have already downloaded and unpacked the source package from sourceforge.net. Good, the hard part is out of the way. Continue on to the next section.
+
+
+================
+4. Configuration
+================
+
+PHP5
+----
+Please see above, our guide to "installing php 5" for configuration options to php.ini.
+
+defines.php
+-----------
+The main things you need to look at in here is DEBUG mode and OS. DEBUG 1 will make it so everything that happens to the bot is printed in the main window. DEBUG 0 will instead print it to a logfile specified in bot.conf. Make sure that you set your OS to either linux, unix, windows or bsd, otherwise your bot won't run (if autodetection fails).
+
+The lines you need to change are:
+
+define('DEBUG', 1);
+
+and:
+
+define('OS', 'windows');
+
+You might also want to change the name of the PID file that is written when you run the bot in background mode. You can edit that filename with this line:
+
+define('PID', "bot.pid");
+
+bot.conf
+--------
+Edit this file and change all the options to your liking. Of special interest should be natip, which allows you to work from behind a nat. Also, as of 2.1, pay special attention to the 'upload' and 'uploaddir' parameters. You can accept file transfers with those. Please also look at dccadminpass. You will need to set this in order to use dcc chat or private message administration of your bot. You will need to run 'bot.php -c password' to generate an md5 password hash of 'password'.
+
+function.conf
+-------------
+This file is a little more complicated. php-irc will respond to various text typed in a channel (triggers). You can configure those triggers in this file. Please see the section titled "Modules and User-defined functions" for help with this file.
+
+At this point, you should be able to start up your bot--although it won't do much. See the section "Modules and User-defined functions" for information about adding functionality.
+
+
+==========
+5. Running
+==========
+Running this bot is rather simple.
+
+Windows:
+--------
+
+Run the bot with the following command:
+
+c:\php\php.exe bot.php bot.conf
+
+Make sure that this is the correct path that php is in. You may need to change 'c:\php' to the directory where your php5's php.exe resides. Make sure, also, that you are located in your php-irc main directory when you start the bot. i.e.,
+
+cd
+
+I have a little trick. I make a windows shortcut (.lnk file) to php.exe, and put it in my php-irc directory. Then I edit the shortcut and make sure that my working directory is my php-irc directory. Then, I can run the bot as such:
+
+php.lnk bot.php bot.conf
+
+Linux:
+------
+The basic syntax is:
+
+/path/to/php5/php bot.php bot.conf
+
+If you followed my php5 installation instructions, /path/to/php5/ would be the that we talked about earlier.
+
+Linux Alternative:
+
+You can edit the #! line in bot.php to reflect your php cgi binary location, and 'chmod 755 bot.php'. This will make 'bot.php' executable. You can then run it as such:
+
+./bot.php bot.conf
+
+You can also run several different configurations under the same process. Simply make another bot.conf file and then run it like this:
+
+./bot.php bot.conf bot2.conf
+
+If you are on linux/unix, you can also run in the background by using the -b switch:
+./bot.php -b bot.conf
+However, in order for this to work, you need to set DEBUG mode to 0 in defines.php. (otherwise your bot won't spawn) Also keep in mind that errors will not be displayed when in background mode. Although text is logged to log.txt or whatever file you choose, the errors are not. I will work on this for future versions. However, if you're going to be doing a lot of debugging and are going to want to see all errors, you may want to keep DEBUG=1 and then use a program such as nohup to start the bot:
+
+nohup ./bot.php bot.conf
+
+If this doesn't work as expected, delete the 'fclose(STDOUT)' line in bot.php and try running it like this:
+
+nohup ./bot.php bot.conf -b
+
+
+======================================================
+6. Remote Administration (via DCC and Private Message)
+======================================================
+
+You can administer your bot via private messages (i.e., /msg php-irc ), or via dcc chat interface. However, in order to use these features, make sure that the 'dccadminpass' setting in bot.conf is uncommented, (remove the ';'), and make sure that you change the password to something people can't guess. You need to specify a password hash here, and you can do that by running:
+
+Windows
+-------
+drive:\path\to\php.exe bot.php -c
+
+*nix
+----
+/path/to/php bot.php -c
+
+Where is your password you wish to use. This will generate an md5 hash of '', and you can replace the dccadminpass setting in bot.conf with this value.
+
+Via private message, you can access admin commands like so (if you are using mIRC):
+
+/msg admin
+
+Where is the nick of your bot, is the password you selected for dccadminpass, and is the command you will use. You can get a list of commands by using the command 'help'.
+
+To use the dcc chat administration interface, use:
+
+/msg admin chatme
+
+The bot should then send you a dcc chat request. You will have to type in your password to validate your session, which is just the password you set with dccadminpass again. Then, you can type 'help' for a list of commands.
+
+
+================
+7. File Transfer
+================
+
+This bot supports file transfers now. I will implement a speed capping system in a later version. For right now, you can send/recieve files at your max bw potential. Really fast transfers (in the line of 100 mbit) take up nearly 99% of your CPU, however. The system supports resume, as well as the mIRC File Server protocol (see below for configuration)
+
+To send someone a file, use:
+
+SEND /path/to/file
+
+You can use 'DCC' for speed/eta, although it doesn't work very well. Its based off of 3 second averages. Oh, and you can use 'CLOSE id' to close a specific transfer. These id's are the numbers between the brackets ([ and ]) when you run the 'DCC' command.
+
+NOTE! This may be a security risk, as people with admin access could send themselves any file on your computer with it. You may want to disable this function in the function.conf file if you feel this may be a problem. (just comment it out by putting a ';' in front of the line, or removing the line completely)
+
+===========================================
+7-a. File Transfer behind a firewall or NAT
+===========================================
+
+To setup the bot to work behind a NAT (i.e., you are a computer behind a router, and you do not have a net-accessable IP, like 192.168.1.100), you can use the 'natip' setting in bot.conf. Then, you can set the 'dccrangestart' item to choose what port file transfers will use for outsiders to connect. Normally, the bot will use port 1024+, but if you are using forwarded ports, you can set this setting to use those ports.
+
+If you are behind a firewall, and cannot use the natip feature:
+This bot also supports the mIRC reverse dcc protocol. The mIRC File Server protocol can be turned on by uncommeting the 'mircdccreverse' setting in bot.conf. The 59 there is just the port that you will connect to. Common numbers are 59 and 212.
+
+=====================================
+8. Modules and User-defined functions
+=====================================
+
+Modules are what add the functionality to php-irc. You can run php-irc by itself, and it may come with some pre-programmed features, but other than that it doesn't do much. You need to extend it by adding modules that other people have written, or by writing modules yourself. In this section, I will attempt to guide you through the process of doing just that.
+
+Modules reside in the 'modules/' directory. I have several modules in this directory already, and you can read about them in the section "Provided Sample Modules".
+
+A php-irc module is a user defined class inside of a file in the modules/ directory. See "template.txt" in the modules/ directory for instructions on how to setup a class. The basic declaration of a module class is as follows:
+
+class class_name extends module {
+
+ //Other stuff, can be found in template.txt
+
+}
+
+This declaration syntax is INCREDIBLY important. You MUST have the format:
+
+class[space]class_name[space]extends[space]{
+
+In order for the dynamic module support in PHP-IRC 2.2.0 to work, class definitions for modules must be defined in this way. If you have outside classes to include, you must include them with "require_once()", instead of "require()".
+
+Now, say that we created a module; we copied template.txt to my_mod.php, and changed "class_name" to "my_mod" inside my_mod.php. Now, we will have to declare this module inside function.conf.
+
+function.conf
+-------------
+There are three main types of directives that you can set in this file. Types, Commands, and Includes. A "Type" statement is a statement which declares a format for a "Command" to use.
+
+For instance, if I had a type, "notice", and I wanted it to have the arguments "module", and "function", I would do this as follows:
+
+type notice module function
+
+Now, I can create commands that use type "notice". Here is an example of a command that uses type "notice":
+
+notice my_mod my_function
+
+Thus, whenever a "notice" event took place on IRC, the function "my_function" in "my_mod" would be run with various useful parsed parameters passed. (Discussed Later)
+
+Note the "module" and "function" arguments. These are required arguments. This means for every single type declared, there must be a "module" and "function" argument specified, because if these didn't exist, what would be the point of catching the event?
+
+"Include" statements specify external function files to include into the main function.conf file. They are useful when packaging a module with several function.conf statements. Instead of copying/pasting all the statements on installation of the module, one need only to instruct a user to include a statement such as this:
+
+include modules/my_mod.conf
+
+Now to get a little more complicated:
+-------------------------------------
+In addition to parsing standard irc messages and events and defining functions to parse them, the bot comes with 4 standard types. These types are "priv", "dcc", "ctcp", and "file". The "file" type is used to include module files and their associated functions into the bots runtime code. The "ctcp" type makes parsing mIRC's "/ctcp" commands simpler. This could also be done by using a "privmsg" type and then parsing the line manually (to remove the ctcp characters), but its simpler to just do it this way. The "priv" type handles text typed in a channel. Thus, we can capture "!ad" or other triggers with this. The "dcc" type handles text typed in the standard user and admin dcc chat interface.
+
+file
+----
+You use this to declare and include modules into php-irc. The syntax is as follows:
+
+file - the type
+name - the module (or name of the class in the file)
+filename - the filename to include (the file that the class resides in)
+
+Example:
+
+file priv_mod modules/priv_mod.php
+
+Filenames with spaces can be enclosed with quotes:
+
+file priv_mod "modules/My totally kick ass mod.php"
+
+priv
+----
+The "priv" type comes with several parameters, each explained below:
+
+priv - the type
+name - the trigger typed into the channel, i.e., "!ad"
+active - whether this particular function is active (can be triggered)
+ when the bot starts up
+inform - Inform the administrator (through dcc chat interface, when the admin
+ is logged in) that someone used this function.
+canDeactivate - admin can deactivate this function using FUNCTION command in dcc interface
+usage - how many times this function was used
+module - the module that the function is located in
+function - the function in the module specified above that is run
+
+An example of a command that uses the "priv" type is defined below:
+
+priv !ad true true true 0 priv_mod priv_ad
+
+The "!ad" command uses the function "priv_ad" in the "priv_mod" module. So whenever someone types in a channel:
+
+!ad
+
+The priv_ad function in priv_mod will be called to handle the arguments and respond to the user.
+
+dcc
+---
+The "dcc" type comes with several parameters, each explained below:
+
+dcc - the type
+name - the command typed, i.e., "HELP"
+numArgs - the expected number of arguments for this command
+usage - a string containing an overview of arguments, i.e., ""
+help - a string containing information about what the command does
+admin - whether this command is only available in the admin interface, or can be used in the standard user dcc chat interface
+module - the module that the function is located in
+function - the function in the module specified above that is run
+section - the section the command is displayed in in dcc chat interface (explained below)
+
+An example of a command that uses the "dcc" type is defined below:
+
+dcc raw 1 "" "Sends raw query to server" true dcc_mod dcc_raw standard
+
+You might also notice that in this case we used quotes. Quotes can be used for any string longer than 1 word. Single and Double quotes are allowed. Escape double/single quotes inside the quotes with a backslash: i.e., "Who\'s there?". This does not follow the standard convention for escaping quotes. So, even if you use double quotes to specify a multi-word string, you must still escape single quotes.
+
+section
+-------
+In the dcc command above, the "section" argument was used, and specified as "standard". PHP-IRC 2.2.0 comes with a new ability to package dcc commands with sections. Thus, when someone types "Help" in dcc chat, all of the functions are organized by category.
+
+A section can be declared with the following arguments:
+
+name - a small idname to be used in 'dcc' statements
+longname - a usually quoted string which speicfies this sections title
+
+PHP-IRC comes with a few pre-defined sections which include 'standard', 'channel', 'dcc', 'info', 'admin', and 'comm'. The declaration for the standard section type is shown below:
+
+section standard "Standard Functions"
+
+You can of course specify your own sections in the same manner; say, for a custom module perhaps.
+
+ctcp
+----
+This is a shortcut to parsing commands sent to this bot with mIRC's /ctcp command. The format is as follows:
+
+ctcp - the type
+name - the trigger, i.e., "files" (see fileserver example in function.conf)
+module - the module that the function is located in
+function - the function in the module specified above that is run
+
+See the fileserver ctcp command in modules/fileserver/fileserver.conf for an example.
+
+Now that you know what function.conf is and how it works:
+---------------------------------------------------------
+
+Suppose we have a random function in a module we've written, such as the one defined in the next section titled "Querying Outside Servers" named "query". Having the functon is all fine and dandy, but how do we access it? That is where function.conf comes in. We will specify a trigger which can be used to access the query function during runtime. First, we have to include our module:
+
+file my_mod modules/my_mod.php
+
+We'll pretend that this is where the 'query' function resides for the moment. Now, lets say we want to run that function every time someone types '!info' in the channel. To do this, we would add (below all the type declarations, and below the 'file' declaration we just made above):
+
+priv !info true true true 0 my_mod query
+
+Thus, every time someone typed !info in the channel, the function 'query' would run. This is the main basis for php-irc. It is the heart of its purpose--responding to triggers.
+
+Creating Functions to Respond to Triggers
+-----------------------------------------
+Now that you know how to create modules, and specify them in function.conf, we will now cover writing your own functions to handle these triggers. There are four main types of functions that you will write. "timer" functions, "standard" functions, "query" functions, and "dcc" functions.
+
+standard
+--------
+Standard functions are the functions which handle all the non-dcc type command statements declared in function.conf. Remember our example earlier, when a user could type '!info' in the channel. This triggered the 'query' function in the module 'my_mod'. A sample declaration of this function could be:
+
+ public function query($line, $args)
+ {
+ //your code
+ }
+
+Notice the "$line, $args". The declarations for 'query', 'dcc', and 'timer' functions all use different values here. They are shown below:
+
+ public function standard($line, $args)
+ public function query($line, $args, $result, $response)
+ public function timer($arguments)
+ public function dcc($chat, $args)
+
+Definitions of variables
+------------------------
+
+$line
+-----
+Line is an array containing a parsed version of the raw line sent from the server. A raw line sent from the server could look like this:
+
+:Manick!~bugs@Rizon-2EFC6E17.resnet.purdue.edu PRIVMSG #manekian :!ad
+
+We need to parse this into meaningful parts in order to do anything with the bot. The $line array does that:
+from => full nick/ident/host, in this case: "Manick!~bugs@Rizon-2EFC6E17.resnet.purdue.edu"
+fromNick => only nick, in this case, "Manick"
+fromHost => only host, in this case, "Rizon-2EFC6E17.resnet.purdue.edu"
+fromIdent => The Ident of the user, in this case, "~bugs"
+cmd => irc command used, (i.e., PRIVMSG, NOTICE, 366, 353, etc), in this case "PRIVMSG"
+to => who this command was directed at (channel or your nick), in this case, "#manekain"
+text => everything after : in the line; basically the text of what someone says, in this case, "!ad"
+params => useful when parsing 'mode' commands etc. in this case, ":!ad"
+raw => the full untouched line.
+
+To access an element in $line, reference it as such: $line['element'], such as:
+
+$line['fromNick']
+
+This would return "Manick", in this case. Sometimes these variables are not populated perfectly. In a particular circumstance, you can use:
+
+print_r($line);
+
+by itself to to print the contents of the $line variable to the screen while in debug mode.
+
+$args
+-----
+This is a simple array created from the $line['text'] variable. It contains the following data:
+
+nargs => the number of arguments
+cmd => the command used
+arg1 => present if there are 1 arguments or more
+arg2 => present if there are 2 arguments or more
+arg3 => present if there are 3 arguments or more
+arg4 => present if there are 4 arguments or more
+query => The full text (all of args put together)
+(there are no more after arg4..)
+
+So, if I typed "!ad 60 Here is an ad that I want to talk about...":
+
+nargs would be "4" (yes, 4)
+cmd would be "!ad"
+arg1 would be "60"
+arg2 would be "Here"
+arg3 would be "is"
+arg4 would be "an"
+query would be "60 Here is an ad that I want to talk about..."
+
+The maximum arguments can be set by the MAX_ARGS define in the defines.php. It was chosen to be four for performance reasons.
+
+$result
+-------
+This is discussed in the next section "Querying Remote Servers"
+
+$response
+---------
+This is discussed in the next section "Querying Remote Servers"
+
+$arguments
+----------
+When creating a timer, you can specify one argument, whether it be a string, array, or object, to send to a timer function every time that timer runs. Timers are discussed in a later section.
+
+$chat
+-----
+This is the object containing the current session of the user who typed the command in the dcc chat window. $args for dcc functions is the same as $args above.
+
+Sending messages and responding to users
+----------------------------------------
+
+After you've received a query and processed it, you might want to send back information. There are several functions that can be used to do just that:
+
+$this->ircClass->sendRaw($text); //send raw data to server
+$this->ircClass->notice($line['fromNick'], $text, $queue = 1); // (where $queue defaults to 1.. meaning its not
+ // sent right away.
+$this->ircClass->privMsg($line['fromNick'], $text, $queue = 1); // $line['fromNick'] can also be the channel
+ // which is usually $line['to'].
+$this->ircClass->action($line['fromNick'], $text, $queue = 1); // does the '/me' thing that mIRC does
+
+To send data to dcc users, use:
+
+$chat->dccSend("text here");
+
+To send a CTCP messege, do this:
+
+$cmd = "VERSION";
+$msg = "";
+$this->ircClass->privMsg($line['fromNick'], chr(1) . trim(strtoupper($cmd) . " " . $msg) . chr(1));
+
+Where $cmd is the command, like "VERSION", or "ACTION", and $msg is the parameters to the command.
+
+$queue
+------
+php-irc maintains a text queue, so that it does not flood the server with text. This is not a perfect system, and still fails ocassionaly, but works for the most part. If $queue is set to 1, or not specified at all, then $text will be appened to the end of the queue waiting to be sent to the server. Otherwise, if you set it to 0, it will be prepended to the beginning of the text queue.
+
+
+Now you should know all you need to know to write your own modules for php-irc.
+
+
+
+
+==============================================
+8-a. Submitting modules for others to download
+==============================================
+
+I am currently working on a site to submit modules. This site will be http://www.phpbots.org when finished.
+
+===========================
+9. Querying outside servers
+===========================
+
+You may need to read the section titled: "Modules and User-defined functions" before reading this.
+
+Sometimes when programming a module, you might find it necessary to parse some webpage to return some data to a user requesting it. Your first impression might be to use "fopen" or "fsockopen" to make a connection to the webserver and get the data.
+
+Consider something for a moment. This bot is running on one process, one thread. Say that you were sending a file to someone, and you also went to query a webpage. What if the webpage was extremely bogged down with traffic? The query would block, and the file transfer would stall. To rectify this, I implemented a few procedures for querying outside servers, including webservers. This eliminates the blocking problem, as the connections are handled by php-irc.
+
+There are two basic ways to communicate with the outside world easily in PHP-IRC.
+
+1) Use $this->ircClass->addQuery()
+2) Utilize the connection class manually
+
+The addQuery() method is a specialized way of using the 'connection' class to get the job done. In other words, you could write your own connection.php class method that does exactly what addQuery does, or even more if you wanted. The irc bot itself uses the connection class to connect to irc servers, run dcc chats, and even run file transfers. You can even use the connection class to start a listening socket, which can be used to write servers such as http servers, ftp servers, or pretty much anything that uses a tcp socket.
+
+=================================================
+9-a. Basic Queries, using the addQuery() function
+=================================================
+
+This method is used mostly for retrieving data from http servers. It's main advantage is that it is incredibly easy to use, but the main disadvantage is that you can only send one query per connection, and then data related to that query is returned before the connection is terminated.
+
+The basic procedure is this: You will run a function with a query, and specify what function to run when data has been recieved from that server. Then, the function, using a specifically defined prototype, will have access to all the data + results from the server as soon as the query is complete.
+
+Functions used in this process are:
+
+irc::addQuery($host, $port, $query, $line, $class, $function)
+socket::generateGetQuery($query, $host, $path, $httpVersion = "1.0") <-- $httpVersion can be omitted
+socket::generatePostQuery($query, $host, $path, $httpVersion = "1.0") <-- $httpVersion can be omitted
+
+These functions, (addQuery, generateGetQuery, and generatePostQuery) are outlined in the command_reference.txt file. But here is how it works:
+
+For instance, if you wanted to parse data at animenfo.com, you would do this:
+
+Define a function in your module file. We'll call it "query" for now. Also, see the previous section for information about how to make this method accessable (by editing function.conf)
+
+ public function query($line, $args)
+ {
+ $query = "search=naruto&queryin=anime_titles&action=Go&option=smart";
+ $getQuery = socket::generateGetQuery($query, "www.animenfo.com", "/search.php");
+ $this->ircClass->addQuery("www.animenfo.com", 80, $getQuery, $line, $this, "queryTwo");
+ }
+
+Notice the "queryTwo". Now define another function in your module file. We'll call it "queryTwo".
+
+ public function queryTwo($line, $args, $result, $response)
+ {
+
+ }
+
+The function, "queryTwo" will be run as soon as a response is recieved from the server, and the response will be stored in the '$response' variable. The result of the query will be stored in the '$result' variable. For instance, if there was an error on query, $result will equal QUERY_ERROR, and the error message will be stored in $response. If there is no error, $result will equal QUERY_SUCCESS.
+
+Notice
+------
+As of version 2.1.1, the socket::httpGetQuery, and socket::httpPostQuery functions were removed. They were replaced with the addQuery function.
+
+================================================
+9-b. Intro to Connection Class, Advanced Queries
+================================================
+
+As the development of PHP-IRC 2.2.0 continued, a need for a connection layer to the socket class appeared. Code was being repeated often in the irc bot class, the dcc class, and other places; in addition, it was becoming quite cluttered and hard to understand. Also, the old way just simply didn't work anymore with the process queue method implmented in 2.2.0. Therefore, the connection class was implemented to solve this problem.
+
+The connection class serves as a layer between the socket class and the user. A user can create a connection, specify a host and port, and the connection class will do everything else automatically; connect, send read/write events, accept connections, close connections, and much more. This works by specifying a callback class, with pre-named, user-defined functions to accept events from the socket class. Say, for example, whenever data is read for a specifc socket, that sockets user-assigned connection class will notify the callback class of an event, say, onRead(), and then the onRead() function in the callback class can read the data.
+
+Here's a simple schematic:
+
++--------------+ +------------------+ +----------------+
+| Socket Class |->Triggers->| Connection Class |->Triggers->| Callback Class |
++--------------+ +------------------+ +----------------+
+
+The callback class can then use socket class functions, such as getQueueLine(), or what have you, to retrieve data from the socket read queue, or send data using the appropriate function.
+
+General Overview
+----------------
+There are two specific ways to run the connection class:
+
+1) Open connection to other server specifying host and port
+2) Listen for connections on a specific or random port, accepting new connections
+
+The ins and outs of the callback class will then be explained.
+
+Method One - Connecting to another server
+-----------------------------------------
+For this method, one needs 3 things, with the fourth being optional:
+
+1) Host
+2) Port
+3) Connection timeout
+4) Transfer timeout
+
+The connection timeout is how long before the connection class will think that it cannot connect to the server before timing out, and the transfer timeout is how long (after a connection has connected) before the connection class believes the connection to have failed after no activity.
+
+Say you wanted to connect to "www.animenfo.com" on port "80". First, you need to declare a new connection:
+
+ $conn = new connection("www.animenfo.com", "80", CONNECT_TIMEOUT);
+
+CONNECT_TIMEOUT is just the default connect timeout used by the irc class. You can use whatever integer/float number you want.
+
+ $this->conn = $conn;
+
+You need some way of remembering this connection; in this case, the call back class will be the one that the connection is created in. In most cases, you will need to make a whole new class because of the need for unique functions to handle the events of any general connection.
+
+ $conn->setSocketClass($this->socketClass);
+ $conn->setIrcClass($this->ircClass);
+ $conn->setTimerClass($this->timerClass);
+
+The connection class needs access to these three classes, socket class, irc class, and timer class.
+
+ $conn->setCallbackClass($this);
+
+This is probably the most important call of all. Whenever an event happens for this connection, specific functions in this class will be called to handle the event. This is explained more thouroughly below in the "Ins and Outs" of the callback class sub-section.
+
+ $conn->init();
+
+This will try to create the socket with the socket class.
+
+Also, optionally here you can specify transfer timeout. That would look like this:
+
+ $conn->setTransTimeout($timeout);
+
+Where $timeout is in seconds or fractions of seconds.
+
+ if ($conn->getError())
+ {
+ $this->ircClass->notice($line['fromNick'], "Error connecting: " . $conn->getErrorMsg() );
+ }
+
+If there was a problem init()'ing the connection, then $conn->getError() will be true, and $conn->getErrorMsg() will be why.
+
+ $this->sockInt = $conn->getSockInt();
+
+The sockInt is necessary to use socket class functions for this socket.
+
+ $conn->connect();
+
+The final step, this will start the connection process to the server.
+
+Method Two - Listening for Connections
+--------------------------------------
+This method follows reletively the same method as for connecting to a server. There are two slight differences:
+
+1) Specify the host as null when creating a connection, and specify the connect timeout as zero.
+
+ $conn = new connection(null, "80", 0);
+
+You can change the "80" to null to listen on a random port.
+
+2) Do not run $conn->connect();
+
+This function is used ONLY when connecting to a server. It has no purpose otherwise.
+
+The Ins and Outs of the Callback Class
+--------------------------------------
+Okay, so now we know how to create a listening connection or a connect connection. Now what do we do with it? We have to have some way of responding to the events. A callback class must have seven pre-named functions:
+
+class my_class {
+
+ public function onTransferTimeout($connection)
+ {
+ }
+
+ public function onConnectTimeout($connection)
+ {
+ }
+
+ public function onConnect($connection)
+ {
+ }
+
+ public function onRead($connection)
+ {
+ return true; (or return false;)
+ }
+
+ public function onWrite($connection)
+ {
+ }
+
+ public function onAccept($listener, $newConnection)
+ {
+ }
+
+ public function onDead($connection)
+ {
+ }
+
+}
+
+Each function is pretty self explanitory. The only one that might cause some confusion is onRead() or onAccept().
+
+onRead()
+--------
+This function returns true if not all data has been read from the socket (i.e., you used socketClass->getQueueLine() but want to give other processes a chance to run before you continue processing). This will make the function run immediately again. Otherwise, returning false will signal to the connection class that you don't need to run this function again.
+
+onAccept()
+----------
+Listener is the connection that was listening for new connections, and $newConnection is the new connection. $newConnection is another object of type connection class, and all one needs to do is call getSockInt() on it to get the socket identifier. The callback class is automatically its parents callback class ($listener's callback class). This can be changed by runing the setCallbackClass() function again with a different class.
+
+Closing a connection
+--------------------
+This is very important. The connection class will, under no circumstances, close a connection. Even if the onDead() function is called, for instance, the callback class MUST close the connection. If you have a connection, $conn, and you want to close it, you would run:
+
+$conn->disconnect();
+
+This kills the socket, and removes it from the socket class. From this point on, it is completely inactive.
+
+What if I want to accept a connection, but close the parent connection in the process?
+--------------------------------------------------------------------------------------
+The dcc class is a sample class that does just this.
+
+ public function onAccept($oldConn, $newConn)
+ {
+ $this->conn = $newConn;
+ //We just want to use $newConn from now on
+
+ $this->sockInt = $newConn->getSockInt();
+ //Get $newConn's sockint
+
+ $oldConn->disconnect();
+ //Close our old connection
+
+ $this->onConnect($newConn);
+ //Trigger the onConnect event
+ }
+
+============================
+10. Custom DCC Chat sessions
+============================
+
+A custom dcc chat handler is where you send out a chat request to a user, and instead of php-irc's default dcc interface handling and parsing the input, you will handle and parse the input yourself. Just follow the template.txt in the modules directory to create your handler. However, in addition, you need to do a few extra things.
+
+You will need to include these functions:
+
+ public function main($line, $args)
+ {
+ $port = $this->dccClass->addChat($line['fromNick'], null, null, false, $this);
+
+ if ($port === false)
+ {
+ $this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
+ }
+ }
+
+ public function handle($chat, $args)
+ {
+ }
+
+ public function connected($chat)
+ {
+ }
+
+ //Following function added for 2.2.1
+ public function disconnect($chat)
+ {
+ }
+
+'main' function
+---------------
+This is the function that your trigger in function.conf will call to initiate the chat
+
+'handle' function
+-----------------
+Whenever something is typed in the dcc chat window, it will be passed to this function in the '$args' array. See the previous section for the general definition of this array.
+
+'connected' function
+--------------------
+Use this function to do any "upon connection" tasks, as in setup the session or whatever you want.
+
+fileserver.php is a module that uses a custom dcc chat handler, and is detailed below.
+
+
+'disconnected' function
+-----------------------
+This is called when a dcc chat session is closed.
+
+==============================
+10-a. Simple File Server (SFS)
+==============================
+
+I've include a small, not-to-complex fileserver which you can use as an example to create your own modules. This particular one is a custom dcc chat handler (refer to previous section). To activate, uncomment the 'ctcp files' section and 'file fileserver' section in the function.conf (you can change 'files' to whatever you want, its your trigger). Then edit these variables in fileserver.php:
+
+private $vDir = "F:/BT/"; (use forward slashes, with a trailing slash as shown)
+private $maxSends = 3;
+private $maxQueues = 15;
+private $queuesPerPerson = 1;
+private $sendsPerPerson = 1;
+
+vDir is the root directory of the fileserver. I haven't beta tested this too much. If it breaks, tell me I guess. It was meant as a demonstration rather than something to actually be used.
+
+====================
+11. Database support
+====================
+
+PHP-IRC offers ever increasing database support. It currently offers a tried and tested mysql database abstraction layer(dba), and a beta postgre dba. There is also a new "ini" database type which operates out of ini files. This is similar to mIRC's /writeini and $readini functions.
+
+=====================
+11-a. MySQL Database
+=====================
+
+To use a mysql database, you will need to uncomment and fill out the database settings in bot.conf. You will also want to make sure that you have php set to use mysql. View the "Installing PHP 5" section for more information about this.
+
+You will need to set 'usedatabase' in bot.conf to this:
+
+usedatabase mysql
+
+INPORTANT DATABASE INFO:
+------------------------
+Because PHP does not escape input from sockets as it does with get/post/cookies (from http), you need to escape your database information before you put it into the database. Therefore, if you have a table with 3 fields like ... name, password, email, then the safest way to put this information into the database using the db class provided in the bot would be:
+
+$fieldArray = array("Somebody's Name", "somePass", "something@something.com");
+
+$this->db->query("INSERT INTO sometable (name,password,email) values ('[1]','[2]','[3]')", $fieldArray);
+
+This ensures that the data is safe to put into the database. The [1] etc will be replaced with their place in the array above in real time. Of course, you are free to do it however you wish.
+
+======================
+11-b. Postgre Database
+======================
+
+You will need to set 'usedatabase' in bot.conf to this:
+
+usedatabase postgre
+
+Also, read "IMPORTANT DATABASE INFO" above for more information. Support for this dba is SKETCHY at best.
+
+=========================================================
+11-c. Serverless, mIRC compatible ini-file based Database
+=========================================================
+
+INI-file support compliments the database system provided by PHP-IRC. Say you have a simple module which only needs to store a few data to file. Instead of having to have a mysql database, you can achieve this feat with ini files. They are basically identical to mIRC ini files--so, if you have any experience with $readini or /writeini, you will be pretty well off.
+
+To use ini files, there are several functions you can perform:
+
+1) Declaring, Creating, or Opening an INI file
+2) Setting ini values
+3) Retrieving ini values
+4) Writing changes to ini file
+5) Miscellaneous ini-file functions.
+
+1 - Declaring, Creating, or Opening an INI file
+-----------------------------------------------
+Creating or opening an ini file is incredibly simple. In fact, they consist of the same step:
+
+$myIni = new ini("somefile.ini");
+
+Thats it! Then:
+
+if ($myIni->getError())
+{
+ //some code to handle ini file error
+}
+
+If this is false, then the ini file cannot be created. In this case, you need to check the permissions on the directory you're attempting to create this file. (It may be that you don't have read access either.)
+
+Now you are ready to import/export data. One idea you may use is saving the $myIni variable in a global variable in your module, and then using it just as if it was a database, running queries and updating data occasionally.
+
+2 - Setting ini values
+----------------------
+INI files consist of three types of data. Sections, Variables, and Values. They look somewhat like this:
+
+[section]
+variable=value
+another_variable=value
+[section2]
+
+etc....
+
+To set an ini value on ini-object "$myIni", use the following function:
+
+$myIni->setIniVal($section, $variable, $value);
+
+None of these arguments may contain a newline character.
+
+3 - Retrieving ini values
+-------------------------
+There are many many ways of retrieving data from an ini object. To assist, there are around ten helper functions:
+
+1) getSections() //get all section names
+2) sectionExists() //check whether a section exists
+3) getSection() //get all vars in a section, associative array form
+4) randomSection() //get a random section
+5) randomVar() //get a random variable in a section
+6) searchSections() //see command_reference.txt
+7) searchVars() //see command_reference.txt ... etc
+8) searchSectionsByVar()
+9) searchVals()
+10) numSections()
+11) numVars()
+12) getVars()
+
+Perhaps the most important function is getIniVal($section, $var). See command_reference.txt for more detailed function information.
+
+4 - Writing changes to ini file
+-------------------------------
+When you want to finalize changes to an ini database, and write the data to a file, call this command:
+
+$myIni->writeIni();
+
+This will write the ini file. You can continue editing, and then use this function again as many times as you wish.
+
+
+5 - Miscellaneous ini-file functions
+------------------------------------
+There are some other useful functions. See command_reference.txt for more info.
+
+1) deleteVar($section, $var)
+2) deleteSection($section)
+3) getSection($section)
+
+==========
+12. Timers
+==========
+
+Timers allow you to run some procedure or function later, but not have to actually "run" it later. You specify a delay, and the script will run it in the interval selected. Timers are used all over php-irc. The point here is that you can also use them.
+
+Timer functions look like this:
+
+ public function myfunc($arguments)
+ {
+ return true/false;
+ }
+
+This form is declared more readily in the section titled "Modules and User-defined functions". By default, a timer will expire upon running, and will not be run again. To change this so that the timer runs again in another interval, the timer function MUST return 'true':
+
+return true;
+
+This will signal the timer class to run the timer again after 'interval'. Otherwise, the timer is removed.
+
+If I wanted to create a timer to run a function in sixty seconds, I would do this:
+
+$this->timerClass->addTimer("my_timer", $this, "myfunc", "", 60, false);
+
+The arguments are as follows:
+$name - The timer's name. Used with removeTimer to remove the timer
+$class - pointer to class with function, usually '$this'
+$function - the function that you will want to run after the interval expires
+$args - the arguments you want to send to the timer
+$interval - duh, in seconds and fractions of seconds (i.e., 5.2)
+$runRightAway - whether this timer should run as soon as it is added, or wait until after the interval. 'true' or 'false'.
+
+A few notes:
+------------
+
+$name
+-----
+If you want to create a random name to send as timer title, with least chance for name collision, use:
+
+irc::randomHash();
+
+This function will generate a string which should be unique.
+
+$args
+-----
+This can be anything you want, from a class, to an array, to an object. I have the 'argClass' defined in defines.php which I use to send multiple variables to my timers:
+
+$args = new argClass;
+
+$args->arg1 = "blah";
+etc...
+
+Otherwise, you could just send an associative array.
+
+Removing Timers
+---------------
+In order to remove a timer, you will need to use this function:
+
+$this->timerClass->removeTimer($name);
+
+The "$name" variable is the same as the name variable declared with addTimer above. Make sure that you specify unique timer names. Also, make sure that you keep track of the timer name if you are going to want to delete it. You can usually do this by sending it via the $args variable.
+
+Instead of relying on removeTimer, I many times simply return false instead of true when the timer is next run. That is also possible.
+
+===================================
+13. Multiple bots under one process
+===================================
+
+This script supports running multiple bots under one process. In order to do this, create another bot.conf file, say, bot2.conf, and just specify it when starting the bot:
+
+./bot.php bot.conf bot2.conf bot3.conf
+
+etc. See the "Running" section for more information. Performance of multiple bots has been significantly increased in 2.2.0.
+
+
+===========================
+14. Provided Sample Modules
+===========================
+To foster continued support of PHP-IRC; I have included some basic module examples in this release. Please note that a parser can and will fail when the html of a site is changed, so some of these releases may NOT work at future dates. They all worked previous to 01/14/05, however.
+
+=================
+14-a. IMDB Parser
+=================
+This module parses the internet movie database, http://www.imdb.com
+
+To use, uncomment the following line from function.conf
+
+;include modules/imdb/imdb_mod.conf
+
+The command is "!imdb". You can do a search by using "!imdb ". If multiple dates were found for your query, you can do: "!imdb (date)" to see it's results. Note that the parenthesis on the date must be there.
+
+Note, as this is a parser, it may not work out of the box, as imdb might have changed their site.
+
+===========================================
+14-b. Quotes mod with mysql/ini file system
+===========================================
+Possibily the most usable feature of any bot, this bot comes with two different forms of quote systems. You can either utilize a mysql database, or use the onboard ini file database.
+
+Mysql
+-----
+To use, uncomment in function.conf:
+
+;include modules/quotes_sql/quote_mod.conf
+
+You must also set the database information in bot.conf, and run this query in the database:
+
+create table quotes (id int default null, deleted tinyint(1) default 0, author varchar(50) default "", quote text, channel varchar(100) default "", time int, key(id));
+
+See modules/quotes_sql/quotes_mod.conf for usable commands.
+
+Ini
+---
+To use, uncomment in function.conf:
+
+;include modules/quotes_ini/quote_mod.conf
+
+Quotes are stored in the included "quotes_database" directory.
+
+See modules/quotes_ini/quotes_mod.conf for usable commands.
+
+========================
+14-c. Simple http server
+========================
+Alright, this is more of a proof of concept than something actually usable. This shows off the use of PHP-IRC's new "connection" class to handle incoming http connections in an event based way.
+
+I really know just about nothing about the http protocol, thus I give no support or instructions for this module. I have had it display pages and images with much success.
+
+To use, uncomment in function.conf:
+
+;include modules/httpd/httpd_mod.conf
+
+Then, the bot will listen on the port specified in modules/httpd/http.ini which defaults to 5050.
+
+=====================
+14-d. Bash.org Parser
+=====================
+This will allow users to display random, searched, or specific quotes from http://bash.org
+
+The commands are:
+
+!bash - random quote
+!bash + - random positive quote
+!bash search - search for a quote, will display the first result containing 'search'
+!bash id - will return the specific quote with id 'id'.
+
+To use, uncomment in function.conf:
+
+;include modules/bash/bash_mod.conf
+
+==============================
+14-e. News System/Rules Script
+==============================
+This is a small standard script where users can type a trigger and information will come back to them. It can be used to generate !rules scripts, !news scripts, or pretty much anything you can think of. To use it, uncomment the appropriate line (referring to news_mod.conf) in function.conf. Then, you can use the default trigger, !news, to add stuff. You must be opped/admined to add/delete items.
+
+Here are the commands:
+
+!news
+
+command:
+add - add a new item to end of list. You can also add to a specific line number, by doing add
+del - delete a line number: del
+show - show line numbers with their respective lines, so you can use del.
+clear - clear out all lines for a specific channel.
+
+Running the command with no arguments is available to everyone, and will show the lines in order of line number.
+
+The usefulness of this mod is very apparent. However, to make it even more useful, I've added another feature. Say that you have these two items in news_mod.conf:
+
+priv !news true true true 0 news_mod priv_news
+priv !requests true true true 0 news_mod priv_news
+
+Both of these are pointing to the same function/module, but they will both access separate database files. Thats right, separate. That is because any call to the function will make the function open the database that is of the same name as the trigger. For instance, doing:
+
+!news add Hello! This is some news!
+
+This will add the line to the news database. And doing:
+
+!requests add Some Request
+
+This will add the line to the requests database, but they use the same module/function! Cool huh :)
+
+===========================
+14-f. Seen System (beta!)
+===========================
+This is a very beta mod which I wrote like 15 minutes prior to releasing this version of php-irc. Basically, it works as a normal seen mod would, you type !seen and it tells you the last time it saw that person. It uses the ini file system to store information. This mod is VERY BETA!!! I haven't even tested 85% of it. I ran it once and thought, "heh, interesting", and never looked at it again. I will not support this mod until either someone updates it and sends me a better revision, or I get the time to make it better.
+
+========================
+14-g. Request Ads System
+========================
+This has been around since the early days of php-irc. It is the classic example. Except in 2.2.0, it now utilizes the ini file system, so ads that are added are saved and restarted when the bot process is killed and restarted. The "!ad" trigger is on by default.
+
+======================
+15. Function Reference
+======================
+Please view the "command_reference.txt" file for a complete indepth look at all the functions that you can use while writing your modules.
diff --git a/ircbot/remote.php b/ircbot/remote.php
new file mode 100644
index 0000000..a6868c0
--- /dev/null
+++ b/ircbot/remote.php
@@ -0,0 +1,213 @@
+ remote class module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+/* Remote, a class to handle addQuery connection from ircClass */
+
+class remote {
+
+ //External Classes
+ private $socketClass;
+ private $ircClass;
+ private $timerClass;
+
+ //Internal variables
+ private $host;
+ private $port;
+ private $query;
+ private $line;
+ private $class;
+ private $function;
+ private $connTimeout;
+ private $transTimeout;
+ private $sockInt;
+ private $connection;
+ private $connected;
+
+ //Output internal variables
+ private $response;
+ private $type;
+
+ function __construct($host, $port, $query, $line, $class, $function, $transTimeout)
+ {
+ $this->host = $host;
+ $this->port = $port;
+ $this->query = $query;
+ $this->line = $line;
+ $this->class = $class;
+ $this->function = $function;
+ $this->transTimeout = $transTimeout;
+ $this->response = "";
+ $this->connected = false;
+ $this->type = QUERY_SUCCESS;
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setTimerClass($class)
+ {
+ $this->timerClass = $class;
+ }
+
+ public function connect()
+ {
+ if ($this->host == null || $this->port == null)
+ {
+ return false;
+ }
+
+ if (!is_object($this->socketClass))
+ {
+ return false;
+ }
+
+ if (!is_object($this->ircClass))
+ {
+ return false;
+ }
+
+ $conn = new connection($this->host, $this->port, CONNECT_TIMEOUT);
+
+ $conn->setSocketClass($this->socketClass);
+ $conn->setIrcClass($this->ircClass);
+ $conn->setCallbackClass($this);
+ $conn->setTimerClass($this->timerClass);
+
+ /* Set Timeouts */
+ $conn->setTransTimeout($this->transTimeout);
+
+ $conn->init();
+
+ if ($conn->getError())
+ {
+ $this->setError("Could not allocate socket");
+ return false;
+ }
+
+ $this->sockInt = $conn->getSockInt();
+ $conn->connect();
+
+ $this->connection = $conn;
+
+ return true;
+ }
+
+ public function disconnect()
+ {
+ $this->connection->disconnect();
+ $this->setError("Manual disconnect");
+ }
+
+ /* Specific handling functions */
+
+ public function onTransferTimeout($conn)
+ {
+ $this->connection->disconnect();
+ $this->setError("The connection timed out");
+ }
+
+ public function onConnectTimeout($conn)
+ {
+ $this->connection->disconnect();
+ $this->setError("Connection attempt timed out");
+ }
+
+ public function onConnect($conn)
+ {
+ $this->connected = true;
+ $this->socketClass->sendSocket($this->sockInt, $this->query);
+ }
+
+ public function onRead($conn)
+ {
+ $this->response .= $this->socketClass->getQueue($this->sockInt);
+ }
+
+ public function onWrite($conn)
+ {
+ // do nothing, we really don't care about this
+ }
+
+ public function onDead($conn)
+ {
+ $this->connection->disconnect();
+
+ if ($this->connected === true)
+ {
+ $this->doCallback();
+ }
+ else
+ {
+ $this->setError($this->connection->getErrorMsg());
+ }
+
+ }
+
+ /* Error handling */
+
+ private function setError($msg)
+ {
+ $this->response = $msg;
+ $this->type = QUERY_ERROR;
+ $this->doCallback();
+ }
+
+ private function doCallback()
+ {
+ if ($this->line != null && is_array($this->line) && isset($this->line['text']))
+ {
+ $lineArgs = parser::createLine($this->line['text']);
+ }
+ else
+ {
+ $lineArgs = array();
+ }
+
+ $func = $this->function;
+ $this->class->$func($this->line, $lineArgs, $this->type, $this->response);
+ }
+
+}
+
+?>
diff --git a/ircbot/socket.php b/ircbot/socket.php
new file mode 100644
index 0000000..b92fafd
--- /dev/null
+++ b/ircbot/socket.php
@@ -0,0 +1,1010 @@
+ socket module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+class socket {
+
+ private $rawSockets; //array of raw sockets to be used by select
+ private $socketInfo; //index by intval($rawSockets[socket])
+ private $numSockets; //number of sockets currently in use
+ private $writeSocks; //sockets that have write buffers queued
+ private $numWriteSocks;
+
+ private $readQueueSize = 0;
+
+ private $tcpRangeStart = 1025;
+ private $timeoutSeconds = 0;
+ private $timeoutMicroSeconds = 0;
+
+ private $myTimeout = 0;
+
+ private $procQueue;
+
+ public function __construct()
+ {
+ $this->connectSockets = array();
+ $this->rawSockets = array();
+ $this->socketInfo = array();
+ $this->writeSocks = array();
+ $this->readQueueSize = 0;
+ $this->numSockets = 0;
+ $this->numWriteSocks = 0;
+ }
+
+ public function setProcQueue($class)
+ {
+ $this->procQueue = $class;
+ }
+
+ public function getNumSockets()
+ {
+ return $this->numSockets;
+ }
+
+ public function setTcpRange($range)
+ {
+ if (intval($range) != 0)
+ {
+ $this->tcpRangeStart = $range;
+ }
+ }
+
+ public function getHost($sockInt)
+ {
+ $status = socket_getsockname($this->socketInfo[$sockInt]->socket, $addr);
+
+ if ($status == false)
+ {
+ return false;
+ }
+
+ return $addr;
+
+ }
+
+ public function getRemoteHost($sockInt)
+ {
+ $status = socket_getpeername($this->socketInfo[$sockInt]->socket, $addr);
+
+ if ($status == false)
+ {
+ return false;
+ }
+
+ return $addr;
+
+ }
+
+ public function setTimeout($time)
+ {
+ $sec = intval($time);
+ $msec = intval(($time - $sec)*1e6);
+
+ if ($sec == 0)
+ {
+ $msec = $msec < $this->myTimeout ? $this->myTimeout : $msec;
+ }
+
+ if ($sec < $this->timeoutSeconds)
+ {
+ $this->timeoutSeconds = $sec;
+ $this->timeoutMicroSeconds = $msec;
+ }
+ else if ($sec == $this->timeoutSeconds)
+ {
+ if ($msec < $this->timeoutMicroSeconds)
+ {
+ $this->timeoutMicroSeconds = $msec;
+ }
+ }
+ }
+
+ public function setHandler($sockInt, $owner, $class, $function)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return false;
+ }
+
+ $sock = $this->socketInfo[$sockInt];
+
+ $sock->owner = $owner;
+ $sock->class = $class;
+ $sock->func = $function;
+
+ return true;
+ }
+
+ /* For debug... */
+ public function showSocks($read, $write)
+ {
+ echo "\n\nRead:\n";
+ if (is_array($read))
+ {
+ foreach($read AS $sock)
+ {
+ echo $sock . "\n";
+ }
+ }
+ echo "\nWrite:\n";
+ if (is_array($write))
+ {
+ foreach($write AS $sock)
+ {
+ echo $sock . "\n";
+ }
+ }
+ echo "\n";
+ }
+
+ public function handle()
+ {
+ //For debug
+ //echo "Read: " . $this->readQueueSize . " Write: " . $this->writeQueueSize . "\n";
+ //echo "timeout: " . $this->timeoutSeconds . "-" . $this->timeoutMicroSeconds . "\n";
+
+ if ($this->numSockets < 1)
+ {
+ if ($this->timeoutSeconds > 0)
+ {
+ sleep($this->timeoutSeconds);
+ }
+
+ if ($this->timeoutMicroSeconds > 0)
+ {
+ usleep($this->timeoutMicroSeconds);
+ }
+
+ $this->timeoutSeconds = 1000;
+ return;
+ }
+
+ if ($this->numSockets < 1)
+ {
+ $sockArray = NULL;
+ $except = NULL;
+ }
+ else
+ {
+ $sockArray = $this->rawSockets;
+ $except = $this->rawSockets;
+ }
+
+ if ($this->numWriteSocks < 1)
+ {
+ $writeArray = NULL;
+ }
+ else
+ {
+ $writeArray = $this->writeSocks;
+ }
+
+ //For debug
+ //$this->showSocks($sockArray, $writeArray);
+
+ $newData = socket_select($sockArray, $writeArray, $except, $this->timeoutSeconds, $this->timeoutMicroSeconds);
+
+ $this->timeoutSeconds = 1000;
+
+ if ($newData === false)
+ {
+ die("socket_select error"); // need to change this to handle errors
+ return;
+ }
+
+ if (!$newData)
+ {
+ return;
+ }
+
+ if (count($sockArray) != 0)
+ {
+ foreach($sockArray AS $socket)
+ {
+ $sockIntval = intval($socket);
+
+ switch($this->socketInfo[$sockIntval]->status)
+ {
+ case SOCK_CONNECTED:
+ $this->readSocket($sockIntval);
+ break;
+ case SOCK_LISTENING:
+ $this->acceptSocket($sockIntval);
+ break;
+ case SOCK_CONNECTING:
+ $this->connectSocket($sockIntval);
+ break;
+ default:
+ break;
+ }
+ }
+
+ }
+
+ if (count($writeArray) != 0)
+ {
+ foreach ($writeArray AS $socket)
+ {
+ $sockIntval = intval($socket);
+ $this->sendSocketQueue($sockIntval, 1);
+ }
+ }
+
+ if (count($except) != 0)
+ {
+ foreach($except AS $socket)
+ {
+ $sockIntval = intval($socket);
+ $this->markDead($sockIntval);
+ }
+ }
+
+ }
+
+
+ private function callBack($sockIntval, $msg)
+ {
+ //Schedule the callback to run
+ if ($this->socketInfo[$sockIntval]->func != "" &&
+ $this->socketInfo[$sockIntval]->func != null)
+ {
+ $this->procQueue->addQueue( $this->socketInfo[$sockIntval]->owner,
+ $this->socketInfo[$sockIntval]->class,
+ $this->socketInfo[$sockIntval]->func,
+ $msg,
+ .01);
+ }
+ }
+
+ private function readSocket($sockIntval)
+ {
+
+ if ($this->isDead($sockIntval))
+ {
+ return;
+ }
+
+ if ($this->socketInfo[$sockIntval]->status != SOCK_CONNECTED)
+ {
+ return;
+ }
+
+ $dataRead = false;
+
+ $socket = $this->socketInfo[$sockIntval]->socket;
+ //Read in 4096*30 bytes
+
+ for ($i = 0; $i < 30; $i++)
+ {
+ $response = @socket_read($socket, 8192, PHP_BINARY_READ);
+
+ $respLength = strlen($response);
+
+ if ($response === false)
+ {
+ $err = socket_last_error($this->socketInfo[$sockIntval]->socket);
+
+ if ($err != EALREADY && $err != EAGAIN && $err != EINPROGRESS)
+ {
+ $this->markDead($sockIntval);
+ }
+ break;
+ }
+ else if ($respLength === 0)
+ {
+ if ($i == 0)
+ {
+ $this->markDead($sockIntval);
+ }
+ break;
+ }
+
+ $dataRead = true;
+
+ $this->readQueueSize += $respLength;
+ $this->socketInfo[$sockIntval]->readLength += $respLength;
+ $this->socketInfo[$sockIntval]->readQueue .= $response;
+
+ }
+
+ if ($dataRead == true)
+ {
+ if ($this->socketInfo[$sockIntval]->readScheduled == false)
+ {
+ $this->callBack($sockIntval, CONN_READ);
+ $this->socketInfo[$sockIntval]->readScheduled = true;
+ }
+ }
+ }
+
+
+ private function sendSocketQueue($sockIntval, $queued = 0)
+ {
+ $socket = $this->socketInfo[$sockIntval]->socket;
+
+ if ($this->isDead($sockIntval))
+ {
+ return;
+ }
+
+ if (($bytesWritten = @socket_write($socket, $this->socketInfo[$sockIntval]->writeQueue)) === false)
+ {
+
+ $socketError = socket_last_error($socket);
+
+ switch ($socketError)
+ {
+ case EAGAIN:
+ case EALREADY:
+ case EINPROGRESS:
+ break;
+ default:
+ $this->markDead($sockIntval);
+ break;
+ }
+
+ }
+ else
+ {
+ $this->socketInfo[$sockIntval]->writeQueue = substr($this->socketInfo[$sockIntval]->writeQueue, $bytesWritten);
+ $this->socketInfo[$sockIntval]->writeLength -= $bytesWritten;
+
+ //Queue Empty, Remove socket from write
+ if ($this->socketInfo[$sockIntval]->writeLength == 0 && $queued == 1)
+ {
+ $this->removeWriteSocketFromArray($sockIntval);
+ }
+
+ if ($this->socketInfo[$sockIntval]->writeLength == 0)
+ {
+ unset($this->socketInfo[$sockIntval]->writeQueue);
+ $this->socketInfo[$sockIntval]->writeQueue = "";
+ }
+
+ //Callback after we wrote to socket
+
+ if ($this->socketInfo[$sockIntval]->writeScheduled == false)
+ {
+ $this->callBack($sockIntval, CONN_WRITE);
+ $this->socketInfo[$sockIntval]->writeScheduled = true;
+ }
+
+ }
+
+ }
+
+ private function createSocket()
+ {
+ $socket = socket_create(AF_INET, SOCK_STREAM, 0);
+
+ socket_set_option($socket,SOL_SOCKET,SO_REUSEADDR,1);
+
+ if ($socket == false)
+ {
+ return false;
+ }
+
+ socket_clear_error($socket);
+
+ if (socket_set_nonblock($socket) == false)
+ {
+ @socket_close($socket);
+ return false;
+ }
+
+ return $socket;
+ }
+
+ public function bindIP($sockInt, $ip)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return;
+ }
+
+ $sockData = $this->socketInfo[$sockInt];
+
+ if ($sockData->status != SOCK_CONNECTING)
+ {
+ return;
+ }
+
+ socket_bind($sockData->socket, $ip);
+ }
+
+ public function addSocket($host, $port)
+ {
+ $listening = false;
+
+ if ($host == null)
+ {
+ $host = false;
+ $listening = true;
+ }
+
+ $socket = $this->createSocket();
+
+ if ($socket == false)
+ {
+ return false;
+ }
+
+ if ($listening == true)
+ {
+ $boundError = false;
+ $currentPort = $this->tcpRangeStart;
+
+ if ($port !== null)
+ {
+ $boundError = @socket_bind($socket, 0, $port);
+ if ($boundError === false)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ while ($boundError === false)
+ {
+ $boundError = @socket_bind($socket, 0, $currentPort);
+ $currentPort++;
+
+ if ($currentPort > $this->tcpRangeStart + HIGHEST_PORT)
+ {
+ return false;
+ }
+ }
+
+ $port = $currentPort - 1;
+ }
+
+
+ if (socket_listen($socket) === false)
+ {
+ return false;
+ }
+
+
+ if (DEBUG == 1)
+ {
+ echo "Socket Listening: " . intval($socket) . "\n";
+ }
+
+
+ }
+ else
+ {
+ if (DEBUG == 1)
+ {
+ echo "Socket Opened: " . intval($socket) . "\n";
+ }
+ }
+
+ $newSock = new socketInfo;
+
+ $newSock->socket = $socket;
+ $newSock->owner = null;
+ $newSock->class = null;
+ $newSock->func = null;
+ $newSock->readQueue = "";
+ $newSock->writeQueue = "";
+ $newSock->readLength = 0;
+ $newSock->writeLength = 0;
+ $newSock->host = $host;
+ $newSock->port = $port;
+ $newSock->newSockInt = array();
+ $newSock->readScheduled = false;
+ $newSock->writeScheduled = false;
+
+ $this->socketInfo[intval($socket)] = $newSock;
+
+ if ($listening == true)
+ {
+ $newSock->status = SOCK_LISTENING;
+ }
+ else
+ {
+ $newSock->status = SOCK_CONNECTING;
+ }
+
+ $this->numSockets++;
+ $this->rawSockets[] = $socket;
+
+ return intval($socket);
+ }
+
+ public function clearReadSchedule($sockInt)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return false;
+ }
+
+ $this->socketInfo[$sockInt]->readScheduled = false;
+
+ return true;
+ }
+
+ public function clearWriteSchedule($sockInt)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return false;
+ }
+
+ $this->socketInfo[$sockInt]->writeScheduled = false;
+
+ return true;
+ }
+
+/*
+ public function beginConnect($sockInt)
+ {
+ $this->procQueue->addQueue(null, $this, "connectSocketProcess", $sockInt, 0);
+ }
+*/
+
+ //process to connect the socket $sockInt
+ public function connectSocketTimer($sockInt)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return false;
+ }
+
+ if ($this->socketInfo[$sockInt]->status != SOCK_CONNECTING)
+ {
+ return false;
+ }
+
+ $this->connectSocket($sockInt);
+
+ return true;
+ }
+
+
+ //Remove all sockets from a specific irc bot
+ public function removeOwner($class)
+ {
+ foreach($this->socketInfo AS $sockInt => $data)
+ {
+ if ($class === $data->owner)
+ {
+ $this->killSocket($sockInt);
+ $this->removeSocket($sockInt);
+ }
+ }
+ }
+
+ public function killSocket($sockInt)
+ {
+ if (DEBUG == 1)
+ {
+ echo "Killing socket: " . $sockInt . "\n";
+ }
+
+ if ($this->socketInfo[$sockInt]->status == SOCK_ACCEPTED)
+ {
+ $this->acceptedSockets--;
+ }
+
+ if ($this->socketInfo[$sockInt]->status != SOCK_DEAD)
+ {
+ $this->removeReadSocketFromArray($sockInt);
+ $this->removeWriteSocketFromArray($sockInt);
+ $this->socketInfo[$sockInt]->status = SOCK_DEAD;
+ }
+
+ if (is_resource($this->socketInfo[$sockInt]->socket))
+ {
+ if (DEBUG == 1)
+ {
+ echo "Closed socket: " . $sockInt . "\n";
+ }
+
+ socket_clear_error($this->socketInfo[$sockInt]->socket);
+ socket_close($this->socketInfo[$sockInt]->socket);
+ }
+ else
+ {
+ if (DEBUG == 1)
+ {
+ echo "Socket already closed: " . $sockInt . "\n";
+ }
+ }
+ }
+
+ public function removeSocket($socketIntval)
+ {
+
+ $this->readQueueSize -= $this->socketInfo[$socketIntval]->readLength;
+
+ unset($this->socketInfo[$socketIntval]->class);
+ unset($this->socketInfo[$socketIntval]->owner);
+ unset($this->socketInfo[$socketIntval]);
+ }
+
+ private function removeReadSocketFromArray($socketIntval)
+ {
+ foreach ($this->rawSockets AS $index => $socket)
+ {
+ if ($socket === $this->socketInfo[$socketIntval]->socket)
+ {
+ unset($this->rawSockets[$index]);
+ $this->numSockets--;
+ break;
+ }
+ }
+ }
+
+ private function removeWriteSocketFromArray($socketIntval)
+ {
+
+ foreach ($this->writeSocks AS $index => $rawSocket)
+ {
+ if ($rawSocket === $this->socketInfo[$socketIntval]->socket)
+ {
+ unset($this->writeSocks[$index]);
+ $this->numWriteSocks--;
+ break;
+ }
+ }
+ }
+
+ public function sendSocket($sockInt, $data)
+ {
+ if ($this->isDead($sockInt))
+ {
+ return;
+ }
+
+ if ($this->socketInfo[$sockInt]->status != SOCK_CONNECTED)
+ {
+ return;
+ }
+
+ $inQueue = $this->socketInfo[$sockInt]->writeLength > 0 ? true : false;
+
+ $len = strlen($data);
+ $this->socketInfo[$sockInt]->writeQueue .= $data;
+ $this->socketInfo[$sockInt]->writeLength += $len;
+
+ if (!$inQueue)
+ {
+ $this->sendSocketQueue($sockInt, 0);
+
+ if ($this->socketInfo[$sockInt]->status == SOCK_CONNECTED)
+ {
+ if ($this->socketInfo[$sockInt]->writeLength > 0)
+ {
+ $this->writeSocks[] = $this->socketInfo[$sockInt]->socket;
+ $this->numWriteSocks++;
+ }
+ }
+ }
+
+ return $len;
+ }
+
+ private function acceptSocket($sockInt)
+ {
+ $sockData = $this->socketInfo[$sockInt];
+
+ $newSock = @socket_accept($sockData->socket);
+ socket_set_nonblock($newSock);
+
+ if ($newSock === false)
+ {
+ return false;
+ }
+
+ $newSockInt = intval($newSock);
+
+ if (DEBUG == 1)
+ {
+ echo "Accepted new connection on: " . $newSockInt . "\n";
+ }
+
+
+ $this->socketInfo[$newSockInt] = clone $sockData;
+ $this->socketInfo[$newSockInt]->socket = $newSock;
+ $this->socketInfo[$newSockInt]->status = SOCK_ACCEPTING; /* fix a onRead done before onAccept */
+
+ $this->numSockets++;
+ $this->rawSockets[] = $newSock;
+
+ $this->socketInfo[$sockInt]->newSockInt[] = $newSockInt;
+
+ //Schedule the callback to run
+ $this->callBack($sockInt, CONN_ACCEPT);
+
+ return true;
+ }
+
+ private function connectSocket($sockInt)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return;
+ }
+
+ if ($this->socketInfo[$sockInt]->status == SOCK_CONNECTED)
+ {
+ return;
+ }
+
+ if (@socket_connect($this->socketInfo[$sockInt]->socket,
+ $this->socketInfo[$sockInt]->host,
+ $this->socketInfo[$sockInt]->port) === true)
+ {
+ $this->socketInfo[$sockInt]->status = SOCK_CONNECTED;
+ $this->callBack($sockInt, CONN_CONNECT);
+ }
+ else
+ {
+ $socketError = socket_last_error($this->socketInfo[$sockInt]->socket);
+
+ switch ($socketError)
+ {
+ case 10022:
+ if (OS != 'windows')
+ {
+ $this->markDead($sockInt);
+ }
+ break;
+ case EISCONN:
+ $this->socketInfo[$sockInt]->status = SOCK_CONNECTED;
+ $this->callBack($sockInt, CONN_CONNECT);
+ break;
+ case EAGAIN:
+ case EALREADY:
+ case EINPROGRESS:
+ break;
+ default:
+ $this->markDead($sockInt);
+ break;
+ }
+ }
+
+ return;
+ }
+
+ public function getSockStatus($sockInt)
+ {
+ return (isset($this->socketInfo[$sockInt]) ? $this->socketInfo[$sockInt]->status : false);
+ }
+
+ public function getSockData($sockInt)
+ {
+ return (isset($this->socketInfo[$sockInt]) ? $this->socketInfo[$sockInt] : false);
+ }
+
+ public function alterSocket($sockInt, $level, $opt, $val)
+ {
+ return socket_set_option($this->socketInfo[$sockInt]->socket, $level, $opt, $val);
+ }
+
+ public function getSockError($sockInt)
+ {
+ return socket_last_error($this->socketInfo[$sockInt]->socket);
+ }
+
+ public function getSockStringError($sockInt)
+ {
+ $strErr = "[" . self::getSockError($sockInt) . "]:" . socket_strerror(socket_last_error($this->socketInfo[$sockInt]->socket));
+ $strErr = str_replace("\n", "", $strErr);
+ return $strErr;
+ }
+
+ public function hasAccepted($sockInt)
+ {
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return false;
+ }
+
+ $newSockInt = array_shift($this->socketInfo[$sockInt]->newSockInt);
+
+ $this->socketInfo[$newSockInt]->status = SOCK_CONNECTED;
+
+ return $newSockInt;
+ }
+
+ private function markDead($sockInt)
+ {
+ if (DEBUG == 1)
+ {
+ echo "Marking socket dead: " . $sockInt . "\n";
+ }
+
+ $this->removeReadSocketFromArray($sockInt);
+ $this->removeWriteSocketFromArray($sockInt);
+ $this->socketInfo[$sockInt]->status = SOCK_DEAD;
+ $this->callBack($sockInt, CONN_DEAD);
+ }
+
+ public function isDead($sockInt)
+ {
+ $socket = $this->socketInfo[$sockInt]->socket;
+
+ if (!is_resource($socket))
+ {
+ $this->markDead($sockIntval);
+ return true;
+ }
+
+ if (!isset($this->socketInfo[$sockInt]))
+ {
+ return true;
+ }
+
+ switch ($this->socketInfo[$sockInt]->status)
+ {
+ case SOCK_DEAD:
+ return true;
+ break;
+ default:
+ return false;
+ break;
+ }
+ }
+
+ public function hasWriteQueue($sockInt)
+ {
+ if ($this->socketInfo[$sockInt]->writeLength > 0)
+ {
+ return $this->socketInfo[$sockInt]->writeLength;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public function getQueue($sockInt)
+ {
+ $this->readQueueSize -= $this->socketInfo[$sockInt]->readLength;
+ $queue = $this->socketInfo[$sockInt]->readQueue;
+ unset($this->socketInfo[$sockInt]->readQueue);
+ $this->socketInfo[$sockInt]->readQueue = "";
+ $this->socketInfo[$sockInt]->readLength = 0;
+ return $queue;
+ }
+
+ public function hasQueue($sockInt)
+ {
+ if ($this->socketInfo[$sockInt]->readLength > 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public function hasLine($sockInt)
+ {
+ if (strpos($this->socketInfo[$sockInt]->readQueue, "\n") !== false)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public function getQueueLine($sockInt)
+ {
+ $readQueue =& $this->socketInfo[$sockInt]->readQueue;
+
+ if (!$this->hasLine($sockInt))
+ {
+ return false;
+ }
+
+ $crlf = "\r\n";
+ $crlfLen = 2;
+
+ $lineEnds = strpos($readQueue, $crlf);
+
+ if ($lineEnds === false)
+ {
+ $crlf = "\n";
+ $crlfLen = 1;
+ $lineEnds = strpos($readQueue, $crlf);
+ }
+
+ $line = substr($readQueue, 0, $lineEnds);
+ $readQueue = substr($readQueue, $lineEnds + $crlfLen);
+
+ $this->readQueueSize -= ($lineEnds + $crlfLen);
+ $this->socketInfo[$sockInt]->readLength -= ($lineEnds + $crlfLen);
+
+ if ($readQueue == "")
+ {
+ unset($this->socketInfo[$sockInt]->readQueue);
+ $this->socketInfo[$sockInt]->readQueue = "";
+ }
+
+ return $line;
+ }
+
+
+
+ /* Misc HTTP Functions */
+
+ public static function generatePostQuery($query, $host, $path, $httpVersion = "1.0")
+ {
+ if ($query != "" && substr($query, 0, 1) != "?")
+ {
+ $query = "?" . $query;
+ }
+
+ if ($path == "")
+ {
+ $path = "/";
+ }
+
+ $postQuery = "POST " . $path . " HTTP/".$httpVersion."\r\n";
+ $postQuery .= "Host: " . $host . "\r\n";
+ $postQuery .= "Content-type: application/x-www-form-urlencoded\r\n";
+ $postQuery .= "Content-length: " . strlen($query) . "\r\n\r\n";
+ $postQuery .= $query;
+
+ return $postQuery;
+ }
+
+ public static function generateGetQuery($query, $host, $path, $httpVersion = "1.0")
+ {
+ if ($path == "")
+ {
+ $path = "/";
+ }
+
+ if ($query != "" && substr($query, 0, 1) != "?")
+ {
+ $query = "?" . $query;
+ }
+
+ $getQuery = "GET " . $path . $query . " HTTP/".$httpVersion."\r\n";
+ $getQuery .= "Host: " . $host . "\r\n";
+ $getQuery .= "Connection: close\r\n";
+ $getQuery .= "\r\n";
+
+ return $getQuery;
+ }
+
+}
+
+?>
diff --git a/ircbot/timers.php b/ircbot/timers.php
new file mode 100644
index 0000000..ac85b99
--- /dev/null
+++ b/ircbot/timers.php
@@ -0,0 +1,235 @@
+ timers module
+| > Module written by Manick
+| > Module Version Number: 2.2.0
++---------------------------------------------------------------------------
+| > This program is free software; you can redistribute it and/or
+| > modify it under the terms of the GNU General Public License
+| > as published by the Free Software Foundation; either version 2
+| > of the License, or (at your option) any later version.
+| >
+| > This program is distributed in the hope that it will be useful,
+| > but WITHOUT ANY WARRANTY; without even the implied warranty of
+| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| > GNU General Public License for more details.
+| >
+| > You should have received a copy of the GNU General Public License
+| > along with this program; if not, write to the Free Software
+| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++---------------------------------------------------------------------------
+| Changes
+| =======-------
+| > If you wish to suggest or submit an update/change to the source
+| > code, email me at manick@manekian.com with the change, and I
+| > will look to adding it in as soon as I can.
++---------------------------------------------------------------------------
+*/
+
+/*
+ * Redesigned 12/22/04... Yes... this file sucks. I basically am going to
+ * do a few things here. I have been stuck on this file for the past 2 weeks,
+ * trying to come up with some ideas to handle the hopeless situation which
+ * faced me. With the new queue system, this timer class became very interesting
+ * to handle. I had to decide how I would add proc queues to the queue class
+ * to handle specific timers in this file. Say, for instance, that a timer
+ * is added, and then another is added that has a shorter time than that one.
+ * The first one will have a proc queue added into the queue class, but then
+ * the second one will have to add another proc queue. But hold on a second,
+ * the way this works right now, after a timer is done running, the next one
+ * is added to the process queue. I handled this by keeping track of how
+ * many processes were in the queue, and didn't add one if there were more than
+ * one, and the call to setCurrentTimer was from handle(). This worked, unless
+ * you have a timer that repeats. Then the problem comes in, as it will not be
+ * added to the proc queue until the next timer is complete. To just handle
+ * this problem, I'm just going to add a proc to the queue for every timer
+ * that is added, and then every timer will have a queue in the procqueue.
+ * that way, we don't have to worry about anything.
+ *
+ * Also, I added a "timerStack" so that I could have reserved names and what
+ * not. Each timer gets a unique name or ID, and that is added to the stack,
+ * as well as sorted into the timerList.
+ *
+ * Okay, way that timers are handled... has changed, if you want a timer to
+ * repeat, you must return true from the timer, runOnce was removed.
+ *
+ * Ooohh oohh ohh! Idea. screw linked lists and shit. I'll just add each
+ * timer to the proc queue, and then have them call handle() with the timer
+ * referenced! This solves all problems, and is incredibly more efficient!
+ * This officially takes the last linked list out of my bot. I have NO IDEA
+ * why I even used them in the first place, as php already has associative arrays
+ * which are a lot better! GEEZ!
+ */
+
+class timers {
+
+ //Local variables
+ private $timerStack = array(); //list of all timers indexed by name
+
+ //External Classes
+ private $procQueue;
+ private $socketClass;
+ private $ircClass;
+
+ //Private list of reserved php-irc timer names (please do not
+ //use these names)
+ private $reserved = array( "listening_timer_[0-9]*",
+ "check_nick_timer",
+ "check_channels_timer",
+ "check_ping_timeout_timer",
+ );
+
+ public function __construct()
+ {
+ $this->time = time();
+ $this->timerStack = array();
+ }
+
+ public function setSocketClass($class)
+ {
+ $this->socketClass = $class;
+ }
+
+ public function setIrcClass($class)
+ {
+ $this->ircClass = $class;
+ }
+
+ public function setProcQueue($class)
+ {
+ $this->procQueue = $class;
+ }
+
+ public static function getMicroTime()
+ {
+ return microtime(true);
+ }
+
+ public function getTimers()
+ {
+ return $this->timerStack;
+ }
+
+ public function handle($timer)
+ {
+ $microTime = self::getMicroTime();
+
+ if (!isset($this->timerStack[$timer->name]))
+ {
+ return false;
+ }
+
+ if ($this->timerStack[$timer->name] !== $timer)
+ {
+ return false;
+ }
+
+ $timer->lastTimeRun = $microTime;
+ $timer->nextRunTime = $microTime + $timer->interval;
+
+ if ($timer->class != null)
+ {
+ $theFunc = $timer->func;
+ $status = $timer->class->$theFunc($timer->args);
+ }
+ else
+ {
+ $theFunc = $timer->func;
+ $status = $theFunc($timer->args);
+ }
+
+ if ($status != true)
+ {
+ $this->removeTimer($timer->name);
+ }
+ else
+ {
+ $this->procQueue->addQueue($this->ircClass, $this, "handle", $timer, $timer->interval);
+ }
+
+ return false;
+ }
+
+ public function removeAllTimers()
+ {
+ foreach ($this->timerStack AS $timer)
+ {
+ $this->removeTimer($timer->name);
+ }
+ }
+
+
+ public function addTimer($name, $class, $function, $args, $interval, $runRightAway = false)
+ {
+ if (trim($name) == "")
+ {
+ return false;
+ }
+
+ if (isset($this->timerStack[$name]))
+ {
+ return false;
+ }
+
+ $newTimer = new timer;
+
+ $newTimer->name = $name;
+ $newTimer->class = $class;
+ $newTimer->func = $function;
+ $newTimer->args = $args;
+ $newTimer->interval = $interval;
+ $newTimer->removed = false;
+
+ if ($runRightAway == false)
+ {
+ $newTimer->lastTimeRun = $this->getMicroTime();
+ $newTimer->nextRunTime = $this->getMicroTime() + $interval;
+ $tInterval = $interval;
+ }
+ else
+ {
+ $newTimer->lastTimeRun = 0;
+ $newTimer->nextRunTime = $this->getMicroTime();
+ $tInterval = 0;
+ }
+
+ $this->procQueue->addQueue($this->ircClass, $this, "handle", $newTimer, $tInterval);
+
+ $this->timerStack[$newTimer->name] = $newTimer;
+
+ return $name;
+ }
+
+ /* Remove the current timer from both the list and stack, changed in 2.1.2, can only call by
+ * timer name now.
+ */
+ public function removeTimer($name)
+ {
+ if (!isset($this->timerStack[$name]))
+ {
+ return false;
+ }
+
+ //Set removed flag,
+ $this->timerStack[$name]->removed = true;
+
+ //Remove from stack
+ unset($this->timerStack[$name]->args);
+ unset($this->timerStack[$name]->class);
+ unset($this->timerStack[$name]);
+
+ return true;
+ }
+
+}
+
+?>
diff --git a/ircbot/typedefs.conf b/ircbot/typedefs.conf
new file mode 100644
index 0000000..07d09cc
--- /dev/null
+++ b/ircbot/typedefs.conf
@@ -0,0 +1,75 @@
+type file ~ ;----Used to import files
+ name ~ ;----the module name
+ filename
+
+type section ~ ;----Used to section functions in dcc chat (used with 'help')
+ name ~ ;-id name to specify with dcc function
+ longname ~ ;-section name displayed when 'help' is pressed
+
+type ctcp ~ ;----handle all ctcp commands
+ name ~ ;----the command typed (or trigger, like !list)
+ module ~
+ function
+
+type priv ~ ;----Used to process input of users in channels
+ name ~
+ active ~
+ inform ~
+ canDeactivate ~
+ usage ~
+ module ~
+ function
+
+type dcc ~ ;----Used to process input of users in dcc interface
+ name ~
+ numArgs ~
+ usage ~
+ help ~
+ admin ~
+ module ~
+ function ~
+ section ;--added 2.2.0
+
+type privmsg ~ ;----Used to process privmsg irc command
+ module ~
+ function
+
+type notice ~ ;----Used to process notice irc command
+ module ~
+ function
+
+type mode ~ ;----Used to process mode irc command
+ module ~
+ function
+
+type join ~ ;----Used to process join irc command
+ module ~
+ function
+
+type kick ~ ;----Used to process kick irc command
+ module ~
+ function
+
+type part ~ ;----Used to process part irc command
+ module ~
+ function
+
+type quit ~ ;----Used to process quit irc command
+ module ~
+ function
+
+type connect ~ ;----Perform on connect
+ module ~ ;----Note this is really 004 from irc
+ function
+
+type disconnect ~ ;----Perform on disconnect $line['text'] holds reason
+ module ~ ;----Note, this is really ERROR from irc
+ function
+
+type raw ~
+ module ~
+ function
+
+type action ~
+ module ~
+ function
diff --git a/manual/beta5/en/account_games.lwdoc b/manual/beta5/en/account_games.lwdoc
new file mode 100644
index 0000000..41baad4
--- /dev/null
+++ b/manual/beta5/en/account_games.lwdoc
@@ -0,0 +1,109 @@
+
+
+ beta5
+ en
+ Accounts and Games
+
+ Each player in LegacyWorlds has a single account which provides him access to all possible games he wishes to play. This section of the manual explains in details how to create and activate an account along with account deletion and how to manage games.
+
+
+
+ From the game home page, clicking on the Create Account link directs you to account creation form. You have to fill in:
+
Username: your in game name
+
Language: language in which you want everything to be displayed
+
E-mail: a valid e-mail address to be associated with the account. This has to be typed in twice to avoid mistakes
+
Password: the password to be used along with your username to access your account. This has to be typed in twice to avoid mistakes
+
+ Once your are satisfied with the data you've entered you can click the Create Account Button.
+
+ If the account creation process has been successful an e-mail is sent to the provided e-mail address containing:
+
a reminder about the typed in account information
+
information about the account activation procedure
+
+
+
+ The e-mail you have received when creating an account contains information to activate your account. In order to activate your account you have to look at the top part of the left panel of the home page. A logging form is displayed there. In the form, you have to provide:
+
Username: the in game username you've chosen
+
Password: the password you've chosen
+
+ You can then click the ok button to log in.
+
+ A new form is then displayed asking for a confirmation code. This code has been sent to you in the e-mail mentioned above. Type in the code in the provided text field and click on the Confirm account creation button. If you provide the right code you get directed towards the main game selection page.
+
+
+
+ Closing your account allows you to delete all game data related to your account. But be careful: it doesn't deleted your account and you can reactivate it any time you wish. The next paragraphs will cover those topics more closely.
+
+
+
+ The form to close your account is accessible from the home page of the game when you are logged it. In order to access the page you have two options:
+
if you're not logged in, follow the logging in procedure. The bottom section of the page displayed in the body of the home page should be about closing your account. Below an introduction about the topic, Is displayed a Close my account button. Clicking the button opens the forms that lead to the path to closing your account
+
if you are logged in and playing a LegacyWorlds game, clicking on the My Account menu item gets you to the logged in home page of the game. As in the previous case below the introduction about the topic, is displayed the Closing my account button. Clicking the button opens the forms that lead to closing your account
+
+
+
+ Clicking the button opens a new form that you have to fill in in order to close the account. You have to provide the following information:
+
Your password in the corresponding textfield to make sure you're really you're who you're saying you are
+
Optionally a text area is provided where you can if you wish explain why you're closing your account
+
+ Below these two fields are displayed two buttons:
+
I really want to close my account: clicking this button starts a countdown to real account closing. You have a 24 to 48h delay to cancel the action
+
No, I was just kidding: clicking this button cancels the account closing procedure
+
+
+
+
+
+ During the delay to account closing you can still cancel the operation. The form to cancel account closing is accessible from the home page of the game when you are logged it. In order to access the page you have two options:
+
if you're not logged in, follow the logging in procedure. The bottom section of the page displayed in the body of the home page should be about closing your account. Below an introduction about the topic and information about the time at which the account will be closed, is displayed a Don't close my account button. Clicking the button opens the forms that allow to cancel the closing operation
+
if you are logged in and playing a LegacyWorlds game, clicking on the My Account menu item gets you to the logged in home page of the game. As in the previous case below the introduction about the topic, is displayed the Don't close my account button. Clicking the button opens the forms that allow to cancel the operation
+
+
+
+ Clicking the button opens a new page with two buttons:
+
Yes, cancel the countdown: clicking this button cancels account closing
+
No, get on with it: clicking this button goes on with the account closing procedure
+
+
+
+
+ You have to be aware of the fact that closing your account doesn't delete your account information from the LegacyWorlds database but only your game data. This prevents anyone from using your player name at your place and impersonate you in game. It also allows you to reactivate your account.
+
+ This also means that all information regarding your account and in particular your personal data are permanently stored in the LegacyWorlds database. If you want those information to be erased from the database, please contact the staff.
+
+
+ If you want to reactivate your account you only have to log in as usual. Joining a LegacyWorlds game is then all the same as for new accounts.
+
+
+
+
+ In the login form of the left panel of the home page you have to fill in:
+
Username: the in game username you've chosen
+
Password: the password you've chosen
+
+ You can then click the Log in -> button to log in.
+
+
+
+ Several LegacyWorlds games may be running at once. You can choose which games you want to play from the main game selection page you reach when logging in.
+
+
+ The game selection list provides informations about current available games, including:
+
Game name: name of the game. This name is a link to join that particular game
+
Players: number of players in this game
+
Running: if you are not currently playing this game this field presents if the game is running or not thus informing you if you can join in or not
+
+ In order to join a particular game click on its name in the games list.
+
+ You'll get then directed to a planet creation form. This form will allow you to choose the name of your first planet in the game. Type in the planet name in the provided text field and click the ok button to validate your input. You can now start taking care of your newborn empire in this game.
+
+
+ A list of current games you are playing is also provided. This list presents:
+
Game name: name of the game. This name is a link to play that particular game
+
Planets: number of planets in your empire in this game
+
Cash: amount of money you have in this particular game
+
+ In order to play a particular game click on its name in the list. You'll get directed to the overview page for this particular game.
+
+
+
diff --git a/manual/beta5/en/accounts.lwdoc b/manual/beta5/en/accounts.lwdoc
new file mode 100644
index 0000000..9a435ce
--- /dev/null
+++ b/manual/beta5/en/accounts.lwdoc
@@ -0,0 +1,35 @@
+
+
+ beta5
+ en
+ Accounts
+
+ Along with the good practices, some rules apply to your account in Legacy Worlds. Those are summed up in this section of the manual.
+
+
+ As for every game of the kind the general rule is: one account per player and one account only.
+
+ Having multiple accounts for one player provides too big an advantage to the player controlling them and it wouldn't be a fair game to allow such a behaviour. It's simply cheating.
+
+ There might not be an automated Anti-Multi System in Legacy Worlds for now but the small number of current players allows for the game administration team to check in the game database and spot by hand suspect behaviours. An automated system will be set up in a future Beta so it doesn't cost much to get good habits from the beginning.
+
+
+ Occasional password sharing among a little group of players is tolerated as long as several accounts are in the control of the same player for only a short period of time. Holding a database or file of allied account information isn't forbidden either as long as the actual use of those data complies with the previous statement.
+
+ The "trusted allies" list should provide you with most of the gains you might expect from password sharing. Use this feature...
+
+
+ Depending on their ages, newly created accounts face a certain amount of limitations that are lifted over time:
+
Your account has to be 10 days old to allow cash transfer
+
Your account has to be 10 days old to allow for diplomatic exchange of technologies
+
+
+
+ Inactive accounts are accounts on which no activity hasn't occured in a certain amount of time. Those accounts will be neutralised. This means they will still exist in the database but won't be involved in any current game anymore. You may be able to reactivate them but you'll have to rejoin all the games you were playing.
+
+
+ In order to check on suspicious behaviour from some players the game administrators might have to look into the database for insult messages and such. As a consequence you have to be aware that they might read your messages. So be careful about what you may say in those.
+
+ You also have to be aware that no messages are actually deleted even if you delete them in-game. They are kept in the database with a "deleted" flag.
+
+
diff --git a/manual/beta5/en/alliance.lwdoc b/manual/beta5/en/alliance.lwdoc
new file mode 100644
index 0000000..73e0c57
--- /dev/null
+++ b/manual/beta5/en/alliance.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Alliance
+
+ An alliance is a group of players who have decided to team up and work together to be stronger in the game. An alliance is identified by its tag, which usual consists of a short hand for its name. An alliance has a leader and is composed of members of different custom ranks. Depending on the privileges attached to their rank members have access to various types of features on the alliance page. An alliance can be either a democracy (members can vote for their leader) or a dictature (no voting system). Alliance specific forums can also be created by members of sufficient rank and their access to members can be restricted according to their rank.
+
+
+ At the beginning of the game you don't belong to any alliance. You can then choose among several options:
+
Remain a lone gunman
+
Join an existing alliance
+
Create a new alliance
+
+ We'll have a closer look at the two last options in the corresponding manual section.
+
+
+ The internal organisation of an alliance is usually set up by its leadership and we won't cover those matters in this manual.
+
+ As member of an alliance and depending on your rank inside the alliance you may have access to various alliance management features. You are invited to read the manual sections covering the features you have access to to learn more about them.
+
+
+ The alliance management pages provide you with useful information about the alliance in the same trend as the alliance information previously described or listings of members and controlled planets. It also offers means to manage members, alliance specific forums and ranks. The various sections of this part of the manual describe those features.
+
+
+
+
+
diff --git a/manual/beta5/en/alliance_create.lwdoc b/manual/beta5/en/alliance_create.lwdoc
new file mode 100644
index 0000000..2e04d59
--- /dev/null
+++ b/manual/beta5/en/alliance_create.lwdoc
@@ -0,0 +1,47 @@
+
+
+ beta5
+ en
+ Creating / Joining an Alliance
+
+ At the beginning of the game you don't belong to any alliance. You can then choose among several options:
+
Remain a lone gunman
+
Join an existing alliance
+
Create a new alliance
+
+ We'll have a closer look at the two last options in the following paragraphs.
+
+
+ Before joining an alliance you have to know what the existing alliances are and which ones might be looking for new members. Several means at are your disposal:
+
The general forums: among the general forums there is a recrutment forum in which alliances which are recruting new members can advertise. You can choose one from there
+
The rankings: on the ranking page, there is an alliance ranking section from which you can pick your future alliance.
+
The maps: there is an alliance display mode for the maps which reveals alliance tags on the map. You can select a neighbouring alliance to send a joining request to.
+
+ Once you've selected an alliance to join or in order to choose one you might be interested in getting more data on the alliance. The alliance information section of the alliance page allows you to do just that.
+
+ Once you've made you decision about the alliance you want to join you may send a joining request. It's what the Join an alliance section of the page is for. In order to send a joining request you have to type the alliance tag in the relevant text field and click the Send request button.
+
+ The section of the page now present a status on the current sent request. In case you'd change you mind you can click the Cancel Request button to cancel your request.
+
+ A message will be sent to your account and stored in the Internal Transmission folder once your joining request is accepted or rejected.
+
+ Keep also in mind that you can only send one request at once and can only be member of one alliance at a time.
+
+
+ Providing the alliance tag in the text field and clicking the display information button reveals:
+
Alliance name: full length name of the alliance
+
Leader: name of the player leading the alliance
+
Rank: rank of the alliance in the alliance ranking
+
Points: number of points for the alliance in the rankings
+
Planets: total number of planets controlled by members of this alliance
+
Avg. coordinates: average coodinates of the planets controlled by this alliance
+
+
+
+ In order to create a new alliance you have to provide two different elements in the relevant text fields of this section of the page:
+
Alliance tag: it's the short hand used for joining request and diplays on the maps and so on
+
Alliance name: complete name of the alliance
+
+ You can now click the Create this alliance button. Your alliance will be created and you'll have a lot to do to manage it, as presented in other sections of this manual.
+
+
diff --git a/manual/beta5/en/alliance_manage.lwdoc b/manual/beta5/en/alliance_manage.lwdoc
new file mode 100644
index 0000000..cebb2d3
--- /dev/null
+++ b/manual/beta5/en/alliance_manage.lwdoc
@@ -0,0 +1,173 @@
+
+
+ beta5
+ en
+ Alliance Management
+
+ The alliance management pages provide you with useful information about the alliance in the same trend as the alliance information previously described or listings of members and controlled planets. It also offers means to manage members, alliance specific forums and ranks. The various sections of this part of the manual describe those features.
+
+
+
+ This section present the main elements concerning the alliance along with means to acquire data about other alliances and a way to leave it.
+
+
+ This part of the page displays your status inside the alliance (leader or member) along with useful data similar to those displayed in the Alliance Information part. See this manual section for an exact list.
+
+ If you are leader of the alliance and have a successor you can choose to step down by clicking the corresponding button in this part of the page. Your successor will automatically become the new leader of the alliance.
+
+ The Leave button also allows you to leave the alliance whenever you want.
+
+
+ The leader can change here some general settings for the alliance:
+
Government: it can be either Dictatorial (members do have access to any voting facility to elect a new leader) or Democratic (members can vote for their leader). The goverment system can be chosen by using the radio button in front of the government system to select.
+
Successor: a member name can be put in the texfield. This member will automatically become the alliance leader if the current one loses all his planets, steps down or leaves the alliance.
+
+ Once data are changed in this section, two buttons appear. The Update button allows to take changes into account. The Reset button reverts to previous settings.
+
+
+ It's the same system as when you have'nt joined an alliance yet.
+
+
+
+
+ This section provides different listings linked with alliances:
+
Alliance Planets: lists the planets belonging to the alliance
+
Alliance Members: lists the players who are members of the alliance
+
Planets under Attack: lists the planets which are part of the alliance and currently are under attack
+
+ It also offers common features for all lists.
+
+
+ At the top of the page the Listing drop down list allows to switch among listings.
+
+ You can also chose the number of elements to display per page with the coresponding drop down list. When several pages are necessary a specific drop down list appear to allow you to move between pages.
+
+ A search facility is also provided. When it is relevant you can either choose to search a planet or a player name by selected the radio button before the item you're interested in. When filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in wherever it may be in the whole name.
+
+
+ This lists all planets in the alliance including for each of them:
+
Coordinates: coordinates of the planets
+
Planet: name of the planet
+
Owner: name of the player who owns the planet
+
Factories: total number of factories on the planet
+
Turrets: total number of turrets on the planet
+
+ In this listing, clicking on the title of one column allows to order the list according to the values of that field. Depending on the direction of the arrow which appears the order is ascending or descending. Clicking again on the same title changes the order from ascending to descending and the other way around.
+
+ A colour code is used to allow you to see if planets are under attack at a glance; these are displayed in red.
+
+
+ This lists all members in the alliance including:
+
Name: name of the player
+
Rank: rank of the player inside the alliance; see rank administration of this manual to learn more about the alliance rank system
+
+ In this listing, clicking on the title of one column allows to order the list according to the values of that field. Depending on the direction of the arrow which appears the order is ascending or descending. Clicking again on the same title changes the order from ascending to descending and the other way around.
+
+ If you have sufficient privileges a checkbox is diplayed before each member name. Checking the box displays some actions features at the bottom of the page including two buttons:
+
Kick: to kick the selected members out of the alliance
+
Change their rank: to change the rank of the selected members to the rank selected in the drop down list displayed afterwards.
+
+
+
+ This lists planets belonging to the alliance which are currently under attack along with useful information such as:
+
Coordinates: coordinates of the planet under attack
+
Planet: name of the planet under attack
+
Owner: name of the player who owner the planet under attack
+
Def. Power: power of the fleets which defend the planet
+
Att. Power: power of the fleets which attack the planet
+
Defenders: list of names of players who are currently defending the planet
+
Attackers: list of names of players who are currently attacking the planet
+
+ For each planet under attack a colour code represents the current defense status compared to enemy fleets:
+
Green: defending fleets have more than 3 times the enemy average power. It's very likely no support is needed and defending fleets should win
+
Red: attacking fleets have more than 3 times the defending average power. It's very like the defenses will be defeated
+
Grey: the average power difference between defending and attacking fleets isn't that big and the outcome of the battle isn't obvious
+
+ In this listing, clicking on the title of one column allows to order the list according to the values of that field. Depending on the direction of the arrow which appears the order is ascending or descending. Clicking again on the same title changes the order from ascending to descending and the other way around.
+
+ You have to be aware that the information provided in this listing may not be 100% accurate. Indeed the are influenced by technologies of the communications area and are subject to electronic counter measures (encryption methods and such) as long as electronic counter counter measures (jamming). The accuracy of the data displayed depends both on the level of technology you and the enemy have in the field.
+
+
+
+ When a player requests to join an alliance for which you can manage pending joining requests a message is sent to your account and stored in the Internal Transmissions folder.
+
+ The Pending Requests part of the Alliance page displays the list of pending joining requests. To accept or reject a given player you have to check the checkbox in front of his name and click the relevant button: Accept or Reject.
+
+
+
+ This section of the alliance management page allows you to perform administration tasks on the alliance specific forums. You can both create and manage those forums from here.
+
+
+ The Create a forum link in the top right corner of the page directs you to a forum creating form you have to fill in properly in order to create a new forum. Before creating the forum you have to provide the following information:
+
Forum name: in this textfield you have to type a new name for the future forum
+
New threads: you have to select who will be allowed to create new threads in the forum by clicking the radio button before the option you're interested in. It can be either Everyone or Moderators only
+
Initial position: this drop down list allows you to select where to place the forum in the forum management page compared to the other existing forums
+
Description: in this textarea you can type in a longer description of the forum
+
Forum access: in this section you have to decide for an access level for each of the customised ranks defined for the alliance. In order to do so you have to check the checkbox located before the rank(s) you want to change access for. Three buttons will appear at the bottom of the page to allow you to manage the access level of the given rank(s):
+
No access: in order to forbid access to that forum to members of this rank click on the Give no access button
+
Standard access: in order to provide access with no extra privileges to the forum for members of that rank click the Give standard access button
+
Moderators: in order to give moderator privileges for that forum to the members of this rank click the Make moderator button
+
+
+
+ You can now either click the OK button to create the forum or the Cancel one to cancel your changes.
+
+
+ Once created, all forums are listed in the Alliance Forums page along with:
+
Name and description: name and description of the forum along with useful links
+
New threads: information about who can create new threads in that forum
+
+ Along with each forum name and description a set of links allow to manage them:
+
Edit: goes back to the forum creation form with prefilled data for the current forum so that you can make changes
+
Delete: allows you to delete the given forum
+
Move down: allows you to move the forum down in the list
+
Move up: allows you to move the forum up in the list
+
+
+
+
+
+ This section of the alliance management page allows you to both create and manage customised ranks of members of your alliance. These ranks are linked with a set of alliance features that you define here.
+
+
+ The Create a rank link at the top right corner of the page directs you to a rank creation for you have to fill in. In order to create a rank you have to provide the following information:
+
Designation: name of the rank as it will appear in the members' listing
+
List access: this drop down list allows you to select which alliance listing will be displayed for players of this rank. It can be either:
+
Detailed planet list: all lists are available
+
Planet list: a less complete planet list is displayed
+
Member list: only the member list is available, the planet list is hidden
+
No access: no listing is displayed
+
+
+
List of planets under attack: check this checkbox so that the player can see the list of planets currently under attack
+
Diplomatic contact: use this radio buttons to make members of this rank diplomatic contact for the alliance or not. As diplomatic contact members receive messages sent to the alliance
+
Can vote: use this radio button to allow members of this rank to vote or not in democratic alliances
+
Can apply for presidency: use this radio button to allow members of this rank to apply for presidency or not in democratic alliances
+
Member management: the following items allow you to decide what role in member management the players of this rank will have:
+
Accept pending requests: use this radio button to allow members of this rank to accept pending joining request
+
Kick members: use this radio button to allow members of this rank to kick members of not. If the Only members of a specific rank option is chosen, a list of all currently existing ranks will be displayed with checkboxes before each rank. Check the boxes before the ranks you want the members of ths rank to be allowed to kick.
+
Change ranks: use this radio button to allow members of this rank to change the rank of other members or not. If the Only members of a specific rank option is chosen, a list of all currently existing ranks will be displayed with checkboxes before each rank. Check the boxes before the ranks you want the members of this rank to be allowed to promote / demote.
+
+
+
Forum access: the following items allow you to decide what forum access the members of the new rank will have:
+
Forum administrator: use this radio button to make members of the new rank forum administrators. As such they'd have all privileges on all forums and the following items will be hidden
+
Forum access: for each existing forum a radio button allows you to chose an access level for members of the new rank. It can be either No access, User or Moderator.
+
+
+
+ Once you've made your modificaction you can either click the Ok button to create the new rank or the cancel button to cancel the changes.
+
+
+ The Rank Administration page provides a list of all defined ranks for the alliance along with useful links including:
+
Rank name: name of the rank as defined during its creation
+
Actions: actions which can be performed on the rank. It can be either edit or delete. The default rank Standard member can't be deleted but only edited
+
Members: number of members of this rank in the alliance
+
+ For each rank several actions are possible:
+
[ + ]: clicking on this symbol before the name of the rank displays a short description based on the privileges attached to this rank
+
Edit: clicking on this link directs you to the rank creation page with prefilled values for the current rank so that you can make changes.
+
Delete: this link allows you to delete a rank. If the alliance has members who currently have this rank a drop down list of available ranks is displayed which allows you to choose to what rank to demote the members who have to rank to delete
+
+
+
+
diff --git a/manual/beta5/en/allies.lwdoc b/manual/beta5/en/allies.lwdoc
new file mode 100644
index 0000000..bd95737
--- /dev/null
+++ b/manual/beta5/en/allies.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Trusted Allies
+
+ In Legacy Worlds you can entrust other players with control of your fleets while you're not online. This page allows you to manage the list of players you want to trust with your fleets in those circumstances along as to know which players might trust you with their fleets.
+
+
+ Typing the name of a player in the provided textfield in this section of the page and clicking the Add button adds the player to your trusted allies list. You can add up to 5 players to the list.
+
+
+ This list present your trusted allies in an ordered way. The different shades of green represent trust levels. When you're not online the player who can move your first is the first online player in the ordered trusted allies list, that is to say the online player with the higher trust level.
+
+ A checkbox is displayed in front of each player name in the list. You have to check the checkbox in front of a name to select the corresponding player. You can perfom several actions on selected players:
+
Remove: clicking on the Remove button removes the selected player from the trusted allies list
+
Up: clicking on the Up button moves the selected player up in the trusted allies list
+
Down: clicking on the down button moves the selected player down in the trusted allies list
+
+
+
+ This list present all players who trust you, including:
+
Player: name of the player who has you in his trusted allies list
+
Trust Level: level of trust at which you are located in this player's list, that is to say your rank in his trusted allies list
+
+
+
diff --git a/manual/beta5/en/background.lwdoc b/manual/beta5/en/background.lwdoc
new file mode 100644
index 0000000..a17a49c
--- /dev/null
+++ b/manual/beta5/en/background.lwdoc
@@ -0,0 +1,17 @@
+
+
+ beta5
+ en
+ Background
+
+ Land, resources, religion, ideology, colour of skin, power... any cause is worth it. A fight, a war. It could be now, it could be tomorrow. Does it really matter? In the end, the result is all the same: devasted cities, wastelands, undrinkable water, polluted soil and scattered survivors. After years of internal conflicts and devastating wars humanity has finally achieved its ultimate goal: the devastation of its home planet, Earth. What hope is there for those faced with an impossible task: survival on a radioactive piece of rock which could collapse into space dust at any time. The only option left for the remaining survivors of the holocaust: flee to the stars in the hope of finding a new home and rebuilding their civilisation.
+
+
+ Hundreds of ships were launched into deep space. Their hope: finding a suitable planet, one that can sustain life as they knew it, one where they could settle and rebuild, one that they might take better care of than the previous one. They searched for years for such harbor, safe haven.Going deeper and deeper into the galaxy. Where noone has gone before.
+
+
+ As commandant of a small group of colonists you've finally managed to find a planet matching the required parameters and you're about to start rebuilding on it. It will be up to you to make it grow into a new galactic empire within a hostile universe. To achieve that goal you'll have to find allies among the other Earth refugees who settled in the neighbouring star systems and fight those willing to spoil your hard work.
+
+ It will also be up to you to provide your citizens with what they might need and encourage the scientists of the expedition in their research to achieve new technological breakthroughs. It will be up to you to fufill Earth's legacy...
+
+
diff --git a/manual/beta5/en/battles.lwdoc b/manual/beta5/en/battles.lwdoc
new file mode 100644
index 0000000..4c206bd
--- /dev/null
+++ b/manual/beta5/en/battles.lwdoc
@@ -0,0 +1,60 @@
+
+
+ beta5
+ en
+ Battles
+
+ Battles regulate the way military engagements occure in LegacyWorlds. The next parapgraphs describe how battles are managed in game.
+ When entering into battle mode, fleets remain unavailable until a battle tick has occured on the stellar object they are orbiting.
+
+
+
+ Battles occure when the following conditions are met:
+
Location: the fleets have to be at the same location. Same location means orbiting the same stellar object. Two fleets in hyperspace don't engage in battle because the particular nature of this parallel dimension renders weapons inefficient
+
Fleets' mode: the modes of the fleets have to be different ((one in defense and one in attack at least)
+
Vacation mode: in the case of an attack on a planet, the attacked planet has to belong to a player who isn't in vacation mode
+
Planet: a battle also occures when a fleet is in attack mode on a planet, be it defended by fleets or turrets or not
+
+
+
+ Battle computations correspond to the calculation of the outcome of a battle. They are regulated by the following rules:
+
Battle computations take place at Battle ticks, every 4 hours
+
The losses of ships and turrets for each side are calculating depending on relative average power and fleet composition of each side
+
The primary factor taken into account is the relative power between attacking and defending fleets. The bigger the difference, the more losses the smaller fleet will sustain and the less losses the bigger fleet will have
+
The number of ships of each type being detroyed depends on fleet composition. The more ships of one category the more will be destroyed
+
+
+
+
+ Each time a battle tick during which you have been engaged in battle has occured, a battle report is sent in your Internal Transmissions folder by your Military Advisor. This report includes for each location a description of the fleets in presence and the outcome:
+
Fleet categories: the report includes up to three categories of fleets:
+
own fleets (green)
+
friendly fleets (blue)
+
enemy fleets (red)
+
+
Fleet composition: for each group of fleets is displayed the composition of the fleet before the battle (Start Column) and the losses (Losses column) for each ship category present and for Turrets if any, along with the same data in power of the fleet
+
Comment: at the bottom of the Battle Report the Military Advisor provides some insights on the next move to make
+
+
+
+
+ When attacking a planet with sufficient forces, a point is reached where all defenses have been destroyed, be they ships or turrets. At the next hour tick is then computed if anyone could take control of the planet. Owner change is decided based on the rules described in the next paragraphs.
+
+
+ The control over the planet can only change if the ground assault troups have a isufficient control over the population. A single company can't control a whole planet, whatever elite they are, can't they?
+
+ As a consequence a player has to have more GAs ships than the number of GA ships required to control the population, in order to take control of the planet.
+
+ At the beginning of the game, the troups transported in 1 GA ship can control 200 population units. This number can be increased through technological advances such as:
+
Exoskeleton
+
Nanofiber Armor
+
Self-repairing Exoskeleton
+
+
+
+ In some cases, several players with fleets including GA ships may be attacking the same planet at once. When several players are attacking the same planet, control over the planet is given to the one who has the capacity to control the more population.
+
+ It doesn't necessarily mean that the player with the more GA ships will gain control. Everything depends on the level of technology each player involved has.
+
+
+
diff --git a/manual/beta5/en/communications.lwdoc b/manual/beta5/en/communications.lwdoc
new file mode 100644
index 0000000..f94f63b
--- /dev/null
+++ b/manual/beta5/en/communications.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Communications
+
+ There are two major means of communication in LegacyWorlds: a messaging system and forums. These allow you to keep in touch with other players both inside your own alliance and outside of it.
+
+
+ This page sums up your current status towards the messaging system and the forums. It allows to see at a glance where to read and where you attention is needed when things come to communications. This manual page describes the contents of this page.
+
+
+ The Messaging System in Legacy Worlds is very similar to a simple mail client. It allows for folder creation to manage and store messages and offers a linear or threaded view of messages. In the bottom left part of the messaging system pages there is a link that allows you to switch to the forums. The various features are described in more details in the Messaging System section of the manual.
+
+
+ Those forums are very similar to those you might find in any message board.
+ There are several categories of forums:
+
Legacy Worlds Forums:- these are used by the staff to make announcements and by layers to report bugs and ask for new features.
+
General Forums:- these are used for general discussions about the game and beyond.
+
Legacy Worlds - Public beta 5:- these are public forums which are specific for Beta 5. They include alliance recruitment forums and such.
+
Alliance specific Forums:- these are the forums of each individual alliance. Their name correspond to the alliance name.
+
+ Forum features and forum categories are described more precisely in the Forums section of the manual.
+
+
+
+
+
+
diff --git a/manual/beta5/en/communications_page.lwdoc b/manual/beta5/en/communications_page.lwdoc
new file mode 100644
index 0000000..13fd190
--- /dev/null
+++ b/manual/beta5/en/communications_page.lwdoc
@@ -0,0 +1,55 @@
+
+
+ beta5
+ en
+ Communications Overview Page
+
+ This page sums up your current status towards the messaging system and the forums. It allows to see at a glance where to read and where you attention is needed when things come to communications. This manual page describes the contents of this page.
+
+ This page in split in two sections:
+
Private Messages: this left part of the page presents an overview of the status of your messaging system
+
Forums: this right part of the part provides a summary about both general and alliance forums
+
+ The next parts of the manual page will describe each.
+
+
+
+ This left part of the page presents data related to the messaging system.
+
+ It first of all provides a Compose a Message which directs you to the message edition form where you can write a private message to send to either a player, a planet, or an alliance diplomatic staff.
+
+ The next two sections of the page will be described in the next paragraphs.
+
+
+ This part of the page presents the list of the three default folders that are available for all accounts:
+
Inbox
+
Internal Transmissions
+
Outbox
+
+ For each of those folder, the name of the folder is the link to the contents of the folder.
+
+ Next to the folder name, the total number of message contained in the folder is displayed. If unread messages are located in one folder, the number of unread messages is presented between brackets.
+
+
+ This part of the page present the list of all the custom folders you have created, if any. For each of those folder, the name of the folder is the link to the contents of the folder.
+
+ Next to the folder name, the total number of message contained in the folder is displayed. If unread messages are located in one folder, the number of unread messages is presented between brackets.
+
+ Below the list of custom folders a Manage Custom folders link directs you to the folder management page.
+
+
+
+
+ The right part of the page presents a list of all available forums. This list is split into two sections:
+
General forums: those forums are available to all players. They are organised in categories that are also displayed in the list
+
Alliance forums: if you're a member of an alliance and the leadership of the alliance has created forums, the forums you have access to are listed here. Only specific members of the alliance have access to each alliance forum, depending on the access rules set up on the alliance forum management page.
+
+
+
+ For each forum or forum category in the list, the name is the a link to the forum page of this particular forum or forum category.
+
+ Along the name is displayed the number of topics or threads in the forum. If there are unread topics, the number of unread threads is displayed after the number of topics between brackets.
+
+
+
+
diff --git a/manual/beta5/en/diplomacy.lwdoc b/manual/beta5/en/diplomacy.lwdoc
new file mode 100644
index 0000000..58073b0
--- /dev/null
+++ b/manual/beta5/en/diplomacy.lwdoc
@@ -0,0 +1,34 @@
+
+
+ beta5
+ en
+ Diplomacy
+
+ Diplomacy covers a lot of concepts concerning in game interactions of players outside of the direct communication means. The major element is the alliance system which allows players to build up teams. The diplomatic section of the game allows you also to manage list of enemy and trusted players. Diplomacy is also a way to acquire technologies you can't research on your own and to exchange planets and fleets through the marketplace. The main Diplomacy page provides an overview of all these topics.
+
+
+ This page provides an overview of your alliance if your part of one along with an overview of your allies and enemies and of your messaged. It includes shortcuts for the major elements in this area. The different sections of the page are the topic of the corresponding manual section.
+
+
+ An alliance is a group of players who have decided to team up and work together to be stronger in the game. Alliance related topics are detailed in the Alliance section of the manual.
+
+
+ This page allows you to keep a list of enemy players and alliance. This topic is discussed in more details in the Enemies manual section.
+
+
+ In Legacy Worlds you can entrust other players with control of your fleets while you're not online. This page is presented in the manual in the Trusted Allies section.
+
+
+ As the complete technological tree isn't available to one given player, you'll have to acquire some technologies from other players through diplomatic exchanges in order to obtain technologies you don't have access to. This feature is the topic of this manual section.
+
+
+ They might not be diplomatic relations per se but economic relations might be considered as a first step towards establishing more solid agreements. As such the marketplace is the place where you can buy or accept and sell or give fleets and planets in LegacyWorlds.
+
+
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/diplomacy_page.lwdoc b/manual/beta5/en/diplomacy_page.lwdoc
new file mode 100644
index 0000000..59d8bc5
--- /dev/null
+++ b/manual/beta5/en/diplomacy_page.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Main Diplomacy Page
+
+ This page provides an overview of your alliance if your part of one along with an overview of your allies and enemies and of your messaged. It includes shortcuts for the major elements in this area. The different sections of the page are the topic of the next paragraphs.
+
+
+ This overview provides a reminder of the alliance tag and name, its number of planets and coordinates, its rank and number of points. It also displays you status inside the alliance and a link to the alliance management page.
+
+ It also includes a section about alliance specific forums. It lists them with links to each forum and number of threads in each.
+
+
+ This overview presents the number of players that:
+
you have in your trusted allies list
+
have you in their trusted allies list
+
you have on your enemies list
+
+ This section also provides links to allies and enemies management pages.
+
+
+ This section provides an overview of your messaging system including:
+
Messages: total number of messages you have with a number of new ones; this title is a link to the message page
+
Internal Transmission: total number of internal transmissions you have with a number of new ones; this title is a link to the internal transmission folder
+
A link to the Compose a message page
+
+
+
diff --git a/manual/beta5/en/empire.lwdoc b/manual/beta5/en/empire.lwdoc
new file mode 100644
index 0000000..fa3deeb
--- /dev/null
+++ b/manual/beta5/en/empire.lwdoc
@@ -0,0 +1,272 @@
+
+
+ beta5
+ en
+ Empire
+
+ Your empire is composed of a set of planets. Starting at first with one it will grow through conquest of uninhabited planets or enemy ones. The overall technological advance of your empire can be improved through >research. The fleets you build will provide it with defenses against hostiles and help with its expansion. Of course all of this costs money.
+
+ In order to manage your empire you have to understand a set of basic concepts that are discribed in the next section of this manual page.
+
+ The last section introduces the set of game pages that allow empire management in game and provides links to manual sections discribing those pages more precisely.
+
+
+
+
+ The individual elements composing your empire are planets. Those planets are identified by a name and are located at a specific set of coordinates in the galaxy in which the game take place. At the beginning of the game you are provided with a single planet.
+
+
+ It is up to you to get your empire growing by conquering or buying other planets. Those planets are either considered neutral (they aren't owned by any real player) or they might belong to another player. In order to conquer another planet you have to send fleets to that planet in sufficient quantity to destroy its defenses. Your fleets also have to include a sufficient amount of GA ships to control its population so that it joins your empire.
+
+ In order to buy a planet you have to look at the marketplace and make a tempting enough offer so that its current owner agrees to sell it to you.
+
+ Your friends can also give you planets.
+
+
+
+
+ What makes great empires is their citizens. The population of a given planet represents the number of inhabitants of the planet. The population size of a planet has an influence on the base income of the planet and its happiness.
+
+
+ Population growth is essential: the more population the more factories and turrets you can build without facing an happiness decrease. Each planet's population increases every day tick.
+
+ The population increase calculation is influenced by several factors including:
+
the planet's happiness
+
the maximum population the planet can hold
+
technologies you possess
+
+ The following technologies and laws have an influence on population growth:
+
Advanced Hospitals
+
Corpse Reanimation
+
Forced Human Cloning
+
Nurishment Purification
+
+
+
+ The population a given planet can hold is limited. The limit is flexible around a fixed value. At first the maximum population of a planet is around 10,000 population units. Technologies can increase this value. Each technology increasing the maximum population size of a planet adds around 10,000 to the limit. Those technologies are:
+
Arcologies
+
Self-sustained Arcologies
+
Singularity Housing
+
+ Since there are 3 technologies, the ultimate limit lies around 40,000.
+
+
+
+
+ One major factor in LegacyWorlds is happiness. It reflect the overall satisfaction of your citizens. Be careful to keep them happy or they might revolt. Just as population growth and maximum size, happiness is influenced by several factors, that are presented in the floowing paragraphs of the manual.
+
+
+ Citizens like when the attention of their leader is focused on them and solely on them. As the consequence, the happiness on each planet will decrease as your empire grows. The more planets you have in your empire the harder it will be too keep a high happiness. Theoritically the happiest empire would be one composed of a single planet.
+
+
+ People don't like to be unemployed but they don't want to be overworked either. Therefore the number of factories on your planets has to be monitored. Up to one certain number of factorieshappiness will increase, but if you add more it will start to decrease. The "ideal" number of factories depends on the planet's population.
+
+
+ People like to feel safe but they don't enjoy a police state. As a consequence the amount of turrets has also to be right depending on the planet population. Just like with factories increasing the number of turrets on one planet will increase its happiness up to a point where it will start having a negative effect. The "ideal" number of turrets also depends on the planet's population.
+
+
+ Both your total amount of fleets and the size of the fleet stationned on one planet have an influence on happiness:
+
Total fleet size: your total fleet size is compared to the average total fleet size in your protection zone. If it is higher you get a happiness bonus, and a malus if it's lower.
+
Fleet stationned on a planet: having a fleet stationned on a planet also increases its happiness. This happiness bonus is linked to the percentage of your total fleet that is stationned on that particular planet
+
+
+
+ Technologies you possess and laws you have enacted (or revoked) might also have an influence on happiness. Some increase happiness and other decrease it.
+
+ Technologies and lawsincreasing happiness are:
+
Advanced Communications
+
Ban Biological Drones
+
Biosphere Protection Pact
+
Civilian Communication Act
+
Civilian Transportation Act
+
Green Production
+
Legalize Space Weed
+
Safe Recreational Drugs
+
Wormholes
+
+ Technologies and lawsdecreasing happiness are:
+
Biological Drones
+
Forced Human Cloning
+
Global Defense Bill
+
Martial law
+
Wild Capitalism
+
Wormhole Lockdown
+
+
+
+ Several decisions you might make in game might have an effect on the overall happiness of your empire, such as:
+
Destroying a planet with a WormHole SuperNovadecreases the happiness of all the remaning planets of the empire
+
Giving away / selling planetsdecreases the happiness of all your remaining planets
+
+ In those cases an happiness malus is applied immediately following the game action. This malus decreases slowly over time until the situation goes back to normal.
+
+
+
+
+ When a planet's happiness gets too low, there is a high probability the population might revolt. When citizens revolt on a given planet, they go on strike and stop working in factories, riots occure and material destruction have to be deplored.
+
+
+ When the happiness of a planet gets below 20%, the planet gets in a status where a revolt is possible. The lower the happiness the higher the probability a revolt could occure.
+
+ Each hour tick the planet is tested for revolt and in some cases the revolt actually happens. The event is more likely if the revolt probability is high that is to say if the happiness is very low.
+
+
+ What does it mean that a planet is revolting? It means that the citizens are quite unhappy with the way they are governed and that they express it. They go on strike and stop working in the factories. No income gets out of industrial factories and military factories' production is halted. They also riot which causes material destructions: turrets and factories are their targets and their number decreases.
+
+ Destroyingfactories and turrets changes the happiness value of the planet. With luck, a single revolt episode might get the planet's happiness above 20%. If not there is still a probability it will revolt each hour tick until the situation is corrected.
+
+
+
+
+ As in every society, when a planet has been run by the same government for some time, a corruption system> starts appearing. People resort to bribery to gain an advantage over other people, individuals use goverment money to achieve their own personal goals.
+
+
+ In LegacyWorlds, each new planet starts with a corruption level of 0%. As soon as it get into the control of a player corruption level starts rising. The rate of increase is linked to the number of factories on the planet: the morefactories the faster it grows. As soon as the corruption level of a planet reaches 10%, the factories on the planet start losing efficiency: income is reduced and military factories build slowlier as government officials use public money and factory workers to build swimming pools in their gardens.
+
+
+ A planet with a high corruption level can see its corruption level decrease if it remains neutral for some time. The only option to restore a planet to a decent corruption level is to abandon it and wait.
+
+
+
+
+ Two kinds of factories are available:
+
Industrial factories contribute to you empire's income
+
Military factories allow to build warefare
+
+ Technologies have an influence on factories productivity and production. This manual section will cover all those topics.
+
+
+ Industrial factories produces goods from raw materials. Those goods are sold within the empire and beyond its borders, which generates money. As a consequence the more industrial factories you have the more money you make. But there are workers in factories and they won't be too happy to have to work 3 jobs to get the planetary economy running. So there is a limit to the number of factories you can build without risking a revolt.
+
+ Industrial factories can be built from the individual page of each planet you own on from the quick builder facility on the planets page.
+
+
+ Military factories are specialised factories producing ships and turrets. The speed at wich items are built depends on the number of military factories on the planet. The more factories you have the faster it will go. But there are workers in factories and they won't be too happy to have to work 3 jobs to get the planetary weapon industry. So there is a limit to the number of factories you can build without risking a revolt.
+
+ Military factories can be built from the individual page of each planet you own on from the quick builder facility on the planets page.
+
+ The items available for construction in military factories depend on the technologies you possess. The following technologies provide you with new ships categories to build:
+
Battle Cruisers
+
Cruisers
+
Fighters
+
+
+
+ Several technologies and laws have either a positive or negative influence on factories productivity. They can either affect only industrial factories or only military factories or both.
+
+ Technologies and laws increasing productivity are:
+
Adaptive Materials
+
Anti-matter Generators
+
Automated Factories
+
Bio-engineering
+
Biological Drones
+
Cloning Vats
+
Global Defense Bill
+
Hardened Alloys
+
Intelligent Materials
+
Martial law
+
Nanotechnologies
+
Robotics
+
Room Temperature Superconductors
+
Self-healing Materials
+
Wild Capitalism
+
Wormhole Lockdown
+
+ Technologies and laws decreasing productivity are:
+
Ban Biological Drones
+
Biosphere Protection Pact
+
Global Defense Bill
+
Green Production
+
Increased Research Grants
+
Legalize Space Weed
+
Martial law
+
Science Golden Age
+
Wild Capitalism
+
Wormholes
+
+
+
+
+
+ At first your empire possesses a few basic technologies that allow for space travel and production. But in order to progress in the game you have to acquire new technologies, either by researching them inside your empire or by diplomatic exchanges.
+
+
+ Each day tick the planets in your empire generate a certain amount of research points. This research output is linked to the planets' population. The number of points generated for each population unit can be modified by technologies and laws such as:
+
Biological Computers (increase)
+
Increased Research Grants (increase)
+
Interstellar University (increase)
+
Miniaturised Particle Colliders (increase)
+
Nano-scale Computers (increase)
+
Quantum Computers (increase)
+
Science Golden Age (increase)
+
Wild Capitalism (decrease)
+
+ Those points are then used to research new technologies according to your research budget as set on the research page.
+
+
+ Technologies that are in the part of the technology graph that you can access get naturally researched using your reseach points.
+
+ Technologies that aren't in that part of the graph have to be acquired using the technology exchange tool in the diplomacy section of the research page. See the relevant section of the manual for more details.
+
+
+
+
+ In game money has nothing to do with real money. It's an imaginary currency even if the sign used correspond to the euro sign (yes, yes, we're europeans...). Money is the main mean used in LegacyWorlds to acquire items, be it by building them or from other players.
+
+
+ There are several ways to gain money:
+
Each planet has a base income linked with its population
+
Industrial factories also provide income. See the relevant section of the manual to know more about this topic.
+
You can also sell planets and fleets, through the marketplace facility
+
You can also receive cash donations from other players
+
+ Several technologies have an influence on your income.
+
+ Basically all technologies increasing the productivity of industrial factories increase you total income. See the factories section of this page to learn more about them.
+
+ Some other technologies have a direct influence on your income:
+
Economy Globalisation (increase)
+
Increased Research Grants (decrease)
+
Wild Capitalism (increase)
+
+
+
+ This money can be used in various means:
+
Money is necessary to build planetary improvements like factories and turrets. Each item has a specific cost
+
You also have to buy the ships you build. Each category of ships has a particular price.
+
In order to implement a new technology that you have discovered you have to pay a certain fee
+
Money can also be used to buy fleets and planets from other players
+
You can also give money to friends
+
A part of your income is automatically diverted to pay for the upkeep of factories, fleets and turrets
+
+
+
+
+
+
+ This page provides you with a status of your empire at a glance along with shortcuts to the most important items you might be interested in viewing. It is split into several sections, providing insights about your planets, research progress, finantial situation and fleets status.
+
+
+ This page provides your with an overview of the finantial situation of your empire. It is split into several sections that are detailed in a specific manual page.
+
+
+ This page provides you with a general overview of all your planets at once along with a quick builder facility. A link in the top right corner of the page allows to switch between two views:
+
List of controlled planets only
+
Quickbuilder facility and list of controlled planets
+
+ Each of those two elements are described in other paragraphs of the corresponding manual section.
+
+
+ This page is the management center for any individual planet you own or an information page for other stellar objects.
+
+
+ Some technologies in game provide you with the ability to build other spatial objects than just fleets: probes and beacons are just that and this manual page will provide you with all you need to know about them.
+
+
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/empire_overview.lwdoc b/manual/beta5/en/empire_overview.lwdoc
new file mode 100644
index 0000000..3dc810b
--- /dev/null
+++ b/manual/beta5/en/empire_overview.lwdoc
@@ -0,0 +1,68 @@
+
+
+ beta5
+ en
+ Empire Overview Page
+
+ The empire overview page provides you with a status of your empire at a glance along with shortcuts to the most important items you might be interested in viewing. It is split into several sections.
+
+
+ This section provides you with important facts about the planets which compose your empire:
+
Planets owned: number of planets in your empire
+
Average happiness: average happiness calculated based on happiness on each of your planets
+
Average corruption: average corruption calculated based on corruption on each of your planets
+
Total population: sum of the populations of each of your planets
+
Average population: total population divided by the number of planets in your empire
+
Total factories: total number of factories on all your planets
+
Average factories: total number of factories divided by the number of planets in your empire
+
Total turrets: total number of turrets in your empire
+
Average turrets: total number of turrets divided by the number of planets you own
+
+ It also provided links to:
+
The Planets overview page
+
Individual planet pages
+
+
+
+ This section provides you with informations about your research budget. For each research category, it displays the percentage of research points allocated along with the number of points per day this currently represents.
+
+ It also provided you with a link to the research management page.
+
+
+
+ This section is split into several paragraphs, each presenting one important aspect of your fleet power.
+
+
+ This overview provides a general view of your fleets, including:
+
Total fleet power: sum of the power of all the ships you possess
+
Fleet upkeep: total cost to sustain all your fleets
+
Number of fleets: total number of fleets
+
Fleets engaged in battle: number of fleets currently engaged in combat situations
+
View fleets: link to the Fleets management page
+
+
+
+ This section provides specific information about fleets located on your own planets, including:
+
Number of fleets: total number of fleets located on your own planets
+
Fleets engaged in battle: total number of fleets engaged in combat on your own planets
+
+
+
+ This part of the page provides informations about fleets that aren't located on your own planets, including:
+
Fleets on foreign planets: total number of fleets located on planets you don't own
+
Fleets engaged in battle: total number of fleets engaged in battle on planets you don't own
+
Moving fleets: total number of fleets in movement
+
Fleets waiting in Hyperspace: total number of fleets in stand-by in hyperspace
+
+
+
+ This section provides important statistics about your fleets, including:
+
GA ships: total number of GA ships
+
Fighters: total number of Fighters
+
Cruisers: total number of Cruisers
+
Battle cruisers: total number of Battle Cruisers
+
Total ships: total number of ships
+
+
+
+
diff --git a/manual/beta5/en/enemies.lwdoc b/manual/beta5/en/enemies.lwdoc
new file mode 100644
index 0000000..522120b
--- /dev/null
+++ b/manual/beta5/en/enemies.lwdoc
@@ -0,0 +1,19 @@
+
+
+ beta5
+ en
+ Enemies
+
+ This page allows you to keep a list of enemy players and alliance. This has for consequence that each time a fleet belonging to one of your enemy arrives at one of your planets it gets automatically switched to attack mode. Moreover it's impossible for them to switch their fleets to defense mode on your planets.
+
+
+ In this section of the page you can add a new enemy to your list by typing its player name in the textfield and clicking the Add button. The player name get displayed in the list below.
+
+ A checkbox is displayed before the name of each of the enemy players in your list. Checking those checkboxes make a new button appear. Clicking this Remove selected enemies button allows you to remove the players whose checkbox has be checked from the enemy list.
+
+
+ In this section of the page you can add a new enemy to your list by typing its tag in the textfield and clicking the Add button. The alliance tag get displayed in the list below.
+
+ A checkbox is displayed before the name of each of the enemy tags in your list. Checking those checkboxes make a new button appear. Clicking this Remove selected enemies button allows you to remove the alliances whose checkbox has be checked from the enemy list.
+
+
diff --git a/manual/beta5/en/fleets.lwdoc b/manual/beta5/en/fleets.lwdoc
new file mode 100644
index 0000000..97195fe
--- /dev/null
+++ b/manual/beta5/en/fleets.lwdoc
@@ -0,0 +1,44 @@
+
+
+ beta5
+ en
+ Fleets
+
+ Fleets are one of the major elements in LegacyWorlds, since they allow you to travel the universe, conquer new planets and defend yourself against enemies.
+ Fleets are sets of ships you can use either to >defend yourself or attack other planets. Each fleet can be composed of ships of several different categories. Those fleets can be moved from planet to planet according to a particular set of rules. When faced with enemy fleets they of course engage in battle.
+
+ In order to have fleets you first of all have to possess the required technologies. You also have to build them.
+
+ Fleets building is covered more precisely in the following manual sections:
+
Military factories section of the empire manual page
+
Building warefare section of the individual planet page manual page
+
Quickbuilder section of the planets overview manual page
+
+
+ Fleets being one of the major concepts to grasp in LegacyWorlds, various fleets related topics will be studied in more details in different subsections of the manual. Those subsections are presented in the next paragraph.
+
+
+
+ Fleets are composed of ships. It sounds only natural to start with ships. This section of the manual will present all topics linked with ships categories and caracteristics.
+
+
+ The Fleets page is the main entry point to manage fleets. This part of the manual will present this page more deeply. The fleet page consists in three different sections:
+
Top part: it includes a set of filters
+
Middle Part: it's the actual fleets list. It's either a complete list or the result of the choices you've made with the filters
+
Bottom Part: it's the Action section of the fleet page, where you can actually act on the fleets.
+
+ The fleets page manual section will describe each part of the page.
+
+
+ Once you have selected at least one fleet in the fleets list of the fleets page, a list of links, corresponding to different actions you can perform with the fleets, is displayed. This list include a selection among the total list of possible actions, depending on the circumstances. Those actions will be presented in the Fleets actions part of the manual.
+
+
+ The main goal of fleets is, obviously, to fight. The different rules surrounding the battle is the topic of the Battles section of the manual.
+
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/fleets_actions.lwdoc b/manual/beta5/en/fleets_actions.lwdoc
new file mode 100644
index 0000000..fd1dfe6
--- /dev/null
+++ b/manual/beta5/en/fleets_actions.lwdoc
@@ -0,0 +1,37 @@
+
+
+ beta5
+ en
+ Fleets Actions
+
+ Once you have selected at least one fleet in the fleets list, a list of links, corresponding to different actions you can perform with the fleets, is displayed at the bottom of the fleets page. This list include a selection among the total list of possible actions, depending on the circumstances.
+
+
+ Once you have selected a set of fleets with the corresponding checkboxes, you may want to unselect them all at once without having to click on all the checkboxes one at a time. This feature does just that: click on this link to unselect all selected fleets.
+
+
+ Clicking on this link opens an alert window where you can type in a new name for the fleet and change it. if several fleets are selected all selected fleets will be renamed with the new name.
+
+
+ Clicking on this link directs you to a new page where you can manage the movements of the selected fleets. This topic is described more thoroughly in the fleets movements section of the manual.
+
+
+ Clicking on this link directs you to a new page where you can define how to split the fleet. This topic is described more closely in the splitting fleets section of the manual.
+
+
+ Clicking this link opens an alert box where you can type in the name of the new merged fleet and validation actually merges the fleets.
+
+ Of course the fleets have to be at the same location. If fleets on several locations are selected, only possible merges are performed.
+
+ The only other requirement is that all fleets have to be available. For instance you can't merge fleets unavailable because of battle but this action can be performed on moving fleets.
+
+
+ Clicking this link directs you to a fleets sale page which is described more closely in the marketplace section of the manual.
+
+
+ Clicking this link opens a confirmation alert box. If you validate the action the selected fleets will disappear from the game.
+
+
+
+
+
diff --git a/manual/beta5/en/fleets_moving.lwdoc b/manual/beta5/en/fleets_moving.lwdoc
new file mode 100644
index 0000000..bed3d31
--- /dev/null
+++ b/manual/beta5/en/fleets_moving.lwdoc
@@ -0,0 +1,199 @@
+
+
+ beta5
+ en
+ Fleets Movements
+
+
+
+ When coming to fleets movements in LegacyWorlds, two different kinds of "space" have to be considered:
+
normal space
+
hyperspace
+
+ Both types will be covered in the next parapgraphs.
+
+
+ Normal space can be considered as the "real world" space, where stars, planets and other stellar objects are located. It's the space in which system ships can travel with their sub-light engines. But moving from one stellar system to another with that kind of engines would take centuries and researchers in LegacyWorlds had to find other means to allow space exploration to be more practical. That's where hyperspace travel gets in.
+
+
+ The scientists in the LegacyWorlds universe soon realised space could also be apprehended on another plane that they called hyperspace. Hyperspace could be considered as another dimension, adjacent to the real one, where the distances between spatial bodies are significantly distorted. As a consequence, hyperspace travel is much faster than travel in normal space. The main drawbacks are that:
+
jumping between hyperspace and normal space used tremendous amounts of energy which implies some specialised engines to open hyperspace windows
+
the lay-out of hyperspace is fluctuating and impossible to cartography. As a consequence moving ships following a defined trajectory reach their destination without problem. But ships stationned in hyperspace can derive from their location and lose clear knowlegde of their position and get definitively lost, unless they have a static point of reference in the form of a hyperspace beacon
+
+
+
+
+
+ Movement computation is the process that allows to define the position of a moving fleet. The exact rules behind this computation include general rules that are valid for all ravel types and others depend on the type of space the fleets are moving in. Rules for all movements, normal space and hyperspace travel are the topics of the next two paragraphs.
+
+
+ All space travels are regulated according to those rules along with rules specific to the type of travel. These general rules are listed below:
+
Movement computation and current position of every moving fleets is calculated every minute. This allows for an almost real time effect of fleets movements
+
In case of a change in the destination of a fleet, the new trajectory is calculated using its current location as starting point
+
Fleets passing by a planet can't be spotted by its owner unless they get into orbit around the planet
+
Fleets' speed is influenced by the type of objects they pass by: nebulas and planetary remains reduce the speed of ships crossing their orbits
+
+
+
+ Normal space travel is regulated by the following rules:
+
Fleets always travel in normal space inside a given stellar system unless the fleet is hyperspace capable and an hyperspace stand-by delay has been set. In such a case the fleets travel in hyperspace but the travel time remains the same as for normal space travel
+
Between two stellar objects a fleet follows the most direct trajectory between the two
+
The fleet always crosses all the orbits between the two stellar objects (its origin nd its destination). As a consequence moving from the first orbit to the 6th takes much longer than from the first to the second
+
Travelling from one orbit to the orbit immediately next to it takes 12 min. The time to travel between two planets inside the same is then a multiple of 12, the multiplication factor depending on the number of orbits to cross
+
+
+
+ Hyperspace travel is regulated by the following rules:
+
When going beyond the limits of a stellar system or a nebula, a fleet has to travel through hyperspace. Fleets that aren't hyperspace capable can't go beyond the limits of a stellar system
+
When leaving a stellar system, a fleet has to cross all orbits between its starting point and the edges of the system before travelling to the next one
+
A fleet moving between two stellar systems follows the most direct path to the destination system
+
When entering its destination system a fleet crosses again the necessary orbits until it reaches its destination planet
+
Whatever the origin and destination orbits in the stellar system are the time to go from one system to another is always the same
+
Hyperspace travel speed can be increased through technologies. This topic is covered in the ship speed of the ships section of the manual
+
+
+
+
+
+
+ There are two different means to access the fleets' orders page:
+
On the individual page of each planet, planetary remains or nebula square, a Send Fleets link is available below the name of the stellar object. Clicking this link directs you to a specific page where you can select the fleets you want to send to that particular location and set up some parameters for the movement of the fleet
+
On the main fleet page, when at least one fleet is selected, a Change orders link is displayed in the bottom Actions section of the page. Clicking this link also directs you to the fleets' order change page
+
+
+
+
+ The page includes some actions links and three different sections:
+
New orders: to define the orders you want the selected fleets to perform
+
Selected fleets: this list displays all fleets selected to perform the action defined in the New orders section
+
Available fleets: this lists includes all fleets you can control (bet it yours or those of your off-line trusted allies) which could follow the orders
+
+
+
+
+ In this part of the page you can define three kinds of orders:
+
Destination: to choose where to send the fleet
+
Hyperspace stand-by orders: to get a fleet to stand-by in hyperspace
+
Fleet mode: to define the mode the fleet will be in upon arrival
+
+ Each type of order willl be detailed in the next paragraphs.
+
+
+ The Destination line first defines the fleet's destination if any has already been set. The destination is preset for instance for moving fleets or when you access the page from the Send Fleets link of an individual stellar object page.
+
+ To change the destination you have to click the Set destination link. You'll get directed to a new page describing current destination if any and providing a destination selection tool. This tool consists in a minimap and several means to change the system it is centered on:
+
Minimap: this minimap is centered on the system in which is located your first planet and displays one stellar system at a time. Arrows are diplayed around the minimap if the selected fleets are hyperspace capable or if you have hyperspace capable fleets in case no particular fleet is selected yet. Using the arrows around the map allows you to change the focus of the minimap and move around that system
+
Centre on coordinates: you can center the minimap on a particular stellar system based on its coordinates. To do you you have to select the relevant radio button and type the coordinates of the stellar system in the provided textfields. Clicking the Move button centers the map on this system
+
Centre on own/allied planet: you can also center the minimap on one of your own planets or one of your trusted allies' planets. To do so, select the relevant radio button and choose the planet you're interested in in the drop down list. Clicking the Move button centers the minimap on the system the planet is located in
+
Centre on planet: you can also center the minimap on an stellar body based on its name. In that case select the corresponding radio button and type in the name of the stellar object in the provided textfield. Clicking the Move button centers the minimap on the system the planet is located in
+
+ Once you have centered the minimap you have to choose the particular stellar object you want to send your fleet to by clicking its name in the minimap. You can now either validate you destination by clicking the Confirm button or cancel your changes by clicking the Cancel button.
+
+
+ Fleets around a stellar object can either:
+
orbit it in clear sight in normal space
+
stay in its neighbourhood in hyperspace
+
+ The hyperspace stand-by orders line first of all indicates current orders, that is to say for how long a fleet is supposed to stay in hyperspace without moving at its current location or at its destination.
+
+ A Set delay link allows you to define for how long the fleet should remain in hyperspace either at its current location or once it has reached its destination. Clicking the Set Delay link opens an alert box where you can type in the number of hour ticks the fleet should spend in hyperspace. For instance a delay of 1 means the fleet has to wait until the nexthour tick and so on.
+
+
+ The fleet mode might be considered as the battle readiness of the fleet. It might also be interpreted as the intention of the fleet: hostile or friendly.
+
+ There are two different available modes for fleets in LegacyWorlds:
+
Defense: the fleet will defend the destination stellar object
+
Attack: the fleet will attack the destination stellar object, attempting to take it over if it's a planet
+
+ The mode in which the fleet is sent can be changed by using the provided drop down list. You just have to select between Defense and Attack in the list.
+
+ Keep in mind you can't send a fleet in attack mode to one of your own planets but no control is exerced on fleets sent to alliance planets or planets belonging to your trusted allies.
+
+ The mode the fleet will have upon arrival at its destinationisn't necessarily the mode it was sent with. The rules behind this mode upon arrival topic is discussed more closely in this paragraph.
+
+
+
+
+ This part of the page presents the list of fleets that are selected to perfom the designed movement. It consists in a table describing each fleet using a colour code to represent fleets' ownership. Actions can also be performed on the list.
+
+
+ The table includes for each fleet:
+
Owner: name of the owner of the fleet
+
Name: name of the fleet
+
Haul: fill rate of the haul of capital ships carrying system ships. It's either N/A for system fleets or a percentage for fleets including capital ships. Be careful if the percentage isn't superior to 100%: in that case the fleet isn't hyperspace capable
+
Ships (G/F/C/B): fleet composition, including number of GA ships, Fighters, Cruisers and Battle Cruisers
+
Power: the power of the total fleet
+
Trajectory: this field presents the list of locations the fleets will go close by along its path to its destination. For stationnary fleets, the value is N/A. For moving fleets, the trajectory is represented with a drop down list describing current and future status and locations
+
+
+
+ The usual colour code is used in the list:
+
Green: for your own fleets
+
Blue: for fleets belonging to off-line players who have you as trusted allies and that you can currently control
+
+
+
+ The only possible action in the list is to remove a fleet. Removing a fleet means that it won't perform the orders as the other fleets in the list. Previous orders for the fleets removed from the list are executed.
+
+ In order to remove a fleet from the list you just have to click on its line.
+
+
+
+
+ This part of the page presents the list of fleets that are available for selection to perfom the designed movement. It consists in a table describing each fleet using a colour code to represent fleets' ownership. Actions can also be performed on the list.
+
+ The list of fleets depends on the set destination. For instance fleets that aren't hyperspace capable aren't displayed if the defined destination implies hyperspace travel.
+
+
+ The table includes for each fleet:
+
Owner: name of the owner of the fleet
+
Name: name of the fleet
+
Haul: fill rate of the haul of capital ships carrying system ships. It's either N/A for system fleets or a percentage for fleets including capital ships. Be careful if the percentage isn't superior to 100%: in that case the fleet isn't hyperspace capable
+
Ships (G/F/C/B): fleet composition, including number of GA ships, Fighters, Cruisers and Battle Cruisers
+
Power: the power of the total fleet
+
Current orders: the current status of the fleet (defending a planet, moving to a particular destination, attacking a planet and so on)
+
+
+
+ The usual colour code is used in the list:
+
Green: for your own fleets
+
Blue: for fleets belonging to off-line players who have you as trusted allies and that you can currently control
+
+
+
+ The only possible action in the list is to add a fleet from the available fleets list to the selected fleets list. Adding a fleet to the selected fleets list means that the fleet will follow the same orders as the other selected fleets.
+
+ In order to select a fleet you just have to click on its line.
+
+
+
+ Once you are satisfied with the changes you have made in the different sections of the page you have to validate your orders.
+
+ In order to validate your orders you have to click the Confirm link in the top right section of the page. Clicking the link actually sends the fleets and directs you back to the fleets page.
+
+ In the same area of the page a Cancel link erases your changes and directs you back to the fleets page.
+
+
+
+
+
+ Depending if you have set up an hyperspace stand-by delay or not two cases are possible:
+
With hyperspace delay: the fleet doesn't get out of hyperspace into normal space immediately and remains in hyperspace until the defined number of hours ticks have passed by. It then jumps into normal space and gets into orbit. Getting into orbit is a complicate process which consumes a lot of energy. As such it causes the fleet getting out of hyperspace to remain unavailable at least until the following hour tick
+
Without hyperspace delay: the fleet directly gets out of hyperspace if it reached the planet through hyperspace, or settles in orbit around the planet if it arrived via normal space. In any case, the process implies it remains unavailable at least until the next hour tick
+
+
+
+ The mode of a fleet getting in orbit around a planet depends on various factors:
+
In most cases: the fleet reaching orbit keeps the same mode as the one it was sent with
+
You already have fleets on the planet: if your different fleets don't have the same mode (some in attack and some in defense) the fleets get switched to the mode of the fleet with the highest power
+
Auto-attack mode: if the owner of the planet has you or your alliance in his enemies list whatever fleets you may send to any of his planets get automatically switched to attack mode
+
+
+
+ When a fleet reaches its destination (eventually getting out of hyperspace on it) and starts orbiting it, it remains unavailable for some time. Unavailability time depends on two cases:
+
Arrival in attack mode or on a planet whose owner has you in his enemy list (be it you as a player or as member of a given alliance): the fleet is unavailable until a Battle tick occurs
+
Other cases: the fleet is unavailable until next Hour tick
+
+
+
+
diff --git a/manual/beta5/en/fleets_page.lwdoc b/manual/beta5/en/fleets_page.lwdoc
new file mode 100644
index 0000000..62c9895
--- /dev/null
+++ b/manual/beta5/en/fleets_page.lwdoc
@@ -0,0 +1,161 @@
+
+
+ beta5
+ en
+ Fleets Page
+
+ The Fleets page is the main entry point to manage fleets. This part of the manual will present this page more deeply. The fleet page consists in three different sections:
+
Top part: it includes a set of filters
+
Middle Part: it's the actual fleets list. It's either a complete list or the result of the choices you've made with the filters
+
Bottom Part: it's the Action section of the fleet page, where you can actually act on the fleets
+
+ This manual section will describe the two first parts of the page. Fleets actions are the topic of another manual section that you can access here.
+
+
+
+ In order to easily find a fleet you're interested in, you can either use the search feature or combine whatever set of filters. The filters and search features are described below.
+
+
+ This filter allows you to select fleets depending on the category of locations there are on or moving to. You can choose to display fleets located on:
+
All planets: no particular filter is applied
+
Own planets: only the fleets located on planets you own are displayed
+
Allied planets: only the fleets located on allied planets are displayed
+
Other planets: only the fleets located on other planets (that is to say planets or other stellar objects which don't fit in any other categories) are displayed
+
+
+
+ This filter allows you to select fleets depending on their status. You can choose to display fleets which status is:
+
Any: no particular filter is applied and all fleets are displayed
+
Idle: only the fleets that are orbiting a planet and can actually move are displayed
+
Unavailable: only the fleets that are orbiting a planet and can't be moved (because they are engaged in battle and so on) are displayed
+
Moving: only the fleets that are currently flying between planets are displayed
+
H.S. Stand-By: only the fleets that are currently standing by in Hyperspace are displayed
+
On Sale: only the fleets that you are currently selling are displayed
+
Sold: only the fleets that you have sold but haven't been transfered to their new owner yet are displayed
+
+
+
+ This filter allows you to select fleets according to the mode they are in. You can either diplay fleets whose mode is:
+
Any: no particular filter is applied and all fleets are displayed
+
Defending: only defending fleets are displayed
+
Attacking: only attacking fleets are displayed
+
+
+
+ This filters allows you to select fleets according to their owner. You can either display fleets whose owner is:
+
Any: no particular filter is applied and all fleets are displayed
+
Myself: only the fleets you own are displayed
+
Trusted Allies: only the fleets belonging to players who have you in their trusted allies list are displayed
+
Others: only the fleets of other players (neither you nor those who have you as trusted allies) are displayed
+
+
+
+ The last "filtering" tool is in fact a search facility. In order to search and display only particular fleet you first of all have to choose on what field you want to perform the search. To do so you have to select the relevant value in the Search form drop down list. It can be either:
+
Fleet: the search is perfomed on the name of the fleet
+
Location: the search is perfomed on the name of the location (planet, nebula square, planetary remains) where the fleet is or is moving to
+
Player: the search is performed on the name of the player who owns the fleet
+
+ Then you have to define the search string. You have to type it in the textfield next to the drop down list. The selection on the fleets list is performed automatically as you type in the string in the textfield. A name containing the search string wherever it may be in the name is considered as a positive match.
+
+
+
+
+ The fleets list part of the page is divided into several sections, depending on the location the fleets are at. Those sections consist in:
+
Own planets: you'll find here the list of all fleets located on planets you own
+
Allied planets: in this section are listed all fleets located on planets belonging to players who have you as trusted ally
+
Other planets: you'll find here all fleets located on other stellar objects, be it planets, planetary remains or nebula squares
+
Moving Fleets: in this section are displayed all fleets moving between different stellar objects
+
Fleets standing by: in this section are listed all fleets standing-by in hyperspace
+
+
+
+
+ For each of the previously described sections you'll find a table proving detailed fleets information for each location. The table includes:
+
Detailed information for the location
+
Detailed information for each fleet at this location
+
+ The next parapgraphs will describe both sections of the table.
+
+
+
+ The location part of the table provides a set of data on the location. Some are common to all stellar objects and others depend on the type of stellar object. All are listed in the next paragraphs.
+
+
+ For all stellar objects, the location description part of the table includes:
+
name: the name of the object
+
coordinates: the coordinates of the object on the map
+
+
+
+ For planets, the location description also displays:
+
alliance tag: tag of the alliance the owner of the planet belongs to
+
owner: the name of the owner if the planet isn't yours but belongs to one of your trusted allies
+
population: the total population of the planet
+
turrets: the number of turrets located on the planet
+
turrets' power: the total power of the turrets on the planet
+
+ When attacking, below the fleets present on the location, one sentense presents the level of control over the population the player with the more control has. It can be either:
+
"xxx could take the planet.": if all defenses were destroyed the player would have enough GA ships to gain control over the planet
+
"xxx would need x more GA Ships to take this planet.": even if the defenses are destroyed the player doesn't have enough GA sps to take over the planet
+
+
+
+ For other stellar objects, that is to say nebulas and planetary remains, the location description includes:
+
nature of the object: it can be either a nebula or planetary remains
+
opacity or class: this represents the level of opacity of the object, which gives an idea of the speed reduction of fleets going through it
+
+
+
+
+
+ Below the description of the location you'll find a list of fleets present at that location. The data included in this list are described in the next paragraphs.
+
+
+ The fleet list of a particular location first of all includes a set of general items:
+
a checkbox that you have to check in order to select the coresponding fleet if you have the ability to do so
+
Owner: name of the owner of the fleet
+
Name: name of the fleet
+
+
+
+ This part of the list indicates the haul status of the fleet. The values can be of two kinds:
+
N/A: this means the fleet doesn't include capital ships and that it can't carry any ship through hyperspace. Such a fleet can only travel to stellar objects located in the same stellar system it is currently located in
+
a percentage: this means the fleet includes capital ships that are hyperspace capable and the percentage represents how filled the hauls of those capital ships are. Two cases are then possible:
+
the percentage is equal to or below 100%: the fleet is fully hyperspace capable and can move to other stellar system as is
+
the percentage is above 100%: there are too many system ships to carry through hyperspace for the number of capital ships you have in the fleet. You either have to remove system ships or add capital ships to the fleet so that the percentage gets equal or lower than 100% if you intend to send the fleet through hyperspace
+
+
+
+
+
+ The table also provides information about the fleet's composition, including:
+
GA Ships: the total number of GA ships in the fleet
+
Fighters: the total number of fighters in the fleet
+
Cruisers: the total number of cruisers in the fleet
+
Battle Cruisers: the total number of battle cruisers in the fleet
+
Power: the total power of all the ships in the fleet
+
+
+
+ The table also indicates the current status of the fleet. This status is composed of two parts, separated with a comma:
+
First item: it indicates the battle mode of the fleet: either Defense or Attack
+
Second item: it indicates the availability of the fleet. You can either move it (Avail.) or have to wait before you can move it again (Unavail.)
+
+
+
+ A colour code for each fleet line is used in the fleet list to help you easily spot different categories of fleets:
+
green: your own fleets
+
blue: fleets belonging to any other player and that are in the same battle mode as your own fleets (defending along with you or attacking along with you)
+
red: enemy fleets, that is to say fleets that aren't in the same battle mode as you(defending while you're attacking or the other way around)
+
+
+
+
+
+ Two operations are possible on a particular fleet:
+
checking the checkbox at the beginning of the fleet's line allows to select the fleet and causes the list of available actions for the fleet to be displayed
+
clicking on the name of the fleet opens an alert window where you can type in a new name for the fleet and change it
+
+
+
+
diff --git a/manual/beta5/en/fleets_splitting.lwdoc b/manual/beta5/en/fleets_splitting.lwdoc
new file mode 100644
index 0000000..3c769f6
--- /dev/null
+++ b/manual/beta5/en/fleets_splitting.lwdoc
@@ -0,0 +1,54 @@
+
+
+ beta5
+ en
+ Splitting Fleets
+
+ Any fleet can be split into several different fleets. The exact splitting conditions follow:
+
Fleets can be split whatever their location is (own, neutral or foreign planets, nebulas or planetary remains)
+
Moving fleets can be split
+
The only mandatory condition that has to be met is that the fleet's status is Available
+
+ In order to split a fleet you have to select it by checking the checkbox on the fleet's line in the fleets list of the fleets page. Then you have to click the split link that appears at the bottom of the fleets page among the other action links. You'll get directed to a special fleet splitting page.
+
+
+ The splitting page is composed of two sections:
+
Top section: this part of the page describes the fleet you are about to split. Its top part indicates the fleet's location. The bottom part consists in an abstract of the fleets' list tables which only includes the fleet being split
+
Bottom section: it's the actual splitting tool
+
+
+
+
+ The New fleets part of the page consists in a form that you have to fill in to split the fleets. This form consists in various items:
+
Split type: to choose how the fleet will be split
+
Split parameters: to define precise splitting caracteristics
+
Split validation: to perform the split
+
+ Each topic will be covered in the next parapgraphs.
+
+
+ The split type can be either:
+
Manual: you have to choose precisely the number of ships of each type that you want to include in your new fleets in the corresponding textfields
+
Automatic: the system will automatically compute the number of ships to include in each fleet, taking into account the number of fleets you want to create and trying to create fleets with homogeneous compositions
+
+ In order to select a split type, select the radio button next to its name.
+
+
+ The provided form allows to set various split parameters that are listed below:
+
Amount of fleets: use this drop down list to select the number of fleets you want to have once the split is done
+
New name: use this textfield to type in the new name of the fleet. If several fleets are created, a number will be added to the name for each fleet
+
GA Ships: use this textfield to type in the number of GA ships to include for each new fleets (out of the total in the original fleet). This field is automatically filled in in automatic mode
+
Fighters (if you possess the corresponding technology): use this textfield to type in the number of fighters to include for each new fleets (out of the total in the original fleet). This field is automatically filled in in automatic mode
+
Cruisers (if you possess the corresponding technology): use this textfield to type in the number of Cruisers to include for each new fleets (out of the total in the original fleet). This field is automatically filled in in automatic mode
+
Battle Cruisers (if you possess the corresponding technology): use this textfield to type in the number of Battle Cruisers to include for each new fleets (out of the total in the original fleet). This field is automatically filled in in automatic mode
+
Haul used: this field is an informative field that indicates the number of haul spaces used by the ships you have included in each fleet. This number has to be inferior or equal to the Haul available value if you want the fleets to be hyperspace capable
+
Haul available: this field is an informative field that indicates the total number of hauls spaces provided by the capital ships included in each fleet. This number has to be superior or equal to the Haul used value in order for the fleets to be hyperspace capable
+
+
+
+ Once you are satisfied with what you have filled in you can click the Split fleet button to actually split the fleet.
+
+ A Cancel button is also provided to go back to the fleets page without making any changes.
+
+
+
diff --git a/manual/beta5/en/forums.lwdoc b/manual/beta5/en/forums.lwdoc
new file mode 100644
index 0000000..ef964de
--- /dev/null
+++ b/manual/beta5/en/forums.lwdoc
@@ -0,0 +1,214 @@
+
+
+ beta5
+ en
+ Forums
+
+ Those forums are very similar to those you might find in any message board.
+ There are several categories of forums:
+
Legacy Worlds Forums:- these are used by the staff to make announcements and by layers to report bugs and ask for new features.
+
General Forums:- these are used for general discussions about the game and beyond.
+
Legacy Worlds - Public beta 5:- these are public forums which are specific for Beta 5. They include alliance recruitment forums and such.
+
Alliance specific Forums:- these are the forums of each individual alliance. Their name correspond to the alliance name.
+
+
+
+ The left side panel of the page consists in a navigation menu to move between forums. It lists the following items:
+
Overview:- this is a link to the forums overview section.
+
Legacy Worlds forums:- this is a link to that category of the forums' pages.
+
General forums:- this is a link to that category of the forums' pages.
+
Legacy Worlds - Public beta 5:- this is a link to that category of the forums' pages.
+
Alliance forums:- this link, corresponding to the alliance name, redirects to the alliance specific forums.
+
+ For each category a Latest messages link is displayed. This link allows to access the lastest message view for the forums in the category. Name of forums with new posts you haven't read yet are displayed in bold. The link corresponding to the page you are currently viewing is displayed in italic.
+
+ Below this list, a Search the forums link redirects you to the search facility.
+
+ At the bottom of the page, a Messages link allows to switch to the messaging system.
+
+
+ For each forums category described in the introduction section of the forum manual page this overview page provides you with a list including:
+
Category of forums:- the name of the category is a link to the specific page for this category.
+
Nature:- on the right side of the name and between brackets, this indicates if the forum category is general or alliance specific.
+
Forum name:- for each forum is displayed its name. That name is a link to the given forum's page. Below is indicated the forum's description.
+
Topics:- number of topics in the forum.
+
Posts:- number of posts in the forum.
+
Last Post:- name of the player who made the last post in the forum along with the date and time.
+
+
+
+
+ In order to read the forums you can either use the various last messages view or browse the topics.
+
+
+ When clicked for the overview page, the Lastest messages link directs you to a view of the last messages in all forums. When clicked under a particular category page it directs you to a view of the last messages in the category.
+
+ In all cases the Lastest messages view presents the following items:
+
Latest Messages in:- indicates what forum category you are viewing the last messages.
+
Navigation panel:- on top and at the bottom of the page it includes:
+
<- Previous page:- link to the previous page.
+
Posts per page:- you can use that drop down list to choose the number of posts to display on each page.
+
Next page ->:- link to the next page.
+
+
List of messages:- this list includes for each post:
+
Forum in which the message has been posted.
+
Title of the message.
+
Posted by:- Author and date and time of the post.
+
Text of the post.
+
Action links:- on the right side of the header of the post various action links directs you to the relevant action pages:
+
View forum: this link directs you to the forum page in which the message has been posted.
+
View topic: this page directs you to the topic page where all messages in the same thread are displayed.
+
Reply: this link directs you to the reply page.
+
Quote: this link directs you to the reply page with included quotes.
+
+
+
+
+
+ Clicking on the name of a forum directs you to this forum's main page. This page includes:
+
Forum name
+
New topic:- either the new topic link which directs to the topic creation page or the "Only moderators can create new topics" sentence is displayed according to the forum settings.
+
Posts per page:- the corresponding drop down list allows you to choose how many topics are to be displayed on each page.
+
Page:- when it is required, a drop down list is displayed to allow you to choose what page to go to.
+
Posts list: this list includes for each post:
+
Topic:- title of the topic. It's a link to the topic display page.
+
Replies:- number of replies to the first post.
+
First post:- author, date and time of the first post in the thread.
+
Last Post:- author, date and time of the last post in the thread.
+
+
+ Clicking on a topic name in the list directs you to the thread page for that specific topic. This page includes:
+
Topic Name.
+
Posts per page:- use this drop down list to choose how many posts to display on each page.
+
Page:- when relevant, a drop down list is displayed to switch between pages of the posts.
+
List of messages in the thread. For each post the elements displayed are:
+
Post title.
+
Posted:- time, date and author of the post.
+
Text of the message.
+
Action links:- along the header of the post, those action links directs you to the relevant action pages or perform the requested action.
+
Reply:- directs you to the reply page.
+
Quote:- directs you to the reply page with included quotes.
+
Edit:- if you are the author of the post this link allows you to go to the edit page. This page is similar to the new topic page except all fields are prefilled with their current contents, thus allowing you to make corrections.
+
Delete:- if you are the author of the post, this link allows you to delete it.
+
+
+
+
+
+
+ If you have the rights to do so, a New topic link is displayed at the top of each forum page. Clicking on the link directs you to the new topic form. To post a new topic in the forum currently named at the top of the form, you have to fill in the following items:
+
Topic title:- use the provided text field to type in the topic title.
+
Text:- use the provided text area to type your message.
+
Options:- two checkboxes that allow you to apply some specific options to the post:
+
Enable graphical smileys:- checking this checkbox will replace all common text based smileys known to the system by their graphical counterparts.
+
Enable forum tags:- checking this checkbox is necessary to use forum specific tags like those required for quotes, text emphasis and such.
+
+
+ At the bottom of the form three buttons are provided to specify what to do with the text typed in and the options you've selected:
+
Submit:- click this button to post the new forum topic.
+
Preview:- click this button to get a preview of what the post will look like in the forum.
+
Cancel:- click this button to cancel your changes and go back to the previous page.
+
+
+
+ In order to reply in a thread you can use either the Reply or the Quote links that are displayed alongside each post header. The behaviour is slightly different depending on which ones you choose:
+
Reply:- a form similar to the one for new topics is displayed with a prefilled title that fits the current thread title. See the New Topic paragraph of the forum section of the manual for a description of this form use.
+
Quote:- a form similar to the one for new topics is displayed with a prefilled title that fits the current thread title and a prefilled body containing the post you replied to text with special quote forum markers. See the New Topic paragraph of the forum section of the manual for a description of this form use. Make sure the Enable forum tags checkbox is checked so that the quote is properly displayed as a quotation.
+
+ At the bottom of those forms, the Replying to... section presents the previous messages in the thread as reference.
+
+
+ Moderator are provided with the means to enforce the moderation rules described in the General Rules section of the manual. If you have moderation privileges on a given forum, you are provided with a set of moderation tools.
+
+ If you have moderation privileges, you have access to functionalities which allow you to delete individual posts or complete threads:
+
Deleting a post: if you have moderation privileges, a "Delete" link is available in the right part of the posts' header. Clicking this link allows you to delete it. If the post is the last remaining one in a thread, the whole toic will be deleted.
+
Deleting a thread: in the threads list of the forum you have moderation privileges on, a checkbox is available in from of of each thread. In order to delete a thread, check the corresponding checkbox to select it. Then click the "Delete" button at the bottom of the page.
+
+
+
+ A sticky thread is a thread that remains on top of the threads list for the forum, whatever new posts may have been made in other threads. To switch a thread sticky, you have to options:
+
New topic: if you're writing a new topic, you can make it sticky from the start by checking the "Sticky topic" checkbox at the bottom of the new topic form.
+
Existing topic: in order to switch an existing topic sticky, you first of all have to select it by checking the corresponding checkbox. Then click the "Switch sticky" button at the bottom of the page.
+
+ If you want a topic not to be sticky anymore, select it by checking its checkbox and click the "Switch Sticky" button. The topic gets back to normal topic status.
+
+
+ If a thread has been posted in the wrong forum, you have the possibility to move it to another forum. In order to do so you first of all have to select the thread by selecting the corresponding checkbox. Then you have to select the destination forum in the forums drop down list at the bottom of the page. The click the "Move" button.
+
+
+ As moderator you also have the ability to edit posts made by other players. To edit any post, just click the "Edit" link in the post's header. You'll be directed to the post edition form, which is similar to the form for new topics, with prefilled values.
+
+
+
+ A "Search forums" link is provided at the bottom of the left forums panel. Clicking this link directs you to a search form where you can specify your search criteria:
+
Text: use the provided textfield to type in the search string. The '*' character can be used as a wildcard to search for partial strings.
+
Search in: you can either search in posts titles or whole posts. To choose between the two, select the corresponding radio button.
+
Forum: you can either search in all forums or one specific forum. To define in what forum to search, select the entry you're interested in in the provided drop down list.
+
Sort by: The results of the search can be sorted according to Post Time or Post Title. Use the drop down list to choose which one to use. The sort can also be either ascending or descending. Select the relevant radio button to define the ordering you're interested in.
+
Display results: Results can be displayed as Posts or Topics. Choose the display you want by selecting the corresponding radio button.
+
+ Once you are satisfied with your setting, you can click the "Search" button to launch the search process.
+
+ The results are displayed as a list very similar to any thread in any forum. The only differences are that each post also includes:
+
+
A new header line where the forum in which the post is located is indicated
+
A "View forum" link in the top right part of the header which directs you to the main page of the forum in which the post is
+
A "View topic" link in the top right part of the header which directs you to the page of the thread in which the post is
+
+
+
+
+ LegacyWorlds' forums include the possibility to apply text modifiers (to get bold text and so on) and can display some smileys with a graphical representation in order for the posts to look nicer.
+
+
+ In order for graphical smileys to be displayed, you either have to enable the option in your preferences or enable it on a per post basis, in the post edition form.
+
+ Most current smileys have a graphic conterpart: :), :P, ;) and so on.
+
+
+ Forums tags allow you to include special items in post or to apply modifiers to texts. Single unit tags are to be used on their own. For tags composed of two elements, the text modifier applies to the text between the two tags.
+
+
+
Tag
+
Meaning
+
+
+
[b] Text [/b]
+
"Text" gets displayed in bold.
+
+
+
[u] Text [/u]
+
"Text" is underlined.
+
+
+
[i] Text [/i]
+
"Text" is displayed in italic.
+
+
+
[quote] Text [/quote]
+
"Text" is displayed as a note without title.
+
+
+
[quote=name] Text [/quote]
+
"Text" is diplayed as a note, with title ("name said:").
+
+
+
[sep]
+
A horizontal bar is drawn to replace the tag.
+
+
+
[item] Text [/item]
+
"Text" is displayed as a bullet-point item.
+
+
+
[link=url] Text [/link]
+
"Text" is displayed as a link that points to the "url" URL.
+
+
+
[code] Text [/code]
+
"Text" is displayed as a fixed size font block. This can be used to insert ASCII art for instance.
+
+
+
+
+
diff --git a/manual/beta5/en/game_interface.lwdoc b/manual/beta5/en/game_interface.lwdoc
new file mode 100644
index 0000000..3179192
--- /dev/null
+++ b/manual/beta5/en/game_interface.lwdoc
@@ -0,0 +1,154 @@
+
+
+ beta5
+ en
+ Game Interface
+
+
+ Each in game page is split into three sections:
+
Top banner: you'll find there the main menu of the game
+
Banner: here is located the title of the page you're currently on
+
Page body: the actual contents of the page are there. On all pages, a Help link on the top right corner of the page directs you to the relevant manual section
+
+
+
+ Most pages are automatically refreshed except the forums' pages. As a consequence it's useless to reload the pages on a regular basis: the game does it for you.
+
+
+
+ In each game you are playing the top menu includes a link or button which takes you back to your account's page. But be careful: getting back to your account's page doesn't mean you have actually logged out from LegacyWorlds. If you want to benefit from features available to your allies when you're offline, make sure you have also logged out from your account, by clicking on the Log Out link on your account's page or by using the Log out link in the menu.
+
+
+
+ The main menu consists in the menu bar on top of all in game pages. This game menu allows you to access all in game pages and features for the current game you're playing. Several game themes are available and the main menu lay-out depends on the theme you've selected in your preferences. A description of the menu depending on those themes is provided in the following paragraphs.
+
+
+
+ The menu bar is split into two sections:
+
Top part: this section of the menu bar provides general informations about the player and the game
+
Bottom part: this section of the menu bar provides you with menu entried linking with all the game pages along with icons for major shortcuts
+
+ The following sections of the manual will describe more precisely those two parts of the menu bar.
+
+
+ The top part of the menu includes a set of data about the player and the current game, including:
+
Player: Name of the player
+
Alliance: if the player belongs to an alliance the alliance tag is displayed between brackets
+
Current funds: amount of cash the player has in bank
+
Server Time: current time and date of the server, which is set to "Coordinated Universal Time" (abbreviated UTC)
+
+
+
+
+ The bottom part of the menu bar includes a set of menu entries for game pages as long as icons for major shortcuts. Those entries include:
+
Overview
+
Empire
+
Diplomacy
+
Universe
+
Communications
+
Shortcut Icons
+
+ The next sections of the manual will present each entry in more details.
+
+
+ The Overview menu entry directs you to the overview page which presents at a glance all important data about your empire and Legacy Worlds' universe. This menu entry also includes three submenu entries:
+
Preferences: this entry directs you to the Preferences page where you can set up game specific preferences
+
My Account: this entry directs you to your account's main page, leaving the current game but not logging you out of LegacyWorlds
+
Log out: this links logs you out of the game
+
+
+
+ The Empire entry directs you to the Empire page which presents at a glance all important empire related information. This menu entry also includes several submenu entries:
+
Planets: this entry directs you to the planets overview page which presents the list of all your planets and a quick builder facility. This entry also include as many submenu entries as you have planets. Each submenu entry directs you to the individual planet page for that particular planet
+
Fleets: this entry directs you to the fleets management page which presents all your fleets and allows you to control their movements and other fleets related actions
+
Beacons: this entry directs you to the Probes and Beacons page where you can manage those features
+
Research: this entry directs you to the main research page where you can manage research. It also includes four submenu entries corresponding to the various sections of the research page:
+
Topics: to manage research topics
+
Laws: to manage laws
+
Budget: to manage research budget
+
Diplomacy: to manage research exchanges
+
+
Money: this entry directs you to the Money page, where is collected all information about the finantial status of your empire
+
+
+
+ The Diplomacy entry directs you to the main Diplomacy page which provides you with a diplomatic status of your empire. This entry also includes four submenu entries:
+
Alliance: this entry directs you to the main alliance page where you can manage and access alliance related data
+
Marketplace: this entry directs you to the marketplace page, where is managed everything emplying selling or buying stuffs
+
Enemies: this entry directs you to the Enemies page where you can manage enemies lists
+
Trusted Allies: this entry directs you to the Trusted Allies page where you can manage a trusted allies list
+
+
+
+ The Universe entry directs you to the main Universe page which displays at a glance major facts about Legacy Worlds' universe. This entry also includes four submenu entries:
+
Maps: this entry directs you to the main Maps pages which present a display of the galaxy. It also includes three submenu entries:
+
Planets: this entry directs you to a map page with a grid diplay and planets identified by their name
+
Alliance: this entry directs you to a map page with a grid diplay and planets identified by their alliancetag
+
Listing: this entry directs you to a map presented in a list
+
+
Ticks: this entry directs you to the main Ticks page which presents the various ticks in the game
+
Rankings: this entry directs you to the main Rankings page which provided various rankings for players and alliances
+
Manual: this entry directs you to this manual main entry
+
+
+
+ The Communications entry directs you to the main Communications page which provides you with major data about your messages and forums. It also includes three submenus entries:
+
Compose a message: this entry directs you to the the compose page of the messaging system where you can write a new message to be sent
+
Folders: this entry directs you to the folders page of the messaging system where you can manage and access you folders. This entry also includes submenu entries:
+
Inbox: to go directly to your inbox folder
+
Transmissions: to go directly to your Internal Transmissions folder
+
Sent: to go directly to your Sent folder
+
A submenu entry for each custom folder: to go directly to the given folder's contents page
+
+
Forums: this entry directs you to the main forums page where you can access all the general forums and your alliance forums
+
+
+
+ On the right part of the page, a set of icons provide shortcuts to some important pages:
+
Planet icon: the link on that icon directs you to the planets management page
+
Ships icon: the link on that icon directs you to the fleets management page
+
Map icon: the link on that icon directs you to the maps page
+
Alliance icon: the link on that icon directs you to the alliance page
+
Log out icon: the link on that icon logs you out
+
+
+
+
+
+ This theme is very similar to the LegacyWorlds Beta 5 one and contains exactly the same data. The only difference is that the two parts are inverted: the menu bar is above the player and game information instead of being below them.
+
+
+
+ The LegacyWorlds Classic theme correspond to the theme used in Beta 1-4. It consists in a table containing three rows of links. The next sections wil describe the contains of each row.
+
+
+ The top row contains four cells corresponding to the four following links:
+
Overview: the Overview link directs you to the overview page which presents at a glance all important data about your empire and Legacy Worlds' universe
+
Fleets: this link directs you to the fleets management page which presents all your fleets and allows you to control their movements and other fleets related actions
+
Alliance: this link directs you to the main alliance page where you can manage and access alliance related data
+
Messages: this link directs you to the messaging system page where you can write a new message to be sent, manage and access your messages folders
+
+
+
+ The middle row contains four cells corresponding to the four following links:
+
Planets: this link directs you to the planets overview page which presents the list of all your planets and a quick builder facility
+
Research: this link directs you to the main research page where you can manage research
+
Marketplace: this link directs you to the marketplace page, where is managed everything emplying selling or buying stuffs
+
Forums: this link directs you to the main forums page where you can access all the general forums and your alliance forums
+
+
+
+ The bottom row contains eight cells corresponding to the eight following links:
+
Money: this link directs you to the Money page, where is collected all information about the finantial status of your empire
+
Beacons: this link directs you to the Probes and Beacons page where you can manage those features
+
Maps: this link directs you to the main Maps pages which present a display of the galaxy
+
Rankings: this link directs you to the main Rankings page which provided various rankings for players and alliances
+
Enemies: this link directs you to the Enemies page where you can manage enemies lists
+
Trusted Allies: this link directs you to the Trusted Allies page where you can manage a trusted allies list
+
Preferences: this link directs you to the Preferences page where you can set up game specific preferences
+
Log out: this links logs you out of the game
+
+
+
+
+
diff --git a/manual/beta5/en/game_overview.lwdoc b/manual/beta5/en/game_overview.lwdoc
new file mode 100644
index 0000000..e416b62
--- /dev/null
+++ b/manual/beta5/en/game_overview.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Game Overview
+
+ Legacy Worlds is an online multiplayer intergalactic war game. Your goal as a player: build up an empire and defeat the other players. How to achieve that: through technological research, alliances with other players and of course conquests.
+
+ Legacy Worlds is a tick based game. This means events are controlled at given intervals of time called ticks.
+
+ Legacy Worlds is a text based game so don't expect any fancy graphics.
+
+
+ At first started as a University project by one of the developers it's now developed by a little team which felt it was a pity to let it go to waste and disappoint its current players.
+
+ The current team includes:
+
El Christoph: original design and game concept
+
TSeeker: lead developer and game design
+
Ju: game design, game manual, developer
+
Sycophant: game design, random ideas, orthograph fascist
+
+
+
+ This version is Beta 5 and is as the previous ones completely free. Our goal isn't to make money or even to have players to contribute for the costs implied by hosting an online game. It's to have fun as much as our players.
+
+ The server hosting the game is currently lended by one of the developers who also shares his bandwidth with all of you players. The domain name has been purchased by another of the developers.
+
+
diff --git a/manual/beta5/en/game_rules.lwdoc b/manual/beta5/en/game_rules.lwdoc
new file mode 100644
index 0000000..6c2e5e4
--- /dev/null
+++ b/manual/beta5/en/game_rules.lwdoc
@@ -0,0 +1,43 @@
+
+
+ beta5
+ en
+ Game Rules
+
+ As in every game there are rules in LegacyWorlds. Those rules apply to all players and are listed in the following sections of the manual.
+
+ Breaking any of those rules has a simple consequence: your account will be deleted and an explanation e-mail will be sent to the e-mail address associated with the account.
+
+
+ As stated in the general rules, it's forbidden for one person to hold several accounts. If multi accounts are found by the staff all the suspicious accounts will be deleted.
+
+ Occasional password sharing is allowed but abusing this authorisation will be met by the same consequence as multiple accounts holding.
+
+
+ Accessing someone else' account without their knowledge nor authorisation is not only illegal, it's cheating.
+
+ If any player can be proved to have done so his account will be deleted.
+
+
+ Using an open proxy to connect to the game server is not only a security threat for our (TSeeker's and Ju's) network but also a suspicious behaviour from a player. Who would need to hide who he is unless he intends to do something that is against the rules?
+
+ As a consequence all accounts connecting from open proxies will be deleted without warning.
+
+ If you have no idea about what I might be talking about the probability this rule concerns you is close to 0 so don't bother....
+
+
+ Forum moderation rules are set up to try and prevent players from having an improper behaviour in the game community. But if those aren't sufficient, harsher measures can be taken.
+
+ If a player gets banned more than 5 times from the forums, his account will be deleted.
+
+
+ It is strictly forbidden to create external tools for personal or alliance purposes.
+
+ If you are interested in building any tool related to the game, be it an irc bot, an alliance management feature or whatever system that easily allows to perform game related tasks, please contact the staff. We don't disagree with the concept of tools per se as long as they are accessible to all players. A lot of tools ideas are already foreseen for a future beta version or even this one. It would be completely stupid to develop the same thing twice .
+ As a consequence all tools should be either:
+
built by the game staff and integrated into the game interface so that any player can use them
+
developed by players authorised to do so. In that case, they have to ask an authorisation from the staff so that the same tools aren't developped twice. If the development is authorised they can be granted the means to easily build the tool and host it on the game server if required software is available. The tool will in any case have to be made publicly available to all players, once it has been reviewed and approved by the staff.
+
+ Players who develop tools without authorisation will have their account deleted.
+
+
diff --git a/manual/beta5/en/general_game.lwdoc b/manual/beta5/en/general_game.lwdoc
new file mode 100644
index 0000000..76ce6db
--- /dev/null
+++ b/manual/beta5/en/general_game.lwdoc
@@ -0,0 +1,37 @@
+
+
+ beta5
+ en
+ General Game Information
+
+ This section of the manual presents some general information about the game including account creation and games management along with a presentation of the main interface and overview page.
+
+
+ The LegacyWorlds home page consists in four different sections:
+
a top banner containing a set of links
+
a left panel containing various forms and information
+
a middle section which consists in the body of the page
+
a bottom banner containing another set of links and credits
+
+ This part of the manual presents those different sections more precisely.
+
+
+ Each player in LegacyWorlds has a single account which provides him access to all possible games he wishes to play. This section of the manual explains in details how to create and activate an account along with account deletion and how to manage games.
+
+
+ Each in game page is split into three sections:
+
Top banner: you'll find there the main menu of the game
+
Banner: here is located the title of the page you're currently on
+
Page body: the actual contents of the page are there
+
+ In this manual section, more precision are provided about all those different parts of the interface.
+
+
+ The overview page is the first page you get directed to when logging into a LegacyWorlds Beta 5 game. It provides a short or a more complete display of important facts about what is going on in game.
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/general_rules.lwdoc b/manual/beta5/en/general_rules.lwdoc
new file mode 100644
index 0000000..0b8ebfb
--- /dev/null
+++ b/manual/beta5/en/general_rules.lwdoc
@@ -0,0 +1,39 @@
+
+
+ beta5
+ en
+ General Rules
+
+ As in every game there are rules. Those rules are to be agreed upon and followed by both sides: players and people running the game. Those are the topic of this section.
+
+ Some general elements that didn't fit in any other section of the manual are also presented here.
+
+
+ As in every system where you have an account and where you interact with other people some general good practice rules apply or should apply. Those are presented in this manual section.
+
+
+ Along with the above good practices, some rules apply to your account in Legacy Worlds. Those are summed up in this accounts section of the manual.
+
+
+ As in every game there are rules. Those rules are detailes in the Game Rules section of the manual.
+
+
+ In order for players to get to know each others and to play better as members of an alliance or simply of the LegacyWorlds community the game is set with some internal forums. Those forums are a tool for you to use and as all tools allowing people to say what they have to say some simple rules apply.
+
+ So far we've always had a policy of free speech but as everyone knows one's freedom ends where begins someone else's freedom.
+
+ As a consequence:
+
Public forums are moderated by the staff and a set of volunteers appointed by staff members
+
Alliance forums are to be moderated by the alliance's leader and eventually other alliance members appointed by the alliance leader. If posts / threads that don't comply with the moderation rules are brought to the staff's attention, the alliance's leader will be held personally responsible. This means the same punishment will be applied to the alliance's leader as to the offender
+
+
+
+ The server on which the game is hosted is located in France. As a consequence French law is applicable. For those not familiar with it here are a few reminders about what it implies in the context of the game are summed up in this manual section.
+
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/glossary.lwdoc b/manual/beta5/en/glossary.lwdoc
new file mode 100644
index 0000000..f88ba74
--- /dev/null
+++ b/manual/beta5/en/glossary.lwdoc
@@ -0,0 +1,160 @@
+
+
+ beta5
+ en
+ Glossary
+
+ A user in computing context is one who uses a computer system. Users may need to identify themselves for the purposes of accounting, security, logging and resource management. In order to identify oneself, a user has an account (a user account) and a username, and in most cases also a password (see below). Users employ the user interface to access systems, and the process of identification is often referred to as log in.
+ In LegacyWorlds each user has a single account that allows him to play as many LegacyWorlds game as he wishes among the available games.
+
+
+ Income, generally defined, is the money that is received as a result of the normal business activities of an individual or a business.
+
+ In the case of LegacyWorlds the base income represents the basic amount generated by a given planet, without taking into account factories output.
+
+
+ Battle cruisers are large and fast heavy combat and transport ships.
+
+
+ A capital ship is a ship equipped with hyperspace engines. As such it can travel from one stellar system to the next through hyperspace. Capital ships have hauls allowing them to transport a certain number of system ships.
+
+
+ A civilian technology is a technology which purpose is to improve the well-being of the citizens of the empire and the empire's efficiency.
+
+
+ In broad terms, corruption is the misuse by government officials of their governmental powers for illegitimate, usually secret, private enrichment. Misuse of government power for other purposes, like repression of political opponents and general police brutality, is not considered political corruption.
+
+ In game, it causes the reduction of factories' productivity.
+
+
+ Cruisers are heavy combat and transport capital ships.
+
+
+ The current funds of your empire represents the finantial capital it owns at the moment. It's the amount of money that can be used to build or buy items or implement technologies.
+
+
+ The daily profits of your empire corresponds to the amount of money it earns each day. It's the difference between your income and the various upkeep costs you have to pay to sustain your fleets.
+
+
+ Generally, an empire is defined as a state that extends dominion over areas and populations that are culturally and ethnically distinct from the culture at the center of power. Like other states, an empire maintains its political structure at least partly by coercion.
+
+ In the LegacyWorlds universe, an empire is constituted by the set of planets that are controlled by a given player.
+
+
+ A factory or manufacturing plant is a large industrial building where workers manufacture goods or supervise machines processing one product into another. Most modern factories have large warehouses or warehouse-like facilities that contain heavy equipment used for assembly line production. Archetypically, factories gather and concentrate resources, workers, capital and plant.
+
+ In LegacyWorlds there are two types of factories:
+
Industrial Factories produce goods that are sold and provide income to your planets
+
Military Factories are dedicated to producing warfare
+
+
+
+ Fighters are light attack system ships.
+
+
+ A fleet is a large formation of warships. In order to control your ships, you have them organised into fleets and you give orders to each of those fleets.
+
+
+ Each ship in LegacyWorld has a power. This power represents both its firepower and resistance to attacks. The total power of a fleet represents the combined power of the ships composing it.
+
+
+ A fundamental technology is a technology which goal is to improve the knowledge of the empire. As such a fundamental technology might not have direct application.
+
+
+ GA Ships (shorthand for Ground Assault Ships) are light attack system ships equipped with troup pods. As such they are the only ships capable of taking over a planet.
+
+
+ A game in LegacyWorlds consists in a universe where a group of players play according to a set of rules using a given interface and a set of tools. Several LegacyWorlds games may be running at the same time, each possibly answering to different game parameters. Those various games might be for instance different betas.
+
+
+ Happiness is an emotional or affective state that feels good or pleasing. Happiness is often correlated to the presence of favorable events (such as a promotion, a marriage, lottery winnings, etc.) and the absence of troubles or bad luck (such as accidents, getting fired, divorce, conflicts, etc.).
+
+ Happines is a concept used in LegacyWorlds to represent the overall satisfaction of one planet's population.
+
+
+ Hyperspace is any region of space co-existing with our own universe (in some cases displaced in an extra spatial dimension) which may be entered using some sort of space-altering device. While hyperspace is in some way anchored to the normal universe, its properties are not the same as normal space, so traveling in hyperspace is largely inequivalent to traveling in normal space. This allows of faster than light (FTL) travel: while the shortest distance between two points in normal space is a straight line, hyperspace allows those points to be closer together, or a curved line in normal space to be straight, etc.
+
+
+ Internal Transmissions are messages that are automatically sent to your Internal Transmissions folder when important game events occur, such as battles, alliance related events, scientific assistance offers and the like.
+
+
+ Law is the set of rules or norms of conduct which forbid, permit or mandate specified actions and relationships among people and organizations.
+
+ In Legacyworlds researches might provide you with laws. Enacting those laws has an effect either positive or negative on game parameters.
+
+
+ A map is a simplified depiction of a space, a navigational aid which highlights relations between objects within that space. A map is a two-dimensional, geometrically accurate representation of a three-dimensional space, in the case of LegacyWorlds the game universe, that is to say a galaxy.
+
+ Different versions of the map of the universe are available, providing various useful information about your empire and its surroundings.
+
+
+ A military technology is a technology with direct military applications. It can either improve ships' speed, defenses or firepower.
+
+
+ A nebula is an interstellar cloud of dust, gas and plasma. Some are the birthplace of stars. They are formed when very diffuse molecular clouds begin to collapse under their own gravity, often due to the influence of a nearby supernova explosion. The cloud collapses and fragments, forming sometimes hundreds of new stars. The newly-formed stars ionize the surrounding gas to produce an emission nebula. Other nebulae are formed by the death of stars; a star that undergoes the transition to a white dwarf blows off its outer layer to form a planetary nebula. Novae and supernovae can also create nebulae known as nova remnants and supernova remnants respectively.
+
+ In the LegacyWorlds universe, nebulae are sectors of space where ships travel slowlier than in the rest of the universe.
+
+
+ A neutral planet is a planet that doesn't belong to any player. It doesn't mean it doesn't have a government, just that it's not controlled by a player. Neutral planets don't build anything on their own and have the number of turrets or factories they had when they were created or abandoned.
+
+
+ A P-* planet is a planet just as every other planet. All planets are generated with a name of the form P-[xxx] where xxx represents any combination of letters and numbers. As players have the ability to rename planets, P- planets are often neutral planets.
+
+
+ A planet is a celestial body that is in orbit around a star or stellar remnants; has a mass below the limiting mass for thermonuclear fusion of deuterium; and is above the minimum mass/size requirement for planetary status in our solar system.
+
+ In the LegacyWorlds universe, there are 6 planets in each stellar system. Each can be colonised as part of one player's empire.
+
+
+ In LegacyWorlds the Wormhole Supernova technology allows you to destroy a planet. The principle of the technology is to get a wormhole to collapse inside the planet, getting it to explode from the inside. The matter constituting the planet doesn't vanish and a field of debris is created, making travel through this region of space more difficult and as such slower.
+
+
+ Ranking is the process of positioning players on an ordinal scale in relation to others. A list arranged in this way is said to be in rank order. Different rankings are providing depending on the topic they are related to.
+
+
+ Each day the planets in each empire generate a certain amount of research points. This amount is linked to their population. Each technology in the technology graph costs a certain amount of research points and the points you've gained are used to make progresses in your researches.
+
+
+ As all technologies aren't available to all players, some means of exchanging technologies are necessary. Scientific assistance can be given or received to/from other players in the form of specific technologies or research points.
+
+
+ The Server Time is the time set on the LegacyWorlds server. It is set to the Coordinated Universal Time (UTC).
+
+ Coordinated Universal Time (UTC) is a high-precision atomic time standard. UTC has uniform seconds defined by International Atomic Time (TAI), with leap seconds announced at irregular intervals to compensate for the earth's slowing rotation, and other discrepancies. The leap seconds allow UTC to closely track Universal Time (UT), which is a time standard based on the earth's angular rotation, rather than a uniform passage of seconds.
+
+
+ In the LegacyWorlds' context, a ship is obviously a starship or a spaceship. A starship is a spaceship designed for interstellar travel, specifically between star systems. Science fiction abounds with tales of such ships. Space-going vessels that are not intended for travel between star systems are often referred to as spaceships. For a more precise description of the different classes of ships available, look at the Fleets page of the manual.
+
+
+ A stellar system is a system comprised of a star or group of stars, and, perhaps, planetary systems of smaller bodies (such as planets or asteroids), in gravitational association. The solar system is the stellar system comprised of Sol and other bodies, such as Earth, in orbit around it.
+
+ In the LegacyWorlds universe, there are 6 planets in each stellar system. Each can be colonised as part of one player's empire.
+
+
+ A system ship is a ship that isn't equipped with hyperspace engine. As a consequence it can only travel in the stellar system it is located in unless it is carried by a capital ship.
+
+
+ Despite its cultural pervasiveness, technology is an elusive concept. It can refer to material objects, such as machines, hardware or utensils, but it can also encompass broader themes, such as systems, methods of organization, and techniques.
+
+ In the LegacyWorlds' universe a set of technologies are available for research, allowing for the evolution of youe empire.
+
+
+
+ A tick is a moment in time during which an automatic game action occurs. At various time intervals, specialised scripts are triggered wich update different game data. Ticks are what make the game dynamic without it to be run real time, which allows for players not to be online all the time and reduces bandwidth.
+
+
+ A turret is usually a rotating weapon platform. This can be mounted on a fortified building or structure such as an anti-naval land battery, or on an armoured fighting vehicle, a naval ship, or a military aircraft.
+
+ In LegacyWorlds' universe, turrets are stationnary defenses that can be set up on planets to help destroy enemy fleets orbiting the planet.
+
+
+ Upkeep represents the necessary care and management of equipment and operations. All mechanical equipment and organizations need continual maintenance to forestall a total system breakdown. This maintenance has a cost that is also called upkeep.
+
+ In LegacyWorlds you have to pay an upkeep for factories, turrets and fleets.
+
+
+ In physics, a wormhole (also known as Abbreviated Space) is a hypothetical topological feature of spacetime that is essentially a "shortcut" or "abbreviation" through space and time. A wormhole has at least two mouths which are connected to a single throat. If the wormhole is traversable, matter can 'travel' from one mouth to the other by passing through the throat.
+ In the LegacyWorlds universe, wormholes aren't theoretical anymore and various technologies are based on building and sustaining stable wormholes.
+
+
diff --git a/manual/beta5/en/good_practices.lwdoc b/manual/beta5/en/good_practices.lwdoc
new file mode 100644
index 0000000..41a9263
--- /dev/null
+++ b/manual/beta5/en/good_practices.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Good Practices
+
+ As in every system where you have an account and where you interact with other people some general good practice rules apply or should apply. Those are presented in this manual section.
+
+
+ You'll find here a few advices about your password to access Legacy Worlds:
+
Your password, as for everything requiring one, has to be complex enough if you don't want anyone to guess it and use your account without your knowledge. A short password is also easier to guess than a long one. The name of your dog is a very bad idea. A random combination of letters and digits along with special characters usually makes a good password
+
Don't use the same password as for a banking site, work or university login, email account and so on. If someone was to guess your Legacy Worlds account information he would then be able to access all those other accounts and might be able to do things that may cost a lot more than a few fleets or in game cash
+
Think about changing your password on a regular basis. This also helps reduce the risks of your account being used by someone else
+
Make sure you sign off before closing your browser's window. By doing so you prevent anyone who might have access to the same computer from using your account if they don't know your account information
+
+
+
+ The other players in the game aren't only nicks on the Internet. There are real persons with feelings beyond those nicks. As such you owe them the respect that is owed to every human being. Whatever their colour, their faith, their nationality, their religion, their opinions, their social behaviour and so on there is no point in saying anything that might hurt their feelings nor in exchanging insults.
+
+ Your are also invited to avoid any offensive alliance or planet names. If the game administrators were to find any of those:
+
The alliance would be disbanded by the game administrators
+
The planet would be taken from the player who owns it, neutralised and renamed as a P-* planet. Whatever fleets the former may have had orbiting the planet would be disbanded
+
+
+ Keep in mind it's only a game and that there is no use in ressorting to degrading comments over a game.
+
+
diff --git a/manual/beta5/en/home_page.lwdoc b/manual/beta5/en/home_page.lwdoc
new file mode 100644
index 0000000..3833eae
--- /dev/null
+++ b/manual/beta5/en/home_page.lwdoc
@@ -0,0 +1,135 @@
+
+
+ beta5
+ en
+ Legacy Worlds Home Page
+
+ The LegacyWorlds home page consists in three different sections:
+
a top banner containing a set of links
+
a left panel containing various forms and information
+
a middle section which consists in the body of the page
+
+ The following sections of the manual will present those various items.
+
+
+
+ The top banner consists in the set of links that allow you to navigate between the various pages of the external LegacyWorlds web site:
+
Home: to go back to the home page
+
Create Account: to go to the account creation form; this link is only present if you're not logged in yet
+
Manual: to go to the manual page
+
Rankings: to go to the external Rankings page
+
+
+
+
+ The left panel can be split into two sections:
+
Top part: it includes account related data
+
Bottom part: it presents some rankings or manual browsing facilities
+
+
+
+ The top part of this panel includes account related information.
+
+ When you are not logged in, it presents three sets of data:
+
login form: in order to log in, type you username and password in the corresponding fields and click on the Log in -> button. You will then log in into your account
+
players information: the number of online players and registered players are displayed below the login form
+
Terms of use: ait's a link to a special page describing shortly the terms of use for the page
+
+
+ When you are logged in, this section presents the name of the account with which you have logged in. Below you'll find a link to the account's preferences pages and the terms of use page and a Log out link. Clicking on the log out button logs out the account and directs you to a special log out page.
+
+
+ On most pages, the bottom part of the left panel presents the Top Ten of the Public Beta 5 Overall round rankings, including Player name and corresponding number of Points.
+
+ The very bottom part of the left panel provides the version number of the newest LegacyWorlds game.
+
+ On the manual page, it contains manual navigation tools, that will be explained along with the manual page.
+
+
+
+
+
+
+ The home page for the game has two different layouts depending if you're logged in or not. Each will be described in the next parapgraphs.
+
+
+ If you're not logged in, this page presents a quick introduction to the game. It also provides a link to the website of the team who built the game: DeepClone Development.
+
+ Below this introduction, you can find an Online Games Directories title. This part of the page lists online review of the game on the following websites:
+ The bottom part of the page includes a set of links allow you to access other DeepClone Development games related items:
+
F1 Manager Pro: another online game developed by the team
+
Legacy Worlds Beta 4: this link directs you to the main page of the previous version of the game (beta 4) if you wish to play it. This older version will be kept running for a few more months
+
external forums: since beta 1-4 didn't have any included forums, external forums on a website hosting message boards were created. This link directs you to this external forum.
+
+
+
+
+ If you are logged in, this page is split into three sections:
+
A games related section
+
A vacation mode related section
+
A closing account related section
+
+ The next paragraphs will cover all these topics.
+
+
+ The games related section presents the list of games you are currently playing, including:
+
Game name: the name of the game
+
Planets: the number of planets you own in this particular game
+
Cash: the amount of money you own in this game
+
+ Clicking on the name of a game will log you in this game.
+
+
+ Vacation mode allows you to take a break from the game. Entering vacation mode doesn't deleted your account nor your game data and you're still able to access the pages of the games you're playing. Being on vacation only means that your assets are protected but that you can't perform any game actions.
+
+ This part of the page first of all provides you with some information about your vacation status:
+
number of vacation credits: vacation credits correspond to period of 6h during which you can stay in vacation
+
Corresponding period of time: the period of time corresponding to your amount of vacation credits
+
+ Below is displayed a Enter Vacation mode button. Clicking the button starts the process of entering vacation mode which is described more precisely in the vacation mode section of the manual.
+
+
+ Closing your account allows you to permanently remove all game data link to your account.
+
+ This part of the page first of all explains what closing the account means. Below is displayed a Close my account button. Clicking the button gets you to the forms that allow you to actually close your account, which is explained more precisely in the closing account section of the manual.
+
+
+
+
+
+ Once on the manual page, you have access both to the manual itself and to a set of tools in the bottom part of the left panel. Both will be presented here.
+
+
+ All manual pages are organised in the same fashion:
+
The title of the manual section is displayed at the top of the page
+
Below the title, the contents of the sections are displayed in a bulleted list. Each item in the list is an internal link to the corresponding part of the page
+
The main parts of each section (top level bullets in the contents) are separated by horizontal lines
+
In the body of the page, each title is followed with a Top link on the right. Clicking this link will get you back to the top of the page
+
+
+
+ There are three kinds of navigation tools that allow you to browse the manual:
+
A set of navigation links: those links (Top, Previous, Up, Next) allow you to go back and forth in your navigation session
+
A search facility: type in a keyword in the provided textfield and click on the Search button. This will direct you to a special result page displaying the manual sections including your search string with links to access them.
+
A contents list: This list includes a set of manual topics corresponding each to one manual page. Clicking on one of those topics will display the corresponding page.
+
+
+
+
+ The Rankings page allows you to access all rankings for any LegacyWorlds game. The top of the page consists in a form where you can choose the rankings to display, by selecting:
+
Game: the first drop down list allows you to select the game for which you want to see the rankings
+
Rankings: the second drop down list allows you to select the type of rankings to display
+
+ Clicking the Display Rankings button updates the rankings list in the bottom part of the page. This list includes for each player in the rankings:
+
Rank: number of the rank
+
Name: name of the player
+
Points: number of points the player has for this particular ranking
+
+
+
+
+
+
diff --git a/manual/beta5/en/law_discrimination.lwdoc b/manual/beta5/en/law_discrimination.lwdoc
new file mode 100644
index 0000000..6acef8a
--- /dev/null
+++ b/manual/beta5/en/law_discrimination.lwdoc
@@ -0,0 +1,54 @@
+
+
+ beta5
+ en
+ Law: discrimination
+
+ [...]
+
+
+
+ (Act no. 2001-1066 of 16 November 2001 Article 1 Official Journal of 17 November 2001)
+
+ (Act no. 2002-303 of 4 March 2002 Article 4 Official Journal of 5 March 2002)
+
+ Discrimination comprises any distinction applied between natural persons by reason of their origin, sex, family situation, physical appearance or patronymic, state of health, handicap, genetic characteristics, sexual morals or orientation, political opinions, union activities, or their membership or non-membership, true or supposed, of a given ethnic group, nation, race or religion.
+
+ Discrimination also comprises any distinction applied between legal persons by reason of the origin, sex, family situation, physical appearance or patronymic, state of health, handicap, genetic characteristics, sexual morals or orientation, political opinions, union activities, membership or non-membership, true or supposed, of a given ethnic group, nation, race or religion of one or more members of these legal persons.
+
+
+ Act no. 2001-1066 of 16 November 2001 Article 1 Official Journal of 17 November 2001
+
+ Ordinance No. 2000-916 of 19 September 2000 Article 3 Official Journal of 22 September into force 1 January 2002
+
+ Discrimination defined by article 225-1, committed against a natural or legal person, is punished by two years? imprisonment and a fine of ? 30,000 where it consists:
+
of the refusal to supply goods or services;
+
of obstructing the normal exercise of any given economic activity;
+
of the refusal to hire, to sanction or to dismiss a person;
+
of subjecting the supply of goods or services to a condition based on one of the factors referred to under article 225-1;
+
of subjecting an offer of employment to a condition based on one of the factors referred to under article 225-1.
+
+
+
+ (Act no. 2002-303. of 4 March 2002 Article 4 Official Journal of 5 March 2002)
+
+ The provisions of the previous article do not apply to:
+
discrimination based on state of health, when it consists of operations aimed at the prevention and coverage of the risk of death, of risks for the physical integrity of the person, or the risk of incapacity to work or invalidity. However, when it is based on the consideration of predictive genetic tests relating to an illness that has not yet commenced or the genetic predisposition towards an illness, this discrimination is punished by the penalties provided for by the previous article;
+
discrimination based on state of health or handicap, if it consists of a refusal to hire or dismiss based on a medically established incapacity, according to either the provisions of title IV of book II of the Labour Code, or of the laws defining the statutory framework of the public service;
+
recruitment discrimination based on gender when the fact of being male or female constitutes the determining factor in the exercise of an employment or professional activity, in accordance with the provisions of the Labour Code or of the laws defining the statutory framework of the public service.
+
+
+
+ Legal persons may incur criminal liability for the offence defined under article 225-2, pursuant to the conditions set out under article 121-2. The penalties incurred by legal persons are:
+
a fine, pursuant to the conditions set out under article 131-38;
+
the penalties enumerated under 2, 3, 4, 5, 8 and 9 of article 131-39.
+
+ The prohibition referred to in 2 of article 131-39 applies to the activity in the exercise of which or on the occasion of the exercise of which the offence was committed.
+
+ [...]
+
+
+
+
+
+
diff --git a/manual/beta5/en/law_spam.lwdoc b/manual/beta5/en/law_spam.lwdoc
new file mode 100644
index 0000000..906ad86
--- /dev/null
+++ b/manual/beta5/en/law_spam.lwdoc
@@ -0,0 +1,21 @@
+
+
+ beta5
+ en
+ Law: spam
+
+ [...]
+
+ (inserted by Order no. 2001-741 of 23 August 2001 art. 5 and art. 12 Journal officiel of 25 August 2001)
+
+ Direct canvassing by a business, by means of automatic calling machines or faxes or electronic messages, of consumers who have not expressed their agreement to receive such calls is prohibited.
+
+ Distance communication methods, other than those mentioned in the previous paragraph, involving personal communication, may only be used where the consumer has not raised an objection.
+
+ The conditions under which the consumer expresses his agreement to receive the calls mentioned in the first paragraph, information that the professional must supply to the consumer regarding his opportunity to raise an objections as well as the conditions under which objection registers are kept are prescribed by Council of State decree.
+
+ [...]
+
+
+
+
diff --git a/manual/beta5/en/law_unauthorised_access.lwdoc b/manual/beta5/en/law_unauthorised_access.lwdoc
new file mode 100644
index 0000000..ee0ce9b
--- /dev/null
+++ b/manual/beta5/en/law_unauthorised_access.lwdoc
@@ -0,0 +1,57 @@
+
+
+ beta5
+ en
+ Law: unauthorised access
+
+ [...]
+
+
+ Ordinance no. 2000-916 of 19th September 2000 Article 3 Official Journal of 22nd September 2000 came into force the 1st January 2002
+
+ Fraudulently accessing or remaining within all or part of an automated data processing system is punished by one year's imprisonment and a fine of 15,000 euros.
+
+ Where this behaviour causes the suppression or modification of data contained in that system, or any alteration of the functioning of that system, the sentence is two years' imprisonment and a fine of 30,000 euros.
+
+
+ Ordinance no. 2000-916 of 19th September 2000 Article 3 Official Journal of 22nd September 2000 came into force the 1st January 2002
+
+ Obstruction or interference with the functioning of an automated data processing system is punished by three years' imprisonment and a fine of 45,000 euros.
+
+
+ Ordinance no. 2000-916 of 19th September 2000 Article 3 Official Journal of 22nd September 2000 came into force the 1st January 2002
+
+ The fraudulent introduction of data into an automated data processing system or the fraudulent suppression or modification of the data that it contains is punished by three years' imprisonment and a fine of 45,000 euros.
+
+
+ The participation in a group or conspiracy established with a view to the preparation of one or more offences set out under articles 323-1 to 323-3, and demonstrated by one or more material actions, is punished by the penalties prescribed for offence in preparation or the one that carries the heaviest penalty.
+
+
+ Natural persons convicted of any of the offences provided for under the present Chapter also incur the following additional penalties:
+
forfeiture of civic, civil and family rights, pursuant to the conditions set out under article 131-26;
+
prohibition, pursuant to the conditions set out under article 131-27 to hold public office or to undertake the social or professional activity in the course of which or on the occasion of the performance of which the offence was committed, for a maximum period of five years;
+
confiscation of the thing which was used or intended for the commission of the offence, or of the thing which is the product of it, with the exception of articles subject to restitution;
+
mandatory closure, for a maximum period of five years of the business premises or of one or more of the premises of the undertaking used to commit the offences;
+
disqualification from public tenders for a maximum period of five years;
+
prohibition to draw cheques, except those allowing the withdrawal of funds by the drawer from the drawee or certified cheques, for a maximum period of five years;
+
public display or dissemination of the decision, in accordance with the conditions set out under article 131-35.
+
+
+
+ Legal persons may incur criminal liability for the offences referred to under the present Chapter pursuant to the conditions set out under article 121-2.
+
+ The penalties incurred by legal persons are:
+
a fine, pursuant to the conditions set out under article 131-38;
+
the penalties referred to under article 131-39.
+
+ The prohibition referred to under 2 of article 131-39 applies to the activity in the course of which or on the occasion of the performance of which the offence was committed.
+
+
+ Attempt to commit the misdemeanours referred to under articles 323-1 to 323-3 is subject to the same penalties.
+
+ [...]
+
+
+
+
+
diff --git a/manual/beta5/en/legal.lwdoc b/manual/beta5/en/legal.lwdoc
new file mode 100644
index 0000000..f86aa76
--- /dev/null
+++ b/manual/beta5/en/legal.lwdoc
@@ -0,0 +1,41 @@
+
+
+ beta5
+ en
+ Legal Issues
+
+ The server on which the game is hosted is located in France. As a consequence French law is applicable. For those not familiar with it here are a few reminders about what it implies in the context of the game.
+
+
+ This legal topic covers both:
+
Access to anyone's account without his knowledge: using whatever mean (guessing, brute force, keystroke logger and such) to acquire anyone's account information and use it without the legitimate owner's knowledge is prohibited
+
Unauthorised access to the server: using whatever mean to gain access to a server on which you don't have permissions is also prohibited by law
+
+ Legacy Worlds' accounts and Legacy World's server both fit into that legal category and you'll find here the extracts of the french Code Penal wich concerns that kind of criminal offense.
+
+
+ The law number 78-17, from the 6th january 1978 known in France as "Loi informatique et libertes" aims at ensuring that data privacy is applied to the collection, storage, and use of personal data. The main principles for regulation of personal data processing are as follows (list not inclusive):
+
all illegal means of data collection are forbidden;
+
the aim of the data files must be explicitly stated;
+
people registered in files must be informed of their rights, for example, for rectification and deletion of data on demand;
+
finally, no decision about an individual can be decided by a computer.
+
+ The archival of sensitive information can result in 5-year prison term and a 300 000 euros fine.
+
+ An official translation of the complete text can be found here in PDF format. You can also have a look at the CNIL (French governmental Commission in charge of data privacy related issued) website.
+
+ The amount of personal data stored in Legacy Worlds is limited to e-mail addresses but you nevertheless have the rights described in this law. This e-mail addresses database is used for internal game related actions only and won't be sold nor offered to any third party for commercial purpose. The only persons who might access it are the game administrators. You can ask for access, rectification, deletion of your own personal data by contacting the game administrators.
+
+
+ The messaging system and the forums provided in Legacy Worlds are to be used for game related topics and to build up a players' community only. As a consequence no spam nor commercial messages can be tolerated.
+
+ You may find here an extract of the French Consumer Code about unsolicited commercial messages.
+
+
+ French law is also very strict on any kind of discrimination and no behaviour of the kind can be tolerated in-game. This means that you can't dismiss any player for whatever particularity he may have, be it sex, age, physical characteristic, religion or whatever. The copy of the French Code Penal on this subject can be found here.
+
+
+
+
+
+
diff --git a/manual/beta5/en/main.lwdoc b/manual/beta5/en/main.lwdoc
new file mode 100644
index 0000000..e43dc18
--- /dev/null
+++ b/manual/beta5/en/main.lwdoc
@@ -0,0 +1,11 @@
+
+
+ beta5
+ en
+ Manual
+
+
+
+
+
+
diff --git a/manual/beta5/en/maps.lwdoc b/manual/beta5/en/maps.lwdoc
new file mode 100644
index 0000000..db200fc
--- /dev/null
+++ b/manual/beta5/en/maps.lwdoc
@@ -0,0 +1,131 @@
+
+
+ beta5
+ en
+ Maps
+
+ LegacyWorlds takes place in a far far away galaxy. The maps allow you to get a grasp on the lay-out of this galaxy.
+
+ This manual section will first of all introduce basic concepts about the galaxy and then present the various available maps along with the associated controls.
+
+
+
+
+ A galaxy is a huge gravitationally bound system of stars, interstellar gas and dust, plasma, and (possibly) unseen dark matter. Stars in the galaxy all orbit a common center of gravity.
+
+ Representing a galaxy as it should be would be of course very difficult to read as distances between objects are huge compared to the size of the objects. Moreover galaxies aren't exact planes and distances between objects vary from object to object.
+
+
+
+ For ease of reading and understanding the galaxy in which the game takes place is represented inside a grid, which consists in a distorted view of reality.
+
+ Two objects are in adjacent grid squares because they are relatively close to one another in reality. But it doesn't mean the distances aren't tremendous.
+
+
+ Each square in the galaxy grid contains 6 objects. Those objects may be planets, planetary remains or parts of a nebula.
+
+ Within a planetary system, planets orbit the central star in elliptical orbits. Eah object orbits the star at a different distance. Thus each object is said to be located on a different orbit. Orbits are ordered according to the distance to the star. The first orbit is the closest while the 6th is the furthest.
+
+ Even if no planetary system exists inside a nebula the same orbit system is applied in the game galaxy. As a consequence nebula squares are also split in 6 orbits, representing each one region of the nebula square.
+
+ In the grid representation of LegacyWorlds galaxy, the object located on the first orbit is the first one in the list of items in the stellar system grid square and so on.
+
+
+
+ The LegacyWorlds galaxy is also an expanding galaxy. It's still young and contains enough dense molecular clouds to produce new generations of stars, thus increasing its size. The in game universe expansion is triggered by new players joining the game in order to provide them with enough room to settle in.
+
+
+
+ As mentionned earlier various stellar objects are present in the galaxy:
+
planets
+
planetary remains
+
nebula
+
+ All those objects are discussed in mode details in the Types of stellar objects section of the individual planet page manual page.
+
+
+
+
+ In order to help you navigate your ships in LegacyWorlds galaxy three kinds of maps are available:
+
Planets Map: this map displays planet names for each planet
+
Alliance Map: this map displays alliances tag for each planet
+
Listing: this presents the planets in the galaxy as a list
+
+ Common features are also available for all kinds of maps.
+
+
+
+ All maps present two features that work the same in all cases:
+
Maps controls: these controls allow you to customise the display of the maps
+
Maps caption: the caption explains the various colour codes used on the map
+
+ The next paragraphs explain both topics more precisely.
+
+
+ The common controls at the top of the page allow you to choose the map to display and its parameters. More precisely those features include:
+
Display: the drop down menu allows you to select the type of map you want to see among the three available modes
+
Grid size: the drop don menu allows you to change the size of the grid to diplay, from 1 system to 7x7 systems
+
Center on: selecting the corresponding radio button or typing something on the same line as a radio button allows you to chose to center the map either on:
+
coordinates: you have to type the X and Y coordinates to center the map on in the two provided textfields
+
own planet: the drop down list allows you to select the name of a planet you own on which you want the map to be centered
+
planet: type the name of a planet in the provided textfield allows you to center the map on this planet
+
+
+ The Update Diplay button allows to take into account the modifications you might have made on the map parameters.
+
+
+
+ A caption is also presented. the map colours include:
+
Green: your own planets
+
Blue: planets belonging to members of your alliance
+
White: other planets, that is to say planets belonging to non alliance members, neutral planets and so on
+
Yellow: planetary remains
+
Shades of red: those aren't planets but nebula squares. Each level of red represent an opacity level or opacity class for the corresponding nebula sector. You can't own nebula squares but can travel through them and station fleets on them but the speed of your ships is reduced depending on the opacity of the nebula square
+
+
+
+
+
+ This is the standard display. It includes a grid of the requested size presenting X and Y coordinates.
+
+ On the borders of the grid clicking on arrows allows you to move the focus of the displayed grid on the complete map. Left and right arrows allow you to move along the X axis whereas top and bottom arrows allow you to move along the Y axis.
+
+
+ In stellar systems are presented for each planet:
+
a planet image
+
a planet name: the name is a link to an individual planet page. The contents of the individual planet page depends on the level of information you have on the planet, that is to say whether it's yours, belongs to your alliance, you have fleets on it and so on
+
+ In nebula squares are displayed:
+
in shades of red the names of the different nebula sectors
+
the background image depends on the average opacity of the nebula square
+
+
+
+
+
+ This display is a specialised one that allow you to grasp where various alliances are settled in. It includes a grid of the requested size presenting X and Y coordinates.
+
+ On the borders of the grid clicking on arrows allows you to move the focus of the displayed grid on the complete map. Left and right arrows allow you to move along the X axis whereas top and bottom arrows allow you to move along the Y axis.
+
+
+ In stellar systems are presented for each planet:
+
a planet image
+
an alliance tag. Untagged planets, that is to say planets which don't belong to any alliance, are presented with empty brackets
+
+ In nebula squares are displayed:
+
in shades of red the text N/A for all different nebula sectors
+
the background image depends on the average opacity of the nebula square
+
+
+
+
+ In listing mode planets in the selected area are presented as a list which includes for each planet:
+
Coordinates: coordinates of the planet
+
Planet: planet image and name. The planet name is a link to an individual planet page. The contents of this page depends on the level of information you have on the planet, that is to say whether it's yours, belongs to your alliance, you have fleets on it and so on.
+
Tag: tag of the alliance to which the planet belongs. Empty brackets are displayed for untagged planets, that is to say planets which don't belong to any alliance. A - is displayed for nebula sectors
+
Opacity: it represents the density of matter in the area which influences ships speed. The opacity is mostly interesting for nebula sectors where it represents the class of the nebula. It's 0 for viable planets and 1 for planetary remains, that is to say planets which have been destroyed.
+
+ As in all lists clicking on the title of one column allows you to order the items in the list according to the values of that field, either in descending or ascending order. Clicking again on the same title allows to switch between descending and ascending order.
+
+
+
diff --git a/manual/beta5/en/market_buy.lwdoc b/manual/beta5/en/market_buy.lwdoc
new file mode 100644
index 0000000..d94c5e8
--- /dev/null
+++ b/manual/beta5/en/market_buy.lwdoc
@@ -0,0 +1,191 @@
+
+
+ beta5
+ en
+ Buying and accepting a gift
+
+ When items are on sale, salers need customers. This part of the manual explains how to make buying offers, how to accept gifts and so on.
+
+ Two kinds of sales offers exist in Legacy Worlds:
+
Public Offers: the sale offers are made publicly and all players can buy items offered for sale
+
Direct offers: the sale or gift offers are only made to one player (you) and noone else is aware of them except you a,d of course the seller
+
+ Each category is managed from a particular subpage of the marketplace page through the corresponding link at the top of the page body. The next sections will describe each case.
+
+
+
+ Public sales offers are accessible through the Public Offers subpage of the marketplace page. The offers are displayed in a geograpical basis. This means that all offers aren't displayed at once. Only offers in a particular region of space are listed.
+
+ As a consequence, the subpage is split in two sections:
+
The left part of the page lists planets and fleets sales offers in the region of space that is currently in focus
+
The right part of the page provides a tool that allows to navigate the galaxy and change the area of space that is under focus
+
+ The next sections will describe each part of the subpage.
+
+
+ The right part of the page provides four different means to change the focus of the sales search:
+
Minimap: this minimap is centered on the system in which is located your first planet and displays one stellar system at a time. Arrows are diplayed around the minimap. Using the arrows around the map allows you to change the focus of the minimap and move around that system
+
Centre on coordinates: you can center the minimap on a particular stellar system based on its coordinates. To do you you have to select the relevant radio button and the coordinates of the stellar system in the provided textfields. Clicking the Change Display button centers the map on this system
+
Centre on own planet: you can also center the minimap on one of your own planets. To do so, select the relevant radio button and choose the planet you're interested in in the drop down list. Clicking the Change Display button centers the minimap on the system the planet is located in
+
Centre on planet: you can also center the minimap on an stellar body based on its name. In that case select the corresponding radio button and type in the name of the stellar object in the provided textfield. Clicking the Change Display button centers the minimap on the system the stellar object is located in
+
+ You also have the possibility to define the size of the focus area. This size is represented by a distance around the stellar system displayed on the minimap. You can change this distance by using the Distance drop down list. Possible values are between 1 and 7.
+
+ For each change you make in the form (except using the arrows in the minimap) don't forget to click the Update Display button to validate your changes.
+
+
+
+ All current planets and fleets sales offers in the selected area of space are listed on the left part of this subpage, if any. The rest of this section will detail both lists.
+
+
+
+ The list of planet sales offers can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of pending offers
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of pending offers a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Public Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular planets. This search system consist in a textfield where you can type in a search string. Any planet which name contains the search string, wherever it may be located in the planet name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all planets sales offers. This list includes for each offer:
+
Planet: the name of the planet on sale. This name is a link to the individual planet page
+
Coords.: the coordinates of the planet
+
Pop.: the total population of the planet
+
Turrets: the total number of turrets on the planet
+
Fact.: the total number of factories on the planet
+
Fleets: if a fleet is bundled with the planet, the number of ships of each category is displayed with the following code:
+
G for GA ships
+
F for fighters
+
C for cruisers
+
B for battle cruisers
+
If no fleet is bundled the No Fleet string is displayed
+
Owner: the name of the player currently owning the planet
+
Expiration: if the offer expires over time, an expiration time and date are displayed. Otherwise this field contains the Never string.
+
Price: for public sales, the price is the buying price, for auction the price is the last bid
+
Action: two actions are possible:
+
For public sales: clicking the Buy link opens an alert confirmation window where you have to confirm to buy the planet at the displayed price
+
For Auctions sales: click the Place Bid link opens an alert window where you can type in your bid. That bid has to be higher than the previous one. The player who placed the higher bid when the expiration time is reached buys the planet
+
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this flied. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+ The list of fleets sales offers can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of pending offers
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of pending offers a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Public Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular locations where flets are on sale. This search system consist in a textfield where you can type in a search string. Any location which name contains the search string, wherever it may be located in the location name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all fleets sales offers. This list includes for each offer:
+
Location: the name of the location where fleets are on sale. This name is a link to the individual page of this location
+
Coords.: the coordinates of the location
+
G.A.S.: the number of GA ships in the fleet
+
Fgt.: the number of fighters in the fleet
+
Cru.: the number of cruisers in the fleet
+
B.Cru.: the number of battle cruisers in the fleet
+
Owner: the name of the player currently owning the fleet
+
Expiration: if the offer expires over time, an expiration time and date are displayed. Otherwise this field contains the Never string.
+
Price: for public sales, the price is the buying price, for auction the price is the last bid
+
Action: two actions are possible:
+
For public sales: clicking the Buy link opens an alert confirmation window where you have to confirm to buy the fleet at the displayed price
+
For Auctions sales: click the Place Bid link opens an alert window where you can type in your bid. That bid has to be higher than the previous one. The player who placed the higher bid when the expiration time is reached buys the fleet
+
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this flied. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+
+
+ All current and past sales and gift offers that were made personally to you are listed on Direct Offers part of the marketplace page. This section is accessible through the Direct Offers link on top of the marketplace page. The rest of this section will detail both lists.
+
+
+
+ The list of pending sale or gift offers can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of pending offers
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of pending offers a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Direct Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular planets on sale or on which fleets are beeing sold. This search system consist in a textfield where you can type in a search string. Any planet which name contains the search string, wherever it may be located in the planet name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all pending offers. This list includes for each offer:
+
Received: the time and date when the offer was made
+
Sender: the name of the player who made the offer to you
+
Price: the price at which the offer has been made. This field is Free for gifts
+
To Player: the player to whom the offer has been made. This field is N/A for public and auction sales
+
Details: a sentense describing the item on sale:
+
For planets: it includes planet name and coordinates, population, number of turrets and factories
+
For fleets: it includes the number of ships of each category along with the total fleet power
+
For planets with bundled fleets: it includes the information provided for both planet and fleets
+
+
Accept offer link: clicking this link opens an alert box where you have to confirm you want to accept the offer and make the sale or gift effective
+
Decline offer link: clicking on this link opens a confirmation alert box. Confirming the action in this alert box rejects the offers.
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this flied. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+ The sales or gift offers history can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of offers history
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of offers history a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Direct Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular planets or fleets offers. This search system consist in a textfield where you can type in a search string. Any planet which name contains the search string, wherever it may be located in the planet name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all offers in the history list. This list includes for each offer:
+
Last Change: the time and date when the last change on the offer has occured. It might be a cancellation of someone accepting the offer for instance
+
Received: the time and date when the offer was received
+
Status: the outcome of the offer. The offer may have been cancelled or accepted or rejected
+
Sender: the name of the player who made the offer
+
Details: a sentense describing the item on sale:
+
For planets: it includes planet name and coordinates, population, number of turrets and factories
+
For fleets: it includes the number of ships of each category along with the total fleet power
+
For planets with bundled fleets: it includes the information provided for both planet and fleets
+
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this field. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+
diff --git a/manual/beta5/en/market_sell.lwdoc b/manual/beta5/en/market_sell.lwdoc
new file mode 100644
index 0000000..47d9625
--- /dev/null
+++ b/manual/beta5/en/market_sell.lwdoc
@@ -0,0 +1,190 @@
+
+
+ beta5
+ en
+ Selling and Giving
+
+ In order for exchanges to take place it is obvious that some items for sale are necessary. This part of the manual will cover this topic. It will go through the process of putting planets and fleets on sale, be it publicly or privately, going through the offers you're making or have already made and making gifts.
+
+
+
+ In order to put an item on sale, you first of all have to choose the item. The process is a bit different depending on the type of item you want to sell:
+
Planets: on the individual page of each planet, a Sell/Give link is displayed below the planet name among other action links. Clicking on this link directs you to the planet sale page
+
Fleets: on the Fleets page, once you have selected the fleet with corresponding checkbox, a Sell link appears among the other action links. Clicking on the link directs you the fleets selling page. It is also possible to sell a fleet bundled with a planet. This topic will be covered along with planets sales
+
+
+
+
+ Once you have clicked on the Sell/Give link of a planet you get directed to a special page with similar items with the individual planet page. This page is split into four sections:
+
Top planet section
+
Planet Overview
+
Give / Sale Planet
+
Bundled Fleets
+
+ The next paragraphs will go through the different sections and their role in the sale process.
+
+
+ This part of the page is almost the same as for the individual planet page. See this section of the manual for more details. The only difference stands with the planetary control links below the planet name. There are only two sale related links:
+
Confirm Sale: once you are statisfied with the choices you've made in the sale form, click on the link to confirm the sale and make it "official". Clicking the link will open a confirmation alert window where you have to confirm again in order to validate the sale offer
+
Cancel: click on this link to remove all changes you've made to the form and go back to the individual planet page of the planet
+
+
+
+ This part of the page is identical to the Planet Overview section of the Individual Planet Page. See this section of the manual for more details.
+
+
+ This part of the page is the actual selling tool. The left part of the page consists in a set of radio buttons corresponding each to one category of sale. Depending on the choice you make, the right part differs because it's specific to the type of sale. The different possible values for the radio button are:
+
Gift: in the case of a gift you're giving a planet to another player without any finantial compensation. The offer is targetted to a particular player. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Target player: use this text field to type in the name of the player to whom the offer has to be made
+
+
Direct Sale: in the case of a direct sale, the sale offer is only made to one player but there is a price attached to the planet. The target player is the only other player who is aware of the sale offer. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Target player: use this text field to type in the name of the player to whom the offer has to be made
+
Price: use this text field to type in the amount of cash you wish to obtain in exchange for the planet
+
+
Public Sale: in the case of a public sale, the sale offer is made in public and all players can see it. The first player who offers to buy the planet is the one with whom the sale is concluded. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Price: use this text field to type in the amount of cash you wish to obtain in exchange for the planet
+
+
Auction Sale: in the case of an auction sale, the offer is also publicly available to all players. But you don't define a fix price for the planet. You can only set a minimum bid. The player who has the higher bid when the offer expires buys the planet for the price corresponding to his bid. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days, The value Never is invalid in this case.
+
Minimum bid: use this text field to type in the minimum price you want to sell the planet to
+
+
+
+
+ When putting a planet for sell or offering a planet as a gift you have the possibility to also offer the fleets orbiting the planet. The price for the planet then correspond to a bundle price for both the fleet and the planet. That's what this section of the manual is all about.
+
+ This part of the page provides a list of all fleets you own that are orbiting the planet. This list includes the following fields:
+
Name: the current name of the fleet
+
G.A. Ships: the number of GA ships in the fleet
+
Fighters: the number of fighters in the fleet
+
Cruisers: the number of cruisers in the fleet
+
Battle Cruisers:the number of battle cruisers in the fleet
+
Power: the total power of the fleet
+
+ In front of each fleet there is a checkbox. Checking the checkbox selects the fleet as having to be sold or given along with the planet.
+
+
+
+
+ Once you have selected fleets on the fleet page and clicked on the Sell link, you get directed to a special fleet selling page. In the top right section of the page are located the page action links:
+
Cancel: this link is always present and clicking it removed all modifications you might have made and directs you back to the fleets page
+
Confirm: clicking this link validates the offer and you get directed back to the fleets page. It only appears when all form for all locations are filled in properly
+
+
+ For each set of Planet name / coordinates is displayed:
+
Selected Fleets: a list of all fleets you have selected for sale at this location
+
Sale details: a form allowing to define the sale parameters
+
+
+
+ For each location this list presents for each fleet to be sold or given:
+
Fleet Name: the current name of the fleet
+
G.A. Ships: the number of GA ships in the fleet
+
Fighters: the number of fighters in the fleet
+
Cruisers: the number of cruisers in the fleet
+
Battle Cruisers:the number of battle cruisers in the fleet
+
Power: the total power of the fleet
+
+ At the bottom of the list a line presents the total for all fleets at this location.
+
+
+ This part of the page is the actual selling tool. The left part of the page consists in a set of radio buttons corresponding each to one category of sale. Depending on the choice you make, the right part differs because it's specific to the type of sale. The different possible values for the radio button are:
+
Gift: in the case of a gift you're giving a fleet to another player without any finantial compensation. The offer is targetted to a particular player. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Target player: use this text field to type in the name of the player to whom the offer has to be made
+
+
Direct Sale: in the case of a direct sale, the sale offer is only made to one player but there is a price attached to the fleet. The target player is the only other player who is aware of the sale offer. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Target player: use this text field to type in the name of the player to whom the offer has to be made
+
Price: use this text field to type in the amount of cash you wish to obtain in exchange for the fleet
+
+
Public Sale: in the case of a public sale, the sale offer is made in public and all players can see it. The first player who offers to buy the fleet is the one with whom the sale is concluded. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values Never, 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days
+
Price: use this text field to type in the amount of cash you wish to obtain in exchange for the fleet
+
+
Auction Sale: in the case of an auction sale, the offer is also publicly available to all players. But you don't define a fix price for the fleet. You can only set a minimum bid. The player who has the higher bid when the offer expires buys the fleet for the price corresponding to his bid. The data you have to fill in in the right part of the form are:
+
Offer expires: use this drop down list to select the expiration time between the values 6 hours, 12 hours, 1 day, 2 days, 3 days, 4 days and 5 days, The value Never is invalid in this case.
+
Minimum bid: use this text field to type in the minimum price you want to sell the fleet to
+
+
+
+
+
+
+
+ All current and past sale and gift offers are listed on the Sent Offer part of the marketplace page. This section is accessible through the Sent Offers link on top of the marketplace page. The rest of this section will detail both lists.
+
+
+
+ The list of pending sale or gift offers can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of pending offers
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of pending offers a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Sent Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular planets on sale or on which fleets are beeing sold. This search system consist in a textfield where you can type in a search string. Any planet which name contains the search string, wherever it may be located in the planet name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all pending offers. This list includes for each offer:
+
Date: the time and date when the offer was made
+
Offer Type: the type of the offer. It can be either Gift, Private Sale, Public Sale or Auction Sale
+
Price: the price at which the offer has been made. This field is N/A for gifts and correspond to the current bid for auction sale
+
Expiration: the date and time when the offer expire
+
To Player: the player to whom the offer has been made. This field is N/A for public and auction sales
+
Details: a sentense describing the item on sale:
+
For planets: it includes planet name and coordinates, population, number of turrets and factories
+
For fleets: it includes the number of ships of each category along with the total fleet power
+
For planets with bundled fleets: it includes the information provided for both planet and fleets
+
+
Cancel link: clicking on this link opens a confirmation alert box. Confirming the action in this alert box cancel the offers.
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this flied. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+ The sales or gift offers history can be split into two parts:
+
Top part: it includes a set of controls that allow you to easily navigate into the list
+
List per se: it's the actual list of offers history
+
+ The next sections of the manual will cover both parts of the list.
+
+
+ On top of the list of offers history a set of controls offer navigation means into the list.
+
+ On the left side of the page, a drop down list allows to select a number of items to display on each page of the list. This number of items can be either 5, 10, 15, 20 or 25. If there are more items in total than this number, the list will be displayed onto several internal pages specific to the list without modifications of the rest of the Sent Offers page.
+
+ In the middle of the page is provided a search facility which allows you to search for particular planets or fleets offers. This search system consist in a textfield where you can type in a search string. Any planet which name contains the search string, wherever it may be located in the planet name, will match the search and be displayed.
+
+ If there are more items in the list than have to be displayed on each list page, a drop down list appears on the right part of the page. This drop down list allows to select the list page to display.
+
+
+ Below the set of control are listed all offers in the history list. This list includes for each offer:
+
Last Change: the time and date when the last change on the offer has occured. It might be a cancellation of someone accepting the offer for instance
+
Status: the outcome of the offer. The offer may have been cancelled or accepted or the item has been sold
+
Sent: the time and date when the offer was made
+
Offer Type: the type of the offer. It can be either Gift, Private Sale, Public Sale or Auction Sale
+
Price: the price at which the offer has been made. This field is N/A for gifts and correspond to the current bid for auction sale
+
To Player: the player to whom the offer has been made. This field is N/A for public and auction sales
+
Details: a sentense describing the item on sale:
+
For planets: it includes planet name and coordinates, population, number of turrets and factories
+
For fleets: it includes the number of ships of each category along with the total fleet power
+
For planets with bundled fleets: it includes the information provided for both planet and fleets
+
+
+ Just as for most lists in game, clicking on the header of one column order the list items according to the value of this field. Clicking again on the same header changes the ordering from ascending to descending and the other way around.
+
+
+
+
+
diff --git a/manual/beta5/en/marketplace.lwdoc b/manual/beta5/en/marketplace.lwdoc
new file mode 100644
index 0000000..1ff5af5
--- /dev/null
+++ b/manual/beta5/en/marketplace.lwdoc
@@ -0,0 +1,45 @@
+
+
+ beta5
+ en
+ Marketplace
+
+ They might not be diplomatic relations per se but economic relations might be considered as a first step towards establishing more solid agreements. As such the marketplace is the place where you can buy or accept and sell or give fleets and planets in LegacyWorlds.
+
+ The marketplace page is split into three subpages:
+
Public Offers: this page presents the planets and fleets that are publicly offered for bidding by their owners. That's also where you can make buying offers.
+
Firect Offers: this page lists the planets and fleets that are directly offered to you and no other players, along with a transaction history
+
Sent Offers: this page lists the sales and gifts offers you've made. Those may be still pending or part of the transactions history
+
+ Those subpages are accessible through the links at the top of the body of the page.
+
+ The next sections of this manual page will go through those different pages while presenting the processes of selling and buying items.
+
+
+ In order for exchanges to take place it is obvious that some items for sale are necessary. This part of the manual will cover this topic. It will go through the process of putting planets and fleets on sale, be it publicly or privately, going through the offers you're making or have already made and making gifts.
+
+
+ When items are on sale, salers need customers. This part of the manual explains how to make buying offers, how to accept gifts and so on.
+
+
+
+ After a sale has been concluded two possibilities exist to cancel the sale:
+
If the buyer doesn't have enough money to purchase the item when the sale is concluded the sale is automatically cancelled
+
If the seller loses the fleet for sale in battle or loses control over the planet for sale the sale is cancelled
+
The seller has 4 hours to cancel the transfer after the sale has been concluded. To cancel the transfer:
+
For planets: go to the individual planet page of the planet and click on the Cancel sale link among the planetary controls links below the planet name
+
For fleets: go to the fleets page and select the fleet for which you want to cancel the sale with the corresponding checkbox. Then click on the Cancel sale link among the action links at the bottom of the page
+
+
+
+
+ There are no guarantees surrounding sales except that the requested price is provided to the seller and the control over the item (planet or fleet) is transfered to the buyer. This means that there might be a fleet waiting to destroy the sold fleet or retake the sold planet.
+
+ In the end everything is a matter of honesty and reputation. If a player has a habit of retaking planets he has just sold the word will spead and it his doubtful other players will buy items from him very often. Just keep that in mind...
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/messages.lwdoc b/manual/beta5/en/messages.lwdoc
new file mode 100644
index 0000000..9b3b8ac
--- /dev/null
+++ b/manual/beta5/en/messages.lwdoc
@@ -0,0 +1,79 @@
+
+
+ beta5
+ en
+ Messaging System
+
+ The Messaging System in Legacy Worlds is very similar to a simple mail client. It allows for folder creation to manage and store messages and offers a linear or threaded view of messages. In the bottom left part of the messaging system pages there is a link that allows you to switch to the forums.
+
+
+ Clicking on the Compose a message link on the Messages page directs you to a message form. You have to fill in the various elements in order to send a message:
+
Message:- the drop down list allow you to select if you want to send the message to:
+
a player
+
an alliance
+
a planet
+
+
to:- you have to type in the text field the name of the recipient: player name, planet name or an alliance tag. In case of an alliance the message is sent to members with diplomatic privileges.
+
Subject:- type in the provided text field the subject of the message.
+
Message:- type in the provided textarea the body of the message.
+
+ The Send message button allows you to send the message to its recipients.
+
+
+
+ Clicking on the Folders link on the messages page directs you to the folder management section of the page. This pages presents a list of all folders for your account including three default folders:
+
Inbox:- received messages get stored here.
+
Internal Transmissions:- messages automatically sent by the game get stored here, including diplomatic messages, alliance specific messages and so on.
+
Sent Messages:- messages you have sent get stored in this folder.
+
+ The three default folders are permanent folders and can't be deleted.
+
+
+ You can create a new folder by typing the new folder name in the provided text field and clicking on the Create button. The newly created folder will then be added to the folders list.
+
+
+ In the folders list a checkbox is displayed in front of each folder. Checking the checkbox allows you to perform actions on the folders. The action section of the page is displayed once you've checked a checkbox and offers:
+
Flush:- the flush button is available for all folders. Clicking the Flush button empties all selected folders.
+
Delete:- the delete button is only available for custom folders. Clicking the Delete button deletes the selected folders and their contents.
+
+
+
+
+
+ A list of all folders is displayed in the left part of the page. When unread messages are present in a given folder, the name of the folder is presented in bold with the number of unread messages between parenthesis. Clicking on the name of a folder allows to visualise the list of the messages it contains. This list presents several options:
+
Messages per page:- the drop down list allows you to choose how many messages to display on each page.
+
Threaded view:- check this checkbox allows you to switch to thread view mode. Leaving the checkbox unchecked presents a linear display.
+
Page:- in case it's required this drop down list appears and allows you to navigate between pages of messages in the given folder.
+
+ The list also present various fields for each message:
+
Subject:- subject of the message.
+
Date:- date and time the message was sent or received.
+
From:- author of the message.
+
To:- recipient of the message.
+
+ Clicking on the title of the columns allow you to order the messages according to that field either in descending or ascending order. Clicking several times on the same column header allows to switch betseen ascending and descending order.
+
+
+ In order to read a particular message you have to click on its subject. The body of the message is then displayed along with a [ Reply ] link. Clicking again on the subject of the message hides the body of the message again.
+
+ Clicking on the reply link when the body of the message is displayed directs you to the Compose a message page with prefilled recipient and subject fields. See the Compose a message section of the manual for more information about this process.
+
+
+ In any given folder, checkboxes are present:
+
in front of the subject header:- checking this checkbox selects all messages in the folder.
+
in front of each message:- checking this checkbox selects the corresponding message.
+
+ Once messages have been selected several actions become available at the bottom of the page:
+
Delete:- clicking the Delete button deletes selected messages.
+
Move:- clicking the Move button moves the selected messages to the folder chosen in the drop down list.
+
+
+
+
+ Those are particular messages sent by the game under various circumstances:
+
Game wide information messages.
+
Alliance wide information messages.
+
Empire specific information messages:- scientific exchange offers etc.
+
+
+
diff --git a/manual/beta5/en/mod_rules.lwdoc b/manual/beta5/en/mod_rules.lwdoc
new file mode 100644
index 0000000..b83cca0
--- /dev/null
+++ b/manual/beta5/en/mod_rules.lwdoc
@@ -0,0 +1,77 @@
+
+
+ beta5
+ en
+ Forum Moderation Rules
+
+ In order for players to get to know each others and to play better as members of an alliance or simply of the LegacyWorlds community the game is set with some internal forums. Those forums are a tool for you to use and as all tools allowing people to say what they have to say some simple rules apply.
+
+ So far we've always had a policy of free speech but as everyone knows one's freedom ends where begins someone else's freedom.
+
+ As a consequence:
+
Public forums are moderated by the staff and a set of volunteers appointed by staff members
+
Alliance forums are to be moderated by the alliance's leader and eventually other alliance members appointed by the alliance leader. If posts / threads that don't comply with the moderation rules are brought to the staff's attention, the alliance's leader will be held personally responsible. This means the same punishment will be applied to the alliance's leader as to the offender
+
+
+
+
+ Those rules apply to:
+
Posts in public forums
+
Posts in alliance forums
+
Forum Signatures
+
Private Messages if their contents are brought to the staff's attention
+
+ If you have any questions or concerns regarding these rules, feel free to contact either Tseeker or Ju or Sycophant or El_Cristoph.
+
+ The actual rules follow.
+
+
+ Offensive, vulgar, obscene, threatening, or hateful posts will not be allowed. As this has already been stated in the general rules in the manual, the server being hosted in France, those are considered as criminal offenses according to french law. Not that any of us would like to report you to the police, but people hosting public websites can be held responsible for what is being posted and you wouldn't want your dear staff to end up in jail if someone was to report it, would you?
+
+ Posts that violate include, but are not limited to:
+
Posting insults
+
Posting unrespectful comments towards other players because of their colour, their gender, their faith, their nationality, their religion, their opinions, their social behaviour and so on
+
Posting pornographic or obscene material
+
Posting links to pornographic or obscene pictures, stories, movies or material
+
Posting links to a website that is potentially damaging to your system or personal details by accessing it
+
Threatening another player
+
Repeated Flames
+
+ This is quite objective, but as always the Moderators have final say on the matter. This rule generally applies to trolls. We're not here to babysit you, folks, and we're not going to ban someone because they insulted you once.
+
+
+ Unsolicited and/or multiple posting of threads/replies for the purposes of advertising or multiple posts with little to no content within a short period of time will not be allowed. No, we're not going to delete a post from a valid forum member advertising his or her new website *if done only once*. Members should not clutter the forum with useless posts, pushing posts with actual content off the front page. "Useless" is subjective, and up to the mod's discretion.
+
+
+ Long strings of text without line breaks(Ex.typing 100 D's with no spaces) can throw off the formatting of the page. If you intend to use a long string, please add line breaks. Anything larger tends to throw off the formatting of the entire page, and can really play havoc with those of us who use the smaller resolutions.
+
+
+ Yes, we all know the general forum gets the most visitors. However, if your question/comment is about Bugs, please direct it to the Bugs forum. The same goes for eclectic etc. Threads found in the wrong forum will be moved.
+
+
+
+ Each violation contains a progression of penalties. They are ordered in such a way as that number 1 will be the reprisal for the first offense in that category, number 2 will be the next step up should you become a repeat offender, etc. Please note that depending on the severity of the action, as determined by the administrative staff, the progression of penalties may be completely bypassed where the result is immediate, permanent suspension from the forums and even the game.
+
+
Warning: A verbal warning from the mods, over either the messaging system, the e-mail address listed for your account, or through a response to the offending post
+
Probation: You are placed on probation. We will watch you, any further offense will result in immediate suspension. The admins and mods will keep track of probationary members
+
Suspension: You are suspended from the forums for one week. After one week you will again be in a probationary state, if you should commit the violation again, you will be banned immediately
+
Banning: Self-explanatory. You are banned from the forums. We will notify you by e-mail or private message if you have these methods available should this situation arise. If you do not have these methods available to us, it becomes your responsibilty to contact one of the mods for an explanation as to why you are banned. Banned members will be kept track of
+
+ Note also that should one person consistently collect warnings for numerous offenses yet not progress beyond the warning stage in any one of them, moderators reserve the right to determine an appropriate penalty for the number and severity of warnings. This should not be a game to see how many warnings you can collect without being punished.
+
+
+ Moderators and staff members are human beings just like you. They have feelings and are due to:
+
punish more severely some particular offenses because they consider them as more important
+
punish more severely some players because they have hard feelings towards them
+
+ As a consequence we consider you should have the right to complain if you consider you've been treated unfairly. To do so you should contact the staff and explain the situation. In such cases there are two options:
+
either the staff considers the person who punished you went too far and the punishment will be lifted. The moderator will be flagged as having gone too far once
+
the staff agrees with the person who punished you and no further step will be taken except you'll be flagged as having complained for no valid reason once
+
+ Those flags will be used to help in the moderation system:
+
If a moderator punishes players for no reason more than 5 times, he'll be removed from the moderation team
+
If you complain for no valid reason more than 5 times you'll be definitively banned from the forums
+
+ Moderating forums is a difficult task and everything should be done so that everyone can have faith in the moderating system, be him moderator or a simple player...
+
+
diff --git a/manual/beta5/en/money.lwdoc b/manual/beta5/en/money.lwdoc
new file mode 100644
index 0000000..85dd487
--- /dev/null
+++ b/manual/beta5/en/money.lwdoc
@@ -0,0 +1,47 @@
+
+
+ beta5
+ en
+ Money Page
+
+ In game money has nothing to do with real money. It's an imaginary currency even if the sign used correspond to the euro sign (yes, yes, we're europeans...). Money is the main mean used in LegacyWorlds to acquire items, be it by building them or from other players.
+
+ General information about the concept of money is provided in the corresponding section of the empire manual page. This maunal section is focused on the Money page of the game interface.
+
+
+ This part of the page keeps you updated on the current amount of money you have in bank and that you can use to build fleets, improve your planets, implement technologies or enact laws.
+
+ Once your account is old enough, it also provides you with a form with which you can transfer cash to another player. To transfer cash to another player fill in the amount to transfer in the first provided text field and the player name in the second one. Then click the Ok button.
+
+
+ This section of the page provides you with a quick overview of your profits and losses with three important figures:
+
Planet Income: sum of the incomes of all your planets
+
Fleet Upkeep: sum of all the costs implied to sustain all your fleets
+
Daily Profits: difference between the Planet income and the Fleet upkeep. It's the amount of money you currently earn each day. This cash is delivered twice a day during cash ticks.
+
+ The two first items are links to the relevant detailled sections of the page.
+
+
+ This list details for each of your planets:
+
Planet: name of the given planet
+
Base income: income derived from the population of the planet
+
Industrial Factories: number of industrial factories on the planet
+
Factory Income: income generated by the industrial factories on the planet
+
Factory Upkeep: costs to maintain all the factories (industrial and military) on the planet
+
Turret Upkeep: cost to maintain all the turrets on the planet
+
Expense: sum of the costs previously listed
+
Profit: sum of the profits previously listed minus the expenses
+
+ At the bottom of the list is displayed the Total Daily Income which sums all the planets' profits.
+
+
+ This list details for each of your fleets:
+
Name: name of the fleet as defined in the Fleet page
+
Location: place at which the fleet is located or towards which it is moving
+
Distance: distance between the current place the fleet is and its destination
+
Delay: time left in hyperspace before reaching the destination
+
Upkeep: current cost to sustain this fleet
+
+ At the bottom of the list is displayed the Total Fleet Upkeep which sums all the fleets' upkeeps.
+
+
diff --git a/manual/beta5/en/overview.lwdoc b/manual/beta5/en/overview.lwdoc
new file mode 100644
index 0000000..ad59f6e
--- /dev/null
+++ b/manual/beta5/en/overview.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Overview
+
+ After years of internal conflicts and devastating wars humanity has finally achieved its ultimate goal: destroy its home planet, Earth. The only option left for the remaining survivors of the holocaust: flee to the stars in the hope of finding a new home and rebuild their civilisation. Hundreds of ships were launched into deep space looking for suitable planets and searched for years for some capable of sustaining life.
+
+ As commandant of a small group of colonists you've finally managed to find a planet matching the required parameters and you're about to start rebuilding on it. It will be up to you to make it grow into a new galactic empire in a hostile universe. To achieve that goal you'll have to find allies among the other Earth refugees who settled in the neighbouring star systems and fight those willing to spoil your hard work.
+
+ It will also be up to you to provide your citizens with what they might need and encourage the scientists of the expedition in their research to achieve new technological breakthroughts. It will be up to you to fufill Earth's legacy...
+
+
+ Legacy Worlds is an online multiplayer intergalactic war game. Your goal as a player: build up an empire and defeat the other players. How to achieve that: through technological advancement, alliances with other players and of course conquests.
+
+ Legacy Worlds is a tick based game. This means events are controlled at given intervals of time called ticks.
+
+ Legacy Worlds is a text based game so don't expect any fancy graphics.
+
+ At first started as an university project by one of the developers it's now developed by a little team which felt it was a pity to let it go to waste and disappoint its current players.
+
+ This version is Beta 5 and is as the previous ones completely free.
+
+
+ This tutorial presents a few tips to help you getting started with the game. It's not the ultimate guide to Legacy Worlds and its scope is limited to your first days of gameplay. Becoming the best player in the game will then be up to you.
+
+
+ The manual for the game itself is split among a few sections. You can find out more about these topics on the Manual Topics page.
+
+
diff --git a/manual/beta5/en/overview_page.lwdoc b/manual/beta5/en/overview_page.lwdoc
new file mode 100644
index 0000000..9228c93
--- /dev/null
+++ b/manual/beta5/en/overview_page.lwdoc
@@ -0,0 +1,105 @@
+
+
+ beta5
+ en
+ Overview Page
+
+ The overview page provides you with a summary of the situation of your empire along with general information about the universe.
+
+ This overview page exists in two versions:
+
Short Overview
+
Complete Overview
+
+ The difference between the two is of course that the complete overview includes more information and more precise data than the short one.
+
+ You can switch between short and complete overview by clicking on the link in the top right corner of the page.
+
+ The following sections of the manual will describe each of them.
+
+
+ This overview provides you with a few simple facts about your empire and the universe.
+
+ Among empire related data you may find:
+
Messages: an update about pending messages along with links to the relevant mail boxes if you have new messages. A link to get directly to the Compose page of the messaging system is also provided
+
Planets: this section sums up the status of your planets. It displays the number of planets you own, the total population of your empire and the total number of factories you have built
+
Fleets: this section indicates the total average power of your fleets
+
Money: here is displayed your total daily profit
+
+
+
+ This section provides a few useful facts about the universe:
+
Forums: this section informs you if you have unread topics in either general or alliance specific forums. It also provides links to the page of each of those forums' categories
+
Planets: this section indicates the total number of planets in the universe
+
Next ticks: here is provided a countdown to the next tick of each category: battle, cash, day and hour tick.
+
Rankings: here are displayed your two major rankings: general and round rankings
+
+
+
+
+ This overview provides you more detailed information about the same topics as the short overview.
+
+
+ Here you will find some information about your messaging system's status. For each of of your default folders (Inbox, Internal Transmissions and Outbox) you will find:
+
Name of the folder, consisting in a direct link to that folder
+
Number of messages in the folder
+
Number of unread messages in the folder if any
+
+ A Compose link which directs you to the compose page of the messaging system is also available.
+
+
+ In the Planets section of the overview, you will find:
+
Planets owned: total number of planets in your empire, along with the average happiness
+
Average corruption: average corruption calculated based on corruption on each of your planets
+
Total population: population of your whole empire along with a per planet average
+
Total factories: count of all your military and industrial factories throughtout your whole empire along with a per planet average
+
Total turrets: total count of the turrets on all your planets with a per planet average
+
+ This section also include a More Details links which directs you to the Planets general page.
+
+
+ In this section, you will find general information about your fleets:
+
total fleet power
+
number of fleets and number of fleets engaged in battle if any
+
a More Details link to access directly the fleets page
+
+
+
+ This part of the complete overview indicates the number of new technologies (that is technologies you haven't implemented yet) that you have discovered. It also provides a direct link to the Research page.
+
+
+ This section consists in a finantial fact sheet for your empire. It includes:
+
Income: total daily income of your empire
+
Fleet upkeep: amount of money you have to spend each day to sustain your fleets
+
Daily Profit: amount of money you actually earn each day, once you have paid for your fleet upkeep
+
+
+
+
+
+ This section of the Universe overview provides you with a summary of the forums' status.
+
+ It includes a list of the various forums categories with a view link which directs you to the page of this forums category. All forums in each category are listed. For each forum:
+
The name of the forum consists in a link to the forum's main page
+
Next to the name, the number of topics in the forum is indicated
+
If relevant, the number of unread topic or topics with unread posts is displayed
+
+
+
+ Here you will find some data about the universe in which everything happens:
+
Total number of planets
+
Number of grid squares in the universe which aren't actually occupied stellar systems with planets but by nebulas
+
+ It also includes some universe related links:
+
Maps: to access directly the maps page
+
More Details: to go to the Universe main page
+
+
+
+ As on the short overview, this part includes a countdown to the next tick of each category: Battle tick, Cash tick, Day tick and Hour tick.
+
+
+ In this section, you will find the list of all rankings with your current rank in each ranking. It also provides a direct More Details link to access the Rankings page.
+
+
+
+
diff --git a/manual/beta5/en/planet.lwdoc b/manual/beta5/en/planet.lwdoc
new file mode 100644
index 0000000..7590c88
--- /dev/null
+++ b/manual/beta5/en/planet.lwdoc
@@ -0,0 +1,215 @@
+
+
+ beta5
+ en
+ Individual Planet Page
+
+ General concepts about planets are provided in the planet section of the empire manual page. The manual section you're reading now focuses on the Individual Planet page and presents its contents.
+
+ This page is the management page for any individual planet you own or an information page for other stellar objects.
+
+
+
+ In LegacyWorlds you can find three kinds of stellar objects. The next paragraphs will describe each type.
+
+
+ Planets are the basic components of you empire. They are the most interesting stellar objects for us and the next two sections of this manual page concern them.
+
+ To learn more about basic concepts about planets, see this manual section.
+
+
+ When a planet has been detroyed by a Wormhole Supernova, the material the planet is composed of doesn't just disapear. Those are planetary remains which are indicated in yellow on the maps.
+
+ You can fly through planetary remains with your fleets and even station there but of course all the junk in the area have a nasty effect: it's quite difficult to navigate among floating rocks and your fleets are slowed down. This is represented by the opacity level of the planetary remains.
+
+ You can of course access the corresponding detailed page of any grid area of the map occupied by planetary remains. This page will indicate:
+
the fleets present there if you have yourself some fleets on that particular planetary remains
+
the opacity level
+
+
+
+ In the universe everything isn't filled with planetary systems. There are also giant gas clouds called nebulas. The are displayed in shade of red on the maps.
+
+ Just as for planetary remains, it's quite difficult to navigate through gas clouds and crossing nebulas with a fleet slows it down. The speed of the fleet crossing a nebula depends on its opacity: denser the cloud, slower the fleet.
+
+ When looking at the page of a nebula square, you'll see:
+
the fleets present if you have a fleet at those coordinates
+
the opacity level of the square
+
+
+
+
+
+ When accessing the individual page of a planet, the amount of information varies. Depending on the status of the planet towards you, the level of information you have access to changes. The next parapgraphs will present the data displayed in each case.
+
+
+ In that case you have access to a complete planetary management page which is described in the next section of this manual page.
+
+
+ In the case of alliance planets when you have access to the planets list, the individual planet page of an allied planet includes:
+
Coordinates of the planet on the map
+
Alliance the owner of the planet belongs to (that is your own alliance)
+
Total number of factories on the planet
+
Total number of Turrets on the planet
+
+ You have also access to three action links:
+
Send Fleets: click this link to send fleets to that particular planet. Sending fleets is covered in the fleets section of the manual
+
Centre Map: clicking this link directs you to the map page with a map centered on that particular planet
+
Message: clicking this link opens the compose form of the messaging system with the planet name prefilled as recipient. This allows you to send a private message to the planet's owner
+
+
+
+ In the case of alliance planets, when you don't have access to the planets list, the amount of information provided on the individual planet page is very limited. It is equivalent to the data provided for any other planet.
+
+
+ If you have fleets stationed on a planet, the data provided are a bit more extended than for any random planet. You have access to:
+
Coordinates of the planet on the map
+
Alliance the owner of the planet belongs to
+
fleet size if any fleet is present
+
Total number of Turrets on the planet
+
Population of the planet
+
+ You have also access to three action links:
+
Send Fleets: click this link to send fleets to that particular planet. Sending fleets is covered in the fleets section of the manual
+
Centre Map: clicking this link directs you to the map page with a map centered on that particular planet
+
Message: clicking this link opens the compose form of the messaging system with the planet name prefilled as recipient. This allows you to send a private message to the planet's owner
+
+
+
+ In the case of an alliance planet on which you have fleets stationned the level of information provided consists in a combination of your particular alliance planets case (if you have planets list access or not) and the planets you have fleets on case.
+
+
+ In cases which don't fit in any other category you have access to very few data:
+
Coordinates of the planet on the map
+
Alliance the owner of the planet belongs to if any
+
+ You have also access to three action links:
+
Send Fleets: click this link to send fleets to that particular planet. Sending fleets is covered in the fleets section of the manual
+
Centre Map: clicking this link directs you to the map page with a map centered on that particular planet
+
Message: clicking this link opens the compose form of the messaging system with the planet name prefilled as recipient. This allows you to send a private message to the planet's owner
+
+ >
+
+
+
+ The individual planet page is the specific management page for a given planet. It provides detailed information on the planet along with a set of controls to navigate among planets and manage one given planet.
+
+
+ In the top right corner of the page, some general controls allow you to navigate among planetary pages:
+
The Select planet drop down list allows you to switch between planets. Selecting the name of another planet you own in the list gets you directly to its individual planet page
+
The Planet list link gets you back to the Planets main page which lists all your planets
+
+
+
+
+ In the top left part of the page, below the planet name, a list of action links provide planet wide functions. The next paragraphs will detail each link.
+
+
+ You can click this link to send fleets to that particular planet. Sending fleets is covered in the fleets section of the manual.
+
+
+ Clicking this link directs you to the map page with a map centered on that particular planet.
+
+
+ clicking on this link allows you to abandon a planet once you have confirmed the action in the alert box that pops up. The link gets then replaced with the time remaining before the planet is actually out of your control and a Cancel link. Clicking the Cancel link of course stops the abandon process.
+
+ You cannot abandon your planet if you only have one. This link is only displayed if you have at least 2 planets.
+
+
+ Once you've owned a given planet for more than two weeks, a new Rename link appears. Clicking on the link opens an alert box with a textfield where you can type in the new name of the planet. Once you're satisfied with the name you can click the OK button to change the planet's name. the Cancel button of course cancels the change and closes the alert box.
+
+ Once you have renamed a planet you have to wait two more weeks before being able to rename it again.
+
+
+ Clicking on this link gets you to a particular version of the planet page where you can set specific sale/gift parameters. This topic is described more precisely in the marketplace section of the manual.
+
+ You cannot sell your planet if you only have one or if your account is younger than 10 days. This link is only displayed if your account is older than 10 days and you have at least 2 planets.
+
+
+ Once you have access to the Wormhole Supernova technology and of course implemented it, you can see a new link which allows you to detroy the planet with a wormhole Supernova.
+
+ Be careful though: citizens of your empire may not appreciate that you destroyed one of your planets and this action has a bad, lasting effect on the happiness of your population.
+
+
+
+ This part of the page provides some facts about the planet, including:
+
Coordinates: coordinates of the planet on the map
+
Alliance: tag of the alliance the planet belongs to
+
Population: total population size of the planet
+
Turrets: number of turrets on the planet along with a Destroy link. Clicking this link opens an alert window where you can select a number of turrets to destroy
+
Planet Income: amount of money generated by the planet each day
+
Happiness: percentage of happiness for the planet
+
Corruption: percentage of corruption of the planet
+
Industrial factories: number of industrial factories on the planet
+
Military factories: number of military factories on the planet
+
Fleets standing by: in this section the average power of your fleets stationed on the planet is indicated in green. Average power of friendly fleets is in blue and average power of enemy fleets in red
+
+
+
+ Industrial factories produces goods from raw materials. Those goods are sold within the empire and beyond its borders, which generates money. As a consequence the more industrial factories you have the more money you make. But there are workers in factories and they won't be too happy to have to work 3 jobs to get the planetary economy running. So there is a limit to the number of factories you can build without risking a revolt.
+
+ The top part of this section indicates the number of industrial factories currently present on your planet, along with the price to build one new industrial factory.
+
+ Below that section, you can manage factories. To change the number of industrial factories on the planet, use the texfield to indicate an amount of factories to build / destroy and click the relevant button: Increase or Decrease.
+
+ You have to be aware that the number of industrial factories you can destroy is limited to 10% of the number you owned 24h before the destruction attempt. For instance if you had 100 industrial factories 24h ago, buit 20 12h ago and try to destroy some now you can destroy up to 30.
+
+
+ Military factories are specialised factories producing ships and turrets. The speed at wich items are built depends on the number of military factories on the planet. The more factories you have the faster it will go. But there are workers in factories and they won't be too happy to have to work 3 jobs to get the planetary weapon industry. So there is a limit to the number of factories you can build without risking a revolt.
+
+ The top part of this section indicates the number of military factories currently present on your planet, along with the price to build one new military factory.
+
+ Below that section, you can manage factories. To change the number of military factories on the planet, use the texfield to indicate an amount of factories to build / destroy and click the relevant button: Increase or Decrease.
+
+ You have to be aware that the number of military factories you can destroy is limited to 10% of the number you owned 24h before the destruction attempt. For instance if you had 100 military factories 24h ago, buit 20 12h ago and try to destroy some now you can destroy up to 30.
+
+
+
+ This part of the page is composed of two sections:
+
tools to add elements to a build queue in the left part
+
build queue management tools in the right part
+
+ The next paragraphs will describe their usage.
+
+
+ In order to build new items, you have to select the type of item you want to build.
+
+ Depending on your technology level, different items are available. Basically you can find turrets (stationary defenses) and Ground Assault (GA) ships (system ships carrying troups which allow them to take control over planets). The following technologies provide you access to other types of ships:
+
Battle Cruisers
+
Cruisers
+
Fighters
+
+
+ Ship types are described more precisely in the ships part of the manual.
+
+ In order to select one item, you have to select the radio button before its name. The cost for one item of each category is indicated along the name. Once you have selected one item, use the Quantity textfield to indicate the number of items to build. Then click the Add button to add the items to the build queue.
+
+
+
+ The build queue consist in:
+
a list of items being built
+
action buttons
+
+ The next parapgraphs will cover both topics.
+
+
+ The list of items being buit includes:
+
Qty: number of items in the queue
+
Type: category of items being built
+
Time to build - Ind.: individual build time for this bundle of items. The time is rounded up to be expressed in hours
+
Time to build - Cum.: cumulated build time for all items in the queue up to this one. This cumulative build time is the sum of build times for previous items without rounding. This represents the fact that if the full hour tick time isn't required to finish one item, work starts on the next. As a consequence, cumulative build time may be inferior to the sum of all individual build times
+
+
+
+ Available build queue actions are:
+
Up: to move one item up in the queue. To do so, select one item by checking the checkbox on its line and click the Up button.
+
Down: to move one item up in the queue. To do so, select one item by checking the checkbox on its line and click the Down button.
+
Cancel: to remove one item from the queue. To do so, select one item by checking the checkbox on its line and click the Cancel button.
+
Flush: to remove all items in the build queue. To do so, just click the Flush button.
+
+ You also have the ability to replace one item in the queue with another. In order to do so, select the item to replace by checking its checkbox in the build queue. Then proceed as if you were to add a new item to the queue but click the Replace button instead of the Add button.
+
+
+
+
+
diff --git a/manual/beta5/en/planets.lwdoc b/manual/beta5/en/planets.lwdoc
new file mode 100644
index 0000000..556a814
--- /dev/null
+++ b/manual/beta5/en/planets.lwdoc
@@ -0,0 +1,59 @@
+
+
+ beta5
+ en
+ Planets Overview Page
+
+ General concepts about planets are provided in the planet section of the empire manual page. The manual section you're reading now focuses on the Planets page and presents its contents.
+
+ The Planets page provides you with a general overview of all your planets at once along with a quick builder facility. A link in the top right corner of the page allows to switch between two views:
+
List of controlled planets only
+
Quickbuilder facility and list of controlled planets
+
+ Each of those two elements are described in the other paragraphs of this manual section.
+
+
+ This section of the page displays a list of all planets in your empire along with:
+
Planet: name of the concerned planet. It's a link to the corresponding planet page
+
Coords: coordinates of the planet
+
Population: population of the planet in millions of unhabitants
+
Happiness: percentage of happiness for the planet
+
Industrial: number of industrial factories on the planet
+
Turrets: number of turrets on the planet
+
Military: number of military factories on the planet
+
Profit: daily profit generated by the planet
+
Currently Building: list of the first elements in the build queue along with the time to completion. A link at the top of the page allows to switch between a view with cumulated build times and a view with individual build times.
+
+
+
+
+ Switching to quick builder mode modifies slightly the controlled planets list and reveals a new section of the page. Using those tools you can manage factories and ships construction and destruction on several planets at once.
+
+
+ In order to do some actions at the planetary level on several planets at once, you first of all have to select the planets you're interested in. This can be achieved by checking the checkboxes which are displayed in front of each planetname. Quick links are also provided at the top of the planets list:
+
select all: to select all planets
+
unselect all: to unselect all planets
+
invert: to invert the selection
+
+ The operation to perform at the planet level may be chosen with radio buttons in the corresponding section of the quick builder. Clicking any element on the same line as a radio button selects it. The different possible operations are:
+
Operations on factories: Using the corresponding drop down lists you can either build or destroy the number of industrial or military factories that you chose in the textfield.
+
Adding to build queues: using the corresponding drop down list you can add to the build queues> the number of ships of the selected category or turrets that you chose in the texfield.
+
Flushingbuild queues: using this option you can remove all elements from the build queues
+
+ The buttons at the bottom of the quick builder perfom the defined planet operation on all selected planets.
+
+
+ In order to perform actions on some specific elements in the build queue you first of all have to select them. To do so you have to check the checkboxes present in front the build queueitems you want to change in the controlled planets list.
+
+ The operation to perform on the selected items may be chosen with radio buttons in the corresponding section of the quick builder. Clicking any element on the same line as a radio button selects it. The different possible operations are:
+
Delete: to remove the selected items from the build queues
+
Move: using the relevant drop down list you can either movedown or up in the queue the items you have selected
+
Replace: using the relevant drop down list you can replace the selected items with the number of ships of the chosen category or turrets that you have put in the textfield
+
+ The buttonsbuttons at the bottom of the quick builder perfom the defined planet operation on all selected items.
+
+
+ The two buttons at the bottom of the quick builder section both perfom the defined actions. The only difference is that the left one (Execute action) leaves the quick builder displayed whereas the right one (Execute and hide) switch also the diplay to list only mode.
+
+
+
diff --git a/manual/beta5/en/preferences.lwdoc b/manual/beta5/en/preferences.lwdoc
new file mode 100644
index 0000000..30d7532
--- /dev/null
+++ b/manual/beta5/en/preferences.lwdoc
@@ -0,0 +1,160 @@
+
+
+ beta5
+ en
+ Preferences
+
+ Various elements in Legacy Worlds can be customised. Some preferences are specific to one account and others are in game features that are defined on a per game basis.
+
+
+ The account preferences page is available through the Preferences link displayed at the bottom of game selection page you reach when logging in. The account preferences page allows for customisation of the various generic elements presented in the table below.
+
+
+
Element
+
Description
+
Possible values
+
+
+
E-Mail Address
+
E-Mail Address of the player - used to send account activation data and game related messages
+
Any valid E-Mail address, as long as it hasn't already been used to create another account
+
+
+
Colour Scheme
+
The colour of the theme to use in game
+
+
Red
+
Green
+
Blue
+
Grey
+
Purple
+
Yellow
+
+
+
+
Language
+
Language in which the game interface and internal messages are displayed
+
+
English
+
French
+
+
+
+
Font Size
+
The font size to use in game
+
+
Tiny
+
Small
+
Normal
+
Big
+
Huge
+
+
+
+ Some forum specific preferences can also be set up as presented in the table below.
+
+
+
Element
+
Description
+
Possible values
+
+
+
Topics/page
+
Number of Forum Topics to display on each page
+
+
10
+
20
+
30
+
40
+
50
+
+
+
+
Graphical smileys
+
This option allows to display or not graphical smileys in forums
+
+
Disabled
+
Enabled
+
+
+
+
Diplay Mode
+
This option allows to switch between threaded and linear vues of a forum topic
+
+
Linear
+
Threaded
+
+
+
+
Messages/page
+
Number of messages in a topic to display on each page
+
+
10
+
20
+
30
+
40
+
50
+
+
+
+
Forum tags
+
This option allows you to define if you want forum tags to be decoded into text modifiers or not
+
+
Disabled
+
Enabled
+
+
+
+
Messaged order
+
Order in which to display the messages according to time
+
+
Oldest First
+
Newest First
+
+
+
+
Signature
+
Message to display at the bottom of the messages you post
+
Any valid chain of characters
+
+
+ The form at the bottom of the page allows you to change your password for your account.
+
+
+
+ Those preferences are specific to the the current game and are accessible only for inside a game. They influence in game elements only. For Beta 5, the form includes the same elemnts as for the account preferences along with a few more items which are presented in the table below:
+
+
+
Element
+
Description
+
Possible values
+
+
+
Tooltips
+
Time period during which tooltips have to be displayed
+
+
Disabled
+
0.5 second
+
1 second
+
1.5 second
+
2 second
+
2.5 second
+
3 second
+
+
+
+
Theme
+
The theme to use for the menu bar
+
+
LegacyWorlds Beta 5
+
Beta 5 Reversed
+
LegacyWorlds Classic
+
+
+
+
+
+ The bottom part of the in game preferences page provides you with a form to leave the given game. Clicking on the Leave LegacyWorlds Beta 5 button will start a 24h count down. If you don't click the DO NOT leave LegacyWorlds Beta 5 button within this 24h delay, your game data will be deleted. But note that this won't delete your account. The account still exists but isn't playing that particular game anymore.
+
+
+
diff --git a/manual/beta5/en/probes.lwdoc b/manual/beta5/en/probes.lwdoc
new file mode 100644
index 0000000..26713e1
--- /dev/null
+++ b/manual/beta5/en/probes.lwdoc
@@ -0,0 +1,20 @@
+
+
+ beta5
+ en
+ Probes and Beacons Page
+
+ Some technologies in game provide you with the ability to build other spatial objects than just ships:
+
Beacons: those are some kind of satellites that can be placed around a planet. The basic model is placed in hyperspace and provides some kind of anchor or fixed reference point for ships located in hyperspace around the planet, thus limiting ships losses. More advanced models, with scanning abilities and such will be available in further versions of the game.
+
Probes: those small unmanned vessels can be sent to other planets to scan for the fleets and other defenses, along with planetary improvements. Those will be available in further versions of the game.
+
+
+
+ This page presents a list of all the planets you own along with some beacon related information. For each planet, it includes
+
Planet name: the name of the planet is a link to the planet's individual page
+
Coordinates: the coordinates of the planet on the map
+
Beacon information: it's either No beacon if there is no beacon around the planet, or the type of beacon
+
Beacon upgrade information: if you have the required technology to install or upgrade a beacon, a button is available, to install or upgrade the beacon, at a cost. If not, an information message states there is no upgrade available.
+
+
+
diff --git a/manual/beta5/en/rankings.lwdoc b/manual/beta5/en/rankings.lwdoc
new file mode 100644
index 0000000..5d2f850
--- /dev/null
+++ b/manual/beta5/en/rankings.lwdoc
@@ -0,0 +1,105 @@
+
+
+ beta5
+ en
+ Rankings
+
+ Rankings are a way to keep track of the various players' progress in the game and to compare their strength. There are different kinds of rankings which are presented in the various sections of the Rankings page.
+
+ On top of the Rankings page various links allow you to navigate beween the different rankings pages:
+
Summary: this page provides you wil a general overview of your own rankings
+
General Rankings: this page presents a list of all players for the general ranking
+
Detailed Rankings: this page offers a list of all players for the various rankings composing the general ranking
+
Alliance Rankings: this page offers a view of all alliances and their ranking
+
Overall Round Rankings: this page presents a list of all players for the overall round ranking
+
Inflicted Damage Rankings: this page presents a list of all players for the inflicted damage ranking
+
+
+
+ This page provides you wil a general overview of your own rankings. For each ranking your rank and the corresponding amount of points are provided. It includes:
+
General ranking: this ranking corresponds to a combination of your civilisation, military and financial rankings. It represents your current advancement in the game.
+
Overall Round Ranking: this ranking is calculated based on your previous general rankings. It allows for a long term estimate of your strength and advancement.
+
Civilization Ranking: this ranking represents the advancement level of the society in your empire. It takes into account technology level, population and happiness.
+
Military Ranking: this ranking allows to assess the military strength of your empire. Its calculation is based on the number of turrets and military factories you own along with your fleet fire power.
+
Financial Ranking: this ranking correspond to the economic health of your empire. It takes into account your banked cash, your empire's income and the number of industrial factories you own.
+
+
+
+ This page provides you with the general rankings for all players. General rankings consists of a combination of civilisation, military and financial rankings, thus providing a current image of each player's strength and advancement in the game.
+
+ The top part of the page includes some navigation facilities:
+
Number of players per page: the left drop down list allows you to choose how many players you want displayed on each page.
+
Page to display: when relevant, a drop down list which allows you to switch between pages is displayed.
+
Search feature: when filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in, wherever it may be in the whole player name.
+
+
+ The bottom part of the page consists of the listing itself, containing:
+
+
Player Name: name of the corresponding player
+
Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
+ In this list your own name is displayed in bold. Clicking on the columns titles allows for sorting according to the corresponding field. Clicking again on the same title switches between ascending and descending sorts.
+
+
+ This page provides you with the detailed rankings for all players. Detailed rankings consists of civilisation, military and financial rankings, thus providing a current detailed image of each player's strength and advancement in each field.
+
+ The top part of the page includes some navigation facilities:
+
Number of players per page: the left drop down list allows you to choose how many players you want displayed on each page.
+
Page to display: when relevant, a drop down list which allows you to switch between pages is displayed.
+
Search feature: when filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in, wherever it may be in the whole player name.
+
+
+ The bottom part of the page consists of the listing itself, containing:
+
+
Player Name: name of the corresponding player
+
Civilisation Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
Military Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
Financial Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
+ In this list your own name is displayed in bold. Clicking on the columns titles allows for sorting according to the corresponding field. Clicking again on the same title switches between ascending and descending sorts.
+
+
+ This page provides you with the rankings for all alliances. Alliance rankings provide a current image of each alliance's strength and advancement in the game.
+
+ The top part of the page includes some navigation facilities:
+
+
Number of alliances per page: the left drop down list allows you to choose how many alliances you want displayed on each page.
+
Page to display: when relevant, a drop down list which allows you to switch between pages is displayed.
+
Search feature: when filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in, wherever it may be in the whole alliance tag.
+
+
+ The bottom part of the page consists of the listing itself, containing:
+
Alliance Name: name of the corresponding alliance
+
Rankings/Points: rank in the rankings for the alliance along with the corresponding amont of points
+
+
+
+ This page provides you with the overall round rankings for all players. Overall round rankings are calculated based on previous general rankings for each player. It allows for a long term estimate of strength and advancement in the game.
+
+ The top part of the page includes some navigation facilities:
+
Number of players per page: the left drop down list allows you to choose how many players you want displayed on each page.
+
Page to display: when relevant, a drop down list which allows you to switch between pages is displayed.
+
Search feature: when filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in, wherever it may be in the whole player name.
+
+
+ The bottom part of the page consists of the listing itself, containing:
+
Player Name: name of the corresponding player
+
Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
+ In this list your own name is displayed in bold. Clicking on the columns titles allows for sorting according to the corresponding field. Clicking again on the same title switches between ascending and descending sorts.
+
+
+ This page provides you with the inflicted damage ranking for all players. Inflicted Damage Rankings are based on fleet power destroyed by the player's fleets.
+
+ The top part of the page includes some navigation facilities:
+
Number of players per page: the left drop down list allows you to choose how many players you want displayed on each page.
+
Page to display: when relevant, a drop down list which allows you to switch between pages is displayed.
+
Search feature: when filling in the search textfield the listing will be automatically limited to the items containing the string you've typed in, wherever it may be in the whole player name.
+
+ The bottom part of the page consists of the listing itself, containing:
+
Player Name: name of the corresponding player
+
Rankings/Points: rank in the rankings for the player along with the corresponding amont of points
+
+ In this list your own name is displayed in bold. Clicking on the columns titles allows for sorting according to the corresponding field. Clicking again on the same title switches between ascending and descending sorts.
+
+
diff --git a/manual/beta5/en/ships.lwdoc b/manual/beta5/en/ships.lwdoc
new file mode 100644
index 0000000..f53c609
--- /dev/null
+++ b/manual/beta5/en/ships.lwdoc
@@ -0,0 +1,192 @@
+
+
+ beta5
+ en
+ Ships
+
+ Fleets are composed of ships. It sounds only natural to start with ships. This section of the manual will present the different ships categories and caracteristics and how to build ships.
+
+
+
+ In LegacyWorlds, several categories of ships and military devices are available:
+
Turrets
+
GA ship
+
Fighter
+
Cruiser
+
Battle cruiser
+
+ Each category of ships has particularities and special abilities which makes it unique and more efficient for one purpose or another. The rest of this manual section will present those ships categories and ships carateristics.
+
+
+ There different categories of ships are listed in the table below.
+
+
+
Name
+
Description
+
Class
+
Initial Power
+
Haul Size
+
Room used
+
Initial Speed
+
Upkeep
+
Build Price
+
+
+
Turret
+
Stationary Defense
+
N/A
+
10
+
N/A
+
N/A
+
N/A
+
20
+
400
+
+
+
GA ship
+
Simple transport vessel for ground troups
+
System Ship
+
5
+
N/A
+
3
+
1
+
40
+
750
+
+
+
Fighter
+
Small attack ship
+
System Ship
+
10
+
N/A
+
1
+
1
+
50
+
500
+
+
+
Cruiser
+
Long range attack and transport vessel
+
Capital Ship
+
40
+
20
+
N/A
+
1
+
500
+
5000
+
+
+
Battle Cruiser
+
Heavy long range attack and transport vessel
+
Capital Ship
+
80
+
15
+
N/A
+
2
+
1500
+
15000
+
+
+
+
+ There are three major categories of military devices in LegacyWorlds. The class of a military device defines its travel abilities. Thoses classes are described in the list below:
+
Turrets: turrets are stationary defenses. As such they can't go anywhere. Isn't it logical?
+
System ships: system ships can only fly inside a star system. They have to be transported in the hauls of capital ships in order to travel in hyperspace
+
Capital ships: capital ships are hyperspace capable. This means they can move between several stellar systems. They can also transport system ships in their hauls
+
+
+
+
+ The power of a ship represents both its firepower and the amount of damage it can sustain. The figures provided are initial figures for basic ships models. Those basic design can be upgraded due to technological advances. The next parapgraphs will list technologies influencing firepower and resistance to damage.
+
+
+
+ The influence technologies have on firepower depend on ship classes. Some technologies have an effect on all classes and other on only one class.
+
+
+ The following technologiesincrease the firepower of all classes of ships:
+
Cybernetic Interfaces
+
Matter Anti-matter Missiles
+
+ This one decreases it:
+
Civilian Transportation Act
+
+
+
+ These technologiesincrease the firepower of turrets and turrets only:
+
Automated Turrets
+
Biological Turrets
+
Sensor Turrets
+
+
+
+ These technologiesincrease the firepower of ships of the Capital Ships class:
+
Biological Hyperspace Engines
+
Biological Propulsion Systems
+
+
+
+
+ This other set of technologiesincreases ships' and turrets' resistance to damage:
+
Adaptive Materials
+
Adaptive Plating
+
Advanced Materials
+
Force fields
+
Hardened Alloys
+
Intelligent Materials
+
Medical Bays
+
Resurrection tanks
+
Self-healing Materials
+
+
+
+
+ System ships have to be transported into the haul of capital ships in order to travel in hyperspace.
+
+ Each type of system ship has a different size. As such the number of haul spaces they use in capital ships differ.
+
+ Each type of capital ship has a different haul size. As such the number of system ships they can carry varies.
+
+ In order to help you to build hyperspace capable fleets, the fleet page and the fleets splitting tool display the percentage of fleet haul that is used.
+
+
+ The speed of a ship is represented by the maximum distance it can travel in one hour tick time. For most ships this distance is 1 (a ship can travel a whole stellar system in one hour).
+
+ The speed of capital ships can be increased through technological advances. Each technology in the list increases the speed of capital ships by 1:
+
Matter Anti-matter Engines
+
Space-time folding
+
+
+
+ The upkeep of a ship is the amount of money you have to pay each day to maintain the ship. The Fleet Upkeep Expenses section of the Money manual page covers this topic more thoroughly.
+
+
+ The build price of a ship class is the price you have to pay to build one ship of the category. See the next section of this manual page to learn more about ship building.
+
+
+ GA ships, as troups transport ships, are the only ships that can take control of a planet. Each GA ship transports the troups capable to control a certain amount of population. The bigger the population, the more GA ships are required to take control of the planet.
+
+ At the beginning of the game, the GA ships you can build are able to control 200 population units. This figure can be increased through technology. Each technology in the following list increases the population size a single GA ship can control by 75:
+
Exoskeleton
+
Nanofiber Armor
+
Self-repairing Exoskeleton
+
+
+
+
+
+ In order to build ships you have to possess the required technology:
+
The Fighter technology allows you to build fighters
+
The Cruiser technology allows you to build cruisers
+
The Battle Cruiser technology allows you to build battle cruisers
+
+
+
+ Ships are built in military factories. Both those factories and ships can be built on each planet separately or by the means of the quick builder facility. In order to know more about those topics, have a look at the following manual sections:
+
Military Factories section of the empire manual page
+
Building warefare section of the individual planet page manual page
+
Quickbuilder section of the planets overview manual page
+
+
+
+
diff --git a/manual/beta5/en/tech_1.lwdoc b/manual/beta5/en/tech_1.lwdoc
new file mode 100644
index 0000000..5f3ca03
--- /dev/null
+++ b/manual/beta5/en/tech_1.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Fighters
+
+ Sir! We have successfully researched a new type of ship, the Fighter! These ships are faster and more efficient at combating enemy ships than our current Ground Assault ships.
+
+
+
+
Category: Military technology
+
Optional: No
+
Cost: €50,000
+
Effects:
+
Provides the ability to build ships of the Fighter class
+
+
+
+
+ Required by:
+
Martial law
+
Cruisers
+
+
+
diff --git a/manual/beta5/en/tech_10.lwdoc b/manual/beta5/en/tech_10.lwdoc
new file mode 100644
index 0000000..bec4375
--- /dev/null
+++ b/manual/beta5/en/tech_10.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Advanced Hospitals
+
+ Sir! We have successfully researched a new public service! We hope that these "Advanced Hospitals" will improve the health of our subjects so that they are less likely to bite the dust at an unprofitable moment.
+
+
+
+
Category: Civilian technology
+
Optional: No
+
Cost: €50,000
+
Effects:
+
Increases population growth
+
+
+
+
+ Depends on:
+
Bio-engineering
+
+ Required by:
+
Cloning Techniques
+
Nourishment Purification
+
Surgical Robots
+
+
+
diff --git a/manual/beta5/en/tech_11.lwdoc b/manual/beta5/en/tech_11.lwdoc
new file mode 100644
index 0000000..6c12121
--- /dev/null
+++ b/manual/beta5/en/tech_11.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ High-efficiency Hydroponics
+
+ Recent progress in bio-engineering has allowed for new farming techniques, that are safer for the planet and allow for further studies in green technologies.
+
+
+
+
Category: Fundamental research
+
Optional: No
+
Cost: €50,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Bio-engineering
+
+ Required by:
+
Safe Recreational Drugs
+
Nourishment Purification
+
Green Production
+
+
+
diff --git a/manual/beta5/en/tech_12.lwdoc b/manual/beta5/en/tech_12.lwdoc
new file mode 100644
index 0000000..144f281
--- /dev/null
+++ b/manual/beta5/en/tech_12.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Safe Recreational Drugs
+
+ Recent progress in the field of farming has allowed our scientists to develop safe recreational drugs such as the so-called "Space weed". This will improve commerce and make the population happier, since these drugs can be used instead of traditional anaesthetics in our hospitals.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €80,000
+
Effects:
+
Increases happiness
+
+
+
+
+ Depends on:
+
High-efficiency Hydroponics
+
+ Required by:
+
Legalize Space Weed
+
+
+
diff --git a/manual/beta5/en/tech_13.lwdoc b/manual/beta5/en/tech_13.lwdoc
new file mode 100644
index 0000000..2a47ee7
--- /dev/null
+++ b/manual/beta5/en/tech_13.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Legalize Space Weed
+
+ Yeah, maaan ... I mean, Sir ... Enacting this law will allow every citizen in our empire to smoke Space Weed as they see fit, without any harmful effect for their health. I mean... huh, What was I saying again? ... Ah, yes! Well, they might be a bit inefficient, because they'll still be stoned, but they'll be happy!
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €15,000
+
Effects:
+
Increases happiness
+
Decreases Industrial Factories productivity
+
Decreases Military Factories productivity
+
+
+
+
+ Depends on:
+
Safe Recreational Drugs
+
+
+
diff --git a/manual/beta5/en/tech_14.lwdoc b/manual/beta5/en/tech_14.lwdoc
new file mode 100644
index 0000000..7ec7aa7
--- /dev/null
+++ b/manual/beta5/en/tech_14.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Cloning Techniques
+
+ Sir! Their stem cells analysis have finally brought our scientists a new breakthrough. Our researchers have succeeded in cloning various lifeforms.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €100,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Advanced Hospitals
+
+ Required by:
+
Lifeform Engineering
+
Cloning Vats
+
+
+
diff --git a/manual/beta5/en/tech_15.lwdoc b/manual/beta5/en/tech_15.lwdoc
new file mode 100644
index 0000000..b169c37
--- /dev/null
+++ b/manual/beta5/en/tech_15.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Nano-scale Computers
+
+ Sir, their recent progresses in nanotechnologies has allowed our scientists to create a new generation of computers. This new miniaturised computer allows us to improve research efficiency and opens a brand new field of research.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €100,000
+
Effects:
+
Increases research output
+
+
+
+
+ Depends on:
+
Room Temperature Superconductors
+
Nanotechnologies
+
+ Required by:
+
Quantum Computers
+
Hyperspace Theory
+
Cybernetic Interfaces
+
+
+
diff --git a/manual/beta5/en/tech_16.lwdoc b/manual/beta5/en/tech_16.lwdoc
new file mode 100644
index 0000000..ef20646
--- /dev/null
+++ b/manual/beta5/en/tech_16.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Quantum Gravitation
+
+ These advances in the field of quantum theory will open a new area for further studies.
+
+
+
+
Category: Fundamental research
+
Optional: No
+
Cost: €100,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Hyperspace Basics
+
+ Required by:
+
Miniaturised Particle Colliders
+
Quantum Computers
+
Hyperspace Theory
+
Experimental Anti-Matter Production
+
+
+
diff --git a/manual/beta5/en/tech_17.lwdoc b/manual/beta5/en/tech_17.lwdoc
new file mode 100644
index 0000000..d3e742e
--- /dev/null
+++ b/manual/beta5/en/tech_17.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Miniaturised Particle Colliders
+
+ These new and small particle colliders increase research in many areas, increasing lab outputs.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €100,000
+
Effects:
+
Increases research output
+
+
+
+
+ Depends on:
+
Advanced Materials
+
Quantum Gravitation
+
+ Required by:
+
Increased Research Grants
+
Science Golden Age
+
+
+
diff --git a/manual/beta5/en/tech_18.lwdoc b/manual/beta5/en/tech_18.lwdoc
new file mode 100644
index 0000000..ee47474
--- /dev/null
+++ b/manual/beta5/en/tech_18.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Advanced Communications
+
+ Having achieved major breakthroughs in electronic research, our scientists are now able to apply this research to the communications field, where some interesting developments are expected.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €150,000
+
Effects:
+
Increases happiness
+
+
+
+
+ Depends on:
+
Room Temperature Superconductors
+
+ Required by:
+
Economy Globalisation
+
Wide Band Jamming
+
Fast Burst Transmission
+
+
+
diff --git a/manual/beta5/en/tech_2.lwdoc b/manual/beta5/en/tech_2.lwdoc
new file mode 100644
index 0000000..e9328d8
--- /dev/null
+++ b/manual/beta5/en/tech_2.lwdoc
@@ -0,0 +1,24 @@
+
+
+ beta5
+ en
+ Hyperspace Basics
+
+ Sir! Our scientists have made major progress in understanding the basics behind Hyperspace theory. Those basic hyperspace capabilities are the very beginning of a new area in space flight and allow a wide range of new experiments.
+
+
+
+
Category: Fundamental research
+
Optional: No
+
Cost: €15,000
+
Effects: N/A
+
+
+
+ Required by:
+
Cruisers
+
Quantum Gravitation
+
Hyperspace Beacon
+
+
+
diff --git a/manual/beta5/en/tech_20.lwdoc b/manual/beta5/en/tech_20.lwdoc
new file mode 100644
index 0000000..3ddac39
--- /dev/null
+++ b/manual/beta5/en/tech_20.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Quantum Computers
+
+ Based on the new discoveries in the quantum theory field, these new computers are much more efficient and faster. Equipping our labs will be expensive but the advantages of the increased research speed should be incredible.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €500,000
+
Effects:
+
Increases research output
+
+
+
+
+ Depends on:
+
Nano-scale Computers
+
Quantum Gravitation
+
+ Required by:
+
Economy Globalisation
+
Biological Computers
+
Quantum Encryption
+
+
+
diff --git a/manual/beta5/en/tech_21.lwdoc b/manual/beta5/en/tech_21.lwdoc
new file mode 100644
index 0000000..62c560c
--- /dev/null
+++ b/manual/beta5/en/tech_21.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Economy Globalisation
+
+ Recent advances in both communications and computer capacities have allowed us to set up an empire wide economic system that should increase our planets base income.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €1,000,000
+
Effects:
+
Increases planetary base income
+
+
+
+
+ Depends on:
+
Advanced Communications
+
Quantum Computers
+
+ Required by:
+
Wild Capitalism
+
+
+
diff --git a/manual/beta5/en/tech_22.lwdoc b/manual/beta5/en/tech_22.lwdoc
new file mode 100644
index 0000000..e94c082
--- /dev/null
+++ b/manual/beta5/en/tech_22.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Hyperspace Theory
+
+ Our scientists have developed and tested a complete advanced theory regarding the structure of Hyperspace! We need to upgrade their labs for them to continue researches in this field.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €500,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Nano-scale Computers
+
Quantum Gravitation
+
+ Required by:
+
Temporal Mechanics
+
Entropy Generator
+
Force fields
+
Hyperspace Probing Beacons
+
+
+
diff --git a/manual/beta5/en/tech_23.lwdoc b/manual/beta5/en/tech_23.lwdoc
new file mode 100644
index 0000000..f10964d
--- /dev/null
+++ b/manual/beta5/en/tech_23.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Increased Research Grants
+
+ This law allows to divert a higher percentage of income towards research thus allowing faster discoveries but reducing income.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €30,000
+
Effects:
+
Increases research output
+
Decreases Industrial Factories productivity
+
Decreases planetary base income
+
+
+
+
+ Depends on:
+
Miniaturised Particle Colliders
+
+
+
diff --git a/manual/beta5/en/tech_24.lwdoc b/manual/beta5/en/tech_24.lwdoc
new file mode 100644
index 0000000..294a191
--- /dev/null
+++ b/manual/beta5/en/tech_24.lwdoc
@@ -0,0 +1,32 @@
+
+
+ beta5
+ en
+ Hardened Alloys
+
+ These new improved alloys are more resistant and will allow for less losses in battle as well as future advances in industry research.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €100,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases planetary base income
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Nanotechnologies
+
+ Required by:
+
Experimental Anti-Matter Production
+
Arcologies
+
Robotics
+
Adaptive Materials
+
+
+
diff --git a/manual/beta5/en/tech_25.lwdoc b/manual/beta5/en/tech_25.lwdoc
new file mode 100644
index 0000000..bd9505c
--- /dev/null
+++ b/manual/beta5/en/tech_25.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Experimental Anti-Matter Production
+
+ Recent advances in new alloy production and a better knowledge of quantum theory have allowed our scientists to produce anti-matter for the first time. Research should be continued in this area since the applications could be tremendous.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €500,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Quantum Gravitation
+
Hardened Alloys
+
+ Required by:
+
Mass Anti-matter Production
+
+
+
diff --git a/manual/beta5/en/tech_26.lwdoc b/manual/beta5/en/tech_26.lwdoc
new file mode 100644
index 0000000..8356917
--- /dev/null
+++ b/manual/beta5/en/tech_26.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Nanofiber Armor
+
+ Sir! Applying nanotechnologies to the military field our scientists have managed to produce nano-fiber armors for our ground troups. Since our soldiers will be better protected against rioters we'll need to send less of them on the ground to take control of a planet.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €100,000
+
Effects:
+
Increases G.A. ship efficiency
+
+
+
+
+ Depends on:
+
Nanotechnologies
+
+ Required by:
+
Exoskeleton
+
+
+
diff --git a/manual/beta5/en/tech_27.lwdoc b/manual/beta5/en/tech_27.lwdoc
new file mode 100644
index 0000000..54ec839
--- /dev/null
+++ b/manual/beta5/en/tech_27.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Lifeform Engineering
+
+ Our scientists have devised a method to design lifeforms from scratch! Although this breakthrough has no direct application, further research should be funded, the potential gains are tremendous!
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €500,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Nanotechnologies
+
Cloning Techniques
+
+ Required by:
+
Sentient Lifeform Engineering
+
Self-healing Materials
+
Lifeform Energy Manipulation
+
+
+
diff --git a/manual/beta5/en/tech_28.lwdoc b/manual/beta5/en/tech_28.lwdoc
new file mode 100644
index 0000000..d614f9c
--- /dev/null
+++ b/manual/beta5/en/tech_28.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Sentient Lifeform Engineering
+
+ Sir! Our biologists have finally managed to create intelligent lifeforms from scratch, thus opening a brand new field of studies.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €800,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Lifeform Engineering
+
+ Required by:
+
Biological Computers
+
Biological Drones
+
+
+
diff --git a/manual/beta5/en/tech_29.lwdoc b/manual/beta5/en/tech_29.lwdoc
new file mode 100644
index 0000000..c861220
--- /dev/null
+++ b/manual/beta5/en/tech_29.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Cloning Vats
+
+ Our scientists have perfected their cloning techniques, allowing them to grow real clones in vats. Our industrial production could be greatly improved using this technology!
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €200,000
+
Effects:
+
Increases Industrial Factories production
+
+
+
+
+ Depends on:
+
Cloning Techniques
+
+ Required by:
+
Corpse Reanimation
+
Forced Human Cloning
+
+
+
diff --git a/manual/beta5/en/tech_3.lwdoc b/manual/beta5/en/tech_3.lwdoc
new file mode 100644
index 0000000..71eb91b
--- /dev/null
+++ b/manual/beta5/en/tech_3.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Advanced Materials
+
+ Sir! Our scientists just discovered new production methods that will allow us to create hardened materials! Our factories must be upgraded in order to start producing those new alloys.
+
+
+
+
Category: Civilian technology
+
Optional: No
+
Cost: €20,000
+
Effects:
+
Reduces battle losses
+
+
+
+
+ Required by:
+
Room Temperature Superconductors
+
Nanotechnologies
+
Miniaturised Particle Colliders
+
+
+
diff --git a/manual/beta5/en/tech_30.lwdoc b/manual/beta5/en/tech_30.lwdoc
new file mode 100644
index 0000000..1fb6552
--- /dev/null
+++ b/manual/beta5/en/tech_30.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Nourishment Purification
+
+ Sir! We have successfully researched a new way to improve food, Nourishment purification! This process will give our subjects a healthier lifespan by removing all the nasties in their food.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases population growth
+
+
+
+
+ Depends on:
+
Advanced Hospitals
+
High-efficiency Hydroponics
+
+ Required by:
+
Corpse Reanimation
+
+
+
diff --git a/manual/beta5/en/tech_31.lwdoc b/manual/beta5/en/tech_31.lwdoc
new file mode 100644
index 0000000..3cdd74e
--- /dev/null
+++ b/manual/beta5/en/tech_31.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Green Production
+
+ These new production methods are safer for planetary ecology, making the population happier but slightly reducing factory productivity.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €400,000
+
Effects:
+
Increases happiness
+
Decreases Industrial Factories productivity
+
Decreases Military Factories productivity
+
+
+
+
+ Depends on:
+
High-efficiency Hydroponics
+
+ Required by:
+
Biosphere Protection Pact
+
Arcologies
+
+
+
diff --git a/manual/beta5/en/tech_32.lwdoc b/manual/beta5/en/tech_32.lwdoc
new file mode 100644
index 0000000..60f36c5
--- /dev/null
+++ b/manual/beta5/en/tech_32.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Biosphere Protection Pact
+
+ Enforcing this law forces the industrial sector to use greener production methods that make the population happier but reduce productivity.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €60,000
+
Effects:
+
Increases happiness
+
Decreases Industrial Factories productivity
+
Decreases Military Factories productivity
+
+
+
+
+ Depends on:
+
Green Production
+
+
+
diff --git a/manual/beta5/en/tech_33.lwdoc b/manual/beta5/en/tech_33.lwdoc
new file mode 100644
index 0000000..4213776
--- /dev/null
+++ b/manual/beta5/en/tech_33.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Corpse Reanimation
+
+ Sir! Our scientists have established a new technology, Corpse Reanimation! This technology will mean about 60% of our subjects will be able to be brought back to life after death through the use of modified cloning vats. This should lead to a decrease in total death and an increase in workers for our factories.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases population growth
+
+
+
+
+ Depends on:
+
Cloning Vats
+
Nourishment Purification
+
+ Required by:
+
Resurrection tanks
+
+
+
diff --git a/manual/beta5/en/tech_34.lwdoc b/manual/beta5/en/tech_34.lwdoc
new file mode 100644
index 0000000..ee2a400
--- /dev/null
+++ b/manual/beta5/en/tech_34.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Forced Human Cloning
+
+ Sir! We could enact a law that would allow our government to clone citizens and boost our population growth! Our people wouldn't be too happy about it though...
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €80,000
+
Effects:
+
Decreases happiness
+
Increases population growth
+
+
+
+
+ Depends on:
+
Cloning Vats
+
+
+
diff --git a/manual/beta5/en/tech_35.lwdoc b/manual/beta5/en/tech_35.lwdoc
new file mode 100644
index 0000000..5b87243
--- /dev/null
+++ b/manual/beta5/en/tech_35.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Arcologies
+
+ Sir! We are now able to build arcologies, which will allow us to house loads more citizens on our empire's planets!
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €800,000
+
Effects:
+
Increases planet maximum population
+
+
+
+
+ Depends on:
+
Hardened Alloys
+
Green Production
+
+ Required by:
+
Singularity Housing
+
+
+
diff --git a/manual/beta5/en/tech_36.lwdoc b/manual/beta5/en/tech_36.lwdoc
new file mode 100644
index 0000000..8737e60
--- /dev/null
+++ b/manual/beta5/en/tech_36.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Robotics
+
+ Recent advances in electronics and new materials have allowed our engineers to design autonomous robots that will help our workers and improve the production of our factories.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €600,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
+
+
+
+ Depends on:
+
Room Temperature Superconductors
+
Hardened Alloys
+
+ Required by:
+
Surgical Robots
+
Biological Drones
+
Automated Turrets
+
+
+
diff --git a/manual/beta5/en/tech_37.lwdoc b/manual/beta5/en/tech_37.lwdoc
new file mode 100644
index 0000000..27d21a9
--- /dev/null
+++ b/manual/beta5/en/tech_37.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Adaptive Materials
+
+ New developments in research have allowed our scientists to create materials that adapt to the needs of our civilians, thus providing even more resistant alloys.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €300,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Hardened Alloys
+
+ Required by:
+
Self-healing Materials
+
Force fields
+
Battle Cruisers
+
+
+
diff --git a/manual/beta5/en/tech_38.lwdoc b/manual/beta5/en/tech_38.lwdoc
new file mode 100644
index 0000000..bf120d6
--- /dev/null
+++ b/manual/beta5/en/tech_38.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Cybernetic Interfaces
+
+ Sir! Our scientists have found a way to interface the human brain with a machine. This new technology allows a direct interface between electronic and biological systems, making our ships more reactive to their pilots' commands.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €500,000
+
Effects:
+
Increases fleet power
+
+
+
+
+ Depends on:
+
Bio-engineering
+
Nano-scale Computers
+
+ Required by:
+
Exoskeleton
+
Biological Propulsion Systems
+
+
+
diff --git a/manual/beta5/en/tech_39.lwdoc b/manual/beta5/en/tech_39.lwdoc
new file mode 100644
index 0000000..0b592d9
--- /dev/null
+++ b/manual/beta5/en/tech_39.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Exoskeleton
+
+ Sir! Our scientists have managed to improve even further the equipment of our ground troups. With those new exoskeletons we will require to send even less GA ships to get the inhabitants of another planet to share our views..
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €700,000
+
Effects:
+
Increases G.A. ship efficiency
+
+
+
+
+ Depends on:
+
Nanofiber Armor
+
Cybernetic Interfaces
+
+ Required by:
+
Self-repairing Exoskeleton
+
+
+
diff --git a/manual/beta5/en/tech_4.lwdoc b/manual/beta5/en/tech_4.lwdoc
new file mode 100644
index 0000000..1769c4e
--- /dev/null
+++ b/manual/beta5/en/tech_4.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Bio-engineering
+
+ Sir! Our scientists worked hard to improve our empire's knowledge of bio-engineering, which will greatly improve the production of basic goods, as well as pave the way for further advances.
+
+
+
+
Category: Civilian technology
+
Optional: No
+
Cost: €30,000
+
Effects:
+
Increases Industrial Factories productivity
+
+
+
+
+ Required by:
+
Advanced Hospitals
+
High-efficiency Hydroponics
+
Cybernetic Interfaces
+
+
+
diff --git a/manual/beta5/en/tech_40.lwdoc b/manual/beta5/en/tech_40.lwdoc
new file mode 100644
index 0000000..bfbf6d6
--- /dev/null
+++ b/manual/beta5/en/tech_40.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Temporal Mechanics
+
+ The progress of our scientists has enabled us to better understand temporal phenomenons, which should allow for a wide range of new discoveries. Further funding of this area of study is a necessity.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €1,000,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Hyperspace Theory
+
+ Required by:
+
Space-time folding
+
Phase Neutraliser
+
Multiphasic Transmission
+
+
+
diff --git a/manual/beta5/en/tech_41.lwdoc b/manual/beta5/en/tech_41.lwdoc
new file mode 100644
index 0000000..0161a40
--- /dev/null
+++ b/manual/beta5/en/tech_41.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Space-time folding
+
+ Sir! Our scientists have pushed the limit of Hyperspace theory! This will allow us to design better, faster ship engines and further advances are to be expected! However, upgrading our fleets as well as our laboratories might be a bit expensive...
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €2,000,000
+
Effects:
+
Increases capital ships speed
+
+
+
+
+ Depends on:
+
Temporal Mechanics
+
+ Required by:
+
Battle Cruisers
+
Wormhole Theory
+
Singularity Housing
+
Biological Subspace Control
+
+
+
diff --git a/manual/beta5/en/tech_42.lwdoc b/manual/beta5/en/tech_42.lwdoc
new file mode 100644
index 0000000..d788e4c
--- /dev/null
+++ b/manual/beta5/en/tech_42.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Biological Computers
+
+ Our scientists have found a way to integrate intelligent lifeforms into our computers, thus improving calculation capabilities. Upgrading our computers, though expensive, should allow our current research projects to reach completion faster.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases research output
+
+
+
+
+ Depends on:
+
Quantum Computers
+
Sentient Lifeform Engineering
+
+ Required by:
+
Science Golden Age
+
Interstellar University
+
Intelligent Materials
+
+
+
diff --git a/manual/beta5/en/tech_43.lwdoc b/manual/beta5/en/tech_43.lwdoc
new file mode 100644
index 0000000..87e07b2
--- /dev/null
+++ b/manual/beta5/en/tech_43.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Science Golden Age
+
+ Enacting this law permits us to divert more resources towards research at the expense of other necessities.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €100,000
+
Effects:
+
Increases research output
+
Decreases Industrial Factories productivity
+
Decreases Military Factories productivity
+
+
+
+
+ Depends on:
+
Miniaturised Particle Colliders
+
Biological Computers
+
+
+
diff --git a/manual/beta5/en/tech_44.lwdoc b/manual/beta5/en/tech_44.lwdoc
new file mode 100644
index 0000000..ce03f38
--- /dev/null
+++ b/manual/beta5/en/tech_44.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Wide Band Jamming
+
+ This basic jamming technology allows us to try and prevent the planets we attack from transmitting data to their allies. Therefore defensive procedures can potentially be disrupted.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €500,000
+
Effects:
+
Increases jamming capabilities
+
+
+
+
+ Depends on:
+
Advanced Communications
+
+ Required by:
+
Entropy Generator
+
Civilian Communication Act
+
+
+
diff --git a/manual/beta5/en/tech_45.lwdoc b/manual/beta5/en/tech_45.lwdoc
new file mode 100644
index 0000000..773d3ca
--- /dev/null
+++ b/manual/beta5/en/tech_45.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Fast Burst Transmission
+
+ This new technology renders our stellar and interstellar communications less prone to jamming and interception.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €500,000
+
Effects:
+
Increases communications efficiency
+
+
+
+
+ Depends on:
+
Advanced Communications
+
+ Required by:
+
Hyperspace Beacon
+
Quantum Encryption
+
+
+
diff --git a/manual/beta5/en/tech_46.lwdoc b/manual/beta5/en/tech_46.lwdoc
new file mode 100644
index 0000000..818234e
--- /dev/null
+++ b/manual/beta5/en/tech_46.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Hyperspace Beacon
+
+ Placed in hyperspace around our planets this beacon provides an "anchor" for your ships and those of your alliance, thus reducing the losses in fleet stationed in hyperspace.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €1,000,000
+
Effects:
+
Provides the ability to build Hyperspace Beacons
+
+
+
+
+ Depends on:
+
Hyperspace Basics
+
Fast Burst Transmission
+
+ Required by:
+
Hyperspace Probing Beacon
+
Sensor Turrets
+
+
+
diff --git a/manual/beta5/en/tech_48.lwdoc b/manual/beta5/en/tech_48.lwdoc
new file mode 100644
index 0000000..a9408e3
--- /dev/null
+++ b/manual/beta5/en/tech_48.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Quantum Encryption
+
+ Quantum computers have allowed tremendous progress in encryption algorithms. We can now be more efficient in preventing the enemy from disrupting our communications.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases communications efficiency
+
+
+
+
+ Depends on:
+
Quantum Computers
+
Fast Burst Transmission
+
+ Required by:
+
Civilian Communication Act
+
Interstellar University
+
Multiphasic Transmission
+
+
+
diff --git a/manual/beta5/en/tech_49.lwdoc b/manual/beta5/en/tech_49.lwdoc
new file mode 100644
index 0000000..3e2e5c5
--- /dev/null
+++ b/manual/beta5/en/tech_49.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Entropy Generator
+
+ By applying hyperspace theory to telecommunications we've found a new way to disrupt enemy communications, making it even harder for them to transmit accurate data to their allies.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases jamming capabilities
+
+
+
+
+ Depends on:
+
Hyperspace Theory
+
Wide Band Jamming
+
+ Required by:
+
Phase Neutraliser
+
+
+
diff --git a/manual/beta5/en/tech_5.lwdoc b/manual/beta5/en/tech_5.lwdoc
new file mode 100644
index 0000000..1f1bb5a
--- /dev/null
+++ b/manual/beta5/en/tech_5.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Martial law
+
+ Sir! We can enact Martial Law to force our people to work in the military's best interest! They probably won't be too happy about it, and our economy might suffer, but who cares? Our military production will be greatly improved!
+
+
+
+
Category: Law
+
Optional: No
+
Cost: €5,000
+
Effects:
+
Increases Military Factories productivity
+
Decreases Industrial Factories productivity
+
Decreases happiness
+
+
+
+
+ Depends on:
+
Fighters
+
+
+
diff --git a/manual/beta5/en/tech_50.lwdoc b/manual/beta5/en/tech_50.lwdoc
new file mode 100644
index 0000000..4904881
--- /dev/null
+++ b/manual/beta5/en/tech_50.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Surgical Robots
+
+ This technology provides new advances in the medical field, allowing for further researches in this area. Further funding should bring quite interesting breakthroughs.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €800,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Advanced Hospitals
+
Robotics
+
+ Required by:
+
Medical Bays
+
+
+
diff --git a/manual/beta5/en/tech_51.lwdoc b/manual/beta5/en/tech_51.lwdoc
new file mode 100644
index 0000000..a765ae3
--- /dev/null
+++ b/manual/beta5/en/tech_51.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Medical Bays
+
+ Our engineers have modified the designs for our capital ships in order to include highly advanced medical bays, in which the pilots can be healed when they are wounded in combat. This improvement will reduce our losses, but our fleets and factories must be upgraded first.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Cruisers
+
Surgical Robots
+
+ Required by:
+
Resurrection tanks
+
+
+
diff --git a/manual/beta5/en/tech_52.lwdoc b/manual/beta5/en/tech_52.lwdoc
new file mode 100644
index 0000000..3eb76d9
--- /dev/null
+++ b/manual/beta5/en/tech_52.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Resurrection tanks
+
+ Our engineers have updated the designs for our capital ships. The medical bays will now integrate the equipment required to raise our pilots from the dead, further reducing battle losses.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €3,000,000
+
Effects:
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Corpse Reanimation
+
Medical Bays
+
+
+
diff --git a/manual/beta5/en/tech_53.lwdoc b/manual/beta5/en/tech_53.lwdoc
new file mode 100644
index 0000000..b8e5613
--- /dev/null
+++ b/manual/beta5/en/tech_53.lwdoc
@@ -0,0 +1,32 @@
+
+
+ beta5
+ en
+ Self-healing Materials
+
+ Sir! Our scientists have have found a way to grow advanced, self-healing materials. This new technology will allow us to provide regeneration and auto-repair capabilities to both our ships and factories. We will thus greatly reduce our losses in battle and gain productivity in our industrial sector.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Lifeform Engineering
+
Adaptive Materials
+
+ Required by:
+
Self-repairing Exoskeleton
+
Intelligent Materials
+
Anti-matter Generators
+
+
+
diff --git a/manual/beta5/en/tech_54.lwdoc b/manual/beta5/en/tech_54.lwdoc
new file mode 100644
index 0000000..fab0bbc
--- /dev/null
+++ b/manual/beta5/en/tech_54.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Self-repairing Exoskeleton
+
+ Sir! Incorporating the newest alloys to our soldiers exoskeletons, our scientists have set up self-repairing exoskeletons. Even more efficient against attacking crowds, this new armor generation will reduce even more the number of GA ships required to take control of a foreign planet.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €2,000,000
+
Effects:
+
Increases G.A. ship efficiency
+
+
+
+
+ Depends on:
+
Exoskeleton
+
Self-healing Materials
+
+
+
diff --git a/manual/beta5/en/tech_55.lwdoc b/manual/beta5/en/tech_55.lwdoc
new file mode 100644
index 0000000..b62bd10
--- /dev/null
+++ b/manual/beta5/en/tech_55.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Biological Drones
+
+ This technology allows industry to use specifically designed lifeforms to replace workers in the factories. These lifeforms will be much more efficient than human beings, but our citizens might not like getting sacked in favour of their new replacements.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €2,000,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
Decreases happiness
+
+
+
+
+ Depends on:
+
Sentient Lifeform Engineering
+
Robotics
+
+ Required by:
+
Ban Biological Drones
+
Automated Factories
+
+
+
diff --git a/manual/beta5/en/tech_56.lwdoc b/manual/beta5/en/tech_56.lwdoc
new file mode 100644
index 0000000..3bc838c
--- /dev/null
+++ b/manual/beta5/en/tech_56.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Ban Biological Drones
+
+ To fight the decrease in happiness caused by biological drones, we can enact a law that bans their presence in our empire. This law counters all effects of biological drones and restores factories to their previous level of productivity.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €70,000
+
Effects:
+
Decreases Industrial Factories productivity
+
Decreases Military Factories productivity
+
Increases happiness
+
+
+
+
+ Depends on:
+
Biological Drones
+
+
+
diff --git a/manual/beta5/en/tech_57.lwdoc b/manual/beta5/en/tech_57.lwdoc
new file mode 100644
index 0000000..f9ce0cc
--- /dev/null
+++ b/manual/beta5/en/tech_57.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Force fields
+
+ Our scientists have found a way to create force fields. The direct military application is the addition of shields to our current fleets, which will reduce losses.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €1,500,000
+
Effects:
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Hyperspace Theory
+
Adaptive Materials
+
+ Required by:
+
Mass Anti-matter Production
+
Singularity Housing
+
+
+
diff --git a/manual/beta5/en/tech_58.lwdoc b/manual/beta5/en/tech_58.lwdoc
new file mode 100644
index 0000000..cd93c8a
--- /dev/null
+++ b/manual/beta5/en/tech_58.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Lifeform Energy Manipulation
+
+ Sir! Our scientists have managed to engineer lifeforms capabable of manipulating energy. This new discovery lets us foresee some astonishing future breakthroughs.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €1,500,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Lifeform Engineering
+
+ Required by:
+
Biological Propulsion Systems
+
Adaptive Plating
+
Biological Subspace Control
+
+
+
diff --git a/manual/beta5/en/tech_59.lwdoc b/manual/beta5/en/tech_59.lwdoc
new file mode 100644
index 0000000..0a6c428
--- /dev/null
+++ b/manual/beta5/en/tech_59.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Civilian Communication Act
+
+ Passing this law will permit civilians access to our militaries' advanced communication networks. Civilians will be happier since they can keep in touch with friends, but this civilian use of military installations could disrupt anti-jamming and jamming systems!
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €120,000
+
Effects:
+
Increases happiness
+
Decreases jamming abilities
+
Decreases communications efficiency
+
+
+
+
+ Depends on:
+
Wide Band Jamming
+
Quantum Encryption
+
+
+
diff --git a/manual/beta5/en/tech_6.lwdoc b/manual/beta5/en/tech_6.lwdoc
new file mode 100644
index 0000000..68e1e3b
--- /dev/null
+++ b/manual/beta5/en/tech_6.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Cruisers
+
+ Sir! We have successfully researched a new type of ship, the Cruiser! These are able to travel outside of our solar system thanks to the recent developments in Hyperspace technology, and can carry our current ships in their holds.
+
+
+
+
Category: Military technology
+
Optional: No
+
Cost: €500,000
+
Effects:
+
Provides the ability to build ships of the Cruiser class
+
+
+
+
+ Depends on:
+
Fighters
+
Hyperspace Basics
+
+ Required by:
+
Civilian Transportation Act
+
Medical Bays
+
Battle Cruisers
+
Biological Propulsion Systems
+
+
+
diff --git a/manual/beta5/en/tech_60.lwdoc b/manual/beta5/en/tech_60.lwdoc
new file mode 100644
index 0000000..c3fc5f0
--- /dev/null
+++ b/manual/beta5/en/tech_60.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Hyperspace Probing Beacon
+
+ Adding probing systems to hyperspace beacons, this technology allows for early detection of enemy ships stationed in hyperspace around our planets.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €3,000,000
+
Effects:
+
Provides the ability to build Hyperspace Probing Beacons
+
+
+
+
+ Depends on:
+
Hyperspace Beacon
+
Hyperspace Theory
+
+
+
diff --git a/manual/beta5/en/tech_61.lwdoc b/manual/beta5/en/tech_61.lwdoc
new file mode 100644
index 0000000..6720640
--- /dev/null
+++ b/manual/beta5/en/tech_61.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Automated Turrets
+
+ Sir! Including robotics in our turrets will improve their accuracy and firing efficiency. With these new turrets we will be able to better defend our planets.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €500,000
+
Effects:
+
Increases turret power
+
+
+
+
+ Depends on:
+
Robotics
+
+ Required by:
+
Sensor Turrets
+
Global Defense Bill
+
Biological Turrets
+
+
+
diff --git a/manual/beta5/en/tech_62.lwdoc b/manual/beta5/en/tech_62.lwdoc
new file mode 100644
index 0000000..6aada66
--- /dev/null
+++ b/manual/beta5/en/tech_62.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Interstellar University
+
+ Sir! Thanks to our recent improvements in communications and computing capacities we've brought education to a new scale. Our interstellar universities will allow us to better adapt education programs to students' needs and to improve cooperation between our research labs.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €2,500,000
+
Effects:
+
Increases research output
+
+
+
+
+ Depends on:
+
Biological Computers
+
Quantum Encryption
+
+ Required by:
+
Wormhole Theory
+
+
+
diff --git a/manual/beta5/en/tech_63.lwdoc b/manual/beta5/en/tech_63.lwdoc
new file mode 100644
index 0000000..63ca243
--- /dev/null
+++ b/manual/beta5/en/tech_63.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Battle Cruisers
+
+ Sir! We have successfully researched a new type of ship, the Battle Cruiser! These ships are an improvement on our Cruisers as they are faster and more deadly. However, they are considerably more expensive to build and carry less of our system ships.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €2,500,000
+
Effects:
+
Provides the ability to build ships of the Battle Cruiser class
+
+
+
+
+ Depends on:
+
Cruisers
+
Adaptive Materials
+
Space-time folding
+
+ Required by:
+
Global Defense Bill
+
Biological Hyperspace Engines
+
Matter Anti-matter Missiles
+
+
+
diff --git a/manual/beta5/en/tech_64.lwdoc b/manual/beta5/en/tech_64.lwdoc
new file mode 100644
index 0000000..bc1bdd8
--- /dev/null
+++ b/manual/beta5/en/tech_64.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Phase Neutraliser
+
+ Applying temporal mechanics to communications, our scientists have managed to find better ways to disrupt enemy data flows, thus reducing their chances of accurate data being sent to their allies.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €5,000,000
+
Effects:
+
Increases jamming capabilities
+
+
+
+
+ Depends on:
+
Temporal Mechanics
+
Entropy Generator
+
+ Required by:
+
Localised Wormhole Destabilisation
+
+
+
diff --git a/manual/beta5/en/tech_65.lwdoc b/manual/beta5/en/tech_65.lwdoc
new file mode 100644
index 0000000..973463e
--- /dev/null
+++ b/manual/beta5/en/tech_65.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Multiphasic Transmission
+
+ Applying temporal mechanics to communication, our scientists have managed to use it to transmit data in fluctuating phases. This further protects our communications from enemy jamming technologies.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €5,000,000
+
Effects:
+
Increases communications efficiency
+
+
+
+
+ Depends on:
+
Temporal Mechanics
+
Quantum Encryption
+
+ Required by:
+
Subspace Data conduit
+
+
+
diff --git a/manual/beta5/en/tech_68.lwdoc b/manual/beta5/en/tech_68.lwdoc
new file mode 100644
index 0000000..f75d4f3
--- /dev/null
+++ b/manual/beta5/en/tech_68.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Sensor Turrets
+
+ Sire dude! Equipping our turrets with sensors designed out of our probe technology, we can gain in the accuracy of our aiming, thus becoming more efficient.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €2,000,000
+
Effects:
+
Increases turret power
+
+
+
+
+ Depends on:
+
Hyperspace Beacon
+
Automated Turrets
+
+
+
diff --git a/manual/beta5/en/tech_69.lwdoc b/manual/beta5/en/tech_69.lwdoc
new file mode 100644
index 0000000..a96ab5b
--- /dev/null
+++ b/manual/beta5/en/tech_69.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Global Defense Bill
+
+ This new law goes even further than the Martial Law to cope with the military's will. But our citizens will even less appreciate it.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €150,000
+
Effects:
+
Decreases happiness
+
Decreases Industrial Factories productivity
+
Increases Military Factories productivity
+
+
+
+
+ Depends on:
+
Automated Turrets
+
Battle Cruisers
+
+
+
diff --git a/manual/beta5/en/tech_7.lwdoc b/manual/beta5/en/tech_7.lwdoc
new file mode 100644
index 0000000..8e9aab6
--- /dev/null
+++ b/manual/beta5/en/tech_7.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Civilian Transportation Act
+
+ This law grants our citizens the right to use military ships to move between planets. This increases happiness but reduces battle efficiency of our ships since they have civilians on board.
+
+
+
+
Category: Law
+
Optional: No
+
Cost: €50,000
+
Effects:
+
Increases happiness
+
Decreases fleet power
+
+
+
+
+ Depends on:
+
Cruisers
+
+
+
diff --git a/manual/beta5/en/tech_70.lwdoc b/manual/beta5/en/tech_70.lwdoc
new file mode 100644
index 0000000..aa83d3c
--- /dev/null
+++ b/manual/beta5/en/tech_70.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Wormhole Theory
+
+ Going even further than space-time folding, our scientists have written a theory that, when put into practice, would allow us to manipulate wormholes. Of course further studies are required to reach any real application.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €5,000,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Space-time folding
+
Interstellar University
+
+ Required by:
+
Wormhole Collapsing
+
Wormholes
+
Subspace Data conduit
+
+
+
diff --git a/manual/beta5/en/tech_71.lwdoc b/manual/beta5/en/tech_71.lwdoc
new file mode 100644
index 0000000..d6188cc
--- /dev/null
+++ b/manual/beta5/en/tech_71.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Biological Propulsion Systems
+
+ Sir! Our scientists have found a way to create and grow artificial lifeforms capable of basic space flight. These can be used to replace our most simple ships in order to gain efficiency.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €4,000,000
+
Effects:
+
Increases G.A. ships power
+
Increases fighters power
+
+
+
+
+ Depends on:
+
Cruisers
+
Cybernetic Interfaces
+
Lifeform Energy Manipulation
+
+ Required by:
+
Biological Hyperspace Engines
+
+
+
diff --git a/manual/beta5/en/tech_72.lwdoc b/manual/beta5/en/tech_72.lwdoc
new file mode 100644
index 0000000..78e5c68
--- /dev/null
+++ b/manual/beta5/en/tech_72.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Mass Anti-matter Production
+
+ Using newly acquired technologies our scientists have achieved mass production of anti-matter thus opening a brand new field of applications.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €2,500,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Experimental Anti-Matter Production
+
Force fields
+
+ Required by:
+
Anti-matter Generators
+
Matter Anti-matter Engines
+
+
+
diff --git a/manual/beta5/en/tech_73.lwdoc b/manual/beta5/en/tech_73.lwdoc
new file mode 100644
index 0000000..bcc8ebf
--- /dev/null
+++ b/manual/beta5/en/tech_73.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Singularity Housing
+
+ Using the principles of Space-time folding, our engineers have improved our arcology design. Hyperspace and force-field generators must be integrated into our existing arcologies in order to allow our planets to house even more citizens.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €3,800,000
+
Effects:
+
Increases planet maximum population
+
+
+
+
+ Depends on:
+
Arcologies
+
Space-time folding
+
Force fields
+
+ Required by:
+
Self-sustained Arcologies
+
+
+
diff --git a/manual/beta5/en/tech_74.lwdoc b/manual/beta5/en/tech_74.lwdoc
new file mode 100644
index 0000000..49b6d64
--- /dev/null
+++ b/manual/beta5/en/tech_74.lwdoc
@@ -0,0 +1,33 @@
+
+
+ beta5
+ en
+ Intelligent Materials
+
+ Bringing sentience to the materials they use, our scientists provide us with wonderful new ways of building stuff.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €4,000,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Biological Computers
+
Self-healing Materials
+
+ Required by:
+
Automated Factories
+
Adaptive Plating
+
Self-sustained Arcologies
+
Biological Turrets
+
+
+
diff --git a/manual/beta5/en/tech_75.lwdoc b/manual/beta5/en/tech_75.lwdoc
new file mode 100644
index 0000000..292945f
--- /dev/null
+++ b/manual/beta5/en/tech_75.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Automated Factories
+
+ Sir! Using sentient materials in our factories will allow us to gain production efficiency.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €7,000,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories productivity
+
+
+
+
+ Depends on:
+
Biological Drones
+
Intelligent Materials
+
+ Required by:
+
Wild Capitalism
+
+
+
diff --git a/manual/beta5/en/tech_76.lwdoc b/manual/beta5/en/tech_76.lwdoc
new file mode 100644
index 0000000..8f26108
--- /dev/null
+++ b/manual/beta5/en/tech_76.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Wild Capitalism
+
+ This law allows the industrial sector to use any means necessary to increase profit. As a consequence, base planetary income and industrial factory benefits are increased but military factories, research and happiness suffer from it.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €200,000
+
Effects:
+
Increases planetary base income
+
Increases Industrial Factories productivity
+
Decreases Military Factories productivity
+
Decreases research output
+
Decreases happiness
+
+
+
+
+ Depends on:
+
Economy Globalisation
+
Automated Factories
+
+
+
diff --git a/manual/beta5/en/tech_77.lwdoc b/manual/beta5/en/tech_77.lwdoc
new file mode 100644
index 0000000..92bede0
--- /dev/null
+++ b/manual/beta5/en/tech_77.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Adaptive Plating
+
+ Sir! Our scientists have come up with a new way to reduce battle damage. They have integrated intelligent materials in our ships' plating thus offering them better defensive abilities.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
Reduces battle losses
+
+
+
+
+ Depends on:
+
Lifeform Energy Manipulation
+
Intelligent Materials
+
+
+
diff --git a/manual/beta5/en/tech_78.lwdoc b/manual/beta5/en/tech_78.lwdoc
new file mode 100644
index 0000000..89c27ce
--- /dev/null
+++ b/manual/beta5/en/tech_78.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Anti-matter Generators
+
+ Sir! Our scientists have designed a new way to produce energy. Equipping our factories with these anti-matter generators will improve our productivity.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €4,000,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories Productivity
+
+
+
+
+ Depends on:
+
Self-healing Materials
+
Mass Anti-matter Production
+
+ Required by:
+
Matter Anti-matter Missiles
+
+
+
diff --git a/manual/beta5/en/tech_79.lwdoc b/manual/beta5/en/tech_79.lwdoc
new file mode 100644
index 0000000..fd57c7d
--- /dev/null
+++ b/manual/beta5/en/tech_79.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Biological Subspace Control
+
+ Sir! Our scientists have engineered some new astonishing lifeforms. These artificial creatures are capable of controlling subspace fields. This major discovery opens a new era for our future studies.
+
+
+
+
Category: Fundamental research
+
Optional: Yes
+
Cost: €4,000,000
+
Effects: N/A
+
+
+
+ Depends on:
+
Space-time folding
+
Lifeform Energy Manipulation
+
+ Required by:
+
Self-sustained Arcologies
+
Biological Hyperspace Engines
+
+
+
diff --git a/manual/beta5/en/tech_8.lwdoc b/manual/beta5/en/tech_8.lwdoc
new file mode 100644
index 0000000..be8e779
--- /dev/null
+++ b/manual/beta5/en/tech_8.lwdoc
@@ -0,0 +1,30 @@
+
+
+ beta5
+ en
+ Room Temperature Superconductors
+
+ Sir! Our scientists have worked on a new type of electronic circuitry that will allow us to greatly improve the efficiency of our factories, using those room temperature superconductors.
+
+
+
+
Category: Civilian technology
+
Optional: No
+
Cost: €40,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Military Factories Productivity
+
+
+
+
+ Depends on:
+
Advanced Materials
+
+ Required by:
+
Nano-scale Computers
+
Advanced Communications
+
Robotics
+
+
+
diff --git a/manual/beta5/en/tech_80.lwdoc b/manual/beta5/en/tech_80.lwdoc
new file mode 100644
index 0000000..4c4a611
--- /dev/null
+++ b/manual/beta5/en/tech_80.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Wormhole Collapsing
+
+ Sir, our scientists have devised a new defense. This technology allows our planets to build counter-measures that will allow them to prevent unwanted hyperspace windows from forming in orbit. This should prevent 10% of an enemy fleet from exiting hyperspace above the planet and delay them in hyperspace for 1 more hour.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
Prevents Hyperspace exit
+
+
+
+
+ Depends on:
+
Wormhole Theory
+
+ Required by:
+
Localised Wormhole Destabilisation
+
Wormhole Supernova
+
+
+
diff --git a/manual/beta5/en/tech_81.lwdoc b/manual/beta5/en/tech_81.lwdoc
new file mode 100644
index 0000000..5cc43ad
--- /dev/null
+++ b/manual/beta5/en/tech_81.lwdoc
@@ -0,0 +1,29 @@
+
+
+ beta5
+ en
+ Wormholes
+
+ This technology applies space-time folding principles to spacebats, allowing your citizens to move freely between the planets in your empire. They will now be living in ecstacy as they will be able to visit their families, friends and dolphins.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
increases happiness
+
decreases Industrial Factories productivity
+
+
+
+
+ Depends on:
+
Wormhole Theory
+
+ Required by:
+
Wormhole Lockdown
+
Wormhole Supernova
+
+
+
diff --git a/manual/beta5/en/tech_82.lwdoc b/manual/beta5/en/tech_82.lwdoc
new file mode 100644
index 0000000..8e8334d
--- /dev/null
+++ b/manual/beta5/en/tech_82.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Subspace Data conduit
+
+ Applying wormhole theory to communications has allowed our scientists to create subspace conduits to transmit data, thus hiding it even better from enemy disruption techniques.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €12,000,000
+
Effects:
+
Increases communications efficiency
+
+
+
+
+ Depends on:
+
Multiphasic Transmission
+
Wormhole Theory
+
+
+
diff --git a/manual/beta5/en/tech_83.lwdoc b/manual/beta5/en/tech_83.lwdoc
new file mode 100644
index 0000000..5b5d9b1
--- /dev/null
+++ b/manual/beta5/en/tech_83.lwdoc
@@ -0,0 +1,26 @@
+
+
+ beta5
+ en
+ Self-sustained Arcologies
+
+ Sir! By combining their expertise in hyperspace theory and biological engineering, our scientists have found a way to create "grown" housing that will provide room and nourishment for our citizens. This will allow us to sustain more people on our planets.
+
+
+
+
Category: Civilian technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
Increases planet maximum population
+
+
+
+
+ Depends on:
+
Singularity Housing
+
Intelligent Materials
+
Biological Subspace Control
+
+
+
diff --git a/manual/beta5/en/tech_84.lwdoc b/manual/beta5/en/tech_84.lwdoc
new file mode 100644
index 0000000..f4830b6
--- /dev/null
+++ b/manual/beta5/en/tech_84.lwdoc
@@ -0,0 +1,27 @@
+
+
+ beta5
+ en
+ Matter Anti-matter Engines
+
+ Sir! Our scientists have found a new application for matter anti-matter reactions: propulsion systems! This new line of engines should increase our ships efficiency greatly.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €5,000,000
+
Effects:
+
Increases capital ship speed
+
+
+
+
+ Depends on:
+
Mass Anti-matter Production
+
+ Required by:
+
Biological Hyperspace Engines
+
+
+
diff --git a/manual/beta5/en/tech_85.lwdoc b/manual/beta5/en/tech_85.lwdoc
new file mode 100644
index 0000000..f996255
--- /dev/null
+++ b/manual/beta5/en/tech_85.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Biological Turrets
+
+ Building our turrets with intelligent materials should allow us to take advantage of their sentience to gain in accuracy and fire power.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €8,000,000
+
Effects:
+
Increases turret power
+
+
+
+
+ Depends on:
+
Automated Turrets
+
Intelligent Materials
+
+
+
diff --git a/manual/beta5/en/tech_86.lwdoc b/manual/beta5/en/tech_86.lwdoc
new file mode 100644
index 0000000..111ac86
--- /dev/null
+++ b/manual/beta5/en/tech_86.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Localised Wormhole Destabilisation
+
+ Applying wormhole collapsing technologies in a localised way allows us to disrupt subspace data conduits and other long range communication, rending them less efficient.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €12,000,000
+
Effects:
+
Increases jamming capabilities
+
+
+
+
+ Depends on:
+
Phase Neutraliser
+
Wormhole Collapsing
+
+
+
diff --git a/manual/beta5/en/tech_87.lwdoc b/manual/beta5/en/tech_87.lwdoc
new file mode 100644
index 0000000..65e9de4
--- /dev/null
+++ b/manual/beta5/en/tech_87.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Wormhole Lockdown
+
+ This law prevents your citizens from using the planetary gateways, cancelling the effects of the wormhole technology.
+
+
+
+
Category: Law
+
Optional: Yes
+
Cost: €170,000
+
Effects:
+
Increases Industrial Factories productivity
+
Decreases happiness
+
+
+
+
+ Depends on:
+
Wormholes
+
+
+
diff --git a/manual/beta5/en/tech_88.lwdoc b/manual/beta5/en/tech_88.lwdoc
new file mode 100644
index 0000000..e409305
--- /dev/null
+++ b/manual/beta5/en/tech_88.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Wormhole Supernova
+
+ Sir! With this technology we can initiate a chain reaction on a planetary wormhole that will cause it to flare up and destroy anything in the vicinity, including the planet and scaring the living hell out of the planet's neighbours.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €15,000,000
+
Effects:
+
Provides the ability to destroy planets
+
+
+
+
+ Depends on:
+
Wormhole Collapsing
+
Wormholes
+
+
+
diff --git a/manual/beta5/en/tech_89.lwdoc b/manual/beta5/en/tech_89.lwdoc
new file mode 100644
index 0000000..82fbefb
--- /dev/null
+++ b/manual/beta5/en/tech_89.lwdoc
@@ -0,0 +1,28 @@
+
+
+ beta5
+ en
+ Biological Hyperspace Engines
+
+ Sir! Our scientists have found a way to grow and nurture organic hyperspace engines. We will now be able to grow living capital ships, improving our fleets' efficiency.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
Increases Cruiser power
+
Increases Battle Cruiser power
+
+
+
+
+ Depends on:
+
Battle Cruisers
+
Biological Propulsion Systems
+
Biological Subspace Control
+
Matter Anti-matter Engines
+
+
+
diff --git a/manual/beta5/en/tech_9.lwdoc b/manual/beta5/en/tech_9.lwdoc
new file mode 100644
index 0000000..ec1a36e
--- /dev/null
+++ b/manual/beta5/en/tech_9.lwdoc
@@ -0,0 +1,31 @@
+
+
+ beta5
+ en
+ Nanotechnologies
+
+ Sir! Our scientists have made major progress in miniaturisation. With this technology our researchers have gained the capability to work at the "nano" level.
+
+
+
+
Category: Civilian technology
+
Optional: No
+
Cost: €40,000
+
Effects:
+
Increases Industrial Factories productivity
+
Increases Militart Factories productivity
+
+
+
+
+ Depends on:
+
Advanced Materials
+
+ Required by:
+
Nano-scale Computers
+
Hardened Alloys
+
Nanofiber Armor
+
Lifeform Engineering
+
+
+
diff --git a/manual/beta5/en/tech_90.lwdoc b/manual/beta5/en/tech_90.lwdoc
new file mode 100644
index 0000000..968a321
--- /dev/null
+++ b/manual/beta5/en/tech_90.lwdoc
@@ -0,0 +1,25 @@
+
+
+ beta5
+ en
+ Matter Anti-matter Missiles
+
+ Using matter / anti-matter reactions in our warheads should greatly increase the damage caused by our ships.
+
+
+
+
Category: Military technology
+
Optional: Yes
+
Cost: €10,000,000
+
Effects:
+
Increases fleet power
+
+
+
+
+ Depends on:
+
Battle Cruisers
+
Anti-matter Generators
+
+
+
diff --git a/manual/beta5/en/tech_exchange.lwdoc b/manual/beta5/en/tech_exchange.lwdoc
new file mode 100644
index 0000000..e08a94a
--- /dev/null
+++ b/manual/beta5/en/tech_exchange.lwdoc
@@ -0,0 +1,46 @@
+
+
+ beta5
+ en
+ Research Exchanges
+
+ As the complete technological tree isn't available to one given player, you'll have to acquire some technologies from other players through diplomatic exchanges in order to obtain technologies you don't have access to.
+
+ Technologies exchanges are managed through the Diplomacy section of the research page. It is accessible by clicking the "Diplomacy" link on top of the Research page.
+
+ In order to use this feature you have to match the following criteria:
+
Your account has to be more than 10 days old.
+
Technologies can only be exchanged between players in the same protection zone.
+
You haven't already sent an offer within the last 24h.
+
+
+
+ The top part of the "Diplomacy" section of the research page allows you to send scientific assistance offers to other players. You can provide this assistance by two different means:
+
Research assistance: by selecting the corresponding radio button, you'll offer part of your own research points to the player you're making the offer to. The number of research points offered is the smallest number between half of the target's.
+
A particular technology: by selecting the other radio button and choosing a technology in the provided drop down list you'll offer this technology to the target player.
+
+ You also have to choose the player you're making the offer to. Use the textfield next to "player" to type in his name. You can also define an amount of money to ask for in compensation by typing in the amount of cash you want in return in the corresponding textfield. Leaving the field blank corresponds to a gift.
+
+ To validate your offer click the "Send" button. You can also cancel your changes by clicking the "Cancel" button.
+
+
+ Each time another player sends you a scientific assistance offer, an Internal Transmission by your Scientific Advisor is sent to your mailbox. In this message, a "More Details" link directs you to the "Diplomacy" section of the Research Page. Details of the offer are displayed in the "Received Assistance Offers" section of the page.
+
+ For each offer is displayed:
+
Sender
+
Date and time of the offer
+
Nature of the offer
+
Your current status toward that particular offer. In particular it indicates if you have already discovered the technology or already accepted an offer within the last 24h...
+
Buttons to either accept the offer or decline it (Accept" and Decline" button)
+
+ Be careful that you can only accept one offer within 24h. Scientific assistance offers also expire on their own after 24h.
+
+
+ The bottom right part of the "Diplomacy" section of the Research page also includes an History of previous research assistance offers. For each offer this history includes:
+
Sender
+
Nature of the offer
+
Time and date of the offer
+
The action that has been take towards the offer: accepted, declined or expired
+
+
+
diff --git a/manual/beta5/en/tech_list.lwdoc b/manual/beta5/en/tech_list.lwdoc
new file mode 100644
index 0000000..3b7c017
--- /dev/null
+++ b/manual/beta5/en/tech_list.lwdoc
@@ -0,0 +1,284 @@
+
+
+ beta5
+ en
+ List of technologies
+
+
Research topics: this paragraph describes all technologies and the way they are organised in the technology graph
+
Research process: this part of the page introduces you to the way research progresses, from unknown technologies to technologies in use in your empire
+
Laws: this section explains how some special technologies allow you to influence the way things are handled in your empire through the legal system
+
Research budget: this paragraph deals with the influence you might have on what is being researched by setting a particular budget
+
Diplomacy: the last part of the manual page introduce the topic of technology exchanges that are covered in more details here, as part of the diplomacy manual page
+
+
+
+
+ In the LegacyWorlds universe a set of technologies are available for the players to research. Each of those technologies may or may not have an influence on some game parameters.
+
+ Technologies are organised according to two different systems:
+
Research Categories: technologies are organised according to the class of parameters they influence
+
Dependencies Graph: technologies usually depend on one another which means you need to possess technology A to be able to research technology B. Those dependencies correspond to links between technologies and the whole set of technologies along with those links compose the technology graph
+
+ Both classification systems are presented in more details in the following paragraphs along with a list of all available technologies.
+
+
+
+ The various research topics available in the game are organised in three categories:
+
Fundamental research
+
Military resarch
+
Civilian research
+
+ The next paragraphs will cover each category more precisely.
+
+
+ Fundamental research has as its primary objective the advancement of knowledge. It is exploratory by nature. It is conducted without any practical end in mind, although it may have unexpected results pointing to practical applications. Through theory generation, fundamental research provides the foundation for further, sometimes applied research.
+
+ Technologies in the fundamental category are basic technologies or theories that are important for your scientists to make further progress in their studies. They don't necessarily provide any improvement in your empire but they may be required by other studies.
+
+ In general fundamental technologies have an influence on the game such as:
+
Increasing research output
+
Providing access to new fields of research without any real influence on game parameters
+
Wide range of influences on various military or civilian parameters: in those cases the technologies were flagged as fundamental because of their exploratory nature
+
+ A list of all fundamental technologies is available here.
+
+
+ Military research consists in applied research. Applied research is done to solve specific, practical questions; its primary aim is not to gain knowledge for its own sake. Applied research in the military field provides technologies with direct military applications.
+
+ Those military technologies usually consist in:
+
new kinds of ships
+
improvements on those ships
+
technologies providing a better defense of your empire
+
technologies providing means to better attack an enemy planet or alliance
+
means to increase factories production
+
+ A list of all military technologies is available here.
+
+
+ Civilian research consists in applied research. Applied research is done to solve specific, practical questions; its primary aim is not to gain knowledge for its own sake. Applied research in the civilian field provide technologies with direct civilian applications.
+
+ Civilian technologies usually consists in:
+
new means to host more citizen on one planet
+
means to increase the happiness of the unhabitants of your empire
+
improvement of the population growth
+
technologies increasing factories efficiency
+
+ A list of all civilian technologies is available here.
+
+
+
+
+ The research topics are also organised in a dependency graph. It means you may need to have researched some other topics before being able to research another new one. A list of all research topics is provided here.
+
+ Clicking on the same of one technology in the list directs you to the individual manual page for the technology. This page is described in more details in the next paragraph.
+
+
+
+ The individual page of a technology is split into several sections:
+
Top part
+
Description
+
Details
+
Dependencies
+
+ The next paragraphs will describe each section.
+
+
+ The top part of the individual page of a technology provides:
+
The name of the research topic as title of the page
+
Links to the other sections of the page in a Contents list
+
+
+
+ This section presents the description of the technology as it appears in-game. This description correspond to an approximation of the technology's effects.
+
+
+ This section of the page provides details about the technology, including:
+
Category: this indicates in what category this topic belongs (civilian, military or fundamental) and if it's a law or a standard technology
+
Optional: research topics are mandatory (this field's value is No) if you are sure to have them in the subsection of the technologies tree you have access to. Other topics (you may not have them in your part of the graph) are optional (field set to Yes)
+
Cost: price you have to pay to implement the technology
+
Effects: influence of the technology of enacting the law on game parameters
+
+
+
+ This part of the page allows you to figure out where the technology is placed in the technology dependencies graph by providing:
+
Depends on: technologies you have to implement prior to being able to research this one
+
Required by: technologies that you can't research if you haven't first implemented this one
+
+
+
+
+
+ The technology list allows you to browse available technologies, following the dependency graph. You can view the list of fundamental research topics, military technologies or civilian technologies. If you care for a nice headache, you can take a look at the complete list as well. The lists are all sorted in alphabetical order.
+
+
+
+
+ During the research process research points are used in the various research categories to advance in the research process of various technologies. Along the way technologies go through various steps:
+
Unknown Technologies: technologies that are available in game but that your researchers haven't studied enough yet
+
Forseen Breakthroughs: research topics your scientists are working on and are close to completion
+
New technologies: technologies your scientists have discovered but that aren't in use in your empire yet
+
Implemented technologies: technologies currently in use in your empire
+
+ The next paragraphs will describe each stage and the associated features more closely.
+
+
+ Unknow technologies are technologies that are available in game. They may be unkown to you for several reasons:
+
Your researchers are working on them but they aren't advanced enough in the research process for the technologies to be listed as forseen breakthroughs
+
You don't have the required dependenciesimplemented yet and your researchers can't work on those subjects yet because they aren't advanced enough technologically
+
Those technologies aren't part of the technology graph section you have access to. You'll have to acquire them through diplomatic exchanges
+
+ Unknown technologies aren't displayed in the Topics section of the Rsearch page contrary to technologies at other research stages.
+
+
+ Forseen breakthroughs are research topics your scientists are currently working on. Technologies appear in this list when the required dependencies have been fulfilled and that at least 75% of the required research points have been consumed.
+
+ Both technologies and laws appear in this list but once completed each category (technologies or laws) is displayed in the relevant section of the page: Topics for standard technologies and Laws for laws.
+
+ Technologies you acquired through diplomatic exchanges get also added to the list with 75% of research completion.
+
+ Forseen breakthroughs are displayed in a single list for all categories in the Topics section of the Research page. For each technology is displayed:
+
Technology: only the name of the technology is basically displayed. Clicking on its name allows to display the description or hide it by clicking it again
+
Type: category in which the technology is classified (Military, Civilian or Fundamental)
+
Cost: price to pay to implement the technology
+
+
+
+ New technologies are technologies that your scientists have completely discovered. It means that your empire possesses the knowledge associated with the technology. But they can't be used in your empire and there effects aren't applied until they are implemented.
+
+ New technologies discovered by your scientists are displayed in the New technologies list of the Topics section of the Technology page.
+
+ New technologies are listed on the Topics section of the Technology page below the New technologies title. The list includes:
+
Technology: only the name of the technology is basically displayed. Clicking on its name allows to display the description or hide it by clicking it again
+
Type: category in which the technology is classified (Military, Civilian or Fundamental)
+
Cost: price to pay to implement the technology
+
Implement technology: clicking this link pays the required fee to implement the technology and start using it in your empire
+
+
+
+ Implementing technologies implies paying a fixed fee to upgrade planetary improvements and fleets so that they use the new technology.
+
+ Once you have chosen to implement a technology, it becomes available for use in your empire. Its effects are applied on all your planets and fleets and so on.
+
+ Implemented technologies are listed at the bottom of the Topics section of the Technology page. This list is split in three columns , one for each research category(Military, Civilian or Fundamental). As for the other lists, only the name of the technology is displayed and clicking its name allows to show / hide the description.
+
+
+
+
+ Some research topics don't provide you with standard technologies that you can implement so that they can be used in your empire. They provides you with access to laws.
+
+ The legal system in LegacyWorlds is quite simple. Once the research points required to research a law have been consumed the law doesn't get listed among the new technologies but among the available laws in the Laws section of the Research page. Laws can be enacted and revoked and have an empire wide influence. Using the legal system allows you to give general directions to your empire's development, depending on the effects of the laws you have enacted or revoked.
+
+ Enacting a law has some beneficial effects but also some drawbacks that have to be carefully weighted before enacting it. Enacting a law represents also a finantial cost and it can't be revoked for a 5 days period of time once enacted.
+
+
+ Check out the list of available laws, sorted alphabetically for your browsing pleasure.
+
+
+ Once it has been discovered, a law can have two different status and can be moved from one category to another at will but with a 5 days delay between each action and a cost. Those two status are:
+
Enacted laws: laws you have chose to enact are listed in this category. Their effects are currently being applied in your empire. You can choose to revoke it by clicking the relevant link
+
Available laws: newly dicovered laws and laws that you have previously revoked are listed here. They aren't used in your empire but you can choose to enact them by clicking the relevant link in order to benefit from their effect. Of course you have to have enough money to pay for the enacting fee to enact the law
+
+
+
+
+
+ Each day tick you get granted a certain amount of research points depending on your empire's total population. You have the possibility to balance the amount of research points used in each research category: Military, Civilian or Fundamental.
+
+ But keep in mind that:
+
you might need technologies in one category in order to achieve some breakthroughs in the others
+
Research points are used primarily in the areas you have set them to be used for. If it is impossible to use all of them in those categories given current implemented technologies, those research points will be assigned in other categories until it is impossible to discover new technologies
+
If no new technologies can be researched, remaining research points are lost
+
+
+
+ For each research category you are provided with 5 buttons to balance your research budget, the total remaning automatically at 100%:
+
double left arrow: decrease the percentage of research points for this category by 10. The two others are increased so that the total remains at 100%
+
left arrow: decrease the percentage of research points for this category by 1. The two others are increased so that the total remains at 100%
+
right arrow: increase the percentage of research points for this category by 1. The two others are decreased so that the total remains at 100%
+
double right arrow: increase the percentage of research points for this category by 10. The two others are decreased so that the total remains at 100%
+
lock: clicking once on a lock has for effect that this category isn't influenced by the changes made on the other categories. The research points percentage for it remains locked at its current value. Clicking once again on it removes the lock and the category is once again taken into account in the calculations to keep the total percentage of research points at 100%
+
+
+
+
+
+ At the beginning of the game, each player gets assigned a subsection of the technology graph. This subset consists usually of about half the total graph. It is the list of technologies that is basically accessible to the player, that is to say that his scientists can research and discover on their own.
+
+ The subset of the technology graph assigned to each player is generated randomly and always includes complete branches of the tree. That is to say no technology is included for which the player can't research the required dependencies.
+
+ Technologies that aren't in your predefined subset of the technology graph have to be obtained from other players.
+
+
+ In order to acquire technologies that your empire can't research you have to acquire them by using the Diplomacy tool of the Research page. See this manual section for more details.
+
+
+
+
+
diff --git a/manual/beta5/en/ticks.lwdoc b/manual/beta5/en/ticks.lwdoc
new file mode 100644
index 0000000..6176547
--- /dev/null
+++ b/manual/beta5/en/ticks.lwdoc
@@ -0,0 +1,79 @@
+
+
+ beta5
+ en
+ Ticks
+
+ Legacy Worlds is a tick based game. Ticks are specific instants in time when automated events are triggered. They correspond to moments when game data are updated.
+ As such different kinds of ticks happen at different time intervals and play a different role in the game dynamics.
+
+
+ The different ticks involved are presented in the table below:
+
+
+
Tick
+
Time
+
Events
+
+
+
Battle
+
Every 4 hours
+
+
Battle computations
+
Battle Unavaibility of fleets ends
+
+
+
+
Hour
+
Every hour
+
+
Fleets arrival Unavaibility ends
+
Hyperspace stand-by delay of fleets get reduced
+
+
+
+
Movement
+
Ever Minute
+
+
Fleet position calculation
+
+
+
+
Cash
+
twice a day
+
+
+ Income calculation and distribution
+
+
+
+
+
Day
+
Once a day
+
+
Population growth
+
Planet updates
+
Ranking updates
+
+
+
+
+
+
+ The Ticks page provides information about the major ticks involved in game:
+
Battle Tick
+
Cash Tick
+
Day Tick
+
Hour Tick
+
+ No display is provides for the Hour Tick, given the occurence of the tick is almost instantaneous.
+
+
+ For each tick is provided:
+
Description of the tick
+
Date and time of the previous tick of the same category
+
Date and time of the next tick of the same category along with a timer to the next tick
+
+
+
+
diff --git a/manual/beta5/en/topics.lwdoc b/manual/beta5/en/topics.lwdoc
new file mode 100644
index 0000000..9384c36
--- /dev/null
+++ b/manual/beta5/en/topics.lwdoc
@@ -0,0 +1,57 @@
+
+
+ beta5
+ en
+ Manual Topics
+
+ This section of the manual presents some general information about the game including account creation and games management along with a presentation of the main interface and overview page.
+
+
+ Your empire is composed of a set of planets. Starting at first with one it will grow through conquest of uninhabited planets or enemy ones. The overall technological advance of your empire can be improved through research. The fleets you build will provide it with defenses against hostiles and help with its expansion. Of course all of this costs money. But don't be too greedy because corruption might settle on your planets.
+
+ What makes great empires is their citizens. Population growth is as such essential. One major factor in LegacyWorlds is happiness. It reflects the overall satisfaction of your citizens. Be careful to keep them happy or they might revolt.
+
+
+ Fleets are sets of ships you can use either to defend yourself or attack other planets. Each fleet can be composed of ships of several different categories. Those fleets can be moved from planet to planet according to a particular set of rules. When faced with enemy fleets they of course engage in battle.
+
+ In order to have fleets you first of all have to build them. You also have to possess the required technologies.
+
+
+ Technology allows you to improve your empire as a whole. A certain amount of research points is granted to you each day tick according to your empire's population. Using those points in various research fields allows for new scientific breakthroughs. Implementing those newly discovered technologies allows your whole empire to benefit from them. Scientific knowledge also provides you access to laws that you can choose to enact or not. Those laws and technologies apply modifiers to various parameters in the game, either positively or negatively.
+
+ Not all research topics may be accessible to your empire and you might have to use diplomatic exchanges to acquire some technologies.
+
+
+ Legacy Worlds' universe is a galaxy far far away where the suvivors from the Earth's annihilation are trying to rebuild their civilisation. Maps of the area are available.
+
+ Legacy Worlds being a tick based game, information about the various ticks is also part of the universe. The various rankings of the players are also present along with the manual you're reading now.
+
+
+ Diplomacy covers a lot of concepts concerning in game interactions of players outside of the direct communication means. The major element is the alliance system which allows players to build up teams. The diplomatic section of the game also allows you to manage list of enemy and trusted players. Diplomacy is also a way to acquire technologies you can't research on your own.
+
+
+ There are two major means of communication in LegacyWorlds: a messaging system and forums. Those allow you to keep in touch with other players both inside your own alliance and outside of it.
+
+
+ Various elements in Legacy Worlds can be customised. Some preferences are specific to one account and others are in-game features that are defined on a per game basis.
+
+
+ As in every game there are rules. Those rules are to be agreed upon and followed by both sides: players and people running the game. Those are the topic of this section.
+
+ Some general elements that didn't fit in any other section of the manual are also presented here.
+
+
+ A glossary, that is a list of terms along with their definition, is provided so that you can grasp the meaning of a concept used in the LegacyWorlds' universe at a glace.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/tutorial.lwdoc b/manual/beta5/en/tutorial.lwdoc
new file mode 100644
index 0000000..882cbae
--- /dev/null
+++ b/manual/beta5/en/tutorial.lwdoc
@@ -0,0 +1,81 @@
+
+
+ beta5
+ en
+ Tutorial
+
+ This tutorial presents a few tips to help you getting started with the game. It's not the ultimate guide to Legacy Worlds and its scope is limited to your first days of gameplay. Becoming the best player in the game will then be up to you.
+
+
+ Legacy Worlds is a ticks based text based galactic war game. As leader of a little group of suvivors from the earth annihilation you are expected to build up an empire among the stars, in a remote galaxy, for your followers. This empire, including only one planet at the begining of the game, can grow through conquest and commerce. Taking over new planets by force is achieved thanks to fleets that you can move from planet to planet. Research provides you new technologies to improve your fleets and your empire.
+
+
+
+ When joining a Legacy Worlds game you get provided with a single planet. Before expanding your newborn empire you first of all can improve that newly acquired property.
+
+
+ In order to be able to build fleets, implement technologies or conduct transactions with other players you first of all need money. Your planet provides you with a base income linked with its population. Building industrial factories also generates income. Income is generated twice a day during the Money tick.
+
+
+ In order to protect your planet against potential invaders you have to set up defenses. Static defenses are provided by turrets. Fleets stationned on a planet also defend it. You build both turrets and ships with military factories. Items in the military factories' build queue get produced during hour ticks. In order to increase the construction speed of your turrets and fleets you can increase the number of military factories on your planet.
+
+
+ Be careful about the amount of factories you build on your planets. Factories have an influence on happiness. Happiness is a major factor in the game and represents the satisfaction of the citizens of your planet. If they are too unhappy they might revolt and destroy planetary improvements. Happiness calculation is dynamic and occurs each time you do anything influencing happiness.
+
+
+ A high happiness is also important because of its influence on population growth. Population size increase happens once a day during day ticks. The bigger the population the more ressources of all kinds you have.
+
+
+ Technological advances are provided through research. Each day at the day tick your amount of research points is calculated and automatically used to research new technologies in the three available categories: fundamental, civilian and military. The only influence you have on research budget is balancing the percentage of research points used in each category. Once a new technology has been discovered you have to implement it, which has a financial cost, before using it in your empire. Technologies have a wide variety of effects on the game parameters and also provide you with new kinds of ships.
+
+ Research also provides you with laws that you can enact to temporarily influence some game parameters.
+
+ Keep a close eye on the research page in order to be able to implement new technologies and progress in the technology graph.
+
+ By default you only have access to about 2/5 of all research topics in the technology graph. The others have to be acquired from other players through diplomacy. In order to get a new technology from another player you have to have the technologies it depends on.
+
+
+ The general overview page provides you with all major information about your empire. Some overview pages are also provided for various major categories of informations like Empire, Diplomacy, Universe or Communications. All important events also generate specific messages in the Internal Transmissions folder of the messaging system.
+
+
+
+
+
+ There are several means to acquire new planets:
+
Buying it: some planets might be offered for bidding in the marketplace
+
Getting it as a donation: it is possible to give a planet to another player
+
Taking it over: it's the most common way which will we described in more details below
+
+
+
+ In order to take over a planet you first of all have to send fleets to it. Fleets movements are regulated by a set of rules.
+
+ System ships (GA ships and fighters) can only travel in the same stellar system. If you want to send your fleets to another system your fleet has to include capital ships (cruisers and battle cruisers) in a sufficient amount so that they can carry all your system ships in their hauls.
+
+ The time required for your fleet to travel from one planet to another depends on the distance between the two planets of course but also on the type of ships you are sending and technological advances you may have.
+
+
+ Once you have reached the target planet you have to attack it in order to destroy its defenses. To do so you have to switch your fleet status to attack and have sufficient fire power compared to the defending forces. Battle calculations occur every 4h during Battle ticks.
+
+ Once the defending fleets have been destroyed you will gain control of the planet at the following hour tick if your fleet includes enough GA ships to control the planet's population. Depending on your technological advancement the number of GA ships required compared to the planet's population changes.
+
+
+
+ Fighting alone in the galaxy isn't easy and it's often best to team up with other players. In game teaming up means creating or joining an alliance. Players in the same alliance get provided with information about their fellow comrades and their empires that are useful to help each others in case of attack. Alliances can also set up alliance specific forums to ease communication among members.
+
+ The leader of the alliance has advanced control over the alliance configuration. He can define various ranks with various privileges among the members to allow specific access to alliance listings and forums depending on members' rank.
+
+
+
+ The in-game communication system includes first of all a messaging system. This messaging system is very similar to a simple mail client. It allows you to send messages to players, planets or alliances' diplomatic staff. You can also create folders to manage your messages.
+
+ The second major communication mean is the forums. Those forums include general forums, game specific forums and alliance forums. The forums are the place to look for help, report bugs, request features, look for an alliance, keep informed about the game and so on... Those forums have a behaviour similar to that of a simple message board.
+
+ Along inside communications an IRC network dedicated to the game has been set up. The server to connect to is irc.legacyworlds.com on the default port. Look at you IRC client manual to know more about IRC set-up and access.
+
+
+ In order to learn more about more advanced features and progress in your use of those presented here you can read the various manual topics.
+
+ A help forum is also provided for you to ask questions. Before posting any new question though make sure it has not already been asked...
+
+
diff --git a/manual/beta5/en/universe.lwdoc b/manual/beta5/en/universe.lwdoc
new file mode 100644
index 0000000..141d755
--- /dev/null
+++ b/manual/beta5/en/universe.lwdoc
@@ -0,0 +1,38 @@
+
+
+ beta5
+ en
+ Universe
+
+ Legacy Worlds' universe includes everything related to places, time and people involved at the scene where the game takes place. As such universe menu item directs you to the set of pages describing all those topics, including:
+
Universe Overview page": this page offers you at a glance all required information about the game universe
+
Maps: the game takes place in a galaxy far far away where the suvivors from the Earth's annihilation are trying to rebuild their civilisation. Maps of the area are available as part of the universe data
+
Ticks: Legacy Worlds being a tick based game, information about the various ticks is also part of the universe. That would be the time dimension of the universe
+
Rankings: there are also people in this universe, the players. The various rankings of the players are also present in the universe section of the game
+
Manual: The rules regulating the way the game works are also part of the universe. That's why the manual you're reading now is placed here
+
+
+
+ This page provides you with a status of Legacy Worlds' universe at a glance along with shortcuts to the most important items you might be interested in viewing. It is split into several sections that are described more precisely in the corresponding manual section.
+
+
+ Legacy Worlds' galaxy is split in a grid. Each square in the grid represent a stellar system or a portion of a nebula. Each square contains 6 elements, either 6 planets or 6 nebula sectors.
+
+ In order to help you navigate your ships in that galaxy three kinds of maps are available.
+
+ Common navigation features are also available for all kinds of maps to help you browse them.
+
+ All those features are explained in details in the maps manual section.
+
+
+ Legacy Worlds is a tick based game. As such different kinds of ticks happen at different time intervals and play a different role in the game dynamics. More precisions on ticks are given in the Ticks manual section.
+
+
+ Rankings are a way to keep track of the various players' progress in the game and to compare their strength. There are different kinds of rankings which are presented in the various sections of the Rankings manual page.
+
+
+
+
+
+
+
diff --git a/manual/beta5/en/universe_page.lwdoc b/manual/beta5/en/universe_page.lwdoc
new file mode 100644
index 0000000..f6e9041
--- /dev/null
+++ b/manual/beta5/en/universe_page.lwdoc
@@ -0,0 +1,39 @@
+
+
+ beta5
+ en
+ Universe Overview Page
+
+ This page provides you with a status of Legacy Worlds' universe at a glance along with shortcuts to the most important items you might be interested in viewing. It is split into several sections.
+
+
+ This section provides you with general information about the galaxy in which the game takes place including:
+
Planets: total number of planets in the galaxy
+
Neutral planets: number of neutral planets in the galaxy
+
Systems occupied by nebulas: number of systems which aren't occupied by stellar systems but by nebula squares
+
Average turrets/planet: average number of turrets on the planets in the galaxy
+
Average factories/planet: average number of factories on the planets in the galaxy
+
+
+
+ This part of the page informs you about the time at wich the next ticks will occure:
+
Next Battle Tick
+
Next Hour Tick
+
Next Cash Tick
+
Next Day Tick
+
+ It also provides a More Details link to the ticks page.
+
+
+ This section sums up your current status in the game rankings, presenting:
+
your current general ranking and the associated number of points
+
your current financial ranking and the associated number of points
+
your current civilisation ranking and the associated number of points
+
your current military ranking and the associated number of points
+
you current inflicted damage ranking and the associated number of points
+
your overall round ranking and the associated number of points
+
the current number of players in the rankings
+
+ It also provides a More Details link to the Rankings page.
+
+
diff --git a/manual/beta5/en/vacation_mode.lwdoc b/manual/beta5/en/vacation_mode.lwdoc
new file mode 100644
index 0000000..d33b69b
--- /dev/null
+++ b/manual/beta5/en/vacation_mode.lwdoc
@@ -0,0 +1,133 @@
+
+
+ beta5
+ en
+ Vacation mode
+
+ While playing a LegacyWorlds' game you might need to take a break from the game for some time, because you're on holidays, or in a place where no internet access (really that still actually exists) or simply because you're tired of playing. In such cases you might not want to lose all the hard work you've put in your empire because someone attacks it while you're not around for instance. The vacation mode is just for you.
+
+ Basically vacation mode allows you to keep your assets protected while you're away but everything is slowed down in your empire and you can't perform any game actions except read your messages and the forums. The next sections of the manual will explain all vacation mode related topics.
+
+
+
+ In order to enter vacation mode you first of all have to access the set of forms that allow you to activate vacation mode. Those two topics will be covered in the next paragraphs.
+
+
+ The page section where you can activate vacation mode is located on the home page of the game when you are logged in. In order to access the page you have two options:
+
if you're not logged in, follow the logging in procedure. The middle section of the page displayed in the body of the home page should be about vacation mode. Below an introduction about the topic, Is displayed an Enter vacation mode button. Clicking the button opens the forms that lead to the path to vacation
+
if you are logged in and playing a LegacyWorlds game, clicking on the My Account menu item gets you to the logged in home page of the game. As in the previous case below the introduction about the topic, is displayed the Enter vacation mode button. Clicking the button opens the forms that lead to the path to vacation
+
+
+
+ Clicking the Enter vacation mode button opens a new page displaying some information about the vacation mode. At the bottom of the page are displayed two buttons:
+
Yes, start the countdown: clicking the button starts the countdown to the beginning of the real vacation period. Until the countdown is finished that the game is still accessible normally
+
No, don't activate vacation mode: clicking the button cancels the action and gets you back to the home page
+
+ Once you have clicked the Yes, start the countdown button the logged in home page presents a Cancel vacation mode button instead of the Enter vacation mode one. The button will stay in place for the next 24 to 30h (until vacation mode actually starts).
+
+
+
+
+ In order to get out of vacation mode you first of all have to access the set of forms that allow you to de-activate vacation mode. Those two topics will be covered in the next paragraphs.
+
+
+ The page section where you can de-activate vacation mode is located on the home page of the game when you are logged in. In order to access the page you have two options:
+
if you're not logged in, follow the logging in procedure. The middle section of the page displayed in the body of the home page should be about vacation mode. Below an introduction about the topic, Is displayed a Leave vacation mode button. Clicking the button opens the forms that lead the to path out of vacation
+
if you are logged in and looking at the data of a LegacyWorlds game, clicking on the My Account menu item gets you to the logged in home page of the game. As in the previous case below the introduction about the topic, is displayed the Leave vacation mode button. Clicking the button opens the forms that lead to the path out of vacation
+
+
+
+ Clicking the Leave vacation mode button opens a new page displaying some information about the vacation mode. At the bottom of the page are displayed two buttons:
+
Yes, exit vacation mode: clicking the button gets you out of the vacation period
+
No, stay in vacation mode: clicking the button cancels the action and gets you back to the home page. You remain in vacation mode
+
+ Once you have clicked the "Yes, exit vacation mode button everything gets back to normal.
+
+
+
+
+ Vacation mode is controlled through vacation credits which allow to keep track of the amount of vacation time you're entitled to. Being on vacation has various effects on both your game data and other players' actions. All those topics will be covered in the next manual paragraphs.
+
+
+ Vacation credits allow to keep track of the amount of vacation time you're entitled to. Vacation credits gain and usage obey a set of rules that are listed below:
+
each account gains one vacation credit each day of gameplay (no vacation credits are gained while you're on vacation or while your account is closed
+
one vacation credit corresponds to 6h of vacation time
+
the maximum number of vacation credits you might have is 240 (that is up to two months of vacation period)
+
while you're in vacation mode, one vacation credit is used every 6h until you get out of vacation mode or get down to 0 vacation credit. In the last case your account gets automatically reverted back to "normal" mode
+
+
+
+
+ While you're in vacation mode you can still log in into your account and access any game you're playing. But some game features aren't accessible and other are altered. The next parapgraphs will list what you can do and what you can't do while on vacation mode along with the other effects it might have on your empire.
+
+
+ While you're on vacation you can:
+
Log in into your account
+
Access any game you're playing
+
See all in game pages
+
Use the messaging system
+
Browse and post in the forums as usual
+
Change your preferences
+
+
+
+ All game related actions, that is to say actions which have a real effect on the game are disabled. A non exhaustive list of actions you can't accomplish while you're on vacation could be:
+
Build or destroy planetary improvements (factories or turrets)
+
Buildships
+
Perform any fleets related actions
+
Upgradebeacons
+
Implementtechnologies
+
Give or receivecash donations
+
Join or leave an alliance
+
Manage your alliance (create or modify ranks, add forums or even create a new alliance)
+
Modify your Trusted Allies and Enemies lists
+
Sell, buy, give, accept as gift an item in the marketplace
+
+
+
+
+ While you're in vacation mode several game parameters get altered and your assets get protected to a certain extent. The next parapgraphs will list all alterations in your in game data that aren't directly visible in the game interface.
+
+
+ While you're in vacation mode, your citizen feel like they're on holidays, with their mighty leader away. As a consequence they don't work as hard a usual and this has quite an effect on production:
+
Population growth is divided by 4
+
Daily profit is divided by 4
+
Military production is divided by 4
+
Research output is divided by 4
+
+
+
+ While you're in vacation mode your planets are also protected to a certain extent. The specific rules around this protection feature are explained below.
+
+ If a planet you own was under attack when you enter vacation mode the battle gets to its end as usual.
+
+ If you lose control over the planet it won't be given back to you because you've entered vacation mode at the time.
+
+ If you keep control of the planet when the battle is over, the planet then enters full protection.
+
+ All planets you own where no battle is occuring are fully protected. This means that even if a battle occurs over the planet you can't lose control over the planet.
+
+
+ The protection status of your fleets depends on their location when you enter vacation mode.
+
+ Moving fleets or fleets in hyperspace stand-by fly or drop out of hyperspace normally as if you weren't in vacation mode.
+
+ For fleets located on your own planets the system is the same as for the planets. This means that fleets located on planets where battles are in progress when you enter vacation mode can get killed during battle ticks as usual.
+
+ The remaining fleets (if any) get in full protection mode at the end of the battle.
+
+ Fleets on your own planets where no battle is in progress are protected and are considered neutral during any future battle occuring at that location while you're on vacation. This means that they don't get killed during battle ticks.
+
+
+
+
+ The influence an account in vacation mode has on the rest of the players is very limited. The only elements to keep in mind are:
+
You can't donate money to players in vacation mode
+
Players in vacation mode won't be able to accept your technologies, planets or fleets exchanges
+
Your fleets can fly to planets whose owner is in vacation mode
+
The fleets belonging to a player in vacation mode can get killed if they aren't located on his own planets
+
You can't kill the fleets of a player in vacation mode if they are on his own planets nor take his planets but battles can occurr in orbit. The only effect vacation mode has is that the owner's fleets are considered neutral and no owner change can occur