Skip to content

Commit

Permalink
[patch 154] Fixed spells 49158, 42650, 46584 and ranks. This patch is…
Browse files Browse the repository at this point in the history
…n't correct at all and should be rewritten later
  • Loading branch information
insider42 committed Dec 9, 2009
1 parent a53904c commit 1da09d3
Show file tree
Hide file tree
Showing 12 changed files with 349 additions and 13 deletions.
82 changes: 82 additions & 0 deletions addition/154_mangos_pet_levelstats.sql
@@ -0,0 +1,82 @@
DELETE FROM `pet_levelstats` WHERE `creature_entry` = 26125;
INSERT INTO `pet_levelstats` VALUES
(26125,1,48,80,10,20,16,13,20,8),
(26125,2,105,106,67,22,17,14,21,9),
(26125,3,162,132,124,24,18,15,22,10),
(26125,4,219,158,181,26,19,16,23,11),
(26125,5,276,184,238,28,20,17,24,12),
(26125,6,333,210,295,30,21,18,25,13),
(26125,7,390,236,352,32,22,19,26,14),
(26125,8,447,262,409,34,23,20,27,15),
(26125,9,504,288,466,36,24,21,28,16),
(26125,10,561,314,523,38,25,22,29,17),
(26125,11,618,340,580,40,26,23,30,18),
(26125,12,675,366,637,42,27,24,31,19),
(26125,13,732,392,694,44,28,25,32,20),
(26125,14,789,418,751,46,29,26,33,21),
(26125,15,846,444,808,48,30,27,34,22),
(26125,16,903,470,865,50,31,28,35,23),
(26125,17,960,496,922,52,32,29,36,24),
(26125,18,1017,522,979,54,33,30,37,25),
(26125,19,1074,548,1036,56,34,31,38,26),
(26125,20,1131,574,1093,58,35,32,39,27),
(26125,21,1188,600,1150,60,36,33,40,28),
(26125,22,1245,626,1207,62,37,34,41,29),
(26125,23,1302,652,1264,64,38,35,42,30),
(26125,24,1359,678,1321,66,39,36,43,31),
(26125,25,1416,704,1378,68,40,37,44,32),
(26125,26,1473,730,1435,70,41,38,45,33),
(26125,27,1530,756,1492,72,42,39,46,34),
(26125,28,1587,782,1549,74,43,40,47,35),
(26125,29,1644,808,1606,76,44,41,48,36),
(26125,30,1701,834,1663,78,45,42,49,37),
(26125,31,1758,860,1720,80,46,43,50,38),
(26125,32,1815,886,1777,82,47,44,51,39),
(26125,33,1872,912,1834,84,48,45,52,40),
(26125,34,1929,938,1891,86,49,46,53,41),
(26125,35,1986,964,1948,88,50,47,54,42),
(26125,36,2043,990,2005,90,51,48,55,43),
(26125,37,2100,1016,2062,92,52,49,56,44),
(26125,38,2157,1042,2119,94,53,50,57,45),
(26125,39,2214,1068,2176,96,54,51,58,46),
(26125,40,2271,1094,2233,98,55,52,59,47),
(26125,41,2328,1120,2290,100,56,53,60,48),
(26125,42,2385,1146,2347,102,57,54,61,49),
(26125,43,2442,1172,2404,104,58,55,62,50),
(26125,44,2499,1198,2461,106,59,56,63,51),
(26125,45,2556,1224,2518,108,60,57,64,52),
(26125,46,2613,1250,2575,110,61,58,65,53),
(26125,47,2670,1276,2632,112,62,59,66,54),
(26125,48,2727,1302,2689,114,63,60,67,55),
(26125,49,2784,1328,2746,116,64,61,68,56),
(26125,50,2841,1354,2803,118,65,62,69,57),
(26125,51,2898,1380,2860,120,66,63,70,58),
(26125,52,2955,1406,2917,122,67,64,71,59),
(26125,53,3012,1432,2974,124,68,65,72,60),
(26125,54,3069,1458,3031,126,69,66,73,61),
(26125,55,3126,1484,3088,128,70,67,74,62),
(26125,56,3183,1510,3145,130,71,68,75,63),
(26125,57,3240,1536,3202,132,72,69,76,64),
(26125,58,3297,1562,3259,134,73,70,77,65),
(26125,59,3354,1588,3316,136,74,71,78,66),
(26125,60,3411,1614,3373,138,75,72,79,67),
(26125,61,3468,1640,3430,140,76,73,80,68),
(26125,62,3525,1666,3487,142,77,74,81,69),
(26125,63,3582,1692,3544,144,78,75,82,70),
(26125,64,3639,1718,3601,146,79,76,83,71),
(26125,65,3696,1744,3658,148,80,77,84,72),
(26125,66,3753,1770,3715,150,81,78,85,73),
(26125,67,3810,1796,3772,152,82,79,86,74),
(26125,68,3867,1822,3829,154,83,80,87,75),
(26125,69,3924,1848,3886,156,84,81,88,76),
(26125,70,3981,1874,3943,158,85,82,89,77),
(26125,71,4038,1900,4000,160,86,83,90,78),
(26125,72,4095,1926,4057,162,87,84,91,79),
(26125,73,4152,1952,4114,164,88,85,92,80),
(26125,74,4209,1978,4171,166,89,86,93,81),
(26125,75,4266,2004,4228,168,90,87,94,82),
(26125,76,4323,2030,4285,170,91,88,95,83),
(26125,77,4380,2056,4342,172,92,89,96,84),
(26125,78,4437,2082,4399,174,93,90,97,85),
(26125,79,4494,2108,4456,176,94,91,98,86),
(26125,80,4551,2134,4513,178,95,92,99,87);
5 changes: 5 additions & 0 deletions addition/154_mangos_spell_pet_auras.sql
@@ -0,0 +1,5 @@
DELETE FROM `spell_pet_auras` WHERE `aura` = 54566;
INSERT INTO `spell_pet_auras` VALUES
(48965,1,26125,54566),
(49572,1,26125,54566),
(49571,1,26125,54566);
3 changes: 2 additions & 1 deletion src/game/Creature.cpp
Expand Up @@ -161,7 +161,7 @@ void Creature::RemoveFromWorld()

