mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Tasks] Replace task goals with explicit fields (#2402)
The task goal system made implementing tasks a little confusing since the goal could be ambiguous depending on type. This also didn't support filtering on multiple goals (e.g. looting items from matching npc names inside an area). Deliver types could specify an npc id in `delivertonpc` but the database may have multiple npcs with the same name or a task might want to match partial npc names. This replaces goalids with explicit fields for npcs, items, proximity areas, and touch switch ids. These changes make managing task data easier without needing to update multiple tables and allows filtering task updates by multiple criteria. To mitigate any performance impact from merging task proximities, only clients with explore tasks in the current zone are checked during client movement updates. Items and npcs still support goallists but it would be possible to denormalize entries into delimited strings to combine with the match lists. This would also decouple task goals from reward lists. The client task update functions were refactored to run through a single filtering function which significantly reduces duplicated code from the legacy task system. This will also make it easier to later implement any unhandled types. Since the new fields will handle filtering single entries and lists based on having values set, `goalmethod` now only distinguishes quest controlled from source controlled. This is a breaking api change, `taskexploredarea` has been removed since explore ids no longer exist.
This commit is contained in:
@@ -260,7 +260,6 @@ SET(repositories
|
||||
repositories/base/base_pets_equipmentset_repository.h
|
||||
repositories/base/base_pets_equipmentset_entries_repository.h
|
||||
repositories/base/base_player_titlesets_repository.h
|
||||
repositories/base/base_proximities_repository.h
|
||||
repositories/base/base_quest_globals_repository.h
|
||||
repositories/base/base_raid_details_repository.h
|
||||
repositories/base/base_raid_members_repository.h
|
||||
@@ -437,7 +436,6 @@ SET(repositories
|
||||
repositories/pets_equipmentset_repository.h
|
||||
repositories/pets_equipmentset_entries_repository.h
|
||||
repositories/player_titlesets_repository.h
|
||||
repositories/proximities_repository.h
|
||||
repositories/quest_globals_repository.h
|
||||
repositories/raid_details_repository.h
|
||||
repositories/raid_members_repository.h
|
||||
|
||||
@@ -225,7 +225,6 @@ namespace DatabaseSchema {
|
||||
"pets_beastlord_data",
|
||||
"pets_equipmentset",
|
||||
"pets_equipmentset_entries",
|
||||
"proximities",
|
||||
"skill_caps",
|
||||
"spawn2",
|
||||
"spawn_conditions",
|
||||
|
||||
@@ -1,393 +0,0 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_PROXIMITIES_REPOSITORY_H
|
||||
#define EQEMU_BASE_PROXIMITIES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseProximitiesRepository {
|
||||
public:
|
||||
struct Proximities {
|
||||
uint32_t zoneid;
|
||||
uint32_t exploreid;
|
||||
float minx;
|
||||
float maxx;
|
||||
float miny;
|
||||
float maxy;
|
||||
float minz;
|
||||
float maxz;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("zoneid");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"zoneid",
|
||||
"exploreid",
|
||||
"minx",
|
||||
"maxx",
|
||||
"miny",
|
||||
"maxy",
|
||||
"minz",
|
||||
"maxz",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"zoneid",
|
||||
"exploreid",
|
||||
"minx",
|
||||
"maxx",
|
||||
"miny",
|
||||
"maxy",
|
||||
"minz",
|
||||
"maxz",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(Strings::Implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string SelectColumnsRaw()
|
||||
{
|
||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("proximities");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Proximities NewEntity()
|
||||
{
|
||||
Proximities e{};
|
||||
|
||||
e.zoneid = 0;
|
||||
e.exploreid = 0;
|
||||
e.minx = 0.000000;
|
||||
e.maxx = 0.000000;
|
||||
e.miny = 0.000000;
|
||||
e.maxy = 0.000000;
|
||||
e.minz = 0.000000;
|
||||
e.maxz = 0.000000;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static Proximities GetProximities(
|
||||
const std::vector<Proximities> &proximitiess,
|
||||
int proximities_id
|
||||
)
|
||||
{
|
||||
for (auto &proximities : proximitiess) {
|
||||
if (proximities.zoneid == proximities_id) {
|
||||
return proximities;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Proximities FindOne(
|
||||
Database& db,
|
||||
int proximities_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
proximities_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Proximities e{};
|
||||
|
||||
e.zoneid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.exploreid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minx = strtof(row[2], nullptr);
|
||||
e.maxx = strtof(row[3], nullptr);
|
||||
e.miny = strtof(row[4], nullptr);
|
||||
e.maxy = strtof(row[5], nullptr);
|
||||
e.minz = strtof(row[6], nullptr);
|
||||
e.maxz = strtof(row[7], nullptr);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int proximities_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
proximities_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const Proximities &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.zoneid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.exploreid));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.minx));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.maxx));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.miny));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.maxy));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.minz));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.maxz));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.zoneid
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Proximities InsertOne(
|
||||
Database& db,
|
||||
Proximities e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.zoneid));
|
||||
v.push_back(std::to_string(e.exploreid));
|
||||
v.push_back(std::to_string(e.minx));
|
||||
v.push_back(std::to_string(e.maxx));
|
||||
v.push_back(std::to_string(e.miny));
|
||||
v.push_back(std::to_string(e.maxy));
|
||||
v.push_back(std::to_string(e.minz));
|
||||
v.push_back(std::to_string(e.maxz));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.zoneid = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<Proximities> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.zoneid));
|
||||
v.push_back(std::to_string(e.exploreid));
|
||||
v.push_back(std::to_string(e.minx));
|
||||
v.push_back(std::to_string(e.maxx));
|
||||
v.push_back(std::to_string(e.miny));
|
||||
v.push_back(std::to_string(e.maxy));
|
||||
v.push_back(std::to_string(e.minz));
|
||||
v.push_back(std::to_string(e.maxz));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<Proximities> All(Database& db)
|
||||
{
|
||||
std::vector<Proximities> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Proximities e{};
|
||||
|
||||
e.zoneid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.exploreid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minx = strtof(row[2], nullptr);
|
||||
e.maxx = strtof(row[3], nullptr);
|
||||
e.miny = strtof(row[4], nullptr);
|
||||
e.maxy = strtof(row[5], nullptr);
|
||||
e.minz = strtof(row[6], nullptr);
|
||||
e.maxz = strtof(row[7], nullptr);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Proximities> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<Proximities> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Proximities e{};
|
||||
|
||||
e.zoneid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.exploreid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minx = strtof(row[2], nullptr);
|
||||
e.maxx = strtof(row[3], nullptr);
|
||||
e.miny = strtof(row[4], nullptr);
|
||||
e.maxy = strtof(row[5], nullptr);
|
||||
e.minz = strtof(row[6], nullptr);
|
||||
e.maxz = strtof(row[7], nullptr);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int64 GetMaxId(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
||||
PrimaryKey(),
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static int64 Count(Database& db, const std::string &where_filter = "")
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT COUNT(*) FROM {} {}",
|
||||
TableName(),
|
||||
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_PROXIMITIES_REPOSITORY_H
|
||||
@@ -25,15 +25,25 @@ public:
|
||||
int32_t step;
|
||||
uint8_t activitytype;
|
||||
std::string target_name;
|
||||
std::string item_list;
|
||||
std::string skill_list;
|
||||
std::string spell_list;
|
||||
std::string description_override;
|
||||
uint32_t goalid;
|
||||
std::string goal_match_list;
|
||||
uint32_t goalmethod;
|
||||
int32_t goalcount;
|
||||
uint32_t delivertonpc;
|
||||
std::string description_override;
|
||||
uint32_t npc_id;
|
||||
uint32_t npc_goal_id;
|
||||
std::string npc_match_list;
|
||||
uint32_t item_id;
|
||||
uint32_t item_goal_id;
|
||||
std::string item_id_list;
|
||||
std::string item_list;
|
||||
int32_t dz_switch_id;
|
||||
float min_x;
|
||||
float min_y;
|
||||
float min_z;
|
||||
float max_x;
|
||||
float max_y;
|
||||
float max_z;
|
||||
std::string skill_list;
|
||||
std::string spell_list;
|
||||
std::string zones;
|
||||
int32_t zone_version;
|
||||
int8_t optional;
|
||||
@@ -53,15 +63,25 @@ public:
|
||||
"step",
|
||||
"activitytype",
|
||||
"target_name",
|
||||
"item_list",
|
||||
"skill_list",
|
||||
"spell_list",
|
||||
"description_override",
|
||||
"goalid",
|
||||
"goal_match_list",
|
||||
"goalmethod",
|
||||
"goalcount",
|
||||
"delivertonpc",
|
||||
"description_override",
|
||||
"npc_id",
|
||||
"npc_goal_id",
|
||||
"npc_match_list",
|
||||
"item_id",
|
||||
"item_goal_id",
|
||||
"item_id_list",
|
||||
"item_list",
|
||||
"dz_switch_id",
|
||||
"min_x",
|
||||
"min_y",
|
||||
"min_z",
|
||||
"max_x",
|
||||
"max_y",
|
||||
"max_z",
|
||||
"skill_list",
|
||||
"spell_list",
|
||||
"zones",
|
||||
"zone_version",
|
||||
"optional",
|
||||
@@ -77,15 +97,25 @@ public:
|
||||
"step",
|
||||
"activitytype",
|
||||
"target_name",
|
||||
"item_list",
|
||||
"skill_list",
|
||||
"spell_list",
|
||||
"description_override",
|
||||
"goalid",
|
||||
"goal_match_list",
|
||||
"goalmethod",
|
||||
"goalcount",
|
||||
"delivertonpc",
|
||||
"description_override",
|
||||
"npc_id",
|
||||
"npc_goal_id",
|
||||
"npc_match_list",
|
||||
"item_id",
|
||||
"item_goal_id",
|
||||
"item_id_list",
|
||||
"item_list",
|
||||
"dz_switch_id",
|
||||
"min_x",
|
||||
"min_y",
|
||||
"min_z",
|
||||
"max_x",
|
||||
"max_y",
|
||||
"max_z",
|
||||
"skill_list",
|
||||
"spell_list",
|
||||
"zones",
|
||||
"zone_version",
|
||||
"optional",
|
||||
@@ -135,15 +165,25 @@ public:
|
||||
e.step = 0;
|
||||
e.activitytype = 0;
|
||||
e.target_name = "";
|
||||
e.item_list = "";
|
||||
e.skill_list = "-1";
|
||||
e.spell_list = "0";
|
||||
e.description_override = "";
|
||||
e.goalid = 0;
|
||||
e.goal_match_list = "";
|
||||
e.goalmethod = 0;
|
||||
e.goalcount = 1;
|
||||
e.delivertonpc = 0;
|
||||
e.description_override = "";
|
||||
e.npc_id = 0;
|
||||
e.npc_goal_id = 0;
|
||||
e.npc_match_list = "";
|
||||
e.item_id = 0;
|
||||
e.item_goal_id = 0;
|
||||
e.item_id_list = "";
|
||||
e.item_list = "";
|
||||
e.dz_switch_id = 0;
|
||||
e.min_x = 0;
|
||||
e.min_y = 0;
|
||||
e.min_z = 0;
|
||||
e.max_x = 0;
|
||||
e.max_y = 0;
|
||||
e.max_z = 0;
|
||||
e.skill_list = "-1";
|
||||
e.spell_list = "0";
|
||||
e.zones = "";
|
||||
e.zone_version = -1;
|
||||
e.optional = 0;
|
||||
@@ -188,18 +228,28 @@ public:
|
||||
e.step = static_cast<int32_t>(atoi(row[3]));
|
||||
e.activitytype = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.target_name = row[5] ? row[5] : "";
|
||||
e.item_list = row[6] ? row[6] : "";
|
||||
e.skill_list = row[7] ? row[7] : "";
|
||||
e.spell_list = row[8] ? row[8] : "";
|
||||
e.description_override = row[9] ? row[9] : "";
|
||||
e.goalid = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.goal_match_list = row[11] ? row[11] : "";
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[13]));
|
||||
e.delivertonpc = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.zones = row[15] ? row[15] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[16]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[17]));
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[7]));
|
||||
e.description_override = row[8] ? row[8] : "";
|
||||
e.npc_id = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.npc_goal_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.npc_match_list = row[11] ? row[11] : "";
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.item_goal_id = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.item_id_list = row[14] ? row[14] : "";
|
||||
e.item_list = row[15] ? row[15] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[16]));
|
||||
e.min_x = strtof(row[17], nullptr);
|
||||
e.min_y = strtof(row[18], nullptr);
|
||||
e.min_z = strtof(row[19], nullptr);
|
||||
e.max_x = strtof(row[20], nullptr);
|
||||
e.max_y = strtof(row[21], nullptr);
|
||||
e.max_z = strtof(row[22], nullptr);
|
||||
e.skill_list = row[23] ? row[23] : "";
|
||||
e.spell_list = row[24] ? row[24] : "";
|
||||
e.zones = row[25] ? row[25] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[26]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[27]));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -239,18 +289,28 @@ public:
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.step));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.activitytype));
|
||||
v.push_back(columns[5] + " = '" + Strings::Escape(e.target_name) + "'");
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back(columns[8] + " = '" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back(columns[9] + " = '" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.goalid));
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.goal_match_list) + "'");
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.goalmethod));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.goalcount));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.delivertonpc));
|
||||
v.push_back(columns[15] + " = '" + Strings::Escape(e.zones) + "'");
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.zone_version));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.optional));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.goalmethod));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.goalcount));
|
||||
v.push_back(columns[8] + " = '" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.npc_id));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.npc_goal_id));
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.npc_match_list) + "'");
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.item_goal_id));
|
||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.item_id_list) + "'");
|
||||
v.push_back(columns[15] + " = '" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.dz_switch_id));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.min_x));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.min_y));
|
||||
v.push_back(columns[19] + " = " + std::to_string(e.min_z));
|
||||
v.push_back(columns[20] + " = " + std::to_string(e.max_x));
|
||||
v.push_back(columns[21] + " = " + std::to_string(e.max_y));
|
||||
v.push_back(columns[22] + " = " + std::to_string(e.max_z));
|
||||
v.push_back(columns[23] + " = '" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back(columns[24] + " = '" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back(columns[25] + " = '" + Strings::Escape(e.zones) + "'");
|
||||
v.push_back(columns[26] + " = " + std::to_string(e.zone_version));
|
||||
v.push_back(columns[27] + " = " + std::to_string(e.optional));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -278,15 +338,25 @@ public:
|
||||
v.push_back(std::to_string(e.step));
|
||||
v.push_back(std::to_string(e.activitytype));
|
||||
v.push_back("'" + Strings::Escape(e.target_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(std::to_string(e.goalid));
|
||||
v.push_back("'" + Strings::Escape(e.goal_match_list) + "'");
|
||||
v.push_back(std::to_string(e.goalmethod));
|
||||
v.push_back(std::to_string(e.goalcount));
|
||||
v.push_back(std::to_string(e.delivertonpc));
|
||||
v.push_back("'" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.npc_goal_id));
|
||||
v.push_back("'" + Strings::Escape(e.npc_match_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_goal_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_id_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back(std::to_string(e.dz_switch_id));
|
||||
v.push_back(std::to_string(e.min_x));
|
||||
v.push_back(std::to_string(e.min_y));
|
||||
v.push_back(std::to_string(e.min_z));
|
||||
v.push_back(std::to_string(e.max_x));
|
||||
v.push_back(std::to_string(e.max_y));
|
||||
v.push_back(std::to_string(e.max_z));
|
||||
v.push_back("'" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.zones) + "'");
|
||||
v.push_back(std::to_string(e.zone_version));
|
||||
v.push_back(std::to_string(e.optional));
|
||||
@@ -325,15 +395,25 @@ public:
|
||||
v.push_back(std::to_string(e.step));
|
||||
v.push_back(std::to_string(e.activitytype));
|
||||
v.push_back("'" + Strings::Escape(e.target_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(std::to_string(e.goalid));
|
||||
v.push_back("'" + Strings::Escape(e.goal_match_list) + "'");
|
||||
v.push_back(std::to_string(e.goalmethod));
|
||||
v.push_back(std::to_string(e.goalcount));
|
||||
v.push_back(std::to_string(e.delivertonpc));
|
||||
v.push_back("'" + Strings::Escape(e.description_override) + "'");
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.npc_goal_id));
|
||||
v.push_back("'" + Strings::Escape(e.npc_match_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_goal_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_id_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back(std::to_string(e.dz_switch_id));
|
||||
v.push_back(std::to_string(e.min_x));
|
||||
v.push_back(std::to_string(e.min_y));
|
||||
v.push_back(std::to_string(e.min_z));
|
||||
v.push_back(std::to_string(e.max_x));
|
||||
v.push_back(std::to_string(e.max_y));
|
||||
v.push_back(std::to_string(e.max_z));
|
||||
v.push_back("'" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.zones) + "'");
|
||||
v.push_back(std::to_string(e.zone_version));
|
||||
v.push_back(std::to_string(e.optional));
|
||||
@@ -376,18 +456,28 @@ public:
|
||||
e.step = static_cast<int32_t>(atoi(row[3]));
|
||||
e.activitytype = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.target_name = row[5] ? row[5] : "";
|
||||
e.item_list = row[6] ? row[6] : "";
|
||||
e.skill_list = row[7] ? row[7] : "";
|
||||
e.spell_list = row[8] ? row[8] : "";
|
||||
e.description_override = row[9] ? row[9] : "";
|
||||
e.goalid = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.goal_match_list = row[11] ? row[11] : "";
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[13]));
|
||||
e.delivertonpc = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.zones = row[15] ? row[15] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[16]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[17]));
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[7]));
|
||||
e.description_override = row[8] ? row[8] : "";
|
||||
e.npc_id = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.npc_goal_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.npc_match_list = row[11] ? row[11] : "";
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.item_goal_id = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.item_id_list = row[14] ? row[14] : "";
|
||||
e.item_list = row[15] ? row[15] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[16]));
|
||||
e.min_x = strtof(row[17], nullptr);
|
||||
e.min_y = strtof(row[18], nullptr);
|
||||
e.min_z = strtof(row[19], nullptr);
|
||||
e.max_x = strtof(row[20], nullptr);
|
||||
e.max_y = strtof(row[21], nullptr);
|
||||
e.max_z = strtof(row[22], nullptr);
|
||||
e.skill_list = row[23] ? row[23] : "";
|
||||
e.spell_list = row[24] ? row[24] : "";
|
||||
e.zones = row[25] ? row[25] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[26]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[27]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -418,18 +508,28 @@ public:
|
||||
e.step = static_cast<int32_t>(atoi(row[3]));
|
||||
e.activitytype = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.target_name = row[5] ? row[5] : "";
|
||||
e.item_list = row[6] ? row[6] : "";
|
||||
e.skill_list = row[7] ? row[7] : "";
|
||||
e.spell_list = row[8] ? row[8] : "";
|
||||
e.description_override = row[9] ? row[9] : "";
|
||||
e.goalid = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.goal_match_list = row[11] ? row[11] : "";
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[13]));
|
||||
e.delivertonpc = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.zones = row[15] ? row[15] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[16]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[17]));
|
||||
e.goalmethod = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.goalcount = static_cast<int32_t>(atoi(row[7]));
|
||||
e.description_override = row[8] ? row[8] : "";
|
||||
e.npc_id = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.npc_goal_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.npc_match_list = row[11] ? row[11] : "";
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.item_goal_id = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.item_id_list = row[14] ? row[14] : "";
|
||||
e.item_list = row[15] ? row[15] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[16]));
|
||||
e.min_x = strtof(row[17], nullptr);
|
||||
e.min_y = strtof(row[18], nullptr);
|
||||
e.min_z = strtof(row[19], nullptr);
|
||||
e.max_x = strtof(row[20], nullptr);
|
||||
e.max_y = strtof(row[21], nullptr);
|
||||
e.max_z = strtof(row[22], nullptr);
|
||||
e.skill_list = row[23] ? row[23] : "";
|
||||
e.spell_list = row[24] ? row[24] : "";
|
||||
e.zones = row[25] ? row[25] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[26]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[27]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_PROXIMITIES_REPOSITORY_H
|
||||
#define EQEMU_PROXIMITIES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_proximities_repository.h"
|
||||
|
||||
class ProximitiesRepository: public BaseProximitiesRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* ProximitiesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ProximitiesRepository::GetWhereNeverExpires()
|
||||
* ProximitiesRepository::GetWhereXAndY()
|
||||
* ProximitiesRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_PROXIMITIES_REPOSITORY_H
|
||||
+17
-7
@@ -18,8 +18,7 @@
|
||||
// Command Codes for worldserver ServerOP_ReloadTasks
|
||||
#define RELOADTASKS 0
|
||||
#define RELOADTASKGOALLISTS 1
|
||||
#define RELOADTASKPROXIMITIES 2
|
||||
#define RELOADTASKSETS 3
|
||||
#define RELOADTASKSETS 2
|
||||
|
||||
typedef enum {
|
||||
METHODSINGLEID = 0,
|
||||
@@ -77,17 +76,28 @@ struct ActivityInformation {
|
||||
std::string description_override; // overrides auto generated description -- default empty, max length 128
|
||||
int skill_id; // older clients, first id from above
|
||||
int spell_id; // older clients, first id from above
|
||||
int goal_id;
|
||||
std::string goal_match_list;
|
||||
TaskMethodType goal_method;
|
||||
int goal_count;
|
||||
int deliver_to_npc;
|
||||
uint32_t npc_id;
|
||||
uint32_t npc_goal_id;
|
||||
std::string npc_match_list; // delimited by '|' for partial name matches but also supports ids
|
||||
uint32_t item_id;
|
||||
uint32_t item_goal_id;
|
||||
std::string item_id_list; // delimited by '|' to support multiple item ids
|
||||
int dz_switch_id;
|
||||
float min_x;
|
||||
float min_y;
|
||||
float min_z;
|
||||
float max_x;
|
||||
float max_y;
|
||||
float max_z;
|
||||
std::vector<int> zone_ids;
|
||||
std::string zones; // IDs ; separated, ZoneID is the first in this list for older clients -- default empty string, max length 64
|
||||
int zone_version;
|
||||
bool optional;
|
||||
bool has_area; // non-database field
|
||||
|
||||
inline bool CheckZone(int zone_id, int version)
|
||||
inline bool CheckZone(int zone_id, int version) const
|
||||
{
|
||||
if (zone_ids.empty()) {
|
||||
return true;
|
||||
@@ -166,7 +176,7 @@ struct ActivityInformation {
|
||||
out.WriteInt32(zone_ids.empty() ? 0 : zone_ids.front());
|
||||
}
|
||||
|
||||
out.WriteInt32(activity_type == TaskActivityType::Touch ? goal_id : 0); // dz_switch_id (maybe add separate field)
|
||||
out.WriteInt32(dz_switch_id);
|
||||
out.WriteString(description_override);
|
||||
out.WriteInt32(done_count);
|
||||
out.WriteInt8(1); // unknown
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9202
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9203
|
||||
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9029
|
||||
|
||||
Reference in New Issue
Block a user