Permalink
Browse files

Many fixes made (#29)

* Many fixes made

The server now starts up, but
- Battleground issues exist, including the loading of battlemasters
failing (World.cpp)
- The server freezes after a short while.

* Minor correction made to enum

Minor correction made to enum

Uncommented call to load BattleMasters (World.cpp), so that issues will
show up for anyone who grans the core in its current state.

* BattlemasterList.dbc format string and struct corrected

Corrections made to the BattlemasterList.dbc format string and c++
structure.

* Battleground issue fixed

Incorrect version of type used, making the index reset to 0 when it
reached 255.
uint8 replaced with uint32

The server now starts up properly.

NOT TESTED:
- account creation
- connecting with a client
  • Loading branch information...
Charles A Edwards authored and billy1arm committed Apr 6, 2017
1 parent efe9faa commit c6f236112318ae2c5eeb1204d2f08c6f3280632a
@@ -1131,12 +1131,15 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
/*** BATTLEGROUND MANAGER ***/
/*********************************************************/

BattleGroundMgr::BattleGroundMgr() : m_ArenaTesting(false)
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
{
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
m_BattleGrounds[i].clear();
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
m_Testing = false;
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
{
sLog.outString("Battlegroud # %u ", i);
m_BattleGrounds[i].clear();
}
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
m_Testing = false;
}

BattleGroundMgr::~BattleGroundMgr()
@@ -2081,7 +2084,7 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType
return BATTLEGROUND_QUEUE_NONE;
case BATTLEGROUND_TP:
return BATTLEGROUND_QUEUE_TP;
case BATTLEGROUND_BG:
case BATTLEGROUND_BFG: // Battle for Gilneas
return BATTLEGROUND_QUEUE_BG;
case BATTLEGROUND_AA:
case BATTLEGROUND_NA:
@@ -2124,7 +2127,7 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue
case BATTLEGROUND_QUEUE_TP:
return BATTLEGROUND_TP;
case BATTLEGROUND_QUEUE_BG:
return BATTLEGROUND_BG;
return BATTLEGROUND_BFG; // Battle for Gilneas
case BATTLEGROUND_QUEUE_2v2:
case BATTLEGROUND_QUEUE_3v3:
case BATTLEGROUND_QUEUE_5v5:
@@ -2206,9 +2209,15 @@ uint32 BattleGroundMgr::GetPrematureFinishTime() const

void BattleGroundMgr::LoadBattleMastersEntry()
{
sLog.outError("Entered load battlemasters\n");
sLog.outString("Entered load battlemasters\n");

mBattleMastersMap.clear(); // need for reload case

QueryResult* result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
sLog.outError("querying database\n");

QueryResult* result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
sLog.outError("Finished querying database\n");

uint32 count = 0;

@@ -2224,6 +2233,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()

BarGoLink bar(result->GetRowCount());

sLog.outError("Looping through fields\n");

do
{
++count;
@@ -2241,7 +2252,9 @@ void BattleGroundMgr::LoadBattleMastersEntry()

mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId);
}
while (result->NextRow());
while (result->NextRow());

sLog.outError("Finished looping through fields\n");

delete result;

@@ -2260,7 +2273,7 @@ HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId
case BATTLEGROUND_SA: return HOLIDAY_CALL_TO_ARMS_SA;
case BATTLEGROUND_IC: return HOLIDAY_CALL_TO_ARMS_IC;
case BATTLEGROUND_TP: return HOLIDAY_CALL_TO_ARMS_TP;
case BATTLEGROUND_BG: return HOLIDAY_CALL_TO_ARMS_BG;
case BATTLEGROUND_BFG: return HOLIDAY_CALL_TO_ARMS_BG; // Battle for Gilneas
default: return HOLIDAY_NONE;
}
}
@@ -2276,7 +2289,7 @@ BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
case HOLIDAY_CALL_TO_ARMS_SA: return BATTLEGROUND_SA;
case HOLIDAY_CALL_TO_ARMS_IC: return BATTLEGROUND_IC;
case HOLIDAY_CALL_TO_ARMS_TP: return BATTLEGROUND_TP;
case HOLIDAY_CALL_TO_ARMS_BG: return BATTLEGROUND_BG;
case HOLIDAY_CALL_TO_ARMS_BG: return BATTLEGROUND_BFG; // Battle for Gilneas
default: return BATTLEGROUND_TYPE_NONE;
}
}
@@ -2288,6 +2301,8 @@ bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)

void BattleGroundMgr::LoadBattleEventIndexes()
{
sLog.outError("Entering load Battlegrounds");

BattleGroundEventIdx events;
events.event1 = BG_EVENT_NONE;
events.event2 = BG_EVENT_NONE;
@@ -2298,6 +2313,8 @@ void BattleGroundMgr::LoadBattleEventIndexes()

uint32 count = 0;

sLog.outError("Querying database");

QueryResult* result =
// 0 1 2 3 4 5 6
WorldDatabase.Query("SELECT data.typ, data.guid1, data.ev1 AS ev1, data.ev2 AS ev2, data.map AS m, data.guid2, description.map, "
@@ -2329,7 +2346,10 @@ void BattleGroundMgr::LoadBattleEventIndexes()
") data "
"LEFT OUTER JOIN battleground_events AS description ON data.map = description.map "
"AND data.ev1 = description.event1 AND data.ev2 = description.event2 "
"ORDER BY m, ev1, ev2");
"ORDER BY m, ev1, ev2");

sLog.outError("Finished querying database");

if (!result)
{
BarGoLink bar(1);
@@ -2342,6 +2362,8 @@ void BattleGroundMgr::LoadBattleEventIndexes()

BarGoLink bar(result->GetRowCount());

sLog.outError("Loop through fields loaded from database");

do
{
bar.step();
@@ -2393,9 +2415,14 @@ void BattleGroundMgr::LoadBattleEventIndexes()

++count;
}
while (result->NextRow());
while (result->NextRow());

sLog.outError("Finished looping through fields loaded from database");

sLog.outString();
sLog.outString(">> Loaded %u battleground eventindexes", count);
delete result;


sLog.outError("Leaving load Battlegrounds");
}
@@ -290,7 +290,8 @@ class BattleGroundMgr
std::vector<uint64> m_QueueUpdateScheduler;
typedef std::set<uint32> ClientBattleGroundIdSet;
ClientBattleGroundIdSet m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; // the instanceids just visible for the client
uint32 m_NextRatingDiscardUpdate;
uint32 m_NextRatingDiscardUpdate;
uint32 m_AutoDistributionTimeChecker;
bool m_ArenaTesting;
bool m_Testing;
};
@@ -349,7 +349,7 @@ template<class T>
inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
// MANGOS_ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
MANGOS_ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));

std::string dbc_filename = dbc_path + filename;
if(storage.Load(dbc_filename.c_str(),localeData.defaultLocale))
@@ -477,7 +477,7 @@ void LoadDBCStores(const std::string& dataPath)
continue;

MANGOS_ASSERT(entry->classId < MAX_CLASSES && "MAX_CLASSES not updated");
// MANGOS_ASSERT(entry->power < MAX_POWERS && "MAX_POWERS not updated");
// MANGOS_ASSERT(entry->power < MAX_POWERS && "MAX_POWERS not updated");

uint32 index = 0;

@@ -487,7 +487,7 @@ void LoadDBCStores(const std::string& dataPath)
++index;
}

// MANGOS_ASSERT(index < MAX_STORED_POWERS && "MAX_STORED_POWERS not updated");
// MANGOS_ASSERT(index < MAX_STORED_POWERS && "MAX_STORED_POWERS not updated");

sChrClassXPowerTypesStore[entry->classId][entry->power] = index;
sChrClassXPowerIndexStore[entry->classId][index] = entry->power;
@@ -618,6 +618,7 @@ void LoadDBCStores(const std::string& dataPath)
}
}

/*
for(uint32 i = 1; i < sSpellEffectStore.GetNumRows(); ++i)
{
if (SpellEffectEntry const *spellEffect = sSpellEffectStore.LookupEntry(i))
@@ -629,14 +630,15 @@ void LoadDBCStores(const std::string& dataPath)
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_POWER_BURN_MANA:
// MANGOS_ASSERT(spellEffect->EffectMiscValue >= 0 && spellEffect->EffectMiscValue < MAX_POWERS);
MANGOS_ASSERT(spellEffect->EffectMiscValue >= 0 && spellEffect->EffectMiscValue < MAX_POWERS);
break;
}
if (spellEffect->EffectSpellId < MAX_EFFECT_INDEX && spellEffect->Difficulty == 0)
sSpellEffectMap[spellEffect->EffectSpellId].effects[spellEffect->EffectIndex] = spellEffect;
}
}
*/

LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellEquippedItemsStore, dbcPath,"SpellEquippedItems.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellInterruptsStore, dbcPath,"SpellInterrupts.dbc");
@@ -990,8 +992,8 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapId, uint32 zoneId)
if (!mapEntry)
return CONTENT_1_60;

if (mapEntry->rootPhaseMap != -1)
mapId = mapEntry->rootPhaseMap;
// if (mapEntry->rootPhaseMap != -1)
// mapId = mapEntry->rootPhaseMap;

switch (mapId)
{
@@ -619,6 +619,26 @@ struct BarberShopStyleEntry
uint32 hair_id; // 7 m_data (real ID to hair/facial hair)
};

struct BattlemasterListEntry
{
uint32 id; // 0
int32 mapid[16]; // 1-16 mapid
uint32 type; // 17 (3 - BG, 4 - arena)
//char* unkName; // 18
DBCString name; // 19
uint32 maxGroupSize; // 20 maxGroupSize, used for checking if queue as group
uint32 HolidayWorldStateId; // 21 new 3.1
uint32 minLevel; // 22, min level (sync with PvPDifficulty.dbc content)
uint32 maxLevel; // 23, max level (sync with PvPDifficulty.dbc content)
//uint32 maxGroupSizeRated; // 24 4.0.1
//uint32 unk; // 25 - 4.0.6.13596
//uint32 maxPlayers; // 26 4.0.1
//uint32 unk1; // 27 4.0.3, value 2 for Rated Battlegrounds
//uint32 unk2 // 28 - Pandaria
//char* strType; // 29 - Pandaria
};

/* Old version
struct BattlemasterListEntry
{
uint32 id; // 0 m_ID
@@ -637,6 +657,7 @@ struct BattlemasterListEntry
//uint32 // 28 5.4.1
//uint32 // 29 5.4.1
};
*/

/*struct Cfg_CategoriesEntry
{
@@ -1377,7 +1398,7 @@ struct MapEntry
uint32 addon; // 16 m_expansionID
uint32 unkTime; // 17 m_raidOffset
uint32 maxPlayers; // 18 m_maxPlayers
int32 rootPhaseMap; // 19 map with base phasing
// int32 rootPhaseMap; // 19 map with base phasing

// Helpers
uint32 Expansion() const { return addon; }
@@ -1989,6 +2010,37 @@ struct SpellTotemsEntry

// SpellMisc.dbc
struct SpellMiscEntry
{
uint32 Id; // 0 m_ID
//uint32 SpellId // 1
//uint32 Unk // 2
uint32 Attributes; // 3 m_attribute
uint32 AttributesEx; // 4 m_attributesEx
uint32 AttributesEx2; // 5 m_attributesExB
uint32 AttributesEx3; // 6 m_attributesExC
uint32 AttributesEx4; // 7 m_attributesExD
uint32 AttributesEx5; // 8 m_attributesExE
uint32 AttributesEx6; // 9 m_attributesExF
uint32 AttributesEx7; // 10 m_attributesExG
uint32 AttributesEx8; // 11 m_attributesExH
uint32 AttributesEx9; // 12 m_attributesExI
uint32 AttributesEx10; // 13 m_attributesExJ
uint32 AttributesEx11; // 14 m_attributesExK
uint32 AttributesEx12; // 15 m_attributesExL
uint32 AttributesEx13; // 16 m_attributesExM
uint32 CastingTimeIndex; // 17 m_castingTimeIndex
uint32 DurationIndex; // 18 m_durationIndex
uint32 rangeIndex; // 19 m_rangeIndex
float speed; // 20 m_speed
uint32 SpellVisual[2]; // 21-22 m_spellVisualID
uint32 SpellIconID; // 23 m_spellIconID
uint32 activeIconID; // 24 m_activeIconID
uint32 SchoolMask; // 25 m_schoolMask
};

// SpellMisc.dbc
/*
struct SpellMiscEntry
{
//uint32 Id; // 0
//uint32 SpellId; // 1
@@ -2015,6 +2067,7 @@ struct SpellMiscEntry
uint32 activeIconID; // 23 m_activeIconID
uint32 SchoolMask; // 24 m_schoolMask
};
*/

struct SpellReagentsEntry;

@@ -34,7 +34,8 @@ const char ArmorLocationfmt[]="nfffff"; // 5.3.0 Checked
const char AuctionHouseEntryfmt[]= "niiix"; // 5.3.0 Checked
const char BankBagSlotPricesEntryfmt[] = "ni"; //5.3.0 Checked
const char BarberShopStyleEntryfmt[]= "nixxxiii"; // TODO: 5.3.0 DIFFERENT
const char BattlemasterListEntryfmt[]="niiiiiiiiiiiiiiiiixsiiiiiiiixx"; // 16357
const char BattlemasterListEntryfmt[] = "niiiiiiiiiiiiiiiiixsiiiixxxxxx";
//const char BattlemasterListEntryfmt[] = "niiiiiiiiiiiiiiiiixsiiiiiiiixx"; // 16357
const char CharStartOutfitEntryfmt[]= "diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // TODO: 5.3.0 DIFFERENT
const char CharTitlesEntryfmt[]="nxsxix"; // 5.3.0 Checked
const char ChatChannelsEntryfmt[]="iixsx"; // 5.3.0 Checked
@@ -90,11 +91,10 @@ const char ItemRandomPropertiesfmt[]="nxiiiiis"; // 5.3.0 Checked
const char ItemRandomSuffixfmt[]="nsxiiiiiiiiii"; // 5.3.0 Checked
const char ItemReforgefmt[]="nifif";
const char ItemSetEntryfmt[]="dsxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; // 5.3.0 Checked
const char LfgDungeonsEntryfmt[] = "nsiiiiiiiiixxixixixxxxxxxxxxx";
const char LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // 5.3.0 Checked
const char LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; // 5.3.0 Checked
const char MailTemplateEntryfmt[]="nxs"; // 5.3.0 Checked
const char MapEntryfmt[]="nsiiisissififfiiiii"; // 16357
const char MapEntryfmt[] = "nsiiiisissififfiiii";
const char MapDifficultyEntryfmt[]="niisiis"; // 5.3.0 Checked
const char MountCapabilityfmt[]="niiiiiii";
const char MountTypefmt[]="niiiiiiiiiiiiiiiiiiiiiiii";
@@ -105,7 +105,6 @@ const char QuestFactionRewardfmt[] = "niiiiiiiiii";
const char QuestSortEntryfmt[]="nx"; // 5.3.0 Checked
const char QuestXPLevelfmt[] = "niiiiiiiiii"; // 5.3.0 Checked
const char Phasefmt[]="nii"; // 5.3.0 Checked
const char PowerDisplayfmt[]="iiiiii";
const char PvPDifficultyfmt[] = "diiiii";
const char RandomPropertiesPointsfmt[] = "niiiiiiiiiiiiiii"; // 5.3.0 Checked
const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiixi"; // 5.3.0 Checked
@@ -136,7 +135,8 @@ const char SpellTotemsEntryfmt[]="diiii"; // 5.3.0 Checked
const char SpellFocusObjectfmt[]="nx";
const char SpellItemEnchantmentfmt[]="nxiiiiiiiiisiiiixxixxxxxxx"; // 17538
const char SpellItemEnchantmentConditionfmt[] = "nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; // 5.3.0 Checked
const char SpellMiscfmt[]="dxxiiiiiiiiiiiiiiiiifiiiii"; // 17538
//char const SpellMiscfmt[] = "nxxiiiiiiiiiiiiiiiiifiiiii";
const char SpellMiscfmt[] = "nxxiiiiiiiiiiiiiiiiifiiiii"; // 17538
const char SpellRadiusfmt[]="nfxxx"; // 16357
const char SpellRangefmt[]="nffffxxx"; // 5.3.0 Checked
const char SpellRuneCostfmt[]="niiixi"; // 16357
@@ -622,9 +622,9 @@ bool GridMap::ExistMap(uint32 mapid, int gx, int gy)

GridMapFileHeader header;
fread(&header, sizeof(header), 1, pf);
if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) ||
if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) )/*||
header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)) ||
!IsAcceptableClientBuild(header.buildMagic))
!IsAcceptableClientBuild(header.buildMagic))*/
{
sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.", tmp);
delete[] tmp;
@@ -639,6 +639,7 @@ bool GridMap::ExistMap(uint32 mapid, int gx, int gy)

bool GridMap::ExistVMap(uint32 mapid, int gx, int gy)
{
/*
if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
{
if (vmgr->isMapLoadingEnabled())
@@ -653,6 +654,7 @@ bool GridMap::ExistVMap(uint32 mapid, int gx, int gy)
}
}
}
*/

return true;
}
Oops, something went wrong.

0 comments on commit c6f2361

Please sign in to comment.