diff --git a/common/emu_constants.h b/common/emu_constants.h index 72ddfa11b..384aa3768 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -307,13 +307,11 @@ namespace EQEmu } // namespace bug - namespace waypoints { - enum WaypointStatus : int { - wpsRoamBoxPauseInProgress = -3, - wpsQuestControlNoGrid = -2, - wpsQuestControlGrid = -1 - }; - } // waypoint_status behavior + enum WaypointStatus : int { + RoamBoxPauseInProgress = -3, + QuestControlNoGrid = -2, + QuestControlGrid = -1 + }; } /*EQEmu*/ diff --git a/zone/mob.h b/zone/mob.h index 080aaf268..a92f5cacb 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1092,7 +1092,7 @@ public: inline glm::vec4 GetCurrentWayPoint() const { return m_CurrentWayPoint; } inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } inline int GetCWP() const { return(cur_wp); } - void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } + void SetCurrentWP(int waypoint) { cur_wp = waypoint; } virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; } virtual const bool IsUnderwaterOnly() const { return false; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 0ed475384..fa4ccc3ab 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1572,14 +1572,12 @@ void NPC::AI_DoMovement() { /** * Roambox logic sets precedence */ - using EQEmu::waypoints::WaypointStatus; - if (roambox_distance > 0) { // Check if we're already moving to a WP // If so, if we're not moving we have arrived and need to set delay - if (GetCWP() == WaypointStatus::wpsRoamBoxPauseInProgress && !IsMoving()) { + if (GetCWP() == EQEmu::WaypointStatus::RoamBoxPauseInProgress && !IsMoving()) { // We have arrived time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay); SetCurrentWP(0); @@ -1657,7 +1655,7 @@ void NPC::AI_DoMovement() { roambox_destination_y); Log(Logs::Detail, Logs::NPCRoamBox, "Dest Z is (%f)", roambox_destination_z); - SetCurrentWP(WaypointStatus::wpsRoamBoxPauseInProgress); + SetCurrentWP(EQEmu::WaypointStatus::RoamBoxPauseInProgress); NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z); } @@ -1671,7 +1669,7 @@ void NPC::AI_DoMovement() { int32 gridno = CastToNPC()->GetGrid(); - if (gridno > 0 || cur_wp == WaypointStatus::wpsQuestControlNoGrid) { + if (gridno > 0 || cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) { if (pause_timer_complete == true) { // time to pause at wp is over AI_SetupNextWaypoint(); } // endif (pause_timer_complete==true) @@ -1703,7 +1701,7 @@ void NPC::AI_DoMovement() { // as that is where roamer is unset and we don't want // the next trip through to move again based on grid stuff. doMove = false; - if (cur_wp == WaypointStatus::wpsQuestControlNoGrid) { + if (cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) { AI_SetupNextWaypoint(); } @@ -1801,11 +1799,9 @@ void NPC::AI_SetupNextWaypoint() { else { pause_timer_complete = false; Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp); - - using EQEmu::waypoints::WaypointStatus; //if we were under quest control (with no grid), we are done now.. - if (cur_wp == WaypointStatus::wpsQuestControlNoGrid) { + if (cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) { Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; diff --git a/zone/spells.cpp b/zone/spells.cpp index c4ba88520..4bcb8b1c3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4206,7 +4206,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNMEZABLE)) { Log(Logs::Detail, Logs::Spells, "We are immune to Mez spells."); - caster->Message_StringID(MT_Shout, CANNOT_MEZ); + caster->Message_StringID(MT_SpellFailure, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { AddToHateList(caster, aggro); @@ -4224,7 +4224,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { Log(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); - caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); + caster->Message_StringID(MT_SpellFailure, CANNOT_MEZ_WITH_SPELL); AddToHateList(caster, 1,0,true,false,false,spell_id); return true; } @@ -4234,7 +4234,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { Log(Logs::Detail, Logs::Spells, "We are immune to Slow spells."); - caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); + caster->Message_StringID(CC_Red, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { AddToHateList(caster, aggro); @@ -4250,7 +4250,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { Log(Logs::Detail, Logs::Spells, "We are immune to Fear spells."); - caster->Message_StringID(MT_Shout, IMMUNE_FEAR); + caster->Message_StringID(CC_Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { AddToHateList(caster, aggro); @@ -4261,7 +4261,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { Log(Logs::Detail, Logs::Spells, "Clients cannot fear eachother!"); - caster->Message_StringID(MT_Shout, IMMUNE_FEAR); + caster->Message_StringID(CC_Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) @@ -4280,7 +4280,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { Message(13, "Your are immune to fear."); Log(Logs::Detail, Logs::Spells, "Clients has WarCry effect, immune to fear!"); - caster->Message_StringID(MT_Shout, IMMUNE_FEAR); + caster->Message_StringID(CC_Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up return true; } } @@ -4290,7 +4290,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(GetSpecialAbility(UNCHARMABLE)) { Log(Logs::Detail, Logs::Spells, "We are immune to Charm spells."); - caster->Message_StringID(MT_Shout, CANNOT_CHARM); + caster->Message_StringID(CC_Red, CANNOT_CHARM); // need to verify message type, not in MQ2Cast for easy look up int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { AddToHateList(caster, aggro); @@ -4303,7 +4303,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { Log(Logs::Detail, Logs::Spells, "You are immune to your own charms."); - caster->Message(MT_Shout, "You cannot charm yourself."); + caster->Message(CC_Red, "You cannot charm yourself."); // need to look up message? return true; } @@ -4316,8 +4316,8 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { Log(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); - caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); - AddToHateList(caster, 1,0,true,false,false,spell_id); + caster->Message_StringID(CC_Red, CANNOT_CHARM_YET); // need to verify message type, not in MQ2Cast for easy look up + AddToHateList(caster, 1,0,true,false,false,spell_id); return true; } } @@ -4331,7 +4331,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNSNAREABLE)) { Log(Logs::Detail, Logs::Spells, "We are immune to Snare spells."); - caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); + caster->Message_StringID(CC_Red, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { AddToHateList(caster, aggro); @@ -4347,7 +4347,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { Log(Logs::Detail, Logs::Spells, "You cannot lifetap yourself."); - caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); + caster->Message_StringID(MT_SpellFailure, CANT_DRAIN_SELF); return true; } } @@ -4357,7 +4357,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { Log(Logs::Detail, Logs::Spells, "You cannot sacrifice yourself."); - caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); + caster->Message_StringID(MT_SpellFailure, CANNOT_SAC_SELF); return true; } } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 7a7ab917e..22d1c9a60 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -108,7 +108,7 @@ void NPC::ResumeWandering() { // we were paused by a quest AI_walking_timer->Disable(); SetGrid(0 - GetGrid()); - if (cur_wp == EQEmu::waypoints::WaypointStatus::wpsQuestControlGrid) + if (cur_wp == EQEmu::WaypointStatus::QuestControlGrid) { // got here by a MoveTo() cur_wp = save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here @@ -164,31 +164,32 @@ void NPC::PauseWandering(int pausetime) return; } -void NPC::MoveTo(const glm::vec4& position, bool saveguardspot) -{ // makes mob walk to specified location - - using EQEmu::waypoints::WaypointStatus; - - if (IsNPC() && GetGrid() != 0) - { // he is on a grid - if (GetGrid() < 0) - { // currently stopped by a quest command - SetGrid(0 - GetGrid()); // get him moving again - Log(Logs::Detail, Logs::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); +void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot) +{ // makes mob walk to specified location + if (IsNPC() && GetGrid() != 0) { // he is on a grid + if (GetGrid() < 0) { // currently stopped by a quest command + SetGrid(0 - GetGrid()); // get him moving again + Log(Logs::Detail, + Logs::AI, + "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", + GetGrid()); } - AI_walking_timer->Disable(); // disable timer in case he is paused at a wp - if (cur_wp >= 0) - { // we've not already done a MoveTo() - save_wp = cur_wp; // save the current waypoint - cur_wp = WaypointStatus::wpsQuestControlGrid; + AI_walking_timer->Disable(); // disable timer in case he is paused at a wp + if (cur_wp >= 0) { // we've not already done a MoveTo() + save_wp = cur_wp; // save the current waypoint + cur_wp = EQEmu::WaypointStatus::QuestControlGrid; } - Log(Logs::Detail, Logs::AI, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d", to_string(static_cast(position)).c_str(), -GetGrid(), save_wp); + Log(Logs::Detail, + Logs::AI, + "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d", + to_string(static_cast(position)).c_str(), + -GetGrid(), + save_wp); } - else - { // not on a grid - roamer = true; + else { // not on a grid + roamer = true; save_wp = 0; - cur_wp = WaypointStatus::wpsQuestControlNoGrid; + cur_wp = EQEmu::WaypointStatus::QuestControlNoGrid; Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast(position)).c_str()); } @@ -197,23 +198,27 @@ void NPC::MoveTo(const glm::vec4& position, bool saveguardspot) m_CurrentWayPoint = position; m_CurrentWayPoint.z = GetFixedZ(dest); - if (saveguardspot) - { + if (saveguardspot) { m_GuardPoint = m_CurrentWayPoint; - if (m_GuardPoint.w == 0) - m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler + if (m_GuardPoint.w == 0) { + m_GuardPoint.w = 0.0001; + } //hack to make IsGuarding simpler if (m_GuardPoint.w == -1) m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y); - Log(Logs::Detail, Logs::AI, "Setting guard position to %s", to_string(static_cast(m_GuardPoint)).c_str()); + Log(Logs::Detail, + Logs::AI, + "Setting guard position to %s", + to_string(static_cast(m_GuardPoint)).c_str()); } - cur_wp_pause = 0; + cur_wp_pause = 0; time_until_can_move = 0; - if (AI_walking_timer->Enabled()) + if (AI_walking_timer->Enabled()) { AI_walking_timer->Start(100); + } } void NPC::UpdateWaypoint(int wp_index)