mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 03:09:22 +02:00
TFS 1.0 functionality:
House list works. /Todo: House auctioning.
This commit is contained in:
parent
deea5eeaab
commit
d57f835c91
15
config.php
15
config.php
@ -4,7 +4,7 @@
|
||||
// TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
|
||||
// TFS 0.4 = TFS_03
|
||||
// TFS 1.0 = TFS_10 (Under developement)
|
||||
$config['TFSVersion'] = 'TFS_03';
|
||||
$config['TFSVersion'] = 'TFS_10';
|
||||
|
||||
$config['site_title'] = 'Znote AAC';
|
||||
$config['site_title_context'] = 'Because open communities are good communities. :3';
|
||||
@ -14,13 +14,13 @@
|
||||
// ------------------------ \\
|
||||
|
||||
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
|
||||
$config['sqlUser'] = 'username';
|
||||
$config['sqlUser'] = 'new';
|
||||
|
||||
// phpmyadmin password for OT server:
|
||||
$config['sqlPassword'] = 'password';
|
||||
$config['sqlPassword'] = 'new';
|
||||
|
||||
// The database name to connect to. (This is usually same as username).
|
||||
$config['sqlDatabase'] = 'database';
|
||||
$config['sqlDatabase'] = 'new';
|
||||
|
||||
// Hostname is usually localhost or 127.0.0.1.
|
||||
$config['sqlHost'] = 'localhost';
|
||||
@ -63,7 +63,10 @@
|
||||
// townID => 'townName' etc: ['3'=>'Thais']
|
||||
$config['towns'] = array(
|
||||
2 => 'Thyrfing',
|
||||
3 => 'Town 3',
|
||||
);
|
||||
// Default town id to display when visting house list page page. (TFS 1.0+).
|
||||
$config['HouseListDefaultTown'] = 1;
|
||||
|
||||
// Leave on black square in map and player should get teleported to their selected town.
|
||||
// If chars get buggy set this position to a beginner location to force players there.
|
||||
@ -194,8 +197,8 @@
|
||||
'enabled' => true,
|
||||
'guildboard' => true,
|
||||
'level' => 5,
|
||||
'cooldownPost' => 60,
|
||||
'cooldownCreate' => 180,
|
||||
'cooldownPost' => 1,//60,
|
||||
'cooldownCreate' => 1,//180,
|
||||
'hidden' => '<font color="orange">[H]</font>',
|
||||
'closed' => '<font color="red">[C]</font>',
|
||||
'sticky' => '<font color="green">[S]</font>',
|
||||
|
93
houses.php
93
houses.php
@ -140,6 +140,97 @@ if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') {
|
||||
</table>
|
||||
<?php
|
||||
} else echo '<p><font color="red">Something is wrong with the cache.</font></p>';
|
||||
}
|
||||
} else if ($config['TFSVersion'] === 'TFS_10') {
|
||||
// Fetch values
|
||||
$townid = (getValue($_POST['selected']) !== false) ? (int)$_POST['selected'] : $config['HouseListDefaultTown'];
|
||||
$towns = $config['towns'];
|
||||
|
||||
// Create Search house box
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<b>Select town:</b>
|
||||
<select name="selected">
|
||||
<?php
|
||||
foreach ($towns as $id => $name) {
|
||||
if ($id != $townid) echo '<option value="'. $id .'">'. $name .'</option>';
|
||||
else echo '<option value="'. $id .'" selected>'. $name .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<input type="submit" value="Fetch houses">
|
||||
</form>
|
||||
<?php
|
||||
|
||||
// Create or fetch data from cache
|
||||
$cache = new Cache('engine/cache/houses');
|
||||
$houses = array();
|
||||
if ($cache->hasExpired()) {
|
||||
$houses = mysql_select_multi("SELECT `id`, `owner`, `paid`, `warnings`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses`;");
|
||||
|
||||
if ($houses !== false) {
|
||||
// Fetch player names
|
||||
$playerlist = array();
|
||||
foreach ($houses as $h) if ($h['owner'] > 0) $playerlist[] = $h['owner'];
|
||||
if (!empty($playerlist)) {
|
||||
$ids = join(',',$playerlist);
|
||||
$tmpPlayers = mysql_select_multi("SELECT `id`, `name` FROM players WHERE `id` IN ($ids);");
|
||||
// Sort $tmpPlayers by player id
|
||||
$tmpById = array();
|
||||
foreach ($tmpPlayers as $p) $tmpById[$p['id']] = $p['name'];
|
||||
for ($i = 0; $i < count($houses); $i++) {
|
||||
if ($houses[$i]['owner'] > 0) $houses[$i]['ownername'] = $tmpById[$houses[$i]['owner']];
|
||||
}
|
||||
}
|
||||
|
||||
$cache->setContent($houses);
|
||||
$cache->save();
|
||||
}
|
||||
} else {
|
||||
$houses = $cache->load();
|
||||
}
|
||||
if ($houses !== false || !empty($houses)) {
|
||||
// Intialize stuff
|
||||
//data_dump($houses, false, "House data");
|
||||
?>
|
||||
<table id="housetable">
|
||||
<tr class="yellow">
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Beds</th>
|
||||
<th>Rent</th>
|
||||
<th>Owner</th>
|
||||
<th>Town</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($houses as $house) {
|
||||
if ($house['town_id'] == $townid) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $house['name']; ?></td>
|
||||
<td><?php echo $house['size']; ?></td>
|
||||
<td><?php echo $house['beds']; ?></td>
|
||||
<td><?php echo $house['rent']; ?></td>
|
||||
<?php
|
||||
// Status:
|
||||
if ($house['owner'] != 0) {
|
||||
echo "<td><a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a></td>";
|
||||
} else {
|
||||
echo "<td>None</td>";
|
||||
}
|
||||
?>
|
||||
<td><?php echo $towns[$house['town_id']]; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo "<h1>Failed to fetch data from sql->houses table.</h1><p>Is the table empty?</p>";
|
||||
} // End TFS 1.0 logic
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
@ -10,7 +10,7 @@
|
||||
include 'layout/widgets/topplayers.php';
|
||||
include 'layout/widgets/highscore.php';
|
||||
include 'layout/widgets/serverinfo.php';
|
||||
if ($config['TFSVersion'] === 'TFS_03') include 'layout/widgets/houses.php';
|
||||
if ($config['TFSVersion'] !== 'TFS_02') include 'layout/widgets/houses.php';
|
||||
// Remove // to enable twitter, edit twitter stuff in /widgets/twitter.php
|
||||
//include 'layout/widgets/twitter.php';
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user