• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Character类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Character类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: attack

 /**
  * @inheritdoc
  */
 public function attack(Character $victim)
 {
     //shoots target
     $victim->weaken(self::SHOOT_ATTACK_HP);
     //performs default attack as well
     $this->character->attack($victim);
     return $this;
 }
开发者ID:rpodwika,项目名称:designpatterns,代码行数:11,代码来源:ShootingCharacter.php


示例3: process_remove_character

function process_remove_character($char_id)
{
    $character = new Character($char_id);
    if ($character->SetCampaign(null)) {
        return "Removed character " . $character->cname . ".";
    }
    return "Unable to remove character " . $character->cname . ".";
}
开发者ID:ediosyncratic,项目名称:rpg-profile,代码行数:8,代码来源:edit_campaign.php


示例4: process_accept_join

function process_accept_join(&$campaign, $char_id)
{
    $character = new Character($char_id);
    $character->RemoveJoinRequest();
    if ($character->SetCampaign($campaign->id)) {
        return "Character " . $character->cname . " added to campaign.";
    }
    return "Unable to add character " . $character->cname . " to campaign.";
}
开发者ID:ediosyncratic,项目名称:rpg-profile,代码行数:9,代码来源:view_campaign.php


示例5: actionPvpCurrent

 public function actionPvpCurrent($realm)
 {
     $model = new Character('pvp_current');
     $model->unsetAttributes();
     if (isset($_GET['Character'])) {
         $model->attributes = $_GET['Character'];
     }
     $this->render('pvp', array('model' => $model, 'current' => true));
 }
开发者ID:stormrage-project,项目名称:valkyrie-yii,代码行数:9,代码来源:StatisticController.php


示例6: getRConfig

 public static function getRConfig($param)
 {
     $model = new Character();
     if ($model->getFConfig($param) == 1) {
         return "<span class='yes'>" . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Yes') . "</span>";
     } else {
         return "<span class='no'>" . Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'No') . "</span>";
     }
 }
开发者ID:smokeelow,项目名称:faicore,代码行数:9,代码来源:Character.php


示例7: run

 public function run()
 {
     $character = new Character();
     $character->name = 'Ellerion';
     $character->class = 'Mage';
     $character->race = 'Human';
     $character->realm = 'Darkspear';
     $character->file = '';
     $character->save();
 }
开发者ID:john5652,项目名称:Blog,代码行数:10,代码来源:CharactersTableSeeder.php


示例8: max_damage

 public function max_damage(Character $enemy = null)
 {
     $dam = 1 + $this->strength * 2 + $this->damage;
     // Mirror some of their enemy's strength
     if ($this->has_trait('partial_match_strength') && $enemy instanceof Character) {
         $add = max(0, floor($enemy->strength() / 3));
         // Enemy str/3 or at minimum 0
         $dam = $dam + $add;
     }
     return $dam;
 }
开发者ID:reillo,项目名称:ninjawars,代码行数:11,代码来源:Npc.php


