mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[9861] Backporting some code chnages from 400 branch.
(based on 400's commit 0f37423) (based on 400's commit 636cfef) (based on 400's commit 0bbe3a7) (based on 400's commit ce86b56) (based on 400's commit b74c6a8)
This commit is contained in:
parent
a0d9ffcc5f
commit
ff2cda6af1
18 changed files with 68 additions and 43 deletions
|
|
@ -1553,7 +1553,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
|||
}
|
||||
|
||||
// used to create the BG templates
|
||||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
|
||||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
|
||||
{
|
||||
// Create the BG
|
||||
BattleGround *bg = NULL;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class BattleGroundMgr
|
|||
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
|
||||
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
|
||||
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||
|
||||
void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; };
|
||||
void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); }
|
||||
|
|
|
|||
|
|
@ -407,5 +407,6 @@ enum SpellEffectIndex
|
|||
};
|
||||
|
||||
#define MAX_EFFECT_INDEX 3
|
||||
#define MAX_REAGENTS 8
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -199,18 +199,23 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale
|
|||
return false;
|
||||
}
|
||||
|
||||
static uint32 ReadDBCBuild(const std::string& dbc_path, char const* localeName = NULL)
|
||||
static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const* localeNameStr = NULL)
|
||||
{
|
||||
std::string text;
|
||||
|
||||
if (!localeName)
|
||||
if (!localeNameStr)
|
||||
{
|
||||
for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr)
|
||||
{
|
||||
for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr)
|
||||
if (ReadDBCBuildFileText(dbc_path,itr->name,text))
|
||||
{
|
||||
localeNameStr = itr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ReadDBCBuildFileText(dbc_path,localeName,text);
|
||||
ReadDBCBuildFileText(dbc_path,localeNameStr->name,text);
|
||||
|
||||
if (text.empty())
|
||||
return 0;
|
||||
|
|
@ -240,7 +245,9 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& f
|
|||
|
||||
struct LocalData
|
||||
{
|
||||
explicit LocalData(uint32 build) : main_build(build), availableDbcLocales(0xFFFFFFFF),checkedDbcLocaleBuilds(0) {}
|
||||
LocalData(uint32 build)
|
||||
: main_build(build), availableDbcLocales(0xFFFFFFFF),checkedDbcLocaleBuilds(0) {}
|
||||
|
||||
uint32 main_build;
|
||||
|
||||
// bitmasks for index of fullLocaleNameList
|
||||
|
|
@ -263,13 +270,16 @@ inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errl
|
|||
if (!(localeData.availableDbcLocales & (1 << i)))
|
||||
continue;
|
||||
|
||||
std::string dbc_dir_loc = dbc_path + fullLocaleNameList[i].name + "/";
|
||||
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
||||
|
||||
std::string dbc_dir_loc = dbc_path + localStr->name + "/";
|
||||
|
||||
if (!(localeData.checkedDbcLocaleBuilds & (1 << i)))
|
||||
{
|
||||
localeData.checkedDbcLocaleBuilds |= (1<<i);// mark as checked for speedup next checks
|
||||
|
||||
uint32 build_loc = ReadDBCBuild(dbc_dir_loc,fullLocaleNameList[i].name);
|
||||
|
||||
uint32 build_loc = ReadDBCBuild(dbc_dir_loc,localStr);
|
||||
if(localeData.main_build != build_loc)
|
||||
{
|
||||
localeData.availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
|
||||
|
|
@ -277,9 +287,9 @@ inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errl
|
|||
// exist but wrong build
|
||||
if (build_loc)
|
||||
{
|
||||
std::string dbc_filename_loc = dbc_path + fullLocaleNameList[i].name + "/" + filename;
|
||||
std::string dbc_filename_loc = dbc_path + localStr->name + "/" + filename;
|
||||
char buf[200];
|
||||
snprintf(buf,200," (exist, but DBC locale subdir %s have DBCs for build %u instead expected build %u, it and other DBC from subdir skipped)",fullLocaleNameList[i].name,build_loc,localeData.main_build);
|
||||
snprintf(buf,200," (exist, but DBC locale subdir %s have DBCs for build %u instead expected build %u, it and other DBC from subdir skipped)",localStr->name,build_loc,localeData.main_build);
|
||||
errlist.push_back(dbc_filename_loc + buf);
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +297,7 @@ inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errl
|
|||
}
|
||||
}
|
||||
|
||||
std::string dbc_filename_loc = dbc_path + fullLocaleNameList[i].name + "/" + filename;
|
||||
std::string dbc_filename_loc = dbc_path + localStr->name + "/" + filename;
|
||||
if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
|
||||
localeData.availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
|
||||
}
|
||||
|
|
@ -647,7 +657,7 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction)
|
|||
return &itr->second;
|
||||
}
|
||||
|
||||
char* GetPetName(uint32 petfamily, uint32 dbclang)
|
||||
char const* GetPetName(uint32 petfamily, uint32 dbclang)
|
||||
{
|
||||
if(!petfamily)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ std::string AcceptableClientBuildsListStr();
|
|||
typedef std::list<uint32> SimpleFactionsList;
|
||||
|
||||
SimpleFactionsList const* GetFactionTeamList(uint32 faction);
|
||||
char* GetPetName(uint32 petfamily, uint32 dbclang);
|
||||
char const* GetPetName(uint32 petfamily, uint32 dbclang);
|
||||
uint32 GetTalentSpellCost(uint32 spellId);
|
||||
uint32 GetTalentSpellCost(TalentSpellPos const* pos);
|
||||
TalentSpellPos const* GetTalentSpellPos(uint32 spellId);
|
||||
|
|
|
|||
|
|
@ -1411,8 +1411,8 @@ struct SpellEntry
|
|||
//uint32 modalNextSpell; // 48 m_modalNextSpell not used
|
||||
uint32 StackAmount; // 49 m_cumulativeAura
|
||||
uint32 Totem[2]; // 50-51 m_totem
|
||||
int32 Reagent[8]; // 52-59 m_reagent
|
||||
uint32 ReagentCount[8]; // 60-67 m_reagentCount
|
||||
int32 Reagent[MAX_REAGENTS]; // 52-59 m_reagent
|
||||
uint32 ReagentCount[MAX_REAGENTS]; // 60-67 m_reagentCount
|
||||
int32 EquippedItemClass; // 68 m_equippedItemClass (value)
|
||||
int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask)
|
||||
int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask)
|
||||
|
|
|
|||
|
|
@ -6196,7 +6196,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry)
|
|||
if(list0.empty() || list1.empty())
|
||||
{
|
||||
CreatureInfo const *cinfo = GetCreatureTemplate(entry);
|
||||
char* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale());
|
||||
char const* petname = GetPetName(cinfo->family, sWorld.GetDefaultDbcLocale());
|
||||
if(!petname)
|
||||
petname = cinfo->Name;
|
||||
return std::string(petname);
|
||||
|
|
|
|||
|
|
@ -1320,7 +1320,7 @@ enum Opcodes
|
|||
UMSG_UNKNOWN_1283 = 0x503, // not found
|
||||
UMSG_UNKNOWN_1284 = 0x504, // not found
|
||||
UMSG_UNKNOWN_1285 = 0x505, // not found
|
||||
SMSG_UNKNOWN_1286 = 0x506, // ERR_CORPSE_IS_NOT_IN_INSTANCE = 0x1A8,
|
||||
SMSG_CORPSE_IS_NOT_IN_INSTANCE = 0x506, // ERR_CORPSE_IS_NOT_IN_INSTANCE = 0x1A8,
|
||||
UMSG_UNKNOWN_1287 = 0x507, // not found
|
||||
CMSG_SET_ALLOW_LOW_LEVEL_RAID1 = 0x508, // lua: SetAllowLowLevelRaid
|
||||
CMSG_SET_ALLOW_LOW_LEVEL_RAID2 = 0x509, // lua: SetAllowLowLevelRaid
|
||||
|
|
|
|||
|
|
@ -2622,7 +2622,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
SetUInt32Value(index, 0);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS,0);
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, 0);
|
||||
|
|
@ -2654,7 +2654,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
SetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE,0.0f);
|
||||
|
||||
// Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
|
||||
for (uint8 i = 0; i < 7; ++i)
|
||||
for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1+i, 0.0f);
|
||||
|
||||
SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f);
|
||||
|
|
@ -2691,7 +2691,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
|
||||
// save new stats
|
||||
for (int i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
SetMaxPower(Powers(i), uint32(GetCreatePowers(Powers(i))));
|
||||
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));
|
||||
|
||||
SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later
|
||||
|
||||
|
|
@ -14922,7 +14922,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32());
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8());
|
||||
|
||||
|
||||
InitDisplayIds();
|
||||
|
||||
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
|
||||
|
|
@ -15216,7 +15215,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetUInt32Value(PLAYER_TRACK_CREATURES, 0 );
|
||||
SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 );
|
||||
|
||||
// cleanup aura list explicitly before skill load wher some spells can be applied
|
||||
// cleanup aura list explicitly before skill load where some spells can be applied
|
||||
RemoveAllAuras();
|
||||
|
||||
// make sure the unit is considered out of combat for proper loading
|
||||
|
|
@ -17436,7 +17435,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
|
|||
|
||||
if(spellInfo)
|
||||
{
|
||||
for(uint32 i = 0; i < 7; ++i)
|
||||
for(uint32 i = 0; i < MAX_REAGENTS; ++i)
|
||||
{
|
||||
if(spellInfo->Reagent[i] > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3958,7 +3958,7 @@ void Spell::TakeReagents()
|
|||
if (p_caster->CanNoReagentCast(m_spellInfo) )
|
||||
return;
|
||||
|
||||
for(uint32 x = 0; x < 8; ++x)
|
||||
for(uint32 x = 0; x < MAX_REAGENTS; ++x)
|
||||
{
|
||||
if(m_spellInfo->Reagent[x] <= 0)
|
||||
continue;
|
||||
|
|
@ -5643,7 +5643,7 @@ SpellCastResult Spell::CheckItems()
|
|||
{
|
||||
if (!p_caster->CanNoReagentCast(m_spellInfo))
|
||||
{
|
||||
for(uint32 i = 0; i < 8; ++i)
|
||||
for(uint32 i = 0; i < MAX_REAGENTS; ++i)
|
||||
{
|
||||
if(m_spellInfo->Reagent[i] <= 0)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -2709,7 +2709,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
|
|||
|
||||
if(need_check_reagents)
|
||||
{
|
||||
for(int j = 0; j < 8; ++j)
|
||||
for(int j = 0; j < MAX_REAGENTS; ++j)
|
||||
{
|
||||
if(spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype( spellInfo->Reagent[j] ))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12160,6 +12160,7 @@ uint32 Unit::GetCreatePowers( Powers power ) const
|
|||
// POWER_FOCUS and POWER_HAPPINESS only have hunter pet
|
||||
switch(power)
|
||||
{
|
||||
case POWER_HEALTH: return 0;
|
||||
case POWER_MANA: return GetCreateMana();
|
||||
case POWER_RAGE: return 1000;
|
||||
case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
|
||||
|
|
@ -12167,7 +12168,6 @@ uint32 Unit::GetCreatePowers( Powers power ) const
|
|||
case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->isPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
|
||||
case POWER_RUNIC_POWER: return 1000;
|
||||
case POWER_RUNE: return 0;
|
||||
case POWER_HEALTH: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -577,10 +577,11 @@ enum UnitFlags
|
|||
enum UnitFlags2
|
||||
{
|
||||
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
|
||||
UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
|
||||
UNIT_FLAG2_UNK1 = 0x00000002, // Hides unit model (show only player equip)
|
||||
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
|
||||
UNIT_FLAG2_FORCE_MOVE = 0x00000040,
|
||||
UNIT_FLAG2_REGENERATE_POWER = 0x00000800
|
||||
UNIT_FLAG2_DISARM = 0x00000400, // disarm or something
|
||||
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
|
||||
};
|
||||
|
||||
/// Non Player Character flags
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ char const* localeNames[MAX_LOCALE] = {
|
|||
};
|
||||
|
||||
// used for search by name or iterate all names
|
||||
LocaleNameStr fullLocaleNameList[] =
|
||||
LocaleNameStr const fullLocaleNameList[] =
|
||||
{
|
||||
{ "enUS", LOCALE_enUS },
|
||||
{ "enGB", LOCALE_enUS },
|
||||
|
|
@ -48,7 +48,7 @@ LocaleNameStr fullLocaleNameList[] =
|
|||
|
||||
LocaleConstant GetLocaleByName(const std::string& name)
|
||||
{
|
||||
for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr)
|
||||
for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr)
|
||||
if (name==itr->name)
|
||||
return itr->locale;
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ struct LocaleNameStr
|
|||
};
|
||||
|
||||
// used for iterate all names including alternative
|
||||
extern LocaleNameStr fullLocaleNameList[];
|
||||
extern LocaleNameStr const fullLocaleNameList[];
|
||||
|
||||
//operator new[] based version of strdup() function! Release memory by using operator delete[] !
|
||||
inline char * mangos_strdup(const char * source)
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
|
|||
offset+=1;
|
||||
break;
|
||||
case FT_STRING:
|
||||
{
|
||||
// fill only not filled entries
|
||||
char** slot = (char**)(&dataTable[offset]);
|
||||
if(!*slot || !**slot)
|
||||
|
|
@ -252,6 +253,13 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
|
|||
offset+=sizeof(char*);
|
||||
break;
|
||||
}
|
||||
case FT_NA:
|
||||
case FT_NA_BYTE:
|
||||
case FT_SORT:
|
||||
break;
|
||||
default:
|
||||
assert(false && "unknown format character");
|
||||
}
|
||||
}
|
||||
|
||||
return stringPool;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ class DBCStorage
|
|||
return false;
|
||||
|
||||
fieldCount = dbc.GetCols();
|
||||
|
||||
// load raw non-string data
|
||||
m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable);
|
||||
|
||||
// load strings from dbc data
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
// error in dbc file at loading if NULL
|
||||
|
|
@ -60,6 +64,7 @@ class DBCStorage
|
|||
if(!dbc.Load(fn, fmt))
|
||||
return false;
|
||||
|
||||
// load strings from another locale dbc data
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
return true;
|
||||
|
|
@ -93,4 +98,5 @@ class DBCStorage
|
|||
T* m_dataTable;
|
||||
StringPoolList m_stringPoolList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9860"
|
||||
#define REVISION_NR "9861"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue