Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-07-06 10:08:55 -06:00
committed by GitHub
8 changed files with 66 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
-- DB update 2022_07_03_07 -> 2022_07_05_00
--
DELETE FROM `waypoint_data` WHERE `id`=518940;
INSERT INTO `acore_world`.`waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
(518940, 1, 3866.84, -672.53, 328.888),
(518940, 2, 3866.84, -672.534, 328.888),
(518940, 3, 3818.17, -768.04, 314.71),

View File

@@ -0,0 +1,3 @@
-- DB update 2022_07_05_01 -> 2022_07_05_02
--
UPDATE `achievement_criteria_data` SET `value1` = 8 WHERE `criteria_id` = 4958 AND `type` = 8;

View File

@@ -0,0 +1,5 @@
-- DB update 2022_07_05_02 -> 2022_07_06_00
--
DELETE FROM `command` WHERE `name` = 'debug play visual';
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('debug play visual', 3, 'Syntax: .debug play visual #visualid\r\nPlay spell visual with #visualid.\n#visualid refers to the ID from SpellVisualKit.dbc');

View File

@@ -29,6 +29,7 @@ GossipMenu::GossipMenu()
{
_menuId = 0;
_locale = DEFAULT_LOCALE;
_senderGUID.Clear();
}
GossipMenu::~GossipMenu()
@@ -188,8 +189,10 @@ void PlayerMenu::ClearMenus()
_questMenu.ClearMenu();
}
void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const
void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
{
_gossipMenu.SetSenderGUID(objectGUID);
WorldPacket data(SMSG_GOSSIP_MESSAGE, 24 + _gossipMenu.GetMenuItemCount() * 100 + _questMenu.GetMenuItemCount() * 75); // guess size
data << objectGUID;
data << uint32(_gossipMenu.GetMenuId()); // new 2.4.0
@@ -234,8 +237,10 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const
_session->SendPacket(&data);
}
void PlayerMenu::SendCloseGossip() const
void PlayerMenu::SendCloseGossip()
{
_gossipMenu.SetSenderGUID(ObjectGuid::Empty);
WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
_session->SendPacket(&data);
}

View File

@@ -213,11 +213,15 @@ public:
return _menuItems;
}
void SetSenderGUID(ObjectGuid guid) { _senderGUID = guid; }
[[nodiscard]] ObjectGuid GetSenderGUID() const { return _senderGUID; }
private:
GossipMenuItemContainer _menuItems;
GossipMenuItemDataContainer _menuItemData;
uint32 _menuId;
LocaleConstant _locale;
ObjectGuid _senderGUID;
};
class QuestMenu
@@ -266,8 +270,8 @@ public:
[[nodiscard]] uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
[[nodiscard]] bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const;
void SendCloseGossip() const;
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID);
void SendCloseGossip();
void SendPointOfInterest(uint32 poiId) const;
/*********************************************************/

View File

@@ -98,6 +98,12 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
recv_data >> code;
// Prevent cheating on C++ scripted menus
if (_player->PlayerTalkClass->GetGossipMenu().GetSenderGUID() != guid)
{
return;
}
Creature* unit = nullptr;
GameObject* go = nullptr;
Item* item = nullptr;
@@ -528,6 +534,16 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data)
ObjectGuid guid;
recv_data >> guid;
if (!guid)
{
// Clear any active gossip related to current selection if not present at player's client
GossipMenu& gossipMenu = _player->PlayerTalkClass->GetGossipMenu();
if (gossipMenu.GetSenderGUID() == _player->GetTarget())
{
_player->PlayerTalkClass->SendCloseGossip();
}
}
_player->SetSelection(guid);
// Change target of current autoshoot spell

View File

@@ -38,9 +38,11 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
uint32 questStatus = DIALOG_STATUS_NONE;
GossipMenu& gossipMenu = _player->PlayerTalkClass->GetGossipMenu();
// Did we already get get a gossip menu? if so no need to status query
if (!gossipMenu.Empty())
// Did we already get a gossip menu with that NPC? if so no need to status query
if (gossipMenu.GetSenderGUID() == guid)
{
return;
}
Object* questGiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!questGiver)

View File

@@ -58,7 +58,8 @@ public:
{ "cinematic", HandleDebugPlayCinematicCommand, SEC_ADMINISTRATOR, Console::No },
{ "movie", HandleDebugPlayMovieCommand, SEC_ADMINISTRATOR, Console::No },
{ "sound", HandleDebugPlaySoundCommand, SEC_ADMINISTRATOR, Console::No },
{ "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No }
{ "music", HandleDebugPlayMusicCommand, SEC_ADMINISTRATOR, Console::No },
{ "visual", HandleDebugVisualCommand, SEC_ADMINISTRATOR, Console::No }
};
static ChatCommandTable debugSendCommandTable =
{
@@ -203,6 +204,28 @@ public:
return true;
}
static bool HandleDebugVisualCommand(ChatHandler* handler, uint32 visualId)
{
if (!visualId)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
Player* player = handler->GetPlayer();
Unit* target = handler->getSelectedUnit();
if (!target)
{
player->SendPlaySpellVisual(visualId);
return true;
}
player->SendPlaySpellImpact(target->GetGUID(), visualId);
return true;
}
static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, SpellCastResult result, Optional<uint32> failArg1, Optional<uint32> failArg2)
{
WorldPacket data(SMSG_CAST_FAILED, 5);