summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-10 20:34:17 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-10 20:36:22 -0600
commit1b13d8557c8666e1017fd70a455830dbdcb9f46c (patch)
tree59ac497717ee78861d6e2dc64a35f4924efb8947
parent9af6e761373f25b56e815f1f75b44473474cf280 (diff)
downloadmana-1b13d8557c8666e1017fd70a455830dbdcb9f46c.tar.gz
mana-1b13d8557c8666e1017fd70a455830dbdcb9f46c.tar.bz2
mana-1b13d8557c8666e1017fd70a455830dbdcb9f46c.tar.xz
mana-1b13d8557c8666e1017fd70a455830dbdcb9f46c.zip
Add SpecialsWindow
THis replaces the MagicWindow that the TMWServ build used and will be usable going forward for eAthena.
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Makefile.am6
-rw-r--r--src/game.cpp8
-rw-r--r--src/gui/chat.cpp3
-rw-r--r--src/gui/magic.cpp92
-rw-r--r--src/gui/specialswindow.cpp254
-rw-r--r--src/gui/specialswindow.h (renamed from src/gui/magic.h)50
-rw-r--r--src/gui/widgets/flowcontainer.cpp78
-rw-r--r--src/gui/widgets/flowcontainer.h68
-rw-r--r--src/gui/windowmenu.cpp10
-rw-r--r--src/net/tmwserv/generalhandler.cpp6
-rw-r--r--src/net/tmwserv/generalhandler.h1
-rw-r--r--src/net/tmwserv/specialhandler.cpp5
-rw-r--r--src/net/tmwserv/specialhandler.h5
-rw-r--r--tmw.cbp12
15 files changed, 468 insertions, 136 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 43726f9d..eeaa7459 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,6 +74,8 @@ SET(SRCS
gui/widgets/desktop.h
gui/widgets/dropdown.cpp
gui/widgets/dropdown.h
+ gui/widgets/flowcontainer.cpp
+ gui/widgets/flowcontainer.h
gui/widgets/icon.cpp
gui/widgets/icon.h
gui/widgets/inttextfield.cpp
@@ -221,6 +223,8 @@ SET(SRCS
gui/skin.h
gui/speechbubble.cpp
gui/speechbubble.h
+ gui/specialswindow.cpp
+ gui/specialswindow.h
gui/statuswindow.cpp
gui/statuswindow.h
gui/storagewindow.cpp
@@ -476,8 +480,6 @@ SET(SRCS_TMW
gui/guildlistbox.h
gui/guildwindow.cpp
gui/guildwindow.h
- gui/magic.cpp
- gui/magic.h
gui/quitdialog.cpp
gui/quitdialog.h
gui/serverdialog.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 25fdb140..ff35cdd5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,8 @@ tmw_SOURCES = gui/widgets/avatar.cpp \
gui/widgets/desktop.h \
gui/widgets/dropdown.cpp \
gui/widgets/dropdown.h \
+ gui/widgets/flowcontainer.cpp \
+ gui/widgets/flowcontainer.h \
gui/widgets/icon.cpp \
gui/widgets/icon.h \
gui/widgets/inttextfield.cpp \
@@ -170,6 +172,8 @@ tmw_SOURCES = gui/widgets/avatar.cpp \
gui/skin.h \
gui/speechbubble.cpp \
gui/speechbubble.h \
+ gui/specialswindow.cpp \
+ gui/specialswindow.h \
gui/statuswindow.cpp \
gui/statuswindow.h \
gui/storagewindow.cpp \
@@ -384,8 +388,6 @@ tmw_SOURCES += \
gui/guildlistbox.h \
gui/guildwindow.cpp \
gui/guildwindow.h \
- gui/magic.cpp \
- gui/magic.h \
gui/quitdialog.cpp \
gui/quitdialog.h \
gui/serverdialog.cpp \
diff --git a/src/game.cpp b/src/game.cpp
index ff0d84f7..2acb8bc2 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -71,10 +71,10 @@
#ifdef TMWSERV_SUPPORT
#include "gui/buddywindow.h"
#include "gui/guildwindow.h"
-#include "gui/magic.h"
#include "gui/quitdialog.h"
#endif
#include "gui/npcpostdialog.h"
+#include "gui/specialswindow.h"
#include "gui/storagewindow.h"
#include "net/generalhandler.h"
@@ -128,7 +128,6 @@ PartyWindow *partyWindow;
#ifdef TMWSERV_SUPPORT
BuddyWindow *buddyWindow;
GuildWindow *guildWindow;
-MagicDialog *magicDialog;
#endif
NpcDialog *npcDialog;
NpcPostDialog *npcPostDialog;
@@ -141,6 +140,7 @@ DebugWindow *debugWindow;
ShortcutWindow *itemShortcutWindow;
ShortcutWindow *emoteShortcutWindow;
OutfitWindow *outfitWindow;
+SpecialsWindow *specialsWindow;
BeingManager *beingManager = NULL;
FloorItemManager *floorItemManager = NULL;
@@ -215,7 +215,6 @@ static void createGuiWindows()
tradeWindow = new TradeWindow;
partyWindow = new PartyWindow;
#ifdef TMWSERV_SUPPORT
- magicDialog = new MagicDialog;
buddyWindow = new BuddyWindow;
guildWindow = new GuildWindow;
#else
@@ -237,6 +236,7 @@ static void createGuiWindows()
emoteShortcutWindow = new ShortcutWindow("EmoteShortcut",
new EmoteShortcutContainer);
outfitWindow = new OutfitWindow();
+ specialsWindow = new SpecialsWindow();
localChatTab = new ChatTab(_("General"));
@@ -269,7 +269,6 @@ static void destroyGuiWindows()
delete npcDialog;
delete npcPostDialog;
#ifdef TMWSERV_SUPPORT
- delete magicDialog;
delete buddyWindow;
delete guildWindow;
#endif
@@ -283,6 +282,7 @@ static void destroyGuiWindows()
delete emoteShortcutWindow;
delete storageWindow;
delete outfitWindow;
+ delete specialsWindow;
}
Game::Game():
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index c337d33b..be302dc3 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -98,6 +98,8 @@ ChatWindow::ChatWindow():
mChatTabs = new TabbedArea;
+ //place(0, 0, mChatTabs, 3, 3);
+ //place(0, 3, mChatInput, 3);
add(mChatTabs);
add(mChatInput);
@@ -128,6 +130,7 @@ void ChatWindow::resetToDefaultSize()
void ChatWindow::adjustTabSize()
{
+ //return;
const gcn::Rectangle area = getChildrenArea();
mChatInput->setPosition(mChatInput->getFrameSize(),
diff --git a/src/gui/magic.cpp b/src/gui/magic.cpp
deleted file mode 100644
index 48cfc5dc..00000000
--- a/src/gui/magic.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * The Mana World
- * Copyright (C) 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "gui/magic.h"
-
-#include "gui/widgets/button.h"
-#include "gui/setup.h"
-
-#include "localplayer.h"
-
-#include "utils/dtor.h"
-#include "utils/gettext.h"
-
-MagicDialog::MagicDialog():
- Window(_("Magic"))
-{
- setWindowName("Magic");
- setCloseButton(true);
- setSaveVisible(true);
- setDefaultSize(255, 30, 175, 225);
- setupWindow->registerWindowForReset(this);
-
- gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this);
- gcn::Button *spellButton2 = new Button(_("Cast Test Spell 2"), "spell_2", this);
- gcn::Button *spellButton3 = new Button(_("Cast Test Spell 3"), "spell_3", this);
-
- spellButton1->setPosition(10, 30);
- spellButton2->setPosition(10, 60);
- spellButton3->setPosition(10, 90);
-
- add(spellButton1);
- add(spellButton2);
- add(spellButton3);
-
- update();
-
- setLocationRelativeTo(getParent());
- loadWindowState();
-}
-
-MagicDialog::~MagicDialog()
-{
-}
-
-void MagicDialog::action(const gcn::ActionEvent &event)
-{
- if (event.getId() == "spell_1")
- {
- player_node->useSpecial(1);
- }
- if (event.getId() == "spell_2")
- {
- player_node->useSpecial(2);
- }
- if (event.getId() == "spell_3")
- {
- player_node->useSpecial(3);
- }
- else if (event.getId() == "close")
- {
- setVisible(false);
- }
-}
-
-void MagicDialog::draw(gcn::Graphics *g)
-{
- update();
-
- Window::draw(g);
-}
-
-void MagicDialog::update()
-{
-}
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
new file mode 100644
index 00000000..5d2ab676
--- /dev/null
+++ b/src/gui/specialswindow.cpp
@@ -0,0 +1,254 @@
+/*
+ * The Mana World
+ * Copyright (C) 2009 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "gui/specialswindow.h"
+
+#include "gui/widgets/button.h"
+#include "gui/widgets/container.h"
+#include "gui/widgets/icon.h"
+#include "gui/widgets/label.h"
+#include "gui/widgets/layouthelper.h"
+#include "gui/widgets/listbox.h"
+#include "gui/widgets/progressbar.h"
+#include "gui/widgets/scrollarea.h"
+#include "gui/widgets/tab.h"
+#include "gui/widgets/tabbedarea.h"
+#include "gui/widgets/flowcontainer.h"
+#include "gui/widgets/windowcontainer.h"
+#include "gui/setup.h"
+
+#include "localplayer.h"
+#include "log.h"
+
+#include "net/net.h"
+#include "net/specialhandler.h"
+
+#include "utils/dtor.h"
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+#include "utils/xml.h"
+
+#include <string>
+
+#define SPECIALS_WIDTH 200
+#define SPECIALS_HEIGHT 32
+
+class SpecialEntry;
+
+struct SpecialInfo
+{
+ unsigned short id;
+ std::string name;
+ std::string icon;
+ SpecialEntry *display;
+};
+
+class SpecialEntry : public Container
+{
+ public:
+ SpecialEntry(SpecialInfo *info);
+
+ void update();
+
+ protected:
+ friend class SpecialsWindow;
+ SpecialInfo *mInfo;
+
+ private:
+ Icon *mIcon;
+ Label *mNameLabel;
+ Label *mLevelLabel;
+ Label *mTechLabel;
+ Button *mUse;
+};
+
+SpecialsWindow::SpecialsWindow():
+ Window(_("Specials"))
+{
+ setWindowName("Specials");
+ setCloseButton(true);
+ setResizable(true);
+ setSaveVisible(true);
+ setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425);
+ setupWindow->registerWindowForReset(this);
+
+ mTabs = new TabbedArea();
+
+ place(0, 0, mTabs, 5, 5);
+
+ setLocationRelativeTo(getParent());
+ loadWindowState();
+}
+
+SpecialsWindow::~SpecialsWindow()
+{
+ // Clear gui
+ loadSpecials("");
+}
+
+void SpecialsWindow::action(const gcn::ActionEvent &event)
+{
+ if (event.getId() == "use")
+ {
+ SpecialEntry *disp = dynamic_cast<SpecialEntry*>(event.getSource()->getParent());
+
+ if (disp)
+ {
+ /*Being *target = player_node->getTarget();
+
+ if (target)
+ Net::getSpecialHandler()->use(disp->mInfo->id, 1, target->getId());
+ else*/
+ Net::getSpecialHandler()->use(disp->mInfo->id);
+ }
+ }
+ else if (event.getId() == "close")
+ {
+ setVisible(false);
+ }
+}
+
+void SpecialsWindow::logic()
+{
+ Window::logic();
+
+ Tab *tab = dynamic_cast<Tab*>(mTabs->getSelectedTab());
+ if (tab != mCurrentTab) {
+ mCurrentTab = tab;
+ }
+}
+
+std::string SpecialsWindow::update(int id)
+{
+ // TODO
+
+ return std::string();
+}
+
+void SpecialsWindow::loadSpecials(const std::string &file)
+{
+ // TODO: mTabs->clear();
+ while (mTabs->getSelectedTabIndex() != -1)
+ {
+ mTabs->removeTabWithIndex(mTabs->getSelectedTabIndex());
+ }
+
+ for (SpecialMap::iterator it = mSpecials.begin(); it != mSpecials.end(); it++)
+ {
+ delete (*it).second->display;
+ }
+ delete_all(mSpecials);
+ mSpecials.clear();
+
+ if (file.length() == 0)
+ return;
+
+ XML::Document doc(file);
+ xmlNodePtr root = doc.rootNode();
+
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "specials"))
+ {
+ logger->log("Error loading specials file: %s", file.c_str());
+ return;
+ }
+
+ int setCount = 0;
+ std::string setName;
+ ScrollArea *scroll;
+ FlowContainer *container;
+
+ for_each_xml_child_node(set, root)
+ {
+ if (xmlStrEqual(set->name, BAD_CAST "set"))
+ {
+ setCount++;
+ setName = XML::getProperty(set, "name", strprintf(_("Specials Set %d"), setCount));
+
+ container = new FlowContainer(SPECIALS_WIDTH, SPECIALS_HEIGHT);
+ container->setOpaque(false);
+ scroll = new ScrollArea(container);
+ scroll->setOpaque(false);
+ scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
+
+ mTabs->addTab(setName, scroll);
+ for_each_xml_child_node(node, set)
+ {
+ if (xmlStrEqual(node->name, BAD_CAST "special"))
+ {
+ int id = atoi(XML::getProperty(node, "id", "-1").c_str());
+ if (id == -1)
+ continue;
+ std::string name = XML::getProperty(node, "name", strprintf(_("Special %d"), id));
+ std::string icon = XML::getProperty(node, "icon", "");
+
+ SpecialInfo *special = new SpecialInfo;
+ special->id = id;
+ special->name = name;
+ special->icon = icon;
+ special->display = new SpecialEntry(special);
+
+ container->add(special->display);
+
+ mSpecials[id] = special;
+ }
+ }
+ }
+ }
+}
+
+SpecialEntry::SpecialEntry(SpecialInfo *info) :
+ mInfo(info),
+ mIcon(NULL),
+ mNameLabel(new Label(info->name)),
+ mLevelLabel(new Label("999")),
+ mUse(new Button("Use", "use", specialsWindow))
+{
+ setFrameSize(1);
+ setOpaque(false);
+ setSize(SPECIALS_WIDTH, SPECIALS_HEIGHT);
+
+ if (!info->icon.empty())
+ mIcon = new Icon(info->icon);
+ else
+ mIcon = new Icon("graphics/gui/unknown-item.png");
+
+ mIcon->setPosition(1, 0);
+ add(mIcon);
+
+ mNameLabel->setPosition(35, 0);
+ add(mNameLabel);
+
+ mLevelLabel->setPosition(getWidth() - mLevelLabel->getWidth(), 0);
+ add(mLevelLabel);
+
+ mNameLabel->setWidth(mLevelLabel->getX() - mNameLabel->getX() - 1);
+
+ mUse->setPosition(getWidth() - mUse->getWidth(), 13);
+ add(mUse);
+
+ update();
+}
+
+void SpecialEntry::update()
+{
+ // TODO
+}
diff --git a/src/gui/magic.h b/src/gui/specialswindow.h
index 734ad799..17c29597 100644
--- a/src/gui/magic.h
+++ b/src/gui/specialswindow.h
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright (C) 2004 The Mana World Development Team
+ * Copyright (C) 2009 The Mana World Development Team
*
* This file is part of The Mana World.
*
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef MAGIC_H
-#define MAGIC_H
+#ifndef SPECIALSWINDOW_H
+#define SPECIALSWINDOW_H
#include "gui/widgets/window.h"
@@ -28,34 +28,42 @@
#include <guichan/actionlistener.hpp>
-/**
- * The skill dialog.
- *
- * \ingroup Interface
- */
-class MagicDialog : public Window, public gcn::ActionListener
-{
+#include <map>
+
+class Label;
+class ScrollArea;
+class Tab;
+class TabbedArea;
+
+struct SpecialInfo;
+
+class SpecialsWindow : public Window, public gcn::ActionListener {
public:
- MagicDialog();
+ SpecialsWindow();
- ~MagicDialog();
+ ~SpecialsWindow();
/**
* Called when receiving actions from widget.
*/
- void action(const gcn::ActionEvent &event);
+ void action(const gcn::ActionEvent &actionEvent);
+
+ void logic();
/**
- * Update the tabs in this dialog
+ * Update the given special's display
*/
- void update();
+ std::string update(int id);
- /**
- * Draw this window.
- */
- void draw(gcn::Graphics *g);
+ void loadSpecials(const std::string &file);
+
+ private:
+ typedef std::map<int, SpecialInfo*> SpecialMap;
+ SpecialMap mSpecials;
+ Tab *mCurrentTab;
+ TabbedArea *mTabs;
};
-extern MagicDialog *magicDialog;
+extern SpecialsWindow *specialsWindow;
-#endif
+#endif // SPECIALSWINDOW_H
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
new file mode 100644
index 00000000..6ce4284b
--- /dev/null
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -0,0 +1,78 @@
+/*
+ * The Mana World
+ * Copyright (C) 2007 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "flowcontainer.h"
+
+FlowContainer::FlowContainer(int boxWidth, int boxHeight):
+ mBoxWidth(boxWidth), mBoxHeight(boxHeight),
+ mGridWidth(1), mGridHeight(1)
+{
+ addWidgetListener(this);
+}
+
+void FlowContainer::widgetResized(const gcn::Event &event)
+{
+ if (getWidth() < mBoxWidth)
+ {
+ setWidth(mBoxWidth);
+ return;
+ }
+
+ int itemCount = mWidgets.size();
+
+ mGridWidth = getWidth() / mBoxWidth;
+
+ if (mGridWidth < 1)
+ mGridWidth = 1;
+
+ mGridHeight = itemCount / mGridWidth;
+
+ if (itemCount % mGridWidth != 0 || mGridHeight < 1)
+ ++mGridHeight;
+
+ int height = mGridHeight * mBoxHeight;
+
+ if (getHeight() != height)
+ {
+ setHeight(height);
+ return;
+ }
+
+ int i = 0;
+ height = 0;
+ for (WidgetList::iterator it = mWidgets.begin(); it != mWidgets.end(); it++)
+ {
+ int x = i % mGridWidth * mBoxWidth;
+ (*it)->setPosition(x, height);
+
+ i++;
+
+ if (i % mGridWidth == 0)
+ height += mBoxHeight;
+ }
+}
+
+void FlowContainer::add(gcn::Widget *widget)
+{
+ Container::add(widget);
+ widget->setSize(mBoxWidth, mBoxHeight);
+ widgetResized(NULL);
+}
diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h
new file mode 100644
index 00000000..afecde25
--- /dev/null
+++ b/src/gui/widgets/flowcontainer.h
@@ -0,0 +1,68 @@
+/*
+ * The Mana World
+ * Copyright (C) 2009 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef FLOWCONTAINER_H
+#define FLOWCONTAINER_H
+
+#include "container.h"
+
+#include <guichan/widgetlistener.hpp>
+
+/**
+ * A container that arranges its contents like words on a page.
+ *
+ * \ingroup GUI
+ */
+class FlowContainer : public Container,
+ public gcn::WidgetListener
+{
+ public:
+ /**
+ * Constructor. Initializes the shortcut container.
+ */
+ FlowContainer(int boxWidth, int boxHeight);
+
+ /**
+ * Destructor.
+ */
+ ~FlowContainer() {}
+
+ /**
+ * Invoked when a widget changes its size. This is used to determine
+ * the new height of the container.
+ */
+ void widgetResized(const gcn::Event &event);
+
+ int getBoxWidth() const
+ { return mBoxWidth; }
+
+ int getBoxHeight() const
+ { return mBoxHeight; }
+
+ void add(gcn::Widget *widget);
+
+ private:
+ int mBoxWidth;
+ int mBoxHeight;
+ int mGridWidth, mGridHeight;
+};
+
+#endif
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 96776617..b73558c0 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -41,11 +41,11 @@ extern Window *inventoryWindow;
extern Window *itemShortcutWindow;
extern Window *setupWindow;
extern Window *skillDialog;
+extern Window *specialsWindow;
extern Window *statusWindow;
#ifdef TMWSERV_SUPPORT
extern Window *buddyWindow;
extern Window *guildWindow;
-extern Window *magicDialog;
#endif
WindowMenu::WindowMenu():
@@ -59,8 +59,8 @@ WindowMenu::WindowMenu():
N_("Equipment"),
N_("Inventory"),
N_("Skills"),
+ N_("Specials"),
#ifdef TMWSERV_SUPPORT
- N_("Magic"),
N_("Guilds"),
N_("Buddies"),
#endif
@@ -129,11 +129,11 @@ void WindowMenu::action(const gcn::ActionEvent &event)
{
window = skillDialog;
}
-#ifdef TMWSERV_SUPPORT
- else if (event.getId() == "Magic")
+ else if (event.getId() == "Specials")
{
- window = magicDialog;
+ window = specialsWindow;
}
+#ifdef TMWSERV_SUPPORT
else if (event.getId() == "Guilds")
{
window = guildWindow;
diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp
index d643586b..011433fe 100644
--- a/src/net/tmwserv/generalhandler.cpp
+++ b/src/net/tmwserv/generalhandler.cpp
@@ -22,6 +22,7 @@
#include "gui/inventorywindow.h"
#include "gui/partywindow.h"
#include "gui/skilldialog.h"
+#include "gui/specialswindow.h"
#include "gui/statuswindow.h"
#include "net/tmwserv/generalhandler.h"
@@ -43,6 +44,7 @@
#include "net/tmwserv/npchandler.h"
#include "net/tmwserv/partyhandler.h"
#include "net/tmwserv/playerhandler.h"
+#include "net/tmwserv/specialhandler.h"
#include "net/tmwserv/tradehandler.h"
#include "utils/gettext.h"
@@ -72,7 +74,8 @@ GeneralHandler::GeneralHandler():
mNpcHandler(new NpcHandler),
mPartyHandler(new PartyHandler),
mPlayerHandler(new PlayerHandler),
- mTradeHandler(new TradeHandler)
+ mTradeHandler(new TradeHandler),
+ mSpecialHandler(new SpecialHandler)
{
accountServerConnection = Net::getConnection();
gameServerConnection = Net::getConnection();
@@ -149,6 +152,7 @@ void GeneralHandler::guiWindowsLoaded()
inventoryWindow->setSplitAllowed(true);
partyWindow->clearPartyName();
skillDialog->loadSkills("tmw-skills.xml");
+ specialsWindow->loadSpecials("specials.xml");
player_node->setExpNeeded(100);
diff --git a/src/net/tmwserv/generalhandler.h b/src/net/tmwserv/generalhandler.h
index 08e18850..40166ca0 100644
--- a/src/net/tmwserv/generalhandler.h
+++ b/src/net/tmwserv/generalhandler.h
@@ -63,6 +63,7 @@ class GeneralHandler : public Net::GeneralHandler
MessageHandlerPtr mPartyHandler;
MessageHandlerPtr mPlayerHandler;
MessageHandlerPtr mTradeHandler;
+ MessageHandlerPtr mSpecialHandler;
};
} // namespace TmwServ
diff --git a/src/net/tmwserv/specialhandler.cpp b/src/net/tmwserv/specialhandler.cpp
index f259e77a..2e4ff1bb 100644
--- a/src/net/tmwserv/specialhandler.cpp
+++ b/src/net/tmwserv/specialhandler.cpp
@@ -37,6 +37,11 @@ SpecialHandler::SpecialHandler()
specialHandler = this;
}
+void SpecialHandler::handleMessage(MessageIn &msg)
+{
+ // TODO
+}
+
void SpecialHandler::use(int id)
{
MessageOut msg(PGMSG_USE_SPECIAL);
diff --git a/src/net/tmwserv/specialhandler.h b/src/net/tmwserv/specialhandler.h
index c7ebd6a2..b8f0ce90 100644
--- a/src/net/tmwserv/specialhandler.h
+++ b/src/net/tmwserv/specialhandler.h
@@ -22,15 +22,18 @@
#ifndef NET_TMWSERV_SKILLHANDLER_H
#define NET_TMWSERV_SKILLHANDLER_H
+#include "net/messagehandler.h"
#include "net/specialhandler.h"
namespace TmwServ {
-class SpecialHandler : public Net::SpecialHandler
+class SpecialHandler : public MessageHandler, public Net::SpecialHandler
{
public:
SpecialHandler();
+ void handleMessage(MessageIn &msg);
+
void use(int id);
void use(int id, int level, int beingId);
diff --git a/tmw.cbp b/tmw.cbp
index 46c3aef2..86196052 100644
--- a/tmw.cbp
+++ b/tmw.cbp
@@ -267,14 +267,6 @@
<Unit filename="src/gui/linkhandler.h" />
<Unit filename="src/gui/login.cpp" />
<Unit filename="src/gui/login.h" />
- <Unit filename="src/gui/magic.cpp">
- <Option target="TMWServ" />
- <Option target="Unix TMWSERV" />
- </Unit>
- <Unit filename="src/gui/magic.h">
- <Option target="TMWServ" />
- <Option target="Unix TMWSERV" />
- </Unit>
<Unit filename="src/gui/minimap.cpp" />
<Unit filename="src/gui/minimap.h" />
<Unit filename="src/gui/ministatus.cpp" />
@@ -355,6 +347,8 @@
<Unit filename="src/gui/skin.h" />
<Unit filename="src/gui/speechbubble.cpp" />
<Unit filename="src/gui/speechbubble.h" />
+ <Unit filename="src/gui/specialswindow.cpp" />
+ <Unit filename="src/gui/specialswindow.h" />
<Unit filename="src/gui/statuswindow.cpp" />
<Unit filename="src/gui/statuswindow.h" />
<Unit filename="src/gui/storagewindow.cpp" />
@@ -406,6 +400,8 @@
<Unit filename="src/gui/widgets/desktop.h" />
<Unit filename="src/gui/widgets/dropdown.cpp" />
<Unit filename="src/gui/widgets/dropdown.h" />
+ <Unit filename="src/gui/widgets/flowcontainer.cpp" />
+ <Unit filename="src/gui/widgets/flowcontainer.h" />
<Unit filename="src/gui/widgets/icon.cpp" />
<Unit filename="src/gui/widgets/icon.h" />
<Unit filename="src/gui/widgets/inttextfield.cpp" />