From a995252a96a13f574877f94309bab7dbb8ea9e26 Mon Sep 17 00:00:00 2001
From: ColdAnkles <13864745+ColdAnkles@users.noreply.github.com>
Date: Wed, 28 Aug 2024 18:47:30 +0930
Subject: [PATCH 01/21] Beginnings of Token Footprints as Campaign Properties.
---
.../client/MapToolExpressionParser.java | 2 +
.../client/functions/FootprintFunctions.java | 159 ++++++++++++++++++
.../maptool/model/CampaignProperties.java | 24 +++
.../rptools/maptool/model/GridlessGrid.java | 11 +-
.../maptool/model/HexGridHorizontal.java | 11 +-
.../maptool/model/HexGridVertical.java | 11 +-
.../rptools/maptool/model/IsometricGrid.java | 11 +-
.../net/rptools/maptool/model/SquareGrid.java | 11 +-
src/main/proto/data_transfer_objects.proto | 11 ++
9 files changed, 241 insertions(+), 10 deletions(-)
create mode 100644 src/main/java/net/rptools/maptool/client/functions/FootprintFunctions.java
diff --git a/src/main/java/net/rptools/maptool/client/MapToolExpressionParser.java b/src/main/java/net/rptools/maptool/client/MapToolExpressionParser.java
index 1a7d432bcd..4b99e74b39 100644
--- a/src/main/java/net/rptools/maptool/client/MapToolExpressionParser.java
+++ b/src/main/java/net/rptools/maptool/client/MapToolExpressionParser.java
@@ -19,6 +19,7 @@
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import main.java.net.rptools.maptool.client.functions.FootprintFunctions; // why
import net.rptools.dicelib.expression.ExpressionParser;
import net.rptools.maptool.client.functions.*;
import net.rptools.maptool.client.functions.json.JSONMacroFunctions;
@@ -105,6 +106,7 @@ public class MapToolExpressionParser extends ExpressionParser {
TestFunctions.getInstance(),
TextLabelFunctions.getInstance(),
TokenSpeechNameFunction.getInstance(),
+ FootprintFunctions.getInstance(),
new MarkDownFunctions(),
new PlayerFunctions(),
new LibraryFunctions(),
diff --git a/src/main/java/net/rptools/maptool/client/functions/FootprintFunctions.java b/src/main/java/net/rptools/maptool/client/functions/FootprintFunctions.java
new file mode 100644
index 0000000000..dfbd7155fc
--- /dev/null
+++ b/src/main/java/net/rptools/maptool/client/functions/FootprintFunctions.java
@@ -0,0 +1,159 @@
+/*
+ * This software Copyright by the RPTools.net development team, and
+ * licensed under the Affero GPL Version 3 or, at your option, any later
+ * version.
+ *
+ * MapTool Source Code is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License * along with this source Code. If not, please visit
+ * and specifically the Affero license
+ * text at .
+ */
+package main.java.net.rptools.maptool.client.functions;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Objects;
+import java.util.regex.PatternSyntaxException;
+import net.rptools.maptool.client.functions.exceptions.*;
+import net.rptools.maptool.model.CellPoint;
+import net.rptools.maptool.model.Grid;
+import net.rptools.maptool.model.GridFactory;
+import net.rptools.maptool.model.TokenFootprint;
+import net.rptools.parser.Parser;
+import net.rptools.parser.ParserException;
+import net.rptools.parser.VariableResolver;
+import net.rptools.parser.function.AbstractFunction;
+
+/**
+ * functions for dealing with token footprint retrieval and modification.
+ *
+ * @author cold_ankles
+ */
+public class FootprintFunctions extends AbstractFunction {
+ public FootprintFunctions() {
+ super(0, 2, "getTokenFootprint", "setTokenFootprint", "getFootprintNames", "getGridTypes");
+ }
+
+ /** The singleton instance. */
+ private static final FootprintFunctions instance = new FootprintFunctions();
+
+ /**
+ * Gets the instance.
+ *
+ * @return the instance.
+ */
+ public static FootprintFunctions getInstance() {
+ return instance;
+ }
+
+ @Override
+ public Object childEvaluate(
+ Parser parser, VariableResolver resolver, String functionName, List