TrinityCore
Loading...
Searching...
No Matches
Trinity::Containers Namespace Reference

Namespaces

namespace  Impl
 
namespace  Lists
 

Classes

class  FlatSet
 

Concepts

concept  Map
 

Functions

template<Map M>
auto MapGetValuePtr (M &map, typename M::key_type const &key)
 
template<Map M>
void MultimapErasePair (M &multimap, typename M::key_type const &key, typename M::mapped_type const &value)
 
template<std::ranges::forward_range C>
void RandomResize (C &container, std::size_t requestedSize)
 
template<std::ranges::forward_range C, invocable_r< bool, std::ranges::range_reference_t< C > > Predicate>
void RandomResize (C &container, Predicate &&predicate, std::size_t requestedSize)
 
template<std::ranges::input_range C>
auto SelectRandomContainerElement (C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
 
template<std::ranges::input_range C>
auto SelectRandomWeightedContainerElement (C const &container, std::span< double > const &weights) -> decltype(std::ranges::begin(container))
 
template<std::ranges::input_range C, invocable_r< double, std::ranges::range_reference_t< C > > Fn>
auto SelectRandomWeightedContainerElement (C const &container, Fn weightExtractor) -> decltype(std::ranges::begin(container))
 
template<std::random_access_iterator Iterator>
void RandomShuffle (Iterator begin, Iterator end)
 Reorder the elements of the iterator range randomly.
 
template<std::ranges::random_access_range C>
void RandomShuffle (C &container)
 Reorder the elements of the container randomly.
 
template<std::input_iterator Iterator1, std::sentinel_for< Iterator1 > Sentinel1, std::input_iterator Iterator2, std::sentinel_for< Iterator2 > Sentinel2>
constexpr bool Intersects (Iterator1 first1, Sentinel1 last1, Iterator2 first2, Sentinel2 last2)
 
template<std::input_iterator Iterator1, std::sentinel_for< Iterator1 > Sentinel1, std::input_iterator Iterator2, std::sentinel_for< Iterator2 > Sentinel2, invocable_r< bool, std::iter_reference_t< Iterator1 >, std::iter_reference_t< Iterator2 > > Predicate>
constexpr bool Intersects (Iterator1 first1, Sentinel1 last1, Iterator2 first2, Sentinel2 last2, Predicate &&equalPred)
 
template<std::ranges::forward_range Container, invocable_r< bool, std::ranges::range_reference_t< Container > > Predicate>
requires requires { c.erase(c.begin(), c.end()); }
constexpr void EraseIf (Container &c, Predicate p)
 
template<typename T >
constexpr decltype(auto) EnsureWritableVectorIndex (std::vector< T > &vec, typename std::vector< T >::size_type i)
 
template<typename T >
constexpr decltype(auto) EnsureWritableVectorIndex (std::vector< T > &vec, typename std::vector< T >::size_type i, T const &resizeDefault)
 
template<typename Container , typename NeedleContainer , typename ContainsOperator = StringContainsStringI_T, typename T = void>
auto FuzzyFindIn (Container const &container, NeedleContainer const &needles, ContainsOperator const &contains={}, int(*bonus)(decltype((*std::begin(std::declval< Container >()))))=nullptr)
 
template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair (iterator first, end_iterator second)
 
template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair (std::pair< iterator, end_iterator > iterators)
 
template<class M >
auto MapEqualRange (M &map, typename M::key_type const &key)
 

Variables

constexpr auto MapKey = []<typename Pair>(Pair&& pair) constexpr -> decltype(auto) { return (std::forward<Pair>(pair).first); }
 
constexpr auto MapValue
 

Function Documentation

◆ EnsureWritableVectorIndex() [1/2]

template<typename T >
constexpr decltype(auto) Trinity::Containers::EnsureWritableVectorIndex ( std::vector< T > &  vec,
typename std::vector< T >::size_type  i 
)
inlineconstexprprivate

Returns a mutable reference to element at index i Will resize vector if neccessary to ensure element at i can be safely written

This exists as separate overload instead of one function with default argument to allow using with vectors of non-default-constructible classes

Definition at line 299 of file Containers.h.

Referenced by LootTemplate::AddEntry(), AuraApplication::BuildUpdatePacket(), WorldSession::LoadPlayerDataAccount(), WorldSession::SetPlayerDataFlagAccount(), SpellInfo::SpellInfo(), and SpellInfo::SpellInfo().

◆ EnsureWritableVectorIndex() [2/2]

template<typename T >
constexpr decltype(auto) Trinity::Containers::EnsureWritableVectorIndex ( std::vector< T > &  vec,
typename std::vector< T >::size_type  i,
T const &  resizeDefault 
)
inlineconstexprprivate

Returns a mutable reference to element at index i Will resize vector if neccessary to ensure element at i can be safely written

This overload allows specifying what value to pad vector with during .resize

Definition at line 314 of file Containers.h.

◆ EraseIf()

◆ FuzzyFindIn()

template<typename Container , typename NeedleContainer , typename ContainsOperator = StringContainsStringI_T, typename T = void>
auto Trinity::Containers::FuzzyFindIn ( Container const &  container,
NeedleContainer const &  needles,
ContainsOperator const &  contains = {},
int(*)(decltype((*std::begin(std::declval< Container >()))))  bonus = nullptr 
)

Definition at line 31 of file FuzzyFind.h.

◆ Intersects() [1/2]

template<std::input_iterator Iterator1, std::sentinel_for< Iterator1 > Sentinel1, std::input_iterator Iterator2, std::sentinel_for< Iterator2 > Sentinel2>
constexpr bool Trinity::Containers::Intersects ( Iterator1  first1,
Sentinel1  last1,
Iterator2  first2,
Sentinel2  last2 
)
inlineconstexprprivate

◆ Intersects() [2/2]

template<std::input_iterator Iterator1, std::sentinel_for< Iterator1 > Sentinel1, std::input_iterator Iterator2, std::sentinel_for< Iterator2 > Sentinel2, invocable_r< bool, std::iter_reference_t< Iterator1 >, std::iter_reference_t< Iterator2 > > Predicate>
constexpr bool Trinity::Containers::Intersects ( Iterator1  first1,
Sentinel1  last1,
Iterator2  first2,
Sentinel2  last2,
Predicate &&  equalPred 
)
inlineconstexprprivate

Definition at line 234 of file Containers.h.

◆ MakeIteratorPair() [1/2]

◆ MakeIteratorPair() [2/2]

template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > Trinity::Containers::MakeIteratorPair ( std::pair< iterator, end_iterator >  iterators)
constexprprivate

Definition at line 54 of file IteratorPair.h.

◆ MapEqualRange()

template<class M >
auto Trinity::Containers::MapEqualRange ( M &  map,
typename M::key_type const &  key 
)
private

Definition at line 60 of file IteratorPair.h.

References MakeIteratorPair().

Referenced by FormationMgr::AddCreatureToGroup(), ItemBonusMgr::ApplyBonusTreeHelper(), AuctionHouseObject::BuildListBiddedItems(), AuctionHouseObject::BuildListOwnedItems(), spell_azerite_gen_aura_calc_from_2nd_effect_triggered_spell::CalculateAmount(), ConvertADT(), Map::DespawnAll(), FindNearestMapAssignment(), Unit::GetAuraApplication(), Unit::GetAuraApplication(), ItemBonusMgr::GetAzeriteUnlockBonusList(), ItemBonusMgr::GetBonusListsForItem(), ItemBonusMgr::GetBonusTreeIdOverride(), DB2Manager::GetCurrencyContainerForCurrencyQuantity(), ObjectMgr::GetGossipMenuItemsMapBounds(), ObjectMgr::GetGossipMenuItemsMapBoundsNonConst(), LanguageMgr::GetLanguageDescById(), Player::GetQuestObjectiveForItem(), DB2Manager::GetSkillRaceClassInfo(), DB2Manager::GetSkillRaceClassInfo(), ObjectMgr::GetSpawnMetadataForGroup(), ObjectMgr::GetSpawnMetadataForSpawnTracking(), ObjectMgr::GetSpellClickInfoMapBounds(), SpellMgr::GetSpellLearnedBySpellMapBounds(), SpellMgr::GetSpellsRequiredForSpellBounds(), SpellMgr::GetSpellTargetPositions(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListObjectCommand(), WorldSession::HandleUpdateAuraVisual(), Player::HasQuestForCurrency(), Player::HasQuestForGO(), DB2Manager::IndexLoadedStores(), World::IsBattlePetJournalLockAcquired(), Unit::IsImmunedToSpell(), Unit::IsImmunedToSpellEffect(), Player::ItemRemovedQuestCheck(), TraitMgr::Load(), DB2Manager::LoadHotfixOptionalData(), LanguageMgr::LoadLanguages(), ConversationActorFillVisitor::operator()(), RegularGrid2D< T, Node, NodeCreatorFunc, BoundsFunc >::remove(), Player::UpdateQuestObjectiveProgress(), and DB2Manager::Zone2MapCoordinates().

◆ MapGetValuePtr()

template<Map M>
auto Trinity::Containers::MapGetValuePtr ( M &  map,
typename M::key_type const &  key 
)
inline

Returns a pointer to mapped value (or the value itself if map stores pointers)

Definition at line 37 of file MapUtils.h.

Referenced by Player::_LoadInventory(), Player::_LoadMail(), TraitMgr::AddSpentCurrenciesForEntry(), ItemBonusMgr::ApplyBonusTreeHelper(), Player::AreaExploredOrEventHappens(), AuctionHouseObject::BuildListAuctionItems(), AuctionHouseObject::BuildListBiddedItems(), AuctionHouseObject::BuildListOwnedItems(), ObjectMgr::BuildPlayerLevelInfo(), CalculateGlobalUiMapPosition(), ItemBonusMgr::CanApplyBonusTreeToItem(), TraitMgr::CanApplyTraitNode(), Player::CompleteQuest(), ConvertADT(), TraitMgr::CountTraitNodeRanks(), Player::DeleteFromDB(), SmoothPhasing::DisableReplacementForSeer(), DB2Manager::EvaluateExpectedStat(), TraitMgr::FillOwnedCurrenciesMap(), BattlegroundMgr::FindBattlegroundScriptTemplate(), LanguageMgr::FindWordGroup(), ObjectMgr::GetAccessRequirement(), AchievementGlobalMgr::GetAchievementScriptId(), GetAISpellInfo(), AuctionHouseMgr::GetAItem(), Aura::GetApplicationOfTarget(), Aura::GetApplicationOfTarget(), ObjectMgr::GetAreaTrigger(), AreaTriggerDataStore::GetAreaTriggerCreateProperties(), ObjectMgr::GetAreaTriggerPolygon(), AreaTriggerDataStore::GetAreaTriggersForMapAndGrid(), AreaTriggerDataStore::GetAreaTriggerSpawn(), AreaTriggerDataStore::GetAreaTriggerTemplate(), DB2Manager::GetArtifactPowerLinks(), DB2Manager::GetArtifactPowerRank(), AuctionHouseObject::GetAuction(), DB2Manager::GetAzeriteEmpoweredItem(), DB2Manager::GetAzeriteEssencePower(), DB2Manager::GetAzeritePowers(), BattlefieldMgr::GetBattlefieldByBattleId(), Battleground::GetBattlegroundScore(), BattlePets::BattlePetMgr::GetBattlePetSpeciesByCreature(), BattlePets::BattlePetMgr::GetBattlePetSpeciesBySpell(), DB2Manager::GetBroadcastTextDuration(), ObjectMgr::GetCellPersonalObjectGuids(), DB2Manager::GetCharBaseInfo(), DB2Manager::GetChrModel(), DB2Manager::GetConditionalChrModel(), TraitMgr::GetConfigTypeForTree(), ConversationDataStore::GetConversationLineTemplate(), ConversationDataStore::GetConversationTemplate(), SpellMgr::GetCreatureImmunities(), DB2Manager::GetCreatureLabels(), ObjectMgr::GetCreatureMovementOverride(), ObjectMgr::GetCreatureQuestCurrencyList(), ObjectMgr::GetCreatureQuestItemList(), ObjectMgr::GetCreatureStaticFlagsOverride(), ObjectMgr::GetCreatureSummonedData(), ObjectMgr::GetCreatureTemplate(), ObjectMgr::GetCreatureTemplateSparringValues(), CriteriaMgr::GetCriteriaByFailEvent(), CriteriaMgr::GetCriteriaByStartEvent(), CriteriaMgr::GetCriteriaDataSet(), CriteriaMgr::GetCriteriaTreesByCriteria(), DB2Manager::GetCurveXAxisRange(), DB2Manager::GetCustomiztionChoices(), DB2Manager::GetCustomiztionOptions(), TransmogMgr::GetDefaultItemModifiedAppearance(), ObjectMgr::GetDestructibleHitpoint(), spell_gen_battleground_mercenary_shapeshift::GetDisplayIdForRace(), CalendarMgr::GetEventInvites(), DB2Manager::GetFactionTeamList(), GetFlyByCameras(), ReputationMgr::GetForcedRankIfAny(), FormationMgr::GetFormationInfo(), DB2Manager::GetFriendshipRepReactions(), Battlenet::Session::GetGameAccountInfo(), DB2Manager::GetGameObjectLabels(), ObjectMgr::GetGameObjectOverride(), ObjectMgr::GetGameObjectTemplate(), DB2Manager::GetGlyphBindableSpells(), DB2Manager::GetGlyphRequiredSpecs(), GameObject::GetGoStateFor(), ObjectMgr::GetGridObjectGuids(), DB2Manager::GetHeirloomByItemId(), DB2Manager::GetHotfixBlobData(), DB2Manager::GetHotfixOptionalData(), SmoothPhasing::GetInfoForSeer(), WorldStateMgr::GetInitialWorldStatesForMap(), ItemBonusMgr::GetItemBonuses(), ItemBonusMgr::GetItemBonusListForItemLevelDelta(), DB2Manager::GetItemChildEquipment(), DB2Manager::GetItemLimitCategoryConditions(), DB2Manager::GetItemSetSpells(), DB2Manager::GetItemSpecOverrides(), ObjectMgr::GetItemTemplate(), ObjectMgr::GetJumpChargeParams(), Conversation::GetLineStartTime(), LootStore::GetLootFor(), LootStore::GetLootForConditionFill(), GameObject::GetLootForPlayer(), Creature::GetLootForPlayer(), DB2Manager::GetMapDifficultyConditions(), ObjectMgr::GetMapObjectGuids(), DB2Manager::GetMount(), DB2Manager::GetMountCapabilities(), DB2Manager::GetMountDisplays(), Trinity::Timezone::GetOffsetByHash(), DB2Manager::GetParagonReputation(), DB2Manager::GetPath(), WaypointMgr::GetPath(), npc_basic_hidden_no_more_private::GetPathDelay(), World::GetPersistentWorldVariable(), BattlePets::BattlePetMgr::GetPet(), ObjectMgr::GetPhaseInfo(), ObjectMgr::GetPhasesForArea(), DB2Manager::GetPhasesForGroup(), ObjectMgr::GetPlayerChoice(), ObjectMgr::GetPlayerInfo(), ObjectMgr::GetPlayerLevelInfo(), PoolMgr::GetPoolTemplate(), DB2Manager::GetPVPStatIDsForMap(), ObjectMgr::GetQuestGreeting(), ObjectMgr::GetQuestGreetingLocale(), ObjectMgr::GetQuestPOIData(), RealmList::GetRealm(), DB2Manager::GetRedirectedContentTuningId(), DB2Manager::GetRequiredAzeriteLevelForAzeritePowerTier(), DB2Manager::GetRequiredCustomizationChoices(), DB2Manager::GetRewardPackCurrencyTypesByRewardID(), DB2Manager::GetRewardPackItemsByRewardID(), CriteriaMgr::GetScenarioCriteriaByTypeAndScenario(), DB2Manager::GetShapeshiftFormModelData(), DB2Manager::GetSkillLineAbilitiesBySkill(), DB2Manager::GetSkillLinesForParentSkill(), DB2Manager::GetSoulbindConduitRank(), ObjectMgr::GetSpawnTrackingData(), DB2Manager::GetSpecializationSpells(), SpellMgr::GetSpellLinked(), SpellMgr::GetSpellProcEntry(), DB2Manager::GetSpellVisualMissiles(), Player::GetStoredAuraTeleportLocation(), TraitMgr::GetSubTreeCurrency(), DB2Manager::GetTaxiPath(), ObjectMgr::GetTerrainSwapInfo(), DB2Manager::GetTextSoundEmoteFor(), MMAP::MapBuilder::getTileList(), ObjectMgr::GetTrainer(), TraitMgr::GetTraitDefinitionEffectPointModifiers(), Player::GetTraitInfoForSpell(), TransmogMgr::GetTransmogIllusionForSpellItemEnchantment(), TransportMgr::GetTransportAnimInfo(), TransportMgr::GetTransportSpawn(), TransportMgr::GetTransportTemplate(), TraitMgr::GetTreesForConfig(), ObjectMgr::GetUiMapQuestLinesList(), ObjectMgr::GetUiMapQuestsList(), LootItem::GetUiTypeForPlayer(), WorldStateMgr::GetValue(), ObjectMgr::GetVehicleTemplate(), WeatherMgr::GetWeatherData(), DB2Manager::GetWMOAreaTable(), ObjectMgr::GetWorldSafeLoc(), WorldStateMgr::GetWorldStateTemplate(), Map::GetWorldStateValue(), Map::GetZoneWeather(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleCharEnum(), spell_anduin_wrynn_blasphemy::HandleDebuff(), WorldSession::HandleHotfixRequest(), WorldSession::HandleLootMasterGiveOpcode(), TraitMgr::HasEnoughCurrency(), Loot::hasItemFor(), ObjectMgr::HasPersonalSpawns(), LootStore::HaveQuestLootFor(), LootStore::HaveQuestLootForPlayer(), DB2Manager::IndexLoadedStores(), TraitMgr::InitializeStarterBuildTraitConfig(), PoolMgr::InitPoolsForMap(), MMAP::MapBuilder::isBattlegroundMap(), SmoothPhasing::IsBeingReplacedForSeer(), MMAP::MapBuilder::isDevMap(), PlayerPersonalPhasesTracker::IsGridLoadedForPhase(), GameObject::IsInvisibleDueToDespawn(), IsLiquidIgnored(), ObjectMgr::IsQuestObjectiveForSpawnTracking(), MMAP::MapBuilder::isTransportMap(), TraitMgr::IsValidEntry(), QuestMgr::Load(), TraitMgr::Load(), ObjectMgr::LoadAreaPhases(), AreaTriggerDataStore::LoadAreaTriggerTemplates(), BattlegroundMgr::LoadBattlegroundScriptTemplate(), ConversationDataStore::LoadConversationTemplates(), CriteriaMgr::LoadCriteriaList(), CriteriaMgr::LoadCriteriaModifiersTree(), WorldStateMgr::LoadFromDB(), ObjectMgr::LoadGossipMenuItems(), DB2Manager::LoadHotfixData(), InstanceScenario::LoadInstanceData(), ObjectMgr::LoadItemTemplates(), MMAP::MMapManager::loadMap(), MMAP::MMapManager::loadMapInstance(), WaypointMgr::LoadPathNodesFromDB(), ObjectMgr::LoadPlayerChoices(), ObjectMgr::LoadPlayerInfo(), ObjectMgr::LoadQuestPOI(), ScenarioMgr::LoadScenarioPOI(), SpellMgr::LoadSpellInfoStore(), ObjectMgr::LoadTrainers(), MultiPersonalPhaseTracker::MarkAllPhasesForDeletion(), CreatureGroup::MemberEngagingTarget(), CriteriaHandler::ModifierSatisfied(), Loot::OnLootOpened(), MultiPersonalPhaseTracker::OnOwnerPhaseChanged(), PlayerPersonalPhasesTracker::OnOwnerPhasesChanged(), ParsMapFiles(), ObjectMgr::PlayerCreateInfoAddItemHelper(), ThreatManager::ProcessAIUpdates(), WaypointMgr::ReloadPath(), BattlegroundMgr::RemoveFromBGFreeSlotQueue(), Player::RemoveStoredAuraTeleportLocation(), CalendarMgr::SendCalendarEvent(), Player::SendPlayerChoice(), CombatManager::SetInCombatWith(), CollectionMgr::SetWarbandSceneIsFavorite(), quest_brace_for_impact::SpawnPet(), TraitMgr::TakeCurrencyCost(), MultiPersonalPhaseTracker::UnregisterTrackedObject(), go_cheer_speaker::go_cheer_speakerAI::UpdateAI(), Battleground::UpdatePvpStat(), RealmList::UpdateRealms(), and TraitMgr::ValidateConfig().

◆ MultimapErasePair()

template<Map M>
void Trinity::Containers::MultimapErasePair ( M &  multimap,
typename M::key_type const &  key,
typename M::mapped_type const &  value 
)

◆ RandomResize() [1/2]

template<std::ranges::forward_range C, invocable_r< bool, std::ranges::range_reference_t< C > > Predicate>
void Trinity::Containers::RandomResize ( C &  container,
Predicate &&  predicate,
std::size_t  requestedSize 
)
private

First use predicate filter

Definition at line 92 of file Containers.h.

References RandomResize().

◆ RandomResize() [2/2]

template<std::ranges::forward_range C>
void Trinity::Containers::RandomResize ( C &  container,
std::size_t  requestedSize 
)
private

Definition at line 67 of file Containers.h.

References urand().

Referenced by boss_earthrager_ptah::DamageTaken(), boss_mandokir::DoAction(), SummonList::DoActionImpl(), spell_scion_of_eternity_arcane_barrage::FilterMeleeHoverDiskPassangers(), spell_item_bracing_chill_search_jump_target::FilterTarget(), spell_priestess_alun_za_tainted_blood::FilterTargets(), spell_argaloth_fel_firestorm_forcecast::FilterTargets(), spell_occuthar_focused_fire::spell_occuthar_focused_fire_SpellScript::FilterTargets(), spell_occuthar_eyes_of_occuthar::spell_occuthar_eyes_of_occuthar_SpellScript::FilterTargets(), spell_opera_pick_red_riding_hood::FilterTargets(), Scripts::EasternKingdoms::Westfall::spell_westfall_unbound_energy::FilterTargets(), spell_akilzon_eagle_swoop_primer::FilterTargets(), spell_akilzon_electrical_overload_primer::FilterTargets(), spell_malacrass_siphon_soul::FilterTargets(), spell_malacrass_mind_control::FilterTargets(), spell_janalai_hatch_eggs::FilterTargets(), spell_nalorakk_surge::FilterTargets(), spell_anetheron_sleep::FilterTargets(), spell_azgalor_doom::FilterTargets(), spell_baleroc_countdown_aoe_dummy::FilterTargets(), spell_anraphet_alpha_beams::FilterTargets(), spell_earthrager_ptah_flame_bolt::FilterTargets(), spell_moam_drain_mana::FilterTargets(), spell_saviana_conflagration_init::FilterTargets(), spell_blood_queen_bloodbolt::FilterTargets(), spell_putricide_unbound_plague::FilterTargets(), spell_rotface_vile_gas_trigger::FilterTargets(), spell_sindragosa_unchained_magic::FilterTargets(), spell_darkfallen_blood_mirror::FilterTargets(), spell_malygos_arcane_storm::FilterTargets(), spell_pursue::spell_pursue_SpellScript::FilterTargets(), spell_hodir_icicle::FilterTargets(), spell_hodir_icicle_force_cast::FilterTargets(), spell_hodir_dispel_magic::FilterTargets(), spell_hodir_storm_cloud_primer::FilterTargets(), spell_hodir_melt_ice::FilterTargets(), spell_lady_vashj_summon_wave_mob_trigger::FilterTargets(), spell_lady_vashj_spore_drop_effect::FilterTargets(), spell_leotheras_the_blind_insidious_whisper::FilterTargets(), spell_morogrim_tidewalker_watery_grave::FilterTargets(), spell_ahune_ice_spear_target_picker::FilterTargets(), spell_hungarfen_putrid_mushroom_primer::FilterTargets(), spell_the_black_stalker_someone_grab_me::FilterTargets(), spell_omor_the_unscarred_orbital_strike_target::FilterTargets(), spell_magtheridon_blaze_target::FilterTargets(), spell_magtheridon_quake_target_selector::FilterTargets(), spell_magtheridon_debris::FilterTargets(), spell_kaelthas_mind_control::FilterTargets(), spell_kaelthas_pure_nether_beam::FilterTargets(), spell_anduin_wrynn_blasphemy::FilterTargets(), spell_dru_starfall_dummy::FilterTargets(), spell_evo_azure_strike::FilterTargets(), spell_item_taunt_flag_targeting::FilterTargets(), spell_pal_holy_prism_selector::FilterTargets(), spell_pri_whispering_shadows_effect::FilterTargets(), spell_sha_path_of_flames_spread::FilterTargets(), UnitAI::FinalizeTargetListSelection(), npc_sparring_partner_exiles_reach::GetRandomSparPoint(), SmartScript::GetTargets(), boss_thorim::boss_thorimAI::GetTrashSpawnTriggers(), spell_anduin_wrynn_grim_reflections::HandleCast(), spell_dru_power_of_the_archdruid::HandleProc(), spell_kaelthas_nether_beam::HandleScript(), npc_corrupted_lightning_totem::JustAppeared(), npc_sparring_partner_combat_training::MovementInform(), TargetHandler::PreferNonTankTargetsAndResizeTargets(), SmartScript::ProcessAction(), spell_dru_shooting_stars::ProcessDoT(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::ProcessEvent(), RandomResize(), BlackMarketMgr::RefreshAuctions(), spell_svalna_revive_champion::RemoveAliveTarget(), GarrisonMgr::RollFollowerAbilities(), battleground_seething_shore::SelectAzeriteNodesToSpawn(), battleground_seething_shore::SelectBuffsToSpawn(), Spell::SelectImplicitAreaTargets(), Spell::SelectImplicitConeTargets(), spell_halion_spawn_living_embers::SelectMeteorFlames(), spell_gen_random_aggro_taunt::SelectRandomTarget(), spell_lockmaw_scent_of_blood::SelectTarget(), spell_warl_seed_of_corruption_dummy::SelectTarget(), spell_malygos_surge_of_power_warning_selector_25::SendThreeTargets(), PoolGroup< T >::SpawnObject(), npc_redridge_huge_boulder::UpdateAI(), boss_azhiccar::UpdateAI(), boss_blood_queen_lana_thel::UpdateAI(), and boss_festergut::UpdateAI().

◆ RandomShuffle() [1/2]

template<std::ranges::random_access_range C>
void Trinity::Containers::RandomShuffle ( C &  container)
inlineprivate

Reorder the elements of the container randomly.

Parameters
containerContainer to reorder

Definition at line 184 of file Containers.h.

References RandomShuffle().

◆ RandomShuffle() [2/2]

◆ SelectRandomContainerElement()

template<std::ranges::input_range C>
auto Trinity::Containers::SelectRandomContainerElement ( C const &  container) -> std::add_const_t<decltype(*std::ranges::begin(container))>&
inlineprivate

Definition at line 110 of file Containers.h.

References urand().

Referenced by Player::_SaveCharacterSelectOutfit(), AuctionBotSeller::AddNewAuctions(), boss_sartharion::CastLavaStrikeOnTarget(), lfg::LFGQueue::CheckCompatibility(), boss_general_vezax::boss_general_vezaxAI::CheckPlayersInRange(), go_cheer_speaker::go_cheer_speakerAI::CheerPicker(), spell_dh_shattered_souls_base_lesser::CreateFragments(), boss_lady_deathwhisper::DoImproveCultist(), boss_hexlord_malacrass::DoSpawnCompanions(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::DoSpawnPortal(), boss_gathios_the_shatterer::ExecuteEvent(), spell_item_bracing_chill_search_jump_target::FilterTarget(), spell_send_mug_target_picker::FilterTargets(), spell_shazzrah_gate_dummy::FilterTargets(), spell_apothecary_validate_area::FilterTargets(), spell_mandokir_decapitate::FilterTargets(), spell_mandokir_devastating_slam::FilterTargets(), spell_mandokir_ohgan_orders::FilterTargets(), spell_kurinnaxx_sand_trap::FilterTargets(), spell_paletress_summon_memory::spell_paletress_summon_memory_SpellScript::FilterTargets(), spell_mistress_kiss_area::FilterTargets(), spell_devourer_of_souls_mirrored_soul_target_selector::FilterTargets(), spell_deathbringer_boiling_blood::FilterTargets(), spell_igb_burning_pitch_selector::FilterTargets(), spell_rotface_mutated_infection::FilterTargets(), spell_rotface_vile_gas_trigger::FilterTargets(), spell_frostwarden_handler_order_whelp::FilterTargets(), spell_dreamwalker_summoner::FilterTargets(), spell_mimiron_fire_search::spell_mimiron_fire_search_SpellScript::FilterTargets(), spell_mimiron_napalm_shell::spell_mimiron_napalm_shell_SpellScript::FilterTargets(), spell_mimiron_rocket_strike_target_select::spell_mimiron_rocket_strike_target_select_SpellScript::FilterTargets(), spell_mimiron_summon_frost_bomb_target::spell_mimiron_summon_frost_bomb_target_SpellScript::FilterTargets(), spell_thorim_charge_orb::spell_thorim_charge_orb_SpellScript::FilterTargets(), spell_thorim_stormhammer::spell_thorim_stormhammer_SpellScript::FilterTargets(), spell_talon_king_ikiss_blink::FilterTargets(), spell_illidan_agonizing_flames::FilterTargets(), spell_illidan_find_target::FilterTargets(), spell_grand_warlock_nethekurse_target_fissures::FilterTargets(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), spell_friendish_soul_explosion::FilterTargets(), UnitAI::FinalizeTargetSelection(), go_cheer_speaker::go_cheer_speakerAI::FireworksBIGOnlyPicker(), go_cheer_speaker::go_cheer_speakerAI::FireworksPicker(), Unit::GetModelForForm(), DB2Manager::GetNameGenEntry(), npc_illidari_fighting_invasion_begins::GetNextTarget(), boss_slagmaw::GetNextTeleportSpell(), AuctionBotConfig::GetRandChar(), AuctionBotConfig::GetRandCharExclude(), GetRandomBossExcept(), spell_baleroc_shards_of_torment_target_search::GetRandomContainerElement(), spell_xt002_heart_overload_periodic::GetRandomToyPile(), boss_thorim::boss_thorimAI::GetTrashSpawnTriggers(), WorldSession::HandleActivateTaxiOpcode(), spell_hallows_end_childrens_custome_aura::HandleAfterApply(), spell_apothecary_lingering_fumes::HandleAfterCast(), AuraEffect::HandleAuraMounted(), spell_ragnaros_lava_burst::HandleDummy(), spell_hallow_end_candy::HandleDummy(), spell_free_webbed::HandleDummy(), spell_free_webbed_on_quest::HandleDummy(), spell_borean_tundra_nerubar_web_random_unit_not_on_quest_dummy::HandleDummy(), spell_borean_tundra_nerubar_web_random_unit_on_quest_dummy::HandleDummy(), spell_fjord_rivenwood_captives_not_on_quest::HandleDummy(), spell_fjord_rivenwood_captives_on_quest::HandleDummy(), spell_terokkar_free_webbed::HandleDummy(), spell_terokkar_free_webbed_on_quest::HandleDummy(), spell_dk_army_transform::HandleDummy(), spell_gen_spectator_cheer_trigger::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_rog_killing_spree_aura::HandleEffectPeriodic(), spell_frostwarden_handler_order_whelp::HandleForcedCast(), spell_blood_mirror_selector::HandleHit(), arena_nokhudon_proving_grounds::HandleKill(), spell_gen_ancestral_call::HandleOnCast(), spell_hallows_end_childrens_custome_aura::HandlePeriodic(), spell_item_aura_of_madness::HandleProc(), spell_item_deathbringers_will< StrengthSpellId, AgilitySpellId, APSpellId, CriticalSpellId, HasteSpellId >::spell_item_deathbringers_will_AuraScript< Strength, Agility, AttackPower, Critical, Haste >::HandleProc(), spell_dru_luxuriant_soil::HandleProc(), spell_bg_seething_shore_azerite_geyser::HandleRemove(), spell_love_is_in_the_air_create_heart_candy::HandleScript(), spell_winter_veil_px_238_winter_wondervolt::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_borean_tundra_shortening_blaster::HandleScript(), spell_icecrown_chum_the_water::HandleScript(), spell_dreamwalker_summon_suppresser::HandleSummon(), spell_gatewatcher_subboss_trigger::HandleTargets(), spell_sha_liquid_magma_totem::HandleTargetSelect(), spell_item_wormhole_pandaria::HandleTeleport(), boss_attumen::boss_attumenAI::IsSummonedBy(), npc_joren_ironstock::JustAppeared(), npc_voidwalker_summoner::JustAppeared(), Scripts::Pandaria::TheWanderingIsle::npc_instructor_zhi::JustAppeared(), Creature::LoadCreaturesSparringHealth(), npc_cw_area_trigger::npc_cw_area_triggerAI::MoveInLineOfSight(), npc_valarjar_paying_respect_to_odyn::MovementInform(), spell_anduin_wrynn_march_of_the_damned::OnPeriodic(), Creature::OverrideSparringHealthPct(), spell_thorim_activate_lightning_orb_periodic::spell_thorim_activate_lightning_orb_periodic_AuraScript::PeriodicTick(), Scripts::Pandaria::TheWanderingIsle::npc_tushui_huojin_trainee::PlayRandomEmote(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), LootTemplate::ProcessPersonalLoot(), npc_feasting_valarjar::Reset(), npc_spectating_valarjar::Reset(), npc_weapon_inspector_valarjar::Reset(), DarkFallenAI::Reset(), LootTemplate::LootGroup::Roll(), BattlePets::BattlePetMgr::RollPetBreed(), boss_xevozz::ScheduleTasks(), npc_icc_orb_controller::ScheduleVisualChannel(), spell_item_mad_alchemists_potion::SecondaryEffect(), spell_item_crazy_alchemists_potion::SecondaryEffect(), Spell::SelectImplicitCasterDestTargets(), Spell::SelectImplicitCasterObjectTargets(), Unit::SelectNearbyTarget(), boss_blood_queen_lana_thel::SelectRandomTarget(), spell_siege_cannon::spell_siege_cannon_SpellScript::SelectRandomTarget(), spell_igb_rocket_artillery::SelectRandomTarget(), spell_putricide_ooze_channel::SelectTarget(), spell_the_lich_king_valkyr_target_search::SelectTarget(), spell_the_lich_king_vile_spirit_move_target_search::SelectTarget(), npc_minigob_manabonk::SelectTargetInDalaran(), spell_edna_skarden_spawn_rp::SetDest(), spell_priestess_alun_za_ritual::SetDest(), npc_icc_orb_controller::SetGUID(), spell_dh_demonic_appetite::ShatterLesserSoulFragment(), npc_drustvar_shoot_wickerman_controller::SpawnChargingFamiliar(), boss_malchezaar::boss_malchezaarAI::SummonInfernal(), spell_sha_elemental_blast::TriggerBuff(), spell_pri_ultimate_penitence_channel::TryDealingDamage(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::Update(), boss_garothi_worldbreaker::UpdateAI(), boss_sulfuron::UpdateAI(), boss_headless_horseman::UpdateAI(), go_cheer_speaker::go_cheer_speakerAI::UpdateAI(), npc_arthas_stratholme::npc_arthas_stratholmeAI::UpdateAI(), npc_egg_pile::npc_egg_pileAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_anub_arak::UpdateAI(), boss_festergut::UpdateAI(), npc_captain_arnath::UpdateAI(), boss_anubrekhan::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_emalon::UpdateAI(), boss_vazruden_the_herald::UpdateAI(), boss_warchief_kargath_bladefist::UpdateAI(), boss_high_astromancer_solarian::UpdateAI(), boss_void_reaver::UpdateAI(), npc_infernal_rain_hellfire::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_anduin_wrynn_fiendish_soul::UpdateAI(), npc_brewfest_reveler_2::UpdateAI(), areatrigger_pri_entropic_rift::UpdateTarget(), and GameObject::Use().

◆ SelectRandomWeightedContainerElement() [1/2]

template<std::ranges::input_range C, invocable_r< double, std::ranges::range_reference_t< C > > Fn>
auto Trinity::Containers::SelectRandomWeightedContainerElement ( C const &  container,
Fn  weightExtractor 
) -> decltype(std::ranges::begin(container))
inlineprivate

Definition at line 143 of file Containers.h.

References urand(), and urandweighted().

◆ SelectRandomWeightedContainerElement() [2/2]

template<std::ranges::input_range C>
auto Trinity::Containers::SelectRandomWeightedContainerElement ( C const &  container,
std::span< double > const &  weights 
) -> decltype(std::ranges::begin(container))
inlineprivate

Variable Documentation

◆ MapKey

constexpr auto Trinity::Containers::MapKey = []<typename Pair>(Pair&& pair) constexpr -> decltype(auto) { return (std::forward<Pair>(pair).first); }
inlineconstexpr

◆ MapValue

constexpr auto Trinity::Containers::MapValue
inlineconstexpr
Initial value:
= []<typename Pair>(Pair&& pair) constexpr -> decltype(auto) { return (std::forward<Pair>(pair).second);
}

Map value projection for various std::ranges algorithms

Definition at line 77 of file MapUtils.h.

Referenced by Trinity::Timezone::FindClosestClientSupportedTimezone(), BattlePets::BattlePetMgr::GetPetCount(), BattlePets::BattlePetMgr::GetPetUniqueSpeciesCount(), npc_commandscript::HandleNpcShowLootCommand(), Player::HasQuestForCurrency(), Unit::IsImmunedToSpell(), Unit::IsImmunedToSpellEffect(), Player::RemoveSpell(), and MMAP::MMapManager::unloadMap().