mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/DBLayer: Correct few more wrong read types (No. 2)
DB/World: Some consistency in the ints "length" field (not really a length) From A to G world tables verified; missing all the others
This commit is contained in:
15
sql/updates/world/2012_03_27_01_world_misc.sql
Normal file
15
sql/updates/world/2012_03_27_01_world_misc.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
ALTER TABLE `exploration_basexp` CHANGE `level` `level` tinyint(3) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `exploration_basexp` CHANGE `basexp` `basexp` mediumint(8) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `fishing_loot_template` CHANGE `mincountOrRef` `mincountOrRef` mediumint(8) NOT NULL DEFAULT '1';
|
||||
ALTER TABLE `game_event_creature` CHANGE `eventEntry` `eventEntry` tinyint(4) NOT NULL COMMENT 'Entry of the game event. Put negative entry to remove during event.';
|
||||
ALTER TABLE `game_event_gameobject` CHANGE `eventEntry` `eventEntry` tinyint(4) NOT NULL COMMENT 'Entry of the game event. Put negative entry to remove during event.';
|
||||
ALTER TABLE `game_event_model_equip` CHANGE `eventEntry` `eventEntry` tinyint(4) NOT NULL COMMENT 'Entry of the game event.';
|
||||
ALTER TABLE `game_event_npc_vendor` CHANGE `eventEntry` `eventEntry` tinyint(4) NOT NULL COMMENT 'Entry of the game event.';
|
||||
ALTER TABLE `game_event_pool` CHANGE `eventEntry` `eventEntry` tinyint(4) NOT NULL COMMENT 'Entry of the game event. Put negative entry to remove during event.';
|
||||
ALTER TABLE `gameobject_loot_template` CHANGE `mincountOrRef` `mincountOrRef` mediumint(8) NOT NULL DEFAULT '1';
|
||||
ALTER TABLE `gameobject_template` CHANGE `WDBVerified` `WDBVerified` smallint(6) NULL DEFAULT '1';
|
||||
ALTER TABLE `gossip_menu` CHANGE `entry` `entry` smallint(5) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `gossip_menu_option` CHANGE `menu_id` `menu_id` smallint(5) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `gossip_menu_option` CHANGE `id` `id` smallint(5) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `gossip_menu_option` CHANGE `box_money` `box_money` int(10) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `gossip_menu_option` CHANGE `action_menu_id` `action_menu_id` int(10) unsigned NOT NULL DEFAULT '0';
|
||||
@@ -220,7 +220,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
uint16 event_id = fields[0].GetUInt8();
|
||||
if (event_id == 0)
|
||||
{
|
||||
sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used.");
|
||||
@@ -232,8 +232,8 @@ void GameEventMgr::LoadFromDB()
|
||||
pGameEvent.start = time_t(starttime);
|
||||
uint64 endtime = fields[2].GetUInt64();
|
||||
pGameEvent.end = time_t(endtime);
|
||||
pGameEvent.occurence = fields[3].GetUInt32();
|
||||
pGameEvent.length = fields[4].GetUInt32();
|
||||
pGameEvent.occurence = fields[3].GetUInt64();
|
||||
pGameEvent.length = fields[4].GetUInt64();
|
||||
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
|
||||
|
||||
pGameEvent.state = (GameEventState)(fields[7].GetUInt8());
|
||||
@@ -315,6 +315,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1
|
||||
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
|
||||
if (!result)
|
||||
{
|
||||
@@ -328,7 +329,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
uint16 event_id = fields[0].GetUInt8();
|
||||
|
||||
if (event_id >= mGameEvent.size())
|
||||
{
|
||||
@@ -338,7 +339,7 @@ void GameEventMgr::LoadFromDB()
|
||||
|
||||
if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
|
||||
{
|
||||
uint16 prerequisite_event = fields[1].GetUInt16();
|
||||
uint16 prerequisite_event = fields[1].GetUInt32();
|
||||
if (prerequisite_event >= mGameEvent.size())
|
||||
{
|
||||
sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
|
||||
@@ -382,7 +383,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
int16 event_id = fields[1].GetInt16();
|
||||
int16 event_id = fields[1].GetInt8();
|
||||
|
||||
int32 internal_event_id = mGameEvent.size() + event_id - 1;
|
||||
|
||||
@@ -408,7 +409,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 1 2
|
||||
// 0 1
|
||||
QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.eventEntry FROM gameobject"
|
||||
" JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
|
||||
|
||||
@@ -425,7 +426,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
int16 event_id = fields[1].GetInt16();
|
||||
int16 event_id = fields[1].GetInt8();
|
||||
|
||||
int32 internal_event_id = mGameEvent.size() + event_id - 1;
|
||||
|
||||
@@ -525,7 +526,7 @@ void GameEventMgr::LoadFromDB()
|
||||
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 quest = fields[1].GetUInt32();
|
||||
uint16 event_id = fields[2].GetUInt16();
|
||||
uint16 event_id = fields[2].GetUInt8();
|
||||
|
||||
if (event_id >= mGameEventCreatureQuests.size())
|
||||
{
|
||||
@@ -566,7 +567,7 @@ void GameEventMgr::LoadFromDB()
|
||||
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 quest = fields[1].GetUInt32();
|
||||
uint16 event_id = fields[2].GetUInt16();
|
||||
uint16 event_id = fields[2].GetUInt8();
|
||||
|
||||
if (event_id >= mGameEventGameObjectQuests.size())
|
||||
{
|
||||
@@ -590,7 +591,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3
|
||||
// 0 1 2 3
|
||||
QueryResult result = WorldDatabase.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
|
||||
|
||||
if (!result)
|
||||
@@ -606,7 +607,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 quest = fields[0].GetUInt32();
|
||||
uint16 event_id = fields[1].GetUInt16();
|
||||
uint16 event_id = fields[1].GetUInt8();
|
||||
uint32 condition = fields[2].GetUInt32();
|
||||
float num = fields[3].GetFloat();
|
||||
|
||||
@@ -648,7 +649,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
uint16 event_id = fields[0].GetUInt8();
|
||||
uint32 condition = fields[1].GetUInt32();
|
||||
|
||||
if (event_id >= mGameEvent.size())
|
||||
@@ -659,8 +660,8 @@ void GameEventMgr::LoadFromDB()
|
||||
|
||||
mGameEvent[event_id].conditions[condition].reqNum = fields[2].GetFloat();
|
||||
mGameEvent[event_id].conditions[condition].done = 0;
|
||||
mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt32();
|
||||
mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt32();
|
||||
mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt16();
|
||||
mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt16();
|
||||
|
||||
++count;
|
||||
}
|
||||
@@ -739,7 +740,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
uint16 event_id = fields[1].GetUInt16();
|
||||
uint16 event_id = fields[1].GetUInt8();
|
||||
uint32 npcflag = fields[2].GetUInt32();
|
||||
|
||||
if (event_id >= mGameEvent.size())
|
||||
@@ -763,7 +764,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1
|
||||
// 0 1
|
||||
QueryResult result = WorldDatabase.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation");
|
||||
|
||||
if (!result)
|
||||
@@ -779,7 +780,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
uint16 eventEntry = fields[1].GetUInt16();
|
||||
uint32 eventEntry = fields[1].GetUInt32(); // TODO: Change to uint8
|
||||
|
||||
if (!sObjectMgr->GetQuestTemplate(questId))
|
||||
{
|
||||
@@ -822,7 +823,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
int8 event_id = fields[0].GetInt8();
|
||||
|
||||
if (event_id >= mGameEventVendors.size())
|
||||
{
|
||||
@@ -834,7 +835,7 @@ void GameEventMgr::LoadFromDB()
|
||||
NPCVendorEntry newEntry;
|
||||
uint32 guid = fields[1].GetUInt32();
|
||||
newEntry.item = fields[2].GetUInt32();
|
||||
newEntry.maxcount = fields[3].GetInt32();
|
||||
newEntry.maxcount = fields[3].GetUInt32();
|
||||
newEntry.incrtime = fields[4].GetUInt32();
|
||||
newEntry.ExtendedCost = fields[5].GetUInt32();
|
||||
// get the event npc flag for checking if the npc will be vendor during the event or not
|
||||
@@ -888,7 +889,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
uint16 event_id = fields[0].GetUInt8();
|
||||
|
||||
if (event_id >= mGameEvent.size())
|
||||
{
|
||||
@@ -911,7 +912,7 @@ void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 1 2
|
||||
// 0 1
|
||||
QueryResult result = WorldDatabase.Query("SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template"
|
||||
" JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
|
||||
|
||||
@@ -928,7 +929,7 @@ void GameEventMgr::LoadFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
int16 event_id = fields[1].GetInt16();
|
||||
int16 event_id = fields[1].GetInt8();
|
||||
|
||||
int32 internal_event_id = mGameEvent.size() + event_id - 1;
|
||||
|
||||
@@ -1019,7 +1020,7 @@ void GameEventMgr::StartArenaSeason()
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
uint16 eventId = fields[0].GetUInt16();
|
||||
uint16 eventId = fields[0].GetUInt8();
|
||||
|
||||
if (eventId >= mGameEvent.size())
|
||||
{
|
||||
|
||||
@@ -1767,7 +1767,7 @@ void ObjectMgr::LoadGameobjects()
|
||||
GameObjectData& data = _gameObjectDataStore[guid];
|
||||
|
||||
data.id = entry;
|
||||
data.mapid = fields[2].GetUInt32();
|
||||
data.mapid = fields[2].GetUInt16();
|
||||
data.posX = fields[3].GetFloat();
|
||||
data.posY = fields[4].GetFloat();
|
||||
data.posZ = fields[5].GetFloat();
|
||||
@@ -1790,10 +1790,10 @@ void ObjectMgr::LoadGameobjects()
|
||||
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
|
||||
}
|
||||
|
||||
data.animprogress = fields[12].GetUInt32();
|
||||
data.animprogress = fields[12].GetUInt8();
|
||||
data.artKit = 0;
|
||||
|
||||
uint32 go_state = fields[13].GetUInt32();
|
||||
uint32 go_state = fields[13].GetUInt8();
|
||||
if (go_state >= MAX_GO_STATE)
|
||||
{
|
||||
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
|
||||
@@ -1807,7 +1807,7 @@ void ObjectMgr::LoadGameobjects()
|
||||
sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
|
||||
|
||||
data.phaseMask = fields[15].GetUInt16();
|
||||
int16 gameEvent = fields[16].GetInt16();
|
||||
int16 gameEvent = fields[16].GetInt8();
|
||||
uint32 PoolId = fields[17].GetUInt32();
|
||||
|
||||
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
|
||||
@@ -5661,6 +5661,7 @@ void ObjectMgr::LoadGraveyardZones()
|
||||
|
||||
GraveYardStore.clear(); // need for reload case
|
||||
|
||||
// 0 1 2
|
||||
QueryResult result = WorldDatabase.Query("SELECT id, ghost_zone, faction FROM game_graveyard_zone");
|
||||
|
||||
if (!result)
|
||||
@@ -5680,7 +5681,7 @@ void ObjectMgr::LoadGraveyardZones()
|
||||
|
||||
uint32 safeLocId = fields[0].GetUInt32();
|
||||
uint32 zoneId = fields[1].GetUInt32();
|
||||
uint32 team = fields[2].GetUInt32();
|
||||
uint32 team = fields[2].GetUInt16();
|
||||
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
|
||||
if (!entry)
|
||||
@@ -6449,7 +6450,7 @@ void ObjectMgr::LoadGameObjectTemplate()
|
||||
got.questItems[i] = fields[10 + i].GetUInt32();
|
||||
|
||||
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
|
||||
got.raw.data[i] = fields[16 + i].GetUInt32();
|
||||
got.raw.data[i] = fields[16 + i].GetInt32(); // data1 and data6 can be -1
|
||||
|
||||
got.AIName = fields[40].GetString();
|
||||
got.ScriptId = GetScriptId(fields[41].GetCString());
|
||||
@@ -6612,7 +6613,7 @@ void ObjectMgr::LoadExplorationBaseXP()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint8 level = fields[0].GetUInt8();
|
||||
uint32 basexp = fields[1].GetUInt32();
|
||||
uint32 basexp = fields[1].GetInt32();
|
||||
_baseXPTable[level] = basexp;
|
||||
++count;
|
||||
}
|
||||
@@ -7897,6 +7898,7 @@ void ObjectMgr::LoadGameTele()
|
||||
|
||||
_gameTeleStore.clear(); // for reload case
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
|
||||
|
||||
if (!result)
|
||||
@@ -7920,7 +7922,7 @@ void ObjectMgr::LoadGameTele()
|
||||
gt.position_y = fields[2].GetFloat();
|
||||
gt.position_z = fields[3].GetFloat();
|
||||
gt.orientation = fields[4].GetFloat();
|
||||
gt.mapId = fields[5].GetUInt32();
|
||||
gt.mapId = fields[5].GetUInt16();
|
||||
gt.name = fields[6].GetString();
|
||||
|
||||
if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation))
|
||||
@@ -8326,7 +8328,7 @@ void ObjectMgr::LoadGossipMenu()
|
||||
|
||||
GossipMenus gMenu;
|
||||
|
||||
gMenu.entry = fields[0].GetUInt32();
|
||||
gMenu.entry = fields[0].GetUInt16();
|
||||
gMenu.text_id = fields[1].GetUInt32();
|
||||
|
||||
if (!GetGossipText(gMenu.text_id))
|
||||
@@ -8352,7 +8354,9 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
_gossipMenuItemsStore.clear();
|
||||
|
||||
QueryResult result = WorldDatabase.Query(
|
||||
// 0 1 2 3 4
|
||||
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, "
|
||||
// 5 6 7 8 9
|
||||
"action_menu_id, action_poi_id, box_coded, box_money, box_text "
|
||||
"FROM gossip_menu_option ORDER BY menu_id, id");
|
||||
|
||||
@@ -8371,11 +8375,11 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
|
||||
GossipMenuItems gMenuItem;
|
||||
|
||||
gMenuItem.MenuId = fields[0].GetUInt32();
|
||||
gMenuItem.OptionIndex = fields[1].GetUInt32();
|
||||
gMenuItem.OptionIcon = fields[2].GetUInt8();
|
||||
gMenuItem.MenuId = fields[0].GetUInt16();
|
||||
gMenuItem.OptionIndex = fields[1].GetUInt16();
|
||||
gMenuItem.OptionIcon = fields[2].GetUInt32();
|
||||
gMenuItem.OptionText = fields[3].GetString();
|
||||
gMenuItem.OptionType = fields[4].GetUInt32();
|
||||
gMenuItem.OptionType = fields[4].GetUInt8();
|
||||
gMenuItem.OptionNpcflag = fields[5].GetUInt32();
|
||||
gMenuItem.ActionMenuId = fields[6].GetUInt32();
|
||||
gMenuItem.ActionPoiId = fields[7].GetUInt32();
|
||||
|
||||
@@ -108,9 +108,9 @@ void LoadWeatherData()
|
||||
|
||||
for (uint8 season = 0; season < WEATHER_SEASONS; ++season)
|
||||
{
|
||||
wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt32();
|
||||
wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt32();
|
||||
wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt32();
|
||||
wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt8();
|
||||
wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt8();
|
||||
wzc.data[season].stormChance = fields[season * (MAX_WEATHER_TYPE-1) + 3].GetUInt8();
|
||||
|
||||
if (wzc.data[season].rainChance > 100)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user