Skip to content

Commit 5f0c851

Browse files
committed
mark self thief state
1 parent aeeee1d commit 5f0c851

File tree

5 files changed

+55
-12
lines changed

5 files changed

+55
-12
lines changed

bdofishbot-bot/src/main/java/ru/namibios/bdofishbot/bot/state/PersonalMessageState.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ else if (Application.getInstance().PM_EXIT_GAME()) {
4747

4848
fishBot.setPmDetected(true);
4949
}
50-
51-
fishBot.setState(new CheckEquipState(fishBot));
52-
50+
51+
fishBot.setState(new SelfThiefState(fishBot));
52+
5353
} catch (Exception e) {
5454
LOG.info(String.format(Message.LOG_FORMAT_ERROR, e));
5555
LOG.error(ExceptionUtils.getString(e));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package ru.namibios.bdofishbot.bot.state;
2+
3+
import org.apache.log4j.Logger;
4+
import ru.namibios.bdofishbot.bot.command.Mark;
5+
import ru.namibios.bdofishbot.bot.command.ShortCommand;
6+
import ru.namibios.bdofishbot.cli.Application;
7+
import ru.namibios.bdofishbot.cli.config.Message;
8+
import ru.namibios.bdofishbot.utils.ExceptionUtils;
9+
10+
public class SelfThiefState extends State {
11+
12+
private static final Logger LOG = Logger.getLogger(SelfThiefState.class);
13+
14+
public SelfThiefState(FishBot fishBot) {
15+
super(fishBot);
16+
17+
this.beforeStart = Application.getInstance().DELAY_SELF_THIEF_BEFORE();
18+
this.afterStart = Application.getInstance().DELAY_SELF_THIEF_AFTER();
19+
}
20+
21+
@Override
22+
public void onStep() {
23+
24+
try{
25+
26+
if (Application.getInstance().MARK_SELT_THIEF()) {
27+
LOG.info("Check mark self thief");
28+
Mark mark = new Mark();
29+
if (mark.getKey().isEmpty()) {
30+
inputService.send(ShortCommand.MARK);
31+
}
32+
}
33+
34+
} catch (Exception e) {
35+
LOG.info(String.format(Message.LOG_FORMAT_ERROR, e));
36+
LOG.error(ExceptionUtils.getString(e));
37+
}
38+
39+
fishBot.setState(new CheckEquipState(fishBot));
40+
41+
}
42+
43+
}

bdofishbot-bot/src/main/java/ru/namibios/bdofishbot/bot/state/StartFishState.java

-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.apache.log4j.Logger;
44
import ru.namibios.bdofishbot.bot.command.Calendar;
5-
import ru.namibios.bdofishbot.bot.command.Mark;
65
import ru.namibios.bdofishbot.bot.command.ShortCommand;
76
import ru.namibios.bdofishbot.bot.service.PauseService;
87
import ru.namibios.bdofishbot.cli.Application;
@@ -29,13 +28,6 @@ public void onStep() {
2928

3029
try {
3130

32-
if (Application.getInstance().MARK_SELT_THIEF()) {
33-
Mark mark = new Mark();
34-
if (mark.getKey().isEmpty()) {
35-
inputService.send(ShortCommand.MARK);
36-
}
37-
}
38-
3931
if (pauseService.isReady()) {
4032
pauseService.rest();
4133
}

bdofishbot-bot/src/main/java/ru/namibios/bdofishbot/cli/config/ApplicationConfig.java

+8
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ public interface ApplicationConfig extends Accessible, Mutable{
368368
@DefaultValue("0")
369369
int DELAY_AFTER_FILTER_LOOT();
370370

371+
@Key("bot.delay.self_thief.before")
372+
@DefaultValue("0")
373+
long DELAY_SELF_THIEF_BEFORE();
374+
375+
@Key("bot.delay.self_thief.after")
376+
@DefaultValue("0")
377+
long DELAY_SELF_THIEF_AFTER();
378+
371379

372380
///////////////////////////////////////////////////////////////////////////
373381
// NOTIFICATION

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<properties>
1818
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19-
<revision>3.2.9</revision>
19+
<revision>3.2.10</revision>
2020
</properties>
2121

2222
<dependencies>

0 commit comments

Comments
 (0)