Ejemplo n.º 1
0
BOOL CMDMkbuilder::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* target = nullptr;

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

    target=manager->FindPlayer(args[0]);
    if (target==nullptr)
    {
        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;
}
Ejemplo n.º 2
0
BOOL CMDMkwiz::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* target = nullptr;

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

    target=manager->FindPlayer(args[0]);
    if (target==mobile)
    {
        mobile->Message(MSG_ERROR,"You may not make yourself a wizard.");
        return false;
    }
    if (target==nullptr)
    {
        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 wizard.");
        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 wizardly.");
    mobile->Message(MSG_INFO, Capitalize(target->GetName())+" has been made a wizard.");
    return true;
}
Ejemplo n.º 3
0
BOOL CMDDisconnect::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* target = nullptr;

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

    target=manager->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;
}
Ejemplo n.º 4
0
BOOL CMDUnsilence::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* targ = nullptr;

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

    targ = manager->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;
}
Ejemplo n.º 5
0
BOOL CMDForce::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* target = nullptr;
    std::string command;

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

    target=manager->FindPlayer(args[0]);
    if (target == mobile)
    {
        mobile->Message(MSG_ERROR, "Why would you need to force yourself to do that?");
        return false;
    }
    if (!target)
    {
        mobile->Message(MSG_ERROR, "That player was not found.");
        return false;
    }
    if (BitIsSet(target->GetRank(),RANK_GOD) || (BitIsSet(mobile->GetRank(), RANK_ADMIN)))
    {
        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);
    mobile->Message(MSG_INFO, "You force "+Capitalize(target->GetName())+" to execute: "+command);
    return true;
}
Ejemplo n.º 6
0
BOOL CMDSilence::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* targ = nullptr;

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

    targ = manager->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, "You should not be silencing staff.");
        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;
}