Merge git://github.com/TrinityCore/TrinityCore into mmaps

Conflicts:
	src/server/game/Entities/Vehicle/Vehicle.cpp
	src/server/game/Movement/MovementGenerator.h
	src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
	src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
	src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
	src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
	src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
	src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
	src/server/game/Movement/Spline/MoveSpline.h
This commit is contained in:
kaelima committed 2012-12-21 00:00:16 +01:00
commit 0a88787dfc
779 files changed
+18290 -8767

No files matched your search

+266 -245
View File
@@ -551,18 +551,22 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (IsAIEnabled)
GetAI()->DamageDealt(victim, damage, damagetype);
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->GetTypeId() == TYPEID_PLAYER && this != victim)
{
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
return 0;
// Signal to pets that their owner was attacked
Pet* pet = victim->ToPlayer()->GetPet();
if (pet && pet->isAlive())
pet->AI()->OwnerDamagedBy(this);
pet->AI()->OwnerAttackedBy(this);
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
return 0;
}
// Signal the pet it was attacked so the AI can respond if needed
if (victim->GetTypeId() == TYPEID_UNIT && this != victim && victim->isPet() && victim->isAlive())
victim->ToPet()->AI()->AttackedBy(this);
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
@@ -1034,6 +1038,9 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
break;
}
// Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage);
// Calculate absorb resist
if (damage > 0)
{
@@ -1130,6 +1137,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType);
damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType);
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
{
@@ -5562,37 +5572,28 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Shadow's Fate (Shadowmourne questline)
case 71169:
{
target = triggeredByAura->GetCaster();
if (!target)
return false;
Player* player = target->ToPlayer();
if (!player)
return false;
// not checking Infusion auras because its in targetAuraSpell of credit spell
if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion
uint32 spellId = 0;
switch (GetEntry())
{
if (GetEntry() != 36678) // Professor Putricide
return false;
CastSpell(target, 71518, true); // Quest Credit
return true;
case 36678: // NPC: Professor Putricide
spellId = 71518; // Spell: Unholy Infusion Credit
break;
case 37955: // NPC: Blood-Queen Lana'thel
spellId = 72934; // Spell: Quest Credit
break;
case 36853: // NPC: Sindragosa <Queen of the Frostbrood>
spellId = 72289; // Spell: Frost Infusion Quest Credit
break;
default:
break;
}
else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion
{
if (GetEntry() != 37955) // Blood-Queen Lana'thel
return false;
CastSpell(target, 72934, true); // Quest Credit
return true;
}
else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion
{
if (GetEntry() != 36853) // Sindragosa
return false;
CastSpell(target, 72289, true); // Quest Credit
return true;
}
else if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) // A Feast of Souls
triggered_spell_id = 71203;
break;
if (spellId)
CastSpell((Unit*)NULL, spellId, true);
CastSpell((Unit*)NULL, 71203, true);
return true;
}
// Essence of the Blood Queen
case 70871:
@@ -6022,9 +6023,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
// Replenishment - roll chance
if (roll_chance_i(aurEff->GetAmount()))
{
CastSpell(this, 57669, true, castItem, triggeredByAura);
}
}
break;
}
@@ -7545,12 +7544,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Unholy Blight
if (dummySpell->Id == 49194)
{
triggered_spell_id = 50536;
SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!unholyBlight)
return false;
basepoints0 = CalculatePct(int32(damage), triggerAmount);
// Glyph of Unholy Blight
//Glyph of Unholy Blight
if (AuraEffect* glyph=GetAuraEffect(63332, 0))
AddPct(basepoints0, glyph->GetAmount());
triggered_spell_id = 50536;
basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -8224,7 +8229,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 40336:
{
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
if (this && isAlive())
if (isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (victim && victim->isAlive())
CastSpell(victim, 27526, true, castItem, triggeredByAura);
@@ -8235,7 +8240,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
// Remove a Evasive Charge
Aura* charge = GetAura(50241);
if (charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
if (charge && charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
RemoveAurasDueToSpell(50240);
}
}
@@ -9033,33 +9038,36 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Shadow's Fate (Shadowmourne questline)
case 71169:
{
if (GetTypeId() != TYPEID_PLAYER)
// Victim needs more checks so bugs, rats or summons can not be affected by the proc.
if (GetTypeId() != TYPEID_PLAYER || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER)
return false;
Player* player = ToPlayer();
if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion
if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE)
{
if (!player->HasAura(71516) || victim->GetEntry() != 36678) // Shadow Infusion && Professor Putricide
return false;
}
else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion
{
if (!player->HasAura(72154) || victim->GetEntry() != 37955) // Thirst Quenched && Blood-Queen Lana'thel
return false;
}
else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion
{
if (!player->HasAura(72290) || victim->GetEntry() != 36853) // Frost-Imbued Blade && Sindragosa
return false;
}
else if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) // A Feast of Souls
return false;
uint32 spellId = 0;
uint32 questId = 0;
switch (victim->GetEntry())
{
case 36678: // NPC: Professor Putricide
questId = 24749; // Quest: Unholy Infusion
spellId = 71516; // Spell: Shadow Infusion
break;
case 37955: // NPC: Blood-Queen Lana'thel
questId = 24756; // Quest: Blood Infusion
spellId = 72154; // Spell: Thirst Quenched
break;
case 36853: // NPC: Sindragosa
questId = 24757; // Quest: Frost Infusion
spellId = 72290; // Spell: Frost-Imbued Blade
break;
default:
return false;
}
if (victim->GetTypeId() != TYPEID_UNIT)
return false;
// critters are not allowed
if (victim->GetCreatureType() == CREATURE_TYPE_CRITTER)
return false;
if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId))
return false;
}
break;
}
}
@@ -13944,17 +13952,17 @@ void Unit::DeleteCharmInfo()
}
CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false),
m_stayX(0.0f), m_stayY(0.0f), m_stayZ(0.0f)
: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false),
_isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
_stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
_charmspells[i].SetActionAndType(0, ACT_DISABLED);
if (m_unit->GetTypeId() == TYPEID_UNIT)
if (_unit->GetTypeId() == TYPEID_UNIT)
{
m_oldReactState = m_unit->ToCreature()->GetReactState();
m_unit->ToCreature()->SetReactState(REACT_PASSIVE);
_oldReactState = _unit->ToCreature()->GetReactState();
_unit->ToCreature()->SetReactState(REACT_PASSIVE);
}
}
@@ -13964,9 +13972,9 @@ CharmInfo::~CharmInfo()
void CharmInfo::RestoreState()
{
if (m_unit->GetTypeId() == TYPEID_UNIT)
if (Creature* creature = m_unit->ToCreature())
creature->SetReactState(m_oldReactState);
if (_unit->GetTypeId() == TYPEID_UNIT)
if (Creature* creature = _unit->ToCreature())
creature->SetReactState(_oldReactState);
}
void CharmInfo::InitPetActionBar()
@@ -13997,16 +14005,16 @@ void CharmInfo::InitEmptyActionBar(bool withAttack)
void CharmInfo::InitPossessCreateSpells()
{
InitEmptyActionBar();
if (m_unit->GetTypeId() == TYPEID_UNIT)
if (_unit->GetTypeId() == TYPEID_UNIT)
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
uint32 spellId = m_unit->ToCreature()->m_spells[i];
uint32 spellId = _unit->ToCreature()->m_spells[i];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo && !(spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD))
{
if (spellInfo->IsPassive())
m_unit->CastSpell(m_unit, spellInfo, true);
_unit->CastSpell(_unit, spellInfo, true);
else
AddSpellToActionBar(spellInfo, ACT_PASSIVE);
}
@@ -14016,7 +14024,7 @@ void CharmInfo::InitPossessCreateSpells()
void CharmInfo::InitCharmCreateSpells()
{
if (m_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
{
InitEmptyActionBar();
return;
@@ -14026,23 +14034,23 @@ void CharmInfo::InitCharmCreateSpells()
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
{
uint32 spellId = m_unit->ToCreature()->m_spells[x];
uint32 spellId = _unit->ToCreature()->m_spells[x];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
{
m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
continue;
}
if (spellInfo->IsPassive())
{
m_unit->CastSpell(m_unit, spellInfo, true);
m_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
_unit->CastSpell(_unit, spellInfo, true);
_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
}
else
{
m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
ActiveStates newstate = ACT_PASSIVE;
@@ -14119,17 +14127,17 @@ void CharmInfo::ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply)
return;
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
if (spellInfo->Id == m_charmspells[x].GetAction())
m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
if (spellInfo->Id == _charmspells[x].GetAction())
_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
}
void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow)
{
m_petnumber = petnumber;
_petnumber = petnumber;
if (statwindow)
m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, m_petnumber);
_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, _petnumber);
else
m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
}
void CharmInfo::LoadPetActionBar(const std::string& data)
@@ -16702,178 +16710,181 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c
return CalculatePct(damage, percent);
}
uint32 Unit::GetModelForForm(ShapeshiftForm form)
uint32 Unit::GetModelForForm(ShapeshiftForm form) const
{
switch (form)
if (GetTypeId() == TYPEID_PLAYER)
{
case FORM_CAT:
// Based on Hair color
if (getRace() == RACE_NIGHTELF)
{
uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
switch (hairColor)
switch (form)
{
case FORM_CAT:
// Based on Hair color
if (getRace() == RACE_NIGHTELF)
{
case 7: // Violet
case 8:
return 29405;
case 3: // Light Blue
return 29406;
case 0: // Green
case 1: // Light Green
case 2: // Dark Green
return 29407;
case 4: // White
return 29408;
default: // original - Dark Blue
return 892;
}
}
// Based on Skin color
else if (getRace() == RACE_TAUREN)
{
uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
// Male
if (getGender() == GENDER_MALE)
{
switch (skinColor)
uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
switch (hairColor)
{
case 12: // White
case 13:
case 14:
case 18: // Completly White
return 29409;
case 9: // Light Brown
case 10:
case 11:
return 29410;
case 6: // Brown
case 7:
case 7: // Violet
case 8:
return 29405;
case 3: // Light Blue
return 29406;
case 0: // Green
case 1: // Light Green
case 2: // Dark Green
return 29407;
case 4: // White
return 29408;
default: // original - Dark Blue
return 892;
}
}
// Based on Skin color
else if (getRace() == RACE_TAUREN)
{
uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
// Male
if (getGender() == GENDER_MALE)
{
switch (skinColor)
{
case 12: // White
case 13:
case 14:
case 18: // Completly White
return 29409;
case 9: // Light Brown
case 10:
case 11:
return 29410;
case 6: // Brown
case 7:
case 8:
return 29411;
case 0: // Dark
case 1:
case 2:
case 3: // Dark Grey
case 4:
case 5:
return 29412;
default: // original - Grey
return 8571;
}
}
// Female
else switch (skinColor)
{
case 10: // White
return 29409;
case 6: // Light Brown
case 7:
return 29410;
case 4: // Brown
case 5:
return 29411;
case 0: // Dark
case 1:
case 2:
case 3: // Dark Grey
case 4:
case 5:
case 3:
return 29412;
default: // original - Grey
return 8571;
}
}
// Female
else switch (skinColor)
else if (Player::TeamForRace(getRace()) == ALLIANCE)
return 892;
else
return 8571;
case FORM_DIREBEAR:
case FORM_BEAR:
// Based on Hair color
if (getRace() == RACE_NIGHTELF)
{
case 10: // White
return 29409;
case 6: // Light Brown
case 7:
return 29410;
case 4: // Brown
case 5:
return 29411;
case 0: // Dark
case 1:
case 2:
case 3:
return 29412;
default: // original - Grey
return 8571;
uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
switch (hairColor)
{
case 0: // Green
case 1: // Light Green
case 2: // Dark Green
return 29413; // 29415?
case 6: // Dark Blue
return 29414;
case 4: // White
return 29416;
case 3: // Light Blue
return 29417;
default: // original - Violet
return 2281;
}
}
}
else if (Player::TeamForRace(getRace()) == ALLIANCE)
return 892;
else
return 8571;
case FORM_DIREBEAR:
case FORM_BEAR:
// Based on Hair color
if (getRace() == RACE_NIGHTELF)
{
uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
switch (hairColor)
// Based on Skin color
else if (getRace() == RACE_TAUREN)
{
case 0: // Green
case 1: // Light Green
case 2: // Dark Green
return 29413; // 29415?
case 6: // Dark Blue
return 29414;
case 4: // White
return 29416;
case 3: // Light Blue
return 29417;
default: // original - Violet
return 2281;
}
}
// Based on Skin color
else if (getRace() == RACE_TAUREN)
{
uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
// Male
if (getGender() == GENDER_MALE)
{
switch (skinColor)
uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
// Male
if (getGender() == GENDER_MALE)
{
switch (skinColor)
{
case 0: // Dark (Black)
case 1:
case 2:
return 29418;
case 3: // White
case 4:
case 5:
case 12:
case 13:
case 14:
return 29419;
case 9: // Light Brown/Grey
case 10:
case 11:
case 15:
case 16:
case 17:
return 29420;
case 18: // Completly White
return 29421;
default: // original - Brown
return 2289;
}
}
// Female
else switch (skinColor)
{
case 0: // Dark (Black)
case 1:
case 2:
return 29418;
case 3: // White
case 4:
case 5:
case 12:
case 13:
case 14:
case 2: // White
case 3:
return 29419;
case 9: // Light Brown/Grey
case 10:
case 11:
case 15:
case 16:
case 17:
case 6: // Light Brown/Grey
case 7:
case 8:
case 9:
return 29420;
case 18: // Completly White
case 10: // Completly White
return 29421;
default: // original - Brown
return 2289;
}
}
// Female
else switch (skinColor)
{
case 0: // Dark (Black)
case 1:
return 29418;
case 2: // White
case 3:
return 29419;
case 6: // Light Brown/Grey
case 7:
case 8:
case 9:
return 29420;
case 10: // Completly White
return 29421;
default: // original - Brown
return 2289;
}
}
else if (Player::TeamForRace(getRace()) == ALLIANCE)
return 2281;
else
return 2289;
case FORM_FLIGHT:
if (Player::TeamForRace(getRace()) == ALLIANCE)
return 20857;
return 20872;
case FORM_FLIGHT_EPIC:
if (Player::TeamForRace(getRace()) == ALLIANCE)
return 21243;
return 21244;
default:
break;
else if (Player::TeamForRace(getRace()) == ALLIANCE)
return 2281;
else
return 2289;
case FORM_FLIGHT:
if (Player::TeamForRace(getRace()) == ALLIANCE)
return 20857;
return 20872;
case FORM_FLIGHT_EPIC:
if (Player::TeamForRace(getRace()) == ALLIANCE)
return 21243;
return 21244;
default:
break;
}
}
uint32 modelid = 0;
@@ -17572,58 +17583,68 @@ uint32 Unit::GetResistance(SpellSchoolMask mask) const
void CharmInfo::SetIsCommandAttack(bool val)
{
m_isCommandAttack = val;
_isCommandAttack = val;
}
bool CharmInfo::IsCommandAttack()
{
return m_isCommandAttack;
return _isCommandAttack;
}
void CharmInfo::SetIsCommandFollow(bool val)
{
_isCommandFollow = val;
}
bool CharmInfo::IsCommandFollow()
{
return _isCommandFollow;
}
void CharmInfo::SaveStayPosition()
{
//! At this point a new spline destination is enabled because of Unit::StopMoving()
G3D::Vector3 const stayPos = m_unit->movespline->FinalDestination();
m_stayX = stayPos.x;
m_stayY = stayPos.y;
m_stayZ = stayPos.z;
G3D::Vector3 const stayPos = _unit->movespline->FinalDestination();
_stayX = stayPos.x;
_stayY = stayPos.y;
_stayZ = stayPos.z;
}
void CharmInfo::GetStayPosition(float &x, float &y, float &z)
{
x = m_stayX;
y = m_stayY;
z = m_stayZ;
x = _stayX;
y = _stayY;
z = _stayZ;
}
void CharmInfo::SetIsAtStay(bool val)
{
m_isAtStay = val;
_isAtStay = val;
}
bool CharmInfo::IsAtStay()
{
return m_isAtStay;
return _isAtStay;
}
void CharmInfo::SetIsFollowing(bool val)
{
m_isFollowing = val;
_isFollowing = val;
}
bool CharmInfo::IsFollowing()
{
return m_isFollowing;
return _isFollowing;
}
void CharmInfo::SetIsReturning(bool val)
{
m_isReturning = val;
_isReturning = val;
}
bool CharmInfo::IsReturning()
{
return m_isReturning;
return _isReturning;
}
void Unit::SetInFront(Unit const* target)