43{
45
46
48
49 if (!result)
50 {
51 LOG_WARN(
"server.loading",
">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
53 return;
54 }
55
58
59 for (auto const& fields : *result)
60 {
61 typeId = fields[0].Get<
uint8>();
62
64 continue;
65
67 {
68 LOG_ERROR(
"sql.sql",
"Invalid OutdoorPvPTypes value {} in outdoorpvp_template; skipped.", typeId);
69 continue;
70 }
71
72 auto data = std::make_unique<OutdoorPvPData>();
74 data->TypeId = realTypeId;
75 data->ScriptId =
sObjectMgr->GetScriptId(fields[1].Get<std::string>());
77
78 ++count;
79 }
80
82 {
85 {
86 LOG_ERROR(
"sql.sql",
"Could not initialize OutdoorPvP object for type ID {}; no entry in database.",
uint32(i));
87 continue;
88 }
89
90 auto pvp = std::unique_ptr<OutdoorPvP>(
sScriptMgr->CreateOutdoorPvP(iter->second.get()));
91 if (!pvp)
92 {
93 LOG_ERROR(
"outdoorpvp",
"Could not initialize OutdoorPvP object for type ID {}; got nullptr pointer from script.",
uint32(i));
94 continue;
95 }
96
97 if (!pvp->SetupOutdoorPvP())
98 {
99 LOG_ERROR(
"outdoorpvp",
"Could not initialize OutdoorPvP object for type ID {}; SetupOutdoorPvP failed.",
uint32(i));
100 continue;
101 }
102
104 }
105
108}
#define LOG_INFO(filterType__,...)
Definition: Log.h:164
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
#define LOG_WARN(filterType__,...)
Definition: Log.h:160
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
#define sScriptMgr
Definition: ScriptMgr.h:708
@ DISABLE_TYPE_OUTDOORPVP
Definition: DisableMgr.h:34
OutdoorPvPTypes
Definition: OutdoorPvP.h:29
#define MAX_OUTDOORPVP_TYPES
Definition: OutdoorPvP.h:39
#define sObjectMgr
Definition: ObjectMgr.h:1623
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:306