Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
fhnaumann committed Feb 29, 2024
1 parent e9471a1 commit a0e29ac
Show file tree
Hide file tree
Showing 10 changed files with 11,097 additions and 3 deletions.
415 changes: 415 additions & 0 deletions builder_website/src/assets/entity_types.json

Large diffs are not rendered by default.

Empty file.
25 changes: 25 additions & 0 deletions builder_website/src/components/model/forces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { BlockBreakForceConfig } from "./blockbreak";

export interface ForcesConfig {
blockBreakForce?: BlockBreakForceConfig
}

export interface BaseForceConfig {
/**
* The lower bound that is used to determine the time for the next forcing. In seconds.
*
* @minimum 1
* @maximum 3600
* @TJS-type integer
*/
minTime?: number

/**
* The upper bound that is used to determine the time for the next forcing. In seconds.
*
* @minimum 1
* @maximum 3600
* @TJS-type integer
*/
maxTime?: number
}
24 changes: 23 additions & 1 deletion builder_website/src/components/model/goals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ export interface CollectableDataConfig {
*/
currentAmount?: number
}
export interface CompletionConfig {
/**
* The time in seconds (since the start) that it took to complete this collectable. -1 indicates that is has not been collected (e.g. 'complete' is false).
*
* @default -1
* @TJS-type integer
*/
whenCollectedSeconds?: number,

/**
* The player (names) that contributed to completing this collectable.
*/
contributors?: ContributorsConfig
}
export interface ContributorsConfig {
[key: string]: number;
}
export interface CollectableEntryConfig {
/**
* The name of the collectable. This could, for example, be "PIG" (entity), "STONE" (material).
Expand All @@ -72,7 +89,12 @@ export interface CollectableEntryConfig {
*
* @default {}
*/
collectableData: CollectableDataConfig
collectableData: CollectableDataConfig,

/**
* Contains information about the completion progress. This includes player names and the amount each player has contributed to the completion of this collectable.
*/
completion?: CompletionConfig
}
export interface MobGoalConfig extends BaseGoalConfig, Orderable {
/**
Expand Down
24 changes: 24 additions & 0 deletions builder_website/src/components/model/item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { BaseForceConfig } from "./forces"
import type { BaseGoalConfig, Orderable, CollectableEntryConfig } from "./goals"
import type { PunishableRuleConfig } from "./rules"

export interface NoItemCollectRuleConfig extends PunishableRuleConfig {
/**
* List of materials that are exempted from the rule.
* @default []
*/
exemptions?: string[]
}

export interface ItemForceConfig extends BaseForceConfig, Omit<ItemGoalConfig, 'fixedOrder'> {

}

export interface ItemGoalConfig extends BaseGoalConfig, Orderable {
/**
* The items that need to be collected to beat this goal.
*
* @default []
*/
items?: CollectableEntryConfig[]
}
17 changes: 17 additions & 0 deletions builder_website/src/components/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export function shuffleArray(array) {
let currentIndex = array.length, randomIndex;

// While there remain elements to shuffle...
while (currentIndex !== 0) {

// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;

// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}

return array;
}
2 changes: 1 addition & 1 deletion generate_json_schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ schema_file_name="challenges_schema.json"

echo "Typescript -> JSON Schema..."
cd builder_website
typescript-json-schema src/components/model/model.ts Model > src/assets/$schema_file_name --noExtraProps --strictNullChecks --required
typescript-json-schema src/components/model/model.ts Model > src/assets/$schema_file_name --noExtraProps --strictNullChecks --required --defaultNumberType=integer
cd ..
echo "Typescript -> JSON Schema DONE!"
echo "Copying into maven resource folder..."
Expand Down
3 changes: 2 additions & 1 deletion plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
Challenges.iml
server/
server/
resourcepack/
Loading

0 comments on commit a0e29ac

Please sign in to comment.