• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PSendSysMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PSendSysMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ PSendSysMessage函数的具体用法?C++ PSendSysMessage怎么用?C++ PSendSysMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PSendSysMessage函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PSendSysMessage

bool ChatHandler::HandleServerRevCommand(const char* /*args*/)
{
    PSendSysMessage(_REVISION);
    return true;
}
开发者ID:Suwai,项目名称:SunfireCore,代码行数:5,代码来源:Level0.cpp


示例2: PSendSysMessage

/// Display the 'Message of the day' for the realm
bool ChatHandler::HandleServerMotdCommand(char* /*args*/)
{
    PSendSysMessage(LANG_MOTD_CURRENT, sWorld.GetMotd());
    return true;
}
开发者ID:Blutban,项目名称:OneServer,代码行数:6,代码来源:Level0.cpp


示例3: getSelectedCreature

bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
{
    Player *player = m_session->GetPlayer();
    Creature *creatureTarget = getSelectedCreature();

    if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
    {
        PSendSysMessage(LANG_SELECT_CREATURE);
        SetSentErrorMessage(true);
        return false;
    }

    CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
    // Creatures with family 0 crashes the server
    if (cInfo->family == 0)
    {
        PSendSysMessage("This creature cannot be tamed. (family id: 0).");
        SetSentErrorMessage(true);
        return false;
    }

    if (player->GetPetGUID())
    {
        PSendSysMessage("You already have a pet");
        SetSentErrorMessage(true);
        return false;
    }

    // Everything looks OK, create new pet
    Pet* pet = new Pet(player, HUNTER_PET);

    if (!pet)
      return false;

    if (!pet->CreateBaseAtCreature(creatureTarget))
    {
        delete pet;
        PSendSysMessage("Error 1");
        return false;
    }

    creatureTarget->setDeathState(JUST_DIED);
    creatureTarget->RemoveCorpse();
    creatureTarget->SetHealth(0); // just for nice GM-mode view

    pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
    pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());

    if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
    {
        sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
        PSendSysMessage("Error 2");
        delete pet;
        return false;
    }

    // prepare visual effect for levelup
    pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);

    pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
    // this enables pet details window (Shift+P)
    pet->InitPetCreateSpells();
    pet->SetFullHealth();

    pet->GetMap()->Add(pet->ToCreature());

    // visual effect for levelup
    pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());

    player->SetMinion(pet, true);
    pet->SavePetToDB(PET_SAVE_AS_CURRENT);
    player->PetSpellInitialize();

    return true;
}
开发者ID:Bootz,项目名称:Singularity,代码行数:75,代码来源:Level2.cpp


示例4: extractOptFirstArg

//mute player for some times
bool ChatHandler::HandleMuteCommand(const char* args)
{
    std::string announce;
    char* nameStr;
    char* delayStr;
    extractOptFirstArg((char*)args, &nameStr, &delayStr);
    if (!delayStr)
        return false;

    char *mutereason = strtok(NULL, "\r");
    std::string mutereasonstr = "No reason";
    if (mutereason != NULL)
         mutereasonstr = mutereason;

    if(!mutereason)
    {
        PSendSysMessage("You must enter a reason of mute");
        SetSentErrorMessage(true);
        return false;
    }
	
    Player* target;
    uint64 target_guid;
    std::string target_name;
    if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
        return false;

    uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);

    // find only player from same account if any
    if (!target)
        if (WorldSession* session = sWorld->FindSession(accountId))
            target = session->GetPlayer();

    uint32 notspeaktime = (uint32) atoi(delayStr);

    // must have strong lesser security level
    if (HasLowerSecurity (target, target_guid, true))
        return false;

    PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);

    if (target)
    {
        // Target is online, mute will be in effect right away.
        int64 muteTime = time(NULL) + notspeaktime * MINUTE;
        target->GetSession()->m_muteTime = muteTime;

        stmt->setInt64(0, muteTime);

        ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str());
    }
    else
    {
        // Target is offline, mute will be in effect starting from the next login.
        int32 muteTime = -int32(notspeaktime * MINUTE);

        stmt->setInt64(0, muteTime);
    }

    stmt->setUInt32(1, accountId);

    LoginDatabase.Execute(stmt);

    std::string nameLink = playerLink(target_name);

    PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notspeaktime, mutereasonstr.c_str());

    announce = "The character '";
    announce += nameStr;
    announce += "' was muted for ";
    announce += delayStr;
    announce += " minutes by the character '";
    announce += m_session->GetPlayerName();
    announce += "'. The reason is: ";
    announce += mutereason;
    HandleAnnounceCommand(announce.c_str());

    return true;
}
开发者ID:TestCore,项目名称:ProjectRisingDarkness,代码行数:81,代码来源:Level2.cpp


