Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ruse.model.definitions;
- import com.google.gson.Gson;
- import com.google.gson.JsonObject;
- import com.ruse.model.Position;
- import com.ruse.util.JsonLoader;
- import com.ruse.util.Misc;
- import com.ruse.world.content.bots.BotHandler;
- import com.ruse.world.content.bots.BotType;
- import com.ruse.world.content.bots.impl.ManKillerBot;
- import com.ruse.world.content.bots.impl.StallThiefBot;
- public class BotDefinition {
- public static JsonLoader parseBots() {
- return new JsonLoader() {
- @Override
- public void load(JsonObject reader, Gson builder) {
- String username = Misc.formatText(reader.get("username").getAsString());
- String password = reader.get("password").getAsString();
- int setX = reader.get("login_set_x").getAsInt();
- int setY = reader.get("login_set_y").getAsInt();
- BotType botType = BotType.valueOf(reader.get("type").getAsString());
- switch(botType) {
- case MAN_KILLER:
- BotHandler.addBot(new ManKillerBot(username, password, botType, new Position(setX, setY)));
- break;
- case STALL_THIEF:
- BotHandler.addBot(new StallThiefBot(username, password, botType, new Position(setX, setY)));
- break;
- }
- }
- @Override
- public String filePath() {
- return "./data/def/json/bots.json";
- }
- };
- }
- }
Add Comment
Please, Sign In to add comment