コード例 #1
0
ファイル: guilds_model.php プロジェクト: Alexy234/modernaac
 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
function delete_guild($id)
{
    $guild = new OTS_Guild();
    $guild->load($id);
    if ($guild->isLoaded()) {
        $rank_list = $guild->getGuildRanksList();
        if (count($rank_list) > 0) {
            $rank_list->orderBy('level');
            foreach ($rank_list as $rank_in_guild) {
                $players_with_rank = $rank_in_guild->getPlayersList();
                if (count($players_with_rank) > 0) {
                    foreach ($players_with_rank as $player_in_guild) {
                        $player_in_guild->setRank();
                        $player_in_guild->save();
                    }
                }
                $rank_in_guild->delete();
            }
        }
        $guild->delete();
        return TRUE;
    } else {
        return FALSE;
    }
}
コード例 #3
0
ファイル: guilds.php プロジェクト: s3kk/Gesior
        foreach ($guild_errors as $guild_error) {
            $main_content .= '<li>' . $guild_error;
        }
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url(' . $layout_name . '/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
        unset($todo);
    }
    if ($todo == 'save') {
        $new_guild = new OTS_Guild();
        $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>