コード例 #1
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Userbar creation');
     $image = null;
     $model = new UserbarForm();
     if (isset($_POST['UserbarForm'])) {
         $model->attributes = $_POST['UserbarForm'];
         if ($model->validate()) {
             $criteria = new CDbCriteria();
             $criteria->select = 'id, name, exp, gender, race, player_class';
             $player = Players::model()->with('abyssRank', 'lifeStats')->findByPK($model->player_id);
             $criteria = new CDbCriteria();
             $criteria->select = 'name';
             $legion = Legions::model()->with(array('legionMembers' => array('joinType' => 'INNER JOIN', 'condition' => 'player_id = ' . $model->player_id)))->find();
             if ($legion == NULL) {
                 $legion->name = null;
             }
             Yii::app()->ih->load($_SERVER['DOCUMENT_ROOT'] . Yii::app()->baseUrl . '/images/userbars/ub' . $model->fon . '.png')->text($player->name, Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_TOP, 8, 8)->text($player->name, Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->name), CImageHandler::CORNER_LEFT_TOP, 8, 7)->text($legion->name, Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_TOP, 8, 36)->text($legion->name, Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->legion), CImageHandler::CORNER_LEFT_TOP, 8, 35)->text(Info::class_text($player->player_class) . ', ' . $this->genderRace($player->gender, $player->race), Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_BOTTOM, 8, 9)->text(Info::class_text($player->player_class) . ', ' . $this->genderRace($player->gender, $player->race), Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->class_race), CImageHandler::CORNER_LEFT_BOTTOM, 8, 10)->text(Info::lvl($player->exp) . ' Level', Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_TOP, 8, 6)->text(Info::lvl($player->exp) . ' Level', Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->level), CImageHandler::CORNER_RIGHT_TOP, 8, 5)->text($player->abyssRank->all_kill . '/' . $player->abyssRank->weekly_kill . ' Kills', Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_TOP, 8, 34)->text($player->abyssRank->all_kill . '/' . $player->abyssRank->weekly_kill . ' Kills', Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->kills), CImageHandler::CORNER_RIGHT_TOP, 8, 33)->text($player->lifeStats->hp . ' HP, ' . $player->lifeStats->mp . ' MP', Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_BOTTOM, 8, 9)->text($player->lifeStats->hp . ' HP, ' . $player->lifeStats->mp . ' MP', Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->stats), CImageHandler::CORNER_RIGHT_BOTTOM, 8, 10)->save($_SERVER['DOCUMENT_ROOT'] . Yii::app()->baseUrl . '/userbars/' . $model->player_id . '.png');
             $image = Yii::app()->homeUrl . 'userbars/' . $model->player_id . '.png';
         }
     }
     $this->render('/userbar', array('model' => $model, 'players' => Players::getPlayers(), 'image' => $image));
 }
コード例 #2
0
ファイル: Players.php プロジェクト: noiary/Aion-Core-v4.7.5
 public function getPlayers()
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'id, name, exp, race, player_class, creation_date';
     $criteria->condition = 'account_id = ' . Yii::app()->user->id;
     return Players::model()->findAll($criteria);
 }
コード例 #3
0
 /**
  * The add action
  */
 public function addAction()
 {
     $auth = $this->session->get('auth');
     if ($auth) {
         $this->_bc->add('Add', 'awards/add');
         $allEpisodes = Episodes::find(array('order' => 'air_date DESC'));
         $allUsers = Users::find(array('order' => 'username'));
         $allPlayers = Players::find(array('order' => 'active DESC, name'));
         $this->view->setVar('users', $allUsers);
         $this->view->setVar('episodes', $allEpisodes);
         $this->view->setVar('players', $allPlayers);
         if ($this->request->isPost()) {
             $datetime = date('Y-m-d H:i:s');
             $award = new Awards();
             $award->userId = $this->request->getPost('user_id', 'int');
             $award->episodeId = $this->request->getPost('episode_id', 'int');
             $award->playerId = $this->request->getPost('player_id', 'int');
             $award->award = $this->request->getPost('award', 'int');
             if (!$award->save()) {
                 foreach ($award->getMessages() as $message) {
                     $this->flash->error((string) $message);
                 }
             } else {
                 $this->view->disable();
                 $this->flash->success('Award created successfully');
                 $this->invalidateCache();
                 $this->response->redirect('awards/');
             }
         }
     }
 }
