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


C++ GetZoneId函数代码示例

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


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

示例1: DeleteFromDB

void Corpse::SaveToDB()
{
    // prevent DB data inconsistence problems and duplicates
    CharacterDatabase.BeginTransaction();
    DeleteFromDB();

    std::ostringstream ss;
    ss  << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES ("
        << GetGUIDLow() << ", "
        << GUID_LOPART(GetOwnerGUID()) << ", "
        << GetPositionX() << ", "
        << GetPositionY() << ", "
        << GetPositionZ() << ", "
        << GetOrientation() << ", "
        << GetZoneId() << ", "
        << GetMapId() << ", '";
    for (uint16 i = 0; i < m_valuesCount; ++i)
        ss << GetUInt32Value(i) << " ";
    ss  << "',"
        << uint64(m_time) <<", "
        << uint32(GetType()) << ", "
        << int(GetInstanceId()) << ", "
        << uint16(GetPhaseMask()) << ")";           // prevent out of range error
    CharacterDatabase.Execute(ss.str().c_str());
    CharacterDatabase.CommitTransaction();
}
开发者ID:Elevim,项目名称:RG-332,代码行数:26,代码来源:Corpse.cpp

示例2: MANGOS_ASSERT

void Corpse::SaveToDB()
{
    // bones should not be saved to DB (would be deleted on startup anyway)
    MANGOS_ASSERT(GetType() != CORPSE_BONES);

    // prevent DB data inconsistence problems and duplicates
    CharacterDatabase.BeginTransaction();
    DeleteFromDB();

    std::ostringstream ss;
    ss  << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES ("
        << GetGUIDLow() << ", "
        << GUID_LOPART(GetOwnerGUID()) << ", "
        << GetPositionX() << ", "
        << GetPositionY() << ", "
        << GetPositionZ() << ", "
        << GetOrientation() << ", "
        << GetZoneId() << ", "
        << GetMapId() << ", '";
    for(uint16 i = 0; i < m_valuesCount; ++i)
        ss << GetUInt32Value(i) << " ";
    ss  << "',"
        << uint64(m_time) <<", "
        << uint32(GetType()) << ", "
        << int(GetInstanceId()) << ")";
    CharacterDatabase.Execute( ss.str().c_str() );
    CharacterDatabase.CommitTransaction();
}
开发者ID:Scergo,项目名称:zero,代码行数:28,代码来源:Corpse.cpp

示例3: GetGUIDLow

void Creature::SaveToDB()
{
	std::stringstream ss;
    ss << "DELETE FROM creatures WHERE id=" << GetGUIDLow();
    sDatabase.Execute(ss.str().c_str());

    ss.rdbuf()->str("");
    ss << "INSERT INTO creatures (id, mapId, zoneId, name_id, positionX, positionY, positionZ, orientation, data) VALUES ( "
        << GetGUIDLow() << ", "
        << GetMapId() << ", "
        << GetZoneId() << ", "
        << GetUInt32Value(OBJECT_FIELD_ENTRY) << ", "
        << m_positionX << ", "
        << m_positionY << ", "
        << m_positionZ << ", "
        << m_orientation << ", '";

    for( uint16 index = 0; index < m_valuesCount; index ++ )
        ss << GetUInt32Value(index) << " ";

	ss << "\")";

    sDatabase.Execute( ss.str( ).c_str( ) );

    
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:26,代码来源:Creature.cpp

示例4: DeleteFromDB

void Corpse::SaveToDB()
{
    // prevent DB data inconsistence problems and duplicates
    RealmDataDatabase.BeginTransaction();
    DeleteFromDB();

    static SqlStatementID saveCorpse;
    SqlStatement stmt = RealmDataDatabase.CreateStatement(saveCorpse, "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

    stmt.addUInt64(GetGUIDLow());
    stmt.addUInt64(GUID_LOPART(GetOwnerGUID()));
    stmt.addFloat(GetPositionX());
    stmt.addFloat(GetPositionY());
    stmt.addFloat(GetPositionZ());
    stmt.addFloat(GetOrientation());
    stmt.addUInt32(GetZoneId());
    stmt.addUInt32(GetMapId());
    stmt.addString(GetUInt32ValuesString());
    stmt.addUInt64(m_time);
    stmt.addUInt32(GetType());
    stmt.addInt32(GetInstanceId());

    stmt.Execute();
    RealmDataDatabase.CommitTransaction();
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:25,代码来源:Corpse.cpp

示例5: DeleteFromDB

void Corpse::SaveToDB()
{
    // prevent DB data inconsistence problems and duplicates
    SQLTransaction trans = CharacterDatabase.BeginTransaction();
    DeleteFromDB(trans);

    std::ostringstream ss;
    ss  << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,displayId,itemCache,bytes1,bytes2,guild,flags,dynFlags,time,corpse_type,instance,phaseMask) VALUES ("
        << GetGUIDLow() << ", "
        << GUID_LOPART(GetOwnerGUID()) << ", "
        << GetPositionX() << ", "
        << GetPositionY() << ", "
        << GetPositionZ() << ", "
        << GetOrientation() << ", "
        << GetZoneId() << ", "
        << GetMapId() << ", "
        << GetUInt32Value(CORPSE_FIELD_DISPLAY_ID) << ", '";
    for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i)
        ss << GetUInt32Value(CORPSE_FIELD_ITEM+i) << " ";
    ss  << "', "
        << GetUInt32Value(CORPSE_FIELD_BYTES_1) << ", "
        << GetUInt32Value(CORPSE_FIELD_BYTES_2) << ", "
        << GetUInt32Value(CORPSE_FIELD_GUILD) << ", "
        << GetUInt32Value(CORPSE_FIELD_FLAGS) << ", "
        << GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS) << ", "
        << uint64(m_time) << ", "
        << uint32(GetType()) << ", "
        << int(GetInstanceId()) << ", "
        << uint16(GetPhaseMask()) << ")";           // prevent out of range error
    trans->Append(ss.str().c_str());
    CharacterDatabase.CommitTransaction(trans);
}
开发者ID:ice74,项目名称:blizzwow,代码行数:32,代码来源:Corpse.cpp

示例6: KickPlayerFromBattlefield

void Battlefield::KickPlayerFromBattlefield(uint64 guid)
{
    if (Player* player = ObjectAccessor::FindPlayer(guid))
    {
        if (player->GetZoneId() == GetZoneId() && !player->IsGameMaster())
            player->TeleportTo(KickPosition);
    }
}
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:8,代码来源:Battlefield.cpp

示例7: KickAfkPlayers

void Battlefield::KickAfkPlayers()
{
    // xinef: optimization, dont lookup player twice
    for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
        for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
            if (Player* player = ObjectAccessor::FindPlayer(*itr))
                if (player->isAFK() && player->GetZoneId() == GetZoneId() && !player->IsGameMaster())
                    player->TeleportTo(KickPosition);
}
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:9,代码来源:Battlefield.cpp

示例8: OUT_DEBUG

/////////////////
// Summoned Go's
//guardians are temporary spawn that will inherit master faction and will follow them. Apart from that they have their own mind
Unit* GameObject::CreateTemporaryGuardian(uint32 guardian_entry,uint32 duration,float angle, Unit* u_caster, uint8 Slot)
{
	CreatureProto * proto = CreatureProtoStorage.LookupEntry(guardian_entry);
	CreatureInfo * info = CreatureNameStorage.LookupEntry(guardian_entry);
	if(!proto || !info)
	{
		OUT_DEBUG("Warning : Missing summon creature template %u !",guardian_entry);
		return NULL;
	}
	uint32 lvl = u_caster->getLevel();
	LocationVector v = GetPositionNC();
	float m_followAngle = angle + v.o;
	float x = v.x +(3*(cosf(m_followAngle)));
	float y = v.y +(3*(sinf(m_followAngle)));
	Creature* p = NULL;
	p = GetMapMgr()->CreateCreature(guardian_entry);
	if(p == NULL)
		return NULL;
	p->SetInstanceID(GetMapMgr()->GetInstanceID());
	p->Load(proto, x, y, v.z, angle);

	if (lvl != 0)
	{
		/* power */
		p->SetPowerType(POWER_TYPE_MANA);
		p->SetUInt32Value(UNIT_FIELD_MAXPOWER1,p->GetUInt32Value(UNIT_FIELD_MAXPOWER1)+28+10*lvl);
		p->SetUInt32Value(UNIT_FIELD_POWER1,p->GetUInt32Value(UNIT_FIELD_POWER1)+28+10*lvl);
		/* health */
		p->SetUInt32Value(UNIT_FIELD_MAXHEALTH,p->GetUInt32Value(UNIT_FIELD_MAXHEALTH)+28+30*lvl);
		p->SetUInt32Value(UNIT_FIELD_HEALTH,p->GetUInt32Value(UNIT_FIELD_HEALTH)+28+30*lvl);
		/* level */
		p->SetUInt32Value(UNIT_FIELD_LEVEL, lvl);
	}

	p->SetSummonedByGUID(GetGUID());
    p->SetCreatedByGUID(GetGUID());
    p->SetZoneId(GetZoneId());
	p->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,u_caster->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE));
	p->_setFaction();

	p->GetAIInterface()->Init(p,AITYPE_PET,MOVEMENTTYPE_NONE,u_caster);
	p->GetAIInterface()->SetUnitToFollow(TO_UNIT(this));
	p->GetAIInterface()->SetUnitToFollowAngle(angle);
	p->GetAIInterface()->SetFollowDistance(3.0f);

	p->PushToWorld(GetMapMgr());

	if(duration)
		sEventMgr.AddEvent(TO_UNIT(this), &Unit::SummonExpireSlot,Slot, EVENT_SUMMON_EXPIRE, duration, 1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );

	return p;

}
开发者ID:arcticdev,项目名称:arctic-test,代码行数:56,代码来源:GameObject.cpp

示例9: GetAreaId

void GameObject::getFishLoot(Loot *fishloot)
{
    fishloot->clear();

    uint32 subzone = GetAreaId();

    // if subzone loot exist use it
    if(LootTemplates_Fishing.HaveLootFor(subzone))
        fishloot->FillLoot(subzone, LootTemplates_Fishing, NULL);
    // else use zone loot
    else
        fishloot->FillLoot(GetZoneId(), LootTemplates_Fishing, NULL);
}
开发者ID:Actionfox,项目名称:mangos,代码行数:13,代码来源:GameObject.cpp

示例10: GetAreaId

void GameObject::getFishLoot(Loot *fishloot)
{
    fishloot->clear();

    uint32 subzone = GetAreaId();

    // if subzone loot exist use it
    if(LootTemplates_Fishing.find(subzone) != LootTemplates_Fishing.end())
        FillLoot(fishloot, subzone, LootTemplates_Fishing, NULL);
    // else use zone loot
    else
        FillLoot(fishloot, GetZoneId(), LootTemplates_Fishing, NULL);
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:13,代码来源:GameObject.cpp

示例11: KickPlayerFromBattlefield

void Battlefield::KickPlayerFromBattlefield(uint64 guid)
{
    if (Player* player = sObjectAccessor->FindPlayer(guid))
    {
        if (player->GetZoneId() == GetZoneId())
            player->TeleportTo(KickPosition);

        if (player->GetTeamId() >= 2)
            return;

        m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
        m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());

    }
}
开发者ID:3DViking,项目名称:MistCore,代码行数:15,代码来源:Battlefield.cpp

示例12: GetZoneId

// Called in WorldSession::HandleBfEntryInviteResponse
void Battlefield::PlayerAcceptInviteToWar(Player* player)
{
    if (!IsWarTime())
        return;

    if (AddOrSetPlayerToCorrectBfGroup(player))
    {
        player->GetSession()->SendBfEntered(GetQueueId(), player->GetZoneId() != GetZoneId(), player->GetTeamId() == GetAttackerTeam());
        m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
        m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());

        if (player->isAFK())
            player->ToggleAFK();

        OnPlayerJoinWar(player);                               //for scripting
    }
}
开发者ID:dantewow,项目名称:TrinityCore,代码行数:18,代码来源:Battlefield.cpp

