Skip to content

Commit 5527acd

Browse files
committed
split types into their own files in Events
1 parent 1d8164a commit 5527acd

File tree

68 files changed

+1288
-1199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1288
-1199
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Intersect.Enums;
2+
using Newtonsoft.Json;
3+
4+
namespace Intersect.GameObjects.Events;
5+
6+
public partial class BooleanVariableMod : VariableMod
7+
{
8+
public bool Value { get; set; }
9+
10+
public VariableType DupVariableType { get; set; } = VariableType.PlayerVariable;
11+
12+
[JsonProperty("DupVariableId")]
13+
public Guid DuplicateVariableId { get; set; }
14+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Intersect.Enums;
2+
3+
namespace Intersect.GameObjects.Events.Commands;
4+
5+
public partial class AddChatboxTextCommand : EventCommand
6+
{
7+
public override EventCommandType Type { get; } = EventCommandType.AddChatboxText;
8+
9+
public string Text { get; set; } = string.Empty;
10+
11+
// TODO: Expose this option to the user?
12+
public ChatMessageType MessageType { get; set; } = ChatMessageType.Notice;
13+
14+
public string Color { get; set; } = string.Empty;
15+
16+
public ChatboxChannel Channel { get; set; } = ChatboxChannel.Player;
17+
18+
public bool ShowChatBubble { get; set; }
19+
20+
public bool ShowChatBubbleInProximity { get; set; }
21+
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
public partial class CastSpellOn : EventCommand
4+
{
5+
public override EventCommandType Type { get; } = EventCommandType.CastSpellOn;
6+
7+
public Guid SpellId { get; set; }
8+
9+
public bool Self { get; set; }
10+
11+
public bool PartyMembers { get; set; }
12+
13+
public bool GuildMembers { get; set; }
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
public partial class ChangeFaceCommand : EventCommand
4+
{
5+
public override EventCommandType Type { get; } = EventCommandType.ChangeFace;
6+
7+
public string Face { get; set; } = string.Empty;
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Intersect.Enums;
2+
3+
namespace Intersect.GameObjects.Events.Commands;
4+
5+
public partial class ChangeGenderCommand : EventCommand
6+
{
7+
public override EventCommandType Type { get; } = EventCommandType.ChangeGender;
8+
9+
public Gender Gender { get; set; } = Gender.Male;
10+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using Intersect.Enums;
2+
3+
namespace Intersect.GameObjects.Events.Commands;
4+
5+
public partial class ChangeItemsCommand : EventCommand
6+
{
7+
//For Json Deserialization
8+
public ChangeItemsCommand()
9+
{
10+
}
11+
12+
public ChangeItemsCommand(Dictionary<Guid, List<EventCommand>> commandLists)
13+
{
14+
for (var i = 0; i < BranchIds.Length; i++)
15+
{
16+
BranchIds[i] = Guid.NewGuid();
17+
commandLists.Add(BranchIds[i], []);
18+
}
19+
}
20+
21+
public override EventCommandType Type { get; } = EventCommandType.ChangeItems;
22+
23+
public Guid ItemId { get; set; }
24+
25+
public bool Add { get; set; } //If !Add then Remove
26+
27+
/// <summary>
28+
/// Defines how the server is supposed to handle changing the items of this request.
29+
/// </summary>
30+
public ItemHandling ItemHandling { get; set; } = ItemHandling.Normal;
31+
32+
/// <summary>
33+
/// Defines whether this event command will use a variable for processing or not.
34+
/// </summary>
35+
public bool UseVariable { get; set; } = false;
36+
37+
/// <summary>
38+
/// Defines whether the variable used is a Player or Global variable.
39+
/// </summary>
40+
public VariableType VariableType { get; set; } = VariableType.PlayerVariable;
41+
42+
/// <summary>
43+
/// The Variable Id to use.
44+
/// </summary>
45+
public Guid VariableId { get; set; }
46+
47+
public int Quantity { get; set; }
48+
49+
//Branch[0] is the event commands to execute when given/taken successfully, Branch[1] is for when they're not.
50+
public Guid[] BranchIds { get; set; } = new Guid[2];
51+
52+
public override string GetCopyData(
53+
Dictionary<Guid, List<EventCommand>> commandLists,
54+
Dictionary<Guid, List<EventCommand>> copyLists
55+
)
56+
{
57+
foreach (var branch in BranchIds)
58+
{
59+
if (branch != Guid.Empty && commandLists.ContainsKey(branch))
60+
{
61+
copyLists.Add(branch, commandLists[branch]);
62+
foreach (var cmd in commandLists[branch])
63+
{
64+
cmd.GetCopyData(commandLists, copyLists);
65+
}
66+
}
67+
}
68+
69+
return base.GetCopyData(commandLists, copyLists);
70+
}
71+
72+
public override void FixBranchIds(Dictionary<Guid, Guid> idDict)
73+
{
74+
for (var i = 0; i < BranchIds.Length; i++)
75+
{
76+
if (idDict.ContainsKey(BranchIds[i]))
77+
{
78+
BranchIds[i] = idDict[BranchIds[i]];
79+
}
80+
}
81+
}
82+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
public partial class ChangeLevelCommand : EventCommand
4+
{
5+
public override EventCommandType Type { get; } = EventCommandType.ChangeLevel;
6+
7+
public int Level { get; set; }
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
public partial class ChangeNameColorCommand : EventCommand
4+
{
5+
public override EventCommandType Type { get; } = EventCommandType.ChangeNameColor;
6+
7+
public Color Color { get; set; }
8+
9+
public bool Override { get; set; }
10+
11+
public bool Remove { get; set; }
12+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
public partial class ChangeNameCommand : EventCommand
4+
{
5+
//For Json Deserialization
6+
public ChangeNameCommand()
7+
{
8+
}
9+
10+
public ChangeNameCommand(Dictionary<Guid, List<EventCommand>> commandLists)
11+
{
12+
for (var i = 0; i < BranchIds.Length; i++)
13+
{
14+
BranchIds[i] = Guid.NewGuid();
15+
commandLists.Add(BranchIds[i], []);
16+
}
17+
}
18+
19+
public override EventCommandType Type { get; } = EventCommandType.ChangeName;
20+
21+
public Guid VariableId { get; set; }
22+
23+
//Branch[0] is the event commands to execute when given/taken successfully, Branch[1] is for when they're not.
24+
public Guid[] BranchIds { get; set; } = new Guid[2];
25+
26+
public override string GetCopyData(
27+
Dictionary<Guid, List<EventCommand>> commandLists,
28+
Dictionary<Guid, List<EventCommand>> copyLists
29+
)
30+
{
31+
foreach (var branch in BranchIds)
32+
{
33+
if (branch != Guid.Empty && commandLists.ContainsKey(branch))
34+
{
35+
copyLists.Add(branch, commandLists[branch]);
36+
foreach (var cmd in commandLists[branch])
37+
{
38+
cmd.GetCopyData(commandLists, copyLists);
39+
}
40+
}
41+
}
42+
43+
return base.GetCopyData(commandLists, copyLists);
44+
}
45+
46+
public override void FixBranchIds(Dictionary<Guid, Guid> idDict)
47+
{
48+
for (var i = 0; i < BranchIds.Length; i++)
49+
{
50+
if (idDict.ContainsKey(BranchIds[i]))
51+
{
52+
BranchIds[i] = idDict[BranchIds[i]];
53+
}
54+
}
55+
}
56+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Intersect.GameObjects.Events.Commands;
2+
3+
/// <summary>
4+
/// Defines the Event command partial class for the Change Player Color command.
5+
/// </summary>
6+
public partial class ChangePlayerColorCommand : EventCommand
7+
{
8+
/// <summary>
9+
/// The <see cref="EventCommandType"/> of this command.
10+
/// </summary>
11+
public override EventCommandType Type { get; } = EventCommandType.ChangePlayerColor;
12+
13+
/// <summary>
14+
/// The <see cref="Color"/> to apply to the player.
15+
/// </summary>
16+
public Color Color { get; set; } = new(255, 255, 255, 255);
17+
}

0 commit comments

Comments
 (0)