summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-08-19 15:29:15 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-03-07 09:54:17 +0100
commit5dcba0dec84d73a02b08bde21388535a80e94c56 (patch)
treed57bd46686f2fa59ac0954bda12a421a538bb415 /src
parent6cf91666c48925be884f6e4ef96eac541b74d3b6 (diff)
downloadmana-5dcba0dec84d73a02b08bde21388535a80e94c56.tar.gz
mana-5dcba0dec84d73a02b08bde21388535a80e94c56.tar.bz2
mana-5dcba0dec84d73a02b08bde21388535a80e94c56.tar.xz
mana-5dcba0dec84d73a02b08bde21388535a80e94c56.zip
Renamed specials to abilities
To match mana/manaserv@9ff69160ea1c3c64ea7012cd70a3b50ff4373264.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt18
-rw-r--r--src/game.cpp8
-rw-r--r--src/gui/abilitieswindow.cpp (renamed from src/gui/specialswindow.cpp)86
-rw-r--r--src/gui/abilitieswindow.h (renamed from src/gui/specialswindow.h)19
-rw-r--r--src/gui/windowmenu.cpp10
-rw-r--r--src/net/abilityhandler.h (renamed from src/net/specialhandler.h)4
-rw-r--r--src/net/manaserv/abilityhandler.cpp (renamed from src/net/manaserv/specialhandler.cpp)24
-rw-r--r--src/net/manaserv/abilityhandler.h (renamed from src/net/manaserv/specialhandler.h)6
-rw-r--r--src/net/manaserv/generalhandler.cpp4
-rw-r--r--src/net/manaserv/generalhandler.h2
-rw-r--r--src/net/manaserv/manaserv_protocol.h8
-rw-r--r--src/net/manaserv/playerhandler.cpp10
-rw-r--r--src/net/net.cpp8
-rw-r--r--src/net/net.h4
-rw-r--r--src/net/tmwa/abilityhandler.cpp (renamed from src/net/tmwa/specialhandler.cpp)18
-rw-r--r--src/net/tmwa/abilityhandler.h (renamed from src/net/tmwa/specialhandler.h)6
-rw-r--r--src/net/tmwa/generalhandler.cpp6
-rw-r--r--src/net/tmwa/generalhandler.h2
-rw-r--r--src/playerinfo.cpp36
-rw-r--r--src/playerinfo.h20
-rw-r--r--src/resources/abilitydb.cpp (renamed from src/resources/specialdb.cpp)54
-rw-r--r--src/resources/abilitydb.h (renamed from src/resources/specialdb.h)22
-rw-r--r--src/resources/settingsmanager.cpp21
-rw-r--r--src/resources/spritedef.h4
24 files changed, 195 insertions, 205 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b7cfe091..23505dcd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -266,8 +266,8 @@ set(SRCS
gui/socialwindow.h
gui/speechbubble.cpp
gui/speechbubble.h
- gui/specialswindow.cpp
- gui/specialswindow.h
+ gui/abilitieswindow.cpp
+ gui/abilitieswindow.h
gui/statuswindow.cpp
gui/statuswindow.h
gui/textdialog.cpp
@@ -307,7 +307,7 @@ set(SRCS
net/partyhandler.h
net/playerhandler.h
net/serverinfo.h
- net/specialhandler.h
+ net/abilityhandler.h
net/tradehandler.h
net/worldinfo.h
resources/action.cpp
@@ -354,8 +354,8 @@ set(SRCS
resources/settingsmanager.h
resources/soundeffect.h
resources/soundeffect.cpp
- resources/specialdb.cpp
- resources/specialdb.h
+ resources/abilitydb.cpp
+ resources/abilitydb.h
resources/spritedef.h
resources/spritedef.cpp
resources/statuseffectdb.cpp
@@ -547,8 +547,8 @@ set(SRCS_TMWA
net/tmwa/playerhandler.cpp
net/tmwa/playerhandler.h
net/tmwa/protocol.h
- net/tmwa/specialhandler.cpp
- net/tmwa/specialhandler.h
+ net/tmwa/abilityhandler.cpp
+ net/tmwa/abilityhandler.h
net/tmwa/token.h
net/tmwa/tradehandler.cpp
net/tmwa/tradehandler.h)
@@ -598,8 +598,8 @@ set(SRCS_MANA
net/manaserv/playerhandler.cpp
net/manaserv/playerhandler.h
net/manaserv/manaserv_protocol.h
- net/manaserv/specialhandler.cpp
- net/manaserv/specialhandler.h
+ net/manaserv/abilityhandler.cpp
+ net/manaserv/abilityhandler.h
net/manaserv/tradehandler.cpp
net/manaserv/tradehandler.h)
diff --git a/src/game.cpp b/src/game.cpp
index 0607bcc2..9657bee7 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -57,7 +57,7 @@
#include "gui/sdlinput.h"
#include "gui/setup.h"
#include "gui/socialwindow.h"
-#include "gui/specialswindow.h"
+#include "gui/abilitieswindow.h"
#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
#include "gui/textdialog.h"
@@ -104,7 +104,7 @@ DebugWindow *debugWindow;
ShortcutWindow *itemShortcutWindow;
ShortcutWindow *emoteShortcutWindow;
OutfitWindow *outfitWindow;
-SpecialsWindow *specialsWindow;
+AbilitiesWindow *abilitiesWindow;
SocialWindow *socialWindow;
ActorSpriteManager *actorSpriteManager;
@@ -159,7 +159,7 @@ static void createGuiWindows()
emoteShortcutWindow = new ShortcutWindow("EmoteShortcut",
new EmoteShortcutContainer);
outfitWindow = new OutfitWindow();
- specialsWindow = new SpecialsWindow();
+ abilitiesWindow = new AbilitiesWindow();
socialWindow = new SocialWindow();
localChatTab = new ChatTab(_("General"));
@@ -192,7 +192,7 @@ static void destroyGuiWindows()
del_0(itemShortcutWindow)
del_0(emoteShortcutWindow)
del_0(outfitWindow)
- del_0(specialsWindow)
+ del_0(abilitiesWindow)
del_0(socialWindow)
Event::trigger(Event::NpcChannel, Event::CloseAll); // Cleanup remaining NPC dialogs
diff --git a/src/gui/specialswindow.cpp b/src/gui/abilitieswindow.cpp
index 340a1e41..c6aefb32 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/abilitieswindow.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "gui/specialswindow.h"
+#include "gui/abilitieswindow.h"
#include "log.h"
@@ -32,9 +32,9 @@
#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
-#include "net/specialhandler.h"
+#include "net/abilityhandler.h"
-#include "resources/specialdb.h"
+#include "resources/abilitydb.h"
#include "resources/theme.h"
#include "utils/dtor.h"
@@ -44,19 +44,19 @@
#include <string>
-#define SPECIALS_WIDTH 200
-#define SPECIALS_HEIGHT 32
+#define ABILITIES_WIDTH 200
+#define ABILITIES_HEIGHT 32
-class SpecialEntry : public Container
+class AbilityEntry : public Container
{
public:
- SpecialEntry(SpecialInfo *info);
+ AbilityEntry(AbilityInfo *info);
void update(int current, int needed);
protected:
- friend class SpecialsWindow;
- SpecialInfo *mInfo;
+ friend class AbilitiesWindow;
+ AbilityInfo *mInfo;
private:
Icon *mIcon = nullptr; // icon to display
@@ -65,46 +65,46 @@ class SpecialEntry : public Container
ProgressBar *mRechargeBar = nullptr; // recharge bar (only shown when applicable)
};
-SpecialsWindow::SpecialsWindow():
- Window(_("Specials"))
+AbilitiesWindow::AbilitiesWindow():
+ Window(_("Abilities"))
{
- setWindowName("Specials");
+ setWindowName("Abilities");
setCloseButton(true);
setResizable(true);
setSaveVisible(true);
- setDefaultSize(windowContainer->getWidth() - 280, 40, SPECIALS_WIDTH + 20, 225);
+ setDefaultSize(windowContainer->getWidth() - 280, 40, ABILITIES_WIDTH + 20, 225);
setupWindow->registerWindowForReset(this);
center();
loadWindowState();
}
-SpecialsWindow::~SpecialsWindow()
+AbilitiesWindow::~AbilitiesWindow()
{
// Clear gui
}
-void SpecialsWindow::action(const gcn::ActionEvent &event)
+void AbilitiesWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "use")
{
- auto *disp = dynamic_cast<SpecialEntry*>(event.getSource()->getParent());
+ auto *disp = dynamic_cast<AbilityEntry*>(event.getSource()->getParent());
if (disp)
{
- if (disp->mInfo->targetMode == SpecialInfo::TARGET_BEING)
+ if (disp->mInfo->targetMode == AbilityInfo::TARGET_BEING)
{
Being *target = local_player->getTarget();
if (target)
- Net::getSpecialHandler()->use(disp->mInfo->id, 1, target->getId());
+ Net::getAbilityHandler()->use(disp->mInfo->id, 1, target->getId());
else
- Net::getSpecialHandler()->use(disp->mInfo->id);
+ Net::getAbilityHandler()->use(disp->mInfo->id);
}
else
{
// TODO: Allow the player to aim at a position on the map and
- // Use special on the map position.
+ // Use abilities on the map position.
}
}
}
@@ -114,68 +114,68 @@ void SpecialsWindow::action(const gcn::ActionEvent &event)
}
}
-void SpecialsWindow::draw(gcn::Graphics *graphics)
+void AbilitiesWindow::draw(gcn::Graphics *graphics)
{
// update the progress bars
- std::map<int, Special> specialData = PlayerInfo::getSpecialStatus();
+ const std::map<int, Ability> &abilityData = PlayerInfo::getAbilityStatus();
bool foundNew = false;
- unsigned int found = 0; // number of entries in specialData which match mEntries
+ unsigned int found = 0; // number of entries in abilityData which match mEntries
- for (auto &special : specialData)
+ for (auto &[id, ability] : abilityData)
{
- auto e = mEntries.find(special.first);
+ auto e = mEntries.find(id);
if (e == mEntries.end())
{
- // found a new special - abort update and rebuild from scratch
+ // found a new ability - abort update and rebuild from scratch
foundNew = true;
break;
}
- // update progress bar of special
- e->second->update(special.second.currentMana, special.second.neededMana);
+ // update progress bar of ability
+ e->second->update(ability.currentMana, ability.neededMana);
found++;
}
- // a rebuild is needed when a) the number of specials changed or b) an existing entry isn't found anymore
+ // a rebuild is needed when a) the number of abilities changed or b) an existing entry isn't found anymore
if (foundNew || found != mEntries.size())
- rebuild(specialData);
+ rebuild(abilityData);
Window::draw(graphics);
}
-void SpecialsWindow::rebuild(const std::map<int, Special> &specialData)
+void AbilitiesWindow::rebuild(const std::map<int, Ability> &abilityData)
{
delete_all(mEntries);
mEntries.clear();
int vPos = 0; //vertical position of next placed element
- for (auto special : specialData)
+ for (auto &[id, ability] : abilityData)
{
- logger->log("Updating special GUI for %d", special.first);
+ logger->log("Updating ability GUI for %d", id);
- SpecialInfo *info = SpecialDB::get(special.first);
+ AbilityInfo *info = AbilityDB::get(id);
if (info)
{
- info->rechargeCurrent = special.second.currentMana;
- info->rechargeNeeded = special.second.neededMana;
- auto* entry = new SpecialEntry(info);
+ info->rechargeCurrent = ability.currentMana;
+ info->rechargeNeeded = ability.neededMana;
+ auto *entry = new AbilityEntry(info);
entry->setPosition(0, vPos);
vPos += entry->getHeight() + 3;
add(entry);
- mEntries[special.first] = entry;
+ mEntries[id] = entry;
}
else
{
- logger->log("Warning: No info available of special %d", special.first);
+ logger->log("Warning: No info available of ability %d", id);
}
}
}
-SpecialEntry::SpecialEntry(SpecialInfo *info) :
+AbilityEntry::AbilityEntry(AbilityInfo *info) :
mInfo(info)
{
- setSize(SPECIALS_WIDTH, SPECIALS_HEIGHT);
+ setSize(ABILITIES_WIDTH, ABILITIES_HEIGHT);
if (!info->icon.empty())
mIcon = new Icon(info->icon);
@@ -189,7 +189,7 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
mNameLabel->setPosition(35, 0);
add(mNameLabel);
- mUse = new Button("Use", "use", specialsWindow);
+ mUse = new Button("Use", "use", abilitiesWindow);
mUse->setPosition(getWidth() - mUse->getWidth(), 5);
add(mUse);
@@ -203,7 +203,7 @@ SpecialEntry::SpecialEntry(SpecialInfo *info) :
}
}
-void SpecialEntry::update(int current, int needed)
+void AbilityEntry::update(int current, int needed)
{
if (mRechargeBar)
{
diff --git a/src/gui/specialswindow.h b/src/gui/abilitieswindow.h
index fd2bb120..aa84ed79 100644
--- a/src/gui/specialswindow.h
+++ b/src/gui/abilitieswindow.h
@@ -28,14 +28,14 @@
#include <map>
-class SpecialEntry;
+class AbilityEntry;
-class SpecialsWindow : public Window, public gcn::ActionListener
+class AbilitiesWindow : public Window, public gcn::ActionListener
{
public:
- SpecialsWindow();
+ AbilitiesWindow();
- ~SpecialsWindow() override;
+ ~AbilitiesWindow() override;
/**
* Called when receiving actions from widget.
@@ -44,14 +44,15 @@ class SpecialsWindow : public Window, public gcn::ActionListener
void draw(gcn::Graphics *graphics) override;
- bool hasSpecials() const
+ bool hasAbilities() const
{ return !mEntries.empty(); }
private:
- // (re)constructs the list of specials
- void rebuild(const std::map<int, Special> &specialData);
+ // (re)constructs the list of abilities
+ void rebuild(const std::map<int, Ability> &abilityData);
- std::map<int, SpecialEntry *> mEntries;
+ std::map<int, AbilityEntry *> mEntries;
};
-extern SpecialsWindow *specialsWindow;
+extern AbilitiesWindow *abilitiesWindow;
+
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index c6e52ee7..0b2d126f 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -25,7 +25,7 @@
#include "gui/emotepopup.h"
#include "gui/skilldialog.h"
-#include "gui/specialswindow.h"
+#include "gui/abilitieswindow.h"
#include "gui/widgets/button.h"
#include "gui/widgets/window.h"
@@ -61,8 +61,8 @@ WindowMenu::WindowMenu()
addButton(N_("Skills"), x, h, "button-icon-skills.png",
KeyboardConfig::KEY_WINDOW_SKILL);
- if (specialsWindow->hasSpecials())
- addButton(N_("Specials"), x, h, "button-icon-specials.png");
+ if (abilitiesWindow->hasAbilities())
+ addButton(N_("Abilities"), x, h, "button-icon-abilities.png");
addButton(N_("Social"), x, h, "button-icon-social.png",
KeyboardConfig::KEY_WINDOW_SOCIAL);
@@ -122,9 +122,9 @@ void WindowMenu::action(const gcn::ActionEvent &event)
{
window = skillDialog;
}
- else if (event.getId() == "Specials")
+ else if (event.getId() == "Abilities")
{
- window = specialsWindow;
+ window = abilitiesWindow;
}
else if (event.getId() == "Social")
{
diff --git a/src/net/specialhandler.h b/src/net/abilityhandler.h
index df09087d..6e3526bb 100644
--- a/src/net/specialhandler.h
+++ b/src/net/abilityhandler.h
@@ -25,10 +25,10 @@
namespace Net {
-class SpecialHandler
+class AbilityHandler
{
public:
- virtual ~SpecialHandler () {}
+ virtual ~AbilityHandler () {}
virtual void use(int id) = 0;
diff --git a/src/net/manaserv/specialhandler.cpp b/src/net/manaserv/abilityhandler.cpp
index 0a477ff8..b5ce9d2e 100644
--- a/src/net/manaserv/specialhandler.cpp
+++ b/src/net/manaserv/abilityhandler.cpp
@@ -19,55 +19,55 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "net/manaserv/specialhandler.h"
+#include "net/manaserv/abilityhandler.h"
#include "net/manaserv/connection.h"
#include "net/manaserv/messagein.h"
#include "net/manaserv/messageout.h"
#include "net/manaserv/manaserv_protocol.h"
-extern Net::SpecialHandler *specialHandler;
+extern Net::AbilityHandler *abilityHandler;
namespace ManaServ {
extern Connection *gameServerConnection;
-SpecialHandler::SpecialHandler()
+AbilityHandler::AbilityHandler()
{
- specialHandler = this;
+ abilityHandler = this;
}
-void SpecialHandler::handleMessage(MessageIn &msg)
+void AbilityHandler::handleMessage(MessageIn &msg)
{
// TODO
}
-void SpecialHandler::use(int id)
+void AbilityHandler::use(int id)
{
- MessageOut msg(PGMSG_USE_SPECIAL_ON_BEING);
+ MessageOut msg(PGMSG_USE_ABILITY_ON_BEING);
msg.writeInt8(id);
msg.writeInt16(0);
gameServerConnection->send(msg);
}
-void SpecialHandler::use(int id, int level, int beingId)
+void AbilityHandler::use(int id, int level, int beingId)
{
- MessageOut msg(PGMSG_USE_SPECIAL_ON_BEING);
+ MessageOut msg(PGMSG_USE_ABILITY_ON_BEING);
msg.writeInt8(id);
msg.writeInt16(beingId);
gameServerConnection->send(msg);
}
-void SpecialHandler::use(int id, int level, int x, int y)
+void AbilityHandler::use(int id, int level, int x, int y)
{
- MessageOut msg(PGMSG_USE_SPECIAL_ON_POINT);
+ MessageOut msg(PGMSG_USE_ABILITY_ON_POINT);
msg.writeInt8(id);
msg.writeInt16(x);
msg.writeInt16(y);
gameServerConnection->send(msg);
}
-void SpecialHandler::use(int id, const std::string &map)
+void AbilityHandler::use(int id, const std::string &map)
{
// TODO
}
diff --git a/src/net/manaserv/specialhandler.h b/src/net/manaserv/abilityhandler.h
index 45793b62..69ab9c2b 100644
--- a/src/net/manaserv/specialhandler.h
+++ b/src/net/manaserv/abilityhandler.h
@@ -21,16 +21,16 @@
#pragma once
-#include "net/specialhandler.h"
+#include "net/abilityhandler.h"
#include "net/manaserv/messagehandler.h"
namespace ManaServ {
-class SpecialHandler final : public MessageHandler, public Net::SpecialHandler
+class AbilityHandler final : public MessageHandler, public Net::AbilityHandler
{
public:
- SpecialHandler();
+ AbilityHandler();
void handleMessage(MessageIn &msg) override;
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index 0692ee82..1e443c66 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -42,7 +42,7 @@
#include "net/manaserv/npchandler.h"
#include "net/manaserv/partyhandler.h"
#include "net/manaserv/playerhandler.h"
-#include "net/manaserv/specialhandler.h"
+#include "net/manaserv/abilityhandler.h"
#include "net/manaserv/tradehandler.h"
#include "resources/attributes.h"
@@ -76,7 +76,7 @@ GeneralHandler::GeneralHandler():
mPartyHandler(new PartyHandler),
mPlayerHandler(new PlayerHandler),
mTradeHandler(new TradeHandler),
- mSpecialHandler(new SpecialHandler)
+ mAbilityHandler(new AbilityHandler)
{
initialize();
diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h
index b9eb9df0..865bbd0d 100644
--- a/src/net/manaserv/generalhandler.h
+++ b/src/net/manaserv/generalhandler.h
@@ -63,7 +63,7 @@ class GeneralHandler : public Net::GeneralHandler, public EventListener
MessageHandlerPtr mPartyHandler;
MessageHandlerPtr mPlayerHandler;
MessageHandlerPtr mTradeHandler;
- MessageHandlerPtr mSpecialHandler;
+ MessageHandlerPtr mAbilityHandler;
};
} // namespace ManaServ
diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h
index b30bf20b..01632215 100644
--- a/src/net/manaserv/manaserv_protocol.h
+++ b/src/net/manaserv/manaserv_protocol.h
@@ -25,7 +25,7 @@ namespace ManaServ {
enum {
PROTOCOL_VERSION = 3,
- SUPPORTED_DB_VERSION = 21
+ SUPPORTED_DB_VERSION = 22
};
/**
@@ -138,9 +138,9 @@ enum {
GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }*
PGMSG_ATTACK = 0x0290, // W being id
GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction, B attack Id
- PGMSG_USE_SPECIAL_ON_BEING = 0x0292, // B specialID, W being id
- GPMSG_SPECIAL_STATUS = 0x0293, // { B specialID, D current, D max, D recharge }
- PGMSG_USE_SPECIAL_ON_POINT = 0x0294, // B specialID, W*2 position
+ PGMSG_USE_ABILITY_ON_BEING = 0x0292, // B abilityID, W being id
+ GPMSG_ABILITY_STATUS = 0x0293, // { B abilityID, D current, D max, D recharge }
+ PGMSG_USE_ABILITY_ON_POINT = 0x0294, // B abilityID, W*2 position
PGMSG_SAY = 0x02A0, // S text
GPMSG_SAY = 0x02A1, // W being id, S text
GPMSG_NPC_CHOICE = 0x02B0, // W being id, { S text }*
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index bf5694c6..335546be 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -75,7 +75,7 @@ PlayerHandler::PlayerHandler()
GPMSG_LEVEL_PROGRESS,
GPMSG_RAISE_ATTRIBUTE_RESPONSE,
GPMSG_LOWER_ATTRIBUTE_RESPONSE,
- GPMSG_SPECIAL_STATUS,
+ GPMSG_ABILITY_STATUS,
0
};
handledMessages = _messages;
@@ -243,17 +243,17 @@ void PlayerHandler::handleMessage(MessageIn &msg)
} break;
- case GPMSG_SPECIAL_STATUS :
+ case GPMSG_ABILITY_STATUS:
{
- PlayerInfo::clearSpecialStatus();
+ PlayerInfo::clearAbilityStatus();
while (msg.getUnreadLength())
{
- // { B specialID, L current, L max, L recharge }
+ // { B abilityID, L current, L max, L recharge }
int id = msg.readInt8();
int current = msg.readInt32();
int max = msg.readInt32();
int recharge = msg.readInt32();
- PlayerInfo::setSpecialStatus(id, current, max, recharge);
+ PlayerInfo::setAbilityStatus(id, current, max, recharge);
}
} break;
/*
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 3a389db2..93003280 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -34,7 +34,7 @@
#include "net/npchandler.h"
#include "net/partyhandler.h"
#include "net/playerhandler.h"
-#include "net/specialhandler.h"
+#include "net/abilityhandler.h"
#include "net/tradehandler.h"
#include "net/tmwa/generalhandler.h"
@@ -54,7 +54,7 @@ Net::GuildHandler *guildHandler = nullptr;
Net::NpcHandler *npcHandler = nullptr;
Net::PartyHandler *partyHandler = nullptr;
Net::PlayerHandler *playerHandler = nullptr;
-Net::SpecialHandler *specialHandler = nullptr;
+Net::AbilityHandler *abilityHandler = nullptr;
Net::TradeHandler *tradeHandler = nullptr;
Net::AdminHandler *Net::getAdminHandler()
@@ -112,9 +112,9 @@ Net::PlayerHandler *Net::getPlayerHandler()
return playerHandler;
}
-Net::SpecialHandler *Net::getSpecialHandler()
+Net::AbilityHandler *Net::getAbilityHandler()
{
- return specialHandler;
+ return abilityHandler;
}
Net::TradeHandler *Net::getTradeHandler()
diff --git a/src/net/net.h b/src/net/net.h
index 216c2048..ced0f7ba 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -44,7 +44,7 @@ class LoginHandler;
class NpcHandler;
class PartyHandler;
class PlayerHandler;
-class SpecialHandler;
+class AbilityHandler;
class TradeHandler;
AdminHandler *getAdminHandler();
@@ -58,7 +58,7 @@ LoginHandler *getLoginHandler();
NpcHandler *getNpcHandler();
PartyHandler *getPartyHandler();
PlayerHandler *getPlayerHandler();
-SpecialHandler *getSpecialHandler();
+AbilityHandler *getAbilityHandler();
TradeHandler *getTradeHandler();
ServerType getNetworkType();
diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/abilityhandler.cpp
index 2e22b00a..e221039c 100644
--- a/src/net/tmwa/specialhandler.cpp
+++ b/src/net/tmwa/abilityhandler.cpp
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "net/tmwa/specialhandler.h"
+#include "net/tmwa/abilityhandler.h"
#include "event.h"
#include "log.h"
@@ -64,11 +64,11 @@
/** should always be zero if failed */
#define SKILL_FAILED 0x00
-extern Net::SpecialHandler *specialHandler;
+extern Net::AbilityHandler *abilityHandler;
namespace TmwAthena {
-SpecialHandler::SpecialHandler()
+AbilityHandler::AbilityHandler()
{
static const Uint16 _messages[] = {
SMSG_PLAYER_SKILLS,
@@ -77,10 +77,10 @@ SpecialHandler::SpecialHandler()
0
};
handledMessages = _messages;
- specialHandler = this;
+ abilityHandler = this;
}
-void SpecialHandler::handleMessage(MessageIn &msg)
+void AbilityHandler::handleMessage(MessageIn &msg)
{
int skillCount;
int skillId;
@@ -219,19 +219,19 @@ void SpecialHandler::handleMessage(MessageIn &msg)
}
}
-void SpecialHandler::use(int id)
+void AbilityHandler::use(int id)
{
}
-void SpecialHandler::use(int id, int level, int beingId)
+void AbilityHandler::use(int id, int level, int beingId)
{
}
-void SpecialHandler::use(int id, int level, int x, int y)
+void AbilityHandler::use(int id, int level, int x, int y)
{
}
-void SpecialHandler::use(int id, const std::string &map)
+void AbilityHandler::use(int id, const std::string &map)
{
}
diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/abilityhandler.h
index 2448b7e0..822ed737 100644
--- a/src/net/tmwa/specialhandler.h
+++ b/src/net/tmwa/abilityhandler.h
@@ -22,16 +22,16 @@
#pragma once
#include "net/net.h"
-#include "net/specialhandler.h"
+#include "net/abilityhandler.h"
#include "net/tmwa/messagehandler.h"
namespace TmwAthena {
-class SpecialHandler final : public MessageHandler, public Net::SpecialHandler
+class AbilityHandler final : public MessageHandler, public Net::AbilityHandler
{
public:
- SpecialHandler();
+ AbilityHandler();
void handleMessage(MessageIn &msg) override;
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index e1b1a9ea..2a8afb4e 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -49,7 +49,7 @@
#include "net/tmwa/playerhandler.h"
#include "net/tmwa/protocol.h"
#include "net/tmwa/tradehandler.h"
-#include "net/tmwa/specialhandler.h"
+#include "net/tmwa/abilityhandler.h"
#include "net/tmwa/gui/guildtab.h"
#include "net/tmwa/gui/partytab.h"
@@ -84,7 +84,7 @@ GeneralHandler::GeneralHandler():
mNpcHandler(new NpcHandler),
mPartyHandler(new PartyHandler),
mPlayerHandler(new PlayerHandler),
- mSpecialHandler(new SpecialHandler),
+ mAbilityHandler(new AbilityHandler),
mTradeHandler(new TradeHandler)
{
static const Uint16 _messages[] = {
@@ -169,7 +169,7 @@ void GeneralHandler::load()
mNetwork->registerHandler(mLoginHandler.get());
mNetwork->registerHandler(mNpcHandler.get());
mNetwork->registerHandler(mPlayerHandler.get());
- mNetwork->registerHandler(mSpecialHandler.get());
+ mNetwork->registerHandler(mAbilityHandler.get());
mNetwork->registerHandler(mTradeHandler.get());
mNetwork->registerHandler(mPartyHandler.get());
}
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index 26c6fe27..529c1661 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -66,7 +66,7 @@ class GeneralHandler final : public MessageHandler, public Net::GeneralHandler,
MessageHandlerPtr mNpcHandler;
MessageHandlerPtr mPartyHandler;
MessageHandlerPtr mPlayerHandler;
- MessageHandlerPtr mSpecialHandler;
+ MessageHandlerPtr mAbilityHandler;
MessageHandlerPtr mTradeHandler;
};
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index aacff3a1..6eaa20b7 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -50,8 +50,8 @@ static bool mNPCPostCount = false;
static BuySellState mBuySellState = BUYSELL_NONE;
-static std::map<int, Special> mSpecials;
-static Timer mSpecialRechargeUpdateTimer;
+static std::map<int, Ability> mAbilities;
+static Timer mAbilityRechargeUpdateTimer;
// --- Triggers ---------------------------------------------------------------
@@ -278,25 +278,25 @@ void setBuySellState(BuySellState buySellState)
}
}
-// --- Specials ---------------------------------------------------------------
+// --- Abilities --------------------------------------------------------------
-void clearSpecialStatus()
+void clearAbilityStatus()
{
- mSpecials.clear();
+ mAbilities.clear();
}
-void setSpecialStatus(int id, int current, int max, int recharge)
+void setAbilityStatus(int id, int current, int max, int recharge)
{
- logger->log("SpecialUpdate Skill #%d -- (%d/%d) -> %d", id, current, max,
+ logger->log("AbilityUpdate Skill #%d -- (%d/%d) -> %d", id, current, max,
recharge);
- mSpecials[id].currentMana = current;
- mSpecials[id].neededMana = max;
- mSpecials[id].recharge = recharge;
+ mAbilities[id].currentMana = current;
+ mAbilities[id].neededMana = max;
+ mAbilities[id].recharge = recharge;
}
-const SpecialsMap &getSpecialStatus()
+const std::map<int, Ability> &getAbilityStatus()
{
- return mSpecials;
+ return mAbilities;
}
// --- Misc -------------------------------------------------------------------
@@ -314,16 +314,16 @@ bool isTalking()
void logic()
{
- if (mSpecialRechargeUpdateTimer.passed())
+ if (mAbilityRechargeUpdateTimer.passed())
{
- mSpecialRechargeUpdateTimer.set(100);
+ mAbilityRechargeUpdateTimer.set(100);
- for (auto &special : mSpecials)
+ for (auto &[id, ability] : mAbilities)
{
- special.second.currentMana += special.second.recharge;
- if (special.second.currentMana > special.second.neededMana)
+ ability.currentMana += ability.recharge;
+ if (ability.currentMana > ability.neededMana)
{
- special.second.currentMana = special.second.neededMana;
+ ability.currentMana = ability.neededMana;
}
}
}
diff --git a/src/playerinfo.h b/src/playerinfo.h
index dd7d98fe..8ac82463 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -70,17 +70,15 @@ enum BuySellState
};
/**
- * Special information storage structure.
+ * Ability information storage structure.
*/
-struct Special
+struct Ability
{
int currentMana;
int neededMana;
int recharge;
};
-using SpecialsMap = std::map<int, Special>;
-
/**
* A database like namespace which holds global info about the localplayer
*
@@ -217,22 +215,22 @@ namespace PlayerInfo
*/
void setBuySellState(BuySellState buySellState);
-// --- Specials ---------------------------------------------------------------
+// --- Abilities --------------------------------------------------------------
/**
- * Removes all specials.
+ * Removes all abilities.
*/
- void clearSpecialStatus();
+ void clearAbilityStatus();
/**
- * Changes the status of the given special.
+ * Changes the status of the given ability.
*/
- void setSpecialStatus(int id, int current, int max, int recharge);
+ void setAbilityStatus(int id, int current, int max, int recharge);
/**
- * Returns the status of the given special.
+ * Returns the status of the given ability.
*/
- const SpecialsMap &getSpecialStatus();
+ const std::map<int, Ability> &getAbilityStatus();
// --- Misc -------------------------------------------------------------------
diff --git a/src/resources/specialdb.cpp b/src/resources/abilitydb.cpp
index ec0b3f2f..115f120e 100644
--- a/src/resources/specialdb.cpp
+++ b/src/resources/abilitydb.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "resources/specialdb.h"
+#include "resources/abilitydb.h"
#include "log.h"
@@ -28,82 +28,82 @@
namespace
{
- std::map<int, SpecialInfo *> mSpecialInfos;
+ std::map<int, AbilityInfo *> mAbilityInfos;
bool mLoaded = false;
}
-SpecialInfo::TargetMode SpecialDB::targetModeFromString(const std::string& str)
+AbilityInfo::TargetMode AbilityDB::targetModeFromString(const std::string& str)
{
if (str == "being")
- return SpecialInfo::TARGET_BEING;
+ return AbilityInfo::TARGET_BEING;
if (str == "point")
- return SpecialInfo::TARGET_POINT;
+ return AbilityInfo::TARGET_POINT;
- logger->log("SpecialDB: Warning, unknown target mode \"%s\"", str.c_str() );
- return SpecialInfo::TARGET_BEING;
+ logger->log("AbilityDB: Warning, unknown target mode \"%s\"", str.c_str() );
+ return AbilityInfo::TARGET_BEING;
}
-void SpecialDB::init()
+void AbilityDB::init()
{
if (mLoaded)
unload();
}
-void SpecialDB::readSpecialSetNode(XML::Node node, const std::string &filename)
+void AbilityDB::readAbilitySetNode(XML::Node node, const std::string &filename)
{
std::string setName = node.getProperty("name", "Actions");
- for (auto special : node.children())
+ for (auto ability : node.children())
{
- if (special.name() == "special")
+ if (ability.name() == "ability")
{
- auto *info = new SpecialInfo();
- int id = special.getProperty("id", 0);
+ auto *info = new AbilityInfo();
+ int id = ability.getProperty("id", 0);
info->id = id;
info->set = setName;
- info->name = special.getProperty("name", "");
- info->icon = special.getProperty("icon", "");
+ info->name = ability.getProperty("name", "");
+ info->icon = ability.getProperty("icon", "");
- info->targetMode = targetModeFromString(special.getProperty("target", "being"));
+ info->targetMode = targetModeFromString(ability.getProperty("target", "being"));
- info->rechargeable = special.getBoolProperty("rechargeable", true);
+ info->rechargeable = ability.getBoolProperty("rechargeable", true);
info->rechargeNeeded = 0;
info->rechargeCurrent = 0;
- if (mSpecialInfos.find(id) != mSpecialInfos.end())
+ if (mAbilityInfos.find(id) != mAbilityInfos.end())
{
- logger->log("SpecialDB: Duplicate special ID %d in %s, ignoring", id, filename.c_str());
+ logger->log("AbilityDB: Duplicate ability ID %d in %s, ignoring", id, filename.c_str());
} else {
- mSpecialInfos[id] = info;
+ mAbilityInfos[id] = info;
}
}
}
}
-void SpecialDB::checkStatus()
+void AbilityDB::checkStatus()
{
mLoaded = true;
}
-void SpecialDB::unload()
+void AbilityDB::unload()
{
- delete_all(mSpecialInfos);
- mSpecialInfos.clear();
+ delete_all(mAbilityInfos);
+ mAbilityInfos.clear();
mLoaded = false;
}
-SpecialInfo *SpecialDB::get(int id)
+AbilityInfo *AbilityDB::get(int id)
{
- auto i = mSpecialInfos.find(id);
+ auto i = mAbilityInfos.find(id);
- if (i == mSpecialInfos.end())
+ if (i == mAbilityInfos.end())
{
return nullptr;
}
diff --git a/src/resources/specialdb.h b/src/resources/abilitydb.h
index c8158a27..e03a7992 100644
--- a/src/resources/specialdb.h
+++ b/src/resources/abilitydb.h
@@ -23,7 +23,7 @@
#include <string>
#include "utils/xml.h"
-struct SpecialInfo
+struct AbilityInfo
{
enum TargetMode
{
@@ -31,34 +31,34 @@ struct SpecialInfo
TARGET_POINT // target map location
};
int id;
- std::string set; // tab on which the special is shown
- std::string name; // displayed name of special
+ std::string set; // tab on which the ability is shown
+ std::string name; // displayed name of ability
std::string icon; // filename of graphical icon
TargetMode targetMode; // target mode
- bool rechargeable; // true when the special has a recharge bar
+ bool rechargeable; // true when the ability has a recharge bar
int rechargeNeeded; // maximum recharge when applicable
int rechargeCurrent; // current recharge when applicable
};
/**
- * Special information database.
+ * Ability information database.
*/
-namespace SpecialDB
+namespace AbilityDB
{
void init();
- void readSpecialSetNode(XML::Node node, const std::string &filename);
+ void readAbilitySetNode(XML::Node node, const std::string &filename);
void checkStatus();
void unload();
- /** gets the special info for ID. Will return 0 when it is
- * a server-specific special.
+ /** gets the ability info for ID. Will return 0 when it is
+ * a server-specific ability.
*/
- SpecialInfo *get(int id);
+ AbilityInfo *get(int id);
- SpecialInfo::TargetMode targetModeFromString(const std::string& str);
+ AbilityInfo::TargetMode targetModeFromString(const std::string& str);
}
diff --git a/src/resources/settingsmanager.cpp b/src/resources/settingsmanager.cpp
index 789b8b75..b5add444 100644
--- a/src/resources/settingsmanager.cpp
+++ b/src/resources/settingsmanager.cpp
@@ -26,7 +26,7 @@
#include "resources/itemdb.h"
#include "resources/monsterdb.h"
#include "resources/npcdb.h"
-#include "resources/specialdb.h"
+#include "resources/abilitydb.h"
#include "resources/statuseffectdb.h"
#include "net/net.h"
@@ -53,7 +53,7 @@ namespace SettingsManager
hairDB.init();
itemDb->init();
MonsterDB::init();
- SpecialDB::init();
+ AbilityDB::init();
NPCDB::init();
EmoteDB::init();
StatusEffectDB::init();
@@ -77,7 +77,7 @@ namespace SettingsManager
hairDB.checkStatus();
itemDb->checkStatus();
MonsterDB::checkStatus();
- SpecialDB::checkStatus();
+ AbilityDB::checkStatus();
NPCDB::checkStatus();
EmoteDB::checkStatus();
StatusEffectDB::checkStatus();
@@ -94,7 +94,7 @@ namespace SettingsManager
StatusEffectDB::unload();
EmoteDB::unload();
NPCDB::unload();
- SpecialDB::unload();
+ AbilityDB::unload();
MonsterDB::unload();
if (itemDb)
itemDb->unload();
@@ -214,9 +214,9 @@ namespace SettingsManager
{
MonsterDB::readMonsterNode(childNode, filename);
}
- else if (childNode.name() == "special-set")
+ else if (childNode.name() == "ability-set")
{
- SpecialDB::readSpecialSetNode(childNode, filename);
+ AbilityDB::readAbilitySetNode(childNode, filename);
}
else if (childNode.name() == "npc")
{
@@ -234,15 +234,6 @@ namespace SettingsManager
{
Units::readUnitNode(childNode, filename);
}
- else
- {
- // compatibility stuff with older configs/games
- if (node.name() == "specials" && childNode.name() == "set")
- {
- // specials.xml:/specials/set
- SpecialDB::readSpecialSetNode(childNode, filename);
- }
- }
}
mIncludedFiles.erase(filename);
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 83bd9598..0d48d145 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -49,7 +49,7 @@ struct SpriteDisplay
* Remember those are the main action.
* Action subtypes, e.g.: "attack_bow" are to be passed by items.xml after
* an ACTION_ATTACK call.
- * Which special to be use to to be passed with the USE_SPECIAL call.
+ * Which ability to be use to to be passed with the USE_ABILITY call.
* Running, walking, ... is a sub-type of moving.
* ...
* Please don't add hard-coded subtypes here!
@@ -64,7 +64,7 @@ namespace SpriteAction
static const std::string MOVE = "walk";
static const std::string ATTACK = "attack";
static const std::string HURT = "hurt";
- static const std::string USE_SPECIAL = "special";
+ static const std::string USE_ABILITY = "ability";
static const std::string CAST_MAGIC = "magic";
static const std::string USE_ITEM = "item";
static const std::string INVALID;