Skip to content

Commit

Permalink
Merge pull request liyunfan1223#21 from liyunfan1223/revert_spell_crash
Browse files Browse the repository at this point in the history
Revert "Merge branch 'master' into Playerbot"
  • Loading branch information
liyunfan1223 authored Sep 13, 2024
2 parents 7e8c2d2 + 2358b25 commit af77652
Show file tree
Hide file tree
Showing 32 changed files with 489 additions and 529 deletions.
3 changes: 0 additions & 3 deletions data/sql/updates/db_world/2024_09_09_00.sql

This file was deleted.

6 changes: 0 additions & 6 deletions data/sql/updates/db_world/2024_09_11_00.sql

This file was deleted.

15 changes: 0 additions & 15 deletions data/sql/updates/db_world/2024_09_11_01.sql

This file was deleted.

6 changes: 3 additions & 3 deletions src/server/apps/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1277,17 +1277,17 @@ Visibility.GroupMode = 1
# Visibility.Distance.Instances
# Visibility.Distance.BGArenas
# Description: Visibility distance to see other players or gameobjects.
# Visibility on continents on retail ~100 yards. In BG/Arenas ~250.
# Visibility on continents on retail ~100 yards. In BG/Arenas ~533.
# For instances default ~170.
# Max limited by active player zone: ~ 333
# Min limit is max aggro radius (45) * Rate.Creature.Aggro
# Default: 100 - (Visibility.Distance.Continents)
# 170 - (Visibility.Distance.Instances)
# 250 - (Visibility.Distance.BGArenas)
# 533 - (Visibility.Distance.BGArenas)

Visibility.Distance.Continents = 100
Visibility.Distance.Instances = 170
Visibility.Distance.BGArenas = 250
Visibility.Distance.BGArenas = 533

#
# Visibility.ObjectSparkles
Expand Down
5 changes: 1 addition & 4 deletions src/server/game/Battlegrounds/ArenaTeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,7 @@ void ArenaTeam::CreateTempArenaTeam(std::vector<Player*> playerList, uint8 type,
{
auto playerCountInTeam = static_cast<uint32>(playerList.size());

const auto standardArenaType = { ARENA_TYPE_2v2, ARENA_TYPE_3v3, ARENA_TYPE_5v5 };
bool isStandardArenaType = std::find(std::begin(standardArenaType), std::end(standardArenaType), type) != std::end(standardArenaType);
if (isStandardArenaType)
ASSERT(playerCountInTeam == GetReqPlayersForType(type));
ASSERT(playerCountInTeam == GetReqPlayersForType(type));

// Generate new arena team id
TeamId = sArenaTeamMgr->GenerateTempArenaTeamId();
Expand Down
2 changes: 0 additions & 2 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,6 @@ inline void Battleground::_ProcessJoin(uint32 diff)
}
m_ToBeTeleported.clear();
}

