当前位置: 首页>>代码示例>>C++>>正文


C++ ArenaTeam::Create方法代码示例

本文整理汇总了C++中ArenaTeam::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::Create方法的具体用法?C++ ArenaTeam::Create怎么用?C++ ArenaTeam::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArenaTeam的用法示例。


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

示例1: HandleArenaCreateCommand

    static bool HandleArenaCreateCommand(ChatHandler* handler, char const* args)
    {
        if (!*args)
            return false;

        Player* target;
        if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target))
            return false;

        char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
        if (!tailStr)
            return false;

        char* name = handler->extractQuotedArg(tailStr);
        if (!name)
            return false;

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

        int8 type = atoi(typeStr);
        if (sArenaTeamMgr->GetArenaTeamByName(name))
        {
            handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name);
            handler->SetSentErrorMessage(true);
            return false;
        }

        if (type == 2 || type == 3 || type == 5 )
        {
            if (Player::GetArenaTeamIdFromDB(target->GetGUID(), type) != 0)
            {
                handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, target->GetName().c_str());
                handler->SetSentErrorMessage(true);
                return false;
            }

            ArenaTeam* arena = new ArenaTeam();

            if (!arena->Create(target->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911))
            {
                delete arena;
                handler->SendSysMessage(LANG_BAD_VALUE);
                handler->SetSentErrorMessage(true);
                return false;
            }

            sArenaTeamMgr->AddArenaTeam(arena);
            handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter());
        }
        else
        {
            handler->SendSysMessage(LANG_BAD_VALUE);
            handler->SetSentErrorMessage(true);
            return false;
        }

        return true;
    }
开发者ID:deathkayn,项目名称:Core-W,代码行数:60,代码来源:cs_arena.cpp

示例2: HandleArenaTeamCreateOpcode

void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE");                // empty opcode
    
    uint32 slot;
    uint32 background;
    uint32 icon;
    uint32 iconcolor;
    uint32 border;
    uint32 bordercolor;
    uint8  strLeng;
    std::string name;

    recvData >> slot >> icon >> iconcolor >> border >> bordercolor >> background;
    recvData >> strLeng >> name;

    // Check for valid arena bracket (2v2, 3v3, 5v5)
    if (slot >= MAX_ARENA_SLOT)
        return;

    uint32 type = ArenaTeam::GetTypeBySlot(slot);
    if (type >= MAX_ARENA_TYPE)
        return;

    // Check if player is already in an arena team
    if (_player->GetArenaTeamId(slot))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
        return;
    }

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(name))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
        return;
    }

    // Create arena team
    ArenaTeam* arenaTeam = new ArenaTeam();

    if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor))
    {
        delete arenaTeam;
        return;
    }

    // Register arena team
    sArenaTeamMgr->AddArenaTeam(arenaTeam);
    sLog->outDebug(LOG_FILTER_NETWORKIO, "ArenaTeamHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId());

    // Broadcast event
    arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), "");
}
开发者ID:AwkwardDev,项目名称:MistCore,代码行数:54,代码来源:ArenaTeamHandler.cpp

示例3: CreateArenateam

    bool CreateArenateam(Player* player, Creature* me)
    {
        if (!player || !me)
            return false;

        uint8 slot = ArenaTeam::GetSlotByType(ARENA_TEAM_5v5);
        if (slot >= MAX_ARENA_SLOT)
            return false;

        // Check if player is already in an arena team
        if (player->GetArenaTeamId(slot))
        {
            player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM);
            return false;
        }

        // Teamname = playername
        // if team name exist, we have to choose another name (playername + number)
        int i = 1;
        std::stringstream teamName;
        //teamName << "3vs3 Solo - " << player->GetName();
        teamName << player->GetName();
        do
        {
            if (sArenaTeamMgr->GetArenaTeamByName(teamName.str()) != NULL) // teamname exist, so choose another name
            {
                teamName.str(std::string());
                teamName << player->GetName() << i++;
            }
            else
                break;
        } while (i < 100); // should never happen

        // Create arena team
        ArenaTeam* arenaTeam = new ArenaTeam();

        if (!arenaTeam->Create(player->GetGUID(), ARENA_TEAM_5v5, teamName.str(), 4283124816, 45, 4294242303, 5, 4294705149))
        {
            delete arenaTeam;
            return false;
        }

        // Register arena team
        sArenaTeamMgr->AddArenaTeam(arenaTeam);
        arenaTeam->AddMember(player->GetGUID());

        ChatHandler(player->GetSession()).SendSysMessage("Arena team successful created!");

        return true;
    }
