mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
gm command for reload of eventindex
also i merged both loading functions together (union-select gameobject and creature) those loading functions were pretty similar
This commit is contained in:
parent
2adf6245c2
commit
0ce6395857
7 changed files with 56 additions and 71 deletions
|
|
@ -2099,66 +2099,49 @@ bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
|
|||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::LoadCreatureBattleEventIndexes()
|
||||
void BattleGroundMgr::LoadBattleEventIndexes()
|
||||
{
|
||||
mCreatureBattleEventIndexMap.clear(); // need for reload case
|
||||
QueryResult *result = WorldDatabase.Query( "SELECT guid, event1, event2 FROM creature_battleground" );
|
||||
|
||||
BattleGroundEventIdx events;
|
||||
events.event1 = BG_EVENT_NONE;
|
||||
events.event2 = BG_EVENT_NONE;
|
||||
m_GameObjectBattleEventIndexMap.clear(); // need for reload case
|
||||
m_GameObjectBattleEventIndexMap[-1] = events;
|
||||
m_CreatureBattleEventIndexMap.clear(); // need for reload case
|
||||
m_CreatureBattleEventIndexMap[-1] = events;
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT 1, guid, event1, event2 FROM gameobject_battleground "
|
||||
"UNION "
|
||||
"SELECT 2, guid, event1, event2 FROM creature_battleground");
|
||||
uint32 count = 0;
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded 0 battleground eventindexes for creatures - table is empty!" );
|
||||
return;
|
||||
}
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
do
|
||||
{
|
||||
++count;
|
||||
bar.step();
|
||||
Field *fields = result->Fetch();
|
||||
uint32 dbTableGuidLow = fields[0].GetUInt32();
|
||||
BattleGroundEventIdx events;
|
||||
events.event1 = fields[1].GetUInt8();
|
||||
events.event2 = fields[2].GetUInt8();
|
||||
mCreatureBattleEventIndexMap[dbTableGuidLow] = events;
|
||||
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
||||
continue; // we don't need to add those to the map
|
||||
|
||||
bool gameobject = (fields[0].GetUInt8() == 1);
|
||||
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
||||
events.event1 = fields[2].GetUInt8();
|
||||
events.event2 = fields[3].GetUInt8();
|
||||
|
||||
if (gameobject)
|
||||
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
||||
else
|
||||
m_CreatureBattleEventIndexMap[dbTableGuidLow] = events;
|
||||
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battleground eventindexes for creatures", count );
|
||||
}
|
||||
|
||||
void BattleGroundMgr::LoadGameObjectBattleEventIndexes()
|
||||
{
|
||||
mGameObjectBattleEventIndexMap.clear(); // need for reload case
|
||||
QueryResult *result = WorldDatabase.Query( "SELECT guid, event1, event2 FROM gameobject_battleground" );
|
||||
uint32 count = 0;
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded 0 battleground eventindexes for gameobjects - table is empty!" );
|
||||
sLog.outString( ">> Loaded %u battleground eventindexes", count);
|
||||
if (count == 0)
|
||||
return;
|
||||
}
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
do
|
||||
{
|
||||
++count;
|
||||
bar.step();
|
||||
Field *fields = result->Fetch();
|
||||
uint32 dbTableGuidLow = fields[0].GetUInt32();
|
||||
BattleGroundEventIdx events;
|
||||
events.event1 = fields[1].GetUInt8();
|
||||
events.event2 = fields[2].GetUInt8();
|
||||
mGameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battleground eventindexes for gameobjects", count );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue