Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function showItemList($list, $type)
- {
- global $tpl;
- for ($x = 0; $x < count($list); $x++)
- {
- if ($list[$x]["add_name"] != "")
- $list[$x]["name"] .= " <span class='uk-text-desc'>{$list[$x]['add_name']}</span>";
- $hint = !empty($list[$x]["description"]) ? " data-uk-tooltip=\"{pos:'top-left'}\" title=\"{$list[$x]['description']}\"" : "";
- $tpl->insert_loop("main.body.info.{$type}.item", array(
- "ID" => $list[$x]["id"],
- "ICON" => getIcon($list[$x]["icon"], $list[$x]["icon_ex"], "ID: {$list[$x]['id']}"),
- "NAME" => "<a href='?show=item_info&id={$list[$x]['item_id']}&tab=1'{$hint}>{$list[$x]['name']}</a>",
- "COUNT" => $list[$x]["min"] != $list[$x]["max"] ? "{$list[$x]['min']} - {$list[$x]['max']}" : $list[$x]["min"],
- "CHANCE" => $list[$x]["chance"] >= 1 ? "{$list[$x]['chance']}%" : "1/".round(100 / $list[$x]['chance'])));
- }
- }
- if ($id > 0 && $db->is_exists("SELECT id FROM npc_data WHERE id = {$id} LIMIT 1"))
- {
- $tpl->assign("N_ID", $id);
- $tabs = array("Параметры", "Дроп / Спойл", "Места спавнов", "Торговля");
- $tab = $util->getNumber(@$_GET["tab"], 0, range(0, count($tabs) - 1));
- $disabled = array();
- $result = $db->query("SELECT * FROM npc_data WHERE id = {$id} LIMIT 1");
- $npc = $db->fetch_assoc($result);
- if ($npc["is_drop"] != 1 && $npc["is_spoil"] != 1)
- $disabled[] = 1;
- if ($npc["is_spawn"] != 1)
- $disabled[] = 2;
- if ($npc["is_merchant"] != 1)
- $disabled[] = 3;
- if (in_array($tab, $disabled))
- $tab = 0;
- showTabsControl($tab, $tabs, "main.body.info.tabs", $disabled);
- // --------------- params ---------------
- $raceName = getSkillName(289406976 + $npc["race"]);
- $attrAtk = explode(";", $npc["attr_atk"]);
- $attrDef = explode(";", $npc["attr_def"]);
- showParam("Уровень", $npc["level"]);
- showParam("Раса", "<a href='?show=npcs&type=race&race={$npc['race']}'>".getSkillName(289406976 + $npc["race"])."</a>", "uk-text-danger");
- showParam("Опыт (рейты х{$serverRates})", number_format($npc["exp"]), true);
- showParam("SP (рейты х{$serverRates})", number_format($npc["sp"]), true);
- showParam("Сила (<b>STR</b>)", $npc["_str"]);
- showParam("Интеллект (<b>INT</b>)", $npc["_int"]);
- showParam("Ловкость (<b>DEX</b>)", $npc["_dex"]);
- showParam("Разум (<b>WIT</b>)", $npc["_wit"]);
- showParam("Телосложение (<b>CON</b>)", $npc["_con"]);
- showParam("Ментальная защита (<b>MEN</b>)", $npc["_men"]);
- showParam("HP", number_format(round($npc["hp"] * $npc["hp_mod"])), "uk-text-hp");
- showParam("MP", number_format(round($npc["mp"] * $npc["mp_mod"])), "uk-text-mp");
- showParam("Физическая атака", number_format(round($npc["patk"] * $npc["patk_mod"])));
- showParam("Магическая атака", number_format(round($npc["matk"] * $npc["matk_mod"])));
- showParam("Физическая защита", number_format(round($npc["pdef"] * $npc["pdef_mod"])));
- showParam("Магическая защита", number_format(round($npc["mdef"] * $npc["mdef_mod"])));
- if ($npc["sdef"] > 0)
- {
- showParam("Физическая защита щита", number_format($npc["sdef"]));
- showParam("Шанс блокировки щитом", $npc["sdef_rate"]."%");
- }
- showParam("Шанс критической атаки", round($npc["critical"] / 10, 1)."%");
- showParam("Дальность физической атаки", number_format($npc["attack_range"]));
- showParam("Скорость физической атаки", number_format($npc["patk_speed"]));
- showParam("Скорость магической атаки", number_format($npc["matk_speed"]));
- showParam("Скорость ходьбы", $npc["walk_speed"]);
- showParam("Скорость бега", $npc["run_speed"]);
- showParam("Атрибут атаки", $attrAtk[0] > -1 ? $attrList[$attrAtk[0]]." (".number_format($attrAtk[1]).")" : "Нейтральный");
- showParam("Атрибут защиты от огня", $attrDef[0]);
- showParam("Атрибут защиты от воды", $attrDef[1]);
- showParam("Атрибут защиты от ветра", $attrDef[2]);
- showParam("Атрибут защиты от земли", $attrDef[3]);
- showParam("Атрибут защиты от света", $attrDef[4]);
- showParam("Атрибут защиты от тьмы", $attrDef[5]);
- if ($npc["rhand"] > 0)
- {
- $item = getItemName($npc["rhand"]);
- if ($item != null)
- showParam("В правой руке держит", "<a href='?show=item_info&id={$item['id']}'>{$item['name']}</a>");
- }
- if ($npc["lhand"] > 0)
- {
- $item = getItemName($npc["lhand"]);
- if ($item != null)
- showParam("В левой руке держит", "<a href='?show=item_info&id={$item['id']}'>{$item['name']}</a>");
- }
- showParam("Социальный (дальность)", strYN($npc["faction"] != "").($npc["faction_range"] > 0 ? " ({$npc['faction_range']})" : ""));
- showParam("Агрессивный (дальность)", strYN($npc["aggro_range"] > 0, true).($npc["aggro_range"] > 0 ? " ({$npc['aggro_range']})" : ""));
- showParam("Есть дроп хербов", strYN($npc["is_drop_herb"]));
- // --------------- skills
- $result=$db->query("SELECT B.uid, B.id, B.level, B.name, B.description, B.icon, B.is_done
- FROM npc_skills AS A
- LEFT JOIN skill_info AS B ON (A.uid = B.uid)
- WHERE A.npc_id = {$id} AND B.lang = '{$lang}'
- ORDER BY B.name");
- if ($db->num_rows($result) > 0)
- {
- $list = $db->fetch_array($result);
- for ($x = 0; $x < count($list); $x++)
- {
- $hint = !empty($list[$x]["description"]) ? " data-uk-tooltip=\"{pos:'top-left'}\" title=\"{$list[$x]['description']}\"" : "";
- $tpl->insert_loop("main.body.info.skills.skill", array(
- "ICON" => $list[$x]["icon"],
- "ID" => $list[$x]["id"],
- "LEVEL" => $list[$x]["level"],
- "NAME" => "<a href='?show=skill_info&uid={$list[$x]['uid']}'{$hint}>{$list[$x]['name']}</a>",
- "IS_DONE" => !$list[$x]["is_done"] ? "<span class='uk-badge uk-badge-warning uk-icon-bug uk-box-shadow' data-uk-tooltip title='Умение не реализовано'></span>" : ""));
- }
- $tpl->parse("main.body.info.skills");
- }
- // --------------- minions
- $result=$db->query("SELECT A.id, A.count, B.name, B.title, C.race
- FROM npc_minions AS A
- LEFT JOIN npc_info AS B ON (A.id = B.id)
- LEFT JOIN npc_data AS C ON (A.id = C.id)
- WHERE A.npc_id = {$id} AND B.lang = '{$lang}'
- ORDER BY B.name");
- if ($db->num_rows($result) > 0)
- {
- $list = $db->fetch_array($result);
- for ($x = 0; $x < count($list); $x++)
- {
- if (!empty($npc["title"]))
- $list[$x]["name"] = "<span class='uk-text-desc'>{$npc['title']}</span> {$list[$x]['name']}";
- $tpl->insert_loop("main.body.info.minions.minion", array(
- "ICON" => $list[$x]["race"],
- "ID" => $list[$x]["id"],
- "COUNT" => $list[$x]["count"],
- "NAME" => "<a href='?show=npc_info&id={$list[$x]['id']}'>{$list[$x]['name']}</a>"));
- }
- $tpl->parse("main.body.info.minions");
- }
- // --------------- spawns
- $result = $db->query("SELECT * FROM spawn_data WHERE npc_id = {$npc['id']}");
- $list = array();
- $sMul = 1;
- if ($db->num_rows($result) == 0)
- {
- $result = $db->query("SELECT * FROM npc_minions WHERE id = {$npc['id']} LIMIT 1");
- if ($db->num_rows($result) > 0)
- {
- $mData = $db->fetch_assoc($result);
- $result = $db->query("SELECT * FROM spawn_data WHERE npc_id = {$mData['npc_id']}");
- if ($db->num_rows($result) > 0)
- {
- $list = $db->fetch_array($result);
- $sMul = $mData['count'];
- }
- }
- }
- else
- $list = $db->fetch_array($result);
- if (count($list) > 0)
- {
- $instances = array();
- foreach ($list as $spawn)
- if ($spawn["ref_id"] > 0)
- $instances[] = $spawn["ref_id"];
- if (count($instances) > 0)
- {
- $result = $db->query("SELECT * FROM instance_info WHERE id IN (".implode(",", array_unique($instances)).") AND lang = '{$lang}'");
- $instances = $db->fetch_array($result, "id");
- }
- $spawnCount = 0;
- $w = 1095;
- $h = 1026;
- $c = 32768;
- $cX = 15;
- $cY = 16;
- $k = $h / $cY / $c;
- for ($x = 0; $x < count($list); $x++)
- {
- $hint = "Количество: ".($list[$x]['count'] * $sMul)."<br>Координаты: {$list[$x]['x']}, {$list[$x]['y']}, {$list[$x]['z']}";
- if ($list[$x]['respawn'] > 0)
- $hint .= "<br>Период респавна: ".strTime($list[$x]['respawn'], true).($list[$x]['respawn_rand'] > 0 ? " ± ".strTime($list[$x]['respawn_rand'], true) : "");
- else if ($list[$x]['respawn'] == 0)
- $hint .= "<br>Период респавна: одноразовый спавн";
- else
- $hint .= "<br>Период респавна: спавн в определенное время";
- if ($list[$x]['ref_id'] != 0)
- $hint .= "<br>Измерение: #{$list[$x]['ref_id']}".(!empty($instances[$list[$x]['ref_id']]) ? " ({$instances[$list[$x]['ref_id']]['name']})" : "");
- if ($list[$x]['period_of_day'] == "DAY")
- $hint .= "<br>Время суток: день";
- else if ($list[$x]['period_of_day'] == "NIGHT")
- $hint .= "<br>Время суток: ночь";
- $posX = round($w / 2 + ($w / $cX) * 1.21 + $list[$x]["x"] * $k);
- $posY = round($h / 2 + $list[$x]["y"] * $k);
- $tpl->insert_loop("main.body.info.point", array(
- "POS_X" => $posX,
- "POS_Y" => $posY,
- "POS_HINT" => "data-uk-tooltip title='{$hint}'"));
- $spawnCount += $list[$x]["count"];
- }
- $tpl->assign("SPAWN_COUNT", $spawnCount * $sMul);
- }
- // --------------- drop & spoil
- $tpl->assign("SERVER_RATES", $serverRates);
- if ($npc["is_drop"] == 1)
- {
- $result = $db->query("SELECT *
- FROM drop_data AS A
- LEFT JOIN item_info AS B ON (A.item_id = B.id)
- WHERE A.npc_id = {$id} AND A.group_id > -1 AND B.lang = '{$lang}'
- ORDER BY A.chance DESC, B.name ASC");
- $list = $db->fetch_array($result);
- if (count($list) > 0)
- {
- showItemList($list, "drop");
- $tpl->parse("main.body.info.drop");
- }
- else
- $tpl->parse("main.body.info.no_drop");
- }
- else
- $tpl->parse("main.body.info.no_drop");
- if ($npc["is_spoil"] == 1)
- {
- $result = $db->query("SELECT *
- FROM drop_data AS A
- LEFT JOIN item_info AS B ON (A.item_id = B.id)
- WHERE A.npc_id = {$id} AND A.group_id = -1 AND B.lang = '{$lang}'
- ORDER BY A.chance DESC, B.name ASC");
- $list = $db->fetch_array($result);
- if (count($list) > 0)
- {
- showItemList($list, "spoil");
- $tpl->parse("main.body.info.spoil");
- }
- else
- $tpl->parse("main.body.info.no_spoil");
- }
- else
- $tpl->parse("main.body.info.no_spoil");
- // --------------- merchant
- if ($npc["is_merchant"] == 1)
- {
- $result = $db->query("SELECT A.*, B.*, C.price
- FROM merchant_data AS A
- LEFT JOIN item_info AS B ON (A.item_id = B.id)
- LEFT JOIN item_data AS C ON (A.item_id = C.id)
- WHERE A.npc_id = {$id} AND B.lang = '{$lang}'
- ORDER BY B.name");
- $list = $db->fetch_array($result);
- if (count($list) > 0)
- {
- for ($x = 0; $x < count($list); $x++)
- {
- if (empty($list[$x]["name"]))
- $list[$x]["name"] = $lang == "ru" ? "[нет имени]" : "[no name]";
- $hint = !empty($list[$x]["description"]) ? " data-uk-tooltip=\"{pos:'top-left'}\" title=\"{$list[$x]['description']}\"" : "";
- $tpl->insert_loop("main.body.info.trade.item", array(
- "ID" => $list[$x]["id"],
- "ICON" => getIcon($list[$x]["icon"], $list[$x]["icon_ex"], "ID: {$list[$x]['id']}"),
- "NAME" => "<a href='?show=item_info&id={$list[$x]['item_id']}&tab=3'{$hint}>".$list[$x]["name"].($list[$x]["add_name"] != "" ? " <span class='uk-text-desc'>{$list[$x]['add_name']}</span> " : "")."</a>",
- "PRICE" => number_format(floor($list[$x]["price"] * (1. + $list[$x]["markup"] / 100.))),
- "PERIOD" => $list[$x]["count"] > 0 ? "период обновления: ".strTime($list[$x]["time"] * 60, false, false).", количество: {$list[$x]['count']}" : "продается всегда, в неограниченном количестве"));
- }
- $tpl->parse("main.body.info.trade");
- }
- else
- $tpl->parse("main.body.info.no_trade");
- }
- else
- $tpl->parse("main.body.info.no_trade");
- $tpl->parse("main.body.info");
- }
- else
- showMessage404();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement