Update paint, Add XP per hour gained

This commit is contained in:
RedSparr0w
2019-12-02 10:39:24 +13:00
parent 218267e28b
commit 7f90d2a629
18 changed files with 75 additions and 65 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
<module name="script-factory" target="1.8" /> <module name="script-factory" target="1.7" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>
</project> </project>
@@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.parabot:317-api-minified:1.21.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3-sources.jar!/" />
</SOURCES>
</library>
</component>
-13
View File
@@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.parabot:client:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.parabot:internal-api:1.52.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1-sources.jar!/" />
</SOURCES>
</library>
</component>
+2 -2
View File
@@ -22,12 +22,12 @@
<dependency> <dependency>
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>client</artifactId> <artifactId>client</artifactId>
<version>2.7</version> <version>2.8.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>317-api-minified</artifactId> <artifactId>317-api-minified</artifactId>
<version>1.21.3</version> <version>1.21.5</version>
</dependency> </dependency>
</dependencies> </dependencies>
+6 -4
View File
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
@@ -9,10 +11,10 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.parabot:client:2.7" level="project" /> <orderEntry type="library" name="Maven: org.parabot:client:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" /> <orderEntry type="library" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" /> <orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.parabot:internal-api:1.52.1" level="project" /> <orderEntry type="library" name="Maven: org.parabot:internal-api:1.53.1" level="project" />
<orderEntry type="library" name="Maven: org.parabot:317-api-minified:1.21.3" level="project" /> <orderEntry type="library" name="Maven: org.parabot:317-api-minified:1.21.5" level="project" />
</component> </component>
</module> </module>
+32 -14
View File
@@ -1,5 +1,6 @@
package scriptfactory; package scriptfactory;
import org.parabot.environment.api.utils.Timer;
import scriptfactory.GUI.GUI; import scriptfactory.GUI.GUI;
import scriptfactory.Strategies.RunLoop; import scriptfactory.Strategies.RunLoop;
import scriptfactory.Actions.Action; import scriptfactory.Actions.Action;
@@ -20,13 +21,14 @@ import static scriptfactory.VarsMethods.log;
* Welcome to AIO AIO - ScriptFactory. Make your own scripts! * Welcome to AIO AIO - ScriptFactory. Make your own scripts!
*/ */
@ScriptManifest(author = "Before", name = "Script Factory 1.9", category = Category.OTHER, version = 1.9, description = "Create your own scripts!", servers = "All") @ScriptManifest(author = "Before", name = "Script Factory 1.10", category = Category.OTHER, version = 1.10, description = "Create your own scripts!", servers = "All")
public class Core extends Script implements Paintable { public class Core extends Script implements Paintable {
private ArrayList<Action> actions = new ArrayList<>(); private ArrayList<Action> actions = new ArrayList<>();
private ArrayList<Strategy> strategies = new ArrayList<>(); private ArrayList<Strategy> strategies = new ArrayList<>();
private GUI gui; private GUI gui;
public Timer SCRIPT_TIMER;
@Override @Override
public boolean onExecute() { public boolean onExecute() {
@@ -45,12 +47,15 @@ public class Core extends Script implements Paintable {
} }
} }
if (!gui.scriptStarted) if (!gui.scriptStarted)
{ {
gui.killAllGuis(); gui.killAllGuis();
VarsMethods.savescript(actions, new File(VarsMethods.CACHED_LOC)); VarsMethods.savescript(actions, new File(VarsMethods.CACHED_LOC));
return false; return false;
} }
VarsMethods.calculateBaseXP();
SCRIPT_TIMER = new Timer();
strategies.add(new RunLoop(actions)); strategies.add(new RunLoop(actions));
provide(strategies); provide(strategies);
@@ -59,20 +64,33 @@ public class Core extends Script implements Paintable {
} }
@Override @Override
public void paint(Graphics g) { public void paint(Graphics graphics) {
try { g.setColor(Color.BLUE); try {
g.fillRect(560, 310, 170, 70); Graphics2D g = (Graphics2D) graphics;
Color c2 = new Color(44, 62, 80, 160);
g.setColor(c2);
g.setBackground(c2);
g.fillRect(4, 232, 160, 20);
g.setColor(Color.YELLOW); Color c = new Color(44, 62, 80, 80);
g.setFont(new Font("Cordia New", Font.PLAIN, 16)); g.setColor(c);
g.drawString("Script Factory", 580, 330); g.setBackground(c);
g.setFont(new Font("Cordia New", Font.PLAIN, 12)); g.fillRect(4, 252, 160, 85);
g.drawString("Currently executing: ", 580, 347);
g.drawString(VarsMethods.currentAction, 580, 360); g.setColor(Color.WHITE);
g.drawString(VarsMethods.currentSubscript.equals("") ? "" : "Subscript " + VarsMethods.currentSubscript, 580, 373);} g.setFont(new Font("Arial", Font.BOLD, 14));
catch (Exception e) g.drawString("Script Factory", 9, 247);
{ g.setFont(new Font("Arial", Font.BOLD, 11));
log("Found it"); if (SCRIPT_TIMER == null) {
g.drawString("Awaiting Start:", 9, 270);
return;
}
g.drawString("Currently Executing:", 9, 270);
g.drawString(VarsMethods.currentAction, 9, 290);
g.drawString("EXP(P/H): " + VarsMethods.formatNumber((int) VarsMethods.gainedXP) + "(" + VarsMethods.formatNumber(SCRIPT_TIMER.getPerHour((int) VarsMethods.gainedXP)) + ")", 9, 310);
g.drawString("Runtime: " + SCRIPT_TIMER.toString(), 9, 330);
} catch (Exception e) {
log("Paint Error");
} }
} }
} }
@@ -3,6 +3,7 @@ package scriptfactory.Strategies;
import scriptfactory.Actions.Action; import scriptfactory.Actions.Action;
import org.parabot.environment.scripts.framework.Strategy; import org.parabot.environment.scripts.framework.Strategy;
import scriptfactory.VarsMethods;
import java.util.ArrayList; import java.util.ArrayList;
@@ -25,6 +26,7 @@ public class RunLoop implements Strategy {
@Override @Override
public void execute() { public void execute() {
VarsMethods.calculateGainedXP();
actionExecutor.execute(); actionExecutor.execute();
} }
+31 -4
View File
@@ -1,10 +1,7 @@
package scriptfactory; package scriptfactory;
import org.parabot.core.ui.Logger; import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.GroundItems; import org.rev317.min.api.methods.*;
import org.rev317.min.api.methods.Items;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.SceneObjects;
import scriptfactory.Actions.Action; import scriptfactory.Actions.Action;
import scriptfactory.Actions.Logic.Endif; import scriptfactory.Actions.Logic.Endif;
import scriptfactory.Actions.Logic.If; import scriptfactory.Actions.Logic.If;
@@ -13,12 +10,15 @@ import scriptfactory.Actions.Logic.IfNot;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.*; import java.io.*;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
public class VarsMethods { public class VarsMethods {
public static int tickSpeed = 1200; public static int tickSpeed = 1200;
public static String currentAction = ""; public static String currentAction = "";
public static String currentSubscript = ""; public static String currentSubscript = "";
public static int baseXP = 0;
public static int gainedXP = 0;
public final static String DEFAULT_DIR = System.getProperty("user.home") + System.getProperty("file.separator") + "Parabot" + System.getProperty("file.separator") + "Script Factory"; public final static String DEFAULT_DIR = System.getProperty("user.home") + System.getProperty("file.separator") + "Parabot" + System.getProperty("file.separator") + "Script Factory";
public final static String CACHED_LOC = DEFAULT_DIR + System.getProperty("file.separator") + "Your Previous Script.txt"; public final static String CACHED_LOC = DEFAULT_DIR + System.getProperty("file.separator") + "Your Previous Script.txt";
@@ -170,4 +170,31 @@ public class VarsMethods {
return GroundItems.Option.valueOf(option); return GroundItems.Option.valueOf(option);
} }
} }
public static String formatNumber(int number) {
DecimalFormat nf = new DecimalFormat("0.0");
double i = number;
if (i >= 1000000) {
return nf.format((i / 1000000)) + "M";
}
if (i >= 1000) {
return nf.format((i / 1000)) + "K";
}
return "" + number;
}
public static void calculateBaseXP(){
baseXP = 0;
for (Skill skill : Skill.values()){
baseXP += skill.getExperience();
}
}
public static void calculateGainedXP(){
gainedXP = 0;
for (Skill skill : Skill.values()){
gainedXP += skill.getExperience();
}
gainedXP -= baseXP;
}
} }
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config> <config>
<jars basedir="/home/dr_cookie/Projects/ScriptFactory3/target/"> <jars basedir="C:/Users/Dan-j/Documents/GitHub/Script-Factory/target/">
<jar in="1000202.jar" out="/home/ci/jars/1000202.jar"/> <jar in="1000202.jar" out="/home/ci/jars/1000202.jar"/>
</jars> </jars>
Binary file not shown.
Binary file not shown.
Binary file not shown.