correct copying of Quests and Questtexts
This commit is contained in:
parent
166ece6ac0
commit
51f734e407
3 changed files with 29 additions and 8 deletions
|
|
@ -1343,7 +1343,7 @@
|
|||
}
|
||||
|
||||
// Copy Achievement conditions
|
||||
// Do this after copying the Achievements itself to ensure Meta-
|
||||
// Do this after copying the Achievements themselves to ensure Meta-
|
||||
// Achievements work correctly
|
||||
foreach($achievements as &$achievement)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -396,7 +396,6 @@
|
|||
}
|
||||
|
||||
// XPs of child Questgroups
|
||||
//var_dump($this->Questgroupshierarchy);
|
||||
$questgroupHierarchy = $this->Questgroupshierarchy->getHierarchyForQuestgroup($questgroupId);
|
||||
if(!empty($questgroupHierarchy))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -710,8 +710,7 @@
|
|||
'FROM quests '.
|
||||
'WHERE id = ?',
|
||||
'iii',
|
||||
$userId,
|
||||
$questgroupIds[$quest['questgroup_id']],
|
||||
$userId, $questgroupIds[$quest['questgroup_id']],
|
||||
$quest['id']
|
||||
);
|
||||
$questIds[$quest['id']] = $this->db->getInsertId();
|
||||
|
|
@ -731,10 +730,7 @@
|
|||
}
|
||||
|
||||
// Copy texts
|
||||
$questtextIds = array_merge(
|
||||
$questtextIds,
|
||||
$this->Questtexts->copyQuesttexts($userId, $quest['id'], $questIds[$quest['id']], $seminaryMediaIds)
|
||||
);
|
||||
$questtextIds = $questtextIds + $this->Questtexts->copyQuesttexts($userId, $quest['id'], $questIds[$quest['id']], $seminaryMediaIds);
|
||||
|
||||
// Copy content
|
||||
$questtype = $this->Questtypes->getQuesttypeById($quest['questtype_id']);
|
||||
|
|
@ -751,6 +747,32 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Copy flow
|
||||
// Do this after copying the Quests themselves to ensure all Quests
|
||||
// have their target IDs.
|
||||
foreach($quests as &$quest)
|
||||
{
|
||||
$previousQuests = $this->db->query(
|
||||
'SELECT previous_quest_id '.
|
||||
'FROM quests_previousquests '.
|
||||
'WHERE quest_id = ?',
|
||||
'i',
|
||||
$quest['id']
|
||||
);
|
||||
foreach($previousQuests as &$previousQuest)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT INTO quests_previousquests '.
|
||||
'(quest_id, previous_quest_id) '.
|
||||
'VALUES '.
|
||||
'(?, ?)',
|
||||
'ii',
|
||||
$questIds[$quest['id']],
|
||||
$questIds[$previousQuest['previous_quest_id']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return array(
|
||||
'quests' => $questIds,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue