Core/DBLayer: Fix remaining errors in loading world tables and a couple of them in characters database

Also removed World::LoadIp2nation(), it was not doing anything.
Closes #5897
This commit is contained in:
Nay
2012-03-28 00:38:04 +01:00
parent 76397cf931
commit f44e6834df
7 changed files with 13 additions and 32 deletions

View File

@@ -0,0 +1,3 @@
ALTER TABLE `spell_dbc` CHANGE `StackAmount` `StackAmount` int(10) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `waypoint_data` CHANGE `action_chance` `action_chance` smallint(6) NOT NULL DEFAULT '100';
ALTER TABLE `item_loot_template` CHANGE `maxcount` `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1';

View File

@@ -283,7 +283,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())
{
@@ -469,7 +469,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();
if (event_id >= mGameEventModelEquip.size())
{
@@ -982,7 +982,7 @@ void GameEventMgr::Initialize()
{
Field* fields = result->Fetch();
uint32 maxEventId = fields[0].GetUInt16();
uint32 maxEventId = fields[0].GetUInt8();
// Id starts with 1 and vector with 0, thus increment
maxEventId++;

View File

@@ -2820,7 +2820,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
uint32 uiEntry = fields[0].GetUInt32();
uint32 uiAccessory = fields[1].GetUInt32();
int8 uiSeat = int8(fields[2].GetInt16());
int8 uiSeat = int8(fields[2].GetInt8());
bool bMinion = fields[3].GetBool();
uint8 uiSummonType = fields[4].GetUInt8();
uint32 uiSummonTimer= fields[5].GetUInt32();
@@ -7154,11 +7154,11 @@ void ObjectMgr::LoadNPCSpellClickSpells()
continue;
}
uint8 userType = fields[3].GetUInt8();
uint8 userType = fields[3].GetUInt16();
if (userType >= SPELL_CLICK_USER_MAX)
sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
uint8 castFlags = fields[2].GetUInt16();
uint8 castFlags = fields[2].GetUInt8();
SpellClickInfo info;
info.spellId = spellid;
info.castFlags = castFlags;
@@ -8240,7 +8240,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
count += LoadReferenceVendor(vendor, -item_id, skip_vendors);
else
{
int32 maxcount = fields[1].GetUInt8(); // tinyint(3) unsigned
int32 maxcount = fields[1].GetUInt8();
uint32 incrtime = fields[2].GetUInt32();
uint32 ExtendedCost = fields[3].GetUInt32();
@@ -8290,7 +8290,7 @@ void ObjectMgr::LoadVendors()
count += LoadReferenceVendor(entry, -item_id, &skip_vendors);
else
{
int32 maxcount = fields[2].GetInt32();
uint32 maxcount = fields[2].GetUInt8();
uint32 incrtime = fields[3].GetUInt32();
uint32 ExtendedCost = fields[4].GetUInt32();

View File

@@ -358,7 +358,7 @@ void InstanceSaveManager::LoadResetTimes()
{
Field* fields = result->Fetch();
uint32 mapid = fields[0].GetUInt16();
Difficulty difficulty = Difficulty(fields[1].GetUInt32());
Difficulty difficulty = Difficulty(fields[1].GetUInt8());
uint64 oldresettime = fields[2].GetUInt32();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);

View File

@@ -79,7 +79,7 @@ void WaypointMgr::Load()
wp->run = fields[6].GetBool();
wp->delay = fields[7].GetUInt32();
wp->event_id = fields[8].GetUInt32();
wp->event_chance = fields[9].GetUInt8();
wp->event_chance = fields[9].GetInt16();
path.push_back(wp);
++count;

View File

@@ -1625,9 +1625,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading Autobroadcasts...");
LoadAutobroadcasts();
sLog->outString("Loading Ip2nation...");
LoadIp2nation();
///- Load and initialize scripts
sObjectMgr->LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
@@ -1884,23 +1881,6 @@ void World::LoadAutobroadcasts()
sLog->outString();
}
void World::LoadIp2nation()
{
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT count(c.code) FROM ip2nationCountries c, ip2nation i WHERE c.code = i.country");
uint32 count = 0;
if (result)
{
Field* fields = result->Fetch();
count = fields[0].GetUInt32();
}
sLog->outString(">> Loaded %u ip2nation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
/// Update the World !
void World::Update(uint32 diff)
{

View File

@@ -741,8 +741,6 @@ class World
void LoadAutobroadcasts();
void LoadIp2nation();
void UpdateAreaDependentAuras();
void ProcessStartEvent();