*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
This commit is contained in:
Rat
2009-04-10 18:11:09 +02:00
parent aa6347538a
commit 1e61dffc89
4 changed files with 17 additions and 6 deletions
+1
View File
@@ -158,6 +158,7 @@ m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTabl
m_CreatureCategoryCooldowns.clear(); m_CreatureCategoryCooldowns.clear();
m_GlobalCooldown = 0; m_GlobalCooldown = 0;
m_unit_movement_flags = MOVEMENTFLAG_WALK_MODE; m_unit_movement_flags = MOVEMENTFLAG_WALK_MODE;
DisableReputationGain = false;
} }
Creature::~Creature() Creature::~Creature()
+6
View File
@@ -134,6 +134,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) 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_CHARM_AI = 0x00008000, // use ai when charmed
CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00010000, // cannot be taunted 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 // 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;} uint32 GetFormationID(){return m_formationID;}
Unit *SelectVictim(); Unit *SelectVictim();
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
bool IsReputationGainDisabled() { return DisableReputationGain; }
protected: protected:
bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL); bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
bool InitEntry(uint32 entry, uint32 team=ALLIANCE, 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_Z;
float mHome_O; float mHome_O;
bool DisableReputationGain;
private: private:
//WaypointMovementGenerator vars //WaypointMovementGenerator vars
uint32 m_waypointID; uint32 m_waypointID;
+6 -3
View File
@@ -5924,6 +5924,9 @@ void Player::RewardReputation(Unit *pVictim, float rate)
if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER) if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
return; return;
if(((Creature*)pVictim)->IsReputationGainDisabled())
return;
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry); ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry);
if(!Rep) if(!Rep)
@@ -15245,7 +15248,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
missingItem = ar->item2; missingItem = ar->item2;
uint32 missingKey = 0; uint32 missingKey = 0;
uint32 missingHeroicQuest = 0; uint32 missingHeroicQuest = 0;
if(GetDifficulty() == DIFFICULTY_HEROIC) if(GetDifficulty() == DIFFICULTY_HEROIC)
{ {
if(ar->heroicKey) 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)) else if(ar->heroicKey2 && !HasItemCount(ar->heroicKey2, 1))
missingKey = ar->heroicKey2; missingKey = ar->heroicKey2;
if(ar->heroicQuest && !GetQuestRewardStatus(ar->heroicQuest)) if(ar->heroicQuest && !GetQuestRewardStatus(ar->heroicQuest))
missingHeroicQuest = 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); GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), ar->levelMin, objmgr.GetItemPrototype(missingItem)->Name1);
else if(missingKey) else if(missingKey)
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY2); SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY2);
else if(missingHeroicQuest) else if(missingHeroicQuest)
GetSession()->SendAreaTriggerMessage(ar->heroicQuestFailedText.c_str()); GetSession()->SendAreaTriggerMessage(ar->heroicQuestFailedText.c_str());
else if(missingQuest) else if(missingQuest)
GetSession()->SendAreaTriggerMessage(ar->questFailedText.c_str()); GetSession()->SendAreaTriggerMessage(ar->questFailedText.c_str());
+4 -3
View File
@@ -2557,7 +2557,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
if (tmp > 0 && roll < (sum += tmp)) if (tmp > 0 && roll < (sum += tmp))
{ {
DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); 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) // 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]->cancel();
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL; caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
} }
} }
@@ -6138,7 +6139,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
triggered_spell_id = 21400; triggered_spell_id = 21400;
} }
else continue; 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); CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
} }
return true; return true;