summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-10 20:30:41 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-10 20:33:26 +0300
commitebf09a72221e05de9cd60e3df806f54e29329f4c (patch)
tree5e146cc81c971d40586cf8d464844679d078c6da /src
parented39e0835a4afc21335bac2ab3cb8c974c371da0 (diff)
downloadplugin-ebf09a72221e05de9cd60e3df806f54e29329f4c.tar.gz
plugin-ebf09a72221e05de9cd60e3df806f54e29329f4c.tar.bz2
plugin-ebf09a72221e05de9cd60e3df806f54e29329f4c.tar.xz
plugin-ebf09a72221e05de9cd60e3df806f54e29329f4c.zip
Add support for sending group id to client.
Add permission send_gm_flag.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/map/clif.c7
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/permission.c17
-rw-r--r--src/map/permission.h9
-rw-r--r--src/map/send.c31
-rw-r--r--src/map/send.h3
7 files changed, 69 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3bb63c2..9599d00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,6 +37,8 @@ MAP_SRC = map/clif.c \
map/parse.h \
map/pc.c \
map/pc.h \
+ map/permission.c \
+ map/permission.h \
map/quest.c \
map/quest.h \
map/script.c \
diff --git a/src/map/clif.c b/src/map/clif.c
index a1be1f8..3c6675e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -152,6 +152,7 @@ void eclif_authok_post(struct map_session_data *sd)
return;
eclif_send_additional_slots(sd, sd);
+ send_pc_info(sd, sd, SELF);
struct MapdExt *data = mapd_get(sd->bl.m);
int mask = data ? data->mask : 1;
send_mapmask(sd->fd, mask);
@@ -232,8 +233,10 @@ void eclif_set_unit_idle_post(struct block_list* bl, struct map_session_data *ts
if (!bl || !tsd)
return;
- if (bl->type == BL_MOB && tsd)
- send_mob_info(bl, tsd ? &tsd->bl : bl, *target);
+ if (bl->type == BL_MOB)
+ send_mob_info(bl, &tsd->bl, *target);
+ else if (bl->type == BL_PC)
+ send_pc_info(bl, &tsd->bl, *target);
}
void eclif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
diff --git a/src/map/init.c b/src/map/init.c
index 3219c61..22bb403 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -41,6 +41,7 @@
#include "map/npc.h"
#include "map/unit.h"
#include "map/parse.h"
+#include "map/permission.h"
#include "map/pc.h"
#include "map/quest.h"
#include "map/script.h"
@@ -184,6 +185,7 @@ HPExport void server_preinit (void)
setDefaultMap();
addHookPre("quest->read_db", equest_read_db);
+ addGroupPermission("send_gm_flag", permission_send_gm_flag);
}
HPExport void server_online (void)
diff --git a/src/map/permission.c b/src/map/permission.c
new file mode 100644
index 0000000..83928de
--- /dev/null
+++ b/src/map/permission.c
@@ -0,0 +1,17 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+#include "../../../map/map.h"
+#include "../../../map/npc.h"
+#include "../../../map/status.h"
+
+unsigned int permission_send_gm_flag = UINT_MAX - 1; \ No newline at end of file
diff --git a/src/map/permission.h b/src/map/permission.h
new file mode 100644
index 0000000..8cbdebb
--- /dev/null
+++ b/src/map/permission.h
@@ -0,0 +1,9 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_PERMISSION
+#define EVOL_MAP_PERMISSION
+
+extern unsigned int permission_send_gm_flag;
+
+#endif // EVOL_MAP_PERMISSION
diff --git a/src/map/send.c b/src/map/send.c
index b92065a..aa03de0 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -15,6 +15,9 @@
#include "../../../map/unit.h"
#include "map/send.h"
+#include "map/permission.h"
+#include "map/data/session.h"
+#include "map/struct/sessionext.h"
void send_npccommand (struct map_session_data *sd, int npcId, int cmd)
{
@@ -121,6 +124,34 @@ void send_mob_info(struct block_list* bl1, struct block_list* bl2,
clif->send(&buf, sizeof(buf), bl2, target);
}
+void send_pc_info(struct block_list* bl1,
+ struct block_list* bl2,
+ enum send_target target)
+{
+ char buf[12];
+
+ if (bl1->type != BL_PC)
+ return;
+
+ struct map_session_data *sd = (struct map_session_data *)bl1;
+
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return;
+ if (data->clientVersion < 4)
+ return;
+
+ WBUFW (buf, 0) = 0xb0a;
+ WBUFW (buf, 2) = 12; // len
+ WBUFL (buf, 4) = sd->bl.id;
+ if (pc_has_permission(sd, permission_send_gm_flag))
+ WBUFL (buf, 8) = sd->group_id;
+ else
+ WBUFL (buf, 8) = 0;
+
+ clif->send(&buf, sizeof(buf), bl2, target);
+}
+
void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_target target)
{
if (!ud)
diff --git a/src/map/send.h b/src/map/send.h
index fbd93c9..e7bdd2a 100644
--- a/src/map/send.h
+++ b/src/map/send.h
@@ -15,5 +15,8 @@ void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_targ
void send_changemusic_brodcast(const int map, const char *music);
void send_changenpc_title (struct map_session_data *sd, const int npcId, const char *name);
void send_join_ack(int fd, const char *const name, int flag);
+void send_pc_info(struct block_list* bl1,
+ struct block_list* bl2,
+ enum send_target target);
#endif // EVOL_MAP_PC