• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] script error, most convert new script to older core.

Status
Not open for further replies.

Shaorin

Respected Member
hi all.

i need some help, i need a script for me server and its to new for me core^^

the script looks like this:

http://pastebin.com/06kNGqNk

i know its are bad written and it can get mutch better^^

i get this errors:

Code:
1>------ Build started: Project: ACE_Wrappers, Configuration: Release Win32 ------
1>Build started 11/23/2013 8:25:58 AM.
1>InitializeBuildStatus:
1>  Creating "ACE_Wrappers__Win32_Release\ACE_Wrappers.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  All outputs are up-to-date.
1>  All outputs are up-to-date.
1>ResourceCompile:
1>  All outputs are up-to-date.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(E:\BotCore-master\externals\ace\win\VC90\ACE_Wrappers__Win32_Release\ACE_Wrappers.dll) does not match the Linker's OutputFile property value (E:\BotCore-master\externals\ace\bin\Win32_Release\ACE.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(992,5): warning MSB8012: TargetName(ACE_Wrappers) does not match the Linker's OutputFile property value (ACE). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>Link:
1>  All outputs are up-to-date.
1>  ace.vcxproj -> E:\BotCore-master\externals\ace\win\VC90\ACE_Wrappers__Win32_Release\ACE_Wrappers.dll
1>FinalizeBuildStatus:
1>  Deleting file "ACE_Wrappers__Win32_Release\ACE_Wrappers.unsuccessfulbuild".
1>  Touching "ACE_Wrappers__Win32_Release\ACE_Wrappers.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.22
2>------ Build started: Project: shared, Configuration: Release Win32 ------
2>Build started 11/23/2013 8:25:58 AM.
2>InitializeBuildStatus:
2>  Creating "shared__Win32_Release\shared.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>CustomBuild:
2>  Getting Version...
2>ClCompile:
2>  All outputs are up-to-date.
2>  All outputs are up-to-date.
2>Lib:
2>  All outputs are up-to-date.
2>  shared.vcxproj -> E:\BotCore-master\win\VC90\shared__Win32_Release\shared.lib
2>FinalizeBuildStatus:
2>  Deleting file "shared__Win32_Release\shared.unsuccessfulbuild".
2>  Touching "shared__Win32_Release\shared.lastbuildstate".
2>
2>Build succeeded.
2>
2>Time Elapsed 00:00:00.31
3>------ Build started: Project: game, Configuration: Release Win32 ------
3>Build started 11/23/2013 8:25:59 AM.
3>InitializeBuildStatus:
3>  Touching "game__Win32_Release\game.unsuccessfulbuild".
3>ClCompile:
3>  All outputs are up-to-date.
3>  Talent_Chooser.cpp
3>..\..\bin\Talent_Chooser.cpp(4): error C2504: 'CreatureScript' : base class undefined
3>..\..\bin\Talent_Chooser.cpp(6): error C2614: 'Talent_Chooser' : illegal member initialization: 'CreatureScript' is not a base or member
3>
3>Build FAILED.
3>
3>Time Elapsed 00:00:01.08
4>------ Build started: Project: worldserver, Configuration: Release Win32 ------
4>Build started 11/23/2013 8:26:00 AM.
4>InitializeBuildStatus:
4>  Touching "worldserver__Win32_Release\worldserver.unsuccessfulbuild".
4>ClCompile:
4>  All outputs are up-to-date.
4>ResourceCompile:
4>  All outputs are up-to-date.
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(E:\BotCore-master\win\VC90\worldserver__Win32_Release\worldserver.exe) does not match the Linker's OutputFile property value (E:\BotCore-master\bin\Win32_Release\worldserver.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
4>LINK : fatal error LNK1181: cannot open input file 'E:\BotCore-master\win\VC90\game__Win32_Release\game.lib'
4>
4>Build FAILED.
4>
4>Time Elapsed 00:00:00.10
========== Build: 2 succeeded, 2 failed, 6 up-to-date, 0 skipped ==========

and in the script it says:

http://puu.sh/5qEvx.png

for my scripts in the end i needs to look like this:

Code:
void AddSC_crystalsong_forest()
{
    Script *newscript;

    newscript = new Script;
    newscript->Name = "npc_warmage_violetstand";
    newscript->GetAI = &GetAI_npc_warmage_violetstand;
    newscript->RegisterSelf();
}

if it gives you an hit on how it should be written.

thx for you help and support^^
 

Shaorin

Respected Member
?????????

i know its trinity core. i'm not sure if you can see that from my complite log but this is trinitycore just an 4 years old one^^ its not useing Cmake or anything like that^^ so yea i can link you one of the scripts here:

/*
* Copyright (C) 2009 - 2010 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include "ScriptPCH.h"
#include "icecrown_citadel.h"

enum Spells
{
/******** Lady Deathwhisper Spell *********/
SPELL_DEATH_AND_DECAY = 72108,
SPELL_DOMINATE_MIND = 71289,
SPELL_SHADOW_BOLT = 71254,
SPELL_MANA_BARRIER = 70842,
SPELL_DARK_TRANSFORMATION = 70900,
SPELL_DARK_EMPOWEREMENT = 70901,
SPELL_FROST_BOLT = 71420,
SPELL_FROST_BOLT_VALLEY = 72905,
SPELL_SUMMON_SHADE = 71363,
SPELL_INSIGNIFICANCE = 71204,
SPELL_ROOT = 42716,
SPELL_BERSERK = 47008,

/********* Cult Adherents & Reanimated Adherents Spells *********/
SPELL_FROST_FEVER = 71129,
SPELL_DEATHCHILL_BOLT = 70594,
SPELL_DEATHCHILL_BLAST = 70906,
SPELL_DARK_MARTYRDROM = 70903,
SPELL_CURSE_OF_TOPOR = 71237,
SPELL_SHORUD_OF_THE_OCCULUT = 70768,
SPELL_ADHERENTS_DETERMINIATION = 71234,
SPELL_PORT_VISUAL = 41236,

/******* Difficulty Spells *******/
SPELL_DEATH_AND_DECAY_25 = 72110,
SPELL_SHADOW_BOLT_25 = 72008,
H_SPELL_SHADOW_BOLT_10 = 72008,
H_SPELL_SHADOW_BOLT_25 = 72504,
//SPELL_ANIMATED_DEAD = ?????,
N_25_SPELL_FROST_BOLT = 72501,
H_10_SPELL_FROST_BOLT = 72007,
H_25_SPELL_FROST_BOLT = 72502,
H_10_SPELL_FROST_BOLT_VALLEY = 72907,
N_25_SPELL_FROST_BOLT_VALLEY = 72906,
H_25_SPELL_FROST_BOLT_VALLEY = 72909,
H_10_SPELl_FROST_FEVER = 67719,
N_25_SPELL_FROST_FEVER = 67934,
H_25_SPELL_FROST_FEVER = 67978,
N_25_SPELL_DEATHCHILL_BOLT = 72005,
H_10_SPELL_DEATHCHILL_BOLT = 72005,
H_25_SPELL_DEATHCHILL_BOLT = 72489,
H_10_SPELL_DEATHCHILL_BLAST = 72485,
N_25_SPELL_DEATHCHILL_BLAST = 72485,
H_25_SPELL_DEATHCHILL_BLAST = 72487,
H_10_SPELL_DARK_MARTYRDROM = 72497,
N_25_SPELL_DARK_MARTYRDROM = 72497,
//H_25_SPELL_DARK_MARTYRDROM = ?????, // Ungekannte ID
};

enum Summons
{
NPC_CULT_ADHERENT = 37949,
NPC_CULT_FANATIC = 37890,
NPC_VENGEFUL_SHADE = 38222,
};

enum Yells
{
SAY_INTRO_1 = -1665907,
SAY_INTRO_2 = -1665908,
SAY_INTRO_3 = -1665902,
SAY_INTRO_4 = -1665903,
SAY_INTRO_5 = -1665904,
SAY_INTRO_6 = -1665905,
SAY_INTRO_7 = -1665906,

SAY_AGGRO = -1665909,
SAY_PHASE_2 = -1665910,
SAY_EMPOWERMENT = -1665911,
SAY_TRANSFORMATION = -1665912,
SAY_ANIMATE_DEAD = -1665913,
SAY_KILL_1 = -1665917,
SAY_KILL_2 = -1665918,
SAY_BERSERK = -1665915,
SAY_DEATH = -1665916,
};

