aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRat <none@none>2009-04-10 18:11:09 +0200
committerRat <none@none>2009-04-10 18:11:09 +0200
commit1e61dffc8969e2901adff5e34782aaa8c3c07e14 (patch)
treeddb7fc661d092a8b3f7552f7cac830c52b8f1285 /src
parentaa6347538a2b28c4b20628add52b7bc63a399c52 (diff)
*added creature extra flag No Crit (CREATURE_FLAG_EXTRA_NO_CRIT)
*added function to disable reputation gained from monsters *tabs2spaces in affected files --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Creature.cpp1
-rw-r--r--src/game/Creature.h6
-rw-r--r--src/game/Player.cpp9
-rw-r--r--src/game/Unit.cpp7
4 files changed, 17 insertions, 6 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 471934f4f80..4a4415a8e08 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -158,6 +158,7 @@ m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTabl
m_CreatureCategoryCooldowns.clear();
m_GlobalCooldown = 0;
m_unit_movement_flags = MOVEMENTFLAG_WALK_MODE;
+ DisableReputationGain = false;
}
Creature::~Creature()
diff --git a/src/game/Creature.h b/src/game/Creature.h
index b477ea00f1d..0930fe00701 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -134,6 +134,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
//CREATURE_FLAG_EXTRA_CHARM_AI = 0x00008000, // use ai when charmed
CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00010000, // cannot be taunted
+ CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes
};
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
@@ -628,6 +629,9 @@ class TRINITY_DLL_SPEC Creature : public Unit
uint32 GetFormationID(){return m_formationID;}
Unit *SelectVictim();
+
+ void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
+ bool IsReputationGainDisabled() { return DisableReputationGain; }
protected:
bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
@@ -678,6 +682,8 @@ class TRINITY_DLL_SPEC Creature : public Unit
float mHome_Z;
float mHome_O;
+ bool DisableReputationGain;
+
private:
//WaypointMovementGenerator vars
uint32 m_waypointID;
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 764cb20c88c..24d36a42558 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5924,6 +5924,9 @@ void Player::RewardReputation(Unit *pVictim, float rate)
if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
return;
+ if(((Creature*)pVictim)->IsReputationGainDisabled())
+ return;
+
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry);
if(!Rep)
@@ -15245,7 +15248,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
missingItem = ar->item2;
uint32 missingKey = 0;
- uint32 missingHeroicQuest = 0;
+ uint32 missingHeroicQuest = 0;
if(GetDifficulty() == DIFFICULTY_HEROIC)
{
if(ar->heroicKey)
@@ -15257,7 +15260,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
else if(ar->heroicKey2 && !HasItemCount(ar->heroicKey2, 1))
missingKey = ar->heroicKey2;
- if(ar->heroicQuest && !GetQuestRewardStatus(ar->heroicQuest))
+ if(ar->heroicQuest && !GetQuestRewardStatus(ar->heroicQuest))
missingHeroicQuest = ar->heroicQuest;
}
@@ -15273,7 +15276,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), ar->levelMin, objmgr.GetItemPrototype(missingItem)->Name1);
else if(missingKey)
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY2);
- else if(missingHeroicQuest)
+ else if(missingHeroicQuest)
GetSession()->SendAreaTriggerMessage(ar->heroicQuestFailedText.c_str());
else if(missingQuest)
GetSession()->SendAreaTriggerMessage(ar->questFailedText.c_str());
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index c412be0e30b..e5c6200e7a5 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2557,7 +2557,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
if (tmp > 0 && roll < (sum += tmp))
{
DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
- return MELEE_HIT_CRIT;
+ if(GetTypeId()!=TYPEID_PLAYER && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
+ return MELEE_HIT_CRIT;
}
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
@@ -4364,7 +4365,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
{
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
-
+
}
}
@@ -6138,7 +6139,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
triggered_spell_id = 21400;
}
else continue;
- basepoints0 = CalculateSpellDamage(procSpell,i,procSpell->EffectBasePoints[i],this) * 0.4f;
+ basepoints0 = CalculateSpellDamage(procSpell,i,procSpell->EffectBasePoints[i],this) * 0.4f;
CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
}
return true;