Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,996 changes: 1,498 additions & 1,498 deletions src/game/ChatCommands/DebugCommands.cpp

Large diffs are not rendered by default.

440 changes: 220 additions & 220 deletions src/game/ChatCommands/EventCommands.cpp

Large diffs are not rendered by default.

1,087 changes: 543 additions & 544 deletions src/game/ChatCommands/GMCommands.cpp

Large diffs are not rendered by default.

1,284 changes: 642 additions & 642 deletions src/game/ChatCommands/GameObjectCommands.cpp

Large diffs are not rendered by default.

428 changes: 214 additions & 214 deletions src/game/ChatCommands/GuildCommands.cpp

Large diffs are not rendered by default.

370 changes: 185 additions & 185 deletions src/game/ChatCommands/InstanceCommands.cpp
Original file line number Diff line number Diff line change
@@ -1,185 +1,185 @@
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2025 MaNGOS <https://www.getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/

#include "Chat.h"
#include "ObjectMgr.h"
#include "MapManager.h"
#include "InstanceData.h"

/**********************************************************************
CommandTable : instanceCommandTable
/***********************************************************************/

bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
{
Player* player = getSelectedPlayer();
if (!player)
{
player = m_session->GetPlayer();
}
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)
{
DungeonPersistentState* state = itr->second.state;
std::string timeleft = secsToTimeString(state->GetResetTime() - time(NULL), TimeFormat::ShortText);
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no",
state->GetDifficulty(), state->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistent map %u", itr->first);
++counter;
}
}
PSendSysMessage("player binds: %d", counter);
counter = 0;

if (Group* group = player->GetGroup())
{
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)
{
DungeonPersistentState* state = itr->second.state;
std::string timeleft = secsToTimeString(state->GetResetTime() - time(NULL), TimeFormat::ShortText);
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no",
state->GetDifficulty(), state->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistent map %u", itr->first);
++counter;
}
}
}
PSendSysMessage("group binds: %d", counter);

return true;
}

bool ChatHandler::HandleInstanceUnbindCommand(char* args)
{
if (!*args)
{
return false;
}

Player* player = getSelectedPlayer();
if (!player)
{
player = m_session->GetPlayer();
}
uint32 counter = 0;
uint32 mapid = 0;
bool got_map = false;

if (strncmp(args, "all", strlen(args)) != 0)
{
if (!isNumeric(args[0]))
{
return false;
}

got_map = true;
mapid = atoi(args);
}

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();)
{
if (got_map && mapid != itr->first)
{
++itr;
continue;
}
if (itr->first != player->GetMapId())
{
DungeonPersistentState* save = itr->second.state;
std::string timeleft = secsToTimeString(save->GetResetTime() - time(NULL), TimeFormat::ShortText);

if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("unbinding map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no",
save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
{
PSendSysMessage("bound for a nonexistent map %u", itr->first);
}
player->UnbindInstance(itr, Difficulty(i));
++counter;
}
else
{
++itr;
}
}
}
PSendSysMessage("instances unbound: %d", counter);

return true;
}

bool ChatHandler::HandleInstanceStatsCommand(char* /*args*/)
{
PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances());
PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances());

uint32 numSaves, numBoundPlayers, numBoundGroups;
sMapPersistentStateMgr.GetStatistics(numSaves, numBoundPlayers, numBoundGroups);
PSendSysMessage("instance saves: %d", numSaves);
PSendSysMessage("players bound: %d", numBoundPlayers);
PSendSysMessage("groups bound: %d", numBoundGroups);
return true;
}

bool ChatHandler::HandleInstanceSaveDataCommand(char* /*args*/)
{
Player* pl = m_session->GetPlayer();

Map* map = pl->GetMap();

InstanceData* iData = map->GetInstanceData();
if (!iData)
{
PSendSysMessage("Map has no instance data.");
SetSentErrorMessage(true);
return false;
}

iData->SaveToDB();
return true;
}

/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2025 MaNGOS <https://www.getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "Chat.h"
#include "ObjectMgr.h"
#include "MapManager.h"
#include "InstanceData.h"
/**********************************************************************
CommandTable : instanceCommandTable
**********************************************************************/
bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
{
Player* player = getSelectedPlayer();
if (!player)
{
player = m_session->GetPlayer();
}
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)
{
DungeonPersistentState* state = itr->second.state;
std::string timeleft = secsToTimeString(state->GetResetTime() - time(NULL), TimeFormat::ShortText);
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no",
state->GetDifficulty(), state->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistent map %u", itr->first);
++counter;
}
}
PSendSysMessage("player binds: %d", counter);
counter = 0;
if (Group* group = player->GetGroup())
{
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)
{
DungeonPersistentState* state = itr->second.state;
std::string timeleft = secsToTimeString(state->GetResetTime() - time(NULL), TimeFormat::ShortText);
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no",
state->GetDifficulty(), state->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistent map %u", itr->first);
++counter;
}
}
}
PSendSysMessage("group binds: %d", counter);
return true;
}
bool ChatHandler::HandleInstanceUnbindCommand(char* args)
{
if (!*args)
{
return false;
}
Player* player = getSelectedPlayer();
if (!player)
{
player = m_session->GetPlayer();
}
uint32 counter = 0;
uint32 mapid = 0;
bool got_map = false;
if (strncmp(args, "all", strlen(args)) != 0)
{
if (!isNumeric(args[0]))
{
return false;
}
got_map = true;
mapid = atoi(args);
}
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();)
{
if (got_map && mapid != itr->first)
{
++itr;
continue;
}
if (itr->first != player->GetMapId())
{
DungeonPersistentState* save = itr->second.state;
std::string timeleft = secsToTimeString(save->GetResetTime() - time(NULL), TimeFormat::ShortText);
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("unbinding map: %d (%s) inst: %d perm: %s diff: %d canReset: %s TTR: %s",
itr->first, entry->name[GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no",
save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
{
PSendSysMessage("bound for a nonexistent map %u", itr->first);
}
player->UnbindInstance(itr, Difficulty(i));
++counter;
}
else
{
++itr;
}
}
}
PSendSysMessage("instances unbound: %d", counter);
return true;
}
bool ChatHandler::HandleInstanceStatsCommand(char* /*args*/)
{
PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances());
PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances());
uint32 numSaves, numBoundPlayers, numBoundGroups;
sMapPersistentStateMgr.GetStatistics(numSaves, numBoundPlayers, numBoundGroups);
PSendSysMessage("instance saves: %d", numSaves);
PSendSysMessage("players bound: %d", numBoundPlayers);
PSendSysMessage("groups bound: %d", numBoundGroups);
return true;
}
bool ChatHandler::HandleInstanceSaveDataCommand(char* /*args*/)
{
Player* pl = m_session->GetPlayer();
Map* map = pl->GetMap();
InstanceData* iData = map->GetInstanceData();
if (!iData)
{
PSendSysMessage("Map has no instance data.");
SetSentErrorMessage(true);
return false;
}
iData->SaveToDB();
return true;
}
Loading