Skip to content

Instantly share code, notes, and snippets.

@Langerz82
Created January 15, 2018 10:54
Show Gist options
  • Save Langerz82/f4051dd992a368001e168bb410f430b9 to your computer and use it in GitHub Desktop.
Save Langerz82/f4051dd992a368001e168bb410f430b9 to your computer and use it in GitHub Desktop.
diff --git src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.cpp
index 86df2a6d13..1a3026b1a0 100644
--- src/server/game/Entities/Unit/Unit.cpp
+++ src/server/game/Entities/Unit/Unit.cpp
@@ -3089,7 +3089,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
//TC_LOG_DEBUG("entities.unit", "Interrupt spell for unit %u.", GetEntry());
Spell* spell = m_currentSpells[spellType];
if (spell
- && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
+ && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
&& (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING))
{
// for example, do not let self-stun aura interrupt itself
@@ -4085,6 +4085,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
// interrupt channeled spell
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
if (spell->getState() == SPELL_STATE_CASTING
+ && IsMovementPreventedByCasting()
&& (spell->m_spellInfo->ChannelInterruptFlags & flag)
&& spell->m_spellInfo->Id != except)
InterruptNonMeleeSpells(false);
@@ -5101,7 +5102,7 @@ void Unit::AddGameObject(GameObject* gameObj)
{
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
// Need disable spell use for owner
- if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
+ if (createBySpell /*&& createBySpell->IsCooldownStartedOnEvent()*/)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
GetSpellHistory()->StartCooldown(createBySpell, 0, nullptr, true);
}
@@ -5130,7 +5131,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
// Need activate spell use for owner
- if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
+ if (createBySpell /*&& createBySpell->IsCooldownStartedOnEvent()*/)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
GetSpellHistory()->SendCooldownEvent(createBySpell);
}
@@ -6192,7 +6193,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
// Remove infinity cooldown
- if (spellInfo && (spellInfo->IsCooldownStartedOnEvent()))
+ if (spellInfo /*&& (spellInfo->IsCooldownStartedOnEvent())*/)
GetSpellHistory()->SendCooldownEvent(spellInfo);
//if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
@@ -8969,7 +8970,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
uint32 Unit::GetAttackTime(WeaponAttackType att) const
{
- float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att) / m_modAttackSpeedPct[att];
+ float f_BaseAttackTime = (GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att) / m_modAttackSpeedPct[att]) / sWorld->getRate(RATE_ATTACKSPEED);
return (uint32)f_BaseAttackTime;
}
diff --git src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/Spells/Auras/SpellAuras.cpp
index d1285e5633..c485cdcf94 100644
--- src/server/game/Spells/Auras/SpellAuras.cpp
+++ src/server/game/Spells/Auras/SpellAuras.cpp
@@ -454,7 +454,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
m_removedApplications.push_back(auraApp);
// reset cooldown state for spells
- if (caster && GetSpellInfo()->IsCooldownStartedOnEvent())
+ if (caster /*&& GetSpellInfo()->IsCooldownStartedOnEvent()*/)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
caster->GetSpellHistory()->SendCooldownEvent(GetSpellInfo());
}
diff --git src/server/game/Spells/Spell.cpp src/server/game/Spells/Spell.cpp
index 184a003cba..5eb1944409 100644
--- src/server/game/Spells/Spell.cpp
+++ src/server/game/Spells/Spell.cpp
@@ -3052,7 +3052,7 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
// as a result a spell that passed CheckCast and should be processed instantly may suffer from this delayed process
// the easiest bug to observe is LoS check in AddUnitTarget, even if spell passed the CheckCast LoS check the situation can change in spell::update
// because target could be relocated in the meantime, making the spell fly to the air (no targets can be registered, so no effects processed, nothing in combat log)
- if (!m_casttime && /*!m_spellInfo->StartRecoveryTime && */!m_castItemGUID && GetCurrentContainer() == CURRENT_GENERIC_SPELL)
+ if (!m_casttime /*&& !m_spellInfo->StartRecoveryTime && !m_castItemGUID && GetCurrentContainer() == CURRENT_GENERIC_SPELL*/)
cast(true);
}
}
@@ -3318,7 +3318,7 @@ void Spell::_cast(bool skipCheck)
creatureCaster->ReleaseFocus(this);
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
- if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()) || m_spellInfo->HasAttribute(SPELL_ATTR4_UNK4))
+ if (m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled() || m_spellInfo->HasAttribute(SPELL_ATTR4_UNK4))
{
// Remove used for cast item if need (it can be already NULL after TakeReagents call
// in case delayed spell remove item at cast delay start
diff --git src/server/game/Spells/SpellHistory.cpp src/server/game/Spells/SpellHistory.cpp
index 8e44c70e9c..2be99968c9 100644
--- src/server/game/Spells/SpellHistory.cpp
+++ src/server/game/Spells/SpellHistory.cpp
@@ -173,7 +173,7 @@ void SpellHistory::HandleCooldowns(SpellInfo const* spellInfo, uint32 itemID, Sp
// potions start cooldown until exiting combat
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemID))
{
- if (itemTemplate->IsPotion() || spellInfo->IsCooldownStartedOnEvent())
+ if (itemTemplate->IsPotion() /*|| spellInfo->IsCooldownStartedOnEvent()*/)
{
player->SetLastPotionId(itemID);
return;
@@ -181,7 +181,7 @@ void SpellHistory::HandleCooldowns(SpellInfo const* spellInfo, uint32 itemID, Sp
}
}
- if (spellInfo->IsCooldownStartedOnEvent() || spellInfo->IsPassive())
+ if (spellInfo->IsPassive())
return;
StartCooldown(spellInfo, itemID, spell);
@@ -349,15 +349,15 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel
{
AddCooldown(spellInfo->Id, itemId, recTime, categoryId, catrecTime, onHold);
- if (needsCooldownPacket)
- {
+ //if (needsCooldownPacket)
+ //{
if (Player* playerOwner = GetPlayerOwner())
{
WorldPacket spellCooldown;
- BuildCooldownPacket(spellCooldown, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, cooldown);
+ BuildCooldownPacket(spellCooldown, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, cooldown ? cooldown : categoryCooldown);
playerOwner->SendDirectMessage(&spellCooldown);
}
- }
+ //}
}
}
@@ -548,8 +548,8 @@ void SpellHistory::LockSpellSchool(SpellSchoolMask schoolMask, uint32 lockoutTim
for (uint32 spellId : knownSpells)
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(spellId);
- if (spellInfo->IsCooldownStartedOnEvent())
- continue;
+ //if (spellInfo->IsCooldownStartedOnEvent())
+ // continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
diff --git src/server/game/Spells/SpellInfo.cpp src/server/game/Spells/SpellInfo.cpp
index 873bfbefdc..66108182af 100644
--- src/server/game/Spells/SpellInfo.cpp
+++ src/server/game/Spells/SpellInfo.cpp
@@ -797,8 +797,8 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry)
ExcludeCasterAuraSpell = spellEntry->excludeCasterAuraSpell;
ExcludeTargetAuraSpell = spellEntry->excludeTargetAuraSpell;
CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : nullptr;
- RecoveryTime = spellEntry->RecoveryTime;
- CategoryRecoveryTime = spellEntry->CategoryRecoveryTime;
+ RecoveryTime = spellEntry->RecoveryTime / sWorld->getRate(RATE_COOLDOWNSPEED);
+ CategoryRecoveryTime = spellEntry->CategoryRecoveryTime / sWorld->getRate(RATE_COOLDOWNSPEED);
StartRecoveryCategory = spellEntry->StartRecoveryCategory;
StartRecoveryTime = spellEntry->StartRecoveryTime;
InterruptFlags = spellEntry->InterruptFlags;
@@ -819,7 +819,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry)
ManaCostPercentage = spellEntry->ManaCostPercentage;
RuneCostID = spellEntry->runeCostID;
RangeEntry = spellEntry->rangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->rangeIndex) : nullptr;
- Speed = spellEntry->speed;
+ Speed = spellEntry->speed / sWorld->getRate(RATE_CASTINGSPEED);
StackAmount = spellEntry->StackAmount;
for (uint8 i = 0; i < 2; ++i)
Totem[i] = spellEntry->Totem[i];
diff --git src/server/game/World/World.cpp src/server/game/World/World.cpp
index 542b7e7d51..702d6dd3e4 100644
--- src/server/game/World/World.cpp
+++ src/server/game/World/World.cpp
@@ -571,6 +571,26 @@ void World::LoadConfigSettings(bool reload)
TC_LOG_ERROR("server.loading", "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
rate_values[RATE_MOVESPEED] = 1.0f;
}
+
+ rate_values[RATE_ATTACKSPEED] = sConfigMgr->GetFloatDefault("Rate.AttackSpeed", 1.0f);
+ if (rate_values[RATE_ATTACKSPEED] <= 0)
+ {
+ TC_LOG_ERROR("server.loading", "Rate.AttackSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_ATTACKSPEED]);
+ rate_values[RATE_ATTACKSPEED] = 1.0f;
+ }
+ rate_values[RATE_COOLDOWNSPEED] = sConfigMgr->GetFloatDefault("Rate.CooldownSpeed", 1.0f);
+ if (rate_values[RATE_COOLDOWNSPEED] <= 0)
+ {
+ TC_LOG_ERROR("server.loading", "Rate.CooldownSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_COOLDOWNSPEED]);
+ rate_values[RATE_COOLDOWNSPEED] = 1.0f;
+ }
+ rate_values[RATE_CASTINGSPEED] = sConfigMgr->GetFloatDefault("Rate.CastingSpeed", 1.0f);
+ if (rate_values[RATE_CASTINGSPEED] <= 0)
+ {
+ TC_LOG_ERROR("server.loading", "Rate.CastingSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_CASTINGSPEED]);
+ rate_values[RATE_CASTINGSPEED] = 1.0f;
+ }
+
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
rate_values[RATE_CORPSE_DECAY_LOOTED] = sConfigMgr->GetFloatDefault("Rate.Corpse.Decay.Looted", 0.5f);
diff --git src/server/game/World/World.h src/server/game/World/World.h
index 6d0bc44205..8a76751b77 100644
--- src/server/game/World/World.h
+++ src/server/game/World/World.h
@@ -459,6 +459,9 @@ enum Rates
RATE_DURABILITY_LOSS_ABSORB,
RATE_DURABILITY_LOSS_BLOCK,
RATE_MOVESPEED,
+ RATE_ATTACKSPEED,
+ RATE_COOLDOWNSPEED,
+ RATE_CASTINGSPEED,
RATE_MONEY_QUEST,
RATE_MONEY_MAX_LEVEL_QUEST,
MAX_RATES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment