Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel System Expanded! #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,16 +1,5 @@
// Channel System Configuration File

chsys: (
{
/* 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. */
}
channel_config: {

/* Colors available */
colors: {
@@ -21,24 +10,112 @@ chsys: (
Cyan: "0x00b89d"
Yellow: "0xffff90"
Green: "0x28bf00"
White: "0xFFFFFF"
Purple: "0xD67FFF"
LightGreen: "0xB6FF00"
Normal: "0x00ff00"
/* Add as many colors as you'd like. */
}

/* Allow users to create their own (private) channels through @channel command? */
/* (must also allow players to use @channel in groups.conf) */
allow_user_channel_creation: true
/**
* Private channel config
* - Always CHAN_TYPE_PUBLIC
* - Always displayed in chat log as "#channel_name: <name>: <chat>"
* - ID of private channels are started from 1000
**/
private_channel: {
allow: true // (bool) Allow playerto create own channel?
color: "Default" // (string) Default color, see colors
delay: 1000 // (int) Chat delay for each member
max_member: 1000 // (int) Max member
self_notif: true // (bool) Show message when you enter or leave the channel
join_notif: false // (bool) Show message when player joined the channel
leave_notif: false // (bool) Show message when player left the channel
/* Moderation feature for channel owner, allowed to: */
ban: true // (bool) Ban player
kick: true // (bool) Kick player
color_override: false // (bool) Player allow color override for private channel
change_delay: false // (bool) Change allow to change channel dealy
}

/* "map_local_channel" is an instanced channel unique to each map. */
map_local_channel: false
map_local_channel_name: "map"
map_local_channel_color: "Yellow"
map_local_channel_autojoin: true /* Disable autojoin in specific maps through mapflag 'nomapchannelautojoin'. */
/**
* Default server channels
**/
channels: (
/**
* Structure
{
name: "#channel" // (string) Channel name
password: "" // (string) Password
alias: "[Channel]" // (string) Message from this channel will be displayed with this name instead the channel name
color: "Default" // (string) Color for this channel
type: "CHAN_TYPE_PUBLIC" // (string) Channel type: CHAN_TYPE_PUBLIC, CHAN_TYPE_ALLY, CHAN_TYPE_MAP
autojoin: false // (bool) Player will auto join channel
delay: 1000 // (int) Chat delay for each player
leave: true // (bool) Player is allowed to leave the channel
chat: true // (bool) Player is allowed to chat on this channel
color_override: false // (bool) Override channel color with personal color
self_notif: true // (bool) Show message when you enter or leave the channel
join_notif: false // (bool) Show message when player joined the channel
leave_notif: false // (bool) Show message when player left the channel
groupid: (0,..,99) // (list,int) Only player with there group ids allowed to join. Group with 'channel_admin' always can enter the channel.
/// All values above are default settings
}, // Use comma if followed by other channel
**/
{
name: "#global"
alias: "[Global]"
color: "White"
type: "CHAN_TYPE_PUBLIC"
delay: 1000
autojoin: false
leave: false
},
{
name: "#support"
alias: "[Support]"
color: "Blue"
type: "CHAN_TYPE_PUBLIC"
delay: 1000
autojoin: false
},
{
name: "#trade"
alias: "[Trade]"
color: "LightGreen"
type: "CHAN_TYPE_PUBLIC"
delay: 1000
autojoin: false
}
)

/* "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
/**
* Channel config for guild alliance
* For the structure, see the 'channels' above
**/
ally: {
name: "#ally"
alias: "[Ally]"
color: "Green"
type: "CHAN_TYPE_ALLY" // DO NOT CHANGE THIS VALUE
delay: 1000
autojoin: false
leave: true
chat: true
}

/**
* Channel config for map channel
* For the structure, see the 'channels' above
**/
map: {
name: "#map"
alias: "[Map]"
color: "Yellow"
type: "CHAN_TYPE_MAP" // DO NOT CHANGE THIS VALUE
delay: 1000
autojoin: false
leave: true
chat: true
}
}
)
@@ -119,6 +119,9 @@ help_txt: conf/help.txt
help2_txt: conf/help2.txt
charhelp_txt: conf/charhelp.txt

// Load channel config from
channel_conf: conf/channels.conf

// Maps:
import: conf/maps_athena.conf

@@ -803,6 +803,18 @@

//753-899 free

881: Cannot join channel '%s'. Reached limit of private channel %d.
882: %s %s has joined
883: You cannot leave '%s' channel.
884: %s %s left
885: Cannot set color_override for this channel '%s'.
886: Not allowed to ban a player.
887: You cannot kick player from this channel '%s'.
888: Not allowed to kick a player.
889: %s %s is kicked.
890: %s %s is banned.
891: %s %s is unbanned.

//------------------------------------
// More atcommands message
//------------------------------------
@@ -9360,5 +9360,162 @@ If <char id> is specified, the specified player is used rather than the attached

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

===========================
| Channel Commands [Cydh] |
===========================
---------------------------------------

*channel_create "<chname>","<alias>"{,"<password>"{<option>{,<delay>{,<color>{,<char_id>}}}}};

Creates public channel with <chname> as the channel name. To protect the
channel, use <password> or write "null" to create it without password.
Channel name must be started with '#' and cannot be same with map or ally
channel names.

<alias> will be used to change the channel name when the channel message
is displayed.

<option> values are:
CHAN_OPT_BASE - Default option including CHAN_OPT_ANNOUNCE_SELF|CHAN_OPT_MSG_DELAY|CHAN_OPT_CAN_CHAT|CHAN_OPT_CAN_LEAVE
CHAN_OPT_ANNOUNCE_SELF - Show info for player itself if player is joined/left the channel
CHAN_OPT_ANNOUNCE_JOIN - Display message when player is joining the channel
CHAN_OPT_ANNOUNCE_LEAVE - Display message when player is leaving the channel
CHAN_OPT_MSG_DELAY - Enable chat delay for the channel
CHAN_OPT_COLOR_OVERRIDE - Player's fontcolor will override channel's color
CHAN_OPT_CAN_CHAT - Player can chat in the channel
CHAN_OPT_CAN_LEAVE - Player can leave from the channel
CHAN_OPT_AUTOJOIN - Logged player will auto join the channel

The <delay> is chat delay in milisecond for a single player can chat again
in the same channel.

Use <color> hex code to set color for this channel, if not defined, default
channel color will be used.

If <char_id> is defined, the channel will be private channel and the player
will be the the channel owner.

Returns 1 on success.

/**
* This example will shows the message on this channel as
* [rAthena] Admin : Hello world!
* instead of
* #rathena Admin : Hello world!
**/
channel_create("#rathena","[rAthena]");
channel_create("#vip","[VIP]","vipmemberonly");

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

*channel_setopt "<chname>",<option>,<value>;

Set option for the channel. Use 1 in <value> to set it, or 0 to unset.
The <option> values are same with 'channel_create'.

For CHAN_OPT_MSG_DELAY must followed with delay in milisecond or use 0
to remove the delay at <value>.

Returns 1 on success.

// Example to set delay
channel_setopt("#global",CHAN_OPT_MSG_DELAY,5000);

Only for public and private channel.

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

*channel_setcolor "<chname>",<color>;

To change channel color.
<color> is using hex RGB value.

Returns 1 on success.

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

*channel_setpass "<chname>","<password>";

To set, unset, or change password of a channel.
Use "null" to remove the password.

Returns 1 on success.
Only for public and private channel.

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

*channel_setgroup "<chname>",<group_id>{,...,<group_id>};
*channel_setgroup2 "<chname>",<array_of_groups>;

Set group restriction for a channel. Only player with matched <group_id>
that allowed to to join the channel.

By using 0 in the first group channel, the group restriction will be
removed from the channel config.

'channel_setgroup2' receives input for group list as an array.

Returns 0 on failure, and 1 (or n groups count) on success.

// Example 1: Remove groups
channel_setgroup("#event",0);

// Example 2: Multiple values
channel_setgroup("#vip",2,5);

// Example 3: Using array
setarray .@staffs[0],2,3,4,10,99;
channel_setgroup("#staff",.@staffs);

Only for public and private channel.

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

*channel_chat "<chname>","<message>"{,<color>};

Sends message to the channel.
Returns 1 on success.

// Example if channel doesn't have alias
channel_chat(#rathena,"Hello World!"); // #rathena Hello World!

// Example if channel has alias
channel_chat(#rathena,"Hello World!"); // [rAthena] Hello World!

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

*channel_ban "<chname>",<char_id>;

Ban player from channel public or private channel.
Channel's owner and group with PC_PERM_CHANNEL_ADMIN cannot be banned.
Returns 1 on success.

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

*channel_unban "<chname>",<char_id>;

Unban player from channel public or private channel.
Returns 1 on success.

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

*channel_kick "<chname>",<char_id>;
*channel_kick "<chname>","<char_name>";

Kick player from channel public or private channel.
Channel's owner and group with PC_PERM_CHANNEL_ADMIN cannot be kicked.
Returns 1 on success.

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

*channel_delete "<chname>";

Delete existing public or private channel. Cannot delete ally or local map
channel.
Returns 0 on success.

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


Whew.
That's about all of them.
@@ -9330,7 +9330,7 @@ static inline void atcmd_channel_help(struct map_session_data *sd, const char *c
{
int fd = sd->fd;
bool can_delete = pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN);
bool can_create = (can_delete || channel_config.user_chenable);
bool can_create = (can_delete || channel_config.private_channel.allow);
clif_displaymessage(fd, msg_txt(sd,1414));// ---- Available options:

//option create
@@ -9439,6 +9439,8 @@ ACMD_FUNC(channel) {
return channel_pcunbind(sd);
} else if ( strcmpi(key,"ban") == 0 ) {
return channel_pcban(sd,sub1,sub2,0);
} else if ( strcmpi(key,"kick") == 0 ) {
return channel_pckick(sd,sub1,sub2,0);
} else if ( strcmpi(key,"banlist") == 0 ) {
return channel_pcban(sd,sub1,NULL,3);
} else if ( strcmpi(key,"unban") == 0 ) {
@@ -9449,7 +9451,7 @@ ACMD_FUNC(channel) {
char sub3[CHAN_NAME_LENGTH], sub4[CHAN_NAME_LENGTH];
sub3[0] = sub4[0] = '\0';
sscanf(sub2, "%19s %19s", sub3, sub4);
if( strcmpi(key,"create") == 0 && ( channel_config.user_chenable || pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) ) ) {
if( strcmpi(key,"create") == 0 && ( channel_config.private_channel.allow || pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) ) ) {
if (sub4[0] != '\0') {
clif_displaymessage(fd, msg_txt(sd, 1408)); // Channel password may not contain spaces.
return -1;