Compile Error C++

Hello,

Can you help me please with my problem, because i added new fuction for spell into the core, but and now i have problem with compilation, because some fuction is undeclared identifier.

I added this spell into the core:

[CODE]case 63276: // Mark of the Faceless

            if (caster) 

{

                uint32 count = 0;

                Position *pos = target;

                std::list<Unit*> unitList;

                Trinity::SpellNotifierCreatureAndPlayer notifier(caster, unitList, 15, PUSH_DST_CENTER, SPELL_TARGETS_ENEMY, pos, 0);

                caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, 15, notifier);

                int32 bp = GetAmount();

                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)

                {

                    if (*itr == target)

                        continue;

                    caster->CastCustomSpell(*itr, 63278, NULL, &bp, NULL, true, NULL);

                    count++;

                }

                if (count > 0 && caster->isAlive()) // prevent healing after death

                    caster->DealHeal(caster, bp * 20);

            }

            break;

        case 63802: // Brain Link

            if (caster) 

            {

                std::list<Unit*> unitList;

                target->GetRaidMember(unitList, 80);

                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)

                {

                    Unit* pUnit = *itr;

                    if (pUnit == target || !pUnit->HasAura(63802))

                        continue;


                    // Afflicted targets suffer Shadow damage whenever they are more than 20 yards apart

                    if (target->IsWithinDist(pUnit, 20))

                        target->CastSpell(pUnit, 63804, true, 0, 0);

                    else 

                        target->CastSpell(pUnit, 63803, true, 0, 0);

                    return;

                }

            }

            break;

        case 67039: // argent squire mount

            if (caster && caster->GetOwner())

            {

                if (caster->GetOwner()->IsMounted())

                {

                    if (!caster->IsMounted())

                        caster->Mount(29736);

                }

                else caster->Unmount();

            }

            break;

        case 63382: // Rapid Burst

            {

                caster->CastSpell(target, (target->GetMap()->IsHeroic() ? (urand(0,1) ? 64531 : 64532) : (urand(0,1) ? 63387 : 64019)), true);

            }

            break;

        case 62038: // Biting Cold

            if (target->GetTypeId() == TYPEID_PLAYER)

            {

                // DoT stacks when the target remains stationary for 4 seconds

                if (target->isMoving())

                    target->RemoveAuraFromStack(62039);

                else if (target->HasAura(62039) && GetAmount() && GetAmount() % 4 == 0)

                    target->AddAura(62039, target);

            }

            break;

        case 62039: // Biting Cold damage

        {

            uint8 stackAmount = target->GetAura(62039)->GetStackAmount();

            int32 damage = (int32)(200 * pow(2.0f,stackAmount));

            target->CastCustomSpell(target,62188,&damage,0,0,true);

            break;

        }[/CODE]

And this is my error:

Error 1 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1197

Error 2 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1204

Error 3 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1217

Error 5 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1221

Error 6 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1225

Error 8 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1226

Error 10 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1228

Error 12 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1246

Error 13 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1246

Error 16 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1250

Error 18 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1253

Error 20 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1254

Error 22 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1255

Error 24 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1256

Error 26 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1256

Error 27 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1261

Error 30 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1263

Error 32 error C2065: ‘target’ : undeclared identifier C:\Users\Tarant\Desktop\cenarius.cz\AN\src\server\game\Spells\Auras\SpellAuraEffects.cpp 1263

— Canned message start —

The topic did not belong to the section it was posted in and was moved to Code Development.

— Canned message end —

Unit target = getSelectedUnit();

ok and now i send here full patch for ulduar spell and can you say me your opinion on this patch? please i need know if this patch is good or dangerous.

This is full spell patch for Ulduar:

[CODE]diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp

— a/src/server/game/Entities/Unit/Unit.cpp

+++ b/src/server/game/Entities/Unit/Unit.cpp

@@ -5278,7 +5278,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVi

                 break;

             }
  •            // Sweeping Strikes
    
  •            // Grim Reprisal
    
  •            case 63305:
    
  •            {
    
  •                // return 60% damage to the attacker
    
  •                basepoints0 = int32(damage * 60 / 100);
    
  •                triggered_spell_id = 64039;
    
  •                break;
    
  •            }
    
  •   		// Sweeping Strikes
    
               case 18765:
    
               case 35429:
    
               {
    

diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp

— a/src/server/game/Spells/Auras/SpellAuraEffects.cpp

+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp

@@ -1926,6 +1926,79 @@ void AuraEffect::PeriodicDummyTick(Unit

             break;

     }

     break;
  •   case 63276: // Mark of the Faceless
    
  •            if (caster) {
    
  •                uint32 count = 0;
    
  •                Position *pos = target;
    
  •                std::list<Unit*> unitList;
    
  •                Trinity::SpellNotifierCreatureAndPlayer notifier(caster, unitList, 15, PUSH_DST_CENTER, SPELL_TARGETS_ENEMY, pos, 0);
    
  •                caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, 15, notifier);
    
  •                int32 bp = GetAmount();
    
  •                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •                {
    
  •                    if (*itr == target)
    
  •                        continue;
    
  •                    caster->CastCustomSpell(*itr, 63278, NULL, &bp, NULL, true, NULL);
    
  •                    count++;
    
  •                }
    
  •                if (count > 0 && caster->isAlive()) // prevent healing after death
    
  •                    caster->DealHeal(caster, bp * 20);
    
  •            }
    
  •            break;
    
  •        case 63802: // Brain Link
    
  •            if (caster) 
    
  •            {
    
  •                std::list<Unit*> unitList;
    
  •                target->GetRaidMember(unitList, 80);
    
  •                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •                {
    
  •                    Unit* pUnit = *itr;
    
  •                    if (pUnit == target || !pUnit->HasAura(63802))
    
  •                        continue;
    
  •                    // Afflicted targets suffer Shadow damage whenever they are more than 20 yards apart
    
  •                    if (target->IsWithinDist(pUnit, 20))
    
  •                        target->CastSpell(pUnit, 63804, true, 0, 0);
    
  •                    else 
    
  •                        target->CastSpell(pUnit, 63803, true, 0, 0);
    
  •                    return;
    
  •                }
    
  •            }
    
  •            break;
    
  •        case 67039: // argent squire mount
    
  •            if (caster && caster->GetOwner())
    
  •            {
    
  •                if (caster->GetOwner()->IsMounted())
    
  •                {
    
  •                    if (!caster->IsMounted())
    
  •                        caster->Mount(29736);
    
  •                }
    
  •                else caster->Unmount();
    
  •            }
    
  •            break;
    
  •        case 63382: // Rapid Burst
    
  •            {
    
  •                caster->CastSpell(target, (target->GetMap()->IsHeroic() ? (urand(0,1) ? 64531 : 64532) : (urand(0,1) ? 63387 : 64019)), true);
    
  •            }
    
  •            break;
    
  •        case 62038: // Biting Cold
    
  •            if (target->GetTypeId() == TYPEID_PLAYER)
    
  •            {
    
  •                // DoT stacks when the target remains stationary for 4 seconds
    
  •                if (target->isMoving())
    
  •                    target->RemoveAuraFromStack(62039);
    
  •                else if (target->HasAura(62039) && GetAmount() && GetAmount() % 4 == 0)
    
  •                    target->AddAura(62039, target);
    
  •            }
    
  •            break;
    
  •        case 62039: // Biting Cold damage
    
  •        {
    
  •            uint8 stackAmount = target->GetAura(62039)->GetStackAmount();
    
  •            int32 damage = (int32)(200 * pow(2.0f,stackAmount));
    
  •            target->CastCustomSpell(target,62188,&damage,0,0,true);
    
  •            break;
    
  •        }
    
     case SPELLFAMILY_MAGE:

     {

         // Mirror Image

diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp

— a/src/server/game/Spells/Auras/SpellAuras.cpp

+++ b/src/server/game/Spells/Auras/SpellAuras.cpp

@@ -1125,7 +1125,32 @@ void Aura::HandleAuraSpecificMods(AuraAp

                         target->RemoveAura(61988);

                     break;

                 case 72368: // Shared Suffering
  •                case 72369:
    
  •                 // Hodir Flash Freeze immunity remove
    
  •   			if ((GetId() == 61969 || GetId() == 61990) && removeMode == AURA_REMOVE_BY_DEATH)
    
  •   				target->RemoveAura(7940);
    
  •   			// Spawn blood pool at animal blood wash off
    
  •   			if (GetId() == 46221 && removeMode == AURA_REMOVE_BY_DEFAULT)
    
  •   				target->CastSpell(target, 63471, true, 0, 0, GetCasterGUID());
    
  •   			// Malady of the Mind will attempt to jump to a nearby friend when removed
    
  •   			if ((GetId() == 63830 || GetId() == 63881) && removeMode == AURA_REMOVE_BY_EXPIRE)
    
  •   			{
    
  •   				std::list<Unit*> unitList;
    
  •   				target->GetRaidMember(unitList, 10);
    
  •   				for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •   				{
    
  •   					Unit* pUnit = *itr;
    
  •   					if (pUnit == target)
    
  •   						continue;
    
  •   					pUnit->CastSpell(pUnit, 63881, true, 0, 0);
    
  •   					return;
    
  •   				}
    
  •   			}
    
  •   			// Shadow Beacon
    
  •   			if (GetId() == 64465 && removeMode == AURA_REMOVE_BY_EXPIRE)
    
  •   				target->CastSpell(target, 64468, true, 0, 0, GetCasterGUID());
    
  •   			break;
    
  •   			case 72369:
    
                       if (caster)
    
                       {
    
                           if (AuraEffect* aurEff = GetEffect(0))
    

diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp

— a/src/server/game/Spells/Spell.cpp

+++ b/src/server/game/Spells/Spell.cpp

@@ -2841,8 +2841,34 @@ void Spell::SelectEffectTargets(uint32 i

                     finish(false);

                 }

             }
  •        }
    
  •        for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •            // Lunatic Gaze
    
  •            if (m_spellInfo->Id == 64164 || m_spellInfo->Id == 64168)
    
  •            {
    
  •                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •                {
    
  •                    // Looking into the maw of madness unhinges your mind
    
  •                    if (!(*itr)->isInFront(m_caster, 100, 2.5f))
    
  •                    {
    
  •                        unitList.erase(itr);
    
  •                        break;
    
  •                    }
    
  •                }
    
  •            }
    
  •            // Induce Madness
    
  •            if (m_spellInfo->Id == 64059)
    
  •            {
    
  •                for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
  •                {
    
  •                    // Only on targets with Illusion Room Aura
    
  •                    if (!(*itr)->HasAura(63988))
    
  •                    {
    
  •                        unitList.erase(itr);
    
  •                        break;
    
  •                    }
    
  •                }
    
  •            }
    
  •        }           
    
  •   	for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
    
               AddUnitTarget(*itr, i);
    
       }
    

diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp

— a/src/server/game/Spells/SpellEffects.cpp

+++ b/src/server/game/Spells/SpellEffects.cpp

@@ -1133,7 +1133,7 @@ void Spell::EffectDummy(SpellEffIndex ef

                     return;


                 if (Battleground* bg = m_caster->ToPlayer()->GetBattleground())
  •                    bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
    
  •   				bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
    
    
                   m_caster->CastSpell(m_caster, 30452, true, NULL);
    
                   return;
    

@@ -5169,8 +5169,42 @@ void Spell::EffectScriptEffect(SpellEffI

                 unitTarget->CastSpell(unitTarget, spellTarget[urand(0,4)], true);

                 break;

             }
  •            case 64142:                                 // Upper Deck - Create Foam Sword
    
  •                if (unitTarget->GetTypeId() != TYPEID_PLAYER)
    
  •        }
    
  •        if (unitTarget)
    
  •        {
    
  •            // reduces Sanity by %
    
  •            uint32 sanityCount = 0;
    
  •            switch(m_spellInfo->Id)
    
  •            {
    
  •                case 63803: // Brain Link
    
  •                case 64168: // Lunatic Gaze
    
  •                    sanityCount = 2; break;
    
  •                case 63830: // Malady of the Mind 10
    
  •                case 63881: // Malady of the Mind 25
    
  •                    sanityCount = 3; break;
    
  •                case 64164: // Lunatic Gaze P3
    
  •                    sanityCount = 4; break;
    
  •                case 63795: // Psychosis
    
  •                    sanityCount = 9; break;
    
  •                case 64059: // Induce Madness
    
  •                    sanityCount = 100; break;
    
  •            }
    
  •            if (sanityCount)
    
  •            {
    
  •                if (Aura * aur = unitTarget->GetAura(63050))
    
  •                {
    
  •                    int32 stack = aur->GetStackAmount() - sanityCount;
    
  •                    if (stack <= 0)
    
  •                        unitTarget->RemoveAurasDueToSpell(63050);
    
  •                    else
    
  •                        unitTarget->SetAuraStack(63050, unitTarget, stack);
    
  •                }
    
  •            }
    
  •   		break;
    
  •   	}
    
  •   	case 64142:   // Upper Deck - Create Foam Sword
    
  •   	{
    
  •   		if (unitTarget->GetTypeId() != TYPEID_PLAYER)
    
                       return;
    
                   Player *plr = unitTarget->ToPlayer();
    
                   static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
    

diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp

— a/src/server/game/Spells/SpellMgr.cpp

+++ b/src/server/game/Spells/SpellMgr.cpp

@@ -3571,7 +3571,12 @@ void SpellMgr::LoadSpellCustomAttr()

         spellInfo->excludeCasterAuraSpell = 57724; // Sated

         count++;

         break;
  •    // Heart of the Crusader
    
  •    // Titanic Storm
    
  •    case 64172:
    
  •        spellInfo->excludeTargetAuraSpell = 65294; // Empowered
    
  •        count++;
    
  •        break;
    
  •   // Heart of the Crusader
    
       case 20335:
    
       case 20336:
    
       case 20337:
    

@@ -3652,6 +3657,19 @@ void SpellMgr::LoadSpellCustomAttr()

         spellInfo->EffectImplicitTargetA[1] = TARGET_DST_CASTER;

         count++;

         break;
  •   case 63830: // Malady of the Mind
    
  •    case 63881: // Malady of the Mind proc
    
  •    case 63795: // Psychosis
    
  •        spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ANY;
    
  •        spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_TARGET_ANY;
    
  •        spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_TARGET_ANY;
    
  •        count++;
    
  •        break;
    
  •    case 63802: // Brain Link
    
  •        spellInfo->MaxAffectedTargets = 2;
    
  •        spellInfo->EffectRadiusIndex[0] = 12; // 100 yard
    
  •        count++;
    
  •        break;	
    
       case 41376: // Spite
    
       case 39992: // Needle Spine
    
       case 29576: // Multi-Shot
    

@@ -3738,7 +3756,35 @@ void SpellMgr::LoadSpellCustomAttr()

     case 47203:

     case 47204:

     case 47205:
  •        // add corruption to affected spells
    
  •    case 62661:     // Searing Flames
    
  •    case 61915:     // Lightning Whirl 10
    
  •    case 63483:     // Lightning Whirl 25
    
  •        spellInfo->InterruptFlags = 47;
    
  •        count++;
    
  •        break;
    
  •    case 62345:     // Ram (Ulduar Siege)
    
  •    case 62308:     // Ram (Ulduar Demolisher)
    
  •    case 62714:     // Shadow Nova
    
  •    case 65209:     // Shadow Nova
    
  •        spellInfo->Effect[0] = 0;
    
  •        count++;
    
  •        break;
    
  •    case 63676:     // Focused Eyebeam Visual 2
    
  •    case 63702:     // Focused Eyebeam Visual Right Eye
    
  •        spellInfo->EffectImplicitTargetA[0] = 92;
    
  •        count++;
    
  •        break;
    
  •    case 64145:     // Diminish Power
    
  •        spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
    
  •        count++;
    
  •        break;
    
  •    case 63882:     // Death Ray Warning Visual
    
  •    case 63886:     // Death Ray Damage Visual
    
  •        spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
    
  •        spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ALLY;
    
  •        count++;
    
  •        break;    
    
  •   	// add corruption to affected spells
    
           spellInfo->EffectSpellClassMask[1][0] |= 2;
    
           count++;
    
           break;
    

@@ -3818,11 +3864,30 @@ void SpellMgr::LoadSpellCustomAttr()

         spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;

         count++;

         break;
  •    case 25771: // Forbearance - wrong mechanic immunity in DBC since 3.0.x
    
  •    case 49838:     // Stop time (Amber Drake in oculus)
    
  •        spellInfo->EffectRadiusIndex[0] = 150;
    
  •        count++;
    
  •        break;
    
  •    case 62713:     // Ironbranch's Essence
    
  •    case 62968:     // Brightleaf's Essence
    
  •        spellInfo->DurationIndex = 39;
    
  •        count++;
    
  •        break;
    
  •    case 62775:     // Tympanic Tantrum
    
  •        spellInfo->EffectRadiusIndex[0] = 41; // 150 yard
    
  •        spellInfo->EffectRadiusIndex[1] = 41;
    
  •        count++;
    
  •        break;
    
  •   case 25771: // Forbearance - wrong mechanic immunity in DBC since 3.0.x
    
           spellInfo->EffectMiscValue[0] = MECHANIC_IMMUNE_SHIELD;
    
           count++;
    
           break;
    
  •    case 64321: // Potent Pheromones
    
  •    case 53651:     // beacon of light
    
  •    case 30708:     // totem of wrath debuff
    
  •        spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO;
    
  •        count++;
    
  •        break;
    
  •   case 64321: // Potent Pheromones
    
           // spell should dispel area aura, but doesn't have the attribute
    
           // may be db data bug, or blizz may keep reapplying area auras every update with checking immunity
    
           // that will be clear if we get more spells with problem like this[/CODE]
    

Pls, You say me here yours opinion. Very thanks

[ol][li][*]This code has a terrible style.[/li]
[li]Why you didn’t use a spoiler?[/li]
[li]In the newest revs basepoints calculates with some new fucntions so [/li][CODE]basepoints0 = int32(damage * 60 / 100);

[/CODE]is a bad way.

[li]EffectImplicitTargetA[0] → EffectImplicitTargetA[EFFECT_0] and so on.[/li]
[/ol]

It would also be prefered to use Spellscripts/Aurascripts instead of putting it in the core itself. Other than that, it’s a good start. Keep going /emoticons/default_wink.png.

Position* pos = target;

Either it should be

Position pos;
target->GetPosition(&pos);

or i missed an implicit type conversion implementation in the Unit class

[/CODE]