Skip to content

Commit

Permalink
Merge branch 'develop' into 2ndJoker
Browse files Browse the repository at this point in the history
  • Loading branch information
bubblobill authored Dec 12, 2023
2 parents 2194a2a + 07a28f9 commit ebc989a
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.swing.*;
import net.rptools.maptool.client.AppPreferences;
import net.rptools.maptool.client.MapTool;
import net.rptools.maptool.client.MapToolExpressionParser;
import net.rptools.maptool.client.ui.htmlframe.HTMLDialog;
import net.rptools.maptool.client.ui.htmlframe.HTMLFrame;
import net.rptools.maptool.client.ui.htmlframe.HTMLOverlayManager;
Expand Down Expand Up @@ -105,12 +106,30 @@ public Object childEvaluate(
return getThemeInfo();
} else if (infoType.equalsIgnoreCase("debug")) {
return getDebugInfo();
} else if (infoType.equalsIgnoreCase("functions")) {
return getFunctionLists();
} else {
throw new ParserException(
I18N.getText("macro.function.getInfo.invalidArg", param.get(0).toString()));
}
}

private JsonObject getFunctionLists() {
UserDefinedMacroFunctions UDF = UserDefinedMacroFunctions.getInstance();
JsonObject udfList = new JsonObject();
for (String name : UDF.getAliases()) {
udfList.addProperty(name, UDF.getFunctionLocation(name));
}
JsonArray fList = new JsonArray();
MapToolExpressionParser.getMacroFunctions()
.forEach(function -> Arrays.stream(function.getAliases()).forEach(fList::add));

JsonObject fInfo = new JsonObject();
fInfo.add("functions", fList);
fInfo.add("user defined functions", udfList);
return fInfo;
}

/**
* Retrieves the information about the current zone/map and returns it as a JSON Object.
*
Expand Down

0 comments on commit ebc989a

Please sign in to comment.