Jump to content
  • 0
Sign in to follow this  
Helena

Convert this Alliance chat command to hercules?

Question

Hi Hercules,

 

I found this on the rAthena forum and was wondering if someone could convert it to Hercules? (Considering most (if not all) rAthena source doesn't work on hercules).

 

It's a ally chat system.

 

 Index: atcommand.c===================================================================--- atcommand.c	(revision 17026)+++ atcommand.c	(working copy)@@ -8699,7 +8699,33 @@	 return 0;	 #undef MC_CART_MDFY }+ACMD_FUNC( toalli ) {+	char *name = sd->status.name;+	char mes[100] = "[Alliance] : ";+	+	if( !message )+		return 0; +	if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || ( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT ) )+		return 0;++	if( battle_config.min_chat_delay ) {+		if ( DIFF_TICK( sd->cantalk_tick, gettick() ) > 0 )+			return 0;+		sd->cantalk_tick = gettick() + battle_config.min_chat_delay;+	}+	strcat( mes, name );+	strcat( mes, " : " );+	if( ( strlen( mes ) + strlen( message ) ) >= 99 ) {+		clif_displaymessage(fd, "Too long message.");+		return 0;+	}+	strcat( mes, message );++	alliance_send_message( sd, mes, strlen( mes ) );+	return 0;+}+ /**  * Fills the reference of available commands in atcommand DBMap  **/@@ -8955,7 +8981,8 @@		 ACMD_DEF2("rmvperm", addperm),		 ACMD_DEF(unloadnpcfile),		 ACMD_DEF(cart),-		ACMD_DEF(mount2)+		ACMD_DEF(mount2),+		ACMD_DEF(toalli)	 };	 AtCommandInfo* atcommand;	 int i;Index: guild.c===================================================================--- guild.c	(revision 17026)+++ guild.c	(working copy)@@ -1332,6 +1332,29 @@	 return c; } +/*====================================================+ * alliance_send_message por: Zephyr (brAthena)+ *---------------------------------------------------*/+int alliance_send_message( struct map_session_data *sd, const char *mes, int len ) {+	int i;+	unsigned char *buf = (unsigned char*)aMalloc((16 + len)*sizeof(unsigned char));+	struct guild* g;+	nullpo_ret(sd);+	if( !sd->status.guild_id )+		return 0;+	g = guild_search( sd->status.guild_id );+	if( g ) {+		//clif_guild_message(g, sd->status.account_id, mes, len);+		guild_recv_message( g->guild_id, sd->status.account_id, mes, len );+		for( i = 0; i < guild_get_alliance_count( g, 0 ); i ++ ) {+			//intif_guild_message( g->alliance[i].guild_id, sd->status.account_id, mes, len );+			guild_recv_message( g->alliance[i].guild_id, sd->status.account_id, mes, len );+		}+		log_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, mes );+	}+	return 0;+}+ // Blocks all guild skills which have a common delay time. void guild_block_skill(struct map_session_data *sd, int time) {Index: guild.h===================================================================--- guild.h	(revision 17026)+++ guild.h	(working copy)@@ -82,6 +82,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data); int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data); int guild_send_message(struct map_session_data *sd,const char *mes,int len);+int alliance_send_message(struct map_session_data *sd,const char *mes,int len); // alliance_send_message por: Zephyr (brAthena) int guild_recv_message(int guild_id,int account_id,const char *mes,int len); int guild_send_dot_remove(struct map_session_data *sd); int guild_skillupack(int guild_id,int skill_num,int account_id); 
Edited by AnnieRuru
use [code] when the script > 10 lines

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

 

http://herc.ws/board/topic/4700-guild-alliance-chat-ally/

 

I honestly think this code is very easy, but wonder why he wants to make another function for it ...

I already optimized it

Plugins please   ^_^

It was released as a plugin ;3 http://herc.ws/board/topic/4700-guild-alliance-chat-ally/

Share this post


Link to post
Share on other sites
  • 0

Hmm isn't there's already a #ally channel in Hercules?

WOOOOAAAAHHHHH !!!

*go dig a hole and hides*

 

blame myself for never play with channel system .....

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.