mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 09:09:54 +02:00
Make trace hunt more like official
This commit is contained in:
@@ -16,10 +16,16 @@ public class TraceHuntBoss {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TraceHuntBoss(int bossId, int hunts, int assists) {
|
public TraceHuntBoss(int bossId) {
|
||||||
this.id = bossId;
|
this.id = bossId;
|
||||||
this.hunts = hunts;
|
}
|
||||||
this.assists = assists;
|
|
||||||
|
public void incrementHuntCount() {
|
||||||
|
this.hunts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementAssistCount() {
|
||||||
|
this.assists++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proto
|
// Proto
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import emu.nebula.database.GameDatabaseObject;
|
|||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
|
import emu.nebula.net.NetMsgId;
|
||||||
import emu.nebula.proto.Public.TraceHuntItem;
|
import emu.nebula.proto.Public.TraceHuntItem;
|
||||||
import emu.nebula.proto.TraceHuntInfoOuterClass.TraceHuntInfo;
|
import emu.nebula.proto.TraceHuntInfoOuterClass.TraceHuntInfo;
|
||||||
import emu.nebula.util.Utils;
|
import emu.nebula.util.Utils;
|
||||||
@@ -164,7 +165,7 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
.setGrantQty(this.getTraceRequests() - oldValue)
|
.setGrantQty(this.getTraceRequests() - oldValue)
|
||||||
.setDailyCount(daily);
|
.setDailyCount(daily);
|
||||||
|
|
||||||
change.add(proto);
|
this.getPlayer().addNextPackage(NetMsgId.trace_hunt_item_change_notify, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHuntPermits(int amount, int daily, PlayerChangeInfo change, boolean shouldSave) {
|
public void addHuntPermits(int amount, int daily, PlayerChangeInfo change, boolean shouldSave) {
|
||||||
@@ -185,7 +186,7 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
.setGrantQty(this.getHuntPermits() - oldValue)
|
.setGrantQty(this.getHuntPermits() - oldValue)
|
||||||
.setDailyCount(daily);
|
.setDailyCount(daily);
|
||||||
|
|
||||||
change.add(proto);
|
this.getPlayer().addNextPackage(NetMsgId.trace_hunt_item_change_notify, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxGainableExp() {
|
public int getMaxGainableExp() {
|
||||||
@@ -267,6 +268,18 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
this.huntLogs.clear();
|
this.huntLogs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log collection
|
||||||
|
|
||||||
|
public void incrementHuntCount(int bossId) {
|
||||||
|
var log = this.getBosses().computeIfAbsent(bossId, i -> new TraceHuntBoss(this.getBossId()));
|
||||||
|
log.incrementHuntCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementAssistCount(int bossId) {
|
||||||
|
var log = this.getBosses().computeIfAbsent(bossId, i -> new TraceHuntBoss(this.getBossId()));
|
||||||
|
log.incrementAssistCount();
|
||||||
|
}
|
||||||
|
|
||||||
// Game logic
|
// Game logic
|
||||||
|
|
||||||
public PlayerChangeInfo trace(int count) {
|
public PlayerChangeInfo trace(int count) {
|
||||||
@@ -310,7 +323,6 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
|
|
||||||
// Complete
|
// Complete
|
||||||
if (this.isHunting()) {
|
if (this.isHunting()) {
|
||||||
this.bossCreateTime = Nebula.getCurrentServerTime();
|
|
||||||
logs.add(new TraceHuntLog(5));
|
logs.add(new TraceHuntLog(5));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -388,6 +400,12 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
|
|
||||||
logs.add(new TraceHuntLog(11, this.getPlayer().getName(), Integer.toString(progress)));
|
logs.add(new TraceHuntLog(11, this.getPlayer().getName(), Integer.toString(progress)));
|
||||||
|
|
||||||
|
// Start the timer
|
||||||
|
if (this.bossCreateTime == 0) {
|
||||||
|
this.bossCreateTime = Nebula.getCurrentServerTime();
|
||||||
|
logs.add(new TraceHuntLog(17));
|
||||||
|
}
|
||||||
|
|
||||||
// Add to logs
|
// Add to logs
|
||||||
this.huntProgress = Math.min(this.huntProgress + progress, GameConstants.TRACE_HUNT_MAX_HUNT_PROGRESS);
|
this.huntProgress = Math.min(this.huntProgress + progress, GameConstants.TRACE_HUNT_MAX_HUNT_PROGRESS);
|
||||||
this.huntCount++;
|
this.huntCount++;
|
||||||
@@ -416,8 +434,7 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add boss log
|
// Add boss log
|
||||||
var bossLog = new TraceHuntBoss(this.getBossId(), this.getHuntCount(), this.getAssistCount());
|
this.incrementHuntCount(this.getBossId());
|
||||||
this.getBosses().put(this.getBossId(), bossLog);
|
|
||||||
|
|
||||||
// Reset boss
|
// Reset boss
|
||||||
this.resetBoss();
|
this.resetBoss();
|
||||||
@@ -435,7 +452,7 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add exp
|
// Add exp
|
||||||
this.addExp(250);
|
this.addExp(150);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
this.save();
|
this.save();
|
||||||
|
|||||||
Reference in New Issue
Block a user