本文整理汇总了PHP中loot函数的典型用法代码示例。如果您正苦于以下问题:PHP loot函数的具体用法?PHP loot怎么用?PHP loot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loot函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: objectinfo2
function objectinfo2(&$Row, $level = 0)
{
global $DB;
// Номер объекта
$object['entry'] = $Row['entry'];
// Название объекта
$object['name'] = localizedName($Row);
// Тип объекта
$object['type'] = $Row['type'];
if ($level > 0) {
// В зависимости от типа объекта, заполняем поля:
switch ($object['type']) {
case GAMEOBJECT_TYPE_DOOR:
/*
* data0: startOpen (Boolean flag)
* data1: open (LockId from Lock.dbc)
* data2: autoClose (long unknown flag)
* data3: noDamageImmune (Boolean flag)
* data4: openTextID (Unknown Text ID)
* data5: closeTextID (Unknown Text ID)
*/
$object['lockid'] = $Row['data1'];
break;
case GAMEOBJECT_TYPE_BUTTON:
/*
* data0: startOpen (State)
* data1: open (LockId from Lock.dbc)
* data2: autoClose (long unknown flag)
* data3: linkedTrap (gameobject_template.entry (Spawned GO type 6))
* data4: noDamageImmune (Boolean flag)
* data5: large? (Boolean flag)
* data6: openTextID (Unknown Text ID)
* data7: closeTextID (Unknown Text ID)
* data8: losOK (Boolean flag)
*/
$object['lockid'] = $Row['data1'];
case GAMEOBJECT_TYPE_QUESTGIVER:
/*
* data0: open (LockId from Lock.dbc)
* data1: questList (unknown ID)
* data2: pageMaterial (PageTextMaterial.dbc)
* data3: gossipID (unknown ID)
* data4: customAnim (unknown value from 1 to 4)
* data5: noDamageImmune (Boolean flag)
* data6: openTextID (Unknown Text ID)
* data7: losOK (Boolean flag)
* data8: allowMounted (Boolean flag)
* data9: large? (Boolean flag)
*/
$object['lockid'] = $Row['data0'];
break;
case GAMEOBJECT_TYPE_CHEST:
/*
* data0: open (LockId from Lock.dbc)
* data1: chestLoot (gameobject_loot_template.entry) *This field is obtained from WDB data and is not to be changed*
* data2: chestRestockTime (time in seconds)
* data3: consumable (State: Boolean flag)
* data4: minRestock (Min successful loot attempts for Mining, Herbalism etc)
* data5: maxRestock (Max successful loot attempts for Mining, Herbalism etc)
* data6: lootedEvent (unknown ID)
* data7: linkedTrap (gameobject_template.entry (Spawned GO type 6))
* data8: questID (v_quest_template.entry of completed quest)
* data9: level (minimal level required to open this gameobject)
* data10: losOK (Boolean flag)
* data11: leaveLoot (Boolean flag)
* data12: notInCombat (Boolean flag)
* data13: log loot (Boolean flag)
* data14: openTextID (Unknown ID)
* data15: use group loot rules (Boolean flag)
*/
$object['lockid'] = $Row['data0'];
$object['lootid'] = $Row['data1'];
break;
case GAMEOBJECT_TYPE_BINDER:
/* Object type not used */
break;
case GAMEOBJECT_TYPE_GENERIC:
/*
* data0: floatingTooltip (Boolean flag)
* data1: highlight (Boolean flag)
* data2: serverOnly? (Always 0)
* data3: large? (Boolean flag)
* data4: floatOnWater (Boolean flag)
* data5: questID (Required active v_quest_template.entry to work)
*/
break;
case GAMEOBJECT_TYPE_TRAP:
/*
* data0: open (LockId from Lock.dbc)
* data1: level (npc equivalent level for casted spell)
* data2: radius (Distance)
* data3: spell (Spell Id from spell.dbc)
* data4: charges (0 or 1)
* data5: cooldown (time in seconds)
* data6: ? (unknown flag)
* data7: startDelay? (time in seconds)
* data8: serverOnly? (always 0)
* data9: stealthed (Boolean flag)
* data10: large? (Boolean flag)
* data11: stealthAffected (Boolean flag)
//.........这里部分代码省略.........
示例2: unset
}
unset($row);
unset($numRow);
unset($extcost);
}
unset($rows_s);
// Дроп
if (!($npc['drop'] = loot('?_creature_loot_template', $lootid))) {
unset($npc['drop']);
}
// Кожа
if (!($npc['skinning'] = loot('?_skinning_loot_template', $lootid))) {
unset($npc['skinning']);
}
// Воруеццо
if (!($npc['pickpocketing'] = loot('?_pickpocketing_loot_template', $lootid))) {
unset($npc['pickpocketing']);
}
// Начиниают квесты...
$rows_qs = $DB->select('
SELECT ?#
FROM ?_creature_questrelation c, ?_quest_template q
WHERE
c.id=?
AND q.entry=c.quest
', $quest_cols[2], $id);
if ($rows_qs) {
$npc['starts'] = array();
foreach ($rows_qs as $numRow => $row) {
$npc['starts'][] = GetQuestInfo($row, 0xffffff);
}
示例3: IN
AND a.id = c.refAchievement
AND c.type IN (?a)
AND c.value1 = ?d
GROUP BY a.id
ORDER BY a.name_loc?d
', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST), $quest['entry'], $_SESSION['locale']);
if ($rows) {
$quest['criteria_of'] = array();
foreach ($rows as $row) {
allachievementsinfo2($row['id']);
$quest['criteria_of'][] = achievementinfo2($row);
}
}
// Награды и благодарности, присылаемые почтой
if ($quest['RewMailTemplateId']) {
if (!($quest['mailrewards'] = loot('mail_loot_template', $quest['RewMailTemplateId']))) {
unset($quest['mailrewards']);
}
}
if ($quest['RewMailDelaySecs']) {
$quest['maildelay'] = sec_to_time($quest['RewMailDelaySecs']);
}
save_cache(QUEST_PAGE, $cache_key, $quest);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $quest['Title'] . ' - ' . $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 5, 'typeid' => $quest['entry'], 'path' => path(0, 5));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
$smarty->assign('screenshots', getscreenshots($page['type'], $page['typeid']));
// Данные о квесте
示例4: JOIN
{ LEFT JOIN (?_locales_creature l) ON l.entry=c.entry AND ? }
WHERE
skinloot=?d
AND factiontemplateID=faction_A
', $npc_cols[0], $_SESSION['locale'] > 0 ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] > 0 ? 1 : DBSIMPLE_SKIP, $lootid);
foreach ($rows as $numRow => $row) {
$item['skinnedfrom'][] = array_merge(creatureinfo2($row), $drop);
}
}
unset($rows);
unset($lootid);
unset($drop);
}
unset($drops_sk);
// Дизенчантитcя в:
if (!($item['disenchanting'] = loot('?_disenchant_loot_template', $item['DisenchantID']))) {
unset($item['disenchanting']);
}
// Получается дизэнчантом из..
$drops_de = drop('?_disenchant_loot_template', $item['entry']);
if ($drops_de) {
$item['disenchantedfrom'] = array();
foreach ($drops_de as $lootid => $drop) {
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d as `name_loc`
}
FROM ?_udwbase_icons, ?_item_template c
{ LEFT JOIN (?_locales_item l) ON l.entry=c.entry AND ? }
WHERE
示例5: IN
AND a.id = c.refAchievement
AND c.type IN (?a)
AND c.value1 = ?d
GROUP BY a.id
ORDER BY a.name_loc?d
', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST), $quest['entry'], $_SESSION['locale']);
if ($rows) {
$quest['criteria_of'] = array();
foreach ($rows as $row) {
allachievementsinfo2($row['id']);
$quest['criteria_of'][] = achievementinfo2($row);
}
}
// Награды и благодарности, присылаемые почтой
if ($quest['RewMailTemplateId']) {
if (!($quest['mailrewards'] = loot('quest_mail_loot_template', $quest['entry']))) {
unset($quest['mailrewards']);
}
}
if ($quest['RewMailDelaySecs']) {
$quest['maildelay'] = sec_to_time($quest['RewMailDelaySecs']);
}
save_cache(10, $cache_key, $quest);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $quest['Title'] . ' - ' . $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 5, 'typeid' => $quest['entry'], 'path' => path(0, 5));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Данные о квесте
$smarty->assign('quest', $quest);
示例6: array_merge
FROM ?_zones
WHERE
areatableID=?d
LIMIT 1
', $lootid);
if ($row) {
$item['fishedin'][] = array_merge($row, $drop);
}
}
}
unset($row);
unset($num);
}
unset($drops_fi);
// Размалывается в
if (!($item['milling'] = loot('milling_loot_template', $item['entry']))) {
unset($item['milling']);
}
// Получается размалыванием из
$drops_mi = drop('milling_loot_template', $item['entry']);
if ($drops_mi) {
$item['milledfrom'] = array();
foreach ($drops_mi as $lootid => $drop) {
$rows = $DB->select('
SELECT c.?#, c.entry, maxcount
{
, l.name_loc?d AS name_loc
}
FROM ?_icons, item_template c
{ LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
WHERE
示例7: loot
function loot($table, $lootid, $group = 0)
{
global $DB, $item_cols;
// Мего запрос :)
$rows = $DB->select('
SELECT l.ChanceOrQuestChance, l.mincountOrRef, l.maxcount as `d-max`, l.groupid, ?#, i.entry, i.maxcount
{, loc.name_loc?d AS name_loc}
FROM ?# l
LEFT JOIN (?_icons a, item_template i) ON l.item=i.entry AND a.id=i.displayid
{LEFT JOIN (locales_item loc) ON loc.entry=i.entry AND ?d}
WHERE
l.entry=?d
AND l.entry <> 0
{ AND l.groupid = ?d }
{LIMIT ?d}
', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $table, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, $lootid, $group ? $group : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
// Подсчитываем нужную информацию о группах
$groupchance = array();
$groupzero = array();
foreach ($rows as $row) {
if ($row['mincountOrRef'] >= 0) {
$gid = $row['groupid'];
if (!isset($groupchance[$gid])) {
$groupchance[$gid] = 0;
}
if (!isset($groupzero[$gid])) {
$groupzero[$gid] = 0;
}
if ($row['ChanceOrQuestChance'] == 0) {
$groupzero[$gid]++;
} else {
$groupchance[$gid] += abs($row['ChanceOrQuestChance']);
}
}
}
// Присваиваем каждой группе номер от 1
$maxgroup = 0;
$groupnum = array();
foreach ($groupchance as $id => $group) {
if ($id) {
$groupnum[$id] = ++$maxgroup;
} else {
$groupnum[$id] = "";
}
}
// Cохраняем весь нессылочный лут
$loot = array();
foreach ($rows as $row) {
if ($row['mincountOrRef'] > 0) {
$chance = $row['ChanceOrQuestChance'];
if ($chance == 0) {
$chance = (100 - $groupchance[$row['groupid']]) / $groupzero[$row['groupid']];
if ($chance < 0) {
$chance = 0;
}
if ($chance > 100) {
$chance = 100;
}
}
$item = $row['entry'] . '.' . $row['groupid'];
// Это чтобы отделить предметы в разных группах
if (isset($loot[$item])) {
$loot[$item]['mincount'] = min($row['mincountOrRef'], $loot[$item]['mincount']);
if ($row['groupid']) {
$loot[$item]['maxcount'] = max($loot[$item]['maxcount'], $row['d-max']);
} else {
$loot[$item]['maxcount'] = $loot[$item]['maxcount'] + $row['d-max'];
}
$loot[$item]['percent'] = 1 - (1 - abs($chance)) * (1 - abs($loot[$item]['percent']));
} else {
$loot[$item] = iteminfo2($row, 0);
$loot[$item]['mincount'] = $row['mincountOrRef'];
$loot[$item]['maxcount'] = $row['d-max'];
$loot[$item]['percent'] = $chance;
$loot[$item]['group'] = $groupnum[$row['groupid']];
$loot[$item]['groupcount'] = 1;
}
}
}
// И наконец, добавляем весь лут со ссылок
foreach ($rows as $row) {
if ($row['mincountOrRef'] < 0) {
$newmax = $maxgroup;
$tmploots = loot('reference_loot_template', -$row['mincountOrRef'], $row['groupid']);
foreach ($tmploots as $tmploot) {
if ($tmploot['group']) {
$tmploot['group'] += $maxgroup;
if ($newmax < $tmploot['group']) {
$newmax = $tmploot['group'];
}
$tmploot['groupcount'] = $tmploot['groupcount'] * $row['d-max'];
} else {
$tmploot['maxcount'] *= $row['d-max'];
}
$tmploot['percent'] *= abs($row['ChanceOrQuestChance']) / 100;
$loot[] = $tmploot;
}
$maxgroup = $newmax;
}
}
//.........这里部分代码省略.........
示例8: array
if (!isset($spell['icon'])) {
$spell['icon'] = $tmpRow['iconname'];
}
}
// Создает спелл
if ($row['effect' . $j . 'triggerspell'] > 0) {
$spell['effect'][$i]['spell'] = array();
$spell['effect'][$i]['spell']['entry'] = $row['effect' . $j . 'triggerspell'];
$spell['effect'][$i]['spell']['name'] = $DB->selectCell('SELECT spellname_loc' . $_SESSION['locale'] . ' FROM ?_spell WHERE spellID = ?d LIMIT 1', $spell['effect'][$i]['spell']['entry']);
allspellsinfo($spell['effect'][$i]['spell']['entry']);
}
$i++;
}
}
// Что лутится из этого спелла (для effect_id=59 /* Open Lock Item */)
if (($row['effect1id'] == 59 || $row['effect2id'] == 59 || $row['effect3id'] == 59) && !($spell['contains'] = loot('spell_loot_template', $spell['entry']))) {
unset($spell['contains']);
}
if (!isset($spell['icon'])) {
$spell['icon'] = $row['iconname'];
}
// Спеллы с таким же названием
$seealso = $DB->select('
SELECT s.*, i.iconname
FROM ?_spell s, ?_spellicons i
WHERE
s.spellname_loc' . $_SESSION['locale'] . ' = ?
AND s.spellID <> ?d
AND (
(s.effect1id = ?d AND s.effect1id!=0)
OR (s.effect2id = ?d AND s.effect2id!=0)
示例9: loot
function loot($table, $lootid, $mod = 1)
{
// Все элементы
global $DB, $item_cols;
$loot = array();
$groups = array();
// Мего запрос :)
$rows = $DB->select('
SELECT l.ChanceOrQuestChance, l.mincountOrRef, l.maxcount, l.groupid, ?#, i.entry
{, loc.name_loc?d AS name_loc}
FROM ?# l
LEFT JOIN (?_icons a, item_template i) ON l.item=i.entry AND a.id=i.displayid
{LEFT JOIN (locales_item loc) ON loc.entry=i.entry AND ?d}
WHERE
l.entry=?d
ORDER BY groupid ASC, ChanceOrQuestChance DESC
{LIMIT ?d}
', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $table, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, $lootid, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$last_group = 0;
$last_group_equal_chance = 100;
// Перебираем
foreach ($rows as $row) {
// Не группа
if ($row['groupid'] == 0) {
// Ссылка
if ($row['mincountOrRef'] < 0) {
add_loot($loot, loot('reference_loot_template', -$row['mincountOrRef'], abs($row['ChanceOrQuestChance']) / 100 * $row['maxcount'] * $mod));
} else {
// Обыкновенный дроп
add_loot($loot, array(array_merge(array('percent' => max(abs($row['ChanceOrQuestChance']) * $mod, 0) * sign($row['ChanceOrQuestChance']), 'mincount' => $row['mincountOrRef'], 'maxcount' => $row['maxcount']), iteminfo2($row, 0))));
}
} else {
$chance = abs($row['ChanceOrQuestChance']);
// Новая группа?
if ($row['groupid'] != $last_group) {
$last_group = $row['groupid'];
$last_group_equal_chance = 100;
}
// Шанс лута задан
if ($chance > 0) {
$last_group_equal_chance -= $chance;
$last_group_equal_chance = max($last_group_equal_chance, 0);
// Ссылка
if ($row['mincountOrRef'] < 0) {
add_loot($loot, loot('reference_loot_template', -$row['mincountOrRef'], $chance / 100 * $row['maxcount'] * $mod));
} else {
add_loot($loot, array(array_merge(array('percent' => $chance * $mod, 'mincount' => $row['mincountOrRef'], 'maxcount' => $row['maxcount']), iteminfo2($row, 0))));
}
} else {
$groups[$last_group][] = array_merge(array('mincount' => $row['mincountOrRef'], 'maxcount' => $row['maxcount'], 'groupchance' => $last_group_equal_chance * $mod), iteminfo2($row, 0));
}
}
}
// Перебираем и добавляем группы
foreach ($groups as $group) {
$num = count($group);
foreach ($group as $item) {
$item['percent'] = $item['groupchance'] / $num;
add_loot($loot, array($item));
}
}
return $loot;
}
示例10: intval
<?php
require_once 'includes/allutil.php';
require_once 'includes/allitems.php';
require_once 'includes/allcomments.php';
require_once 'includes/allscreenshots.php';
$smarty->config_load($conf_file, 'zone');
// номер объекта;
$id = intval($podrazdel);
$cache_key = cache_key($id);
if (!($zone = load_cache(ZONE_PAGE, $cache_key))) {
unset($zone);
// Данные об объекте:
$zone = $DB->selectRow('SELECT * FROM ?_zones WHERE areatableID = ?d', $id);
$zone['name'] = localizedName($zone);
if (!($zone['fishing'] = loot('fishing_loot_template', $id))) {
unset($zone['fishing']);
}
if ($zone['parent']) {
$row = $DB->selectRow('SELECT * FROM ?_zones WHERE areatableID = ?d', $zone['parent']);
if ($row) {
$parentname = localizedName($row);
}
unset($row);
if (!empty($parentname)) {
$zone['parentname'] = $parentname;
}
}
$rows = $DB->select('SELECT * FROM ?_zones WHERE parent = ?d', $id);
if ($rows) {
$zone['subzones'] = array();