Пример #1
0
 public function createGuild($name, $character)
 {
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $player = new OTS_Player();
     $player->load($character);
     $new_guild = new OTS_Guild();
     $new_guild->setCreationData(time());
     $new_guild->setName($name);
     $new_guild->setOwner($player);
     $new_guild->save();
     $new_guild->setCustomField('motd', 'New guild. Leader must edit this text :)');
     $new_guild->setCustomField('creationdata', time());
     $new_guild->setCustomField('world_id', $player->getWorld());
     $ranks = $new_guild->getGuildRanksList();
     $ranks->orderBy('level', POT::ORDER_DESC);
     foreach ($ranks as $rank) {
         if ($rank->getLevel() == 3) {
             $player->setRank($rank);
             $player->save();
         }
     }
     $ide = new IDE();
     $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $new_guild->getId());
     success("{$name} has been created.");
 }
Пример #2
0
 /**
  * Checks highest access level of account in given guild.
  * 
  * @param OTS_Guild $guild Guild in which access should be checked.
  * @return int Access level (highest access level of all characters).
  * @throws PDOException On PDO operation error.
  */
 public function getGuildAccess(OTS_Guild $guild)
 {
     // by default
     $access = 0;
     // finds ranks of all characters
     foreach ($this->getPlayersList() as $player) {
         $rank = $player->getRank();
         // checks if rank's access level is higher then previouls found highest
         if (isset($rank) && $rank->getGuild()->getId() == $guild->getId() && $rank->getLevel() > $access) {
             $access = $rank->getLevel();
         }
     }
     return $access;
 }
Пример #3
0
        $new_guild->setName($guild_name);
        $new_guild->setOwner($player);
        $new_guild->setCustomField('description', 'Nova guild. O líder deve editar esse texto!');
        $new_guild->setCustomField('creationdata', time());
        $new_guild->setCustomField('world_id', $player->getWorld());
        $new_guild->save();
        $ranks = $new_guild->getGuildRanksList();
        $ranks->orderBy('level', POT::ORDER_DESC);
        foreach ($ranks as $rank) {
            if ($rank->getLevel() == 3) {
                $player->setRank($rank);
                $player->save();
            }
        }
        $new_guild->save();
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD CLASS=white><B><center>Criar Guild</center></B></TD></TR><TR BGCOLOR=' . $config['site']['darkborder'] . '><TD WIDTH=100%><b><center>Parabéns!</center></b><br /><p class="justify">Você criou a guild <b>' . $guild_name . '</b>. <b>' . $player->getName() . '</b> é o dono(a) dessa nova guild. Você agora pode convidar outros jogadores, modificar o logotipo, a descrição e o MOTD (Message of the day) da sua guild. Vá na página de sua guild e clique no botão "Gerenciar Guild" para fazer qualquer modificação.</TD></TR></TABLE><br /><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="index.php?subtopic=guilds&action=show&guild=' . $new_guild->getId() . '" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="' . $layout_name . '/images/buttons/sbutton_Submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    } else {
        $main_content .= 'Preencha os campos abaixo para criar uma guild.<br /> Você deve ter um personagem sem guild e acima do nível ' . $config['site']['guild_need_level'] . ' para ser o dono dessa nova guild.<br><br />
		<FORM ACTION="index.php?subtopic=guilds&action=createguild&todo=save" METHOD=post>
		<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
		<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Criar Guild</B></TD></TR>
		<TR><TD BGCOLOR="' . $config['site']['darkborder'] . '"><TABLE BORDER=0 CELLSPACING=8 CELLPADDING=0>
		  <TR><TD>
		    <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>';
        $main_content .= '<TR><TD width="150" valign="top"><B>Dono da guild: </B></TD><TD><SELECT name=\'name\'>';
        if (count($array_of_player_nig) > 0) {
            sort($array_of_player_nig);
            foreach ($array_of_player_nig as $nick) {
                $main_content .= '<OPTION>' . $nick . '</OPTION>';
            }
        }
Пример #4
0
        $new_guild->setCreationData($time);
        $new_guild->setName($guild_name);
        $new_guild->setOwner($player);
        $new_guild->save();
        $new_guild->setCustomField('description', 'New guild. Leader must edit this text :)');
        $new_guild->setCustomField('creationdata', time());
        $new_guild->setCustomField('world_id', $player->getWorld());
        $ranks = $new_guild->getGuildRanksList();
        $ranks->orderBy('level', POT::ORDER_DESC);
        foreach ($ranks as $rank) {
            if ($rank->getLevel() == 3) {
                $player->setRank($rank);
                $player->save();
            }
        }
        $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR=' . $config['site']['vdarkborder'] . '><TD CLASS=white><B>Create guild</B></TD></TR><TR BGCOLOR=' . $config['site']['darkborder'] . '><TD WIDTH=100%><b>Congratulations!</b><br/>You have created guild <b>' . $guild_name . '</b>. <b>' . $player->getName() . '</b> is leader of this guild. Now you can invite players, change picture, description and motd of guild. Press submit to open guild manager.</TD></TR></TABLE><br/><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><FORM ACTION="?subtopic=guilds&action=show&guild=' . $new_guild->getId() . '" METHOD=post><TR><TD><center><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="' . $layout_name . '/images/buttons/sbutton_Submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center></TD></TR></FORM></TABLE>';
    } else {
        $main_content .= 'To play on ' . $config['server']['serverName'] . ' you need an account. 
		All you have to do to create your new account is to enter your email address, password to new account, verification code from picture and to agree to the terms presented below. 
		If you have done so, your account number, password and e-mail address will be shown on the following page and your account and password will be sent 
		to your email address along with further instructions.<BR><BR>
		<FORM ACTION="?subtopic=guilds&action=createguild&todo=save" METHOD=post>
		<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
		<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Create a ' . $config['server']['serverName'] . ' Account</B></TD></TR>
		<TR><TD BGCOLOR="' . $config['site']['darkborder'] . '"><TABLE BORDER=0 CELLSPACING=8 CELLPADDING=0>
		  <TR><TD>
		    <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>';
        $main_content .= '<TR><TD width="150" valign="top"><B>Leader: </B></TD><TD><SELECT name=\'name\'>';
        if (count($array_of_player_nig) > 0) {
            sort($array_of_player_nig);
            foreach ($array_of_player_nig as $nick) {
Пример #5
0
 /**
  * Assigns rank to guild.
  * 
  * <p>
  * This method only updates object state. To save changes in database you need to use {@link OTS_GuildRank::save() save() method} to flush changed to database.
  * </p>
  * 
  * @param OTS_Guild $guild Owning guild.
  * @throws E_OTS_NotLoaded If given <var>$guild</var> object is not loaded.
  */
 public function setGuild(OTS_Guild $guild)
 {
     $this->data['guild_id'] = $guild->getId();
 }