Skip to content

Commit

Permalink
add "show chat bubble" option on add chatbox text event command (#1902)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeylonSantana authored Sep 14, 2023
1 parent 663c971 commit 19dd30a
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Intersect (Core)/GameObjects/Events/Commands/EventCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public partial class AddChatboxTextCommand : EventCommand
public string Color { get; set; } = "";

public ChatboxChannel Channel { get; set; } = ChatboxChannel.Player;

public bool ShowChatBubble { get; set; }
}

public partial class SetVariableCommand : EventCommand
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public EventCommandChatboxText(AddChatboxTextCommand refCommand, FrmEvent editor
}

cmbChannel.SelectedIndex = (int) mMyCommand.Channel;
chkShowChatBubble.Checked = mMyCommand.ShowChatBubble;
}

private void InitLocalization()
Expand All @@ -50,6 +51,7 @@ private void InitLocalization()
{
cmbChannel.Items.Add(Strings.EventChatboxText.channels[i]);
}
chkShowChatBubble.Text = Strings.EventChatboxText.ShowChatBubble;

btnSave.Text = Strings.EventChatboxText.okay;
btnCancel.Text = Strings.EventChatboxText.cancel;
Expand All @@ -60,6 +62,7 @@ private void btnSave_Click(object sender, EventArgs e)
mMyCommand.Text = txtAddText.Text;
mMyCommand.Color = cmbColor.Text;
mMyCommand.Channel = (ChatboxChannel) cmbChannel.SelectedIndex;
mMyCommand.ShowChatBubble = chkShowChatBubble.Checked;
mEventEditor.FinishCommandEdit();
}

Expand Down
2 changes: 2 additions & 0 deletions Intersect.Editor/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,8 @@ public partial struct EventChatboxText

public static LocalizedString title = @"Add Chatbox Text";

public static LocalizedString ShowChatBubble = @"Show Chat Bubble";

}

public partial struct EventCommandList
Expand Down
11 changes: 11 additions & 0 deletions Intersect.Server/Entities/Events/CommandProcessing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ Stack<CommandInstance> callStack
}
break;
}

if (command.ShowChatBubble)
{
PacketSender.SendChatBubbleToPlayer(
player,
instance.PageInstance.Id,
instance.PageInstance.GetEntityType(),
txt,
instance.PageInstance.MapId
);
}
}

//Set Variable Commands
Expand Down
6 changes: 6 additions & 0 deletions Intersect.Server/Networking/PacketSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,12 @@ public static void SendChatBubble(Guid entityId, Guid mapInstanceId, EntityType
SendDataToProximityOnMapInstance(mapId, mapInstanceId, new ChatBubblePacket(entityId, type, mapId, text), null, TransmissionMode.Any);
}

//ChatBubblePacket
public static void SendChatBubbleToPlayer(Player player, Guid entityId, EntityType type, string text, Guid mapId)
{
player.SendPacket(new ChatBubblePacket(entityId, type, mapId, text));
}

//QuestOfferPacket
public static void SendQuestOffer(Player player, Guid questId)
{
Expand Down

0 comments on commit 19dd30a

Please sign in to comment.