Пример #1
0
BOOL CMDMkbuilder::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    Player* target = NULL;

    if (!args.size())
        {
            mobile->Message(MSG_ERROR,"You must specify the person that you would like to make a builder.\n");
            return false;
        }

    target=world->FindPlayer(args[0]);
    if (target==NULL)
        {
            mobile->Message(MSG_ERROR,"That person couldn't be found.");
            return false;
        }
    if (mobile == target)
        {
            mobile->Message(MSG_INFO, "You may not make yourself a builder.");
            return false;
        }
    if (BitIsSet(target->GetRank(),RANK_BUILDER))
        {
            mobile->Message(MSG_ERROR,"That person is already a builder.");
            return false;
        }

    target->SetRank(BitSet(mobile->GetRank(),RANK_BUILDER));
    target->Message(MSG_INFO,"You were made a builder.");
    mobile->Message(MSG_INFO, Capitalize(target->GetName())+" was made a builder.");
    return true;
}
Пример #2
0
BOOL CMDMkgod::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    Player* target = NULL;

    if (!args.size())
        {
            mobile->Message(MSG_ERROR,"You must specify the person that you would like to make a god.\n");
            return false;
        }

    target=world->FindPlayer(args[0]);

    if (target==mobile)
        {
            mobile->Message(MSG_ERROR,"You may not make yourself a god.");
            return false;
        }
    if (target==NULL)
        {
            mobile->Message(MSG_ERROR,"That person couldn't be found.");
            return false;
        }
    if (BitIsSet(target->GetRank(),RANK_GOD))
        {
            mobile->Message(MSG_ERROR,"That person is already a god.");
            return false;
        }

    target->SetRank(BitSet(mobile->GetRank(), RANK_PLAYTESTER|RANK_NEWBIEHELPER|RANK_BUILDER|RANK_ADMIN|RANK_GOD));
    target->Message(MSG_INFO,"You suddenly feel more godlike.");
    mobile->Message(MSG_INFO, Capitalize(target->GetName())+" has been made a god.");
    return true;
}
Пример #3
0
BOOL CMDForce::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    Player* target = NULL;
    std::string command;

    if (!args.size() || args.size() < 2)
        {
            mobile->Message(MSG_ERROR, "syntax: force <player> <command> [args]");
            return false;
        }

    target=world->FindPlayer(args[0]);
    if (target == mobile)
        {
            mobile->Message(MSG_ERROR, "Why would you need to force yourself to do that?");
            return false;
        }
    if (target == NULL)
        {
            mobile->Message(MSG_ERROR, "That player was not found.");
            return false;
        }
    if (BitIsSet(target->GetRank(),RANK_GOD))
        {
            mobile->Message(MSG_ERROR, "You probably shouldn't try to do that...");
            return false;
        }

    args.erase(args.begin());
    command = Explode(args);
    target->GetSocket()->AddCommand(command);
    return true;
}
Пример #4
0
BOOL CMDDisconnect::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    Player* target = NULL;

    if (!args.size())
        {
            mobile->Message(MSG_ERROR, "Syntax: disconnect <player>");
            return false;
        }

    target=world->FindPlayer(args[0]);
    if (!target)
        {
            mobile->Message(MSG_ERROR, "I could not find that player.");
            return false;
        }
    if (mobile == target)
        {
            mobile->Message(MSG_ERROR, "If you really want to disconnect yourself, you could just use quit.");
            return false;
        }

    if ((BitIsSet(target->GetRank(), RANK_GOD)) || (BitIsSet(target->GetRank(), RANK_ADMIN)))
        {
            mobile->Message(MSG_ERROR, "You can't disconnect that person.");
            return false;
        }

    target->GetSocket()->Kill();
    return true;
}
Пример #5
0
BOOL CMDUnsilence::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    Player* targ = NULL;
    World* world = World::GetPtr();

    if (!args.size())
        {
            mobile->Message(MSG_ERROR, "Syntax: unsilence <player>");
            return false;
        }

    targ = world->FindPlayer(args[0]);
    if (!targ)
        {
            mobile->Message(MSG_ERROR, "Could not find the specified player.");
            return false;
        }

    if (!BitIsSet(targ->GetPflag(), PF_SILENCE))
        {
            mobile->Message(MSG_INFO, "That player is not silenced.");
            return false;
        }

    targ->SetPflag(BitClear(mobile->GetPflag(), PF_SILENCE));
    mobile->Message(MSG_INFO, Capitalize(targ->GetName())+" has been unsilenced.");
    world->WriteLog(Capitalize(targ->GetName())+" was unsilenced by "+Capitalize(mobile->GetName())+".");
    targ->Message(MSG_INFO, "You were unsilenced by "+Capitalize(mobile->GetName())+".");

    return true;
}
Пример #6
0
BOOL CMDSilence::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    Player* targ = NULL;
    World* world = World::GetPtr();

    if (!args.size())
        {
            mobile->Message(MSG_ERROR, "Syntax: silence <player>");
            return false;
        }

    targ = world->FindPlayer(args[0]);
    if (!targ)
        {
            mobile->Message(MSG_ERROR, "Could not find the specified player.");
            return false;
        }
    if (targ->HasAccess(RANK_ADMIN) || targ->HasAccess(RANK_GOD))
        {
            mobile->Message(MSG_ERROR, "That player should be demoted before you try to silence them.");
            return false;
        }

    if (BitIsSet(mobile->GetPflag(), PF_SILENCE))
        {
            mobile->Message(MSG_ERROR, "That player has already been silenced.");
            return false;
        }

    targ->SetPflag(BitSet(targ->GetPflag(), PF_SILENCE));
    mobile->Message(MSG_INFO, Capitalize(targ->GetName())+" was silenced.");
    world->WriteLog(Capitalize(targ->GetName())+" was silenced by "+Capitalize(mobile->GetName())+".");
    targ->Message(MSG_ERROR, "You were silenced by "+Capitalize(mobile->GetName())+".");

    return true;
}