rendered paste body#include "StdAfx.h"
#include "Setup.h"
#include "WorldSession.h"
#include "LogonCommHandler.h"
#include "AIInterface.h"
#include "Unit.h"
/************************************************************************/
/* GuardAI.cpp Script */
/************************************************************************/
// Undercity GuardianAI
#define CN_UNDERCITY_GUARDIAN 78021
//#define DISEASE_CLOUD 12187 //12188
class CCGUARDIANAI : public CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(CCGUARDIANAI);
//SP_AI_Spell spells[1];
//bool m_spellcheck[1];
CCGUARDIANAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
/*nrspells = 1;
for(int i=0;i<nrspells;i++)
{
m_spellcheck[i] = false;
}
spells[0].info = sSpellStore.LookupEntry(DISEASE_CLOUD);
spells[0].targettype = TARGET_SELF;
spells[0].instant = true;
spells[0].cooldown = -1;
spells[0].perctrigger = 0.0f;
spells[0].attackstoptimer = 1000;
_unit->CastSpell(_unit, spells[0].info, spells[0].instant);*/
}
void CheckPvP(Unit* mTarget)
{
Unit * Target = FindTarget();
if(Target == hasStateFlag(UF_ATTACKING))
{
AttackReaction(Target, 1, 0);
}
}
void OnCombatStart(Unit* mTarget)
{
//CastTime();
//RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
}
/*void CastTime()
{
for(int i=0;i<nrspells;i++)
spells[i].casttime = spells[i].cooldown;
}*/
bool OnTargetDied(Unit* mTarget)
{
//BlueSystemMessage(m_session, "Account %s has been permanently banned.", args);
sLogonCommHandler.CharacterDatabaseSQLExecute("UPDATE characters SET positionX = -1835.859985, positionY = 5422.379883, positionZ -12.4218100, mapID = 530 WHERE name = '%s'", WorldDatabase.EscapeString(args).c_str());
sLogonCommHandler.LogonDatabaseReloadAccounts();
//BlueSystemMessage(m_session, "Accounts table reloaded.");
sGMLog.writefromsession(m_session, "Teleported %s to Shattrath", args);
return true;
}
void OnCombatStop(Unit *mTarget)
{
//CastTime();
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
//CastTime();
RemoveAIUpdateEvent();
}
void AIUpdate()
{
/*float val = sRand.rand(100.0f);
SpellCast(val);*/
}
protected:
//int nrspells;
};
void SetupGuardAI(ScriptMgr * mgr)
{
mgr->register_creature_script(CN_UNDERCITY_GUARDIAN, &CCGUARDIANAI::Create);
}