Skip to content

Commit

Permalink
fix charbazaar pages, componentizing some blocks of code (to reuse an…
Browse files Browse the repository at this point in the history
…d do not repeat code). added hover on buttons from PR #54.
  • Loading branch information
elsongabriel committed Dec 7, 2023
1 parent 0c194f1 commit ba526ea
Show file tree
Hide file tree
Showing 8 changed files with 597 additions and 1,147 deletions.
314 changes: 314 additions & 0 deletions system/pages/char_bazaar/char_info.php

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions system/pages/char_bazaar/create_step1.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/* PLAYERS */
$players = array();
global $account_logged, $template_path;

$players = [];
$account_players = $account_logged->getPlayersList();
/* PLAYERS END */

Expand All @@ -20,13 +22,13 @@
</div>
<img id="TubeLeftEnd"
src="<?= $template_path; ?>/images/global/content/progressbar/progress-bar-tube-left-green.gif"> <img
id="TubeRightEnd"
src="<?= $template_path; ?>/images/global/content/progressbar/progress-bar-tube-right-blue.gif">
id="TubeRightEnd"
src="<?= $template_path; ?>/images/global/content/progressbar/progress-bar-tube-right-blue.gif">
<div id="FirstStep" class="Steps">
<div class="SingleStepContainer">
<img class="StepIcon"
src="<?= $template_path; ?>/images/global/content/progressbar/progress-bar-icon-1-green.gif">
<div class="StepText" style="font-weight:bold;">Select character</div>
<div class="StepText" style="font-weight:bold;">Select Character</div>
</div>
</div>
<div id="StepsContainer1">
Expand Down Expand Up @@ -116,15 +118,18 @@
cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><select style="width: 100%;"
<td>
<select style="width: 100%;"
name="auction_character">
<?php foreach ($account_players as $player) {
$item = "{$player->getname()} | Level {$player->getLevel()} | Vocation: {$player->getVocationName()}"
?>
<option
value="<?= $player->getId() ?>"><?= $item ?></option>
<option value="<?= $player->getId() ?>">
<?= $item ?>
</option>
<?php } ?>
</select></td>
</select>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -153,13 +158,15 @@
<tr>
<td>
<div style="float: right;">
<a href="?news">
<a href="?currentcharactertrades">
<div class="BigButton"
style="background-image:url(<?= $template_path; ?>/images/global/buttons/sbutton_red.gif)">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);">
<div class="BigButtonOver"
<div onmouseover="MouseOverBigButton('CancelBazaar');"
onmouseout="MouseOutBigButton('CancelBazaar');">
<div id="CancelBazaar" class="BigButtonOver"
style="background-image: url(<?= $template_path; ?>/images/global/buttons/sbutton_red_over.gif); visibility: hidden;"></div>
<input class="BigButtonText" type="button" value="Cancel"></div>
<input class="BigButtonText" type="button" value="Cancel">
</div>
</div>
</a>
</div>
Expand All @@ -168,10 +175,12 @@
<div style="float: left;">
<div class="BigButton"
style="background-image:url(<?= $template_path; ?>/images/global/buttons/sbutton_green.gif)">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);">
<div class="BigButtonOver"
<div onmouseover="MouseOverBigButton('NextBazaar');"
onmouseout="MouseOutBigButton('NextBazaar');">
<div id="NextBazaar" class="BigButtonOver"
style="background-image: url(<?= $template_path; ?>/images/global/buttons/sbutton_green_over.gif); visibility: hidden;"></div>
<input name="auction_submit" class="BigButtonText" type="submit" value="Next"></div>
<input name="auction_submit" class="BigButtonText" type="submit" value="Next">
</div>
</div>
</div>
</td>
Expand Down
49 changes: 26 additions & 23 deletions system/pages/char_bazaar/create_step2.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
global $db, $account_logged, $template_path, $charbazaar_create, $config;

