Core/PacketIO: Implemented CMSG_CONVERSATION_LINE_STARTED
Port From (https://github.com/TrinityCore/TrinityCore/commit/6d9ce8e8baa100ecc7650d0ae56037c131bab2e0)
This commit is contained in:
@@ -351,7 +351,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
StartTimer timer = new();
|
StartTimer timer = new();
|
||||||
timer.Type = TimerType.Pvp;
|
timer.Type = TimerType.Pvp;
|
||||||
timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
timer.TimeLeft = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
||||||
timer.TotalTime = countdownMaxForBGType;
|
timer.TotalTime = countdownMaxForBGType;
|
||||||
|
|
||||||
foreach (var guid in GetPlayers().Keys)
|
foreach (var guid in GetPlayers().Keys)
|
||||||
@@ -1059,7 +1059,7 @@ namespace Game.BattleGrounds
|
|||||||
uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
|
uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
|
||||||
StartTimer timer = new();
|
StartTimer timer = new();
|
||||||
timer.Type = TimerType.Pvp;
|
timer.Type = TimerType.Pvp;
|
||||||
timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
timer.TimeLeft = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
||||||
timer.TotalTime = countdownMaxForBGType;
|
timer.TotalTime = countdownMaxForBGType;
|
||||||
|
|
||||||
player.SendPacket(timer);
|
player.SendPacket(timer);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Game.Entities
|
|||||||
SetObjectScale(1.0f);
|
SetObjectScale(1.0f);
|
||||||
|
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.LastLineEndTime), conversationTemplate.LastLineEndTime);
|
SetUpdateFieldValue(m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.LastLineEndTime), conversationTemplate.LastLineEndTime);
|
||||||
_duration = conversationTemplate.LastLineEndTime;
|
_duration = conversationTemplate.LastLineEndTime + 10 * Time.InMilliseconds;
|
||||||
_textureKitId = conversationTemplate.TextureKitId;
|
_textureKitId = conversationTemplate.TextureKitId;
|
||||||
|
|
||||||
if (conversationTemplate.Actors != null)
|
if (conversationTemplate.Actors != null)
|
||||||
@@ -197,7 +197,7 @@ namespace Game.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddActor(ObjectGuid actorGuid, ushort actorIdx)
|
public void AddActor(ObjectGuid actorGuid, ushort actorIdx)
|
||||||
{
|
{
|
||||||
ConversationActorField actorField = m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.Actors, actorIdx);
|
ConversationActorField actorField = m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.Actors, actorIdx);
|
||||||
SetUpdateFieldValue(ref actorField.ActorGUID, actorGuid);
|
SetUpdateFieldValue(ref actorField.ActorGUID, actorGuid);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
|||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Networking;
|
using Game.Networking;
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Game.Entities
|
namespace Game.Entities
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class ObjectAccessor : Singleton<ObjectAccessor>
|
|||||||
return u.GetMap().GetSceneObject(guid);
|
return u.GetMap().GetSceneObject(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Conversation GetConversation(WorldObject u, ObjectGuid guid)
|
public static Conversation GetConversation(WorldObject u, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return u.GetMap().GetConversation(guid);
|
return u.GetMap().GetConversation(guid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ using Game.Entities;
|
|||||||
using Game.Groups;
|
using Game.Groups;
|
||||||
using Game.Guilds;
|
using Game.Guilds;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using Game.Misc;
|
|
||||||
using Game.Networking;
|
using Game.Networking;
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using Game.PvP;
|
using Game.PvP;
|
||||||
@@ -454,6 +453,14 @@ namespace Game
|
|||||||
_player.PlayerTalkClass.GetInteractionData().Reset();
|
_player.PlayerTalkClass.GetInteractionData().Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WorldPacketHandler(ClientOpcodes.ConversationLineStarted)]
|
||||||
|
void HandleConversationLineStarted(ConversationLineStarted conversationLineStarted)
|
||||||
|
{
|
||||||
|
Conversation convo = ObjectAccessor.GetConversation(_player, conversationLineStarted.ConversationGUID);
|
||||||
|
if (convo != null)
|
||||||
|
Global.ScriptMgr.OnConversationLineStarted(convo, conversationLineStarted.LineID, _player);
|
||||||
|
}
|
||||||
|
|
||||||
[WorldPacketHandler(ClientOpcodes.ChatUnregisterAllAddonPrefixes)]
|
[WorldPacketHandler(ClientOpcodes.ChatUnregisterAllAddonPrefixes)]
|
||||||
void HandleUnregisterAllAddonPrefixes(ChatUnregisterAllAddonPrefixes packet)
|
void HandleUnregisterAllAddonPrefixes(ChatUnregisterAllAddonPrefixes packet)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1239,15 +1239,29 @@ namespace Game.Networking.Packets
|
|||||||
public override void Write()
|
public override void Write()
|
||||||
{
|
{
|
||||||
_worldPacket.WriteUInt32((uint)Type);
|
_worldPacket.WriteUInt32((uint)Type);
|
||||||
_worldPacket.WriteUInt32(TimeRemaining);
|
_worldPacket.WriteUInt32(TimeLeft);
|
||||||
_worldPacket.WriteUInt32(TotalTime);
|
_worldPacket.WriteUInt32(TotalTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint TimeRemaining;
|
|
||||||
public uint TotalTime;
|
|
||||||
public TimerType Type;
|
public TimerType Type;
|
||||||
|
public uint TimeLeft;
|
||||||
|
public uint TotalTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ConversationLineStarted : ClientPacket
|
||||||
|
{
|
||||||
|
public ObjectGuid ConversationGUID;
|
||||||
|
public uint LineID;
|
||||||
|
|
||||||
|
public ConversationLineStarted(WorldPacket packet) : base(packet) { }
|
||||||
|
|
||||||
|
public override void Read()
|
||||||
|
{
|
||||||
|
ConversationGUID = _worldPacket.ReadPackedGuid();
|
||||||
|
LineID = _worldPacket.ReadUInt32();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DisplayGameError : ServerPacket
|
class DisplayGameError : ServerPacket
|
||||||
{
|
{
|
||||||
public DisplayGameError(GameError error) : base(ServerOpcodes.DisplayGameError)
|
public DisplayGameError(GameError error) : base(ServerOpcodes.DisplayGameError)
|
||||||
|
|||||||
@@ -760,7 +760,7 @@ namespace Game.Scripting
|
|||||||
public virtual AreaTriggerAI GetAI(AreaTrigger at) { return null; }
|
public virtual AreaTriggerAI GetAI(AreaTrigger at) { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConversationScript : ScriptObject
|
public class ConversationScript : ScriptObject
|
||||||
{
|
{
|
||||||
public ConversationScript(string name) : base(name)
|
public ConversationScript(string name) : base(name)
|
||||||
{
|
{
|
||||||
@@ -771,6 +771,9 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
// Called when Conversation is created but not added to Map yet.
|
// Called when Conversation is created but not added to Map yet.
|
||||||
public virtual void OnConversationCreate(Conversation conversation, Unit creator) { }
|
public virtual void OnConversationCreate(Conversation conversation, Unit creator) { }
|
||||||
|
|
||||||
|
// Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid
|
||||||
|
public virtual void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SceneScript : ScriptObject
|
public class SceneScript : ScriptObject
|
||||||
|
|||||||
@@ -1117,6 +1117,14 @@ namespace Game.Scripting
|
|||||||
RunScript<ConversationScript>(script => script.OnConversationCreate(conversation, creator), conversation.GetScriptId());
|
RunScript<ConversationScript>(script => script.OnConversationCreate(conversation, creator), conversation.GetScriptId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender)
|
||||||
|
{
|
||||||
|
Cypher.Assert(conversation != null);
|
||||||
|
Cypher.Assert(sender != null);
|
||||||
|
|
||||||
|
RunScript<ConversationScript>(script => script.OnConversationLineStarted(conversation, lineId, sender), conversation.GetScriptId());
|
||||||
|
}
|
||||||
|
|
||||||
//SceneScript
|
//SceneScript
|
||||||
public void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
public void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Framework.Constants;
|
||||||
|
using Game.Entities;
|
||||||
|
using Game.Scripting;
|
||||||
|
|
||||||
|
namespace Scripts.World
|
||||||
|
{
|
||||||
|
[Script]
|
||||||
|
class conversation_allied_race_dk_defender_of_azeroth : ConversationScript
|
||||||
|
{
|
||||||
|
const uint NpcTalkToYourCommanderCredit = 161709;
|
||||||
|
const uint NpcListenToYourCommanderCredit = 163027;
|
||||||
|
const uint ConversationLinePlayer = 32926;
|
||||||
|
|
||||||
|
public conversation_allied_race_dk_defender_of_azeroth() : base("conversation_allied_race_dk_defender_of_azeroth") { }
|
||||||
|
|
||||||
|
public override void OnConversationCreate(Conversation conversation, Unit creator)
|
||||||
|
{
|
||||||
|
conversation.AddActor(ObjectGuid.Create(HighGuid.Player, 0xFFFFFFFFFFFFFFFF), 1);
|
||||||
|
Player player = creator.ToPlayer();
|
||||||
|
if (player != null)
|
||||||
|
player.KilledMonsterCredit(NpcTalkToYourCommanderCredit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender)
|
||||||
|
{
|
||||||
|
if (lineId != ConversationLinePlayer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sender.KilledMonsterCredit(NpcListenToYourCommanderCredit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `conversation_line_template` WHERE `Id` IN (32915, 32916, 32917, 32918, 32919, 32926);
|
||||||
|
INSERT INTO `conversation_line_template` (`Id`, `StartTime`, `UiCameraID`, `ActorIdx`, `Flags`, `VerifiedBuild`) VALUES
|
||||||
|
(32915, 0, 0, 0, 0, 40120),
|
||||||
|
(32916, 9878, 0, 0, 0, 40120),
|
||||||
|
(32917, 22389, 0, 0, 0, 40120),
|
||||||
|
(32918, 33855, 0, 0, 0, 40120),
|
||||||
|
(32919, 43842, 0, 0, 0, 40120),
|
||||||
|
(32926, 55409, 0, 1, 1, 40120);
|
||||||
|
|
||||||
|
DELETE FROM `conversation_template` WHERE `Id`=13254;
|
||||||
|
INSERT INTO `conversation_template` (`Id`, `FirstLineID`, `LastLineEndTime`, `TextureKitId`, `ScriptName`, `VerifiedBuild`) VALUES
|
||||||
|
(13254, 32915, 55409, 0, 'conversation_allied_race_dk_defender_of_azeroth', 40120);
|
||||||
|
|
||||||
|
DELETE FROM `conversation_actors` WHERE (`ConversationId`=13254 AND `Idx`=0);
|
||||||
|
INSERT INTO `conversation_actors` (`ConversationId`, `ConversationActorId`, `ConversationActorGuid`, `Idx`, `VerifiedBuild`) VALUES
|
||||||
|
-- (13254, 0, 0, 1, 40120), -- Full: 0x0800040000000000FFFFFFFFFFFFFFFF Player/0 R1/S16777215 Map: 0 (Eastern Kingdoms) Low: 1099511627775
|
||||||
|
(13254, 74042, 1050053, 0, 40120); -- Full: 0x203AF51F209DEB400009E0000059DA73 Creature/0 R3773/S2528 Map: 2297 (Icecrown Citadel (8.3)) Entry: 161709 (Highlord Darion Mograine) Low: 5888627
|
||||||
Reference in New Issue
Block a user