开发者ID:tinymac,项目名称:123,代码行数:50,代码来源:npc_solo3v3.cpp

示例4: HandleArenaTeamCreateOpcode

void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE");

    uint32 icon, backgroundColor, borderColor, iconColor, border, slot;
    std::string name;

    recvData >> icon;
    recvData >> backgroundColor;
    recvData >> borderColor;
    recvData >> iconColor;
    recvData >> border;
    recvData >> slot;
    recvData >> name;

    // Perform checks
    if (_player->getLevel() < sWorld->getIntConfig(CONFIG_ARENA_MIN_LEVEL)) // TODO: implement error message
        return;

    if (_player->GetArenaTeamId(slot))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);
        return;
    }

    if (sArenaTeamMgr->GetArenaTeamByName(name))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
        return;
    }

    if (sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID);
        return;
    }

    // Create arena team
    ArenaTeam* arenaTeam = new ArenaTeam();

    if (!arenaTeam->Create(_player->GetGUID(), ArenaTeam::GetTypeBySlot(slot), name, backgroundColor, icon, iconColor, border, borderColor))
    {
        delete arenaTeam;
        return;
    }

    // Register arena team
    sArenaTeamMgr->AddArenaTeam(arenaTeam);
    sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId());
}
开发者ID:Bootz,项目名称:TrilliumEMU-1,代码行数:50,代码来源:ArenaTeamHandler.cpp

示例5: HandleArenaTeamCreateOpcode

void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_CREATE");

    uint32 slot, icon, iconcolor, border, bordercolor, background;
    std::string name;

    recvData >> slot;
    recvData >> icon;
    recvData >> bordercolor;
    recvData >> border;
    recvData >> background;
    recvData >> iconcolor;
    name = recvData.ReadString(recvData.ReadBits(8));

    uint8 type = ArenaTeam::GetTypeBySlot(slot);

    if (_player->GetArenaTeamId(slot))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
        return;
    }

    if (sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID);
        return;
    }

    if (sArenaTeamMgr->GetArenaTeamByName(name))
    {
        SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
        return;
    }

    ArenaTeam* arenaTeam = new ArenaTeam;
    if (!arenaTeam->Create(GUID_LOPART(_player->GetGUID()), type, name, background, icon, iconcolor, border, bordercolor))
    {
        sLog->outError(LOG_FILTER_ARENAS, "Arena team create failed.");
        delete arenaTeam;
        return;
    }

    sArenaTeamMgr->AddArenaTeam(arenaTeam);

    SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_CREATED);
}
开发者ID:Adeer,项目名称:Patchs,代码行数:47,代码来源:ArenaTeamHandler.cpp

示例6: HandleArenaTeamCreate

void WorldSession::HandleArenaTeamCreate(WorldPacket & recv_data)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE");

    uint32 type, icon, iconcolor, border, bordercolor, background;
    std::string name;

    recv_data >> background >> icon >> iconcolor >> border >> bordercolor;
    recv_data >> type;
    recv_data >> name;

    ArenaTeam* at = new ArenaTeam;
    if (!at->Create(GUID_LOPART(_player->GetGUIDLow()), type, name, background, icon, iconcolor, border, bordercolor))
    {
        sLog->outError("ArenaTeamHandler: arena team create failed.");
        delete at;
        return;
    }

    // register team and add captain
    sArenaTeamMgr->AddArenaTeam(at);
}
开发者ID:Bootz,项目名称:SkyFireEMU_430,代码行数:22,代码来源:ArenaTeamHandler.cpp

