Init
This commit is contained in:
100
content/gameplay-systems/_index.en.md
Normal file
100
content/gameplay-systems/_index.en.md
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
title: Gameplay Systems
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
The Gameplay Systems provide quest mechanics, progression systems, and gameplay features for the adventure mode.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure`
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="objectives" title="Objectives" subtitle="Quest and goal system" >}}
|
||||
{{< card link="farming" title="Farming" subtitle="Crop growth and agriculture" >}}
|
||||
{{< card link="npc-objectives" title="NPC Objectives" subtitle="NPC-related quests" >}}
|
||||
{{< card link="memories" title="Memories" subtitle="Persistent state tracking" >}}
|
||||
{{< card link="shop" title="Shop" subtitle="Trading and commerce" >}}
|
||||
{{< card link="camera-effects" title="Camera Effects" subtitle="Cinematic camera control" >}}
|
||||
{{< card link="reputation" title="Reputation" subtitle="Faction standing system" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The Adventure system is composed of multiple plugins:
|
||||
|
||||
```
|
||||
Adventure System
|
||||
├── ObjectivePlugin (objectives/)
|
||||
│ ├── Objective - Quest instance with TaskSets
|
||||
│ ├── ObjectiveTask - Individual task types
|
||||
│ ├── ObjectiveCompletion - Reward handlers
|
||||
│ └── ObjectiveHistoryComponent - Progress tracking
|
||||
├── FarmingPlugin (farming/)
|
||||
│ ├── FarmingBlock/FarmingBlockState - Crop state
|
||||
│ ├── TilledSoilBlock - Farmland mechanics
|
||||
│ ├── GrowthModifier - Fertilizer, water, light
|
||||
│ └── CoopBlock/CoopResidentComponent - Animal coops
|
||||
├── NPCObjectivesPlugin (npcobjectives/)
|
||||
│ ├── KillTask/BountyTask - Combat objectives
|
||||
│ ├── KillTrackerSystem - Kill counting
|
||||
│ └── NPC Actions (StartObjective, CompleteTask)
|
||||
├── MemoriesPlugin (memories/)
|
||||
│ ├── PlayerMemories - Player memory component
|
||||
│ ├── Memory/MemoryProvider - Memory types
|
||||
│ └── NPCMemory - NPC-related memories
|
||||
├── ShopPlugin (shop/)
|
||||
│ ├── ShopAsset - Shop definitions
|
||||
│ ├── BarterShopAsset - Trade-based shops
|
||||
│ └── ShopElement/GiveItemInteraction
|
||||
├── CameraPlugin (camera/)
|
||||
│ ├── CameraShake - Screen shake effects
|
||||
│ ├── ViewBobbing - Movement camera bob
|
||||
│ └── CameraEffectSystem
|
||||
└── ReputationPlugin (reputation/)
|
||||
├── ReputationGroup - Faction definitions
|
||||
├── ReputationRank - Standing levels
|
||||
└── ReputationGroupComponent - NPC faction
|
||||
```
|
||||
|
||||
## Subpackages
|
||||
|
||||
| Package | Files | Description |
|
||||
|---------|-------|-------------|
|
||||
| `objectives/` | 82 | Quest and objective system |
|
||||
| `farming/` | 24 | Agriculture mechanics |
|
||||
| `npcobjectives/` | 22 | NPC-related objectives (kill tasks) |
|
||||
| `memories/` | 19 | State persistence and collectibles |
|
||||
| `shop/` | 16 | Trading and barter system |
|
||||
| `camera/` | 13 | Camera effects (shake, bobbing) |
|
||||
| `reputation/` | 12 | Faction reputation system |
|
||||
| `objectivereputation/` | 4 | Reputation rewards for objectives |
|
||||
| `npcreputation/` | 2 | NPC attitude based on reputation |
|
||||
| `shopreputation/` | 1 | Reputation-gated shop items |
|
||||
|
||||
## Quick Example
|
||||
|
||||
```java
|
||||
// Start an objective for a player
|
||||
ObjectivePlugin objectives = ObjectivePlugin.get();
|
||||
objectives.startObjective(player, "collect_wood");
|
||||
|
||||
// Change reputation with a faction
|
||||
ReputationPlugin rep = ReputationPlugin.get();
|
||||
rep.changeReputation(player, "village_faction", 10, componentAccessor);
|
||||
|
||||
// Get reputation rank
|
||||
ReputationRank rank = rep.getReputationRank(store, playerRef, "village_faction");
|
||||
|
||||
// Check if player has a memory
|
||||
MemoriesPlugin memories = MemoriesPlugin.get();
|
||||
boolean hasMemory = memories.hasRecordedMemory(someMemory);
|
||||
```
|
||||
|
||||
## Plugin Registration
|
||||
|
||||
Each adventure subsystem is a separate plugin that registers:
|
||||
- **Components** on EntityStore or ChunkStore
|
||||
- **Interactions** for block/entity interactions
|
||||
- **Assets** loaded from JSON/YAML files
|
||||
- **Systems** for ECS processing
|
||||
- **Commands** for administration
|
||||
100
content/gameplay-systems/_index.fr.md
Normal file
100
content/gameplay-systems/_index.fr.md
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
title: Systèmes de Gameplay
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Les Systèmes de Gameplay fournissent des mécaniques de quêtes, des systèmes de progression et des fonctionnalités de gameplay pour le mode aventure.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure`
|
||||
|
||||
{{< cards >}}
|
||||
{{< card link="objectives" title="Objectifs" subtitle="Système de quêtes et buts" >}}
|
||||
{{< card link="farming" title="Agriculture" subtitle="Croissance des cultures et agriculture" >}}
|
||||
{{< card link="npc-objectives" title="Objectifs NPC" subtitle="Quêtes liées aux NPCs" >}}
|
||||
{{< card link="memories" title="Mémoires" subtitle="Suivi d'état persistant" >}}
|
||||
{{< card link="shop" title="Boutique" subtitle="Commerce et échanges" >}}
|
||||
{{< card link="camera-effects" title="Effets Caméra" subtitle="Contrôle caméra cinématique" >}}
|
||||
{{< card link="reputation" title="Réputation" subtitle="Système de standing de faction" >}}
|
||||
{{< /cards >}}
|
||||
|
||||
## Vue d'Ensemble de l'Architecture
|
||||
|
||||
Le système Adventure est composé de plusieurs plugins :
|
||||
|
||||
```
|
||||
Système Adventure
|
||||
├── ObjectivePlugin (objectives/)
|
||||
│ ├── Objective - Instance de quête avec TaskSets
|
||||
│ ├── ObjectiveTask - Types de tâches individuelles
|
||||
│ ├── ObjectiveCompletion - Gestionnaires de récompenses
|
||||
│ └── ObjectiveHistoryComponent - Suivi de progression
|
||||
├── FarmingPlugin (farming/)
|
||||
│ ├── FarmingBlock/FarmingBlockState - État des cultures
|
||||
│ ├── TilledSoilBlock - Mécaniques de terre labourée
|
||||
│ ├── GrowthModifier - Engrais, eau, lumière
|
||||
│ └── CoopBlock/CoopResidentComponent - Poulaillers
|
||||
├── NPCObjectivesPlugin (npcobjectives/)
|
||||
│ ├── KillTask/BountyTask - Objectifs de combat
|
||||
│ ├── KillTrackerSystem - Compteur d'éliminations
|
||||
│ └── Actions NPC (StartObjective, CompleteTask)
|
||||
├── MemoriesPlugin (memories/)
|
||||
│ ├── PlayerMemories - Composant mémoire joueur
|
||||
│ ├── Memory/MemoryProvider - Types de mémoires
|
||||
│ └── NPCMemory - Mémoires liées aux NPCs
|
||||
├── ShopPlugin (shop/)
|
||||
│ ├── ShopAsset - Définitions de boutiques
|
||||
│ ├── BarterShopAsset - Boutiques de troc
|
||||
│ └── ShopElement/GiveItemInteraction
|
||||
├── CameraPlugin (camera/)
|
||||
│ ├── CameraShake - Effets de tremblement
|
||||
│ ├── ViewBobbing - Balancement de caméra
|
||||
│ └── CameraEffectSystem
|
||||
└── ReputationPlugin (reputation/)
|
||||
├── ReputationGroup - Définitions de factions
|
||||
├── ReputationRank - Niveaux de standing
|
||||
└── ReputationGroupComponent - Faction du NPC
|
||||
```
|
||||
|
||||
## Sous-packages
|
||||
|
||||
| Package | Fichiers | Description |
|
||||
|---------|----------|-------------|
|
||||
| `objectives/` | 82 | Système de quêtes et objectifs |
|
||||
| `farming/` | 24 | Mécaniques d'agriculture |
|
||||
| `npcobjectives/` | 22 | Objectifs liés aux NPCs (tâches d'élimination) |
|
||||
| `memories/` | 19 | Persistance d'état et collectibles |
|
||||
| `shop/` | 16 | Système de commerce et troc |
|
||||
| `camera/` | 13 | Effets caméra (tremblement, balancement) |
|
||||
| `reputation/` | 12 | Système de réputation de faction |
|
||||
| `objectivereputation/` | 4 | Récompenses de réputation pour objectifs |
|
||||
| `npcreputation/` | 2 | Attitude NPC basée sur réputation |
|
||||
| `shopreputation/` | 1 | Items de boutique conditionnés par réputation |
|
||||
|
||||
## Exemple Rapide
|
||||
|
||||
```java
|
||||
// Démarrer un objectif pour un joueur
|
||||
ObjectivePlugin objectives = ObjectivePlugin.get();
|
||||
objectives.startObjective(player, "collect_wood");
|
||||
|
||||
// Changer la réputation avec une faction
|
||||
ReputationPlugin rep = ReputationPlugin.get();
|
||||
rep.changeReputation(player, "village_faction", 10, componentAccessor);
|
||||
|
||||
// Obtenir le rang de réputation
|
||||
ReputationRank rank = rep.getReputationRank(store, playerRef, "village_faction");
|
||||
|
||||
// Vérifier si le joueur a une mémoire
|
||||
MemoriesPlugin memories = MemoriesPlugin.get();
|
||||
boolean hasMemory = memories.hasRecordedMemory(someMemory);
|
||||
```
|
||||
|
||||
## Enregistrement des Plugins
|
||||
|
||||
Chaque sous-système adventure est un plugin séparé qui enregistre :
|
||||
- **Composants** sur EntityStore ou ChunkStore
|
||||
- **Interactions** pour les interactions bloc/entité
|
||||
- **Assets** chargés depuis fichiers JSON/YAML
|
||||
- **Systèmes** pour le traitement ECS
|
||||
- **Commandes** pour l'administration
|
||||
191
content/gameplay-systems/camera-effects.en.md
Normal file
191
content/gameplay-systems/camera-effects.en.md
Normal file
@@ -0,0 +1,191 @@
|
||||
---
|
||||
title: Camera Effects
|
||||
type: docs
|
||||
weight: 6
|
||||
---
|
||||
|
||||
The camera system provides screen effects like camera shake and view bobbing.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.camera`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
CameraPlugin
|
||||
├── Effects
|
||||
│ ├── CameraShakeEffect - Screen shake effect
|
||||
│ └── CameraShake asset
|
||||
├── View Bobbing
|
||||
│ ├── ViewBobbing asset
|
||||
│ └── ViewBobbingPacketGenerator
|
||||
├── Interactions
|
||||
│ └── CameraShakeInteraction
|
||||
├── Systems
|
||||
│ └── CameraEffectSystem
|
||||
└── Commands
|
||||
└── CameraEffectCommand
|
||||
```
|
||||
|
||||
## Camera Shake
|
||||
|
||||
### CameraShakeEffect
|
||||
|
||||
Registered camera effect type:
|
||||
|
||||
```java
|
||||
getCodecRegistry(CameraEffect.CODEC).register(
|
||||
"CameraShake",
|
||||
CameraShakeEffect.class,
|
||||
CameraShakeEffect.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### CameraShake Asset
|
||||
|
||||
Camera shake definitions loaded from `Camera/CameraShake/`:
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(String.class, CameraShake.class, new IndexedAssetMap())
|
||||
.loadsBefore(CameraEffect.class)
|
||||
.setPath("Camera/CameraShake")
|
||||
.setKeyFunction(CameraShake::getId)
|
||||
.setReplaceOnRemove(CameraShake::new)
|
||||
.setPacketGenerator(new CameraShakePacketGenerator())
|
||||
.build();
|
||||
```
|
||||
|
||||
### CameraShake Configuration
|
||||
|
||||
```yaml
|
||||
# Camera/CameraShake/explosion.json
|
||||
{
|
||||
"Id": "explosion",
|
||||
"Intensity": 1.0,
|
||||
"Duration": 0.5,
|
||||
"Frequency": 10.0,
|
||||
"FalloffDistance": 20.0
|
||||
}
|
||||
```
|
||||
|
||||
## View Bobbing
|
||||
|
||||
Camera movement during player locomotion:
|
||||
|
||||
### ViewBobbing Asset
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(MovementType.class, ViewBobbing.class, new DefaultAssetMap())
|
||||
.setPath("Camera/ViewBobbing")
|
||||
.setKeyFunction(ViewBobbing::getId)
|
||||
.setPacketGenerator(new ViewBobbingPacketGenerator())
|
||||
.build();
|
||||
```
|
||||
|
||||
Key indexed by `MovementType` enum for different movement states.
|
||||
|
||||
### ViewBobbing Configuration
|
||||
|
||||
```yaml
|
||||
# Camera/ViewBobbing/walking.json
|
||||
{
|
||||
"Id": "WALKING",
|
||||
"HorizontalAmplitude": 0.02,
|
||||
"VerticalAmplitude": 0.01,
|
||||
"Frequency": 2.0
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### CameraShakeInteraction
|
||||
|
||||
Trigger camera shake from interactions:
|
||||
|
||||
```java
|
||||
getCodecRegistry(Interaction.CODEC).register(
|
||||
"CameraShake",
|
||||
CameraShakeInteraction.class,
|
||||
CameraShakeInteraction.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Usage Example
|
||||
|
||||
```yaml
|
||||
# Item or block interaction
|
||||
{
|
||||
"Type": "CameraShake",
|
||||
"ShakeId": "explosion",
|
||||
"Intensity": 0.5
|
||||
}
|
||||
```
|
||||
|
||||
## Systems
|
||||
|
||||
### CameraEffectSystem
|
||||
|
||||
ECS system for processing camera effects:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new CameraEffectSystem());
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### CameraEffectCommand
|
||||
|
||||
Admin command for testing camera effects:
|
||||
|
||||
```java
|
||||
getCommandRegistry().registerCommand(new CameraEffectCommand());
|
||||
```
|
||||
|
||||
Usage:
|
||||
```
|
||||
/cameraeffect <effect_id> [intensity] [duration]
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Applying Camera Shake
|
||||
|
||||
```java
|
||||
// Through interaction system
|
||||
// Define in asset JSON and trigger via interaction
|
||||
|
||||
// Or programmatically through CameraEffectSystem
|
||||
```
|
||||
|
||||
### Getting Camera Assets
|
||||
|
||||
```java
|
||||
// Get camera shake asset
|
||||
CameraShake shake = CameraShake.getAssetMap().getAsset("explosion");
|
||||
|
||||
// Get view bobbing for movement type
|
||||
ViewBobbing bobbing = ViewBobbing.getAssetMap().getAsset(MovementType.WALKING);
|
||||
```
|
||||
|
||||
## Packet Generation
|
||||
|
||||
Both camera shake and view bobbing use packet generators for client sync:
|
||||
|
||||
```java
|
||||
public class CameraShakePacketGenerator implements PacketGenerator<CameraShake> {
|
||||
// Generates network packets for camera shake
|
||||
}
|
||||
|
||||
public class ViewBobbingPacketGenerator implements PacketGenerator<ViewBobbing> {
|
||||
// Generates network packets for view bobbing
|
||||
}
|
||||
```
|
||||
|
||||
## Asset Dependencies
|
||||
|
||||
Camera shake assets load before camera effects:
|
||||
|
||||
```java
|
||||
.loadsBefore(CameraEffect.class)
|
||||
```
|
||||
|
||||
This ensures shake definitions are available when camera effects reference them.
|
||||
191
content/gameplay-systems/camera-effects.fr.md
Normal file
191
content/gameplay-systems/camera-effects.fr.md
Normal file
@@ -0,0 +1,191 @@
|
||||
---
|
||||
title: Effets Camera
|
||||
type: docs
|
||||
weight: 6
|
||||
---
|
||||
|
||||
Le systeme de camera fournit des effets d'ecran comme les tremblements et le balancement de vue.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.camera`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
CameraPlugin
|
||||
├── Effets
|
||||
│ ├── CameraShakeEffect - Effet de tremblement
|
||||
│ └── CameraShake asset
|
||||
├── Balancement de Vue
|
||||
│ ├── ViewBobbing asset
|
||||
│ └── ViewBobbingPacketGenerator
|
||||
├── Interactions
|
||||
│ └── CameraShakeInteraction
|
||||
├── Systemes
|
||||
│ └── CameraEffectSystem
|
||||
└── Commandes
|
||||
└── CameraEffectCommand
|
||||
```
|
||||
|
||||
## Tremblement de Camera
|
||||
|
||||
### CameraShakeEffect
|
||||
|
||||
Type d'effet camera enregistre:
|
||||
|
||||
```java
|
||||
getCodecRegistry(CameraEffect.CODEC).register(
|
||||
"CameraShake",
|
||||
CameraShakeEffect.class,
|
||||
CameraShakeEffect.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Asset CameraShake
|
||||
|
||||
Definitions de tremblements chargees depuis `Camera/CameraShake/`:
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(String.class, CameraShake.class, new IndexedAssetMap())
|
||||
.loadsBefore(CameraEffect.class)
|
||||
.setPath("Camera/CameraShake")
|
||||
.setKeyFunction(CameraShake::getId)
|
||||
.setReplaceOnRemove(CameraShake::new)
|
||||
.setPacketGenerator(new CameraShakePacketGenerator())
|
||||
.build();
|
||||
```
|
||||
|
||||
### Configuration CameraShake
|
||||
|
||||
```yaml
|
||||
# Camera/CameraShake/explosion.json
|
||||
{
|
||||
"Id": "explosion",
|
||||
"Intensity": 1.0,
|
||||
"Duration": 0.5,
|
||||
"Frequency": 10.0,
|
||||
"FalloffDistance": 20.0
|
||||
}
|
||||
```
|
||||
|
||||
## Balancement de Vue
|
||||
|
||||
Mouvement de camera pendant la locomotion du joueur:
|
||||
|
||||
### Asset ViewBobbing
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(MovementType.class, ViewBobbing.class, new DefaultAssetMap())
|
||||
.setPath("Camera/ViewBobbing")
|
||||
.setKeyFunction(ViewBobbing::getId)
|
||||
.setPacketGenerator(new ViewBobbingPacketGenerator())
|
||||
.build();
|
||||
```
|
||||
|
||||
Indexe par enum `MovementType` pour differents etats de mouvement.
|
||||
|
||||
### Configuration ViewBobbing
|
||||
|
||||
```yaml
|
||||
# Camera/ViewBobbing/walking.json
|
||||
{
|
||||
"Id": "WALKING",
|
||||
"HorizontalAmplitude": 0.02,
|
||||
"VerticalAmplitude": 0.01,
|
||||
"Frequency": 2.0
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### CameraShakeInteraction
|
||||
|
||||
Declencher un tremblement depuis les interactions:
|
||||
|
||||
```java
|
||||
getCodecRegistry(Interaction.CODEC).register(
|
||||
"CameraShake",
|
||||
CameraShakeInteraction.class,
|
||||
CameraShakeInteraction.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Exemple d'Utilisation
|
||||
|
||||
```yaml
|
||||
# Interaction d'item ou bloc
|
||||
{
|
||||
"Type": "CameraShake",
|
||||
"ShakeId": "explosion",
|
||||
"Intensity": 0.5
|
||||
}
|
||||
```
|
||||
|
||||
## Systemes
|
||||
|
||||
### CameraEffectSystem
|
||||
|
||||
Systeme ECS pour traiter les effets camera:
|
||||
|
||||
```java
|
||||
getEntityStoreRegistry().registerSystem(new CameraEffectSystem());
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
### CameraEffectCommand
|
||||
|
||||
Commande admin pour tester les effets camera:
|
||||
|
||||
```java
|
||||
getCommandRegistry().registerCommand(new CameraEffectCommand());
|
||||
```
|
||||
|
||||
Utilisation:
|
||||
```
|
||||
/cameraeffect <effect_id> [intensity] [duration]
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Appliquer un Tremblement
|
||||
|
||||
```java
|
||||
// Via le systeme d'interaction
|
||||
// Definir dans JSON asset et declencher via interaction
|
||||
|
||||
// Ou programmatiquement via CameraEffectSystem
|
||||
```
|
||||
|
||||
### Obtenir les Assets Camera
|
||||
|
||||
```java
|
||||
// Obtenir asset de tremblement
|
||||
CameraShake shake = CameraShake.getAssetMap().getAsset("explosion");
|
||||
|
||||
// Obtenir balancement pour type de mouvement
|
||||
ViewBobbing bobbing = ViewBobbing.getAssetMap().getAsset(MovementType.WALKING);
|
||||
```
|
||||
|
||||
## Generation de Paquets
|
||||
|
||||
Les tremblements et balancements utilisent des generateurs de paquets pour sync client:
|
||||
|
||||
```java
|
||||
public class CameraShakePacketGenerator implements PacketGenerator<CameraShake> {
|
||||
// Genere paquets reseau pour tremblement
|
||||
}
|
||||
|
||||
public class ViewBobbingPacketGenerator implements PacketGenerator<ViewBobbing> {
|
||||
// Genere paquets reseau pour balancement
|
||||
}
|
||||
```
|
||||
|
||||
## Dependances d'Assets
|
||||
|
||||
Les assets de tremblement chargent avant les effets camera:
|
||||
|
||||
```java
|
||||
.loadsBefore(CameraEffect.class)
|
||||
```
|
||||
|
||||
Cela assure que les definitions de tremblement sont disponibles quand les effets camera les referencent.
|
||||
200
content/gameplay-systems/farming.en.md
Normal file
200
content/gameplay-systems/farming.en.md
Normal file
@@ -0,0 +1,200 @@
|
||||
---
|
||||
title: Farming
|
||||
type: docs
|
||||
weight: 2
|
||||
---
|
||||
|
||||
The farming system provides crop growth, harvesting, and animal coop mechanics.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.farming`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
FarmingPlugin
|
||||
├── Block Components (ChunkStore)
|
||||
│ ├── TilledSoilBlock - Farmland state
|
||||
│ ├── FarmingBlock - Crop growth tracking
|
||||
│ ├── FarmingBlockState - Block growth state
|
||||
│ └── CoopBlock - Animal coop state
|
||||
├── Entity Components (EntityStore)
|
||||
│ └── CoopResidentComponent - Animals in coops
|
||||
├── Growth Modifiers
|
||||
│ ├── FertilizerGrowthModifier
|
||||
│ ├── WaterGrowthModifier
|
||||
│ └── LightLevelGrowthModifier
|
||||
└── Farming Stages
|
||||
├── BlockTypeFarmingStageData
|
||||
├── BlockStateFarmingStageData
|
||||
├── PrefabFarmingStageData
|
||||
└── SpreadFarmingStageData
|
||||
```
|
||||
|
||||
## Block Components
|
||||
|
||||
### TilledSoilBlock
|
||||
|
||||
Tracks tilled soil state on ChunkStore:
|
||||
|
||||
```java
|
||||
ComponentType<ChunkStore, TilledSoilBlock> type =
|
||||
FarmingPlugin.get().getTiledSoilBlockComponentType();
|
||||
```
|
||||
|
||||
### FarmingBlock
|
||||
|
||||
Tracks crop growth progress:
|
||||
|
||||
```java
|
||||
public class FarmingBlock {
|
||||
// Growth rate modifier (0 = no spread on newly generated)
|
||||
public void setSpreadRate(float rate);
|
||||
}
|
||||
```
|
||||
|
||||
### FarmingBlockState
|
||||
|
||||
Current farming state for a block position.
|
||||
|
||||
### CoopBlock
|
||||
|
||||
Animal coop block state for housing creatures.
|
||||
|
||||
## Growth Modifiers
|
||||
|
||||
Growth modifiers affect crop growth rate:
|
||||
|
||||
| Modifier | Type ID | Description |
|
||||
|----------|---------|-------------|
|
||||
| `FertilizerGrowthModifierAsset` | `Fertilizer` | Boosts growth with fertilizer |
|
||||
| `WaterGrowthModifierAsset` | `Water` | Water proximity bonus |
|
||||
| `LightLevelGrowthModifierAsset` | `LightLevel` | Light-based growth |
|
||||
|
||||
### Asset Configuration
|
||||
|
||||
```yaml
|
||||
# Farming/Modifiers/bone_meal.json
|
||||
{
|
||||
"Id": "bone_meal",
|
||||
"Type": "Fertilizer",
|
||||
"GrowthMultiplier": 2.0
|
||||
}
|
||||
```
|
||||
|
||||
## Farming Stages
|
||||
|
||||
Crops progress through stages defined as assets:
|
||||
|
||||
| Stage Type | Type ID | Description |
|
||||
|------------|---------|-------------|
|
||||
| `BlockTypeFarmingStageData` | `BlockType` | Changes block type |
|
||||
| `BlockStateFarmingStageData` | `BlockState` | Changes block state |
|
||||
| `PrefabFarmingStageData` | `Prefab` | Places a prefab structure |
|
||||
| `SpreadFarmingStageData` | `Spread` | Spreads to adjacent blocks |
|
||||
|
||||
### Spread Growth Behavior
|
||||
|
||||
```java
|
||||
public interface SpreadGrowthBehaviour {
|
||||
// Directional growth (vines, etc.)
|
||||
}
|
||||
|
||||
public class DirectionalGrowthBehaviour implements SpreadGrowthBehaviour {
|
||||
// Grows in specified direction
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
Registered farming interactions:
|
||||
|
||||
| Interaction | Type ID | Description |
|
||||
|-------------|---------|-------------|
|
||||
| `HarvestCropInteraction` | `HarvestCrop` | Harvest mature crops |
|
||||
| `FertilizeSoilInteraction` | `FertilizeSoil` | Apply fertilizer |
|
||||
| `ChangeFarmingStageInteraction` | `ChangeFarmingStage` | Force stage change |
|
||||
| `UseWateringCanInteraction` | `UseWateringCan` | Water crops |
|
||||
| `UseCoopInteraction` | `UseCoop` | Interact with animal coop |
|
||||
| `UseCaptureCrateInteraction` | `UseCaptureCrate` | Capture animals |
|
||||
|
||||
### Interaction Example
|
||||
|
||||
```yaml
|
||||
# Item interaction definition
|
||||
{
|
||||
"Type": "HarvestCrop",
|
||||
"DropTable": "wheat_drops"
|
||||
}
|
||||
```
|
||||
|
||||
## Animal Coops
|
||||
|
||||
### FarmingCoopAsset
|
||||
|
||||
Define coop configurations:
|
||||
|
||||
```yaml
|
||||
# Farming/Coops/chicken_coop.json
|
||||
{
|
||||
"Id": "chicken_coop",
|
||||
"Capacity": 4,
|
||||
"NPCGroups": ["chickens"],
|
||||
"Drops": "egg_drops"
|
||||
}
|
||||
```
|
||||
|
||||
### CoopResidentComponent
|
||||
|
||||
Entity component for animals living in coops:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, CoopResidentComponent> type =
|
||||
FarmingPlugin.get().getCoopResidentComponentType();
|
||||
```
|
||||
|
||||
## Systems
|
||||
|
||||
The farming plugin registers these ECS systems:
|
||||
|
||||
| System | Description |
|
||||
|--------|-------------|
|
||||
| `OnSoilAdded` | Initialize soil when tilled |
|
||||
| `OnFarmBlockAdded` | Initialize crop when planted |
|
||||
| `Ticking` | Process growth each tick |
|
||||
| `MigrateFarming` | Migration for old data |
|
||||
| `OnCoopAdded` | Initialize coop blocks |
|
||||
| `CoopResidentEntitySystem` | Manage coop residents |
|
||||
| `CoopResidentTicking` | Coop production ticking |
|
||||
|
||||
## Events
|
||||
|
||||
```java
|
||||
// Prevent spread on newly generated chunks
|
||||
getEventRegistry().registerGlobal(
|
||||
EventPriority.LAST,
|
||||
ChunkPreLoadProcessEvent.class,
|
||||
FarmingPlugin::preventSpreadOnNew
|
||||
);
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
```java
|
||||
FarmingPlugin farming = FarmingPlugin.get();
|
||||
|
||||
// Get component types for queries
|
||||
ComponentType<ChunkStore, FarmingBlock> farmingType =
|
||||
farming.getFarmingBlockComponentType();
|
||||
|
||||
// Check farming state
|
||||
FarmingBlock block = holder.getComponent(farmingType);
|
||||
if (block != null) {
|
||||
block.setSpreadRate(1.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Assets loaded from `Farming/` directory:
|
||||
- `Farming/Modifiers/` - Growth modifier definitions
|
||||
- `Farming/Coops/` - Animal coop definitions
|
||||
200
content/gameplay-systems/farming.fr.md
Normal file
200
content/gameplay-systems/farming.fr.md
Normal file
@@ -0,0 +1,200 @@
|
||||
---
|
||||
title: Agriculture
|
||||
type: docs
|
||||
weight: 2
|
||||
---
|
||||
|
||||
Le systeme d'agriculture fournit la croissance des cultures, la recolte et les mecaniques de poulaillers.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.farming`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
FarmingPlugin
|
||||
├── Composants de Bloc (ChunkStore)
|
||||
│ ├── TilledSoilBlock - Etat de la terre labouree
|
||||
│ ├── FarmingBlock - Suivi de croissance
|
||||
│ ├── FarmingBlockState - Etat de croissance du bloc
|
||||
│ └── CoopBlock - Etat du poulailler
|
||||
├── Composants d'Entite (EntityStore)
|
||||
│ └── CoopResidentComponent - Animaux dans les poulaillers
|
||||
├── Modificateurs de Croissance
|
||||
│ ├── FertilizerGrowthModifier
|
||||
│ ├── WaterGrowthModifier
|
||||
│ └── LightLevelGrowthModifier
|
||||
└── Etapes d'Agriculture
|
||||
├── BlockTypeFarmingStageData
|
||||
├── BlockStateFarmingStageData
|
||||
├── PrefabFarmingStageData
|
||||
└── SpreadFarmingStageData
|
||||
```
|
||||
|
||||
## Composants de Bloc
|
||||
|
||||
### TilledSoilBlock
|
||||
|
||||
Suit l'etat du sol laboure sur ChunkStore:
|
||||
|
||||
```java
|
||||
ComponentType<ChunkStore, TilledSoilBlock> type =
|
||||
FarmingPlugin.get().getTiledSoilBlockComponentType();
|
||||
```
|
||||
|
||||
### FarmingBlock
|
||||
|
||||
Suit la progression de croissance des cultures:
|
||||
|
||||
```java
|
||||
public class FarmingBlock {
|
||||
// Modificateur de taux de croissance (0 = pas de propagation sur nouveau)
|
||||
public void setSpreadRate(float rate);
|
||||
}
|
||||
```
|
||||
|
||||
### FarmingBlockState
|
||||
|
||||
Etat actuel d'agriculture pour une position de bloc.
|
||||
|
||||
### CoopBlock
|
||||
|
||||
Etat du bloc poulailler pour heberger des creatures.
|
||||
|
||||
## Modificateurs de Croissance
|
||||
|
||||
Les modificateurs de croissance affectent le taux de croissance:
|
||||
|
||||
| Modificateur | ID Type | Description |
|
||||
|--------------|---------|-------------|
|
||||
| `FertilizerGrowthModifierAsset` | `Fertilizer` | Boost avec engrais |
|
||||
| `WaterGrowthModifierAsset` | `Water` | Bonus proximite eau |
|
||||
| `LightLevelGrowthModifierAsset` | `LightLevel` | Croissance basee sur lumiere |
|
||||
|
||||
### Configuration d'Asset
|
||||
|
||||
```yaml
|
||||
# Farming/Modifiers/bone_meal.json
|
||||
{
|
||||
"Id": "bone_meal",
|
||||
"Type": "Fertilizer",
|
||||
"GrowthMultiplier": 2.0
|
||||
}
|
||||
```
|
||||
|
||||
## Etapes d'Agriculture
|
||||
|
||||
Les cultures progressent a travers des etapes definies comme assets:
|
||||
|
||||
| Type d'Etape | ID Type | Description |
|
||||
|--------------|---------|-------------|
|
||||
| `BlockTypeFarmingStageData` | `BlockType` | Change le type de bloc |
|
||||
| `BlockStateFarmingStageData` | `BlockState` | Change l'etat du bloc |
|
||||
| `PrefabFarmingStageData` | `Prefab` | Place une structure prefab |
|
||||
| `SpreadFarmingStageData` | `Spread` | Se propage aux blocs adjacents |
|
||||
|
||||
### Comportement de Propagation
|
||||
|
||||
```java
|
||||
public interface SpreadGrowthBehaviour {
|
||||
// Croissance directionnelle (vignes, etc.)
|
||||
}
|
||||
|
||||
public class DirectionalGrowthBehaviour implements SpreadGrowthBehaviour {
|
||||
// Pousse dans la direction specifiee
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
Interactions d'agriculture enregistrees:
|
||||
|
||||
| Interaction | ID Type | Description |
|
||||
|-------------|---------|-------------|
|
||||
| `HarvestCropInteraction` | `HarvestCrop` | Recolter les cultures matures |
|
||||
| `FertilizeSoilInteraction` | `FertilizeSoil` | Appliquer de l'engrais |
|
||||
| `ChangeFarmingStageInteraction` | `ChangeFarmingStage` | Forcer changement d'etape |
|
||||
| `UseWateringCanInteraction` | `UseWateringCan` | Arroser les cultures |
|
||||
| `UseCoopInteraction` | `UseCoop` | Interagir avec le poulailler |
|
||||
| `UseCaptureCrateInteraction` | `UseCaptureCrate` | Capturer des animaux |
|
||||
|
||||
### Exemple d'Interaction
|
||||
|
||||
```yaml
|
||||
# Definition d'interaction d'item
|
||||
{
|
||||
"Type": "HarvestCrop",
|
||||
"DropTable": "wheat_drops"
|
||||
}
|
||||
```
|
||||
|
||||
## Poulaillers
|
||||
|
||||
### FarmingCoopAsset
|
||||
|
||||
Definir les configurations de poulailler:
|
||||
|
||||
```yaml
|
||||
# Farming/Coops/chicken_coop.json
|
||||
{
|
||||
"Id": "chicken_coop",
|
||||
"Capacity": 4,
|
||||
"NPCGroups": ["chickens"],
|
||||
"Drops": "egg_drops"
|
||||
}
|
||||
```
|
||||
|
||||
### CoopResidentComponent
|
||||
|
||||
Composant d'entite pour les animaux vivant dans les poulaillers:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, CoopResidentComponent> type =
|
||||
FarmingPlugin.get().getCoopResidentComponentType();
|
||||
```
|
||||
|
||||
## Systemes
|
||||
|
||||
Le plugin d'agriculture enregistre ces systemes ECS:
|
||||
|
||||
| Systeme | Description |
|
||||
|---------|-------------|
|
||||
| `OnSoilAdded` | Initialiser le sol quand laboure |
|
||||
| `OnFarmBlockAdded` | Initialiser la culture quand plantee |
|
||||
| `Ticking` | Traiter la croissance chaque tick |
|
||||
| `MigrateFarming` | Migration pour anciennes donnees |
|
||||
| `OnCoopAdded` | Initialiser les blocs poulailler |
|
||||
| `CoopResidentEntitySystem` | Gerer les residents du poulailler |
|
||||
| `CoopResidentTicking` | Ticking de production du poulailler |
|
||||
|
||||
## Evenements
|
||||
|
||||
```java
|
||||
// Empecher la propagation sur les chunks nouvellement generes
|
||||
getEventRegistry().registerGlobal(
|
||||
EventPriority.LAST,
|
||||
ChunkPreLoadProcessEvent.class,
|
||||
FarmingPlugin::preventSpreadOnNew
|
||||
);
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
```java
|
||||
FarmingPlugin farming = FarmingPlugin.get();
|
||||
|
||||
// Obtenir les types de composants pour les requetes
|
||||
ComponentType<ChunkStore, FarmingBlock> farmingType =
|
||||
farming.getFarmingBlockComponentType();
|
||||
|
||||
// Verifier l'etat d'agriculture
|
||||
FarmingBlock block = holder.getComponent(farmingType);
|
||||
if (block != null) {
|
||||
block.setSpreadRate(1.0f);
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Assets charges depuis le repertoire `Farming/`:
|
||||
- `Farming/Modifiers/` - Definitions des modificateurs de croissance
|
||||
- `Farming/Coops/` - Definitions des poulaillers
|
||||
225
content/gameplay-systems/memories.en.md
Normal file
225
content/gameplay-systems/memories.en.md
Normal file
@@ -0,0 +1,225 @@
|
||||
---
|
||||
title: Memories
|
||||
type: docs
|
||||
weight: 4
|
||||
---
|
||||
|
||||
The memories system provides persistent collectible discovery tracking for players.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.memories`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
MemoriesPlugin
|
||||
├── Components
|
||||
│ └── PlayerMemories - Player's collected memories
|
||||
├── Memory Types
|
||||
│ ├── Memory - Base memory interface
|
||||
│ ├── MemoryProvider - Supplies memory instances
|
||||
│ └── NPCMemory/NPCMemoryProvider - NPC-based memories
|
||||
├── Storage
|
||||
│ └── RecordedMemories - Persistent storage (memories.json)
|
||||
├── UI
|
||||
│ ├── MemoriesWindow - Client window
|
||||
│ ├── MemoriesPage - UI page
|
||||
│ └── MemoriesPageSupplier
|
||||
├── Systems
|
||||
│ ├── PlayerAddedSystem - Initialize on player join
|
||||
│ ├── NPCMemory.GatherMemoriesSystem - Collect NPC memories
|
||||
│ └── TempleRespawnPlayersSystem - Temple respawn logic
|
||||
└── Commands
|
||||
└── MemoriesCommand (capacity, clear, level, unlock)
|
||||
```
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### Memory Interface
|
||||
|
||||
Base interface for all memory types:
|
||||
|
||||
```java
|
||||
public interface Memory {
|
||||
// Codec for serialization
|
||||
static final Codec<Memory> CODEC;
|
||||
}
|
||||
```
|
||||
|
||||
### MemoryProvider
|
||||
|
||||
Provides memory instances and configuration:
|
||||
|
||||
```java
|
||||
public interface MemoryProvider<T extends Memory> {
|
||||
String getId();
|
||||
BuilderCodec<T> getCodec();
|
||||
Map<String, Set<Memory>> getAllMemories();
|
||||
}
|
||||
```
|
||||
|
||||
### NPCMemory
|
||||
|
||||
Memories discovered from NPCs:
|
||||
|
||||
```java
|
||||
public class NPCMemory implements Memory {
|
||||
// Collected when player approaches NPC within radius
|
||||
}
|
||||
|
||||
public class NPCMemoryProvider implements MemoryProvider<NPCMemory> {
|
||||
public double getCollectionRadius(); // From config
|
||||
}
|
||||
```
|
||||
|
||||
## Player Memories Component
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, PlayerMemories> type =
|
||||
MemoriesPlugin.get().getPlayerMemoriesComponentType();
|
||||
```
|
||||
|
||||
The `PlayerMemories` component tracks:
|
||||
- Memories discovered by player
|
||||
- Memory capacity
|
||||
- Transfer to recorded memories
|
||||
|
||||
## Recorded Memories
|
||||
|
||||
World-persistent memory storage saved to `memories.json`:
|
||||
|
||||
```java
|
||||
// Check if memory is recorded
|
||||
boolean hasMemory = MemoriesPlugin.get().hasRecordedMemory(memory);
|
||||
|
||||
// Get all recorded memories
|
||||
Set<Memory> recorded = MemoriesPlugin.get().getRecordedMemories();
|
||||
|
||||
// Record player's memories
|
||||
boolean recorded = MemoriesPlugin.get().recordPlayerMemories(playerMemories);
|
||||
|
||||
// Clear all recorded memories
|
||||
MemoriesPlugin.get().clearRecordedMemories();
|
||||
|
||||
// Record all possible memories
|
||||
MemoriesPlugin.get().recordAllMemories();
|
||||
```
|
||||
|
||||
## Memory Levels
|
||||
|
||||
Memory count determines player level:
|
||||
|
||||
```java
|
||||
// Get current memories level
|
||||
int level = MemoriesPlugin.get().getMemoriesLevel(gameplayConfig);
|
||||
|
||||
// Get memories needed for next level
|
||||
int needed = MemoriesPlugin.get().getMemoriesForNextLevel(gameplayConfig);
|
||||
```
|
||||
|
||||
### Level Configuration
|
||||
|
||||
```java
|
||||
public class MemoriesGameplayConfig {
|
||||
int[] memoriesAmountPerLevel; // Thresholds for each level
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
| Interaction | Type ID | Description |
|
||||
|-------------|---------|-------------|
|
||||
| `SetMemoriesCapacityInteraction` | `SetMemoriesCapacity` | Set player memory capacity |
|
||||
| `MemoriesConditionInteraction` | `MemoriesCondition` | Condition based on memories |
|
||||
|
||||
## UI Integration
|
||||
|
||||
### Memory Window
|
||||
|
||||
Client-requestable window for viewing memories:
|
||||
|
||||
```java
|
||||
Window.CLIENT_REQUESTABLE_WINDOW_TYPES.put(WindowType.Memories, MemoriesWindow::new);
|
||||
```
|
||||
|
||||
### Custom UI Page
|
||||
|
||||
```java
|
||||
OpenCustomUIInteraction.registerCustomPageSupplier(
|
||||
this,
|
||||
MemoriesPage.class,
|
||||
"Memories",
|
||||
new MemoriesPageSupplier()
|
||||
);
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/memories` | Base memories command |
|
||||
| `/memories capacity <amount>` | Set memory capacity |
|
||||
| `/memories clear` | Clear recorded memories |
|
||||
| `/memories level` | Show current level |
|
||||
| `/memories unlock` | Unlock all memories |
|
||||
|
||||
## Configuration
|
||||
|
||||
### Plugin Config
|
||||
|
||||
```java
|
||||
public class MemoriesPluginConfig {
|
||||
// Collection radius per memory type
|
||||
Object2DoubleMap<String> collectionRadius;
|
||||
|
||||
public Object2DoubleMap<String> getCollectionRadius();
|
||||
}
|
||||
```
|
||||
|
||||
### Gameplay Config
|
||||
|
||||
```yaml
|
||||
# gameplay_config.json
|
||||
{
|
||||
"Memories": {
|
||||
"MemoriesAmountPerLevel": [5, 15, 30, 50, 75, 100]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Temple System
|
||||
|
||||
The Forgotten Temple system for memory-related respawns:
|
||||
|
||||
```java
|
||||
public class ForgottenTempleConfig {
|
||||
// Temple configuration for respawn
|
||||
}
|
||||
|
||||
public class TempleRespawnPlayersSystem {
|
||||
// Handles respawn at temples
|
||||
}
|
||||
```
|
||||
|
||||
## Events
|
||||
|
||||
Player memories feature status is sent on join:
|
||||
|
||||
```java
|
||||
// Sent to client when player joins
|
||||
playerConnection.writeNoCache(new UpdateMemoriesFeatureStatus(isFeatureUnlocked));
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
```java
|
||||
MemoriesPlugin memories = MemoriesPlugin.get();
|
||||
|
||||
// Get all available memories
|
||||
Map<String, Set<Memory>> allMemories = memories.getAllMemories();
|
||||
|
||||
// Register custom memory provider
|
||||
memories.registerMemoryProvider(new CustomMemoryProvider());
|
||||
|
||||
// Check player memories component
|
||||
PlayerMemories playerMemories = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||
```
|
||||
225
content/gameplay-systems/memories.fr.md
Normal file
225
content/gameplay-systems/memories.fr.md
Normal file
@@ -0,0 +1,225 @@
|
||||
---
|
||||
title: Memoires
|
||||
type: docs
|
||||
weight: 4
|
||||
---
|
||||
|
||||
Le systeme de memoires fournit un suivi persistant des decouvertes collectibles pour les joueurs.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.memories`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
MemoriesPlugin
|
||||
├── Composants
|
||||
│ └── PlayerMemories - Memoires collectees du joueur
|
||||
├── Types de Memoire
|
||||
│ ├── Memory - Interface de base
|
||||
│ ├── MemoryProvider - Fournit les instances de memoire
|
||||
│ └── NPCMemory/NPCMemoryProvider - Memoires basees sur NPCs
|
||||
├── Stockage
|
||||
│ └── RecordedMemories - Stockage persistant (memories.json)
|
||||
├── UI
|
||||
│ ├── MemoriesWindow - Fenetre client
|
||||
│ ├── MemoriesPage - Page UI
|
||||
│ └── MemoriesPageSupplier
|
||||
├── Systemes
|
||||
│ ├── PlayerAddedSystem - Initialiser a la connexion
|
||||
│ ├── NPCMemory.GatherMemoriesSystem - Collecter memoires NPC
|
||||
│ └── TempleRespawnPlayersSystem - Logique respawn temple
|
||||
└── Commandes
|
||||
└── MemoriesCommand (capacity, clear, level, unlock)
|
||||
```
|
||||
|
||||
## Concepts Cles
|
||||
|
||||
### Interface Memory
|
||||
|
||||
Interface de base pour tous les types de memoire:
|
||||
|
||||
```java
|
||||
public interface Memory {
|
||||
// Codec pour serialisation
|
||||
static final Codec<Memory> CODEC;
|
||||
}
|
||||
```
|
||||
|
||||
### MemoryProvider
|
||||
|
||||
Fournit les instances et configuration de memoire:
|
||||
|
||||
```java
|
||||
public interface MemoryProvider<T extends Memory> {
|
||||
String getId();
|
||||
BuilderCodec<T> getCodec();
|
||||
Map<String, Set<Memory>> getAllMemories();
|
||||
}
|
||||
```
|
||||
|
||||
### NPCMemory
|
||||
|
||||
Memoires decouvertes depuis les NPCs:
|
||||
|
||||
```java
|
||||
public class NPCMemory implements Memory {
|
||||
// Collectee quand joueur approche NPC dans le rayon
|
||||
}
|
||||
|
||||
public class NPCMemoryProvider implements MemoryProvider<NPCMemory> {
|
||||
public double getCollectionRadius(); // Depuis config
|
||||
}
|
||||
```
|
||||
|
||||
## Composant Player Memories
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, PlayerMemories> type =
|
||||
MemoriesPlugin.get().getPlayerMemoriesComponentType();
|
||||
```
|
||||
|
||||
Le composant `PlayerMemories` suit:
|
||||
- Memoires decouvertes par le joueur
|
||||
- Capacite de memoire
|
||||
- Transfert vers memoires enregistrees
|
||||
|
||||
## Memoires Enregistrees
|
||||
|
||||
Stockage persistant de memoires sauvegarde dans `memories.json`:
|
||||
|
||||
```java
|
||||
// Verifier si memoire est enregistree
|
||||
boolean hasMemory = MemoriesPlugin.get().hasRecordedMemory(memory);
|
||||
|
||||
// Obtenir toutes les memoires enregistrees
|
||||
Set<Memory> recorded = MemoriesPlugin.get().getRecordedMemories();
|
||||
|
||||
// Enregistrer les memoires du joueur
|
||||
boolean recorded = MemoriesPlugin.get().recordPlayerMemories(playerMemories);
|
||||
|
||||
// Effacer toutes les memoires enregistrees
|
||||
MemoriesPlugin.get().clearRecordedMemories();
|
||||
|
||||
// Enregistrer toutes les memoires possibles
|
||||
MemoriesPlugin.get().recordAllMemories();
|
||||
```
|
||||
|
||||
## Niveaux de Memoire
|
||||
|
||||
Le nombre de memoires determine le niveau du joueur:
|
||||
|
||||
```java
|
||||
// Obtenir niveau actuel de memoires
|
||||
int level = MemoriesPlugin.get().getMemoriesLevel(gameplayConfig);
|
||||
|
||||
// Obtenir memoires necessaires pour prochain niveau
|
||||
int needed = MemoriesPlugin.get().getMemoriesForNextLevel(gameplayConfig);
|
||||
```
|
||||
|
||||
### Configuration des Niveaux
|
||||
|
||||
```java
|
||||
public class MemoriesGameplayConfig {
|
||||
int[] memoriesAmountPerLevel; // Seuils pour chaque niveau
|
||||
}
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
| Interaction | ID Type | Description |
|
||||
|-------------|---------|-------------|
|
||||
| `SetMemoriesCapacityInteraction` | `SetMemoriesCapacity` | Definir capacite memoire joueur |
|
||||
| `MemoriesConditionInteraction` | `MemoriesCondition` | Condition basee sur memoires |
|
||||
|
||||
## Integration UI
|
||||
|
||||
### Fenetre Memoires
|
||||
|
||||
Fenetre demandable par le client pour voir les memoires:
|
||||
|
||||
```java
|
||||
Window.CLIENT_REQUESTABLE_WINDOW_TYPES.put(WindowType.Memories, MemoriesWindow::new);
|
||||
```
|
||||
|
||||
### Page UI Personnalisee
|
||||
|
||||
```java
|
||||
OpenCustomUIInteraction.registerCustomPageSupplier(
|
||||
this,
|
||||
MemoriesPage.class,
|
||||
"Memories",
|
||||
new MemoriesPageSupplier()
|
||||
);
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `/memories` | Commande memoires de base |
|
||||
| `/memories capacity <amount>` | Definir capacite memoire |
|
||||
| `/memories clear` | Effacer memoires enregistrees |
|
||||
| `/memories level` | Afficher niveau actuel |
|
||||
| `/memories unlock` | Debloquer toutes les memoires |
|
||||
|
||||
## Configuration
|
||||
|
||||
### Config Plugin
|
||||
|
||||
```java
|
||||
public class MemoriesPluginConfig {
|
||||
// Rayon de collection par type de memoire
|
||||
Object2DoubleMap<String> collectionRadius;
|
||||
|
||||
public Object2DoubleMap<String> getCollectionRadius();
|
||||
}
|
||||
```
|
||||
|
||||
### Config Gameplay
|
||||
|
||||
```yaml
|
||||
# gameplay_config.json
|
||||
{
|
||||
"Memories": {
|
||||
"MemoriesAmountPerLevel": [5, 15, 30, 50, 75, 100]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Systeme de Temple
|
||||
|
||||
Le systeme du Temple Oublie pour les respawns lies aux memoires:
|
||||
|
||||
```java
|
||||
public class ForgottenTempleConfig {
|
||||
// Configuration temple pour respawn
|
||||
}
|
||||
|
||||
public class TempleRespawnPlayersSystem {
|
||||
// Gere le respawn aux temples
|
||||
}
|
||||
```
|
||||
|
||||
## Evenements
|
||||
|
||||
Le statut de la fonctionnalite memoires est envoye a la connexion:
|
||||
|
||||
```java
|
||||
// Envoye au client quand joueur rejoint
|
||||
playerConnection.writeNoCache(new UpdateMemoriesFeatureStatus(isFeatureUnlocked));
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
```java
|
||||
MemoriesPlugin memories = MemoriesPlugin.get();
|
||||
|
||||
// Obtenir toutes les memoires disponibles
|
||||
Map<String, Set<Memory>> allMemories = memories.getAllMemories();
|
||||
|
||||
// Enregistrer fournisseur de memoire personnalise
|
||||
memories.registerMemoryProvider(new CustomMemoryProvider());
|
||||
|
||||
// Verifier composant memoires joueur
|
||||
PlayerMemories playerMemories = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||
```
|
||||
202
content/gameplay-systems/npc-objectives.en.md
Normal file
202
content/gameplay-systems/npc-objectives.en.md
Normal file
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: NPC Objectives
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
The NPC objectives system extends the base objective system with combat-related tasks.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.npcobjectives`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
NPCObjectivesPlugin
|
||||
├── Task Types
|
||||
│ ├── KillSpawnBeaconObjectiveTask - Kill NPCs from spawn beacons
|
||||
│ ├── KillSpawnMarkerObjectiveTask - Kill NPCs from spawn markers
|
||||
│ ├── BountyObjectiveTask - Hunt specific NPC targets
|
||||
│ └── KillNPCObjectiveTask - Kill NPCs by type/group
|
||||
├── Resources
|
||||
│ └── KillTrackerResource - Tracks kill counts
|
||||
├── Systems
|
||||
│ ├── KillTrackerSystem - Monitors NPC deaths
|
||||
│ └── SpawnBeaconCheckRemovalSystem - Cleanup spawn beacons
|
||||
└── NPC Actions
|
||||
├── BuilderActionCompleteTask - Complete task on NPC
|
||||
├── BuilderActionStartObjective - Start objective from NPC
|
||||
└── BuilderSensorHasTask - Check if player has task
|
||||
```
|
||||
|
||||
## Task Types
|
||||
|
||||
### KillTask Interface
|
||||
|
||||
All kill-based tasks implement this interface:
|
||||
|
||||
```java
|
||||
public interface KillTask {
|
||||
void checkKilledEntity(
|
||||
Store<EntityStore> store,
|
||||
Ref<EntityStore> npcRef,
|
||||
Objective objective,
|
||||
NPCEntity npc,
|
||||
Damage damageInfo
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Registered Task Types
|
||||
|
||||
| Type | Task Asset Class | Description |
|
||||
|------|------------------|-------------|
|
||||
| `KillSpawnBeacon` | `KillSpawnBeaconObjectiveTaskAsset` | Kill NPCs from beacons |
|
||||
| `KillSpawnMarker` | `KillSpawnMarkerObjectiveTaskAsset` | Kill NPCs from markers |
|
||||
| `Bounty` | `BountyObjectiveTaskAsset` | Hunt specific target |
|
||||
| `KillNPC` | `KillObjectiveTaskAsset` | Kill NPCs by group |
|
||||
|
||||
### Bounty Task
|
||||
|
||||
Spawns a specific NPC and marks it as a bounty target:
|
||||
|
||||
```java
|
||||
public class BountyObjectiveTask extends ObjectiveTask implements KillTask {
|
||||
boolean completed;
|
||||
UUID entityUuid; // Target NPC UUID
|
||||
|
||||
// Spawns NPC at position and adds map marker
|
||||
protected TransactionRecord[] setup0(Objective objective, World world, Store<EntityStore> store) {
|
||||
// Get spawn position from asset configuration
|
||||
Vector3i spawnPosition = getAsset().getWorldLocationProvider()
|
||||
.runCondition(world, objectivePosition);
|
||||
|
||||
// Spawn the bounty NPC
|
||||
Pair<Ref<EntityStore>, INonPlayerCharacter> npcPair =
|
||||
NPCPlugin.get().spawnNPC(store, getAsset().getNpcId(), null, spawnPosition, Vector3f.ZERO);
|
||||
|
||||
// Add map marker for bounty
|
||||
addMarker(new MapMarker(
|
||||
getBountyMarkerIDFromUUID(npcUuid),
|
||||
"Bounty Target",
|
||||
"Home.png",
|
||||
transform
|
||||
));
|
||||
|
||||
// Register kill tracker
|
||||
store.getResource(KillTrackerResource.getResourceType()).watch(transaction);
|
||||
|
||||
return transactionRecords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkKilledEntity(Store<EntityStore> store, Ref<EntityStore> npcRef,
|
||||
Objective objective, NPCEntity npc, Damage damageInfo) {
|
||||
if (!this.entityUuid.equals(uuid)) return;
|
||||
this.completed = true;
|
||||
this.complete(objective, store);
|
||||
objective.checkTaskSetCompletion(store);
|
||||
this.removeMarker(getBountyMarkerIDFromUUID(uuid));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Asset Configuration
|
||||
|
||||
```yaml
|
||||
# Objectives/bounty_quest.json
|
||||
{
|
||||
"Id": "bounty_quest",
|
||||
"TaskSets": [
|
||||
{
|
||||
"Tasks": [
|
||||
{
|
||||
"Type": "Bounty",
|
||||
"NpcId": "bandit_leader",
|
||||
"WorldLocationProvider": {
|
||||
"Type": "LocationRadius",
|
||||
"Radius": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Kill Tracker
|
||||
|
||||
### KillTrackerResource
|
||||
|
||||
World resource that tracks NPC kills:
|
||||
|
||||
```java
|
||||
ResourceType<EntityStore, KillTrackerResource> type =
|
||||
NPCObjectivesPlugin.get().getKillTrackerResourceType();
|
||||
```
|
||||
|
||||
### KillTrackerSystem
|
||||
|
||||
ECS system that monitors NPC deaths and notifies watching tasks:
|
||||
|
||||
```java
|
||||
// Register transaction to watch for kills
|
||||
KillTaskTransaction transaction = new KillTaskTransaction(task, objective, store);
|
||||
store.getResource(KillTrackerResource.getResourceType()).watch(transaction);
|
||||
```
|
||||
|
||||
## NPC Actions
|
||||
|
||||
Registered as NPC core component types for AI integration:
|
||||
|
||||
### CompleteTask Action
|
||||
|
||||
```java
|
||||
// Completes a task when NPC interaction occurs
|
||||
NPCPlugin.get().registerCoreComponentType("CompleteTask", BuilderActionCompleteTask::new);
|
||||
```
|
||||
|
||||
### StartObjective Action
|
||||
|
||||
```java
|
||||
// Starts an objective from NPC dialogue/interaction
|
||||
NPCPlugin.get().registerCoreComponentType("StartObjective", BuilderActionStartObjective::new);
|
||||
```
|
||||
|
||||
### HasTask Sensor
|
||||
|
||||
```java
|
||||
// Sensor that checks if player has a specific task
|
||||
NPCPlugin.get().registerCoreComponentType("HasTask", BuilderSensorHasTask::new);
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Check if Player Has Task
|
||||
|
||||
```java
|
||||
boolean hasTask = NPCObjectivesPlugin.hasTask(playerUUID, npcId, "taskId");
|
||||
```
|
||||
|
||||
### Update Task Completion
|
||||
|
||||
```java
|
||||
String animationId = NPCObjectivesPlugin.updateTaskCompletion(
|
||||
store, ref, playerRef, npcId, "taskId"
|
||||
);
|
||||
```
|
||||
|
||||
### Start Objective from NPC
|
||||
|
||||
```java
|
||||
NPCObjectivesPlugin.startObjective(playerReference, "quest_id", store);
|
||||
```
|
||||
|
||||
## Asset Loading Order
|
||||
|
||||
The plugin ensures proper asset loading order:
|
||||
|
||||
```java
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(SpawnMarker.class);
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(BeaconNPCSpawn.class);
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(NPCGroup.class);
|
||||
```
|
||||
202
content/gameplay-systems/npc-objectives.fr.md
Normal file
202
content/gameplay-systems/npc-objectives.fr.md
Normal file
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: Objectifs NPC
|
||||
type: docs
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Le systeme d'objectifs NPC etend le systeme d'objectifs de base avec des taches liees au combat.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.npcobjectives`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
NPCObjectivesPlugin
|
||||
├── Types de Taches
|
||||
│ ├── KillSpawnBeaconObjectiveTask - Tuer NPCs de spawn beacons
|
||||
│ ├── KillSpawnMarkerObjectiveTask - Tuer NPCs de spawn markers
|
||||
│ ├── BountyObjectiveTask - Chasser des cibles NPC specifiques
|
||||
│ └── KillNPCObjectiveTask - Tuer NPCs par type/groupe
|
||||
├── Ressources
|
||||
│ └── KillTrackerResource - Suit les compteurs de kills
|
||||
├── Systemes
|
||||
│ ├── KillTrackerSystem - Surveille les morts de NPCs
|
||||
│ └── SpawnBeaconCheckRemovalSystem - Nettoyage spawn beacons
|
||||
└── Actions NPC
|
||||
├── BuilderActionCompleteTask - Completer tache sur NPC
|
||||
├── BuilderActionStartObjective - Demarrer objectif depuis NPC
|
||||
└── BuilderSensorHasTask - Verifier si joueur a une tache
|
||||
```
|
||||
|
||||
## Types de Taches
|
||||
|
||||
### Interface KillTask
|
||||
|
||||
Toutes les taches basees sur les kills implementent cette interface:
|
||||
|
||||
```java
|
||||
public interface KillTask {
|
||||
void checkKilledEntity(
|
||||
Store<EntityStore> store,
|
||||
Ref<EntityStore> npcRef,
|
||||
Objective objective,
|
||||
NPCEntity npc,
|
||||
Damage damageInfo
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Types de Taches Enregistres
|
||||
|
||||
| Type | Classe Asset | Description |
|
||||
|------|--------------|-------------|
|
||||
| `KillSpawnBeacon` | `KillSpawnBeaconObjectiveTaskAsset` | Tuer NPCs de beacons |
|
||||
| `KillSpawnMarker` | `KillSpawnMarkerObjectiveTaskAsset` | Tuer NPCs de markers |
|
||||
| `Bounty` | `BountyObjectiveTaskAsset` | Chasser une cible specifique |
|
||||
| `KillNPC` | `KillObjectiveTaskAsset` | Tuer NPCs par groupe |
|
||||
|
||||
### Tache Bounty
|
||||
|
||||
Fait apparaitre un NPC specifique et le marque comme cible de prime:
|
||||
|
||||
```java
|
||||
public class BountyObjectiveTask extends ObjectiveTask implements KillTask {
|
||||
boolean completed;
|
||||
UUID entityUuid; // UUID du NPC cible
|
||||
|
||||
// Fait apparaitre le NPC a la position et ajoute un marqueur carte
|
||||
protected TransactionRecord[] setup0(Objective objective, World world, Store<EntityStore> store) {
|
||||
// Obtenir la position de spawn depuis la configuration
|
||||
Vector3i spawnPosition = getAsset().getWorldLocationProvider()
|
||||
.runCondition(world, objectivePosition);
|
||||
|
||||
// Faire apparaitre le NPC bounty
|
||||
Pair<Ref<EntityStore>, INonPlayerCharacter> npcPair =
|
||||
NPCPlugin.get().spawnNPC(store, getAsset().getNpcId(), null, spawnPosition, Vector3f.ZERO);
|
||||
|
||||
// Ajouter marqueur sur la carte
|
||||
addMarker(new MapMarker(
|
||||
getBountyMarkerIDFromUUID(npcUuid),
|
||||
"Bounty Target",
|
||||
"Home.png",
|
||||
transform
|
||||
));
|
||||
|
||||
// Enregistrer le tracker de kills
|
||||
store.getResource(KillTrackerResource.getResourceType()).watch(transaction);
|
||||
|
||||
return transactionRecords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkKilledEntity(Store<EntityStore> store, Ref<EntityStore> npcRef,
|
||||
Objective objective, NPCEntity npc, Damage damageInfo) {
|
||||
if (!this.entityUuid.equals(uuid)) return;
|
||||
this.completed = true;
|
||||
this.complete(objective, store);
|
||||
objective.checkTaskSetCompletion(store);
|
||||
this.removeMarker(getBountyMarkerIDFromUUID(uuid));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration d'Asset
|
||||
|
||||
```yaml
|
||||
# Objectives/bounty_quest.json
|
||||
{
|
||||
"Id": "bounty_quest",
|
||||
"TaskSets": [
|
||||
{
|
||||
"Tasks": [
|
||||
{
|
||||
"Type": "Bounty",
|
||||
"NpcId": "bandit_leader",
|
||||
"WorldLocationProvider": {
|
||||
"Type": "LocationRadius",
|
||||
"Radius": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Tracker de Kills
|
||||
|
||||
### KillTrackerResource
|
||||
|
||||
Ressource monde qui suit les kills de NPCs:
|
||||
|
||||
```java
|
||||
ResourceType<EntityStore, KillTrackerResource> type =
|
||||
NPCObjectivesPlugin.get().getKillTrackerResourceType();
|
||||
```
|
||||
|
||||
### KillTrackerSystem
|
||||
|
||||
Systeme ECS qui surveille les morts de NPCs et notifie les taches:
|
||||
|
||||
```java
|
||||
// Enregistrer une transaction pour surveiller les kills
|
||||
KillTaskTransaction transaction = new KillTaskTransaction(task, objective, store);
|
||||
store.getResource(KillTrackerResource.getResourceType()).watch(transaction);
|
||||
```
|
||||
|
||||
## Actions NPC
|
||||
|
||||
Enregistrees comme types de composants core NPC pour l'integration IA:
|
||||
|
||||
### Action CompleteTask
|
||||
|
||||
```java
|
||||
// Complete une tache quand interaction NPC se produit
|
||||
NPCPlugin.get().registerCoreComponentType("CompleteTask", BuilderActionCompleteTask::new);
|
||||
```
|
||||
|
||||
### Action StartObjective
|
||||
|
||||
```java
|
||||
// Demarre un objectif depuis dialogue/interaction NPC
|
||||
NPCPlugin.get().registerCoreComponentType("StartObjective", BuilderActionStartObjective::new);
|
||||
```
|
||||
|
||||
### Sensor HasTask
|
||||
|
||||
```java
|
||||
// Sensor qui verifie si le joueur a une tache specifique
|
||||
NPCPlugin.get().registerCoreComponentType("HasTask", BuilderSensorHasTask::new);
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Verifier si Joueur a une Tache
|
||||
|
||||
```java
|
||||
boolean hasTask = NPCObjectivesPlugin.hasTask(playerUUID, npcId, "taskId");
|
||||
```
|
||||
|
||||
### Mettre a Jour Completion de Tache
|
||||
|
||||
```java
|
||||
String animationId = NPCObjectivesPlugin.updateTaskCompletion(
|
||||
store, ref, playerRef, npcId, "taskId"
|
||||
);
|
||||
```
|
||||
|
||||
### Demarrer Objectif depuis NPC
|
||||
|
||||
```java
|
||||
NPCObjectivesPlugin.startObjective(playerReference, "quest_id", store);
|
||||
```
|
||||
|
||||
## Ordre de Chargement des Assets
|
||||
|
||||
Le plugin assure un ordre de chargement correct:
|
||||
|
||||
```java
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(SpawnMarker.class);
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(BeaconNPCSpawn.class);
|
||||
AssetRegistry.getAssetStore(ObjectiveAsset.class).injectLoadsAfter(NPCGroup.class);
|
||||
```
|
||||
204
content/gameplay-systems/objectives.en.md
Normal file
204
content/gameplay-systems/objectives.en.md
Normal file
@@ -0,0 +1,204 @@
|
||||
---
|
||||
title: Objectives
|
||||
type: docs
|
||||
weight: 1
|
||||
---
|
||||
|
||||
The objectives system provides quest mechanics with tasks, completions, and progress tracking.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.objectives`
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### ObjectiveAsset
|
||||
|
||||
Objectives are defined as JSON assets loaded from `Objectives/`:
|
||||
|
||||
```java
|
||||
public class ObjectiveAsset {
|
||||
protected String id; // Unique identifier
|
||||
protected String category; // Quest category
|
||||
protected TaskSet[] taskSets; // Sequential task groups
|
||||
protected ObjectiveCompletionAsset[] completionHandlers; // Rewards
|
||||
protected String objectiveTitleKey; // Localization key for title
|
||||
protected String objectiveDescriptionKey; // Localization key for description
|
||||
protected boolean removeOnItemDrop; // Remove objective items on drop
|
||||
}
|
||||
```
|
||||
|
||||
### TaskSet
|
||||
|
||||
Each objective contains one or more TaskSets that must be completed sequentially:
|
||||
|
||||
```java
|
||||
public class TaskSet {
|
||||
protected String descriptionId; // Optional description key
|
||||
protected ObjectiveTaskAsset[] tasks; // Tasks to complete in parallel
|
||||
}
|
||||
```
|
||||
|
||||
### Objective Instance
|
||||
|
||||
When started, an `Objective` instance tracks state:
|
||||
|
||||
```java
|
||||
public class Objective {
|
||||
private final UUID uuid; // Unique instance ID
|
||||
private final String objectiveId; // Asset ID reference
|
||||
private final Set<UUID> playerUUIDs; // Participating players
|
||||
private ObjectiveTask[] currentTasks; // Active tasks
|
||||
private int taskSetIndex; // Current TaskSet index
|
||||
}
|
||||
```
|
||||
|
||||
## Task Types
|
||||
|
||||
The system provides built-in task types registered by `ObjectivePlugin`:
|
||||
|
||||
| Type | Class | Description |
|
||||
|------|-------|-------------|
|
||||
| `Craft` | `CraftObjectiveTask` | Craft specific items |
|
||||
| `Gather` | `GatherObjectiveTask` | Collect items in inventory |
|
||||
| `UseBlock` | `UseBlockObjectiveTask` | Interact with blocks |
|
||||
| `UseEntity` | `UseEntityObjectiveTask` | Interact with entities |
|
||||
| `TreasureMap` | `TreasureMapObjectiveTask` | Find treasure locations |
|
||||
| `ReachLocation` | `ReachLocationTask` | Reach specific coordinates |
|
||||
|
||||
### Task Asset Example
|
||||
|
||||
```yaml
|
||||
# Objectives/collect_wood.json
|
||||
{
|
||||
"Id": "collect_wood",
|
||||
"Category": "tutorial",
|
||||
"TaskSets": [
|
||||
{
|
||||
"Tasks": [
|
||||
{
|
||||
"Type": "Gather",
|
||||
"Item": "oak_log",
|
||||
"Amount": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Completions": [
|
||||
{
|
||||
"Type": "GiveItems",
|
||||
"Items": [
|
||||
{ "Item": "gold_coin", "Amount": 5 }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Completion Handlers
|
||||
|
||||
When all TaskSets complete, completion handlers execute:
|
||||
|
||||
| Type | Class | Description |
|
||||
|------|-------|-------------|
|
||||
| `GiveItems` | `GiveItemsCompletion` | Give items to player |
|
||||
| `ClearObjectiveItems` | `ClearObjectiveItemsCompletion` | Remove objective-related items |
|
||||
|
||||
## API Usage
|
||||
|
||||
### Starting Objectives
|
||||
|
||||
```java
|
||||
ObjectivePlugin plugin = ObjectivePlugin.get();
|
||||
|
||||
// Start objective for player
|
||||
plugin.startObjective(player, "collect_wood");
|
||||
|
||||
// With custom data
|
||||
Objective objective = plugin.startObjective(player, "collect_wood", customData);
|
||||
```
|
||||
|
||||
### Tracking Progress
|
||||
|
||||
```java
|
||||
// Get player's active objectives
|
||||
ObjectiveHistoryComponent history = store.getComponent(
|
||||
playerRef,
|
||||
ObjectiveHistoryComponent.getComponentType()
|
||||
);
|
||||
|
||||
// Check objective status
|
||||
ObjectiveHistoryData data = history.getObjectiveData("collect_wood");
|
||||
if (data != null && data.isCompleted()) {
|
||||
// Already completed
|
||||
}
|
||||
```
|
||||
|
||||
### Completing Objectives
|
||||
|
||||
```java
|
||||
// Mark objective as complete (triggers completions)
|
||||
objective.complete(objectivePlugin);
|
||||
|
||||
// Cancel objective without rewards
|
||||
objective.cancel(objectivePlugin);
|
||||
```
|
||||
|
||||
## Trigger Conditions
|
||||
|
||||
Objectives can have trigger conditions for activation:
|
||||
|
||||
```java
|
||||
// Weather-based trigger
|
||||
public class WeatherTriggerCondition { /* ... */ }
|
||||
|
||||
// Location-based trigger
|
||||
public class ObjectiveLocationTriggerCondition { /* ... */ }
|
||||
|
||||
// Time-based trigger
|
||||
public class HourRangeTriggerCondition { /* ... */ }
|
||||
```
|
||||
|
||||
## Location Markers
|
||||
|
||||
Use markers to create spatial objectives:
|
||||
|
||||
```java
|
||||
// Define marker area
|
||||
public interface ObjectiveLocationMarkerArea {
|
||||
boolean isInArea(Vector3d position);
|
||||
}
|
||||
|
||||
// Built-in area types
|
||||
public class ObjectiveLocationAreaRadius { /* Spherical area */ }
|
||||
public class ObjectiveLocationAreaBox { /* Box area */ }
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/objective start <id> [player]` | Start an objective |
|
||||
| `/objective complete <id> [player]` | Force complete |
|
||||
| `/objective history [player]` | View history |
|
||||
| `/objective panel` | Open admin panel |
|
||||
|
||||
## Events
|
||||
|
||||
```java
|
||||
// Treasure chest opened during objective
|
||||
public class TreasureChestOpeningEvent implements IEvent<UUID> {
|
||||
public TreasureChestState getChestState();
|
||||
public Player getPlayer();
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Assets are loaded from `Objectives/` directory with inheritance support:
|
||||
|
||||
```yaml
|
||||
# Objectives/config.yaml
|
||||
ObjectiveGameplayConfig:
|
||||
DefaultObjectives:
|
||||
- tutorial_quest
|
||||
- welcome_message
|
||||
```
|
||||
204
content/gameplay-systems/objectives.fr.md
Normal file
204
content/gameplay-systems/objectives.fr.md
Normal file
@@ -0,0 +1,204 @@
|
||||
---
|
||||
title: Objectifs
|
||||
type: docs
|
||||
weight: 1
|
||||
---
|
||||
|
||||
Le systeme d'objectifs fournit des mecaniques de quetes avec des taches, des completions et un suivi de progression.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.objectives`
|
||||
|
||||
## Concepts Cles
|
||||
|
||||
### ObjectiveAsset
|
||||
|
||||
Les objectifs sont definis comme des assets JSON charges depuis `Objectives/`:
|
||||
|
||||
```java
|
||||
public class ObjectiveAsset {
|
||||
protected String id; // Identifiant unique
|
||||
protected String category; // Categorie de quete
|
||||
protected TaskSet[] taskSets; // Groupes de taches sequentiels
|
||||
protected ObjectiveCompletionAsset[] completionHandlers; // Recompenses
|
||||
protected String objectiveTitleKey; // Cle de localisation du titre
|
||||
protected String objectiveDescriptionKey; // Cle de localisation de description
|
||||
protected boolean removeOnItemDrop; // Retirer items objectif au drop
|
||||
}
|
||||
```
|
||||
|
||||
### TaskSet
|
||||
|
||||
Chaque objectif contient un ou plusieurs TaskSets a completer sequentiellement:
|
||||
|
||||
```java
|
||||
public class TaskSet {
|
||||
protected String descriptionId; // Cle de description optionnelle
|
||||
protected ObjectiveTaskAsset[] tasks; // Taches a completer en parallele
|
||||
}
|
||||
```
|
||||
|
||||
### Instance d'Objectif
|
||||
|
||||
Quand demarre, une instance `Objective` suit l'etat:
|
||||
|
||||
```java
|
||||
public class Objective {
|
||||
private final UUID uuid; // ID unique de l'instance
|
||||
private final String objectiveId; // Reference ID de l'asset
|
||||
private final Set<UUID> playerUUIDs; // Joueurs participants
|
||||
private ObjectiveTask[] currentTasks; // Taches actives
|
||||
private int taskSetIndex; // Index du TaskSet courant
|
||||
}
|
||||
```
|
||||
|
||||
## Types de Taches
|
||||
|
||||
Le systeme fournit des types de taches integres enregistres par `ObjectivePlugin`:
|
||||
|
||||
| Type | Classe | Description |
|
||||
|------|--------|-------------|
|
||||
| `Craft` | `CraftObjectiveTask` | Fabriquer des items specifiques |
|
||||
| `Gather` | `GatherObjectiveTask` | Collecter des items dans l'inventaire |
|
||||
| `UseBlock` | `UseBlockObjectiveTask` | Interagir avec des blocs |
|
||||
| `UseEntity` | `UseEntityObjectiveTask` | Interagir avec des entites |
|
||||
| `TreasureMap` | `TreasureMapObjectiveTask` | Trouver des emplacements de tresor |
|
||||
| `ReachLocation` | `ReachLocationTask` | Atteindre des coordonnees specifiques |
|
||||
|
||||
### Exemple d'Asset de Tache
|
||||
|
||||
```yaml
|
||||
# Objectives/collect_wood.json
|
||||
{
|
||||
"Id": "collect_wood",
|
||||
"Category": "tutorial",
|
||||
"TaskSets": [
|
||||
{
|
||||
"Tasks": [
|
||||
{
|
||||
"Type": "Gather",
|
||||
"Item": "oak_log",
|
||||
"Amount": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Completions": [
|
||||
{
|
||||
"Type": "GiveItems",
|
||||
"Items": [
|
||||
{ "Item": "gold_coin", "Amount": 5 }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Gestionnaires de Completion
|
||||
|
||||
Quand tous les TaskSets sont completes, les gestionnaires de completion s'executent:
|
||||
|
||||
| Type | Classe | Description |
|
||||
|------|--------|-------------|
|
||||
| `GiveItems` | `GiveItemsCompletion` | Donner des items au joueur |
|
||||
| `ClearObjectiveItems` | `ClearObjectiveItemsCompletion` | Retirer les items lies a l'objectif |
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Demarrer des Objectifs
|
||||
|
||||
```java
|
||||
ObjectivePlugin plugin = ObjectivePlugin.get();
|
||||
|
||||
// Demarrer un objectif pour un joueur
|
||||
plugin.startObjective(player, "collect_wood");
|
||||
|
||||
// Avec des donnees personnalisees
|
||||
Objective objective = plugin.startObjective(player, "collect_wood", customData);
|
||||
```
|
||||
|
||||
### Suivre la Progression
|
||||
|
||||
```java
|
||||
// Obtenir les objectifs actifs du joueur
|
||||
ObjectiveHistoryComponent history = store.getComponent(
|
||||
playerRef,
|
||||
ObjectiveHistoryComponent.getComponentType()
|
||||
);
|
||||
|
||||
// Verifier le statut de l'objectif
|
||||
ObjectiveHistoryData data = history.getObjectiveData("collect_wood");
|
||||
if (data != null && data.isCompleted()) {
|
||||
// Deja complete
|
||||
}
|
||||
```
|
||||
|
||||
### Completer des Objectifs
|
||||
|
||||
```java
|
||||
// Marquer l'objectif comme complete (declenche les completions)
|
||||
objective.complete(objectivePlugin);
|
||||
|
||||
// Annuler l'objectif sans recompenses
|
||||
objective.cancel(objectivePlugin);
|
||||
```
|
||||
|
||||
## Conditions de Declenchement
|
||||
|
||||
Les objectifs peuvent avoir des conditions de declenchement pour l'activation:
|
||||
|
||||
```java
|
||||
// Declencheur base sur la meteo
|
||||
public class WeatherTriggerCondition { /* ... */ }
|
||||
|
||||
// Declencheur base sur la position
|
||||
public class ObjectiveLocationTriggerCondition { /* ... */ }
|
||||
|
||||
// Declencheur base sur l'heure
|
||||
public class HourRangeTriggerCondition { /* ... */ }
|
||||
```
|
||||
|
||||
## Marqueurs de Position
|
||||
|
||||
Utilisez les marqueurs pour creer des objectifs spatiaux:
|
||||
|
||||
```java
|
||||
// Definir une zone de marqueur
|
||||
public interface ObjectiveLocationMarkerArea {
|
||||
boolean isInArea(Vector3d position);
|
||||
}
|
||||
|
||||
// Types de zones integres
|
||||
public class ObjectiveLocationAreaRadius { /* Zone spherique */ }
|
||||
public class ObjectiveLocationAreaBox { /* Zone boite */ }
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `/objective start <id> [joueur]` | Demarrer un objectif |
|
||||
| `/objective complete <id> [joueur]` | Forcer la completion |
|
||||
| `/objective history [joueur]` | Voir l'historique |
|
||||
| `/objective panel` | Ouvrir le panneau admin |
|
||||
|
||||
## Evenements
|
||||
|
||||
```java
|
||||
// Coffre au tresor ouvert pendant l'objectif
|
||||
public class TreasureChestOpeningEvent implements IEvent<UUID> {
|
||||
public TreasureChestState getChestState();
|
||||
public Player getPlayer();
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Les assets sont charges depuis le repertoire `Objectives/` avec support d'heritage:
|
||||
|
||||
```yaml
|
||||
# Objectives/config.yaml
|
||||
ObjectiveGameplayConfig:
|
||||
DefaultObjectives:
|
||||
- tutorial_quest
|
||||
- welcome_message
|
||||
```
|
||||
241
content/gameplay-systems/reputation.en.md
Normal file
241
content/gameplay-systems/reputation.en.md
Normal file
@@ -0,0 +1,241 @@
|
||||
---
|
||||
title: Reputation
|
||||
type: docs
|
||||
weight: 7
|
||||
---
|
||||
|
||||
The reputation system provides faction standing mechanics that affect NPC behavior and interactions.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.reputation`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
ReputationPlugin
|
||||
├── Assets
|
||||
│ ├── ReputationGroup - Faction definitions
|
||||
│ └── ReputationRank - Standing level definitions
|
||||
├── Components
|
||||
│ └── ReputationGroupComponent - NPC faction assignment
|
||||
├── Storage
|
||||
│ ├── ReputationDataResource - World-level storage
|
||||
│ └── PlayerConfigData - Player-level storage
|
||||
├── Requirements
|
||||
│ └── ReputationRequirement - Choice requirement
|
||||
├── Configuration
|
||||
│ └── ReputationGameplayConfig
|
||||
└── Commands
|
||||
└── ReputationCommand (value, set, add, rank)
|
||||
```
|
||||
|
||||
## Reputation Groups
|
||||
|
||||
Factions are defined as `ReputationGroup` assets:
|
||||
|
||||
```java
|
||||
public class ReputationGroup implements JsonAssetWithMap<String, DefaultAssetMap<String, ReputationGroup>> {
|
||||
protected String id;
|
||||
protected String[] npcGroups; // NPC groups in this faction
|
||||
protected int initialReputationValue; // Starting reputation
|
||||
}
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Reputation/Groups/`
|
||||
|
||||
### Group Configuration
|
||||
|
||||
```yaml
|
||||
# NPC/Reputation/Groups/village_faction.json
|
||||
{
|
||||
"Id": "village_faction",
|
||||
"NPCGroups": ["villagers", "guards"],
|
||||
"InitialReputationValue": 0
|
||||
}
|
||||
```
|
||||
|
||||
## Reputation Ranks
|
||||
|
||||
Standing levels defined as `ReputationRank` assets:
|
||||
|
||||
```java
|
||||
public class ReputationRank implements JsonAssetWithMap<String, DefaultAssetMap<String, ReputationRank>> {
|
||||
protected String id;
|
||||
protected int minValue;
|
||||
protected int maxValue;
|
||||
protected Attitude attitude; // NPC attitude at this rank
|
||||
}
|
||||
```
|
||||
|
||||
**Asset Location:** `NPC/Reputation/Ranks/`
|
||||
|
||||
### Rank Configuration
|
||||
|
||||
```yaml
|
||||
# NPC/Reputation/Ranks/friendly.json
|
||||
{
|
||||
"Id": "friendly",
|
||||
"MinValue": 50,
|
||||
"MaxValue": 100,
|
||||
"Attitude": "friendly"
|
||||
}
|
||||
```
|
||||
|
||||
## Storage Modes
|
||||
|
||||
Reputation can be stored per-player or per-world:
|
||||
|
||||
```java
|
||||
public enum ReputationStorageType {
|
||||
PerPlayer, // Each player has own reputation
|
||||
PerWorld // Shared world reputation
|
||||
}
|
||||
```
|
||||
|
||||
### Per-Player Storage
|
||||
|
||||
```java
|
||||
PlayerConfigData playerConfigData = player.getPlayerConfigData();
|
||||
Object2IntMap<String> reputationData = playerConfigData.getReputationData();
|
||||
```
|
||||
|
||||
### Per-World Storage
|
||||
|
||||
```java
|
||||
ReputationDataResource resource = world.getEntityStore().getStore()
|
||||
.getResource(ReputationPlugin.get().getReputationDataResourceType());
|
||||
Object2IntMap<String> worldReputation = resource.getReputationStats();
|
||||
```
|
||||
|
||||
## NPC Faction Assignment
|
||||
|
||||
### ReputationGroupComponent
|
||||
|
||||
Assigns NPCs to factions:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, ReputationGroupComponent> type =
|
||||
ReputationPlugin.get().getReputationGroupComponentType();
|
||||
|
||||
ReputationGroupComponent comp = store.getComponent(npcRef, type);
|
||||
String factionId = comp.getReputationGroupId();
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Changing Reputation
|
||||
|
||||
```java
|
||||
ReputationPlugin rep = ReputationPlugin.get();
|
||||
|
||||
// Change reputation with faction (returns new value)
|
||||
int newValue = rep.changeReputation(player, "village_faction", 10, componentAccessor);
|
||||
|
||||
// Change reputation via NPC reference
|
||||
int newValue = rep.changeReputation(player, npcRef, -5, componentAccessor);
|
||||
|
||||
// World-level reputation change
|
||||
int newValue = rep.changeReputation(world, "village_faction", 15);
|
||||
```
|
||||
|
||||
### Getting Reputation
|
||||
|
||||
```java
|
||||
// Get reputation value
|
||||
int value = rep.getReputationValue(store, playerRef, "village_faction");
|
||||
int value = rep.getReputationValue(store, playerRef, npcRef);
|
||||
|
||||
// Get reputation rank
|
||||
ReputationRank rank = rep.getReputationRank(store, playerRef, "village_faction");
|
||||
ReputationRank rank = rep.getReputationRankFromValue(value);
|
||||
|
||||
// Get NPC attitude based on reputation
|
||||
Attitude attitude = rep.getAttitude(store, playerRef, npcRef);
|
||||
```
|
||||
|
||||
## Choice Requirements
|
||||
|
||||
Use reputation as requirement for dialogue choices:
|
||||
|
||||
```java
|
||||
ChoiceRequirement.CODEC.register(
|
||||
"Reputation",
|
||||
ReputationRequirement.class,
|
||||
ReputationRequirement.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Choice Configuration
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Type": "Reputation",
|
||||
"FactionId": "village_faction",
|
||||
"MinRank": "friendly"
|
||||
}
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `/reputation` | Base reputation command |
|
||||
| `/reputation value <faction> [player]` | Show reputation value |
|
||||
| `/reputation set <faction> <value> [player]` | Set reputation |
|
||||
| `/reputation add <faction> <amount> [player]` | Add reputation |
|
||||
| `/reputation rank <faction> [player]` | Show current rank |
|
||||
|
||||
## Configuration
|
||||
|
||||
### Gameplay Config
|
||||
|
||||
```java
|
||||
public class ReputationGameplayConfig {
|
||||
ReputationStorageType reputationStorageType;
|
||||
|
||||
public static ReputationGameplayConfig getOrDefault(GameplayConfig config);
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
# gameplay_config.json
|
||||
{
|
||||
"Reputation": {
|
||||
"ReputationStorageType": "PerPlayer"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Related Plugins
|
||||
|
||||
### ObjectiveReputationPlugin
|
||||
|
||||
Rewards reputation on objective completion:
|
||||
|
||||
```java
|
||||
public class ReputationCompletion implements ObjectiveCompletion {
|
||||
// Awards reputation when objective completes
|
||||
}
|
||||
```
|
||||
|
||||
### NPCReputationPlugin
|
||||
|
||||
NPC attitude based on reputation:
|
||||
|
||||
```java
|
||||
public class ReputationAttitudeSystem {
|
||||
// Updates NPC attitude based on player reputation
|
||||
}
|
||||
```
|
||||
|
||||
### ShopReputationPlugin
|
||||
|
||||
Reputation-gated shop items.
|
||||
|
||||
## Validation
|
||||
|
||||
Ranks are validated on plugin start:
|
||||
|
||||
```java
|
||||
// Warns if gaps between rank ranges
|
||||
// Warns if rank ranges overlap
|
||||
```
|
||||
241
content/gameplay-systems/reputation.fr.md
Normal file
241
content/gameplay-systems/reputation.fr.md
Normal file
@@ -0,0 +1,241 @@
|
||||
---
|
||||
title: Reputation
|
||||
type: docs
|
||||
weight: 7
|
||||
---
|
||||
|
||||
Le systeme de reputation fournit des mecaniques de standing de faction qui affectent le comportement et les interactions des NPCs.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.reputation`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
ReputationPlugin
|
||||
├── Assets
|
||||
│ ├── ReputationGroup - Definitions de factions
|
||||
│ └── ReputationRank - Definitions de niveaux de standing
|
||||
├── Composants
|
||||
│ └── ReputationGroupComponent - Assignation faction NPC
|
||||
├── Stockage
|
||||
│ ├── ReputationDataResource - Stockage niveau monde
|
||||
│ └── PlayerConfigData - Stockage niveau joueur
|
||||
├── Requirements
|
||||
│ └── ReputationRequirement - Requirement de choix
|
||||
├── Configuration
|
||||
│ └── ReputationGameplayConfig
|
||||
└── Commandes
|
||||
└── ReputationCommand (value, set, add, rank)
|
||||
```
|
||||
|
||||
## Groupes de Reputation
|
||||
|
||||
Les factions sont definies comme assets `ReputationGroup`:
|
||||
|
||||
```java
|
||||
public class ReputationGroup implements JsonAssetWithMap<String, DefaultAssetMap<String, ReputationGroup>> {
|
||||
protected String id;
|
||||
protected String[] npcGroups; // Groupes NPC dans cette faction
|
||||
protected int initialReputationValue; // Reputation de depart
|
||||
}
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Reputation/Groups/`
|
||||
|
||||
### Configuration de Groupe
|
||||
|
||||
```yaml
|
||||
# NPC/Reputation/Groups/village_faction.json
|
||||
{
|
||||
"Id": "village_faction",
|
||||
"NPCGroups": ["villagers", "guards"],
|
||||
"InitialReputationValue": 0
|
||||
}
|
||||
```
|
||||
|
||||
## Rangs de Reputation
|
||||
|
||||
Niveaux de standing definis comme assets `ReputationRank`:
|
||||
|
||||
```java
|
||||
public class ReputationRank implements JsonAssetWithMap<String, DefaultAssetMap<String, ReputationRank>> {
|
||||
protected String id;
|
||||
protected int minValue;
|
||||
protected int maxValue;
|
||||
protected Attitude attitude; // Attitude NPC a ce rang
|
||||
}
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `NPC/Reputation/Ranks/`
|
||||
|
||||
### Configuration de Rang
|
||||
|
||||
```yaml
|
||||
# NPC/Reputation/Ranks/friendly.json
|
||||
{
|
||||
"Id": "friendly",
|
||||
"MinValue": 50,
|
||||
"MaxValue": 100,
|
||||
"Attitude": "friendly"
|
||||
}
|
||||
```
|
||||
|
||||
## Modes de Stockage
|
||||
|
||||
La reputation peut etre stockee par-joueur ou par-monde:
|
||||
|
||||
```java
|
||||
public enum ReputationStorageType {
|
||||
PerPlayer, // Chaque joueur a sa propre reputation
|
||||
PerWorld // Reputation monde partagee
|
||||
}
|
||||
```
|
||||
|
||||
### Stockage Par-Joueur
|
||||
|
||||
```java
|
||||
PlayerConfigData playerConfigData = player.getPlayerConfigData();
|
||||
Object2IntMap<String> reputationData = playerConfigData.getReputationData();
|
||||
```
|
||||
|
||||
### Stockage Par-Monde
|
||||
|
||||
```java
|
||||
ReputationDataResource resource = world.getEntityStore().getStore()
|
||||
.getResource(ReputationPlugin.get().getReputationDataResourceType());
|
||||
Object2IntMap<String> worldReputation = resource.getReputationStats();
|
||||
```
|
||||
|
||||
## Assignation Faction NPC
|
||||
|
||||
### ReputationGroupComponent
|
||||
|
||||
Assigne les NPCs aux factions:
|
||||
|
||||
```java
|
||||
ComponentType<EntityStore, ReputationGroupComponent> type =
|
||||
ReputationPlugin.get().getReputationGroupComponentType();
|
||||
|
||||
ReputationGroupComponent comp = store.getComponent(npcRef, type);
|
||||
String factionId = comp.getReputationGroupId();
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Changer la Reputation
|
||||
|
||||
```java
|
||||
ReputationPlugin rep = ReputationPlugin.get();
|
||||
|
||||
// Changer reputation avec faction (retourne nouvelle valeur)
|
||||
int newValue = rep.changeReputation(player, "village_faction", 10, componentAccessor);
|
||||
|
||||
// Changer reputation via reference NPC
|
||||
int newValue = rep.changeReputation(player, npcRef, -5, componentAccessor);
|
||||
|
||||
// Changement reputation niveau monde
|
||||
int newValue = rep.changeReputation(world, "village_faction", 15);
|
||||
```
|
||||
|
||||
### Obtenir la Reputation
|
||||
|
||||
```java
|
||||
// Obtenir valeur reputation
|
||||
int value = rep.getReputationValue(store, playerRef, "village_faction");
|
||||
int value = rep.getReputationValue(store, playerRef, npcRef);
|
||||
|
||||
// Obtenir rang reputation
|
||||
ReputationRank rank = rep.getReputationRank(store, playerRef, "village_faction");
|
||||
ReputationRank rank = rep.getReputationRankFromValue(value);
|
||||
|
||||
// Obtenir attitude NPC basee sur reputation
|
||||
Attitude attitude = rep.getAttitude(store, playerRef, npcRef);
|
||||
```
|
||||
|
||||
## Requirements de Choix
|
||||
|
||||
Utiliser la reputation comme requirement pour les choix de dialogue:
|
||||
|
||||
```java
|
||||
ChoiceRequirement.CODEC.register(
|
||||
"Reputation",
|
||||
ReputationRequirement.class,
|
||||
ReputationRequirement.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Configuration de Choix
|
||||
|
||||
```yaml
|
||||
{
|
||||
"Type": "Reputation",
|
||||
"FactionId": "village_faction",
|
||||
"MinRank": "friendly"
|
||||
}
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `/reputation` | Commande reputation de base |
|
||||
| `/reputation value <faction> [joueur]` | Afficher valeur reputation |
|
||||
| `/reputation set <faction> <valeur> [joueur]` | Definir reputation |
|
||||
| `/reputation add <faction> <montant> [joueur]` | Ajouter reputation |
|
||||
| `/reputation rank <faction> [joueur]` | Afficher rang actuel |
|
||||
|
||||
## Configuration
|
||||
|
||||
### Config Gameplay
|
||||
|
||||
```java
|
||||
public class ReputationGameplayConfig {
|
||||
ReputationStorageType reputationStorageType;
|
||||
|
||||
public static ReputationGameplayConfig getOrDefault(GameplayConfig config);
|
||||
}
|
||||
```
|
||||
|
||||
```yaml
|
||||
# gameplay_config.json
|
||||
{
|
||||
"Reputation": {
|
||||
"ReputationStorageType": "PerPlayer"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Plugins Lies
|
||||
|
||||
### ObjectiveReputationPlugin
|
||||
|
||||
Recompense reputation a la completion d'objectif:
|
||||
|
||||
```java
|
||||
public class ReputationCompletion implements ObjectiveCompletion {
|
||||
// Attribue reputation quand objectif complete
|
||||
}
|
||||
```
|
||||
|
||||
### NPCReputationPlugin
|
||||
|
||||
Attitude NPC basee sur reputation:
|
||||
|
||||
```java
|
||||
public class ReputationAttitudeSystem {
|
||||
// Met a jour attitude NPC basee sur reputation joueur
|
||||
}
|
||||
```
|
||||
|
||||
### ShopReputationPlugin
|
||||
|
||||
Items de boutique conditionnes par reputation.
|
||||
|
||||
## Validation
|
||||
|
||||
Les rangs sont valides au demarrage du plugin:
|
||||
|
||||
```java
|
||||
// Avertit si ecarts entre plages de rangs
|
||||
// Avertit si plages de rangs se chevauchent
|
||||
```
|
||||
195
content/gameplay-systems/shop.en.md
Normal file
195
content/gameplay-systems/shop.en.md
Normal file
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: Shop
|
||||
type: docs
|
||||
weight: 5
|
||||
---
|
||||
|
||||
The shop system provides trading and commerce through NPC shops and barter systems.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.shop`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
ShopPlugin
|
||||
├── Shop Types
|
||||
│ ├── ShopAsset - Static shop definitions
|
||||
│ └── BarterShopAsset - Dynamic barter shops
|
||||
├── Elements
|
||||
│ ├── ShopElement - Shop item entry
|
||||
│ └── ChoiceElement integration
|
||||
├── Interactions
|
||||
│ └── GiveItemInteraction
|
||||
├── Pages
|
||||
│ ├── ShopPage - Shop UI page
|
||||
│ ├── ShopPageSupplier
|
||||
│ └── BarterPage - Barter UI page
|
||||
└── State
|
||||
└── BarterShopState - Persistent barter state
|
||||
```
|
||||
|
||||
## Shop Types
|
||||
|
||||
### ShopAsset
|
||||
|
||||
Static shops with fixed content:
|
||||
|
||||
```java
|
||||
public class ShopAsset implements JsonAssetWithMap<String, DefaultAssetMap<String, ShopAsset>> {
|
||||
protected String id;
|
||||
protected ChoiceElement[] elements; // Shop items
|
||||
|
||||
public String getId();
|
||||
public ChoiceElement[] getElements();
|
||||
}
|
||||
```
|
||||
|
||||
**Asset Location:** `Shops/`
|
||||
|
||||
### BarterShopAsset
|
||||
|
||||
Dynamic shops with rotating trades:
|
||||
|
||||
```java
|
||||
public class BarterShopAsset implements JsonAssetWithMap<String, DefaultAssetMap<String, BarterShopAsset>> {
|
||||
// Barter-based trading with refresh mechanics
|
||||
}
|
||||
```
|
||||
|
||||
**Asset Location:** `BarterShops/`
|
||||
|
||||
## Shop Configuration
|
||||
|
||||
### Static Shop Example
|
||||
|
||||
```yaml
|
||||
# Shops/general_store.json
|
||||
{
|
||||
"Id": "general_store",
|
||||
"Content": [
|
||||
{
|
||||
"Type": "ShopElement",
|
||||
"Item": "bread",
|
||||
"Price": 5,
|
||||
"Currency": "gold_coin"
|
||||
},
|
||||
{
|
||||
"Type": "ShopElement",
|
||||
"Item": "torch",
|
||||
"Price": 2,
|
||||
"Currency": "gold_coin"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Barter Shop Components
|
||||
|
||||
```java
|
||||
public class BarterShopState {
|
||||
// Persistent state for barter shops
|
||||
public static void initialize(Path dataDirectory);
|
||||
public static void shutdown();
|
||||
}
|
||||
|
||||
public class TradeSlot { /* Base trade slot */ }
|
||||
public class FixedTradeSlot extends TradeSlot { /* Fixed trade */ }
|
||||
public class PoolTradeSlot extends TradeSlot { /* Random from pool */ }
|
||||
public class WeightedTrade { /* Weighted random trade */ }
|
||||
|
||||
public class BarterItemStack { /* Items for barter */ }
|
||||
public class BarterTrade { /* Complete trade definition */ }
|
||||
public class RefreshInterval { /* Trade refresh timing */ }
|
||||
```
|
||||
|
||||
## Shop Elements
|
||||
|
||||
### ShopElement
|
||||
|
||||
Registered as a choice element type:
|
||||
|
||||
```java
|
||||
getCodecRegistry(ChoiceElement.CODEC).register("ShopElement", ShopElement.class, ShopElement.CODEC);
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### GiveItemInteraction
|
||||
|
||||
Choice interaction that gives items to player:
|
||||
|
||||
```java
|
||||
getCodecRegistry(ChoiceInteraction.CODEC).register("GiveItem", GiveItemInteraction.class, GiveItemInteraction.CODEC);
|
||||
```
|
||||
|
||||
## UI Integration
|
||||
|
||||
### Shop Page
|
||||
|
||||
Custom UI page for shops:
|
||||
|
||||
```java
|
||||
getCodecRegistry(OpenCustomUIInteraction.PAGE_CODEC).register(
|
||||
"Shop",
|
||||
ShopPageSupplier.class,
|
||||
ShopPageSupplier.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Opening a Shop
|
||||
|
||||
```yaml
|
||||
# Interaction definition
|
||||
{
|
||||
"Type": "OpenCustomUI",
|
||||
"Page": {
|
||||
"Type": "Shop",
|
||||
"ShopId": "general_store"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## API Usage
|
||||
|
||||
### Getting Shop Assets
|
||||
|
||||
```java
|
||||
// Get shop asset store
|
||||
AssetStore<String, ShopAsset, DefaultAssetMap<String, ShopAsset>> store =
|
||||
ShopAsset.getAssetStore();
|
||||
|
||||
// Get specific shop
|
||||
ShopAsset shop = ShopAsset.getAssetMap().getAsset("general_store");
|
||||
|
||||
// Get barter shop
|
||||
BarterShopAsset barterShop = BarterShopAsset.getAssetMap().getAsset("traveling_merchant");
|
||||
```
|
||||
|
||||
### Shop Plugin Instance
|
||||
|
||||
```java
|
||||
ShopPlugin shop = ShopPlugin.get();
|
||||
```
|
||||
|
||||
## Barter State Persistence
|
||||
|
||||
Barter shop state is saved/loaded automatically:
|
||||
|
||||
```java
|
||||
// Called in start()
|
||||
BarterShopState.initialize(this.getDataDirectory());
|
||||
|
||||
// Called in shutdown()
|
||||
BarterShopState.shutdown();
|
||||
```
|
||||
|
||||
## Asset Dependencies
|
||||
|
||||
Shops load after items:
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(ShopAsset.class, new DefaultAssetMap())
|
||||
.setPath("Shops")
|
||||
.loadsAfter(Item.class) // Ensure items are loaded first
|
||||
.build();
|
||||
```
|
||||
195
content/gameplay-systems/shop.fr.md
Normal file
195
content/gameplay-systems/shop.fr.md
Normal file
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: Boutique
|
||||
type: docs
|
||||
weight: 5
|
||||
---
|
||||
|
||||
Le systeme de boutique fournit le commerce via des boutiques NPC et des systemes de troc.
|
||||
|
||||
**Package:** `com.hypixel.hytale.builtin.adventure.shop`
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
ShopPlugin
|
||||
├── Types de Boutique
|
||||
│ ├── ShopAsset - Definitions boutique statiques
|
||||
│ └── BarterShopAsset - Boutiques de troc dynamiques
|
||||
├── Elements
|
||||
│ ├── ShopElement - Entree item boutique
|
||||
│ └── Integration ChoiceElement
|
||||
├── Interactions
|
||||
│ └── GiveItemInteraction
|
||||
├── Pages
|
||||
│ ├── ShopPage - Page UI boutique
|
||||
│ ├── ShopPageSupplier
|
||||
│ └── BarterPage - Page UI troc
|
||||
└── Etat
|
||||
└── BarterShopState - Etat troc persistant
|
||||
```
|
||||
|
||||
## Types de Boutique
|
||||
|
||||
### ShopAsset
|
||||
|
||||
Boutiques statiques avec contenu fixe:
|
||||
|
||||
```java
|
||||
public class ShopAsset implements JsonAssetWithMap<String, DefaultAssetMap<String, ShopAsset>> {
|
||||
protected String id;
|
||||
protected ChoiceElement[] elements; // Items boutique
|
||||
|
||||
public String getId();
|
||||
public ChoiceElement[] getElements();
|
||||
}
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `Shops/`
|
||||
|
||||
### BarterShopAsset
|
||||
|
||||
Boutiques dynamiques avec echanges rotatifs:
|
||||
|
||||
```java
|
||||
public class BarterShopAsset implements JsonAssetWithMap<String, DefaultAssetMap<String, BarterShopAsset>> {
|
||||
// Trading base sur le troc avec mecanique de rafraichissement
|
||||
}
|
||||
```
|
||||
|
||||
**Emplacement Asset:** `BarterShops/`
|
||||
|
||||
## Configuration de Boutique
|
||||
|
||||
### Exemple Boutique Statique
|
||||
|
||||
```yaml
|
||||
# Shops/general_store.json
|
||||
{
|
||||
"Id": "general_store",
|
||||
"Content": [
|
||||
{
|
||||
"Type": "ShopElement",
|
||||
"Item": "bread",
|
||||
"Price": 5,
|
||||
"Currency": "gold_coin"
|
||||
},
|
||||
{
|
||||
"Type": "ShopElement",
|
||||
"Item": "torch",
|
||||
"Price": 2,
|
||||
"Currency": "gold_coin"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Composants Boutique Troc
|
||||
|
||||
```java
|
||||
public class BarterShopState {
|
||||
// Etat persistant pour boutiques de troc
|
||||
public static void initialize(Path dataDirectory);
|
||||
public static void shutdown();
|
||||
}
|
||||
|
||||
public class TradeSlot { /* Slot d'echange de base */ }
|
||||
public class FixedTradeSlot extends TradeSlot { /* Echange fixe */ }
|
||||
public class PoolTradeSlot extends TradeSlot { /* Aleatoire depuis pool */ }
|
||||
public class WeightedTrade { /* Echange aleatoire pondere */ }
|
||||
|
||||
public class BarterItemStack { /* Items pour troc */ }
|
||||
public class BarterTrade { /* Definition complete d'echange */ }
|
||||
public class RefreshInterval { /* Timing de rafraichissement */ }
|
||||
```
|
||||
|
||||
## Elements de Boutique
|
||||
|
||||
### ShopElement
|
||||
|
||||
Enregistre comme type d'element de choix:
|
||||
|
||||
```java
|
||||
getCodecRegistry(ChoiceElement.CODEC).register("ShopElement", ShopElement.class, ShopElement.CODEC);
|
||||
```
|
||||
|
||||
## Interactions
|
||||
|
||||
### GiveItemInteraction
|
||||
|
||||
Interaction de choix qui donne des items au joueur:
|
||||
|
||||
```java
|
||||
getCodecRegistry(ChoiceInteraction.CODEC).register("GiveItem", GiveItemInteraction.class, GiveItemInteraction.CODEC);
|
||||
```
|
||||
|
||||
## Integration UI
|
||||
|
||||
### Page Boutique
|
||||
|
||||
Page UI personnalisee pour boutiques:
|
||||
|
||||
```java
|
||||
getCodecRegistry(OpenCustomUIInteraction.PAGE_CODEC).register(
|
||||
"Shop",
|
||||
ShopPageSupplier.class,
|
||||
ShopPageSupplier.CODEC
|
||||
);
|
||||
```
|
||||
|
||||
### Ouvrir une Boutique
|
||||
|
||||
```yaml
|
||||
# Definition d'interaction
|
||||
{
|
||||
"Type": "OpenCustomUI",
|
||||
"Page": {
|
||||
"Type": "Shop",
|
||||
"ShopId": "general_store"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Utilisation de l'API
|
||||
|
||||
### Obtenir les Assets Boutique
|
||||
|
||||
```java
|
||||
// Obtenir le store d'assets boutique
|
||||
AssetStore<String, ShopAsset, DefaultAssetMap<String, ShopAsset>> store =
|
||||
ShopAsset.getAssetStore();
|
||||
|
||||
// Obtenir boutique specifique
|
||||
ShopAsset shop = ShopAsset.getAssetMap().getAsset("general_store");
|
||||
|
||||
// Obtenir boutique troc
|
||||
BarterShopAsset barterShop = BarterShopAsset.getAssetMap().getAsset("traveling_merchant");
|
||||
```
|
||||
|
||||
### Instance Plugin Boutique
|
||||
|
||||
```java
|
||||
ShopPlugin shop = ShopPlugin.get();
|
||||
```
|
||||
|
||||
## Persistance Etat Troc
|
||||
|
||||
L'etat des boutiques de troc est sauvegarde/charge automatiquement:
|
||||
|
||||
```java
|
||||
// Appele dans start()
|
||||
BarterShopState.initialize(this.getDataDirectory());
|
||||
|
||||
// Appele dans shutdown()
|
||||
BarterShopState.shutdown();
|
||||
```
|
||||
|
||||
## Dependances d'Assets
|
||||
|
||||
Les boutiques chargent apres les items:
|
||||
|
||||
```java
|
||||
HytaleAssetStore.builder(ShopAsset.class, new DefaultAssetMap())
|
||||
.setPath("Shops")
|
||||
.loadsAfter(Item.class) // Assurer que items sont charges d'abord
|
||||
.build();
|
||||
```
|
||||
Reference in New Issue
Block a user