float SpawnLoc[6][3] =
{
{-620.197449f, 2272.062256f, 50.848679f}, // 1 Right Door 1
{-598.636353f, 2272.062256f, 50.848679f}, // 2 Right Door 2
{-578.495728f, 2272.062256f, 50.848679f}, // 3 Right Door 3
{-578.495728f, 2149.211182f, 50.848679f}, // 4 Left Door 1
{-598.636353f, 2149.211182f, 50.848679f}, // 5 Left Door 2
{-620.197449f, 2149.211182f, 50.848679f}, // 6 Left Door 3
};

float HeroicSpawnLoc[3][3] =
{
{-517.652466f, 2216.611328f, 62.823681f}, // 7 Upper marsh 1
{-517.652466f, 2211.611328f, 62.823681f}, // 8 Upper marsh 2
{-517.652466f, 2206.611328f, 62.823681f}, // 9 Upper marsh 3
};

struct NotCharmedTargetSelector : public std::unary_function<Unit *, bool>
{
NotCharmedTargetSelector() {}

bool operator() (const Unit *pTarget) {
return (!pTarget->isCharmed());
}
};

struct Boss_Lady_DeathwisperAI : public ScriptedAI
{
Boss_Lady_DeathwisperAI(Creature *pCreature) : ScriptedAI(pCreature)
{
m_pInstance = pCreature->GetInstanceData();
}

ScriptedInstance* m_pInstance;

uint32 m_uiPhase;
uint32 m_uiDominateMindTimer;
uint32 m_uiSummonWaveTimer;
uint32 m_uiDeathandDecayTimer;
uint8 m_uiIntroText;
uint32 m_uiIntroTextTimer;
uint32 m_uiFrostBoltTimer;
uint32 m_uiFrostValleyTimer;
uint32 m_uiShadowBoltTimer;
uint32 m_uiDarkEmpoweredTimer;

void Reset()
{
m_uiPhase = 1;
m_uiSummonWaveTimer = 15000;
m_uiDeathandDecayTimer = 10000;
m_uiIntroText = 0;
m_uiIntroTextTimer = 12000;
m_uiFrostBoltTimer = 15000;
m_uiFrostValleyTimer = 5000;
m_uiShadowBoltTimer = urand(5000,10000);
m_uiDarkEmpoweredTimer = 30000;

if (!getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
m_uiDominateMindTimer = 15000;

if (m_pInstance)
m_pInstance->SetData(DATA_DEATHWHISPER_EVENT, NOT_STARTED);
}

void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, me);

if (m_pInstance)
m_pInstance->SetData(DATA_DEATHWHISPER_EVENT, IN_PROGRESS);
}

void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, me);

if (m_pInstance)
m_pInstance->SetData(DATA_DEATHWHISPER_EVENT, DONE);
}

void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me);
}

void MoveInLineOfSight(Unit* pWho)
{
if (me->IsWithinDistInMap(pWho, 50.0f) && m_uiIntroText == 0)
{
DoScriptText(SAY_INTRO_1, me);
m_uiIntroText++;
}
}

void JustSummoned(Creature* pSummoned)
{
pSummoned->CastSpell(pSummoned, SPELL_PORT_VISUAL, false);

if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
pSummoned->AI()->AttackStart(pTarget);
}

void DamageTaken(Unit *done_by, uint32 &damage)
{
if (me->HasAura(SPELL_MANA_BARRIER))
{
me->SetHealth(me->GetHealth()+damage);
me->SetPower(POWER_MANA, me->GetPower(POWER_MANA)>damage ? me->GetPower(POWER_MANA)-damage : 0);
}
}


void AdherentList(Unit* me)
{
me->FindNearestCreature(NPC_CULT_ADHERENT, 200.0f);

std::list<Creature*> pAdherentList;
Trinity::AllCreaturesOfEntryInRange checker(me, NPC_CULT_ADHERENT, 200.0f);
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, pAdherentList, checker);
me->VisitNearbyObject(200.0f, searcher);

if(pAdherentList.empty())
return;

std::list<Creature*>::iterator itr = pAdherentList.begin();
uint32 rnd = rand()%pAdherentList.size();

for(uint32 i = 0; i < rnd; ++i)
++itr;

(*itr)->CastSpell(me, SPELL_DARK_EMPOWEREMENT, true);
}

void FanaticList(Unit* me)
{
me->FindNearestCreature(NPC_CULT_FANATIC, 200.0f);

std::list<Creature*> pFanaticList;
Trinity::AllCreaturesOfEntryInRange checker(me, NPC_CULT_FANATIC, 200.0f);
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, pFanaticList, checker);
me->VisitNearbyObject(200.0f, searcher);

if(pFanaticList.empty())
return;

std::list<Creature*>::iterator itr = pFanaticList.begin();
uint32 rnd = rand()%pFanaticList.size();

for(uint32 i = 0; i < rnd; ++i)
++itr;

(*itr)->CastSpell(me, SPELL_DARK_EMPOWEREMENT, true);
}

void UpdateAI(const uint32 uiDiff)
{
if (m_uiIntroText == 1 || m_uiIntroText == 2 ||
m_uiIntroText == 3 || m_uiIntroText == 4 ||
m_uiIntroText == 5 || m_uiIntroText == 6)
{
if (m_uiIntroTextTimer < uiDiff)
{
switch(m_uiIntroText)
{
case 1: DoScriptText(SAY_INTRO_2, me); break;
case 2: DoScriptText(SAY_INTRO_3, me); break;
case 3: DoScriptText(SAY_INTRO_4, me); break;
case 4: DoScriptText(SAY_INTRO_5, me); break;
case 5: DoScriptText(SAY_INTRO_6, me); break;
case 6: DoScriptText(SAY_INTRO_7, me); break;
}
m_uiIntroText++;
m_uiIntroTextTimer = 10500;
}
else m_uiIntroTextTimer -= uiDiff;
}

if (!UpdateVictim())
return;

if (m_uiPhase == 1)
{
if (m_uiShadowBoltTimer < uiDiff)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(pTarget, SPELL_SHADOW_BOLT);
m_uiShadowBoltTimer = urand(5000,10000);
}
else m_uiShadowBoltTimer -= uiDiff;

if (m_uiDarkEmpoweredTimer < uiDiff)
{
DoScriptText(SAY_EMPOWERMENT, me);
switch(rand() % 2)
{
case 0: AdherentList(me); break;
case 1: FanaticList(me); break;
}
m_uiDarkEmpoweredTimer = urand(25000,30000);
}
else m_uiDarkEmpoweredTimer -= uiDiff;

if (m_uiSummonWaveTimer < uiDiff)
{
for (uint8 i = 0; i < RAID_MODE(3,6,3,6); ++i)
{
me->SummonCreature(RAND(NPC_CULT_FANATIC, NPC_CULT_ADHERENT), SpawnLoc[0], SpawnLoc [1], SpawnLoc[2],0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
}
m_uiSummonWaveTimer = 60000;
}
else m_uiSummonWaveTimer -= uiDiff;

if (!me->HasAura(SPELL_MANA_BARRIER))
DoCast(me, SPELL_MANA_BARRIER);
if (!me->HasAura(SPELL_ROOT))
DoCast(me, SPELL_ROOT);

if (m_uiPhase == 1 || m_uiPhase == 2)
{
if (m_uiDominateMindTimer < uiDiff)
{
uint32 count = RAID_MODE(0,1,1,3);
for (uint8 i = 1; i <= count; i++)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true);
if (pTarget && !pTarget->isCharmed())
{
DoCast(pTarget, SPELL_DOMINATE_MIND);
}
}
m_uiDominateMindTimer = urand(15000,30000);
}
else m_uiDominateMindTimer -= uiDiff;

if (m_uiDeathandDecayTimer < uiDiff)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(pTarget, SPELL_DEATH_AND_DECAY);
m_uiDeathandDecayTimer = urand(10000,12000);
}
else m_uiDeathandDecayTimer -= uiDiff;

if (getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
if (m_uiSummonWaveTimer < uiDiff)
{
for (uint8 i = 0; i < RAID_MODE(3,3,3,3); ++i)
{
me->SummonCreature(RAND(NPC_CULT_FANATIC, NPC_CULT_ADHERENT), HeroicSpawnLoc[0], HeroicSpawnLoc [1], HeroicSpawnLoc[2],0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
}
m_uiSummonWaveTimer = 60000;
}
else m_uiSummonWaveTimer -= uiDiff;
}

if ((me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 1)
{
DoScriptText(SAY_PHASE_2, me);
m_uiPhase = 2;
}
}

if (m_uiPhase == 2)
{
if (me->HasAura(SPELL_MANA_BARRIER))
me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER);

if (me->HasAura(SPELL_ROOT))
me->RemoveAurasDueToSpell(SPELL_ROOT);

if (m_uiFrostBoltTimer < uiDiff)
{
DoCast(me->getVictim(), SPELL_FROST_BOLT);
m_uiFrostBoltTimer = urand(5000,10000);
}
else m_uiFrostBoltTimer -= uiDiff;

if (m_uiFrostValleyTimer < uiDiff)
{
DoCastAOE(SPELL_FROST_BOLT_VALLEY);
m_uiFrostValleyTimer = urand(30000,35000);
}
else m_uiFrostValleyTimer -= uiDiff;

DoMeleeAttackIfReady();
}
}
};

