correct copying of Quests and Questtexts
This commit is contained in:
parent
c0b22f03e1
commit
191ef2c6b9
3 changed files with 29 additions and 8 deletions
|
|
@ -1343,7 +1343,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy Achievement conditions
|
// 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
|
// Achievements work correctly
|
||||||
foreach($achievements as &$achievement)
|
foreach($achievements as &$achievement)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// XPs of child Questgroups
|
// XPs of child Questgroups
|
||||||
//var_dump($this->Questgroupshierarchy);
|
|
||||||
$questgroupHierarchy = $this->Questgroupshierarchy->getHierarchyForQuestgroup($questgroupId);
|
$questgroupHierarchy = $this->Questgroupshierarchy->getHierarchyForQuestgroup($questgroupId);
|
||||||
if(!empty($questgroupHierarchy))
|
if(!empty($questgroupHierarchy))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -710,8 +710,7 @@
|
||||||
'FROM quests '.
|
'FROM quests '.
|
||||||
'WHERE id = ?',
|
'WHERE id = ?',
|
||||||
'iii',
|
'iii',
|
||||||
$userId,
|
$userId, $questgroupIds[$quest['questgroup_id']],
|
||||||
$questgroupIds[$quest['questgroup_id']],
|
|
||||||
$quest['id']
|
$quest['id']
|
||||||
);
|
);
|
||||||
$questIds[$quest['id']] = $this->db->getInsertId();
|
$questIds[$quest['id']] = $this->db->getInsertId();
|
||||||
|
|
@ -731,10 +730,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy texts
|
// Copy texts
|
||||||
$questtextIds = array_merge(
|
$questtextIds = $questtextIds + $this->Questtexts->copyQuesttexts($userId, $quest['id'], $questIds[$quest['id']], $seminaryMediaIds);
|
||||||
$questtextIds,
|
|
||||||
$this->Questtexts->copyQuesttexts($userId, $quest['id'], $questIds[$quest['id']], $seminaryMediaIds)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Copy content
|
// Copy content
|
||||||
$questtype = $this->Questtypes->getQuesttypeById($quest['questtype_id']);
|
$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(
|
return array(
|
||||||
'quests' => $questIds,
|
'quests' => $questIds,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue