mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-02 16:49:10 +00:00
Changed how subscripts work
This commit is contained in:
+1
-3
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package scriptfactory.Actions;
|
||||
|
||||
import scriptfactory.Strategies.ActionExecutor;
|
||||
import scriptfactory.VarsMethods;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static scriptfactory.VarsMethods.*;
|
||||
|
||||
public class SubscriptHandler {
|
||||
public static void runSubscript(String path)
|
||||
{
|
||||
ArrayList<Action> actions = new ArrayList<>();
|
||||
File subscriptFile = new File(DEFAULT_DIR + FSEP + path);
|
||||
if (subscriptFile.exists())
|
||||
loadscript(actions, subscriptFile);
|
||||
else
|
||||
loadscript(actions, new File(DEFAULT_DIR + FSEP + "dependencies" + FSEP + path));
|
||||
ActionExecutor executor = new ActionExecutor(actions);
|
||||
|
||||
VarsMethods.currentSubscript = path;
|
||||
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
executor.execute();
|
||||
}
|
||||
|
||||
VarsMethods.currentSubscript = "";
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import static scriptfactory.VarsMethods.log;
|
||||
* Welcome to AIO AIO - ScriptFactory. Make your own scripts!
|
||||
*/
|
||||
|
||||
@ScriptManifest(author = "Before", name = "Script Factory 1.7", category = Category.OTHER, version = 1.7, description = "Create your own scripts!", servers = "All")
|
||||
@ScriptManifest(author = "Before", name = "Script Factory 1.8", category = Category.OTHER, version = 1.8, description = "Create your own scripts!", servers = "All")
|
||||
public class Core extends Script implements Paintable {
|
||||
|
||||
private ArrayList<Action> actions = new ArrayList<>();
|
||||
|
||||
@@ -6,14 +6,14 @@ import scriptfactory.Actions.Logic.Endif;
|
||||
import scriptfactory.Actions.Logic.If;
|
||||
import scriptfactory.Actions.Logic.IfNot;
|
||||
import scriptfactory.Actions.Logic.LogicHandler;
|
||||
import scriptfactory.Actions.SubscriptHandler;
|
||||
import scriptfactory.VarsMethods;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Stack;
|
||||
|
||||
import static scriptfactory.VarsMethods.log;
|
||||
import static scriptfactory.VarsMethods.*;
|
||||
|
||||
public class ActionExecutor {
|
||||
private ArrayList<Action> actions;
|
||||
@@ -109,7 +109,8 @@ public class ActionExecutor {
|
||||
actionHandler.walkTo(action);
|
||||
break;
|
||||
case "Run subscript":
|
||||
SubscriptHandler.runSubscript(action.getParamAsString(0));
|
||||
insertSubscript(action, actions, action.getParamAsString(0));
|
||||
lineIndex = --lineIndex == -1 ? actions.size()-1 : lineIndex; //Rerun the last line, which now contains start of subscript
|
||||
break;
|
||||
case "Bank all except IDs":
|
||||
actionHandler.bankAllExcept(action);
|
||||
@@ -122,4 +123,26 @@ public class ActionExecutor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void insertSubscript(Action action, ArrayList<Action> actions, String path) {
|
||||
int actionIndex = -1;
|
||||
//Find where to insert the subscript
|
||||
for (int i = 0; i < actions.size(); i++)
|
||||
if (actions.get(i).equals(action))
|
||||
actionIndex = i;
|
||||
|
||||
//Load subscript into array
|
||||
ArrayList<Action> subscriptActions = new ArrayList<>();
|
||||
File subscriptFile = new File(DEFAULT_DIR + FSEP + path);
|
||||
if (subscriptFile.exists())
|
||||
loadscript(subscriptActions, subscriptFile);
|
||||
else
|
||||
loadscript(subscriptActions, new File(DEFAULT_DIR + FSEP + "dependencies" + FSEP + path));
|
||||
|
||||
//Insert subscript array into original script array
|
||||
actions.remove(actionIndex);
|
||||
for (int i = 0; i < subscriptActions.size(); i++) {
|
||||
actions.add(actionIndex + i, subscriptActions.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project name="allatori">
|
||||
<target name="allatori">
|
||||
<taskdef name="allatori" classname="com.allatori.ant.ObfuscatorTask" classpath="${user.home}/allatori/allatori.jar"/>
|
||||
<allatori config="src/main/resources/config.xml"/>
|
||||
<echo message="Obfuscating script"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<config>
|
||||
<jars basedir="/home/dr_cookie/Projects/ScriptFactory3/target/">
|
||||
<jar in="1000202.jar" out="/home/ci/jars/1000202.jar"/>
|
||||
</jars>
|
||||
|
||||
<classpath basedir="/home/ci/allatori/libs">
|
||||
<jar name="./*.jar"/>
|
||||
</classpath>
|
||||
|
||||
<!-- String encryption -->
|
||||
<property name="string-encryption" value="enable"/>
|
||||
<property name="string-encryption-type" value="fast"/>
|
||||
<property name="string-encryption-version" value="v4"/>
|
||||
|
||||
<!-- Control flow obfuscation -->
|
||||
<property name="control-flow-obfuscation" value="enable"/>
|
||||
<property name="extensive-flow-obfuscation" value="normal"/>
|
||||
|
||||
<!-- Renaming -->
|
||||
<property name="default-package" value=""/>
|
||||
<property name="force-default-package" value="disable"/>
|
||||
|
||||
<property name="classes-naming" value="unique"/>
|
||||
<property name="methods-naming" value="iii"/>
|
||||
<property name="fields-naming" value="iii"/>
|
||||
<property name="local-variables-naming" value="abc"/>
|
||||
|
||||
<!-- Other -->
|
||||
<property name="line-numbers" value="keep"/>
|
||||
<property name="generics" value="keep"/>
|
||||
<property name="member-reorder" value="enable"/>
|
||||
<property name="finalize" value="disable"/>
|
||||
<property name="synthetize-methods" value="private"/>
|
||||
<property name="synthetize-fields" value="private"/>
|
||||
<property name="remove-toString" value="disable"/>
|
||||
</config>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user