Euphy

r17228: Channel System (replacement for @main)

Recommended Posts

Channel System

r17228 adds a system of chat channels with far greater versatility than the former @main chat. @main is now an alias for the @channel command.

All settings are located in trunk/conf/channels.conf.

Features

  • New atcommands, @join and @channel, to manipulate chat channels.

  • @join <#channel_name> {<password>}

    @channel join <#channel_name> {<password>}

    Joins the specified channel.

    ---------------------------------------

    @channel leave <#channel_name>

    Leaves the specified channel.

    ---------------------------------------

    @channel create <#channel_name> <channel_password>

    Creates a new channel.

    'allow_user_channel_creation' must be enabled in '/conf/channels.conf'.

    ---------------------------------------

    @channel delete <#channel_name>

    Destroys the specified channel.

    ---------------------------------------

    @channel list

    @channel list mine

    @channel list colors

    'list' displays a list of all public channels.

    'list mine' displays a list of channels you have joined.

    'list colors' displays a list of all available colors for custom channels.

    ---------------------------------------

    @channel setcolor <#channel_name> <color_name>

    Changes the text color of the specified channel.

    You must either be the channel's owner or have the channel_admin permission.

    ---------------------------------------

    @channel setopt <#channel_name> <option> <value>

    Sets an option and value for the specified channel.

    You must either be the channel's owner or have the channel_admin permission.

    Available options:

    -- 'JoinAnnounce <1|0>' : Toggles channel announcement when a new player enters.

    -- 'MessageDelay <0-10>' : Sets the delay (in seconds) for messages sent to the channel.

    ---------------------------------------

    @channel ban <#channel_name> <player>

    @channel unban <#channel_name> <player>

    @channel unbanall <#channel_name>

    @channel banlist <#channel_name>

    Bans or unbans a player from the specified channel.

    'unbanall' clears all bans from the channel.

    'banlist' displays a list of all players banned from the channel.

    ---------------------------------------

    @channel bindto <#channel_name>

    @channel unbind

    Binds or unbinds your global chat with the specified channel, which sends all global messages to the specified channel.

    ---------------------------------------

  • Speak in a #channel by either:
    • Sending a whisper to #channel.
    • Binding your global chat to the channel (@channel bindto <#channel_name>).
  • Set default channels, available when the server starts:
    	/* Default channels (available to all players) */
    	default_channels: {
    		/* channel_name : channel_messages_color */
    	 	main: "Yellow"
    		support: "Blue"
    		trade: "Red"
    		chat: "Default"
    		/* Add as many channels as you'd like. */
    	}
  • Automatically join local map channels (#map) and guild ally channels (#ally):
    	/* "map_local_channel" is an instanced channel unique to each map. */
    	map_local_channel: true
    	map_local_channel_name: "map"
    	map_local_channel_color: "Yellow"
    	map_local_channel_autojoin: true /* Disable autojoin in specific maps through mapflag 'nomapchannelautojoin'. */
    
    	/* "ally_channel" is a channel shared by all your guild allies. */
    	ally_channel_enabled: true
    	ally_channel_name: "ally"
    	ally_channel_color: "Green"
    	ally_channel_autojoin: true
    
    Use the 'nomapchannelautojoin' mapflag to disable auto-joining the #map channel on a map:
    <map_name>	mapflag	nomapchannelautojoin
    
  • Allow users to create private channels if 'allow_user_channel_creation' is true:
    	/* Allow users to create their own (private) channels through @channels command? */
    	/* (must also allow players to use @channels in groups.conf) */
    	allow_user_channel_creation: true
    
  • Create a list of colors to use in channels:
    	/* Colors available */
    	colors: {
    		Default: "0xffffff" /* Custom channels will use the first in the list unless a font is selected through @channel. */
    		Red: "0xff0000"
    		Blue: "0x83cfe9"
    		Orange: "0xe57c00"
    		Cyan: "0x00b89d"
    		Yellow: "0xffff90"
    		Green: "0x28bf00"
    		Normal: "0x00ff00"
    		/* Add as many channels as you'd like. */
    	}
Credits go to @Ind for the coding, and @Lighta for helping out.  Feel free to post all suggestions or reports! Edited by Euphy
  • Upvote 10

Share this post


Link to post
Share on other sites

hmm i got a problem i manually diff it working fine but when i create a Channel then try to pm the channel my mapserver crash.

Share this post


Link to post
Share on other sites

@TrojamWorm

it's your diff fault, fresh rAthena channel work's fine

Share this post


Link to post
Share on other sites

@TrojamWorm

it's your diff fault, fresh rAthena channel work's fine

sorry i already fix. but i think there's a error on @fontcolor

check it out guys try to @fontcolor <color> then try to speak with other player

Share this post


Link to post
Share on other sites

@TrojanWorm: Isn't it @channel setcolor <#channel_name> <color_name> as it is stated above?

 

Edited. Bad info. Sorry

Edited by jaBote

Share this post


Link to post
Share on other sites

@TrojamWorm and @jaBote

/* debug only, delete after */
ACMD_FUNC(fontcolor) {
...
...
}

Share this post


Link to post
Share on other sites

I'm glad you guys liked it enough to merge, however

Credits go to @Ind for the coding

this is a unfair statement, the feature's design was the joint effort from our whole team, not only me.
  • Upvote 4

Share this post


Link to post
Share on other sites

Thank you Ind, I've corrected that.

Share this post


Link to post
Share on other sites

so cool! rAthena devs are really awesome!  /ok  

Edited by paopao

Share this post


Link to post
Share on other sites

After i updated my svn, everything was fine and the main chat was working fine also.

 

But i was afk for a while, so like 20 minutes i came back and i typed a word in the #main channel, map server crashed without any error.

 

Ima try if it happens again.

 

 

another thing i figured out

 

a player who just logged in cant read the #main channel without typing some in the channel first?

Edited by Docubo

Share this post


Link to post
Share on other sites
He is right, here is debug info:

 

0x08095839 in clif_chsys_msg (channel=0xad5982b4, sd=0xa47f6020, msg=0xbf99139a "[ #trade ] normali : neviete  nahodou kto tu vyvoal po meste MVP bosov?   boli tu phonovia a je tu belzebub ") at clif.c:5538

 

5538                    WFIFOHEAD(user->fd,msg_len + 12);

 


(gdb) print user->fd

$1 = -1

 

and guess what happens after calling session[-1]->wdata_size ;)

Edited by Baalberith

Share this post


Link to post
Share on other sites

Found a problem ... look closely into map.c:

if( sd->channel_count ) {
	for( i = 0; i < sd->channel_count; i++ ) {
		if( sd->channels[i] != NULL )
			clif_chsys_left(sd->channels[i],sd);
....

 

But after calling clif_chsys_left, sd->channel_count decreases .. this leads to not leaving half of the channels on log-out.

FIx is easy:

if( sd->channel_count ) {
	unsigned char count = sd->channel_count; 
	for( i = sd->channel_count - 1; i >= 0; i-- ) {
...

 

This fix ensures we won't run into array indexing mess once more...

Share this post


Link to post
Share on other sites

errorbxl.jpg

you are from korea? O.O

Share this post


Link to post
Share on other sites

After i updated my svn, everything was fine and the main chat was working fine also.

 

But i was afk for a while, so like 20 minutes i came back and i typed a word in the #main channel, map server crashed without any error.

 

Ima try if it happens again.

 

 

another thing i figured out

 

a player who just logged in cant read the #main channel without typing some in the channel first?

same problem #main channel get crash

Share this post


Link to post
Share on other sites

so cool! rAthena devs are really awesome!  /ok  

 

The channel system came from the Hercules emulation project, not rAthena itself. It was simply a merge into the source here.

 

Question though, with the inclusion of this, with other things like @fontcolor be made available here? I know it's not an "official" feature, but it'd be pretty nifty methinks!

  • Upvote 3

Share this post


Link to post
Share on other sites

And another problem ... When player changes map server using pc_setpos, he doesn't leave channels and server crashes on first message as he was de-allocated from memory already.

Possible fix would be to move the channel leaving into unit_free() function.

Edited by Baalberith

Share this post


Link to post
Share on other sites

Great job

Share this post


Link to post
Share on other sites
[Warning]: atcommand_config_read: can not set alias for non-existent command channel (conf/atcommand_athena.conf:59)
[status]: Done reading '60' command aliases in 'conf/atcommand_athena.conf'.
[Warning]: pc_groups:read_config: non-existent command name 'channel', removing... (conf/groups.conf:130)
[Warning]: pc_groups:read_config: non-existent command name 'channel', removing... (conf/groups.conf:174)
[Warning]: pc_groups:read_config: non-existent command name 'channels', removing... (conf/groups.conf:308)
[Warning]: pc_groups:read_config: non-existent permission name 'channel_admin', removing... (conf/groups.conf:320)


but i have channel.conf

im using the latest rAthena

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...