Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Util.h File Reference
#include "Define.h"
#include "Errors.h"
#include "NetworkAddress.h"
#include <algorithm>
#include <list>
#include <string>
#include <vector>
Include dependency graph for Util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Finder< T, S >
class  flag128
class  flag96
class  HookList< T >
class  Tokenizer

Namespaces

namespace  SkyFire
namespace  SkyFire::Impl

Macros

#define _FLAG96

Enumerations

enum  ComparisionType {
  COMP_TYPE_EQ = 0 , COMP_TYPE_HIGH , COMP_TYPE_LOW , COMP_TYPE_HIGH_EQ ,
  COMP_TYPE_LOW_EQ , COMP_TYPE_MAX
}

Functions

template<class T, class U>
AddPct (T &base, U pct)
template<class T, class U>
ApplyPct (T &base, U pct)
void ApplyPercentModFloatVar (float &var, float val, bool apply)
template<typename Container>
std::string ByteArrayToHexStr (Container const &c, bool reverse=false)
std::string SkyFire::Impl::ByteArrayToHexStr (uint8 const *bytes, size_t length, bool reverse=false)
template<class T, class U>
CalculatePct (T base, U pct)
template<class T>
bool CompareValues (ComparisionType type, T val1, T val2)
bool consoleToUtf8 (const std::string &conStr, std::string &utf8str)
uint32 CreatePIDFile (const std::string &filename)
 create PID file
float frand (float min, float max)
std::string GetAddressString (Skyfire::Net::Address const &addr)
 Transforms network address into string format "dotted_ip:port".
std::wstring GetMainPartOfName (std::wstring wname, uint32 declension)
template<size_t Size>
std::array< uint8, Size > HexStrToByteArray (std::string const &str, bool reverse=false)
template<size_t Size>
void HexStrToByteArray (std::string const &str, std::array< uint8, Size > &buf, bool reverse=false)
void SkyFire::Impl::HexStrToByteArray (std::string const &str, uint8 *out, size_t outlen, bool reverse=false)
bool isBasicLatinCharacter (wchar_t wchar)
bool isBasicLatinString (const std::wstring &wstr, bool numericOrSpace)
bool isCyrillicCharacter (wchar_t wchar)
bool isCyrillicString (const std::wstring &wstr, bool numericOrSpace)
bool isEastAsianCharacter (wchar_t wchar)
bool isEastAsianString (const std::wstring &wstr, bool numericOrSpace)
bool isExtendedLatinCharacter (wchar_t wchar)
bool isExtendedLatinString (const std::wstring &wstr, bool numericOrSpace)
bool IsIPAddress (char const *ipaddress)
 Check if the string is a valid ip address representation.
bool IsIPAddrInNetwork (Skyfire::Net::Address const &net, Skyfire::Net::Address const &addr, Skyfire::Net::Address const &subnetMask)
 Checks if address belongs to the a network with specified submask.
