aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2010-08-06 19:23:43 +0200
committerXTZGZoReX <none@none>2010-08-06 19:23:43 +0200
commit946adf469c14deeaf202cba5378fb5edfd792bd6 (patch)
treece27f0aaa34c6cd06fbdf234ec31ff6abc9ce80c /src/server/game/AI/ScriptedAI
parent2562a4651f94e2dc40ccce108a2497c2c26bfff6 (diff)
*** New core <-> script library interface - complete rewrite of the old one.
* Removed the misdesigned on_events script/hooks. * Lots of related cleanups and assertions. * The interface is now fully object-oriented. ** Scripts no longer use function pointers. ** Scripts no longer use the general-purpose Script struct for everything. ** Script types are split into separate classes which must be inherited depending on what functionality is desired. * Several script types have been added to allow extending functionality in a code-only manner (some script types require assignment in the recently added ScriptName columns in the database, though). ** SpellHandlerScript: Wrapper around spell scripts (returns new SpellScript objects (`spell_script_names`.`ScriptName`)). ** ServerScript: Allows scripting events that occur in the network layer. ** WorldScript: Allows scripting certain world-global events. ** FormulaScript: Allows hooking and interfering with core formulas. ** *MapScript: Allows hooking different map types (including world, instance, and battleground maps (`instance_template`.`ScriptName`)). ** ItemScript: Allows scripting of items (like the old interface (`item_template`.`ScriptName`)). ** CreatureScript: Allows scripting of creatures/AI (like the old interface (`creature_template`.`ScriptName`)). ** GameObjectScript: Allows scripting of gameobjects (like the old interface (`gameobject_template`.`ScriptName`)). ** AreaTriggerScript: Allows scripting triggered area triggers (like the old interface (`areatrigger_scripts`.`ScriptName`)). ** OutdoorPvPScript: Script which should return OutdoorPvP objects for use by OutdoorPvPMgr (`outdoorpvp_template`.`ScriptName`). ** CommandScript: Allows extending the in-core command table. ** WeatherScript: Allows scripting of weather changes (`game_weather`.`ScriptName`). ** AuctionHouseScript: Allows scripting of auction events. ** ConditionScript: Allows scripting of conditions (`conditions`.`ScriptName`). ** DynamicObjectScript: Allows scripting of dynamicobjects. ** TransportScript: Allows scripting of transport events (`transports`.`ScriptName`). * OutdoorPvP objects are now created through scripts. This effectively means that they'll need to be moved to scripts before the they're functional again. * The whole idea with this new interface is to allow expanding core functionality without touching core code. If further hooks are needed to expand functionality of the core, let us know; we'll add them, if we agree that it is appropriate to do so. *** NOTE: The scripts project will _not_ build before it has been adapted to the new interface. *** Thanks to everyone who helped out with related preparations and suggestions! --HG-- branch : trunk
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp106
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
2 files changed, 2 insertions, 106 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 9ab9e06b624..c3b132026a1 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -16,7 +16,7 @@ struct TSpellSummary
{
uint8 Targets; // set of enum SelectTarget
uint8 Effects; // set of enum SelectEffect
-} *SpellSummary;
+} extern *SpellSummary;
void SummonList::DoZoneInCombat(uint32 entry)
{
@@ -309,91 +309,6 @@ bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggere
return true;
}
-void FillSpellSummary()
-{
- SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
-
- SpellEntry const* pTempSpell;
-
- 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)
- {
- //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 ||
- 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_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 ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ||
- 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_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 (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
@@ -702,25 +617,6 @@ 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
- goInfo = GOBJECT(187055);
- if (goInfo)
- if (goInfo->type == GAMEOBJECT_TYPE_GOOBER)
- goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN
-
- // Naxxramas : Sapphiron Birth
- goInfo = GOBJECT(181356);
- if (goInfo)
- if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
- goInfo->trap.radius = 50;
-}
-
// SD2 grid searchers.
Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive)
{
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 9b27504c1b7..b4cd3f3eb9e 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -394,7 +394,7 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait
void npc_escortAI::FillPointMovementListForCreature()
{
- std::vector<ScriptPointMove> const &pPointsEntries = pSystemMgr.GetPointMoveList(me->GetEntry());
+ std::vector<ScriptPointMove> const &pPointsEntries = sScriptSystemMgr.GetPointMoveList(me->GetEntry());
if (pPointsEntries.empty())
return;