本文整理汇总了C++中Map::GetDifficulty方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetDifficulty方法的具体用法?C++ Map::GetDifficulty怎么用?C++ Map::GetDifficulty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetDifficulty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGroupSetLeaderOpcode
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
{
ObjectGuid guid;
recv_data >> guid;
Group *group = GetPlayer()->GetGroup();
if (!group)
return;
Player *player = sObjectMgr.GetPlayer(guid);
/** error handling **/
if (!player || !group->IsLeader(GetPlayer()->GetObjectGuid()) || player->GetGroup() != group)
return;
/********************/
//Ranger: instance-reset exploit fix get from getmangos.com
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
if(itr->getSource()->IsInWorld())
{
Map *map = itr->getSource()->GetMap();
if (map && map->IsDungeon() && (player->GetBoundInstance(map->GetId(),map->GetDifficulty()) && !itr->getSource()->GetBoundInstance(map->GetId(),map->GetDifficulty())))
{
sLog.outError("WorldSession::HandleGroupSetLeaderOpcode: %s cannot set %s to Leader.", GetPlayer()->GetGuidStr().c_str(), player->GetGuidStr().c_str());
ChatHandler(GetPlayer()).PSendSysMessage("Sorry, cannot set new Leader. Please select another member.");
return;
}
}
}
// everything's fine, do it
group->ChangeLeader(guid);
}
示例2: SetData
void SetData(uint32 uiI, uint32 uiValue)
{
if (uiValue == VAPOR_CASTED_COALESCE && numberCastCoalesce < 3)
{
numberCastCoalesce++;
if (numberCastCoalesce >= 3)
{
Map* map = me->GetMap();
AchievementEntry const* its_frost_damage = sAchievementStore.LookupEntry(ACHIEVEMENT_ITS_FROST_DAMAGE);
if (map && map->IsDungeon() && map->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
{
Map::PlayerList const & players = map->GetPlayers();
if (!players.isEmpty())
{
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
if (Player* player = i->getSource())
{
if (player->GetDistance(me) < 300.0f)
{
player->CompletedAchievement(its_frost_damage);
}
}
}
}
}
}
}
}
示例3: doReset
void BSWScriptedAI::doReset()
{
Map* pMap = m_creature->GetMap();
if (pMap) currentDifficulty = pMap->GetDifficulty();
else currentDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
m_BSWRecords.clear();
setStage(0);
_loadFromDB();
_fillEmptyDataField();
resetTimers();
};
示例4: CanBeAccounted
bool Quest::CanBeAccounted(Player *p) const
{
if(HasSpecialFlag(QUEST_FG_FLAGS_CUSTOM_STRICT_MODE))
{
// not in instance? always accept this.
if(!p->GetInstanceId())
return true;
Map *mp = p->GetMap();
if(IsHeroic())
{
// in heroic dungeon, or heroic instance
if(mp->IsRaid())
{
return mp->GetDifficulty() >= RAID_DIFFICULTY_10MAN_HEROIC;
}
else
{
return mp->GetDifficulty() >= DUNGEON_DIFFICULTY_HEROIC;
}
}
else
{
// in normal dungeon, or normal instance
if(mp->IsRaid())
{
return mp->GetDifficulty() <= RAID_DIFFICULTY_25MAN_NORMAL;
}
else
{
return mp->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL;
}
}
}
return true;
}
示例5: _homebindIfInstance
void Group::_homebindIfInstance(Player* player)
{
if (player && !player->isGameMaster())
{
Map* map = player->GetMap();
if (map->IsDungeon())
{
// leaving the group in an instance, the homebind timer is started
// unless the player is permanently saved to the instance
InstancePlayerBind* playerBind = player->GetBoundInstance(map->GetId(), map->GetDifficulty());
if (!playerBind || !playerBind->perm)
player->m_InstanceValid = false;
}
}
}
示例6: HandleMoveWorldportAckOpcode
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
if (!GetPlayer()->IsBeingTeleportedFar())
return;
GetPlayer()->SetSemaphoreTeleportFar(0);
// get the teleport destination
WorldLocation const& loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapManager::IsValidMapCoord(loc))
{
KickPlayer();
return;
}
// get the destination map entry, not the current one, this will fix homebind and reset greeting
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId());
Map* oldMap = GetPlayer()->GetMap();
if (GetPlayer()->IsInWorld())
{
sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
// reset instance validity, except if going to an instance inside an instance
if (GetPlayer()->m_InstanceValid == false && !mInstance)
{
GetPlayer()->m_InstanceValid = true;
// pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map!
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty()))
sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty(), true);
}
// relocate the player to the teleport destination
Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer());
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
{
sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
GetPlayer()->Relocate(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
oldMap->AfterPlayerUnlinkFromMap();
// pussywizard: transport teleport couldn't teleport us to the same map (some other teleport pending, reqs not met, etc.), but we still have transport set until player moves! clear it if map differs (crashfix)
if (Transport* t = _player->GetTransport())
if (!t->IsInMap(_player))
{
t->RemovePassenger(_player);
_player->m_transport = NULL;
_player->m_movementInfo.transport.Reset();
_player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
if (!_player->getHostileRefManager().isEmpty())
_player->getHostileRefManager().deleteReferences(); // pussywizard: multithreading crashfix
CellCoord pair(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()));
Cell cell(pair);
if (!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid())
{
KickPlayer();
return;
}
newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
// pussywizard: player supposed to enter bg map
if (_player->InBattleground())
{
// but landed on another map, cleanup data
if (!mEntry->IsBattlegroundOrArena())
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
// everything ok
else if (Battleground* bg = _player->GetBattleground())
{
if (_player->IsInvitedForBattlegroundInstance()) // GMs are not invited, so they are not added to participants
bg->AddPlayer(_player);
}
//.........这里部分代码省略.........
示例7: CreateInstanceForPlayer
/*
- return the right instance for the object, based on its InstanceId
- create the instance if it's not created already
- the player is not actually added to the instance (only in InstanceMap::Add)
*/
Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
{
if (GetId() != mapId || !player)
return NULL;
Map* map = NULL;
if (IsBattlegroundOrArena())
{
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
uint32 newInstanceId = player->GetBattlegroundId();
if (!newInstanceId)
return NULL;
map = sMapMgr->FindMap(mapId, newInstanceId);
if (!map)
{
Battleground* bg = player->GetBattleground(true);
if (bg && bg->GetStatus() < STATUS_WAIT_LEAVE)
map = CreateBattleground(newInstanceId, bg);
else
{
player->TeleportToEntryPoint();
return NULL;
}
}
}
else
{
Difficulty realdiff = player->GetDifficulty(IsRaid());
uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(player, GetId(), realdiff);
if (destInstId)
{
InstanceSave* pSave = sInstanceSaveMgr->GetInstanceSave(destInstId);
ASSERT(pSave); // pussywizard: must exist
map = FindInstanceMap(destInstId);
if (!map)
map = CreateInstance(destInstId, pSave, realdiff);
else if ((mapId == 631 || mapId == 724) && !map->HavePlayers() && map->GetDifficulty() != realdiff)
{
if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db
return NULL;
if (!map->AllTransportsEmpty())
map->AllTransportsRemovePassengers(); // pussywizard: gameobjects / summons (assert(passengers.empty) fail in ~transport)
for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i)
if (i->first == destInstId)
{
DestroyInstance(i);
map = CreateInstance(destInstId, pSave, realdiff);
break;
}
}
}
else
{
uint32 newInstanceId = sMapMgr->GenerateInstanceId();
ASSERT(!FindInstanceMap(newInstanceId)); // pussywizard: instance with new id can't exist
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
map = CreateInstance(newInstanceId, NULL, diff);
}
}
return map;
}