示例5: strtok

bool ChatHandler::HandleBanAutoCommand(char *args)
{
    if (!*args)
        return false;

    char* cname = strtok ((char*)args, " ");
    if (!cname)
        return false;

    std::string name = cname;

    char* creason = strtok (NULL,"");
    std::string banreason = creason ? creason : "";


    QueryResult *result;
    Field *fields;

    result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'",name.c_str());
    if(!result)
    {
        PSendSysMessage(LANG_BAN_NOTFOUND,"character",name.c_str());
        return true;
    }
    fields = result->Fetch();
    uint32 accId = fields->GetUInt32();
    delete result;

    std::string oldreason;
    uint32 bandate, unbandate;
    int32 bandiff;
    uint32 max_banid = 0;
    uint32 counted_extra_bans = 0;
    result = LoginDatabase.PQuery("SELECT bandate,unbandate,banreason FROM account_banned WHERE id=%u", accId);
    if(result)
    {
        do
        {
            fields = result->Fetch();
            bandate = fields[0].GetUInt32();
            unbandate = fields[1].GetUInt32();
            oldreason = fields[2].GetCppString();
            bandiff = unbandate - bandate;
            if(oldreason.size() > 10 && oldreason.substr(0,10) == "[AutoBan #")
            {
                uint32 banid = atoi(oldreason.c_str() + 10);
                max_banid = std::max(max_banid, banid);
            }
            else if(bandiff >= (int32)sWorld.getConfig(CONFIG_UINT32_AUTOBAN_MIN_COUNTED_BANTIME) || bandiff == 0)
            {
                ++counted_extra_bans;
            }
        }
        while (result->NextRow());
        delete result;
    }
    max_banid = std::max(max_banid, counted_extra_bans);
    std::string duration = sWorld.GetAutoBanTime(max_banid);
    std::stringstream reason;
    reason << "[AutoBan #" << (max_banid + 1) << "; " << duration << "] " << banreason;
    uint32 duration_secs = TimeStringToSecs(duration);

    switch(sWorld.BanAccount(BAN_CHARACTER, name, duration_secs, reason.str().c_str(), m_session ? m_session->GetPlayerName() : ""))
    {
    case BAN_SUCCESS:
        if(atoi(duration.c_str())>0)
            PSendSysMessage(LANG_BAN_YOUBANNED,name.c_str(),secsToTimeString(TimeStringToSecs(duration),true).c_str(),reason.str().c_str());
        else
            PSendSysMessage(LANG_BAN_YOUPERMBANNED,name.c_str(),reason.str().c_str());
        break;
    case BAN_SYNTAX_ERROR:
        return false;
    case BAN_NOTFOUND:
        PSendSysMessage(LANG_BAN_NOTFOUND,"character",name.c_str());
        SetSentErrorMessage(true);
        return false;
    }

    return true;
}
开发者ID:lauwdude,项目名称:mangos,代码行数:80,代码来源:Level_pe.cpp


示例6: PSendSysMessage

