aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/2815_world_SD2_scripts.sql27
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp6
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp25
-rw-r--r--src/bindings/scripts/include/sc_creature.h4
-rw-r--r--src/bindings/scripts/scripts/npc/npc_escortAI.cpp73
-rw-r--r--src/bindings/scripts/scripts/npc/npc_escortAI.h4
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp69
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp22
-rw-r--r--src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/westfall/westfall.cpp25
-rw-r--r--src/game/CreatureAI.h6
12 files changed, 163 insertions, 106 deletions
diff --git a/sql/updates/2815_world_SD2_scripts.sql b/sql/updates/2815_world_SD2_scripts.sql
new file mode 100644
index 00000000000..3a6825ee59a
--- /dev/null
+++ b/sql/updates/2815_world_SD2_scripts.sql
@@ -0,0 +1,27 @@
+DELETE FROM script_waypoint WHERE entry=12423;
+INSERT INTO script_waypoint VALUES
+(12423, 0, -9509.72, -147.03, 58.74, 0, ''),
+(12423, 1, -9517.07, -172.82, 58.66, 0, '');
+
+DELETE FROM script_waypoint WHERE entry=12427;
+INSERT INTO script_waypoint VALUES
+(12427, 0, -5689.20, -456.44, 391.08, 0, ''),
+(12427, 1, -5700.37, -450.77, 393.19, 0, '');
+
+DELETE FROM script_waypoint WHERE entry=12428;
+INSERT INTO script_waypoint VALUES
+(12428, 0, 2454.09, 361.26, 31.51, 0, ''),
+(12428, 1, 2472.03, 378.08, 30.98, 0, '');
+
+DELETE FROM script_waypoint WHERE entry=12429;
+INSERT INTO script_waypoint VALUES
+(12429, 0, 9654.19, 909.58, 1272.11, 0, ''),
+(12429, 1, 9642.53, 908.11, 1269.10, 0, '');
+
+DELETE FROM script_waypoint WHERE entry=12430;
+INSERT INTO script_waypoint VALUES
+(12430, 0, 161.65, -4779.34, 14.64, 0, ''),
+(12430, 1, 140.71, -4813.56, 17.04, 0, '');
+
+UPDATE script_texts SET emote=20 WHERE entry=-1000231;
+UPDATE script_texts SET emote=4 WHERE entry IN (-1000232, -1000256, -1000258, -1000260, -1000262);
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index 850b9bb467f..a87322e33bf 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -693,7 +693,7 @@ void LoadDatabase()
if (!GetLanguageDescByID(temp.Language))
error_db_log("TSCR: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
- if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
+ if (temp.Type > CHAT_TYPE_ZONE_YELL)
error_db_log("TSCR: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
TextMap[i] = temp;
@@ -758,7 +758,7 @@ void LoadDatabase()
if (!GetLanguageDescByID(temp.Language))
error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.",i,temp.Language);
- if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
+ if (temp.Type > CHAT_TYPE_ZONE_YELL)
error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
TextMap[i] = temp;
@@ -823,7 +823,7 @@ void LoadDatabase()
if (!GetLanguageDescByID(temp.Language))
error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.",i,temp.Language);
- if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
+ if (temp.Type > CHAT_TYPE_ZONE_YELL)
error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
TextMap[i] = temp;
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index fcd44d94842..d52e018275e 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -747,6 +747,31 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 s
return pList;
}
+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::SetSheathState(SheathState newState)
+{
+ m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, newState);
+}
+
/*void Scripted_NoMovementAI::MoveInLineOfSight(Unit *who)
{
if( !m_creature->getVictim() && m_creature->canAttack(who) && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) )
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 03194e9a3a9..47850b0d417 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -184,6 +184,10 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
//Checks if you can cast the specified spell
bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered = false);
+
+ void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE);
+
+ void SetSheathState(SheathState newState);
};
struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
index 1b047c624cd..61c14a090d3 100644
--- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
+++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
@@ -95,7 +95,8 @@ void npc_escortAI::EnterEvadeMode()
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
- }else
+ }
+ else
{
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveTargetedHome();
@@ -114,9 +115,9 @@ void npc_escortAI::UpdateAI(const uint32 diff)
if (ReconnectWP)
{
//Correct movement speed
- if (Run)
+ if (bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- else
+ else if (!bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
//Continue with waypoints
@@ -150,13 +151,15 @@ void npc_escortAI::UpdateAI(const uint32 diff)
m_creature->Respawn();
m_creature->GetMotionMaster()->Clear(true);
- //Re-Enable gossip
- m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ //Restore original NpcFlags
+ m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_uiNpcFlags);
IsBeingEscorted = false;
WaitTimer = 0;
return;
- }else{
+ }
+ else
+ {
debug_log("SD2: EscortAI reached end of waypoints with Despawn off");
IsBeingEscorted = false;
WaitTimer = 0;
@@ -194,8 +197,9 @@ void npc_escortAI::UpdateAI(const uint32 diff)
m_creature->Respawn();
m_creature->GetMotionMaster()->Clear(true);
- //Re-Enable gossip
- m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ //Restore original NpcFlags
+ m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_uiNpcFlags);
+
}
PlayerTimer = 1000;
@@ -233,7 +237,8 @@ void npc_escortAI::MovementInform(uint32 type, uint32 id)
Returning = false;
WaitTimer = 1;
- }else
+ }
+ else
{
//Make sure that we are still on the right waypoint
if (CurrentWP->id != id)
@@ -295,6 +300,30 @@ void npc_escortAI::FillPointMovementListForCreature()
}
}
+void npc_escortAI::SetRun(bool bRun)
+{
+ if (bRun)
+ {
+ if (!bIsRunning)
+ {
+ m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ bIsRunning = true;
+ }
+ else
+ debug_log("SD2: EscortAI attempt to set run mode, but is already running.");
+ }
+ else
+ {
+ if (bIsRunning)
+ {
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ bIsRunning = false;
+ }
+ else
+ debug_log("SD2: EscortAI attempt to set walk mode, but is already walking.");
+ }
+}
+
void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
{
if (InCombat)
@@ -303,25 +332,39 @@ void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
return;
}
+ if (IsBeingEscorted)
+ {
+ error_log("SD2: EscortAI attempt to Start while already escorting");
+ return;
+ }
+
if (WaypointList.empty())
{
- debug_log("SD2 ERROR: Call to escortAI::Start with 0 waypoints");
+ error_db_log("SD2: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint)");
return;
}
Attack = bAttack;
Defend = bDefend;
- Run = bRun;
+ bIsRunning = bRun;
PlayerGUID = pGUID;
- debug_log("SD2: EscortAI started with %d waypoints. Attack = %d, Defend = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), Attack, Defend, Run, PlayerGUID);
+ //store original NpcFlags
+ m_uiNpcFlags = m_creature->GetUInt32Value(UNIT_NPC_FLAGS);
+
+ //remove them if any
+ if (m_uiNpcFlags)
+ m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
+
+ debug_log("SD2: EscortAI started with %d waypoints. Attack = %d, Defend = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), Attack, Defend, bIsRunning, PlayerGUID);
CurrentWP = WaypointList.begin();
//Set initial speed
- if (Run)
+ if (bIsRunning)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- else m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ else
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
//Start WP
m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z );
@@ -331,7 +374,5 @@ void npc_escortAI::Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID)
Returning = false;
IsOnHold = false;
- //Disable questgiver flag
- m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
}
diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h
index 503ff614171..23fc2561bf0 100644
--- a/src/bindings/scripts/scripts/npc/npc_escortAI.h
+++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h
@@ -63,6 +63,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
void FillPointMovementListForCreature();
void Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID = 0);
+ void SetRun(bool bRun = true);
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
float GetMaxPlayerDistance() { return MaxPlayerDistance; }
@@ -81,6 +82,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
private:
uint32 WaitTimer;
uint32 PlayerTimer;
+ uint32 m_uiNpcFlags;
float MaxPlayerDistance;
struct
@@ -97,7 +99,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
bool Defend;
bool Returning;
bool ReconnectWP;
- bool Run;
+ bool bIsRunning;
bool CanMelee;
bool DespawnAtEnd;
bool DespawnAtFar;
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index 8257fa60596..15d6370a82c 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -37,6 +37,7 @@ npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap
EndContentData */
#include "precompiled.h"
+#include "../npc/npc_escortAI.h"
/*########
# npc_chicken_cluck
@@ -620,18 +621,9 @@ enum
SAY_SHAYA_GOODBYE = -1000174,
};
-float fRunTo[5][3]=
+struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI
{
- {9661.724, 869.803, 1270.742}, //shaya
- {-9543.747, -117.770, 57.893}, //roberts
- {-5650.226, -473.517, 397.027}, //dolf
- {189.175, -4747.069, 11.215}, //kor'ja
- {2471.303, 371.101, 30.919}, //kel
-};
-
-struct TRINITY_DLL_DECL npc_garments_of_questsAI : public ScriptedAI
-{
- npc_garments_of_questsAI(Creature *c) : ScriptedAI(c) {Reset();}
+ npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();}
uint64 caster;
@@ -652,7 +644,6 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public ScriptedAI
m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
//expect database to have RegenHealth=0
m_creature->SetHealth(int(m_creature->GetMaxHealth()*0.7));
- m_creature->SetVisibility(VISIBILITY_ON);
}
void Aggro(Unit *who) {}
@@ -767,21 +758,8 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public ScriptedAI
}
}
- void MovementInform(uint32 type, uint32 id)
+ void WaypointReached(uint32 uiPoint)
{
- if (type != POINT_MOTION_TYPE)
- return;
-
- //we reached destination, kill ourselves
- if (id == 0)
- {
- m_creature->SetVisibility(VISIBILITY_OFF);
- m_creature->setDeathState(JUST_DIED);
- m_creature->SetHealth(0);
- m_creature->CombatStop();
- m_creature->DeleteThreatList();
- m_creature->RemoveCorpse();
- }
}
void UpdateAI(const uint32 diff)
@@ -794,27 +772,14 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public ScriptedAI
{
switch(m_creature->GetEntry())
{
- case ENTRY_SHAYA:
- DoScriptText(SAY_SHAYA_GOODBYE,m_creature,pUnit);
- m_creature->GetMotionMaster()->MovePoint(0, fRunTo[0][0], fRunTo[0][1], fRunTo[0][2]);
- break;
- case ENTRY_ROBERTS:
- DoScriptText(SAY_ROBERTS_GOODBYE,m_creature,pUnit);
- m_creature->GetMotionMaster()->MovePoint(0, fRunTo[1][0], fRunTo[1][1], fRunTo[1][2]);
- break;
- case ENTRY_DOLF:
- DoScriptText(SAY_DOLF_GOODBYE,m_creature,pUnit);
- m_creature->GetMotionMaster()->MovePoint(0, fRunTo[2][0], fRunTo[2][1], fRunTo[2][2]);
- break;
- case ENTRY_KORJA:
- DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit);
- m_creature->GetMotionMaster()->MovePoint(0, fRunTo[3][0], fRunTo[3][1], fRunTo[3][2]);
- break;
- case ENTRY_DG_KEL:
- DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit);
- m_creature->GetMotionMaster()->MovePoint(0, fRunTo[4][0], fRunTo[4][1], fRunTo[4][2]);
- break;
+ case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,m_creature,pUnit); break;
+ case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,m_creature,pUnit); break;
+ case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,m_creature,pUnit); break;
+ case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit); break;
+ case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit); break;
}
+
+ Start(false,true,true);
}
else
EnterEvadeMode(); //something went wrong
@@ -823,17 +788,17 @@ struct TRINITY_DLL_DECL npc_garments_of_questsAI : public ScriptedAI
}else RunAwayTimer -= diff;
}
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- DoMeleeAttackIfReady();
+ npc_escortAI::UpdateAI(diff);
}
};
CreatureAI* GetAI_npc_garments_of_quests(Creature* pCreature)
{
- return new npc_garments_of_questsAI(pCreature);
+ npc_garments_of_questsAI* tempAI = new npc_garments_of_questsAI(pCreature);
+
+ tempAI->FillPointMovementListForCreature();
+
+ return (CreatureAI*)tempAI;
}
/*######
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 6d36e208a70..ff34df08c4b 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -137,8 +137,8 @@ EndScriptData */
#define FLAME_ENRAGE_DISTANCE 30
#define FLAME_CHARGE_DISTANCE 50
-#define ITEM_ID_MAIN_HAND 32837
-#define ITEM_ID_OFF_HAND 32838
+#define EQUIP_ID_MAIN_HAND 32837
+#define EQUIP_ID_OFF_HAND 32838
/**** Creature Summon and Recognition IDs ****/
enum CreatureEntry
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
index c7b14a0b7ff..4f11af1a5d2 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
@@ -229,12 +229,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
switch( i )
{
case 8:
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun(false);
m_creature->SummonCreature(18764,2181.87,112.46,89.45,0.26,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
break;
case 9:
DoScriptText(SAY_TH_ARMORY, m_creature);
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL);
//m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO);
//m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781);
@@ -246,7 +245,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, THRALL_MODEL_EQUIPPED);
break;
case 11:
- m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun();
break;
case 15:
m_creature->SummonCreature(MOB_ENTRY_RIFLE,2200.28,137.37,87.93,5.07,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
@@ -274,11 +273,12 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
case 30:
IsOnHold = true;
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun(false);
break;
case 31:
DoScriptText(SAY_TH_MOUNTS_UP, m_creature);
DoMount();
+ SetRun();
break;
case 37:
//possibly regular patrollers? If so, remove this and let database handle them
@@ -290,6 +290,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
m_creature->SummonCreature(SKARLOC_MOUNT,2488.64,625.77,58.26,4.71,TEMPSUMMON_TIMED_DESPAWN,10000);
DoUnmount();
HadMount = false;
+ SetRun(false);
break;
case 60:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
@@ -297,9 +298,10 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
IsOnHold = true;
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
pInstance->SetData(TYPE_THRALL_PART2, DONE);
+ SetRun();
break;
case 64:
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun(false);
break;
case 68:
m_creature->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22,692.60,55.50,2.84,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
@@ -308,10 +310,10 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
m_creature->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94,695.81,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
break;
case 71:
- m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun();
break;
case 81:
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun(false);
break;
case 83:
m_creature->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33,646.82,56.03,4.28,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000);
@@ -321,9 +323,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
break;
case 84:
DoScriptText(SAY_TH_CHURCH_END, m_creature);
+ SetRun();
break;
case 91:
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun(false);
break;
case 93:
m_creature->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
@@ -332,7 +336,6 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
m_creature->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39,659.77,61.93,2.61,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
break;
case 94:
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
{
if (Unit* Taretha = Unit::GetUnit((*m_creature), TarethaGUID))
@@ -349,7 +352,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
break;
case 97:
DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, m_creature);
- m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ SetRun();
break;
case 98:
//trigger epoch Yell("Thrall! Come outside and face your fate! ....")
@@ -426,7 +429,6 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
{
m_creature->Mount(SKARLOC_MOUNT_MODEL);
m_creature->SetSpeed(MOVE_RUN,SPEED_MOUNT);
- m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
}
void DoUnmount()
{
diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
index 0278d40a7cb..04ffd78c14b 100644
--- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
+++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
@@ -17,7 +17,7 @@
/* ScriptData
SDName: Tanaris
SD%Complete: 80
-SDComment: Quest support: 2954, 4005, 10277, 648, 10279(Special flight path). Noggenfogger vendor
+SDComment: Quest support: 648, 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor
SDCategory: Tanaris
EndScriptData */
@@ -387,7 +387,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
if (player)
{
DoScriptText(SAY_CHICKEN_COMP, m_creature);
- ((Player*)player)->GroupEventHappens(Q_OOX17, m_creature);
+ player->GroupEventHappens(Q_OOX17, m_creature);
}
break;
}
diff --git a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
index 9f981d4a35c..6eef452270d 100644
--- a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
+++ b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
@@ -38,12 +38,7 @@ EndContentData */
struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
{
- npc_defias_traitorAI(Creature *c) : npc_escortAI(c)
- {
- IsWalking = false;
- }
-
- bool IsWalking;
+ npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); }
void WaypointReached(uint32 i)
{
@@ -52,13 +47,10 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
if (!player)
return;
- if (IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
-
switch (i)
{
case 35:
- IsWalking = true;
+ SetRun(false);
break;
case 36:
DoScriptText(SAY_PROGRESS, m_creature, player);
@@ -66,8 +58,8 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
case 44:
DoScriptText(SAY_END, m_creature, player);
{
- if (player && player->GetTypeId() == TYPEID_PLAYER)
- ((Player*)player)->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,m_creature);
+ if (player)
+ player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,m_creature);
}
break;
}
@@ -82,14 +74,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
}
void Reset()
- {
- if (IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
- {
- m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- return;
- }
- IsWalking = false;
- }
+ {}
void JustDied(Unit* killer)
{
diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
index 41e973f704c..c61a410d9b6 100644
--- a/src/game/CreatureAI.h
+++ b/src/game/CreatureAI.h
@@ -71,6 +71,12 @@ enum SelectAggroTarget
SELECT_TARGET_FARTHEST,
};
+enum SCEquip
+{
+ EQUIP_NO_CHANGE = -1,
+ EQUIP_UNEQUIP = 0
+};
+
class TRINITY_DLL_SPEC UnitAI
{
protected: