drop usage of holidayIds (as far as possible)
  the obvious change is, that all events are now refenreced by a positive eventId.
  (?event=375 will probably become ?event=5)
Comments
  fixed malformed db-table. It can now hold negative typeIds.
  applying this commit will drop any comments related to events without holiday
  added gain of SiteReputation for comment-replies

resyncing dependencies of 'game_event' is required
This commit is contained in:
Sarjuuk
2015-07-11 23:59:55 +02:00
parent e9399c169a
commit 051334da22
22 changed files with 171 additions and 105 deletions

View File

@@ -575,6 +575,10 @@ class AjaxHandler
if (!$this->post('id') || !User::canUpvote())
break;
$owner = DB::Aowow()->selectCell('SELECT userId FROM ?_comments WHERE id = ?d', $this->post('id'));
if (!$owner)
break;
$ok = DB::Aowow()->query(
'INSERT INTO ?_comments_rates (commentId, userId, value) VALUES (?d, ?d, ?d)',
$this->post('id'),
@@ -583,13 +587,20 @@ class AjaxHandler
);
if ($ok)
{
Util::gainSiteReputation($owner, SITEREP_ACTION_UPVOTED, ['id' => $this->post('id'), 'voterId' => User::$id]);
User::decrementDailyVotes();
}
break;
case 'downvote-reply':
if (!$this->post('id') || !User::canUpvote())
break;
$owner = DB::Aowow()->selectCell('SELECT userId FROM ?_comments WHERE id = ?d', $this->post('id'));
if (!$owner)
break;
$ok = DB::Aowow()->query(
'INSERT INTO ?_comments_rates (commentId, userId, value) VALUES (?d, ?d, ?d)',
$this->post('id'),
@@ -598,7 +609,10 @@ class AjaxHandler
);
if ($ok)
{
Util::gainSiteReputation($owner, SITEREP_ACTION_DOWNVOTED, ['id' => $this->post('id'), 'voterId' => User::$id]);
User::decrementDailyVotes();
}
}
return json_encode($result, JSON_NUMERIC_CHECK);

View File

@@ -330,11 +330,7 @@ class CommunityContent
if (!$ids)
continue;
$cnd = [['id', $ids]];
if ($t == TYPE_WORLDEVENT) // FKIN HOLIDAYS
array_push($cnd, ['holidayId', $ids], 'OR');
$tClass = new Util::$typeClasses[$t]($cnd);
$tClass = new Util::$typeClasses[$t](array(['id', $ids]));
foreach ($pages as &$p)
if ($p['type'] == $t)
if ($tClass->getEntry($p['typeId']))

View File

