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


C++ ObjectGuid::GetRawValue方法代码示例

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


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

示例1: CheckForMark

	// hacky way for the mark of the faceless, needs core support
	// PLEASE REMOVE FOR REVISION!
    void CheckForMark(ObjectGuid m_uiTargetGUID)
    {
        if(m_uiTargetGUID.GetRawValue() == 0)
            return;

        m_bHasSimphon = false;
        Map *map = m_creature->GetMap();
        Unit* pTarget = m_creature->GetMap()->GetUnit( m_uiTargetGUID);
        if (map->IsDungeon())
        {
            Map::PlayerList const &PlayerList = map->GetPlayers();

            if (PlayerList.isEmpty())
                return;

            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if(pTarget && pTarget->isAlive() && !m_bHasSimphon && m_uiTargetGUID.GetRawValue() != i->getSource()->GetObjectGuid().GetRawValue())
                {
                    if (i->getSource()->isAlive() && pTarget->GetDistance2d(i->getSource()) < 10.0f)
                    {
                        DoCast(pTarget, SPELL_MARK_SIMPHON);
                        m_bHasSimphon = true;
                    }
                }
            }
        } 
    }
开发者ID:Bearq,项目名称:scriptdev2,代码行数:30,代码来源:boss_general_vezax.cpp

示例2: BuildSendPlayVisual

void PacketWorker::BuildSendPlayVisual(WorldPacket* data, ObjectGuid guid, uint32 value, bool impact)
{
    *data << uint32(0);         // unk, seems always 0
    *data << uint32(value);
    *data << uint32(impact ? 1 : 0);

    uint8 guidMask[8] = { 4, 7, 5, 3, 1, 2, 0, 6 };
    uint8 byteOrder[8] = { 0, 4, 1, 6, 7, 2, 3, 5 };
    data->WriteGuidMask(guid.GetRawValue(), guidMask, 8);
    data->WriteGuidBytes(guid.GetRawValue(), byteOrder, 8, 0);
}
开发者ID:Dekadencee,项目名称:StrawberryCore,代码行数:11,代码来源:PacketWorker.cpp

示例3: HandleEquipmentSetSaveOpcode

void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket& recv_data)
{
    DEBUG_LOG("CMSG_EQUIPMENT_SET_SAVE");

    ObjectGuid setGuid;
    uint32 index;
    std::string name;
    std::string iconName;

    recv_data >> setGuid.ReadAsPacked();
    recv_data >> index;
    recv_data >> name;
    recv_data >> iconName;

    if (index >= MAX_EQUIPMENT_SET_INDEX)                   // client set slots amount
        return;

    EquipmentSet eqSet;

    eqSet.Guid      = setGuid.GetRawValue();
    eqSet.Name      = name;
    eqSet.IconName  = iconName;
    eqSet.state     = EQUIPMENT_SET_NEW;

    for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
    {
        ObjectGuid itemGuid;

        recv_data >> itemGuid.ReadAsPacked();

        // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (not touch slot at equip set)
        if (itemGuid.GetRawValue() == 1)
        {
            // ignored slots saved as bit mask because we have no free special values for Items[i]
            eqSet.IgnoreMask |= 1 << i;
            continue;
        }

        Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);

        if (!item && itemGuid)                              // cheating check 1
            return;

        if (item && item->GetObjectGuid() != itemGuid)      // cheating check 2
            return;

        eqSet.Items[i] = itemGuid.GetCounter();
    }

    _player->SetEquipmentSet(index, eqSet);
}
开发者ID:zeroR2,项目名称:mangos,代码行数:51,代码来源:CharacterHandler.cpp

示例4: SendLfgRoleCheckUpdate