CreatureAI* GetAI_Boss_Lady_Deathwisper(Creature* pCreature)
{
return new Boss_Lady_DeathwisperAI(pCreature);
}

struct CultAdherentsAI : public ScriptedAI
{
CultAdherentsAI(Creature *pCreature) : ScriptedAI(pCreature)
{
}

uint32 uiFrostFeverTimer;
uint32 uiDeathchillBoltTimer;
uint32 uiCurseofToporTimer;
uint32 uiPhaseTimer;

bool m_bIsDarkMartydrom;
bool m_bIsPhase2;

void Reset()
{
uiFrostFeverTimer = 15000;
uiDeathchillBoltTimer = 10000;
uiCurseofToporTimer = urand(10000,20000);
uiPhaseTimer = 120000;

m_bIsDarkMartydrom = false;
m_bIsPhase2 = false;
}

void EnterCombat(Unit* who)
{
DoCast(me, SPELL_SHORUD_OF_THE_OCCULUT);
}

void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;

if (uiFrostFeverTimer < uiDiff)
{
DoCast(me->getVictim(), SPELL_FROST_FEVER);
uiFrostFeverTimer = 15000;
}
else uiFrostFeverTimer -= uiDiff;
if (uiDeathchillBoltTimer < uiDiff)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(pTarget, RAND(SPELL_DEATHCHILL_BLAST, SPELL_DEATHCHILL_BOLT));
uiDeathchillBoltTimer = 5000;
}
else uiDeathchillBoltTimer -= uiDiff;
if (uiCurseofToporTimer < uiDiff)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM);
DoCast(pTarget, SPELL_CURSE_OF_TOPOR);
uiCurseofToporTimer = urand(10000,20000);
}
else uiCurseofToporTimer -= uiDiff;

if (HealthBelowPct(15) && !m_bIsDarkMartydrom)
{
me->CastStop();
DoCast(me, SPELL_DARK_MARTYRDROM);
m_bIsDarkMartydrom = true;
uiPhaseTimer = 5000;
}
if (uiPhaseTimer < uiDiff && !m_bIsPhase2)
{
me->SetHealth(me->GetMaxHealth());
DoCast(me, SPELL_ADHERENTS_DETERMINIATION);
m_bIsPhase2 = true;
}
else uiPhaseTimer -= uiDiff;

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI_CultAdherents(Creature* pCreature)
{
return new CultAdherentsAI (pCreature);
}

void AddSC_boss_Deahtwisper()
{
Script* NewScript;

NewScript = new Script;
NewScript->Name = "Boss_Lady_Deathwisper";
NewScript->GetAI = &GetAI_Boss_Lady_Deathwisper;
NewScript->RegisterSelf();

NewScript = new Script;
NewScript->Name = "mob_CultAdherents";
NewScript->GetAI = &GetAI_CultAdherents;
NewScript->RegisterSelf();
}


hope it helped.
 

Tommy

Founder
Well, it looked pretty obvious what it was considering you didn't mention that it was an old TC source. It looked like MaNGOS, so how was I suppose to know if you didn't mention it was an old TC source? The script you linked won't help considering the script you want converted is Gossip, not CreatureAI. Besides that, when you copied/pasted the script, it makes it humanly impossible to read due to the indentation. If you look at an existing gossip script, you can easily copy what you need from that and convert it with no problem.
 

Shaorin

Respected Member
hmm ok. but first of. if this was mangos why should i then post in "Trinitycores support"? but yea maybe i did but or not but anyway its an old trinitycore.

and to convert it ok? sorry but i don't ahve any c++ EXP so i don't know how to....

here is for gossip:

/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* ScriptData
SDName: Example_Gossip_Codebox
SD%Complete: 100
SDComment: Show a codebox in gossip option
SDCategory: Script Examples
EndScriptData */

#include "ScriptPCH.h"
#include <cstring>

enum eEnums
{
SPELL_POLYMORPH = 12826,
SPELL_MARK_OF_THE_WILD = 26990,

SAY_NOT_INTERESTED = -1999922,
SAY_WRONG = -1999923,
SAY_CORRECT = -1999924
};

#define GOSSIP_ITEM_1 "A quiz: what's your name?"
#define GOSSIP_ITEM_2 "I'm not interested"

//This function is called when the player opens the gossip menubool
bool GossipHello_example_gossip_codebox(Player* pPlayer, Creature* pCreature)
{
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true);
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);

pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());

return true;
}

//This function is called when the player clicks an option on the gossip menubool
bool GossipSelect_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
if (uiAction == GOSSIP_ACTION_INFO_DEF+2)
{
DoScriptText(SAY_NOT_INTERESTED, pCreature);
pPlayer->CLOSE_GOSSIP_MENU();
}

return true;
}

bool GossipSelectWithCode_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode)
{
if (uiSender == GOSSIP_SENDER_MAIN)
{
switch (uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
if (std::strcmp(sCode, pPlayer->GetName()) != 0)
{
DoScriptText(SAY_WRONG, pCreature);
pCreature->CastSpell(pPlayer, SPELL_POLYMORPH, true);
}
else
{
DoScriptText(SAY_CORRECT, pCreature);
pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD, true);
}
pPlayer->CLOSE_GOSSIP_MENU();

return true;
}
}

return false;
}

void AddSC_example_gossip_codebox()
{
Script* newscript;

newscript = new Script;
newscript->Name = "example_gossip_codebox";
newscript->pGossipHello = &GossipHello_example_gossip_codebox;
newscript->pGossipSelect = &GossipSelect_example_gossip_codebox;
newscript->pGossipSelectWithCode = &GossipSelectWithCode_example_gossip_codebox;
newscript->RegisterSelf();
}

if you can help me get in the right way and so on. cuz many ppl only knows the new way, so i don't know where to look^^
 

Tommy

Founder
hmm ok. but first of. if this was mangos why should i then post in "Trinitycores support"? but yea maybe i did but or not but anyway its an old trinitycore.

and to convert it ok? sorry but i don't ahve any c++ EXP so i don't know how to....

here is for gossip:



if you can help me get in the right way and so on. cuz many ppl only knows the new way, so i don't know where to look^^

People have been known to create threads in the wrong section. You're asking me to convert it, but I don't have the source to do so, so some of the methods could be wrong. However, I'll convert it. Simply, you could do it without flaw, all you need to do is try. :p

Anyway, like I said before, I don't have the source so I can't test it for errors, etc. I wish I could've put the spells in an array, but I'm about to go afk for awhile. This is all I could do at the moment. I cleared up the indentation and what you don't need, enjoy.

Code:
#include "ScriptPCH.h"

struct Choice
{
    uint32 action;
    uint8 classId;
    const char* talentName;
};

Choice TalentChoice[] =
{
    /* Paladin */
    { 1, CLASS_PALADIN, "Retribution" },
    { 2, CLASS_PALADIN, "Holy" },
    { 3, CLASS_PALADIN, "Protection" },
    /* Mage */
    { 4, CLASS_MAGE, "Arcane" },
    { 5, CLASS_MAGE, "Fire" },
    { 6, CLASS_MAGE, "Frost" },
    /* Warrior */
    { 7, CLASS_WARRIOR, "Arms" },
    { 8, CLASS_WARRIOR, "Fury" },
    { 9, CLASS_WARRIOR, "Protection" },
    /* Priest */
    { 10, CLASS_PRIEST, "Holy" },
    { 11, CLASS_PRIEST, "Discipline" },
    { 12, CLASS_PRIEST, "Shadow" },
    /* Hunter */
    { 13, CLASS_HUNTER, "Marksman" },
    { 14, CLASS_HUNTER, "Survival" },
    { 15, CLASS_HUNTER, "Beastmaster" },
    /* Rogue */
    { 16, CLASS_ROGUE, "Sub" },
    { 17, CLASS_ROGUE, "Assassination" },
    { 18, CLASS_ROGUE, "Combat" },
    /* Shaman */
    { 19, CLASS_SHAMAN, "Restoration" },
    { 20, CLASS_SHAMAN, "Enchancement" },
    { 21, CLASS_SHAMAN, "Elemental" },
    /* Warlock */
    { 22, CLASS_WARLOCK, "Affliciton" },
    { 23, CLASS_WARLOCK, "Demonology" },
    { 24, CLASS_WARLOCK, "Destruction" },
    /* Druid */
    { 25, CLASS_DRUID, "Feral" },
    { 26, CLASS_DRUID, "Balance" },
    { 27, CLASS_DRUID, "Restoration" },
};

bool Chooser_GossipHello(Player* player, Creature* creature)
{
    for (int i = 0; i < sizeof(TalentChoice) / sizeof(uint32); i++)
        if (player->getClass() == TalentChoice[i].classId)
            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TalentChoice[i].talentName, GOSSIP_SENDER_MAIN, TalentChoice[i].action);
    player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
    return true;
}

bool Chooser_GossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions)
{
    player->PlayerTalkClass->ClearMenus();

    switch(actions)
    {
        /* Paladin */
        case 1: // Retrubition
            player->removeSpell(54428, false);
            player->removeSpell(19746, false);
            player->removeSpell(62124, false);
            player->removeSpell(498, false);
            player->learnSpell(7294, false);
            player->learnSpell(35395, false);
            break;
        case 2: // Holy
            player->removeSpell(62124, false);
            player->removeSpell(498, false);
            player->removeSpell(7294, false);
            player->removeSpell(35395, false);
            player->learnSpell(54428, false);
            player->learnSpell(19746, false);
            break;
        case 3: // Protection
            player->removeSpell(54428, false);
            player->removeSpell(19746, false);
            player->removeSpell(7294, false);
            player->removeSpell(35395, false);
            player->removeSpell(62124, false);
            player->learnSpell(498, false);
            break;
        /* Mage */
        case 4: // Arcane
            player->removeSpell(44614, false);
            player->removeSpell(44457, false);
            player->removeSpell(120, false);
            player->removeSpell(45438, false);
            player->learnSpell(12051, false);
            player->learnSpell(5143, false);
            break;
        case 5: // Fire
            player->removeSpell(12051, false);
            player->removeSpell(5143, false);
            player->removeSpell(120, false);
            player->removeSpell(45438, false);
            player->learnSpell(44614, false);
            player->learnSpell(44457, false);
            break;
        case 6: // Frost
            player->removeSpell(12051, false);
            player->removeSpell(5143, false);
            player->removeSpell(44614, false);
            player->removeSpell(44457, false);
            player->learnSpell(120, false);
            player->learnSpell(45438, false);
            break;
        /* Warrior */
        case 7: // Arms
            player->removeSpell(6572, false);
            player->removeSpell(2565, false);
            player->removeSpell(23881, false);
            player->removeSpell(674, false);
            player->learnSpell(1715, false);
            player->learnSpell(20230, false);
            break;
        case 8: // Fury
            player->removeSpell(1715, false);
            player->removeSpell(20230, false);
            player->removeSpell(6572, false);
            player->removeSpell(2565, false);
            player->learnSpell(23881, false);
            player->learnSpell(674, false);
            break;
        case 9: // Protection
            player->removeSpell(1715, false);
            player->removeSpell(20230, false);
            player->removeSpell(23881, false);
            player->removeSpell(674, false);
            player->learnSpell(6572, false);
            player->learnSpell(2565, false);
            break;
        /* Priest */
        case 10: // Holy
            player->removeSpell(17, false);
            player->removeSpell(588, false);
            player->removeSpell(15407, false);
            player->removeSpell(8122, false);
            player->learnSpell(2061, false);
            player->learnSpell(14914, false);
            break;
        case 11: // Discipline
            player->removeSpell(2061, false);
            player->removeSpell(14914, false);
            player->removeSpell(15407, false);
            player->removeSpell(8122, false);
            player->learnSpell(588, false);
            player->learnSpell(17, false);
            break;
        case 12: // Shadow
            player->removeSpell(17, false);
            player->removeSpell(588, false);
            player->removeSpell(2061, false);
            player->removeSpell(14914, false);
            player->learnSpell(15407, false);
            player->learnSpell(8122, false);
            break;
        /* Hunter */
        case 13: // Marksman
            player->removeSpell(13165, false);
            player->removeSpell(1495, false);
            player->removeSpell(1499, false);
            player->removeSpell(2974, false);
            player->learnSpell(2643, false);
            player->learnSpell(3044, false);
            break;
        case 14: // Survival
            player->removeSpell(13165, false);
            player->removeSpell(2643, false);
            player->removeSpell(3044, false);
            player->removeSpell(1499, false);
            player->learnSpell(1495, false);
            player->learnSpell(2974, false);
            break;
        case 15: // Beastmaster
            player->removeSpell(2974, false);
            player->removeSpell(1495, false);
            player->removeSpell(2643, false);
            player->removeSpell(3044, false);
            player->learnSpell(13165, false);
            player->learnSpell(1499, false);
            break;
        /* Rogue */
        case 16: // Sub
            player->removeSpell(703, false);
            player->removeSpell(5171, false);
            player->removeSpell(5277, false);
            player->removeSpell(1776, false);
            player->learnSpell(8676, false);
            player->learnSpell(2983, false);
            break;
        case 17: // Assassination
            player->removeSpell(8676, false);
            player->removeSpell(2983, false);
            player->removeSpell(5277, false);
            player->removeSpell(1776, false);
            player->learnSpell(703, false);
            player->learnSpell(5171, false);
            break;
        case 18: // Combat
            player->removeSpell(8676, false);
            player->removeSpell(2983, false);
            player->removeSpell(703, false);
            player->removeSpell(84668, false);
            player->learnSpell(5277, false);
            player->learnSpell(5171, false);
            break;
        /* Shaman */
        case 19: // Restoration
            player->removeSpell(8056, false);
            player->removeSpell(674, false);
            player->removeSpell(51490, false);
            player->removeSpell(51505, false);
            player->learnSpell(51730, false);
            player->learnSpell(16176, false);
            break;
        case 20: // Enchancement
            player->removeSpell(51730, false);
            player->removeSpell(16176, false);
            player->removeSpell(51490, false);
            player->removeSpell(51505, false);
            player->learnSpell(8056, false);
            player->learnSpell(674, false);
            break;
        case 21: // Elemental
            player->removeSpell(51730, false);
            player->removeSpell(16176, false);
            player->removeSpell(8056, false);
            player->removeSpell(674, false);
            player->learnSpell(51490, false);
            player->learnSpell(51505, false);
            break;
        /* Warlock */
        case 22: // Affliction
            player->removeSpell(12746, false);
            player->removeSpell(47897, false);
            player->removeSpell(707, false);
            player->removeSpell(17962, false);
            player->learnSpell(5484, false);
            player->learnSpell(980, false);
            break;
        case 23: // Demonology
            player->removeSpell(5484, false);
            player->removeSpell(980, false);
            player->removeSpell(707, false);
            player->removeSpell(17962, false);
            player->learnSpell(12746, false);
            player->learnSpell(47897, false);
            break;
        case 24: // Destruction
            player->removeSpell(5484, false);
            player->removeSpell(980, false);
            player->removeSpell(12746, false);
            player->removeSpell(47897, false);
            player->learnSpell(707, false);
            player->learnSpell(17962, false);
            break;
        /* Druid */
        case 25: // Feral
            player->removeSpell(5570, false);
            player->removeSpell(50516, false);
            player->removeSpell(50464, false);
            player->removeSpell(8936, false);
            player->learnSpell(770, false);
            player->learnSpell(22812, false);
            break;
        case 26: // Balance
            player->removeSpell(770, false);
            player->removeSpell(22812, false);
            player->removeSpell(50464, false);
            player->removeSpell(8936, false);
            player->learnSpell(5570, false);
            player->learnSpell(50516, false);
            break;
        case 27: // Restoration
            player->removeSpell(770, false);
            player->removeSpell(22812, false);
            player->removeSpell(5570, false);
            player->removeSpell(50516, false);
            player->learnSpell(50464, false);
            player->learnSpell(8936, false);
            break;
    }
    player->CLOSE_GOSSIP_MENU();
    return true;
}

void AddSC_talent_chooser()
{
    Script* newscript;

    newscript = new Script;
    newscript->Name = "talent_chooser";
    newscript->pGossipHello = &Chooser_GossipHello;
    newscript->pGossipSelect = &Chooser_GossipSelect;
    newscript->RegisterSelf();
}
 

Shaorin

Respected Member
thx so mutch. this vesrion is working, if you want to clan it up you can do so. but for now i cans tart to adding stuffs and so^^
 

Shaorin

Respected Member
if you want to clan it up. plz send me a PM first so i can give you the new script cuz i'm adding new spells.
 
Status
Not open for further replies.
Top