summaryrefslogtreecommitdiff
path: root/src/gui/npcpostdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npcpostdialog.cpp')
-rw-r--r--src/gui/npcpostdialog.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 19d0cf61..0662515e 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -21,18 +21,15 @@
#include "gui/npcpostdialog.h"
-#include "npc.h"
+#include "event.h"
+#include "playerinfo.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/label.h"
#include "gui/widgets/textbox.h"
#include "gui/widgets/textfield.h"
#include "gui/widgets/scrollarea.h"
-#include "net/net.h"
-#include "net/npchandler.h"
-
#include "utils/gettext.h"
NpcPostDialog::DialogList NpcPostDialog::instances;
@@ -80,11 +77,14 @@ NpcPostDialog::NpcPostDialog(int npcId):
instances.push_back(this);
setVisible(true);
+
+ PlayerInfo::setNPCPostCount(PlayerInfo::getNPCPostCount() + 1);
}
NpcPostDialog::~NpcPostDialog()
{
instances.remove(this);
+ PlayerInfo::setNPCPostCount(PlayerInfo::getNPCPostCount() - 1);
}
void NpcPostDialog::action(const gcn::ActionEvent &event)
@@ -93,13 +93,15 @@ void NpcPostDialog::action(const gcn::ActionEvent &event)
{
if (mSender->getText().empty() || mText->getText().empty())
{
- localChatTab->chatLog(_("Failed to send as sender or letter "
- "invalid."));
+ SERVER_NOTICE(_("Failed to send as sender or letter invalid."))
}
else
{
- Net::getNpcHandler()->sendLetter(mNpcId, mSender->getText(),
- mText->getText());
+ Mana::Event event("doSendLetter");
+ event.setInt("npcId", mNpcId);
+ event.setString("recipient", mSender->getText());
+ event.setString("text", mText->getText());
+ event.trigger("NPC");
}
setVisible(false);
}