case "item": if (isset($items[$id[1]])) { $iid = $id; unset($iid[0]); $iid = implode("_", $iid); $item = $items[$iid]; $item["ai"]["respawn"]["loc"] = $locId; $itemId = "item_" . $id[1] . "_" . \Likedimion\Helper\View::generateRandomString(rand(3, 5)); $locHelper->addObject($itemId, $item); } break; } } } } $locations[$key] = $locHelper->getLoc(); } try { $loc_i->batchInsert($locations); $page = <<<PAGE <div class="alert alert-success">Локациии успешно обновлены</div> PAGE; } catch (MongoException $e) { $page = <<<PAGE <div class="alert alert-danger">Не удалось обновить мир, возникла ошибка<br/>{$e->getMessage()}</div> PAGE; } //квесты while (list($qId, $quest) = each($questBank)) { $quest["qid"] = $qId; $questBank[$qId] = $quest;
<a href="/?game=msg&action=add&pid={$owner["_id"]}">в контакты</a> </div> END_PLAYER; $page .= "</li>"; } } } $page .= "</ul>"; //выходы if ($loc["doors"]) { $locHelper->setCollection($ld->locations); $page .= "<div class='list-group'>"; for ($i = 0; $i < count($loc["doors"]); $i++) { $added = str_repeat("!", $locHelper->getCountNpc($loc["doors"][$i][1])); $doorData = $locHelper->getCollection()->findOne(["lid" => $loc["doors"][$i][1]], ["terr"]); if ($doorData["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_UNGUARD and $locHelper->getLoc()["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_GUARD) { $guard = "<span class='label label-danger'>#</span>"; } elseif ($doorData["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_GUARD and $locHelper->getLoc()["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_UNGUARD) { $guard = "<span class='label label-success'>!</span>"; } else { $guard = ""; } $page .= "<div class='list-group-item little_block_center'>" . $guard . "\n<a id='center' class='strong' href='/?game=travel&go=" . $loc["doors"][$i][1] . "'>" . $loc["doors"][$i][0] . "</a> <span class='label label-warning'>" . substr($added, 0, 3) . "</span>\n</div>"; } $page .= "</div>"; } //$locHelper->clearJournal(); $playerHelper->clearJournal(); $ld->locations->update(["_id" => new MongoId($loc["_id"])], $locHelper->getLoc()); } else { $page .= "<div class='alert alert-warning'>Какая-то безжизненная пустыня</div>";
header("Location: /?"); } /** * Created by PhpStorm. * User: babenoff * Date: 06.12.2015 * Time: 23:56 */ if (isset($_GET["pid"])) { $player = $ld->players->findOne(["_id" => new MongoId($_GET["pid"])]); if ($player and $player["aid"] = $_SESSION["aid"]) { $_SESSION["pid"] = $player["_id"]; $playerHelper = new \Likedimion\Helper\PlayerHelper($player); $playerHelper->addTimer("online", $config["online_time"]); $playerHelper->setCollection($ld->players); $playerHelper->update(); $loc = $ld->locations->findOne(["lid" => $player["loc"]]); $lHelper = new \Likedimion\Helper\LocationHelper($loc); $lHelper->addPlayer($player["_id"]); $msg = ($player["sex"] == "m" ? " появился " : " появилась ") . $player["title"]; $lHelper->addJournal($msg, $ld->players, $player["_id"]); try { $ld->locations->update(["_id" => new MongoId($lHelper->getLoc()["_id"])], $lHelper->getLoc()); header("Location: /?"); } catch (MongoException $e) { die($e->getMessage()); } } else { require ROOT . "/404.php"; } }