Core/Maps: Replaced spawnmask with difficulty list

This commit is contained in:
Shauren
2018-09-15 17:55:26 +02:00
parent 0f3156d324
commit 738f37d3cf
36 changed files with 320 additions and 214 deletions

View File

@@ -156,7 +156,7 @@ public:
}
// fill the gameobject data and save to the db
object->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
object->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType spawnId = object->GetSpawnId();
// delete the old object and do a clean load from DB with a fresh new GameObject instance.

View File

@@ -81,13 +81,16 @@ public:
uint32 counter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
auto binds = player->GetBoundInstances(Difficulty(i));
if (binds != player->m_boundInstances.end())
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
for (auto itr = binds->second.begin(); itr != binds->second.end(); ++itr)
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
}
}
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_PLAYER_BINDS, counter);
@@ -97,13 +100,16 @@ public:
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
auto binds = group->GetBoundInstances(Difficulty(i));
if (binds != group->GetBoundInstanceEnd())
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
for (auto itr = binds->second.begin(); itr != binds->second.end(); ++itr)
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
}
}
}
@@ -138,19 +144,22 @@ public:
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
auto binds = player->GetBoundInstances(Difficulty(i));
if (binds != player->m_boundInstances.end())
{
InstanceSave* save = itr->second.save;
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficultyID()))
for (auto itr = binds->second.begin(); itr != binds->second.end();)
{
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
player->UnbindInstance(itr, Difficulty(i));
counter++;
InstanceSave* save = itr->second.save;
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficultyID()))
{
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
player->UnbindInstance(itr, binds);
counter++;
}
else
++itr;
}
else
++itr;
}
}
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBOUND, counter);

View File

@@ -301,7 +301,7 @@ public:
Creature* creature = trans->CreateNPCPassenger(guid, &data);
creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, UI64LIT(1) << map->GetSpawnMode());
creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, { map->GetDifficultyID() });
sObjectMgr->AddCreatureToGrid(guid, &data);
return true;
@@ -312,7 +312,7 @@ public:
return false;
PhasingHandler::InheritPhaseShift(creature, chr);
creature->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
creature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType db_guid = creature->GetSpawnId();

View File

@@ -674,7 +674,7 @@ public:
}
PhasingHandler::InheritPhaseShift(wpCreature, chr);
wpCreature->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
wpCreature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType dbGuid = wpCreature->GetSpawnId();
@@ -892,7 +892,7 @@ public:
}
PhasingHandler::InheritPhaseShift(wpCreature, chr);
wpCreature->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
wpCreature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType dbGuid = wpCreature->GetSpawnId();
@@ -961,7 +961,7 @@ public:
}
PhasingHandler::InheritPhaseShift(creature, chr);
creature->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
creature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType dbGuid = creature->GetSpawnId();
@@ -1018,7 +1018,7 @@ public:
}
PhasingHandler::InheritPhaseShift(creature, chr);
creature->SaveToDB(map->GetId(), UI64LIT(1) << map->GetSpawnMode());
creature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
ObjectGuid::LowType dbGuid = creature->GetSpawnId();

View File

@@ -112,7 +112,7 @@ public:
//THIS GOB IS A TRAP - What shall i do? =(
//Cast it spell? Copyed Heigan method
floorEruption->SendCustomAnim(floorEruption->GetGoAnimProgress());
floorEruption->CastSpell(nullptr, Difficulty(instance->GetSpawnMode()) == DIFFICULTY_10_N ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
floorEruption->CastSpell(nullptr, instance->GetDifficultyID() == DIFFICULTY_10_N ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
//Get all immediatly nearby floors
std::list<GameObject*> nearFloorList;

View File

@@ -232,7 +232,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(ConflagrationTargetSelector());
uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3);
uint8 maxSize = uint8(GetCaster()->GetMap()->Is25ManRaid() ? 6 : 3);
if (targets.size() > maxSize)
Trinity::Containers::RandomResize(targets, maxSize);
}

View File

