mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-02 16:49:10 +00:00
Merge pull request #4 from RedSparr0w/xp-gained
Update paint, Add XP per hour gained
This commit is contained in:
Generated
+1
-1
@@ -10,7 +10,7 @@
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="script-factory" target="1.8" />
|
||||
<module name="script-factory" target="1.7" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</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
@@ -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>
|
||||
@@ -22,12 +22,12 @@
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>client</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>2.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>317-api-minified</artifactId>
|
||||
<version>1.21.3</version>
|
||||
<version>1.21.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
+6
-4
@@ -1,6 +1,8 @@
|
||||
<?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" 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$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
@@ -9,10 +11,10 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<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: 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:317-api-minified:1.21.3" 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.5" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,5 +1,6 @@
|
||||
package scriptfactory;
|
||||
|
||||
import org.parabot.environment.api.utils.Timer;
|
||||
import scriptfactory.GUI.GUI;
|
||||
import scriptfactory.Strategies.RunLoop;
|
||||
import scriptfactory.Actions.Action;
|
||||
@@ -20,13 +21,14 @@ import static scriptfactory.VarsMethods.log;
|
||||
* 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 {
|
||||
|
||||
private ArrayList<Action> actions = new ArrayList<>();
|
||||
private ArrayList<Strategy> strategies = new ArrayList<>();
|
||||
|
||||
private GUI gui;
|
||||
public Timer SCRIPT_TIMER;
|
||||
|
||||
@Override
|
||||
public boolean onExecute() {
|
||||
@@ -45,12 +47,15 @@ public class Core extends Script implements Paintable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!gui.scriptStarted)
|
||||
{
|
||||
gui.killAllGuis();
|
||||
VarsMethods.savescript(actions, new File(VarsMethods.CACHED_LOC));
|
||||
return false;
|
||||
}
|
||||
VarsMethods.calculateBaseXP();
|
||||
SCRIPT_TIMER = new Timer();
|
||||
|
||||
strategies.add(new RunLoop(actions));
|
||||
provide(strategies);
|
||||
@@ -59,20 +64,33 @@ public class Core extends Script implements Paintable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
try { g.setColor(Color.BLUE);
|
||||
g.fillRect(560, 310, 170, 70);
|
||||
public void paint(Graphics graphics) {
|
||||
try {
|
||||
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);
|
||||
g.setFont(new Font("Cordia New", Font.PLAIN, 16));
|
||||
g.drawString("Script Factory", 580, 330);
|
||||
g.setFont(new Font("Cordia New", Font.PLAIN, 12));
|
||||
g.drawString("Currently executing: ", 580, 347);
|
||||
g.drawString(VarsMethods.currentAction, 580, 360);
|
||||
g.drawString(VarsMethods.currentSubscript.equals("") ? "" : "Subscript " + VarsMethods.currentSubscript, 580, 373);}
|
||||
catch (Exception e)
|
||||
{
|
||||
log("Found it");
|
||||
Color c = new Color(44, 62, 80, 80);
|
||||
g.setColor(c);
|
||||
g.setBackground(c);
|
||||
g.fillRect(4, 252, 160, 85);
|
||||
|
||||
g.setColor(Color.WHITE);
|
||||
g.setFont(new Font("Arial", Font.BOLD, 14));
|
||||
g.drawString("Script Factory", 9, 247);
|
||||
g.setFont(new Font("Arial", Font.BOLD, 11));
|
||||
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 org.parabot.environment.scripts.framework.Strategy;
|
||||
import scriptfactory.VarsMethods;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -25,6 +26,7 @@ public class RunLoop implements Strategy {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
VarsMethods.calculateGainedXP();
|
||||
actionExecutor.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package scriptfactory;
|
||||
|
||||
import org.parabot.core.ui.Logger;
|
||||
import org.rev317.min.api.methods.GroundItems;
|
||||
import org.rev317.min.api.methods.Items;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.SceneObjects;
|
||||
import org.rev317.min.api.methods.*;
|
||||
import scriptfactory.Actions.Action;
|
||||
import scriptfactory.Actions.Logic.Endif;
|
||||
import scriptfactory.Actions.Logic.If;
|
||||
@@ -13,12 +10,15 @@ import scriptfactory.Actions.Logic.IfNot;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class VarsMethods {
|
||||
public static int tickSpeed = 1200;
|
||||
public static String currentAction = "";
|
||||
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 CACHED_LOC = DEFAULT_DIR + System.getProperty("file.separator") + "Your Previous Script.txt";
|
||||
@@ -170,4 +170,31 @@ public class VarsMethods {
|
||||
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,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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"/>
|
||||
</jars>
|
||||
|
||||
|
||||
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