Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 11 commits
  • 19 files changed
  • 7 commit comments
  • 4 contributors
View
4 sql_mr/mr01894_mangos_achievements_fixes.sql → sql_mr/mr01902_mangos_achievements_fixes.sql
@@ -123,3 +123,7 @@ INSERT INTO `achievement_criteria_requirement` VALUES (12182,6,4710,0);
INSERT INTO `achievement_criteria_requirement` VALUES (13254,0,0,0);
INSERT INTO `achievement_criteria_requirement` VALUES (13255,6,4710,0);
+
+-- Friend or Fowl
+DELETE FROM `achievement_criteria_requirement` WHERE criteria_id=3821;
+INSERT INTO `achievement_criteria_requirement` VALUES (3821,0,0,0);
View
10 sql_mr/mr01902_mangos_creature_ai_scripts.sql
@@ -0,0 +1,10 @@
+-- Friend of Fowl achieve
+DELETE FROM creature_ai_scripts WHERE creature_id IN(23801,24746);
+INSERT INTO `creature_ai_scripts` VALUES
+('2380101', '23801', '6', '0', '100', '0', '0', '0', '0', '0', '11', '25281', '6', '3', '0', '0', '0', '0', '0', '0', '0', '0', 'ytdb');
+INSERT INTO `creature_ai_scripts` VALUES
+('2474601', '24746', '6', '0', '100', '0', '0', '0', '0', '0', '11', '25281', '6', '3', '0', '0', '0', '0', '0', '0', '0', '0', 'ytdb');
+
+UPDATE `creature_template` SET `AIName` = 'EventAI' WHERE `entry` = '23801';
+UPDATE `creature_template` SET `AIName` = 'EventAI' WHERE `entry` = '24746';
+UPDATE creature_template SET type=1 WHERE entry in(23801,24746);
View
71 src/game/AchievementMgr.cpp
@@ -1432,25 +1432,62 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (!miscvalue1 || miscvalue1 != achievementCriteria->be_spell_target.spellID)
continue;
- // those requirements couldn't be found in the dbc
- AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria);
- if(!data)
- continue;
-
- if(!data->Meets(GetPlayer(),unit))
- continue;
-
- // Defense of the Ancients
- if(achievementCriteria->referredAchievement == 1757 || achievementCriteria->referredAchievement == 2200)
+ // for special conditions
+ switch(achievementCriteria->referredAchievement)
{
- // If not in SotA
- BattleGround * bg = GetPlayer()->GetBattleGround();
- if(!bg || bg->GetTypeID(true) != BATTLEGROUND_SA)
- continue;
+ case 1757: // Defense of the Ancients(alliance)
+ case 2200: // Defense of the Ancients(horde)
+ {
+ // If not in SotA
+ BattleGround * bg = GetPlayer()->GetBattleGround();
+ if(!bg || bg->GetTypeID(true) != BATTLEGROUND_SA)
+ continue;
- // If hasnt all walls.
- if(!((BattleGroundSA*)bg)->winSAwithAllWalls(GetPlayer()->GetTeam()))
- continue;
+ // If hasnt all walls.
+ if(!((BattleGroundSA*)bg)->winSAwithAllWalls(GetPlayer()->GetTeam()))
+ continue;
+ break;
+ }
+ case 1761: // The Dapper Sapper (SotA)
+ case 2193: // Explosives Expert (SotA)
+ {
+ // If not in SotA
+ BattleGround * bg = GetPlayer()->GetBattleGround();
+ if(!bg || bg->GetTypeID(true) != BATTLEGROUND_SA)
+ continue;
+ break;
+ }
+ case 3850: // Mowed Down (IoC) (both)
+ {
+ //if not at bg
+ BattleGround* bg = GetPlayer()->GetBattleGround();
+ if (!bg)
+ continue;
+ if (bg->GetTypeID(true) != BATTLEGROUND_IC)
+ continue;
+ if(!((GetPlayer()->GetVehicle()) && (GetPlayer()->GetVehicle()->GetBase()->GetEntry() == 34944)))
+ continue;
+ break;
+ }
+ case 1310: // Storm the Beach (SotA)
+ {
+ // If not in SotA
+ BattleGround * bg = GetPlayer()->GetBattleGround();
+ if(!bg || bg->GetTypeID(true) != BATTLEGROUND_SA)
+ continue;
+ break;
+ }
+ default:
+ {
+ // those requirements couldn't be found in the dbc
+ AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria);
+
+ if (!data)
+ continue;
+ if (!data->Meets(GetPlayer(),unit))
+ continue;
+ break;
+ }
}
change = 1;
View
12 src/game/BattleGroundSA.cpp
@@ -201,10 +201,8 @@ void BattleGroundSA::Update(uint32 diff)
RoundScores[0].time = BG_SA_ROUNDLENGTH;
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- {
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
- plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 52459);
- }
+ plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_END_OF_ROUND);
ResetBattle(0, defender);
}
@@ -214,10 +212,8 @@ void BattleGroundSA::Update(uint32 diff)
RoundScores[1].winner = GetDefender();
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- {
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
- plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 52459);
- }
+ plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_END_OF_ROUND);
if (RoundScores[0].winner == GetDefender())
EndBattleGround(GetDefender());
@@ -626,7 +622,7 @@ void BattleGroundSA::EventPlayerDamageGO(Player *player, GameObject* target_obj,
// Seaforium Charge Explosion
if (doneBy == 52408)
- player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 60937);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_PLANT_SEAFORIUM_CHARGE);
BG_SA_GoType type = BG_SA_GO_GATES_T_NONE;
switch (target_obj->GetEntry())
@@ -817,7 +813,7 @@ void BattleGroundSA::EventPlayerDamageGO(Player *player, GameObject* target_obj,
{
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
if (plr->GetTeam() != defender)
- plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
+ plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, BG_SA_STORM_THE_BEACH);
}
if (Phase == SA_ROUND_ONE) // Victory at first round
View
11 src/game/BattleGroundSA.h
@@ -24,8 +24,8 @@ class BattleGround;
#define BG_SA_GRY_MAX 3
#define BG_SA_GATE_MAX 6
#define BG_SA_MAX_WS 4
-#define BG_SA_EVENT_START_BATTLE_1 23748 // Ally / Horde likely
-#define BG_SA_EVENT_START_BATTLE_2 21702
+#define BG_SA_EVENT_START_BATTLE_1 23748 // First Round Start
+#define BG_SA_EVENT_START_BATTLE_2 21702 // Second Round Start
enum BG_SA_WorldStates
{
@@ -80,6 +80,13 @@ enum BG_SA_GraveYardStatus
BG_SA_GRAVE_STATUS_HORDE_OCCUPIED = 4 // Captured by the Horde, not clickable by anyone
};
+enum BG_SA_Spells
+{
+ BG_SA_END_OF_ROUND = 52459, // Achievement Criteria
+ BG_SA_PLANT_SEAFORIUM_CHARGE = 60937, // Spell doesnt exist(Achievement Criteria)
+ BG_SA_STORM_THE_BEACH = 65246, // Spell doesnt exist(Achievement Criteria)
+};
+
enum BG_SA_Timers
{
BG_SA_ROUNDLENGTH = 600000,
View
4 src/game/BattleGroundWS.cpp
@@ -390,7 +390,9 @@ void BattleGroundWS::PickOrReturnFlag(Player* pPlayer, Team forTeam, bool picked
pPlayer->CastSpell(pPlayer, A ? BG_WS_SPELL_WARSONG_FLAG : BG_WS_SPELL_SILVERWING_FLAG, true);
if (!fromGround)
- pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, A ? BG_WS_SPELL_WARSONG_FLAG_PICKED : BG_WS_SPELL_SILVERWING_FLAG_PICKED);
+ //For timed achivements (Quick Cap)
+ pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, A ? BG_WS_SPELL_WARSONG_FLAG_PICKED : BG_WS_SPELL_SILVERWING_FLAG_PICKED);
+
}
// Flag on ground (not in base), return flag to base.
else
View
16 src/game/GameEventMgr.cpp
@@ -146,17 +146,23 @@ void GameEventMgr::LoadFromDB()
pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32());
- if(pGameEvent.length==0) // length>0 is validity check
+ if (pGameEvent.length == 0) // length>0 is validity check
{
- sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.",event_id);
+ sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.", event_id);
continue;
}
- if(pGameEvent.holiday_id != HOLIDAY_NONE)
+ if (pGameEvent.occurence < pGameEvent.length) // occurence < length is useless. This also asserts that occurence > 0!
{
- if(!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
+ sLog.outErrorDb("`game_event` game event id (%i) has occurence %u < length %u and can't be used.", event_id, pGameEvent.occurence, pGameEvent.length);
+ continue;
+ }
+
+ if (pGameEvent.holiday_id != HOLIDAY_NONE)
+ {
+ if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
- sLog.outErrorDb("`game_event` game event id (%i) have nonexistent holiday id %u.",event_id,pGameEvent.holiday_id);
+ sLog.outErrorDb("`game_event` game event id (%i) have nonexistent holiday id %u.", event_id, pGameEvent.holiday_id);
pGameEvent.holiday_id = HOLIDAY_NONE;
}
}
View
26 src/game/GridNotifiers.h
@@ -1224,8 +1224,34 @@ namespace MaNGOS
const WorldObject* m_pObject;
uint32 m_uiEntry;
float m_fRange;
+
+ // prevent clone this object
+ AllGameObjectsWithEntryInRange(AllGameObjectsWithEntryInRange const&);
+ };
+
+ class AllCreaturesOfEntryInRangeCheck
+ {
+ public:
+ AllCreaturesOfEntryInRangeCheck(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
+ WorldObject const& GetFocusObject() const { return *m_pObject; }
+ bool operator() (Unit* pUnit)
+ {
+ if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit,m_fRange,false))
+ return true;
+
+ return false;
+ }
+
+ private:
+ const WorldObject* m_pObject;
+ uint32 m_uiEntry;
+ float m_fRange;
+
+ // prevent clone this object
+ AllCreaturesOfEntryInRangeCheck(AllCreaturesOfEntryInRangeCheck const&);
};
+
// Player checks and do
class AnyPlayerInObjectRangeCheck
View
14 src/game/Level1.cpp
@@ -138,7 +138,7 @@ bool ChatHandler::HandleNameAnnounceCommand(char* args)
if (!*args)
return false;
- switch(m_session->GetSecurity())
+ switch(m_session->GetSecurity())
{
case SEC_MODERATOR:
strid = LANG_SYSTEMMESSAGE_MODERATOR;
@@ -596,10 +596,14 @@ bool ChatHandler::HandleGonameCommand(char* args)
target->InterruptTaxiFlying();
// to point to see at target with same orientation
- float x,y,z;
- target->GetContactPoint(_player,x,y,z);
+ float x, y, z;
+
+ if (_player->GetMapId() == target->GetMapId())
+ target->GetContactPoint(_player, x, y, z);
+ else
+ target->GetPosition(x, y, z);
- _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
+ _player->TeleportTo(target->GetMapId(), x, y, z + 0.5f, _player->GetAngle(target), TELE_TO_GM_MODE);
}
else
{
@@ -618,6 +622,8 @@ bool ChatHandler::HandleGonameCommand(char* args)
if (!Player::LoadPositionFromDB(target_guid, map,x,y,z,o,in_flight))
return false;
+ z += 0.5f;
+
return HandleGoHelper(_player, map, x, y, &z);
}
View
22 src/game/Level3.cpp
@@ -3922,31 +3922,23 @@ bool ChatHandler::HandleDamageCommand(char* args)
// melee damage by specific school
if (!*args)
{
- uint32 absorb = 0;
- uint32 resist = 0;
-
- target->CalculateDamageAbsorbAndResist(m_session->GetPlayer(),schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
-
- if (damage <= absorb + resist)
- return true;
-
- damage -= absorb + resist;
-
- m_session->GetPlayer()->DealDamageMods(target,damage,&absorb);
- m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
DamageInfo damageInfo = DamageInfo(m_session->GetPlayer(), target, spellid);
damageInfo.damage = damage;
- damageInfo.absorb = absorb;
- damageInfo.resist = resist;
+ damageInfo.absorb = 0;
+ damageInfo.resist = 0;
damageInfo.HitInfo = HITINFO_NORMALSWING2;
damageInfo.TargetState = VICTIMSTATE_NORMAL;
+
+ target->CalculateDamageAbsorbAndResist(m_session->GetPlayer(),&damageInfo, false);
+
+ m_session->GetPlayer()->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
+ m_session->GetPlayer()->DealDamage(target,&damageInfo,false);
m_session->GetPlayer()->SendAttackStateUpdate(&damageInfo);
return true;
}
// non-melee damage
-
m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
return true;
}
View
36 src/game/Player.cpp
@@ -967,28 +967,42 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
// Absorb, resist some environmental damage type
uint32 absorb = 0;
uint32 resist = 0;
- if (type == DAMAGE_LAVA)
- CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
- else if (type == DAMAGE_SLIME)
- CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist);
- damage-=absorb+resist;
+ //16455 lava, 16456 slime
+ uint32 spellID = 0;
+ switch (type)
+ {
+ case DAMAGE_LAVA:
+ spellID = 16455;
+ break;
+ case DAMAGE_SLIME:
+ spellID = 16456;
+ //as i think, not used NATURE mask for slime damage.
+ break;
+ default:
+ break;
+ }
+ DamageInfo damageInfo = DamageInfo(this,this,spellID);
+ damageInfo.damage = damage;
+ damageInfo.damageType = SELF_DAMAGE;
+
+ CalculateDamageAbsorbAndResist(this, &damageInfo);
DealDamageMods(this,damage,&absorb);
WorldPacket data(SMSG_ENVIRONMENTALDAMAGELOG, (21));
data << GetObjectGuid();
- data << uint8(type!=DAMAGE_FALL_TO_VOID ? type : DAMAGE_FALL);
- data << uint32(damage);
- data << uint32(absorb);
- data << uint32(resist);
+ data << uint8(type != DAMAGE_FALL_TO_VOID ? type : DAMAGE_FALL);
+ data << uint32(damageInfo.damage);
+ data << uint32(damageInfo.absorb);
+ data << uint32(damageInfo.resist);
SendMessageToSet(&data, true);
- uint32 final_damage = DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ uint32 final_damage = DealDamage(this, &damageInfo, false);
if(!isAlive())
{
- if (type==DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
+ if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
{
DEBUG_LOG("We are fall to death, loosing 10 percents durability");
DurabilityLossAll(0.10f,false);
View
2 src/game/SharedDefines.h
@@ -374,7 +374,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX3_DONT_DISPLAY_RANGE 0x40000000 // 30 client doesn't display range in tooltip for those spells
#define SPELL_ATTR_EX3_UNK31 0x80000000 // 31
-#define SPELL_ATTR_EX4_UNK0 0x00000001 // 0
+#define SPELL_ATTR_EX4_IGNORE_RESISTANCES 0x00000001 // 0 not may be resisted (in magic case) and have binary resistance method (in melee case).
#define SPELL_ATTR_EX4_UNK1 0x00000002 // 1 proc on finishing move?
#define SPELL_ATTR_EX4_UNK2 0x00000004 // 2
#define SPELL_ATTR_EX4_UNK3 0x00000008 // 3
View
17 src/game/SpellAuras.cpp
@@ -6222,6 +6222,15 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
{
switch(spell->Id)
{
+ case 25281: // Turkey Marker
+ {
+ if (target && target->GetTypeId() != TYPEID_PLAYER)
+ break;
+ if (Aura* aura = target->GetAura(25281, EFFECT_INDEX_0))
+ if (aura->GetStackAmount() == 15)
+ target->CastSpell(target, 25285, true); // Friend or Fowl criteria
+ break;
+ }
case 49555: // Corpse Explode (Trollgore - Drak'Tharon Keep Normal)
if (!apply)
{
@@ -8625,7 +8634,7 @@ void Aura::PeriodicTick()
if (GetSpellProto()->Id == 50344) // Dream Funnel Oculus drake spell
damageInfo.damage = uint32(pCaster->GetMaxHealth()*0.05f);
- target->CalculateDamageAbsorbAndResist(pCaster, damageInfo.SchoolMask(), DOT, damageInfo.damage, &damageInfo.absorb, &damageInfo.resist, !(GetSpellProto()->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
+ target->CalculateDamageAbsorbAndResist(pCaster, &damageInfo, !(GetSpellProto()->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s attacked %s for %u dmg inflicted by %u abs is %u",
GetAffectiveCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), damageInfo.damage, GetId(), damageInfo.absorb);
@@ -8722,7 +8731,7 @@ void Aura::PeriodicTick()
if (GetAffectiveCasterGuid().IsPlayer())
damageInfo.damage -= target->GetSpellDamageReduction(damageInfo.damage);
- target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, damageInfo.damage, &damageInfo.absorb, &damageInfo.resist, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
+ target->CalculateDamageAbsorbAndResist(pCaster, &damageInfo, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u",
GetAffectiveCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), damageInfo.damage, GetId(),damageInfo.absorb);
@@ -10907,6 +10916,10 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount)
}
}
}
+ // Turkey Marker
+ // Hack for not changing duration of timed achievement
+ if (m_spellProto->Id == 25281)
+ refresh = false;
if (refresh)
// Stack increased refresh duration
View
12 src/game/SpellEffects.cpp
@@ -287,17 +287,19 @@ void Spell::EffectInstaKill(SpellEffectIndex /*eff_idx*/)
void Spell::EffectEnvironmentalDMG(SpellEffectIndex eff_idx)
{
- uint32 absorb = 0;
- uint32 resist = 0;
-
// Note: this hack with damage replace required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case nonexistent GO casting support
// currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc
+ DamageInfo damageInfo = DamageInfo(m_caster,m_caster,m_spellInfo);
+ damageInfo.damage = damage;
+ damageInfo.damageType = SELF_DAMAGE;
+
damage = m_spellInfo->CalculateSimpleValue(eff_idx);
- m_caster->CalculateDamageAbsorbAndResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
+ m_caster->CalculateDamageAbsorbAndResist(m_caster, &damageInfo);
+
+ m_caster->SendSpellNonMeleeDamageLog(&damageInfo);
- m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage);
}
View
102 src/game/Unit.cpp
@@ -1909,9 +1909,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, DamageInfo* damage
damageInfo->procEx |= PROC_EX_DIRECT_DAMAGE;
// Calculate absorb & resists
- uint32 absorb_affected_damage = CalcNotIgnoreAbsorbDamage(damageInfo->damage,damageInfo->SchoolMask());
- damageInfo->target->CalculateDamageAbsorbAndResist(this, damageInfo->SchoolMask(), DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, true);
- damageInfo->damage-=damageInfo->absorb + damageInfo->resist;
+ damageInfo->target->CalculateDamageAbsorbAndResist(this, damageInfo, true);
+
if (damageInfo->absorb)
{
damageInfo->HitInfo|=HITINFO_ABSORB;
@@ -2123,18 +2122,20 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
return (newdamage > 1) ? newdamage : 1;
}
-void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect)
+void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, DamageInfo* damageInfo, bool canReflect)
{
- if(!pCaster || !isAlive() || !damage)
+ if(!pCaster || !isAlive() || !damageInfo || damageInfo->damage == 0)
return;
// Magic damage, check for resists
- if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL)==0)
+ if (!(damageInfo->SchoolMask() & SPELL_SCHOOL_MASK_NORMAL) &&
+ !damageInfo->IsMeleeDamage() &&
+ !(damageInfo->m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_IGNORE_RESISTANCES))
{
// Get base resistance for schoolmask
- float tmpvalue2 = (float)GetResistance(schoolMask);
+ float tmpvalue2 = (float)GetResistance(damageInfo->SchoolMask());
// Ignore resistance by self SPELL_AURA_MOD_TARGET_RESISTANCE aura
- tmpvalue2 += (float)pCaster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask);
+ tmpvalue2 += (float)pCaster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, damageInfo->SchoolMask());
if (pCaster->GetTypeId() == TYPEID_PLAYER)
tmpvalue2 -= (float)((Player*)pCaster)->GetSpellPenetrationItemMod();
@@ -2156,17 +2157,20 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
else
break;
}
- if (damagetype == DOT && m == 4)
- *resist += uint32(damage - 1);
+ if (damageInfo->damageType == DOT && m == 4)
+ damageInfo->resist += uint32(damageInfo->damage);
+ // need make more correct this hack.
else
- *resist += uint32(damage * m / 4);
- if(*resist > damage)
- *resist = damage;
+ damageInfo->resist += uint32(damageInfo->damage * m / 4);
+
+ // full resist mode granted
+ if (damageInfo->resist > damageInfo->damage)
+ damageInfo->resist = damageInfo->damage;
}
else
- *resist = 0;
+ damageInfo->resist = 0;
- int32 RemainingDamage = damage - *resist;
+ int32 RemainingDamage = damageInfo->damage - damageInfo->resist;
// Get unit state (need for some absorb check)
uint32 unitflag = GetUInt32Value(UNIT_FIELD_FLAGS);
@@ -2178,13 +2182,18 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
SpellEntry const* preventDeathSpell = NULL;
int32 preventDeathAmount = 0;
+ // for absorb use only absorb_affected_damage
+ uint32 absorb_affected_damage = CalcNotIgnoreAbsorbDamage(damageInfo->damage,damageInfo->SchoolMask());
+ if (RemainingDamage > absorb_affected_damage)
+ RemainingDamage = absorb_affected_damage;
+
// full absorb cases (by chance)
AuraList const& vAbsorb = GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
for(AuraList::const_iterator i = vAbsorb.begin(); i != vAbsorb.end() && RemainingDamage > 0; ++i)
{
// only work with proper school mask damage
Modifier* i_mod = (*i)->GetModifier();
- if (!(i_mod->m_miscvalue & schoolMask))
+ if (!(i_mod->m_miscvalue & damageInfo->SchoolMask()))
continue;
SpellEntry const* i_spellProto = (*i)->GetSpellProto();
@@ -2227,7 +2236,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end() && RemainingDamage > 0; ++i)
{
Modifier* mod = (*i)->GetModifier();
- if (!(mod->m_miscvalue & schoolMask))
+ if (!(mod->m_miscvalue & damageInfo->SchoolMask()))
continue;
SpellEntry const* spellProto = (*i)->GetSpellProto();
@@ -2269,7 +2278,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
if (spellProto->SpellIconID == 3006)
{
// You have a chance equal to your Parry chance
- if (damagetype == SPELL_DIRECT_DAMAGE && // Only for direct spell damage
+ if (damageInfo->damageType == SPELL_DIRECT_DAMAGE && // Only for direct spell damage
roll_chance_f(GetUnitParryChance())) // Roll chance
RemainingDamage -= RemainingDamage * currentAbsorb / 100;
continue;
@@ -2475,7 +2484,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
uint32 ab_damage = absorbed;
pCaster->DealDamageMods(caster,ab_damage,NULL);
- pCaster->DealDamage(caster, ab_damage, NULL, damagetype, schoolMask, 0, false);
+ pCaster->DealDamage(caster, ab_damage, NULL, damageInfo->damageType, damageInfo->SchoolMask(), 0, false);
continue;
}
// Will of Necropolis
@@ -2546,7 +2555,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetModifier()->m_miscvalue & damageInfo->SchoolMask()) == 0)
continue;
int32 currentAbsorb;
@@ -2618,30 +2627,30 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetModifier()->m_miscvalue & damageInfo->SchoolMask()) == 0)
continue;
// Damage can be splitted only if aura has an alive caster
Unit *caster = (*i)->GetCaster();
if(!caster || caster == this || !caster->IsInWorld() || !caster->isAlive())
continue;
- DamageInfo damageInfo = DamageInfo(pCaster, caster, (*i)->GetSpellProto());
- damageInfo.CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- damageInfo.damageType = damagetype;
+ DamageInfo splitdamageInfo = DamageInfo(pCaster, caster, (*i)->GetSpellProto());
+ splitdamageInfo.CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
+ splitdamageInfo.damageType = damageInfo->damageType;
if (RemainingDamage >= (*i)->GetModifier()->m_amount)
- damageInfo.damage = (*i)->GetModifier()->m_amount;
+ splitdamageInfo.damage = (*i)->GetModifier()->m_amount;
else
- damageInfo.damage = RemainingDamage;
+ splitdamageInfo.damage = RemainingDamage;
- RemainingDamage -= damageInfo.damage;
+ RemainingDamage -= splitdamageInfo.damage;
- pCaster->DealDamageMods(caster,damageInfo.damage,&damageInfo.absorb);
+ pCaster->DealDamageMods(caster,splitdamageInfo.damage,&splitdamageInfo.absorb);
- pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, damageInfo.damage, schoolMask, damageInfo.absorb, 0, false, 0, false);
- damageInfo.cleanDamage = damageInfo.damage - damageInfo.absorb;
- pCaster->DealDamage(caster, &damageInfo, false);
+ pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitdamageInfo.damage, damageInfo->SchoolMask(), splitdamageInfo.absorb, 0, false, 0, false);
+ splitdamageInfo.cleanDamage = splitdamageInfo.damage - splitdamageInfo.absorb;
+ pCaster->DealDamage(caster, &splitdamageInfo, false);
}
AuraList const& vSplitDamagePct = GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
@@ -2650,27 +2659,27 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetModifier()->m_miscvalue & damageInfo->SchoolMask()) == 0)
continue;
// Damage can be splitted only if aura has an alive caster
Unit *caster = (*i)->GetCaster();
if(!caster || caster == this || !caster->IsInWorld() || !caster->isAlive())
continue;
- DamageInfo damageInfo = DamageInfo(pCaster, caster, (*i)->GetSpellProto());
- damageInfo.CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- damageInfo.damageType = damagetype;
+ DamageInfo splitdamageInfo = DamageInfo(pCaster, caster, (*i)->GetSpellProto());
+ splitdamageInfo.CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
+ splitdamageInfo.damageType = damageInfo->damageType;
- damageInfo.damage = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
+ splitdamageInfo.damage = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
- RemainingDamage -= int32(damageInfo.damage);
+ RemainingDamage -= int32(splitdamageInfo.damage);
- pCaster->DealDamageMods(caster,damageInfo.damage,&damageInfo.absorb);
+ pCaster->DealDamageMods(caster,splitdamageInfo.damage,&splitdamageInfo.absorb);
- pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, damageInfo.damage, schoolMask, damageInfo.absorb, 0, false, 0, false);
- damageInfo.cleanDamage = damageInfo.damage - damageInfo.absorb;
- pCaster->DealDamage(caster, &damageInfo, false);
+ pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitdamageInfo.damage, damageInfo->SchoolMask(), splitdamageInfo.absorb, 0, false, 0, false);
+ splitdamageInfo.cleanDamage = splitdamageInfo.damage - splitdamageInfo.absorb;
+ pCaster->DealDamage(caster, &splitdamageInfo, false);
}
}
@@ -2709,7 +2718,12 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
}
}
- *absorb = damage - RemainingDamage - *resist;
+ damageInfo->absorb = damageInfo->damage - damageInfo->resist - RemainingDamage;
+
+ if (damageInfo->damage < (damageInfo->absorb + damageInfo->resist))
+ damageInfo->damage = 0;
+ else
+ damageInfo->damage -= damageInfo->absorb + damageInfo->resist;
}
void Unit::CalculateAbsorbResistBlock(Unit *pCaster, DamageInfo *damageInfo, SpellEntry const* spellProto, WeaponAttackType attType)
@@ -2735,9 +2749,7 @@ void Unit::CalculateAbsorbResistBlock(Unit *pCaster, DamageInfo *damageInfo, Spe
damageInfo->damage-=damageInfo->blocked;
}
- uint32 absorb_affected_damage = pCaster->CalcNotIgnoreAbsorbDamage(damageInfo->damage,GetSpellSchoolMask(spellProto),spellProto);
- CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), SPELL_DIRECT_DAMAGE, absorb_affected_damage, &damageInfo->absorb, &damageInfo->resist, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
- damageInfo->damage-= damageInfo->absorb + damageInfo->resist;
+ CalculateDamageAbsorbAndResist(pCaster, damageInfo, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
}
void Unit::CalculateHealAbsorb(const uint32 heal, uint32 *absorb)
View
2 src/game/Unit.h
@@ -2038,7 +2038,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
// redefined in Creature
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage);
- void CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect = false);
+ void CalculateDamageAbsorbAndResist(Unit *pCaster, DamageInfo* damageInfo, bool canReflect = false);
void CalculateAbsorbResistBlock(Unit *pCaster, DamageInfo *damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK);
void CalculateHealAbsorb(uint32 heal, uint32 *absorb);
View
4 src/game/UnitAuraProcHandler.cpp
@@ -5292,10 +5292,10 @@ SpellAuraProcResult Unit::HandleDamageShieldAuraProc(Unit* pVictim, DamageInfo*
procDamageInfo.damage = SpellDamageBonusDone(pVictim, spellProto, procDamageInfo.damage, SPELL_DIRECT_DAMAGE);
procDamageInfo.damage = pVictim->SpellDamageBonusTaken(this, spellProto, procDamageInfo.damage, SPELL_DIRECT_DAMAGE);
-
procDamageInfo.CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- pVictim->CalculateDamageAbsorbAndResist(this, GetSpellSchoolMask(spellProto), SPELL_DIRECT_DAMAGE, procDamageInfo.damage, &procDamageInfo.absorb, &procDamageInfo.resist, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
+
+ pVictim->CalculateDamageAbsorbAndResist(this, &procDamageInfo, !(spellProto->AttributesEx & SPELL_ATTR_EX_CANT_REFLECTED));
DealDamageMods(pVictim, procDamageInfo.damage, &procDamageInfo.absorb);
View
2 src/shared/revision_R2.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_R2_H__
#define __REVISION_R2_H__
- #define REVISION_R2 "1898"
+ #define REVISION_R2 "1903"
#endif // __REVISION_R2_H__
View
2 src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "11961"
+ #define REVISION_NR "11963"
#endif // __REVISION_NR_H__

Showing you all comments on commits in this comparison.

@Zakamurite

aura always has target (by mangos logic)

@Zakamurite

and but here target isn't checked

@Thermaltake

https://gist.github.com/2390228 после обновления, чуть ли не каждый час такие пошли.

@rsa
MangosR2 member
rsa commented on 652f053 Apr 15, 2012

it's wrong in multithreaded environment. aura may not have a target in some times...

@rsa
MangosR2 member
rsa commented on 652f053 Apr 15, 2012

ревертайте 1896, однако причины фриза в дампе нет - либо проблемы с железом (наиболее вероятно), либо что-то с настройками сервера. поставьте не менее 3 нитей в работу.

@Thermaltake

Вчера еще не одного краша не было, аптайм 6 дней был, ночью обновился, понеслось. 30 минут назад откатился до того, где аптайм 6 дней был, падать перестал. И вы еще говорите тут на железо?
Сейчас железу менее 15-и дней, до меня это железо ни кто не арендовал. Мне пришлось 3 дня ждать, пока им привезут эти сервера.

@rsa
MangosR2 member
rsa commented on 652f053 Apr 15, 2012

этот коммит избавил Undergarun от одного редкого (по нашим меркам, ему с 2,5к - частого) краша. и ничего не добавил. если у вас добавил - значит что-то не так.

Something went wrong with that request. Please try again.