bool ChatHandler::HandlePlayerbotCommand(char* args)
{
    if (sWorld.getConfig(CONFIG_BOOL_PLAYERBOT_DISABLE))
    {
        PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
        SetSentErrorMessage(true);
        return false;
    }

    if (!m_session)
    {
        PSendSysMessage("|cffff0000You may only add bots from an active session");
        SetSentErrorMessage(true);
        return false;
    }

    if (!*args)
    {
        PSendSysMessage("|cffff0000usage: add PLAYERNAME  or  remove PLAYERNAME");
        SetSentErrorMessage(true);
        return false;
    }

    char *cmd = strtok ((char *) args, " ");
    char *charname = strtok (NULL, " ");
    if (!cmd || !charname)
    {
        PSendSysMessage("|cffff0000usage: add PLAYERNAME  or  remove PLAYERNAME");
        SetSentErrorMessage(true);
        return false;
    }

    std::string cmdStr = cmd;
    std::string charnameStr = charname;

    if (!normalizePlayerName(charnameStr))
        return false;

    uint64 guid = sObjectMgr.GetPlayerGUIDByName(charnameStr.c_str());
    if (guid == 0 || (guid == m_session->GetPlayer()->GetGUID()))
    {
        SendSysMessage(LANG_PLAYER_NOT_FOUND);
        SetSentErrorMessage(true);
        return false;
    }

    uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid);
    if (accountId != m_session->GetAccountId())
    {
        PSendSysMessage("|cffff0000You may only add bots from the same account.");
        SetSentErrorMessage(true);
        return false;
    }

    // create the playerbot manager if it doesn't already exist
    PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
    if (!mgr)
    {
        mgr = new PlayerbotMgr(m_session->GetPlayer());
        m_session->GetPlayer()->SetPlayerbotMgr(mgr);
    }

    QueryResult *resultchar = CharacterDatabase.PQuery("SELECT COUNT(*) FROM characters WHERE online = '1' AND account = '%u'", m_session->GetAccountId());
    if (resultchar)
    {
        Field *fields = resultchar->Fetch();
        int acctcharcount = fields[0].GetUInt32();
        int maxnum = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_MAXBOTS);
        if (!(m_session->GetSecurity() > SEC_PLAYER))
            if (acctcharcount > maxnum && (cmdStr == "add" || cmdStr == "login"))
            {
                PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)", maxnum);
                SetSentErrorMessage(true);
                delete resultchar;
                return false;
            }
    }
    delete resultchar;

    QueryResult *resultlvl = CharacterDatabase.PQuery("SELECT level,name FROM characters WHERE guid = '%lu'", guid);
    if (resultlvl)
    {
        Field *fields = resultlvl->Fetch();
        int charlvl = fields[0].GetUInt32();
        int maxlvl = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_RESTRICTLEVEL);
        if (!(m_session->GetSecurity() > SEC_PLAYER))
            if (charlvl > maxlvl)
            {
                PSendSysMessage("|cffff0000You cannot summon |cffffffff[%s]|cffff0000, it's level is too high.(Current Max:lvl |cffffffff%u)", fields[1].GetString(), maxlvl);
                SetSentErrorMessage(true);
                delete resultlvl;
                return false;
            }
    }
    delete resultlvl;
    // end of gmconfig patch
    if (cmdStr == "add" || cmdStr == "login")
    {
        if (mgr->GetPlayerBot(guid))
        {
//.........这里部分代码省略.........
开发者ID:bobthezealot,项目名称:mangos,代码行数:101,代码来源:PlayerbotMgr.cpp


示例7: PSendSysMessage

bool ChatHandler::HandlePlayerbotCommand(char* args)
{
    if (!(m_session->GetSecurity() > SEC_PLAYER))
        if (botConfig.GetBoolDefault("PlayerbotAI.DisableBots", false))
        {
            PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
            SetSentErrorMessage(true);
            return false;
        }

    if (!m_session)
    {
        PSendSysMessage("|cffff0000You may only add bots from an active session");
        SetSentErrorMessage(true);
        return false;
    }

    if (!*args)
    {
        PSendSysMessage("|cffff0000usage: add PLAYERNAME  or  remove PLAYERNAME");
        SetSentErrorMessage(true);
        return false;
    }

    char* cmd = strtok((char*) args, " ");
    char* charname = strtok(nullptr, " ");

    if (!cmd || !charname)
    {
        PSendSysMessage("|cffff0000usage: add PLAYERNAME  or  remove PLAYERNAME");
        SetSentErrorMessage(true);
        return false;
    }

    std::string cmdStr = cmd;
    std::string charnameStr = charname;

    if (!normalizePlayerName(charnameStr))
        return false;

    ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(charnameStr.c_str());
    if (guid == ObjectGuid() || (guid == m_session->GetPlayer()->GetObjectGuid()))
    {
        SendSysMessage(LANG_PLAYER_NOT_FOUND);
        SetSentErrorMessage(true);
        return false;
    }

    uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid);
    if (accountId != m_session->GetAccountId())
    {
        PSendSysMessage("|cffff0000You may only add bots from the same account.");
        SetSentErrorMessage(true);
        return false;
    }

    // create the playerbot manager if it doesn't already exist
    PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
    if (!mgr)
    {
        mgr = new PlayerbotMgr(m_session->GetPlayer());
        m_session->GetPlayer()->SetPlayerbotMgr(mgr);
    }

    QueryResult* resultchar = CharacterDatabase.PQuery("SELECT COUNT(*) FROM characters WHERE online = '1' AND account = '%u'", m_session->GetAccountId());
    if (resultchar)
    {
        Field* fields = resultchar->Fetch();
        int acctcharcount = fields[0].GetUInt32();
        int maxnum = botConfig.GetIntDefault("PlayerbotAI.MaxNumBots", 9);
        if (!(m_session->GetSecurity() > SEC_PLAYER))
            if (acctcharcount > maxnum && (cmdStr == "add" || cmdStr == "login"))
            {
                PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)", maxnum);
                SetSentErrorMessage(true);
                delete resultchar;
                return false;
            }
        delete resultchar;
    }

    QueryResult* resultlvl = CharacterDatabase.PQuery("SELECT level,name FROM characters WHERE guid = '%u'", guid.GetCounter());
    if (resultlvl)
    {
        Field* fields = resultlvl->Fetch();
        int charlvl = fields[0].GetUInt32();
        int maxlvl = botConfig.GetIntDefault("PlayerbotAI.RestrictBotLevel", 60);
        if (!(m_session->GetSecurity() > SEC_PLAYER))
            if (charlvl > maxlvl)
            {
                PSendSysMessage("|cffff0000You cannot summon |cffffffff[%s]|cffff0000, it's level is too high.(Current Max:lvl |cffffffff%u)", fields[1].GetString(), maxlvl);
                SetSentErrorMessage(true);
                delete resultlvl;
                return false;
            }
        delete resultlvl;
    }

    // end of gmconfig patch
    if (cmdStr == "add" || cmdStr == "login")
//.........这里部分代码省略.........
开发者ID:keyshuwen,项目名称:mangos-classic,代码行数:101,代码来源:PlayerbotMgr.cpp


示例8: GetAccessLevel

bool ChatHandler::HandleAccountCommand(const char* /*args*/)
{
    AccountTypes gmlevel = GetAccessLevel();
    PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
    return true;
}
开发者ID:BuloZB,项目名称:Valhalla-Project,代码行数:6,代码来源:Level0.cpp


示例9: secsToTimeString

bool ChatHandler::HandleServerUptimeCommand(const char* /*args*/)
{
    std::string str = secsToTimeString(sWorld.GetUptime());
    PSendSysMessage("%s", str.c_str());
    return true;
}
开发者ID:Suwai,项目名称:SunfireCore,代码行数:6,代码来源:Level0.cpp


示例10: pname_esc

bool ChatHandler::HandlePunishCommand(char *args)
{
    Player *plr = NULL;
    std::string pname;
    uint64 plr_guid = 0;
    uint32 accid = 0;
    if(!ExtractPlayerTarget(&args, &plr, NULL, &pname))
        return false;

    if(plr)
        accid = plr->GetSession()->GetAccountId();
    else
    {
        std::string pname_esc(pname);
        CharacterDatabase.escape_string(pname_esc);
        QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", pname_esc.c_str());
        if(!result)
        {
            SendSysMessage(LANG_PLAYER_NOT_FOUND);
            SetSentErrorMessage(true);
            return false;
        }
        Field *fields = result->Fetch();
        accid = fields[0].GetUInt32();
        delete result;
    }

    // extra check, not sure if really necessary, but we better be on the safe side!
    if(!accid)
    {
        SendSysMessage(LANG_PLAYER_NOT_FOUND);
        SetSentErrorMessage(true);
        return false;
    }

    // find only player from same account if any
    if (!plr)
    {
        if (WorldSession* session = sWorld.FindSession(accid))
        {
            plr = session->GetPlayer();
            pname = plr->GetName();
        }
    }

    char *what = ExtractArg(&args);
    char *reason = ExtractArg(&args);

    std::string strWhat(what ? what : "");

    bool handled = sPunishMgr.Handle(accid, plr, m_session->GetPlayer(), pname, strWhat, reason ? reason : GetMangosString(LANG_NO_REASON_GIVEN));

    if(!handled)
    {
        PSendSysMessage(LANG_NO_RECORD_IN_DB, strWhat.c_str());
        SetSentErrorMessage(true);
        return false;
    }

    return true;
}
开发者ID:lauwdude,项目名称:mangos,代码行数:61,代码来源:Level_pe.cpp


示例11: atoi

bool ChatHandler::HandleTargetAndDeleteObjectCommand(char *args)
{

    QueryResult *result;

    if(*args)
    {
        int32 id = atoi((char*)args);
        if(id)
            result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` FROM `gameobject` WHERE `map` = %i AND `id` = '%u' ORDER BY `order` ASC LIMIT 1", m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),id);
        else
            result = WorldDatabase.PQuery(
            "SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` "
            "FROM `gameobject`,`gameobject_template` WHERE `gameobject_template`.`entry` = `gameobject`.`id` AND `map` = %i AND `name` LIKE '%%%s%%' ORDER BY `order` ASC LIMIT 1",
            m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),args);
    }
    else
        result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) as `order` FROM `gameobject` WHERE `map` = %i ORDER BY `order` ASC LIMIT 1", m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId());

    if (!result)
    {
        SendSysMessage("Nothing found!");
        return true;
    }

    Field *fields = result->Fetch();
    uint32 guid = fields[0].GetUInt32();
    uint32 id = fields[1].GetUInt32();
    float x = fields[2].GetFloat();
    float y = fields[3].GetFloat();
    float z = fields[4].GetFloat();
    float o = fields[5].GetFloat();
    int mapid = fields[6].GetUInt16();
    delete result;

    const GameObjectInfo *goI = sObjectMgr.GetGameObjectInfo(id);

    if (!goI)
    {
        PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id);
        return false;
    }

    GameObject* obj = m_session->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, guid, id));

    if(!obj)
    {
        PSendSysMessage("Game Object (GUID: %u) not found", GUID_LOPART(guid));
        return true;
    }

    uint64 owner_guid = obj->GetOwnerGUID();
    if(owner_guid)
    {
        Unit* owner = ObjectAccessor::Instance().GetUnit(*m_session->GetPlayer(),owner_guid);
        if(!owner && GUID_HIPART(owner_guid)!=HIGHGUID_PLAYER)
        {
            PSendSysMessage("Game Object (GUID: %u) have references in not found creature %u GO list, can't be deleted.", GUID_LOPART(owner_guid), obj->GetGUIDLow());
            return true;
        }

        owner->RemoveGameObject(obj,false);
    }

    obj->Delete();
    obj->DeleteFromDB();

    PSendSysMessage("Game Object (GUID: %u) [%s] removed", obj->GetGUIDLow(),goI->name);

    return true;
}
开发者ID:lauwdude,项目名称:mangos,代码行数:71,代码来源:Level_pe.cpp


示例12: strtok

bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
{
    if (!*args)
        return false;

    char* tguid = strtok((char*)args, " ");
    uint64 ticketGuid = atoi(tguid);
    char* targetgm = strtok(NULL, " ");

    if (!targetgm)
        return false;

    std::string targm = targetgm;
    if (!normalizePlayerName(targm))
        return false;

    Player *cplr = m_session->GetPlayer();
    GM_Ticket *ticket = sTicketMgr->GetGMTicket(ticketGuid);

    if (!ticket || ticket->closed != 0)
    {
        SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
        return true;
    }

    uint64 tarGUID = sObjectMgr->GetPlayerGUIDByName(targm.c_str());
    uint64 accid = sObjectMgr->GetPlayerAccountIdByGUID(tarGUID);
    uint32 gmlevel = sAccountMgr->GetSecurity(accid, realmID);

    if (!tarGUID || gmlevel == SEC_PLAYER)
    {
        SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
        return true;
    }

    if (ticket->assignedToGM == tarGUID)
    {
        PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid);
        return true;
    }

    std::string gmname;
    sObjectMgr->GetPlayerNameByGUID(tarGUID, gmname);
    if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID())
    {
        PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str());
        return true;
    }

    ticket->assignedToGM = tarGUID;

    if (gmlevel == SEC_ADMINISTRATOR && ticket->escalated == TICKET_IN_ESCALATION_QUEUE)
        ticket->escalated = TICKET_ESCALATED_ASSIGNED;
    else if (ticket->escalated == TICKET_UNASSIGNED)
        ticket->escalated = TICKET_ASSIGNED;

    sTicketMgr->AddOrUpdateGMTicket(*ticket);

    std::stringstream ss;
    ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid);
    ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str());
    ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str());
    SendGlobalGMSysMessage(ss.str().c_str());

    sTicketMgr->UpdateLastChange();
    return true;
}
开发者ID:dsstest,项目名称:ArkCORE,代码行数:67,代码来源:TicketCommands.cpp


