您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ArenaType函数代码示例

51自学网 2021-06-01 19:47:28
  C++
这篇教程C++ ArenaType函数代码示例写得很实用,希望能帮到您。

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

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

示例1: MAKE_NEW_GUID

bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result){    if (!result)        return false;    Field* fields = result->Fetch();    TeamId            = fields[0].GetUInt32();    TeamName          = fields[1].GetString();    CaptainGuid       = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);    Type              = ArenaType(fields[3].GetUInt8());    BackgroundColor   = fields[4].GetUInt32();    EmblemStyle       = fields[5].GetUInt8();    EmblemColor       = fields[6].GetUInt32();    BorderStyle       = fields[7].GetUInt8();    BorderColor       = fields[8].GetUInt32();    Stats.Rating      = fields[9].GetUInt16();    Stats.WeekGames   = fields[10].GetUInt16();    Stats.WeekWins    = fields[11].GetUInt16();    Stats.SeasonGames = fields[12].GetUInt16();    Stats.SeasonWins  = fields[13].GetUInt16();    Stats.Rank        = fields[14].GetUInt32();    if (!IsArenaTypeValid(Type))        return false;    return true;}
开发者ID:sk3tche,项目名称:TrinityCore,代码行数:28,


示例2: ObjectGuid

bool ArenaTeam::LoadArenaTeamFromDB(QueryResult *arenaTeamDataResult){    if(!arenaTeamDataResult)        return false;    Field *fields = arenaTeamDataResult->Fetch();    m_TeamId             = fields[0].GetUInt32();    m_Name               = fields[1].GetCppString();    m_CaptainGuid        = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32());    m_Type               = ArenaType(fields[3].GetUInt32());    if (!IsArenaTypeValid(m_Type))        return false;    m_BackgroundColor    = fields[4].GetUInt32();    m_EmblemStyle        = fields[5].GetUInt32();    m_EmblemColor        = fields[6].GetUInt32();    m_BorderStyle        = fields[7].GetUInt32();    m_BorderColor        = fields[8].GetUInt32();    //load team stats    m_stats.rating       = fields[9].GetUInt32();    m_stats.games_week   = fields[10].GetUInt32();    m_stats.wins_week    = fields[11].GetUInt32();    m_stats.games_season = fields[12].GetUInt32();    m_stats.wins_season  = fields[13].GetUInt32();    m_stats.rank         = fields[14].GetUInt32();    return true;}
开发者ID:Archives,项目名称:easy-mangos,代码行数:30,


示例3: DEBUG_LOG

void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recv_data){    DEBUG_LOG("Received opcode CMSG_TURN_IN_PETITION"); // ok    // recv_data.hexlike();    ObjectGuid petitionGuid;    recv_data >> petitionGuid;    DEBUG_LOG("Petition %s turned in by %s", petitionGuid.GetString().c_str(), _player->GetGuidStr().c_str());    /// Collect petition info data    ObjectGuid ownerGuid;    uint32 type;    std::string name;    // data    QueryResult* result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());    if (result)    {        Field* fields = result->Fetch();        ownerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());        name = fields[1].GetCppString();        type = fields[2].GetUInt32();        delete result;    }    else    {        sLog.outError("CMSG_TURN_IN_PETITION: petition table not have data for guid %u!", petitionGuid.GetCounter());        return;    }    if (type == 9)    {        if (_player->GetGuildId())        {            WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);            data << uint32(PETITION_TURN_ALREADY_IN_GUILD); // already in guild            _player->GetSession()->SendPacket(data);            return;        }    }    else    {        if (!IsArenaTypeValid(ArenaType(type)))            return;        uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));        if (slot >= MAX_ARENA_SLOT)            return;        if (_player->GetArenaTeamId(slot))        {            // data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);            // data << (uint32)PETITION_TURN_ALREADY_IN_GUILD;   // already in guild            //_player->GetSession()->SendPacket(data);            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM);            return;        }    }    if (_player->GetObjectGuid() != ownerGuid)        return;    // signs    result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());    uint8 signs = result ? (uint8)result->GetRowCount() : 0;    uint32 count = type == 9 ? sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS) : type - 1;    if (signs < count)    {        WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);        data << uint32(PETITION_TURN_NEED_MORE_SIGNATURES); // need more signatures...        SendPacket(data);        delete result;        return;    }    if (type == 9)    {        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)//.........这里部分代码省略.........
开发者ID:Ozerev,项目名称:mangos-tbc,代码行数:101,


示例4: m_bgTypeId

BattlegroundQueue::BattlegroundQueue() : m_bgTypeId(BATTLEGROUND_TYPE_NONE), m_arenaType(ArenaType(0)){    for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)    {        for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j)        {            m_WaitTimeLastIndex[i][j] = 0;            for (uint32 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k)                m_WaitTimes[i][j][k] = 0;        }    }}
开发者ID:boom8866,项目名称:azerothcore-wotlk,代码行数:12,


示例5: DEBUG_LOG

void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data){    DEBUG_LOG("WORLD: Recvd CMSG_BATTLEFIELD_PORT Message");    uint8 type;                                             // arenatype if arena    uint8 unk2;                                             // unk, can be 0x0 (may be if was invited?) and 0x1    uint32 bgTypeId_;                                       // type id from dbc    uint16 unk;                                             // 0x1F90 constant?    uint8 action;                                           // enter battle 0x1, leave queue 0x0    recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;    if (!sBattlemasterListStore.LookupEntry(bgTypeId_))    {        sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", bgTypeId_);        return;    }    if (type && !IsArenaTypeValid(ArenaType(type)))    {        sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), arena type wrong: %u.", _player->GetGUIDLow(), type);        return;    }    if (!_player->InBattleGroundQueue())    {        sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), he is not in bg_queue.", _player->GetGUIDLow());        return;    }    // get GroupQueueInfo from BattleGroundQueue    BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);    BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, ArenaType(type));    BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];    // we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function    GroupQueueInfo ginfo;    if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))    {        sLog.outError("BattlegroundHandler: itrplayerstatus not found.");        return;    }    // if action == 1, then instanceId is required    if (!ginfo.IsInvitedToBGInstanceGUID && action == 1)    {        sLog.outError("BattlegroundHandler: instance not found.");        return;    }    BattleGround* bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);    // bg template might and must be used in case of leaving queue, when instance is not created yet    if (!bg && action == 0)        bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);    if (!bg)    {        sLog.outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);        return;    }    // some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it    if (action == 1 && ginfo.arenaType == ARENA_TYPE_NONE)    {        // if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue        if (!_player->CanJoinToBattleground())        {            // send bg command result to show nice message            WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);            data2 << uint32(0xFFFFFFFE);            _player->GetSession()->SendPacket(&data2);            action = 0;            DEBUG_LOG("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());        }        // if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue        if (_player->getLevel() > bg->GetMaxLevel())        {            sLog.outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",                          _player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());            action = 0;        }    }    uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);    WorldPacket data;    switch (action)    {        case 1:                                         // port to battleground            if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))                return;                                 // cheating?            // resurrect the player            if (!_player->isAlive())            {                _player->ResurrectPlayer(1.0f);                _player->SpawnCorpseBones();            }            // stop taxi flight at port            if (_player->IsTaxiFlying())            {                _player->GetMotionMaster()->MovementExpired();                _player->m_taxi.ClearTaxiDestinations();            }//.........这里部分代码省略.........
开发者ID:bread-and-butter,项目名称:server,代码行数:101,


示例6: GUID_LOPART

void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data){    sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION");    // Get petition guid from packet    WorldPacket data;    uint64 petitionGuid;    recv_data >> petitionGuid;    // Check if player really has the required petition charter    Item* item = _player->GetItemByGuid(petitionGuid);    if (!item)        return;    sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow());    // Get petition data from db    uint32 ownerguidlo;    uint32 type;    std::string name;    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PETITION);    stmt->setUInt32(0, GUID_LOPART(petitionGuid));    PreparedQueryResult result = CharacterDatabase.Query(stmt);    if (result)    {        Field* fields = result->Fetch();        ownerguidlo = fields[0].GetUInt32();        name = fields[1].GetString();        type = fields[2].GetUInt8();    }    else    {        sLog->outError("Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));        return;    }    // Only the petition owner can turn in the petition    if (_player->GetGUIDLow() != ownerguidlo)        return;    // Petition type (guild/arena) specific checks    if (type == GUILD_CHARTER_TYPE)    {        // Check if player is already in a guild        if (_player->GetGuildId())        {            data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);            data << (uint32)PETITION_TURN_ALREADY_IN_GUILD;            _player->GetSession()->SendPacket(&data);            return;        }        // Check if guild name is already taken        if (sGuildMgr->GetGuildByName(name))        {            Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, name);            return;        }    }    else    {        // Check for valid arena bracket (2v2, 3v3, 5v5)        if (!IsArenaTypeValid(ArenaType(type)))            return;        uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));        if (slot >= MAX_ARENA_SLOT)            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;        }    }    // Get petition signatures from db    uint8 signatures;    stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PETITION_SIGNATURE);    stmt->setUInt32(0, GUID_LOPART(petitionGuid));    result = CharacterDatabase.Query(stmt);    if (result)        signatures = uint8(result->GetRowCount());    else        signatures = 0;    uint32 requiredSignatures;//.........这里部分代码省略.........
开发者ID:sk3tche,项目名称:TrinityCore,代码行数:101,