示例7: HandleTurnInPetitionOpcode


//.........这里部分代码省略.........
        if (sGuildMgr.GetGuildByName(name))
        {
            SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S);
            delete result;
            return;
        }
    }
    else
    {
        if (sObjectMgr.GetArenaTeamByName(name))
        {
            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
            delete result;
            return;
        }
    }

    // and at last charter item check
    Item* item = _player->GetItemByGuid(petitionGuid);
    if (!item)
    {
        delete result;
        return;
    }

    // OK!

    // delete charter item
    _player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);

    if (type == 9)                                          // create guild
    {
        Guild* guild = new Guild;
        if (!guild->Create(_player, name))
        {
            delete guild;
            delete result;
            return;
        }

        // register guild and add guildmaster
        sGuildMgr.AddGuild(guild);

        // add members
        for (uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();

            ObjectGuid signGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
            if (!signGuid)
                continue;

            guild->AddMember(signGuid, guild->GetLowestRank());
            result->NextRow();
        }
    }
    else                                                    // or arena team
    {
        ArenaTeam* at = new ArenaTeam;
        if (!at->Create(_player->GetObjectGuid(), ArenaType(type), name))
        {
            sLog.outError("PetitionsHandler: arena team create failed.");
            delete at;
            delete result;
            return;
        }
开发者ID:Ozerev,项目名称:mangos-tbc,代码行数:67,代码来源:PetitionsHandler.cpp

示例8: HandleTurnInPetitionOpcode


//.........这里部分代码省略.........

    if(type == 9)
    {
        if(objmgr.GetGuildByName(name))
        {
            SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
            delete result;
            return;
        }
    }
    else
    {
        if(objmgr.GetArenaTeamByName(name))
        {
            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
            delete result;
            return;
        }
    }

    // and at last charter item check
    Item *item = _player->GetItemByGuid(petitionguid);
    if(!item)
    {
        delete result;
        return;
    }

    // OK!

    // delete charter item
    _player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);

    if(type == 9)                                           // create guild
    {
        Guild* guild = new Guild;
        if(!guild->create(_player->GetGUID(), name))
        {
            delete guild;
            delete result;
            return;
        }

        // register guild and add guildmaster
        objmgr.AddGuild(guild);

        // add members
        for(uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();
            guild->AddMember(fields[0].GetUInt64(), guild->GetLowestRank());
            result->NextRow();
        }
    }
    else                                                    // or arena team
    {
        ArenaTeam* at = new ArenaTeam;
        if(!at->Create(_player->GetGUID(), type, name))
        {
            sLog.outError("PetitionsHandler: arena team create failed.");
            delete at;
            delete result;
            return;
        }

        CHECK_PACKET_SIZE(recv_data, 8+5*4);
        uint32 icon, iconcolor, border, bordercolor, backgroud;
        recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor;

        at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor);

        // register team and add captain
        objmgr.AddArenaTeam(at);
        sLog.outDebug("PetitonsHandler: arena team added to objmrg");

        // add members
        for(uint8 i = 0; i < signs; ++i)
        {
            Field* fields = result->Fetch();
            uint64 memberGUID = fields[0].GetUInt64();
            sLog.outDebug("PetitionsHandler: adding arena member %u", GUID_LOPART(memberGUID));
            at->AddMember(memberGUID);
            result->NextRow();
        }
    }

    delete result;

    CharacterDatabase.BeginTransaction();
    CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
    CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
    CharacterDatabase.CommitTransaction();

    // created
    sLog.outDebug("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid));

    data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
    data << (uint32)PETITION_TURN_OK;
    SendPacket(&data);
}
开发者ID:eyeless,项目名称:mangos,代码行数:101,代码来源:PetitionsHandler.cpp


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