本文整理汇总了PHP中DB::World方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::World方法的具体用法?PHP DB::World怎么用?PHP DB::World使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::World方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: events
function events(array $ids = [])
{
$eventQuery = '
SELECT
ge.eventEntry,
holiday,
0, -- cuFlags
UNIX_TIMESTAMP(start_time),
UNIX_TIMESTAMP(end_time),
occurence * 60,
length * 60,
IF (gep.eventEntry IS NOT NULL, GROUP_CONCAT(prerequisite_event SEPARATOR " "), NULL),
description
FROM
game_event ge
LEFT JOIN
game_event_prerequisite gep ON gep.eventEntry = ge.eventEntry
{
WHERE
ge.eventEntry IN (?a)
}
GROUP BY
ge.eventEntry';
$events = DB::World()->select($eventQuery, $ids ?: DBSIMPLE_SKIP);
foreach ($events as $e) {
DB::Aowow()->query('REPLACE INTO ?_events VALUES (?a)', array_values($e));
}
return true;
}
示例2: achievement
function achievement(array $ids = [])
{
if ($ids) {
DB::Aowow()->query('DELETE FROM ?_achievement WHERE id IN (?a)', $ids);
} else {
DB::Aowow()->query('REPLACE INTO ?_achievement SELECT a.id, 2 - a.faction, a.map, 0, 0, a.category, ac.parentCategory, a.points, a.orderInGroup, a.iconId, a.flags, a.reqCriteriaCount, a.refAchievement, 0, 0, a.name_loc0, a.name_loc2, a.name_loc3, a.name_loc4, a.name_loc6, a.name_loc8, a.description_loc0, a.description_loc2, a.description_loc3, a.description_loc4, a.description_loc6, a.description_loc8, a.reward_loc0, a.reward_loc2, a.reward_loc3, a.reward_loc4, a.reward_loc6, a.reward_loc8 FROM dbc_achievement a LEFT JOIN dbc_achievement_category ac ON ac.id = a.category');
}
// serverside achievements
$serverAchievements = DB::World()->select('SELECT ID, IF(requiredFaction = -1, 3, IF(requiredFaction = 0, 2, 1)) AS "faction", mapID, points, flags, count, refAchievement FROM achievement_dbc{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP);
foreach ($serverAchievements as $sa) {
DB::Aowow()->query('REPLACE INTO ?_achievement (id, faction, map, points, flags, reqCriteriaCount, refAchievement, cuFlags, name_loc0, name_loc2, name_loc3, name_loc4, name_loc6, name_loc8) VALUES (?d, ?d, ?d, ?d, ?d, ?d, ?d, ?d, ?, ?, ?, ?, ?, ?)', $sa['ID'], $sa['faction'], $sa['mapID'], $sa['points'], $sa['flags'], $sa['count'], $sa['refAchievement'], CUSTOM_SERVERSIDE, 'Serverside - #' . $sa['ID'], 'Serverside - #' . $sa['ID'], 'Serverside - #' . $sa['ID'], 'Serverside - #' . $sa['ID'], 'Serverside - #' . $sa['ID'], 'Serverside - #' . $sa['ID']);
}
if ($ids) {
return true;
}
// create chain of achievements
$chainIdx = 0;
$parents = DB::Aowow()->selectCol('SELECT a.id FROM dbc_achievement a JOIN dbc_achievement b ON b.previous = a.id WHERE a.previous = 0');
foreach ($parents as $chainId => $next) {
$tree = [null, $next];
while ($next = DB::Aowow()->selectCell('SELECT id FROM dbc_achievement WHERE previous = ?d', $next)) {
$tree[] = $next;
}
foreach ($tree as $idx => $aId) {
if (!$aId) {
continue;
}
DB::Aowow()->query('UPDATE ?_achievement SET cuFlags = cuFlags | ?d, chainId = ?d, chainPos = ?d WHERE id = ?d', $idx == 1 ? ACHIEVEMENT_CU_FIRST_SERIES : (count($tree) == $idx + 1 ? ACHIEVEMENT_CU_LAST_SERIES : 0), $chainId + 1, $idx, $aId);
}
}
return true;
}
示例3: titles
function titles()
{
$questQuery = '
SELECT
qt.RewardTitleId AS ARRAY_KEY,
qt.RequiredRaces,
ge.holiday
FROM
quest_template qt
LEFT JOIN
game_event_seasonal_questrelation sq ON sq.questId = qt.id
LEFT JOIN
game_event ge ON ge.eventEntry = sq.eventEntry
WHERE
qt.RewardTitleId <> 0';
DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles');
// hide unused titles
DB::Aowow()->query('UPDATE ?_titles SET cuFlags = ?d WHERE id BETWEEN 85 AND 123 AND id NOT IN (113, 120, 121, 122)', CUSTOM_EXCLUDE_FOR_LISTVIEW);
// set expansion
DB::Aowow()->query('UPDATE ?_titles SET expansion = 2 WHERE id >= 72 AND id <> 80');
DB::Aowow()->query('UPDATE ?_titles SET expansion = 1 WHERE id >= 42 AND id <> 46 AND expansion = 0');
// set category
DB::Aowow()->query('UPDATE ?_titles SET category = 1 WHERE id <= 28 OR id IN (42, 43, 44, 45, 47, 48, 62, 71, 72, 80, 82, 126, 127, 128, 157, 163, 167, 169, 177)');
DB::Aowow()->query('UPDATE ?_titles SET category = 5 WHERE id BETWEEN 96 AND 109 OR id IN (83, 84)');
DB::Aowow()->query('UPDATE ?_titles SET category = 2 WHERE id BETWEEN 144 AND 156 OR id IN (63, 77, 79, 113, 123, 130, 131, 132, 176)');
DB::Aowow()->query('UPDATE ?_titles SET category = 6 WHERE id IN (46, 74, 75, 76, 124, 133, 134, 135, 137, 138, 155, 168)');
DB::Aowow()->query('UPDATE ?_titles SET category = 4 WHERE id IN (81, 125)');
DB::Aowow()->query('UPDATE ?_titles SET category = 3 WHERE id IN (53, 64, 120, 121, 122, 129, 139, 140, 141, 142) OR (id >= 158 AND category = 0)');
// update side
$questInfo = DB::World()->select($questQuery);
$sideUpd = DB::World()->selectCol('SELECT IF (title_A, title_A, title_H) AS ARRAY_KEY, BIT_OR(IF(title_A, 1, 2)) AS side FROM achievement_reward WHERE (title_A <> 0 AND title_H = 0) OR (title_H <> 0 AND title_A = 0) GROUP BY ARRAY_KEY HAVING side <> 3');
foreach ($questInfo as $tId => $data) {
if ($data['holiday']) {
DB::Aowow()->query('UPDATE ?_titles SET holidayId = ?d WHERE id = ?d', $data['holiday'], $tId);
}
$side = Util::sideByRaceMask($data['RequiredRaces']);
if ($side == 3) {
continue;
}
if (!isset($sideUpd[$tId])) {
$sideUpd[$tId] = $side;
} else {
$sideUpd[$tId] |= $side;
}
}
foreach ($sideUpd as $tId => $side) {
if ($side != 3) {
DB::Aowow()->query("UPDATE ?_titles SET side = ?d WHERE id = ?d", $side, $tId);
}
}
// update side - sourceless titles (maintain query order)
DB::Aowow()->query('UPDATE ?_titles SET side = 2 WHERE id <= 28 OR id IN (118, 119, 116, 117, 110, 127)');
DB::Aowow()->query('UPDATE ?_titles SET side = 1 WHERE id <= 14 OR id IN (111, 115, 112, 114, 126)');
// ! src12Ext pendant in source-script !
$doubles = DB::World()->selectCol('SELECT IF(title_A, title_A, title_H) AS ARRAY_KEY, GROUP_CONCAT(entry SEPARATOR " "), count(1) FROM achievement_reward WHERE title_A <> 0 OR title_H <> 0 GROUP BY ARRAY_KEY HAVING count(1) > 1');
foreach ($doubles as $tId => $acvIds) {
DB::Aowow()->query('UPDATE ?_titles SET src12Ext = ?d WHERE id = ?d', explode(' ', $acvIds)[1], $tId);
}
return true;
}
示例4: spelldifficulty
function spelldifficulty(array $ids = [])
{
// has no unique keys..
DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty');
DB::Aowow()->query('INSERT INTO ?_spelldifficulty SELECT * FROM dbc_spelldifficulty');
$rows = DB::World()->select('SELECT spellid0, spellid1, spellid2, spellid3 FROM spelldifficulty_dbc');
foreach ($rows as $r) {
DB::Aowow()->query('INSERT INTO ?_spelldifficulty VALUES (?a)', array_values($r));
}
return true;
}
示例5: generateContent
protected function generateContent()
{
/***********/
/* Infobox */
/***********/
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
if ($this->subject->getField('side') == SIDE_ALLIANCE) {
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-alliance]' . Lang::game('si', SIDE_ALLIANCE) . '[/span]';
} else {
if ($this->subject->getField('side') == SIDE_HORDE) {
$infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-horde]' . Lang::game('si', SIDE_HORDE) . '[/span]';
} else {
$infobox[] = Lang::main('side') . Lang::main('colon') . Lang::game('si', SIDE_BOTH);
}
}
if ($g = $this->subject->getField('gender')) {
$infobox[] = Lang::main('gender') . Lang::main('colon') . '[span class=icon-' . ($g == 2 ? 'female' : 'male') . ']' . Lang::main('sex', $g) . '[/span]';
}
if ($eId = $this->subject->getField('eventId')) {
$this->extendGlobalIds(TYPE_WORLDEVENT, $eId);
$infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[event=' . $eId . ']';
}
/****************/
/* Main Content */
/****************/
$this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null;
$this->expansion = Util::$expansionString[$this->subject->getField('expansion')];
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => ['name' => $this->nameFixed]);
// factionchange-equivalent
if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_titles WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) {
$altTitle = new TitleList(array(['id', abs($pendant)]));
if (!$altTitle->error) {
$this->transfer = sprintf(Lang::title('_transfer'), $altTitle->id, $altTitle->getHtmlizedName(), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2));
}
}
/**************/
/* Extra Tabs */
/**************/
// tab: quest source
$quests = new QuestList(array(['rewardTitleId', $this->typeId]));
if (!$quests->error) {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_REWARDS));
$this->lvTabs[] = ['quest', array('data' => array_values($quests->getListviewData()), 'id' => 'reward-from-quest', 'name' => '$LANG.tab_rewardfrom', 'hiddenCols' => ['experience', 'money'], 'visibleCols' => ['category'])];
}
// tab: achievement source
if ($aIds = DB::World()->selectCol('SELECT entry FROM achievement_reward WHERE title_A = ?d OR title_H = ?d', $this->typeId, $this->typeId)) {
$acvs = new AchievementList(array(['id', $aIds]));
if (!$acvs->error) {
$this->extendGlobalData($acvs->getJSGlobals());
$this->lvTabs[] = ['achievement', array('data' => array_values($acvs->getListviewData()), 'id' => 'reward-from-achievement', 'name' => '$LANG.tab_rewardfrom', 'visibleCols' => ['category'], 'sort' => ['reqlevel', 'name'])];
}
}
// tab: criteria of (to be added by TC)
}
示例6: __construct
public function __construct($conditions = [], $miscData = null)
{
parent::__construct($conditions, $miscData);
if ($this->error) {
return;
}
// post processing
$rewards = DB::World()->select('
SELECT ar.entry AS ARRAY_KEY, ar.*, lar.* FROM achievement_reward ar LEFT JOIN locales_achievement_reward lar ON lar.entry = ar.entry WHERE ar.entry IN (?a)', $this->getFoundIDs());
foreach ($this->iterate() as $_id => &$_curTpl) {
$_curTpl['rewards'] = [];
if (!empty($rewards[$_id])) {
$_curTpl = array_merge($rewards[$_id], $_curTpl);
if ($rewards[$_id]['mailTemplate']) {
// using class Loot creates an inifinite loop cirling between Loot, ItemList and SpellList or something
// $mailSrc = new Loot();
// $mailSrc->getByContainer(LOOT_MAIL, $rewards[$_id]['mailTemplate']);
// foreach ($mailSrc->iterate() as $loot)
// $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']];
// lets just assume for now, that mailRewards for achievements do not contain references
$mailRew = DB::World()->selectCol('SELECT Item FROM mail_loot_template WHERE Reference <= 0 AND entry = ?d', $rewards[$_id]['mailTemplate']);
foreach ($mailRew as $mr) {
$_curTpl['rewards'][] = [TYPE_ITEM, $mr];
}
}
}
//"rewards":[[11,137],[3,138]] [type, typeId]
if (!empty($_curTpl['item'])) {
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['item']];
}
if (!empty($_curTpl['itemExtra'])) {
$_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']];
}
if (!empty($_curTpl['title_A'])) {
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_A']];
}
if (!empty($_curTpl['title_H'])) {
if (empty($_curTpl['title_A']) || $_curTpl['title_A'] != $_curTpl['title_H']) {
$_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_H']];
}
}
// icon
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
}
}
示例7: PerformItemsSearch
private static function PerformItemsSearch()
{
if (!isset(self::$m_results['items'])) {
self::$m_results['items'] = array();
}
// Find item IDs
$items = DB::World()->select("\n SELECT\n `a`.`entry`\n FROM `%s` AS `a`\n WHERE %s LIKE '%s' LIMIT 200", WoW_Locale::GetLocaleID() != LOCALE_EN ? 'locales_item' : 'item_template', WoW_Locale::GetLocaleID() != LOCALE_EN ? '`a`.`name_loc' . WoW_Locale::GetLocaleID() . '`' : '`a`.`name`', '%' . self::$m_query . '%');
if (!$items) {
return;
}
$item_id = array();
foreach ($items as $item) {
// Generate IDs array
$item_id[] = $item['entry'];
}
// Request items
self::$m_results['items'] = WoW_Items::GetExtendedItemInfo($item_id);
}
示例8: itemenchantment
function itemenchantment()
{
$baseQuery = '
REPLACE INTO
?_itemenchantment
SELECT
Id, charges, 0, 0, 0, type1, type2, type3, amount1, amount2, amount3, object1, object2, object3, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, conditionId, skillLine, skillLevel, requiredLevel
FROM
dbc_spellitemenchantment';
DB::Aowow()->query($baseQuery);
$cuProcs = DB::World()->select('SELECT entry AS ARRAY_KEY, customChance AS procChance, PPMChance AS ppmRate FROM spell_enchant_proc_data');
foreach ($cuProcs as $id => $vals) {
DB::Aowow()->query('UPDATE ?_itemenchantment SET ?a WHERE id = ?d', $vals, $id);
}
// hide strange stuff
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE type1 = 0 AND type2 = 0 AND type3 = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE name_loc0 LIKE "%test%"', CUSTOM_EXCLUDE_FOR_LISTVIEW);
return true;
}
示例9: quests_startend
function quests_startend()
{
$query['creature'] = '
SELECT 1 AS type, id AS typeId, quest AS questId, 1 AS method, 0 AS eventId FROM creature_queststarter UNION
SELECT 1 AS type, id AS typeId, quest AS questId, 2 AS method, 0 AS eventId FROM creature_questender UNION
SELECT 1 AS type, id AS typeId, quest AS questId, 1 AS method, eventEntry AS eventId FROM game_event_creature_quest';
$query['object'] = '
SELECT 2 AS type, id AS typeId, quest AS questId, 1 AS method, 0 AS eventId FROM gameobject_queststarter UNION
SELECT 2 AS type, id AS typeId, quest AS questId, 2 AS method, 0 AS eventId FROM gameobject_questender UNION
SELECT 2 AS type, id AS typeId, quest AS questId, 1 AS method, eventEntry AS eventId FROM game_event_gameobject_quest';
$query['item'] = 'SELECT 3 AS type, entry AS typeId, startquest AS questId, 1 AS method, 0 AS eventId FROM item_template WHERE startquest <> 0';
// always rebuild this table from scratch
// or how would i know what to fetch specifically
DB::Aowow()->query('TRUNCATE TABLE ?_quests_startend');
foreach ($query as $q) {
$data = DB::World()->select($q);
foreach ($data as $d) {
DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) ON DUPLICATE KEY UPDATE method = method | VALUES(method), eventId = IF(eventId = 0, VALUES(eventId), eventId)', array_keys($d), array_values($d));
}
}
return true;
}
示例10: currencies
function currencies(array $ids = [])
{
if (!$ids) {
DB::Aowow()->query('REPLACE INTO ?_currencies (id, category, itemId) SELECT Id, category, itemId FROM dbc_currencytypes');
}
$moneyItems = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM dbc_currencytypes{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP);
// apply names
$moneyNames = DB::World()->select('SELECT it.entry AS ARRAY_KEY, name AS name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM item_template it LEFT JOIN locales_item li ON li.entry = it.entry WHERE it.entry IN (?a)', $moneyItems);
foreach ($moneyItems as $cId => $itemId) {
if (!empty($moneyNames[$itemId])) {
$strings = $moneyNames[$itemId];
} else {
CLISetup::log('item #' . $itemId . ' required by currency #' . $cId . ' not in item_template', CLISetup::LOG_WARN);
$strings = ['name_loc0' => 'Item #' . $itemId . ' not in DB', 'iconId' => -1240, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
}
DB::Aowow()->query('UPDATE ?_currencies SET ?a WHERE itemId = ?d', $strings, $itemId);
}
// apply icons
$displayIds = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, displayid FROM item_template WHERE entry IN (?a)', $moneyItems);
foreach ($displayIds as $itemId => $iconId) {
DB::Aowow()->query('UPDATE ?_currencies SET iconId = ?d WHERE itemId = ?d', -$iconId, $itemId);
}
return true;
}
示例11: createEffects
private function createEffects(&$infobox, &$redButtons)
{
// proc data .. maybe use more information..?
$procData = DB::World()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId);
if (!isset($procData['cooldown'])) {
$procData['cooldown'] = 0;
}
$effects = [];
$spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell()));
$itemIdx = $this->subject->canCreateItem();
// Iterate through all effects:
for ($i = 1; $i < 4; $i++) {
if ($this->subject->getField('effect' . $i . 'Id') <= 0) {
continue;
}
$effId = (int) $this->subject->getField('effect' . $i . 'Id');
$effMV = (int) $this->subject->getField('effect' . $i . 'MiscValue');
$effBP = (int) $this->subject->getField('effect' . $i . 'BasePoints');
$effDS = (int) $this->subject->getField('effect' . $i . 'DieSides');
$effRPPL = $this->subject->getField('effect' . $i . 'RealPointsPerLevel');
$effAura = (int) $this->subject->getField('effect' . $i . 'AuraId');
$foo =& $effects[];
// Icons:
// .. from item
if (in_array($i, $itemIdx)) {
$_ = $this->subject->getField('effect' . $i . 'CreateItemId');
foreach ($this->subject->relItems->iterate() as $itemId => $__) {
if ($itemId != $_) {
continue;
}
$foo['icon'] = array('id' => $this->subject->relItems->id, 'name' => $this->subject->relItems->getField('name', true), 'quality' => $this->subject->relItems->getField('quality'), 'count' => $effDS + $effBP, 'icon' => $this->subject->relItems->getField('iconString'));
break;
}
if ($effDS > 1) {
$foo['icon']['count'] = "'" . ($effBP + 1) . '-' . $foo['icon']['count'] . "'";
}
} else {
if (in_array($i, $spellIdx) || $effId == 133) {
$_ = $this->subject->getField('effect' . $i . 'TriggerSpell');
if (!$_) {
$_ = $this->subject->getField('effect' . $i . 'MiscValue');
}
$trig = new SpellList(array(['s.id', (int) $_]));
$foo['icon'] = array('id' => $_, 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')) . ' #' . $_ : $trig->getField('name', true), 'count' => 0);
$this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
}
// Effect Name
$foo['name'] = (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'EffectId: ' . $effId, Util::$spellEffectStrings[$effId]) : Util::$spellEffectStrings[$effId]) . Lang::main('colon');
if ($this->subject->getField('effect' . $i . 'RadiusMax') > 0) {
$foo['radius'] = $this->subject->getField('effect' . $i . 'RadiusMax');
}
if (!in_array($i, $itemIdx) && !in_array($i, $spellIdx) && !in_array($effAura, [225, 227])) {
$foo['value'] = ($effDS && $effDS != 1 ? $effBP + 1 . Lang::game('valueDelim') : null) . ($effBP + $effDS);
}
if ($effRPPL != 0) {
$foo['value'] = (isset($foo['value']) ? $foo['value'] : '0') . sprintf(Lang::spell('costPerLevel'), $effRPPL);
}
if ($this->subject->getField('effect' . $i . 'Periode') > 0) {
$foo['interval'] = Util::formatTime($this->subject->getField('effect' . $i . 'Periode'));
}
if ($_ = $this->subject->getField('effect' . $i . 'Mechanic')) {
$foo['mechanic'] = Lang::game('me', $_);
}
if (!empty($procData['chance'])) {
$foo['procData'] = array($procData['chance'], $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
} else {
if (in_array($i, $this->subject->canTriggerSpell()) && $this->subject->getField('procChance')) {
$foo['procData'] = array($this->subject->getField('procChance'), $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
}
}
// parse masks and indizes
switch ($effId) {
case 8:
// Power Drain
// Power Drain
case 30:
// Energize
// Energize
case 137:
// Energize Pct
$_ = Lang::spell('powerTypes', $effMV);
if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
$_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
} else {
if (!$_) {
$_ = $effMV;
}
}
if ($effMV == POWER_RAGE || $effMV == POWER_RUNIC_POWER) {
$foo['value'] = ($effDS && $effDS != 1 ? ($effBP + 1) / 10 . Lang::game('valueDelim') : null) . ($effBP + $effDS) / 10;
}
$foo['name'] .= ' (' . $_ . ')';
break;
case 16:
// QuestComplete
if ($_ = QuestList::getName($effMV)) {
$foo['name'] .= '(<a href="?quest=' . $effMV . '">' . $_ . '</a>)';
} else {
$foo['name'] .= Util::ucFirst(Lang::game('quest')) . ' #' . $effMV;
//.........这里部分代码省略.........
示例12: generateContent
//.........这里部分代码省略.........
}
}
}
$spells = new SpellList($condition);
if (!$spells->error) {
foreach ($spells->iterate() as $__) {
$reqClass |= $spells->getField('reqClassMask');
$reqRace |= $spells->getField('reqRaceMask');
}
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$lv = array('file' => 'spell', 'data' => $spells->getListviewData(), 'params' => ['visibleCols' => "\$['source']"]);
switch ($this->cat) {
case -4:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=-4');
break;
case 7:
if ($this->typeId != 769) {
// Internal
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . (log($reqClass, 2) + 1) . '.' . $this->typeId);
}
// doesn't matter what spell; reqClass should be identical for all Class Spells
break;
case 9:
case 11:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . $this->typeId);
break;
}
$this->lvTabs[] = $lv;
}
// tab: trainers [npcs]
if (in_array($this->cat, [-5, 6, 7, 8, 9, 11])) {
$list = [];
if (!empty(Util::$trainerTemplates[TYPE_SKILL][$this->typeId])) {
$list = DB::World()->selectCol('SELECT DISTINCT entry FROM npc_trainer WHERE spell IN (?a) AND entry < 200000', Util::$trainerTemplates[TYPE_SKILL][$this->typeId]);
} else {
$mask = 0;
foreach (Util::$skillLineMask[-3] as $idx => $pair) {
if ($pair[1] == $this->typeId) {
$mask |= 1 << $idx;
}
}
$spellIds = DB::Aowow()->selectCol('SELECT id FROM ?_spell WHERE typeCat IN (-11, 9) AND (skillLine1 = ?d OR (skillLine1 > 0 AND skillLine2OrMask = ?d) {OR (skillLine1 = -3 AND skillLine2OrMask = ?d)})', $this->typeId, $this->typeId, $mask ?: DBSIMPLE_SKIP);
$list = $spellIds ? DB::World()->selectCol('
SELECT IF(t1.entry > 200000, t2.entry, t1.entry)
FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.spell = -t1.entry
WHERE t1.spell IN (?a)', $spellIds) : [];
}
if ($list) {
$this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
$trainer = new CreatureList(array(CFG_SQL_LIMIT_NONE, ['ct.id', $list], ['s.guid', NULL, '!'], ['ct.npcflag', 0x10, '&']));
if (!$trainer->error) {
$this->extendGlobalData($trainer->getJSGlobals());
$this->lvTabs[] = array('file' => 'creature', 'data' => $trainer->getListviewData(), 'params' => array('id' => 'trainer', 'name' => '$LANG.tab_trainers'));
}
}
}
// tab: quests [quests]
if (in_array($this->cat, [9, 11])) {
$sort = 0;
switch ($this->typeId) {
case 182:
$sort = 24;
break;
// Herbalism
// Herbalism
示例13: objects
function objects(array $ids = [])
{
$baseQuery = '
SELECT
go.entry,
`type`,
IF(`type` = 2, -2, -- quests 1
IF(`type` = 8 AND Data0 IN (1, 2, 3, 4, 1552), -6, -- tools
IF(`type` = 3 AND IFNULL(gqi.ItemId, 0) <> 0, -2, -- quests 2
IF(`type` IN (3, 9, 25), `type`, 0)))), -- regular chests, books, pools
0 AS event, -- linked worldevent
displayId,
go.name,
gtl2.`name` AS name_loc2,
gtl3.`name` AS name_loc3,
gtl6.`name` AS name_loc6,
gtl8.`name` AS name_loc8,
faction,
flags,
0 AS cuFlags, -- custom Flags
IF(`type` IN (3, 25), Data1, 0), -- lootId
IF(`type` IN (2, 3, 6, 10, 13, 24, 26), Data0, IF(`type` IN (0, 1), Data1, 0)), -- lockId
0 AS reqSkill, -- reqSkill
IF(`type` = 9, Data0, IF(`type` = 10, Data7, 0)), -- pageTextId
IF(`type` = 1, Data3, -- linkedTrapIds
IF(`type` = 3, Data7,
IF(`type` = 10, Data12,
IF(`type` = 8, Data2, 0)))),
IF(`type` = 5, Data5, -- reqQuest
IF(`type` = 3, Data8,
IF(`type` = 10, Data1,
IF(`type` = 8, Data4, 0)))),
IF(`type` = 8, Data0, 0), -- spellFocusId
IF(`type` = 10, Data10, -- onUseSpell
IF(`type` IN (18, 24), Data1,
IF(`type` = 26, Data2,
IF(`type` = 22, Data0, 0)))),
IF(`type` = 18, Data4, 0), -- onSuccessSpell
IF(`type` = 18, Data2, IF(`type` = 24, Data3, 0)), -- auraSpell
IF(`type` = 30, Data2, IF(`type` = 24, Data4, IF(`type` = 6, Data3, 0))), -- triggeredSpell
IF(`type` = 29, CONCAT_WS(" ", Data14, Data15, Data16, Data17, Data0), -- miscInfo: capturePoint
IF(`type` = 3, CONCAT_WS(" ", Data4, Data5, Data2), -- miscInfo: loot v
IF(`type` = 25, CONCAT_WS(" ", Data2, Data3, 0),
IF(`type` = 23, CONCAT_WS(" ", Data0, Data1, Data2), "")))), -- miscInfo: meetingStone
IF(ScriptName <> "", ScriptName, AIName)
FROM
gameobject_template go
LEFT JOIN
gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR"
LEFT JOIN
gameobject_template_locale gtl3 ON go.entry = gtl3.entry AND gtl3.`locale` = "deDE"
LEFT JOIN
gameobject_template_locale gtl6 ON go.entry = gtl6.entry AND gtl6.`locale` = "esES"
LEFT JOIN
gameobject_template_locale gtl8 ON go.entry = gtl8.entry AND gtl8.`locale` = "ruRU"
LEFT JOIN
gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry
{
WHERE
go.entry IN (?a)
}
GROUP BY
go.entry
LIMIT
?d, ?d';
$updateQuery = '
UPDATE
?_objects o
LEFT JOIN
dbc_lock l ON l.id = IF(o.`type` = 3, lockId, null)
SET
typeCat = IF(`type` = 3 AND (l.properties1 = 1 OR l.properties2 = 1), -5, -- footlocker
IF(`type` = 3 AND (l.properties1 = 2), -3, -- herb
IF(`type` = 3 AND (l.properties1 = 3), -4, typeCat))), -- ore
reqSkill = IF(`type` = 3 AND l.properties1 IN (1, 2, 3), IF(l.reqSkill1 > 1, l.reqSkill1, 1),
IF(`type` = 3 AND l.properties2 = 1, IF(l.reqSkill2 > 1, l.reqSkill2, 1), 0))
{
WHERE
o.id IN (?a)
}';
$offset = 0;
while ($objects = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) {
CLISetup::log(' * sets ' . ($offset + 1) . ' - ' . ($offset + count($objects)));
$offset += SqlGen::$stepSize;
foreach ($objects as $o) {
DB::Aowow()->query('REPLACE INTO ?_objects VALUES (?a)', array_values($o));
}
}
// apply typeCat and reqSkill depending on locks
DB::Aowow()->query($updateQuery, $ids ?: DBSIMPLE_SKIP);
return true;
}
示例14: GetRandomTitle
private static function GetRandomTitle()
{
$title = DB::World()->selectRow("SELECT `title_en` AS `originalTitle`%s FROM `DBPREFIX_site_titles` ORDER BY RAND() LIMIT 1", WoW_Locale::GetLocaleID() == LOCALE_EN ? null : sprintf(', `title_%s` AS `localizedTitle`', WoW_Locale::GetLocale()));
if (!$title) {
return false;
}
if (isset($title['localizedTitle']) && $title['localizedTitle'] != '') {
return $title['localizedTitle'];
}
return $title['originalTitle'];
}
示例15: spawns
function spawns()
{
$alphaMapCache = [];
$alphaMapCheck = function ($areaId, array &$set) use(&$alphaMapCache) {
$file = 'setup/generated/alphaMaps/' . $areaId . '.png';
if (!file_exists($file)) {
// file does not exist (probably instanced area)
return false;
}
// invalid and corner cases (literally)
if (!is_array($set) || empty($set['posX']) || empty($set['posY']) || $set['posX'] >= 100 || $set['posY'] >= 100) {
$set = null;
return true;
}
if (empty($alphaMapCache[$areaId])) {
$alphaMapCache[$areaId] = imagecreatefrompng($file);
}
// alphaMaps are 1000 x 1000, adapt points [black => valid point]
if (!imagecolorat($alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10)) {
$set = null;
}
return true;
};
$checkCoords = function ($points) use($alphaMapCheck) {
$result = [];
$capitals = array(1497, 1637, 1638, 3487, 1519, 1537, 1657, 3557, 3703, 4395);
foreach ($points as $res) {
if ($alphaMapCheck($res['areaId'], $res)) {
if (!$res) {
continue;
}
// some rough measure how central the spawn is on the map (the lower the number, the better)
// 0: perfect center; 1: touches a border
$q = abs(($res['posX'] - 50) / 50 * (($res['posY'] - 50) / 50));
if (empty($result) || $result[0] > $q) {
$result = [$q, $res];
}
} else {
if (in_array($res['areaId'], $capitals)) {
// capitals (auto-discovered) and no hand-made alphaMap available
return $res;
} else {
if (empty($result)) {
// add with lowest quality if alpha map is missing
$result = [1.0, $res];
}
}
}
}
// spawn does not really match on a map, but we need at least one result
if (!$result) {
usort($points, function ($a, $b) {
return $a['quality'] < $b['quality'] ? -1 : 1;
});
$result = [1.0, $points[0]];
}
return $result[1];
};
$query[1] = ['SELECT c.guid, 1 AS "type", c.id AS typeId, c.spawntimesecs AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, IFNULL(ca.path_id, 0) AS pathId, c.position_y AS `posX`, c.position_x AS `posY` ' . 'FROM creature c LEFT JOIN creature_addon ca ON ca.guid = c.guid', ' - assembling ' . CLISetup::bold('creature') . ' spawns'];
$query[2] = ['SELECT c.guid, 2 AS "type", c.id AS typeId, ABS(c.spawntimesecs) AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, 0 as pathId, c.position_y AS `posX`, c.position_x AS `posY` ' . 'FROM gameobject c', ' - assembling ' . CLISetup::bold('gameobject') . ' spawns'];
$query[3] = ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, w.waittime AS "wait", w.location_y AS `posX`, w.location_x AS `posY` ' . 'FROM creature c JOIN script_waypoint w ON c.id = w.entry', ' - assembling waypoints from ' . CLISetup::bold('script_waypoint')];
$query[4] = ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, 0 AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' . 'FROM creature c JOIN waypoints w ON c.id = w.entry', ' - assembling waypoints from ' . CLISetup::bold('waypoints')];
$query[5] = ['SELECT c.guid, -w.id AS "npcOrPath", w.point, c.zoneId AS areaId, c.map, w.delay AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' . 'FROM creature c JOIN creature_addon ca ON ca.guid = c.guid JOIN waypoint_data w ON w.id = ca.path_id', ' - assembling waypoints from ' . CLISetup::bold('waypoint_data')];
$queryPost = 'SELECT dm.Id, wma.areaId, IFNULL(dm.floor, 0) AS floor, ' . '100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)), 1) AS `posX`, ' . '100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)), 1) AS `posY`, ' . '((abs(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)) - 50) / 50) * ' . ' (abs(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)) - 50) / 50)) AS quality ' . 'FROM dbc_worldmaparea wma ' . 'LEFT JOIN dbc_dungeonmap dm ON dm.mapId = IF(?d AND wma.mapId NOT IN (0, 1, 530), wma.mapId, -1) ' . 'WHERE wma.mapId = ?d AND IF(?d, wma.areaId = ?d, wma.areaId <> 0) ' . 'HAVING (`posX` BETWEEN 0.1 AND 99.9 AND `posY` BETWEEN 0.1 AND 99.9) AND (dm.Id IS NULL OR ?d) ' . 'ORDER BY quality ASC';
/*********************/
/* truncate old data */
/*********************/
DB::Aowow()->query('TRUNCATE TABLE ?_spawns');
DB::Aowow()->query('TRUNCATE TABLE ?_creature_waypoints');
/**************************/
/* offsets for transports */
/**************************/
$transports = DB::World()->selectCol('SELECT Data0 AS pathId, Data6 AS ARRAY_KEY FROM gameobject_template WHERE type = 15 AND Data6 <> 0');
foreach ($transports as &$t) {
$t = DB::Aowow()->selectRow('SELECT posX, posY, mapId FROM dbc_taxipathnode tpn WHERE tpn.pathId = ?d AND nodeIdx = 0', $t);
}
/**************/
/* perform... */
/**************/
foreach ($query as $idx => $q) {
CLISetup::log($q[1]);
$n = 0;
$sum = 0;
foreach (DB::World()->select($q[0]) as $spawn) {
if (!$n) {
CLISetup::log(' * sets ' . ($sum + 1) . ' - ' . ($sum += SqlGen::$stepSize));
}
if ($n++ > SqlGen::$stepSize) {
$n = 0;
}
// npc/object is on a transport -> apply offsets to path of transport
// note, that the coordinates are mixed up .. again
// also note, that transport DO spawn outside of displayable area maps .. another todo i guess..
if (isset($transports[$spawn['map']])) {
$spawn['posX'] += $transports[$spawn['map']]['posY'];
$spawn['posY'] += $transports[$spawn['map']]['posX'];
$spawn['map'] = $transports[$spawn['map']]['mapId'];
}
$points = DB::Aowow()->select($queryPost, $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], 1, $spawn['map'], $spawn['areaId'], $spawn['areaId'], $spawn['areaId'] ? 1 : 0);
if (!$points) {
//.........这里部分代码省略.........