コード例 #4
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Send mail');
     $model = new Mail();
     if (isset($_POST['Mail'])) {
         $model->attributes = $_POST['Mail'];
         $player_id = Players::model()->find('name = "' . $model->player_name . '"');
         if ($player_id->online == 1) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Error - You must first log out of the game server.') . '</div>');
         }
         $criteria = new CDbCriteria();
         $criteria->select = 'MAX(mail_unique_id) as mail_unique_id';
         $last_mail_id = Mail::model()->find($criteria);
         $model->mail_unique_id = $last_mail_id->mail_unique_id + 1;
         $model->mail_recipient_id = $player_id->id;
         $model->sender_name = 'ServerWebsite';
         $model->mail_title = $model->mail_title;
         $model->mail_message = $model->mail_message . "\n\nThis has been sent via our server website.  Please, do not reply.";
         $model->unread = 1;
         // Fallenfate - Add function to send kinah to players.
         if ($model->item_count != NULL || $model->item_count != "") {
             $model->attached_item_id = 0;
             $model->attached_kinah_count = $model->item_count;
         }
         $model->express = 1;
         if ($model->save(false)) {
             Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('main', 'Mail sent!') . '</div>');
             $this->refresh();
         }
     }
     $this->render('/admin/mail', array('model' => $model));
 }
コード例 #5
0
 public function actionView($id)
 {
     $model = Players::model();
     $player = $model->findByPk($id);
     $count = $model->count('last_seen > ' . (time() - 60 * 60 * 24 * 7));
     // Вывод всего на вьюху
     $this->render('view', array('model' => $player, 'count' => $count));
 }
コード例 #6
0
ファイル: migration.php プロジェクト: kimblemj/server
 public static function linkV1EditorToV2User($editorName, $editorPass = false, $v2UserId = false, $v2Key = false)
 {
     /*Huge hack to allow for either v1 style access or v2 access*/
     if (!$editorPass) {
         $data = file_get_contents("php://input");
         $glob = json_decode($data);
         $editorName = $glob->v1_name;
         $editorPass = $glob->v1_pass;
         $v2UserId = $glob->auth->user_id;
         $v2Key = $glob->auth->key;
     }
     /*End huge hack*/
     $Players = new Players();
     $Editors = new Editors();
     $v1Player = $Players->getLoginPlayerObject($editorName, $editorPass)->data;
     $v1Editor = $Editors->getToken($editorName, $editorPass, "read_write")->data;
     //v1 player optional, v1 editor not
     if (!$v1Editor) {
         return new migration_return_package(1, NULL, "Editor Credentials Invalid");
     }
     $loginPack = new stdClass();
     $loginPack->auth = new stdClass();
     $loginPack->auth->user_id = $v2UserId;
     $loginPack->auth->key = $v2Key;
     $loginPack->no_auto_migrate = true;
     //negative var name because it's a hack and we want the default to be nonexistant
     $v2User = bridgeService("v2", "users", "logIn", "", $loginPack);
     if ($v2User->returnCode != 0) {
         return new migration_return_package(1, NULL, "Invalid v2 credentials");
     }
     $v2User = $v2User->data;
     //clear out existing links to v1 data
     if ($v1Player && ($mig = migration_dbconnection::queryObject("SELECT * FROM user_migrations WHERE v1_player_id = '{$v1Player->player_id}'"))) {
         $v1Player = false;
         //v1 player migrated under diff account- don't try to link
     }
     if ($v1Editor && migration_dbconnection::queryObject("SELECT * FROM user_migrations WHERE v1_editor_id = '{$v1Editor->editor_id}'")) {
         if (!$mig->v1_player_id) {
             migration_dbconnection::query("DELETE FROM user_migrations WHERE v1_editor_id = '{$v1Editor->editor_id}'");
         } else {
             migration_dbconnection::query("UPDATE user_migrations SET v1_editor_id = '0' WHERE v1_editor_id = '{$v1Editor->editor_id}'");
         }
     }
     if (!$v1Player) {
         $v1Player = new stdClass();
         $v1Player->player_id = 0;
     }
     if (!$v1Editor) {
         $v1Editor = new stdClass();
         $v1Editor->editor_id = 0;
     }
     migration_dbconnection::query("DELETE FROM user_migrations WHERE v2_user_id = '{$v2User->user_id}'");
     //clear out any previous migration data for v2 user
     migration_dbconnection::query("INSERT INTO user_migrations (v2_user_id, v2_read_write_key, v1_player_id, v1_editor_id, v1_read_write_token) VALUES ('{$v2User->user_id}', '{$v2User->read_write_key}', '{$v1Player->player_id}', '{$v1Editor->editor_id}', '{$v1Editor->read_write_token}')");
     return new migration_return_package(0, true);
 }
