/summon <player> #42

Open
opened 2014-07-04 18:13:12 -06:00 by RElesgoe · 4 comments
RElesgoe commented 2014-07-04 18:13:12 -06:00 (Migrated from github.com)
static int _handle_summon_command(t_connection * c, char const *text)
{
    t_channel * channel;
    t_connection *  user;

    std::vector<std::string> args = split_command(text, 1);

    if (args[1].empty())
    {
        describe_command(c, args[0].c_str());
        return 0;
    }
    text = args[1].c_str(); // player to be summoned

    if (!accountlist_find_account(text))
    {
        message_send_text(c, message_type_error, c, localize(c, "Account {} does not exist.", text));
        return 0;
    }

    if (user = connlist_find_connection_by_accountname(text))
    {
        message_send_text(c, message_type_error, c, localize(c, "{} is not online.", text));
        return 0;
    }

    if (channel = conn_get_channel(user))
    {
        if (strcasecmp(channel_get_name(conn_get_channel(c)), channel_get_name(channel)) == 0)
        {
            message_send_text(c, message_type_info, c, localize(c, "{} is already in the same channel as you.", text));
            return 0;
        }

        conn_set_channel(user, channel_get_name(conn_get_channel(c)))

        if ((conn_get_clienttag(user) == CLIENTTAG_WARCRAFT3_UINT) || (conn_get_clienttag(user) == CLIENTTAG_WAR3XP_UINT))
            conn_update_w3_playerinfo(user);
        command_set_flags(user);

        message_send_text(c, message_type_info, c, localize(c, "{} has been summoned.", text));
    }
    else
    {
        message_send_text(c, message_type_error, c, localize(c, "{} is currently in a game.", text));
    }

    return 0;
}

Summons <player> to the same channel as you. This code is untested

``` C++ static int _handle_summon_command(t_connection * c, char const *text) { t_channel * channel; t_connection * user; std::vector<std::string> args = split_command(text, 1); if (args[1].empty()) { describe_command(c, args[0].c_str()); return 0; } text = args[1].c_str(); // player to be summoned if (!accountlist_find_account(text)) { message_send_text(c, message_type_error, c, localize(c, "Account {} does not exist.", text)); return 0; } if (user = connlist_find_connection_by_accountname(text)) { message_send_text(c, message_type_error, c, localize(c, "{} is not online.", text)); return 0; } if (channel = conn_get_channel(user)) { if (strcasecmp(channel_get_name(conn_get_channel(c)), channel_get_name(channel)) == 0) { message_send_text(c, message_type_info, c, localize(c, "{} is already in the same channel as you.", text)); return 0; } conn_set_channel(user, channel_get_name(conn_get_channel(c))) if ((conn_get_clienttag(user) == CLIENTTAG_WARCRAFT3_UINT) || (conn_get_clienttag(user) == CLIENTTAG_WAR3XP_UINT)) conn_update_w3_playerinfo(user); command_set_flags(user); message_send_text(c, message_type_info, c, localize(c, "{} has been summoned.", text)); } else { message_send_text(c, message_type_error, c, localize(c, "{} is currently in a game.", text)); } return 0; } ``` Summons `<player>` to the same channel as you. This code is untested
cen1 commented 2014-07-04 18:27:52 -06:00 (Migrated from github.com)

This seems potentially dangerous and abusable. Is it supposed to be under higher CGs?

This seems potentially dangerous and abusable. Is it supposed to be under higher CGs?
RElesgoe commented 2014-07-04 18:28:39 -06:00 (Migrated from github.com)

Yeah, those with higher CGs should be able to use it, not regular players

Yeah, those with higher CGs should be able to use it, not regular players
HarpyWar commented 2014-07-05 14:26:21 -06:00 (Migrated from github.com)

May be add this command and allow it for all users, but destination user must confirm it by writing /summon yes (the same syntax for /clan command when invite user into a clan)

May be add this command and allow it for all users, but destination user must confirm it by writing `/summon yes` (the same syntax for `/clan` command when invite user into a clan)
RElesgoe commented 2014-07-12 19:04:35 -06:00 (Migrated from github.com)

@HarpyWar I disagree, if a player wants another player to come to the same channel, he can just /whisper the other player to come and if the other player wants to accept the request, he just types /j <channel>.

@HarpyWar I disagree, if a player wants another player to come to the same channel, he can just `/whisper` the other player to come and if the other player wants to accept the request, he just types `/j <channel>`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Techwizz/pvpgn-server#42
No description provided.