Skip to content

Commit da1cabc

Browse files
committed
rename NpcBase -> NPCDescriptor
1 parent 04ee4a7 commit da1cabc

File tree

26 files changed

+163
-140
lines changed

26 files changed

+163
-140
lines changed

Framework/Intersect.Framework.Core/Descriptors/GameObjectType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Intersect.Framework.Core.GameObjects.Events;
44
using Intersect.Framework.Core.GameObjects.Items;
55
using Intersect.Framework.Core.GameObjects.Maps;
6+
using Intersect.Framework.Core.GameObjects.NPCs;
67
using Intersect.Framework.Core.GameObjects.Variables;
78
using Intersect.GameObjects;
89

@@ -19,7 +20,7 @@ public enum GameObjectType
1920
[GameObjectInfo(typeof(ItemDescriptor), "items")]
2021
Item,
2122

22-
[GameObjectInfo(typeof(NpcBase), "npcs")]
23+
[GameObjectInfo(typeof(NPCDescriptor), "npcs")]
2324
Npc,
2425

2526
[GameObjectInfo(typeof(ProjectileBase), "projectiles")]

Framework/Intersect.Framework.Core/GameObjects/NpcBase.cs renamed to Framework/Intersect.Framework.Core/GameObjects/NPCs/NPCDescriptor.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
using Intersect.Enums;
33
using Intersect.Framework.Core.GameObjects.Conditions;
44
using Intersect.Framework.Core.GameObjects.Events;
5+
using Intersect.GameObjects;
56
using Intersect.Models;
67
using Intersect.Utilities;
78
using Newtonsoft.Json;
89

9-
namespace Intersect.GameObjects;
10+
namespace Intersect.Framework.Core.GameObjects.NPCs;
1011

11-
public partial class NpcBase : DatabaseObject<NpcBase>, IFolderable
12+
public partial class NPCDescriptor : DatabaseObject<NPCDescriptor>, IFolderable
1213
{
1314
private long[] _maxVitals = new long[Enum.GetValues<Vital>().Length];
1415
private int[] _stats = new int[Enum.GetValues<Stat>().Length];
@@ -110,13 +111,13 @@ public string ImmunitiesJson
110111
}
111112

112113
[JsonConstructor]
113-
public NpcBase(Guid id) : base(id)
114+
public NPCDescriptor(Guid id) : base(id)
114115
{
115116
Name = "New Npc";
116117
}
117118

118119
//Parameterless constructor for EF
119-
public NpcBase()
120+
public NPCDescriptor()
120121
{
121122
Name = "New Npc";
122123
}

Framework/Intersect.Framework.Core/GameObjects/QuestBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Intersect.Framework.Core.GameObjects.Conditions;
44
using Intersect.Framework.Core.GameObjects.Events;
55
using Intersect.Framework.Core.GameObjects.Items;
6+
using Intersect.Framework.Core.GameObjects.NPCs;
67
using Intersect.Framework.Core.Serialization;
78
using Intersect.Localization;
89
using Intersect.Models;
@@ -254,7 +255,7 @@ public string GetTaskString(Dictionary<int, LocalizedString> descriptions)
254255
break;
255256
case QuestObjective.KillNpcs: //Kill Npcs
256257
taskString = descriptions[(int)Objective].ToString(
257-
NpcBase.GetName(TargetId),
258+
NPCDescriptor.GetName(TargetId),
258259
Quantity,
259260
Description
260261
);

Intersect.Client.Core/Interface/Game/QuestsWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Intersect.Client.Networking;
99
using Intersect.Enums;
1010
using Intersect.Framework.Core.GameObjects.Items;
11+
using Intersect.Framework.Core.GameObjects.NPCs;
1112
using Intersect.GameObjects;
1213
using Intersect.Utilities;
1314

@@ -381,7 +382,7 @@ private void UpdateSelectedQuest()
381382
Strings.QuestLog.TaskNpc.ToString(
382383
Globals.Me.QuestProgress[mSelectedQuest.Id].TaskProgress,
383384
mSelectedQuest.Tasks[i].Quantity,
384-
NpcBase.GetName(mSelectedQuest.Tasks[i].TargetId)
385+
NPCDescriptor.GetName(mSelectedQuest.Tasks[i].TargetId)
385386
), mQuestDescTemplateLabel
386387
);
387388
}

Intersect.Editor/Forms/DockingElements/frmMapLayers.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Intersect.Framework.Core.GameObjects.Maps;
99
using Intersect.Framework.Core.GameObjects.Maps.Attributes;
1010
using Intersect.Framework.Core.GameObjects.Maps.MapList;
11+
using Intersect.Framework.Core.GameObjects.NPCs;
1112
using Intersect.GameObjects;
1213
using Intersect.Localization;
1314
using Intersect.Utilities;
@@ -793,13 +794,13 @@ public void RefreshNpcList()
793794
{
794795
// Update the list incase npcs have been modified since form load.
795796
cmbNpc.Items.Clear();
796-
cmbNpc.Items.AddRange(NpcBase.Names);
797+
cmbNpc.Items.AddRange(NPCDescriptor.Names);
797798

798799
// Add the map NPCs
799800
lstMapNpcs.Items.Clear();
800801
for (var i = 0; i < Globals.CurrentMap.Spawns.Count; i++)
801802
{
802-
lstMapNpcs.Items.Add(NpcBase.GetName(Globals.CurrentMap.Spawns[i].NpcId));
803+
lstMapNpcs.Items.Add(NPCDescriptor.GetName(Globals.CurrentMap.Spawns[i].NpcId));
803804
}
804805

805806
// Don't select if there are no NPCs, to avoid crashes.
@@ -816,7 +817,7 @@ public void RefreshNpcList()
816817
if (lstMapNpcs.SelectedIndex < Globals.CurrentMap.Spawns.Count)
817818
{
818819
cmbDir.SelectedIndex = (int) Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].Direction;
819-
cmbNpc.SelectedIndex = NpcBase.ListIndex(Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].NpcId);
820+
cmbNpc.SelectedIndex = NPCDescriptor.ListIndex(Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].NpcId);
820821
if (Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].X >= 0)
821822
{
822823
rbDeclared.Checked = true;
@@ -840,13 +841,13 @@ private void btnAddMapNpc_Click(object sender, EventArgs e)
840841
//Don't add nothing
841842
if (cmbNpc.SelectedIndex > -1)
842843
{
843-
n.NpcId = NpcBase.IdFromList(cmbNpc.SelectedIndex);
844+
n.NpcId = NPCDescriptor.IdFromList(cmbNpc.SelectedIndex);
844845
n.X = -1;
845846
n.Y = -1;
846847
n.Direction = NpcSpawnDirection.Random;
847848

848849
Globals.CurrentMap.Spawns.Add(n);
849-
lstMapNpcs.Items.Add(NpcBase.GetName(n.NpcId));
850+
lstMapNpcs.Items.Add(NPCDescriptor.GetName(n.NpcId));
850851
lstMapNpcs.SelectedIndex = lstMapNpcs.Items.Count - 1;
851852
}
852853

@@ -864,7 +865,7 @@ private void btnRemoveMapNpc_Click(object sender, EventArgs e)
864865
lstMapNpcs.Items.Clear();
865866
for (var i = 0; i < Globals.CurrentMap.Spawns.Count; i++)
866867
{
867-
lstMapNpcs.Items.Add(NpcBase.GetName(Globals.CurrentMap.Spawns[i].NpcId));
868+
lstMapNpcs.Items.Add(NPCDescriptor.GetName(Globals.CurrentMap.Spawns[i].NpcId));
868869
}
869870

870871
if (lstMapNpcs.Items.Count > 0)
@@ -902,7 +903,7 @@ private void lstMapNpcs_Update()
902903

903904
var selectedSpawn = Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex];
904905

905-
cmbNpc.SelectedIndex = NpcBase.ListIndex(selectedSpawn.NpcId);
906+
cmbNpc.SelectedIndex = NPCDescriptor.ListIndex(selectedSpawn.NpcId);
906907
cmbDir.SelectedIndex = (int)selectedSpawn.Direction;
907908
rbDeclared.Checked = selectedSpawn.X >= 0;
908909
rbRandom.Checked = !rbDeclared.Checked;
@@ -943,14 +944,14 @@ private void cmbNpc_SelectedIndexChanged(object sender, EventArgs e)
943944

944945
if (lstMapNpcs.SelectedIndex >= 0)
945946
{
946-
Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].NpcId = NpcBase.IdFromList(cmbNpc.SelectedIndex);
947+
Globals.CurrentMap.Spawns[lstMapNpcs.SelectedIndex].NpcId = NPCDescriptor.IdFromList(cmbNpc.SelectedIndex);
947948

