2012-06-25 13:04:51 +00:00
|
|
|
<?php
|
|
|
|
class CSRAchievement extends AchAchievement implements CSR {
|
2012-07-02 16:56:13 +00:00
|
|
|
use CSRDispatcher;
|
2012-06-25 13:04:51 +00:00
|
|
|
|
2012-07-02 16:56:13 +00:00
|
|
|
function CSRAchievement($data,$parent) {
|
|
|
|
parent::__construct($data,$parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function makeChild($d) {
|
|
|
|
return new CSRPerk($d,$this);
|
2012-06-25 13:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function grant($pid) {
|
2012-07-02 16:56:13 +00:00
|
|
|
$iter = $this->getIterator();
|
|
|
|
while($iter->hasNext()) {
|
|
|
|
$curr = $iter->getNext();
|
|
|
|
$curr->grant($pid);
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->setChildDone($curr->getID());
|
2012-06-25 13:04:51 +00:00
|
|
|
}
|
2012-07-02 16:56:13 +00:00
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->setChildDone($this->id);
|
2012-06-25 13:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function deny($pid) {
|
2012-07-02 16:56:13 +00:00
|
|
|
$iter = $this->getIterator();
|
|
|
|
while($iter->hasNext()) {
|
|
|
|
$curr = $iter->getNext();
|
|
|
|
$curr->deny($pid);
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->setChildOpen($curr->getID());
|
2012-07-02 16:56:13 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->setChildOpen($this->id);
|
2012-07-02 16:56:13 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
function setPerkDone($id) {
|
2012-07-02 16:56:13 +00:00
|
|
|
echo "perk<br>";
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->setChildDone($id);
|
2012-07-02 16:56:13 +00:00
|
|
|
|
|
|
|
echo "ach<br>";
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->addChildDone($this->id);
|
2012-07-02 16:56:13 +00:00
|
|
|
|
|
|
|
if(!$this->hasOpen()) {
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->removeChildOpen($this->id);
|
2012-07-02 16:56:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
function setPerkOpen($id) {
|
2012-07-02 16:56:13 +00:00
|
|
|
echo "perk<br>";
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->setChildOpen($id);
|
2012-07-02 16:56:13 +00:00
|
|
|
echo "ach<br>";
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->addChildOpen($this->id);
|
2012-07-02 16:56:13 +00:00
|
|
|
|
|
|
|
if(!$this->hasDone()) {
|
2012-07-08 16:11:25 +00:00
|
|
|
$this->parent->removeChildDone($this->id);
|
2012-06-25 13:04:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|