mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +00:00
feat: refactor vanity (#1477)
* feat: refactor vanity cleanup code to be generalized for objects remove unused party feature add fallback to data to text Allow for better organizing data in multiple files remove special case flag values in favor of config data general cleanup and fixes * newline at eof's
This commit is contained in:
@@ -3,15 +3,17 @@
|
||||
#include "dCommonVars.h"
|
||||
#include "Entity.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
struct VanityNPCLocation
|
||||
struct VanityObjectLocation
|
||||
{
|
||||
float m_Chance = 1.0f;
|
||||
NiPoint3 m_Position;
|
||||
NiQuaternion m_Rotation;
|
||||
float m_Scale = 1.0f;
|
||||
};
|
||||
|
||||
struct VanityNPC
|
||||
struct VanityObject
|
||||
{
|
||||
LWOOBJID m_ID = LWOOBJID_EMPTY;
|
||||
std::string m_Name;
|
||||
@@ -19,37 +21,24 @@ struct VanityNPC
|
||||
std::vector<LOT> m_Equipment;
|
||||
std::vector<std::string> m_Phrases;
|
||||
std::string m_Script;
|
||||
std::map<std::string, bool> m_Flags;
|
||||
std::map<uint32_t, std::vector<VanityNPCLocation>> m_Locations;
|
||||
std::vector<LDFBaseData*> ldf;
|
||||
std::map<uint32_t, std::vector<VanityObjectLocation>> m_Locations;
|
||||
std::vector<LDFBaseData*> m_Config;
|
||||
};
|
||||
|
||||
struct VanityParty
|
||||
{
|
||||
uint32_t m_Zone;
|
||||
float m_Chance = 1.0f;
|
||||
std::vector<VanityNPCLocation> m_Locations;
|
||||
};
|
||||
|
||||
class VanityUtilities
|
||||
{
|
||||
public:
|
||||
static void SpawnVanity();
|
||||
|
||||
static Entity* SpawnNPC(
|
||||
LOT lot,
|
||||
const std::string& name,
|
||||
const NiPoint3& position,
|
||||
const NiQuaternion& rotation,
|
||||
const std::vector<LOT>& inventory,
|
||||
const std::vector<LDFBaseData*>& ldf
|
||||
static Entity* SpawnObject(
|
||||
const VanityObject& object,
|
||||
const VanityObjectLocation& location
|
||||
);
|
||||
|
||||
static LWOOBJID SpawnSpawner(
|
||||
LOT lot,
|
||||
const NiPoint3& position,
|
||||
const NiQuaternion& rotation,
|
||||
const std::vector<LDFBaseData*>& ldf
|
||||
const VanityObject& object,
|
||||
const VanityObjectLocation& location
|
||||
);
|
||||
|
||||
static std::string ParseMarkdown(
|
||||
@@ -60,16 +49,14 @@ public:
|
||||
const std::string& file
|
||||
);
|
||||
|
||||
static VanityNPC* GetNPC(const std::string& name);
|
||||
static VanityObject* GetObject(const std::string& name);
|
||||
|
||||
private:
|
||||
static void SetupNPCTalk(Entity* npc);
|
||||
|
||||
static void NPCTalk(Entity* npc);
|
||||
|
||||
static std::vector<VanityNPC> m_NPCs;
|
||||
|
||||
static std::vector<VanityParty> m_Parties;
|
||||
|
||||
static std::vector<std::string> m_PartyPhrases;
|
||||
static std::vector<VanityObject> m_Objects;
|
||||
|
||||
static std::set<std::string> m_LoadedFiles;
|
||||
};
|
||||
|
Reference in New Issue
Block a user