Files
azerothcore-wotlk/src/server/game/Addons/AddonMgr.h
2021-03-17 09:46:01 -06:00

59 lines
1.3 KiB
C++

/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#ifndef _ADDONMGR_H
#define _ADDONMGR_H
#include "Define.h"
#include <list>
#include <string>
#include <utility>
struct AddonInfo
{
AddonInfo(std::string name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
: Name(std::move(name)), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
std::string Name;
uint8 Enabled;
uint32 CRC;
uint8 State;
bool UsePublicKeyOrCRC;
};
struct SavedAddon
{
SavedAddon(std::string name, uint32 crc) : Name(std::move(name))
{
CRC = crc;
}
std::string Name;
uint32 CRC;
};
struct BannedAddon
{
uint32 Id;
uint8 NameMD5[16];
uint8 VersionMD5[16];
uint32 Timestamp;
};
#define STANDARD_ADDON_CRC 0x4c1c776d
namespace AddonMgr
{
void LoadFromDB();
void SaveAddon(AddonInfo const& addon);
SavedAddon const* GetAddonInfo(const std::string& name);
typedef std::list<BannedAddon> BannedAddonList;
BannedAddonList const* GetBannedAddons();
}
#endif