-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a big change but hopefully makes things far more extensible in the long run.
- Loading branch information
Showing
47 changed files
with
405 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 0.30.{build} | ||
version: 0.31.{build} | ||
branches: | ||
only: | ||
- master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OpenRpg.Core.Classes | ||
{ | ||
public class DefaultMultiClass : IMultiClass | ||
{ | ||
public Dictionary<int, IClass> InternalClasses { get; set; } = new Dictionary<int, IClass>(); | ||
|
||
public IEnumerable<IClass> Classes => InternalClasses.Values; | ||
|
||
public void AddClass(IClass classToAdd) | ||
{ | ||
if (!HasClass(classToAdd.Template.Id)) | ||
{ InternalClasses.Add(classToAdd.Template.Id, classToAdd); } | ||
} | ||
|
||
public void RemoveClass(int classTemplateId) | ||
{ | ||
if (HasClass(classTemplateId)) | ||
{ InternalClasses.Remove(classTemplateId); } | ||
} | ||
|
||
public IClass GetClass(int classTemplateId) | ||
{ return HasClass(classTemplateId) ? InternalClasses[classTemplateId] : null; } | ||
|
||
public bool HasClass(int classTemplateId) | ||
{ return InternalClasses.ContainsKey(classTemplateId); } | ||
|
||
public DefaultMultiClass() | ||
{} | ||
|
||
public DefaultMultiClass(IEnumerable<IClass> classes) | ||
{ InternalClasses = classes.ToDictionary(x => x.Template.Id, x => x); } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
using OpenRpg.Core.Classes.Variables; | ||
using OpenRpg.Core.Common; | ||
using OpenRpg.Core.Variables.General; | ||
|
||
namespace OpenRpg.Core.Classes | ||
{ | ||
public interface IClass : IHasVariables<IClassVariables> | ||
public interface IClass : IHasVariables<IClassVariables>, IHasTemplate<IClassTemplate> | ||
{ | ||
int Level { get; set; } | ||
IClassTemplate ClassTemplate { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OpenRpg.Core.Classes | ||
{ | ||
public interface IMultiClass | ||
{ | ||
IEnumerable<IClass> Classes { get; } | ||
|
||
void AddClass(IClass classToAdd); | ||
void RemoveClass(int classIdToRemove); | ||
IClass GetClass(int classIdGet); | ||
bool HasClass(int classTemplateId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OpenRpg.Core.Common | ||
{ | ||
public interface IDataTemplate : IHasDataId, IHasLocaleDescription | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OpenRpg.Core.Common | ||
{ | ||
public interface IHasTemplate<out T> where T : IDataTemplate | ||
{ | ||
T Template { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OpenRpg.Core.Entity | ||
{ | ||
public class DefaultEntityTemplate : DefaultEntity, IEntityTemplate | ||
{ | ||
public int Id { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace OpenRpg.Core.Entity | ||
{ | ||
public class DefaultUniqueEntity : DefaultEntity, IUniqueEntity | ||
{ | ||
public Guid UniqueId { get; set; } = Guid.NewGuid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OpenRpg.Core.Common; | ||
|
||
namespace OpenRpg.Core.Entity | ||
{ | ||
public interface IEntityTemplate : IDataTemplate, IEntity | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OpenRpg.Core.Common; | ||
|
||
namespace OpenRpg.Core.Entity | ||
{ | ||
public interface IUniqueEntity : IIsUnique, IEntity | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using OpenRpg.Core.Classes; | ||
using OpenRpg.Core.Races; | ||
using OpenRpg.Core.Types; | ||
using OpenRpg.Core.Variables.Entity; | ||
|
||
namespace OpenRpg.Core.Extensions | ||
{ | ||
public static class EntityVariableExtensions | ||
{ | ||
public static bool HasRace(this IEntityVariables vars) | ||
{ return vars.ContainsKey(EntityVariableTypes.Race); } | ||
|
||
public static IRaceTemplate Race(this IEntityVariables vars) | ||
{ return vars[EntityVariableTypes.Race] as IRaceTemplate; } | ||
|
||
public static void Race(this IEntityVariables vars, IRaceTemplate race) | ||
{ vars[EntityVariableTypes.Race] = race; } | ||
|
||
public static bool HasClass(this IEntityVariables vars) | ||
{ return vars.ContainsKey(EntityVariableTypes.Class); } | ||
|
||
public static IClass Class(this IEntityVariables vars) | ||
{ return vars[EntityVariableTypes.Class] as IClass; } | ||
|
||
public static void Class(this IEntityVariables vars, IClass classToUse) | ||
{ vars[EntityVariableTypes.Class] = classToUse; } | ||
|
||
public static bool HasMultiClass(this IEntityVariables vars) | ||
{ return vars.ContainsKey(EntityVariableTypes.MultiClasses); } | ||
|
||
public static IMultiClass MultiClass(this IEntityVariables vars) | ||
{ return vars[EntityVariableTypes.MultiClasses] as IMultiClass; } | ||
|
||
public static void MultiClass(this IEntityVariables vars, IMultiClass multiClass) | ||
{ vars[EntityVariableTypes.MultiClasses] = multiClass; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using OpenRpg.Core.Classes.Variables; | ||
using OpenRpg.Core.Effects; | ||
using OpenRpg.Core.Types; | ||
|
||
namespace OpenRpg.Core.Extensions | ||
{ | ||
public static class IClassVariableExtensions | ||
{ | ||
public static int Level(this IClassVariables vars) => (int)vars.Get(ClassVariableTypes.Level); | ||
public static void Level(this IClassVariables vars, int level) => vars[ClassVariableTypes.Level] = level; | ||
|
||
public static int Experience(this IClassVariables vars) => (int)vars.Get(ClassVariableTypes.Experience); | ||
public static void Experience(this IClassVariables vars, int experience) => vars[ClassVariableTypes.Experience] = experience; | ||
public static void AddExperience(this IClassVariables state, int change) => state.Experience(state.Experience() + change); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace OpenRpg.Core.Types | ||
{ | ||
public interface ClassVariableTypes | ||
{ | ||
public static readonly int Unknown = 0; | ||
|
||
public static readonly int Level = 1; | ||
public static readonly int Experience = 2; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/OpenRpg.Core/Types/StatsVariableTypes.cs → ...pg.Core/Types/EntityStatsVariableTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.