diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
| commit | 738f37d3cf45d4e10eda9d44a4cb17079b7bbc1b (patch) | |
| tree | 9db45160ed8a0c68090dec2aebb9b73c9f2ea335 /src/server/scripts/Commands | |
| parent | 0f3156d324ff8134171bada01b40f5c23f5c43cc (diff) | |
Core/Maps: Replaced spawnmask with difficulty list
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_instance.cpp | 53 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_wp.cpp | 8 |
4 files changed, 38 insertions, 29 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 8f1f2b98120..cf1d0fe3543 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -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. diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index a68d74a4ec6..10abea19971 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -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); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 7b9d16502bb..c72893c77a9 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -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(); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 47f466c7c61..8e6f486448a 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -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(); |
