Implement a general way to store selection data for gossip and fix trainer exploit

This commit is contained in:
hondacrx
2017-08-15 10:42:52 -04:00
parent 000aa1d993
commit 8d113d506d
7 changed files with 48 additions and 13 deletions
+8 -3
View File
@@ -79,7 +79,9 @@ namespace Game
return;
}
_player.SetCurrentTrainerId(trainerId);
_player.PlayerTalkClass.GetInteractionData().Reset();
_player.PlayerTalkClass.GetInteractionData().SourceGuid = guid;
_player.PlayerTalkClass.GetInteractionData().TrainerId = trainerId;
trainer.SendSpells(unit, _player, GetSessionDbLocaleIndex());
}
@@ -97,7 +99,10 @@ namespace Game
if (_player.HasUnitState(UnitState.Died))
_player.RemoveAurasByType(AuraType.FeignDeath);
if (_player.GetCurrentTrainerId() != packet.TrainerID)
if (_player.PlayerTalkClass.GetInteractionData().SourceGuid != packet.TrainerGUID)
return;
if (_player.PlayerTalkClass.GetInteractionData().TrainerId != packet.TrainerID)
return;
// check present spell in trainer spell list
@@ -164,7 +169,7 @@ namespace Game
return;
// Prevent cheating on C# scripted menus
if (GetPlayer().PlayerTalkClass.GetGossipMenu().GetSenderGUID() != packet.GossipUnit)
if (GetPlayer().PlayerTalkClass.GetInteractionData().SourceGuid != packet.GossipUnit)
return;
Creature unit = null;