correctly set status of Sidequests
This commit is contained in:
parent
5706d6fe14
commit
5cd7372ad2
2 changed files with 55 additions and 2 deletions
|
|
@ -261,7 +261,12 @@
|
|||
$character = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
||||
|
||||
// Set solved
|
||||
$this->Quests->setQuestSolved($quest['id'], $character['id']);
|
||||
if(is_null($sidequest)) {
|
||||
$this->Quests->setQuestSolved($quest['id'], $character['id']);
|
||||
}
|
||||
else {
|
||||
$this->Quests->setSidequestSolved($sidequest['id'], $character['id']);
|
||||
}
|
||||
|
||||
|
||||
// Redirect
|
||||
|
|
@ -294,7 +299,13 @@
|
|||
$character = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
||||
|
||||
// Set solved
|
||||
$this->Quests->setQuestUnsolved($quest['id'], $character['id']);
|
||||
if(is_null($sidequest)) {
|
||||
$this->Quests->setQuestUnsolved($quest['id'], $character['id']);
|
||||
}
|
||||
else {
|
||||
$this->Quests->setSidequestUnsolved($sidequest['id'], $character['id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Redirect
|
||||
|
|
|
|||
|
|
@ -217,6 +217,27 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark a Sidequest as solved for a Character.
|
||||
*
|
||||
* @param int $sidequestId ID of Sidequest to mark as solved
|
||||
* @param int $characterId ID of Character that solved the Sidequest
|
||||
*/
|
||||
public function setSidequestSolved($sidequestId, $characterId)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT INTO sidequests_characters '.
|
||||
'(sidequest_id, character_id, status) '.
|
||||
'VALUES '.
|
||||
'(?, ?, ?)',
|
||||
'iii',
|
||||
$sidequestId,
|
||||
$characterId,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark a Quest as unsolved for a Character.
|
||||
*
|
||||
|
|
@ -238,6 +259,27 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark a Sidequest as unsolved for a Character.
|
||||
*
|
||||
* @param int $sidequestId ID of Sidequest to mark as unsolved
|
||||
* @param int $characterId ID of Character that unsolved the Sidequest
|
||||
*/
|
||||
public function setSidequestUnsolved($sidequestId, $characterId)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT INTO sidequests_characters '.
|
||||
'(sidequest_id, character_id, status) '.
|
||||
'VALUES '.
|
||||
'(?, ?, ?)',
|
||||
'iii',
|
||||
$sidequestId,
|
||||
$characterId,
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the given Character has solved the given Quest.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue