$page .= "<ul class='list-group'>";
 foreach ($loc["loc"] as $oid => $obj) {
     if (substr($oid, 0, 4) == "npc_") {
         $skillsButtons = "<ul class='pagination pagination-sm'>";
         for ($i = 1; $i <= 5; $i++) {
             $skillsButtons .= "<li><a href='/?game=travel&a=use&section=skill&cell=" . ($i - 1) . "&to=" . $oid . "'>" . $i . "</a></li>";
         }
         $skillsButtons .= "</ul>";
         $iItems = "<ul class='pagination pagination-sm'>";
         for ($i = 1; $i <= 5; $i++) {
             $iItems .= "<li><a href='/?game=travel&a=use&section=item&cell=" . ($i - 1) . "&to=" . $oid . "'>" . $i . "</a></li>";
         }
         $iItems .= "</ul>";
         $nid = preg_split("/[_\\.]/", $oid);
         $speakLink = "";
         if (\Likedimion\Dialog\Dialog::exists($nid[1])) {
             $speakLink = "<a href=\"/?game=dialog&dId=" . $oid . "\">говорить</a><div class='hr'></div>";
         }
         $page .= "<li class='list-group-item little_block_center strong'>";
         $npcTitle = View::compileNpcTitle($obj, $player);
         $page .= <<<END_NPC
 <div class="ui_player" id="ui_player{$oid}" onclick="menu('npc{$oid}_menu');">
 <span>{$npcTitle}</span>
 </div>
 <div id="npc{$oid}_menu" class="menu" style="display: none;">
     {$speakLink}
     <a href="/?game=travel&section=attack&to={$oid}">атаковать</a><br/>
     использовать навык
     {$skillsButtons}
     <div class="hr"></div>
     использовать предмет
<?php

/**
 * Created by PhpStorm.
 * User: babenoff
 * Date: 28.12.2015
 * Time: 17:50
 */
$dId = $_GET["dId"];
if (\Likedimion\Dialog\Dialog::exists($dId)) {
    $dialog = new \Likedimion\Dialog\Dialog($dId);
    $sectionId = isset($_GET["sId"]) ? $_GET["sId"] : "start";
    $playerHelper->getPlayer()["event"]["sId"] = $sectionId;
    $playerHelper->update();
    try {
        $section = $dialog->getSection($sectionId);
        $title = $section->getOption("title", "Диалог");
        $text = $section->getReply()->getText();
        $page = "<div class='alert alert-info'>" . $text . "</div>";
        $answers = $section->getAnswersIterator();
        $page .= "<div class='list-group'>";
        if ($answers->count() < 1) {
            $playerHelper->setEvent([]);
            $playerHelper->update();
            $page .= "<div class='list-group-item little_block_center strong'><a href='/?'>конец </a></div>";
        }
        while ($answers->valid()) {
            /** @var \Likedimion\Dialog\DialogAnswer $answer */
            $answer = $answers->current();
            $page .= "<div class='list-group-item little_block_center strong'><a href='/?game=roller&dId=" . $_GET["dId"] . "&sId=" . $answer->getSectionId() . "'>" . $answer->getReply()->getText() . "</a></div>";
            $answers->next();