viewing paste topic/4700- ally.diff | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
 src/map/atcommand.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 50ec913..f92e7f9 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9361,6 +9361,34 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea
        clif->message(fd,atcmd_output);
        return true;
 }
+
+ACMD(ally) {
+       if ( !message || !*message )
+               return false;
+       else if ( sd->status.guild_id == 0 ) {
+               clif->message( fd, "You don't have a guild." );
+               return false;
+       }
+       else if ( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || sd->sc.data[SC_NOCHAT] )
+               return true;
+       else if ( battle->bc->min_chat_delay ) {
+               if ( DIFF_TICK( sd->cantalk_tick, timer->gettick() ) > 0 )
+                       return true;
+               sd->cantalk_tick = timer->gettick() + battle->bc->min_chat_delay;
+       }
+       else {
+               struct guild* g = guild->search( sd->status.guild_id );
+               int i;
+       //      sprintf( atcmd_output, "[Alliance] %s : %s", sd->status.name, message );
+               sprintf( atcmd_output, "[%s] %s : %s", g->name, sd->status.name, message );
+               guild->recv_message( sd->status.guild_id, sd->status.account_id, atcmd_output, strlen(atcmd_output) );
+               for ( i = 0; i < guild->get_alliance_count( g, 0 ); i++ )
+                       guild->recv_message( g->alliance[i].guild_id, sd->status.account_id, atcmd_output, strlen(atcmd_output) );
+               logs->chat( LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name( sd->mapindex ), sd->bl.x, sd->bl.y, NULL, message);
+       }
+       return true;
+}
+
 /**
  * Fills the reference of available commands in atcommand DBMap
  **/
@@ -9371,6 +9399,7 @@ void atcommand_basecommands(void) {
         * Command reference list, place the base of your commands here
         **/
        AtCommandInfo atcommand_base[] = {
+               ACMD_DEF(ally),
                ACMD_DEF2("warp", mapmove),
                ACMD_DEF(where),
                ACMD_DEF(jumpto),
 
Viewed 724 times, submitted by AnnieRuru.