From 100429f29ca23d27d1e57bb082a3a61c1505ffe0 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 8 Feb 2009 11:59:23 +0300 Subject: [PATCH] [7252] Move all world global broadcast string (all arena/bg related) to `mangos_string`. PLEASE, NOT USE string world broadcasts in real code. This function _only_ for debug purposes. Really allow with .debug bg start bg with 1 player. Added helps for some existed .debug commands. --- sql/mangos.sql | 14 +++++++++- sql/updates/7252_01_mangos_command.sql | 6 +++++ sql/updates/7252_02_mangos_mangos_string.sql | 14 ++++++++++ sql/updates/Makefile.am | 4 +++ src/game/BattleGroundMgr.cpp | 28 +++++++++++++------- src/game/Language.h | 12 ++++++++- src/game/World.cpp | 2 +- src/shared/revision_nr.h | 2 +- 8 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 sql/updates/7252_01_mangos_command.sql create mode 100644 sql/updates/7252_02_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index e8b4dc98f..6233ed7a4 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -22,7 +22,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, - `required_7251_01_mangos_spell_chain` bit(1) default NULL + `required_7252_02_mangos_mangos_string` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -264,6 +264,8 @@ INSERT INTO `command` VALUES ('cooldown',3,'Syntax: .cooldown [#spell_id]\r\n\r\nRemove all (if spell_id not provided) or #spel_id spell cooldown from selected character or you (if no selection).'), ('damage',3,'Syntax: .damage $damage_amount [$school [$spellid]]\r\n\r\nApply $damage to target. If not $school and $spellid provided then this flat clean melee damage without any modifiers. If $school provided then damage modified by armor reduction (if school physical), and target absorbing modifiers and result applied as melee damage to target. If spell provided then damage modified and applied as spell damage. $spellid can be shift-link.'), ('debug anim',2,'Syntax: .debug anim #emoteid\r\n\r\nPlay emote #emoteid for your character.'), +('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'), +('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'), ('debug getvalue',3,'Syntax: .debug getvalue #field #isInt\r\n\r\nGet the field #field of the selected creature. If no creature is selected, get the content of your field.\r\n\r\nUse a #isInt of value 1 if the expected field content is an integer.'), ('debug playsound',1,'Syntax: .debug playsound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'), ('debug setvalue',3,'Syntax: .debug setvalue #field #value #isInt\r\n\r\nSet the field #field of the selected creature with value #value. If no creature is selected, set the content of your field.\r\n\r\nUse a #isInt of value 1 if #value is an integer.'), @@ -2821,6 +2823,16 @@ INSERT INTO `mangos_string` VALUES (734,'You cannot summon players to a battleground or arena map.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (735,'You must be in GM mode to teleport to a player in a battleground.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (736,'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(737,'Arenas are set to 1v1 for debugging. So, don\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(738,'Arenas are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(739,'Battlegrounds are set to 1v0 for debugging.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(740,'Battlegrounds are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(741,'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(742,'Distributing arena points to players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(743,'Finished setting arena points for online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(744,'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(745,'Modification done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(746,'Done flushing Arena points.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (801,'You do not have enough gold',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (802,'You do not have enough free slots',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (803,'Your partner does not have enough free bag slots',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/7252_01_mangos_command.sql b/sql/updates/7252_01_mangos_command.sql new file mode 100644 index 000000000..4d1ff984f --- /dev/null +++ b/sql/updates/7252_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_7251_01_mangos_spell_chain required_7252_01_mangos_command bit; + +DELETE FROM `command` WHERE `name` IN ('debug arena','debug bg'); +INSERT INTO `command` VALUES +('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'), +('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'); diff --git a/sql/updates/7252_02_mangos_mangos_string.sql b/sql/updates/7252_02_mangos_mangos_string.sql new file mode 100644 index 000000000..3b5a2d5b6 --- /dev/null +++ b/sql/updates/7252_02_mangos_mangos_string.sql @@ -0,0 +1,14 @@ +ALTER TABLE db_version CHANGE COLUMN required_7252_01_mangos_command required_7252_02_mangos_mangos_string bit; + +DELETE FROM `mangos_string` WHERE entry IN (737,738,739,740,741,742,743,744,745,746); +INSERT INTO `mangos_string` VALUES +(737,'Arenas are set to 1v1 for debugging. So, don\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(738,'Arenas are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(739,'Battlegrounds are set to 1v0 for debugging.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(740,'Battlegrounds are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(741,'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(742,'Distributing arena points to players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(743,'Finished setting arena points for online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(744,'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(745,'Modification done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(746,'Done flushing Arena points.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 89a2c9abc..f25faa606 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -172,6 +172,8 @@ pkgdata_DATA = \ 7249_01_mangos_spell_proc_event.sql \ 7251_01_mangos_spell_chain.sql \ 7251_02_characters_character_spell.sql \ + 7252_01_mangos_command.sql \ + 7252_02_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -324,4 +326,6 @@ EXTRA_DIST = \ 7249_01_mangos_spell_proc_event.sql \ 7251_01_mangos_spell_chain.sql \ 7251_02_characters_character_spell.sql \ + 7252_01_mangos_command.sql \ + 7252_02_mangos_mangos_string.sql \ README diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 15935232a..4b31cd0c5 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -694,6 +694,14 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin } } } + // BG case + else + { + if(sBattleGroundMgr.isTesting()) + { + MinPlayersPerTeam = 1; + } + } // found out the minimum and maximum ratings the newly added team should battle against // arenaRating is the rating of the latest joined team @@ -1700,9 +1708,9 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() void BattleGroundMgr::DistributeArenaPoints() { // used to distribute arena points based on last week's stats - sWorld.SendGlobalText("Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_START); - sWorld.SendGlobalText("Distributing arena points to players...", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START); //temporary structure for storing maximum points to add values for all players std::map PlayerPoints; @@ -1729,9 +1737,9 @@ void BattleGroundMgr::DistributeArenaPoints() PlayerPoints.clear(); - sWorld.SendGlobalText("Finished setting arena points for online players.", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END); - sWorld.SendGlobalText("Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START); for(ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr) { if(ArenaTeam * at = titr->second) @@ -1742,9 +1750,9 @@ void BattleGroundMgr::DistributeArenaPoints() } } - sWorld.SendGlobalText("Modification done.", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END); - sWorld.SendGlobalText("Done flushing Arena points.", NULL); + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END); } void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId) @@ -1899,18 +1907,18 @@ void BattleGroundMgr::ToggleTesting() { m_Testing = !m_Testing; if(m_Testing) - sWorld.SendGlobalText("Battlegrounds are set to 1v0 for debugging.", NULL); + sWorld.SendWorldText(LANG_DEBUG_BG_ON); else - sWorld.SendGlobalText("Battlegrounds are set to normal playercount.", NULL); + sWorld.SendWorldText(LANG_DEBUG_BG_OFF); } void BattleGroundMgr::ToggleArenaTesting() { m_ArenaTesting = !m_ArenaTesting; if(m_ArenaTesting) - sWorld.SendGlobalText("Arenas are set to 1v1 for debugging. So, don't join as group.", NULL); + sWorld.SendWorldText(LANG_DEBUG_ARENA_ON); else - sWorld.SendGlobalText("Arenas are set to normal playercount.", NULL); + sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF); } uint32 BattleGroundMgr::GetMaxRatingDifference() const diff --git a/src/game/Language.h b/src/game/Language.h index 4bb924f89..fa72d3104 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -670,7 +670,17 @@ enum MangosStrings LANG_CANNOT_SUMMON_TO_BG = 734, // "You cannot summon players to a battleground or arena map." LANG_CANNOT_GO_TO_BG_GM = 735, // "You must be in GM mode to teleport to a player in a battleground." LANG_CANNOT_GO_TO_BG_FROM_BG = 736, // "You cannot teleport to a battleground from another battleground. Please leave the current battleground first." - // Room for batleground/arena strings 737-799 not used + LANG_DEBUG_ARENA_ON = 737, + LANG_DEBUG_ARENA_OFF = 738, + LANG_DEBUG_BG_ON = 739, + LANG_DEBUG_BG_OFF = 740, + LANG_DIST_ARENA_POINTS_START = 741, + LANG_DIST_ARENA_POINTS_ONLINE_START = 742, + LANG_DIST_ARENA_POINTS_ONLINE_END = 743, + LANG_DIST_ARENA_POINTS_TEAM_START = 744, + LANG_DIST_ARENA_POINTS_TEAM_END = 745, + LANG_DIST_ARENA_POINTS_END = 746, + // Room for batleground/arena strings 747-799 not used // in game strings // = 800, not used diff --git a/src/game/World.cpp b/src/game/World.cpp index 1d7a91f21..fea2d085e 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2328,7 +2328,7 @@ void World::SendWorldText(int32 string_id, ...) delete data_cache[i][j]; } -/// Send a System Message to all players (except self if mentioned) +/// DEPRICATED, only for debug purpose. Send a System Message to all players (except self if mentioned) void World::SendGlobalText(const char* text, WorldSession *self) { WorldPacket data; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a1df9c63a..f48b6249d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7251" + #define REVISION_NR "7252" #endif // __REVISION_NR_H__