if (isset($_POST['auction_submit']) && isset($_POST['auction_character'])) {
$selected_character = $_POST['auction_character'];
$next_truecount = 0;

/* PLAYERS */
$getCharacter = $db->query('SELECT `id`, `account_id`, `name`, `level`, `vocation`' . 'FROM `players`' . 'WHERE `id` = ' . $db->quote($selected_character) . '');
$getCharacter = $getCharacter->fetch();
$character = $db->query('SELECT `id`, `account_id`, `name`, `level`, `vocation`' . 'FROM `players`' . 'WHERE `id` = ' . $db->quote($selected_character) . '');
$character = $character->fetch();
/* PLAYERS END */


/* VERIFICA CONTA */
$idLogged = $account_logged->getCustomField('id');

if ($idLogged == $getCharacter['account_id']) {
if ($idLogged == $character['account_id']) {
$next_truecount++;
} else {
header('Location: index.php?news');
Expand All @@ -22,23 +22,22 @@


/* GET LEVEL PLAYERS */
if ($getCharacter['level'] >= 8) {
if ($character['level'] >= 8) {
$verif_level = '<img src="' . $template_path . '/images/premiumfeatures/icon_yes.png">';
$next_truecount++;
} else {
$verif_level = '<img src="' . $template_path . '/images/premiumfeatures/icon_no.png">';
}
/* GET LEVEL PLAYERS END */


/* GET FRAGS PLAYERS */
$frags_enabled = $db->hasTable('player_killers') && $config['characters']['frags'];
$frags_count = 0;
if ($frags_enabled) {
$query = $db->query(
'SELECT COUNT(`player_id`) as `frags`' .
'FROM `player_killers`' .
'WHERE `player_id` = ' . $getCharacter['id'] . ' ' .
'WHERE `player_id` = ' . $character['id'] . ' ' .
'GROUP BY `player_id`' .
'ORDER BY COUNT(`player_id`) DESC');

Expand All @@ -54,7 +53,7 @@


/* GET COINS */
$getCoins = $db->query('SELECT `coins`' . 'FROM `accounts`' . 'WHERE `id` = ' . $getCharacter['account_id'] . '');
$getCoins = $db->query('SELECT `coins`' . 'FROM `accounts`' . 'WHERE `id` = ' . $character['account_id'] . '');
$getCoins = $getCoins->fetch();

if ($getCoins >= $charbazaar_create) {
Expand All @@ -67,7 +66,7 @@


/* GET HOUSE */
$getHouse = $db->query('SELECT `owner`' . 'FROM `houses`' . 'WHERE `owner` = ' . $getCharacter['id'] . '');
$getHouse = $db->query('SELECT `owner`' . 'FROM `houses`' . 'WHERE `owner` = ' . $character['id'] . '');
$getHouse = $getHouse->fetch();

if ($getHouse == 0) {
Expand All @@ -80,13 +79,13 @@


/* GET GUILD */
$getGuildOwner = $db->query('SELECT `ownerid`' . 'FROM `guilds`' . 'WHERE `ownerid` = ' . $getCharacter['id'] . '');
$getGuildOwner = $db->query('SELECT `ownerid`' . 'FROM `guilds`' . 'WHERE `ownerid` = ' . $character['id'] . '');
$getGuildOwner = $getGuildOwner->fetch();

$getGuildInvited = $db->query('SELECT `player_id`' . 'FROM `guild_invites`' . 'WHERE `player_id` = ' . $getCharacter['id'] . '');
$getGuildInvited = $db->query('SELECT `player_id`' . 'FROM `guild_invites`' . 'WHERE `player_id` = ' . $character['id'] . '');
$getGuildInvited = $getGuildInvited->fetch();

$getGuildMember = $db->query('SELECT `player_id`' . 'FROM `guild_membership`' . 'WHERE `player_id` = ' . $getCharacter['id'] . '');
$getGuildMember = $db->query('SELECT `player_id`' . 'FROM `guild_membership`' . 'WHERE `player_id` = ' . $character['id'] . '');
$getGuildMember = $getGuildMember->fetch();

if ($getGuildOwner == 0 && $getGuildInvited == 0 && $getGuildMember == 0) {
Expand All @@ -99,7 +98,7 @@


/* GET MARKET */
$getMarket = $db->query('SELECT `player_id`' . 'FROM `market_offers`' . 'WHERE `player_id` = ' . $getCharacter['id'] . '');
$getMarket = $db->query('SELECT `player_id`' . 'FROM `market_offers`' . 'WHERE `player_id` = ' . $character['id'] . '');
$getMarket = $getMarket->fetch();

if ($getMarket == 0) {
Expand All @@ -123,7 +122,7 @@


/* GET CHARACTER ONLINE */
$getOnline = $db->query('SELECT `player_id`' . 'FROM `players_online`' . 'WHERE `player_id` = ' . $getCharacter['id'] . '');
$getOnline = $db->query('SELECT `player_id`' . 'FROM `players_online`' . 'WHERE `player_id` = ' . $character['id'] . '');
$getOnline = $getOnline->rowCount();

if ($getOnline == 0) {
Expand Down Expand Up @@ -199,7 +198,7 @@
</div>
<br>
<form method="post" action="?subtopic=createcharacterauction&step=3">
<input type="hidden" name="auction_character" value="<?= $getCharacter['id'] ?>">
<input type="hidden" name="auction_character" value="<?= $character['id'] ?>">
<div class="TableContainer">
<div class="CaptionContainer">
<div class="CaptionInnerContainer">
Expand Down Expand Up @@ -322,10 +321,12 @@
<a href="?subtopic=createcharacterauction&step=1">
<div class="BigButton"
style="background-image:url(<?= $template_path; ?>/images/global/buttons/sbutton.gif)">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);">
<div class="BigButtonOver"
<div onmouseover="MouseOverBigButton('BackBazaar');"
onmouseout="MouseOutBigButton('BackBazaar');">
<div id="BackBazaar" class="BigButtonOver"
style="background-image: url(<?= $template_path; ?>/images/global/buttons/sbutton_over.gif); visibility: hidden;"></div>
<input class="BigButtonText" type="button" value="Back"></div>
<input class="BigButtonText" type="button" value="Back">
</div>
</div>
</a>
</div>
Expand All @@ -335,19 +336,21 @@
<?php if ($next_truecount == 9) { ?>
<div class="BigButton"
style="background-image:url(<?= $template_path; ?>/images/global/buttons/sbutton_green.gif)">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);">
<div class="BigButtonOver"
<div onmouseover="MouseOverBigButton('NextBazaar');"
onmouseout="MouseOutBigButton('NextBazaar');">
<div id="NextBazaar" class="BigButtonOver"
style="background-image: url(<?= $template_path; ?>/images/global/buttons/sbutton_green_over.gif); visibility: hidden;"></div>
<input name="auction_submit" class="BigButtonText" type="submit" value="Next">
</div>
</div>
<?php } else { ?>
<div class="BigButton"
style="background-image:url(<?= $template_path; ?>/images/global/buttons/sbutton_red.gif)">
<div onmouseover="MouseOverBigButton(this);" onmouseout="MouseOutBigButton(this);">
<div class="BigButtonOver"
<div onmouseover="MouseOverBigButton('ErrorBazaar');"
onmouseout="MouseOutBigButton('ErrorBazaar');">
<div id="ErrorBazaar" class="BigButtonOver"
style="background-image: url(<?= $template_path; ?>/images/global/buttons/sbutton_red_over.gif); visibility: hidden;"></div>
<input name="auction_submit" class="BigButtonText" type="button" value="Erro">
<input class="BigButtonText" type="button" value="Error">
</div>
</div>
<?php } ?>
Expand Down
Loading

0 comments on commit ba526ea

Please sign in to comment.