-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from XenotropicDev/2.1
2.1 features merge
- Loading branch information
Showing
55 changed files
with
2,695 additions
and
108 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
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,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Server.GameInterfaces; | ||
using TheOracle2.Data; | ||
|
||
namespace Server.Data; | ||
|
||
public interface IEntityRepository | ||
{ | ||
IEnumerable<OracleGameEntity> GetEntities(); | ||
OracleGameEntity? GetEntity(string id); | ||
} | ||
|
||
public class JsonEntityRepository : IEntityRepository | ||
{ | ||
private List<OracleGameEntity>? Entities; | ||
|
||
public OracleGameEntity? GetEntity(string id) | ||
{ | ||
return GetEntities().FirstOrDefault(o => o.Id == id); | ||
} | ||
|
||
public IEnumerable<OracleGameEntity> GetEntities() | ||
{ | ||
if (Entities == null) | ||
{ | ||
Entities = new List<OracleGameEntity>(); | ||
var files = new DirectoryInfo(Path.Combine("Data", "game entities")).GetFiles("*.json").ToList(); | ||
|
||
foreach (var file in files) | ||
{ | ||
using var fileStream = file.OpenText(); | ||
string text = fileStream.ReadToEnd(); | ||
|
||
var root = JsonConvert.DeserializeObject<List<OracleGameEntity>>(text, new JsonSerializerSettings() { MetadataPropertyHandling = MetadataPropertyHandling.Ignore }); | ||
|
||
if (root != null) Entities.AddRange(root); | ||
} | ||
} | ||
|
||
return Entities; | ||
} | ||
} |
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,7 +1,32 @@ | ||
namespace TheOracle2; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace TheOracle2; | ||
|
||
public enum IronGame | ||
{ | ||
Ironsworn, | ||
Starforged | ||
} | ||
|
||
public static class IronGameExtenstions | ||
{ | ||
public static IronGame? GetIronGameInString(string value) | ||
{ | ||
foreach(var game in Enum.GetValues<IronGame>()) | ||
{ | ||
if (value.Contains(game.ToString(), StringComparison.OrdinalIgnoreCase)) return game; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public static string RemoveIronGameInString(string value) | ||
{ | ||
foreach (var game in Enum.GetValues<IronGame>()) | ||
{ | ||
value = Regex.Replace(value, game.ToString() + " ?", "", RegexOptions.IgnoreCase); | ||
} | ||
|
||
return value.Trim(); | ||
} | ||
} |
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,47 @@ | ||
[ | ||
{ | ||
"Id": "Starforged_Creature", | ||
"SearchName": "Starforged Creature", | ||
"title": "Creature", | ||
"game": "Starforged", | ||
"shortName": "Creature", | ||
"InitialOracles": [ | ||
{ | ||
"FieldName": "Environment", | ||
"FieldValue": "[[Starforged/Oracles/Creatures/Environment]]", | ||
"HasModalOverride": false | ||
}, | ||
{ | ||
"FieldName": "Scale", | ||
"FieldValue": "[[Starforged/Oracles/Creatures/Scale]]", | ||
"HasModalOverride": false | ||
}, | ||
{ | ||
"FieldName": "Basic Form", | ||
"FieldValue": "[[Starforged/Oracles/Creatures/Basic_Form]]", | ||
"HasModalOverride": false | ||
}, | ||
{ | ||
"FieldName": "First Look", | ||
"FieldValue": "[[Starforged/Oracles/Creatures/First_Look]]", | ||
"HasModalOverride": false | ||
} | ||
], | ||
"FollowUpOracles": [ | ||
{ | ||
"FieldName": "Encountered Behavior", | ||
"FieldValue": "[[Starforged/Oracles/Creatures/Encountered_Behavior]]", | ||
"Emoji": "👋", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Revealed Aspect", | ||
"FieldValue": "Starforged/Oracles/Creatures/Revealed_Aspect", | ||
"Emoji": "👁️", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
} | ||
] | ||
} | ||
] |
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,117 @@ | ||
[ | ||
{ | ||
"Id": "Ironsworn_NPC", | ||
"SearchName": "Ironsworn NPC", | ||
"title": "[[Ironsworn/Oracles/Name/Ironlander]]", | ||
"author": "NPC", | ||
"game": "Ironsworn", | ||
"shortName": "NPC", | ||
"InitialOracles": [ | ||
{ | ||
"FieldName": "Description", | ||
"FieldValue": "[[Ironsworn/Oracles/Character/Descriptor]]", | ||
"HasModalOverride": false | ||
} | ||
], | ||
"FollowUpOracles": [ | ||
{ | ||
"FieldName": "Role", | ||
"FieldValue": "[[Ironsworn/Oracles/Character/Role]]", | ||
"Emoji": "🎭", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Goal", | ||
"FieldValue": "Ironsworn/Oracles/Character/Goal", | ||
"Emoji": "❗", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Disposition", | ||
"FieldValue": "[[Ironsworn/Oracles/Character/Disposition]]", | ||
"Emoji": "👋", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Activity", | ||
"FieldValue": "[[Ironsworn/Oracles/Character/Activity]]", | ||
"Emoji": "💃", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
} | ||
] | ||
}, | ||
{ | ||
"Id": "Starforged_NPC_Callsign", | ||
"SearchName": "Starforged NPC with Callsign", | ||
"title": "NPC", | ||
"game": "Starforged", | ||
"InitialOracles": [ | ||
{ | ||
"FieldName": "Callsign", | ||
"FieldValue": "[[Starforged/Oracles/Characters/Name/Callsign]]", | ||
"HasModalOverride": false | ||
}, | ||
{ | ||
"FieldName": "First Look", | ||
"FieldValue": "[[Starforged/Oracles/Characters/First_Look]]" | ||
} | ||
], | ||
"FollowUpOracles": [ | ||
{ | ||
"FieldName": "Disposition", | ||
"FieldValue": "Starforged/Oracles/Characters/Disposition", | ||
"Emoji": "👋", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Revealed Aspect", | ||
"FieldValue": "Starforged/Oracles/Characters/Revealed_Aspect", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
} | ||
] | ||
}, | ||
{ | ||
"Id": "Starforged_NPC_Name", | ||
"SearchName": "Starforged NPC with Name", | ||
"title": "NPC", | ||
"game": "Starforged", | ||
"InitialOracles": [ | ||
{ | ||
"FieldName": "Name", | ||
"FieldValue": "[[Starforged/Oracles/Characters/Name/Given_Name]] [[Starforged/Oracles/Characters/Name/Family_Name]]", | ||
"HasModalOverride": false | ||
}, | ||
{ | ||
"FieldName": "First Look", | ||
"FieldValue": "[[Starforged/Oracles/Characters/First_Look]]", | ||
"AllowFudge": true | ||
} | ||
], | ||
"FollowUpOracles": [ | ||
{ | ||
"FieldName": "Callsign", | ||
"FieldValue": "[[Starforged/Oracles/Characters/Name/Callsign]]", | ||
"HasModalOverride": true | ||
}, | ||
{ | ||
"FieldName": "Disposition", | ||
"FieldValue": "[[Starforged/Oracles/Characters/Disposition]]", | ||
"Emoji": "👋", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
}, | ||
{ | ||
"FieldName": "Revealed Aspect", | ||
"FieldValue": "[[Starforged/Oracles/Characters/Revealed_Aspect]]", | ||
"AllowReroll": true, | ||
"AllowFudge": true | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.