summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-08-04 22:22:40 -0600
committerJared Adams <jaxad0127@gmail.com>2010-08-05 01:04:58 -0600
commitdd1463241c00f38de5855b9e9869b773f683373f (patch)
treea5ceea8ccfded6f48214021bc7481a98b81abebc /src/being.cpp
parent154ea41225505eee0c77652a04738d845a2e93cd (diff)
downloadmana-client-dd1463241c00f38de5855b9e9869b773f683373f.tar.gz
mana-client-dd1463241c00f38de5855b9e9869b773f683373f.tar.bz2
mana-client-dd1463241c00f38de5855b9e9869b773f683373f.tar.xz
mana-client-dd1463241c00f38de5855b9e9869b773f683373f.zip
Have Being manage speech creation and add permissions to events
The Being and Player Chat events now have the precomuted permissions for SPEECH_LOG and SPEECH_FLOAT. The Being class now acts on those events to show speech (if SPEECH_FLOAT is present). ChatWindow now checks for the SPEECH_LOG permission. Reviewed-by: Freeyorp
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 344636a5..9be5986c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -26,6 +26,7 @@
#include "client.h"
#include "configuration.h"
#include "effectmanager.h"
+#include "event.h"
#include "graphics.h"
#include "guild.h"
#include "localplayer.h"
@@ -33,6 +34,7 @@
#include "map.h"
#include "particle.h"
#include "party.h"
+#include "playerrelations.h"
#include "simpleanimation.h"
#include "sound.h"
#include "sprite.h"
@@ -114,6 +116,7 @@ Being::Being(int id, Type type, int subtype, Map *map):
setShowName(true);
updateColors();
+ listen("Chat");
}
Being::~Being()
@@ -1198,3 +1201,21 @@ void Being::talkTo()
{
Net::getNpcHandler()->talk(mId);
}
+
+void Being::event(const std::string &channel, const Mana::Event &event)
+{
+ if (channel == "Chat" &&
+ (event.getName() == "Being" || event.getName() == "Player") &&
+ event.getInt("permissions") & PlayerRelation::SPEECH_FLOAT)
+ {
+ try
+ {
+ if (mId == event.getInt("beingId"))
+ {
+ setSpeech(event.getString("text"));
+ }
+ }
+ catch (Mana::BadEvent badEvent)
+ {}
+ }
+}