コード例 #7
0
ファイル: SiteController.php プロジェクト: DmitriyS/CS-Bans
 /**
  * Главная страница сайта
  */
 public function actionIndex()
 {
     // Вытаскиваем 10 последних банов
     $dependecy = new CDbCacheDependency('SELECT MAX(`bid`) FROM {{bans}}');
     $bans = new CActiveDataProvider(Bans::model()->cache(300, $dependecy), array('criteria' => array('condition' => Yii::app()->config->auto_prune ? 'expired = 0' : null, 'order' => 'bid DESC', 'limit' => 10), 'pagination' => false));
     // Вытаскиваем 10 лучших игроков
     $dependecy = new CDbCacheDependency('SELECT MAX(`id`) FROM `bio_players`');
     $players = new CActiveDataProvider(Players::model()->cache(300, $dependecy), array('criteria' => array('select' => '`id`, `nick`, ' . Players::sql_skill_formula() . ' AS `skill`', 'order' => '`skill` DESC, `id` ASC', 'condition' => 'last_seen > ' . (time() - 60 * 60 * 24 * 7), 'limit' => 10), 'pagination' => false));
     $this->render('index', array('bans' => $bans, 'players' => $players, 'servers' => Serverinfo::model()->findAll()));
 }
コード例 #8
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Character list');
     $criteria = new CDbCriteria();
     $criteria->select = 'name, account_id, account_name, exp, race, player_class, creation_date';
     $criteria->join = 'INNER JOIN ' . Config::db('db') . '.log_referals ON (log_referals.slave_id = t.account_id AND log_referals.master_id = "' . Yii::app()->user->id . '" AND status = "unpaid")';
     $referals = Players::model()->findAll($criteria);
     $form = new LogReferals();
     if (isset($_POST['LogReferals'])) {
         $form->attributes = $_POST['LogReferals'];
         $check_isset = LogReferals::model()->count('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
         if ($check_isset != 1) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>');
             $this->refresh();
         }
         $master = AccountData::model()->find('id = ' . Yii::app()->user->id);
         $check_ip = AccountData::model()->count('id = ' . $form->slave_id . ' AND last_ip = "' . $master->last_ip . '"');
         if ($check_ip != 0) {
             $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
             $log->status = 'blocked';
             $log->update(false);
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>');
             $this->refresh();
         }
         $criteria = new CDbCriteria();
         $criteria->select = 'exp';
         $criteria->condition = 'account_id = ' . $form->slave_id;
         $criteria->order = 'exp DESC';
         $criteria->limit = 1;
         $check_lvl = Players::model()->find($criteria);
         if (Info::lvl($check_lvl->exp) < Config::get('referal_level')) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'Less than the minimum level.') . '</div>');
             $this->refresh();
         }
         $criteria = new CDbCriteria();
         $criteria->condition = 'id = ' . Yii::app()->user->id;
         $money = AccountData::model()->find($criteria);
         $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus');
         $money->save();
         $criteria = new CDbCriteria();
         $criteria->condition = 'id = ' . $form->slave_id;
         $money = AccountData::model()->find($criteria);
         $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus_ref');
         $money->save();
         $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"');
         $log->status = 'complete';
         $log->update(false);
         Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('pers', 'Bonus credit applied!') . '</div>');
         $this->refresh();
     }
     $this->render('/pers', array('model' => Players::getPlayers(), 'referals' => $referals));
 }
コード例 #9
0
ファイル: npcs.php プロジェクト: kimblemj/server
 public function getNpcConversationsForPlayerAfterViewingNode($gameId, $intNpcId, $intPlayerId, $intNodeId)
 {
     //update the player log
     Players::nodeViewed($gameId, $intPlayerId, $intNodeId);
     //get the options for this npc and player
     $conversationsReturnData = Npcs::getConversationsForPlayer($gameId, $intNpcId, $intPlayerId);
     if ($npcReturnData->returnCode > 0) {
         return $optionsReturnData;
     }
     $conversationsArray = $conversationsReturnData->data;
     return new returnData(0, $conversationsArray);
 }