示例7: COUNT

void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data){    sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN");    // ok    //recv_data.hexlike();    Field* fields;    uint64 petitionguid;    uint8 unk;    recv_data >> petitionguid;                              // petition guid    recv_data >> unk;    QueryResult result = CharacterDatabase.PQuery(        "SELECT ownerguid, "        "  (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, "        "  type "        "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid));    if (!result)    {        sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());        return;    }    fields = result->Fetch();    uint64 ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);    uint8 signs = fields[1].GetUInt8();    uint32 type = fields[2].GetUInt32();    uint32 plguidlo = _player->GetGUIDLow();    if (GUID_LOPART(ownerguid) == plguidlo)        return;    // not let enemies sign guild charter    if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != sObjectMgr->GetPlayerTeamByGUID(ownerguid))    {        if (type != GUILD_CHARTER_TYPE)            SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);        else            Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NOT_ALLIED);        return;    }    if (type != GUILD_CHARTER_TYPE)    {        if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))        {            SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);            return;        }        if (!IsArenaTypeValid(ArenaType(type)))            return;        uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));        if (slot >= MAX_ARENA_SLOT)            return;        if (_player->GetArenaTeamId(slot))        {            SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);            return;        }        if (_player->GetArenaTeamIdInvited())        {            SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);            return;        }    }    else    {        if (_player->GetGuildId())        {            Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName());            return;        }        if (_player->GetGuildIdInvited())        {            Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName());            return;        }    }    if (++signs > type)                                        // client signs maximum        return;    //client doesn't allow to sign petition two times by one character, but not check sign by another character from same account    //not allow sign another player from already sign player account    result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE player_account = '%u' AND petitionguid = '%u'", GetAccountId(), GUID_LOPART(petitionguid));    if (result)    {        WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));        data << uint64(petitionguid);        data << uint64(_player->GetGUID());        data << (uint32)PETITION_SIGN_ALREADY_SIGNED;        // close at signer side        SendPacket(&data);//.........这里部分代码省略.........
开发者ID:sk3tche,项目名称:TrinityCore,代码行数:101,



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


C++ Args函数代码示例
C++ ArenaTeamInfoType函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。