Esempio n. 1
0
 public function getMembers($forceReload = false)
 {
     if (!isset($this->members) || $forceReload) {
         $members = new DatabaseList('Player');
         $members->setFilter(new SQL_Filter(new SQL_Field('rank_id'), SQL_Filter::EQUAL, $this->getID()));
         $members->addOrder(new SQL_Order(new SQL_Field('name')));
         $this->members = $members;
     }
     return $this->members;
 }
Esempio n. 2
0
 public function getMembers($forceReload = false)
 {
     if (!isset($this->members) || $forceReload) {
         $members = new DatabaseList('Player');
         $filterGuild = new SQL_Filter(new SQL_Field('rank_id', 'guild_membership'), SQL_Filter::EQUAL, $this->getID());
         $filterPlayer = new SQL_Filter(new SQL_Field('id', 'players'), SQL_Filter::EQUAL, new SQL_Field('player_id', 'guild_membership'));
         $members->setFilter(new SQL_Filter($filterGuild, SQL_Filter::CRITERIUM_AND, $filterPlayer));
         $members->addOrder(new SQL_Order(new SQL_Field('name', 'players')));
         $this->members = $members;
     }
     return $this->members;
 }
Esempio n. 3
0
 public function __construct($type, $limit = 5, $page = 0, $worldId = 0, $vocation = '')
 {
     $this->highscoreConfig = Website::getWebsiteConfig();
     parent::__construct();
     $this->skillType = $type;
     $this->setLimit($limit);
     $this->setOffset($page * $limit);
     $this->worldId = $worldId;
     $this->vocation = $vocation;
     switch ($type) {
         case self::SKILL_FIST:
         case self::SKILL_CLUB:
         case self::SKILL_SWORD:
         case self::SKILL_AXE:
         case self::SKILL_DISTANCE:
         case self::SKILL_SHIELD:
         case self::SKILL_FISHING:
             $this->loadSkill();
             break;
         case self::SKILL__MAGLEVEL:
             $this->loadMagic();
             break;
         case self::SKILL__LEVEL:
             $this->loadLevel();
             break;
         default:
             new Error_Critic('', __METHOD__ . '(), unknown type: ' . htmlspecialchars($type));
             break;
     }
 }
Esempio n. 4
0
 public function load()
 {
     $this->setClass('Item');
     parent::load();
     if (count($this->data) > 0) {
         $_new_items = array();
         $_new_data = array();
         foreach ($this->data as $i => $item) {
             $_new_items[$i] = new Item($item);
             $_new_data[] =& $_new_items[$i];
         }
         $this->data = $_new_data;
     }
 }
