Hello!
Below is a chunk of my quest code. It is supposed to remove 10 rock cones if the user has 10 and has not already completed the quest. If they have completed the quest it is supposed to simply tell them they no longer need rock cones. However, my users have reported that even when they've already done it they are still losing rock cones out of their inventory (and not receiving a reward for it). Does anyone see an issue in this chunk of code that would result in them having 10 rock cones taken out even after already doing it?
PHP Code:
public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle("Turn in 10 Rock Cones");
// Allow user to complete quest if they have not yet.
$notdone = $mysidia->db->select("users", array("quest1"), "quest1='no' and username='{$mysidia->user->username}'")->fetchColumn();
$takeItem = $this->takeItem("Rock Cone", 10);
if ($notdone){
if ($takeItem){
$mysidia->db->update("users", array("quest1" => "yes"), "username = '{$mysidia->user->username}'");
$amount = 150;
$mysidia->user->changecash($amount);
$document->add(new Comment("Thank you for bringing me those Rock Cones!<br>
You've recieve $amount kibs as a thankyou!", FALSE));
} else {
$document->add(new Comment("Hey, this isn't enough Rock Cones!", FALSE));
}
}
else {
$document->add(new Comment("Sorry, we don't need anymore rock cones.", FALSE));
}
}