- Joined
- Oct 12, 2015
- Messages
- 3,781
- Thread Author
- #1
Hey guys.
The following "bot" will convert an old pre-Spectre "FileWeb" into a Spectre-compatible SerializableWeb, with the option to add vertices.
There is no UI of any kind, just code, so you'll probably have to do some tweaking to get it to work but the process is fairly straight-forward and the comments should guide you.
Credit to @SlashnHax for showing me the conversion and @Cloud for his tutorial on web expansion: Tutorial - [Series] Expanding The Navigation Web - Basic Objects (Agility Shortcuts) | Community | RuneMate
Main class: convertFileWeb.java
Manifest: convertFileWeb.manifest.xml
The following "bot" will convert an old pre-Spectre "FileWeb" into a Spectre-compatible SerializableWeb, with the option to add vertices.
There is no UI of any kind, just code, so you'll probably have to do some tweaking to get it to work but the process is fairly straight-forward and the comments should guide you.
Credit to @SlashnHax for showing me the conversion and @Cloud for his tutorial on web expansion: Tutorial - [Series] Expanding The Navigation Web - Basic Objects (Agility Shortcuts) | Community | RuneMate
Main class: convertFileWeb.java
JavaScript:
package com.pBots.web;
import com.runemate.game.api.hybrid.local.Skill;
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.location.navigation.web.SerializableWeb;
import com.runemate.game.api.hybrid.location.navigation.web.default_webs.FileWeb;
import com.runemate.game.api.hybrid.location.navigation.web.requirements.Requirement;
import com.runemate.game.api.hybrid.location.navigation.web.vertex_types.objects.BasicObjectVertex;
import com.runemate.game.api.hybrid.util.Resources;
import com.runemate.game.api.hybrid.util.Usable;
import com.runemate.game.api.script.framework.task.TaskScript;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Collections;
public class convertFileWeb extends TaskScript {
//If you plan on adding vertices, expand on the following as necessary
private Coordinate objectPos = new Coordinate(0, 0, 0);
private Coordinate landingPos = new Coordinate(0, 0, 0);
//If the object has a requirement, declare it here
final Usable requirement = new Usable() {
@Override
public boolean isUsable() {
return Skill.AGILITY.getCurrentLevel() >= 21;
}
};
//Declare the vertex/vertices
final BasicObjectVertex object = new BasicObjectVertex(objectPos, "Object name", "Action", (Collection<Requirement>) requirement); //If no requirement then Collections.emptyList()
//Declare your new web
private SerializableWeb webName;
public void onStart(String... args) {
try {
webName = new SerializableWeb();
webName.addVertices(FileWeb.fromByteArray(Resources.getAsByteArray("path/to/old/web.nav")).getVertices());
//Connect the vertices
webName.getVertexNearestTo(objectPos).addBidirectionalEdge(object);
//Save your new web
Path path = Paths.get("path\\to\\output.nav");
Files.createFile(path);
Files.write(path, webName.serialize());
} catch (IOException e) {
e.printStackTrace();
}
}
}
Manifest: convertFileWeb.manifest.xml
HTML:
<manifest>
<main-class>com.pBots.web.convertOldVertices</main-class>
<name>ConvertOldWeb</name>
<tag-line>Convert of FileWeb to new SeriazableWeb</tag-line><!--Max of 50 chars-->
<description>EConvert of FileWeb to new SeriazableWeb, and add new vertices</description><!--Max of 110 chars-->
<version>1</version>
<compatibility>
<game>OSRS</game>
<game>RS3</game>
</compatibility>
<categories>
<category>DEVELOPER_TOOLS</category>
</categories>
<!--Required to publish on the bot store-->
<internal-id>ConvertOldWeb</internal-id>
<!--The rest are optional-->
<open-source>true</open-source>
<hidden>false</hidden> <!--If you need to hide it from the bot store for maintenance-->
<access>public</access>
<tags>
<tag>web</tag>
</tags>
<resources>
<resource>reference/to/old/web.nav</resource>
</resources>
</manifest>