@@ -282,7 +282,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
EventStage = 6000;
uint32 tributeChest = 0;
if (instance->GetSpawnMode() == DIFFICULTY_10_HC)
if (instance->GetDifficultyID() == DIFFICULTY_10_HC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_10H_99;
@@ -299,7 +299,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
}
}
else if (instance->GetSpawnMode() == DIFFICULTY_25_HC)
else if (instance->GetDifficultyID() == DIFFICULTY_25_HC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_25H_99;

View File

@@ -135,7 +135,7 @@ Position const mincharPos = {4629.3711f, 2782.6089f, 424.6390f, 0.000000f};
bool IsVampire(Unit const* unit)
{
for (uint8 i = 0; i < 3; ++i)
if (unit->HasAura(vampireAuras[i][unit->GetMap()->GetSpawnMode() - DIFFICULTY_10_N]))
if (unit->HasAura(vampireAuras[i][unit->GetMap()->GetDifficultyID() - DIFFICULTY_10_N]))
return true;
return false;
}

View File

@@ -642,7 +642,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
if (Creature* marrowgar = GetCaster()->ToCreature())
{
CreatureAI* marrowgarAI = marrowgar->AI();
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->Is25ManRaid() ? 3 : 1);
std::list<Unit*> targets;
marrowgarAI->SelectTargetList(targets, BoneSpikeTargetSelector(marrowgarAI), boneSpikeCount, SELECT_TARGET_RANDOM);

View File

@@ -1006,7 +1006,7 @@ class spell_putricide_slime_puddle_aura : public SpellScriptLoader
void ReplaceAura()
{
if (Unit* target = GetHitUnit())
GetCaster()->AddAura((GetCaster()->GetMap()->GetSpawnMode() & 1) ? 72456 : 70346, target);
GetCaster()->AddAura(GetCaster()->GetMap()->Is25ManRaid() ? 72456 : 70346, target);
}
void Register() override
@@ -1316,7 +1316,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
int32 damage = spell->GetEffect(EFFECT_0)->CalcValue(caster);
float multiplier = 2.0f;
if (GetTarget()->GetMap()->GetSpawnMode() & 1)
if (GetTarget()->GetMap()->Is25ManRaid())
multiplier = 3.0f;
damage *= int32(pow(multiplier, GetStackAmount()));
@@ -1416,7 +1416,7 @@ class spell_putricide_mutation_init : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
uint32 spellId = 70311;
if (GetTarget()->GetMap()->GetSpawnMode() & 1)
if (GetTarget()->GetMap()->Is25ManRaid())
spellId = 71503;
GetTarget()->CastSpell(GetTarget(), spellId, true);

View File

@@ -1162,7 +1162,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(UnchainedMagicTargetSelector());
uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2);
uint32 maxSize = uint32(GetCaster()->GetMap()->Is25ManRaid() ? 6 : 2);
if (unitList.size() > maxSize)
Trinity::Containers::RandomResize(unitList, maxSize);
}

View File

@@ -372,7 +372,7 @@ class instance_icecrown_citadel : public InstanceMapScript
{
if (WeeklyQuestData[questIndex].creatureEntry == entry)
{
uint8 diffIndex = uint8(instance->GetSpawnMode() & 1);
uint8 diffIndex = instance->Is25ManRaid() ? 1 : 0;
if (!sPoolMgr->IsSpawnedObject<Quest>(WeeklyQuestData[questIndex].questId[diffIndex]))
return 0;
break;
@@ -961,7 +961,7 @@ class instance_icecrown_citadel : public InstanceMapScript
case DATA_VALITHRIA_DREAMWALKER:
if (state == DONE)
{
if (sPoolMgr->IsSpawnedObject<Quest>(WeeklyQuestData[8].questId[instance->GetSpawnMode() & 1]))
if (sPoolMgr->IsSpawnedObject<Quest>(WeeklyQuestData[8].questId[instance->Is25ManRaid() ? 1 : 0]))
instance->SummonCreature(NPC_VALITHRIA_DREAMWALKER_QUEST, ValithriaSpawnPos);
if (GameObject* teleporter = instance->GetGameObject(TeleporterSindragosaGUID))
SetTeleporterState(teleporter, true);
@@ -1066,7 +1066,7 @@ class instance_icecrown_citadel : public InstanceMapScript
break;
// 5 is the index of Blood Quickening
if (!sPoolMgr->IsSpawnedObject<Quest>(WeeklyQuestData[5].questId[instance->GetSpawnMode() & 1]))
if (!sPoolMgr->IsSpawnedObject<Quest>(WeeklyQuestData[5].questId[instance->Is25ManRaid() ? 1 : 0]))
break;
switch (data)