コード例 #10
0
ファイル: WidgetPvp.php プロジェクト: noiary/Aion-Core-v4.7.5
 public function run()
 {
     if (Yii::app()->getController()->id == 'news' && Yii::app()->getController()->action->id == 'index') {
         $criteria = new CDbCriteria();
         $criteria->select = 'name, exp, gender, race, player_class, online';
         $criteria->condition = 'exp > 100';
         $criteria->order = 'weekly_kill DESC, all_kill DESC, ap DESC, gp DESC';
         $criteria->join = 'INNER JOIN ' . Config::db('ls') . '.account_data ON (account_data.id=t.account_id AND account_data.access_level < ' . Config::get('hide_top') . ')';
         $criteria->limit = 10;
         $model = Players::model()->with('abyssRank')->findAll($criteria);
         $this->render('widgetPvp', array('model' => $model));
     }
 }
コード例 #11
0
 public static function playersJSON()
 {
     $players = Players::model()->findAll();
     $_players = array();
     foreach ($players as $player) {
         $tmp = array();
         $tmp['name'] = $player->getFullName(true);
         $tmp['nickname'] = $player->nickname;
         $tmp['female'] = $player->female;
         $_players[] = $tmp;
     }
     return CJSON::encode($_players);
 }
コード例 #12
0
ファイル: notes.php プロジェクト: kimblemj/server
 function createNewNoteStartIncomplete($gameId, $playerId, $lat = 0, $lon = 0)
 {
     $query = "INSERT INTO notes (game_id, owner_id, title, incomplete) VALUES ('{$gameId}', '{$playerId}', 'New Note', '1')";
     Module::query($query);
     if (mysql_error()) {
         return new returnData(1, NULL, mysql_error());
     }
     $nId = mysql_insert_id();
     Module::saveContentNoAuthentication($gameId, false, 0, 'PlayerNote', $nId, 0);
     Module::processGameEvent($playerId, $gameId, Module::kLOG_GET_NOTE, $nId);
     Players::dropNote($gameId, $playerId, $nId, $lat, $lon);
     return new returnData(0, $nId);
 }
コード例 #13
0
 public function actionOnline()
 {
     $this->pageTitle = Yii::t('title', 'Players online');
     $criteria = new CDbCriteria();
     $criteria->select = 'name, account_id, exp, gender, race, player_class, world_id, show_location';
     $criteria->condition = 'online = 1';
     $criteria->order = 'exp DESC, ap DESC';
     $criteria->join = 'INNER JOIN ' . Config::db('ls') . '.account_data ON (account_data.id=t.account_id AND account_data.access_level < ' . Config::get('hide_top') . ')';
     $pages = new CPagination(Players::model()->count($criteria));
     $pages->pageSize = Config::get('page_top');
     $pages->applyLimit($criteria);
     $model = Players::model()->with('abyssRank')->findAll($criteria);
     $this->render('online', array('model' => $model, 'pages' => $pages));
 }
コード例 #14
0
ファイル: commands.php プロジェクト: ryden/ItalyMafia-3.0
 public static function Handle($playerid, $cmdtext)
 {
     $player = Players::FindByID($playerid);
     if ($player == null) {
         return 0;
     }
     //    Log::Append(LOG_COMMAND, "[{$player->id}] {$player->name} -> {$cmdtext}");
     $params = explode(' ', substr($cmdtext, 1));
     $name = strtolower($params[0]);
     if (!isset(CommandHandler::$commands[$name])) {
         return 0;
     }
     $cmd = CommandHandler::$commands[$name];
     if ($cmd->authed && (!$player->account || !$player->account->Authed())) {
         $player->Send(COLOR_RED, '* Login before sending this command');
         return 1;
     }
     $numparams = count($params) - 1;
     if ($numparams < $cmd->numparams) {
         CommandHandler::SendUsage($player, $name, $cmd);
     } else {
         if (!$cmd->Call($player, $numparams, $params)) {
             CommandHandler::SendUsage($player, $name, $cmd);
         }
     }
     return 1;
 }
コード例 #15
0
ファイル: location.php プロジェクト: ryden/ItalyMafia-3.0
 public function Destroy()
 {
     foreach ($this->children as $child) {
         $child->Destroy();
     }
     if ($this->parent) {
         /* Move players to the parent location */
         foreach (Players::Get() as $player) {
             if ($player->location->id == $this->id) {
                 /* Move to the parent location */
                 $player->SetLocation($this->parent);
                 $entrance = $this->GetEntrance();
                 $player->SetPosition($entrance->position);
             }
         }
         $this->parent->RemoveChild($this);
     }
     foreach ($this->entrances as $entrance) {
         if ($entrance->id != -1) {
             DestroyPickup($entrance->id);
         }
         $entrance->location = null;
     }
     $this->entrances = null;
     foreach ($this->objects as $obj) {
         $obj->Destroy();
     }
     $this->objects = null;
     $this->children = null;
     $this->parent = null;
     Locations::Del($this);
     $this->area->Destroy();
     $this->area = null;
 }
コード例 #16
0
ファイル: players.php プロジェクト: kimblemj/server
 private static function getAllPlayerDataBP($gameId, $getItems = true, $getAttributes = true, $getNotes = true)
 {
     $result = Module::query("SELECT DISTINCT player_id FROM player_log WHERE game_id='{$gameId}' AND player_id != 0");
     $players = array();
     while ($player = mysql_fetch_object($result)) {
         $players[] = $player->player_id;
     }
     return Players::getPlayerArrayDataBP($gameId, $players, $getItems, $getAttributes, $getNotes);
 }
コード例 #17
0
ファイル: player.php プロジェクト: ryden/ItalyMafia-3.0
 public function SetAdminLevel($level)
 {
     $this->adminlevel = (int) $level;
     if ($this->adminlevel > 0) {
         /* Show nametags */
         foreach (Players::Get() as $p) {
             $this->CanIdentify($p, true);
         }
     }
 }
コード例 #18
0
ファイル: home.inc.php プロジェクト: Aberos/OTPANEL
                </div>
                
            </div>
            
            <div class="col-lg-3 col-md-6">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <div class="row">
                            <div class="col-xs-3">
                                <i class="fa fa fa-users fa-5x"></i>
                            </div>
                            
                            
                            <div class="col-xs-9 text-right">
                                <div class="huge"><?php 
echo Players::GetCount();
?>
</div>
                                <div>Players</div>
                            </div>
                        </div>
                    </div>
                    <a href="painel.php?exe=players">
                        <div class="panel-footer">
                            <span class="pull-left">Ver todos os players</span>
                            <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                            <div class="clearfix"></div>
                        </div>
                    </a>
                </div>
            </div>
コード例 #19
0
<?php

require_once "inc/models/games.php";
require_once "inc/models/players.php";
$action = 'init-game-prepare';
$again = true;
if (isset($_POST['name']) && $_POST['name'] != '' && isset($_POST['amount']) && $_POST['amount'] != '' && isset($_POST['story']) && $_POST['story'] != '') {
    $name = $_POST['name'];
    $state = 1;
    $current_round = 1;
    $current_player = 0;
    $story_id = $_POST['story'];
    $start_time = date("Y-m-d H:i:s");
    $gameObject = new Games($name, $state, $current_round, $current_player, $story_id, $start_time);
    $gameObject->insert();
    $gameid = mysql_insert_id();
    $_POST['gameid'] = $gameid;
    // Set POST-Variable to current Game-ID
    for ($i = 0; $i < $_POST['amount']; $i++) {
        $playerObject = new Players($gameid, "{JSON Text}");
        $playerObject->insert();
    }
    $action = 'show-player';
} else {
    $msgObject = array("type" => "danger", "msg" => "Bitte alle Felder korrekt ausfüllen!");
}
コード例 #20
0
ファイル: players.php プロジェクト: ericmller29/NHLER
    }
    public function getPlayers()
    {
        $statsTable = $this->scraper->find('.stats tbody tr');
        foreach ($statsTable as $key => $player) {
            $td = $player->children();
            if ($key > 0) {
                $playerObj = new stdClass();
                $playerObj->name = $td[1]->plaintext;
                $playerObj->team = $td[2]->plaintext;
                $playerObj->position = $td[3]->plaintext;
                $playerObj->games_played = intval($td[4]->plaintext);
                $playerObj->goals = intval($td[5]->plaintext);
                $playerObj->assists = intval($td[6]->plaintext);
                $playerObj->points = intval($td[7]->plaintext);
                $playerObj->plus_minus = intval($td[8]->plaintext);
                $playerObj->pims = intval($td[9]->plaintext);
                $playerObj->ppg = intval($td[10]->plaintext);
                $playerObj->ppp = intval($td[11]->plaintext);
                $playerObj->shg = intval($td[12]->plaintext);
                $this->database->insertPlayers($playerObj);
                $this->database->insertPlayerStats($playerObj);
                $this->results[] = $playerObj;
            }
        }
        sleep(10);
        // echo json_encode($players);
    }
}
$scraper = new Players();
$scraper->run();
コード例 #21
0
ファイル: tuto.php プロジェクト: Tailszefox/EntityPHP
    {
        return array('name' => 'VARCHAR(255)', 'monster' => 'PetMonsters', 'items' => array('Items'));
    }
    public function __construct($name = null, $monster = null)
    {
        $this->name = $name;
        $this->monster = $monster;
    }
}
//Init connection to the database
\EntityPHP\Core::connectToDB('localhost', 'entityphp', '3n7i7iPHP', 'entityphp');
\EntityPHP\Core::generateDatabase();
//Add some items to the dabatase
$smallLife = new Items('Small life potion', 3);
$normalLife = new Items('Life potion', 5);
$bigLife = new Items('Big life potion', 8);
$smallMana = new Items('Small mana potion', 4);
$normalMana = new Items('Mana potion', 6);
$bigMana = new Items('Big mana potion', 9);
Items::addMultiple(array($smallLife, $normalLife, $bigLife, $smallMana, $normalMana, $bigMana));
//Add some monsters
$monster1 = new PetMonsters('Unosaur', 100);
$monster2 = new PetMonsters('Dososaur', 80);
$monster3 = new PetMonsters('Tresosaur', 60);
PetMonsters::addMultiple(array($monster1, $monster2, $monster3));
//Add some players
$character1 = new Players('Juno', $monster1);
$character2 = new Players('Ados', $monster2);
$character3 = new Players('Gitres', $monster3);
Players::addMultiple(array($character1, $character2, $character3));
コード例 #22
0
 public function actionSettings()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Account settings');
     $model = AccountData::model()->findByPk(Yii::app()->user->id);
     $model->scenario = 'edit';
     $form2 = Players::model()->findAll('account_id = ' . Yii::app()->user->id);
     if (isset($_POST['AccountData'])) {
         $model->attributes = $_POST['AccountData'];
         if ($this->hashPassword($model->current_password) == $model->password) {
             if (!empty($model->new_password)) {
                 $model->password = $this->hashPassword($model->new_password);
             }
             if ($model->save()) {
                 Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('main', 'Settings modified!') . '</div>');
                 $this->refresh();
             }
         } else {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('account', 'Incorrect password!') . '</div>');
             $this->refresh();
         }
     }
     if (isset($_POST['Players'])) {
         $clear = Yii::app()->db->createCommand('UPDATE ' . Config::db('gs') . '.players SET show_location = 0, show_inventory = 0 WHERE account_id = ' . Yii::app()->user->id);
         $clear->execute();
         if (isset($_POST['Players']['show_location'])) {
             $command = Yii::app()->db->createCommand('UPDATE ' . Config::db('gs') . '.players SET show_location = 1 WHERE id=:id');
             foreach ($_POST['Players']['show_location'] as $key => $value) {
                 $command->execute(array(':id' => $key));
             }
         }
         if (isset($_POST['Players']['show_inventory'])) {
             $command = Yii::app()->db->createCommand('UPDATE ' . Config::db('gs') . '.players SET show_inventory = 1 WHERE id=:id');
             foreach ($_POST['Players']['show_inventory'] as $key => $value) {
                 $command->execute(array(':id' => $key));
             }
         }
         Yii::app()->user->setFlash('message2', '<div class="flash_success">' . Yii::t('main', 'Settings modified!') . '</div>');
         $this->refresh();
     }
     $this->render('settings', array('form' => $model, 'form2' => $form2));
 }
コード例 #23
0
ファイル: main.php プロジェクト: ryden/ItalyMafia-3.0
 public static function OnPlayerDisconnect(Player $player, $reasonid)
 {
     /* Remove from connected players list */
     unset(Players::$players[$player->id]);
     Players::$players_by_id[$player->id] = null;
     /* Remove from JQ list */
     Players::DelFromJQ($player);
     /* Remove from OOC list */
     Players::DelFromOOC($player);
     /* Send the quit info to players who requested it */
     $reason = Core::TranslateQuitReason($reasonid);
     if ($player->account && $player->account->Authed()) {
         foreach (Players::$players_jq as $p) {
             $p->Send(COLOR_GRAY, "[QUIT] {$player->name}({$player->id}) has quitted ({$reason})");
         }
     }
     if (Players::$upgrade_draws[$player->id] != null) {
         TextDrawDestroy(Players::$upgrade_draws[$player->id]);
         Players::$upgrade_draws[$player->id] = null;
     }
     if ($player->account) {
         $player->SetName($player->account->name);
     }
     Log::Append(LOG_JOINQUIT, "[{$player->id}] {$player->name}({$player->ip}) disconnected ({$reason})");
     $player->Destroy();
     return CALLBACK_OK;
 }
