mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2026-02-08 05:20:04 +00:00
Compare commits
5 Commits
b617456aa1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51d3cfbb3b | ||
|
|
8df263a64d | ||
| 572df90645 | |||
|
|
8d0587dd45 | ||
|
|
0078be8e9a |
6
.github/workflows/check-builds.yaml
vendored
6
.github/workflows/check-builds.yaml
vendored
@@ -60,7 +60,7 @@ jobs:
|
|||||||
path: bin
|
path: bin
|
||||||
|
|
||||||
windows-build:
|
windows-build:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
- name: Set environment
|
- name: Set environment
|
||||||
run: $s = $env:GITHUB_SHA.subString(0, 7); echo "SHORT_SHA=$s" >> $env:GITHUB_ENV
|
run: $s = $env:GITHUB_SHA.subString(0, 7); echo "SHORT_SHA=$s" >> $env:GITHUB_ENV
|
||||||
@@ -75,7 +75,7 @@ jobs:
|
|||||||
$configurations = "Release"
|
$configurations = "Release"
|
||||||
# "Debug" builds are disabled, since we don't really need them
|
# "Debug" builds are disabled, since we don't really need them
|
||||||
|
|
||||||
$vsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
|
$vsPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
|
||||||
|
|
||||||
Import-Module "$vsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
Import-Module "$vsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
|
||||||
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation
|
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation
|
||||||
@@ -111,7 +111,7 @@ jobs:
|
|||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: 'windows-vs2019-bin-x64-${{ env.SHORT_SHA }}'
|
name: 'windows-vs2022-bin-x64-${{ env.SHORT_SHA }}'
|
||||||
path: bin
|
path: bin
|
||||||
|
|
||||||
copy-artifacts:
|
copy-artifacts:
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ motd=Welcome to OpenFusion!
|
|||||||
# requires to run. You can override them by changing their values and
|
# requires to run. You can override them by changing their values and
|
||||||
# uncommenting them (removing the leading # character from that line).
|
# uncommenting them (removing the leading # character from that line).
|
||||||
|
|
||||||
|
# Should drop fixes be enabled?
|
||||||
|
# This will add drops to (mostly Academy-specific) mobs that don't have drops
|
||||||
|
# and rearrange drop tables that are either unassigned or stranded in difficult to reach mobs
|
||||||
|
# e.g. Hyper Fusionfly and Fusion Numbuh Four drops will become more accessible.
|
||||||
|
# This is a polish option that is slightly inauthentic to the original game.
|
||||||
|
#dropfixesenabled=true
|
||||||
|
|
||||||
# location of the tabledata folder
|
# location of the tabledata folder
|
||||||
#tdatadir=tdata/
|
#tdatadir=tdata/
|
||||||
# location of the patch folder
|
# location of the patch folder
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// these are added to the NPC's static key to avoid collisions
|
// these are added to the NPC's static key to avoid collisions
|
||||||
const int NPC_ID_OFFSET = 1;
|
const int NPC_ID_OFFSET = 1;
|
||||||
const int MOB_ID_OFFSET = 10000;
|
const int MOB_ID_OFFSET = 10000;
|
||||||
const int MOB_GROUP_ID_OFFSET = 20000;
|
const int MOB_GROUP_ID_OFFSET = 30000;
|
||||||
|
|
||||||
// typedef for JSON object because I don't want to type nlohmann::json every time
|
// typedef for JSON object because I don't want to type nlohmann::json every time
|
||||||
typedef nlohmann::json json;
|
typedef nlohmann::json json;
|
||||||
|
|||||||
@@ -196,18 +196,16 @@ void Database::updateEmailContent(EmailData* data) {
|
|||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::deleteEmailAttachments(int playerID, int index, int slot) {
|
static void _deleteEmailAttachments(int playerID, int index, int slot) {
|
||||||
std::lock_guard<std::mutex> lock(dbCrit);
|
|
||||||
|
|
||||||
sqlite3_stmt* stmt;
|
sqlite3_stmt* stmt;
|
||||||
|
|
||||||
std::string sql(R"(
|
std::string sql(R"(
|
||||||
DELETE FROM EmailItems
|
DELETE FROM EmailItems
|
||||||
WHERE PlayerID = ? AND MsgIndex = ?;
|
WHERE PlayerID = ? AND MsgIndex = ?
|
||||||
)");
|
)");
|
||||||
|
|
||||||
if (slot != -1)
|
if (slot != -1)
|
||||||
sql += " AND \"Slot\" = ? ";
|
sql += " AND \"Slot\" = ?";
|
||||||
sql += ";";
|
sql += ";";
|
||||||
|
|
||||||
sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, NULL);
|
sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, NULL);
|
||||||
@@ -221,6 +219,11 @@ void Database::deleteEmailAttachments(int playerID, int index, int slot) {
|
|||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database::deleteEmailAttachments(int playerID, int index, int slot) {
|
||||||
|
std::lock_guard<std::mutex> lock(dbCrit);
|
||||||
|
_deleteEmailAttachments(playerID, index, slot);
|
||||||
|
}
|
||||||
|
|
||||||
void Database::deleteEmails(int playerID, int64_t* indices) {
|
void Database::deleteEmails(int playerID, int64_t* indices) {
|
||||||
std::lock_guard<std::mutex> lock(dbCrit);
|
std::lock_guard<std::mutex> lock(dbCrit);
|
||||||
|
|
||||||
@@ -234,12 +237,15 @@ void Database::deleteEmails(int playerID, int64_t* indices) {
|
|||||||
sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
|
sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
|
int64_t msgIndex = indices[i];
|
||||||
sqlite3_bind_int(stmt, 1, playerID);
|
sqlite3_bind_int(stmt, 1, playerID);
|
||||||
sqlite3_bind_int64(stmt, 2, indices[i]);
|
sqlite3_bind_int64(stmt, 2, msgIndex);
|
||||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
std::cout << "[WARN] Database: Failed to delete an email: " << sqlite3_errmsg(db) << std::endl;
|
std::cout << "[WARN] Database: Failed to delete an email: " << sqlite3_errmsg(db) << std::endl;
|
||||||
}
|
}
|
||||||
sqlite3_reset(stmt);
|
sqlite3_reset(stmt);
|
||||||
|
// delete all attachments
|
||||||
|
_deleteEmailAttachments(playerID, msgIndex, -1);
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
|
||||||
@@ -323,12 +329,23 @@ bool Database::sendEmail(EmailData* data, std::vector<sItemBase> attachments, Pl
|
|||||||
sqlite3_bind_int(stmt, 7, item.iTimeLimit);
|
sqlite3_bind_int(stmt, 7, item.iTimeLimit);
|
||||||
|
|
||||||
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
std::cout << "[WARN] Database: Failed to send email: " << sqlite3_errmsg(db) << std::endl;
|
// very likely the UNIQUE constraint failing due to
|
||||||
sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, NULL);
|
// orphaned attachments from an old email.
|
||||||
sqlite3_finalize(stmt);
|
// try deleting them first
|
||||||
return false;
|
_deleteEmailAttachments(data->PlayerId, data->MsgIndex, -1);
|
||||||
|
|
||||||
|
// try again
|
||||||
|
sqlite3_reset(stmt);
|
||||||
|
if (sqlite3_step(stmt) != SQLITE_DONE) {
|
||||||
|
// different error, give up
|
||||||
|
std::cout << "[WARN] Database: Failed to send email: " << sqlite3_errmsg(db) << std::endl;
|
||||||
|
sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, NULL);
|
||||||
|
sqlite3_finalize(stmt);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlite3_reset(stmt);
|
sqlite3_reset(stmt);
|
||||||
|
sqlite3_clear_bindings(stmt);
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ int settings::EVENTMODE = 0;
|
|||||||
// race settings
|
// race settings
|
||||||
bool settings::IZRACESCORECAPPED = true;
|
bool settings::IZRACESCORECAPPED = true;
|
||||||
|
|
||||||
|
// drop fixes enabled
|
||||||
|
bool settings::DROPFIXESENABLED = false;
|
||||||
|
|
||||||
void settings::init() {
|
void settings::init() {
|
||||||
INIReader reader("config.ini");
|
INIReader reader("config.ini");
|
||||||
|
|
||||||
@@ -117,6 +120,7 @@ void settings::init() {
|
|||||||
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
||||||
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
||||||
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
||||||
|
DROPFIXESENABLED = reader.GetBoolean("shard", "dropfixesenabled", DROPFIXESENABLED);
|
||||||
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
||||||
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
||||||
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
||||||
@@ -126,4 +130,16 @@ void settings::init() {
|
|||||||
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
||||||
MONITORLISTENIP = reader.Get("monitor", "listenip", MONITORLISTENIP);
|
MONITORLISTENIP = reader.Get("monitor", "listenip", MONITORLISTENIP);
|
||||||
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
||||||
|
|
||||||
|
if (DROPFIXESENABLED) {
|
||||||
|
std::cout << "[INFO] Drop fixes enabled" << std::endl;
|
||||||
|
if (ENABLEDPATCHES.empty()) {
|
||||||
|
ENABLEDPATCHES = "0104-fixes";
|
||||||
|
} else {
|
||||||
|
ENABLEDPATCHES += " 0104-fixes";
|
||||||
|
if (ENABLEDPATCHES.find("1013") != std::string::npos) {
|
||||||
|
ENABLEDPATCHES += " 1013-fixes";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace settings {
|
|||||||
extern int MONITORINTERVAL;
|
extern int MONITORINTERVAL;
|
||||||
extern bool DISABLEFIRSTUSEFLAG;
|
extern bool DISABLEFIRSTUSEFLAG;
|
||||||
extern bool IZRACESCORECAPPED;
|
extern bool IZRACESCORECAPPED;
|
||||||
|
extern bool DROPFIXESENABLED;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
||||||
|
|||||||
2
tdata
2
tdata
Submodule tdata updated: bdb611b092...d6183b484e
Reference in New Issue
Block a user