Skip to content

Commit

Permalink
split types into their own files in Events
Browse files Browse the repository at this point in the history
  • Loading branch information
lodicolo committed Feb 27, 2025
1 parent 1d8164a commit 5527acd
Show file tree
Hide file tree
Showing 68 changed files with 1,288 additions and 1,199 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Intersect.Enums;
using Newtonsoft.Json;

namespace Intersect.GameObjects.Events;

public partial class BooleanVariableMod : VariableMod
{
public bool Value { get; set; }

public VariableType DupVariableType { get; set; } = VariableType.PlayerVariable;

[JsonProperty("DupVariableId")]
public Guid DuplicateVariableId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Intersect.Enums;

namespace Intersect.GameObjects.Events.Commands;

public partial class AddChatboxTextCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.AddChatboxText;

public string Text { get; set; } = string.Empty;

// TODO: Expose this option to the user?
public ChatMessageType MessageType { get; set; } = ChatMessageType.Notice;

public string Color { get; set; } = string.Empty;

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

public bool ShowChatBubble { get; set; }

public bool ShowChatBubbleInProximity { get; set; }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class CastSpellOn : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.CastSpellOn;

public Guid SpellId { get; set; }

public bool Self { get; set; }

public bool PartyMembers { get; set; }

public bool GuildMembers { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeFaceCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.ChangeFace;

public string Face { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Intersect.Enums;

namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeGenderCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.ChangeGender;

public Gender Gender { get; set; } = Gender.Male;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using Intersect.Enums;

namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeItemsCommand : EventCommand
{
//For Json Deserialization
public ChangeItemsCommand()
{
}

public ChangeItemsCommand(Dictionary<Guid, List<EventCommand>> commandLists)
{
for (var i = 0; i < BranchIds.Length; i++)
{
BranchIds[i] = Guid.NewGuid();
commandLists.Add(BranchIds[i], []);
}
}

public override EventCommandType Type { get; } = EventCommandType.ChangeItems;

public Guid ItemId { get; set; }

public bool Add { get; set; } //If !Add then Remove

/// <summary>
/// Defines how the server is supposed to handle changing the items of this request.
/// </summary>
public ItemHandling ItemHandling { get; set; } = ItemHandling.Normal;

/// <summary>
/// Defines whether this event command will use a variable for processing or not.
/// </summary>
public bool UseVariable { get; set; } = false;

/// <summary>
/// Defines whether the variable used is a Player or Global variable.
/// </summary>
public VariableType VariableType { get; set; } = VariableType.PlayerVariable;

/// <summary>
/// The Variable Id to use.
/// </summary>
public Guid VariableId { get; set; }

public int Quantity { get; set; }

//Branch[0] is the event commands to execute when given/taken successfully, Branch[1] is for when they're not.
public Guid[] BranchIds { get; set; } = new Guid[2];

public override string GetCopyData(
Dictionary<Guid, List<EventCommand>> commandLists,
Dictionary<Guid, List<EventCommand>> copyLists
)
{
foreach (var branch in BranchIds)
{
if (branch != Guid.Empty && commandLists.ContainsKey(branch))
{
copyLists.Add(branch, commandLists[branch]);
foreach (var cmd in commandLists[branch])
{
cmd.GetCopyData(commandLists, copyLists);
}
}
}

return base.GetCopyData(commandLists, copyLists);
}

public override void FixBranchIds(Dictionary<Guid, Guid> idDict)
{
for (var i = 0; i < BranchIds.Length; i++)
{
if (idDict.ContainsKey(BranchIds[i]))
{
BranchIds[i] = idDict[BranchIds[i]];
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeLevelCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.ChangeLevel;

public int Level { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeNameColorCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.ChangeNameColor;

public Color Color { get; set; }

public bool Override { get; set; }

public bool Remove { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeNameCommand : EventCommand
{
//For Json Deserialization
public ChangeNameCommand()
{
}

public ChangeNameCommand(Dictionary<Guid, List<EventCommand>> commandLists)
{
for (var i = 0; i < BranchIds.Length; i++)
{
BranchIds[i] = Guid.NewGuid();
commandLists.Add(BranchIds[i], []);
}
}

public override EventCommandType Type { get; } = EventCommandType.ChangeName;

public Guid VariableId { get; set; }

//Branch[0] is the event commands to execute when given/taken successfully, Branch[1] is for when they're not.
public Guid[] BranchIds { get; set; } = new Guid[2];

public override string GetCopyData(
Dictionary<Guid, List<EventCommand>> commandLists,
Dictionary<Guid, List<EventCommand>> copyLists
)
{
foreach (var branch in BranchIds)
{
if (branch != Guid.Empty && commandLists.ContainsKey(branch))
{
copyLists.Add(branch, commandLists[branch]);
foreach (var cmd in commandLists[branch])
{
cmd.GetCopyData(commandLists, copyLists);
}
}
}

return base.GetCopyData(commandLists, copyLists);
}

public override void FixBranchIds(Dictionary<Guid, Guid> idDict)
{
for (var i = 0; i < BranchIds.Length; i++)
{
if (idDict.ContainsKey(BranchIds[i]))
{
BranchIds[i] = idDict[BranchIds[i]];
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Intersect.GameObjects.Events.Commands;

/// <summary>
/// Defines the Event command partial class for the Change Player Color command.
/// </summary>
public partial class ChangePlayerColorCommand : EventCommand
{
/// <summary>
/// The <see cref="EventCommandType"/> of this command.
/// </summary>
public override EventCommandType Type { get; } = EventCommandType.ChangePlayerColor;

/// <summary>
/// The <see cref="Color"/> to apply to the player.
/// </summary>
public Color Color { get; set; } = new(255, 255, 255, 255);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangePlayerLabelCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.PlayerLabel;

public string Value { get; set; }

public int Position { get; set; } //0 = Above Player Name, 1 = Below Player Name

public Color Color { get; set; }

public bool MatchNameColor { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeSpellsCommand : EventCommand
{
//For Json Deserialization
public ChangeSpellsCommand()
{
}

public ChangeSpellsCommand(Dictionary<Guid, List<EventCommand>> commandLists)
{
for (var i = 0; i < BranchIds.Length; i++)
{
BranchIds[i] = Guid.NewGuid();
commandLists.Add(BranchIds[i], []);
}
}

public override EventCommandType Type { get; } = EventCommandType.ChangeSpells;

public Guid SpellId { get; set; }

public bool Add { get; set; } //If !Add then Remove

public bool RemoveBoundSpell { get; set; }

//Branch[0] is the event commands to execute when taught/removed successfully, Branch[1] is for when it's not.
public Guid[] BranchIds { get; set; } = new Guid[2];

public override string GetCopyData(
Dictionary<Guid, List<EventCommand>> commandLists,
Dictionary<Guid, List<EventCommand>> copyLists
)
{
foreach (var branch in BranchIds)
{
if (branch != Guid.Empty && commandLists.ContainsKey(branch))
{
copyLists.Add(branch, commandLists[branch]);
foreach (var cmd in commandLists[branch])
{
cmd.GetCopyData(commandLists, copyLists);
}
}
}

return base.GetCopyData(commandLists, copyLists);
}

public override void FixBranchIds(Dictionary<Guid, Guid> idDict)
{
for (var i = 0; i < BranchIds.Length; i++)
{
if (idDict.ContainsKey(BranchIds[i]))
{
BranchIds[i] = idDict[BranchIds[i]];
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class ChangeSpriteCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.ChangeSprite;

public string Sprite { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Intersect.GameObjects.Events.Commands;

public partial class CompleteQuestTaskCommand : EventCommand
{
public override EventCommandType Type { get; } = EventCommandType.CompleteQuestTask;

public Guid QuestId { get; set; }

public Guid TaskId { get; set; }
}
Loading

0 comments on commit 5527acd

Please sign in to comment.