-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacter.php
More file actions
240 lines (215 loc) · 8.13 KB
/
character.php
File metadata and controls
240 lines (215 loc) · 8.13 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
define("INCLUDED", true); //This is for returning a die message if INCLUDED is not defined on any of the template
$AJAX_PAGE = false;
//################ Required Resources ################
$REQUIRED_RESOURCES = array(
'WoW' => true,
'Realm' => true,
);
//################ Required Files ################
require_once("init.php");
//################ PAGE ACCESS ################
$cms->BannedAccess(false);
eval($cms->SetPageAccess(ACCESS_REGISTERED));
//################ General Variables ################
$page_name[] = array("Characters"=>"characters.php");
WoW::getZonesArray();
//################ Page Functions ################
if(empty($_GET['cid']) || empty($_GET['rid']) || empty($REALM[$_GET['rid']]))
{
//Redirect to characters list
$REDIRECT_MESSAGE = "No Character Selected";
$REDIRECT_LOCATION = "characters.php";
$REDIRECT_INTERVAL = 0;
$REDIRECT_TYPE = "notice";
eval($templates->Redirect());
exit();
}
$rclass = new Realm($_GET['rid']);
$_cdata = $rclass->FetchCharacterByCharacterID("", $_GET['cid']);
$page_name[] = array($_cdata['name']=>"character.php?rid={$_GET['rid']}&cid={$_GET['cid']}");
if($_cdata['account'] == $USER['id'])
{
$CHARACTERLIST_SHOW_TOOLS = true;
}
else
{
$CHARACTERLIST_SHOW_TOOLS = false;
}
$CHARACTERLIST_RID = $_GET['rid'];
$CHARACTERLIST_MUSTBEONLINE = false;
$CHARACTERLIST_MUSTBEOFFLINE = false;
$CHARACTERLIST_SELECTION = false;
if(isset($_GET['act']) && $_cdata['account'] == $USER['id'])
{
//Character unstuck/revive
if($_GET['act'] == "unstuck")
{
$page_name[] = array("Unstuck/Revive"=>$_SERVER['REQUEST_URI']);
if(isset($_POST['submit']))
{
if($_cdata['online'] != 0) //Must be offline or else it can be used to cheat on pvps and etc
{
$cms->ErrorPopulate("You must be logged out to use this tool.");
}
if(!$cms->ErrorExists()) //If no errors
{
$location = null;
if(WoW::$arrFactionId[$_cdata['race']] == 1) //Get faction id and check location accordingly
{
$location = $REALM[$_GET['rid']]['UNSTUCK']['alliance'];
}
if(WoW::$arrFactionId[$_cdata['race']] == 2)
{
$location = $REALM[$_GET['rid']]['UNSTUCK']['horde'];
}
$teleresult = $rclass->ExecuteRemoteCommand("tele name {$_cdata['name']} {$location}"); //Teleport
$ressresult = $rclass->ExecuteRemoteCommand("revive {$_cdata['name']}"); //and then revive
if(!$teleresult['sent'] && !$ressresult['sent']) //If both functions did not work, return an error
{
$cms->ErrorPopulate("There was a problem with the server, please try again later. If this problem persists, please contact an administrator!");
}
else //Output success page
{
eval($templates->Output("unstuck_success"));
exit();
}
}
}
}
//Character recustomization/rename
if($_GET['act'] == "customize")
{
$page_name[] = array("Rename/Customize"=>$_SERVER['REQUEST_URI']);
if(isset($_POST['submit']))
{
//User must have required vote points
if((int)$USER['votepoints'] < $cms->config['cost_customizetool']) //Cost
{
$cms->ErrorPopulate("The cost of this tool is {$cms->config['cost_customizetool']} Vote Points. You only have {$USER['votepoints']} Vote Points. <a href='vote.php'>Click here to vote for us</a>.");
}
//Check if user was ever banned
$query = new Query();
$query->Select("`account_banned`")->Columns(array("COUNT(*)"=>"numrows"))->Where("`id` = '%s'", $USER['id'])->Build();
$result = MySQLiFetch($DB->query($query, DBNAME), "onerow: 1");
if((int)$result['numrows'] > 0)
{
$cms->ErrorPopulate("You are not allowed to use this tool.");
}
if(!$cms->ErrorExists()) //If no errors
{
//execute command first to check if ther are no errors
$soapresult = $rclass->ExecuteRemoteCommand("character customize {$_cdata['name']}");
$sent = $soapresult['sent'] ? 1 : 0;
if($soapresult['sent'])
{
//Deduct points
$query = new Query();
$query->Update("`account_mm_extend`")->Columns(array("`votepoints`"=>"`votepoints` - '%s'"), $cms->config['cost_customizetool'])->Where("`id` = '%s'", $USER['id'])->Build();
$result = $DB->query($query, DBNAME);
//Deduct Points from GLOBAL varaible to remove confusion because of positioning
if($result)
{
$USER['votepoints'] -= $cms->config['cost_customizetool'];
}
}
else //If there was an error do not duduct points
{
$cms->ErrorPopulate("There was a problem with the server, please try again later. If this problem persists, please contact an administrator!");
}
//Insert entry in log
$query = new Query();
$query->Insert("`log_customizetool`")->Columns(array(
"`account`" => "'%s'",
"`character`" => "'%s'",
"`oldname`" => "'%s'",
"`command`" => "'%s'",
"`message`" => "'%s'",
"`sent`" => "'%s'",
"`cost`" => "'%s'",
), $_cdata['account'], $_cdata['guid'], $_cdata['name'], "character customize {$_cdata['name']}", $soapresult['message'], $sent, $cms->config['cost_customizetool'])->Build();
$DB->query($query, DBNAME);
//If everything is ok
if($soapresult['sent'])
{
eval($templates->Output("customize_success"));
exit();
}
}
}
}
//Character faction changer
if($_GET['act'] == "factionchange")
{
$page_name[] = array("Faction Change"=>$_SERVER['REQUEST_URI']);
if(isset($_POST['submit']))
{
//User must have required vote points
if((int)$USER['votepoints'] < $cms->config['cost_factionchange']) //Cost
{
$cms->ErrorPopulate("The cost of this tool is {$cms->config['cost_factionchange']} Vote Points. You only have {$USER['votepoints']} Vote Points. <a href='vote.php'>Click here to vote for us</a>.");
}
if(!$cms->ErrorExists()) //If no errors
{
//execute command first to check if ther are no errors
$soapresult = $rclass->ExecuteRemoteCommand("character changefaction {$_cdata['name']}");
if($soapresult['sent'])
{
//Deduct points
$query = new Query();
$query->Update("`account_mm_extend`")->Columns(array("`votepoints`"=>"`votepoints` - '%s'"), $cms->config['cost_factionchange'])->Where("`id` = '%s'", $USER['id'])->Build();
$result = $DB->query($query, DBNAME);
if($result)
{
$USER['votepoints'] -= $cms->config['cost_factionchange']; //Deduct Points from GLOBAL varaible to remove confusion because of positioning
//Show success screen
eval($templates->Output("factionchange_success"));
exit();
}
}
else //If there was an error do not duduct points
{
$cms->ErrorPopulate("There was a problem with the server, please try again later. If this problem persists, please contact an administrator!");
}
}
}
}
//Character race changer
if($_GET['act'] == "racechange")
{
$page_name[] = array("Race Change"=>$_SERVER['REQUEST_URI']);
if(isset($_POST['submit']))
{
//User must have required vote points
if((int)$USER['votepoints'] < $cms->config['cost_racechange']) //Cost
{
$cms->ErrorPopulate("The cost of this tool is {$cms->config['cost_racechange']} Vote Points. You only have {$USER['votepoints']} Vote Points. <a href='vote.php'>Click here to vote for us</a>.");
}
if(!$cms->ErrorExists()) //If no errors
{
//execute command first to check if ther are no errors
$soapresult = $rclass->ExecuteRemoteCommand("character changerace {$_cdata['name']}");
if($soapresult['sent'])
{
//Deduct points
$query = new Query();
$query->Update("`account_mm_extend`")->Columns(array("`votepoints`"=>"`votepoints` - '%s'"), $cms->config['cost_racechange'])->Where("`id` = '%s'", $USER['id'])->Build();
$result = $DB->query($query, DBNAME);
if($result)
{
$USER['votepoints'] -= $cms->config['cost_racechange']; //Deduct Points from GLOBAL varaible to remove confusion because of positioning
//Show success screen
eval($templates->Output("racechange_success"));
exit();
}
}
else //If there was an error do not duduct points
{
$cms->ErrorPopulate("There was a problem with the server, please try again later. If this problem persists, please contact an administrator!");
}
}
}
}
}
eval($templates->Output('character'));
?>