Skip to content

Commit ca2c71a

Browse files
committed
rename CraftBase -> CraftingRecipeDescriptor, CraftingTableBase -> CraftingTableDescriptor
generate migrations for renames of CraftingRecipeDescriptor and CraftingTableDescriptor
1 parent a57fcf9 commit ca2c71a

File tree

25 files changed

+3789
-240
lines changed

25 files changed

+3789
-240
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public enum GameObjectType
3636
[GameObjectInfo(typeof(SpellBase), "spells")]
3737
Spell,
3838

39-
[GameObjectInfo(typeof(CraftingTableBase), "crafting_tables")]
39+
[GameObjectInfo(typeof(CraftingTableDescriptor), "crafting_tables")]
4040
CraftTables,
4141

42-
[GameObjectInfo(typeof(CraftBase), "crafts")]
42+
[GameObjectInfo(typeof(CraftingRecipeDescriptor), "crafts")]
4343
Crafts,
4444

4545
[GameObjectInfo(typeof(MapBase), "maps")]

Framework/Intersect.Framework.Core/GameObjects/Crafting/CraftBase.cs renamed to Framework/Intersect.Framework.Core/GameObjects/Crafting/CraftingRecipeDescriptor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77
namespace Intersect.Framework.Core.GameObjects.Crafting;
88

