From ed1863e1d1a7b8e4e5ff72ee07d1a64c452287b4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 9 Mar 2009 11:40:18 +0300 Subject: [PATCH] [7422] Allow localization base at guildmaster locale default guild rank names at guild creating. --- sql/mangos.sql | 7 +++++- sql/updates/7422_01_mangos_mangos_string.sql | 9 +++++++ sql/updates/Makefile.am | 2 ++ src/game/Guild.cpp | 36 ++++++++++++---------------- src/game/Guild.h | 2 +- src/game/GuildHandler.cpp | 2 +- src/game/Language.h | 7 +++++- src/game/Level3.cpp | 2 +- src/game/PetitionsHandler.cpp | 2 +- src/shared/revision_nr.h | 2 +- 10 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 sql/updates/7422_01_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 3de564fc..0fbc1a57 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_7399_01_mangos_mangos_string` bit(1) default NULL + `required_7422_01_mangos_mangos_string` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -2849,6 +2849,11 @@ INSERT INTO `mangos_string` VALUES (808,'Player %s not found or offline',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (809,'Account for character %s not found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (810,'|Hplayer:$N|h[$N]|h has earned the achievement $a!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(811,'Guild Master',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(812,'Officer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(813,'Veteran',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(814,'Member',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(815,'Initiate',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1000,'Exiting daemon...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1001,'Account deleted: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (1002,'Account %s NOT deleted (probably sql file format was updated)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/7422_01_mangos_mangos_string.sql b/sql/updates/7422_01_mangos_mangos_string.sql new file mode 100644 index 00000000..affe8f74 --- /dev/null +++ b/sql/updates/7422_01_mangos_mangos_string.sql @@ -0,0 +1,9 @@ +ALTER TABLE db_version CHANGE COLUMN required_7399_01_mangos_mangos_string required_7422_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry in (811, 812, 813, 814, 815); +INSERT INTO mangos_string VALUES + (811,'Guild Master',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (812,'Officer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (813,'Veteran',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (814,'Member',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (815,'Initiate',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index ea455f78..c1ea02a7 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -195,6 +195,7 @@ pkgdata_DATA = \ 7390_01_mangos_areatrigger_teleport.sql \ 7393_01_mangos_game_event.sql \ 7399_01_mangos_mangos_string.sql \ + 7422_01_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -370,4 +371,5 @@ EXTRA_DIST = \ 7390_01_mangos_areatrigger_teleport.sql \ 7393_01_mangos_game_event.sql \ 7399_01_mangos_mangos_string.sql \ + 7422_01_mangos_mangos_string.sql \ README diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 239782f9..a13fc049 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -26,6 +26,7 @@ #include "Chat.h" #include "SocialMgr.h" #include "Util.h" +#include "Language.h" Guild::Guild() { @@ -49,27 +50,25 @@ Guild::~Guild() } -bool Guild::create(uint64 lGuid, std::string gname) +bool Guild::create(Player* leader, std::string gname) { - std::string rname; - std::string lName; - - if(!objmgr.GetPlayerNameByGUID(lGuid, lName)) - return false; if(objmgr.GetGuildByName(gname)) return false; - sLog.outDebug("GUILD: creating guild %s to leader: %u", gname.c_str(), GUID_LOPART(lGuid)); + WorldSession* lSession = leader->GetSession(); + if(!lSession) + return false; - leaderGuid = lGuid; + leaderGuid = leader->GetGUID(); name = gname; GINFO = ""; MOTD = "No message set."; guildbank_money = 0; purchased_tabs = 0; - Id = objmgr.GenerateGuildId(); + sLog.outDebug("GUILD: creating guild %s to leader: %u", gname.c_str(), GUID_LOPART(leaderGuid)); + // gname already assigned to Guild::name, use it to encode string for DB CharacterDatabase.escape_string(gname); @@ -87,18 +86,13 @@ bool Guild::create(uint64 lGuid, std::string gname) Id, gname.c_str(), GUID_LOPART(leaderGuid), dbGINFO.c_str(), dbMOTD.c_str(), EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, guildbank_money); CharacterDatabase.CommitTransaction(); - rname = "Guild Master"; - CreateRank(rname,GR_RIGHT_ALL); - rname = "Officer"; - CreateRank(rname,GR_RIGHT_ALL); - rname = "Veteran"; - CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); - rname = "Member"; - CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); - rname = "Initiate"; - CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); - - return AddMember(lGuid, (uint32)GR_GUILDMASTER); + CreateRank(lSession->GetMangosString(LANG_GUILD_MASTER), GR_RIGHT_ALL); + CreateRank(lSession->GetMangosString(LANG_GUILD_OFFICER), GR_RIGHT_ALL); + CreateRank(lSession->GetMangosString(LANG_GUILD_VETERAN), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + CreateRank(lSession->GetMangosString(LANG_GUILD_MEMBER), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + CreateRank(lSession->GetMangosString(LANG_GUILD_INITIATE),GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); + + return AddMember(leaderGuid, (uint32)GR_GUILDMASTER); } bool Guild::AddMember(uint64 plGuid, uint32 plRank) diff --git a/src/game/Guild.h b/src/game/Guild.h index ec764bef..8890baf4 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -267,7 +267,7 @@ class Guild Guild(); ~Guild(); - bool create(uint64 lGuid, std::string gname); + bool create(Player* leader, std::string gname); void Disband(); typedef std::map MemberList; diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 7b77ddf4..f9bde884 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -62,7 +62,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) return; Guild *guild = new Guild; - if(!guild->create(GetPlayer()->GetGUID(),gname)) + if(!guild->create(GetPlayer(),gname)) { delete guild; return; diff --git a/src/game/Language.h b/src/game/Language.h index a2d5500f..a0fb566e 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -708,7 +708,12 @@ enum MangosStrings LANG_PLAYER_NOT_EXIST_OR_OFFLINE = 808, LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND = 809, LANG_ACHIEVEMENT_EARNED = 810, - // Room for in-game strings 811-999 not used + LANG_GUILD_MASTER = 811, + LANG_GUILD_OFFICER = 812, + LANG_GUILD_VETERAN = 813, + LANG_GUILD_MEMBER = 814, + LANG_GUILD_INITIATE = 815, + // Room for in-game strings 816-999 not used // Level 4 (CLI only commands) LANG_COMMAND_EXIT = 1000, diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index ab342f25..eaaebeb4 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3065,7 +3065,7 @@ bool ChatHandler::HandleGuildCreateCommand(const char* args) } Guild *guild = new Guild; - if (!guild->create (player->GetGUID (),guildname)) + if (!guild->create (player,guildname)) { delete guild; SendSysMessage (LANG_GUILD_NOT_CREATED); diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index a4a6594c..a3d50441 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -824,7 +824,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) if(type == 9) // create guild { Guild* guild = new Guild; - if(!guild->create(_player->GetGUID(), name)) + if(!guild->create(_player, name)) { delete guild; delete result; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6af72ad2..b78c81a0 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 "7421" + #define REVISION_NR "7422" #endif // __REVISION_NR_H__ -- 2.11.4.GIT