World config and inventories

This commit is contained in:
Mysaa Java
2026-10-08 11:46:28 +02:00
parent 466da86969
commit 741f60bb3b
24 changed files with 976 additions and 352 deletions
@@ -8,7 +8,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bernard.nodecames.model.Game;
import com.bernard.nodecames.model.GridConfig.MutableOption;
import io.github.archipelagomw.APResult.ResultCode;
import io.github.archipelagomw.Client;
@@ -37,57 +36,11 @@ public class ArchipelagoClient extends Client {
}
@ArchipelagoEventListener
public void onReceiveItem(ReceiveItemEvent e) throws IllegalGameActionException {
public void onReceiveItem(ReceiveItemEvent e) {
log.debug("Received item : {}", e.getItemName());
switch(e.getItemName()) {
case "progressive_hint_count":
gm.unlockMoreHintCount(this.game);
break;
case "progressive_hint_word_length":
gm.unlockMoreHintWordLengthCount(this.game);
break;
case "progressive_hint_word_count":
gm.unlockMoreHintWordCount(this.game);
break;
case "zero_hint":
gm.unlockHintWordCount(this.game, 0);
break;
case "infinity_hint":
gm.unlockHintWordCount(this.game, -1);
break;
case "one_more_guess":
gm.unlockMutable(game, MutableOption.ONE_MORE_GUESS, true);
break;
case "end_guessing":
gm.unlockMutable(game, MutableOption.END_GUESSING, true);
break;
case "only_one_green_green":
gm.unlockMutable(game, MutableOption.ONLY_ONE_GREEN_GREEN, true);
break;
case "sudden_death":
gm.unlockMutable(game, MutableOption.SUDDEN_DEATH, true);
break;
case "structured_grid":
gm.unlockStructuredGrid(game);
break;
case "hints_in_a_row":
gm.unlockMutable(game, MutableOption.HINTS_IN_A_ROW, true);
break;
case "anyone_starts":
gm.unlockAnyoneCanStart(game);
break;
case "filler":
// We do nothing if we receive a filler item
break;
default:
if (e.getItemName().startsWith("unlock_world_")) {
int worldIndex = Integer.parseInt(e.getItemName().substring("unlock_world_".length()))-1;
String worldName = "%d-%d".formatted((worldIndex/3)+1, (worldIndex%3)+1);
gm.unlockWorld(game, worldName);
} else {
throw new IllegalArgumentException("Received unknown item : "+e.getItemName());
}
}
if(e.getIndex() > game.getInventory().getReceivedItems().size())
gm.giveItem(game, e.getItemName());
// Else, the item has already been received
}
@Getter