sScriptMgr->OnArenaStart(this);
}
else
{
Expand Down
4 changes: 0 additions & 4 deletions src/server/game/Battlegrounds/BattlegroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,6 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId

sScriptMgr->OnQueueUpdate(this, diff, bgTypeId, bracket_id, arenaType, isRated, arenaRating);

if (!sScriptMgr->OnQueueUpdateValidity(this, diff, bgTypeId, bracket_id, arenaType, isRated, arenaRating)) {
return;
}

m_SelectionPools[TEAM_ALLIANCE].Init();
m_SelectionPools[TEAM_HORDE].Init();

Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Creature/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3679,7 +3679,7 @@ bool Creature::IsNotReachableAndNeedRegen() const
std::shared_ptr<time_t> const& Creature::GetLastLeashExtensionTimePtr() const
{
if (m_lastLeashExtensionTime == nullptr)
m_lastLeashExtensionTime = std::make_shared<time_t>(GameTime::GetGameTime().count());
m_lastLeashExtensionTime = std::make_shared<time_t>(time(nullptr));
return m_lastLeashExtensionTime;
}

Expand All @@ -3700,7 +3700,7 @@ time_t Creature::GetLastLeashExtensionTime() const

void Creature::UpdateLeashExtensionTime()
{
(*GetLastLeashExtensionTimePtr()) = GameTime::GetGameTime().count();
(*GetLastLeashExtensionTimePtr()) = time(nullptr);
}

bool Creature::CanPeriodicallyCallForAssistance() const
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/TemporarySummon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ std::string Minion::GetDebugInfo() const
Guardian::Guardian(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
{
m_unitTypeMask |= UNIT_MASK_GUARDIAN;
if (properties && (properties->Type == SUMMON_TYPE_PET || properties->Category == SUMMON_CATEGORY_PET))
if (properties && properties->Type == SUMMON_TYPE_PET)
{
m_unitTypeMask |= UNIT_MASK_CONTROLABLE_GUARDIAN;
InitCharmInfo();
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Object/ObjectDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define DEFAULT_VISIBILITY_DISTANCE 100.0f // default visible distance, 100 yards on continents
#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
#define VISIBILITY_DIST_WINTERGRASP 175.0f
#define DEFAULT_VISIBILITY_BGARENAS 250.0f // default visible distance in BG/Arenas, roughly 250 yards
#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards

#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
#define DEFAULT_COMBAT_REACH 1.5f
Expand Down
40 changes: 5 additions & 35 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,20 +738,6 @@ bool Unit::GetRandomContactPoint(Unit const* obj, float& x, float& y, float& z,
return true;
}

Unit* Unit::getAttackerForHelper() const
{
if (GetVictim() != nullptr)
return GetVictim();

if (!IsEngaged())
return nullptr;

if (!m_attackers.empty())
return *(m_attackers.begin());

return nullptr;
}

void Unit::UpdateInterruptMask()
{
m_interruptMask = 0;
Expand Down Expand Up @@ -13573,9 +13559,6 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration)
}
}

if (Creature* pCreature = ToCreature())
pCreature->UpdateLeashExtensionTime();

SetInCombatState(false, enemy, duration);
}

Expand Down Expand Up @@ -17253,17 +17236,6 @@ void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuar
}
}

void Unit::SetCantProc(bool apply)
{
if (apply)
++m_procDeep;
else
{
ASSERT(m_procDeep);
--m_procDeep;
}
}

void Unit::AddPetAura(PetAura const* petSpell)
{
if (!IsPlayer())
Expand Down Expand Up @@ -20256,13 +20228,13 @@ void Unit::OutDebugInfo() const
class AuraMunchingQueue : public BasicEvent
{
public:
AuraMunchingQueue(Unit& owner, ObjectGuid targetGUID, int32 basePoints, uint32 spellId, AuraEffect* aurEff) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId), _aurEff(aurEff) { }
AuraMunchingQueue(Unit& owner, ObjectGuid targetGUID, int32 basePoints, uint32 spellId) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId) { }

bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
{
if (_owner.IsInWorld() && _owner.FindMap())
if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID))
_owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, _aurEff, _owner.GetGUID());
_owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, _owner.GetGUID());

return true;
}
Expand All @@ -20272,15 +20244,13 @@ class AuraMunchingQueue : public BasicEvent
ObjectGuid _targetGUID;
int32 _basePoints;
uint32 _spellId;
AuraEffect* _aurEff;
};

void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex)
{
AuraEffect* aurEff = nullptr;
for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
{
aurEff = *i;
AuraEffect* aurEff = *i;
if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
continue;

Expand All @@ -20290,9 +20260,9 @@ void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, Aura

// xinef: delay only for casting on different unit
if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, aurEff, caster->GetGUID());
caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, caster->GetGUID());
else
caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId, aurEff), caster->m_Events.CalculateQueueTime(400));
caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400));
}

void Unit::SendClearTarget()
Expand Down
Loading

0 comments on commit af77652

Please sign in to comment.