# Conflicts:
#	src/server/game/Spells/SpellMgr.cpp
This commit is contained in:
Ovahlord committed 2018-03-06 13:03:29 +01:00
commit f6d3b214c2
44 files changed
+711 -425

No files matched your search

+1 -1
View File
@@ -288,7 +288,7 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
case LOCATION_DOWNLOAD:
{
std::string const filename = base.filename().generic_string();
std::string const workdir = boost::filesystem::current_path().generic_string().c_str();
std::string const workdir = boost::filesystem::current_path().generic_string();
TC_LOG_ERROR("sql.updates", ">> File \"%s\" is missing, download it from \"https://t.me/trinitycorelegacy\"" \
" Mirror: \"https://github.com/TrinityCoreLegacy/TrinityCore/releases\"" \
" uncompress it and place the file \"%s\" in the directory \"%s\".", filename.c_str(), filename.c_str(), workdir.c_str());
@@ -73,10 +73,7 @@ bool TargetedMovementGenerator<T, D>::DoUpdate(T* owner, uint32 diff)
transport->CalculatePassengerPosition(destination.x, destination.y, destination.z);
// First check distance
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->CanFly())
targetMoved = !GetTarget()->IsInDist(destination.x, destination.y, destination.z, distance);
else
targetMoved = !GetTarget()->IsInDist2d(destination.x, destination.y, distance);
targetMoved = !GetTarget()->IsInDist(destination.x, destination.y, destination.z, distance);
// then, if the target is in range, check also Line of Sight.
if (!targetMoved)
+2 -2
View File
@@ -43,8 +43,8 @@ PathGenerator::PathGenerator(const Unit* owner) :
if (DisableMgr::IsPathfindingEnabled(mapId))
{
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
_navMesh = mmap->GetNavMesh(mapId, _sourceUnit->GetTerrainSwaps());
_navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId(), _sourceUnit->GetTerrainSwaps());
_navMesh = mmap->GetNavMesh(mapId);
_navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId());
}
CreateFilter();
@@ -3903,13 +3903,14 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
target->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float(GetAmount()), apply);
}
void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
{
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
return;
Unit* target = aurApp->GetTarget();
// handle stack rules
if (target->GetTypeId() == TYPEID_PLAYER)
{
target->ToPlayer()->UpdateMeleeHitChances();
@@ -3917,8 +3918,9 @@ void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, b
}
else
{
target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
float value = target->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
target->m_modMeleeHitChance = value;
target->m_modRangedHitChance = value;
}
}
+16 -1
View File
@@ -976,8 +976,20 @@ bool Aura::CanBeSaved() const
// Check if aura is single target, not only spell info
if (GetCasterGUID() != GetOwner()->GetGUID())
if (GetSpellInfo()->IsSingleTarget() || IsSingleTarget())
{
// owner == caster for area auras, check for possible bad data in DB
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!GetSpellInfo()->Effects[i].IsEffect())
continue;
if (GetSpellInfo()->Effects[i].IsTargetingArea() || GetSpellInfo()->Effects[i].IsAreaAuraEffect())
return false;
}
if (IsSingleTarget() || GetSpellInfo()->IsSingleTarget())
return false;
}
// Can't be saved - aura handler relies on calculated amount and changes it
if (HasEffectType(SPELL_AURA_CONVERT_RUNE))
@@ -2326,6 +2338,9 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca
units.push_back(GetUnitOwner());
else
{
ASSERT(caster, "Area aura (Id: %u) has nullptr caster (%s)", m_spellInfo->Id, GetCasterGUID().ToString().c_str());
ASSERT(GetCasterGUID() == GetUnitOwner()->GetGUID(), "Area aura (Id: %u) has owner (%s) different to caster (%s)", m_spellInfo->Id, GetUnitOwner()->GetGUID().ToString().c_str(), GetCasterGUID().ToString().c_str());
// skip area update if owner is not in world!
if (!GetUnitOwner()->IsInWorld())
continue;
+17 -3
View File
@@ -1818,6 +1818,7 @@ void SpellMgr::LoadSpellProcs()
bool addTriggerFlag = false;
uint32 procSpellTypeMask = PROC_SPELL_TYPE_NONE;
uint32 nonProcMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!spellInfo->Effects[i].IsEffect())
@@ -1828,7 +1829,11 @@ void SpellMgr::LoadSpellProcs()
continue;
if (!isTriggerAura[auraName])
{
// explicitly disable non proccing auras to avoid losing charges on self proc
nonProcMask |= 1 << i;
continue;
}
procSpellTypeMask |= spellTypeMask[auraName];
if (isAlwaysTriggeredAura[auraName])
@@ -1848,7 +1853,6 @@ void SpellMgr::LoadSpellProcs()
break;
}
}
break;
}
if (!procSpellTypeMask)
@@ -1911,6 +1915,8 @@ void SpellMgr::LoadSpellProcs()
procEntry.AttributesMask |= PROC_ATTR_REQ_EXP_OR_HONOR;
if (addTriggerFlag)
procEntry.AttributesMask |= PROC_ATTR_TRIGGERED_CAN_PROC;
if (nonProcMask)
procEntry.AttributesMask |= nonProcMask * PROC_ATTR_DISABLE_EFF_0;
procEntry.ProcsPerMinute = 0;
procEntry.Chance = spellInfo->ProcChance;
@@ -4461,11 +4467,16 @@ void SpellMgr::LoadSpellInfoCorrections()
if (spellInfo->IsPassive() && GetTalentSpellCost(i))
if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
if (spellInfo->Effects[j].TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE || spellInfo->Effects[j].TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE)
if (G3D::fuzzyEq(spellInfo->ConeAngle, 0.f))
spellInfo->ConeAngle = 90.f;
}
// Area auras may not target area (they're self cast)
if (spellInfo->Effects[j].IsAreaAuraEffect() && spellInfo->Effects[j].IsTargetingArea())
{
spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
spellInfo->Effects[j].TargetB = SpellImplicitTargetInfo(0);
}
}
// disable proc for magnet auras, they're handled differently
if (spellInfo->HasAura(SPELL_AURA_SPELL_MAGNET))
@@ -4500,6 +4511,9 @@ void SpellMgr::LoadSpellInfoCorrections()
if (SummonPropertiesEntry* properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(628))) // Hungry Plaguehound
properties->Category = SUMMON_CATEGORY_PET;
if (LockEntry* entry = const_cast<LockEntry*>(sLockStore.LookupEntry(36))) // 3366 Opening, allows to open without proper key
entry->Type[2] = LOCK_KEY_NONE;
TC_LOG_INFO("server.loading", ">> Loaded SpellInfo corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
+4 -8
View File
@@ -1513,19 +1513,15 @@ void World::SetInitialWorldSettings()
// Load M2 fly by cameras
LoadM2Cameras(m_dataPath);
std::unordered_map<uint32, std::vector<uint32>> mapData;
std::vector<uint32> mapIds;
for (MapEntry const* mapEntry : sMapStore)
{
mapData.insert(std::unordered_map<uint32, std::vector<uint32>>::value_type(mapEntry->MapID, std::vector<uint32>()));
if (mapEntry->rootPhaseMap != -1)
mapData[mapEntry->rootPhaseMap].push_back(mapEntry->MapID);
}
mapIds.push_back(mapEntry->MapID);
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
vmmgr2->InitializeThreadUnsafe(mapData);
vmmgr2->InitializeThreadUnsafe(mapIds);
MMAP::MMapManager* mmmgr = MMAP::MMapFactory::createOrGetMMapManager();
mmmgr->InitializeThreadUnsafe(mapData);
mmmgr->InitializeThreadUnsafe(mapIds);
TC_LOG_INFO("server.loading", "Initializing PlayerDump tables...");
PlayerDump::InitializeTables();
+1 -1
View File
@@ -248,7 +248,7 @@ public:
uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps())) ? 1 : 0;
uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
if (haveVMap)
{
+6 -6
View File
@@ -62,7 +62,7 @@ public:
static bool HandleMmapPathCommand(ChatHandler* handler, char const* args)
{
if (!MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps()))
if (!MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
return true;
@@ -134,8 +134,8 @@ public:
handler->PSendSysMessage("gridloc [%i, %i]", gy, gx);
// calculate navmesh tile location
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps());
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(handler->GetSession()->GetPlayer()->GetMapId(), player->GetInstanceId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps());
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId());
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(handler->GetSession()->GetPlayer()->GetMapId(), player->GetInstanceId());
if (!navmesh || !navmeshquery)
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
@@ -186,8 +186,8 @@ public:
static bool HandleMmapLoadedTilesCommand(ChatHandler* handler, char const* /*args*/)
{
uint32 mapid = handler->GetSession()->GetPlayer()->GetMapId();
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(mapid, handler->GetSession()->GetPlayer()->GetTerrainSwaps());
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(mapid, handler->GetSession()->GetPlayer()->GetInstanceId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps());
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(mapid);
dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(mapid, handler->GetSession()->GetPlayer()->GetInstanceId());
if (!navmesh || !navmeshquery)
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
@@ -217,7 +217,7 @@ public:
MMAP::MMapManager* manager = MMAP::MMapFactory::createOrGetMMapManager();
handler->PSendSysMessage(" %u maps loaded with %u tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());
dtNavMesh const* navmesh = manager->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId(), handler->GetSession()->GetPlayer()->GetTerrainSwaps());
dtNavMesh const* navmesh = manager->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId());
if (!navmesh)
{
handler->PSendSysMessage("NavMesh not loaded for current map.");