コード例 #24
0
 public function actionCategory($name)
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $id = WebshopCategory::model()->find('alt_name = "' . $name . '"');
     $this->pageTitle = Yii::t('title', 'Webshop') . ': ' . $id->name;
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->condition = 'category_id = ' . $id->category_id;
     $pages = new CPagination(Webshop::model()->count($criteria));
     $pages->pageSize = Config::get('page_shop');
     $pages->applyLimit($criteria);
     $model = Webshop::model()->findAll($criteria);
     $form = new Inventory();
     $form->scenario = 'buy';
     if (isset($_POST['Inventory'])) {
         $form->attributes = $_POST['Inventory'];
         if ($form->validate()) {
             $criteria = new CDbCriteria();
             $criteria->select = '*';
             $criteria->condition = 'item_id = ' . $form->item_id;
             $item = Webshop::model()->find($criteria);
             $real_price = ceil($form->new_amount * ($item->price / $item->amount));
             $account = AccountData::model()->findByPk(Yii::app()->user->id);
             if ($account[Yii::app()->params->money] < $real_price) {
                 Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Insufficient funds.') . '</div>');
                 $this->refresh();
             }
             $criteria = new CDbCriteria();
             $criteria->condition = 'id = ' . $form->item_owner . ' AND online = 1';
             $online = Players::model()->count($criteria);
             if ($online == 1) {
                 Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Log-out') . '</div>');
                 $this->refresh();
             }
             $criteria = new CDbCriteria();
             $criteria->select = 'MAX(mail_unique_id) as mail_unique_id';
             $last_mail_id = Mail::model()->find($criteria);
             $mail = new Mail();
             $mail->mail_unique_id = $last_mail_id->mail_unique_id + 1;
             $mail->mail_recipient_id = $form->item_owner;
             $mail->sender_name = 'Admin';
             $mail->mail_title = Yii::t('webshop', 'Delivery');
             $mail->mail_message = Yii::t('webshop', 'Your purchase has been successful.  Thank you, and we hope you enjoy the game!');
             $mail->unread = 1;
             if ($form->item_id == 182400001) {
                 $mail->attached_item_id = 0;
                 $mail->attached_kinah_count = $form->new_amount;
             } else {
                 $mail->attached_item_id = $this->add_item($form->item_id, $form->item_owner, $form->new_amount);
                 $mail->attached_kinah_count = 0;
             }
             $mail->express = 1;
             $mail->save(false);
             $account[Yii::app()->params->money] = $account[Yii::app()->params->money] - $real_price;
             $account->save(false);
             $log = new LogWebshop();
             $log->player_id = $form->item_owner;
             $log->item = $form->item_id;
             $log->amount = $form->new_amount;
             $log->price = $real_price;
             $log->save(false);
             Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('webshop', 'Purchase successful!') . '</div>');
             $this->refresh();
         }
     }
     $this->render('category', array('model' => $model, 'id' => $id, 'form' => $form, 'players' => Players::getPlayers(), 'pages' => $pages));
 }
コード例 #25
0
ファイル: PlayerController.php プロジェクト: murribu/trumedia
 function getCatchers()
 {
     $catchers = Players::whereRaw('mlb_id in (select distinct catcher_id from pitches)')->orderBy('name')->get();
     return $catchers;
 }
コード例 #26
0
ファイル: players.inc.php プロジェクト: beporter/hlstats
 * Current development:
 * +
 * + Johannes 'Banana' Keßler
 * + http://hlstats.sourceforge.net
 * + 2007 - 2012
 * +
 *
 * This program is free software is licensed under the
 * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
 *
 * You should have received a copy of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
 * along with this program; if not, visit http://hlstats-community.org/License.html
 *
 */
require 'class/players.class.php';
$playersObj = new Players($game);
/**
 * check the get values
 */
if (isset($_GET["minkills"])) {
    $check = validateInput($_GET['minkills'], 'digit');
    if ($check === true) {
        $playersObj->setOption("minkills", $_GET['minkills']);
    }
}
if (isset($_GET["showall"])) {
    $check = validateInput($_GET['showall'], 'digit');
    if ($check === true) {
        $playersObj->setOption("showall", $_GET['showall']);
    }
}
コード例 #27
0
ファイル: core.php プロジェクト: ryden/ItalyMafia-3.0
 public static function FindPlayer($player, $id)
 {
     $res = Players::Find($id);
     if (!$res) {
         $player->Send(COLOR_PNOTFOUND, '[ERROR] Given player id not found or more than one result');
         return null;
     } else {
         if (!$res->account || $res->account->Authed() == false) {
             $player->Send(COLOR_PNOTAUTHED, '[ERROR] Given player is not authed');
             return null;
         }
     }
     return $res;
 }