void Creature::RemoveCorpse()
{
if ((getDeathState() != CORPSE && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault))
if (((getDeathState() != CORPSE && getDeathState() != GHOULED) && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault))
return;

m_deathTimer = 0;
Expand Down Expand Up @@ -379,6 +379,7 @@ void Creature::Update(uint32 diff)
}
break;
}
case GHOULED:
case CORPSE:
{
if (m_isDeadByDefault)
Expand Down
4 changes: 2 additions & 2 deletions src/game/GridNotifiers.h
Expand Up @@ -557,8 +557,8 @@ namespace MaNGOS
}
bool operator()(Creature* u)
{
if (u->getDeathState()!=CORPSE || u->isInFlight() || u->isDeadByDefault() ||
(u->GetDisplayId() != u->GetNativeDisplayId()) ||
if ((u->getDeathState()!=CORPSE && u->getDeathState()!=GHOULED) || u->isInFlight() ||
u->isDeadByDefault() || (u->GetDisplayId() != u->GetNativeDisplayId()) ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)!=0)
return false;

Expand Down
41 changes: 35 additions & 6 deletions src/game/Pet.cpp
Expand Up @@ -205,6 +205,11 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool

SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);

// If pet is deathknight's ghoul
if (GetEntry() == 26125)
// then he must have energy bar instead of mana
setPowerType(POWER_ENERGY);
// this enables popup window (pet dismiss, cancel)
break;
case HUNTER_PET:
Expand Down Expand Up @@ -1904,13 +1909,37 @@ void Pet::CastPetAura(PetAura const* aura)
if(!auraId)
return;

if(auraId == 35696) // Demonic Knowledge
switch (auraId)
{
int32 basePoints = int32(aura->GetDamage() * (GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)) / 100);
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
}
else
CastSpell(this, auraId, true);
case 35696: // Demonic Knowledge
{
int32 basePoints = int32(aura->GetDamage() * (GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)) / 100);
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
break;
}
case 54566: // Ravenous Dead
{
Unit* owner = GetOwner();
if (owner)
{
// We must give x% bonus to base bonus from owner's stamina to ghoul stamina
int32 basePoints0 =
int32(owner->GetStat(STAT_STAMINA)*0.3f*(aura->GetDamage()+100.0f)/100.0f
- (GetStat(STAT_STAMINA)-GetCreateStat(STAT_STAMINA)));
// We must give x% bonus to base bonus from owner's strength to ghoul strength
int32 basePoints1 =
int32(owner->GetStat(STAT_STRENGTH)*0.3f*(aura->GetDamage()+100.0f)/100.0f
- (GetStat(STAT_STRENGTH)-GetCreateStat(STAT_STRENGTH)));
CastCustomSpell(this, auraId, &basePoints0, &basePoints1, NULL, true);
}
break;
}
default:
{
CastSpell(this, auraId, true);
break;
}
}
}

