Log in

View Full Version : Project Illusion AA


seveianrex
09-24-2008, 08:59 AM
Hello. Here is my completed Project Illusion AA code. I have tested it. I apologize for not having that nifty .patch format but I couldn't get WinMerge to work :P

{spdat.h}
At bottom of file, add:

bool IsPlayerIllusionSpell(int16 spell_id); // seveian 2008-09-23


{spdat.cpp}
At bottom of file, add:

// seveian 2008-09-23
bool IsPlayerIllusionSpell(int16 spell_id) {
return (spells[spell_id].effectdescnum == 49);
}


{AA.h}
In the enum aaEffectType, add a new item

aaEffectProjectIllusion // seveian 2008-09-23


{AA.cpp}
in the void Client::HandleAAAction(aaID activate), locate the switch(caa->action) and add the following case statement

// seveian 2008-09-23
case aaActionProjectIllusion:
EnableAAEffect(aaEffectProjectIllusion, 3600);
Message(10, "The power of your next illusion spell will flow to your grouped target in your place.");
break;


{spells.cpp}
in the bool Mob::DetermineSpellTargets, after the line "bodyType target_bt = BT_Humanoid;", add the following (NOTE: The switch I ended off with in my snippet above should _REPLACE_ the existing switch.)

SpellTargetType targetType = spells[spell_id].targettype;

// seveian 2008-09-23
if(IsPlayerIllusionSpell(spell_id)
&& !spell_target // null ptr crash safeguard
&& !spell_target->IsNPC() // still self only if NPC targetted
&& IsClient()
&& IsGrouped() // still self only if not grouped
&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
targetType = ST_GroupClient;
}

switch (targetType)


In bool Mob::SpellFinished, after this snippet:

//range check our target, if we have one and it is not us
float range = spells[spell_id].range;
if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id) && IsGroupSpell(spell_id))
range = spells[spell_id].aoerange;
range = GetActSpellRange(spell_id, range);


Add this:

// seveian 2008-09-23
if(IsPlayerIllusionSpell(spell_id)
&& IsClient()
&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
range = 100;
}


After this snippet:

//
// solar: Switch #2 - execute the spell
//
switch(CastAction)
{
default:
case CastActUnknown:
case SingleTarget:
{
if(spell_target == NULL) {
mlog(SPELLS__CASTING, "Spell %d: Targeted spell, but we have no target", spell_id);
return(false);
}
SpellOnTarget(spell_id, spell_target);


Add this (before the break):


// seveian 2008-09-23
if(IsPlayerIllusionSpell(spell_id)
&& IsClient()
&& CastToClient()->CheckAAEffect(aaEffectProjectIllusion)){
CastToClient()->DisableAAEffect(aaEffectProjectIllusion);
}

janusd
09-24-2008, 10:29 AM
Awesome! This will make chanters more fun for lots of people... now if you can get Critical Affliction for necromancers to work that would be awesome. Or perhaps the pet focus on items to work...

seveianrex
09-25-2008, 06:05 AM
Do HoT Crits work either?

seveianrex
09-25-2008, 06:18 AM
For anyone attempting to test this out, you also need to run the following query to the database:


UPDATE `altadv_vars` SET `hotkey_sid`='5662', `hotkey_sid2`='5663' WHERE `skill_id`='643'


(Or just manually set hotkey_sid and hotkey_sid2 to 5662/5663 respectively for the Project Illusion row in the altadv_vars table)

(thanks AndMetal for the string values)