示例13: GetZoneId

uint32 TerrainInfo::GetZoneId(GridPair const& gridPair) const
{
    float x = ((float)gridPair.x_coord - CENTER_GRID_ID - 0.5) * SIZE_OF_GRIDS + CENTER_GRID_OFFSET;
    float y = ((float)gridPair.y_coord - CENTER_GRID_ID - 0.5) * SIZE_OF_GRIDS + CENTER_GRID_OFFSET;
    return GetZoneId(x, y, 0.0f);
}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:6,代码来源:GridMap.cpp

示例14: data

void Player::SendInitialWorldstates(){
	WorldPacket data( SMSG_INIT_WORLD_STATES, 100 );
	m_mapMgr->GetWorldStatesHandler().BuildInitWorldStatesForZone( GetZoneId(), GetAreaID(), data );
	m_session->SendPacket( &data );
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:5,代码来源:PlayerPacketWrapper.cpp

示例15: switch


//.........这里部分代码省略.........
            Player* player = (Player*)user;

            if(info->camera.cinematicId)
            {
                WorldPacket data(SMSG_TRIGGER_CINEMATIC, 4);
                data << info->camera.cinematicId;
                player->GetSession()->SendPacket(&data);
            }
            return;
        }
        //fishing bobber
        case GAMEOBJECT_TYPE_FISHINGNODE:                   //17
        {
            if(user->GetTypeId()!=TYPEID_PLAYER)
                return;

            Player* player = (Player*)user;

            if(player->GetGUID() != GetOwnerGUID())
                return;

            switch(getLootState())
            {
                case GO_READY:                              // ready for loot
                {
                    // 1) skill must be >= base_zone_skill
                    // 2) if skill == base_zone_skill => 5% chance
                    // 3) chance is linear dependence from (base_zone_skill-skill)

                    uint32 subzone = GetAreaId();

                    int32 zone_skill = objmgr.GetFishingBaseSkillLevel( subzone );
                    if(!zone_skill)
                        zone_skill = objmgr.GetFishingBaseSkillLevel( GetZoneId() );

                    //provide error, no fishable zone or area should be 0
                    if(!zone_skill)
                        sLog.outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.",subzone);

                    int32 skill = player->GetSkillValue(SKILL_FISHING);
                    int32 chance = skill - zone_skill + 5;
                    int32 roll = irand(1,100);

                    DEBUG_LOG("Fishing check (skill: %i zone min skill: %i chance %i roll: %i",skill,zone_skill,chance,roll);

                    if(skill >= zone_skill && chance >= roll)
                    {
                        // prevent removing GO at spell cancel
                        player->RemoveGameObject(this,false);
                        SetOwnerGUID(player->GetGUID());

                        //fish catched
                        player->UpdateFishingSkill();

                        GameObject* ok = LookupFishingHoleAround(DEFAULT_VISIBILITY_DISTANCE);
                        if (ok)
                        {
                            player->SendLoot(ok->GetGUID(),LOOT_FISHINGHOLE);
                            SetLootState(GO_JUST_DEACTIVATED);
                        }
                        else
                            player->SendLoot(GetGUID(),LOOT_FISHING);
                    }
                    else
                    {
                        // fish escaped, can be deleted now
开发者ID:Actionfox,项目名称:mangos,代码行数:67,代码来源:GameObject.cpp


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