[8600] allow unbinding instances also per map

so command can be called as
.instance unbind all
or
.instance unbind #mapid
now

output also the mapname next to the mapid
for the humanoid users among us ;)
This commit is contained in:
balrok 2009-10-08 00:17:55 +02:00
parent dc96ddfbfb
commit 49c52ddf9c
6 changed files with 65 additions and 22 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_8589_10_mangos_spell_proc_event` bit(1) default NULL
`required_8600_01_mangos_command` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -434,7 +434,7 @@ INSERT INTO `command` VALUES
('honor addkill',2,'Syntax: .honor addkikll\r\n\r\nAdd the targeted unit as one of your pvp kills today (you only get honor if it\'s a racial leader or a player)'),
('honor update',2,'Syntax: .honor update\r\n\r\nForce the yesterday\'s honor fields to be updated with today\'s data, which will get reset for the selected player.'),
('hover',3,'Syntax: .hover #flag\r\n\r\nEnable or disable hover mode for your character.\r\n\r\nUse a #flag of value 1 to enable, use a #flag value of 0 to disable hover.'),
('instance unbind',3,'Syntax: .instance unbind all\r\n All of the selected player\'s binds will be cleared.'),
('instance unbind',3,'Syntax: .instance unbind all\r\n All of the selected player\'s binds will be cleared.\r\n.instance unbind #mapid\r\n Only the specified #mapid instance will be cleared.'),
('instance listbinds',3,'Syntax: .instance listbinds\r\n Lists the binds of the selected player.'),
('instance stats',3,'Syntax: .instance stats\r\n Shows statistics about instances.'),
('instance savedata',3,'Syntax: .instance savedata\r\n Save the InstanceData for the current player\'s map to the DB.'),

View file

@ -0,0 +1,8 @@
ALTER TABLE db_version CHANGE COLUMN required_8589_10_mangos_spell_proc_event required_8600_01_mangos_command bit;
DELETE FROM command where name='instance unbind';
INSERT INTO `command` VALUES
('instance unbind',3,'Syntax: .instance unbind all\r\n All of the selected
player\'s binds will be cleared.\r\n.instance unbind #mapid\r\n Only the
specified #mapid instance will be cleared.');

View file

@ -129,6 +129,7 @@ pkgdata_DATA = \
8589_10_mangos_spell_proc_event.sql \
8589_11_characters_characters.sql \
8596_01_characters_bugreport.sql \
8600_01_mangos_command.sql \
README
## Additional files to include when running 'make dist'
@ -238,4 +239,5 @@ EXTRA_DIST = \
8589_10_mangos_spell_proc_event.sql \
8589_11_characters_characters.sql \
8596_01_characters_bugreport.sql \
8600_01_mangos_command.sql \
README

View file

@ -5920,7 +5920,14 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s",
itr->first, entry->name[m_session->GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no",
save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistant map %u", itr->first);
counter++;
}
}
@ -5936,7 +5943,14 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/)
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
PSendSysMessage("map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s",
itr->first, entry->name[m_session->GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no",
save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistant map %u", itr->first);
counter++;
}
}
@ -5951,22 +5965,42 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args)
if(!*args)
return false;
std::string cmd = args;
if(cmd == "all")
{
Player* player = getSelectedPlayer();
if (!player) player = m_session->GetPlayer();
if (!player)
player = m_session->GetPlayer();
uint32 counter = 0;
uint32 mapid = 0;
bool got_map = false;
if (args != "all")
{
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())
{
InstanceSave *save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
if (const MapEntry* entry = sMapStore.LookupEntry(itr->first))
{
PSendSysMessage("unbinding map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s",
itr->first, entry->name[m_session->GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no",
save->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? "normal" : "heroic", save->CanReset() ? "yes" : "no", timeleft.c_str());
}
else
PSendSysMessage("bound for a nonexistant map %u", itr->first);
player->UnbindInstance(itr, Difficulty(i));
counter++;
}
@ -5975,7 +6009,6 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args)
}
}
PSendSysMessage("instances unbound: %d", counter);
}
return true;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8599"
#define REVISION_NR "8600"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8596_01_characters_bugreport"
#define REVISION_DB_MANGOS "required_8589_10_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_8600_01_mangos_command"
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
#endif // __REVISION_SQL_H__