1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2017-2019 The ManaPlus Developers |
4 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
5 |
|
|
* |
6 |
|
|
* This file is part of The ManaPlus Client. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#include "resources/dbmanager.h" |
23 |
|
|
|
24 |
|
|
#include "being/being.h" |
25 |
|
|
|
26 |
|
|
#include "net/loginhandler.h" |
27 |
|
|
#include "net/net.h" |
28 |
|
|
|
29 |
|
|
#include "resources/db/avatardb.h" |
30 |
|
|
#include "resources/db/badgesdb.h" |
31 |
|
|
#include "resources/db/chardb.h" |
32 |
|
|
#include "resources/db/clandb.h" |
33 |
|
|
#include "resources/db/colordb.h" |
34 |
|
|
#include "resources/db/deaddb.h" |
35 |
|
|
#include "resources/db/elementaldb.h" |
36 |
|
|
#include "resources/db/emotedb.h" |
37 |
|
|
#include "resources/db/groupdb.h" |
38 |
|
|
#include "resources/db/homunculusdb.h" |
39 |
|
|
#include "resources/db/horsedb.h" |
40 |
|
|
#include "resources/db/itemdb.h" |
41 |
|
|
#include "resources/db/itemfielddb.h" |
42 |
|
|
#include "resources/db/itemoptiondb.h" |
43 |
|
|
#include "resources/db/languagedb.h" |
44 |
|
|
#include "resources/db/sounddb.h" |
45 |
|
|
#include "resources/db/mapdb.h" |
46 |
|
|
#include "resources/db/mercenarydb.h" |
47 |
|
|
#include "resources/db/moddb.h" |
48 |
|
|
#include "resources/db/monsterdb.h" |
49 |
|
|
#include "resources/db/networkdb.h" |
50 |
|
|
#include "resources/db/npcdb.h" |
51 |
|
|
#include "resources/db/npcdialogdb.h" |
52 |
|
|
#include "resources/db/palettedb.h" |
53 |
|
|
#include "resources/db/petdb.h" |
54 |
|
|
#include "resources/db/skillunitdb.h" |
55 |
|
|
#include "resources/db/statdb.h" |
56 |
|
|
#include "resources/db/statuseffectdb.h" |
57 |
|
|
#include "resources/db/textdb.h" |
58 |
|
|
#include "resources/db/unitsdb.h" |
59 |
|
|
#include "resources/db/weaponsdb.h" |
60 |
|
|
|
61 |
|
|
#include "debug.h" |
62 |
|
|
|
63 |
|
|
void DbManager::loadDb() |
64 |
|
|
{ |
65 |
|
|
CharDB::load(); |
66 |
|
|
GroupDb::load(); |
67 |
|
|
StatDb::load(); |
68 |
|
|
DeadDB::load(); |
69 |
|
|
PaletteDB::load(); |
70 |
|
|
ColorDB::load(); |
71 |
|
|
SoundDB::load(); |
72 |
|
|
LanguageDb::load(); |
73 |
|
|
TextDb::load(); |
74 |
|
|
MapDB::load(); |
75 |
|
|
ItemFieldDb::load(); |
76 |
|
|
ItemOptionDb::load(); |
77 |
|
|
ItemDB::load(); |
78 |
|
|
Being::load(); |
79 |
|
|
const ServerTypeT type = Net::getNetworkType(); |
80 |
|
|
if (type == ServerType::EATHENA || |
81 |
|
|
type == ServerType::EVOL2) |
82 |
|
|
{ |
83 |
|
|
NetworkDb::load(); |
84 |
|
|
if (loginHandler != nullptr) |
85 |
|
|
loginHandler->updatePacketVersion(); |
86 |
|
|
MercenaryDB::load(); |
87 |
|
|
HomunculusDB::load(); |
88 |
|
|
ElementalDb::load(); |
89 |
|
|
SkillUnitDb::load(); |
90 |
|
|
HorseDB::load(); |
91 |
|
|
ClanDb::load(); |
92 |
|
|
} |
93 |
|
|
MonsterDB::load(); |
94 |
|
|
AvatarDB::load(); |
95 |
|
|
BadgesDB::load(); |
96 |
|
|
WeaponsDB::load(); |
97 |
|
|
UnitsDb::load(); |
98 |
|
|
NPCDB::load(); |
99 |
|
|
NpcDialogDB::load(); |
100 |
|
|
PETDB::load(); |
101 |
|
|
EmoteDB::load(); |
102 |
|
|
// ModDB::load(); |
103 |
|
|
StatusEffectDB::load(); |
104 |
|
|
} |
105 |
|
|
|
106 |
|
204 |
void DbManager::unloadDb() |
107 |
|
|
{ |
108 |
|
204 |
CharDB::unload(); |
109 |
|
204 |
GroupDb::unload(); |
110 |
|
204 |
StatDb::unload(); |
111 |
|
204 |
DeadDB::unload(); |
112 |
|
204 |
ColorDB::unload(); |
113 |
|
204 |
SoundDB::unload(); |
114 |
|
204 |
LanguageDb::unload(); |
115 |
|
204 |
TextDb::unload(); |
116 |
|
204 |
EmoteDB::unload(); |
117 |
|
204 |
ItemDB::unload(); |
118 |
|
204 |
ItemOptionDb::unload(); |
119 |
|
204 |
ItemFieldDb::unload(); |
120 |
|
204 |
const ServerTypeT type = Net::getNetworkType(); |
121 |
✗✓ |
204 |
if (type == ServerType::EATHENA || |
122 |
|
|
type == ServerType::EVOL2) |
123 |
|
|
{ |
124 |
|
|
MercenaryDB::unload(); |
125 |
|
|
HomunculusDB::unload(); |
126 |
|
|
ClanDb::unload(); |
127 |
|
|
ElementalDb::unload(); |
128 |
|
|
SkillUnitDb::unload(); |
129 |
|
|
HorseDB::unload(); |
130 |
|
|
NetworkDb::unload(); |
131 |
|
|
} |
132 |
|
204 |
MonsterDB::unload(); |
133 |
|
204 |
NPCDB::unload(); |
134 |
|
204 |
NpcDialogDB::unload(); |
135 |
|
204 |
AvatarDB::unload(); |
136 |
|
204 |
BadgesDB::unload(); |
137 |
|
204 |
WeaponsDB::unload(); |
138 |
|
204 |
UnitsDb::unload(); |
139 |
|
204 |
PaletteDB::unload(); |
140 |
|
204 |
PETDB::unload(); |
141 |
|
204 |
StatusEffectDB::unload(); |
142 |
|
204 |
ModDB::unload(); |
143 |
|
206 |
} |