aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Object/Object.cpp3
-rw-r--r--src/server/game/Entities/Object/Object.h29
-rw-r--r--src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/boss_kazzara_the_hellforged.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp8
-rw-r--r--src/server/scripts/ExilesReach/zone_exiles_reach.cpp18
5 files changed, 15 insertions, 45 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 748213b71e7..461b372cdcb 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -863,9 +863,6 @@ void MovementInfo::OutDebug()
TC_LOG_DEBUG("misc", "standingOnGameObjectGUID: {}", standingOnGameObjectGUID->ToString());
}
-FindCreatureOptions::FindCreatureOptions() = default;
-FindCreatureOptions::~FindCreatureOptions() = default;
-
WorldObject::WorldObject(bool isWorldObject) : Object(), WorldLocation(), LastUsedScriptID(0),
m_movementInfo(), m_name(), m_isActive(false), m_isFarVisible(false), m_isWorldObject(isWorldObject), m_zoneScript(nullptr),
m_transport(nullptr), m_zoneId(0), m_areaId(0), m_staticFloorZ(VMAP_INVALID_HEIGHT), m_outdoors(false), m_liquidStatus(LIQUID_MAP_NO_WATER),
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 58df910745c..e6025514676 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -432,29 +432,8 @@ class FlaggedValuesArray32
T_FLAGS m_flags;
};
-struct TC_GAME_API FindCreatureOptions
+struct FindCreatureOptions
{
- FindCreatureOptions();
- ~FindCreatureOptions();
-
- FindCreatureOptions& SetCreatureId(uint32 creatureId) { CreatureId = creatureId; return *this; }
- FindCreatureOptions& SetStringId(std::string_view stringId) { StringId = stringId; return *this; }
-
- FindCreatureOptions& SetIsAlive(bool isAlive) { IsAlive = isAlive; return *this; }
- FindCreatureOptions& SetIsInCombat(bool isInCombat) { IsInCombat = isInCombat; return *this; }
- FindCreatureOptions& SetIsSummon(bool isSummon) { IsSummon = isSummon; return *this; }
-
- FindCreatureOptions& SetIgnorePhases(bool ignorePhases) { IgnorePhases = ignorePhases; return *this; }
- FindCreatureOptions& SetIgnoreNotOwnedPrivateObjects(bool ignoreNotOwnedPrivateObjects) { IgnoreNotOwnedPrivateObjects = ignoreNotOwnedPrivateObjects; return *this; }
- FindCreatureOptions& SetIgnorePrivateObjects(bool ignorePrivateObjects) { IgnorePrivateObjects = ignorePrivateObjects; return *this; }
-
- FindCreatureOptions& SetHasAura(uint32 spellId) { AuraSpellId = spellId; return *this; }
- FindCreatureOptions& SetOwner(ObjectGuid ownerGuid) { OwnerGuid = ownerGuid; return *this; }
- FindCreatureOptions& SetCharmer(ObjectGuid charmerGuid) { CharmerGuid = charmerGuid; return *this; }
- FindCreatureOptions& SetCreator(ObjectGuid creatorGuid) { CreatorGuid = creatorGuid; return *this; }
- FindCreatureOptions& SetDemonCreator(ObjectGuid demonCreatorGuid) { DemonCreatorGuid = demonCreatorGuid; return *this; }
- FindCreatureOptions& SetPrivateObjectOwner(ObjectGuid privateObjectOwnerGuid) { PrivateObjectOwnerGuid = privateObjectOwnerGuid; return *this; }
-
Optional<uint32> CreatureId;
Optional<std::string_view> StringId;
@@ -472,12 +451,6 @@ struct TC_GAME_API FindCreatureOptions
Optional<ObjectGuid> CreatorGuid;
Optional<ObjectGuid> DemonCreatorGuid;
Optional<ObjectGuid> PrivateObjectOwnerGuid;
-
- FindCreatureOptions(FindCreatureOptions const&) = delete;
- FindCreatureOptions(FindCreatureOptions&&) = delete;
-
- FindCreatureOptions& operator=(FindCreatureOptions const&) = delete;
- FindCreatureOptions& operator=(FindCreatureOptions&&) = delete;
};
class TC_GAME_API WorldObject : public Object, public WorldLocation
diff --git a/src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/boss_kazzara_the_hellforged.cpp b/src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/boss_kazzara_the_hellforged.cpp
index ed7e7328a2c..2cdaaedd6df 100644
--- a/src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/boss_kazzara_the_hellforged.cpp
+++ b/src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/boss_kazzara_the_hellforged.cpp
@@ -68,7 +68,7 @@ struct boss_kazzara_the_hellforged : public BossAI
scheduler.Schedule(1s + 500ms, [this](TaskContext /*context*/)
{
std::vector<Creature*> sunderedMobs;
- GetCreatureListWithOptionsInGrid(sunderedMobs, me, 50.0f, FindCreatureOptions().SetStringId("sundered_mob"));
+ GetCreatureListWithOptionsInGrid(sunderedMobs, me, 50.0f, { .StringId = "sundered_mob" });
for (Creature* sunderedMob : sunderedMobs)
{
if (!sunderedMob->IsAlive() || sunderedMob->IsInCombat())
diff --git a/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp b/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp
index 263c764a098..975e87c5da8 100644
--- a/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp
@@ -476,8 +476,8 @@ public:
void OnConversationCreate(Conversation* conversation, Unit* creator) override
{
- Creature* mathiasObject = GetClosestCreatureWithOptions(creator, 15.0f, FindCreatureOptions().SetIgnorePhases(true).SetCreatureId(NPC_MATHIAS_SHAW));
- Creature* vanessaObject = GetClosestCreatureWithOptions(creator, 15.0f, FindCreatureOptions().SetIgnorePhases(true).SetCreatureId(NPC_VANESSA_VANCLEEF));
+ Creature* mathiasObject = GetClosestCreatureWithOptions(creator, 15.0f, { .CreatureId = NPC_MATHIAS_SHAW, .IgnorePhases = true });
+ Creature* vanessaObject = GetClosestCreatureWithOptions(creator, 15.0f, { .CreatureId = NPC_VANESSA_VANCLEEF, .IgnorePhases = true });
if (!mathiasObject || !vanessaObject)
return;
@@ -589,8 +589,8 @@ public:
void OnConversationCreate(Conversation* conversation, Unit* creator) override
{
- Creature* mathiasObject = GetClosestCreatureWithOptions(creator, 15.0f, FindCreatureOptions().SetIgnorePhases(true).SetCreatureId(NPC_MATHIAS_SHAW));
- Creature* vanessaObject = GetClosestCreatureWithOptions(creator, 15.0f, FindCreatureOptions().SetIgnorePhases(true).SetCreatureId(NPC_VANESSA_VANCLEEF));
+ Creature* mathiasObject = GetClosestCreatureWithOptions(creator, 15.0f, { .CreatureId = NPC_MATHIAS_SHAW, .IgnorePhases = true });
+ Creature* vanessaObject = GetClosestCreatureWithOptions(creator, 15.0f, { .CreatureId = NPC_VANESSA_VANCLEEF, .IgnorePhases = true });
if (!mathiasObject || !vanessaObject)
return;
diff --git a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
index fb9c65ad462..5a73e74bb1b 100644
--- a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
+++ b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
@@ -48,7 +48,7 @@ CreatureAI* GetPrivatePublicPairAISelector(Creature* creature)
static Creature* FindCreatureIgnorePhase(WorldObject const* obj, std::string_view stringId, float range = 100.0f)
{
- return obj->FindNearestCreatureWithOptions(range, FindCreatureOptions().SetIgnorePhases(true).SetStringId(stringId));
+ return obj->FindNearestCreatureWithOptions(range, { .StringId = stringId, .IgnorePhases = true });
}
// ********************************************
@@ -290,7 +290,7 @@ class spell_summon_sparring_partner : public SpellScript
if (!caster)
return;
- Creature* partner = caster->FindNearestCreatureWithOptions(10.0f, FindCreatureOptions().SetIgnorePhases(true).SetStringId(caster->GetTeam() == ALLIANCE ? "q58209_cole" : "q59927_throg"));
+ Creature* partner = FindCreatureIgnorePhase(caster, caster->GetTeam() == ALLIANCE ? "q58209_cole" : "q59927_throg", 10.0f);
if (!partner)
return;
@@ -1469,7 +1469,7 @@ struct npc_bo_beach_laying : public ScriptedAI
{
player->KilledMonsterCredit(me->GetEntry());
- if (Creature* survivor = player->FindNearestCreatureWithOptions(50.0f, FindCreatureOptions().SetStringId("bo_beach").SetIgnorePhases(true)))
+ if (Creature* survivor = FindCreatureIgnorePhase(player, "bo_beach", 50.0f))
survivor->SummonPersonalClone(BoCloneSpawnPosition, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
}
}
@@ -1491,7 +1491,7 @@ struct npc_mithran_dawntracker_beach_laying : public ScriptedAI
{
player->KilledMonsterCredit(me->GetEntry());
- if (Creature* survivor = player->FindNearestCreatureWithOptions(50.0f, FindCreatureOptions().SetStringId("mithran_beach").SetIgnorePhases(true)))
+ if (Creature* survivor = FindCreatureIgnorePhase(player, "mithran_beach", 50.0f))
survivor->SummonPersonalClone(MithranCloneSpawnPosition, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
}
}
@@ -1513,7 +1513,7 @@ struct npc_lana_jordan_beach_laying : public ScriptedAI
{
player->KilledMonsterCredit(me->GetEntry());
- if (Creature* survivor = player->FindNearestCreatureWithOptions(50.0f, FindCreatureOptions().SetStringId("lana_jordan_beach").SetIgnorePhases(true)))
+ if (Creature* survivor = FindCreatureIgnorePhase(player, "lana_jordan_beach", 50.0f))
survivor->SummonPersonalClone(LanaCloneSpawnPosition, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
}
}
@@ -1967,14 +1967,14 @@ public:
player->CastSpell(player, SPELL_UPDATE_PHASE_SHIFT);
player->CastSpell(player, summonSpellId);
- if (Creature* survivor1 = player->FindNearestCreatureWithOptions(25.0f, FindCreatureOptions().SetStringId(survivor1StringId).SetIgnorePhases(true)))
+ if (Creature* survivor1 = FindCreatureIgnorePhase(player, survivor1StringId, 25.0f))
{
Creature* survivor1Personal = survivor1->SummonPersonalClone(survivor1->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
survivor1Personal->SetScriptStringId("spawn_check");
}
- if (Creature* survivor2 = player->FindNearestCreatureWithOptions(25.0f, FindCreatureOptions().SetStringId(survivor2StringId).SetIgnorePhases(true)))
+ if (Creature* survivor2 = FindCreatureIgnorePhase(player, survivor2StringId, 25.0f))
survivor2->SummonPersonalClone(survivor2->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
- if (Creature* survivor3 = player->FindNearestCreatureWithOptions(25.0f, FindCreatureOptions().SetStringId(survivor3StringId).SetIgnorePhases(true)))
+ if (Creature* survivor3 = FindCreatureIgnorePhase(player, survivor3StringId, 25.0f))
survivor3->SummonPersonalClone(survivor3->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
break;
@@ -2030,7 +2030,7 @@ class spell_summon_survivor_beach : public SpellScript
if (!caster)
return;
- Creature* survivor = caster->FindNearestCreatureWithOptions(5.0f, FindCreatureOptions().SetIgnorePhases(true).SetStringId(caster->GetTeam() == ALLIANCE ? "q54952_garrick" : "q59931_grimaxe"));
+ Creature* survivor = FindCreatureIgnorePhase(caster, caster->GetTeam() == ALLIANCE ? "q54952_garrick" : "q59931_grimaxe", 5.0f);
if (!survivor)
return;