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

@@ -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)