2020-08-18 20:42:30 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include "settings.hpp"
|
2021-03-12 17:50:21 +00:00
|
|
|
#include "INIReader.hpp"
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2021-03-20 23:53:22 +00:00
|
|
|
// so we get the ACADEMY definition
|
|
|
|
#include "core/CNStructs.hpp"
|
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
// defaults :)
|
2020-08-23 21:09:31 +00:00
|
|
|
int settings::VERBOSITY = 1;
|
2021-11-04 02:12:11 +00:00
|
|
|
bool settings::SANDBOX = true;
|
2020-08-22 17:39:13 +00:00
|
|
|
|
2020-12-17 23:24:24 +00:00
|
|
|
int settings::LOGINPORT = 23000;
|
2020-09-01 22:37:09 +00:00
|
|
|
bool settings::APPROVEALLNAMES = true;
|
2022-06-29 21:42:44 +00:00
|
|
|
bool settings::AUTOCREATEACCOUNTS = true;
|
2020-09-08 22:23:45 +00:00
|
|
|
int settings::DBSAVEINTERVAL = 240;
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-12-17 23:24:24 +00:00
|
|
|
int settings::SHARDPORT = 23001;
|
2020-08-18 20:42:30 +00:00
|
|
|
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
2021-10-21 18:58:41 +00:00
|
|
|
bool settings::LOCALHOSTWORKAROUND = true;
|
2020-09-16 15:45:53 +00:00
|
|
|
time_t settings::TIMEOUT = 60000;
|
2020-10-20 22:55:58 +00:00
|
|
|
int settings::VIEWDISTANCE = 25600;
|
2020-09-22 18:53:44 +00:00
|
|
|
bool settings::SIMULATEMOBS = true;
|
2022-11-26 18:36:10 +00:00
|
|
|
bool settings::ANTICHEAT = true;
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-12-21 00:58:33 +00:00
|
|
|
// default spawn point
|
|
|
|
#ifndef ACADEMY
|
2021-01-06 11:29:39 +00:00
|
|
|
// Sector V (The Future)
|
2020-09-08 20:41:02 +00:00
|
|
|
int settings::SPAWN_X = 632032;
|
|
|
|
int settings::SPAWN_Y = 187177;
|
|
|
|
int settings::SPAWN_Z = -5500;
|
2020-12-21 00:58:33 +00:00
|
|
|
#else
|
2021-01-06 11:29:39 +00:00
|
|
|
// Null Void (Training Area)
|
2020-12-21 00:58:33 +00:00
|
|
|
int settings::SPAWN_X = 19835;
|
|
|
|
int settings::SPAWN_Y = 108682;
|
|
|
|
int settings::SPAWN_Z = 8450;
|
|
|
|
#endif
|
2020-09-08 20:41:02 +00:00
|
|
|
int settings::SPAWN_ANGLE = 130;
|
2021-05-02 00:49:54 +00:00
|
|
|
|
2020-11-28 23:31:00 +00:00
|
|
|
std::string settings::DBPATH = "database.db";
|
2021-05-02 00:49:54 +00:00
|
|
|
std::string settings::TDATADIR = "tdata/";
|
|
|
|
std::string settings::PATCHDIR = "tdata/patch/";
|
|
|
|
|
|
|
|
std::string settings::NPCJSON = "NPCs.json";
|
|
|
|
std::string settings::MOBJSON = "mobs.json";
|
|
|
|
std::string settings::EGGSJSON = "eggs.json";
|
|
|
|
std::string settings::GRUNTWORKJSON = "gruntwork.json";
|
|
|
|
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
|
|
|
std::string settings::DROPSJSON = "drops.json";
|
|
|
|
std::string settings::PATHJSON = "paths.json";
|
2021-05-06 15:47:48 +00:00
|
|
|
#ifdef ACADEMY
|
2021-05-02 00:49:54 +00:00
|
|
|
std::string settings::XDTJSON = "xdt1013.json";
|
2021-05-07 19:29:18 +00:00
|
|
|
std::string settings::ENABLEDPATCHES = "1013";
|
2021-05-02 00:49:54 +00:00
|
|
|
#else
|
2021-05-06 15:47:48 +00:00
|
|
|
std::string settings::XDTJSON = "xdt.json";
|
2021-05-07 19:29:18 +00:00
|
|
|
std::string settings::ENABLEDPATCHES = "";
|
2021-05-02 00:49:54 +00:00
|
|
|
#endif // ACADEMY
|
2021-01-04 16:08:44 +00:00
|
|
|
|
2020-09-22 02:26:12 +00:00
|
|
|
int settings::ACCLEVEL = 1;
|
2020-12-07 18:24:56 +00:00
|
|
|
bool settings::DISABLEFIRSTUSEFLAG = true;
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-12-02 22:42:33 +00:00
|
|
|
// monitor settings
|
2020-12-04 16:30:21 +00:00
|
|
|
bool settings::MONITORENABLED = false;
|
2020-12-02 22:42:33 +00:00
|
|
|
int settings::MONITORPORT = 8003;
|
|
|
|
int settings::MONITORINTERVAL = 5000;
|
|
|
|
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
// event mode settings
|
|
|
|
int settings::EVENTMODE = 0;
|
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
void settings::init() {
|
|
|
|
INIReader reader("config.ini");
|
|
|
|
|
|
|
|
if (reader.ParseError() != 0) {
|
|
|
|
if (reader.ParseError() == -1)
|
|
|
|
std::cerr << "[WARN] Settings: missing config.ini file!" << std::endl;
|
2020-09-14 13:53:48 +00:00
|
|
|
else
|
2020-08-18 20:42:30 +00:00
|
|
|
std::cerr << "[WARN] Settings: invalid config.ini syntax at line " << reader.ParseError() << std::endl;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-14 13:53:48 +00:00
|
|
|
VERBOSITY = reader.GetInteger("", "verbosity", VERBOSITY);
|
2021-11-04 02:12:11 +00:00
|
|
|
SANDBOX = reader.GetBoolean("", "sandbox", SANDBOX);
|
2020-08-18 20:42:30 +00:00
|
|
|
LOGINPORT = reader.GetInteger("login", "port", LOGINPORT);
|
2022-06-29 21:42:44 +00:00
|
|
|
APPROVEALLNAMES = reader.GetBoolean("login", "acceptallcustomnames", APPROVEALLNAMES);
|
|
|
|
AUTOCREATEACCOUNTS = reader.GetBoolean("login", "autocreateaccounts", AUTOCREATEACCOUNTS);
|
2020-12-17 23:17:35 +00:00
|
|
|
DBSAVEINTERVAL = reader.GetInteger("login", "dbsaveinterval", DBSAVEINTERVAL);
|
2022-06-29 21:42:44 +00:00
|
|
|
SHARDPORT = reader.GetInteger("shard", "port", SHARDPORT);
|
2021-10-21 18:58:41 +00:00
|
|
|
SHARDSERVERIP = reader.Get("shard", "ip", SHARDSERVERIP);
|
|
|
|
LOCALHOSTWORKAROUND = reader.GetBoolean("shard", "localhostworkaround", LOCALHOSTWORKAROUND);
|
2020-09-16 15:45:53 +00:00
|
|
|
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
|
2020-10-14 21:15:02 +00:00
|
|
|
VIEWDISTANCE = reader.GetInteger("shard", "viewdistance", VIEWDISTANCE);
|
2020-09-22 18:53:44 +00:00
|
|
|
SIMULATEMOBS = reader.GetBoolean("shard", "simulatemobs", SIMULATEMOBS);
|
2020-08-18 20:42:30 +00:00
|
|
|
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
|
|
|
|
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
|
|
|
|
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);
|
2020-09-08 20:41:02 +00:00
|
|
|
SPAWN_ANGLE = reader.GetInteger("shard", "spawnangle", SPAWN_ANGLE);
|
2020-08-21 22:14:11 +00:00
|
|
|
NPCJSON = reader.Get("shard", "npcdata", NPCJSON);
|
2020-09-09 17:06:22 +00:00
|
|
|
XDTJSON = reader.Get("shard", "xdtdata", XDTJSON);
|
2020-09-07 17:54:40 +00:00
|
|
|
MOBJSON = reader.Get("shard", "mobdata", MOBJSON);
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
DROPSJSON = reader.Get("shard", "dropdata", DROPSJSON);
|
2020-10-24 19:48:55 +00:00
|
|
|
EGGSJSON = reader.Get("shard", "eggdata", EGGSJSON);
|
2020-09-17 02:27:21 +00:00
|
|
|
PATHJSON = reader.Get("shard", "pathdata", PATHJSON);
|
2020-10-06 19:53:21 +00:00
|
|
|
GRUNTWORKJSON = reader.Get("shard", "gruntwork", GRUNTWORKJSON);
|
2020-08-21 22:14:11 +00:00
|
|
|
MOTDSTRING = reader.Get("shard", "motd", MOTDSTRING);
|
2020-11-28 23:31:00 +00:00
|
|
|
DBPATH = reader.Get("shard", "dbpath", DBPATH);
|
2021-05-02 00:49:54 +00:00
|
|
|
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
|
|
|
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
2021-05-07 19:29:18 +00:00
|
|
|
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
2020-09-22 18:53:44 +00:00
|
|
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future
* Mobs now drop correct crates
* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates. Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.
* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable
* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-10 17:18:47 +00:00
|
|
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
2020-12-13 14:59:56 +00:00
|
|
|
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
2022-11-26 18:36:10 +00:00
|
|
|
ANTICHEAT = reader.GetBoolean("shard", "anticheat", ANTICHEAT);
|
2020-12-04 16:30:21 +00:00
|
|
|
MONITORENABLED = reader.GetBoolean("monitor", "enabled", MONITORENABLED);
|
2020-12-02 22:42:33 +00:00
|
|
|
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
2020-12-07 20:10:19 +00:00
|
|
|
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
2020-08-19 17:22:54 +00:00
|
|
|
}
|