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 |
|
215 |
void DbManager::unloadDb() |
107 |
|
|
{ |
108 |
|
215 |
CharDB::unload(); |
109 |
|
215 |
GroupDb::unload(); |
110 |
|
215 |
StatDb::unload(); |
111 |
|
215 |
DeadDB::unload(); |
112 |
|
215 |
ColorDB::unload(); |
113 |
|
215 |
SoundDB::unload(); |
114 |
|
215 |
LanguageDb::unload(); |
115 |
|
215 |
TextDb::unload(); |
116 |
|
215 |
EmoteDB::unload(); |
117 |
|
215 |
ItemDB::unload(); |
118 |
|
215 |
ItemOptionDb::unload(); |
119 |
|
215 |
ItemFieldDb::unload(); |
120 |
|
215 |
const ServerTypeT type = Net::getNetworkType(); |
121 |
✗✓ |
215 |
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 |
|
215 |
MonsterDB::unload(); |
133 |
|
215 |
NPCDB::unload(); |
134 |
|
215 |
NpcDialogDB::unload(); |
135 |
|
215 |
AvatarDB::unload(); |
136 |
|
215 |
BadgesDB::unload(); |
137 |
|
215 |
WeaponsDB::unload(); |
138 |
|
215 |
UnitsDb::unload(); |
139 |
|
215 |
PaletteDB::unload(); |
140 |
|
215 |
PETDB::unload(); |
141 |
|
215 |
StatusEffectDB::unload(); |
142 |
|
215 |
ModDB::unload(); |
143 |
|
217 |
} |