示例13: playerLink

bool ChatHandler::HandlePartyInfoCommand(const char* args)
{
    Player* target;
    uint64 target_guid;
    std::string target_name;
    if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
        return false;

    uint32 accId = 0;
    std::string username = "";
    std::string status = "";
    uint32 security = 0;

    // get additional information from Player object
    if (target)
    {
        std::string nameLink = playerLink(target_name);
        if (Group *grp = target->GetGroup())
        {
            if (grp->isRaidGroup())
                SendSysMessage("----------------Raid Group----------------");
            else if (grp->isBGGroup())
                SendSysMessage("----------------BG Group-----------------");
            else if (grp->isLFGGroup())
                SendSysMessage("----------------LFG Group----------------");
            else
                SendSysMessage("------------------Group------------------");

            for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
            {
                Player *pl = itr->getSource();

                if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
                    continue;

                accId = pl->GetSession()->GetAccountId();
                nameLink = playerLink(pl->GetName());

                QueryResult result = LoginDatabase.PQuery("SELECT aa.gmlevel, a.username "
                                                            "FROM account a "
                                                            "LEFT JOIN account_access aa "
                                                            "ON (a.id = aa.id) "
                                                            "WHERE a.id = '%u'",accId);
                if (result)
                {
                    Field* fields = result->Fetch();
                    security = fields[0].GetUInt32();
                    username = fields[1].GetString();
                }

                if (grp->IsLeader(pl->GetGUID()))
                {
                    status = "[Leader]";
                }
                else if (grp->IsAssistant(pl->GetGUID()))
                {
                    status = "[Assistant]";
                }

                PSendSysMessage(LANG_PARTYINFO_PLAYER, (pl?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), username.c_str(), accId, security, status.c_str());
            }
            SendSysMessage("----------------------------------------");
        }
        else
        {
            PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
            SetSentErrorMessage(true);
            return false;
        }

    }

    return true;
}
开发者ID:Deviuss,项目名称:TrinityCore,代码行数:74,代码来源:Level2.cpp