9-
public partial class CraftBase : DatabaseObject<CraftBase>, IFolderable
9+
public partial class CraftingRecipeDescriptor : DatabaseObject<CraftingRecipeDescriptor>, IFolderable
1010
{
1111
[NotMapped]
1212
public List<CraftingRecipeIngredient> Ingredients { get; set; } = [];
1313

1414
[JsonConstructor]
15-
public CraftBase(Guid id) : base(id)
15+
public CraftingRecipeDescriptor(Guid id) : base(id)
1616
{
1717
Name = "New Craft";
1818
}
1919

2020
//Parameterless constructor for EF
21-
public CraftBase()
21+
public CraftingRecipeDescriptor()
2222
{
2323
Name = "New Craft";
2424
}

Framework/Intersect.Framework.Core/GameObjects/Crafting/CraftingTableBase.cs renamed to Framework/Intersect.Framework.Core/GameObjects/Crafting/CraftingTableDescriptor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
namespace Intersect.Framework.Core.GameObjects.Crafting;
66

7-
public partial class CraftingTableBase : DatabaseObject<CraftingTableBase>, IFolderable
7+
public partial class CraftingTableDescriptor : DatabaseObject<CraftingTableDescriptor>, IFolderable
88
{
99
[NotMapped]
10-
public DbList<CraftBase> Crafts { get; set; } = [];
10+
public DbList<CraftingRecipeDescriptor> Crafts { get; set; } = [];
1111

1212
[JsonConstructor]
13-
public CraftingTableBase(Guid id) : base(id)
13+
public CraftingTableDescriptor(Guid id) : base(id)
1414
{
1515
Name = "New Table";
1616
}
1717

1818
//Parameterless constructor for EF
19-
public CraftingTableBase()
19+
public CraftingTableDescriptor()
2020
{
2121
Name = "New Table";
2222
}
@@ -26,7 +26,7 @@ public CraftingTableBase()
2626
public string CraftsJson
2727
{
2828
get => JsonConvert.SerializeObject(Crafts, Formatting.None);
29-
protected set => Crafts = JsonConvert.DeserializeObject<DbList<CraftBase>>(value);
29+
protected set => Crafts = JsonConvert.DeserializeObject<DbList<CraftingRecipeDescriptor>>(value);
3030
}
3131

3232
/// <inheritdoc />

Intersect.Client.Core/General/Globals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static partial class Globals
100100
//Scene management
101101

102102
//Only need 1 table, and that is the one we see at a given moment in time.
103-
public static CraftingTableBase? ActiveCraftingTable { get; set; }
103+
public static CraftingTableDescriptor? ActiveCraftingTable { get; set; }
104104

105105
public static int AnimationFrame { get; set; }
106106

Intersect.Client.Core/Interface/Game/Crafting/CraftingWindow.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ private void PlayerOnInventoryUpdated(Player player, int slotIndex)
140140

141141
private void LoadCraftRecipeById(Guid craftDescriptorId)
142142
{
143-
if (!CraftBase.TryGet(craftDescriptorId, out var craftDescriptor))
143+
if (!CraftingRecipeDescriptor.TryGet(craftDescriptorId, out var craftDescriptor))
144144
{
145145
return;
146146
}
147147

148148
LoadCraftRecipe(craftDescriptor);
149149
}
150150

151-
private void LoadCraftRecipe(CraftBase craftDescriptor)
151+
private void LoadCraftRecipe(CraftingRecipeDescriptor craftDescriptor)
152152
{
153153
_craftRecipeDescriptorId = craftDescriptor.Id;
154154

@@ -270,7 +270,7 @@ private void LoadCraftRecipe(CraftBase craftDescriptor)
270270
if (IsCrafting)
271271
{
272272
var cancraft = true;
273-
foreach (var c in CraftBase.Get(_craftRecipeDescriptorId).Ingredients)
273+
foreach (var c in CraftingRecipeDescriptor.Get(_craftRecipeDescriptorId).Ingredients)
274274
{
275275
if (inventoryItemsByDescriptorId.ContainsKey(c.ItemId))
276276
{
@@ -337,13 +337,13 @@ private void CraftingRecipeRowOnClicked(Base sender, MouseButtonState arguments)
337337
return;
338338
}
339339

340-
if (sender is not ListBoxRow { UserData: CraftBase craftDescriptor })
340+
if (sender is not ListBoxRow { UserData: CraftingRecipeDescriptor craftDescriptor })
341341
{
342342
ApplicationContext.CurrentContext.Logger.LogError(
343343
"Sender is not a {ListBoxRowTypeName} or the {UserDataPropertyName} is not a {CraftDescriptorTypeName}",
344344
typeof(ListBoxRow).GetName(true),
345345
nameof(UserData),
346-
typeof(CraftBase).GetName(true)
346+
typeof(CraftingRecipeDescriptor).GetName(true)
347347
);
348348
return;
349349
}
@@ -371,7 +371,7 @@ private bool CanCraft()
371371
}
372372
}
373373

374-
var craftDescriptor = CraftBase.Get(_craftRecipeDescriptorId);
374+
var craftDescriptor = CraftingRecipeDescriptor.Get(_craftRecipeDescriptorId);
375375
var canCraft = craftDescriptor?.Ingredients != null;
376376

377377
if (canCraft)
@@ -468,7 +468,7 @@ protected override void DoPrelayout(Framework.Gwen.Skin.Base skin)
468468
return;
469469
}
470470

471-
var craft = CraftBase.Get(_craftRecipeDescriptorId);
471+
var craft = CraftingRecipeDescriptor.Get(_craftRecipeDescriptorId);
472472
if (craft == null)
473473
{
474474
return;
@@ -516,10 +516,10 @@ protected override void EnsureInitialized()
516516
return;
517517
}
518518

519-
CraftBase? craftRecipeDescriptorToLoad = null;
519+
CraftingRecipeDescriptor? craftRecipeDescriptorToLoad = null;
520520
foreach (var craftRecipeDescriptorId in craftRecipeDescriptorIds)
521521
{
522-
if (!CraftBase.TryGet(craftRecipeDescriptorId, out var craftRecipeDescriptor))
522+
if (!CraftingRecipeDescriptor.TryGet(craftRecipeDescriptorId, out var craftRecipeDescriptor))
523523
{
524524
ApplicationContext.CurrentContext.Logger.LogWarning(
525525
"Failed to load craft recipe descriptor {CraftDescriptorId}",

Intersect.Client.Core/Networking/PacketHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ public void HandlePacket(IPacketSender packetSender, CraftingTablePacket packet)
17251725
{
17261726
if (!packet.Close)
17271727
{
1728-
Globals.ActiveCraftingTable = new CraftingTableBase();
1728+
Globals.ActiveCraftingTable = new CraftingTableDescriptor();
17291729
Globals.ActiveCraftingTable.Load(packet.TableData);
17301730
Interface.Interface.EnqueueInGame(gameInterface => gameInterface.NotifyOpenCraftingTable(packet.JournalMode));
17311731
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,8 @@ private static string GetCommandText(OpenShopCommand command, MapInstance map)
12201220
private static string GetCommandText(OpenCraftingTableCommand command, MapInstance map)
12211221
{
12221222
return command.JournalMode ?
1223-
Strings.EventCommandList.OpenCraftingJournal.ToString(CraftingTableBase.GetName(command.CraftingTableId)) :
1224-
Strings.EventCommandList.opencrafting.ToString(CraftingTableBase.GetName(command.CraftingTableId));
1223+
Strings.EventCommandList.OpenCraftingJournal.ToString(CraftingTableDescriptor.GetName(command.CraftingTableId)) :
1224+
Strings.EventCommandList.opencrafting.ToString(CraftingTableDescriptor.GetName(command.CraftingTableId));
12251225
}
12261226

12271227
private static string GetCommandText(SetClassCommand command, MapInstance map)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public EventCommandOpenCraftingTable(OpenCraftingTableCommand refCommand, FrmEve
2020
mEventEditor = editor;
2121
InitLocalization();
2222
cmbTable.Items.Clear();
23-
cmbTable.Items.AddRange(CraftingTableBase.Names);
24-
cmbTable.SelectedIndex = CraftingTableBase.ListIndex(mMyCommand.CraftingTableId);
23+
cmbTable.Items.AddRange(CraftingTableDescriptor.Names);
24+
cmbTable.SelectedIndex = CraftingTableDescriptor.ListIndex(mMyCommand.CraftingTableId);
2525
chkJournalMode.Checked = mMyCommand.JournalMode;
2626
}
2727

@@ -47,7 +47,7 @@ private void btnSave_Click(object sender, EventArgs e)
4747
{
4848
if (cmbTable.SelectedIndex > -1)
4949
{
50-
mMyCommand.CraftingTableId = CraftingTableBase.IdFromList(cmbTable.SelectedIndex);
50+
mMyCommand.CraftingTableId = CraftingTableDescriptor.IdFromList(cmbTable.SelectedIndex);
5151
}
5252

5353
mMyCommand.JournalMode = chkJournalMode.Checked;

Intersect.Editor/Forms/Editors/frmCraftingTables.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ namespace Intersect.Editor.Forms.Editors;
1414
public partial class FrmCraftingTables : EditorForm
1515
{
1616

17-
private List<CraftingTableBase> mChanged = new List<CraftingTableBase>();
17+
private List<CraftingTableDescriptor> mChanged = new List<CraftingTableDescriptor>();
1818

1919
private string mCopiedItem;
2020

21-
private CraftingTableBase mEditorItem;
21+
private CraftingTableDescriptor mEditorItem;
2222

2323
private List<string> mKnownFolders = new List<string>();
2424

@@ -32,7 +32,7 @@ public FrmCraftingTables()
3232
}
3333
private void AssignEditorItem(Guid id)
3434
{
35-
mEditorItem = CraftingTableBase.Get(id);
35+
mEditorItem = CraftingTableDescriptor.Get(id);
3636
UpdateEditor();
3737
}
3838

@@ -41,7 +41,7 @@ protected override void GameObjectUpdatedDelegate(GameObjectType type)
4141
if (type == GameObjectType.CraftTables)
4242
{
4343
InitEditor();
44-
if (mEditorItem != null && !DatabaseObject<CraftingTableBase>.Lookup.Values.Contains(mEditorItem))
44+
if (mEditorItem != null && !DatabaseObject<CraftingTableDescriptor>.Lookup.Values.Contains(mEditorItem))
4545
{
4646
mEditorItem = null;
4747
UpdateEditor();
@@ -189,7 +189,7 @@ private void form_KeyDown(object sender, KeyEventArgs e)
189189
private void frmCrafting_Load(object sender, EventArgs e)
190190
{
191191
cmbCrafts.Items.Clear();
192-
cmbCrafts.Items.AddRange(CraftBase.Names);
192+
cmbCrafts.Items.AddRange(CraftingRecipeDescriptor.Names);
193193

194194
InitLocalization();
195195
}
@@ -227,14 +227,14 @@ public void UpdateList()
227227
lstCrafts.Items.Clear();
228228
foreach (var id in mEditorItem.Crafts)
229229
{
230-
lstCrafts.Items.Add(CraftBase.GetName(id));
230+
lstCrafts.Items.Add(CraftingRecipeDescriptor.GetName(id));
231231
}
232232
}
233233

234234
private void btnAddCraftedItem_Click(object sender, EventArgs e)
235235
{
236-
var id = CraftBase.IdFromList(cmbCrafts.SelectedIndex);
237-
var craft = CraftBase.Get(id);
236+
var id = CraftingRecipeDescriptor.IdFromList(cmbCrafts.SelectedIndex);
237+
var craft = CraftingRecipeDescriptor.Get(id);
238238
if (craft != null && !mEditorItem.Crafts.Contains(id))
239239
{
240240
mEditorItem.Crafts.Add(id);
@@ -283,15 +283,15 @@ public void InitEditor()
283283
{
284284
//Collect folders
285285
var mFolders = new List<string>();
286-
foreach (var itm in CraftingTableBase.Lookup)
286+
foreach (var itm in CraftingTableDescriptor.Lookup)
287287
{
288-
if (!string.IsNullOrEmpty(((CraftingTableBase) itm.Value).Folder) &&
289-
!mFolders.Contains(((CraftingTableBase) itm.Value).Folder))
288+
if (!string.IsNullOrEmpty(((CraftingTableDescriptor) itm.Value).Folder) &&
289+
!mFolders.Contains(((CraftingTableDescriptor) itm.Value).Folder))
290290
{
291-
mFolders.Add(((CraftingTableBase) itm.Value).Folder);
292-
if (!mKnownFolders.Contains(((CraftingTableBase) itm.Value).Folder))
291+
mFolders.Add(((CraftingTableDescriptor) itm.Value).Folder);
292+
if (!mKnownFolders.Contains(((CraftingTableDescriptor) itm.Value).Folder))
293293
{
294-
mKnownFolders.Add(((CraftingTableBase) itm.Value).Folder);
294+
mKnownFolders.Add(((CraftingTableDescriptor) itm.Value).Folder);
295295
}
296296
}
297297
}
@@ -302,8 +302,8 @@ public void InitEditor()
302302
cmbFolder.Items.Add("");
303303
cmbFolder.Items.AddRange(mKnownFolders.ToArray());
304304

305-
var items = CraftingTableBase.Lookup.OrderBy(p => p.Value?.Name).Select(pair => new KeyValuePair<Guid, KeyValuePair<string, string>>(pair.Key,
306-
new KeyValuePair<string, string>(((CraftingTableBase)pair.Value)?.Name ?? Models.DatabaseObject<CraftingTableBase>.Deleted, ((CraftingTableBase)pair.Value)?.Folder ?? ""))).ToArray();
305+
var items = CraftingTableDescriptor.Lookup.OrderBy(p => p.Value?.Name).Select(pair => new KeyValuePair<Guid, KeyValuePair<string, string>>(pair.Key,
306+
new KeyValuePair<string, string>(((CraftingTableDescriptor)pair.Value)?.Name ?? Models.DatabaseObject<CraftingTableDescriptor>.Deleted, ((CraftingTableDescriptor)pair.Value)?.Folder ?? ""))).ToArray();
307307
lstGameObjects.Repopulate(items, mFolders, btnAlphabetical.Checked, CustomSearch(), txtSearch.Text);
308308
}
309309

Intersect.Editor/Forms/Editors/frmCrafts.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ namespace Intersect.Editor.Forms.Editors;
1515
public partial class FrmCrafts : EditorForm
1616
{
1717

18-
private List<CraftBase> mChanged = new List<CraftBase>();
18+
private List<CraftingRecipeDescriptor> mChanged = new List<CraftingRecipeDescriptor>();
1919

2020
private string mCopiedItem;
2121

22-
private CraftBase mEditorItem;
22+
private CraftingRecipeDescriptor mEditorItem;
2323

2424
private List<string> mKnownFolders = new List<string>();
2525

@@ -47,7 +47,7 @@ public FrmCrafts()
4747
}
4848
private void AssignEditorItem(Guid id)
4949
{
50-
mEditorItem = CraftBase.Get(id);
50+
mEditorItem = CraftingRecipeDescriptor.Get(id);
5151
UpdateEditor();
5252
}
5353

@@ -56,7 +56,7 @@ protected override void GameObjectUpdatedDelegate(GameObjectType type)
5656
if (type == GameObjectType.Crafts)
5757
{
5858
InitEditor();
59-
if (mEditorItem != null && !DatabaseObject<CraftBase>.Lookup.Values.Contains(mEditorItem))
59+
if (mEditorItem != null && !DatabaseObject<CraftingRecipeDescriptor>.Lookup.Values.Contains(mEditorItem))
6060
{
6161
mEditorItem = null;
6262
UpdateEditor();
@@ -483,15 +483,15 @@ public void InitEditor()
483483
{
484484
//Collect folders
485485
var mFolders = new List<string>();
486-
foreach (var itm in CraftBase.Lookup)
486+
foreach (var itm in CraftingRecipeDescriptor.Lookup)
487487
{
488-
if (!string.IsNullOrEmpty(((CraftBase) itm.Value).Folder) &&
489-
!mFolders.Contains(((CraftBase) itm.Value).Folder))
488+
if (!string.IsNullOrEmpty(((CraftingRecipeDescriptor) itm.Value).Folder) &&
489+
!mFolders.Contains(((CraftingRecipeDescriptor) itm.Value).Folder))
490490
{
491-
mFolders.Add(((CraftBase) itm.Value).Folder);
492-
if (!mKnownFolders.Contains(((CraftBase) itm.Value).Folder))
491+
mFolders.Add(((CraftingRecipeDescriptor) itm.Value).Folder);
492+
if (!mKnownFolders.Contains(((CraftingRecipeDescriptor) itm.Value).Folder))
493493
{
494-
mKnownFolders.Add(((CraftBase) itm.Value).Folder);
494+
mKnownFolders.Add(((CraftingRecipeDescriptor) itm.Value).Folder);
495495
}
496496
}
497497
}
@@ -502,8 +502,8 @@ public void InitEditor()
502502
cmbFolder.Items.Add("");
503503
cmbFolder.Items.AddRange(mKnownFolders.ToArray());
504504

505-
var items = CraftBase.Lookup.OrderBy(p => p.Value?.Name).Select(pair => new KeyValuePair<Guid, KeyValuePair<string, string>>(pair.Key,
506-
new KeyValuePair<string, string>(((CraftBase)pair.Value)?.Name ?? Models.DatabaseObject<CraftBase>.Deleted, ((CraftBase)pair.Value)?.Folder ?? ""))).ToArray();
505+
var items = CraftingRecipeDescriptor.Lookup.OrderBy(p => p.Value?.Name).Select(pair => new KeyValuePair<Guid, KeyValuePair<string, string>>(pair.Key,
506+
new KeyValuePair<string, string>(((CraftingRecipeDescriptor)pair.Value)?.Name ?? Models.DatabaseObject<CraftingRecipeDescriptor>.Deleted, ((CraftingRecipeDescriptor)pair.Value)?.Folder ?? ""))).ToArray();
507507
lstGameObjects.Repopulate(items, mFolders, btnAlphabetical.Checked, CustomSearch(), txtSearch.Text);
508508
}
509509

0 commit comments

Comments
 (0)