Core/Gossip: Track started interaction types and reset only questgiver on quest accept
Port From (https://github.com/TrinityCore/TrinityCore/commit/c02e311eef9e635738b9e48559d5455ef016d8b4)
This commit is contained in:
@@ -993,6 +993,8 @@ namespace Game
|
||||
if (ahEntry == null)
|
||||
return;
|
||||
|
||||
GetPlayer().PlayerTalkClass.GetInteractionData().StartInteraction(guid, PlayerInteractionType.Auctioneer);
|
||||
|
||||
AuctionHelloResponse auctionHelloResponse = new();
|
||||
auctionHelloResponse.Auctioneer = guid;
|
||||
auctionHelloResponse.AuctionHouseID = ahEntry.Id;
|
||||
|
||||
@@ -307,8 +307,8 @@ namespace Game
|
||||
|
||||
public void SendShowBank(ObjectGuid guid, PlayerInteractionType interactionType)
|
||||
{
|
||||
_player.PlayerTalkClass.GetInteractionData().Reset();
|
||||
_player.PlayerTalkClass.GetInteractionData().SourceGuid = guid;
|
||||
_player.PlayerTalkClass.GetInteractionData().StartInteraction(guid, interactionType);
|
||||
|
||||
NPCInteractionOpenResult npcInteraction = new();
|
||||
npcInteraction.Npc = guid;
|
||||
npcInteraction.InteractionType = interactionType;
|
||||
|
||||
@@ -265,6 +265,8 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
GetPlayer().PlayerTalkClass.GetInteractionData().StartInteraction(packet.Banker, PlayerInteractionType.GuildBanker);
|
||||
|
||||
guild.SendBankList(this, 0, packet.FullUpdate);
|
||||
}
|
||||
|
||||
|
||||
@@ -562,8 +562,7 @@ namespace Game
|
||||
response.Mails.Add(new MailListEntry(m, player));
|
||||
}
|
||||
|
||||
player.PlayerTalkClass.GetInteractionData().Reset();
|
||||
player.PlayerTalkClass.GetInteractionData().SourceGuid = getList.Mailbox;
|
||||
player.PlayerTalkClass.GetInteractionData().StartInteraction(getList.Mailbox, PlayerInteractionType.MailInfo);
|
||||
SendPacket(response);
|
||||
|
||||
// recalculate m_nextMailDelivereTime and unReadMails
|
||||
|
||||
@@ -89,9 +89,8 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
_player.PlayerTalkClass.GetInteractionData().Reset();
|
||||
_player.PlayerTalkClass.GetInteractionData().SourceGuid = npc.GetGUID();
|
||||
_player.PlayerTalkClass.GetInteractionData().SetTrainerId(trainerId);
|
||||
_player.PlayerTalkClass.GetInteractionData().StartInteraction(npc.GetGUID(), PlayerInteractionType.Trainer);
|
||||
_player.PlayerTalkClass.GetInteractionData().GetTrainer().Id = trainerId;
|
||||
trainer.SendSpells(npc, _player, GetSessionDbLocaleIndex());
|
||||
}
|
||||
|
||||
@@ -109,10 +108,10 @@ namespace Game
|
||||
if (_player.HasUnitState(UnitState.Died))
|
||||
_player.RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
if (_player.PlayerTalkClass.GetInteractionData().SourceGuid != packet.TrainerGUID)
|
||||
if (!_player.PlayerTalkClass.GetInteractionData().IsInteractingWith(packet.TrainerGUID, PlayerInteractionType.Trainer))
|
||||
return;
|
||||
|
||||
if (_player.PlayerTalkClass.GetInteractionData().GetTrainerId() != packet.TrainerID)
|
||||
if (_player.PlayerTalkClass.GetInteractionData().GetTrainer().Id != packet.TrainerID)
|
||||
return;
|
||||
|
||||
// check present spell in trainer spell list
|
||||
@@ -177,7 +176,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
// Prevent cheating on C# scripted menus
|
||||
if (GetPlayer().PlayerTalkClass.GetInteractionData().SourceGuid != packet.GossipUnit)
|
||||
if (!_player.PlayerTalkClass.GetInteractionData().IsInteractingWith(packet.GossipUnit, PlayerInteractionType.Gossip))
|
||||
return;
|
||||
|
||||
Creature unit = null;
|
||||
@@ -424,6 +423,8 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
GetPlayer().PlayerTalkClass.GetInteractionData().StartInteraction(vendorGuid, PlayerInteractionType.Vendor);
|
||||
|
||||
// Stop the npc if moving
|
||||
uint pause = vendor.GetMovementTemplate().GetInteractionPauseTimer();
|
||||
if (pause != 0)
|
||||
|
||||
@@ -425,8 +425,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data = new(ServerOpcodes.PetitionShowList);
|
||||
data.WritePackedGuid(guid); // npc guid
|
||||
GetPlayer().PlayerTalkClass.GetInteractionData().StartInteraction(guid, PlayerInteractionType.PetitionVendor);
|
||||
|
||||
ServerPetitionShowList packet = new();
|
||||
packet.Unit = guid;
|
||||
|
||||
@@ -77,118 +77,100 @@ namespace Game
|
||||
|
||||
// no or incorrect quest giver
|
||||
if (obj == null)
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
Player playerQuestObject = obj.ToPlayer();
|
||||
if (playerQuestObject != null)
|
||||
{
|
||||
if ((_player.GetPlayerSharingQuest().IsEmpty() && _player.GetPlayerSharingQuest() != packet.QuestGiverGUID) || !playerQuestObject.CanShareQuest(packet.QuestID))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player.IsInSameRaidWith(playerQuestObject))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!obj.HasQuest(packet.QuestID))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// some kind of WPE protection
|
||||
if (!_player.CanInteractWithQuestGiver(obj))
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);
|
||||
if (quest != null)
|
||||
if (quest == null)
|
||||
return;
|
||||
|
||||
// prevent cheating
|
||||
if (!GetPlayer().CanTakeQuest(quest, true))
|
||||
return;
|
||||
|
||||
if (!_player.GetPlayerSharingQuest().IsEmpty())
|
||||
{
|
||||
// prevent cheating
|
||||
if (!GetPlayer().CanTakeQuest(quest, true))
|
||||
Player player = Global.ObjAccessor.FindPlayer(_player.GetPlayerSharingQuest());
|
||||
if (player != null)
|
||||
{
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player.GetPlayerSharingQuest().IsEmpty())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(_player.GetPlayerSharingQuest());
|
||||
if (player != null)
|
||||
{
|
||||
player.SendPushToPartyResponse(_player, QuestPushReason.Accepted);
|
||||
_player.ClearQuestSharingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
if (_player.CanAddQuest(quest, true))
|
||||
{
|
||||
_player.AddQuestAndCheckCompletion(quest, obj);
|
||||
|
||||
if (quest.IsPushedToPartyOnAccept())
|
||||
{
|
||||
var group = _player.GetGroup();
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
|
||||
if (player == null || player == _player || !player.IsInMap(_player)) // not self and in same map
|
||||
continue;
|
||||
|
||||
if (player.CanTakeQuest(quest, true))
|
||||
{
|
||||
player.SetQuestSharingInfo(_player.GetGUID(), quest.Id);
|
||||
|
||||
//need confirmation that any gossip window will close
|
||||
player.PlayerTalkClass.SendCloseGossip();
|
||||
|
||||
_player.SendQuestConfirmAccept(quest, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.HasFlag(QuestFlags.LaunchGossipAccept) && !quest.HasFlagEx(QuestFlagsEx.SuppressGossipAccept))
|
||||
{
|
||||
void launchGossip(WorldObject worldObject)
|
||||
{
|
||||
_player.PlayerTalkClass.ClearMenus();
|
||||
_player.PrepareGossipMenu(worldObject, _player.GetGossipMenuForSource(worldObject), true);
|
||||
_player.SendPreparedGossip(worldObject);
|
||||
_player.PlayerTalkClass.GetInteractionData().IsLaunchedByQuest = true;
|
||||
}
|
||||
|
||||
Creature creature = obj.ToCreature();
|
||||
if (creature != null)
|
||||
launchGossip(creature);
|
||||
else
|
||||
{
|
||||
GameObject go = obj.ToGameObject();
|
||||
if (go != null)
|
||||
launchGossip(go);
|
||||
}
|
||||
}
|
||||
else
|
||||
_player.PlayerTalkClass.SendCloseGossip();
|
||||
|
||||
return;
|
||||
player.SendPushToPartyResponse(_player, QuestPushReason.Accepted);
|
||||
_player.ClearQuestSharingInfo();
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_GOSSIP_CLEAR_SHARING_INFO();
|
||||
if (!_player.CanAddQuest(quest, true))
|
||||
return;
|
||||
|
||||
_player.AddQuestAndCheckCompletion(quest, obj);
|
||||
|
||||
if (quest.IsPushedToPartyOnAccept())
|
||||
{
|
||||
var group = _player.GetGroup();
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
|
||||
if (player == null || player == _player || !player.IsInMap(_player)) // not self and in same map
|
||||
continue;
|
||||
|
||||
if (player.CanTakeQuest(quest, true))
|
||||
{
|
||||
player.SetQuestSharingInfo(_player.GetGUID(), quest.Id);
|
||||
|
||||
//need confirmation that any gossip window will close
|
||||
player.PlayerTalkClass.SendCloseGossip();
|
||||
|
||||
_player.SendQuestConfirmAccept(quest, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.HasFlag(QuestFlags.LaunchGossipAccept) && !quest.HasFlagEx(QuestFlagsEx.SuppressGossipAccept))
|
||||
{
|
||||
void launchGossip(WorldObject worldObject)
|
||||
{
|
||||
_player.PlayerTalkClass.ClearMenus();
|
||||
_player.PrepareGossipMenu(worldObject, _player.GetGossipMenuForSource(worldObject), true);
|
||||
_player.SendPreparedGossip(worldObject);
|
||||
_player.PlayerTalkClass.GetInteractionData().IsLaunchedByQuest = true;
|
||||
}
|
||||
|
||||
Creature creature = obj.ToCreature();
|
||||
if (creature != null)
|
||||
launchGossip(creature);
|
||||
else
|
||||
{
|
||||
GameObject go = obj.ToGameObject();
|
||||
if (go != null)
|
||||
launchGossip(go);
|
||||
}
|
||||
}
|
||||
// do not close gossip if quest accept script started a new interaction
|
||||
else if (!_player.PlayerTalkClass.GetInteractionData().IsInteractingWith(obj.GetGUID(), PlayerInteractionType.QuestGiver))
|
||||
_player.PlayerTalkClass.GetInteractionData().IsLaunchedByQuest = true;
|
||||
else
|
||||
_player.PlayerTalkClass.SendCloseGossip();
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.QuestGiverQueryQuest, Processing = PacketProcessing.Inplace)]
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace Game
|
||||
if (curloc == 0)
|
||||
return;
|
||||
|
||||
GetPlayer().PlayerTalkClass.GetInteractionData().StartInteraction(unit.GetGUID(), PlayerInteractionType.TaxiNode);
|
||||
|
||||
bool lastTaxiCheaterState = GetPlayer().IsTaxiCheater();
|
||||
if (unit.GetEntry() == 29480)
|
||||
GetPlayer().SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
|
||||
|
||||
Reference in New Issue
Block a user