コード例 #28
0
ファイル: admin.php プロジェクト: ryden/ItalyMafia-3.0
 public static function cmdAdmins(Player $player, $numparams, $params)
 {
     $player->Send(COLOR_ADMINLIST, '* Current online admins:');
     foreach (Players::Get() as $p) {
         if ($p->GetAdminLevel() > 0 && Admin::$showadmins[$p->id]) {
             $player->Send(COLOR_ADMINLIST, " {$p->name} (" . Admin::GetLevelStr($p->GetAdminLevel()) . ')');
         }
     }
     return COMMAND_OK;
 }
コード例 #29
0
ファイル: chart.class.php プロジェクト: BlackMajic/HLStats
 /**
  * create the image for player activity
  * @todo To complete
  * @return array The path to the image
  */
 private function _mostTimeOnline()
 {
     exit;
     if (!in_array('Players', get_declared_classes())) {
         require 'players.class.php';
     }
     $playersObj = new Players($this->_game);
     $data = $playersObj->getMostTimeOnline();
     $c = 0;
     $xLine = array();
     $connects = array();
     $disconnects = array();
     // we need only the count for each day
     foreach ($data['connect'] as $d => $e) {
         $connects[] = count($e);
         // this shows the date only every 5 days
         if ($c % 5 == 0) {
             $xLine[] = $d;
         } else {
             $xLine[] = '';
         }
         $c++;
     }
     // we need only the count for each day
     foreach ($data['disconnect'] as $d => $e) {
         $disconnects[] = count($e);
     }
     // add the connects
     $this->_pData->AddPoint($connects, '1');
     $this->_pData->AddSerie('1');
     $this->_pData->SetSerieName(l("Connects"), '1');
     // the dates for x axe
     $this->_pData->AddPoint($xLine, 'x');
     $this->_pData->SetAbsciseLabelSerie("x");
     // add the disconnects
     $this->_pData->AddPoint($disconnects, '2');
     $this->_pData->AddSerie('2');
     $this->_pData->SetSerieName(l("Disconnects"), '2');
     $this->_pChart->setFontProperties("class/pchart/Fonts/tahoma.ttf", 8);
     $this->_pChart->setGraphArea(50, 30, $this->_option['width'] - 10, $this->_option['height'] - 70);
     $this->_pChart->drawFilledRoundedRectangle(3, 3, $this->_option['width'] - 3, $this->_option['height'] - 3, 5, 240, 240, 240);
     $this->_pChart->drawGraphArea(255, 255, 255, TRUE);
     $this->_pChart->drawScale($this->_pData->GetData(), $this->_pData->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
     $this->_pChart->drawGrid(4, TRUE, 230, 230, 230, 50);
     #  // Draw the cubic curve graph
     $this->_pChart->drawCubicCurve($this->_pData->GetData(), $this->_pData->GetDataDescription());
     #
     #  // Finish the graph
     //$this->_pChart->setFontProperties("class/pchart/Fonts/tahoma.ttf",8);
     $this->_pChart->drawLegend(10, $this->_option['height'] - 40, $this->_pData->GetDataDescription(), 255, 255, 255);
     $this->_pChart->setFontProperties("class/pchart/Fonts/tahoma.ttf", 10);
     $this->_pChart->drawTitle(0, 20, l("Player activity"), 50, 50, 50, $this->_option['width']);
     return "tmp/" . $this->_option['chartId'] . ".png";
 }
コード例 #30
0
ファイル: callbacks.php プロジェクト: ryden/ItalyMafia-3.0
 public function OnPlayerKeyStateChange($playerid, $newkeys, $oldkeys)
 {
     if ($this->callbacks[cOnPlayerKeyStateChange] == null) {
         return 1;
     }
     $player = Players::FindByID($playerid);
     if ($player == null) {
         return 1;
     }
     for ($cbk = $this->callbacks[cOnPlayerKeyStateChange]; $cbk != null; $cbk = $cbk->next) {
         $obj = $cbk->GetObj();
         $func = $cbk->GetFunc();
         if ($obj) {
             $ret = $obj->{$func}($player, $newkeys, $oldkeys);
         } else {
             $ret = call_user_func($func, $player, $newkeys, $oldkeys);
         }
         if ($ret != CALLBACK_OK) {
             break;
         }
     }
     if ($ret & CALLBACK_DISALLOW) {
         return 0;
     }
     return 1;
 }