Core/PacketIO: Fixed quest query packet structure
Port From (https://github.com/TrinityCore/TrinityCore/commit/e540d74610e14b8920570e9ece4c2aa47a4be6ed)
This commit is contained in:
@@ -43,6 +43,19 @@ namespace Framework.Constants
|
||||
KillPlayersSameFaction = 0x80
|
||||
}
|
||||
|
||||
public enum QuestCompleteSpellType
|
||||
{
|
||||
LegacyBehavior = 0,
|
||||
Follower = 1,
|
||||
Tradeskill = 2,
|
||||
Ability = 3,
|
||||
Aura = 4,
|
||||
Spell = 5,
|
||||
Unlock = 6,
|
||||
Companion = 7,
|
||||
Max
|
||||
}
|
||||
|
||||
public struct QuestSlotOffsets
|
||||
{
|
||||
public const int Id = 0;
|
||||
|
||||
@@ -7198,8 +7198,8 @@ namespace Game
|
||||
|
||||
|
||||
// Load `quest_reward_display_spell`
|
||||
// 0 1 2
|
||||
result = DB.World.Query("SELECT QuestID, SpellID, PlayerConditionID FROM quest_reward_display_spell ORDER BY QuestID ASC, Idx ASC");
|
||||
// 0 1 2 3
|
||||
result = DB.World.Query("SELECT QuestID, SpellID, PlayerConditionID, Type FROM quest_reward_display_spell ORDER BY QuestID ASC, Idx ASC");
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 quest reward display spells. DB table `quest_reward_display_spell` is empty.");
|
||||
|
||||
@@ -959,17 +959,13 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
public uint SpellID;
|
||||
public uint PlayerConditionID;
|
||||
|
||||
public QuestCompleteDisplaySpell(uint spellID, uint playerConditionID)
|
||||
{
|
||||
SpellID = spellID;
|
||||
PlayerConditionID = playerConditionID;
|
||||
}
|
||||
public int Type;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteUInt32(SpellID);
|
||||
data.WriteUInt32(PlayerConditionID);
|
||||
data.WriteInt32(Type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ namespace Game
|
||||
{
|
||||
uint spellId = fields.Read<uint>(1);
|
||||
uint playerConditionId = fields.Read<uint>(2);
|
||||
QuestCompleteSpellType type = (QuestCompleteSpellType)fields.Read<uint>(3);
|
||||
|
||||
if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
|
||||
{
|
||||
@@ -135,7 +136,13 @@ namespace Game
|
||||
playerConditionId = 0;
|
||||
}
|
||||
|
||||
RewardDisplaySpell.Add(new QuestRewardDisplaySpell(spellId, playerConditionId));
|
||||
if (type >= QuestCompleteSpellType.Max)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"Table `quest_reward_display_spell` invalid type value ({type}) set for quest {Id} and spell {spellId}. Set to 0.");
|
||||
type = QuestCompleteSpellType.LegacyBehavior;
|
||||
}
|
||||
|
||||
RewardDisplaySpell.Add(new QuestRewardDisplaySpell(spellId, playerConditionId, type));
|
||||
}
|
||||
|
||||
public void LoadRewardChoiceItems(SQLFields fields)
|
||||
@@ -630,7 +637,13 @@ namespace Game
|
||||
response.Info.RewardMoneyMultiplier = RewardMoneyMultiplier;
|
||||
response.Info.RewardBonusMoney = RewardBonusMoney;
|
||||
foreach (QuestRewardDisplaySpell displaySpell in RewardDisplaySpell)
|
||||
response.Info.RewardDisplaySpell.Add(new QuestCompleteDisplaySpell(displaySpell.SpellId, displaySpell.PlayerConditionId));
|
||||
{
|
||||
QuestCompleteDisplaySpell rewardDisplaySpell = new();
|
||||
rewardDisplaySpell.SpellID = displaySpell.SpellId;
|
||||
rewardDisplaySpell.PlayerConditionID = displaySpell.PlayerConditionId;
|
||||
rewardDisplaySpell.Type = (int)displaySpell.Type;
|
||||
response.Info.RewardDisplaySpell.Add(rewardDisplaySpell);
|
||||
}
|
||||
|
||||
response.Info.RewardSpell = RewardSpell;
|
||||
|
||||
@@ -966,11 +979,13 @@ namespace Game
|
||||
{
|
||||
public uint SpellId;
|
||||
public uint PlayerConditionId;
|
||||
public QuestCompleteSpellType Type;
|
||||
|
||||
public QuestRewardDisplaySpell(uint spellId, uint playerConditionId)
|
||||
public QuestRewardDisplaySpell(uint spellId, uint playerConditionId, QuestCompleteSpellType type)
|
||||
{
|
||||
SpellId = spellId;
|
||||
PlayerConditionId = playerConditionId;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user