From 46ba2d945a9da4af1fe13d2da1a593a1fe2a4f20 Mon Sep 17 00:00:00 2001 From: Nefarion Date: Sat, 9 Mar 2013 22:34:42 +0100 Subject: Allow reply to whispers if you are under CONFIG_CHAT_WHISPER_LEVEL_REQ, and implement feature for GMs to remove single players from their WhisperWhiteList. --- .../world/2013_03_11_01_world_trinty_strings.sql | 2 ++ src/server/game/Entities/Player/Player.h | 1 + src/server/game/Handlers/ChatHandler.cpp | 22 ++++++++++------------ src/server/game/Miscellaneous/Language.h | 3 ++- src/server/game/Server/WorldSession.cpp | 3 +++ src/server/scripts/Commands/cs_message.cpp | 19 ++++++++++++++++++- 6 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 sql/updates/world/2013_03_11_01_world_trinty_strings.sql diff --git a/sql/updates/world/2013_03_11_01_world_trinty_strings.sql b/sql/updates/world/2013_03_11_01_world_trinty_strings.sql new file mode 100644 index 00000000000..c4a76a4e4f7 --- /dev/null +++ b/sql/updates/world/2013_03_11_01_world_trinty_strings.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` where `entry` = 363; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES ('363', 'Player %s cannot whisper you any longer.'); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a95c81fb6bc..bf38eba9d4c 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2272,6 +2272,7 @@ class Player : public Unit, public GridObject void ClearWhisperWhiteList() { WhisperList.clear(); } void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); } bool IsInWhisperWhiteList(uint64 guid); + void RemoveFromWhisperWhiteList(uint64 guid) { WhisperList.remove(guid); } /*! These methods send different packets to the client in apply and unapply case. These methods are only sent to the current unit. diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 81de643bcf5..72d768baa65 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -257,12 +257,6 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } break; case CHAT_MSG_WHISPER: { - if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ)) - { - SendNotification(GetTrinityString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ)); - return; - } - if (!normalizePlayerName(to)) { SendPlayerNotFoundNotice(to); @@ -270,16 +264,18 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } Player* receiver = sObjectAccessor->FindPlayerByName(to); - if (!receiver || (!HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && - !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) + if (!receiver) { SendPlayerNotFoundNotice(to); return; } + if (!sender->isGameMaster() && sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) && !receiver->IsInWhisperWhiteList(sender->GetGUID())) + { + SendNotification(GetTrinityString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ)); + return; + } - // @todo: check only sender permission and add receiver to whiteList if receiver does not have the permission - if (GetPlayer()->GetTeam() != receiver->GetTeam() && !HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT) && - !receiver->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT)) + if (GetPlayer()->GetTeam() != receiver->GetTeam() && !HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT) && !receiver->IsInWhisperWhiteList(sender->GetGUID())) { SendWrongFactionNotice(); return; @@ -292,7 +288,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } // If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to - if (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())) + // We also do that if a player is under the required level for whispers. + if (receiver->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) || + (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))) sender->AddWhisperWhiteList(receiver->GetGUID()); GetPlayer()->Whisper(msg, lang, receiver->GetGUID()); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 28f7a2cb8a0..26e0cc27828 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -376,7 +376,8 @@ enum TrinityStrings LANG_COMMAND_CHEAT_CD = 360, LANG_COMMAND_CHEAT_POWER = 361, LANG_COMMAND_CHEAT_WW = 362, - // Room for more level 2 363-399 not used + LANG_COMMAND_WHISPEROFFPLAYER = 363, + // Room for more level 2 364-399 not used // level 3 chat LANG_SCRIPTS_RELOADED = 400, diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 0eede73d7fa..5e91f0f2464 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -477,6 +477,9 @@ void WorldSession::LogoutPlayer(bool save) ///- Remove pet _player->RemovePet(NULL, PET_SAVE_AS_CURRENT, true); + ///- Clear whisper whitelist + _player->ClearWhisperWhiteList(); + ///- empty buyback items and save the player in the database // some save parts only correctly work in case player present in map/player_lists (pets, etc) if (save) diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index e2c53492e9d..1364c586da7 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -186,7 +186,7 @@ public: return true; } - std::string argStr = (char*)args; + std::string argStr = strtok((char*)args, " "); // whisper on if (argStr == "on") { @@ -205,6 +205,23 @@ public: return true; } + if (argStr == "remove") + { + std::string name = strtok(NULL, " "); + if (normalizePlayerName(name)) + if (Player* player = sObjectAccessor->FindPlayerByName(name)) + { + handler->GetSession()->GetPlayer()->RemoveFromWhisperWhiteList(player->GetGUID()); + handler->PSendSysMessage(LANG_COMMAND_WHISPEROFFPLAYER, name); + return true; + } + else + { + handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND, name); + handler->SetSentErrorMessage(true); + return false; + } + } handler->SendSysMessage(LANG_USE_BOL); handler->SetSentErrorMessage(true); return false; -- cgit v1.2.3 From 492a516b9869d2a85663240f77597d66d695ee01 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 15 Mar 2013 16:46:12 +0100 Subject: Remove documentation for script/custom texts The related code and tables do not exist anymore. --- doc/TextTables.txt | 92 ------------------------------------------------------ 1 file changed, 92 deletions(-) delete mode 100644 doc/TextTables.txt diff --git a/doc/TextTables.txt b/doc/TextTables.txt deleted file mode 100644 index fa8aebdb5d3..00000000000 --- a/doc/TextTables.txt +++ /dev/null @@ -1,92 +0,0 @@ -========================================= -Texts Documentation -========================================= - -========================================================= -WARNING: THIS DOCUMENTATION IS NOT ALWAYS UP TO DATE. -FOR MORE UP-TO-DATE INFORMATION, CHECK THE TRINITY WIKI. -========================================================= - -Scriptdev2 Revision 695 introduces a new format for using texts in EventAI and SD2 Scripts. -This information relates to the *_texts tables located in the ScriptDev Database. - -Any script can at any time access and use text from any of the three text tables, as long as the entry does in fact exist. -Custom scripters are adviced to store their text data in custom_texts. - -The different tables has ranges of entries allowed for that table. -Reserved EventAI in Mangos entry -1 -> -999999 -script_texts: entry -1000000 -> -1999999 -custom_texts: entry -2000000 -> -2999999 -Any entry out of range for that table will display a startup error. - - -========================================= -Basic Structure of script_texts and custom_texts -========================================= -Below is a the list of current fields within the texts tables. - -Field_Name Description ------------------------------------------------------------ -entry This value is mearly an NEGATIVE identifier of the current text number. Required for sql queries. -content_default This is the actual text presented in the default language (English). - -content_loc1 This is the actual text presented in the Localization #1 Clients (Korean) -content_loc2 This is the actual text presented in the Localization #2 Clients (French) -content_loc3 This is the actual text presented in the Localization #3 Clients (German) -content_loc4 This is the actual text presented in the Localization #4 Clients (Chinese) -content_loc5 This is the actual text presented in the Localization #5 Clients (Taiwanese) -content_loc6 This is the actual text presented in the Localization #6 Clients (Spanish) -content_loc7 This is the actual text presented in the Localization #7 Clients (Spanish Mexico) -content_loc8 This is the actual text presented in the Localization #8 Clients (Russian) - -sound This value is the Sound ID that corresponds to the actual text used (Defined in SoundEntries.dbc). -type Variables used to define type of text (Say/Yell/Textemote/Whisper). -language This value is the Language that the text is native in (Defined in Languages.dbc). -emote Value from enum Emote (defined in Emotes.dbc). Only source of text will play this emote (not target, if target are defined in DoScriptText) -comment This is a comment regarding the text entry (For ACID, accepted format is to use Creature ID of NPC using it). - -Note: Fields `content_loc1` to `content_loc8` are NULL values by default and are handled by seperate localization projects. - - -========================================= -Text Types (type) -========================================= -Below is the list of current Text types that texts tables can handle. These were previously seperate Actions in ACID. - -# Internal Name Description ------------------------------------------------------------ -0 CHAT_TYPE_SAY This type sets the text to be displayed as a Say (Speech Bubble). -1 CHAT_TYPE_YELL This type sets the text to be displayed as a Yell (Red Speech Bubble) and usually has a matching Sound ID. -2 CHAT_TYPE_TEXT_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log. -3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). -4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log. -5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses). -6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone. - - -========================================= -Language Types (language) -========================================= -Below is the list of current Language types that are allowed. -This is the Race Language that the text is native to (So it will display properly) - -# Internal Name Description ------------------------------------------------------------ -0 UNIVERSAL Text in this language is understood by ALL Races. -1 ORCISH Text in this language is understood ONLY by Horde Races. -2 DARNASSIAN Text in this language is understood ONLY by the Night Elf Race. -3 TAURAHE Text in this language is understood ONLY by the Tauren Race. -6 DWARVISH Text in this language is understood ONLY by the Dwarf Race. -7 COMMON Text in this language is understood ONLY by Alliance Races. -8 DEMONIC Text in this language is understood ONLY by the Demon Race (Not Implimented). -9 TITAN This language was used by Sargeras to speak with other Titians (Not Implemented). -10 THALASSIAN Text in this language is understood ONLY by the Blood Elf Race. -11 DRACONIC Text in this language is understood ONLY by the Dragon Race. -12 KALIMAG Text will display as Kalimag (not readable by players, language of all elementals) -13 GNOMISH Text in this language is understood ONLY by the Gnome Race. -14 TROLL Text in this language is understood ONLY by the Troll Race. -33 GUTTERSPEAK Text in this language is understood ONLY by the Undead Race. -35 DRAENEI Text in this language is understood ONLY by the Draenai Race. -36 ZOMBIE (not currently used?) -37 GNOMISH BINARY Binary language used by Alliance when drinking Binary Brew -38 GOBLIN BINARY Binary language used by Horce when drinking Binary Brew \ No newline at end of file -- cgit v1.2.3 From 44553d3fd4d9d808f4a863fa26297ef97a03bac1 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 15 Mar 2013 16:50:40 +0100 Subject: Fix some engrish --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 4 ++-- src/server/game/Entities/Unit/Unit.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 2ff5ce27aa0..3b9109a8f38 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -104,8 +104,8 @@ enum SMART_EVENT SMART_EVENT_REWARD_QUEST = 20, // QuestID(0any) SMART_EVENT_REACHED_HOME = 21, // NONE SMART_EVENT_RECEIVE_EMOTE = 22, // EmoteId, CooldownMin, CooldownMax, condition, val1, val2, val3 - SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax - SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_HAS_AURA = 23, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax + SMART_EVENT_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Stack amount, Param3/4 RepeatMin, RepeatMax SMART_EVENT_RESET = 25, // Called after combat, when the creature respawn and spawn. SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ba8c2239274..97b85b555e8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16912,7 +16912,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) Player* player = ToPlayer(); - // If player is on mouted duel and exits the mount should immediatly lose the duel + // If the player is on mounted duel and exits the mount, he should immediatly lose the duel if (player && player->duel && player->duel->isMounted) player->DuelComplete(DUEL_FLED); -- cgit v1.2.3 From 59bc6ed0ae09a63be9562425afb9533d07b702ea Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 15 Mar 2013 19:32:46 +0100 Subject: Core/Unit: Fall after exiting vehicle if is in air and can not fly --- src/server/game/Entities/Unit/Unit.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 97b85b555e8..d76885591a5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16940,14 +16940,19 @@ void Unit::_ExitVehicle(Position const* exitPosition) SendMessageToSet(&data, false); } + float height = pos.GetPositionZ(); + Movement::MoveSplineInit init(this); - init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false); + + // Creatures without inhabit type air should begin falling after exiting the vehicle + if (GetTypeId() == TYPEID_UNIT && !CanFly() && height > GetMap()->GetWaterOrGroundLevel(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), &height) + 0.1f) + init.SetFall(); + + init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false); init.SetFacing(GetOrientation()); init.SetTransportExit(); init.Launch(); - //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above) - if (player) player->ResummonPetTemporaryUnSummonedIfAny(); -- cgit v1.2.3 From b136f01edfa6152018d095889395f0fb16125e29 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 15 Mar 2013 19:37:45 +0100 Subject: Script/Quest: Into the wild green Yonder Still todo: * Fix spell focus requirement for the drop spell casted by the vehicle Closes: #8752 --- sql/updates/world/2013_03_15_01_world_smart_scripts.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sql/updates/world/2013_03_15_01_world_smart_scripts.sql diff --git a/sql/updates/world/2013_03_15_01_world_smart_scripts.sql b/sql/updates/world/2013_03_15_01_world_smart_scripts.sql new file mode 100644 index 00000000000..63561342f3c --- /dev/null +++ b/sql/updates/world/2013_03_15_01_world_smart_scripts.sql @@ -0,0 +1,12 @@ +DELETE FROM `smart_scripts` WHERE `entryorguid`=30407 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_flags`,`event_phase_mask`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(30407,0,1,11,0,0,0,0,0,0,11,56726,0,1,'Captured Crusader - On Respawn - Apply Nerubian Webs (56726)'), +(30407,1,0,61,0,0,0,0,0,0,22,1,0,1,'Captured Crusader - Linked to id 0 - Set event phase to 1'), +(30407,2,0, 1,0,1,4000,4000,4000,4000,10,70,22,1,'Captured Crusader - Out of combat - Random emote'), +(30407,3,4, 8,0,1,56683,0,0,0,11,56687,0,7,'Captured Crusader - Spell hit of Grab Captured Crusader (56683) - Cast Ride Vehicle (56687)'), +(30407,4,5,61,0,1,0,0,0,0,1,0,0,1,'Captured Crusader - Linked to id 3 - Talk'), +(30407,5,0,61,0,1,0,0,0,0,22,2,0,1,'Captured Crusader - Linked to id 3 - Set event phase to 2'), +(30407,6,0, 1,0,2,8000,8000,8000,8000,1,1,0,1,'Captured Crusader - Out of combat - Talk'), +(30407,7,8,23,1,2,56687,0,0,0,1,2,0,1,'Captured Crusader - Aura Ride Vehicle (56687) removed - Talk'), +(30407,8,9,61,0,2,0,0,0,0,41,5000,0,1,'Captured Crusader - Linked to id 7 - Despawn'), +(30407,9,0,61,0,2,0,0,0,0,22,0,0,1,'Captured Crusader - Linked to id 7 - Set event phase to 0'); -- cgit v1.2.3 From 6b78efdcd6f21135faa789c9402587b95a3b37b2 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 15 Mar 2013 20:44:07 +0000 Subject: SQL: Rename SQL file after PR merge --- sql/updates/world/2013_03_11_01_world_trinty_strings.sql | 2 -- sql/updates/world/2013_03_15_01_world_trinity_strings.sql | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 sql/updates/world/2013_03_11_01_world_trinty_strings.sql create mode 100644 sql/updates/world/2013_03_15_01_world_trinity_strings.sql diff --git a/sql/updates/world/2013_03_11_01_world_trinty_strings.sql b/sql/updates/world/2013_03_11_01_world_trinty_strings.sql deleted file mode 100644 index c4a76a4e4f7..00000000000 --- a/sql/updates/world/2013_03_11_01_world_trinty_strings.sql +++ /dev/null @@ -1,2 +0,0 @@ -DELETE FROM `trinity_string` where `entry` = 363; -INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES ('363', 'Player %s cannot whisper you any longer.'); diff --git a/sql/updates/world/2013_03_15_01_world_trinity_strings.sql b/sql/updates/world/2013_03_15_01_world_trinity_strings.sql new file mode 100644 index 00000000000..0ae44b1ae53 --- /dev/null +++ b/sql/updates/world/2013_03_15_01_world_trinity_strings.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` where `entry`=363; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(363, 'Player %s cannot whisper you any longer.'); -- cgit v1.2.3 From 3b9ab08029a224fe0f1548eb8187c4186f4ea29b Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Fri, 15 Mar 2013 23:02:11 +0100 Subject: Core: Fix non pch build --- src/server/scripts/Commands/cs_message.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index 1364c586da7..66f55b85c1c 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ChannelMgr.h" #include "Language.h" #include "Player.h" +#include "ObjectMgr.h" class message_commandscript : public CommandScript { -- cgit v1.2.3