<?php /** * Created by PhpStorm. * User: babenoff * Date: 24.12.2015 * Time: 21:26 */ $player = $playerHelper->getPlayer(); if ($_GET["go"] and $_GET["go"] != $player["loc"]) { $oldLoc = $ld->locations->findOne(["lid" => $player["loc"]]); $oldLocHelper = new \Likedimion\Helper\LocationHelper($oldLoc); $oldLocHelper->setCollection($ld->locations); $newLoc = $ld->locations->findOne(["lid" => $_GET["go"]]); if ($newLoc) { $newLocHelper = new \Likedimion\Helper\LocationHelper($newLoc); $oldLocHelper->removePlayer($player["_id"]); $newLocHelper->addPlayer($player["_id"]); $newLocHelper->setCollection($ld->locations); $playerHelper->move($_GET["go"]); $playerHelper->update(); if ($oldLoc["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_GUARD and $newLoc["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_UNGUARD) { $playerHelper->addJournal("Вы покунули охраняемую территорию."); } elseif ($oldLoc["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_UNGUARD and $newLoc["terr"] == \Likedimion\Helper\LocationHelper::TERRITORY_GUARD) { $playerHelper->addJournal("Вы на охраняемой территории."); } $outmsg = $player["title"] . ($player["sex"] == "m" ? " ушел " : " ушла ") . $oldLocHelper->getDoorName($_GET["go"]); $inmsg = ($player["sex"] == "m" ? " пришел " : " пришла ") . $player["title"]; $oldLocHelper->addJournal($outmsg, $ld->players, $player["_id"]); $newLocHelper->addJournal($inmsg, $ld->players, $player["_id"]); $oldLocHelper->update();
* Time: 15:58 */ use Likedimion\Game; use Likedimion\Helper\View; if (!defined('ROOT')) { header("Location: /?"); } $adminSession = false; if ($_SESSION["pid"]) { Game::init()->setDb($ld); Game::init()->setDispatcher(require "event_dispatcher.php"); Game::init()->setPlayer($_SESSION["pid"]); $player = Game::init()->getPlayer(); $loc = $ld->locations->findOne(["lid" => $player["loc"]]); if ($loc) { $locationHelper = new \Likedimion\Helper\LocationHelper($loc); $locationHelper->setCollection($ld->locations); Game::init()->addService('loc.helper', $locationHelper); } if (count($player["event"]) > 0) { foreach ($_GET as $key => $value) { if (isset($player["event"][$key])) { $player["event"][$key] = $value; } } $_GET = array_merge($_GET, $player["event"]); } if (empty($_GET["game"])) { $_GET["game"] = "travel"; } if (!empty($_GET["admin"])) {
<div class="text strong"> <span class="game_ui_icon icon_star"></span> <span class="title strong">опыт</span> <span id="data">{$exp} / {$needExp}</span> </div> </div> </div> PAGE; //БАФФЫ if ($loc["messages"]) { while (list($i, $msg) = each($loc["messages"])) { $playerHelper->addJournal($msg); } } if ($loc) { $locHelper = new \Likedimion\Helper\LocationHelper($loc); $journalAll = $playerHelper->getJournal(); $size = count($journalAll); for ($i = $size; $i >= 0; $i--) { for ($j = 0; $j <= $i - 1; $j++) { if ($journalAll[$j]["time"] > $journalAll[$j + 1]["time"]) { $k = $journalAll[$j]["time"]; $journalAll[$j]["time"] = $journalAll[$j + 1]["time"]; $journalAll[$j + 1]["time"] = $k; } } } //ЖУРНАЛ if (count($journalAll) > 0) { $page .= '<div id="journalContainer"><div id="journal">'; while (list($key, $journalMsg) = each($journalAll)) {
<?php /** * Created by PhpStorm. * User: babenoff * Date: 25.12.2015 * Time: 21:27 */ if ($_POST["speak_msg"]) { $_POST["speak_msg"] = strip_tags($_POST["speak_msg"]); $_POST["speak_msg"] = \Likedimion\Censure\Censure::parse($_POST["speak_msg"], 3, "…", true, "[бип]"); $loc = $ld->locations->findOne(["lid" => $player["loc"]]); if ($loc) { $locHelper = new \Likedimion\Helper\LocationHelper($loc); $locHelper->setCollection($ld->locations); if ($_GET["to"]) { $toPlayer = $playerHelper->getCollection()->findOne(["_id" => new MongoId($_GET["to"])]); if ($toPlayer) { //$msg = $player["title"] . " говорит <b>" . $toPlayer["title"] . "</b> "; $toPlayerHelper = new \Likedimion\Helper\PlayerHelper($toPlayer); $toPlayerHelper->setCollection($ld->players); if ($_POST["private"]) { $msgTo = "<b>[П!]</b><span class='text-underline'>" . $player["title"] . "</span> шепчет <b>вам</b>: " . $_POST["speak_msg"]; $msgFrom = "Вы шепчете <span style='text-decoration: underline;'>" . $toPlayer["title"] . "</span> " . $_POST["speak_msg"]; $msgAll = "<span class='text-underline'>" . $player["title"] . "</span> что-то шепчет <span class='text-underline'>" . $toPlayer["title"] . "</span>"; $playerHelper->addJournal($msgFrom); $toPlayerHelper->addJournal($msgTo); $toPlayerHelper->update(); $locHelper->addJournal($msgAll, $ld->players, $player["_id"], $toPlayer["_id"]); $locHelper->update(); } else {
try { $ld->locations->remove(); $ld->quests->remove(); $ld->items->remove(); } catch (MongoException $e) { return; } /* @var MongoCollection $loc_i type */ $loc_i = $ld->locations; $q = $ld->quests; $it = $ld->items; $loc_i->createIndex(["lid" => 1], ["unique" => true]); $q->createIndex(["qid" => 1], ["unique" => true]); $it->createIndex(["iid" => 1], ["unique" => true]); foreach ($locations as $key => $location) { $locHelper = new \Likedimion\Helper\LocationHelper($location); //$locHelper->setCollection($ld->locations); foreach ($respawns as $locId => $respawn) { if ($locId == $location["lid"]) { for ($i = 0; $i < count($respawn); $i++) { $id = preg_split("/[_\\.]/", $respawn[$i]); switch ($id[0]) { case "npc": if (isset($npc_lib[$id[1]])) { $npcCompiler = new \Likedimion\Helper\NpcCompiler(); $npc = $npc_lib[$id[1]]; $manNames = str_replace(",", "", $manNames); $mNames = preg_split("/(\r\n)|(\n)/", $manNames); $wNames = preg_split("/(\r\n)|(\n)/", $womanNames); $npcCompiler->setNpc($npc)->setManNames($mNames)->setWomanNames($wNames); $npcCompiler->compile();
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"; } }