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


PHP client::logPlayerCompletedQuest方法代码示例

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


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

示例1: checkForCascadingLogs

 public static function checkForCascadingLogs($pack)
 {
     $quests = dbconnection::queryArray("SELECT * FROM quests WHERE game_id = '{$pack->game_id}'");
     $completedRecords = dbconnection::queryArray("SELECT * FROM user_log WHERE game_id = '{$pack->game_id}' AND user_id = '{$pack->auth->user_id}' AND event_type = 'COMPLETE_QUEST' AND deleted = 0 GROUP BY content_id");
     $incompleteQuests = array();
     for ($i = 0; $i < count($quests); $i++) {
         $completed = false;
         for ($j = 0; $j < count($completedRecords); $j++) {
             if ($quests[$i]->quest_id == $completedRecords[$j]->content_id) {
                 $completed = true;
             }
         }
         if (!$completed) {
             $incompleteQuests[] = $quests[$i];
         }
     }
     $reqQueryPack = new stdClass();
     $reqQueryPack->game_id = $pack->game_id;
     $reqQueryPack->user_id = $pack->auth->user_id;
     $questQueryPack = new stdClass();
     $questQueryPack->game_id = $pack->game_id;
     $questQueryPack->auth = $pack->auth;
     $questQueryPack->silent = true;
     //logPlayerCompletedQuest would otherwise recursively call this function. Might as well save it for the end.
     $dirty = false;
     for ($i = 0; $i < count($incompleteQuests); $i++) {
         $reqQueryPack->requirement_root_package_id = $incompleteQuests[$i]->complete_requirement_root_package_id;
         $questQueryPack->quest_id = $incompleteQuests[$i]->quest_id;
         if (requirements::evaluateRequirementPackage($reqQueryPack)) {
             client::logPlayerCompletedQuest($questQueryPack);
             $dirty = true;
         }
     }
     if ($dirty) {
         client::checkForCascadingLogs($pack);
     }
     //log changed, potentially requiring more logs
 }
开发者ID:kimblemj,项目名称:server,代码行数:38,代码来源:client.php


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