-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.php
75 lines (62 loc) · 3.76 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* install.php
*
* @package Attaques
* @author Verité/ericc
* @link http://www.ogsteam.eu
* @version : 0.8j
*/
//L'appel direct est interdit
if (!defined('IN_SPYOGAME')) die("Hacking attempt");
//Définitions
global $db;
global $table_prefix;
define("TABLE_ATTAQUES_ATTAQUES", $table_prefix . "attaques_attaques");
define("TABLE_ATTAQUES_RECYCLAGES", $table_prefix . "attaques_recyclages");
define("TABLE_ATTAQUES_ARCHIVES", $table_prefix . "attaques_archives");
$mod_folder = "attaques";
install_mod($mod_folder);
//Si la table attaques_attaques existe, on la supprime
$query = "DROP TABLE IF EXISTS " . TABLE_ATTAQUES_ATTAQUES;
$db->sql_query($query);
//Si la table attaques_recyclage existe, on la supprime
$query = "DROP TABLE IF EXISTS " . TABLE_ATTAQUES_RECYCLAGES;
$db->sql_query($query);
//Si la table gains_save existe, on la supprime
$query = "DROP TABLE IF EXISTS " . TABLE_ATTAQUES_ARCHIVES;
$db->sql_query($query);
//Ensuite, on crée la table attaques_attaques
$query = "CREATE TABLE " . TABLE_ATTAQUES_ATTAQUES . " (" . " attack_id INT NOT NULL AUTO_INCREMENT, " . " attack_user_id INT NOT NULL, " . " attack_coord VARCHAR(8) NOT NULL, " . " attack_date INT NOT NULL, " . " attack_metal BIGINT NOT NULL, " . " attack_cristal BIGINT NOT NULL, " . " attack_deut BIGINT NOT NULL, " . " attack_pertes BIGINT NOT NULL, " . " primary key ( attack_id )" . " )";
$db->sql_query($query);
//Puis la table attaques_recyclages
$query = "CREATE TABLE " . TABLE_ATTAQUES_RECYCLAGES . " (" . " recy_id INT NOT NULL AUTO_INCREMENT, " . " recy_user_id INT NOT NULL, " . " recy_coord VARCHAR(8) NOT NULL, " . " recy_date INT NOT NULL, " . " recy_metal BIGINT NOT NULL, " . " recy_cristal BIGINT NOT NULL, " . " primary key ( recy_id )" . " )";
$db->sql_query($query);
//Enfin la table attaques_archives
$query = "CREATE TABLE " . TABLE_ATTAQUES_ARCHIVES . " (" . " archives_id INT NOT NULL AUTO_INCREMENT, " . " archives_user_id INT NOT NULL, " . " archives_nb_attaques INT NOT NULL, " . " archives_date INT NOT NULL, " . " archives_metal BIGINT NOT NULL, " . " archives_cristal BIGINT NOT NULL, " . " archives_deut BIGINT NOT NULL, " . " archives_pertes BIGINT NOT NULL, " . " archives_recy_metal BIGINT NOT NULL, " . " archives_recy_cristal BIGINT NOT NULL, " . " primary key ( archives_id )" . " )";
$db->sql_query($query);
// on insère les valeurs de configuration par défaut
$sqldata = '{"transp":75,"layer":1,"defenseur":1,"histo":1}';
mod_set_option('config', $sqldata);
// on insère les valeurs bbcodes par défaut
$sqldata = '{"title":"#FFA500","m_g":"#00FF40","c_g":"#00FF40","d_g":"#00FF40","m_r":"#00FF40","c_r":"#00FF40","perte":"#FF0000","renta":"#00FF40"}';
mod_set_option('bbcodes', $sqldata);
//On vérifie que la table xtense_callbacks existe (Xtense2)
if ($db->sql_numrows($db->sql_query("SHOW TABLES LIKE '" . $table_prefix . "xtense_callbacks" . "'"))) {
// Si oui, on récupère le n° d'id du mod
$query = "SELECT `id` FROM `" . TABLE_MOD . "` WHERE `action`='attaques' AND `active`='1' LIMIT 1";
$result = $db->sql_query($query);
$attack_id = $db->sql_fetch_row($result);
$attack_id = $attack_id[0];
// on fait du nettoyage au cas ou
$query = "DELETE FROM `" . $table_prefix . "xtense_callbacks" . "` WHERE `mod_id`=" . $attack_id;
$db->sql_query($query);
// Insert les données pour récuperer les RC
$query = "INSERT INTO " . $table_prefix . "xtense_callbacks" . " ( `mod_id` , `function` , `type` )
VALUES ( '" . $attack_id . "', 'attack_rc', 'rc')";
$db->sql_query($query);
// Insert les données pour récuperer les RR
$query = "INSERT INTO " . $table_prefix . "xtense_callbacks" . " ( `mod_id` , `function` , `type` )
VALUES ( '" . $attack_id . "', 'attack_rr', 'rc_cdr')";
$db->sql_query($query);
}