mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/SmartAI:
- Fixed some issues with SMART_ACTION_SET_FLY (#1073) - Fixed allowing 0 as input for SMART_EVENT_ACCEPTED_QUEST and SMART_EVENT_REWARD_QUEST (#2680) - Some cleanup
This commit is contained in:
19
sql/updates/world/2011_10_24_00_world_sai.sql
Normal file
19
sql/updates/world/2011_10_24_00_world_sai.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Fix sai of Darkspear Scout after recent fixing action 60
|
||||
SET @N_DScout = 40416;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=@N_DScout AND `source_type`=0;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=@N_DScout*100 AND `source_type`=9;
|
||||
INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`)VALUES
|
||||
(@N_DScout,0,0,0,25,0,100,0,0,0,0,0,53,1,@N_DScout,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Start waypath on spawn'),
|
||||
(@N_DScout,0,1,0,25,0,100,0,0,0,0,0,60,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Set fly = 1 on spawn'),
|
||||
(@N_DScout,0,2,0,40,0,100,0,1,@N_DScout,0,0,60,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Set fly = 0 on waypoint 1'),
|
||||
(@N_DScout,0,3,0,40,0,100,0,1,@N_DScout,0,0,59,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Set run = 0 on waypoint 1'),
|
||||
(@N_DScout,0,4,0,40,0,100,0,1,@N_DScout,0,0,43,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Unmount on waypoint 1'),
|
||||
(@N_DScout,0,5,0,40,0,100,0,6,@N_DScout,0,0,54,15000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Pause waypoint on waypoint 6'),
|
||||
(@N_DScout,0,6,0,40,0,100,0,6,@N_DScout,0,0,66,0,0,0,0,0,0,1,0,0,0,0,0,0,0.820305, 'Darkspear Scout: Change orientation on waypoint 6'),
|
||||
(@N_DScout,0,7,0,40,0,100,0,6,@N_DScout,0,0,80,@N_DScout*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Run script on waypoint 6'),
|
||||
(@N_DScout,0,8,0,40,0,100,0,9,@N_DScout,0,0,41,500,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Despawn on waypoint 9'),
|
||||
(@N_DScout*100,9,0,0,0,0,100,0,0,0,0,0,10,1,2,5,66,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Random emote 1,2,5,66'),
|
||||
(@N_DScout*100,9,1,0,0,0,50,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Random text'),
|
||||
(@N_DScout*100,9,2,0,0,0,50,0,1000,1000,0,0,1,0,0,0,0,0,0,9,@N_Voljin,0,15,0,0,0,0, 'Vol''Jin: Reply to Darkspear Scout'),
|
||||
(@N_DScout*100,9,3,0,0,0,100,0,2000,2000,0,0,10,1,2,5,66,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Random emote 1,2,5,66'),
|
||||
(@N_DScout*100,9,4,0,0,0,100,0,6000,6000,0,0,10,1,2,5,66,0,0,1,0,0,0,0,0,0,0, 'Darkspear Scout: Random emote 1,2,5,66');
|
||||
@@ -450,12 +450,14 @@ void SmartAI::EnterEvadeMode()
|
||||
{
|
||||
AddEscortState(SMART_ESCORT_RETURNING);
|
||||
ReturnToLastOOCPos();
|
||||
} else if (mFollowGuid){
|
||||
}
|
||||
else if (mFollowGuid)
|
||||
{
|
||||
if (Unit* target = me->GetUnit(*me, mFollowGuid))
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
} else {
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
}
|
||||
@@ -705,12 +707,25 @@ void SmartAI::SetRun(bool run)
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
else
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
me->SendMovementFlagUpdate();
|
||||
mRun = run;
|
||||
}
|
||||
|
||||
void SmartAI::SetFly(bool fly)
|
||||
{
|
||||
me->SetFlying(fly);
|
||||
if (fly)
|
||||
{
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
|
||||
me->SetFlying(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
|
||||
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
|
||||
me->SetFlying(false);
|
||||
}
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
|
||||
void SmartAI::SetSwim(bool swim)
|
||||
@@ -719,6 +734,7 @@ void SmartAI::SetSwim(bool swim)
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||
else
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
|
||||
void SmartAI::sGossipHello(Player* player)
|
||||
|
||||
@@ -1782,7 +1782,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_JUMP_TO_POS:
|
||||
{
|
||||
if (!me)
|
||||
return;
|
||||
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
|
||||
// TODO: Resume path when reached jump location
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SEND_GOSSIP_MENU:
|
||||
@@ -1795,7 +1800,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
return;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if(Player* player = (*itr)->ToPlayer())
|
||||
if (Player* player = (*itr)->ToPlayer())
|
||||
{
|
||||
if (e.action.sendGossipMenu.gossipMenuId)
|
||||
player->PrepareGossipMenu(GetBaseObject(), e.action.sendGossipMenu.gossipMenuId, true);
|
||||
|
||||
@@ -394,7 +394,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
break;
|
||||
case SMART_EVENT_ACCEPTED_QUEST:
|
||||
case SMART_EVENT_REWARD_QUEST:
|
||||
if (!IsQuestValid(e, e.event.quest.quest)) return false;
|
||||
if (e.event.quest.quest && !IsQuestValid(e, e.event.quest.quest))
|
||||
return false;
|
||||
break;
|
||||
case SMART_EVENT_RECEIVE_EMOTE:
|
||||
{
|
||||
@@ -526,7 +527,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
break;
|
||||
case SMART_ACTION_SOUND:
|
||||
if (!IsSoundValid(e, e.action.sound.sound)) return false;
|
||||
if (!IsSoundValid(e, e.action.sound.sound))
|
||||
return false;
|
||||
if (e.action.sound.range > TEXT_RANGE_WORLD)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range);
|
||||
@@ -539,7 +541,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
break;
|
||||
case SMART_ACTION_FAIL_QUEST:
|
||||
case SMART_ACTION_ADD_QUEST:
|
||||
if (e.action.quest.quest && !IsQuestValid(e, e.action.quest.quest)) return false;
|
||||
if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) return false;
|
||||
break;
|
||||
case SMART_ACTION_ACTIVATE_TAXI:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user