From 6bc9d4df9d2c843e94afaceef1e502c2e2091074 Mon Sep 17 00:00:00 2001 From: Samy Avrillon Date: Sun, 20 Oct 2024 19:55:36 +0200 Subject: [PATCH] Des bouts de code faits ... ouais --- .../greposimu/model/game/Building.java | 26 ++++++ .../greposimu/model/runtime/Alliance.java | 5 ++ .../greposimu/model/runtime/Joueureuse.java | 9 ++ .../model/runtime/PositionVille.java | 8 ++ .../greposimu/model/runtime/Timestamp.java | 7 ++ .../greposimu/model/runtime/Ville.java | 18 ++++ .../greposimu/model/simulator/Joueureuse.java | 32 +++++++ .../greposimu/model/simulator/Troupes.java | 9 ++ .../greposimu/model/simulator/Ville.java | 88 +++++++++++++++++++ src/main/resources/greposource.js | 11 +++ 10 files changed, 213 insertions(+) create mode 100644 src/main/java/com/bernard/greposimu/model/game/Building.java create mode 100644 src/main/java/com/bernard/greposimu/model/runtime/Alliance.java create mode 100644 src/main/java/com/bernard/greposimu/model/runtime/Joueureuse.java create mode 100644 src/main/java/com/bernard/greposimu/model/runtime/PositionVille.java create mode 100644 src/main/java/com/bernard/greposimu/model/runtime/Timestamp.java create mode 100644 src/main/java/com/bernard/greposimu/model/runtime/Ville.java create mode 100644 src/main/java/com/bernard/greposimu/model/simulator/Joueureuse.java create mode 100644 src/main/java/com/bernard/greposimu/model/simulator/Troupes.java create mode 100644 src/main/java/com/bernard/greposimu/model/simulator/Ville.java create mode 100644 src/main/resources/greposource.js diff --git a/src/main/java/com/bernard/greposimu/model/game/Building.java b/src/main/java/com/bernard/greposimu/model/game/Building.java new file mode 100644 index 0000000..657d743 --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/game/Building.java @@ -0,0 +1,26 @@ +package com.bernard.greposimu.model.game; + +public enum Building { + AGORA, + SENAT, + SCIERIE, + FERME, + CARRIERE, + ENTREPOT, + MINE, + CASERNE, + TEMPLE, + MARCHE, + PORT, + ACADEMIE, + REMPARTS, + GROTTE, + THEATRE, + THERMES, + BIBLIOTHEQUE, + PHARE, + TOUR, + STATUE, + ORACLE, + COMPTOIR; +} diff --git a/src/main/java/com/bernard/greposimu/model/runtime/Alliance.java b/src/main/java/com/bernard/greposimu/model/runtime/Alliance.java new file mode 100644 index 0000000..fdda318 --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/runtime/Alliance.java @@ -0,0 +1,5 @@ +package com.bernard.greposimu.model.runtime; + +public class Alliance { + +} diff --git a/src/main/java/com/bernard/greposimu/model/runtime/Joueureuse.java b/src/main/java/com/bernard/greposimu/model/runtime/Joueureuse.java new file mode 100644 index 0000000..0931cae --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/runtime/Joueureuse.java @@ -0,0 +1,9 @@ +package com.bernard.greposimu.model.runtime; + +public class Joueureuse { + + String nom; + Alliance alliance; + int points; + +} diff --git a/src/main/java/com/bernard/greposimu/model/runtime/PositionVille.java b/src/main/java/com/bernard/greposimu/model/runtime/PositionVille.java new file mode 100644 index 0000000..c274fc5 --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/runtime/PositionVille.java @@ -0,0 +1,8 @@ +package com.bernard.greposimu.model.runtime; + +public class PositionVille { + + int ileId; + int x,y,nr,ex,ey,fx,fy; + +} diff --git a/src/main/java/com/bernard/greposimu/model/runtime/Timestamp.java b/src/main/java/com/bernard/greposimu/model/runtime/Timestamp.java new file mode 100644 index 0000000..e881cdc --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/runtime/Timestamp.java @@ -0,0 +1,7 @@ +package com.bernard.greposimu.model.runtime; + +public class Timestamp { + + long timestamp; + +} diff --git a/src/main/java/com/bernard/greposimu/model/runtime/Ville.java b/src/main/java/com/bernard/greposimu/model/runtime/Ville.java new file mode 100644 index 0000000..9318b6f --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/runtime/Ville.java @@ -0,0 +1,18 @@ +package com.bernard.greposimu.model.runtime; + +import com.bernard.greposimu.model.game.Resources; + +public class Ville { + + int id; + + // null -> Ville fantôme + Joueureuse proprietaire; + + PositionVille ville; + + Resources resources; + + Map batiments + +} diff --git a/src/main/java/com/bernard/greposimu/model/simulator/Joueureuse.java b/src/main/java/com/bernard/greposimu/model/simulator/Joueureuse.java new file mode 100644 index 0000000..9d888f5 --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/simulator/Joueureuse.java @@ -0,0 +1,32 @@ +package com.bernard.greposimu.model.simulator; + +import java.util.List; +import java.util.Map; + +import com.bernard.greposimu.model.game.God; +import com.bernard.greposimu.model.runtime.Timestamp; + +public class Joueureuse { + + // God + Map favor; + int rage; + + int gold; + + // Heroes + // herosId -> townId + Map heroes; + // herosId -> timeOfArrival + Map heroesArrival; + // herosid -> level + Map heroesLevel; + + List inventory; + + //TODO quêtes + //TODO messages/rapports + //TODO profile + //TODO alliance + allianceMessages + +} diff --git a/src/main/java/com/bernard/greposimu/model/simulator/Troupes.java b/src/main/java/com/bernard/greposimu/model/simulator/Troupes.java new file mode 100644 index 0000000..6eed530 --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/simulator/Troupes.java @@ -0,0 +1,9 @@ +package com.bernard.greposimu.model.simulator; + +import java.util.Map; + +public class Troupes { + + Map unites; + +} diff --git a/src/main/java/com/bernard/greposimu/model/simulator/Ville.java b/src/main/java/com/bernard/greposimu/model/simulator/Ville.java new file mode 100644 index 0000000..e748d7d --- /dev/null +++ b/src/main/java/com/bernard/greposimu/model/simulator/Ville.java @@ -0,0 +1,88 @@ +package com.bernard.greposimu.model.simulator; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bernard.greposimu.model.game.God; +import com.bernard.greposimu.model.game.Resources; +import com.bernard.greposimu.model.runtime.Timestamp; + +public class Ville { + int id; + String nom; + + Map batiments; + + Troupes troupes; + + // origin town id -> troupes + Map soutiens; + + // Destination town -> troupes + Map soutenus; + + // sortilegeId -> effectEnd + Map sortileges; + + // Agora + Timestamp festivalEnd,olympiquesEnd,marchEnd,theaterEnd; + + // Academie + Set researches; + List researchQueue; + + // Senat + List buildingQueue; + + // Farm + Timestamp miliceAppel; + + // Entrepôt + Resources storage; + + // Caserne + List terrestrialQueue; + + // Temple + God god; + + // Port + List navalQueue; + + // Remparts + Troupes slainAsOff,slainAsDef,lostAsOff,lostAsDef; + + // Grotte + int piecesStoquees; + + /* Ordres */ + Set ordresMilitaires; + Set incomingTrade; + Set outgoingTrade; + + public static class TradeOrder { + Resources resources; + Integer other; + } + public static class UnitOrder { + Troupes attq; + Timestamp arrivee; + OrderType type; + Set sortileges; + } + public static enum OrderType { + ATTACK, + SUPPORT, + ATTACK_CANCELED, + ATTACK_RETURN; + } + + public static class QueueItem { + String buildingId; + Timestamp startTime; + Timestamp endTime; + long duration; + } + +} diff --git a/src/main/resources/greposource.js b/src/main/resources/greposource.js new file mode 100644 index 0000000..7b07819 --- /dev/null +++ b/src/main/resources/greposource.js @@ -0,0 +1,11 @@ +out = {} +for(var townid in ITowns.towns) { + out[townid] = {} + out[townid].units = ITowns.towns[townid].units() + out[townid].support = ITowns.towns[townid].unitsSupport() + out[townid].outer = ITowns.towns[townid].unitsOuter() + out[townid].resources = ITowns.towns[townid].resources() + out[townid].buildings = ITowns.towns[townid].buildings().getBuildings() + out[townid].researches = ITowns.towns[townid].researches().attributes +} +var json = JSON.stringify(out) \ No newline at end of file