AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Hyperlinks.cpp File Reference
#include "Hyperlinks.h"
#include "Common.h"
#include "DBCStores.h"
#include "ObjectMgr.h"
#include "QuestDef.h"
#include "SharedDefines.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "World.h"

Go to the source code of this file.

Classes

struct  LinkValidator< T >
 
struct  LinkValidator< LinkTags::achievement >
 
struct  LinkValidator< LinkTags::item >
 
struct  LinkValidator< LinkTags::quest >
 
struct  LinkValidator< LinkTags::spell >
 
struct  LinkValidator< LinkTags::enchant >
 
struct  LinkValidator< LinkTags::glyph >
 
struct  LinkValidator< LinkTags::talent >
 
struct  LinkValidator< LinkTags::trade >
 

Macros

#define TryValidateAs(T)   do { if (info.tag == T::tag()) return ValidateAs<T>(info); } while (0);
 

Functions

uint8 toHex (char c)
 
template<typename TAG >
static bool ValidateAs (HyperlinkInfo const &info)
 
static bool ValidateLinkInfo (HyperlinkInfo const &info)
 

Macro Definition Documentation

◆ TryValidateAs

#define TryValidateAs (   T)    do { if (info.tag == T::tag()) return ValidateAs<T>(info); } while (0);

Function Documentation

◆ toHex()

uint8 toHex ( char  c)
inline
30{ return (c >= '0' && c <= '9') ? c - '0' + 0x10 : (c >= 'a' && c <= 'f') ? c - 'a' + 0x1a : 0x00; }

Referenced by Acore::Hyperlinks::ParseSingleHyperlink().

◆ ValidateAs()

template<typename TAG >
static bool ValidateAs ( HyperlinkInfo const &  info)
static
328{
329 std::decay_t<typename TAG::value_type> t;
330 if (!TAG::StoreTo(t, info.data))
331 return false;
332
333 int32 const severity = static_cast<int32>(sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY));
334 if (severity >= 0)
335 {
336 if (!LinkValidator<TAG>::IsColorValid(t, info.color))
337 return false;
338
339 if (severity >= 1)
340 {
341 if (!LinkValidator<TAG>::IsTextValid(t, info.text))
342 return false;
343 }
344 }
345 return true;
346}
std::int32_t int32
Definition: Define.h:103
@ CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY
Definition: IWorld.h:289
#define sWorld
Definition: World.h:443
Definition: Hyperlinks.cpp:106

References Acore::Hyperlinks::HyperlinkInfo::color, CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY, Acore::Hyperlinks::HyperlinkInfo::data, sWorld, and Acore::Hyperlinks::HyperlinkInfo::text.

◆ ValidateLinkInfo()

static bool ValidateLinkInfo ( HyperlinkInfo const &  info)
static
351{
352 using namespace LinkTags;
353 TryValidateAs(achievement);
354 TryValidateAs(area);
355 TryValidateAs(areatrigger);
356 TryValidateAs(creature);
357 TryValidateAs(creature_entry);
358 TryValidateAs(enchant);
359 TryValidateAs(gameevent);
360 TryValidateAs(gameobject);
361 TryValidateAs(gameobject_entry);
362 TryValidateAs(glyph);
363 TryValidateAs(item);
364 TryValidateAs(itemset);
365 TryValidateAs(player);
366 TryValidateAs(quest);
367 TryValidateAs(skill);
368 TryValidateAs(spell);
369 TryValidateAs(talent);
370 TryValidateAs(taxinode);
371 TryValidateAs(tele);
372 TryValidateAs(title);
373 TryValidateAs(trade);
374 return false;
375}
#define TryValidateAs(T)
Definition: Hyperlinks.cpp:348

References TryValidateAs.

Referenced by Acore::Hyperlinks::CheckAllLinks().