struct DoPetLearnSpell
Expand Down
1 change: 1 addition & 0 deletions src/game/Player.cpp
Expand Up @@ -4601,6 +4601,7 @@ void Player::RepopAtGraveyard()
GetSession()->SendPacket(&data);
}
}
SetDisplayId(GetNativeDisplayId());
}

void Player::JoinedChannel(Channel *c)
Expand Down
96 changes: 95 additions & 1 deletion src/game/Spell.cpp
Expand Up @@ -469,6 +469,42 @@ WorldObject* Spell::FindCorpseUsing()
return result;
}

void Spell::FillCustomTargetMap(uint32 i, UnitList& TagUnitMap)
{
float radius;
if (m_spellInfo->EffectRadiusIndex[i])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
// Resulting effect depends on spell that we want to cast
switch (m_spellInfo->Id)
{
case 46584: // Raise Dead
{
WorldObject* result = FindCorpseUsing <MaNGOS::RaiseDeadObjectCheck> ();

if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
TagUnitMap.push_back((Unit*)result);
break;
default:
break;
}
}
break;
}
case 47496: // Ghoul's explode
{
FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);
break;
}
break;
}
}

void Spell::FillTargetMap()
{
// TODO: ADD the correct target FILLS!!!!!!
Expand Down Expand Up @@ -512,6 +548,11 @@ void Spell::FillTargetMap()
}
break;
case TARGET_EFFECT_SELECT:
if (m_spellInfo->Id == 46584 || m_spellInfo->Id == 47496)
{
FillCustomTargetMap(i,tmpUnitMap);
break;
}
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
Expand Down Expand Up @@ -1378,11 +1419,64 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
case TARGET_TOTEM_FIRE:
case TARGET_SELF:
case TARGET_SELF2:
case TARGET_AREAEFFECT_CUSTOM:
case TARGET_AREAEFFECT_CUSTOM_2:
case TARGET_SUMMON:
TagUnitMap.push_back(m_caster);
break;
case TARGET_AREAEFFECT_CUSTOM:
{
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_DEATHKNIGHT:
{
switch (m_spellInfo->SpellIconID)
{
case 1737: // Corpse Explosion
{
// if not our ghoul AND
if (!(m_targets.getUnitTarget()->GetEntry() == 26125 && m_targets.getUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()) &&
// alive target or not suitable corpse
( ((Creature*)m_targets.getUnitTarget())->isDeadByDefault() ||
(m_targets.getUnitTarget()->getDeathState() != CORPSE && m_targets.getUnitTarget()->getDeathState() != GHOULED) ||
(m_targets.getUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL)!=0 ||
(m_targets.getUnitTarget()->GetDisplayId() != m_targets.getUnitTarget()->GetNativeDisplayId()) ))
{
TagUnitMap.clear();
CleanupTargetList();

WorldObject* result = FindCorpseUsing <MaNGOS::ExplodeCorpseObjectCheck> ();

if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
TagUnitMap.push_back((Unit*)result);
break;
}
}
else
{
if (m_caster->GetTypeId()==TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
finish(false);
}
}
break;
}
}
break;
}
default :
{
TagUnitMap.push_back(m_caster);
break;
}
}
break;
}
case TARGET_RANDOM_ENEMY_CHAIN_IN_AREA:
{
m_targets.m_targetMask = 0;
Expand Down
1 change: 1 addition & 0 deletions src/game/Spell.h
Expand Up @@ -373,6 +373,7 @@ class Spell
typedef std::list<Unit*> UnitList;
void FillTargetMap();
void SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap);
void FillCustomTargetMap(uint32 i, UnitList& TagUnitMap);

void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets );
void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster );
Expand Down

0 comments on commit 1da09d3

Please sign in to comment.