mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-04 07:23:57 +00:00
Fix float types, remove some errant table repositories [skip ci]
This commit is contained in:
parent
9e27ffacff
commit
a824ddec44
@ -37,10 +37,10 @@ public:
|
||||
int8 type;
|
||||
int type_data;
|
||||
int16 type_count;
|
||||
std::string assa_x;
|
||||
std::string assa_y;
|
||||
std::string assa_z;
|
||||
std::string assa_h;
|
||||
float assa_x;
|
||||
float assa_y;
|
||||
float assa_z;
|
||||
float assa_h;
|
||||
std::string text;
|
||||
int duration;
|
||||
int zone_in_time;
|
||||
@ -48,18 +48,18 @@ public:
|
||||
int16 lose_points;
|
||||
int8 theme;
|
||||
int16 zone_in_zone_id;
|
||||
std::string zone_in_x;
|
||||
std::string zone_in_y;
|
||||
float zone_in_x;
|
||||
float zone_in_y;
|
||||
int16 zone_in_object_id;
|
||||
std::string dest_x;
|
||||
std::string dest_y;
|
||||
std::string dest_z;
|
||||
std::string dest_h;
|
||||
float dest_x;
|
||||
float dest_y;
|
||||
float dest_z;
|
||||
float dest_h;
|
||||
int graveyard_zone_id;
|
||||
std::string graveyard_x;
|
||||
std::string graveyard_y;
|
||||
std::string graveyard_z;
|
||||
std::string graveyard_radius;
|
||||
float graveyard_x;
|
||||
float graveyard_y;
|
||||
float graveyard_z;
|
||||
float graveyard_radius;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -27,16 +27,16 @@
|
||||
class BaseDataRepository {
|
||||
public:
|
||||
struct BaseData {
|
||||
int level;
|
||||
int class;
|
||||
std::string hp;
|
||||
std::string mana;
|
||||
std::string end;
|
||||
std::string unk1;
|
||||
std::string unk2;
|
||||
std::string hp_fac;
|
||||
std::string mana_fac;
|
||||
std::string end_fac;
|
||||
int level;
|
||||
int class;
|
||||
float hp;
|
||||
float mana;
|
||||
float end;
|
||||
float unk1;
|
||||
float unk2;
|
||||
float hp_fac;
|
||||
float mana_fac;
|
||||
float end_fac;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -31,12 +31,12 @@ public:
|
||||
int spellid;
|
||||
int8 type;
|
||||
int zoneid;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string x_diff;
|
||||
std::string y_diff;
|
||||
std::string z_diff;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float x_diff;
|
||||
float y_diff;
|
||||
float z_diff;
|
||||
std::string message;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
@ -39,9 +39,9 @@ public:
|
||||
std::string category_name;
|
||||
std::string reporter_name;
|
||||
std::string ui_path;
|
||||
std::string pos_x;
|
||||
std::string pos_y;
|
||||
std::string pos_z;
|
||||
float pos_x;
|
||||
float pos_y;
|
||||
float pos_z;
|
||||
int heading;
|
||||
int time_played;
|
||||
int target_id;
|
||||
|
||||
@ -31,9 +31,9 @@ public:
|
||||
std::string zone;
|
||||
std::string name;
|
||||
std::string ui;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
std::string type;
|
||||
int8 flag;
|
||||
std::string target;
|
||||
|
||||
@ -27,14 +27,14 @@
|
||||
class CharacterBindRepository {
|
||||
public:
|
||||
struct CharacterBind {
|
||||
int id;
|
||||
int slot;
|
||||
int16 zone_id;
|
||||
int instance_id;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
int id;
|
||||
int slot;
|
||||
int16 zone_id;
|
||||
int instance_id;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -32,10 +32,10 @@ public:
|
||||
std::string charname;
|
||||
int16 zone_id;
|
||||
int16 instance_id;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
std::string time_of_death;
|
||||
int guild_consent_id;
|
||||
int8 is_rezzed;
|
||||
|
||||
@ -35,10 +35,10 @@ public:
|
||||
std::string suffix;
|
||||
int zone_id;
|
||||
int zone_instance;
|
||||
std::string y;
|
||||
std::string x;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
float y;
|
||||
float x;
|
||||
float z;
|
||||
float heading;
|
||||
int8 gender;
|
||||
int16 race;
|
||||
int8 class;
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
int spell_id;
|
||||
int hp;
|
||||
int mana;
|
||||
std::string size;
|
||||
float size;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -1,253 +0,0 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_DB_VERSION_REPOSITORY_H
|
||||
#define EQEMU_DB_VERSION_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
|
||||
class DbVersionRepository {
|
||||
public:
|
||||
struct DbVersion {
|
||||
int version;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"version",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string InsertColumnsRaw()
|
||||
{
|
||||
std::vector<std::string> insert_columns;
|
||||
|
||||
for (auto &column : Columns()) {
|
||||
if (column == PrimaryKey()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
insert_columns.push_back(column);
|
||||
}
|
||||
|
||||
return std::string(implode(", ", insert_columns));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("db_version");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
InsertColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static DbVersion NewEntity()
|
||||
{
|
||||
DbVersion entry{};
|
||||
|
||||
entry.version = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static DbVersion GetDbVersionEntry(
|
||||
const std::vector<DbVersion> &db_versions,
|
||||
int db_version_id
|
||||
)
|
||||
{
|
||||
for (auto &db_version : db_versions) {
|
||||
if (db_version. == db_version_id) {
|
||||
return db_version;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static DbVersion FindOne(
|
||||
int db_version_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
db_version_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
DbVersion entry{};
|
||||
|
||||
entry.version = atoi(row[0]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
int db_version_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
db_version_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
DbVersion db_version_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(db_version_entry.version));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
db_version_entry.
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static DbVersion InsertOne(
|
||||
DbVersion db_version_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(db_version_entry.version));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
db_version_entry.id = results.LastInsertedID();
|
||||
return db_version_entry;
|
||||
}
|
||||
|
||||
db_version_entry = InstanceListRepository::NewEntity();
|
||||
|
||||
return db_version_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
std::vector<DbVersion> db_version_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &db_version_entry: db_version_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(db_version_entry.version));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<DbVersion> All()
|
||||
{
|
||||
std::vector<DbVersion> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DbVersion entry{};
|
||||
|
||||
entry.version = atoi(row[0]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_DB_VERSION_REPOSITORY_H
|
||||
@ -32,10 +32,10 @@ public:
|
||||
std::string zone;
|
||||
int16 version;
|
||||
std::string name;
|
||||
std::string pos_y;
|
||||
std::string pos_x;
|
||||
std::string pos_z;
|
||||
std::string heading;
|
||||
float pos_y;
|
||||
float pos_x;
|
||||
float pos_z;
|
||||
float heading;
|
||||
int16 opentype;
|
||||
int16 guild;
|
||||
int16 lockpick;
|
||||
@ -48,14 +48,14 @@ public:
|
||||
int door_param;
|
||||
std::string dest_zone;
|
||||
int dest_instance;
|
||||
std::string dest_x;
|
||||
std::string dest_y;
|
||||
std::string dest_z;
|
||||
std::string dest_heading;
|
||||
float dest_x;
|
||||
float dest_y;
|
||||
float dest_z;
|
||||
float dest_heading;
|
||||
int invert_state;
|
||||
int incline;
|
||||
int16 size;
|
||||
std::string buffer;
|
||||
float buffer;
|
||||
int client_version_mask;
|
||||
int16 is_ldon_door;
|
||||
};
|
||||
|
||||
@ -1,293 +0,0 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_EQTIME_REPOSITORY_H
|
||||
#define EQEMU_EQTIME_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
|
||||
class EqtimeRepository {
|
||||
public:
|
||||
struct Eqtime {
|
||||
int8 minute;
|
||||
int8 hour;
|
||||
int8 day;
|
||||
int8 month;
|
||||
int year;
|
||||
int realtime;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"minute",
|
||||
"hour",
|
||||
"day",
|
||||
"month",
|
||||
"year",
|
||||
"realtime",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string InsertColumnsRaw()
|
||||
{
|
||||
std::vector<std::string> insert_columns;
|
||||
|
||||
for (auto &column : Columns()) {
|
||||
if (column == PrimaryKey()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
insert_columns.push_back(column);
|
||||
}
|
||||
|
||||
return std::string(implode(", ", insert_columns));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("eqtime");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
InsertColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Eqtime NewEntity()
|
||||
{
|
||||
Eqtime entry{};
|
||||
|
||||
entry.minute = 0;
|
||||
entry.hour = 0;
|
||||
entry.day = 0;
|
||||
entry.month = 0;
|
||||
entry.year = 0;
|
||||
entry.realtime = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static Eqtime GetEqtimeEntry(
|
||||
const std::vector<Eqtime> &eqtimes,
|
||||
int eqtime_id
|
||||
)
|
||||
{
|
||||
for (auto &eqtime : eqtimes) {
|
||||
if (eqtime. == eqtime_id) {
|
||||
return eqtime;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Eqtime FindOne(
|
||||
int eqtime_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
eqtime_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Eqtime entry{};
|
||||
|
||||
entry.minute = atoi(row[0]);
|
||||
entry.hour = atoi(row[1]);
|
||||
entry.day = atoi(row[2]);
|
||||
entry.month = atoi(row[3]);
|
||||
entry.year = atoi(row[4]);
|
||||
entry.realtime = atoi(row[5]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
int eqtime_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
eqtime_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Eqtime eqtime_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(eqtime_entry.minute));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(eqtime_entry.hour));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(eqtime_entry.day));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(eqtime_entry.month));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(eqtime_entry.year));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(eqtime_entry.realtime));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
eqtime_entry.
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Eqtime InsertOne(
|
||||
Eqtime eqtime_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(eqtime_entry.minute));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.hour));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.day));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.month));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.year));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.realtime));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
eqtime_entry.id = results.LastInsertedID();
|
||||
return eqtime_entry;
|
||||
}
|
||||
|
||||
eqtime_entry = InstanceListRepository::NewEntity();
|
||||
|
||||
return eqtime_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
std::vector<Eqtime> eqtime_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &eqtime_entry: eqtime_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(eqtime_entry.minute));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.hour));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.day));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.month));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.year));
|
||||
insert_values.push_back(std::to_string(eqtime_entry.realtime));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<Eqtime> All()
|
||||
{
|
||||
std::vector<Eqtime> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Eqtime entry{};
|
||||
|
||||
entry.minute = atoi(row[0]);
|
||||
entry.hour = atoi(row[1]);
|
||||
entry.day = atoi(row[2]);
|
||||
entry.month = atoi(row[3]);
|
||||
entry.year = atoi(row[4]);
|
||||
entry.realtime = atoi(row[5]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_EQTIME_REPOSITORY_H
|
||||
@ -27,12 +27,12 @@
|
||||
class GraveyardRepository {
|
||||
public:
|
||||
struct Graveyard {
|
||||
int id;
|
||||
int zone_id;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
int id;
|
||||
int zone_id;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -30,12 +30,12 @@ public:
|
||||
int id;
|
||||
int zoneid;
|
||||
int16 version;
|
||||
std::string max_x;
|
||||
std::string max_y;
|
||||
std::string max_z;
|
||||
std::string min_x;
|
||||
std::string min_y;
|
||||
std::string heading;
|
||||
float max_x;
|
||||
float max_y;
|
||||
float max_z;
|
||||
float min_x;
|
||||
float min_y;
|
||||
float heading;
|
||||
std::string name;
|
||||
int item;
|
||||
int max_allowed;
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
class LevelExpModsRepository {
|
||||
public:
|
||||
struct LevelExpMods {
|
||||
int level;
|
||||
std::string exp_mod;
|
||||
std::string aa_exp_mod;
|
||||
int level;
|
||||
float exp_mod;
|
||||
float aa_exp_mod;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -27,15 +27,15 @@
|
||||
class LootdropEntriesRepository {
|
||||
public:
|
||||
struct LootdropEntries {
|
||||
int lootdrop_id;
|
||||
int item_id;
|
||||
int16 item_charges;
|
||||
int8 equip_item;
|
||||
std::string chance;
|
||||
std::string disabled_chance;
|
||||
int8 minlevel;
|
||||
int8 maxlevel;
|
||||
int8 multiplier;
|
||||
int lootdrop_id;
|
||||
int item_id;
|
||||
int16 item_charges;
|
||||
int8 equip_item;
|
||||
float chance;
|
||||
float disabled_chance;
|
||||
int8 minlevel;
|
||||
int8 maxlevel;
|
||||
int8 multiplier;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -27,12 +27,12 @@
|
||||
class LoottableEntriesRepository {
|
||||
public:
|
||||
struct LoottableEntries {
|
||||
int loottable_id;
|
||||
int lootdrop_id;
|
||||
int8 multiplier;
|
||||
int8 droplimit;
|
||||
int8 mindrop;
|
||||
std::string probability;
|
||||
int loottable_id;
|
||||
int lootdrop_id;
|
||||
int8 multiplier;
|
||||
int8 droplimit;
|
||||
int8 mindrop;
|
||||
float probability;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -40,7 +40,7 @@ public:
|
||||
int8 texture;
|
||||
int8 helmtexture;
|
||||
int herosforgemodel;
|
||||
std::string size;
|
||||
float size;
|
||||
int hp_regen_rate;
|
||||
int mana_regen_rate;
|
||||
int loottable_id;
|
||||
@ -78,7 +78,7 @@ public:
|
||||
int8 prim_melee_type;
|
||||
int8 sec_melee_type;
|
||||
int8 ranged_type;
|
||||
std::string runspeed;
|
||||
float runspeed;
|
||||
int16 MR;
|
||||
int16 CR;
|
||||
int16 DR;
|
||||
@ -92,7 +92,7 @@ public:
|
||||
int16 AC;
|
||||
int8 npc_aggro;
|
||||
int8 spawn_limit;
|
||||
std::string attack_speed;
|
||||
float attack_speed;
|
||||
int8 attack_delay;
|
||||
int8 findable;
|
||||
int STR;
|
||||
@ -119,8 +119,8 @@ public:
|
||||
int8 underwater;
|
||||
int8 isquest;
|
||||
int emoteid;
|
||||
std::string spellscale;
|
||||
std::string healscale;
|
||||
float spellscale;
|
||||
float healscale;
|
||||
int8 no_target_hotkey;
|
||||
int8 raid_target;
|
||||
int8 armtexture;
|
||||
|
||||
@ -30,10 +30,10 @@ public:
|
||||
int id;
|
||||
int zoneid;
|
||||
int16 version;
|
||||
std::string xpos;
|
||||
std::string ypos;
|
||||
std::string zpos;
|
||||
std::string heading;
|
||||
float xpos;
|
||||
float ypos;
|
||||
float zpos;
|
||||
float heading;
|
||||
int itemid;
|
||||
int16 charges;
|
||||
std::string objectname;
|
||||
@ -49,9 +49,9 @@ public:
|
||||
int unknown72;
|
||||
int unknown76;
|
||||
int unknown84;
|
||||
std::string size;
|
||||
std::string tilt_x;
|
||||
std::string tilt_y;
|
||||
float size;
|
||||
float tilt_x;
|
||||
float tilt_y;
|
||||
std::string display_name;
|
||||
};
|
||||
|
||||
|
||||
@ -27,14 +27,14 @@
|
||||
class ProximitiesRepository {
|
||||
public:
|
||||
struct Proximities {
|
||||
int zoneid;
|
||||
int exploreid;
|
||||
std::string minx;
|
||||
std::string maxx;
|
||||
std::string miny;
|
||||
std::string maxy;
|
||||
std::string minz;
|
||||
std::string maxz;
|
||||
int zoneid;
|
||||
int exploreid;
|
||||
float minx;
|
||||
float maxx;
|
||||
float miny;
|
||||
float maxy;
|
||||
float minz;
|
||||
float maxz;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -31,10 +31,10 @@ public:
|
||||
int spawngroupID;
|
||||
std::string zone;
|
||||
int16 version;
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
int respawntime;
|
||||
int variance;
|
||||
int pathgrid;
|
||||
|
||||
@ -254,10 +254,10 @@ public:
|
||||
int persistdeath;
|
||||
int field225;
|
||||
int field226;
|
||||
std::string min_dist;
|
||||
std::string min_dist_mod;
|
||||
std::string max_dist;
|
||||
std::string max_dist_mod;
|
||||
float min_dist;
|
||||
float min_dist_mod;
|
||||
float max_dist;
|
||||
float max_dist_mod;
|
||||
int min_range;
|
||||
int field232;
|
||||
int field233;
|
||||
|
||||
@ -27,21 +27,21 @@
|
||||
class StartZonesRepository {
|
||||
public:
|
||||
struct StartZones {
|
||||
std::string x;
|
||||
std::string y;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
int zone_id;
|
||||
int bind_id;
|
||||
int player_choice;
|
||||
int player_class;
|
||||
int player_deity;
|
||||
int player_race;
|
||||
int start_zone;
|
||||
std::string bind_x;
|
||||
std::string bind_y;
|
||||
std::string bind_z;
|
||||
int8 select_rank;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
int zone_id;
|
||||
int bind_id;
|
||||
int player_choice;
|
||||
int player_class;
|
||||
int player_deity;
|
||||
int player_race;
|
||||
int start_zone;
|
||||
float bind_x;
|
||||
float bind_y;
|
||||
float bind_z;
|
||||
int8 select_rank;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
|
||||
@ -34,8 +34,8 @@ public:
|
||||
int y;
|
||||
int z;
|
||||
int8 chance;
|
||||
std::string maxzdiff;
|
||||
std::string radius;
|
||||
float maxzdiff;
|
||||
float radius;
|
||||
int effect;
|
||||
int effectvalue;
|
||||
int effectvalue2;
|
||||
|
||||
@ -31,18 +31,18 @@ public:
|
||||
std::string zone;
|
||||
int version;
|
||||
int16 number;
|
||||
std::string y;
|
||||
std::string x;
|
||||
std::string z;
|
||||
std::string heading;
|
||||
std::string target_y;
|
||||
std::string target_x;
|
||||
std::string target_z;
|
||||
std::string target_heading;
|
||||
float y;
|
||||
float x;
|
||||
float z;
|
||||
float heading;
|
||||
float target_y;
|
||||
float target_x;
|
||||
float target_z;
|
||||
float target_heading;
|
||||
int16 zoneinst;
|
||||
int target_zone_id;
|
||||
int target_instance;
|
||||
std::string buffer;
|
||||
float buffer;
|
||||
int client_version_mask;
|
||||
};
|
||||
|
||||
|
||||
@ -32,10 +32,10 @@ public:
|
||||
std::string file_name;
|
||||
std::string long_name;
|
||||
std::string map_file_name;
|
||||
std::string safe_x;
|
||||
std::string safe_y;
|
||||
std::string safe_z;
|
||||
std::string graveyard_id;
|
||||
float safe_x;
|
||||
float safe_y;
|
||||
float safe_z;
|
||||
float graveyard_id;
|
||||
int8 min_level;
|
||||
int8 min_status;
|
||||
int zoneidnumber;
|
||||
@ -44,40 +44,40 @@ public:
|
||||
int maxclients;
|
||||
int ruleset;
|
||||
std::string note;
|
||||
std::string underworld;
|
||||
std::string minclip;
|
||||
std::string maxclip;
|
||||
std::string fog_minclip;
|
||||
std::string fog_maxclip;
|
||||
float underworld;
|
||||
float minclip;
|
||||
float maxclip;
|
||||
float fog_minclip;
|
||||
float fog_maxclip;
|
||||
int8 fog_blue;
|
||||
int8 fog_red;
|
||||
int8 fog_green;
|
||||
int8 sky;
|
||||
int8 ztype;
|
||||
std::string zone_exp_multiplier;
|
||||
std::string walkspeed;
|
||||
float zone_exp_multiplier;
|
||||
float walkspeed;
|
||||
int8 time_type;
|
||||
int8 fog_red1;
|
||||
int8 fog_green1;
|
||||
int8 fog_blue1;
|
||||
std::string fog_minclip1;
|
||||
std::string fog_maxclip1;
|
||||
float fog_minclip1;
|
||||
float fog_maxclip1;
|
||||
int8 fog_red2;
|
||||
int8 fog_green2;
|
||||
int8 fog_blue2;
|
||||
std::string fog_minclip2;
|
||||
std::string fog_maxclip2;
|
||||
float fog_minclip2;
|
||||
float fog_maxclip2;
|
||||
int8 fog_red3;
|
||||
int8 fog_green3;
|
||||
int8 fog_blue3;
|
||||
std::string fog_minclip3;
|
||||
std::string fog_maxclip3;
|
||||
float fog_minclip3;
|
||||
float fog_maxclip3;
|
||||
int8 fog_red4;
|
||||
int8 fog_green4;
|
||||
int8 fog_blue4;
|
||||
std::string fog_minclip4;
|
||||
std::string fog_maxclip4;
|
||||
std::string fog_density;
|
||||
float fog_minclip4;
|
||||
float fog_maxclip4;
|
||||
float fog_density;
|
||||
std::string flag_needed;
|
||||
int8 canbind;
|
||||
int8 cancombat;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
int snow_duration2;
|
||||
int snow_duration3;
|
||||
int snow_duration4;
|
||||
std::string gravity;
|
||||
float gravity;
|
||||
int type;
|
||||
int8 skylock;
|
||||
int fast_regen_hp;
|
||||
|
||||
@ -117,6 +117,8 @@ foreach my $table_to_generate (@tables) {
|
||||
# These tables don't have a typical schema
|
||||
my @table_ignore_list = (
|
||||
"character_enabledtasks",
|
||||
"eqtime",
|
||||
"db_version",
|
||||
"keyring",
|
||||
"profanity_list",
|
||||
"zone_flags",
|
||||
@ -201,7 +203,7 @@ foreach my $table_to_generate (@tables) {
|
||||
my $column_key = $row[5];
|
||||
my $column_default = ($row[6] ? $row[6] : "");
|
||||
|
||||
if ($column_key eq "PRI") {
|
||||
if ($column_key eq "PRI" || ($ordinal_position == 0 && $column_name=~/id/i)) {
|
||||
$table_primary_key{$table_name} = $column_name;
|
||||
}
|
||||
|
||||
@ -380,9 +382,16 @@ sub translate_mysql_data_type_to_c {
|
||||
elsif ($mysql_data_type =~ /smallint/) {
|
||||
$struct_data_type = 'int16';
|
||||
}
|
||||
elsif ($mysql_data_type =~ /bigint/) {
|
||||
$struct_data_type = 'int';
|
||||
# Use regular int for now until we have 64 support
|
||||
}
|
||||
elsif ($mysql_data_type =~ /int/) {
|
||||
$struct_data_type = 'int';
|
||||
}
|
||||
elsif ($mysql_data_type =~ /float|double|decimal/) {
|
||||
$struct_data_type = 'float';
|
||||
}
|
||||
|
||||
return $struct_data_type;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user