Esempio n. 1
0
 function getRemainingPlusTime($action)
 {
     $time = 0;
     $tasks = $this->queueModel->tasksInQueue;
     if (isset($tasks[constant('QS_PLUS' . ($action + 1))])) {
         $time = $tasks[constant('QS_PLUS' . ($action + 1))][0]['remainingSeconds'];
     }
     return 0 < $time ? time_remain_lang . ' <span id="timer1">' . WebHelper::secondstostring($time) . '</span> ' . time_hour_lang : '';
 }
Esempio n. 2
0
 public function getRemainingPlusTime($action)
 {
     $time = 0;
     $tasks = $this->queueModel->tasksInQueue;
     if (isset($tasks[constant("QS_PLUS" . ($action + 1))])) {
         $time = $tasks[constant("QS_PLUS" . ($action + 1))][0]['remainingSeconds'];
     }
     return 0 < $time ? time_remain_lang . " <span id=\"timer1\">" . WebHelper::secondstostring($time) . "</span> " . time_hour_lang : "";
 }
Esempio n. 3
0
 function getActionText($neededResources, $isField, $upgrade, &$item_id)
 {
     $needUpgradeType = $this->needMoreUpgrades($neededResources, $item_id);
     if (0 < $needUpgradeType) {
         switch ($needUpgradeType) {
             case 1:
                 '<span class="none">' . buildings_p_upg0 . '</span>';
             case 2:
                 '<span class="none">' . buildings_p_upg1 . '</span>';
             case 3:
                 '<span class="none">' . buildings_p_upg2 . '</span>';
             case 4:
                 '<span class="none">' . buildings_p_upg3 . '</span>';
         }
         return;
     } else {
         if ($this->isResourcesAvailable($neededResources)) {
             $pageNamePostfix = $isField ? '1' : '2';
             $link = $upgrade ? '<a class="build" href="village' . $pageNamePostfix . '.php?id=' . $this->buildingIndex . '&k=' . $this->data['update_key'] . '">' . buildings_p_upg_tolevel . ' ' . $this->buildProperties['nextLevel'] . '</a>' : '<a class="build" href="village2.php?id=' . $this->buildingIndex . '&b=' . $item_id . '&k=' . $this->data['update_key'] . '">' . buildings_p_create_newbuild . '</a>';
             $workerResult = $this->isWorkerBusy($isField);
             return $workerResult['isBusy'] ? '<span class="none">' . buildings_p_workersbusy . '</span>' : $link . ($workerResult['isPlusUsed'] ? ' <span class="none">(' . buildings_p_wait_buildqueue . ')</span>' : '');
         }
     }
     $neededTime = $this->getNeededTime($neededResources);
     return '<span class="none">' . (0 < $neededTime ? buildings_p_willenoughresat . ' ' . WebHelper::secondstostring($neededTime) . ' ' . time_hour_lang : buildings_p_notenoughres2) . '</span>';
 }
Esempio n. 4
0
 function handleNoQuiz($m, $quizStep)
 {
     $time = floor(36000 / $this->gameMetadata['game_speed']);
     $this->guideData['quiztime'] = WebHelper::secondstostring($time);
     $result = 0;
     switch ($quizStep) {
         case 0:
             if (isset($_GET['v']) && trim($_GET['v']) == 'y') {
                 $result = 1;
                 $newTask = new QueueTask(QS_PLUS1, $this->player->playerId, 86400);
                 $newTask->villageId = '';
                 $newTask->tag = 0;
                 $this->queueModel->addTask($newTask);
                 $m->increaseGoldNumber($this->player->playerId, 15);
                 $newTask = new QueueTask(QS_GUIDENOQUIZ, $this->player->playerId, $time);
                 $this->queueModel->addTask($newTask);
             }
             break;
         case 1:
         case 2:
         case 3:
         case 4:
         case 5:
             if (!isset($this->queueModel->tasksInQueue[QS_GUIDENOQUIZ]) && isset($_GET['v']) && trim($_GET['v']) == 'y') {
                 $result = 1;
                 $m->addResourcesTo($this->data['selected_village_id'], array(217, 247, 177, 207));
                 $newTask = new QueueTask(QS_GUIDENOQUIZ, $this->player->playerId, $time);
                 $this->queueModel->addTask($newTask);
             }
             break;
         case 6:
             if (!isset($this->queueModel->tasksInQueue[QS_GUIDENOQUIZ]) && isset($_GET['v']) && trim($_GET['v']) == 'y') {
                 $this->clientAction = 100;
                 $this->quiz = GUIDE_QUIZ_COMPLETED;
                 $m->setGuideTask($this->player->playerId, $this->quiz);
                 $newTask = new QueueTask(QS_PLUS1, $this->player->playerId, 172800);
                 $newTask->villageId = '';
                 $newTask->tag = 0;
                 $this->queueModel->addTask($newTask);
                 $m->increaseGoldNumber($this->player->playerId, 20);
             }
     }
     if ($result == 1 && $quizStep < 6) {
         ++$quizStep;
         $this->quiz = '0,201,' . $quizStep;
         $m->setGuideTask($this->player->playerId, $this->quiz);
     }
     $this->guideData['quizStep'] = $quizStep;
     $this->guideData['pended'] = isset($this->queueModel->tasksInQueue[QS_GUIDENOQUIZ]);
     if ($this->guideData['pended']) {
         $this->guideData['remainingSeconds'] = $this->queueModel->tasksInQueue[QS_GUIDENOQUIZ][0]['remainingSeconds'];
     }
 }