示例14: PSendSysMessage

// Delete a user account and all associated characters in this realm
// todo - This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
bool ChatHandler::HandleAccountDeleteCommand(const char* args)
{
    if (!*args)
        return false;

    ///- Get the account name from the command line
    char *account_name_str=strtok ((char*)args," ");
    if (!account_name_str)
        return false;

    std::string account_name = account_name_str;
    if (!AccountMgr::normalizeString(account_name))
    {
        PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
        SetSentErrorMessage(true);
        return false;
    }

    uint32 account_id = accmgr.GetId(account_name);
    if (!account_id)
    {
        PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
        SetSentErrorMessage(true);
        return false;
    }

    // Commands not recommended call from chat, but support anyway
    if (m_session)
    {
        uint32 targetSecurity = accmgr.GetSecurity(account_id);

        // can delete only for account with less security
        // This is also reject self apply in fact
        if (targetSecurity >= m_session->GetSecurity())
        {
            SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);
            SetSentErrorMessage (true);
            return false;
        }
    }

    AccountOpResult result = accmgr.DeleteAccount(account_id);
    switch(result)
    {
    case AOR_OK:
        PSendSysMessage(LANG_ACCOUNT_DELETED,account_name.c_str());
        break;
    case AOR_NAME_NOT_EXIST:
        PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
        SetSentErrorMessage(true);
        return false;
    case AOR_DB_INTERNAL_ERROR:
        PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR,account_name.c_str());
        SetSentErrorMessage(true);
        return false;
    default:
        PSendSysMessage(LANG_ACCOUNT_NOT_DELETED,account_name.c_str());
        SetSentErrorMessage(true);
        return false;
    }

    return true;
}
开发者ID:romseguy,项目名称:Trinitycore_Azshara_2.4.3,代码行数:65,代码来源:CliRunnable.cpp