@@ -29,6 +29,7 @@ class ItemList extends BaseType
'ic' => ['j' => ['?_icons ic ON ic.id = -i.displayId', true], 's' => ', ic.iconString'],
'is' => ['j' => ['?_item_stats `is` ON `is`.`id` = `i`.`id`', true], 's' => ', `is`.*'],
's' => ['j' => ['?_spell `s` ON s.effect1CreateItemId = i.id', true], 'g' => 'i.id'],
'e' => ['j' => ['?_events `e` ON e.id = i.eventId', true], 's' => ', e.holidayId'],
'src' => ['j' => ['?_source src ON type = 3 AND typeId = i.id', true], 's' => ', moreType, moreTypeId, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
);
@@ -88,9 +89,9 @@ class ItemList extends BaseType
if (empty($this->vendors))
{
$itemz = DB::World()->select('
SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, nv.extendedCost FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, nv.extendedCost FROM npc_vendor nv WHERE {nv.entry IN (?a) AND} nv.item IN (?a)
UNION
SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, IFNULL(IF(ge.holiday, ge.holiday, -ge.eventEntry), 0) AS eventId, genv.maxcount, genv.extendedCost FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, ge.eventEntry AS eventId, genv.maxcount, genv.extendedCost FROM game_event_npc_vendor genv LEFT JOIN game_event ge ON genv.eventEntry = ge.eventEntry JOIN creature c ON c.guid = genv.guid WHERE {c.id IN (?a) AND} genv.item IN (?a)',
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
array_keys($this->templates),
empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC],
@@ -543,11 +544,9 @@ class ItemList extends BaseType
$x .= "<br />".Lang::game('duration').Lang::main('colon').Util::formatTime(abs($dur) * 1000).($this->curTpl['flagsCustom'] & 0x1 ? ' ('.Lang::item('realTime').')' : null);
// required holiday
if ($hId = $this->curTpl['holidayId'])
{
$hDay = DB::Aowow()->selectRow("SELECT * FROM ?_holidays WHERE id = ?", $hId);
$x .= '<br />'.sprintf(Lang::game('requires'), '<a href="'.$hId.'" class="q1">'.Util::localizedString($hDay, 'name').'</a>');
}
if ($eId = $this->curTpl['eventId'])
if ($hName = DB::Aowow()->selectRow('SELECT h.* FROM ?_holidays h JOIN ?_events e ON e.holidayId = h.id WHERE e.id = ?d', $eId))
$x .= '<br />'.sprintf(Lang::game('requires'), '<a href="'.$eId.'" class="q1">'.Util::localizedString($hName, 'name').'</a>');
// item begins a quest
if ($this->curTpl['startQuest'])
@@ -1657,7 +1656,7 @@ class ItemListFilter extends Filter
99 => [FILTER_CR_ENUM, 'requiredSkill' ], // requiresprof
66 => [FILTER_CR_ENUM, 'requiredSpell' ], // requiresprofspec
17 => [FILTER_CR_ENUM, 'requiredFaction' ], // requiresrepwith
169 => [FILTER_CR_ENUM, 'holidayId' ], // requiresevent
169 => [FILTER_CR_ENUM, 'e.holidayId' ], // requiresevent
21 => [FILTER_CR_NUMERIC, 'is.agi', null, true], // agi
23 => [FILTER_CR_NUMERIC, 'is.int', null, true], // int
22 => [FILTER_CR_NUMERIC, 'is.sta', null, true], // sta

View File

@@ -14,8 +14,11 @@ class ItemsetList extends BaseType
public $pieceToSet = []; // used to build g_items and search
private $classes = []; // used to build g_classes
protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset `set`';
protected $queryOpts = ['set' => ['o' => 'maxlevel DESC']];
protected $queryBase = 'SELECT `set`.*, `set`.id AS ARRAY_KEY FROM ?_itemset `set`';
protected $queryOpts = array(
'set' => ['o' => 'maxlevel DESC'],
'e' => ['j' => ['?_events e ON e.id = `set`.eventId', true], 's' => ', e.holidayId']
);
public function __construct($conditions = [])
{
@@ -171,7 +174,7 @@ class ItemsetListFilter extends Filter
3 => [FILTER_CR_NUMERIC, 'npieces', ], // pieces
4 => [FILTER_CR_STRING, 'bonusText', true ], // bonustext
5 => [FILTER_CR_BOOLEAN, 'heroic', ], // heroic
6 => [FILTER_CR_ENUM, 'holidayId', ], // relatedevent
6 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos

View File

@@ -18,6 +18,7 @@ class QuestList extends BaseType
'q' => [],
'rsc' => ['j' => '?_spell rsc ON q.rewardSpellCast = rsc.id'], // limit rewardSpellCasts
'qse' => ['j' => '?_quests_startend qse ON q.id = qse.questId', 's' => ', qse.method'], // groupConcat..?
'e' => ['j' => ['?_events e ON e.id = `q`.eventId', true], 's' => ', e.holidayId']
);
public function __construct($conditions = [], $miscData = null)
@@ -433,7 +434,7 @@ class QuestListFilter extends Filter
45 => [FILTER_CR_BOOLEAN, 'rewardTitleId', ], // titlerewarded
2 => [FILTER_CR_NUMERIC, 'rewardXP', ], // experiencegained
3 => [FILTER_CR_NUMERIC, 'rewardOrReqMoney', ], // moneyrewarded
33 => [FILTER_CR_ENUM, 'holidayId', ], // relatedevent
33 => [FILTER_CR_ENUM, 'e.holidayId', ], // relatedevent
25 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
36 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos

View File

@@ -9,7 +9,7 @@ class WorldEventList extends BaseType
public static $type = TYPE_WORLDEVENT;
public static $brickFile = 'event';
protected $queryBase = 'SELECT *, -e.id as id, -e.id AS ARRAY_KEY FROM ?_events e';
protected $queryBase = 'SELECT *, e.id as id, e.id AS ARRAY_KEY FROM ?_events e';
protected $queryOpts = array(
'e' => [['h']],
'h' => ['j' => ['?_holidays h ON e.holidayId = h.id', true], 'o' => '-e.id ASC']
@@ -40,12 +40,9 @@ class WorldEventList extends BaseType
if ($this->curTpl['requires'])
$this->curTpl['requires'] = explode(' ', $this->curTpl['requires']);
$this->curTpl['eventBak'] = -$this->curTpl['id'];
// change Ids if holiday is set
if ($this->curTpl['holidayId'] > 0)
{
$this->curTpl['id'] = $this->curTpl['holidayId'];
$this->curTpl['name'] = $this->getField('name', true);
$replace[$this->id] = $this->curTpl;
unset($this->curTpl['description']);

View File

@@ -26,18 +26,12 @@ class EventPage extends GenericPage
$this->typeId = intVal($id);
$conditions = $this->typeId < 0 ? [['id', -$this->typeId]] : [['holidayId', $this->typeId]];
$this->subject = new WorldEventList($conditions);
$this->subject = new WorldEventList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::game('event'), Lang::event('notFound'));
$this->hId = $this->subject->getField('holidayId');
$this->eId = $this->subject->getField('eventBak');
// redirect if associated with a holiday
if ($this->hId && $this->typeId != $this->hId)
header('Location: '.HOST_URL.'?event='.$this->hId, true, 302);
$this->eId = $this->typeId;
$this->name = $this->subject->getField('name', true);
}
@@ -86,7 +80,7 @@ class EventPage extends GenericPage
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(
BUTTON_WOWHEAD => $this->typeId > 0,
BUTTON_WOWHEAD => $this->hId > 0,
BUTTON_LINKS => true
);
$this->dates = array(
@@ -163,11 +157,11 @@ class EventPage extends GenericPage
{
$itemCnd = array(
'OR',
['holidayId', $this->hId], // direct requirement on item
['eventId', $this->eId], // direct requirement on item
);
// tab: quests (by table, go & creature)
$quests = new QuestList(array(['holidayId', $this->hId]));
$quests = new QuestList(array(['eventId', $this->eId]));
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
@@ -217,7 +211,7 @@ class EventPage extends GenericPage
}
// tab: see also (event conditions)
if ($rel = DB::World()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId))
if ($rel = DB::World()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, prerequisite_event, -eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId))
{
$list = [];
array_walk($rel, function($v, $k) use (&$list) {
@@ -233,18 +227,18 @@ class EventPage extends GenericPage
$this->extendGlobalData($relEvents->getJSGlobals());
$relData = $relEvents->getListviewData();
foreach ($relEvents->getFoundIDs() as $id)
$relData[$id]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, -$this->eId]];
$relData[$id]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $this->eId]];
$this->extendGlobalData($this->subject->getJSGlobals());
foreach ($rel as $r)
{
if ($r >= 0)
if ($r <= 0)
continue;
$this->extendGlobalIds(TYPE_WORLDEVENT, $r);
$d = $this->subject->getListviewData();
$d[-$this->eId]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $r]];
$d[$this->eId]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $r]];
$relData = array_merge($relData, $d);
}
@@ -265,6 +259,9 @@ class EventPage extends GenericPage
protected function postCache()
{
if ($this->hId)
Util::$wowheadLink = 'http://'.Util::$subDomains[User::$localeId].'.wowhead.com/event='.$this->hId;
/********************/
/* finalize infobox */
/********************/

View File

@@ -634,27 +634,7 @@ class GenericPage
$this->initJSGlobal($type);
// todo (med): properly distinguish holidayId and eventId
$cnd = [CFG_SQL_LIMIT_NONE];
if ($type == TYPE_WORLDEVENT)
{
$hIds = array_filter($ids, function($v) { return $v > 0; });
$eIds = array_filter($ids, function($v) { return $v < 0; });
if ($hIds)
$cnd[] = ['holidayId', array_unique($hIds, SORT_NUMERIC)];
if ($eIds)
{
array_walk($eIds, function(&$v) { $v = abs($v);});
$cnd[] = ['e.id', array_unique($eIds, SORT_NUMERIC)];
}
if ($eIds && $hIds)
$cnd[] = 'OR';
}
else
$cnd [] = ['id', array_unique($ids, SORT_NUMERIC)];
$cnd = [CFG_SQL_LIMIT_NONE, ['id', array_unique($ids, SORT_NUMERIC)]];
switch ($type)
{

View File

@@ -167,9 +167,11 @@ class ItemPage extends genericPage
}
// related holiday
if ($hId = $this->subject->getField('holidayId'))
if ($hName = DB::Aowow()->selectRow('SELECT * FROM ?_holidays WHERE id = ?d', $hId))
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[url=?event='.$hId.']'.Util::localizedString($hName, 'name').'[/url]';
if ($eId = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $eId);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$eId.']';
}
// tool
if ($tId = $this->subject->getField('totemCategory'))

View File

@@ -68,11 +68,11 @@ class ItemsetPage extends GenericPage
if ($this->subject->getField('cuFlags') & CUSTOM_UNAVAILABLE)
$infobox[] = Lang::main('unavailable');
// holiday
if ($h = $this->subject->getField('holidayId'))
// worldevent
if ($e = $this->subject->getField('eventId'))
{
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$h.']';
$this->extendGlobalIds(TYPE_WORLDEVENT, $h);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$e.']';
$this->extendGlobalIds(TYPE_WORLDEVENT, $e);
}
// itemLevel
@@ -184,10 +184,10 @@ class ItemsetPage extends GenericPage
$rel[] = ['classMask', 1 << (end($this->path) - 1), '&'];
$rel[] = ['contentGroup', (int)$_ta];
}
else if ($this->subject->getField('holidayId'))
else if ($this->subject->getField('eventId'))
{
$rel[] = ['id', $this->typeId, '!'];
$rel[] = ['holidayId', 0, '!'];
$rel[] = ['eventId', 0, '!'];
}
else if ($this->subject->getField('skillId'))
{

View File

@@ -110,7 +110,7 @@ class NpcPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_creature gec, creature c WHERE ge.eventEntry = gec.eventEntry AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_creature gec, creature c WHERE ge.eventEntry = gec.eventEntry AND c.guid = gec.guid AND c.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$ev = [];

View File

@@ -63,7 +63,7 @@ class ObjectPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// Event (ignore events, where the object only gets removed)
if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.eventEntry FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$ev = [];

View File

@@ -63,7 +63,7 @@ class QuestPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
// event (todo: assign eventData)
if ($_ = $this->subject->getField('holidayId'))
if ($_ = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $_);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$_.']';

View File

@@ -49,8 +49,6 @@ class ScreenshotPage extends GenericPage
$t = Util::$typeClasses[$m[1]];
$c = [['id', intVal($m[2])]];
if ($m[1] == TYPE_WORLDEVENT && $m[2] < 0) // ohforfsake..
$c = [['id', -intVal($m[2])]];
$this->destination = new $t($c);

View File

@@ -61,8 +61,11 @@ class TitlePage extends GenericPage
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 ($e = $this->subject->getField('holidayId'))
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[url=?event='.$e.']'.WorldEventList::getName($e).'[/url]';
if ($eId = $this->subject->getField('eventId'))
{
$this->extendGlobalIds(TYPE_WORLDEVENT, $eId);
$infobox[] = Lang::game('eventShort').Lang::main('colon').'[event='.$eId.']';
}
/****************/
/* Main Content */

View File

@@ -1080,7 +1080,7 @@ CREATE TABLE `aowow_items` (
`disenchantId` mediumint(8) unsigned NOT NULL DEFAULT '0',
`duration` int(10) unsigned NOT NULL DEFAULT '0',
`itemLimitCategory` smallint(6) NOT NULL DEFAULT '0',
`holidayId` int(11) unsigned NOT NULL DEFAULT '0',
`eventId` smallint(5) unsigned NOT NULL,
`scriptName` varchar(64) NOT NULL DEFAULT '',
`foodType` tinyint(3) unsigned NOT NULL DEFAULT '0',
`gemEnchantmentId` mediumint(8) NOT NULL,
@@ -1152,7 +1152,7 @@ CREATE TABLE `aowow_itemset` (
`quality` tinyint(4) NOT NULL,
`type` smallint(6) NOT NULL COMMENT 'g_itemset_types',
`contentGroup` smallint(6) NOT NULL COMMENT 'g_itemset_notes',
`holidayId` smallint(3) NOT NULL,
`eventId` smallint(5) unsigned NOT NULL,
`skillId` smallint(3) unsigned NOT NULL,
`skillLevel` smallint(3) unsigned NOT NULL,
PRIMARY KEY (`id`)
@@ -1349,7 +1349,7 @@ CREATE TABLE `aowow_quests` (
`type` smallint(5) unsigned NOT NULL DEFAULT '0',
`suggestedPlayers` tinyint(3) unsigned NOT NULL DEFAULT '0',
`timeLimit` int(10) unsigned NOT NULL DEFAULT '0',
`holidayId` smallint(6) NOT NULL DEFAULT '0',
`eventId` smallint(5) unsigned NOT NULL,
`prevQuestId` mediumint(8) NOT NULL DEFAULT '0',
`nextQuestId` mediumint(8) NOT NULL DEFAULT '0',
`exclusiveGroup` mediumint(8) NOT NULL DEFAULT '0',
@@ -2134,7 +2134,7 @@ CREATE TABLE `aowow_titles` (
`side` tinyint(3) unsigned NOT NULL,
`expansion` tinyint(3) unsigned NOT NULL,
`src12Ext` mediumint(9) unsigned NOT NULL,
`holidayId` smallint(5) unsigned NOT NULL,
`eventId` smallint(5) unsigned NOT NULL,
`male_loc0` varchar(33) NOT NULL,
`male_loc2` varchar(35) NOT NULL,
`male_loc3` varchar(37) NOT NULL,

View File

@@ -57,10 +57,10 @@ class SqlGen
'spelldifficulty' => [null, null, null, ['spelldifficulty_dbc']],
'taxi' /* nodes + paths */ => [null, null, null, ['creature_template', 'creature']],
'titles' => [null, null, null, ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward']],
'items' => [null, null, null, ['item_template', 'locales_item', 'spell_group']],
'items' => [null, null, null, ['item_template', 'locales_item', 'spell_group', 'game_event']],
'spawns' /* + waypoints */ => [null, null, null, ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data']],
'zones' => [null, null, null, ['access_requirement']],
'itemset' => [null, null, ['spell'], ['item_template']],
'itemset' => [null, null, ['spell'], ['item_template', 'game_event']],
'item_stats' => [null, null, ['items', 'spell'], null],
'source' => [null, null, ['spell', 'achievements'], ['npc_vendor', 'game_event_npc_vendor', 'creature', 'quest_template', 'playercreateinfo_item', 'npc_trainer', 'skill_discovery_template', 'playercreateinfo_spell', 'achievement_reward']]
);

View File

@@ -11,6 +11,7 @@ if (!CLI)
* item_template
* locales_item
* spell_group
* game_event
*/
$customData = array(
@@ -80,7 +81,7 @@ function items(array $ids = [])
spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4,
spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,
bonding,
description, description_loc2, description_loc3, description_loc6, description_loc8,
it.description, description_loc2, description_loc3, description_loc6, description_loc8,
PageText,
LanguageID,
startquest,
@@ -101,7 +102,7 @@ function items(array $ids = [])
DisenchantID,
duration,
ItemLimitCategory,
HolidayId,
IFNULL(ge.eventEntry, 0),
ScriptName,
FoodType,
0 AS gemEnchantmentId,
@@ -113,6 +114,8 @@ function items(array $ids = [])
locales_item li ON li.entry = it.entry
LEFT JOIN
spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2)
LEFT JOIN
game_event ge ON ge.holiday = it.HolidayId AND it.HolidayId > 0
{
WHERE
ct.entry IN (?a)
@@ -182,7 +185,7 @@ function items(array $ids = [])
DB::Aowow()->query('UPDATE ?_items SET subClass = -2 WHERE quality = 4 AND class = 15 AND subClassBak = 0 AND requiredClass AND (requiredClass & 0x5FF) <> 0x5FF');
// move some junk to holiday if it requires one
DB::Aowow()->query('UPDATE ?_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND holidayId <> 0');
DB::Aowow()->query('UPDATE ?_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND eventId <> 0');
// move misc items that start quests to class: quest (except Sayges scrolls for consistency)
DB::Aowow()->query('UPDATE ?_items SET class = 12 WHERE classBak = 15 AND startQuest <> 0 AND name_loc0 NOT LIKE "sayge\'s fortune%"');

View File

@@ -15,6 +15,7 @@ if (!CLI)
/* deps:
* item_template
* game_event
*/
@@ -33,6 +34,11 @@ function itemset()
812 => 181, // Noblegarden
);
// find events associated with holidayIds
if ($pairs = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($setToHoliday)))
foreach ($setToHoliday as &$hId)
$hId = !empty($pairs[$hId]) ? $pairs[$hId] : 0;
// tags where refId == virtualId
// in pve sets are not recycled beyond the contentGroup
$tagsById = array(

View File

@@ -33,7 +33,7 @@ function quests(array $ids = [])
Type,
SuggestedPlayers,
LimitTime,
0 AS holidayId, -- holidayId
IFNULL(gesqr.eventEntry, 0) AS eventId,
PrevQuestId,
NextQuestId,
ExclusiveGroup,
@@ -90,6 +90,8 @@ function quests(array $ids = [])
quest_template q
LEFT JOIN
locales_quest lq ON q.Id = lq.Id
LEFT JOIN
game_event_seasonal_questrelation gesqr ON gesqr.questId = q.Id
{
WHERE
q.Id IN (?a)
@@ -155,7 +157,7 @@ function quests(array $ids = [])
DB::Aowow()->query($repQuery, $i, $i, $i, $i, $ids ?: DBSIMPLE_SKIP);
// update zoneOrSort .. well .. now "not documenting" bites me in the ass .. ~700 quests were changed, i don't know by what method
$questByHoliday = DB::World()->selectCol('SELECT sq.questId AS ARRAY_KEY, ge.holiday FROM game_event_seasonal_questrelation sq JOIN game_event ge ON ge.eventEntry = sq.eventEntry');
$eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0');
$holidaySorts = array(
141 => -1001, 181 => -374, 201 => -1002,
301 => -101, 321 => -1005, 324 => -1003,
@@ -163,9 +165,9 @@ function quests(array $ids = [])
374 => -364, 376 => -364, 404 => -375,
409 => -41, 423 => -376, 424 => -101
);
foreach ($questByHoliday as $qId => $hId)
if ($hId)
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE id = ?d{ AND id IN (?a)}', $holidaySorts[$hId], $qId, $ids ?: DBSIMPLE_SKIP);
foreach ($holidaySorts as $hId => $sort)
if (!empty($eventSet[$hId]))
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE eventId = ?d{ AND id IN (?a)}', $sort, $eventSet[$hId], $ids ?: DBSIMPLE_SKIP);
/*
zoneorsort for quests will need updating
@@ -193,10 +195,6 @@ function quests(array $ids = [])
// dungeon quests to Misc/Dungeon Finder
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE (specialFlags & ?d OR id IN (?a)){ AND id IN (?a)}', -1010, QUEST_FLAG_SPECIAL_DUNGEON_FINDER, [24789, 24791, 24923], $ids ?: DBSIMPLE_SKIP);
// finally link related events (after zoneorSort has been updated)
foreach ($holidaySorts as $hId => $sort)
DB::Aowow()->query('UPDATE ?_quests SET holidayId = ?d WHERE zoneOrSort = ?d{ AND id IN (?a)}', $hId, $sort, $ids ?: DBSIMPLE_SKIP);
return true;
}

View File

@@ -14,27 +14,32 @@ if (!CLI)
*/
$customData = array(
137 => ['holidayId' => 201, 'gender' => 2],
138 => ['holidayId' => 201, 'gender' => 1],
124 => ['holidayId' => 324],
135 => ['holidayId' => 423],
155 => ['holidayId' => 181],
133 => ['holidayId' => 372],
74 => ['holidayId' => 327],
75 => ['holidayId' => 341],
76 => ['holidayId' => 341],
134 => ['holidayId' => 141],
168 => ['holidayId' => 404]
137 => ['gender' => 2],
138 => ['gender' => 1],
);
$reqDBC = ['chartitles'];
function titles()
{
$titleHoliday = array(
137 => 201,
138 => 201,
124 => 324,
135 => 423,
155 => 181,
133 => 372,
74 => 327,
75 => 341,
76 => 341,
134 => 141,
168 => 404
);
$questQuery = '
SELECT
qt.RewardTitleId AS ARRAY_KEY,
qt.RequiredRaces,
ge.holiday
ge.eventEntry
FROM
quest_template qt
LEFT JOIN
@@ -61,13 +66,19 @@ function titles()
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 event
if ($assoc = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($titleHoliday)))
foreach ($titleHoliday as $tId => $hId)
if (!empty($assoc[$hId]))
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $assoc[$hId], $tId);
// 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);
if ($data['eventEntry'])
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $data['eventEntry'], $tId);
$side = Util::sideByRaceMask($data['RequiredRaces']);
if ($side == 3)

View File

@@ -0,0 +1,58 @@
ALTER TABLE `aowow_items`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_items`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `itemLimitCategory`;
ALTER TABLE `aowow_itemset`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_itemset`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `contentGroup`;
ALTER TABLE `aowow_quests`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_quests`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `timeLimit`;
ALTER TABLE `aowow_titles`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_titles`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `src12Ext`;
ALTER TABLE `aowow_comments`
ALTER `typeId` DROP DEFAULT;
ALTER TABLE `aowow_comments`
CHANGE COLUMN `typeId` `typeId` INT(10) NOT NULL COMMENT 'ID Of Page' AFTER `type`;
-- ---------------
-- try to reconstruct CommunityContent for TYPE_WORLDEVENT (12)
-- ---------------
UPDATE `aowow_comments` c, `aowow_events` e SET c.`typeId` = e.`id` WHERE c.`type` = 12 AND c.`typeId` > 0 AND c.`typeId` = e.`holidayId`;
UPDATE `aowow_comments` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_screenshots` s, `aowow_events` e SET s.`typeId` = e.`id` WHERE s.`type` = 12 AND s.`typeId` > 0 AND s.`typeId` = e.`holidayId`;
UPDATE `aowow_screenshots` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_videos` v, `aowow_events` e SET v.`typeId` = e.`id` WHERE v.`type` = 12 AND v.`typeId` > 0 AND v.`typeId` = e.`holidayId`;
UPDATE `aowow_videos` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
-- ---------------
-- drop not recoverable comments
-- ---------------
DELETE FROM `aowow_account_reputation` WHERE `action` IN (3, 4, 5) AND `sourceA` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)
DELETE FROM `aowow_comments_rates` WHERE `commentId` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)
DELETE FROM `aowow_comments` WHERE `id` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)