Init
This commit is contained in:
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
|
||||
```
|
||||
Reference in New Issue
Block a user