示例15: PSendSysMessage

bool ChatHandler::HandleAcctCommand(const char* args)
{
    uint32 gmlevel = m_session->GetSecurity();
    PSendSysMessage(LANG_ACCOUNT_LEVEL, gmlevel);
    return true;
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:6,代码来源:Level0.cpp


示例16: PSendSysMessage

bool ChatHandler::HandleAccountCommand(const char* /*args*/)
{
    AccountTypes gmlevel = m_session->GetSecurity();
    PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
    return true;
}
开发者ID:AztiIluna,项目名称:mangos,代码行数:6,代码来源:Level0.cpp


示例17: GUID_LOPART

//show info of player
bool ChatHandler::HandlePInfoCommand(const char* args)
{
    Player* target;
    uint64 target_guid;
    std::string target_name;
    if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
        return false;

    uint32 accId = 0;
    uint32 money = 0;
    uint32 total_player_time = 0;
    uint8 level = 0;
    uint32 latency = 0;
    uint8 race;
    uint8 Class;
    int64 muteTime = 0;
    int64 banTime = -1;

    // get additional information from Player object
    if (target)
    {
        // check online security
        if (HasLowerSecurity(target, 0))
            return false;

        accId = target->GetSession()->GetAccountId();
        money = target->GetMoney();
        total_player_time = target->GetTotalPlayedTime();
        level = target->getLevel();
        latency = target->GetSession()->GetLatency();
        race = target->getRace();
        Class = target->getClass();
        muteTime = target->GetSession()->m_muteTime;
    }
    // get additional information from DB
    else
    {
        // check offline security
        if (HasLowerSecurity(NULL, target_guid))
            return false;

        //                                                     0          1      2      3        4     5
        QueryResult result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid));
        if (!result)
            return false;

        Field *fields = result->Fetch();
        total_player_time = fields[0].GetUInt32();
        level = fields[1].GetUInt32();
        money = fields[2].GetUInt32();
        accId = fields[3].GetUInt32();
        race = fields[4].GetUInt8();
        Class = fields[5].GetUInt8();
    }

    std::string username = GetSingularityString(LANG_ERROR);
    std::string email = GetSingularityString(LANG_ERROR);
    std::string last_ip = GetSingularityString(LANG_ERROR);
    uint32 security = 0;
    std::string last_login = GetSingularityString(LANG_ERROR);

    QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel, a.email, a.last_ip, a.last_login, a.mutetime "
                                                "FROM account a "
                                                "LEFT JOIN account_access aa "
                                                "ON (a.id = aa.id) "
                                                "WHERE a.id = '%u'", accId);
    if (result)
    {
        Field* fields = result->Fetch();
        username = fields[0].GetString();
        security = fields[1].GetUInt32();
        email = fields[2].GetString();
        muteTime = fields[5].GetUInt64();

        if (email.empty())
            email = "-";

        if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
        {
            last_ip = fields[3].GetString();
            last_login = fields[4].GetString();
        }
        else
        {
            last_ip = "-";
            last_login = "-";
        }
    }

    std::string nameLink = playerLink(target_name);

    PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetSingularityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);

    if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate FROM account_banned WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId))
    {
        Field * fields = result->Fetch();
        banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
    }
    else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate FROM character_banned WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid)))
