diff --git a/sql/mangos.sql b/sql/mangos.sql index 8ba1d8ef6..da6ae5969 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -2637,7 +2637,16 @@ INSERT INTO `mangos_string` VALUES (1011,'| | %20s | |||',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1100,'Account %s (Id: %u) have up to %u expansion allowed now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1101,'Message of the day changed to:\r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(1102,'Message sent to %s: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +(1102,'Message sent to %s: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1103,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1104,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1105,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1106,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1107,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1108,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1109,'%d - %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1110,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1111,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/2008_10_22_02_mangos_mangos_string.sql b/sql/updates/2008_10_22_02_mangos_mangos_string.sql new file mode 100644 index 000000000..118ce26dd --- /dev/null +++ b/sql/updates/2008_10_22_02_mangos_mangos_string.sql @@ -0,0 +1,12 @@ +DELETE FROM mangos_string WHERE entry IN (1103,1104,1105,1106,1107,1108,1109,1110,1111); + +INSERT INTO mangos_string VALUES +(1103,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1104,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1105,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1106,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1107,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1108,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1109,'%d - %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1110,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1111,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index ffdacf3b6..db3e7f580 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -100,6 +100,7 @@ pkgdata_DATA = \ 2008_10_21_02_mangos_command.sql \ 2008_10_21_03_mangos_command.sql \ 2008_10_22_01_mangos_quest_template.sql \ + 2008_10_22_02_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -181,4 +182,5 @@ EXTRA_DIST = \ 2008_10_21_02_mangos_command.sql \ 2008_10_21_03_mangos_command.sql \ 2008_10_22_01_mangos_quest_template.sql \ + 2008_10_22_02_mangos_mangos_string.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index e99b46edd..3389c6462 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -173,10 +173,10 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand eventCommandTable[] = { - { "activelist", SEC_GAMEMASTER, false, &ChatHandler::HandleEventActiveListCommand, "", NULL }, - { "start", SEC_GAMEMASTER, false, &ChatHandler::HandleEventStartCommand, "", NULL }, - { "stop", SEC_GAMEMASTER, false, &ChatHandler::HandleEventStopCommand, "", NULL }, - { "", SEC_GAMEMASTER, false, &ChatHandler::HandleEventInfoCommand, "", NULL }, + { "activelist", SEC_GAMEMASTER, true, &ChatHandler::HandleEventActiveListCommand, "", NULL }, + { "start", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStartCommand, "", NULL }, + { "stop", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStopCommand, "", NULL }, + { "", SEC_GAMEMASTER, true, &ChatHandler::HandleEventInfoCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -197,70 +197,70 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand reloadCommandTable[] = { - { "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllCommand, "", NULL }, - { "all_loot", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllLootCommand, "", NULL }, - { "all_npc", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllNpcCommand, "", NULL }, - { "all_quest", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllQuestCommand, "", NULL }, - { "all_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllScriptsCommand, "", NULL }, - { "all_spell", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, - { "all_item", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllItemCommand, "", NULL }, - { "all_locales", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllLocalesCommand, "", NULL }, + { "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllCommand, "", NULL }, + { "all_loot", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllLootCommand, "", NULL }, + { "all_npc", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllNpcCommand, "", NULL }, + { "all_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllQuestCommand, "", NULL }, + { "all_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllScriptsCommand, "", NULL }, + { "all_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, + { "all_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllItemCommand, "", NULL }, + { "all_locales", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllLocalesCommand, "", NULL }, - { "config", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadConfigCommand, "", NULL }, + { "config", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConfigCommand, "", NULL }, - { "areatrigger_tavern", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL }, - { "areatrigger_teleport", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL }, - { "areatrigger_involvedrelation",SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL }, - { "event_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadEventScriptsCommand, "", NULL }, - { "command", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadCommandCommand, "", NULL }, - { "creature_involvedrelation", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand,"",NULL }, - { "creature_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL }, - { "creature_questrelation", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL }, - { "disenchant_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand, "", NULL }, - { "fishing_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesFishingCommand, "", NULL }, - { "game_graveyard_zone", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadGameGraveyardZoneCommand, "", NULL }, - { "game_tele", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadGameTeleCommand, "", NULL }, - { "gameobject_involvedrelation", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL }, - { "gameobject_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL }, - { "gameobject_questrelation", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL }, - { "gameobject_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL }, - { "item_enchantment_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, - { "item_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, - { "mangos_string", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadMangosStringCommand, "", NULL }, - { "npc_gossip", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, - { "npc_trainer", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, - { "npc_vendor", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, - { "page_text", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadPageTextsCommand, "", NULL }, - { "pickpocketing_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand,"",NULL}, - { "prospecting_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL }, - { "quest_mail_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesQuestMailCommand, "", NULL }, - { "quest_end_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL }, - { "quest_start_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadQuestStartScriptsCommand, "", NULL }, - { "quest_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadQuestTemplateCommand, "", NULL }, - { "reference_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesReferenceCommand, "", NULL }, - { "reserved_name", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadReservedNameCommand, "", NULL }, - { "skill_discovery_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSkillDiscoveryTemplateCommand, "", NULL }, - { "skill_extra_item_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand, "", NULL }, - { "skill_fishing_base_level", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand, "", NULL }, - { "skinning_loot_template", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL }, - { "spell_affect", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellAffectCommand, "", NULL }, - { "spell_chain", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellChainCommand, "", NULL }, - { "spell_elixir", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellElixirCommand, "", NULL }, - { "spell_learn_spell", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellLearnSpellCommand, "", NULL }, - { "spell_pet_auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellPetAurasCommand, "", NULL }, - { "spell_proc_event", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL }, - { "spell_script_target", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL }, - { "spell_scripts", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL }, - { "spell_target_position", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, - { "spell_threats", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, - { "locales_creature", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, - { "locales_gameobject", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, - { "locales_item", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, - { "locales_npc_text", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, - { "locales_page_text", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, - { "locales_quest", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, + { "areatrigger_tavern", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL }, + { "areatrigger_teleport", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL }, + { "areatrigger_involvedrelation",SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL }, + { "event_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventScriptsCommand, "", NULL }, + { "command", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommandCommand, "", NULL }, + { "creature_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand,"",NULL }, + { "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL }, + { "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL }, + { "disenchant_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand, "", NULL }, + { "fishing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand, "", NULL }, + { "game_graveyard_zone", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand, "", NULL }, + { "game_tele", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameTeleCommand, "", NULL }, + { "gameobject_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL }, + { "gameobject_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL }, + { "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL }, + { "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL }, + { "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, + { "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, + { "mangos_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadMangosStringCommand, "", NULL }, + { "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, + { "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, + { "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, + { "page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPageTextsCommand, "", NULL }, + { "pickpocketing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand,"",NULL}, + { "prospecting_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL }, + { "quest_mail_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesQuestMailCommand, "", NULL }, + { "quest_end_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL }, + { "quest_start_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestStartScriptsCommand, "", NULL }, + { "quest_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestTemplateCommand, "", NULL }, + { "reference_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesReferenceCommand, "", NULL }, + { "reserved_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadReservedNameCommand, "", NULL }, + { "skill_discovery_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillDiscoveryTemplateCommand, "", NULL }, + { "skill_extra_item_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand, "", NULL }, + { "skill_fishing_base_level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand, "", NULL }, + { "skinning_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL }, + { "spell_affect", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAffectCommand, "", NULL }, + { "spell_chain", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellChainCommand, "", NULL }, + { "spell_elixir", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellElixirCommand, "", NULL }, + { "spell_learn_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellLearnSpellCommand, "", NULL }, + { "spell_pet_auras", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellPetAurasCommand, "", NULL }, + { "spell_proc_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL }, + { "spell_script_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL }, + { "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL }, + { "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, + { "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, + { "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, + { "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, + { "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, + { "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, + { "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, + { "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, - { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -274,36 +274,36 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand guildCommandTable[] = { - { "create", SEC_GAMEMASTER, false, &ChatHandler::HandleGuildCreateCommand, "", NULL }, - { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleGuildDeleteCommand, "", NULL }, - { "invite", SEC_GAMEMASTER, false, &ChatHandler::HandleGuildInviteCommand, "", NULL }, - { "uninvite", SEC_GAMEMASTER, false, &ChatHandler::HandleGuildUninviteCommand, "", NULL }, - { "rank", SEC_GAMEMASTER, false, &ChatHandler::HandleGuildRankCommand, "", NULL }, + { "create", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildCreateCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildDeleteCommand, "", NULL }, + { "invite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildInviteCommand, "", NULL }, + { "uninvite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildUninviteCommand, "", NULL }, + { "rank", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildRankCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand lookupPlayerCommandTable[] = { - { "ip", SEC_GAMEMASTER, false, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, - { "account", SEC_GAMEMASTER, false, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, - { "email", SEC_GAMEMASTER, false, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, + { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, + { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, + { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand lookupCommandTable[] = { - { "area", SEC_MODERATOR, false, &ChatHandler::HandleLookupAreaCommand, "", NULL }, - { "creature", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, - { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleLookupEventCommand, "", NULL }, - { "faction", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupFactionCommand, "", NULL }, - { "item", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupItemCommand, "", NULL }, - { "itemset", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupItemSetCommand, "", NULL }, - { "object", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupObjectCommand, "", NULL }, - { "quest", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupQuestCommand, "", NULL }, - { "player", SEC_GAMEMASTER, false, NULL, "", lookupPlayerCommandTable }, - { "skill", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupSkillCommand, "", NULL }, - { "spell", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLookupSpellCommand, "", NULL }, - { "tele", SEC_MODERATOR, false, &ChatHandler::HandleLookupTeleCommand, "", NULL }, + { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, + { "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL }, + { "faction", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupFactionCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemCommand, "", NULL }, + { "itemset", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemSetCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupObjectCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupQuestCommand, "", NULL }, + { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, + { "skill", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSkillCommand, "", NULL }, + { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, + { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -337,9 +337,9 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand listCommandTable[] = { - { "creature", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListCreatureCommand, "", NULL }, - { "item", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListItemCommand, "", NULL }, - { "object", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListObjectCommand, "", NULL }, + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListItemCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListObjectCommand, "", NULL }, { "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -347,7 +347,7 @@ ChatCommand * ChatHandler::getCommandTable() static ChatCommand teleCommandTable[] = { { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddTeleCommand, "", NULL }, - { "del", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDelTeleCommand, "", NULL }, + { "del", SEC_ADMINISTRATOR, true, &ChatHandler::HandleDelTeleCommand, "", NULL }, { "name", SEC_MODERATOR, true, &ChatHandler::HandleNameTeleCommand, "", NULL }, { "group", SEC_MODERATOR, false, &ChatHandler::HandleGroupTeleCommand, "", NULL }, { "", SEC_MODERATOR, false, &ChatHandler::HandleTeleCommand, "", NULL }, @@ -454,11 +454,11 @@ ChatCommand * ChatHandler::getCommandTable() { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, - { "reload", SEC_ADMINISTRATOR, false, NULL, "", reloadCommandTable }, - { "list", SEC_ADMINISTRATOR, false, NULL, "", listCommandTable }, - { "lookup", SEC_ADMINISTRATOR, false, NULL, "", lookupCommandTable }, + { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, + { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, + { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, - { "guild", SEC_ADMINISTRATOR, false, NULL, "", guildCommandTable }, + { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, { "reset", SEC_ADMINISTRATOR, false, NULL, "", resetCommandTable }, { "instance", SEC_ADMINISTRATOR, false, NULL, "", instanceCommandTable }, diff --git a/src/game/Language.h b/src/game/Language.h index be2a7cff2..910f5131d 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -447,16 +447,16 @@ enum MangosStrings LANG_ITEMLIST_AUCTION = 510, LANG_WRONG_LINK_TYPE = 511, - LANG_ITEM_LIST = 512, - LANG_QUEST_LIST = 513, - LANG_CREATURE_ENTRY_LIST = 514, - LANG_CREATURE_LIST = 515, - LANG_GO_ENTRY_LIST = 516, - LANG_GO_LIST = 517, - LANG_ITEMSET_LIST = 518, + LANG_ITEM_LIST_CHAT = 512, + LANG_QUEST_LIST_CHAT = 513, + LANG_CREATURE_ENTRY_LIST_CHAT = 514, + LANG_CREATURE_LIST_CHAT = 515, + LANG_GO_ENTRY_LIST_CHAT = 516, + LANG_GO_LIST_CHAT = 517, + LANG_ITEMSET_LIST_CHAT = 518, LANG_TELE_LIST = 519, LANG_SPELL_LIST = 520, - LANG_SKILL_LIST = 521, + LANG_SKILL_LIST_CHAT = 521, LANG_GAMEOBJECT_NOT_EXIST = 522, @@ -529,7 +529,7 @@ enum MangosStrings LANG_COMMAND_NEAROBJMESSAGE = 581, LANG_COMMAND_RAWPAWNTIMES = 582, - LANG_EVENT_ENTRY_LIST = 583, + LANG_EVENT_ENTRY_LIST_CHAT = 583, LANG_NOEVENTFOUND = 584, LANG_EVENT_NOT_EXIST = 585, LANG_EVENT_INFO = 586, @@ -667,7 +667,16 @@ enum MangosStrings LANG_MOTD_NEW = 1100, LANG_ACCOUNT_SETADDON = 1101, LANG_SENDMESSAGE = 1102, - // Room for more level 3 1103-1199 not used + LANG_EVENT_ENTRY_LIST_CONSOLE = 1103, + LANG_CREATURE_ENTRY_LIST_CONSOLE = 1104, + LANG_ITEM_LIST_CONSOLE = 1105, + LANG_ITEMSET_LIST_CONSOLE = 1106, + LANG_GO_ENTRY_LIST_CONSOLE = 1107, + LANG_QUEST_LIST_CONSOLE = 1108, + LANG_SKILL_LIST_CONSOLE = 1109, + LANG_CREATURE_LIST_CONSOLE = 1110, + LANG_GO_LIST_CONSOLE = 1111, + // Room for more level 3 1112-1199 not used // FREE IDS 1200-9999 diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 57330eeff..243e39340 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1644,62 +1644,67 @@ bool ChatHandler::HandleTeleCommand(const char * args) bool ChatHandler::HandleLookupAreaCommand(const char* args) { - if(!*args) + if (!*args) return false; std::string namepart = args; std::wstring wnamepart; - if(!Utf8toWStr(namepart,wnamepart)) + if (!Utf8toWStr (namepart,wnamepart)) return false; uint32 counter = 0; // Counter for figure out that we found smth. // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower (wnamepart); // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) + for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) { - AreaTableEntry const *areaEntry = sAreaStore.LookupEntry(areaflag); - if(areaEntry) + AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag); + if (areaEntry) { - int loc = m_session->GetSessionDbcLocale(); + int loc = m_session ? m_session->GetSessionDbcLocale () : sWorld.GetDefaultDbcLocale(); std::string name = areaEntry->area_name[loc]; - if(name.empty()) + if (name.empty()) continue; - if(!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo (name, wnamepart)) { loc = 0; for(; loc < MAX_LOCALE; ++loc) { - if(loc==m_session->GetSessionDbcLocale()) + if (m_session && loc==m_session->GetSessionDbcLocale ()) continue; name = areaEntry->area_name[loc]; - if(name.empty()) + if (name.empty ()) continue; - if (Utf8FitTo(name, wnamepart)) + if (Utf8FitTo (name, wnamepart)) break; } } - if(loc < MAX_LOCALE) + if (loc < MAX_LOCALE) { // send area in "id - [name]" format std::ostringstream ss; - ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; + if (m_session) + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; + else + ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; - SendSysMessage(ss.str().c_str()); + SendSysMessage (ss.str ().c_str()); ++counter; } } } - if (counter == 0) // if counter == 0 then we found nth - SendSysMessage(LANG_COMMAND_NOAREAFOUND); + + if (counter == 0) // if counter == 0 then we found nth + SendSysMessage (LANG_COMMAND_NOAREAFOUND); + return true; } @@ -1712,6 +1717,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) SetSentErrorMessage(true); return false; } + char const* str = strtok((char*)args, " "); if(!str) return false; @@ -1725,9 +1731,9 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) // converting string that we try to find to lower case wstrToLower( wnamepart ); - GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); - std::ostringstream reply; + + GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) { GameTele const* tele = &itr->second; @@ -1735,11 +1741,10 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) if(tele->wnameLow.find(wnamepart) == std::wstring::npos) continue; - reply << " |cffffffff|Htele:"; - reply << itr->first; - reply << "|h["; - reply << tele->name; - reply << "]|h|r\n"; + if (m_session) + reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; + else + reply << " " << itr->first << " " << tele->name << "\n"; } if(reply.str().empty()) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index ce942af77..d305572e2 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -554,38 +554,38 @@ bool ChatHandler::HandleGUIDCommand(const char* /*args*/) bool ChatHandler::HandleLookupFactionCommand(const char* args) { - if(!*args) + if (!*args) return false; - Player *target = getSelectedPlayer(); - if (!target) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } + // Can be NULL at console call + Player *target = getSelectedPlayer (); std::string namepart = args; std::wstring wnamepart; - if(!Utf8toWStr(namepart,wnamepart)) + if (!Utf8toWStr (namepart,wnamepart)) return false; // converting string that we try to find to lower case - wstrToLower( wnamepart ); + wstrToLower (wnamepart); uint32 counter = 0; // Counter for figure out that we found smth. - for (uint32 id = 0; id < sFactionStore.GetNumRows(); id++) - //for(FactionStateList::const_iterator itr = target->m_factions.begin(); itr != target->m_factions.end(); ++itr) + for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) { - FactionEntry const *factionEntry = sFactionStore.LookupEntry(id); - //FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID); + FactionEntry const *factionEntry = sFactionStore.LookupEntry (id); if (factionEntry) { - FactionStateList::const_iterator repItr = target->m_factions.find(factionEntry->reputationListID); + FactionState const* repState = NULL; + if(target) + { + FactionStateList::const_iterator repItr = target->m_factions.find (factionEntry->reputationListID); + if(repItr != target->m_factions.end()) + repState = &repItr->second; + } - int loc = m_session->GetSessionDbcLocale(); + + int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); std::string name = factionEntry->name[loc]; if(name.empty()) continue; @@ -595,7 +595,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) loc = 0; for(; loc < MAX_LOCALE; ++loc) { - if(loc==m_session->GetSessionDbcLocale()) + if(m_session && loc==m_session->GetSessionDbcLocale()) continue; name = factionEntry->name[loc]; @@ -612,26 +612,29 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format // or "id - [faction] [no reputation]" format std::ostringstream ss; - ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r"; + if (m_session) + ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r"; + else + ss << id << " - " << name << " " << localeNames[loc]; - if (repItr != target->m_factions.end()) + if (repState) // and then target!=NULL also { ReputationRank rank = target->GetReputationRank(factionEntry); std::string rankName = GetMangosString(ReputationRankStrIndex[rank]); ss << " " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")"; - if(repItr->second.Flags & FACTION_FLAG_VISIBLE) + if(repState->Flags & FACTION_FLAG_VISIBLE) ss << GetMangosString(LANG_FACTION_VISIBLE); - if(repItr->second.Flags & FACTION_FLAG_AT_WAR) + if(repState->Flags & FACTION_FLAG_AT_WAR) ss << GetMangosString(LANG_FACTION_ATWAR); - if(repItr->second.Flags & FACTION_FLAG_PEACE_FORCED) + if(repState->Flags & FACTION_FLAG_PEACE_FORCED) ss << GetMangosString(LANG_FACTION_PEACE_FORCED); - if(repItr->second.Flags & FACTION_FLAG_HIDDEN) + if(repState->Flags & FACTION_FLAG_HIDDEN) ss << GetMangosString(LANG_FACTION_HIDDEN); - if(repItr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED) + if(repState->Flags & FACTION_FLAG_INVISIBLE_FORCED) ss << GetMangosString(LANG_FACTION_INVISIBLE_FORCED); - if(repItr->second.Flags & FACTION_FLAG_INACTIVE) + if(repState->Flags & FACTION_FLAG_INACTIVE) ss << GetMangosString(LANG_FACTION_INACTIVE); } else @@ -3588,7 +3591,12 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) if (Utf8FitTo(descr, wnamepart)) { char const* active = activeEvents.find(id) != activeEvents.end() ? GetMangosString(LANG_ACTIVE) : ""; - PSendSysMessage(LANG_EVENT_ENTRY_LIST,id,id,descr.c_str(),active ); + + if(m_session) + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active ); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active ); + ++counter; } } @@ -3613,7 +3621,11 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args) uint32 event_id = *itr; GameEventData const& eventData = events[event_id]; - PSendSysMessage(LANG_EVENT_ENTRY_LIST,event_id,event_id,eventData.description.c_str(),active ); + if(m_session) + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active ); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active ); + ++counter; } @@ -3914,54 +3926,54 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) { - if(!*args) + if (!*args) return false; - std::string ip = strtok((char*)args, " "); - char* limit_str = strtok(NULL, " "); - int32 limit = limit_str ? atoi(limit_str) : -1; + std::string ip = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; - loginDatabase.escape_string(ip); + loginDatabase.escape_string (ip); - QueryResult* result = loginDatabase.PQuery("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str ()); - return LookupPlayerSearchCommand(result,limit); + return LookupPlayerSearchCommand (result,limit); } bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) { - if(!*args) + if (!*args) return false; - std::string account = strtok((char*)args, " "); - char* limit_str = strtok(NULL, " "); - int32 limit = limit_str ? atoi(limit_str) : -1; + std::string account = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; - if(!AccountMgr::normilizeString(account)) + if (!AccountMgr::normilizeString (account)) return false; - loginDatabase.escape_string(account); + loginDatabase.escape_string (account); - QueryResult* result = loginDatabase.PQuery("SELECT id,username FROM account WHERE username = '%s'", account.c_str()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE username = '%s'", account.c_str ()); - return LookupPlayerSearchCommand(result,limit); + return LookupPlayerSearchCommand (result,limit); } bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { - if(!*args) + if (!*args) return false; - std::string email = strtok((char*)args, " "); - char* limit_str = strtok(NULL, " "); - int32 limit = limit_str ? atoi(limit_str) : -1; + std::string email = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; - loginDatabase.escape_string(email); + loginDatabase.escape_string (email); - QueryResult* result = loginDatabase.PQuery("SELECT id,username FROM account WHERE email = '%s'", email.c_str()); + QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE email = '%s'", email.c_str ()); - return LookupPlayerSearchCommand(result,limit); + return LookupPlayerSearchCommand (result,limit); } bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index f4fed22f9..57888f56f 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2029,10 +2029,16 @@ bool ChatHandler::HandleListItemCommand(const char* args) char* cId = extractKeyFromLink((char*)args,"Hitem"); if(!cId) return false; + uint32 item_id = atol(cId); + if(!item_id) + { + PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); + SetSentErrorMessage(true); + return false; + } - ItemPrototype const* itemProto = item_id ? itemProto = objmgr.GetItemPrototype(item_id) : NULL; - + ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id); if(!itemProto) { PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); @@ -2205,16 +2211,21 @@ bool ChatHandler::HandleListObjectCommand(const char* args) if(!*args) return false; - // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); if(!cId) return false; uint32 go_id = atol(cId); + if(!go_id) + { + PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); + SetSentErrorMessage(true); + return false; + } GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id); - - if(!go_id || !gInfo) + if(!gInfo) { PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); SetSentErrorMessage(true); @@ -2227,7 +2238,6 @@ bool ChatHandler::HandleListObjectCommand(const char* args) if(count < 0) return false; - Player* pl = m_session->GetPlayer(); QueryResult *result; uint32 obj_count = 0; @@ -2238,8 +2248,15 @@ bool ChatHandler::HandleListObjectCommand(const char* args) delete result; } - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),go_id,uint32(count)); + if(m_session) + { + Player* pl = m_session->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),go_id,uint32(count)); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM gameobject WHERE id = '%u' LIMIT %u", + go_id,uint32(count)); if (result) { @@ -2252,7 +2269,10 @@ bool ChatHandler::HandleListObjectCommand(const char* args) float z = fields[3].GetFloat(); int mapid = fields[4].GetUInt16(); - PSendSysMessage(LANG_GO_LIST, guid, guid, gInfo->name, x, y, z, mapid); + if (m_session) + PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); + else + PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name, x, y, z, mapid); } while (result->NextRow()); delete result; @@ -2291,7 +2311,7 @@ bool ChatHandler::HandleNearObjectCommand(const char* args) if(!gInfo) continue; - PSendSysMessage(LANG_GO_LIST, guid, guid, gInfo->name, x, y, z, mapid); + PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); ++count; } while (result->NextRow()); @@ -2308,16 +2328,21 @@ bool ChatHandler::HandleListCreatureCommand(const char* args) if(!*args) return false; - // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hcreature_entry"); if(!cId) return false; uint32 cr_id = atol(cId); + if(!cr_id) + { + PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); + SetSentErrorMessage(true); + return false; + } CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id); - - if(!cr_id || !cInfo) + if(!cInfo) { PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); SetSentErrorMessage(true); @@ -2330,7 +2355,6 @@ bool ChatHandler::HandleListCreatureCommand(const char* args) if(count < 0) return false; - Player* pl = m_session->GetPlayer(); QueryResult *result; uint32 cr_count = 0; @@ -2341,8 +2365,15 @@ bool ChatHandler::HandleListCreatureCommand(const char* args) delete result; } - result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id,uint32(count)); + if(m_session) + { + Player* pl = m_session->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id,uint32(count)); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u", + cr_id,uint32(count)); if (result) { @@ -2355,7 +2386,10 @@ bool ChatHandler::HandleListCreatureCommand(const char* args) float z = fields[3].GetFloat(); int mapid = fields[4].GetUInt16(); - PSendSysMessage(LANG_CREATURE_LIST, guid, guid, cInfo->Name, x, y, z, mapid); + if (m_session) + PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name, x, y, z, mapid); + else + PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name, x, y, z, mapid); } while (result->NextRow()); delete result; @@ -2388,7 +2422,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args) if(!pProto) continue; - int loc_idx = m_session->GetSessionDbLocaleIndex(); + int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex(); if ( loc_idx >= 0 ) { ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); @@ -2400,7 +2434,10 @@ bool ChatHandler::HandleLookupItemCommand(const char* args) if (Utf8FitTo(name, wnamepart)) { - PSendSysMessage(LANG_ITEM_LIST, id, id, name.c_str()); + if (m_session) + PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); ++counter; continue; } @@ -2414,7 +2451,10 @@ bool ChatHandler::HandleLookupItemCommand(const char* args) if (Utf8FitTo(name, wnamepart)) { - PSendSysMessage(LANG_ITEM_LIST, id, id, name.c_str()); + if (m_session) + PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); ++counter; } } @@ -2447,8 +2487,8 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args) ItemSetEntry const *set = sItemSetStore.LookupEntry(id); if(set) { - int loc = m_session->GetSessionDbcLocale(); - std::string name = set->name[m_session->GetSessionDbcLocale()]; + int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); + std::string name = set->name[loc]; if(name.empty()) continue; @@ -2457,10 +2497,10 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args) loc = 0; for(; loc < MAX_LOCALE; ++loc) { - if(loc==m_session->GetSessionDbcLocale()) + if(m_session && loc==m_session->GetSessionDbcLocale()) continue; - name = set->name[m_session->GetSessionDbcLocale()]; + name = set->name[loc]; if(name.empty()) continue; @@ -2472,7 +2512,10 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args) if(loc < MAX_LOCALE) { // send item set in "id - [namedlink locale]" format - PSendSysMessage(LANG_ITEMSET_LIST,id,id,name.c_str(),localeNames[loc]); + if (m_session) + PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]); + else + PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE,id,name.c_str(),localeNames[loc]); ++counter; } } @@ -2484,17 +2527,12 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args) bool ChatHandler::HandleLookupSkillCommand(const char* args) { - Player* target = getSelectedPlayer(); - if(!target) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - if(!*args) return false; + // can be NULL in console call + Player* target = getSelectedPlayer(); + std::string namepart = args; std::wstring wnamepart; @@ -2512,7 +2550,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args) SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id); if(skillInfo) { - int loc = m_session->GetSessionDbcLocale(); + int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); std::string name = skillInfo->name[loc]; if(name.empty()) continue; @@ -2522,7 +2560,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args) loc = 0; for(; loc < MAX_LOCALE; ++loc) { - if(loc==m_session->GetSessionDbcLocale()) + if(m_session && loc==m_session->GetSessionDbcLocale()) continue; name = skillInfo->name[loc]; @@ -2536,8 +2574,15 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args) if(loc < MAX_LOCALE) { + char const* knownStr = ""; + if(target && target->HasSkill(id)) + knownStr = GetMangosString(LANG_KNOWN); + // send skill in "id - [namedlink locale]" format - PSendSysMessage(LANG_SKILL_LIST,id,id,name.c_str(),localeNames[loc],(target->HasSkill(id) ? m_session->GetMangosString(LANG_KNOWN) : "")); + if (m_session) + PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr); + else + PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr); ++counter; } @@ -2550,17 +2595,12 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args) bool ChatHandler::HandleLookupSpellCommand(const char* args) { - Player* target = getSelectedPlayer(); - if( !target ) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - if(!*args) return false; + // can be NULL at console call + Player* target = getSelectedPlayer(); + std::string namepart = args; std::wstring wnamepart; @@ -2578,7 +2618,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) SpellEntry const *spellInfo = sSpellStore.LookupEntry(id); if(spellInfo) { - int loc = m_session->GetSessionDbcLocale(); + int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); std::string name = spellInfo->SpellName[loc]; if(name.empty()) continue; @@ -2588,7 +2628,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) loc = 0; for(; loc < MAX_LOCALE; ++loc) { - if(loc==m_session->GetSessionDbcLocale()) + if(m_session && loc==m_session->GetSessionDbcLocale()) continue; name = spellInfo->SpellName[loc]; @@ -2602,14 +2642,14 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) if(loc < MAX_LOCALE) { - bool known = target->HasSpell(id); + bool known = target && target->HasSpell(id); bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL); uint32 telentCost = GetTalentSpellCost(id); bool talent = (telentCost > 0); bool passive = IsPassiveSpell(id); - bool active = target->HasAura(id,0) || target->HasAura(id,1) || target->HasAura(id,2); + bool active = target && (target->HasAura(id,0) || target->HasAura(id,1) || target->HasAura(id,2)); // unit32 used to prevent interpreting uint8 as char at output // find rank of learned spell for learning spell, or talent rank @@ -2617,13 +2657,19 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format std::ostringstream ss; - ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; + if (m_session) + ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; + else + ss << id << " - " << name; // include rank in link name if(rank) ss << GetMangosString(LANG_SPELL_RANK) << rank; - ss << " " << localeNames[loc] << "]|h|r"; + if (m_session) + ss << " " << localeNames[loc] << "]|h|r"; + else + ss << " " << localeNames[loc]; if(talent) ss << GetMangosString(LANG_TALENT); @@ -2649,17 +2695,12 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) bool ChatHandler::HandleLookupQuestCommand(const char* args) { - Player* target = getSelectedPlayer(); - if( !target ) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - if(!*args) return false; + // can be NULL at console call + Player* target = getSelectedPlayer(); + std::string namepart = args; std::wstring wnamepart; @@ -2676,7 +2717,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) { Quest * qinfo = iter->second; - int loc_idx = m_session->GetSessionDbLocaleIndex(); + int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex(); if ( loc_idx >= 0 ) { QuestLocale const *il = objmgr.GetQuestLocale(qinfo->GetQuestId()); @@ -2688,20 +2729,27 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) if (Utf8FitTo(title, wnamepart)) { - QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - char const* statusStr = ""; - if(status == QUEST_STATUS_COMPLETE) - { - if(target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); - else - statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); - } - else if(status == QUEST_STATUS_INCOMPLETE) - statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); - PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetMangosString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetMangosString(LANG_ACTIVE) : "") )); + if(target) + { + QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); + + if(status == QUEST_STATUS_COMPLETE) + { + if(target->GetQuestRewardStatus(qinfo->GetQuestId())) + statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); + else + statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); + } + else if(status == QUEST_STATUS_INCOMPLETE) + statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); + } + + if (m_session) + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); + else + PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); ++counter; continue; } @@ -2715,20 +2763,28 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) if (Utf8FitTo(title, wnamepart)) { - QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); - char const* statusStr = ""; - if(status == QUEST_STATUS_COMPLETE) - { - if(target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); - else - statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); - } - else if(status == QUEST_STATUS_INCOMPLETE) - statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); - PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(), title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetMangosString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetMangosString(LANG_ACTIVE) : "") )); + if(target) + { + QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); + + if(status == QUEST_STATUS_COMPLETE) + { + if(target->GetQuestRewardStatus(qinfo->GetQuestId())) + statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); + else + statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); + } + else if(status == QUEST_STATUS_INCOMPLETE) + statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); + } + + if (m_session) + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); + else + PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); + ++counter; } } @@ -2741,39 +2797,42 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) bool ChatHandler::HandleLookupCreatureCommand(const char* args) { - if(!*args) + if (!*args) return false; std::string namepart = args; std::wstring wnamepart; // converting string that we try to find to lower case - if(!Utf8toWStr(namepart,wnamepart)) + if (!Utf8toWStr (namepart,wnamepart)) return false; - wstrToLower(wnamepart); + wstrToLower (wnamepart); uint32 counter = 0; - for (uint32 id = 0; id< sCreatureStorage.MaxEntry; id++ ) + for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(id); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry (id); if(!cInfo) continue; - int loc_idx = m_session->GetSessionDbLocaleIndex(); - if ( loc_idx >= 0 ) + int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex(); + if (loc_idx >= 0) { - CreatureLocale const *cl = objmgr.GetCreatureLocale(id); + CreatureLocale const *cl = objmgr.GetCreatureLocale (id); if (cl) { - if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty()) + if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ()) { std::string name = cl->Name[loc_idx]; - if (Utf8FitTo(name, wnamepart)) + if (Utf8FitTo (name, wnamepart)) { - PSendSysMessage(LANG_CREATURE_ENTRY_LIST, id, id, name.c_str()); + if (m_session) + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + else + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); ++counter; continue; } @@ -2782,18 +2841,21 @@ bool ChatHandler::HandleLookupCreatureCommand(const char* args) } std::string name = cInfo->Name; - if(name.empty()) + if (name.empty ()) continue; if (Utf8FitTo(name, wnamepart)) { - PSendSysMessage(LANG_CREATURE_ENTRY_LIST,id,id,name.c_str()); + if (m_session) + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + else + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); ++counter; } } if (counter==0) - SendSysMessage(LANG_COMMAND_NOCREATUREFOUND); + SendSysMessage (LANG_COMMAND_NOCREATUREFOUND); return true; } @@ -2820,7 +2882,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args) if(!gInfo) continue; - int loc_idx = m_session->GetSessionDbLocaleIndex(); + int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex(); if ( loc_idx >= 0 ) { GameObjectLocale const *gl = objmgr.GetGameObjectLocale(id); @@ -2832,7 +2894,10 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args) if (Utf8FitTo(name, wnamepart)) { - PSendSysMessage(LANG_GO_ENTRY_LIST, id, id, name.c_str()); + if (m_session) + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); ++counter; continue; } @@ -2846,7 +2911,10 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args) if(Utf8FitTo(name, wnamepart)) { - PSendSysMessage(LANG_GO_ENTRY_LIST, id, id, name.c_str()); + if (m_session) + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); ++counter; } } @@ -2871,86 +2939,82 @@ bool ChatHandler::HandleGuildCreateCommand(const char* args) if (!*args) return false; - Guild *guild; - Player * player; - char *lname,*gname; - std::string guildname; + char *lname = strtok ((char*)args, " "); + char *gname = strtok (NULL, ""); - lname = strtok((char*)args, " "); - gname = strtok(NULL, ""); - - if(!lname) + if (!lname) return false; - else if(!gname) + + if (!gname) { - SendSysMessage(LANG_INSERT_GUILD_NAME); - SetSentErrorMessage(true); + SendSysMessage (LANG_INSERT_GUILD_NAME); + SetSentErrorMessage (true); return false; } - guildname = gname; - player = ObjectAccessor::Instance().FindPlayerByName(lname); + std::string guildname = gname; - if(!player) + Player* player = ObjectAccessor::Instance ().FindPlayerByName (lname); + if (!player) { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); + SendSysMessage (LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage (true); return false; } - if(!player->GetGuildId()) + if (player->GetGuildId()) { - guild = new Guild; - if(!guild->create(player->GetGUID(),guildname)) - { - delete guild; - SendSysMessage(LANG_GUILD_NOT_CREATED); - SetSentErrorMessage(true); - return false; - } - - objmgr.AddGuild(guild); + SendSysMessage (LANG_PLAYER_IN_GUILD); + return true; } - else - SendSysMessage(LANG_PLAYER_IN_GUILD); + Guild *guild = new Guild; + if (!guild->create (player->GetGUID (),guildname)) + { + delete guild; + SendSysMessage (LANG_GUILD_NOT_CREATED); + SetSentErrorMessage (true); + return false; + } + + objmgr.AddGuild (guild); return true; } bool ChatHandler::HandleGuildInviteCommand(const char *args) { - if(!*args) + if (!*args) return false; - char* par1 = strtok((char*)args, " "); + char* par1 = strtok ((char*)args, " "); char* par2 = strtok (NULL, ""); if(!par1 || !par2) return false; std::string glName = par2; - Guild* targetGuild = objmgr.GetGuildByName(glName); - if(!targetGuild) + Guild* targetGuild = objmgr.GetGuildByName (glName); + if (!targetGuild) return false; std::string plName = par1; - if(!normalizePlayerName(plName)) + if (!normalizePlayerName (plName)) { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); + SendSysMessage (LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage (true); return false; } uint64 plGuid = 0; - if(Player* targetPlayer = ObjectAccessor::Instance().FindPlayerByName(plName.c_str())) - plGuid = targetPlayer->GetGUID(); + if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ())) + plGuid = targetPlayer->GetGUID (); else - plGuid = objmgr.GetPlayerGUIDByName(plName.c_str()); + plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); - if(!plGuid) + if (!plGuid) false; // players's guild membership checked in AddMember before add - if(!targetGuild->AddMember(plGuid,targetGuild->GetLowestRank())) + if (!targetGuild->AddMember (plGuid,targetGuild->GetLowestRank ())) return false; return true; @@ -2958,107 +3022,108 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args) bool ChatHandler::HandleGuildUninviteCommand(const char *args) { - if(!*args) + if (!*args) return false; - char* par1 = strtok((char*)args, " "); + char* par1 = strtok ((char*)args, " "); if(!par1) return false; + std::string plName = par1; - if(!normalizePlayerName(plName)) + if (!normalizePlayerName (plName)) { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); + SendSysMessage (LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage (true); return false; } uint64 plGuid = 0; uint32 glId = 0; - if(Player* targetPlayer = ObjectAccessor::Instance().FindPlayerByName(plName.c_str())) + if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ())) { - plGuid = targetPlayer->GetGUID(); - glId = targetPlayer->GetGuildId(); + plGuid = targetPlayer->GetGUID (); + glId = targetPlayer->GetGuildId (); } else { - plGuid = objmgr.GetPlayerGUIDByName(plName.c_str()); - glId = Player::GetGuildIdFromDB(plGuid); + plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); + glId = Player::GetGuildIdFromDB (plGuid); } - if(!plGuid || !glId) + if (!plGuid || !glId) return false; - Guild* targetGuild = objmgr.GetGuildById(glId); - if(!targetGuild) + Guild* targetGuild = objmgr.GetGuildById (glId); + if (!targetGuild) return false; - targetGuild->DelMember(plGuid); + targetGuild->DelMember (plGuid); return true; } bool ChatHandler::HandleGuildRankCommand(const char *args) { - if(!*args) + if (!*args) return false; - char* par1 = strtok((char*)args, " "); - char* par2 = strtok(NULL, " "); - if(!par1 || !par2) + char* par1 = strtok ((char*)args, " "); + char* par2 = strtok (NULL, " "); + if (!par1 || !par2) return false; std::string plName = par1; - if(!normalizePlayerName(plName)) + if (!normalizePlayerName (plName)) { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); + SendSysMessage (LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage (true); return false; } uint64 plGuid = 0; uint32 glId = 0; - if(Player* targetPlayer = ObjectAccessor::Instance().FindPlayerByName(plName.c_str())) + if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ())) { - plGuid = targetPlayer->GetGUID(); - glId = targetPlayer->GetGuildId(); + plGuid = targetPlayer->GetGUID (); + glId = targetPlayer->GetGuildId (); } else { - plGuid = objmgr.GetPlayerGUIDByName(plName.c_str()); - glId = Player::GetGuildIdFromDB(plGuid); + plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); + glId = Player::GetGuildIdFromDB (plGuid); } - if(!plGuid || !glId) + if (!plGuid || !glId) return false; - Guild* targetGuild = objmgr.GetGuildById(glId); - if(!targetGuild) + Guild* targetGuild = objmgr.GetGuildById (glId); + if (!targetGuild) return false; - uint32 newrank = uint32(atoi(par2)); - if(newrank > targetGuild->GetLowestRank()) + uint32 newrank = uint32 (atoi (par2)); + if (newrank > targetGuild->GetLowestRank ()) return false; - targetGuild->ChangeRank(plGuid,newrank); + targetGuild->ChangeRank (plGuid,newrank); return true; } bool ChatHandler::HandleGuildDeleteCommand(const char* args) { - if(!*args) + if (!*args) return false; - char* par1 = strtok((char*)args, " "); - if(!par1) + char* par1 = strtok ((char*)args, " "); + if (!par1) return false; std::string gld = par1; - Guild* targetGuild = objmgr.GetGuildByName(gld); - if(!targetGuild) + Guild* targetGuild = objmgr.GetGuildByName (gld); + if (!targetGuild) return false; - targetGuild->Disband(); + targetGuild->Disband (); return true; } @@ -5275,13 +5340,19 @@ bool ChatHandler::HandleLoadPDumpCommand(const char *args) if(!account_id) { account_id = atoi(account); // use original string - if(account_id) + if(!account_id) { - if(!accmgr.GetName(account_id,account_name)) - return false; - } - else + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); return false; + } + + if(!accmgr.GetName(account_id,account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } } char * name = strtok(NULL, " "); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 229c57e6b..b6997a99f 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -653,6 +653,7 @@ class ObjectMgr } const char *GetMangosString(int32 entry, int locale_idx) const; const char *GetMangosStringForDBCLocale(int32 entry) const { return GetMangosString(entry,DBCLocaleIndex); } + int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance); diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index bd5149b2c..03c7f6290 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -370,13 +370,12 @@ bool PlayerDumpReader::LoadDump(std::string file, uint32 account, std::string na delete result; if (charcount >= 10) - { return false; - } } } FILE *fin = fopen(file.c_str(), "r"); - if(!fin) return false; + if(!fin) + return false; QueryResult * result = NULL; char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];