//===== Hercules Plugin ====================================== //= Ally - Atcommand //===== By: ================================================== //= Original by Zephir from brAthena //= Convert by AnnieRuru //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= Hercules 2014-03-03 //===== Description: ========================================= //= able to send a message to guild alliance //===== Topic ================================================ //= http://hercules.ws/board/topic/4700- //===== Additional Comments: ================================= //= nothing special about this mod ... but might be famous ? //============================================================ #include #include #include #include "../common/HPMi.h" #include "../common/strlib.h" #include "../map/pc.h" #include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time) HPExport struct hplugin_info pinfo = { "ally", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "1.0", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated) }; 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; char atcmd_output[CHAT_SIZE_MAX]; // safesnprintf( atcmd_output, CHAT_SIZE_MAX, "[Alliance] %s : %s", sd->status.name, message ); safesnprintf( atcmd_output, CHAT_SIZE_MAX, "[%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; } HPExport void plugin_init (void) { atcommand = GET_SYMBOL("atcommand"); clif = GET_SYMBOL("clif"); battle = GET_SYMBOL("battle"); mapindex = GET_SYMBOL("mapindex"); timer = GET_SYMBOL("timer"); guild = GET_SYMBOL("guild"); logs = GET_SYMBOL("logs"); strlib = GET_SYMBOL("strlib"); addAtcommand("ally",ally); }