--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-27 14:54:54 -06:00
13 changed files with 244 additions and 184 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
INSERT INTO `spell_script_target` VALUES REPLACE INTO `spell_script_target` VALUES
(33655,0,183350), (33655,0,183350),
(33655,0,183351), (33655,0,183351),
(44374,1,24722), (44374,1,24722),
+1
View File
@@ -0,0 +1 @@
update creature_template set scriptname = 'npc_enraged_spirit' where entry in (21050, 21061, 21060, 21059);
+1
View File
@@ -161,4 +161,5 @@ INSTALL(FILES
965_world_scripts.sql 965_world_scripts.sql
966_world_scripts.sql 966_world_scripts.sql
970_world_scripts.sql 970_world_scripts.sql
973_world_scripts.sql
DESTINATION share/trinity/sql/updates) DESTINATION share/trinity/sql/updates)
@@ -17,7 +17,7 @@
/* ScriptData /* ScriptData
SDName: Shadowmoon_Valley SDName: Shadowmoon_Valley
SD%Complete: 100 SD%Complete: 100
SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 11082, 10781, 10451. Vendor Drake Dealer Hurlunk. SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 10458, 10481, 10480, 11082, 10781, 10451. Vendor Drake Dealer Hurlunk.
SDCategory: Shadowmoon Valley SDCategory: Shadowmoon Valley
EndScriptData */ EndScriptData */
@@ -36,6 +36,7 @@ mob_torloth_the_magnificent
mob_illidari_spawn mob_illidari_spawn
npc_lord_illidan_stormrage npc_lord_illidan_stormrage
go_crystal_prison go_crystal_prison
npc_enraged_spirit
EndContentData */ EndContentData */
#include "precompiled.h" #include "precompiled.h"
@@ -958,7 +959,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
} }
((Creature*)CoilskarAssassin)->AI()->AttackStart(m_creature); ((Creature*)CoilskarAssassin)->AI()->AttackStart(m_creature);
} }
else error_log("SD2 ERROR: Coilskar Assassin couldn't be summmoned"); else error_log("TSCR ERROR: Coilskar Assassin couldn't be summmoned");
} }
void JustDied(Unit* killer) void JustDied(Unit* killer)
@@ -1636,6 +1637,120 @@ CreatureAI* GetAI_mob_torloth_the_magnificent(Creature* c)
return new mob_torloth_the_magnificentAI(c); return new mob_torloth_the_magnificentAI(c);
} }
/*####
# npc_enraged_spirits
####*/
/* QUESTS */
#define QUEST_ENRAGED_SPIRITS_FIRE_EARTH 10458
#define QUEST_ENRAGED_SPIRITS_AIR 10481
#define QUEST_ENRAGED_SPIRITS_WATER 10480
/* Totem */
#define ENTRY_TOTEM_OF_SPIRITS 21071
#define RADIUS_TOTEM_OF_SPIRITS 15
/* SPIRITS */
#define ENTRY_ENRAGED_EARTH_SPIRIT 21050
#define ENTRY_ENRAGED_FIRE_SPIRIT 21061
#define ENTRY_ENRAGED_AIR_SPIRIT 21060
#define ENTRY_ENRAGED_WATER_SPIRIT 21059
/* SOULS */
#define ENTRY_EARTHEN_SOUL 21073
#define ENTRY_FIERY_SOUL 21097
#define ENTRY_ENRAGED_AIRY_SOUL 21116
#define ENTRY_ENRAGED_WATERY_SOUL 21109 // wrong model
/* SPELL KILLCREDIT - not working!?! - using KilledMonster */
#define SPELL_EARTHEN_SOUL_CAPTURED_CREDIT 36108
#define SPELL_FIERY_SOUL_CAPTURED_CREDIT 36117
#define SPELL_AIRY_SOUL_CAPTURED_CREDIT 36182
#define SPELL_WATERY_SOUL_CAPTURED_CREDIT 36171
/* KilledMonster Workaround */
#define CREDIT_FIRE 21094
#define CREDIT_WATER 21095
#define CREDIT_AIR 21096
#define CREDIT_EARTH 21092
/* Captured Spell/Buff */
#define SPELL_SOUL_CAPTURED 36115
/* Factions */
#define ENRAGED_SOUL_FRIENDLY 35
#define ENRAGED_SOUL_HOSTILE 14
struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI
{
npc_enraged_spiritAI(Creature *c) : ScriptedAI(c) {Reset();}
void Reset() { }
void Aggro(Unit *who){}
void JustDied(Unit* killer)
{
// always spawn spirit on death
// if totem around
// move spirit to totem and cast kill count
uint32 entry = 0;
uint32 credit = 0;
switch(m_creature->GetEntry()) {
case ENTRY_ENRAGED_FIRE_SPIRIT:
entry = ENTRY_FIERY_SOUL;
//credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT;
credit = CREDIT_FIRE;
break;
case ENTRY_ENRAGED_EARTH_SPIRIT:
entry = ENTRY_EARTHEN_SOUL;
//credit = SPELL_EARTHEN_SOUL_CAPTURED_CREDIT;
credit = CREDIT_EARTH;
break;
case ENTRY_ENRAGED_AIR_SPIRIT:
entry = ENTRY_ENRAGED_AIRY_SOUL;
//credit = SPELL_AIRY_SOUL_CAPTURED_CREDIT;
credit = CREDIT_AIR;
break;
case ENTRY_ENRAGED_WATER_SPIRIT:
entry = ENTRY_ENRAGED_WATERY_SOUL;
//credit = SPELL_WATERY_SOUL_CAPTURED_CREDIT;
credit = CREDIT_WATER;
break;
}
// Spawn Soul on Kill ALWAYS!
Creature* Summoned = NULL;
Unit* totemOspirits = NULL;
if ( entry != 0 )
Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
// FIND TOTEM, PROCESS QUEST
if (Summoned)
{
totemOspirits = FindCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS, m_creature);
if (totemOspirits)
{
Summoned->setFaction(ENRAGED_SOUL_FRIENDLY);
Summoned->GetMotionMaster()->MovePoint(0,totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ());
Player* Owner = (Player*)totemOspirits->GetOwner();
if (Owner)
// DoCast(Owner, credit); -- not working!
Owner->KilledMonster(credit, Summoned->GetGUID());
DoCast(totemOspirits,SPELL_SOUL_CAPTURED);
}
}
}
};
CreatureAI* GetAI_npc_enraged_spirit(Creature *_Creature)
{
return new npc_enraged_spiritAI(_Creature);
}
/*##### /*#####
# #
######*/ ######*/
@@ -1708,21 +1823,26 @@ void AddSC_shadowmoon_valley()
newscript = new Script; newscript = new Script;
newscript->Name = "npc_lord_illidan_stormrage"; newscript->Name = "npc_lord_illidan_stormrage";
newscript->GetAI = GetAI_npc_lord_illidan_stormrage; newscript->GetAI = &GetAI_npc_lord_illidan_stormrage;
newscript->RegisterSelf(); newscript->RegisterSelf();
newscript = new Script; newscript = new Script;
newscript->Name = "go_crystal_prison"; newscript->Name = "go_crystal_prison";
newscript->pGOQuestAccept = GOQuestAccept_GO_crystal_prison; newscript->pGOQuestAccept = &GOQuestAccept_GO_crystal_prison;
newscript->RegisterSelf(); newscript->RegisterSelf();
newscript = new Script; newscript = new Script;
newscript->Name = "mob_illidari_spawn"; newscript->Name = "mob_illidari_spawn";
newscript->GetAI = GetAI_mob_illidari_spawn; newscript->GetAI = &GetAI_mob_illidari_spawn;
newscript->RegisterSelf(); newscript->RegisterSelf();
newscript = new Script; newscript = new Script;
newscript->Name = "mob_torloth_the_magnificent"; newscript->Name = "mob_torloth_the_magnificent";
newscript->GetAI = GetAI_mob_torloth_the_magnificent; newscript->GetAI = &GetAI_mob_torloth_the_magnificent;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_enraged_spirit";
newscript->GetAI = &GetAI_npc_enraged_spirit;
newscript->RegisterSelf(); newscript->RegisterSelf();
} }
+3 -5
View File
@@ -96,14 +96,12 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove)
else //Walking on the ground else //Walking on the ground
dist = sqrt((dx*dx) + (dy*dy)); dist = sqrt((dx*dx) + (dy*dy));
float speed;
if(traveller.GetTraveller().hasUnitState(UNIT_STAT_CHARGING)) if(traveller.GetTraveller().hasUnitState(UNIT_STAT_CHARGING))
i_totalTravelTime = 1000; speed = 0.025f; // assume it is 25 yard per second
else else
{ speed = traveller.Speed() * 0.001f; // speed is in seconds so convert from second to millisecond
float speed = traveller.Speed();
speed *= 0.001f; // speed is in seconds so convert from second to millisecond
i_totalTravelTime = static_cast<uint32>(dist/speed); i_totalTravelTime = static_cast<uint32>(dist/speed);
}
i_timeElapsed = 0; i_timeElapsed = 0;
if(sendMove) if(sendMove)
+1 -2
View File
@@ -867,8 +867,7 @@ enum Targets
TARGET_DEST_CASTER_BACK_LEFT = 42, //water totem TARGET_DEST_CASTER_BACK_LEFT = 42, //water totem
TARGET_DEST_CASTER_BACK_RIGHT = 43, //air totem TARGET_DEST_CASTER_BACK_RIGHT = 43, //air totem
TARGET_DEST_CASTER_FRONT_RIGHT = 44, //fire totem TARGET_DEST_CASTER_FRONT_RIGHT = 44, //fire totem
TARGET_CHAIN_HEAL = 45, TARGET_UNIT_CHAINHEAL = 45,
//TARGET_UNIT_CHAINHEAL
TARGET_SCRIPT_COORDINATES = 46, TARGET_SCRIPT_COORDINATES = 46,
//TARGET_DEST_NEARBY_ENTRY //TARGET_DEST_NEARBY_ENTRY
TARGET_DEST_CASTER_FRONT = 47, TARGET_DEST_CASTER_FRONT = 47,
+95 -132
View File
@@ -1215,6 +1215,7 @@ struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*,
{ {
return (ChainHealingHash(_Left) < ChainHealingHash(_Right)); return (ChainHealingHash(_Left) < ChainHealingHash(_Right));
} }
int32 ChainHealingHash(Unit const* Target) const int32 ChainHealingHash(Unit const* Target) const
{ {
if (Target == MainTarget) if (Target == MainTarget)
@@ -1232,18 +1233,6 @@ struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*,
} }
}; };
class ChainHealingFullHealth: std::unary_function<const Unit*, bool>
{
public:
const Unit* MainTarget;
ChainHealingFullHealth(const Unit* Target) : MainTarget(Target) {};
bool operator()(const Unit* Target)
{
return (Target != MainTarget && Target->GetHealth() == Target->GetMaxHealth());
}
};
// Helper for targets nearest to the spell target // Helper for targets nearest to the spell target
// The spell target is always first unless there is a target at _completely_ the same position (unbelievable case) // The spell target is always first unless there is a target at _completely_ the same position (unbelievable case)
struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit, bool> struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit, bool>
@@ -1257,9 +1246,10 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
} }
}; };
void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, Unit* pUnitTarget, float max_range, uint32 unMaxTargets) void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uint32 num, SpellTargets TargetType)
{ {
if(!pUnitTarget) Unit *cur = m_targets.getUnitTarget();
if(!cur)
return; return;
// Get spell max affected targets // Get spell max affected targets
@@ -1274,48 +1264,60 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, Unit* pUnitTarget, f
//FIXME: This very like horrible hack and wrong for most spells //FIXME: This very like horrible hack and wrong for most spells
if(m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE) if(m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE)
max_range += unMaxTargets * CHAIN_SPELL_JUMP_RADIUS; max_range += num * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit *> tempUnitMap; std::list<Unit*> tempUnitMap;
Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, m_caster, max_range); if(TargetType == SPELL_TARGETS_CHAINHEAL)
Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); {
m_caster->VisitNearbyObject(max_range, searcher); SearchAreaTarget(tempUnitMap, max_range, PUSH_TARGET_CENTER, SPELL_TARGETS_ALLY);
tempUnitMap.sort(ChainHealingOrder(m_caster));
if(cur->GetHealth() == cur->GetMaxHealth() && tempUnitMap.size())
cur = tempUnitMap.front();
}
else
SearchAreaTarget(tempUnitMap, max_range, PUSH_TARGET_CENTER, TargetType);
tempUnitMap.remove(cur);
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget)); while(num)
{
TagUnitMap.push_back(cur);
--num;
if(tempUnitMap.empty()) if(tempUnitMap.empty())
return;
uint32 t = unMaxTargets;
if(pUnitTarget != m_caster)
{
if(*tempUnitMap.begin() == pUnitTarget)
tempUnitMap.erase(tempUnitMap.begin());
TagUnitMap.push_back(pUnitTarget);
--t;
}
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempUnitMap.begin();
while(t && next != tempUnitMap.end())
{
if(prev->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
break; break;
if(!prev->IsWithinLOSInMap(*next) std::list<Unit*>::iterator next;
|| m_spellInfo->DmgClass==SPELL_DAMAGE_CLASS_MELEE && !m_caster->isInFront(*next, max_range))
if(TargetType == SPELL_TARGETS_CHAINHEAL)
{
next = tempUnitMap.begin();
while(cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS
|| !cur->IsWithinLOSInMap(*next))
{ {
++next; ++next;
continue; if(next == tempUnitMap.end())
return;
}
}
else
{
tempUnitMap.sort(TargetDistanceOrder(cur));
next = tempUnitMap.begin();
if(cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
break;
while(!cur->IsWithinLOSInMap(*next)
|| m_spellInfo->DmgClass==SPELL_DAMAGE_CLASS_MELEE
&& !m_caster->isInFront(*next, max_range))
{
++next;
if(next == tempUnitMap.end() || cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
return;
}
} }
prev = *next; cur = *next;
TagUnitMap.push_back(prev);
tempUnitMap.erase(next); tempUnitMap.erase(next);
tempUnitMap.sort(TargetDistanceOrder(prev));
next = tempUnitMap.begin();
--t;
} }
} }
@@ -1332,11 +1334,22 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
x = m_targets.m_destX; x = m_targets.m_destX;
y = m_targets.m_destY; y = m_targets.m_destY;
} }
else else if(type == PUSH_SELF_CENTER)
{ {
x = m_caster->GetPositionX(); x = m_caster->GetPositionX();
y = m_caster->GetPositionY(); y = m_caster->GetPositionY();
} }
else if(type == PUSH_TARGET_CENTER)
{
Unit *target = m_targets.getUnitTarget();
if(!target)
{
sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id );
return;
}
x = target->GetPositionX();
y = target->GetPositionY();
}
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry); Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry);
if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY) if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
@@ -1368,13 +1381,13 @@ Unit* Spell::SearchNearbyTarget(float radius, SpellTargets TargetType, uint32 en
} }
} }
default: default:
case SPELL_TARGETS_AOE_DAMAGE: case SPELL_TARGETS_ENEMY:
{ {
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, radius); Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, radius);
Trinity::UnitLastSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(target, u_check); Trinity::UnitLastSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(target, u_check);
m_caster->VisitNearbyObject(radius, searcher); m_caster->VisitNearbyObject(radius, searcher);
}break; }break;
case SPELL_TARGETS_FRIENDLY: case SPELL_TARGETS_ALLY:
{ {
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, radius); Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, radius);
Trinity::UnitLastSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(target, u_check); Trinity::UnitLastSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(target, u_check);
@@ -1467,13 +1480,16 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
target->GetPartyMember(TagUnitMap, radius); target->GetPartyMember(TagUnitMap, radius);
break; break;
case TARGET_UNIT_TARGET_ENEMY: case TARGET_UNIT_TARGET_ENEMY:
if(Unit* pUnitTarget = SelectMagnetTarget())
{
if(EffectChainTarget <= 1) if(EffectChainTarget <= 1)
TagUnitMap.push_back(pUnitTarget); TagUnitMap.push_back(SelectMagnetTarget());
else //TODO: chain target should also use magnet target else if(SelectMagnetTarget()) //TODO: chain target should also use magnet target
SearchChainTarget(TagUnitMap, pUnitTarget, radius, EffectChainTarget); SearchChainTarget(TagUnitMap, radius, EffectChainTarget, SPELL_TARGETS_ENEMY);
} break;
case TARGET_UNIT_CHAINHEAL:
if(EffectChainTarget <= 1)
TagUnitMap.push_back(target);
else
SearchChainTarget(TagUnitMap, radius, EffectChainTarget, SPELL_TARGETS_CHAINHEAL);
break; break;
} }
}break; }break;
@@ -1520,12 +1536,12 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
case TARGET_UNIT_AREA_ENEMY_GROUND: case TARGET_UNIT_AREA_ENEMY_GROUND:
m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION;
case TARGET_UNIT_AREA_ENEMY: case TARGET_UNIT_AREA_ENEMY:
SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_ENEMY);
break; break;
case TARGET_UNIT_AREA_ALLY_GROUND: case TARGET_UNIT_AREA_ALLY_GROUND:
m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION;
case TARGET_UNIT_AREA_ALLY: case TARGET_UNIT_AREA_ALLY:
SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY); SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_ALLY);
break; break;
case TARGET_UNIT_AREA_PARTY_GROUND: case TARGET_UNIT_AREA_PARTY_GROUND:
m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION;
@@ -1540,7 +1556,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id);
if(lower==upper) if(lower==upper)
{ {
SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_ENEMY);
sLog.outErrorDb("Spell (ID: %u) (caster Entry: %u) does not have record in `spell_script_target`", m_spellInfo->Id, m_caster->GetEntry()); sLog.outErrorDb("Spell (ID: %u) (caster Entry: %u) does not have record in `spell_script_target`", m_spellInfo->Id, m_caster->GetEntry());
break; break;
} }
@@ -1599,33 +1615,40 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
case TARGET_IN_FRONT_OF_CASTER: case TARGET_IN_FRONT_OF_CASTER:
case TARGET_UNIT_CONE_ENEMY_UNKNOWN: case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
if(m_customAttr & SPELL_ATTR_CU_CONE_BACK) if(m_customAttr & SPELL_ATTR_CU_CONE_BACK)
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE); SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_ENEMY);
else if(m_customAttr & SPELL_ATTR_CU_CONE_LINE) else if(m_customAttr & SPELL_ATTR_CU_CONE_LINE)
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_ENEMY);
else else
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_AOE_DAMAGE); SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_ENEMY);
break; break;
case TARGET_UNIT_CONE_ALLY: case TARGET_UNIT_CONE_ALLY:
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_ALLY);
break; break;
// nearby target // nearby target
case TARGET_UNIT_NEARBY_ALLY: case TARGET_UNIT_NEARBY_ALLY:
case TARGET_UNIT_NEARBY_ALLY_UNK: case TARGET_UNIT_NEARBY_ALLY_UNK:
{ if(!m_targets.getUnitTarget())
if(Unit* pUnitTarget = SearchNearbyTarget(radius, SPELL_TARGETS_FRIENDLY)) m_targets.setUnitTarget(SearchNearbyTarget(radius, SPELL_TARGETS_ALLY));
TagUnitMap.push_back(pUnitTarget); if(m_targets.getUnitTarget())
}break;
case TARGET_UNIT_NEARBY_ENEMY:
{ {
if(EffectChainTarget <= 1) if(EffectChainTarget <= 1)
{ TagUnitMap.push_back(m_targets.getUnitTarget());
if(Unit* pUnitTarget = SearchNearbyTarget(radius, SPELL_TARGETS_AOE_DAMAGE))
TagUnitMap.push_back(pUnitTarget);
}
else else
SearchChainTarget(TagUnitMap, m_caster, radius, EffectChainTarget); SearchChainTarget(TagUnitMap, radius, EffectChainTarget, SPELL_TARGETS_ALLY);
}break; }
break;
case TARGET_UNIT_NEARBY_ENEMY:
if(!m_targets.getUnitTarget())
m_targets.setUnitTarget(SearchNearbyTarget(radius, SPELL_TARGETS_ENEMY));
if(m_targets.getUnitTarget())
{
if(EffectChainTarget <= 1)
TagUnitMap.push_back(m_targets.getUnitTarget());
else
SearchChainTarget(TagUnitMap, radius, EffectChainTarget, SPELL_TARGETS_ENEMY);
}
break;
case TARGET_SCRIPT: case TARGET_SCRIPT:
case TARGET_SCRIPT_COORDINATES: case TARGET_SCRIPT_COORDINATES:
case TARGET_UNIT_AREA_SCRIPT: case TARGET_UNIT_AREA_SCRIPT:
@@ -1722,66 +1745,6 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TagUnitMap.push_back(m_caster); TagUnitMap.push_back(m_caster);
break; break;
} }
case TARGET_CHAIN_HEAL:
{
Unit* pUnitTarget = m_targets.getUnitTarget();
if(!pUnitTarget)
break;
if (EffectChainTarget <= 1)
TagUnitMap.push_back(pUnitTarget);
else
{
unMaxTargets = EffectChainTarget;
float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit *> tempUnitMap;
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, tempUnitMap, max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
m_caster->VisitNearbyObject(max_range, notifier);
if(m_caster != pUnitTarget && std::find(tempUnitMap.begin(),tempUnitMap.end(),m_caster) == tempUnitMap.end() )
tempUnitMap.push_front(m_caster);
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
if(tempUnitMap.empty())
break;
if(*tempUnitMap.begin() == pUnitTarget)
tempUnitMap.erase(tempUnitMap.begin());
TagUnitMap.push_back(pUnitTarget);
uint32 t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempUnitMap.begin();
while(t && next != tempUnitMap.end() )
{
if(prev->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS)
break;
if(!prev->IsWithinLOSInMap(*next))
{
++next;
continue;
}
if((*next)->GetHealth() == (*next)->GetMaxHealth())
{
next = tempUnitMap.erase(next);
continue;
}
prev = *next;
TagUnitMap.push_back(prev);
tempUnitMap.erase(next);
tempUnitMap.sort(TargetDistanceOrder(prev));
next = tempUnitMap.begin();
--t;
}
}
}break;
case TARGET_AREAEFFECT_PARTY_AND_CLASS: case TARGET_AREAEFFECT_PARTY_AND_CLASS:
{ {
Player* targetPlayer = m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER Player* targetPlayer = m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER
+10 -7
View File
@@ -108,6 +108,7 @@ enum SpellNotifyPushType
PUSH_IN_LINE, PUSH_IN_LINE,
PUSH_SELF_CENTER, PUSH_SELF_CENTER,
PUSH_DEST_CENTER, PUSH_DEST_CENTER,
PUSH_TARGET_CENTER,
}; };
bool IsQuestTameSpell(uint32 spellId); bool IsQuestTameSpell(uint32 spellId);
@@ -228,9 +229,10 @@ enum ReplenishType
enum SpellTargets enum SpellTargets
{ {
SPELL_TARGETS_FRIENDLY, SPELL_TARGETS_ALLY,
SPELL_TARGETS_AOE_DAMAGE, SPELL_TARGETS_ENEMY,
SPELL_TARGETS_ENTRY SPELL_TARGETS_ENTRY,
SPELL_TARGETS_CHAINHEAL,
}; };
#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL 1000 #define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL 1000
@@ -579,8 +581,9 @@ class Spell
bool IsAliveUnitPresentInTargetList(); bool IsAliveUnitPresentInTargetList();
void SearchAreaTarget(std::list<Unit*> &data, float radius, const uint32 &type, void SearchAreaTarget(std::list<Unit*> &data, float radius, const uint32 &type,
SpellTargets TargetType, uint32 entry = 0); SpellTargets TargetType, uint32 entry = 0);
void SearchChainTarget(std::list<Unit*> &data, float radius, uint32 unMaxTargets,
SpellTargets TargetType);
Unit* SearchNearbyTarget(float radius, SpellTargets TargetType, uint32 entry = 0); Unit* SearchNearbyTarget(float radius, SpellTargets TargetType, uint32 entry = 0);
void SearchChainTarget(std::list<Unit*> &data, Unit* pUnitTarget, float max_range, uint32 unMaxTargets);
bool IsValidSingleTargetEffect(Unit const* target, Targets type) const; bool IsValidSingleTargetEffect(Unit const* target, Targets type) const;
bool IsValidSingleTargetSpell(Unit const* target) const; bool IsValidSingleTargetSpell(Unit const* target) const;
void CalculateDamageDoneForAllTargets(); void CalculateDamageDoneForAllTargets();
@@ -624,7 +627,7 @@ namespace Trinity
uint32 i_entry; uint32 i_entry;
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type, SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
SpellTargets TargetType = SPELL_TARGETS_AOE_DAMAGE, uint32 entry = 0) SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0)
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry) : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry)
{ {
i_caster = spell.GetCaster(); i_caster = spell.GetCaster();
@@ -644,11 +647,11 @@ namespace Trinity
switch (i_TargetType) switch (i_TargetType)
{ {
case SPELL_TARGETS_FRIENDLY: case SPELL_TARGETS_ALLY:
if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() )) if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() ))
continue; continue;
break; break;
case SPELL_TARGETS_AOE_DAMAGE: case SPELL_TARGETS_ENEMY:
{ {
if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem()) if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem())
continue; continue;
+1
View File
@@ -106,6 +106,7 @@ SpellMgr::SpellMgr()
case TARGET_UNIT_TARGET_ENEMY: case TARGET_UNIT_TARGET_ENEMY:
case TARGET_UNIT_TARGET_PARTY: case TARGET_UNIT_TARGET_PARTY:
case TARGET_UNIT_PARTY_TARGET: case TARGET_UNIT_PARTY_TARGET:
case TARGET_UNIT_CHAINHEAL:
SpellTargetType[i] = TARGET_TYPE_UNIT_TARGET; SpellTargetType[i] = TARGET_TYPE_UNIT_TARGET;
break; break;
case TARGET_UNIT_CHANNEL: case TARGET_UNIT_CHANNEL:
-5
View File
@@ -533,11 +533,6 @@ void World::LoadConfigSettings(bool reload)
///- Read other configuration items from the config file ///- Read other configuration items from the config file
///- Do we allow flying mounts in Azeroth/Outland and others (others being instances, BGs, arenas)?
m_configs[CONFIG_FLYING_MOUNTS_AZEROTH] = sConfig.GetBoolDefault("FlyingMounts.Azeroth", false);
m_configs[CONFIG_FLYING_MOUNTS_OUTLAND] = sConfig.GetBoolDefault("FlyingMounts.Outland", true);
m_configs[CONFIG_FLYING_MOUNTS_OTHERS] = sConfig.GetBoolDefault("FlyingMounts.Others", false);
m_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1); m_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1);
if(m_configs[CONFIG_COMPRESSION] < 1 || m_configs[CONFIG_COMPRESSION] > 9) if(m_configs[CONFIG_COMPRESSION] < 1 || m_configs[CONFIG_COMPRESSION] > 9)
{ {
-4
View File
@@ -196,10 +196,6 @@ enum WorldConfigs
CONFIG_ARENA_SEASON_IN_PROGRESS, CONFIG_ARENA_SEASON_IN_PROGRESS,
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,
CONFIG_SKILL_MILLING, CONFIG_SKILL_MILLING,
CONFIG_FLYING_MOUNTS_AZEROTH,
CONFIG_FLYING_MOUNTS_OUTLAND,
CONFIG_FLYING_MOUNTS_OTHERS,
CONFIG_MAX_WHO, CONFIG_MAX_WHO,
CONFIG_BG_START_MUSIC, CONFIG_BG_START_MUSIC,
CONFIG_START_ALL_SPELLS, CONFIG_START_ALL_SPELLS,
+1
View File
@@ -87,6 +87,7 @@ void extractDataFromHG(FILE* EntriesFile, std::string path, bool url, RawData& d
{ {
thash_str[i] = hash_str[i]; thash_str[i] = hash_str[i];
} }
thash_str[12] = '\0';
strcpy(data.hash_str,thash_str); strcpy(data.hash_str,thash_str);
strcpy(data.rev_str,revision_str); strcpy(data.rev_str,revision_str);
-18
View File
@@ -502,21 +502,6 @@ LogColors = ""
# Default: 0 (false) # Default: 0 (false)
# 1 (true) # 1 (true)
# #
# FlyingMounts.Azeroth
# Enable/disable flying mounts in Azeroth (map 0 and 1).
# Default: 0 - off
# 1 - on (may be crashy)
#
# FlyingMounts.Outland
# Enable/disable flying mounts in Outland (map 530).
# Default: 1 - on
# 0 - off
#
# FlyingMounts.Others
# Enable/disable flying mounts in other maps (instances, arenas, BGs, etc).
# Default: 0 - off
# 1 - on (may be crashy)
#
# CastUnstuck # CastUnstuck
# Allow cast or not Unstuck spell at .start or client Help option use # Allow cast or not Unstuck spell at .start or client Help option use
# Default: 1 (true) # Default: 1 (true)
@@ -622,9 +607,6 @@ ActivateWeather = 1
Battleground.CastDeserter = 1 Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Enable = 1 Battleground.QueueAnnouncer.Enable = 1
Battleground.QueueAnnouncer.PlayerOnly = 0 Battleground.QueueAnnouncer.PlayerOnly = 0
FlyingMounts.Azeroth = 0
FlyingMounts.Outland = 1
FlyingMounts.Others = 0
CastUnstuck = 1 CastUnstuck = 1
Instance.IgnoreLevel = 0 Instance.IgnoreLevel = 0
Instance.IgnoreRaid = 0 Instance.IgnoreRaid = 0