aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-06 15:21:44 -0600
committermegamage <none@none>2009-03-06 15:21:44 -0600
commit50b3095312ef01dcc748011d740a8fadfaa04b6c (patch)
tree2260ac10775016e7cc5ded834eb4754adc8aa3a2 /src/game/Player.cpp
parent2e0af6e37b17b76651e50b24a016b045f747b658 (diff)
Implement some death related achievements
* ACHIEVEMENT_CRITERIA_TYPE_DEATH (normal and arena types counting) * ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON (instance types by man limit counting) Note: need fixed for cases when max allowed players different from recommended count. * ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM (environment damage sources by types) Fixed: * ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER - self-kill counting as death from players - same team player kill in opposition kills counter. Also cleanup in Player::EnvironmentalDamage use DBCStructure.h comment. Author: VladimirMangos --HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 7bda4f64ed9..cf1e79e687b 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -898,6 +898,9 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
void Player::EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 damage)
{
+ if(!isAlive() || isGameMaster())
+ return;
+
WorldPacket data(SMSG_ENVIRONMENTALDAMAGELOG, (21));
data << (uint64)guid;
data << (uint8)(type!=DAMAGE_FALL_TO_VOID ? type : DAMAGE_FALL);
@@ -908,13 +911,18 @@ void Player::EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 da
DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- if(type==DAMAGE_FALL && !isAlive()) // DealDamage not apply item durability loss at self damage
+ if(!isAlive())
{
- DEBUG_LOG("We are fall to death, loosing 10 percents durability");
- DurabilityLossAll(0.10f,false);
- // durability lost message
- WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
- GetSession()->SendPacket(&data);
+ 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);
+ // durability lost message
+ WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
+ GetSession()->SendPacket(&data);
+ }
+
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type);
}
}
@@ -998,9 +1006,7 @@ void Player::HandleLava()
uint64 guid = GetGUID();
uint32 damage = urand(600, 700); // TODO: Get more detailed information about lava damage
- // if not gamemaster then deal damage
- if ( !isGameMaster() )
- EnvironmentalDamage(guid, DAMAGE_LAVA, damage);
+ EnvironmentalDamage(guid, DAMAGE_LAVA, damage);
m_breathTimer = 1*IN_MILISECONDS;
}
@@ -1385,6 +1391,8 @@ void Player::setDeathState(DeathState s)
if(!ressSpellId)
ressSpellId = GetResurrectionSpellId();
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1);
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1);
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1);
}
Unit::setDeathState(s);