summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorL0ne_W0lf <L0ne_W0lf@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-03-24 03:49:39 +0000
committerL0ne_W0lf <L0ne_W0lf@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-03-24 03:49:39 +0000
commitfbb2cecd2f8fbdf6fa212f157fa7d946e6751a79 (patch)
treea5a22d9704b6ea61958094dd264e60a4d8b04bcd /src/map/atcommand.c
parentcd855784481681184a9ea7b161cd9ba60ae3c872 (diff)
downloadhercules-fbb2cecd2f8fbdf6fa212f157fa7d946e6751a79.tar.gz
hercules-fbb2cecd2f8fbdf6fa212f157fa7d946e6751a79.tar.bz2
hercules-fbb2cecd2f8fbdf6fa212f157fa7d946e6751a79.tar.xz
hercules-fbb2cecd2f8fbdf6fa212f157fa7d946e6751a79.zip
* Implemented NPC_TALK (Credit to SnakeDrak and Daegaladh)
- Also added in the ability to use '@npctalkc' as a GM command. - Added supporting information to the databases. - Sneaking in a fix to the Refined Ballista. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14270 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ceb8ddb42..7424d1ab0 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6343,20 +6343,31 @@ int atcommand_cleanmap(const int fd, struct map_session_data* sd, const char* co
/*==========================================
* make a NPC/PET talk
+ * @npctalkc [SnakeDrak]
*------------------------------------------*/
int atcommand_npctalk(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
char name[NAME_LENGTH],mes[100],temp[100];
struct npc_data *nd;
+ bool ifcolor=(*(command + 8) != 'c' && *(command + 8) != 'C')?0:1;
+ unsigned long color=0;
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return -1;
- if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) {
- clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalk <npc name>, <message>).");
- return -1;
+ if(!ifcolor) {
+ if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) {
+ clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalk <npc name>, <message>).");
+ return -1;
+ }
+ }
+ else {
+ if (!message || !*message || sscanf(message, "%lx %23[^,], %99[^\n]", &color, name, mes) < 3) {
+ clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalkc <color> <npc name>, <message>).");
+ return -1;
+ }
}
if (!(nd = npc_name2id(name))) {
@@ -6366,7 +6377,9 @@ int atcommand_npctalk(const int fd, struct map_session_data* sd, const char* com
strtok(name, "#"); // discard extra name identifier if present
snprintf(temp, sizeof(temp), "%s : %s", name, mes);
- clif_message(&nd->bl, temp);
+
+ if(ifcolor) clif_messagecolor(&nd->bl,color,temp);
+ else clif_message(&nd->bl, temp);
return 0;
}
@@ -8733,6 +8746,7 @@ AtCommandInfo atcommand_info[] = {
{ "mobsearch", 10,10, atcommand_mobsearch },
{ "cleanmap", 40,40, atcommand_cleanmap },
{ "npctalk", 20,20, atcommand_npctalk },
+ { "npctalkc", 20,20, atcommand_npctalk },
{ "pettalk", 10,10, atcommand_pettalk },
{ "users", 40,40, atcommand_users },
{ "reset", 40,40, atcommand_reset },