mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 09:06:46 +00:00
[Tasks] Schema simplification (#2449)
* Combine task_activity item and npc fields This will make tooling easier. While denormalizing goallists may not be ideal, it decouples tasks from rewards which share the table and removes a redundant column in favor of a using the delimited string which better matches live packet data. * [Tasks] Deprecate goallists table, migrate reward goal lists, simplify logic * Update 2022_09_25_task_concat_matchlists.sql * Update 2022_09_25_task_concat_matchlists.sql * Tweaks * Fix reward column name in conversion script * Task reward stacking * Update task_client_state.cpp * Implement stack counts * Fix reward item instance memory leak * Validate reward item instance * Fix item reward message * Fix findtask Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
@@ -1,333 +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_GOALLISTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_GOALLISTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseGoallistsRepository {
|
||||
public:
|
||||
struct Goallists {
|
||||
uint32_t listid;
|
||||
uint32_t entry;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("listid");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"listid",
|
||||
"entry",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"listid",
|
||||
"entry",
|
||||
};
|
||||
}
|
||||
|
||||
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("goallists");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Goallists NewEntity()
|
||||
{
|
||||
Goallists e{};
|
||||
|
||||
e.listid = 0;
|
||||
e.entry = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static Goallists GetGoallists(
|
||||
const std::vector<Goallists> &goallistss,
|
||||
int goallists_id
|
||||
)
|
||||
{
|
||||
for (auto &goallists : goallistss) {
|
||||
if (goallists.listid == goallists_id) {
|
||||
return goallists;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Goallists FindOne(
|
||||
Database& db,
|
||||
int goallists_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
goallists_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Goallists e{};
|
||||
|
||||
e.listid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.entry = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int goallists_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
goallists_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const Goallists &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.listid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.entry));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.listid
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Goallists InsertOne(
|
||||
Database& db,
|
||||
Goallists e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.listid));
|
||||
v.push_back(std::to_string(e.entry));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.listid = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<Goallists> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.listid));
|
||||
v.push_back(std::to_string(e.entry));
|
||||
|
||||
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<Goallists> All(Database& db)
|
||||
{
|
||||
std::vector<Goallists> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Goallists e{};
|
||||
|
||||
e.listid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.entry = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Goallists> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<Goallists> 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) {
|
||||
Goallists e{};
|
||||
|
||||
e.listid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.entry = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
|
||||
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_GOALLISTS_REPOSITORY_H
|
||||
@@ -28,11 +28,7 @@ public:
|
||||
uint32_t goalmethod;
|
||||
int32_t goalcount;
|
||||
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;
|
||||
@@ -66,11 +62,7 @@ public:
|
||||
"goalmethod",
|
||||
"goalcount",
|
||||
"description_override",
|
||||
"npc_id",
|
||||
"npc_goal_id",
|
||||
"npc_match_list",
|
||||
"item_id",
|
||||
"item_goal_id",
|
||||
"item_id_list",
|
||||
"item_list",
|
||||
"dz_switch_id",
|
||||
@@ -100,11 +92,7 @@ public:
|
||||
"goalmethod",
|
||||
"goalcount",
|
||||
"description_override",
|
||||
"npc_id",
|
||||
"npc_goal_id",
|
||||
"npc_match_list",
|
||||
"item_id",
|
||||
"item_goal_id",
|
||||
"item_id_list",
|
||||
"item_list",
|
||||
"dz_switch_id",
|
||||
@@ -168,11 +156,7 @@ public:
|
||||
e.goalmethod = 0;
|
||||
e.goalcount = 1;
|
||||
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;
|
||||
@@ -231,25 +215,21 @@ public:
|
||||
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]));
|
||||
e.npc_match_list = row[9] ? row[9] : "";
|
||||
e.item_id_list = row[10] ? row[10] : "";
|
||||
e.item_list = row[11] ? row[11] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.min_x = strtof(row[13], nullptr);
|
||||
e.min_y = strtof(row[14], nullptr);
|
||||
e.min_z = strtof(row[15], nullptr);
|
||||
e.max_x = strtof(row[16], nullptr);
|
||||
e.max_y = strtof(row[17], nullptr);
|
||||
e.max_z = strtof(row[18], nullptr);
|
||||
e.skill_list = row[19] ? row[19] : "";
|
||||
e.spell_list = row[20] ? row[20] : "";
|
||||
e.zones = row[21] ? row[21] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[22]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[23]));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -292,25 +272,21 @@ public:
|
||||
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));
|
||||
v.push_back(columns[9] + " = '" + Strings::Escape(e.npc_match_list) + "'");
|
||||
v.push_back(columns[10] + " = '" + Strings::Escape(e.item_id_list) + "'");
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.item_list) + "'");
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.dz_switch_id));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.min_x));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.min_y));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.min_z));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.max_x));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.max_y));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.max_z));
|
||||
v.push_back(columns[19] + " = '" + Strings::Escape(e.skill_list) + "'");
|
||||
v.push_back(columns[20] + " = '" + Strings::Escape(e.spell_list) + "'");
|
||||
v.push_back(columns[21] + " = '" + Strings::Escape(e.zones) + "'");
|
||||
v.push_back(columns[22] + " = " + std::to_string(e.zone_version));
|
||||
v.push_back(columns[23] + " = " + std::to_string(e.optional));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -341,11 +317,7 @@ public:
|
||||
v.push_back(std::to_string(e.goalmethod));
|
||||
v.push_back(std::to_string(e.goalcount));
|
||||
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));
|
||||
@@ -398,11 +370,7 @@ public:
|
||||
v.push_back(std::to_string(e.goalmethod));
|
||||
v.push_back(std::to_string(e.goalcount));
|
||||
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));
|
||||
@@ -459,25 +427,21 @@ public:
|
||||
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]));
|
||||
e.npc_match_list = row[9] ? row[9] : "";
|
||||
e.item_id_list = row[10] ? row[10] : "";
|
||||
e.item_list = row[11] ? row[11] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.min_x = strtof(row[13], nullptr);
|
||||
e.min_y = strtof(row[14], nullptr);
|
||||
e.min_z = strtof(row[15], nullptr);
|
||||
e.max_x = strtof(row[16], nullptr);
|
||||
e.max_y = strtof(row[17], nullptr);
|
||||
e.max_z = strtof(row[18], nullptr);
|
||||
e.skill_list = row[19] ? row[19] : "";
|
||||
e.spell_list = row[20] ? row[20] : "";
|
||||
e.zones = row[21] ? row[21] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[22]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[23]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -511,25 +475,21 @@ public:
|
||||
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]));
|
||||
e.npc_match_list = row[9] ? row[9] : "";
|
||||
e.item_id_list = row[10] ? row[10] : "";
|
||||
e.item_list = row[11] ? row[11] : "";
|
||||
e.dz_switch_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.min_x = strtof(row[13], nullptr);
|
||||
e.min_y = strtof(row[14], nullptr);
|
||||
e.min_z = strtof(row[15], nullptr);
|
||||
e.max_x = strtof(row[16], nullptr);
|
||||
e.max_y = strtof(row[17], nullptr);
|
||||
e.max_z = strtof(row[18], nullptr);
|
||||
e.skill_list = row[19] ? row[19] : "";
|
||||
e.spell_list = row[20] ? row[20] : "";
|
||||
e.zones = row[21] ? row[21] : "";
|
||||
e.zone_version = static_cast<int32_t>(atoi(row[22]));
|
||||
e.optional = static_cast<int8_t>(atoi(row[23]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@ public:
|
||||
int8_t duration_code;
|
||||
std::string title;
|
||||
std::string description;
|
||||
std::string reward;
|
||||
uint32_t rewardid;
|
||||
uint32_t cashreward;
|
||||
int32_t xpreward;
|
||||
uint8_t rewardmethod;
|
||||
std::string reward_text;
|
||||
std::string reward_id_list;
|
||||
uint32_t cash_reward;
|
||||
int32_t exp_reward;
|
||||
uint8_t reward_method;
|
||||
int32_t reward_points;
|
||||
int32_t reward_point_type;
|
||||
uint8_t minlevel;
|
||||
uint8_t maxlevel;
|
||||
uint8_t min_level;
|
||||
uint8_t max_level;
|
||||
uint32_t level_spread;
|
||||
uint32_t min_players;
|
||||
uint32_t max_players;
|
||||
@@ -63,15 +63,15 @@ public:
|
||||
"duration_code",
|
||||
"title",
|
||||
"description",
|
||||
"reward",
|
||||
"rewardid",
|
||||
"cashreward",
|
||||
"xpreward",
|
||||
"rewardmethod",
|
||||
"reward_text",
|
||||
"reward_id_list",
|
||||
"cash_reward",
|
||||
"exp_reward",
|
||||
"reward_method",
|
||||
"reward_points",
|
||||
"reward_point_type",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"min_level",
|
||||
"max_level",
|
||||
"level_spread",
|
||||
"min_players",
|
||||
"max_players",
|
||||
@@ -97,15 +97,15 @@ public:
|
||||
"duration_code",
|
||||
"title",
|
||||
"description",
|
||||
"reward",
|
||||
"rewardid",
|
||||
"cashreward",
|
||||
"xpreward",
|
||||
"rewardmethod",
|
||||
"reward_text",
|
||||
"reward_id_list",
|
||||
"cash_reward",
|
||||
"exp_reward",
|
||||
"reward_method",
|
||||
"reward_points",
|
||||
"reward_point_type",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"min_level",
|
||||
"max_level",
|
||||
"level_spread",
|
||||
"min_players",
|
||||
"max_players",
|
||||
@@ -165,15 +165,15 @@ public:
|
||||
e.duration_code = 0;
|
||||
e.title = "";
|
||||
e.description = "";
|
||||
e.reward = "";
|
||||
e.rewardid = 0;
|
||||
e.cashreward = 0;
|
||||
e.xpreward = 0;
|
||||
e.rewardmethod = 2;
|
||||
e.reward_text = "";
|
||||
e.reward_id_list = "";
|
||||
e.cash_reward = 0;
|
||||
e.exp_reward = 0;
|
||||
e.reward_method = 0;
|
||||
e.reward_points = 0;
|
||||
e.reward_point_type = 0;
|
||||
e.minlevel = 0;
|
||||
e.maxlevel = 0;
|
||||
e.min_level = 0;
|
||||
e.max_level = 0;
|
||||
e.level_spread = 0;
|
||||
e.min_players = 0;
|
||||
e.max_players = 0;
|
||||
@@ -228,15 +228,15 @@ public:
|
||||
e.duration_code = static_cast<int8_t>(atoi(row[3]));
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.description = row[5] ? row[5] : "";
|
||||
e.reward = row[6] ? row[6] : "";
|
||||
e.rewardid = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.cashreward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.xpreward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.rewardmethod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_text = row[6] ? row[6] : "";
|
||||
e.reward_id_list = row[7] ? row[7] : "";
|
||||
e.cash_reward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.exp_reward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.reward_method = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_points = static_cast<int32_t>(atoi(row[11]));
|
||||
e.reward_point_type = static_cast<int32_t>(atoi(row[12]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level_spread = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.min_players = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.max_players = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
@@ -289,15 +289,15 @@ public:
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.duration_code));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.title) + "'");
|
||||
v.push_back(columns[5] + " = '" + Strings::Escape(e.description) + "'");
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.reward) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.rewardid));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.cashreward));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.xpreward));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.rewardmethod));
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.reward_text) + "'");
|
||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.reward_id_list) + "'");
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.cash_reward));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.exp_reward));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.reward_method));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.reward_points));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.reward_point_type));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.minlevel));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.maxlevel));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.min_level));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.max_level));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.level_spread));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.min_players));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.max_players));
|
||||
@@ -338,15 +338,15 @@ public:
|
||||
v.push_back(std::to_string(e.duration_code));
|
||||
v.push_back("'" + Strings::Escape(e.title) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reward) + "'");
|
||||
v.push_back(std::to_string(e.rewardid));
|
||||
v.push_back(std::to_string(e.cashreward));
|
||||
v.push_back(std::to_string(e.xpreward));
|
||||
v.push_back(std::to_string(e.rewardmethod));
|
||||
v.push_back("'" + Strings::Escape(e.reward_text) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reward_id_list) + "'");
|
||||
v.push_back(std::to_string(e.cash_reward));
|
||||
v.push_back(std::to_string(e.exp_reward));
|
||||
v.push_back(std::to_string(e.reward_method));
|
||||
v.push_back(std::to_string(e.reward_points));
|
||||
v.push_back(std::to_string(e.reward_point_type));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
v.push_back(std::to_string(e.level_spread));
|
||||
v.push_back(std::to_string(e.min_players));
|
||||
v.push_back(std::to_string(e.max_players));
|
||||
@@ -395,15 +395,15 @@ public:
|
||||
v.push_back(std::to_string(e.duration_code));
|
||||
v.push_back("'" + Strings::Escape(e.title) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reward) + "'");
|
||||
v.push_back(std::to_string(e.rewardid));
|
||||
v.push_back(std::to_string(e.cashreward));
|
||||
v.push_back(std::to_string(e.xpreward));
|
||||
v.push_back(std::to_string(e.rewardmethod));
|
||||
v.push_back("'" + Strings::Escape(e.reward_text) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reward_id_list) + "'");
|
||||
v.push_back(std::to_string(e.cash_reward));
|
||||
v.push_back(std::to_string(e.exp_reward));
|
||||
v.push_back(std::to_string(e.reward_method));
|
||||
v.push_back(std::to_string(e.reward_points));
|
||||
v.push_back(std::to_string(e.reward_point_type));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
v.push_back(std::to_string(e.level_spread));
|
||||
v.push_back(std::to_string(e.min_players));
|
||||
v.push_back(std::to_string(e.max_players));
|
||||
@@ -456,15 +456,15 @@ public:
|
||||
e.duration_code = static_cast<int8_t>(atoi(row[3]));
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.description = row[5] ? row[5] : "";
|
||||
e.reward = row[6] ? row[6] : "";
|
||||
e.rewardid = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.cashreward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.xpreward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.rewardmethod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_text = row[6] ? row[6] : "";
|
||||
e.reward_id_list = row[7] ? row[7] : "";
|
||||
e.cash_reward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.exp_reward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.reward_method = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_points = static_cast<int32_t>(atoi(row[11]));
|
||||
e.reward_point_type = static_cast<int32_t>(atoi(row[12]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level_spread = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.min_players = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.max_players = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
@@ -508,15 +508,15 @@ public:
|
||||
e.duration_code = static_cast<int8_t>(atoi(row[3]));
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.description = row[5] ? row[5] : "";
|
||||
e.reward = row[6] ? row[6] : "";
|
||||
e.rewardid = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.cashreward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.xpreward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.rewardmethod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_text = row[6] ? row[6] : "";
|
||||
e.reward_id_list = row[7] ? row[7] : "";
|
||||
e.cash_reward = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.exp_reward = static_cast<int32_t>(atoi(row[9]));
|
||||
e.reward_method = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.reward_points = static_cast<int32_t>(atoi(row[11]));
|
||||
e.reward_point_type = static_cast<int32_t>(atoi(row[12]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[13], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level_spread = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.min_players = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.max_players = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
|
||||
Reference in New Issue
Block a user