本文整理汇总了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
}