bool isNumeric (char c)
bool isNumeric (char const *str)
bool isNumeric (wchar_t wchar)
bool isNumericOrSpace (wchar_t wchar)
int64 MoneyStringToMoney (const std::string &moneyString)
int32 rand32 ()
double rand_chance (void)
double rand_norm (void)
bool roll_chance_f (float chance)
bool roll_chance_i (int chance)
template<class T>
RoundToInterval (T &num, T floor, T ceil)
std::string secsToTimeString (uint64 timeInSecs, bool shortText=false, bool hoursOnly=false)
void stripLineInvisibleChars (std::string &src)
uint32 TimeStringToSecs (const std::string &timestring)
std::string TimeToTimestampStr (time_t t)
bool Utf8FitTo (const std::string &str, const std::wstring &search)
size_t utf8length (std::string &utf8str)
void utf8printf (FILE *out, const char *str,...)
bool utf8ToConsole (const std::string &utf8str, std::string &conStr)
bool Utf8toWStr (char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
bool Utf8toWStr (const std::string &utf8str, std::wstring &wstr)
bool Utf8toWStr (const std::string &utf8str, wchar_t *wstr, size_t &wsize)
void utf8truncate (std::string &utf8str, size_t len)
void vutf8printf (FILE *out, const char *str, va_list *ap)
wchar_t wcharToLower (wchar_t wchar)
wchar_t wcharToUpper (wchar_t wchar)
wchar_t wcharToUpperOnlyLatin (wchar_t wchar)
void wstrToLower (std::wstring &str)
void wstrToUpper (std::wstring &str)
bool WStrToUtf8 (const std::wstring &wstr, std::string &utf8str)
bool WStrToUtf8 (wchar_t *wstr, size_t size, std::string &utf8str)

Macro Definition Documentation

◆ _FLAG96

#define _FLAG96

Definition at line 365 of file Util.h.

Enumeration Type Documentation

◆ ComparisionType

Enumerator
COMP_TYPE_EQ 
COMP_TYPE_HIGH 
COMP_TYPE_LOW 
COMP_TYPE_HIGH_EQ 
COMP_TYPE_LOW_EQ 
COMP_TYPE_MAX 

Definition at line 687 of file Util.h.

Function Documentation

◆ AddPct()

template<class T, class U>
T AddPct ( T & base,
U pct )
inline

Definition at line 109 of file Util.h.

References CalculatePct().

Referenced by KillRewarder::_RewardXP(), Player::AddSpellMod(), HostileReference::addThreatPercent(), Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), spell_pri_lightwell_renew::spell_pri_lightwell_renew_AuraScript::CalculateAmount(), Unit::CalculateLevelPenalty(), Unit::CalculateMeleeDamage(), Unit::CalculateSpellDamageTaken(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount(), Spell::Delayed(), Spell::DelayedChannel(), Spell::EffectEnergize(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), Unit::GetTotalAuraMultiplier(), Unit::GetTotalAuraMultiplierByAffectMask(), Unit::GetTotalAuraMultiplierByMiscMask(), Unit::GetTotalAuraMultiplierByMiscValue(), spell_mastery_blood_shield::spell_mastery_blood_shield_SpellScript::HandleAfterHit(), spell_dk_death_strike::spell_dk_death_strike_SpellScript::HandleDummy(), spell_dk_scourge_strike::spell_dk_scourge_strike_SpellScript::HandleDummy(), spell_sha_healing_stream_totem::spell_sha_healing_stream_totem_SpellScript::HandleDummy(), spell_sha_lava_lash::spell_sha_lava_lash_SpellScript::HandleDummy(), spell_warl_life_tap::spell_warl_life_tap_SpellScript::HandleDummy(), Unit::HandleDummyAuraProc(), spell_pri_prayer_of_mending_heal::spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal(), AuraEffect::HandlePeriodicHealAurasTick(), Unit::MeleeDamageBonusDone(), Unit::MeleeDamageBonusTaken(), Unit::ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::RegenerateMana(), Player::RewardHonor(), Player::RewardQuest(), Unit::RewardRage(), Unit::SpellCriticalDamageBonus(), Unit::SpellDamageBonusDone(), Unit::SpellDamageBonusTaken(), Unit::SpellHealingBonusDone(), Unit::SpellHealingBonusTaken(), Guardian::UpdateDamagePhysical(), and Unit::UpdateSpeed().

◆ ApplyPct()

template<class T, class U>
T ApplyPct ( T & base,
U pct )
inline

◆ ApplyPercentModFloatVar()

◆ ByteArrayToHexStr()

template<typename Container>
std::string ByteArrayToHexStr ( Container const & c,
bool reverse = false )

Definition at line 344 of file Util.h.

References SkyFire::Impl::ByteArrayToHexStr().

◆ CalculatePct()

template<class T, class U>
T CalculatePct ( T base,
U pct )
inline

Definition at line 103 of file Util.h.

Referenced by KillRewarder::_RewardXP(), spell_dk_anti_magic_shell_raid::spell_dk_anti_magic_shell_raid_AuraScript::Absorb(), spell_dk_anti_magic_shell_self::spell_dk_anti_magic_shell_self_AuraScript::Absorb(), spell_dk_anti_magic_zone::spell_dk_anti_magic_zone_AuraScript::Absorb(), spell_dru_savage_defense::spell_dru_savage_defense_AuraScript::Absorb(), AddPct(), ApplyPct(), Player::ApplySpellMod(), Player::BuyItemFromVendorSlot(), Unit::CalcAbsorbResist(), Unit::CalcArmorReducedDamage(), spell_dru_innervate::spell_dru_innervate_AuraScript::CalculateAmount(), spell_mark_of_kazzak::spell_mark_of_kazzak_AuraScript::CalculateAmount(), spell_pri_power_word_shield::spell_pri_power_word_shield_AuraScript::CalculateAmount(), spell_sha_mana_tide_totem::spell_sha_mana_tide_totem_AuraScript::CalculateAmount(), spell_warl_pet_passive::spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee(), spell_warl_pet_passive::spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount(), spell_rog_recuperate::spell_rog_recuperate_AuraScript::CalculateBonus(), spell_hun_pet_scaling_01::spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount(), spell_warl_pet_scaling_02::spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount(), Unit::CalculateMeleeDamage(), spell_hun_pet_scaling_02::spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount(), spell_warl_pet_scaling_03::spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount(), Player::CalculateReputationGain(), spell_hun_pet_scaling_03::spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount(), spell_warl_pet_scaling_04::spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount(), Unit::CalculateSpellDamageTaken(), Skyfire::Spells::CalculateSpellPowerCosts(), spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount(), spell_dk_pet_scaling_01::spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount(), Pet::CastPetAura(), Unit::CountPctFromCurHealth(), Unit::CountPctFromMaxHealth(), Unit::CountPctFromMaxPower(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), Unit::DealDamage(), Spell::DelayedChannel(), ThreatManager::doAddThreat(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectResurrectWithAura(), Spell::EffectSchoolDMG(), Spell::EffectSelfResurrect(), AuctionEntry::GetAuctionCut(), AuctionHouseMgr::GetAuctionDeposit(), AuctionEntry::GetAuctionOutBid(), Unit::GetCombatRatingDamageReduction(), spell_pri_renew::spell_pri_renew_AuraScript::HandleApplyEffect(), Unit::HandleAuraProc(), Aura::HandleAuraSpecificMods(), spell_dk_death_strike::spell_dk_death_strike_SpellScript::HandleDummy(), spell_warl_life_tap::spell_warl_life_tap_SpellScript::HandleDummy(), spell_warr_concussion_blow::spell_warr_concussion_blow_SpellScript::HandleDummy(), Unit::HandleDummyAuraProc(), spell_pal_eye_for_an_eye::spell_pal_eye_for_an_eye_AuraScript::HandleEffectProc(), spell_pri_vampiric_embrace::spell_pri_vampiric_embrace_AuraScript::HandleEffectProc(), spell_sha_ancestral_awakening::spell_sha_ancestral_awakening_AuraScript::HandleEffectProc(), spell_sha_glyph_of_healing_wave::spell_sha_glyph_of_healing_wave_AuraScript::HandleEffectProc(), spell_sha_telluric_currents::spell_sha_telluric_currents_AuraScript::HandleEffectProc(), spell_sha_chain_heal::spell_sha_chain_heal_SpellScript::HandleHeal(), WorldSession::HandleLootMoneyOpcode(), AuraEffect::HandleModPowerCostPCT(), spell_monk_fortifying_brew::spell_monk_fortifying_brew_SpellScript::HandleOnHit(), spell_warl_healthstone_heal::spell_warl_healthstone_heal_SpellScript::HandleOnHit(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_devourer_of_souls_mirrored_soul_proc::spell_devourer_of_souls_mirrored_soul_proc_AuraScript::HandleProc(), spell_dk_blood_gorged::spell_dk_blood_gorged_AuraScript::HandleProc(), spell_dru_living_seed::spell_dru_living_seed_AuraScript::HandleProc(), spell_item_blessing_of_ancient_kings::spell_item_blessing_of_ancient_kings_AuraScript::HandleProc(), spell_item_necrotic_touch::spell_item_necrotic_touch_AuraScript::HandleProc(), spell_mage_ignite::spell_mage_ignite_AuraScript::HandleProc(), spell_pal_beacon_of_light::spell_pal_beacon_of_light_AuraScript::HandleProc(), spell_pri_divine_aegis::spell_pri_divine_aegis_AuraScript::HandleProc(), spell_yogg_saron_grim_reprisal::spell_yogg_saron_grim_reprisal_AuraScript::HandleProc(), Unit::HandleProcTriggerSpell(), Unit::MeleeDamageBonusTaken(), spell_valanar_kinetic_bomb_absorb::spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb(), spell_blood_queen_essence_of_the_blood_queen::spell_blood_queen_essence_of_the_blood_queen_AuraScript::OnProc(), spell_warl_fel_synergy::spell_warl_fel_synergy_AuraScript::OnProc(), Spell::prepare(), spell_mage_pyroblast::spell_mage_pyroblast_SpellScript::RecalculateDamage(), spell_pri_power_word_shield::spell_pri_power_word_shield_AuraScript::ReflectDamage(), Player::Regenerate(), WorldSession::SendListInventory(), OPvPCapturePoint::SetCapturePointData(), Unit::SpellBaseDamageBonusDone(), Unit::SpellBaseHealingBonusDone(), Unit::SpellDamageBonusTaken(), Guardian::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateManaRegen(), Player::UpdateRating(), Guardian::UpdateResistances(), and Guardian::UpdateStats().

◆ CompareValues()

template<class T>
bool CompareValues ( ComparisionType type,
T val1,
T val2 )

◆ consoleToUtf8()

bool consoleToUtf8 ( const std::string & conStr,
std::string & utf8str )

Definition at line 458 of file Util.cpp.

References WStrToUtf8().

Referenced by CliRunnable::Run().

◆ CreatePIDFile()

uint32 CreatePIDFile ( const std::string & filename)

create PID file

Definition at line 253 of file Util.cpp.

Referenced by main(), and Master::Run().

◆ frand()

◆ GetAddressString()

std::string GetAddressString ( Skyfire::Net::Address const & addr)

Transforms network address into string format "dotted_ip:port".

Definition at line 237 of file Util.cpp.

References Skyfire::Net::Address::GetHost(), and Skyfire::Net::Address::GetPort().

Referenced by AuthSocket::_HandleRealmList().

◆ GetMainPartOfName()

std::wstring GetMainPartOfName ( std::wstring wname,
uint32 declension )

Definition at line 396 of file Util.cpp.

References isCyrillicCharacter().

Referenced by ObjectMgr::CheckDeclinedNames().

◆ HexStrToByteArray() [1/2]

template<size_t Size>
std::array< uint8, Size > HexStrToByteArray ( std::string const & str,
bool reverse = false )

Definition at line 355 of file Util.h.

References HexStrToByteArray().

◆ HexStrToByteArray() [2/2]

template<size_t Size>
void HexStrToByteArray ( std::string const & str,
std::array< uint8, Size > & buf,
bool reverse = false )

Definition at line 350 of file Util.h.

References SkyFire::Impl::HexStrToByteArray().

Referenced by HexStrToByteArray().

◆ isBasicLatinCharacter()

bool isBasicLatinCharacter ( wchar_t wchar)
inline

Definition at line 142 of file Util.h.

Referenced by isBasicLatinString(), isExtendedLatinCharacter(), and wcharToUpperOnlyLatin().

◆ isBasicLatinString()

bool isBasicLatinString ( const std::wstring & wstr,
bool numericOrSpace )
inline

Definition at line 226 of file Util.h.

References isBasicLatinCharacter(), and isNumericOrSpace().

Referenced by isValidString().

◆ isCyrillicCharacter()

bool isCyrillicCharacter ( wchar_t wchar)
inline

◆ isCyrillicString()

bool isCyrillicString ( const std::wstring & wstr,
bool numericOrSpace )
inline

Definition at line 242 of file Util.h.

References isCyrillicCharacter(), and isNumericOrSpace().

Referenced by isValidString().

◆ isEastAsianCharacter()

bool isEastAsianCharacter ( wchar_t wchar)
inline

Definition at line 181 of file Util.h.

Referenced by isEastAsianString().

◆ isEastAsianString()

bool isEastAsianString ( const std::wstring & wstr,
bool numericOrSpace )
inline

Definition at line 250 of file Util.h.

References isEastAsianCharacter(), and isNumericOrSpace().

Referenced by isValidString().

◆ isExtendedLatinCharacter()

bool isExtendedLatinCharacter ( wchar_t wchar)
inline

Definition at line 151 of file Util.h.

References isBasicLatinCharacter().

Referenced by isExtendedLatinString().

◆ isExtendedLatinString()

bool isExtendedLatinString ( const std::wstring & wstr,
bool numericOrSpace )
inline

Definition at line 234 of file Util.h.

References isExtendedLatinCharacter(), and isNumericOrSpace().

Referenced by isValidString().

◆ IsIPAddress()

bool IsIPAddress ( char const * ipaddress)

Check if the string is a valid ip address representation.

Definition at line 229 of file Util.cpp.

References Skyfire::Net::IsIPv4Address().

Referenced by ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoIPCommand(), and ban_commandscript::HandleUnBanHelper().

◆ IsIPAddrInNetwork()

bool IsIPAddrInNetwork ( Skyfire::Net::Address const & net,
Skyfire::Net::Address const & addr,
Skyfire::Net::Address const & subnetMask )

Checks if address belongs to the a network with specified submask.

Definition at line 244 of file Util.cpp.

References Skyfire::Net::Address::ToIPv4NetworkOrder().

Referenced by AuthSocket::GetAddressForClient().

◆ isNumeric() [1/3]

bool isNumeric ( char c)
inline

Definition at line 207 of file Util.h.

◆ isNumeric() [2/3]

bool isNumeric ( char const * str)
inline

Definition at line 212 of file Util.h.

References isNumeric().

◆ isNumeric() [3/3]

◆ isNumericOrSpace()

bool isNumericOrSpace ( wchar_t wchar)
inline

Definition at line 221 of file Util.h.

References isNumeric().

Referenced by isBasicLatinString(), isCyrillicString(), isEastAsianString(), and isExtendedLatinString().

◆ MoneyStringToMoney()

int64 MoneyStringToMoney ( const std::string & moneyString)

Definition at line 150 of file Util.cpp.

References Tokenizer::begin(), and Tokenizer::end().

Referenced by modify_commandscript::HandleModifyMoneyCommand().

◆ rand32()

int32 rand32 ( )

Definition at line 45 of file Util.cpp.

References SfmtRand().

Referenced by Player::GetRandomResearchProjectForRace(), and Player::OnArchaeologyFindUsed().

◆ rand_chance()

◆ rand_norm()

◆ roll_chance_f()

◆ roll_chance_i()

bool roll_chance_i ( int chance)
inline

Definition at line 89 of file Util.h.

Referenced by spell_rog_cheat_death::spell_rog_cheat_death_AuraScript::Absorb(), Spell::DoTriggersOnSpellHit(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectScriptEffect(), Spell::EffectStealBeneficialBuff(), Spell::EffectTeleportUnits(), Unit::GetMeleeHitRedirectTarget(), Player::GetRandomResearchDigsiteForContinent(), Player::GetResurrectionSpellId(), AuraEffect::HandleAuraDummy(), spell_capacitus_polarity_shift::spell_capacitus_polarity_shift_SpellScript::HandleDummy(), spell_gen_gnomish_transporter::spell_gen_gnomish_transporter_SpellScript::HandleDummy(), spell_item_nigh_invulnerability::spell_item_nigh_invulnerability_SpellScript::HandleDummy(), spell_item_nitro_boots::spell_item_nitro_boots_SpellScript::HandleDummy(), spell_item_poultryizer::spell_item_poultryizer_SpellScript::HandleDummy(), spell_item_purify_helboar_meat::spell_item_purify_helboar_meat_SpellScript::HandleDummy(), spell_item_pygmy_oil::spell_item_pygmy_oil_SpellScript::HandleDummy(), spell_item_teach_language::spell_item_teach_language_SpellScript::HandleDummy(), spell_q12634_despawn_fruit_tosser::spell_q12634_despawn_fruit_tosser_SpellScript::HandleDummy(), spell_q5206_test_fetid_skull::spell_q5206_test_fetid_skull_SpellScript::HandleDummy(), spell_q9452_cast_net::spell_q9452_cast_net_SpellScript::HandleDummy(), spell_thaddius_polarity_shift::spell_thaddius_polarity_shift_SpellScript::HandleDummy(), Unit::HandleDummyAuraProc(), spell_monk_soothing_mist::spell_monk_soothing_mist_AuraScript::HandleEffectPeriodic(), spell_mage_blast_wave::spell_mage_blast_wave_SpellScript::HandleImprovedFlamestrike(), spell_mage_water_elemental_freeze::spell_mage_water_elemental_freeze_SpellScript::HandleImprovedFreeze(), spell_dk_runic_corruption::spell_dk_runic_corruption_SpellScript::HandleOnHit(), spell_dk_runic_empowerment::spell_dk_runic_empowerment_SpellScript::HandleOnHit(), spell_mastery_combo_breaker::spell_mastery_combo_breaker_SpellScript::HandleOnHit(), spell_warr_bloodthirst::spell_warr_bloodthirst_SpellScript::HandleOnHit(), spell_warr_deep_wounds::spell_warr_deep_wounds_SpellScript::HandleOnHit(), Unit::HandleOverrideClassScriptAuraProc(), Unit::HandleProcTriggerSpell(), spell_gen_netherbloom::spell_gen_netherbloom_SpellScript::HandleScript(), spell_gen_nightmare_vine::spell_gen_nightmare_vine_SpellScript::HandleScript(), spell_hallow_end_trick_or_treat::spell_hallow_end_trick_or_treat_SpellScript::HandleScript(), spell_hallow_end_tricky_treat::spell_hallow_end_tricky_treat_SpellScript::HandleScript(), spell_item_defibrillate::spell_item_defibrillate_SpellScript::HandleScript(), spell_hun_invigoration::spell_hun_invigoration_SpellScript::HandleScriptEffect(), Unit::isBlockCritical(), boss_gatewatcher_iron_hand::boss_gatewatcher_iron_handAI::KilledUnit(), Player::OnArchaeologyFindUsed(), spell_warl_shadow_trance_proc::spell_warl_shadow_trance_proc_AuraScript::OnProc(), Unit::SpellHitResult(), boss_sara::boss_saraAI::SpellHitTarget(), Player::Update(), boss_gatewatcher_iron_hand::boss_gatewatcher_iron_handAI::UpdateAI(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::UpdateAI(), and npc_wild_imp::npc_wild_impAI::UpdateAI().

◆ RoundToInterval()

template<class T>
T RoundToInterval ( T & num,
T floor,
T ceil )
inline

◆ secsToTimeString()

◆ stripLineInvisibleChars()

void stripLineInvisibleChars ( std::string & src)

Definition at line 94 of file Util.cpp.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ TimeStringToSecs()

uint32 TimeStringToSecs ( const std::string & timestring)

◆ TimeToTimestampStr()

◆ Utf8FitTo()

◆ utf8length()

size_t utf8length ( std::string & utf8str)

◆ utf8printf()

void utf8printf ( FILE * out,
const char * str,
... )

Definition at line 489 of file Util.cpp.

References vutf8printf().

Referenced by AppenderConsole::_write().

◆ utf8ToConsole()

bool utf8ToConsole ( const std::string & utf8str,
std::string & conStr )

Definition at line 441 of file Util.cpp.

References Utf8toWStr().

◆ Utf8toWStr() [1/3]

bool Utf8toWStr ( char const * utf8str,
size_t csize,
wchar_t * wstr,
size_t & wsize )

Definition at line 305 of file Util.cpp.

Referenced by ObjectMgr::AddGameTele(), ObjectMgr::CheckDeclinedNames(), ObjectMgr::CheckPetName(), ObjectMgr::CheckPlayerName(), ObjectMgr::DeleteGameTele(), ChannelMgr::GetChannel(), ObjectMgr::GetGameTele(), ObjectMgr::GetGameTeleExactName(), ChannelMgr::GetJoinChannel(), WorldSession::HandleAuctionListItems(), learn_commandscript::HandleLearnAllRecipesCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), modify_commandscript::HandleModifyRepCommand(), WorldSession::HandleSetPlayerDeclinedNames(), WorldSession::HandleWhoOpcode(), ObjectMgr::IsReservedName(), ObjectMgr::IsValidCharterName(), ChannelMgr::LeftChannel(), ObjectMgr::LoadGameTele(), ObjectMgr::LoadReservedPlayersNames(), normalizePlayerName(), AccountMgr::normalizeString(), Utf8FitTo(), utf8print(), utf8ToConsole(), and vutf8printf().

◆ Utf8toWStr() [2/3]

bool Utf8toWStr ( const std::string & utf8str,
std::wstring & wstr )

Definition at line 333 of file Util.cpp.

Referenced by Utf8toWStr().

◆ Utf8toWStr() [3/3]

bool Utf8toWStr ( const std::string & utf8str,
wchar_t * wstr,
size_t & wsize )
inline

Definition at line 130 of file Util.h.

References Utf8toWStr().

◆ utf8truncate()

void utf8truncate ( std::string & utf8str,
size_t len )

Definition at line 284 of file Util.cpp.

Referenced by PlayerSocial::SetFriendNote(), and Guild::BankTab::SetText().

◆ vutf8printf()

void vutf8printf ( FILE * out,
const char * str,
va_list * ap )

Definition at line 497 of file Util.cpp.

References Utf8toWStr(), and vsnprintf.

Referenced by utf8printf().

◆ wcharToLower()

wchar_t wcharToLower ( wchar_t wchar)
inline

Definition at line 286 of file Util.h.

Referenced by wstrToLower().

◆ wcharToUpper()

wchar_t wcharToUpper ( wchar_t wchar)
inline

Definition at line 258 of file Util.h.

Referenced by normalizePlayerName(), wcharToUpperOnlyLatin(), and wstrToUpper().

◆ wcharToUpperOnlyLatin()

wchar_t wcharToUpperOnlyLatin ( wchar_t wchar)
inline

Definition at line 281 of file Util.h.

References isBasicLatinCharacter(), and wcharToUpper().

Referenced by AccountMgr::normalizeString().

◆ wstrToLower()

◆ wstrToUpper()

void wstrToUpper ( std::wstring & str)
inline

Definition at line 309 of file Util.h.

References wcharToUpper().

◆ WStrToUtf8() [1/2]

bool WStrToUtf8 ( const std::wstring & wstr,
std::string & utf8str )

Definition at line 371 of file Util.cpp.

◆ WStrToUtf8() [2/2]

bool WStrToUtf8 ( wchar_t * wstr,
size_t size,
std::string & utf8str )

Definition at line 348 of file Util.cpp.

Referenced by consoleToUtf8(), normalizePlayerName(), and AccountMgr::normalizeString().