本文整理汇总了PHP中Neuron_Core_Tools类的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools类的具体用法?PHP Neuron_Core_Tools怎么用?PHP Neuron_Core_Tools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Neuron_Core_Tools类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getContent
public function getContent()
{
$me = Neuron_GameServer::getPlayer();
$text = Neuron_Core_Text::__getInstance();
$text->setFile('unit');
$text->setSection('equipment');
if ($this->village && $this->village->isActive() && $this->village->getOwner() && $this->village->getOwner()->getId() == $me->getId()) {
$page = new Neuron_Core_Template();
$page->set('noItems', $text->get('noItems'));
$page->set('available', $text->get('available'));
$page->set('total', $text->get('total'));
$equipment = $this->village->getEquipment();
$yourEquipment = array();
foreach ($equipment as $type => $items) {
if (count($items) > 0) {
$yourEquipment[$type] = array('type' => $text->get($type, 'types', 'equipment'), 'items' => array());
foreach ($items as $item) {
$yourEquipment[$type]['items'][] = array($item->getName(true), $item->getAvailableAmount(), $item->getAmount(), Neuron_Core_Tools::output_text($item->getStats_text()));
}
}
}
$page->set('equipment', $yourEquipment);
return $page->parse('equipment.tpl');
} else {
return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
}
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:27,代码来源:Equipment.php
示例2: getContent
public function getContent()
{
$text = Neuron_Core_Text::__getInstance();
$player = Neuron_GameServer::getPlayer();
if (!$player) {
return $this->throwError($text->get('login', 'login', 'account'));
}
$input = $this->getInputData();
$request = $this->getRequestData();
$mapper = Neuron_GameServer_Mappers_BlockingChatMapper::getInstance();
$total = $mapper->countPrivateMessages($player);
if (isset($input['page'])) {
$current = $input['page'];
$request['page'] = $current;
$this->updateRequestData($request);
} else {
$current = isset($request['page']) ? $request['page'] : 0;
}
$perpage = 10;
$page = new Neuron_Core_Template();
$pages = Neuron_Core_Tools::splitInPages($page, $total, $current, $perpage);
$messages = $mapper->getPrivateChats($player, $pages['start'], $pages['perpage']);
$page->set('messages', $messages);
return $page->parse('gameserver/chat/privatemessages.phpt');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:25,代码来源:Messages.php
示例3: getForum
protected function getForum()
{
$requestData = $this->getRequestData();
if (isset($requestData['clan'])) {
$clan = new Dolumar_Players_Clan($requestData['clan']);
if ($clan) {
$login = Neuron_Core_Login::__getInstance();
if ($login->isLogin()) {
$me = Neuron_GameServer::getPlayer();
$isMember = $clan->isMember($me);
$isModerator = $clan->isModerator($me);
//__construct ($iForumType, $iForumId, $objUser = false, $bCanSeeAll = false, $bIsModerator = false)
$forum = new Neuron_Forum_Forum(1, $clan->getId(), $me, $isMember, $isModerator);
} else {
$forum = new Neuron_Forum_Forum(1, $clan->getId(), false, false, false);
}
// Fetch thze title
$text = Neuron_Core_Text::__getInstance();
$forum->setTitle(Neuron_Core_Tools::putIntoText($text->get('title', 'forum', 'clan'), array('clan' => Neuron_Core_Tools::output_varchar($clan->getName()))));
return $forum;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:27,代码来源:ClanForum.php
示例4: getEquipmentStats
private function getEquipmentStats()
{
$equipment = Dolumar_Players_Equipment::getAllEquipment();
$types = array();
foreach ($equipment as $v) {
$type = $v->getItemType();
if (!isset($types[$type])) {
$types[$type] = array();
}
$types[$type][] = $v;
}
$html = '<div class="equipment-report fancybox">';
foreach ($types as $type => $data) {
$this->sortLogables($data);
$html .= '<div class="equipment-type">';
$html .= '<h2>' . $type . '</h2>';
foreach ($data as $equipment) {
$html .= '<div class="equipment">';
$html .= '<h3>' . $equipment->getName() . ' (' . $equipment->getCategory() . ')</h3>';
for ($i = 1; $i <= Dolumar_Players_Village_Equipment::EQUIPMENT_MAX_LEVEL; $i++) {
$equipment->setLevel($i);
$html .= '<div class="equipment-level">';
$html .= '<h4>' . $i . ': ' . $equipment->getName() . '</h4>';
$html .= Neuron_Core_Tools::output_text($equipment->getStats_text());
$html .= '<p class="equipment-costs"><span class="stat-title">Cost: </span>' . $equipment->getCraftCost_text() . '</p>';
$html .= '</div>';
}
$html .= '</div>';
}
$html .= '</div><div class="clearer"></div>';
}
return $html . '</div>';
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:33,代码来源:Report.php
示例5: register
private function register()
{
$player = Neuron_GameServer::getPlayer();
if (!$player) {
echo '<p>Please login.</p>';
return;
}
$name = Neuron_Core_Tools::getInput('_POST', 'name', 'varchar');
$developer = Neuron_Core_Tools::getInput('_POST', 'developer', 'varchar');
$email = Neuron_Core_Tools::getInput('_POST', 'email', 'email');
$user_id = $player->getId();
$page = new Neuron_Core_Template();
if ($name && $developer) {
$consumer = array('requester_name' => $developer, 'requester_email' => $email);
// Register the consumer
$store = Neuron_Auth_OAuthStore::getStore();
$key = $store->updateConsumer($consumer, $user_id);
// Get the complete consumer from the store
$consumer = $store->getConsumer($key, $user_id);
// Some interesting fields, the user will need the key and secret
$page->set('app_data', array('Consumer ID' => $consumer['id'], 'Consumer Key' => $consumer['consumer_key'], 'Consumer secret' => $consumer['consumer_secret']));
return $page->parse('oauth/information.phpt');
} else {
return $page->parse('oauth/register.phpt');
}
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:26,代码来源:OAuth.php
示例6: getBody
public function getBody()
{
$timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
$db = Neuron_DB_Database::__getInstance();
$page = new Neuron_Core_Template();
$page->set('timeframe', $timeframe);
// Fetch all doubles
$data = $db->query("\n\t\t\tSELECT\n\t\t\t\tn_login_log.l_ip,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(DISTINCT n_login_log.l_plid) AS plids,\n\t\t\t\tGROUP_CONCAT(DISTINCT n_players.nickname) AS nicknames,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(c.pac_plid1) AS cleared_1,\n\t\t\t\tGROUP_CONCAT(c.pac_plid2) AS cleared_2,\n\t\t\t\tGROUP_CONCAT(c.pac_reason) AS cleared_reason,\n\t\t\t\t\n\t\t\t\tCOUNT(DISTINCT l_plid) AS aantal\n\t\t\tFROM\n\t\t\t\tn_login_log\n\t\t\tLEFT JOIN\n\t\t\t\tn_players ON n_login_log.l_plid = n_players.plid\n\t\t\tLEFT JOIN\n\t\t\t\tn_players_admin_cleared c ON (c.pac_plid1 = n_login_log.l_plid OR c.pac_plid2 = n_login_log.l_plid)\n\t\t\tWHERE\n\t\t\t\tn_login_log.l_datetime > FROM_UNIXTIME(" . (NOW - $timeframe) . ") AND\n\t\t\t\tn_players.isPlaying = 1\n\t\t\tGROUP BY\n\t\t\t\tl_ip\n\t\t\tHAVING\n\t\t\t\taantal > 1\n\t\t");
foreach ($data as $row) {
$plids = explode(',', $row['plids']);
$nicknames = explode(',', $row['nicknames']);
// Check clearances.
$clearances = $this->getClearancesFromRow($row);
$players = array();
$combinedlogs = "";
foreach ($plids as $k => $v) {
$players[] = array('id' => $plids[$k], 'name' => isset($nicknames[$k]) ? $nicknames[$k] : 'no-nickname-set', 'url' => $this->getUrl('user', array('id' => $plids[$k])), 'logs_url' => $this->getUrl('gamelogs', array('players' => $plids[$k])));
$combinedlogs .= $plids[$k] . "|";
}
// Check for cleared accounts
$allcleared = true;
foreach ($players as $k => $v) {
$players[$k]['cleared'] = $this->isCleared($clearances, $v, $players);
if ($allcleared && !$players[$k]['cleared']) {
$allcleared = false;
}
}
$combinedlogs = substr($combinedlogs, 0, -1);
$page->addListValue('players', array('ip' => $row['l_ip'], 'players' => $players, 'combined_logs_url' => $this->getUrl('gamelogs', array('players' => $combinedlogs)), 'clearmultis' => $this->getUrl('clearmultis', array('players' => $combinedlogs)), 'cleared' => $allcleared, 'amount' => $row['aantal']));
}
$page->usortList('players', array($this, 'sortcompare'));
return $page->parse('pages/admin/multis.phpt');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:33,代码来源:Multis.php
示例7: getContent
public function getContent($msg = null, $failed = false)
{
$myself = Neuron_GameServer::getPlayer();
if (!$this->village->isActive() || $this->village->getOwner()->getId() != $myself->getId()) {
return false;
}
$page = new Neuron_Core_Template();
$page->setTextSection('formation', 'battle');
// Load battle slots
$slots = $this->village->getDefenseSlots();
// Load your units
$squads = $this->village->getSquads(false, false, false);
// See how much rows that is
$rows = $this->countRows($squads, $slots);
$page->set('rows', $rows);
$page->set('slots', $slots);
if (!empty($msg)) {
$page->set('message', $msg);
$page->set('error', $failed);
}
foreach ($squads as $v) {
if ($v->getUnitsAmount() > 0) {
$page->addListValue('squads', array('sName' => Neuron_Core_Tools::output_varchar($v->getName()), 'oUnits' => $v->getUnits(), 'id' => $v->getId()));
}
}
return $page->parse('battle/formation.phpt');
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:27,代码来源:Formation.php
示例8: setSettings
public function setSettings()
{
$text = Neuron_Core_Text::__getInstance();
$login = Neuron_Core_Login::__getInstance();
if ($login->isLogin()) {
$player = Neuron_GameServer::getPlayer();
$pos = $player->getPreferences();
$pos = $pos['minimapPosition'];
} else {
$pos = Neuron_Core_Tools::getInput('_COOKIE', COOKIE_PREFIX . 'prefMP', 'int', 0);
}
if ($pos == 4) {
$this->setPosition('auto', 'auto', '0px', '0px');
} elseif ($pos == 2) {
$this->setPosition('0px', '32px', 'auto', 'auto');
} elseif ($pos == 3) {
$this->setPosition('auto', '32px', '0px', 'auto');
} else {
$this->setPosition('0px', 'auto', 'auto', '0px');
}
if ($pos != 5) {
$this->setType('panel');
} else {
// Movable ;-)
$this->setPosition('0px', 'auto', 'auto', '0px');
//$this->setOnResize ('onResizeMiniMap');
}
// Window settings
$this->setSize('200px', '150px');
$this->setTitle('Mini Map');
$this->setClass('minimap');
$this->setType('panel');
$this->setAllowOnlyOnce();
$this->setPool('minimap');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:35,代码来源:MiniMap.php
示例9: getContent
public function getContent()
{
$text = Neuron_Core_Text::__getInstance();
if ($this->building) {
$input = $this->getInputData();
$me = Neuron_GameServer::getPlayer();
if ($me && $this->building->getOwner()->getId() == $me->getId() && $this->building->getVillage()->isActive()) {
if (isset($input['action']) && $input['action'] == 'destruct' && isset($input['key']) && Neuron_Core_Tools::checkConfirmLink($input['key'])) {
// Reload
reloadEverything();
$loc = $this->building->getLocation();
//$this->reloadLocation ($loc[0], $loc[1]);
return $this->building->destructBuilding();
} else {
// Make sure you are not in vacation mode.
if ($this->building->getVillage()->getOwner()->inVacationMode()) {
return '<p class="false">' . $text->get('vacationMode', 'main', 'main') . '</p>';
}
return $this->building->getMyContent($input);
}
} else {
return $this->building->getGeneralContent(false);
}
} else {
return '<p class="false">' . $text->get('notFound', 'building', 'building') . '</p>';
}
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:27,代码来源:Building.php
示例10: checkBuildings
function checkBuildings($buildings, $sQ, $i, $j, $tx, $ty)
{
global $output;
// Objects & buildings
if (isset($buildings[$tx]) && isset($buildings[$tx][$ty])) {
$loc = array();
foreach ($buildings[$tx][$ty] as $b) {
$displayobject = $b->getDisplayObject();
$offset = $displayobject->getOffset();
$title = Neuron_Core_Tools::output_varchar($b->getName());
$location = $b->getLocation();
if (!isset($loc[$location[0] . 'p' . $location[1]])) {
if (!isset($output['regions'][$sQ]['objects'][$i])) {
$output['regions'][$sQ]['objects'][$i] = array();
}
if (!isset($output['regions'][$sQ]['objects'][$i][$j])) {
$output['regions'][$sQ]['objects'][$i][$j] = array();
}
$id = time();
$output['regions'][$sQ]['objects'][$i][$j][] = array('tx' => $tx, 'ty' => $ty, 'id' => $id, 'i' => $i - $offset[0], 'j' => $j - $offset[1], 'm' => map_image_cache($displayobject), 'n' => $title, 's' => $b->getMapObjectStatus()->getArray(), 'c' => $b->getEvents('click'), 'z' => 0, 'd' => true);
$loc[$location[0] . 'p' . $location[1]] = true;
}
}
}
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:25,代码来源:jsonmap.php
示例11: getBody
public function getBody()
{
$myself = Neuron_GameServer::getPlayer();
if (!$myself->isAdmin()) {
return '<p>You are not allowed to execute the commands. Only admins are.</p>';
}
// Check for input
$record = Neuron_Core_Tools::getInput('_GET', 'id', 'int');
$action = Neuron_Core_Tools::getInput('_GET', 'action', 'varchar');
if ($record && $action) {
$this->processAction($record, $action == 'accept');
}
$page = new Neuron_Core_Template();
$db = Neuron_DB_Database::getInstance();
$list = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_mod_actions\n\t\t\tWHERE\n\t\t\t\tma_processed = 0\n\t\t\tORDER BY\n\t\t\t\tma_date ASC\n\t\t");
foreach ($list as $v) {
$params = json_decode($v['ma_data'], true);
$target = false;
if (isset($params['plid'])) {
$target = Neuron_GameServer::getPlayer($params['plid']);
}
$actor = Neuron_GameServer::getPlayer($v['ma_plid']);
$page->addListValue('actions', array('date' => $v['ma_date'], 'action' => $v['ma_action'], 'target' => $target ? $target->getDisplayName() : null, 'actor' => $actor ? $actor->getDisplayName() : null, 'reason' => !empty($v['ma_reason']) ? Neuron_Core_Tools::output_text($v['ma_reason']) : null, 'accept_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'accept')), 'deny_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'deny'))));
}
return $page->parse('pages/admin/execute/list.phpt');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:26,代码来源:Execute.php
示例12: getContent
public function getContent($error = null)
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('account');
$text->setSection('premium');
$player = Neuron_GameServer::getPlayer();
if (!$player) {
return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
}
$openid = isset($_SESSION['neuron_openid_identity']) ? md5($_SESSION['neuron_openid_identity']) : false;
if ($player && $player->isFound() && ($player->isEmailCertified() || $openid)) {
$page = new Neuron_Core_Template();
// Premium account stuff
$page->set('premium', $text->get('premium', 'myAccount'));
if ($player->isPremium()) {
$page->set('premiumLast', Neuron_Core_Tools::putIntoText($text->get('premiumLast', 'myAccount'), array(date(DATETIME, $player->getPremiumEndDate()))));
$page->set('extend2', $text->getClickTo($text->get('toPremium', 'myAccount')));
} else {
$page->set('notPremium1', $text->get('notPremium', 'myAccount'));
$page->set('notPremium2', $text->getClickTo($text->get('toPremium', 'myAccount')));
}
$page->set('toUse', $text->getClickTo(Neuron_Core_Tools::putIntoText($text->get('toUseCredit'), array('amount' => PREMIUM_COST_CREDITS))));
$page->set('extend_url', htmlentities($player->getCreditUseUrl(PREMIUM_COST_CREDITS)));
$page->set('benefits', $this->getBenefits());
if (!empty($error)) {
$page->set('error', $text->get($error));
}
return $page->parse('gameserver/account/premium.tpl');
} elseif ($player->isFound()) {
return '<p>' . $text->get('validateEmail') . '</p>';
}
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:32,代码来源:Premium.php
示例13: printResults
private function printResults($page, $query)
{
foreach ($query as $v) {
$displayname = Neuron_URLBuilder::getInstance()->getOpenUrl('PlayerProfile', Neuron_Core_Tools::output_varchar($v['nickname']), array('plid' => $v['plid']));
$villagename = Neuron_URLBuilder::getInstance()->getOpenUrl('VillageProfile', Neuron_Core_Tools::output_varchar($v['vname']), array('village' => $v['vid']));
$page->addListValue('results', array('id' => $v['plid'], 'nickname' => $v['nickname'], 'displayname' => $displayname, 'village' => $v['vname'], 'displayvillage' => $villagename, 'distance' => Neuron_Core_Tools::output_distance($v['distance']), 'networth' => $v['networth']));
}
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:8,代码来源:Search.php
示例14: getCustomContent
public function getCustomContent($input)
{
$data = $this->getData();
if (!$data) {
return null;
}
$content = json_decode($data['t_description'], true);
return Neuron_Core_Tools::output_text($this->getTranslatedContent($content, 'description'));
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:9,代码来源:BonusBuilding.php
示例15: getDescription
public function getDescription($tags = true)
{
$this->loadData();
if ($tags) {
return Neuron_Core_Tools::putIntoText($this->data['c_description'], array('clan' => $this->getName(), 'members' => count($this->getMembers())));
} else {
return $this->data['c_description'];
}
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:9,代码来源:Clan.php
示例16: getBody
public function getBody()
{
$player = Neuron_GameServer::getPlayer(Neuron_Core_Tools::getInput('_GET', 'id', 'int'));
$statistics = $player->getStatistics();
$out = $this->linearArray($statistics);
$page = new Neuron_Core_Template();
$page->set('statistics', $out);
return $page->parse('gameserver/pages/statistics.phpt');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:9,代码来源:Statistics.php
示例17: getContent
public function getContent()
{
$server = Neuron_GameServer::getServer();
$page = new Neuron_Core_Template();
if ($server->getEndgameStartDate() > time()) {
$page->set('endgame_start', Neuron_Core_Tools::getCountdown($server->getEndgameStartDate()));
} else {
$page->set('endgame_start', '<strong>already started</strong>');
}
return $page->parse('dolumar/serversettings.phpt');
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:11,代码来源:Serversettings.php
示例18: text2bundle
public static function text2bundle($text)
{
$path = $text->getPath();
$output = array();
self::handleDirectory($output, $path);
$data = array();
foreach ($output as $k => $v) {
$data[] = array('attributes' => array('name' => $k), 'element-content' => $v);
}
return Neuron_Core_Tools::output_xml($data, null, 'messagebundle', array(), 'msg');
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:11,代码来源:MessageBundle.php
示例19: getBody
public function getBody()
{
$village = Neuron_Core_Tools::getInput('_GET', 'village', 'int');
$village = Dolumar_Players_Village::getVillage($village);
$body = '<h2>' . $village->getName() . '</h2>';
$location = $village->buildings->getTownCenterLocation();
//$url = ABSOLUTE_URL . '#' . $location[0] . ',' . $location[1];
$url = $this->getUrl('Playerprofile', array('plid' => $village->getOwner()->getId()));
header('Location: ' . $url);
return $body;
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:11,代码来源:Villageprofile.php
示例20: getIncome
public function getIncome($since = NOW, $now = NOW)
{
$profiler = Neuron_Profiler_Profiler::getInstance();
$profiler->start('Calculating income for this ' . $this->getClassName());
$o = array($this->RESOURCE => $this->calculateIncome());
$profiler->start('Processing bonus effects');
$o = Neuron_Core_Tools::floor_array($this->getVillage()->procBonusses('procIncome', array($o, $this), $now, $since));
$profiler->stop();
$profiler->stop();
return $o;
}
开发者ID:Toxicat,项目名称:dolumar,代码行数:11,代码来源:Producing.php
注:本文中的Neuron_Core_Tools类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论