示例9: afterSave

 public function afterSave($created, $options)
 {
     // Mark the user as absent in all his games
     // Get characters, so we can also have the game list
     App::uses('Character', 'Model');
     $Character = new Character();
     $params = array();
     $params['recursive'] = -1;
     $params['fields'] = array('Character.id', 'Character.game_id', 'Character.level', 'Character.default_role_id');
     $params['group'] = 'game_id';
     $params['conditions']['user_id'] = $this->data['Availability']['user_id'];
     $params['conditions']['main'] = 1;
     if ($characters = $Character->find('all', $params)) {
         App::uses('Event', 'Model');
         $Event = new Event();
         $Event->Behaviors->detach('Commentable');
         App::uses('EventsCharacter', 'Model');
         $EventsCharacter = new EventsCharacter();
         foreach ($characters as $character) {
             // Get events for this period
             $params = array();
             $params['recursive'] = -1;
             $params['fields'] = array('Event.id');
             $params['conditions']['game_id'] = $character['Character']['game_id'];
             $params['conditions']['character_level <='] = $character['Character']['level'];
             $params['conditions']['time_start >='] = $this->data['Availability']['start'] . ' 00:00:00';
             $params['conditions']['time_start <='] = $this->data['Availability']['end'] . ' 23:59:59';
             if ($events = $Event->find('all', $params)) {
                 foreach ($events as $event) {
                     // If already registered to this event, update it
                     $paramsEventsCharacter = array();
                     $paramsEventsCharacter['recursive'] = -1;
                     $paramsEventsCharacter['fields'] = array('id');
                     $paramsEventsCharacter['conditions']['event_id'] = $event['Event']['id'];
                     $paramsEventsCharacter['conditions']['user_id'] = $this->data['Availability']['user_id'];
                     if ($eventCharacter = $EventsCharacter->find('first', $paramsEventsCharacter)) {
                         $eventCharacter['EventsCharacter']['status'] = 0;
                         $EventsCharacter->save($eventCharacter['EventsCharacter']);
                     } else {
                         $toSave = array();
                         $toSave['event_id'] = $event['Event']['id'];
                         $toSave['user_id'] = $this->data['Availability']['user_id'];
                         $toSave['character_id'] = $character['Character']['id'];
                         $toSave['raids_role_id'] = $character['Character']['default_role_id'];
                         $toSave['comment'] = $this->data['Availability']['comment'];
                         $toSave['status'] = 0;
                         $EventsCharacter->__add($toSave);
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:Chaoslan,项目名称:mushraider,代码行数:54,代码来源:Availability.php


示例10: 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


示例11: init

 public static function init()
 {
     self::$classCRC32Cache = new IdentityHashMap();
     self::$CLASS_TO_SERIALIZER_INSTANCE = new IdentityHashMap();
     self::$NO_SUCH_SERIALIZER = new SerializabilityUtilEx_NoSuchSerializer();
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES = new HashMap();
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES = new HashSet();
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Boolean::typeClass()->getFullName(), "Z");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Byte::typeClass()->getFullName(), "B");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Character::typeClass()->getFullName(), "C");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Double::typeClass()->getFullName(), "D");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Float::typeClass()->getFullName(), "F");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Integer::typeClass()->getFullName(), "I");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Long::typeClass()->getFullName(), "J");
     self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Short::typeClass()->getFullName(), "S");
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Boolean::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Byte::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Character::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Double::clazz());
     //TODO Exception class
     //self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Exception::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Float::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Integer::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Long::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Object::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Short::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(String::clazz());
     self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Classes::classOf('Throwable'));
 }
开发者ID:google-code-backups,项目名称:gwtphp-derpc,代码行数:29,代码来源:SerializabilityUtilEx.php


示例12: testErase

 function testErase(){
     echo $this->char->erase();
     var_dump($char->errors);
     $this->assertEquals(isset(Character::find()->realm($this->source_realmid)->where(array('guid' => $this->guid))->first()->name),false);
     echo $this->char->load_dump_to_realm($this->source_realmid);
     var_dump($char->errors);
     $this->assertEquals(isset(Character::find()->realm($this->source_realmid)->where(array('guid' => $this->guid))->first()->name),true);
 }
开发者ID:reddragon010,项目名称:RG-ServerPanel,代码行数:8,代码来源:CharacterTest.php


示例13: testContainsOnlyTheSpecifiedRange

 public function testContainsOnlyTheSpecifiedRange()
 {
     $generator = Character::ascii();
     $this->assertTrue($generator->contains(""));
     $this->assertTrue($generator->contains("A"));
     $this->assertTrue($generator->contains("b"));
     $this->assertFalse($generator->contains("é"));
 }
开发者ID:nicoder,项目名称:eris,代码行数:8,代码来源:CharacterTest.php


示例14: get_members

 public function get_members(){
     $find = Character::find()
         ->realm($this->realm->id)
         ->join("INNER", 'arena_team_member' ,array('weekgames','weekwins','seasongames','seasonwins','personalrating','arenateamid'),'guid')
         ->where(array('arena_team_member.arenateamid' => $this->arenateamid));
     $members = $find->all();
     return $members;
 }
开发者ID:reddragon010,项目名称:RG-ServerPanel,代码行数:8,代码来源:ArenaTeam.php


示例15: getFulfillers

 /**
  * Get a list of Fulfillers with API credentials.
  *
  * @return array
  */
 protected function getFulfillers()
 {
     // Get all fulfillers who have API credentials.
     $fulfillers = Character::whereNotNull('key_id')->whereNotNull('v_code')->whereHas('roles', function ($q) {
         $q->where('name', '=', 'fulfiller');
     })->get();
     return $fulfillers;
 }
开发者ID:orbitroom,项目名称:4isk,代码行数:13,代码来源:VerifyPayouts.php


示例16: saveNewDeposits

 /**
  * Check WalletJournal for new deposits and save to storage.
  *
  * @param int $lastRefID The last entry on a page of the WalletJournal, used to find the start of the next page.
  * @return void
  */
 protected function saveNewDeposits($lastRefID = null)
 {
     // Setup PhealNG and make a call to the Corporation's WalletJournal endpoint to grab some entries.
     Config::get('phealng');
     $pheal = new Pheal(Config::get('phealng.keyID'), Config::get('phealng.vCode'));
     $query = $pheal->corpScope->WalletJournal(array('fromID' => $lastRefID));
     // Allow mass assignment so we can add records to our secure Deposit model.
     Eloquent::unguard();
     // Create an empty array to store RefIDs (so that we can find the lowest one later).
     $refIDs = array();
     foreach ($query->entries as $entry) {
         // Store all refIDs, even those that aren't related Player Donations.
         array_push($refIDs, $entry->refID);
         // Only check Player Donations.
         if ($entry->refTypeID == 10) {
             // If the Character doesn't already exist in our storage, let's add it.
             $character = Character::firstOrNew(array('id' => $entry->ownerID1, 'name' => $entry->ownerName1));
             if (empty($character['original'])) {
                 $this->newCharacters++;
             }
             // If the refID exists in storage, ignore that entry. Otherwise, save it.
             $deposit = Deposit::firstOrNew(array('ref_id' => $entry->refID));
             if (empty($deposit['original'])) {
                 $deposit->depositor_id = $entry->ownerID1;
                 $deposit->amount = $entry->amount;
                 $deposit->reason = trim($entry->reason);
                 $deposit->sent_at = $entry->date;
                 // Now that we know if the Deposit is new or not, we can se the Character's updated balance.
                 $character->balance = $character->balance + $entry->amount;
                 if ($character->save() && $deposit->save()) {
                     $this->newDeposits++;
                     $this->iskAdded += $entry->amount;
                 }
             } else {
                 if (!empty($deposit['original'])) {
                     $this->existingDeposits++;
                 }
             }
         } else {
             $this->nonDeposits++;
         }
     }
     // Recurse through the function, using a new starting point each time. When the API stops returning entries min
     // will throw an ErrorException. Instead of returning the Exception, we return a report and save it to the log.
     try {
         $this->saveNewDeposits(min($refIDs));
     } catch (Exception $e) {
         $output = "Unrelated entries ignored: " . $this->nonDeposits . "\n";
         $output .= "Existing Deposits ignored: " . $this->existingDeposits . "\n";
         $output .= "New Deposits saved: " . $this->newDeposits . "\n";
         $output .= "New (inactive) Characters added: " . $this->newCharacters . "\n";
         $output .= "Total deposited since last fetch: " . $this->iskAdded . " isk\n";
         Log::info($output);
         echo $output;
     }
 }
开发者ID:orbitroom,项目名称:4isk,代码行数:62,代码来源:FetchDeposits.php


示例17: tearDown

 protected function tearDown()
 {
     CharClass::deleteAll();
     Character::deleteAll();
     Race::deleteAll();
     Skill::deleteAll();
     Stat::deleteAll();
     Description::deleteAll();
     Background::deleteAll();
 }
开发者ID:civilianemail,项目名称:dnd,代码行数:10,代码来源:FinalizeTest.php


示例18: get_members

 public function get_members(){
     $find = Character::find()
         ->realm($this->realm->id)
         ->join("INNER", 'guild_member' ,array('rank','guildid'),'guid')
         ->where(array('guild_member.guildid' => $this->guildid))
         ->order('guild_member.rank')
         ->limit(500);
     $members = $find->all();
     return $members;
 }
开发者ID:reddragon010,项目名称:RG-ServerPanel,代码行数:10,代码来源:Guild.php


示例19: init

 public static function init()
 {
     self::$TYPE_NAMES[' Z'] = Boolean::typeClass();
     self::$TYPE_NAMES[' B'] = Byte::typeClass();
     self::$TYPE_NAMES[' C'] = Character::typeClass();
     self::$TYPE_NAMES[' D'] = Double::typeClass();
     self::$TYPE_NAMES[' F'] = Float::typeClass();
     self::$TYPE_NAMES[' I'] = Integer::typeClass();
     self::$TYPE_NAMES[' J'] = Long::typeClass();
     self::$TYPE_NAMES[' S'] = Short::typeClass();
 }
开发者ID:google-code-backups,项目名称:gwtphp-derpc,代码行数:11,代码来源:RPC.php


示例20: getAChars

 public static function getAChars($acc)
 {
     $chars = Character::model()->findAll(array('select' => 'Name', 'condition' => 'AccountID=:memb___id', 'params' => array(':memb___id' => $acc)));
     foreach ($chars as $key => $char) {
         if ($key + 1 != sizeof($chars)) {
             echo CHtml::link($char->Name, array('char', 'id' => $char->Name), array('class' => 'char-link', 'title' => $char->Name)) . ', ';
         } else {
             echo CHtml::link($char->Name, array('char', 'id' => $char->Name), array('class' => 'char-link', 'title' => $char->Name));
         }
     }
 }
开发者ID:smokeelow,项目名称:faicore,代码行数:11,代码来源:Account.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CharsetConverter类代码示例发布时间:2022-05-20
下一篇:
PHP Channel类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap