mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Adding dbstr_us.txt support to client files
This commit is contained in:
parent
70048eb6e1
commit
7041db7480
@ -32,6 +32,7 @@ EQEmuLogSys Log;
|
|||||||
void ExportSpells(SharedDatabase *db);
|
void ExportSpells(SharedDatabase *db);
|
||||||
void ExportSkillCaps(SharedDatabase *db);
|
void ExportSkillCaps(SharedDatabase *db);
|
||||||
void ExportBaseData(SharedDatabase *db);
|
void ExportBaseData(SharedDatabase *db);
|
||||||
|
void ExportDBStrings(SharedDatabase *db);
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||||
@ -62,6 +63,7 @@ int main(int argc, char **argv) {
|
|||||||
ExportSpells(&database);
|
ExportSpells(&database);
|
||||||
ExportSkillCaps(&database);
|
ExportSkillCaps(&database);
|
||||||
ExportBaseData(&database);
|
ExportBaseData(&database);
|
||||||
|
ExportDBStrings(&database);
|
||||||
|
|
||||||
Log.CloseFileLogs();
|
Log.CloseFileLogs();
|
||||||
|
|
||||||
@ -200,3 +202,37 @@ void ExportBaseData(SharedDatabase *db) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExportDBStrings(SharedDatabase *db) {
|
||||||
|
Log.Out(Logs::General, Logs::Status, "Exporting DB Strings...");
|
||||||
|
|
||||||
|
FILE *f = fopen("export/dbstr_us.txt", "w");
|
||||||
|
if(!f) {
|
||||||
|
Log.Out(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "Major^Minor^String(New)\n");
|
||||||
|
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
|
||||||
|
auto results = db->QueryDatabase(query);
|
||||||
|
if(results.Success()) {
|
||||||
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
std::string line;
|
||||||
|
unsigned int fields = results.ColumnCount();
|
||||||
|
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||||
|
if(rowIndex != 0)
|
||||||
|
line.push_back('^');
|
||||||
|
|
||||||
|
if(row[rowIndex] != nullptr) {
|
||||||
|
line += row[rowIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "%s\n", line.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ EQEmuLogSys Log;
|
|||||||
void ImportSpells(SharedDatabase *db);
|
void ImportSpells(SharedDatabase *db);
|
||||||
void ImportSkillCaps(SharedDatabase *db);
|
void ImportSkillCaps(SharedDatabase *db);
|
||||||
void ImportBaseData(SharedDatabase *db);
|
void ImportBaseData(SharedDatabase *db);
|
||||||
|
void ImportDBStrings(SharedDatabase *db);
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
@ -59,6 +60,7 @@ int main(int argc, char **argv) {
|
|||||||
ImportSpells(&database);
|
ImportSpells(&database);
|
||||||
ImportSkillCaps(&database);
|
ImportSkillCaps(&database);
|
||||||
ImportBaseData(&database);
|
ImportBaseData(&database);
|
||||||
|
ImportDBStrings(&database);
|
||||||
|
|
||||||
Log.CloseFileLogs();
|
Log.CloseFileLogs();
|
||||||
|
|
||||||
@ -202,7 +204,6 @@ void ImportSkillCaps(SharedDatabase *db) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int class_id, skill_id, level, cap;
|
int class_id, skill_id, level, cap;
|
||||||
class_id = atoi(split[0].c_str());
|
class_id = atoi(split[0].c_str());
|
||||||
skill_id = atoi(split[1].c_str());
|
skill_id = atoi(split[1].c_str());
|
||||||
@ -262,3 +263,56 @@ void ImportBaseData(SharedDatabase *db) {
|
|||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImportDBStrings(SharedDatabase *db) {
|
||||||
|
Log.Out(Logs::General, Logs::Status, "Importing DB Strings...");
|
||||||
|
|
||||||
|
FILE *f = fopen("import/dbstr_us.txt", "r");
|
||||||
|
if(!f) {
|
||||||
|
Log.Out(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string delete_sql = "DELETE FROM db_str";
|
||||||
|
db->QueryDatabase(delete_sql);
|
||||||
|
|
||||||
|
char buffer[2048];
|
||||||
|
bool first = true;
|
||||||
|
while(fgets(buffer, 2048, f)) {
|
||||||
|
if(first) {
|
||||||
|
first = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < 2048; ++i) {
|
||||||
|
if(buffer[i] == '\n') {
|
||||||
|
buffer[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto split = SplitString(buffer, '^');
|
||||||
|
|
||||||
|
if(split.size() < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sql;
|
||||||
|
int id, type;
|
||||||
|
std::string value;
|
||||||
|
|
||||||
|
id = atoi(split[0].c_str());
|
||||||
|
type = atoi(split[1].c_str());
|
||||||
|
|
||||||
|
if(split.size() >= 3) {
|
||||||
|
value = ::EscapeString(split[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql = StringFormat("INSERT INTO db_str(id, type, value) VALUES(%u, %u, '%s')",
|
||||||
|
id, type, value.c_str());
|
||||||
|
|
||||||
|
db->QueryDatabase(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|||||||
6
utils/sql/git/required/2015_05_23_dbstr_us.sql
Normal file
6
utils/sql/git/required/2015_05_23_dbstr_us.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE `db_str` (
|
||||||
|
`id` INT(10) NOT NULL,
|
||||||
|
`type` INT(10) NOT NULL,
|
||||||
|
`value` TEXT NOT NULL,
|
||||||
|
PRIMARY KEY (`id`, `type`)
|
||||||
|
);;
|
||||||
Loading…
x
Reference in New Issue
Block a user