void WorldSession::SendLfgRoleCheckUpdate(LFGRoleCheck const& roleCheck)
{
    WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE);
    
    data << uint32(roleCheck.state);
    data << uint8(roleCheck.state == LFG_ROLECHECK_INITIALITING);
    
    std::set<uint32> dungeons;
    if (roleCheck.randomDungeonID)
        dungeons.insert(roleCheck.randomDungeonID);
    else
        dungeons = roleCheck.dungeonList;
        
    data << uint8(dungeons.size());
    if (!dungeons.empty())
        for (std::set<uint32>::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
            data << uint32(sLFGMgr.GetDungeonEntry(*it));
            
    data << uint8(roleCheck.currentRoles.size());
    if (!roleCheck.currentRoles.empty())
    {
        ObjectGuid leaderGuid = ObjectGuid(roleCheck.leaderGuidRaw);
        uint8 leaderRoles     = roleCheck.currentRoles.find(leaderGuid)->second;
        Player* pLeader       = ObjectAccessor::FindPlayer(leaderGuid);
        
        data << uint64(leaderGuid.GetRawValue());
        data << uint8(leaderRoles > 0);
        data << uint32(leaderRoles);
        data << uint8(pLeader->getLevel());
        
        for (roleMap::const_iterator rItr = roleCheck.currentRoles.begin(); rItr != roleCheck.currentRoles.end(); ++rItr)
        {
            if (rItr->first == leaderGuid)
                continue; // exclude the leader
            
            ObjectGuid plrGuid = rItr->first;
            
            Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid);
            
            data << uint64(plrGuid.GetRawValue());
            data << uint8(rItr->second > 0);
            data << uint32(rItr->second);
            data << uint8(pPlayer->getLevel());
        }
    }
    
    SendPacket(&data);
}
开发者ID:mangostwo,项目名称:server,代码行数:48,代码来源:LFGHandler.cpp

示例5: QuerySkill

string WhoAction::QuerySkill(string text)
{
    ostringstream out;
    InitSkills();

    for (map<uint32, string>::iterator i = skills.begin(); i != skills.end(); ++i)
    {
        string name = i->second;
        uint16 skill = i->first;
        if (!strcmpi(text.c_str(), name.c_str()) && bot->HasSkill(skill))
        {
            string skillName = i->second;
            uint32 spellId = AI_VALUE2(uint32, "spell id", skillName);
            uint16 value = bot->GetSkillValue(skill);
            uint16 maxSkill = bot->GetMaxSkillValue(skill);
            ObjectGuid guid = bot->GetObjectGuid();
            string data = "0";
            out << "|cFFFFFF00|Htrade:" << spellId << ":" << value << ":" << maxSkill << ":"
                    << std::hex << std::uppercase << guid.GetRawValue()
                    << std::nouppercase << std::dec << ":" << data
                    << "|h[" << skills[skill] << "]|h|r"
                    << " |h|cff00ff00" << value << "|h|cffffffff/"
                    << "|h|cff00ff00" << maxSkill << "|h|cffffffff ";
        }
    }

    return out.str();
}
开发者ID:Chuck5ta,项目名称:server,代码行数:28,代码来源:WhoAction.cpp

示例6: RemoveFromQueue

void LFGQueue::RemoveFromQueue(ObjectGuid guid)
{
    RemoveFromNewQueue(guid);
    RemoveFromCurrentQueue(guid);
    RemoveFromCompatibles(guid);

    std::ostringstream o;
    o << guid.GetRawValue();
    std::string sguid = o.str();

    LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
    for (LfgQueueDataContainer::iterator itr = QueueDataStore.begin(); itr != QueueDataStore.end(); ++itr)
        if (itr->first != guid)
        {
            if (std::string::npos != itr->second.bestCompatible.find(sguid))
            {
                itr->second.bestCompatible.clear();
                FindBestCompatibleInQueue(itr);
            }
        }
        else
            itDelete = itr;

    if (itDelete != QueueDataStore.end())
        QueueDataStore.erase(itDelete);
}
开发者ID:samaelsacred,项目名称:4.3.4,代码行数:26,代码来源:LFGQueue.cpp

示例7: HandleAttackSwingOpcode

void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data)
{
    ObjectGuid guid;
    recv_data >> guid;

    DEBUG_LOG("WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());

    Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid.GetRawValue());

    if (!pEnemy)
    {
        if (!guid.IsUnit())
            sLog.outError("WORLD: %s isn't player, pet or creature", guid.GetString().c_str());
        else
            sLog.outError("WORLD: Enemy %s not found", guid.GetString().c_str());

        // stop attack state at client
        SendAttackStop(NULL);
        return;
    }

    if (!_player->canAttack(pEnemy))
    {
        sLog.outError("WORLD: Enemy %s is friendly",guid.GetString().c_str());

        // stop attack state at client
        SendAttackStop(pEnemy);
        return;
    }

    _player->Attack(pEnemy,true);
}
开发者ID:Kerpele,项目名称:UnNamedWoW,代码行数:32,代码来源:CombatHandler.cpp

示例8: AddPlayer

void BattleGround::AddPlayer(Player *plr)
{
    // remove afk from player
    if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
        plr->ToggleAFK();

    // score struct must be created in inherited class

    ObjectGuid guid = plr->GetObjectGuid();
    uint32 team = plr->GetBGTeam();

    BattleGroundPlayer bp;
    bp.LastOnlineTime = 0;
    bp.Team = team;

    // Add to list/maps
    m_Players[guid.GetRawValue()] = bp;

    UpdatePlayersCountByTeam(team, false);                  // +1 player

    WorldPacket data;
    sBattleGroundMgr.BuildPlayerJoinedBattleGroundPacket(&data, plr);
    SendPacketToTeam(team, &data, plr, false);

    // Log
    DETAIL_LOG("BATTLEGROUND: Player %s joined the battle.", plr->GetName());
}
开发者ID:magomags,项目名称:mangoszero,代码行数:27,代码来源:BattleGround.cpp

示例9: GetInstanceObjectGUID

uint64 BSWScriptedInstance::GetInstanceObjectGUID(uint32 entry)
{
    ObjectGuid guid = GetInstanceObjectGuid(entry);
    if (guid.IsEmpty())
        return 0;
    else
        return guid.GetRawValue();
}
开发者ID:AwkwardDev,项目名称:scriptdev2,代码行数:8,代码来源:BSW_instance.cpp

示例10: HaveMember

bool ArenaTeam::HaveMember(ObjectGuid guid) const
{
    for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
        if(itr->guid == guid.GetRawValue())
            return true;

    return false;
}
开发者ID:Aldrealia,项目名称:mangos,代码行数:8,代码来源:ArenaTeam.cpp

示例11: HandleEquipmentSetDelete

void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
{
    sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE");

    ObjectGuid setGuid;

    recv_data >> setGuid.ReadAsPacked();

    _player->DeleteEquipmentSet(setGuid.GetRawValue());
}
开发者ID:1ATOM,项目名称:mangos,代码行数:10,代码来源:CharacterHandler.cpp

示例12: HandleRequestVehicleSwitchSeat

void WorldSession::HandleRequestVehicleSwitchSeat(WorldPacket &recv_data)
{
    sLog.outDebug("WORLD: Recvd CMSG_REQUEST_VEHICLE_SWITCH_SEAT");
    recv_data.hexlike();

    uint64 vehicleGUID = _player->GetVehicleGUID();

    if(!vehicleGUID)                                        // something wrong here...
        return;

    if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
    {
        ObjectGuid guid;
        recv_data >> guid.ReadAsPacked();

        int8 seatId = 0;
        recv_data >> seatId;

        if(!guid.IsEmpty())
        {
            if(vehicleGUID != guid.GetRawValue())
            {
                if(Vehicle *veh = ObjectAccessor::GetVehicle(guid.GetRawValue()))
                {
                    if(!_player->IsWithinDistInMap(veh, 10))
                        return;

                    if(Vehicle *v = veh->FindFreeSeat(&seatId, false))
                    {
                        vehicle->RemovePassenger(_player);
                        _player->EnterVehicle(v, seatId, false);
                    }
                }
                return;
            }
        }
        if(Vehicle *v = vehicle->FindFreeSeat(&seatId, false))
        {
            vehicle->RemovePassenger(_player);
            _player->EnterVehicle(v, seatId, false);
        }
    }
开发者ID:BlackBarryProject,项目名称:Mangos,代码行数:42,代码来源:MovementHandler.cpp

示例13: HandleForceSpeedChangeAck

void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recv_data)
{
    DEBUG_LOG("WORLD: Recvd CMSG_SPEED_CHANGE_ACK");
    /* extract packet */
    ObjectGuid guid;
    uint32 unk1;
    MovementInfo movementInfo;
    float newspeed;

    recv_data >> guid;
    recv_data >> unk1;                           // counter or moveEvent
    recv_data >> movementInfo;
    recv_data >> newspeed;

    // now can skip not our packet
    if (GetPlayer()->GetGUID() != guid.GetRawValue())
        return;
    /*----------------*/

    // Save movement flags
    GetPlayer()->SetUnitMovementFlags(movementInfo.GetMovementFlags());

    // client ACK send one packet for mounted/run case and need skip all except last from its
    // in other cases anti-cheat check can be fail in false case
    UnitMoveType move_type;
    UnitMoveType force_move_type;

    //static char const* move_type_name[MAX_MOVE_TYPE] = {"Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack"};

    uint16 opcode = recv_data.GetOpcode();
    switch (opcode)
    {
        case CMSG_FORCE_WALK_SPEED_CHANGE_ACK:          move_type = MOVE_WALK;          force_move_type = MOVE_WALK;        break;
        case CMSG_FORCE_RUN_SPEED_CHANGE_ACK:           move_type = MOVE_RUN;           force_move_type = MOVE_RUN;         break;
        case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK:      move_type = MOVE_RUN_BACK;      force_move_type = MOVE_RUN_BACK;    break;
        case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK:          move_type = MOVE_SWIM;          force_move_type = MOVE_SWIM;        break;
        case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK:     move_type = MOVE_SWIM_BACK;     force_move_type = MOVE_SWIM_BACK;   break;
        case CMSG_FORCE_TURN_RATE_CHANGE_ACK:           move_type = MOVE_TURN_RATE;     force_move_type = MOVE_TURN_RATE;   break;
        case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK:        move_type = MOVE_FLIGHT;        force_move_type = MOVE_FLIGHT;      break;
        case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK:   move_type = MOVE_FLIGHT_BACK;   force_move_type = MOVE_FLIGHT_BACK; break;
        default:
            sLog.outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
            return;
    }

    // skip all forced speed changes except last and unexpected
    // in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN] store both.
    if (GetPlayer()->m_forced_speed_changes[force_move_type] > 0)
    {
        --GetPlayer()->m_forced_speed_changes[force_move_type];
        if (GetPlayer()->m_forced_speed_changes[force_move_type] > 0)
            return;
    }
}
开发者ID:Regolan,项目名称:blizzlikecore,代码行数:54,代码来源:MovementHandler.cpp

