Use reset time for normal/heroic from new DBC. Improve basic support for raid difficalties.

This commit is contained in:
VladimirMangos 2009-10-05 02:04:33 +04:00
parent 9850551751
commit a9af7f2b1c
24 changed files with 340 additions and 173 deletions

View file

@ -809,8 +809,16 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
else if(at->requiredItem2 && !GetPlayer()->HasItemCount(at->requiredItem2, 1))
missingItem = at->requiredItem2;
MapEntry const* mapEntry = sMapStore.LookupEntry(at->target_mapId);
if(!mapEntry)
return;
bool isHeroicTargetMap = mapEntry->IsRaid()
? (GetPlayer()->GetRaidDifficulty() >= RAID_DIFFICULTY_10MAN_HEROIC)
: (GetPlayer()->GetDungeonDifficulty() >= DUNGEON_DIFFICULTY_HEROIC);
uint32 missingKey = 0;
if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
if(isHeroicTargetMap)
{
if(at->heroicKey)
{
@ -823,7 +831,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
}
uint32 missingQuest = 0;
if(GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
if(isHeroicTargetMap)
{
if (at->requiredQuestHeroic && !GetPlayer()->GetQuestRewardStatus(at->requiredQuestHeroic))
missingQuest = at->requiredQuestHeroic;
@ -840,7 +848,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
if(missingItem)
SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1);
else if(missingKey)
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, DUNGEON_DIFFICULTY_HEROIC);
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isHeroicTargetMap ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL);
else if(missingQuest)
SendAreaTriggerMessage(at->requiredFailedText.c_str());
else if(missingLevel)
@ -1383,10 +1391,16 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ )
if(Group *pGroup = _player->GetGroup())
{
if(pGroup->IsLeader(_player->GetGUID()))
pGroup->ResetInstances(INSTANCE_RESET_ALL, _player);
{
pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player);
pGroup->ResetInstances(INSTANCE_RESET_ALL, true,_player);
}
}
else
_player->ResetInstances(INSTANCE_RESET_ALL);
{
_player->ResetInstances(INSTANCE_RESET_ALL, false);
_player->ResetInstances(INSTANCE_RESET_ALL, true);
}
}
void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
@ -1396,15 +1410,15 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
if(mode == _player->GetDungeonDifficulty())
return;
if(mode > DUNGEON_DIFFICULTY_HEROIC)
if(mode >= MAX_DUNGEON_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
if(Difficulty(mode) == _player->GetDungeonDifficulty())
return;
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
@ -1422,14 +1436,14 @@ void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data )
{
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player);
pGroup->SetDungeonDifficulty(mode);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
pGroup->SetDungeonDifficulty(Difficulty(mode));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY);
_player->SetDungeonDifficulty(mode);
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false);
_player->SetDungeonDifficulty(Difficulty(mode));
}
}
@ -1440,15 +1454,15 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
uint32 mode;
recv_data >> mode;
if(mode == _player->GetRaidDifficulty())
return;
if(mode > RAID_DIFFICULTY_25MAN_HEROIC)
if(mode >= MAX_RAID_DIFFICULTY)
{
sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
if(RaidDifficulties(mode) == _player->GetRaidDifficulty())
return;
// cannot reset while in an instance
Map *map = _player->GetMap();
if(map && map->IsDungeon())
@ -1466,14 +1480,14 @@ void WorldSession::HandleSetRaidDifficultyOpcode( WorldPacket & recv_data )
{
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, _player);
pGroup->SetRaidDifficulty(mode);
pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
pGroup->SetRaidDifficulty(Difficulty(mode));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY);
_player->SetRaidDifficulty(mode);
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true);
_player->SetRaidDifficulty(Difficulty(mode));
}
}