//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:Singularity,代码行数:101,代码来源:Level2.cpp


示例18: strtok

bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
{
    if (!*args)
        return false;

    char* sTicketId = strtok((char*)args, " ");
    uint32 ticketId = atoi(sTicketId);

    char* sTarget = strtok(NULL, " ");
    if (!sTarget)
        return false;

    std::string target(sTarget);
    if (!normalizePlayerName(target))
        return false;

    GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
    if (!ticket || ticket->IsClosed())
    {
        SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
        return true;
    }

    // Get target information
    uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
    uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
    uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID);

    // Target must exist and have administrative rights
    if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
    {
        SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
        return true;
    }

    // If already assigned, leave
    if (ticket->IsAssignedTo(targetGuid))
    {
        PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
        return true;
    }

    // If assigned to different player other than current, leave
    //! Console can override though
    Player* player = m_session ? m_session->GetPlayer() : NULL;
    if (player && ticket->IsAssignedNotTo(player->GetGUID()))
    {
        PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
        return true;
    }

    // Assign ticket
    SQLTransaction trans = SQLTransaction(NULL);
    ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
    ticket->SaveToDB(trans);
    sTicketMgr->UpdateLastChange();

    std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL);
    SendGlobalGMSysMessage(msg.c_str());
    return true;
}
开发者ID:Krill156,项目名称:FreyaCore,代码行数:61,代码来源:TicketCommands.cpp


示例19: getSelectedPlayer

bool ChatHandler::HandleLookupTitleCommand(const char* args)
{
    if (!*args)
        return false;

    // can be NULL in console call
    Player* target = getSelectedPlayer();

    // title name have single string arg for player name
    char const* targetName = target ? target->GetName() : "NAME";

    std::string namepart = args;
    std::wstring wnamepart;

    if (!Utf8toWStr(namepart, wnamepart))
        return false;

    // converting string that we try to find to lower case
    wstrToLower(wnamepart);

    uint32 counter = 0;                                     // Counter for figure out that we found smth.
    uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);

    // Search in CharTitles.dbc
    for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
    {
        CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
        if (titleInfo)
        {
            int loc = GetSessionDbcLocale();
            std::string name = titleInfo->name[loc];
            if (name.empty())
                continue;

            if (!Utf8FitTo(name, wnamepart))
            {
                loc = 0;
                for (; loc < TOTAL_LOCALES; ++loc)
                {
                    if (loc == GetSessionDbcLocale())
                        continue;

                    name = titleInfo->name[loc];
                    if (name.empty())
                        continue;

                    if (Utf8FitTo(name, wnamepart))
                        break;
                }
            }

            if (loc < TOTAL_LOCALES)
            {
                if (maxResults && counter == maxResults)
                {
                    PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
                    return true;
                }

                char const* knownStr = target && target->HasTitle(titleInfo) ? GetSingularityString(LANG_KNOWN) : "";

                char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
                    ? GetSingularityString(LANG_ACTIVE)
                    : "";

                char titleNameStr[80];
                snprintf(titleNameStr, 80, name.c_str(), targetName);

                // send title in "id (idx:idx) - [namedlink locale]" format
                if (m_session)
                    PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
                else
                    PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);

                ++counter;
            }
        }
    }
    if (counter == 0)                                       // if counter == 0 then we found nth
        SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
    return true;
}
开发者ID:Bootz,项目名称:Singularity,代码行数:82,代码来源:Level2.cpp



注:本文中的PSendSysMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PT函数代码示例发布时间:2022-05-30
下一篇:
C++ PSendMessageToAll函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap