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

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

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

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

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

示例1: GetHeightStatic

GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data) const{    GridMapLiquidStatus result = LIQUID_MAP_NO_WATER;    VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();    uint32 liquid_type = 0;    float liquid_level = INVALID_HEIGHT_VALUE;    float ground_level = GetHeightStatic(x, y, z, true, DEFAULT_WATER_SEARCH);    if (vmgr->GetLiquidLevel(GetMapId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type))    {        // DEBUG_LOG("getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type);        // Check water level and ground level        if (liquid_level > ground_level && z > ground_level - 2)        {            // All ok in water -> store data            if (data)            {                // hardcoded in client like this                if (GetMapId() == 530 && liquid_type == 2)                    liquid_type = 15;                uint32 liquidFlagType = 0;                if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type))                    liquidFlagType = liq->Type;                if (liquid_type && liquid_type < 21)                {                    if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetMapId()))                    {                        uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];                        if (!overrideLiquid && area->zone)                        {                            area = GetAreaEntryByAreaID(area->zone);                            if (area)                                overrideLiquid = area->LiquidTypeOverride[liquidFlagType];                        }                        if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid))                        {                            liquid_type = overrideLiquid;                            liquidFlagType = liq->Type;                        }                    }                }                data->level = liquid_level;                data->depth_level = ground_level;                data->entry = liquid_type;                data->type_flags = 1 << liquidFlagType;            }            // For speed check as int values            int delta = int((liquid_level - z) * 10);            // Get position delta            if (delta > 20)                   // Under water                return LIQUID_MAP_UNDER_WATER;            if (delta > 0)                    // In water                return LIQUID_MAP_IN_WATER;            if (delta > -1)                   // Walk on water                return LIQUID_MAP_WATER_WALK;            result = LIQUID_MAP_ABOVE_WATER;        }    }    else if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))    {        GridMapLiquidData map_data;        GridMapLiquidStatus map_result = gmap->getLiquidStatus(x, y, z, ReqLiquidType, &map_data);        // Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER:        if (map_result != LIQUID_MAP_NO_WATER && (map_data.level > ground_level))        {            if (data)            {                // hardcoded in client like this                if (GetMapId() == 530 && map_data.entry == 2)                    map_data.entry = 15;                *data = map_data;            }            return map_result;        }    }    return result;}
开发者ID:StarCore,项目名称:mangos3,代码行数:84,


示例2: HandlePlayerUnderMap

bool BattlegroundNA::HandlePlayerUnderMap(Player *player){    player->TeleportTo(GetMapId(), 4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation(), false);    return true;}
开发者ID:rexy,项目名称:ArkCORE,代码行数:5,


示例3: HandlePlayerUnderMap

bool BattleGroundDS::HandlePlayerUnderMap(Player *player){    player->TeleportTo(GetMapId(),1299.046f,784.825f,9.338f,player->GetOrientation(),false);    return true;}
开发者ID:MichaelFurth,项目名称:RCore,代码行数:5,


示例4: GetTemplate

// to cache or not to cache, that is the questionInstanceTemplate const* DungeonPersistentState::GetTemplate() const{    return ObjectMgr::GetInstanceTemplate(GetMapId());}
开发者ID:klyxmaster,项目名称:mangos-wotlk,代码行数:5,


示例5: HandlePlayerUnderMap

bool BattleGroundBE::HandlePlayerUnderMap(Player* player){    player->TeleportTo(GetMapId(), 6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());    return true;}
开发者ID:AlexHjelm,项目名称:Core,代码行数:5,


示例6: GetArenaMatchmakerRating

void Arena::EndBattleground(uint32 winner){    // arena rating calculation    if (isRated())    {        uint32 loserTeamRating        = 0;        uint32 loserMatchmakerRating  = 0;        int32  loserChange            = 0;        int32  loserMatchmakerChange  = 0;        uint32 winnerTeamRating       = 0;        uint32 winnerMatchmakerRating = 0;        int32  winnerChange           = 0;        int32  winnerMatchmakerChange = 0;        ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));        ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));        if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)        {            loserTeamRating = loserArenaTeam->GetRating();            loserMatchmakerRating = GetArenaMatchmakerRating(GetOtherTeam(winner));            winnerTeamRating = winnerArenaTeam->GetRating();            winnerMatchmakerRating = GetArenaMatchmakerRating(winner);            if (winner != 0)            {                winnerMatchmakerChange = winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange);                loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange);                TC_LOG_DEBUG("bg.arena", "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---",                    GetArenaType(), winnerTeamRating, winnerChange, winnerMatchmakerRating, winnerMatchmakerChange,                    loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);                SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);                SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);                // bg team that the client expects is different to TeamId                // alliance 1, horde 0                uint8 winnerTeam = winner == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE;                uint8 loserTeam = winner == ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;                _arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName());                _arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName());                TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d",                    GetArenaType(), GetArenaTeamIdByIndex(TEAM_ALLIANCE), GetArenaTeamIdByIndex(TEAM_HORDE), winnerArenaTeam->GetId(), winnerChange, loserChange);                if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))                    for (auto const& score : PlayerScores)                        if (Player* player = ObjectAccessor::FindConnectedPlayer(ObjectGuid(HighGuid::Player, score.first)))                        {                            TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (GUID: %u, Team: %d, IP: %s): %s",                                GetArenaType(), player->GetName().c_str(), score.first, player->GetArenaTeamId(GetArenaType() == 5 ? 2 : GetArenaType() == 3),                                player->GetSession()->GetRemoteAddress().c_str(), score.second->ToString().c_str());                        }            }            // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes            else            {                _arenaTeamScores[BG_TEAM_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());                _arenaTeamScores[BG_TEAM_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());                winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);                loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);            }            uint8 aliveWinners = GetAlivePlayersCountByTeam(winner);            for (auto const& i : GetPlayers())            {                uint32 team = i.second.Team;                if (i.second.OfflineRemoveTime)                {                    // if rated arena match - make member lost!                    if (team == winner)                        winnerArenaTeam->OfflineMemberLost(i.first, loserMatchmakerRating, winnerMatchmakerChange);                    else                        loserArenaTeam->OfflineMemberLost(i.first, winnerMatchmakerRating, loserMatchmakerChange);                    continue;                }                Player* player = _GetPlayer(i.first, i.second.OfflineRemoveTime != 0, "Arena::EndBattleground");                if (!player)                    continue;                // per player calculation                if (team == winner)                {                    // update achievement BEFORE personal rating update                    uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());                    player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);                    player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());                    // Last standing - Rated 5v5 arena & be solely alive player                    if (GetArenaType() == ARENA_TYPE_5v5 && aliveWinners == 1 && player->IsAlive())                        player->CastSpell(player, SPELL_LAST_MAN_STANDING, true);                    winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);                }//.........这里部分代码省略.........
开发者ID:boom8866,项目名称:MaddieCore,代码行数:101,


示例7: DEBUG_LOG

DungeonPersistentState::~DungeonPersistentState(){    DEBUG_LOG("Unloading DungeonPersistantState of map %u instance %u", GetMapId(), GetInstanceId());    UnbindThisState();}
开发者ID:klyxmaster,项目名称:mangos-wotlk,代码行数:5,


示例8: GetMapId

bool Game_Vehicle::IsInCurrentMap() const {	return GetMapId() == Game_Map::GetMapId();}
开发者ID:ChristianBreitwieser,项目名称:easyrpg-libretro,代码行数:3,


示例9: if

//.........这里部分代码省略.........				if( plObj )					plObj->RemoveIfVisible(curObj);				if( curObj->IsPlayer() )					static_cast< Player* >( curObj )->RemoveIfVisible(obj);				curObj->RemoveInRangeObject(obj);				if( obj->GetMapMgr() != this )				{					/* Something removed us. */					return;				}				obj->RemoveInRangeObject(iter2);			}		}	}	///////////////////////////	// Get new cell coordinates	///////////////////////////	if(obj->GetMapMgr() != this)	{		/* Something removed us. */		return;	}	if(obj->GetPositionX() >= _maxX || obj->GetPositionX() <= _minX ||		obj->GetPositionY() >= _maxY || obj->GetPositionY() <= _minY)	{		if(obj->IsPlayer())		{			Player* plr = static_cast< Player* >( obj );			if(plr->GetBindMapId() != GetMapId())			{				plr->SafeTeleport(plr->GetBindMapId(),0,plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				return;			}			else			{				obj->GetPositionV()->ChangeCoords(plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				WorldPacket * data = plr->BuildTeleportAckMsg(plr->GetPosition());				plr->GetSession()->SendPacket(data);				delete data;			}		}		else		{			obj->GetPositionV()->ChangeCoords(0,0,0,0);		}	}	uint32 cellX = GetPosX(obj->GetPositionX());	uint32 cellY = GetPosY(obj->GetPositionY());	if(cellX >= _sizeX || cellY >= _sizeY)	{		return;	}	MapCell *objCell = GetCell(cellX, cellY);	MapCell * pOldCell = obj->GetMapCell();	if (!objCell)	{
开发者ID:Chero,项目名称:abcwow,代码行数:67,


示例10: urand

void BattleGroundDS::Update(uint32 diff){    BattleGround::Update(diff);    if (GetStatus() == STATUS_IN_PROGRESS)    {        // push people from the tubes        if (pushbackCheck)        {            // knockback            if (m_uiKnockback < diff)            {                for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)                {                    Player *plr = sObjectMgr.GetPlayer(itr->first);                    if (!plr)                        continue;                    if (GameObject* obj = plr->GetGameObject(48018))                         // Remove Demonic Circle                        obj->Delete();                    if (plr->GetPositionZ() < 11.0f)                        continue;                    float angle = (plr->GetBGTeam() == ALLIANCE /*gold*/) ? plr->GetAngle(1259.58f, 764.43f) : plr->GetAngle(1325.84f, 817.304f);                    plr->KnockBackPlayerWithAngle(angle, 45, 7);                    if (plr->IsWithinDist2d(1214, 765, 50) && plr->IsWithinLOS(1214, 765, 14))                        plr->KnockBackPlayerWithAngle(6.40f,55,7);                    if (plr->IsWithinDist2d(1369, 817, 50) && plr->IsWithinLOS(1369, 817, 14))                        plr->KnockBackPlayerWithAngle(3.03f,55,7);                }                pushbackCheck = false;                m_uiKnockback = 1000;            }            else                m_uiKnockback -= diff;        }        // in case pushback failed        if (teleportCheck)        {            if (m_uiTeleport < diff)            {                for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)                {                    if (Player *plr = sObjectMgr.GetPlayer(itr->first))                    {                        if (plr->GetPositionZ() < 11.0f)                            continue;                        float x, y;                        if (plr->GetBGTeam() == ALLIANCE)                        {                            x = 1259.58f;                            y = 764.43f;                        }                        else                        {                            x = 1325.84f;                            y = 817.304f;                        }                        plr->TeleportTo(GetMapId(), x + urand(0,2), y + urand(0,2), 3.15f, plr->GetOrientation());                    }                }                teleportCheck = false;                // close the gate                OpenDoorEvent(BG_EVENT_DOOR);            }            else                m_uiTeleport -= diff;        }        // Waterfall        if (m_uiWaterfall < diff)        {            if (waterfallActivated)            {                SpawnEvent(WATERFALL_EVENT, 0, false);                waterfallActivated = false;            }            else            {                SpawnEvent(WATERFALL_EVENT, 0, true);                waterfallActivated = true;                for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)                {                    Player * plr = sObjectMgr.GetPlayer(itr->first);                    if (plr && plr->GetDistance2d(1291, 790) <= 6)                        plr->KnockBackFrom(plr, -20.0f, 9.0f);                }            }            m_uiWaterfall = urand(30,45)*IN_MILLISECONDS;        }        else            m_uiWaterfall -= diff;//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:mangos,代码行数:101,


示例11: SetThreadName

bool MapMgr::Do(){#ifdef WIN32	threadid=GetCurrentThreadId();#endif	thread_running = true;	ThreadState =THREADSTATE_BUSY;	SetThreadName("Map mgr - M%u|I%u",this->_mapId ,this->m_instanceID);	ObjectSet::iterator i;	uint32 last_exec=getMSTime();	/* create static objects */	for(GOSpawnList::iterator itr = _map->staticSpawns.GOSpawns.begin(); itr != _map->staticSpawns.GOSpawns.end(); ++itr)	{		GameObject * obj = CreateGameObject((*itr)->entry);		obj->Load((*itr));		_mapWideStaticObjects.insert(obj);	}	for(CreatureSpawnList::iterator itr = _map->staticSpawns.CreatureSpawns.begin(); itr != _map->staticSpawns.CreatureSpawns.end(); ++itr)	{		Creature * obj = CreateCreature((*itr)->entry);		obj->Load(*itr, 0, pMapInfo);		_mapWideStaticObjects.insert(obj);	}	/* add static objects */	for(set<Object*>::iterator itr = _mapWideStaticObjects.begin(); itr != _mapWideStaticObjects.end(); ++itr)		PushStaticObject(*itr);	/* load corpses */	objmgr.LoadCorpses(this);	// always declare local variables outside of the loop!	// otherwise theres a lot of sub esp; going on.	uint32 exec_time, exec_start;#ifdef WIN32	HANDLE hThread = GetCurrentThread();#endif	while((ThreadState != THREADSTATE_TERMINATE) && !_shutdown)	{		exec_start=getMSTime();		//first push to world new objects		m_objectinsertlock.Acquire();//<<<<<<<<<<<<<<<<		if(m_objectinsertpool.size())		{			for(i=m_objectinsertpool.begin();i!=m_objectinsertpool.end();i++)			{				//PushObject(*i);				(*i)->PushToWorld(this);			}			m_objectinsertpool.clear();		}		m_objectinsertlock.Release();//>>>>>>>>>>>>>>>>		//-------------------------------------------------------						//Now update sessions of this map + objects		_PerformObjectDuties();		last_exec=getMSTime();		exec_time=last_exec-exec_start;		if(exec_time<MAP_MGR_UPDATE_PERIOD)		{			/*				The common place I see this is waiting for a Win32 thread to exit. I used to come up with all sorts of goofy,				elaborate event-based systems to do this myself until I discovered that thread handles are waitable. Just use				WaitForSingleObject() on the thread handle and you're done. No risking race conditions with the thread exit code.				I think pthreads has pthread_join() for this too.				- http://www.virtualdub.org/blog/pivot/entry.php?id=62			*/#ifdef WIN32			WaitForSingleObject(hThread, MAP_MGR_UPDATE_PERIOD-exec_time);#else			Sleep(MAP_MGR_UPDATE_PERIOD-exec_time);#endif		}		//////////////////////////////////////////////////////////////////////////		// Check if we have to die :P		//////////////////////////////////////////////////////////////////////////		if(InactiveMoveTime && UNIXTIME >= InactiveMoveTime)			break;	}	// Clear the instance's reference to us.	if(m_battleground)	{		BattlegroundManager.DeleteBattleground(m_battleground);		sInstanceMgr.DeleteBattlegroundInstance( GetMapId(), GetInstanceID() );	}	if(pInstance)	{		// check for a non-raid instance, these expire after 10 minutes.		if(GetMapInfo()->type == INSTANCE_NONRAID || pInstance->m_isBattleground)		{			pInstance->m_mapMgr = NULL;//.........这里部分代码省略.........
开发者ID:Chero,项目名称:abcwow,代码行数:101,


示例12: ASSERT

void MapMgr::PushObject(Object *obj){	/////////////	// Assertions	/////////////	ASSERT(obj);		// That object types are not map objects. TODO: add AI groups here?	if(obj->GetTypeId() == TYPEID_ITEM || obj->GetTypeId() == TYPEID_CONTAINER)	{		// mark object as updatable and exit		return;	}	if(obj->GetTypeId() == TYPEID_CORPSE)	{		m_corpses.insert(((Corpse*)obj));	}			obj->ClearInRangeSet();	ASSERT(obj->GetMapId() == _mapId);	if(!(obj->GetPositionX() < _maxX && obj->GetPositionX() > _minX) || 	   !(obj->GetPositionY() < _maxY && obj->GetPositionY() > _minY))	{		if(obj->IsPlayer())		{			Player * plr = static_cast< Player* >( obj );			if(plr->GetBindMapId() != GetMapId())			{				plr->SafeTeleport(plr->GetBindMapId(),0,plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				return;			}			else			{				obj->GetPositionV()->ChangeCoords(plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				WorldPacket * data = plr->BuildTeleportAckMsg(plr->GetPosition());				plr->GetSession()->SendPacket(data);				delete data;			}		}		else		{			obj->GetPositionV()->ChangeCoords(0,0,0,0);		}	}	ASSERT(obj->GetPositionY() < _maxY && obj->GetPositionY() > _minY);	ASSERT(_cells);	///////////////////////	// Get cell coordinates	///////////////////////	uint32 x = GetPosX(obj->GetPositionX());	uint32 y = GetPosY(obj->GetPositionY());	if(x >= _sizeX || y >= _sizeY)	{		if(obj->IsPlayer())		{			Player * plr = static_cast< Player* >( obj );			if(plr->GetBindMapId() != GetMapId())			{				plr->SafeTeleport(plr->GetBindMapId(),0,plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				return;			}			else			{				obj->GetPositionV()->ChangeCoords(plr->GetBindPositionX(),plr->GetBindPositionY(),plr->GetBindPositionZ(),0);				plr->GetSession()->SystemMessage("Teleported you to your hearthstone location as you were out of the map boundaries.");				WorldPacket * data = plr->BuildTeleportAckMsg(plr->GetPosition());				plr->GetSession()->SendPacket(data);				delete data;			}		}		else		{			obj->GetPositionV()->ChangeCoords(0,0,0,0);		}		x = GetPosX(obj->GetPositionX());		y = GetPosY(obj->GetPositionY());	}	MapCell *objCell = GetCell(x,y);	if (!objCell)	{		objCell = Create(x,y);		objCell->Init(x, y, _mapId, this);	}	uint32 endX = (x <= _sizeX) ? x + 1 : (_sizeX-1);	uint32 endY = (y <= _sizeY) ? y + 1 : (_sizeY-1);	uint32 startX = x > 0 ? x - 1 : 0;	uint32 startY = y > 0 ? y - 1 : 0;	uint32 posX, posY;	MapCell *cell;//.........这里部分代码省略.........
开发者ID:Chero,项目名称:abcwow,代码行数:101,


示例13: GetCaster

void DynamicObject::Update(uint32 p_time){    // caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor    Unit* caster = GetCaster();    if(!caster)    {        Delete();        return;    }    bool deleteThis = false;    if(m_aliveDuration > int32(p_time))        m_aliveDuration -= p_time;    else        deleteThis = true;    // TODO: make a timer and update this in larger intervals    CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));    Cell cell = RedZone::GetZone(p);    cell.data.Part.reserved = ALL_DISTRICT;    cell.SetNoCreate();    MaNGOS::DynamicObjectUpdater notifier(*this,caster);    TypeContainerVisitor<MaNGOS::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier);    TypeContainerVisitor<MaNGOS::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);    CellLock<GridReadGuard> cell_lock(cell, p);    cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this));    cell_lock->Visit(cell_lock, grid_object_notifier,  *MapManager::Instance().GetMap(GetMapId(), this));    if(deleteThis)    {        caster->RemoveDynObjectWithGUID(GetGUID());        Delete();    }}
开发者ID:Artea,项目名称:mangos-svn,代码行数:38,


示例14: switch

//.........这里部分代码省略.........                    {                        case GAMEOBJECT_TYPE_FISHINGNODE:   //  can't fish now                        {                            Unit* caster = GetOwner();                            if(caster && caster->GetTypeId()==TYPEID_PLAYER)                            {                                if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL])                                {                                    caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->SendChannelUpdate(0);                                    caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->finish(false);                                }                                WorldPacket data(SMSG_FISH_NOT_HOOKED,0);                                ((Player*)caster)->GetSession()->SendPacket(&data);                            }                            // can be delete                            m_lootState = GO_JUST_DEACTIVATED;                            return;                        }                        case GAMEOBJECT_TYPE_DOOR:                        case GAMEOBJECT_TYPE_BUTTON:                            //we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)                            if( !GetGoState() )                                SwitchDoorOrButton(false);                            //flags in AB are type_button and we need to add them here so no break!                        default:                            if(!m_spawnedByDefault)         // despawn timer                            {                                                            // can be despawned or destroyed                                SetLootState(GO_JUST_DEACTIVATED);                                return;                            }                                                            // respawn timer                            MapManager::Instance().GetMap(GetMapId(), this)->Add(this);                            break;                    }                }            }            // traps can have time and can not have            GameObjectInfo const* goInfo = GetGOInfo();            if(goInfo->type == GAMEOBJECT_TYPE_TRAP)            {                // traps                Unit* owner = GetOwner();                Unit* ok = NULL;                            // pointer to appropriate target if found any                if(m_cooldownTime >= time(NULL))                    return;                bool IsBattleGroundTrap = false;                //FIXME: this is activation radius (in different casting radius that must be selected from spell data)                //TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state                float radius = goInfo->trap.radius;                if(!radius)                {                    if(goInfo->trap.cooldown != 3)            // cast in other case (at some triggering/linked go/etc explicit call)                    {                        // try to read radius from trap spell                        if(const SpellEntry *spellEntry = sSpellStore.LookupEntry(goInfo->trap.spellId))                            radius = GetSpellRadius(spellEntry,0,false);                        //    radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellEntry->EffectRadiusIndex[0]));                        if(!radius)                            break;
开发者ID:de-dima,项目名称:243,代码行数:67,


示例15: HandlePlayerUnderMap

bool BattleGroundRV::HandlePlayerUnderMap(Player *player){    player->TeleportTo(GetMapId(), 763.5f, -284, 28.276f, player->GetOrientation(), false);    return true;}
开发者ID:Agustin1010,项目名称:Mangos-Agustin,代码行数:5,


示例16: GetTeam

void Player::Reputation_OnKilledUnit(Unit* pUnit, bool InnerLoop){	// add rep for on kill	if(pUnit->GetTypeId() != TYPEID_UNIT || pUnit->IsPet())		return;	Group * m_Group = m_playerInfo->m_Group;	if(!InnerLoop && m_Group)	{		/* loop the rep for group members */		m_Group->getLock().Acquire();		GroupMembersSet::iterator it;		for(uint32 i = 0; i < m_Group->GetSubGroupCount(); ++i)		{			for(it = m_Group->GetSubGroup(i)->GetGroupMembersBegin(); it != m_Group->GetSubGroup(i)->GetGroupMembersEnd(); ++it)			{				if((*it)->m_loggedInPlayer && (*it)->m_loggedInPlayer->isInRange(TO_PLAYER(this),100.0f))					(*it)->m_loggedInPlayer->Reputation_OnKilledUnit(pUnit, true);			}		}		m_Group->getLock().Release();		return;	}	int team = GetTeam();	ReputationModifier * modifier = objmgr.GetReputationModifier(pUnit->GetEntry(), pUnit->m_factionDBC->ID);	if(modifier != 0)	{		// Apply this data.		for(vector<ReputationMod>::iterator itr = modifier->mods.begin(); itr != modifier->mods.end(); ++itr)		{			if(!(*itr).faction[team])				continue;			/* rep limit? */			if (!IS_INSTANCE(GetMapId()) || (IS_INSTANCE(GetMapId()) && this->iInstanceType != MODE_5PLAYER_HEROIC))			{				if((*itr).replimit)				{					if(GetStanding((*itr).faction[team]) >= (int32)(*itr).replimit)						continue;				}			}			int32 value = int32(float(itr->value) * sWorld.getRate(RATE_KILLREPUTATION));			//value *= sWorld.getRate(RATE_KILLREPUTATION);			ModStanding(itr->faction[team], value);		}	}	else	{		if(IS_INSTANCE(GetMapId()) && objmgr.HandleInstanceReputationModifiers(TO_PLAYER(this), pUnit))			return;		if(pUnit->m_factionDBC->RepListId < 0)			return;		// decrease rep by 5.		int change = -5;		change = int32((float(change) * sWorld.getRate(RATE_KILLREPUTATION)));		ModStanding(pUnit->m_factionDBC->ID, change);	}}
开发者ID:AscNHalf,项目名称:AscNHalf,代码行数:63,


示例17: GenerateResearchSiteInMap

void Player::UseResearchSite(uint32 id){    _researchSites.erase(id);    GenerateResearchSiteInMap(GetMapId());}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:5,


示例18: GetHeight

float TerrainInfo::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchDist) const{    // find raw .map surface under Z coordinates    float mapHeight;    float z2 = z + 2.f;    if (GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))    {        float _mapheight = gmap->getHeight(x,y);        // look from a bit higher pos to find the floor, ignore under surface case        if (z2 > _mapheight)            mapHeight = _mapheight;        else            mapHeight = VMAP_INVALID_HEIGHT_VALUE;    }    else        mapHeight = VMAP_INVALID_HEIGHT_VALUE;    float vmapHeight;    if (pUseVmaps)    {        VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();        if (vmgr->isHeightCalcEnabled())        {            // if mapHeight has been found search vmap height at least until mapHeight point            // this prevent case when original Z "too high above ground and vmap height search fail"            // this will not affect most normal cases (no map in instance, or stay at ground at continent)            if (mapHeight > INVALID_HEIGHT && z2 - mapHeight > maxSearchDist)                maxSearchDist = z2 - mapHeight + 1.0f;      // 1.0 make sure that we not fail for case when map height near but above for vamp height            // look from a bit higher pos to find the floor            vmapHeight = vmgr->getHeight(GetMapId(), x, y, z2, maxSearchDist);        }        else            vmapHeight = VMAP_INVALID_HEIGHT_VALUE;    }    else        vmapHeight = VMAP_INVALID_HEIGHT_VALUE;    //hack for LK frozen throne true height    if (GetAreaId(x,y,z) == 4859)    {        mapHeight  += 200.0f;        vmapHeight += 200.0f;    }    // mapHeight set for any above raw ground Z or <= INVALID_HEIGHT    // vmapheight set for any under Z value or <= INVALID_HEIGHT    if (vmapHeight > INVALID_HEIGHT)    {        if (mapHeight > INVALID_HEIGHT)        {            // we have mapheight and vmapheight and must select more appropriate            // we are already under the surface or vmap height above map heigt            // or if the distance of the vmap height is less the land height distance            if (z < mapHeight || vmapHeight > mapHeight || fabs(mapHeight-z) > fabs(vmapHeight-z))                return vmapHeight;            else                return mapHeight;                           // better use .map surface height        }        else            return vmapHeight;                              // we have only vmapHeight (if have)    }    return mapHeight;}
开发者ID:Archives,项目名称:easy-mangos,代码行数:69,


示例19: VALUES

/*    Called from AddPersistentState*/void DungeonPersistentState::SaveToDB(){    // state instance data too    std::string data;    if (Map* map = GetMap())    {        InstanceData* iData = map->GetInstanceData();        if (iData && iData->Save())        {            data = iData->Save();            CharacterDatabase.escape_string(data);        }    }    CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str());}
开发者ID:klyxmaster,项目名称:mangos-wotlk,代码行数:20,


示例20: SetUInt32Value

//.........这里部分代码省略.........	SetUInt32Value(UNIT_FIELD_FLAGS, spawn->flags);	SetUInt32Value(UNIT_NPC_EMOTESTATE, spawn->emote_state);	SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, proto->BoundingRadius);	SetFloatValue(UNIT_FIELD_COMBATREACH, proto->CombatReach);	original_emotestate = spawn->emote_state;	// set position	m_position.ChangeCoords( spawn->x, spawn->y, spawn->z, spawn->o );	m_spawnLocation.ChangeCoords(spawn->x, spawn->y, spawn->z, spawn->o);	m_aiInterface->setMoveType(spawn->movetype);		m_aiInterface->m_waypoints = objmgr.GetWayPointMap(spawn->id);	m_faction = dbcFactionTemplate.LookupEntry(spawn->factionid);	if(m_faction)	{		m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction);		// not a neutral creature		if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0))		{			GetAIInterface()->m_canCallForHelp = true;		}	}//SETUP NPC FLAGS	SetUInt32Value(UNIT_NPC_FLAGS,proto->NPCFLags);	if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ) )		m_SellItems = objmgr.GetVendorList(GetEntry());	if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ) )		_LoadQuests();	if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TAXIVENDOR) )		m_TaxiNode = sTaxiMgr.GetNearestTaxiNode( m_position.x, m_position.y, m_position.z, GetMapId() );	if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER_PROF))		mTrainer = objmgr.GetTrainer(GetEntry());	if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ) )		auctionHouse = sAuctionMgr.GetAuctionHouse(GetEntry());//NPC FLAGS	 m_aiInterface->m_waypoints=objmgr.GetWayPointMap(spawn->id);	//load resistances	for(uint32 x=0;x<7;x++)		BaseResistance[x]=GetUInt32Value(UNIT_FIELD_RESISTANCES+x);	for(uint32 x=0;x<5;x++)		BaseStats[x]=GetUInt32Value(UNIT_FIELD_STAT0+x);	BaseDamage[0]=GetFloatValue(UNIT_FIELD_MINDAMAGE);	BaseDamage[1]=GetFloatValue(UNIT_FIELD_MAXDAMAGE);	BaseOffhandDamage[0]=GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE);	BaseOffhandDamage[1]=GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE);	BaseRangedDamage[0]=GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE);	BaseRangedDamage[1]=GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE);	BaseAttackType=proto->AttackType;	SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);   // better set this one	SetUInt32Value(UNIT_FIELD_BYTES_0, spawn->bytes);	SetUInt32Value(UNIT_FIELD_BYTES_2, spawn->bytes2);////////////AI		// kek	for(list<AI_Spell*>::iterator itr = proto->spells.begin(); itr != proto->spells.end(); ++itr)
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:67,


示例21: UpdateEncounterState

void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry){    DungeonEncounterMapBounds bounds = sObjectMgr.GetDungeonEncounterBounds(creditEntry);    for (DungeonEncounterMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)    {        DungeonEncounterEntry const* dbcEntry = iter->second->dbcEntry;        if (iter->second->creditType == type && Difficulty(dbcEntry->Difficulty) == GetDifficulty() && dbcEntry->mapId == GetMapId())        {            m_completedEncountersMask |= 1 << dbcEntry->encounterIndex;            CharacterDatabase.PExecute("UPDATE instance SET encountersMask = '%u' WHERE id = '%u'", m_completedEncountersMask, GetInstanceId());            DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);            if (/*uint32 dungeonId =*/ iter->second->lastEncounterDungeon)            {                DEBUG_LOG("DungeonPersistentState:: Dungeon %s (Instance-Id %u) completed last encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);                // Place LFG reward here            }            return;        }    }}
开发者ID:klyxmaster,项目名称:mangos-wotlk,代码行数:24,


示例22: HandlePlayerUnderMap

bool BattlegroundBE::HandlePlayerUnderMap(Player* player){    player->TeleportTo(GetMapId(), 6237.79768f, 261.142f, 2.0f, 4.0f, false);    return true;}
开发者ID:GetPlay,项目名称:TC,代码行数:5,


示例23: GetLowGUID

void Corpse::SaveToDB(){	//save corpse to DB	std::stringstream ss;	ss << "DELETE FROM corpses WHERE guid = " << GetLowGUID();	CharacterDatabase.Execute( ss.str( ).c_str( ) );	ss.rdbuf()->str("");	ss << "INSERT INTO corpses (guid, positionX, positionY, positionZ, orientation, zoneId, mapId, data, instanceId) VALUES ("		<< GetLowGUID() << ", '" << GetPositionX() << "', '" << GetPositionY() << "', '" << GetPositionZ() << "', '" << GetOrientation() << "', '" << GetZoneId() << "', '" << GetMapId() << "', '";	for(uint16 i = 0; i < m_valuesCount; i++ )		ss << GetUInt32Value(i) << " ";	ss << "', " << GetInstanceID() << " )";	CharacterDatabase.Execute( ss.str().c_str() );}
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:18,


示例24: HandlePlayerUnderMap

bool BattlegroundDS::HandlePlayerUnderMap(Player *player){    player->TeleportTo(GetMapId(), 1299.046, 784.825, 9.338, 2.422, false);    return true;}
开发者ID:InkVisible,项目名称:wow,代码行数:5,


示例25: HandlePlayerUnderMap

bool BattlegroundRV::HandlePlayerUnderMap(Player* player){    player->TeleportTo(GetMapId(), 763.5f, -284, 28.276f, 2.422f, false);    return true;}
开发者ID:AnthoDevMoP,项目名称:Genesis,代码行数:5,


示例26: HandlePlayerUnderMap

bool BattlegroundRL::HandlePlayerUnderMap(Player* player){    player->TeleportTo(GetMapId(), 1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation(), false);    return true;}
开发者ID:AntReX,项目名称:survival,代码行数:5,


示例27: GetEntry

void Vehicle::InstallAccessories(){	CreatureProtoVehicle* acc = CreatureProtoVehicleStorage.LookupEntry(GetEntry());	if(acc == NULL)	{		sLog.outDetail("Vehicle %u has no accessories.", GetEntry());		return;	}	MapMgr* map = (GetMapMgr() ? GetMapMgr() : sInstanceMgr.GetMapMgr(GetMapId()));	if(map == NULL) // Shouldn't ever really happen.		return;	for(int i = 0; i < 8; i++)	{		SeatInfo seatinfo = acc->seats[i];		if(!seatinfo.accessoryentry || (seatinfo.accessoryentry == GetEntry()))			continue;		if(m_vehicleSeats[i] == NULL)		{			sLog.outDetail("No seatmap for selected seat./n");			continue;		}		// Load the Proto		CreatureProto* proto = CreatureProtoStorage.LookupEntry(seatinfo.accessoryentry);		CreatureInfo* info = CreatureNameStorage.LookupEntry(seatinfo.accessoryentry);		if(!proto || !info)		{			sLog.outError("No proto/info for vehicle accessory %u in vehicle %u", seatinfo.accessoryentry, GetEntry());			continue;		}		// Remove any passengers.		if(m_passengers[i])			RemovePassenger(m_passengers[i]);		if(proto->vehicle_entry > 0)		{			// Create the Vehicle!			Vehicle* pass = map->CreateVehicle(seatinfo.accessoryentry);			if(pass != NULL && pass)			{				pass->Load(proto, (IsInInstance() ? map->iInstanceMode : MODE_5PLAYER_NORMAL),					GetPositionX()+m_vehicleSeats[i]->m_attachmentOffsetX,					GetPositionY()+m_vehicleSeats[i]->m_attachmentOffsetY,					GetPositionZ()+m_vehicleSeats[i]->m_attachmentOffsetZ);				pass->Init();				pass->m_TransporterGUID = GetGUID();				pass->InitSeats(proto->vehicle_entry);				if(pass->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))					pass->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); // Accessory				AddPassenger(pass, i, true);				pass->PushToWorld(map);			}		}		else		{			// Create the Unit!			Creature* pass = map->CreateCreature(seatinfo.accessoryentry);			if(pass != NULL)			{				pass->Load(proto, map->iInstanceMode,					GetPositionX()+m_vehicleSeats[i]->m_attachmentOffsetX,					GetPositionY()+m_vehicleSeats[i]->m_attachmentOffsetY,					GetPositionZ()+m_vehicleSeats[i]->m_attachmentOffsetZ);				pass->Init();				pass->m_TransporterGUID = GetGUID();				AddPassenger(pass, i, true);				pass->PushToWorld(map);			}		}	}}
开发者ID:SkyFire,项目名称:sandshroud,代码行数:79,



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


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