summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-01-24 14:38:39 +0100
committerHaruna <haru@dotalux.com>2015-01-24 14:38:39 +0100
commit6f3a82487fdffabf221a9a2dfc5ace027c333f95 (patch)
tree76f2ba97a955d0724949b5f233a81bcd4ea8cf52 /src/map/script.c
parenta75714ca455c728d34918dd12200fcec87ebc0d4 (diff)
parent28eda3cd3dd7f8031668fdd8ba463e5661246348 (diff)
downloadhercules-6f3a82487fdffabf221a9a2dfc5ace027c333f95.tar.gz
hercules-6f3a82487fdffabf221a9a2dfc5ace027c333f95.tar.bz2
hercules-6f3a82487fdffabf221a9a2dfc5ace027c333f95.tar.xz
hercules-6f3a82487fdffabf221a9a2dfc5ace027c333f95.zip
Merge pull request #452 from HerculesWS/channel_refactor
Hercules Channel System refactor
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index a2ea86ac6..f50e56d2d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16,6 +16,7 @@
#include "atcommand.h"
#include "battle.h"
#include "battleground.h"
+#include "channel.h"
#include "chat.h"
#include "chrif.h"
#include "clif.h"
@@ -19012,6 +19013,29 @@ BUILDIN(shopcount) {
return true;
}
+/**
+ * @call channelmes("#channel", "message");
+ *
+ * Sends a message through the specified chat channel.
+ *
+ */
+BUILDIN(channelmes)
+{
+ struct map_session_data *sd = script->rid2sd(st);
+ const char *channelname = script_getstr(st, 2);
+ struct channel_data *chan = channel->search(channelname, sd);
+
+ if (!chan) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ channel->send(chan, NULL, script_getstr(st, 3));
+
+ script_pushint(st, 1);
+ return true;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
BUILDIN(defpattern);
@@ -19637,6 +19661,8 @@ void script_parse_builtin(void) {
BUILDIN_DEF(tradertype,"i"),
BUILDIN_DEF(purchaseok,""),
BUILDIN_DEF(shopcount, "i"),
+
+ BUILDIN_DEF(channelmes, "ss"),
};
int i, len = ARRAYLENGTH(BUILDIN);
RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up