Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HilkopterBob committed Mar 8, 2023
2 parents 633bbfc + 55c93cd commit 0b03ffb
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 5 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/checkjson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,39 @@ name: Validate JSONs
on: [push]

jobs:
verify-json-validation:
verify-effects-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate JSON
- name: Validate Effects JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /.github/workflows/schema.json
INPUT_SCHEMA: /.github/workflows/effectschema.json
INPUT_JSONS: /config/effects.json
verify-entities-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate Entity JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /.github/workflows/entityschema.json
INPUT_JSONS: /config/entities.json
verify-levels-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate Levels JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /.github/workflows/levelschema.json
INPUT_JSONS: /config/levels.json
verify-items-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate Items JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /.github/workflows/itemschema.json
INPUT_JSONS: /config/items.json
38 changes: 38 additions & 0 deletions .github/workflows/effectschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"patternProperties": {
"^[A-Z].[a-z][0-9]{1,}":{
"$ref": "#/definitions/Effect"
}
},
"definitions": {
"Effect":{
"type":"object",
"properties": {
"name": {
"type": "string",
"description": "Der Name des Effektes"
},
"descr":{
"type": "string",
"description": "Die Beschreibung des Effektes"
},
"etype":{
"type":"string",
"description": "Der Effekttyp",
"enum": ["good","bad","evil"]
},
"value":{
"type":"integer",
"description": "Die Menge die ein Wert durch diesen Effekt beeinfluss wird"
},
"infl":{
"type":"string",
"description": "Der Wert der durch diesen Effekt beeinflusst wird"
}
},
"required": ["name","descr","etype","value","infl"]
}
}
}
75 changes: 75 additions & 0 deletions .github/workflows/entityschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"required": ["Player"],
"properties": {
"Player":{
"$ref": "#/definitions/Entity"
}
},
"patternProperties": {
"^[A-Z].[a-z]{1,}":{
"$ref": "#/definitions/Entity"
}
},
"definitions": {
"Entity":{
"type":"object",
"properties": {
"name": {
"type": "string",
"description": "Der Name der Entität ingame",
"minLength": 0,
"maxLength": 30
},
"hp":{
"type": "integer",
"description": "Die Lebenspunkte der Entität",
"minimum": 0,
"maximum": 100
},
"wealth":{
"type":"integer",
"description": "Der Wohlstandswert der Entität",
"minimum": 0,
"maximum": 100
},
"inv":{
"type":"array",
"description": "Eine Liste aller Inventargegenstände der Entität"
},
"xp":{
"type":"integer",
"description": "Die Erfahrungspunkte der Entität",
"minimum": 0,
"maximum": 100
},
"ptype":{
"type":"integer",
"description": "Der Typ der Entität (Friendly/Harmfull)"
},
"geffects":{
"type":"array",
"description": "Eine Liste aller positiven Effekte(Buffs) auf der Entität"
},
"beffects":{
"type":"array",
"description": "Eine Liste aller negativen Effekte(debuffs) auf der Entität"
},
"eeffects":{
"type":"array",
"description": "Eine Liste aller negativen Boss Effekte(debuffs) auf der Entität"
},
"location":{
"type":"string",
"description": "An welchem Ort Befindet sich die Entität grade"
},
"level":{
"type":"integer",
"description": "Welche Stufe hat die Entität"
}
},
"required": ["name","hp","wealth","inv","xp","ptype","geffects","beffects","eeffects","location","level"]
}
}
}
50 changes: 50 additions & 0 deletions .github/workflows/itemschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"patternProperties": {
"^[A-Z].[a-z]{1,}":{
"$ref": "#/definitions/Item"
}
},
"definitions": {
"Item":{
"type":"object",
"properties": {
"type": {
"type": "string",
"description": "Der Itemtyp",
"enum": ["weapon","tool","potion","misc"]
},
"dmg":{
"type": "integer",
"description": "Der Schaden des Items",
"minimum": 0,
"maximum": 100
},
"condition":{
"type":"integer",
"description": "Der Zustand des Items",
"minimum": 0,
"maximum": 100
},
"effects":{
"type":"array",
"description": "Eine Liste aller Special Effekte auf dem Item"
},
"useable":{
"type":"boolean",
"description": "Ist das Item benutzbar?"
},
"equipable":{
"type":"boolean",
"description": "Ist das Item ausrüstbar?"
},
"questitem":{
"type":"boolean",
"description": "Ist das Item ein Questitem"
}
},
"required": ["type","dmg","condition","effects","useable","equipable","questitem"]
}
}
}
File renamed without changes.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg?branch=main&kill_cache=1)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml)


# Textadventure

Expand Down
1 change: 1 addition & 0 deletions config/effects.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../.github/workflows/effectschema.json",
"Kopfschmerz":{
"name":"Kopfschmerz",
"descr":"Kopfschmerzen die aus dem hinteren deines Kopfes in die Stirn ziehen.\nZiemlich unangenehm.",
Expand Down
3 changes: 2 additions & 1 deletion config/entities.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../.github/workflows/entityschema.json",
"Player":{
"name": "Player",
"hp": 0,
Expand All @@ -25,4 +26,4 @@
"location": "",
"level": 0
}
}
}
1 change: 1 addition & 0 deletions config/items.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../.github/workflows/itemschema.json",
"Sword" : {
"type": "weapon",
"dmg": 10,
Expand Down
2 changes: 1 addition & 1 deletion config/levels.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../.github/workflows/schema.json",
"$schema": "../.github/workflows/levelschema.json",
"Menu":{
"text": [
[
Expand Down

0 comments on commit 0b03ffb

Please sign in to comment.