forked from gplanchat/wootook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
officier.php
118 lines (108 loc) · 4.27 KB
/
officier.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
* All rights reserved.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/application/bootstrap.php';
function ShowOfficierPage ( &$CurrentUser ) {
global $lang, $resource, $reslist, $_GET;
includeLang('officier');
// Vérification que le joueur n'a pas un nombre de points négatif
if ($CurrentUser['rpg_points'] < 0) {
doquery("UPDATE {{table}} SET `rpg_points` = '0' WHERE `id` = '". $CurrentUser['id'] ."';", 'users');
}
// Si recrutement d'un officier
if ($_GET['mode'] == 2) {
if ($CurrentUser['rpg_points'] > 0) {
$Selected = $_GET['offi'];
if ( in_array($Selected, $reslist['officier']) ) {
$Result = IsOfficierAccessible ( $CurrentUser, $Selected );
if ( $Result == 1 ) {
$CurrentUser[$resource[$Selected]] += 1;
$CurrentUser['rpg_points'] -= 1;
if ($Selected == 610) {
$CurrentUser['spy_tech'] += 5;
} elseif ($Selected == 611) {
$CurrentUser['computer_tech'] += 3;
}
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`rpg_points` = '". $CurrentUser['rpg_points'] ."', ";
$QryUpdateUser .= "`spy_tech` = '". $CurrentUser['spy_tech'] ."', ";
$QryUpdateUser .= "`computer_tech` = '". $CurrentUser['computer_tech'] ."', ";
$QryUpdateUser .= "`".$resource[$Selected]."` = '". $CurrentUser[$resource[$Selected]] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $CurrentUser['id'] ."';";
doquery( $QryUpdateUser, 'users' );
$Message = $lang['OffiRecrute'];
} elseif ( $Result == -1 ) {
$Message = $lang['Maxlvl'];
} elseif ( $Result == 0 ) {
$Message = $lang['Noob'];
}
}
} else {
$Message = $lang['NoPoints'];
}
$MessTPL = gettemplate('message_body');
$parse['title'] = $lang['Officier'];
$parse['mes'] = $Message;
$page = parsetemplate( $MessTPL, $parse);
} else {
// Pas de recrutement d'officier
$PageTPL = gettemplate('officier_body');
$RowsTPL = gettemplate('officier_rows');
$parse['off_points'] = $lang['off_points'];
$parse['alv_points'] = $CurrentUser['rpg_points'];
$parse['disp_off_tbl'] = "";
for ( $Officier = 601; $Officier <= 615; $Officier++ ) {
$Result = IsOfficierAccessible ( $CurrentUser, $Officier );
if ( $Result != 0 ) {
$bloc['off_id'] = $Officier;
$bloc['off_tx_lvl'] = $lang['off_tx_lvl'];
$bloc['off_lvl'] = $CurrentUser[$resource[$Officier]];
$bloc['off_desc'] = $lang['Desc'][$Officier];
if ($Result == 1) {
$bloc['off_link'] = "<a href=\"officier.php?mode=2&offi=".$Officier."\"><font color=\"#00ff00\">". $lang['link'][$Officier]."</font>";
} else {
$bloc['off_link'] = $lang['Maxlvl'];
}
$parse['disp_off_tbl'] .= parsetemplate( $RowsTPL, $bloc );
}
}
$page = parsetemplate( $PageTPL, $parse);
}
return $page;
}
$page = ShowOfficierPage ( $user );
display($page, $lang['officier']);
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 - Version originelle (Tom1991)
// 1.1 - Réécriture Chlorel pour integration complete dans Wootook
?>