mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#ifndef SC_PRECOMPILED_H
|
||||
#define SC_PRECOMPILED_H
|
||||
|
||||
#include "../ScriptMgr.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
@@ -20,7 +18,6 @@
|
||||
#include "Chat.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
BOOL APIENTRY DllMain( HANDLE hModule,
|
||||
@@ -31,6 +28,5 @@ LPVOID lpReserved
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,23 +4,20 @@
|
||||
*
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "Item.h"
|
||||
#include "Spell.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
// Spell summary for ScriptedAI::SelectSpell
|
||||
struct TSpellSummary
|
||||
{
|
||||
uint8 Targets; // set of enum SelectTarget
|
||||
uint8 Effects; // set of enum SelectEffect
|
||||
} *SpellSummary;
|
||||
|
||||
void SummonList::DoZoneInCombat(uint32 entry)
|
||||
{
|
||||
for(iterator i = begin(); i != end();)
|
||||
for (iterator i = begin(); i != end(); )
|
||||
{
|
||||
Creature *summon = Unit::GetCreature(*m_creature, *i);
|
||||
++i;
|
||||
@@ -29,10 +26,9 @@ void SummonList::DoZoneInCombat(uint32 entry)
|
||||
summon->AI()->DoZoneInCombat();
|
||||
}
|
||||
}
|
||||
|
||||
void SummonList::DoAction(uint32 entry, uint32 info)
|
||||
{
|
||||
for(iterator i = begin(); i != end();)
|
||||
for (iterator i = begin(); i != end(); )
|
||||
{
|
||||
Creature *summon = Unit::GetCreature(*m_creature, *i);
|
||||
++i;
|
||||
@@ -41,10 +37,9 @@ void SummonList::DoAction(uint32 entry, uint32 info)
|
||||
summon->AI()->DoAction(info);
|
||||
}
|
||||
}
|
||||
|
||||
void SummonList::DespawnEntry(uint32 entry)
|
||||
{
|
||||
for(iterator i = begin(); i != end();)
|
||||
for (iterator i = begin(); i != end(); )
|
||||
{
|
||||
Creature *summon = Unit::GetCreature(*m_creature, *i);
|
||||
if(!summon)
|
||||
@@ -59,7 +54,6 @@ void SummonList::DespawnEntry(uint32 entry)
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void SummonList::DespawnAll()
|
||||
{
|
||||
while(!empty())
|
||||
@@ -80,7 +74,6 @@ void SummonList::DespawnAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
|
||||
m_creature(pCreature),
|
||||
IsFleeing(false),
|
||||
@@ -89,22 +82,18 @@ ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
|
||||
{
|
||||
HeroicMode = m_creature->GetMap()->IsHeroic();
|
||||
}
|
||||
|
||||
void ScriptedAI::AttackStartNoMove(Unit* pWho)
|
||||
{
|
||||
if (!pWho)
|
||||
return;
|
||||
|
||||
if(m_creature->Attack(pWho, false))
|
||||
DoStartNoMovement(pWho);
|
||||
}
|
||||
|
||||
void ScriptedAI::UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
//Check if we have a current target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (m_creature->isAttackReady())
|
||||
{
|
||||
//If we are within range melee the target
|
||||
@@ -115,232 +104,180 @@ void ScriptedAI::UpdateAI(const uint32 uiDiff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedAI::DoStartMovement(Unit* pVictim, float fDistance, float fAngle)
|
||||
{
|
||||
if (pVictim)
|
||||
m_creature->GetMotionMaster()->MoveChase(pVictim, fDistance, fAngle);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoStartNoMovement(Unit* pVictim)
|
||||
{
|
||||
if (!pVictim)
|
||||
return;
|
||||
|
||||
m_creature->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
|
||||
void ScriptedAI::DoStopAttack()
|
||||
{
|
||||
if (m_creature->getVictim())
|
||||
m_creature->AttackStop();
|
||||
}
|
||||
|
||||
void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered)
|
||||
{
|
||||
if (!pTarget || m_creature->IsNonMeleeSpellCasted(false))
|
||||
return;
|
||||
|
||||
m_creature->StopMoving();
|
||||
m_creature->CastSpell(pTarget, pSpellInfo, bTriggered);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
|
||||
{
|
||||
if (!pSource)
|
||||
return;
|
||||
|
||||
if (!GetSoundEntriesStore()->LookupEntry(uiSoundId))
|
||||
{
|
||||
error_log("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
|
||||
pSource->PlayDirectSound(uiSoundId);
|
||||
}
|
||||
|
||||
Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime)
|
||||
{
|
||||
return m_creature->SummonCreature(uiId, m_creature->GetPositionX()+fX, m_creature->GetPositionY()+fY, m_creature->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime);
|
||||
}
|
||||
|
||||
Unit* ScriptedAI::SelectUnit(SelectAggroTarget target, uint32 uiPosition)
|
||||
{
|
||||
//ThreatList m_threatlist;
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator itr = threatlist.begin();
|
||||
std::list<HostilReference*>::reverse_iterator ritr = threatlist.rbegin();
|
||||
|
||||
if (uiPosition >= threatlist.size() || !threatlist.size())
|
||||
return NULL;
|
||||
|
||||
switch (target)
|
||||
{
|
||||
case SELECT_TARGET_RANDOM:
|
||||
advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition ) ));
|
||||
return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
|
||||
break;
|
||||
|
||||
case SELECT_TARGET_TOPAGGRO:
|
||||
advance (itr , uiPosition);
|
||||
return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
|
||||
break;
|
||||
|
||||
case SELECT_TARGET_BOTTOMAGGRO:
|
||||
advance (ritr , uiPosition);
|
||||
return Unit::GetUnit((*m_creature),(*ritr)->getUnitGuid());
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects)
|
||||
{
|
||||
//No target so we can't cast
|
||||
if (!pTarget)
|
||||
return false;
|
||||
|
||||
//Silenced so we can't cast
|
||||
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
return false;
|
||||
|
||||
//Using the extended script system we first create a list of viable spells
|
||||
SpellEntry const* apSpell[CREATURE_MAX_SPELLS];
|
||||
memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS);
|
||||
|
||||
uint32 uiSpellCount = 0;
|
||||
|
||||
SpellEntry const* pTempSpell;
|
||||
SpellRangeEntry const* pTempRange;
|
||||
|
||||
//Check if each spell is viable(set it to null if not)
|
||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
|
||||
{
|
||||
pTempSpell = GetSpellStore()->LookupEntry(m_creature->m_spells[i]);
|
||||
|
||||
//This spell doesn't exist
|
||||
if (!pTempSpell)
|
||||
continue;
|
||||
|
||||
// Targets and Effects checked first as most used restrictions
|
||||
//Check the spell targets if specified
|
||||
if (selectTargets && !(SpellSummary[m_creature->m_spells[i]].Targets & (1 << (selectTargets-1))))
|
||||
continue;
|
||||
|
||||
//Check the type of spell if we are looking for a specific spell type
|
||||
if (selectEffects && !(SpellSummary[m_creature->m_spells[i]].Effects & (1 << (selectEffects-1))))
|
||||
continue;
|
||||
|
||||
//Check for school if specified
|
||||
if (uiSchool >= 0 && pTempSpell->SchoolMask & uiSchool)
|
||||
continue;
|
||||
|
||||
//Check for spell mechanic if specified
|
||||
if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic)
|
||||
continue;
|
||||
|
||||
//Make sure that the spell uses the requested amount of power
|
||||
if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin)
|
||||
continue;
|
||||
|
||||
if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax)
|
||||
continue;
|
||||
|
||||
//Continue if we don't have the mana to actually cast this spell
|
||||
if (pTempSpell->manaCost > m_creature->GetPower((Powers)pTempSpell->powerType))
|
||||
continue;
|
||||
|
||||
//Get the Range
|
||||
pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex);
|
||||
|
||||
//Spell has invalid range store so we can't use it
|
||||
if (!pTempRange)
|
||||
continue;
|
||||
|
||||
//Check if the spell meets our range requirements
|
||||
if (fRangeMin && m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin)
|
||||
continue;
|
||||
if (fRangeMax && m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax)
|
||||
continue;
|
||||
|
||||
//Check if our target is in range
|
||||
if (m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
|
||||
continue;
|
||||
|
||||
//All good so lets add it to the spell list
|
||||
apSpell[uiSpellCount] = pTempSpell;
|
||||
++uiSpellCount;
|
||||
}
|
||||
|
||||
//We got our usable spells so now lets randomly pick one
|
||||
if (!uiSpellCount)
|
||||
return NULL;
|
||||
|
||||
return apSpell[rand()%uiSpellCount];
|
||||
}
|
||||
|
||||
bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered)
|
||||
{
|
||||
//No target so we can't cast
|
||||
if (!pTarget || !pSpell)
|
||||
return false;
|
||||
|
||||
//Silenced so we can't cast
|
||||
if (!bTriggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
return false;
|
||||
|
||||
//Check for power
|
||||
if (!bTriggered && me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost)
|
||||
return false;
|
||||
|
||||
SpellRangeEntry const* pTempRange = GetSpellRangeStore()->LookupEntry(pSpell->rangeIndex);
|
||||
|
||||
//Spell has invalid range store so we can't use it
|
||||
if (!pTempRange)
|
||||
return false;
|
||||
|
||||
//Unit is out of range of this spell
|
||||
if (me->IsInRange(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange), m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FillSpellSummary()
|
||||
{
|
||||
SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
|
||||
|
||||
SpellEntry const* pTempSpell;
|
||||
|
||||
for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
|
||||
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
|
||||
{
|
||||
SpellSummary[i].Effects = 0;
|
||||
SpellSummary[i].Targets = 0;
|
||||
|
||||
pTempSpell = GetSpellStore()->LookupEntry(i);
|
||||
//This spell doesn't exist
|
||||
if (!pTempSpell)
|
||||
continue;
|
||||
|
||||
for(uint32 j = 0; j < 3; ++j)
|
||||
for (uint32 j = 0; j < 3; ++j)
|
||||
{
|
||||
//Spell targets self
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER )
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1);
|
||||
|
||||
//Spell targets a single enemy
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY )
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1);
|
||||
|
||||
//Spell targets AoE at enemy
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY )
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1);
|
||||
|
||||
//Spell targets an enemy
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY ||
|
||||
@@ -349,19 +286,16 @@ void FillSpellSummary()
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY )
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1);
|
||||
|
||||
//Spell targets a single friend(or self)
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY )
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1);
|
||||
|
||||
//Spell targets aoe friends
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1);
|
||||
|
||||
//Spell targets any friend(or self)
|
||||
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
|
||||
@@ -370,28 +304,24 @@ void FillSpellSummary()
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET ||
|
||||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
|
||||
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1);
|
||||
|
||||
//Make sure that this spell includes a damage effect
|
||||
if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ||
|
||||
pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL ||
|
||||
pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
|
||||
pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH )
|
||||
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1);
|
||||
|
||||
//Make sure that this spell includes a healing effect (or an apply aura with a periodic heal)
|
||||
if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL ||
|
||||
pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
|
||||
pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL ||
|
||||
(pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j]== 8 ))
|
||||
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1);
|
||||
|
||||
//Make sure that this spell applies an aura
|
||||
if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA )
|
||||
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedAI::DoResetThreat()
|
||||
{
|
||||
if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty())
|
||||
@@ -399,41 +329,33 @@ void ScriptedAI::DoResetThreat()
|
||||
error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (m_creature entry = %d)", m_creature->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
|
||||
for(std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
if(pUnit && DoGetThreat(pUnit))
|
||||
DoModifyThreatPercent(pUnit, -100);
|
||||
}
|
||||
}
|
||||
|
||||
float ScriptedAI::DoGetThreat(Unit* pUnit)
|
||||
{
|
||||
if(!pUnit) return 0.0f;
|
||||
return m_creature->getThreatManager().getThreat(pUnit);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct)
|
||||
{
|
||||
if(!pUnit) return;
|
||||
m_creature->getThreatManager().modifyThreatPercent(pUnit, pct);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime)
|
||||
{
|
||||
m_creature->Relocate(fX, fY, fZ);
|
||||
m_creature->SendMonsterMove(fX, fY, fZ, uiTime);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportTo(const float fPos[4])
|
||||
{
|
||||
me->NearTeleportTo(fPos[0], fPos[1], fPos[2], fPos[3]);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO)
|
||||
{
|
||||
if(!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
|
||||
@@ -442,33 +364,27 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo
|
||||
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", m_creature->GetGUID(), m_creature->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
|
||||
return;
|
||||
}
|
||||
|
||||
CAST_PLR(pUnit)->TeleportTo(pUnit->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO)
|
||||
{
|
||||
Map *map = m_creature->GetMap();
|
||||
if (!map->IsDungeon())
|
||||
return;
|
||||
|
||||
Map::PlayerList const &PlayerList = map->GetPlayers();
|
||||
for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
if (Player* i_pl = i->getSource())
|
||||
if (i_pl->isAlive())
|
||||
i_pl->TeleportTo(m_creature->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
}
|
||||
|
||||
Unit* ScriptedAI::DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff)
|
||||
{
|
||||
Unit* pUnit = NULL;
|
||||
Trinity::MostHPMissingInRange u_check(m_creature, fRange, uiMinHPDiff);
|
||||
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(m_creature, pUnit, u_check);
|
||||
m_creature->VisitNearbyObject(fRange, searcher);
|
||||
|
||||
return pUnit;
|
||||
}
|
||||
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float fRange)
|
||||
{
|
||||
std::list<Creature*> pList;
|
||||
@@ -477,7 +393,6 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float fRange)
|
||||
m_creature->VisitNearbyObject(fRange, searcher);
|
||||
return pList;
|
||||
}
|
||||
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellid)
|
||||
{
|
||||
std::list<Creature*> pList;
|
||||
@@ -486,51 +401,39 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32
|
||||
m_creature->VisitNearbyObject(fRange, searcher);
|
||||
return pList;
|
||||
}
|
||||
|
||||
Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
|
||||
{
|
||||
Player* pPlayer = NULL;
|
||||
|
||||
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::PlayerAtMinimumRangeAway check(m_creature, fMinimumRange);
|
||||
Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
|
||||
TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, pair);
|
||||
cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
|
||||
|
||||
return pPlayer;
|
||||
}
|
||||
|
||||
void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged)
|
||||
{
|
||||
if (bLoadDefault)
|
||||
{
|
||||
if (CreatureInfo const* pInfo = GetCreatureTemplateStore(m_creature->GetEntry()))
|
||||
m_creature->LoadEquipment(pInfo->equipmentId,true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (uiMainHand >= 0)
|
||||
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand));
|
||||
|
||||
if (uiOffHand >= 0)
|
||||
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand));
|
||||
|
||||
if (uiRanged >= 0)
|
||||
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged));
|
||||
}
|
||||
|
||||
void ScriptedAI::SetCombatMovement(bool bCombatMove)
|
||||
{
|
||||
m_bCombatMovement = bCombatMove;
|
||||
}
|
||||
|
||||
enum eNPCs
|
||||
{
|
||||
NPC_BROODLORD = 12017,
|
||||
@@ -538,7 +441,6 @@ enum eNPCs
|
||||
NPC_JAN_ALAI = 23578,
|
||||
NPC_SARTHARION = 28860
|
||||
};
|
||||
|
||||
// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area.
|
||||
// It is assumed the information is found elswehere and can be handled by mangos. So far no luck finding such information/way to extract it.
|
||||
bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
|
||||
@@ -550,14 +452,11 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
|
||||
m_uiEvadeCheckCooldown -= uiDiff;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_creature->IsInEvadeMode() || !m_creature->getVictim())
|
||||
return false;
|
||||
|
||||
float fX = m_creature->GetPositionX();
|
||||
float fY = m_creature->GetPositionY();
|
||||
float fZ = m_creature->GetPositionZ();
|
||||
|
||||
switch(m_creature->GetEntry())
|
||||
{
|
||||
case NPC_BROODLORD: // broodlord (not move down stairs)
|
||||
@@ -580,39 +479,32 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
|
||||
error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", m_creature->GetEntry());
|
||||
return false;
|
||||
}
|
||||
|
||||
EnterEvadeMode();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Scripted_NoMovementAI::AttackStart(Unit* pWho)
|
||||
{
|
||||
if (!pWho)
|
||||
return;
|
||||
|
||||
if (m_creature->Attack(pWho, true))
|
||||
{
|
||||
DoStartNoMovement(pWho);
|
||||
}
|
||||
}
|
||||
|
||||
BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c)
|
||||
, bossId(id), summons(me), instance(c->GetInstanceData())
|
||||
, boundary(instance ? instance->GetBossBoundary(id) : NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void BossAI::_Reset()
|
||||
{
|
||||
if(!me->isAlive())
|
||||
return;
|
||||
|
||||
events.Reset();
|
||||
summons.DespawnAll();
|
||||
if(instance)
|
||||
instance->SetBossState(bossId, NOT_STARTED);
|
||||
}
|
||||
|
||||
void BossAI::_JustDied()
|
||||
{
|
||||
events.Reset();
|
||||
@@ -620,7 +512,6 @@ void BossAI::_JustDied()
|
||||
if(instance)
|
||||
instance->SetBossState(bossId, DONE);
|
||||
}
|
||||
|
||||
void BossAI::_EnterCombat()
|
||||
{
|
||||
me->setActive(true);
|
||||
@@ -628,23 +519,20 @@ void BossAI::_EnterCombat()
|
||||
if(instance)
|
||||
instance->SetBossState(bossId, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void BossAI::TeleportCheaters()
|
||||
{
|
||||
float x, y, z;
|
||||
me->GetPosition(x, y, z);
|
||||
std::list<HostilReference*> &m_threatlist = me->getThreatManager().getThreatList();
|
||||
for(std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
|
||||
for (std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
|
||||
if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget()))
|
||||
(*itr)->getTarget()->NearTeleportTo(x, y, z, 0);
|
||||
}
|
||||
|
||||
bool BossAI::CheckBoundary(Unit *who)
|
||||
{
|
||||
if(!boundary || !who)
|
||||
return true;
|
||||
|
||||
for(BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr)
|
||||
for (BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr)
|
||||
{
|
||||
switch(itr->first)
|
||||
{
|
||||
@@ -682,48 +570,39 @@ bool BossAI::CheckBoundary(Unit *who)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BossAI::JustSummoned(Creature *summon)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
if(me->isInCombat())
|
||||
DoZoneInCombat(summon);
|
||||
}
|
||||
|
||||
void BossAI::SummonedCreatureDespawn(Creature *summon)
|
||||
{
|
||||
summons.Despawn(summon);
|
||||
}
|
||||
|
||||
#define GOBJECT(x) (const_cast<GameObjectInfo*>(GetGameObjectInfo(x)))
|
||||
|
||||
void LoadOverridenSQLData()
|
||||
{
|
||||
GameObjectInfo *goInfo;
|
||||
|
||||
// Sunwell Plateau : Kalecgos : Spectral Rift
|
||||
if(goInfo = GOBJECT(187055))
|
||||
if(goInfo->type == GAMEOBJECT_TYPE_GOOBER)
|
||||
goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN
|
||||
|
||||
// Naxxramas : Sapphiron Birth
|
||||
if(goInfo = GOBJECT(181356))
|
||||
if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
|
||||
goInfo->trap.radius = 50;
|
||||
}
|
||||
|
||||
void LoadOverridenDBCData()
|
||||
{
|
||||
SpellEntry *spellInfo;
|
||||
for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
|
||||
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
|
||||
{
|
||||
spellInfo = GET_SPELL(i);
|
||||
if(!spellInfo)
|
||||
continue;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
// Black Temple : Illidan : Parasitic Shadowfiend Passive
|
||||
@@ -749,23 +628,17 @@ void LoadOverridenDBCData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange)
|
||||
{
|
||||
Creature* pCreature = NULL;
|
||||
|
||||
CellPair pair(Trinity::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*pSource, Entry, true, MaxSearchRange);
|
||||
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pCreature, creature_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer> creature_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, pair);
|
||||
cell_lock->Visit(cell_lock, creature_searcher,*(pSource->GetMap()));
|
||||
|
||||
return pCreature;
|
||||
}
|
||||
|
||||
@@ -4,28 +4,21 @@
|
||||
*
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#ifndef SC_CREATURE_H
|
||||
#define SC_CREATURE_H
|
||||
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "InstanceData.h"
|
||||
|
||||
#define SCRIPT_CAST_TYPE dynamic_cast
|
||||
//#define SCRIPT_CAST_TYPE static_cast
|
||||
|
||||
#define CAST_PLR(a) (SCRIPT_CAST_TYPE<Player*>(a))
|
||||
#define CAST_CRE(a) (SCRIPT_CAST_TYPE<Creature*>(a))
|
||||
#define CAST_SUM(a) (SCRIPT_CAST_TYPE<TempSummon*>(a))
|
||||
#define CAST_PET(a) (SCRIPT_CAST_TYPE<Pet*>(a))
|
||||
#define CAST_AI(a,b) (SCRIPT_CAST_TYPE<a*>(b))
|
||||
|
||||
#define GET_SPELL(a) (const_cast<SpellEntry*>(GetSpellStore()->LookupEntry(a)))
|
||||
|
||||
class ScriptedInstance;
|
||||
|
||||
class SummonList : public std::list<uint64>
|
||||
{
|
||||
public:
|
||||
@@ -39,178 +32,125 @@ class SummonList : public std::list<uint64>
|
||||
private:
|
||||
Creature *m_creature;
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
{
|
||||
explicit ScriptedAI(Creature* pCreature);
|
||||
~ScriptedAI() {}
|
||||
|
||||
//*************
|
||||
//CreatureAI Functions
|
||||
//*************
|
||||
|
||||
void AttackStartNoMove(Unit *target);
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit* pDone_by, uint32& uiDamage) {}
|
||||
|
||||
//Called at World update tick
|
||||
void UpdateAI(const uint32);
|
||||
|
||||
//Called at creature death
|
||||
void JustDied(Unit* who){}
|
||||
|
||||
//Called at creature killing another unit
|
||||
void KilledUnit(Unit* who){}
|
||||
|
||||
// Called when the creature summon successfully other creature
|
||||
void JustSummoned(Creature* ) {}
|
||||
|
||||
// Called when a summoned creature is despawned
|
||||
void SummonedCreatureDespawn(Creature*) {}
|
||||
|
||||
// Called when hit by a spell
|
||||
void SpellHit(Unit* caster, const SpellEntry *spell) {}
|
||||
|
||||
// Called when spell hits a target
|
||||
void SpellHitTarget(Unit* target, const SpellEntry *spell) {}
|
||||
|
||||
//Called at waypoint reached or PointMovement end
|
||||
void MovementInform(uint32 type, uint32 id){}
|
||||
|
||||
// Called when AI is temporarily replaced or put back when possess is applied or removed
|
||||
void OnPossess(bool apply) {}
|
||||
|
||||
//*************
|
||||
// Variables
|
||||
//*************
|
||||
|
||||
//Pointer to creature we are manipulating
|
||||
Creature* m_creature;
|
||||
|
||||
//For fleeing
|
||||
bool IsFleeing;
|
||||
|
||||
bool HeroicMode;
|
||||
|
||||
//*************
|
||||
//Pure virtual functions
|
||||
//*************
|
||||
|
||||
//Called at creature reset either by death or evade
|
||||
void Reset() {}
|
||||
|
||||
//Called at creature aggro either by MoveInLOS or Attack Start
|
||||
void EnterCombat(Unit* who) {}
|
||||
|
||||
//*************
|
||||
//AI Helper Functions
|
||||
//*************
|
||||
|
||||
//Start movement toward victim
|
||||
void DoStartMovement(Unit* pVictim, float fDistance = 0, float fAngle = 0);
|
||||
|
||||
//Start no movement on victim
|
||||
void DoStartNoMovement(Unit* pVictim);
|
||||
|
||||
//Stop attack of current victim
|
||||
void DoStopAttack();
|
||||
|
||||
//Cast spell by spell info
|
||||
void DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered = false);
|
||||
|
||||
//Plays a sound to all nearby players
|
||||
void DoPlaySoundToSet(WorldObject* pSource, uint32 sound);
|
||||
|
||||
//Drops all threat to 0%. Does not remove players from the threat list
|
||||
void DoResetThreat();
|
||||
|
||||
float DoGetThreat(Unit* u);
|
||||
void DoModifyThreatPercent(Unit* pUnit, int32 pct);
|
||||
|
||||
void DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime = 0);
|
||||
void DoTeleportTo(const float pos[4]);
|
||||
|
||||
void DoAction(const int32 param) {}
|
||||
|
||||
//Teleports a player without dropping threat (only teleports to same map)
|
||||
void DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO);
|
||||
void DoTeleportAll(float fX, float fY, float fZ, float fO);
|
||||
|
||||
//Returns friendly unit with the most amount of hp missing from max hp
|
||||
Unit* DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff = 1);
|
||||
|
||||
//Returns a list of friendly CC'd units within range
|
||||
std::list<Creature*> DoFindFriendlyCC(float fRange);
|
||||
|
||||
//Returns a list of all friendly units missing a specific buff within range
|
||||
std::list<Creature*> DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId);
|
||||
|
||||
//Return a player with at least minimumRange from m_creature
|
||||
Player* GetPlayerAtMinimumRange(float fMinimumRange);
|
||||
|
||||
//Spawns a creature relative to m_creature
|
||||
Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime);
|
||||
|
||||
//Selects a unit from the creature's current aggro list
|
||||
Unit* SelectUnit(SelectAggroTarget target, uint32 uiPosition);
|
||||
|
||||
bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < m_creature->GetMaxHealth() * pct; }
|
||||
|
||||
//Returns spells that meet the specified criteria from the creatures spell list
|
||||
SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect);
|
||||
|
||||
//Checks if you can cast the specified spell
|
||||
bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false);
|
||||
|
||||
void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE);
|
||||
|
||||
//Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims
|
||||
void SetCombatMovement(bool CombatMove);
|
||||
bool IsCombatMovement() { return m_bCombatMovement; }
|
||||
|
||||
bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff);
|
||||
|
||||
private:
|
||||
bool m_bCombatMovement;
|
||||
uint32 m_uiEvadeCheckCooldown;
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
|
||||
{
|
||||
Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
|
||||
//Called at each attack of m_creature by any victim
|
||||
void AttackStart(Unit* who);
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL BossAI : public ScriptedAI
|
||||
{
|
||||
BossAI(Creature *c, uint32 id);
|
||||
|
||||
const uint32 bossId;
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
InstanceData * const instance;
|
||||
const BossBoundaryMap * const boundary;
|
||||
|
||||
void JustSummoned(Creature *summon);
|
||||
void SummonedCreatureDespawn(Creature *summon);
|
||||
|
||||
void UpdateAI(const uint32 diff) = 0;
|
||||
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit *who) { _EnterCombat(); }
|
||||
void JustDied(Unit *killer) { _JustDied(); }
|
||||
void JustReachedHome() { me->setActive(false); }
|
||||
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
void _JustReachedHome() { me->setActive(false); }
|
||||
|
||||
bool CheckInRoom()
|
||||
{
|
||||
if(CheckBoundary(me))
|
||||
@@ -221,11 +161,8 @@ struct TRINITY_DLL_DECL BossAI : public ScriptedAI
|
||||
bool CheckBoundary(Unit *who);
|
||||
void TeleportCheaters();
|
||||
};
|
||||
|
||||
// SD2's grid searchers
|
||||
|
||||
//return closest creature alive in grid, with range from pSource
|
||||
Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,18 +4,14 @@
|
||||
*
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#ifndef SC_GOSSIP_H
|
||||
#define SC_GOSSIP_H
|
||||
|
||||
#include "Player.h"
|
||||
#include "GossipDef.h"
|
||||
#include "QuestDef.h"
|
||||
|
||||
// Gossip Item Text
|
||||
#define GOSSIP_TEXT_BROWSE_GOODS "I'd like to browse your goods."
|
||||
#define GOSSIP_TEXT_TRAIN "Train me!"
|
||||
|
||||
#define GOSSIP_TEXT_BANK "The bank"
|
||||
#define GOSSIP_TEXT_IRONFORGE_BANK "The bank of Ironforge"
|
||||
#define GOSSIP_TEXT_STORMWIND_BANK "The bank of Stormwind"
|
||||
@@ -39,14 +35,12 @@
|
||||
#define GOSSIP_TEXT_CLASSTRAINER "A class trainer"
|
||||
#define GOSSIP_TEXT_PROFTRAINER "A profession trainer"
|
||||
#define GOSSIP_TEXT_LEXICON "Lexicon of Power"
|
||||
|
||||
#define GOSSIP_TEXT_ALTERACVALLEY "Alterac Valley"
|
||||
#define GOSSIP_TEXT_ARATHIBASIN "Arathi Basin"
|
||||
#define GOSSIP_TEXT_WARSONGULCH "Warsong Gulch"
|
||||
#define GOSSIP_TEXT_ARENA "Arena"
|
||||
#define GOSSIP_TEXT_EYEOFTHESTORM "Eye of The Storm"
|
||||
#define GOSSIP_TEXT_STRANDOFANCIENT "Strand of the Ancients"
|
||||
|
||||
#define GOSSIP_TEXT_DEATH_KNIGHT "Death Knight"
|
||||
#define GOSSIP_TEXT_DRUID "Druid"
|
||||
#define GOSSIP_TEXT_HUNTER "Hunter"
|
||||
@@ -57,7 +51,6 @@
|
||||
#define GOSSIP_TEXT_SHAMAN "Shaman"
|
||||
#define GOSSIP_TEXT_MAGE "Mage"
|
||||
#define GOSSIP_TEXT_WARLOCK "Warlock"
|
||||
|
||||
#define GOSSIP_TEXT_ALCHEMY "Alchemy"
|
||||
#define GOSSIP_TEXT_BLACKSMITHING "Blacksmithing"
|
||||
#define GOSSIP_TEXT_COOKING "Cooking"
|
||||
@@ -72,7 +65,6 @@
|
||||
#define GOSSIP_TEXT_MINING "Mining"
|
||||
#define GOSSIP_TEXT_FISHING "Fishing"
|
||||
#define GOSSIP_TEXT_SKINNING "Skinning"
|
||||
|
||||
enum eTradeskill
|
||||
{
|
||||
// Skill defines
|
||||
@@ -91,7 +83,6 @@ enum eTradeskill
|
||||
TRADESKILL_SKINNING = 13,
|
||||
TRADESKILL_JEWLCRAFTING = 14,
|
||||
TRADESKILL_INSCRIPTION = 15,
|
||||
|
||||
TRADESKILL_LEVEL_NONE = 0,
|
||||
TRADESKILL_LEVEL_APPRENTICE = 1,
|
||||
TRADESKILL_LEVEL_JOURNEYMAN = 2,
|
||||
@@ -99,7 +90,6 @@ enum eTradeskill
|
||||
TRADESKILL_LEVEL_ARTISAN = 4,
|
||||
TRADESKILL_LEVEL_MASTER = 5,
|
||||
TRADESKILL_LEVEL_GRAND_MASTER = 6,
|
||||
|
||||
// Gossip defines
|
||||
GOSSIP_ACTION_TRADE = 1,
|
||||
GOSSIP_ACTION_TRAIN = 2,
|
||||
@@ -114,7 +104,6 @@ enum eTradeskill
|
||||
GOSSIP_ACTION_INN_INFO = 11,
|
||||
GOSSIP_ACTION_UNLEARN = 12,
|
||||
GOSSIP_ACTION_INFO_DEF = 1000,
|
||||
|
||||
GOSSIP_SENDER_MAIN = 1,
|
||||
GOSSIP_SENDER_INN_INFO = 2,
|
||||
GOSSIP_SENDER_INFO = 3,
|
||||
@@ -126,11 +115,8 @@ enum eTradeskill
|
||||
GOSSIP_SENDER_SEC_MAILBOX = 9,
|
||||
GOSSIP_SENDER_SEC_STABLEMASTER = 10
|
||||
};
|
||||
|
||||
extern uint32 GetSkillLevel(Player *player,uint32 skill);
|
||||
|
||||
// Defined fuctions to use with player.
|
||||
|
||||
// This fuction add's a menu item,
|
||||
// a - Icon Id
|
||||
// b - Text
|
||||
@@ -140,10 +126,8 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill);
|
||||
// f - Money value in pop up box
|
||||
#define ADD_GOSSIP_ITEM(a,b,c,d) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,"",0)
|
||||
#define ADD_GOSSIP_ITEM_EXTENDED(a,b,c,d,e,f,g) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,e,f,g)
|
||||
|
||||
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64)
|
||||
#define SEND_GOSSIP_MENU(a,b) PlayerTalkClass->SendGossipMenu(a,b)
|
||||
|
||||
// This fuction shows POI(point of interest) to client.
|
||||
// a - position X
|
||||
// b - position Y
|
||||
@@ -152,23 +136,19 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill);
|
||||
// e - Data
|
||||
// f - Location Name
|
||||
#define SEND_POI(a,b,c,d,e,f) PlayerTalkClass->SendPointOfInterest(a,b,c,d,e,f)
|
||||
|
||||
// Closes the Menu
|
||||
#define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip()
|
||||
|
||||
// Fuction to tell to client the details
|
||||
// a - quest object
|
||||
// b - npc guid(uint64)
|
||||
// c - Activate accept(bool)
|
||||
#define SEND_QUEST_DETAILS(a,b,c) PlayerTalkClass->SendQuestDetails(a,b,c)
|
||||
|
||||
// Fuction to tell to client the requested items to complete quest
|
||||
// a - quest object
|
||||
// b - npc guid(uint64)
|
||||
// c - Iscompletable(bool)
|
||||
// d - close at cancel(bool) - in case single incomplite ques
|
||||
#define SEND_REQUESTEDITEMS(a,b,c,d) PlayerTalkClass->SendRequestedItems(a,b,c,d)
|
||||
|
||||
// Fuctions to send NPC lists, a - is always the npc guid(uint64)
|
||||
#define SEND_VENDORLIST(a) GetSession()->SendListInventory(a)
|
||||
#define SEND_TRAINERLIST(a) GetSession()->SendTrainerList(a)
|
||||
@@ -176,16 +156,12 @@ extern uint32 GetSkillLevel(Player *player,uint32 skill);
|
||||
#define SEND_TABARDLIST(a) GetSession()->SendTabardVendorActivate(a)
|
||||
#define SEND_AUCTIONLIST(a) GetSession()->SendAuctionHello(a)
|
||||
#define SEND_TAXILIST(a) GetSession()->SendTaxiStatus(a)
|
||||
|
||||
// Ressurect's the player if is dead.
|
||||
#define SEND_SPRESURRECT() GetSession()->SendSpiritResurrect()
|
||||
|
||||
// Get the player's honor rank.
|
||||
#define GET_HONORRANK() GetHonorRank()
|
||||
// -----------------------------------
|
||||
|
||||
// defined fuctions to use with Creature
|
||||
|
||||
#define QUEST_DIALOG_STATUS(a,b,c) GetSession()->getDialogStatus(a,b,c)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#ifndef SC_INSTANCE_H
|
||||
#define SC_INSTANCE_H
|
||||
|
||||
#include "InstanceData.h"
|
||||
#include "Map.h"
|
||||
|
||||
#define OUT_SAVE_INST_DATA debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_SAVE_INST_DATA_COMPLETE debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA(a) debug_log("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
|
||||
#define OUT_LOAD_INST_DATA_COMPLETE debug_log("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA_FAIL error_log("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
|
||||
#define ScriptedInstance InstanceData
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user