EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Project Illusion AA (https://www.eqemulator.org/forums/showthread.php?t=26289)

seveianrex 09-24-2008 08:59 AM

Project Illusion AA
 
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:
Code:

bool IsPlayerIllusionSpell(int16 spell_id); // seveian 2008-09-23
{spdat.cpp}
At bottom of file, add:
Code:

// 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
Code:

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
Code:

                // 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.)
Code:

        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:
Code:

        //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:
Code:

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

After this snippet:
Code:

        //
        // 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):

Code:

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


seveianrex 09-26-2008 11:43 PM

Sorry, need to post a change to this:

in {spells.cpp}

The line:
Code:

&& !spell_target // null ptr crash safeguard
Is supposed to read:
Code:

&& spell_target != NULL // null ptr crash safeguard


All times are GMT -4. The time now is 08:30 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.