Skip to content

Commit

Permalink
New Task: AutoShop
Browse files Browse the repository at this point in the history
  • Loading branch information
dm94 committed Aug 9, 2023
1 parent 4028e40 commit 8da2bce
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>com.deemetool</groupId>
<artifactId>DmPluginPlus</artifactId>
<version>2.0.1</version>
<version>2.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/private/private.jar</systemPath>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private boolean hasFormation(Formation formation) {
}

private boolean hasOption(BehaviourOptions option) {
return config.options.stream().anyMatch(s -> s.name() != null && s.name().equals(option.name()));
return config.options.stream().anyMatch(s -> s != null && s.name() != null && s.name().equals(option.name()));
}

private boolean isAttacking() {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/deeme/lang/strings_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,9 @@ generic_gate.roaming.desc=It will move around the map if it is not attacking or

travel_map=Map Travel
travel_map.enabled=Travel to the map
travel_map.map=Map where to go
travel_map.map=Map where to go

auto_shop=Auto Shop
buy_item_conditions=Item buy configuration
buy_item_conditions.item=Item to buy
buy_item_conditions.quantity=Quantity
48 changes: 48 additions & 0 deletions src/main/java/com/deeme/tasks/AutoShopDummy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.deeme.tasks;

import com.deemetool.tasks.autoshop.Config;

import java.util.Arrays;

import com.deeme.types.VerifierChecker;
import com.deeme.types.backpage.Utils;
import com.deemetool.tasks.autoshop.AutoShop;

import eu.darkbot.api.PluginAPI;
import eu.darkbot.api.config.ConfigSetting;
import eu.darkbot.api.extensions.Configurable;
import eu.darkbot.api.extensions.Feature;
import eu.darkbot.api.extensions.Task;
import eu.darkbot.api.managers.AuthAPI;
import eu.darkbot.api.managers.ExtensionsAPI;
import eu.darkbot.api.utils.Inject;

@Feature(name = "AutoShop [PLUS]", description = "Auto Buy Items")
public class AutoShopDummy implements Task, Configurable<Config> {
private AutoShop privateTask;

public AutoShopDummy(PluginAPI api) {
this(api, api.requireAPI(AuthAPI.class));
}

@Inject
public AutoShopDummy(PluginAPI api, AuthAPI auth) {
if (!Arrays.equals(VerifierChecker.class.getSigners(), getClass().getSigners())) {
throw new SecurityException();
}
VerifierChecker.checkAuthenticity(auth);
Utils.discordDonorCheck(api.getAPI(ExtensionsAPI.class).getFeatureInfo(this.getClass()), auth.getAuthId());

this.privateTask = new AutoShop(api);
}

@Override
public void setConfig(ConfigSetting<Config> arg0) {
this.privateTask.setConfig(arg0);
}

@Override
public void onTickTask() {
privateTask.onTickTask();
}
}
1 change: 1 addition & 0 deletions src/main/resources/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"com.deeme.tasks.AutoChangeMap",
"com.deeme.tasks.HitacFollower",
"com.deeme.tasks.ExternalChat",
"com.deeme.tasks.AutoShopDummy",
"com.deeme.behaviours.Others",
"com.deeme.behaviours.defense.DefenseMode",
"com.deeme.behaviours.CustomEvents",
Expand Down

0 comments on commit 8da2bce

Please sign in to comment.