示例14: BuildSetMovementPacket

void PacketWorker::BuildSetMovementPacket(Opcodes op, WorldPacket* data, ObjectGuid guid, uint32 value)
{
    switch(op)
    {
        case SMSG_FORCE_MOVE_ROOT:
        {
            uint8 guidMask[8] = { 2, 7, 6, 0, 5, 4, 1, 3 };
            uint8 byteOrder[8] = { 1, 0, 2, 5, 3, 4, 7, 6 };
            data->WriteGuidMask(guid.GetRawValue(), guidMask, 8);
            data->WriteGuidBytes(guid.GetRawValue(), byteOrder, 4, 0);
            *data << uint32(value);
            data->WriteGuidBytes(guid.GetRawValue(), byteOrder, 4, 4);
            data->FlushBits();
            break;
        }
        case SMSG_FORCE_MOVE_UNROOT:
        {
            uint8 guidMask[8] = { 0, 1, 3, 7, 5, 2, 4, 6 };
            uint8 byteOrder[8] = { 3, 6, 1, 2, 0, 7, 4, 5 };
            data->WriteGuidMask(guid.GetRawValue(), guidMask, 8);
            data->WriteGuidBytes(guid.GetRawValue(), byteOrder, 3, 0);
            *data << uint32(value);
            data->WriteGuidBytes(guid.GetRawValue(), byteOrder, 5, 3);
            break;
        }
        default:
        {
            sLog.outError("Called PacketWorker::BuildSetMovementPacket for unknown opcode %u", op);
            break;
        }
    }
}
开发者ID:Dekadencee,项目名称:StrawberryCore,代码行数:32,代码来源:PacketWorker.cpp

示例15: HandleEquipmentSetUseOpcode

void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket& recv_data)
{
    DEBUG_LOG("CMSG_EQUIPMENT_SET_USE");
    recv_data.hexlike();

    for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
    {
        ObjectGuid itemGuid;
        uint8 srcbag, srcslot;

        recv_data >> itemGuid.ReadAsPacked();
        recv_data >> srcbag >> srcslot;

        DEBUG_LOG("Item (%s): srcbag %u, srcslot %u", itemGuid.GetString().c_str(), srcbag, srcslot);

        // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
        if (itemGuid.GetRawValue() == 1)
            continue;

        Item* item = _player->GetItemByGuid(itemGuid);

        uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);

        if (!item)
        {
            Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
            if (!uItem)
                continue;

            ItemPosCountVec sDest;
            InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false);
            if (msg == EQUIP_ERR_OK)
            {
                _player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
                _player->StoreItem(sDest, uItem, true);
            }
            else
                _player->SendEquipError(msg, uItem, NULL);

            continue;
        }

        if (item->GetPos() == dstpos)
            continue;

        _player->SwapItem(item->GetPos(), dstpos);
    }

    WorldPacket data(SMSG_USE_EQUIPMENT_SET_RESULT, 1);
    data << uint8(0);                                       // 4 - equipment swap failed - inventory is full
    SendPacket(&data);
}
开发者ID:zeroR2,项目名称:mangos,代码行数:52,代码来源:CharacterHandler.cpp


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