mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts: replace some SetOrientation() calls with spline packets and some random changes
This commit is contained in:
@@ -409,7 +409,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
|
||||
if (me->HasReactState(REACT_AGGRESSIVE) && allowAutoSelect)
|
||||
{
|
||||
if (!me->GetCharmInfo()->IsReturning() || me->GetCharmInfo()->IsFollowing() || me->GetCharmInfo()->IsAtStay())
|
||||
if (Unit* nearTarget = me->ToCreature()->SelectNearestHostileUnitInAggroRange(true))
|
||||
if (Unit* nearTarget = me->SelectNearestHostileUnitInAggroRange(true))
|
||||
return nearTarget;
|
||||
}
|
||||
|
||||
|
||||
@@ -525,9 +525,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell);
|
||||
int32 mana = me->GetPower(POWER_MANA);
|
||||
|
||||
if (me->GetDistance((*itr)->ToUnit()) > spellInfo->GetMaxRange(true) ||
|
||||
me->GetDistance((*itr)->ToUnit()) < spellInfo->GetMinRange(true) ||
|
||||
!me->ToUnit()->IsWithinLOSInMap((*itr)->ToUnit()) ||
|
||||
if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) ||
|
||||
me->GetDistance(*itr) < spellInfo->GetMinRange(true) ||
|
||||
!me->IsWithinLOSInMap(*itr) ||
|
||||
mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
|
||||
_allowMove = true;
|
||||
|
||||
|
||||
@@ -821,7 +821,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
return 0;
|
||||
}
|
||||
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
|
||||
{
|
||||
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
|
||||
|
||||
@@ -1574,7 +1574,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
||||
if (!map)
|
||||
return NULL;
|
||||
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
|
||||
{
|
||||
TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
|
||||
|
||||
@@ -1180,7 +1180,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
|
||||
{
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
//TC_LOG_DEBUG("misc", "Spawning creature %u", *itr);
|
||||
if (!creature->LoadCreatureFromDB(*itr, map))
|
||||
delete creature;
|
||||
|
||||
@@ -364,7 +364,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
|
||||
{
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
//TC_LOG_DEBUG("pool", "Spawning creature %u", guid);
|
||||
if (!creature->LoadCreatureFromDB(obj->guid, map))
|
||||
{
|
||||
|
||||
@@ -923,7 +923,7 @@ public:
|
||||
if (!ve)
|
||||
return false;
|
||||
|
||||
Creature* v = new Creature;
|
||||
Creature* v = new Creature();
|
||||
|
||||
Map* map = handler->GetSession()->GetPlayer()->GetMap();
|
||||
|
||||
|
||||
@@ -689,7 +689,7 @@ public:
|
||||
wpCreature->AddObjectToRemoveList();
|
||||
}
|
||||
// re-create
|
||||
Creature* wpCreature2 = new Creature;
|
||||
Creature* wpCreature2 = new Creature();
|
||||
if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
|
||||
@@ -913,7 +913,7 @@ public:
|
||||
Map* map = chr->GetMap();
|
||||
float o = chr->GetOrientation();
|
||||
|
||||
Creature* wpCreature = new Creature;
|
||||
Creature* wpCreature = new Creature();
|
||||
if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
@@ -977,7 +977,7 @@ public:
|
||||
float o = chr->GetOrientation();
|
||||
Map* map = chr->GetMap();
|
||||
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
@@ -1026,7 +1026,7 @@ public:
|
||||
Player* chr = handler->GetSession()->GetPlayer();
|
||||
Map* map = chr->GetMap();
|
||||
|
||||
Creature* creature = new Creature;
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
DoCast(me, SPELL_ICEARMOR, true);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)OVERRIDE { }
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE { }
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
|
||||
@@ -351,8 +351,7 @@ public:
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
me->SetOrientation(me->GetAngle(breathX, breathY));
|
||||
me->StopMoving();
|
||||
me->SetFacingTo(me->GetAngle(breathX, breathY));
|
||||
//DoTextEmote("takes a deep breath.", NULL);
|
||||
events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
|
||||
break;
|
||||
|
||||
@@ -258,7 +258,7 @@ class npc_shade_of_jindo : public CreatureScript
|
||||
DoCast(me, SPELL_INVISIBLE, true);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)OVERRIDE { }
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE { }
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
{
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
break;
|
||||
case 11:
|
||||
Talk(SAY_PROGRESS2, player->GetGUID());
|
||||
me->SetOrientation(4.762841f);
|
||||
me->SetFacingTo(4.762841f);
|
||||
break;
|
||||
case 18:
|
||||
{
|
||||
@@ -186,11 +186,11 @@ public:
|
||||
player->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me);
|
||||
break;
|
||||
case 32:
|
||||
me->SetOrientation(2.978281f);
|
||||
me->SetFacingTo(2.978281f);
|
||||
Talk(SAY_END1, player->GetGUID());
|
||||
break;
|
||||
case 33:
|
||||
me->SetOrientation(5.858011f);
|
||||
me->SetFacingTo(5.858011f);
|
||||
Talk(SAY_END2, player->GetGUID());
|
||||
Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
|
||||
if (CaptainHelios)
|
||||
|
||||
@@ -308,18 +308,15 @@ public:
|
||||
{
|
||||
if (instance)
|
||||
{
|
||||
Unit* pKri = Unit::GetUnit(*me, instance->GetData64(DATA_KRI));
|
||||
Unit* pVem = Unit::GetUnit(*me, instance->GetData64(DATA_VEM));
|
||||
|
||||
switch (urand(0, 2))
|
||||
{
|
||||
case 0:
|
||||
if (pKri)
|
||||
DoCast(pKri, SPELL_HEAL);
|
||||
if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRI)))
|
||||
DoCast(kri, SPELL_HEAL);
|
||||
break;
|
||||
case 1:
|
||||
if (pVem)
|
||||
DoCast(pVem, SPELL_HEAL);
|
||||
if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VEM)))
|
||||
DoCast(vem, SPELL_HEAL);
|
||||
break;
|
||||
case 2:
|
||||
DoCast(me, SPELL_HEAL);
|
||||
|
||||
@@ -551,14 +551,13 @@ public:
|
||||
events.ScheduleEvent(EVENT_SCRIPT_11, 6000);
|
||||
break;
|
||||
case EVENT_SCRIPT_11:
|
||||
me->SetOrientation(2.932153f);
|
||||
me->SendMovementFlagUpdate(true);
|
||||
me->SetFacingTo(2.932153f);
|
||||
Talk(SAY_BRANN_3, playerGUID);
|
||||
|
||||
for (uint8 i = 0; i < 5; ++i)
|
||||
{
|
||||
if (GameObject* go = ObjectAccessor::GetGameObject(*me, objectGUID[i]))
|
||||
go->Delete();
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_SCRIPT_12, 6000);
|
||||
break;
|
||||
case EVENT_SCRIPT_12:
|
||||
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
|
||||
struct npc_commander_dawnforgeAI : public ScriptedAI
|
||||
{
|
||||
npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
|
||||
npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
uint64 PlayerGUID;
|
||||
uint64 ardonisGUID;
|
||||
@@ -411,9 +411,6 @@ public:
|
||||
uint32 Phase_Timer;
|
||||
bool isEvent;
|
||||
|
||||
float angle_dawnforge;
|
||||
float angle_ardonis;
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
PlayerGUID = 0;
|
||||
@@ -438,21 +435,15 @@ public:
|
||||
{
|
||||
Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID);
|
||||
Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID);
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
if (!ardonis || !pathaleon || !player)
|
||||
if (!ardonis || !pathaleon)
|
||||
return;
|
||||
|
||||
//Calculate the angle to Pathaleon
|
||||
angle_dawnforge = me->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY());
|
||||
angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY());
|
||||
// Turn Dawnforge
|
||||
me->SetFacingToObject(pathaleon);
|
||||
|
||||
//Turn Dawnforge and update
|
||||
me->SetOrientation(angle_dawnforge);
|
||||
me->SendUpdateToPlayer(player);
|
||||
//Turn Ardonis and update
|
||||
ardonis->SetOrientation(angle_ardonis);
|
||||
ardonis->SendUpdateToPlayer(player);
|
||||
// Turn Ardonis
|
||||
ardonis->SetFacingToObject(pathaleon);
|
||||
|
||||
//Set them to kneel
|
||||
me->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
@@ -464,20 +455,11 @@ public:
|
||||
{
|
||||
if (Unit* ardonis = ObjectAccessor::GetUnit(*me, ardonisGUID))
|
||||
{
|
||||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
// Turn Dawnforge
|
||||
me->SetFacingToObject(ardonis);
|
||||
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
angle_dawnforge = me->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY());
|
||||
angle_ardonis = ardonis->GetAngle(me->GetPositionX(), me->GetPositionY());
|
||||
|
||||
//Turn Dawnforge and update
|
||||
me->SetOrientation(angle_dawnforge);
|
||||
me->SendUpdateToPlayer(player);
|
||||
//Turn Ardonis and update
|
||||
ardonis->SetOrientation(angle_ardonis);
|
||||
ardonis->SendUpdateToPlayer(player);
|
||||
// Turn Ardonis
|
||||
ardonis->SetFacingToObject(me);
|
||||
|
||||
//Set state
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
Reference in New Issue
Block a user