当前位置: 首页>>代码示例>>PHP>>正文


PHP Character::setName方法代码示例

本文整理汇总了PHP中Character::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Character::setName方法的具体用法?PHP Character::setName怎么用?PHP Character::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character的用法示例。


在下文中一共展示了Character::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: changeName

function changeName()
{
    global $Config, $DB, $lang, $user;
    include 'core/SDL/class.character.php';
    $Character = new Character();
    if (empty($_POST['newname'])) {
        output_message('error', $lang['char_rename_newname']);
        return FALSE;
    }
    if ($Config->get('module_charrename') == 0) {
        output_message('error', 'Nice try hacking, but not good enough.');
        return FALSE;
    }
    if ($user['web_points'] >= $Config->get('module_charrename_pts')) {
        if ($Character->checkNameExists($_POST['newname']) == FALSE) {
            if ($Character->isOnline($_POST['id']) == FALSE) {
                if ($Character->setName($_POST['id'], $_POST['newname']) == TRUE) {
                    $DB->query("UPDATE `mw_account_extend` SET \n\t\t\t\t\t\t`web_points`=(`web_points` - " . $Config->get('module_charrename_pts') . "), \n\t\t\t\t\t\t`points_spent`=(`points_spent` + " . $Config->get('module_charrename_pts') . ")  \n\t\t\t\t\t   WHERE `account_id` = " . $user['id'] . " LIMIT 1");
                    output_message('success', $lang['char_rename_success'] . ' Redirecting...<meta http-equiv=refresh content="3;url=?p=account&sub=rename">');
                }
            } else {
                output_message('validation', $lang['char_is_online']);
            }
        } else {
            output_message('validation', $lang['char_name_exists']);
        }
    } else {
        output_message('validation', $lang['not_enough_points']);
    }
}
开发者ID:louisnorthmore,项目名称:mangoswebv3,代码行数:30,代码来源:account.rename.php

示例2: getChararcterById

 public function getChararcterById($guid)
 {
     $this->db->select('name, race, class, gender, level, playerBytes, playerBytes2')->where('guid', $guid);
     $query = $this->db->get('characters');
     if ($query->rowCount() > 0) {
         $row = $this->db->fetch($query);
         $character = new Character($guid);
         $character->setName($row->name)->setClass($row->class)->setGender($row->gender)->setRace($row->race)->setLevel($row->level);
         return $character;
     } else {
         return NULL;
     }
 }
开发者ID:Tulba,项目名称:AquaflameCMS-2.0,代码行数:13,代码来源:characters.php

示例3: array

<?php

$loader = (require_once 'vendor/autoload.php');
$loader->add('', __DIR__ . '/api/entities');
require_once 'bootstrap.php';
$alreadyDone = array('isc');
$d = opendir('api/data/factions');
while ($f = readdir($d)) {
    $path = 'api/data/factions/' . $f;
    $infos = pathinfo($path);
    $extension = $infos['extension'];
    $filename = $infos['filename'];
    if (substr($f, 0, 1) != '.' && $extension == 'json') {
        $json = file_get_contents($path);
        $data = json_decode($json);
        $faction = $filename;
        if (!in_array($filename, $alreadyDone)) {
            echo "Doing " . $filename . "\n";
            foreach ($data as $charData) {
                $character = new Character();
                $character->setName($charData->name);
                $character->setFaction($faction);
                $character->setCost($charData->cost);
                $entityManager->persist($character);
                echo "Saved " . $charData->name . "\n";
            }
        }
    }
}
$entityManager->flush();
开发者ID:mbagur,项目名称:eden-browser,代码行数:30,代码来源:populate_db.php


注:本文中的Character::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。