forked from jewalky/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config_new.cpp
733 lines (676 loc) · 26.7 KB
/
config_new.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#include "config_new.h"
#include "lib\utils.hpp"
#include "srvmgrdef.h"
#include "cheat_codes_new.h"
#include <fstream>
#include <algorithm>
unsigned long MAX_SKILL = 110; // Vanilla (V): 100; we use SOFTCORE values by default
unsigned long MAX_EXP_ON_SKILL = 35742360; // V: 13779612;
uint32_t ParseLogFlags(std::string string)
{
if(CheckHex(string))
{
return HexToInt(string);
}
else
{
uint32_t flags = 0;
std::vector<std::string> v = Explode(string, "|");
for(std::vector<std::string>::iterator it = v.begin(); it != v.end(); ++it)
{
std::string par = ToLower(Trim((*it)));
if(!par.length()) continue;
uint32_t flag = 0;
bool erase = false;
if(par[0] == '-')
{
erase = true;
par.erase(0, 1);
}
if(par == "camping")
flag = SVL_CAMPING;
else if(par == "buildings")
flag = SVL_BUILDINGS;
else if(par == "saves")
flag = SVL_SAVES;
else if(par == "diplomacy")
flag = SVL_DIPLOMACY;
else if(par == "all")
flag = SVL_ALL;
if(!flag) continue;
if(!erase) flags |= flag;
else flags &= ~flag;
}
return flags;
}
}
void __declspec(naked) imp_ParseConfig()
{
__asm
{
push [esp+0x04]
call ReadConfig
add esp, 4
retn
}
}
void SetCString(byte* cstring, const char* value)
{
__asm
{
push value
mov ecx, [cstring]
mov edx, 0x005DDA20
call edx
}
}
void AppendMaplist(const char* filename, uint32_t duration)
{
__asm
{
push [filename]
mov eax, 0x006D15F8
push [eax]
mov ecx, 0x006D15F0
mov edx, 0x005DAEAB
call edx
push [duration]
mov eax, 0x006D1620
push [eax]
mov ecx, 0x006D1618
mov edx, 0x005DB2FC
call edx
}
}
namespace Config
{
uint32_t ExceptionCount = 0;
std::string ChrBase = "chr";
uint32_t LogMode = SVL_ALL;
std::string LogFile = "server.log";
uint32_t ServerID = 0;
bool ServerStarted = false;
std::string CurrentMapName = "N/A";
std::string CurrentMapTitle = "N/A";
uint32_t ServerFlags = 0;
float InventoryDropProbability = 1;
float WearDropProbability = 1;
bool MapLoaded = false;
uint32_t ProtocolVersion = 7;
std::string IPAddress = "0.0.0.0";
uint16_t IPAddressP = 8001;
std::string IPAddress2 = "0.0.0.0";
uint16_t IPAddress2P = 8002;
std::string HatAddress = "127.0.0.1";
uint16_t HatAddressP = 7999;
uint32_t MaxPaletteAllowed = 16;
std::string SqlAddress = "127.0.0.1";
uint16_t SqlPort = 3306;
std::string SqlLogin = "root";
std::string SqlPassword = "";
std::string SqlDatabase = "logins";
uint32_t ServerCaps = 0;
uint32_t GameMode = 0;
bool Suspended = false;
uint32_t OriginalTime = 0;
std::vector<std::string> Includes;
std::string ControlDirectory = "ctl";
uint32_t MaxPlayers = 16;
bool ExitingCleanly = false;
double DeathExpMult = 1;
double KilledExpMult = 1;
double PKExpMult = 1;
double RespawnExpMult2 = 0.9;
MainCharacterParameters WarriorMaleMaxParameters = { 52, 50, 48, 46, 100, 100, 100, 100, 100};
MainCharacterParameters WarriorFemaleMaxParameters = { 50, 52, 46, 48, 100, 100, 100, 100, 100};
MainCharacterParameters MageMaleMaxParameters = { 48, 46, 52, 50, 100, 100, 100, 100, 100};
MainCharacterParameters MageFemaleMaxParameters = { 46, 48, 50, 52, 100, 100, 100, 100, 100};
extern uint32_t MinQuestReward = 250;
extern uint32_t MaxQuestReward = 16383000;
uint32_t QuestRollInterval = 0x78;
float mage_pvp_dmg_factor = 1;
int16_t max_pvp_dmg = 100;
float shop_potions_factor = 1;
bool server_rotate_maps = true;
// If these settings are set to true, it will forbid a player from taking several quests for the same monster, group or monster type.
bool AllowOnlyOneQuest_KillNMonsters = false;
bool AllowOnlyOneQuest_KillTheMonster = false;
bool AllowOnlyOneQuest_KillTheGroup = false;
bool AllowQuestFilters = false;
}
int32_t ReadIntegerParameter(std::string value, int32_t MinValue, int32_t MaxValue)
{
int32_t val = StrToInt(value);
if(val < MinValue) val = MinValue;
if(val > MaxValue) val = MaxValue;
return val;
}
float ReadFloatParameter(std::string value, float MinValue, float MaxValue)
{
float val = StrToFloat(value);
if(val < MinValue) val = MinValue;
if(val > MaxValue) val = MaxValue;
return val;
}
int ReadConfig(const char* filename)
{
if(!Config::Includes.size()) // root config
{
// set defaults
SetCString((byte*)(0x006D15B0), "127.0.0.1:8001"); // IPAddress
SetCString((byte*)(0x006D15B4), "127.0.0.1:8002"); // IPAddress2
SetCString((byte*)(0x006D15B8), "127.0.0.1:7999"); // HatAddress
SetCString((byte*)(0x006D15BC), "chr"); // ChrBase
}
using namespace std;
ifstream f_cfg;
f_cfg.open(filename, ios::in);
if(!f_cfg.is_open()) return -1;
string line;
int32_t lnid = 0;
std::string section = "root";
while(getline(f_cfg, line))
{
lnid++;
bool enc = false;
for(size_t i = 0; i < line.length(); i++)
{
if(line[i] == '"') enc = !enc;
if(enc) continue;
if(line[i] == '#' || line[i] == ';' ||
(line[i] == '/' && i != line.length()-1 && line[i+1] == '/'))
{
line.erase(i);
break;
}
}
line = Trim(line);
if(!line.length()) continue;
if(line[0] == '!')
{
if(line.find("!include ") == 0)
{
line.erase(0, 9);
line = Trim(line);
if(line[0] == '"')
{
line.erase(0, 1);
line.erase(line.length()-1, 1);
}
if(std::find(Config::Includes.begin(), Config::Includes.end(), line) == Config::Includes.end())
{
Config::Includes.push_back(line);
int32_t result = ReadConfig(line.c_str());
if(result == -1)
Printf("ReadConfig: file not found in \"%s\"!", line.c_str());
else if(result > 0)
Printf("ReadConfig: syntax error at \"%s\":%u!", line.c_str(), result);
}
else
{
Printf("ReadConfig: recursive inclusion detected in \"%s\":%u.", filename, lnid);
}
}
continue;
}
if(line[0] == '[')
{
line.erase(0, 1);
size_t whs = line.find_first_of(']');
if(whs == string::npos)
{
return lnid;
}
line.erase(whs);
section = ToLower(Trim(line));
if(section == "bannedips" ||
section == "bannedplayers" ||
section == "reporttowww") Printf("ReadConfig: obsolete section (%s)", section.c_str());
else if(section != "settings" &&
section != "maps" &&
section != "network" &&
section != "mysql") return lnid;
}
else
{
std::string parameter, value;
size_t whd = line.find_first_of('=');
if(whd != string::npos)
{
parameter = line;
parameter.erase(whd);
value = line;
value.erase(0, whd+1);
}
else
{
value = "";
parameter = line;
}
parameter = ToLower(Trim(parameter));
value = Trim(value);
if(value[0] == '"')
{
if(value[value.length()-1] != '"')
{
return lnid;
}
value.erase(0, 1);
value.erase(value.length()-1, 1);
}
if(section == "settings")
{
if(parameter == "chrbase")
{
if(value[value.length()-1] != '\\') value += '\\';
Config::ChrBase = value;
SetCString((byte*)(0x006D15BC), value.c_str());
}
else if(parameter == ToLower("QuestRollInterval"))
{
if(!CheckInt(value)) return lnid;
Config::QuestRollInterval = ReadIntegerParameter(value,1,0xFF);
}
else if(parameter == ToLower("MagePvpDmgFactor"))
{
if(!CheckFloat(value)) return lnid;
Config::mage_pvp_dmg_factor = ReadFloatParameter(value,0,100);
}
else if(parameter == ToLower("MaxPvpDmg"))
{
if(!CheckInt(value)) return lnid;
// value, int32_t MinValue, int32_t MaxValue
Config::max_pvp_dmg = ReadIntegerParameter(value,1,500);
}
else if(parameter == ToLower("ShopPotionsFactor"))
{
if(!CheckFloat(value)) return lnid;
Config::shop_potions_factor = ReadFloatParameter(value,0,100);
}
else if(parameter == ToLower("ServerRotateMaps"))
{
if(!CheckBool(value)) return lnid;
Config::server_rotate_maps = StrToBool(value);
}
else if(parameter == "description")
{
SetCString((byte*)(0x006D15C0), value.c_str());
}
else if(parameter == "repopdelay")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 20) val = 20;
if(val > 500) val = 500;
*(int32_t*)(0x006D15A0) = val;
}
else if(parameter == "gamespeed")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 0 || val > 8) val = 4;
*(int32_t*)(0x006D15A8) = val;
}
else if(parameter == "logfile")
{
Config::LogFile = value;
}
else if(parameter == "logmode")
{
Config::LogMode = ParseLogFlags(value);
}
else if(parameter == "serverid")
{
if(!CheckInt(value)) return lnid;
uint32_t val = StrToInt(value);
Config::ServerID = val;
*(uint32_t*)(0x006D15C4) = val;
}
else if(parameter == "sayrange")
{
if(!CheckInt(value)) return lnid;
uint32_t val = StrToInt(value);
if(val > 255 || !val) val = 255;
*(uint32_t*)(0x006D162C) = val;
}
else if(parameter == "shoutdelay")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 0) val = 0;
*(int32_t*)(0x006D1630) = val;
}
else if(parameter == "maxplayers")
{
if(!CheckInt(value)) return lnid;
uint32_t val = StrToInt(value);
if(val > 32) val = 32;
Config::MaxPlayers = val;
*(uint32_t*)(0x006D163C) = val;
}
else if(parameter == "gametype" ||
parameter == "gamemode")
{
uint32_t gmode = 0;
if(CheckInt(value))
{
uint32_t val = StrToInt(value);
if(val > 3) return lnid;
gmode = val;
}
else
{
value = ToLower(value);
if(value == "cooperative")
gmode = GAMEMODE_COOPERATIVE;
else if(value == "deathmatch")
gmode = GAMEMODE_DEATHMATCH;
else if(value == "softcore")
gmode = GAMEMODE_SOFTCORE;
else if(value == "arena")
gmode = GAMEMODE_ARENA;
else if(value == "sandbox")
gmode = GAMEMODE_SANDBOX;
else return lnid;
}
Config::GameMode = gmode;
if(gmode == GAMEMODE_SANDBOX || gmode == GAMEMODE_SOFTCORE)
*(uint32_t*)(0x006D1648) = GAMEMODE_COOPERATIVE; // для сервера это кооп
else *(uint32_t*)(0x006D1648) = gmode;
}
else if(parameter == "logintimeout")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 10) val = 10;
if(val > 300) val = 300;
*(int32_t*)(0x006D1640) = val;
}
else if(parameter == "reconnectdelay")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 1) val = 0;
*(int32_t*)(0x006D1644) = val;
}
else if(parameter == "shutdowndelay")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 1 || val > 60)
val = 5;
*(int32_t*)(0x006D1658) = val;
}
else if(parameter == "fraglimit")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 1) val = 2147483647;
*(int32_t*)(0x006D164C) = val;
}
else if(parameter == "arenatimelimit" ||
parameter == "timelimit")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 1) val = 2147483647;
*(int32_t*)(0x006D1660) = val;
}
else if(parameter == "scaledmaps")
{
if(!CheckBool(value)) return lnid;
bool bv = StrToBool(value);
if(bv) *(uint32_t*)(0x006D1654) = 1;
}
else if(parameter == "treasureprobability")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 0) val = 0;
if(val > 100) val = 100;
*(int32_t*)(0x006D1664) = val;
}
else if(parameter == "serverflags")
{
Config::ServerFlags = ParseFlags(value);
if(Config::ServerFlags & SVF_SOFTCORE)
{
MAX_SKILL = 110;
MAX_EXP_ON_SKILL = 35742360;
Config::ServerCaps |= SVC_SOFTCORE;
}
}
else if(parameter == "maxpaletteallowed")
{
int32_t val = StrToInt(value);
if(val < 0) val = 0;
Config::MaxPaletteAllowed = val;
}
else if(parameter == "deathexpmult")
{
float val = StrToFloat(value);
if(val < 0) val = 0;
if(val > 1) val = 1;
Config::DeathExpMult = val;
}
else if(parameter == "killedexpmult")
{
float val = StrToFloat(value);
if(val < 0) val = 0;
if(val > 1) val = 1;
Config::KilledExpMult = val;
}
else if(parameter == "pkexpmult")
{
float val = StrToFloat(value);
if(val < 0) val = 0;
if(val > 1) val = 1;
Config::PKExpMult = val;
}
else if(parameter == "respawnexpmult2")
{
float val = StrToFloat(value);
if(val < 0) val = 0;
if(val > 1) val = 1;
Config::RespawnExpMult2 = val;
}
else if(parameter.rfind(ToLower("CharParams."), 0) == 0){
//string.rfind is used as .startsWith()
const char delim = '.';
std::vector<std::string> out;
tokenize(parameter, delim, out);
int statValue = ReadIntegerParameter(value,1,200);
if(out.size() ==3){
std::string clazz = out[1];
std::string stat = out[2];
// Printf("Parsing '%s' '%s' '%s' = %d", parameter.c_str(), clazz.c_str(), stat.c_str(), statValue);
MainCharacterParameters *params = NULL;
if(clazz == ToLower("WarriorMale")) params = &Config::WarriorMaleMaxParameters;
else if (clazz == ToLower("WarriorFemale")) params = &Config::WarriorFemaleMaxParameters;
else if (clazz == ToLower("MageMale")) params = &Config::MageMaleMaxParameters;
else if (clazz == ToLower("MageFemale")) params = &Config::MageFemaleMaxParameters;
else {
Printf("Error while reading '%s' part of '%s' config", clazz.c_str(), parameter.c_str());
}
if(stat == ToLower("MaxBody")) params->Body = statValue;
else if (stat == ToLower("MaxReaction")) params->Reaction = statValue;
else if (stat == ToLower("MaxMind")) params->Mind = statValue;
else if (stat == ToLower("MaxSpirit")) params->Spirit = statValue;
else if (stat == ToLower("MaxResistFire")) params->ResistFire = statValue;
else if (stat == ToLower("MaxResistWater")) params->ResistWater = statValue;
else if (stat == ToLower("MaxResistAir")) params->ResistAir = statValue;
else if (stat == ToLower("MaxResistEarth")) params->ResistEarth = statValue;
else if (stat == ToLower("MaxResistAstral")) params->ResistAstral = statValue;
else {
Printf("Error while reading '%s' part of '%s' config", stat.c_str(), parameter.c_str());
}
}
}
else if(parameter == ToLower("MinQuestReward"))
{
if(!CheckInt(value)) return lnid;
Config::MinQuestReward = ReadIntegerParameter(value,250,16383000);
}
else if(parameter == ToLower("MaxQuestReward"))
{
if(!CheckInt(value)) return lnid;
Config::MaxQuestReward = ReadIntegerParameter(value,Config::MinQuestReward,16383000);
}
else if(parameter == ToLower("InventoryDropProbability"))
{
if(!CheckFloat(value)) return lnid;
Config::InventoryDropProbability = ReadFloatParameter(value,0,1);
}
else if(parameter == ToLower("WearDropProbability"))
{
if(!CheckFloat(value)) return lnid;
Config::WearDropProbability = ReadFloatParameter(value,0,1);
}
else if(parameter == ToLower("AllowOnlyOneQuest_KillNMonsters"))
{
if(!CheckBool(value)) return lnid;
Config::AllowOnlyOneQuest_KillNMonsters = StrToBool(value);
}
else if(parameter == ToLower("AllowOnlyOneQuest_KillTheMonster"))
{
if(!CheckBool(value)) return lnid;
Config::AllowOnlyOneQuest_KillTheMonster = StrToBool(value);
}
else if(parameter == ToLower("AllowOnlyOneQuest_KillTheGroup"))
{
if(!CheckBool(value)) return lnid;
Config::AllowOnlyOneQuest_KillTheGroup = StrToBool(value);
}
else if(parameter == ToLower("AllowQuestFilters"))
{
if(!CheckBool(value)) return lnid;
Config::AllowQuestFilters = StrToBool(value);
}
else if(parameter == "servercaps")
{
value = Trim(ToLower(value));
std::vector<std::string> svcap = Explode(value, "|");
uint32_t caps = 0;
for(std::vector<std::string>::iterator it = svcap.begin(); it != svcap.end(); ++it)
{
std::string& cap = (*it);
if(!cap.length()) continue;
uint32_t flag = 0;
bool erase = false;
if(cap[0] == '-')
{
erase = true;
cap.erase(0, 1);
}
if(cap == "all") flag = SVC_ALL;
else if(cap == "detailed_info") flag = SVC_DETAILED_INFO;
else if(cap == "fixed_maplist") flag = SVC_FIXED_MAPLIST;
else if(cap == "save_database") flag = SVC_SAVE_DATABASE;
if(!flag) return lnid;
if(!erase) caps |= flag;
else caps &= ~flag;
}
Config::ServerCaps &= SVC_SOFTCORE;
Config::ServerCaps |= caps & ~SVC_SOFTCORE;
}
else if(parameter == "controldirectory")
{
Config::ControlDirectory = value;
}
else if(parameter == "flagscore" ||
parameter == "protocol" ||
parameter == "ipaddress" ||
parameter == "ipaddress2" ||
parameter == "save" ||
parameter == "hataddress")
{
Printf("ReadConfig: obsolete parameter (settings/%s)", parameter.c_str());
}
}
else if(section == "network")
{
if(parameter == "protocolversion")
{
if(!CheckInt(value)) return lnid;
int32_t val = StrToInt(value);
if(val < 8) val = 8;
if(val > 20) val = 20;
Config::ProtocolVersion = val;
}
else if(parameter == "ipaddress" ||
parameter == "ipaddress2" ||
parameter == "hataddress")
{
vector<string> ipd = Explode(value, ":");
if(ipd.size() > 2) return lnid;
if(!CheckIP(ipd[0])) return lnid;
uint32_t port = 8001;
if(ipd.size() == 2)
{
if(!CheckInt(ipd[1])) return lnid;
port = StrToInt(ipd[1]);
if(port > 65535) return lnid;
}
if(parameter == "ipaddress")
{
SetCString((byte*)(0x006D15B0), value.c_str());
Config::IPAddress = ipd[0];
Config::IPAddressP = port;
}
else if(parameter == "ipaddress2")
{
SetCString((byte*)(0x006D15B4), value.c_str());
Config::IPAddress2 = ipd[0];
Config::IPAddress2P = port;
}
else
{
SetCString((byte*)(0x006D15B8), value.c_str());
Config::HatAddress = ipd[0];
Config::HatAddressP = port;
}
}
}
else if(section == "mysql")
{
if(parameter == "server")
{
vector<string> ipd = Explode(value, ":");
if(ipd.size() > 2) return lnid;
if(!CheckIP(ipd[0])) return lnid;
uint32_t port = 3306;
Config::SqlAddress = ipd[0];
Config::SqlPort = port;
}
else if(parameter == "login")
Config::SqlLogin = value;
else if(parameter == "password")
Config::SqlPassword = value;
else if(parameter == "database")
Config::SqlDatabase = value;
else return lnid;
}
else if(section == "maps")
{
std::string m_filename = parameter;
uint32_t m_time = 2147483647;
if(value.length()) m_time = (uint32_t)(StrToFloat(value) * 60.0);
AppendMaplist(m_filename.c_str(), m_time);
}
else
{
Printf("ReadConfig: unknown parameter (%s/%s)", section.c_str(), parameter.c_str());
}
}
}
if (Config::GameMode == GAMEMODE_SOFTCORE)
{
Config::ServerFlags = Config::ServerFlags & ~(SVF_SANDBOX) | SVF_SOFTCORE;
}
else if (Config::GameMode == GAMEMODE_SANDBOX)
{
Config::ServerFlags = Config::ServerFlags & ~(SVF_SOFTCORE) | SVF_SANDBOX;
}
f_cfg.close();
return 0;
}