summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 84d49e1db..24f71f47b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2268,7 +2268,7 @@ static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, int id,
return 1;
}
-static int pc_addautobonus(struct s_autobonus *bonus, char max, const char *bonus_script, short rate, unsigned int dur, short flag, const char *other_script, unsigned short pos, bool onskill)
+static int pc_addautobonus(struct s_autobonus *bonus, char max, const char *bonus_script, short rate, unsigned int dur, short flag, const char *other_script, unsigned int pos, bool onskill)
{
int i;
@@ -10990,7 +10990,7 @@ static int map_day_timer(int tid, int64 tick, int id, intptr_t data)
map->night_flag = 0; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60), sizeof(tmp_soutput)); // The day has arrived!
- intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
+ clif->broadcast(NULL, tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT, ALL_CLIENT);
return 0;
}
@@ -11011,7 +11011,7 @@ static int map_night_timer(int tid, int64 tick, int id, intptr_t data)
map->night_flag = 1; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59), sizeof(tmp_soutput)); // The night has fallen...
- intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
+ clif->broadcast(NULL, tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT, ALL_CLIENT);
return 0;
}
@@ -12311,6 +12311,54 @@ static void pc_check_supernovice_call(struct map_session_data *sd, const char *m
}
}
+/**
+ * Sends a message t all online GMs having the specified permission.
+ *
+ * @param sender_name Sender character name.
+ * @param permission The required permission to receive this message.
+ * @param message The message body.
+ *
+ * @return The amount of characters the message was delivered to.
+ */
+// The transmission of GM only Wisp/Page from server to inter-server
+static int pc_wis_message_to_gm(const char *sender_name, int permission, const char *message)
+{
+ nullpo_ret(sender_name);
+ nullpo_ret(message);
+ int mes_len = (int)strlen(message) + 1; // + null
+ int count = 0;
+
+ // information is sent to all online GM
+ map->foreachpc(pc->wis_message_to_gm_sub, permission, sender_name, message, mes_len, &count);
+
+ return count;
+}
+
+/**
+ * Helper function for pc_wis_message_to_gm().
+ */
+static int pc_wis_message_to_gm_sub(struct map_session_data *sd, va_list va)
+{
+ nullpo_ret(sd);
+
+ int permission = va_arg(va, int);
+ if (!pc_has_permission(sd, permission))
+ return 0;
+
+ const char *sender_name = va_arg(va, const char *);
+ const char *message = va_arg(va, const char *);
+ int len = va_arg(va, int);
+ int *count = va_arg(va, int *);
+
+ nullpo_ret(sender_name);
+ nullpo_ret(message);
+ nullpo_ret(count);
+
+ clif->wis_message(sd->fd, sender_name, message, len);
+ ++*count;
+ return 1;
+}
+
static void pc_update_job_and_level(struct map_session_data *sd)
{
nullpo_retv(sd);
@@ -12758,6 +12806,8 @@ void pc_defaults(void)
pc->check_supernovice_call = pc_check_supernovice_call;
pc->process_chat_message = pc_process_chat_message;
+ pc->wis_message_to_gm = pc_wis_message_to_gm;
+ pc->wis_message_to_gm_sub = pc_wis_message_to_gm_sub;
/**
* Autotrade persistency [Ind/Hercules <3]