Esempio n. 5
0
<img id="ContentBoxHeadline" class="Title" src="layouts/tibiacom/images/header/headline-killstatistics.gif" alt="Contentbox headline">
<?php 
if (!defined('INITIALIZED')) {
    exit;
}
$players_deaths = new DatabaseList('PlayerDeath');
$players_deaths->setFilter(new SQL_Filter(new SQL_Field('id', 'players'), SQL_Filter::EQUAL, new SQL_Field('player_id', 'player_deaths')));
$players_deaths->addOrder(new SQL_Order(new SQL_Field('time'), SQL_Order::DESC));
$players_deaths->setLimit(50);
$players_deaths_count = 0;
foreach ($players_deaths as $death) {
    $bgcolor = $players_deaths_count++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
    $players_rows .= '<TR BGCOLOR="' . $bgcolor . '"><TD WIDTH="30"><center>' . $players_deaths_count . '.</center></TD><TD WIDTH="125"><small>' . date("j.m.Y, G:i:s", $death->getTime()) . '</small></TD><TD><a href="index.php?subtopic=characters&name=' . urlencode($death->data['name']) . '">' . htmlspecialchars($death->data['name']) . '</a> at level ' . $death->getLevel() . ' by ' . $death->getKillerString();
    if ($death->getMostDamageString() != '' && $death->getKillerString() != $death->getMostDamageString()) {
        $players_rows .= ' and ' . $death->getMostDamageString();
    }
    $players_rows .= '</TD></TR>';
}
if ($players_deaths_count == 0) {
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="' . $config['site']['vdarkborder'] . '"><TD CLASS=white><B>Last Deaths</B></TD></TR><TR BGCOLOR=' . $config['site']['darkborder'] . '><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>No one died on ' . htmlspecialchars($config['server']['serverName']) . '.</TD></TR></TABLE></TD></TR></TABLE><BR>';
} else {
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="' . $config['site']['vdarkborder'] . '"><TD CLASS=white><B>Last Deaths</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>' . $players_rows . '</TABLE>';
}
Esempio n. 6
0
            header("Location: ?subtopic=guilds");
        } elseif ($redirect == 'guild') {
            header("Location: ?subtopic=guilds&action=show&guild=" . urlencode($guild));
        } else {
            $main_content .= 'Wrong address to redirect!';
        }
    }
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//show list of guilds
if ($action == '') {
    $world_name = $config['server']['serverName'];
    $guilds_list = new DatabaseList('Guild');
    $guilds_list->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
    $main_content .= '<h2><center>Guilds on ' . htmlspecialchars($world_name) . '</center></h2><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
	<TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD COLSPAN=3 CLASS=white><B>Guilds on ' . htmlspecialchars($world_name) . '</B></TD></TR>
	<TR BGCOLOR=' . $config['site']['darkborder'] . '><TD WIDTH=64><B>Logo</B></TD>
	<TD WIDTH=100%><B>Description</B></TD>
	<TD WIDTH=56><B>&#160;</B></TD></TR>';
    $showed_guilds = 1;
    if (count($guilds_list) > 0) {
        foreach ($guilds_list as $guild) {
            if (is_int($showed_guilds / 2)) {
                $bgcolor = $config['site']['darkborder'];
            } else {
                $bgcolor = $config['site']['lightborder'];
            }
            $showed_guilds++;
Esempio n. 7
0
 public function unban()
 {
     $bans = new DatabaseList('Ban');
     $filterType = new SQL_Filter(new SQL_Field('type'), SQL_Filter::EQUAL, Ban::TYPE_ACCOUNT);
     $filterValue = new SQL_Filter(new SQL_Field('value'), SQL_Filter::EQUAL, $this->data['id']);
     $filterActive = new SQL_Filter(new SQL_Field('active'), SQL_Filter::EQUAL, 1);
     $filter = new SQL_Filter($filterType, SQL_Filter::CRITERIUM_AND, $filterValue);
     $filter = new SQL_Filter($filter, SQL_Filter::CRITERIUM_AND, $filterActive);
     $bans->setFilter($filter);
     foreach ($bans as $ban) {
         $ban->setActive(0);
         $ban->save();
     }
 }
Esempio n. 8
0
<?php

if (!defined('INITIALIZED')) {
    exit;
}
$playerNamelocks = new DatabaseList('PlayerNamelocks');
$playerNamelocks->addOrder(new SQL_Order(new SQL_Field('date'), SQL_Order::DESC));
$main_content .= '<center><h2>Namelocks list</h2></center>';
$main_content .= "<table border=0 cellspacing=1 cellpadding=4 width=100%>\n\t<tr bgcolor=\"" . $config['site']['vdarkborder'] . "\">\n\t<td><font class=white><b>Current Name</b></font></td>\n\t<td><font class=white><b>Old Names</b></font></td>";
if (count($playerNamelocks) > 0) {
    $playersNamelocksInfo = array();
    foreach ($playerNamelocks as $namelock) {
        if (!isset($playersNamelocksInfo[$namelock->getID()])) {
            $playersNamelocksInfo[$namelock->getID()] = array();
            $playersNamelocksInfo[$namelock->getID()]['name'] = $namelock->getNewName();
            $playersNamelocksInfo[$namelock->getID()]['oldNames'] = array();
            $playersNamelocksInfo[$namelock->getID()]['oldNames'][] = $namelock;
        } else {
            $playersNamelocksInfo[$namelock->getID()]['oldNames'][] = $namelock;
        }
    }
    $old_names_text = array();
    foreach ($playersNamelocksInfo as $playerInfo) {
        $old_names_text = array();
        foreach ($playerInfo['oldNames'] as $oldName) {
            $old_names_text[] = 'until ' . date("j F Y, g:i a", $oldName->getDate()) . ' known as <b>' . htmlspecialchars($oldName->getName()) . '</b>';
        }
        $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
        $main_content .= '<tr bgcolor="' . $bgcolor . '"><td style="vertical-align:top"><a href="?subtopic=characters&name=' . urlencode($playerInfo['name']) . '">' . htmlspecialchars($playerInfo['name']) . '</a></td><td>' . implode('<br />', $old_names_text) . '</td></tr>';
    }
} else {
Esempio n. 9
0
 public function isNamelocked()
 {
     $bans = new DatabaseList('Ban');
     $filterType = new SQL_Filter(new SQL_Field('type'), SQL_Filter::EQUAL, Ban::TYPE_PLAYER);
     $filterParam = new SQL_Filter(new SQL_Field('param'), SQL_Filter::EQUAL, Ban::PLAYERBAN_LOCK);
     $filterValue = new SQL_Filter(new SQL_Field('value'), SQL_Filter::EQUAL, $this->data['id']);
     $filterActive = new SQL_Filter(new SQL_Field('active'), SQL_Filter::EQUAL, 1);
     $filter = new SQL_Filter($filterType, SQL_Filter::CRITERIUM_AND, $filterValue);
     $filter = new SQL_Filter($filter, SQL_Filter::CRITERIUM_AND, $filterActive);
     $filter = new SQL_Filter($filter, SQL_Filter::CRITERIUM_AND, $filterParam);
     $bans->setFilter($filter);
     return count($bans) > 0;
 }
Esempio n. 10
0
     $number_of_quests = 0;
     foreach ($config['site']['quests'] as $questName => $storageID) {
         $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
         $number_of_quests++;
         $main_content .= '<TR BGCOLOR="' . $bgcolor . '"><TD WIDTH=95%>' . $questName . '</TD>';
         if ($player->getStorage($storageID) === null) {
             $main_content .= '<TD><img src="images/false.png"/></TD></TR>';
         } else {
             $main_content .= '<TD><img src="images/true.png"/></TD></TR>';
         }
     }
     $main_content .= '</TABLE></td></tr></table><br />';
 }
 $deads = 0;
 //deaths list
 $player_deaths = new DatabaseList('PlayerDeath');
 $player_deaths->setFilter(new SQL_Filter(new SQL_Filter(new SQL_Field('player_id'), SQL_Filter::EQUAL, $player->getId()), SQL_Filter::CRITERIUM_AND, new SQL_Filter(new SQL_Field('id', 'players'), SQL_Filter::EQUAL, new SQL_Field('player_id', 'player_deaths'))));
 $player_deaths->addOrder(new SQL_Order(new SQL_Field('time'), SQL_Order::DESC));
 $player_deaths->setLimit(20);
 foreach ($player_deaths as $death) {
     $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
     $deads++;
     $dead_add_content .= "<tr bgcolor=\"" . $bgcolor . "\"><td width=\"20%\" align=\"center\">" . date("j M Y, H:i", $death->getTime()) . "</td><td>Died at level " . $death->getLevel() . " by " . $death->getKillerString();
     if ($death->getMostDamageString() != '' && $death->getKillerString() != $death->getMostDamageString()) {
         $dead_add_content .= ' and ' . $death->getMostDamageString();
     }
     $dead_add_content .= "</td></tr>";
 }
 if ($deads > 0) {
     $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="' . $config['site']['vdarkborder'] . '"><TD COLSPAN=2 CLASS=white><B>Character Deaths</B></TD></TR>' . $dead_add_content . '</TABLE><br />';
 }
Esempio n. 11
0
 public function acceptInvite($player)
 {
     $ranks = new DatabaseList('GuildRank');
     $ranks->setFilter(new SQL_Filter(new SQL_Field('guild_id'), SQL_Filter::EQUAL, $this->getID()));
     $ranks->addOrder(new SQL_Order(new SQL_Field('level'), SQL_Order::ASC));
     // load rank with lowest access level
     if ($rank = $ranks->getResult(0)) {
         $player->setRank($rank);
         $player->save();
         $player->removeGuildInvitations();
     } else {
         new Error_Critic('', 'There is no rank in guild <b>' . htmlspecialchars($guild->getName()) . '</b>, cannot add player <b>' . htmlspecialchars($player->getName()) . '</b> to guild.');
     }
 }
Esempio n. 12
0
    }
    if (count($config['site']['worlds']) > 1) {
        $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD></TD><TD>
		<FORM ACTION="" METHOD=get><INPUT TYPE="hidden" NAME="subtopic" VALUE="guilds"><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>World Selection</B></TD></TR><TR><TD BGCOLOR="' . $config['site']['darkborder'] . '">
		<TABLE BORDER=0 CELLPADDING=1><TR><TD>Guilds on world:</TD><TD><SELECT SIZE="1" NAME="world">';
        foreach ($config['site']['worlds'] as $id => $world_n) {
            if ($id == $world_id) {
                $main_content .= '<OPTION VALUE="' . $id . '" selected="selected">' . htmlspecialchars($world_n) . '</OPTION>';
            } else {
                $main_content .= '<OPTION VALUE="' . $id . '">' . htmlspecialchars($world_n) . '</OPTION>';
            }
        }
        $main_content .= '</SELECT> </TD><TD><INPUT TYPE="image" NAME="Submit" ALT="Submit" SRC="' . $layout_name . '/images/buttons/sbutton_submit.gif">
			</TD></TR></TABLE></TABLE></FORM></TABLE>';
    }
    $guilds_list = new DatabaseList('Guild');
    $filterWorld = new SQL_Filter(new SQL_Field('world_id', 'guilds'), SQL_Filter::EQUAL, $world_id);
    $guilds_list->setFilter($filterWorld);
    $guilds_list->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
    $main_content .= '<h2><center>Guilds on ' . htmlspecialchars($world_name) . '</center></h2><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
	<TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD COLSPAN=3 CLASS=white><B>Guilds on ' . htmlspecialchars($world_name) . '</B></TD></TR>
	<TR BGCOLOR=' . $config['site']['darkborder'] . '><TD WIDTH=64><B>Logo</B></TD>
	<TD WIDTH=100%><B>Description</B></TD>
	<TD WIDTH=56><B>&#160;</B></TD></TR>';
    $showed_guilds = 1;
    if (count($guilds_list) > 0) {
        foreach ($guilds_list as $guild) {
            if (is_int($showed_guilds / 2)) {
                $bgcolor = $config['site']['darkborder'];
            } else {
                $bgcolor = $config['site']['lightborder'];
Esempio n. 13
0
     }
 }
 if ($guild_leader) {
     $currentWars = array();
     $wars = new DatabaseList('GuildWar');
     foreach ($wars as $war) {
         if ($war->getStatus() == GuildWar::STATE_INVITED || $war->getStatus() == GuildWar::STATE_ON_WAR) {
             if ($war->getGuild1ID() == $guild->getID()) {
                 $currentWars[$war->getGuild2ID()] = $war->getStatus();
             } elseif ($war->getGuild2ID() == $guild->getID()) {
                 $currentWars[$war->getGuild1ID()] = $war->getStatus();
             }
         }
     }
     $main_content .= '<center><h1>' . htmlspecialchars($guild->getName()) . ' vs. ???</h2></center><br /><h3>Choose your enemy!</h3><br /><table width="100%" border="0" cellspacing="1" cellpadding="4">';
     $guildsList = new DatabaseList('Guild');
     $guildsList->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
     $shown_guilds = 0;
     foreach ($guildsList as $enemyGuild) {
         if (is_int($shown_guilds / 2)) {
             $bgcolor = $config['site']['darkborder'];
         } else {
             $bgcolor = $config['site']['lightborder'];
         }
         $shown_guilds++;
         $main_content .= '<tr BGCOLOR="' . $bgcolor . '"><td width="70px"><IMG SRC="guild_image.php?id=' . $enemyGuild->getID() . '" WIDTH="64" HEIGHT="64"></td><td valign="top"><B>' . htmlspecialchars($enemyGuild->getName()) . '</B></td><td>';
         if ($enemyGuild->getID() != $guild->getID()) {
             if (isset($currentWars[$enemyGuild->getID()])) {
                 // in war or invited
                 if ($currentWars[$enemyGuild->getID()] == GuildWar::STATE_INVITED) {
                     // guild already invited you or you invited that guild
Esempio n. 14
0
$main_content .= '<td style="vertical-align:top">';
$main_content .= '<input type="radio" name="owner" value="2" id="radio_o2" ' . ($selected_owner == 2 ? 'checked="checked"' : '') . '/><label for="radio_o2">All</label><br />';
$main_content .= '<input type="radio" name="owner" value="0" id="radio_o0" ' . ($selected_owner == 0 ? 'checked="checked"' : '') . '/><label for="radio_o0">Empty</label><br />';
$main_content .= '<input type="radio" name="owner" value="1" id="radio_o1" ' . ($selected_owner == 1 ? 'checked="checked"' : '') . '/><label for="radio_o1">Rented</label>';
$main_content .= '</td>';
$selected_order = 'name';
if (isset($_REQUEST['order'])) {
    $selected_order = $_REQUEST['order'];
}
$main_content .= '<td style="vertical-align:top">';
$main_content .= '<input type="radio" name="order" value="name" id="radio_s0" ' . ($selected_order == 'name' ? 'checked="checked"' : '') . '/><label for="radio_s0">Name</label><br />';
$main_content .= '<input type="radio" name="order" value="size" id="radio_s1" ' . ($selected_order == 'size' ? 'checked="checked"' : '') . '/><label for="radio_s1">Size</label>';
$main_content .= '</td></tr>';
$main_content .= '<tr><td colspan="3" style="text-align:right"><input type="image" name="Submit" alt="Submit" src="' . $layout_name . '/images/buttons/sbutton_submit.gif"></td></tr></table></form>';
if (isset($_REQUEST['town']) && isset($_REQUEST['owner']) && isset($_REQUEST['order'])) {
    $houses = new DatabaseList('House');
    $filterTown = new SQL_Filter(new SQL_Field('townid'), SQL_Filter::EQUAL, $_REQUEST['town']);
    if ($_REQUEST['owner'] == 0) {
        $filterOwner = new SQL_Filter(new SQL_Field('owner'), SQL_Filter::EQUAL, 0);
        $filter = new SQL_Filter($filterTown, SQL_Filter::CRITERIUM_AND, $filterOwner);
    } elseif ($_REQUEST['owner'] == 1) {
        $filterOwner = new SQL_Filter(new SQL_Field('owner'), SQL_Filter::NOT_EQUAL, 0);
        $filter = new SQL_Filter($filterTown, SQL_Filter::CRITERIUM_AND, $filterOwner);
    } else {
        $filter = $filterTown;
    }
    $houses->setFilter($filter);
    if ($_REQUEST['order'] == 'size') {
        $houses->addOrder(new SQL_Order(new SQL_Field('tiles', 'houses'), SQL_Order::DESC));
    } else {
        $houses->addOrder(new SQL_Order(new SQL_Field('name', 'houses')));