948949
// Refresh List
949950
n = lstMapNpcs.SelectedIndex;
950951
lstMapNpcs.Items.Clear();
951952
for (var i = 0; i < Globals.CurrentMap.Spawns.Count; i++)
952953
{
953-
lstMapNpcs.Items.Add(NpcBase.GetName(Globals.CurrentMap.Spawns[i].NpcId));
954+
lstMapNpcs.Items.Add(NPCDescriptor.GetName(Globals.CurrentMap.Spawns[i].NpcId));
954955
}
955956

956957
lstMapNpcs.SelectedIndex = n;

Intersect.Editor/Forms/Editors/Events/CommandPrinter.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Intersect.Framework.Core.GameObjects.Events.Commands;
88
using Intersect.Framework.Core.GameObjects.Items;
99
using Intersect.Framework.Core.GameObjects.Maps.MapList;
10+
using Intersect.Framework.Core.GameObjects.NPCs;
1011
using Intersect.Framework.Core.GameObjects.Variables;
1112
using Intersect.GameObjects;
1213
using Microsoft.Extensions.Logging;
@@ -1035,7 +1036,7 @@ private static string GetCommandText(SpawnNpcCommand command, MapInstance map)
10351036
if (orderedMap.MapId == command.MapId)
10361037
{
10371038
return Strings.EventCommandList.spawnnpc.ToString(
1038-
NpcBase.GetName(command.NpcId),
1039+
NPCDescriptor.GetName(command.NpcId),
10391040
Strings.EventCommandList.spawnonmap.ToString(
10401041
orderedMap.Name, command.X, command.Y, Strings.Direction.dir?[command.Dir]
10411042
)
@@ -1044,7 +1045,7 @@ private static string GetCommandText(SpawnNpcCommand command, MapInstance map)
10441045
}
10451046

10461047
return Strings.EventCommandList.spawnnpc.ToString(
1047-
NpcBase.GetName(command.NpcId),
1048+
NPCDescriptor.GetName(command.NpcId),
10481049
Strings.EventCommandList.spawnonmap.ToString(
10491050
Strings.EventCommandList.mapnotfound, command.X, command.Y, Strings.Direction.dir[command.Dir]
10501051
)
@@ -1062,21 +1063,21 @@ private static string GetCommandText(SpawnNpcCommand command, MapInstance map)
10621063
if (command.EntityId == Guid.Empty)
10631064
{
10641065
return Strings.EventCommandList.spawnnpc.ToString(
1065-
NpcBase.GetName(command.NpcId),
1066+
NPCDescriptor.GetName(command.NpcId),
10661067
Strings.EventCommandList.spawnonplayer.ToString(command.X, command.Y, retain)
10671068
);
10681069
}
10691070

10701071
if (map.LocalEvents.TryGetValue(command.EntityId, out var localEvent))
10711072
{
10721073
return Strings.EventCommandList.spawnnpc.ToString(
1073-
NpcBase.GetName(command.NpcId),
1074+
NPCDescriptor.GetName(command.NpcId),
10741075
Strings.EventCommandList.spawnonevent.ToString(localEvent.Name, command.X, command.Y, retain)
10751076
);
10761077
}
10771078

10781079
return Strings.EventCommandList.spawnnpc.ToString(
1079-
NpcBase.GetName(command.NpcId),
1080+
NPCDescriptor.GetName(command.NpcId),
10801081
Strings.EventCommandList.spawnonevent.ToString(
10811082
Strings.EventCommandList.deletedevent, command.X, command.Y, retain
10821083
)

Intersect.Editor/Forms/Editors/Events/Event Commands/EventCommand_ConditionalBranch.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Intersect.Framework.Core.GameObjects.Events.Commands;
77
using Intersect.Framework.Core.GameObjects.Items;
88
using Intersect.Framework.Core.GameObjects.Maps;
9+
using Intersect.Framework.Core.GameObjects.NPCs;
910
using Intersect.Framework.Core.GameObjects.Variables;
1011
using Intersect.GameObjects;
1112
using Intersect.Utilities;
@@ -529,7 +530,7 @@ private void UpdateFormElements(ConditionType type)
529530
case ConditionType.NoNpcsOnMap:
530531
grpNpc.Show();
531532
cmbNpcs.Items.Clear();
532-
cmbNpcs.Items.AddRange(NpcBase.Names);
533+
cmbNpcs.Items.AddRange(NPCDescriptor.Names);
533534

534535
chkNpc.Checked = false;
535536
cmbNpcs.Hide();
@@ -1344,7 +1345,7 @@ private void SetupFormValues(NoNpcsOnMapCondition condition)
13441345
{
13451346
lblNpc.Show();
13461347
cmbNpcs.Show();
1347-
cmbNpcs.SelectedIndex = NpcBase.ListIndex(condition.NpcId);
1348+
cmbNpcs.SelectedIndex = NPCDescriptor.ListIndex(condition.NpcId);
13481349
}
13491350
else
13501351
{
@@ -1541,7 +1542,7 @@ private void SaveFormValues(QuestCompletedCondition condition)
15411542
private void SaveFormValues(NoNpcsOnMapCondition condition)
15421543
{
15431544
condition.SpecificNpc = chkNpc.Checked;
1544-
condition.NpcId = condition.SpecificNpc ? NpcBase.IdFromList(cmbNpcs.SelectedIndex) : default;
1545+
condition.NpcId = condition.SpecificNpc ? NPCDescriptor.IdFromList(cmbNpcs.SelectedIndex) : default;
15451546
}
15461547

15471548
private void SaveFormValues(GenderIsCondition condition)

Intersect.Editor/Forms/Editors/Events/Event Commands/EventCommand_SpawnNpc.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Intersect.Framework.Core.GameObjects.Events.Commands;
66
using Intersect.Framework.Core.GameObjects.Maps;
77
using Intersect.Framework.Core.GameObjects.Maps.MapList;
8+
using Intersect.Framework.Core.GameObjects.NPCs;
89
using Intersect.GameObjects;
910

1011
namespace Intersect.Editor.Forms.Editors.Events.Event_Commands;
@@ -41,8 +42,8 @@ SpawnNpcCommand editingCommand
4142
mCurrentMap = currentMap;
4243
InitLocalization();
4344
cmbNpc.Items.Clear();
44-
cmbNpc.Items.AddRange(NpcBase.Names);
45-
cmbNpc.SelectedIndex = NpcBase.ListIndex(mMyCommand.NpcId);
45+
cmbNpc.Items.AddRange(NPCDescriptor.Names);
46+
cmbNpc.SelectedIndex = NPCDescriptor.ListIndex(mMyCommand.NpcId);
4647
if (mMyCommand.MapId != Guid.Empty)
4748
{
4849
cmbConditionType.SelectedIndex = 0;
@@ -181,7 +182,7 @@ private void UpdateSpawnPreview()
181182

182183
private void btnSave_Click(object sender, EventArgs e)
183184
{
184-
mMyCommand.NpcId = NpcBase.IdFromList(cmbNpc.SelectedIndex);
185+
mMyCommand.NpcId = NPCDescriptor.IdFromList(cmbNpc.SelectedIndex);
185186
switch (cmbConditionType.SelectedIndex)
186187
{
187188
case 0: //Tile Spawn

Intersect.Editor/Forms/Editors/Quest/Quest_TaskEditor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Intersect.Editor.Localization;
44
using Intersect.Enums;
55
using Intersect.Framework.Core.GameObjects.Items;
6+
using Intersect.Framework.Core.GameObjects.NPCs;
67
using Intersect.GameObjects;
78
using Microsoft.Extensions.Logging;
89

@@ -57,7 +58,7 @@ public QuestTaskEditor(QuestBase refQuest, QuestBase.QuestTask refTask)
5758

5859
break;
5960
case 2: //Kill NPCS
60-
cmbNpc.SelectedIndex = NpcBase.ListIndex(mMyTask?.TargetId ?? Guid.Empty);
61+
cmbNpc.SelectedIndex = NPCDescriptor.ListIndex(mMyTask?.TargetId ?? Guid.Empty);
6162
nudNpcQuantity.Value = mMyTask?.Quantity ?? 0;
6263

6364
break;
@@ -115,7 +116,7 @@ private void UpdateFormElements()
115116
case 2: //Kill Npcs
116117
grpKillNpcs.Show();
117118
cmbNpc.Items.Clear();
118-
cmbNpc.Items.AddRange(NpcBase.Names);
119+
cmbNpc.Items.AddRange(NPCDescriptor.Names);
119120
if (cmbNpc.Items.Count > 0)
120121
{
121122
cmbNpc.SelectedIndex = 0;
@@ -144,7 +145,7 @@ private void btnSave_Click(object sender, EventArgs e)
144145

145146
break;
146147
case QuestObjective.KillNpcs: //Kill Npcs
147-
mMyTask.TargetId = NpcBase.IdFromList(cmbNpc.SelectedIndex);
148+
mMyTask.TargetId = NPCDescriptor.IdFromList(cmbNpc.SelectedIndex);
148149
mMyTask.Quantity = (int) nudNpcQuantity.Value;
149150

150151
break;

0 commit comments

Comments
 (0)