mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-23 10:44:36 +01:00
fix some events (most events are available) prepare for rogue DLC
This commit is contained in:
@@ -142,11 +142,10 @@ public class RogueEntityLoader extends SceneEntityLoader {
|
||||
} while (instance.setDialogueParams(npcId) == null);
|
||||
|
||||
instance.getEventManager().setNowPercentage(0);
|
||||
instance.getEventManager().setBuffType(0);
|
||||
npc.setRogueNpcId(npcId);
|
||||
npc.setEventId(++instance.eventId);
|
||||
npc.setEventId(++instance.eventUniqueId);
|
||||
scene.getPlayer().sendPacket(new PacketSyncRogueDialogueEventDataScNotify(npcId, instance.curDialogueParams.get(npcId),
|
||||
instance.eventId));
|
||||
instance.eventUniqueId));
|
||||
}
|
||||
|
||||
return npc;
|
||||
|
||||
@@ -16,7 +16,6 @@ public class RogueEventManager {
|
||||
private RogueInstance rogueInstance;
|
||||
private Player player;
|
||||
@Setter private int nowPercentage = 0;
|
||||
@Setter private int buffType = 0;
|
||||
|
||||
public RogueEventManager(RogueInstance rogueInstance) {
|
||||
this.rogueInstance = rogueInstance;
|
||||
@@ -93,28 +92,27 @@ public class RogueEventManager {
|
||||
var increasePercent = param.get(2);
|
||||
if (this.nowPercentage != 0)
|
||||
this.nowPercentage = initialPercent;
|
||||
else
|
||||
this.nowPercentage += increasePercent;
|
||||
var weightList = new WeightedList<Integer>();
|
||||
for (int i = 4; i < param.size(); i += 2) {
|
||||
for (int i = 3; i < param.size(); i += 2) {
|
||||
weightList.add(param.get(i + 1), param.get(i));
|
||||
}
|
||||
int randomNum = Utils.randomRange(0, 100);
|
||||
if (randomNum <= this.nowPercentage) {
|
||||
handleCost(eventId);
|
||||
this.handleEvent(failEventId, npcId);
|
||||
//this.handleEvent(failEventId, npcId);
|
||||
this.getRogueInstance().getCurDialogueParams().get(npcId).add(RogueDialogueEventParam.newInstance()
|
||||
.setDialogueEventId(failEventId)
|
||||
.setIsValid(true));
|
||||
return 0;
|
||||
} else {
|
||||
this.nowPercentage += increasePercent;
|
||||
handleCost(eventId);
|
||||
int nextEventId = weightList.next();
|
||||
this.handleEvent(nextEventId, npcId);
|
||||
this.getRogueInstance().getCurDialogueParams().get(npcId).add(RogueDialogueEventParam.newInstance()
|
||||
.setDialogueEventId(nextEventId)
|
||||
.setIsValid(true)
|
||||
.setRatio(this.nowPercentage / 100f));
|
||||
.setRatio(this.nowPercentage)); // not working
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class RogueInstance {
|
||||
private int aeonBuffType;
|
||||
private int maxAeonBuffs;
|
||||
private int money; // universal debris
|
||||
public int id = 2; // idk what this is for, but it's needed for the packet
|
||||
public int eventId = 690;
|
||||
public int actionUniqueId = 0;
|
||||
public int eventUniqueId = 690;
|
||||
public Int2ObjectMap<List<RogueDialogueEventParam>> curDialogueParams = new Int2ObjectOpenHashMap<>();
|
||||
private final Set<RogueBuffData> normalBuff = GameData.getRogueBuffGroupExcelMap().get(100005).getRogueBuffList();
|
||||
private final Set<RogueBuffData> uncommonBuff = GameData.getRogueBuffGroupExcelMap().get(100003).getRogueBuffList();
|
||||
@@ -224,8 +224,8 @@ public class RogueInstance {
|
||||
}
|
||||
|
||||
if (this.getBuffSelect() != null) {
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.buffSelect.toProto(), this.id);
|
||||
this.id += 2;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.buffSelect.toProto(), this.actionUniqueId);
|
||||
this.actionUniqueId += 2;
|
||||
this.pendingAction = proto.toProto();
|
||||
this.getPlayer().sendPacket(proto);
|
||||
}
|
||||
@@ -240,14 +240,14 @@ public class RogueInstance {
|
||||
if (getBuffSelect() != null && getBuffSelect().hasRerolls() && money >= 30) {
|
||||
this.getBuffSelect().reroll();
|
||||
this.setMoney(money - 30);
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.getBuffSelect().toProto(), this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.getBuffSelect().toProto(), this.actionUniqueId - 2));
|
||||
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.buffSelect.toProto(), this.id);
|
||||
this.id += 2;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.buffSelect.toProto(), this.actionUniqueId);
|
||||
this.actionUniqueId += 2;
|
||||
pendingAction = proto.toProto();
|
||||
return this.getBuffSelect();
|
||||
} else {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -256,7 +256,7 @@ public class RogueInstance {
|
||||
public synchronized RogueBuffData selectBuff(int buffId) {
|
||||
// Sanity
|
||||
if (this.getBuffSelect() == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class RogueInstance {
|
||||
.orElse(null);
|
||||
|
||||
if (buff == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public class RogueInstance {
|
||||
|
||||
var data = HandleRogueCommonPendingActionScRsp.newInstance();
|
||||
data.getMutableRogueBuffSelect();
|
||||
data.setTimes(this.id - 2);
|
||||
data.setTimes(this.actionUniqueId - 2);
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(data));
|
||||
return buff;
|
||||
}
|
||||
@@ -329,8 +329,8 @@ public class RogueInstance {
|
||||
if (this.pendingMiracleSelects > 0 && this.getMiracleSelect() == null) {
|
||||
this.miracleSelect = new RogueMiracleSelectMenu(this);
|
||||
this.pendingMiracleSelects--;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.miracleSelect.toProto(), this.id);
|
||||
this.id += 2;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.miracleSelect.toProto(), this.actionUniqueId);
|
||||
this.actionUniqueId += 2;
|
||||
this.pendingAction = proto.toProto();
|
||||
this.getPlayer().sendPacket(proto);
|
||||
return this.miracleSelect;
|
||||
@@ -341,7 +341,7 @@ public class RogueInstance {
|
||||
|
||||
public synchronized RogueMiracleData selectMiracle(int miracleId) {
|
||||
if (this.getMiracleSelect() == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public class RogueInstance {
|
||||
.orElse(null);
|
||||
|
||||
if (miracle == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ public class RogueInstance {
|
||||
|
||||
var data = HandleRogueCommonPendingActionScRsp.newInstance();
|
||||
data.getMutableMiracleSelect();
|
||||
data.setTimes(this.id - 2);
|
||||
data.setTimes(this.actionUniqueId - 2);
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(data));
|
||||
return miracle;
|
||||
}
|
||||
@@ -380,8 +380,8 @@ public class RogueInstance {
|
||||
if (this.pendingBonusSelects > 0 && this.getBonusSelect() == null) {
|
||||
this.bonusSelect = new RogueBonusSelectMenu(this);
|
||||
this.pendingBonusSelects--;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.bonusSelect.toProto(), this.id);
|
||||
this.id += 2;
|
||||
var proto = new PacketSyncRogueCommonPendingActionScNotify(this.bonusSelect.toProto(), this.actionUniqueId);
|
||||
this.actionUniqueId += 2;
|
||||
this.pendingAction = proto.toProto();
|
||||
this.getPlayer().sendPacket(proto);
|
||||
return this.bonusSelect;
|
||||
@@ -392,7 +392,7 @@ public class RogueInstance {
|
||||
|
||||
public synchronized RogueBonusData selectBonus(int bonusId) {
|
||||
if (this.getBonusSelect() == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ public class RogueInstance {
|
||||
.orElse(null);
|
||||
|
||||
if (bonus == null) {
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.id - 2));
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(this.actionUniqueId - 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ public class RogueInstance {
|
||||
// TODO: add event
|
||||
var data = HandleRogueCommonPendingActionScRsp.newInstance();
|
||||
data.getMutableBonusSelect();
|
||||
data.setTimes(this.id - 2);
|
||||
data.setTimes(this.actionUniqueId - 2);
|
||||
this.getPlayer().sendPacket(new PacketHandleRogueCommonPendingActionScRsp(data));
|
||||
try {
|
||||
this.onSelectDialogue(bonus.getEventId(), 0);
|
||||
@@ -489,7 +489,6 @@ public class RogueInstance {
|
||||
|
||||
if (argMap.containsKey(v) && argMap.get(v).equals("RelateToBuff")) {
|
||||
param.setArgId(this.getAeonId());
|
||||
this.getEventManager().setBuffType(this.getAeonBuffType());
|
||||
}
|
||||
|
||||
params.add(param);
|
||||
@@ -691,7 +690,9 @@ public class RogueInstance {
|
||||
|
||||
public RogueAeon toAeonProto() {
|
||||
var proto = RogueAeon.newInstance()
|
||||
.setAeonId(this.getAeonId());
|
||||
.setAeonId(this.getAeonId())
|
||||
.setAeonEnhanceBuffNum(3)
|
||||
.setIsUnlockAeon(true);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class RogueManager extends BasePlayerManager {
|
||||
aeonInfo.addAeonIdList(aeonExcel.getAeonID());
|
||||
}
|
||||
aeonInfo.setIsUnlocked(true);
|
||||
aeonInfo.setJPEBPGIEGPO(3); // guess
|
||||
aeonInfo.setUnlockAeonEnhanceNum(3); // guess
|
||||
}
|
||||
|
||||
var data = RogueInfoData.newInstance()
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PacketSelectRogueDialogueEventScRsp extends BasePacket {
|
||||
.setNpcId(npc.getRogueNpcId())
|
||||
.setGameModeType(5)
|
||||
.addSelectEventId(dialogueEventId)
|
||||
.setGBMDBBBMBEJ(instance.getEventId())
|
||||
.setEventUniqueId(instance.getEventUniqueId())
|
||||
.addAllRogueDialogueEventParam(params.toArray(RogueDialogueEventParam[]::new));
|
||||
|
||||
var l = DialogueResult.newInstance();
|
||||
|
||||
@@ -15,7 +15,7 @@ public class PacketSyncRogueCommonActionResultScNotify extends BasePacket {
|
||||
super(CmdId.SyncRogueCommonActionResultScNotify);
|
||||
|
||||
var proto = SyncRogueCommonActionResultScNotify.newInstance()
|
||||
.setOCPBNBPAMEN(101);
|
||||
.setRogueVersionId(101);
|
||||
|
||||
proto.setAction(action);
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ public class PacketSyncRogueCommonPendingActionScNotify extends BasePacket {
|
||||
var proto = SyncRogueCommonPendingActionScNotify.newInstance();
|
||||
|
||||
proto.setRogueCommonPendingAction(action)
|
||||
.setOCPBNBPAMEN(101); // common rogue
|
||||
.setRogueVersionId(101); // common rogue
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketSyncRogueCommonPendingActionScNotify(RogueAction action, int id) {
|
||||
this(RogueCommonPendingAction.newInstance()
|
||||
.setGLFDHAJPJDF(id)
|
||||
.setActionUniqueId(id)
|
||||
.setRogueAction(action));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PacketSyncRogueDialogueEventDataScNotify extends BasePacket {
|
||||
this(RogueDialogueEvent.newInstance()
|
||||
.setGameModeType(5) // rogue explore
|
||||
.setNpcId(rogueNpcId)
|
||||
.setGBMDBBBMBEJ(eventId)
|
||||
.setEventUniqueId(eventId)
|
||||
.addAllRogueDialogueEventParam(params.toArray(RogueDialogueEventParam[]::new)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package emu.lunarcore.server.packet.send;
|
||||
|
||||
import emu.lunarcore.game.rogue.RogueMiracleSelectMenu;
|
||||
import emu.lunarcore.proto.SyncRogueMiracleSelectInfoScNotifyOuterClass.SyncRogueMiracleSelectInfoScNotify;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
|
||||
public class PacketSyncRogueMiracleSelectInfoScNotify extends BasePacket {
|
||||
|
||||
public PacketSyncRogueMiracleSelectInfoScNotify(RogueMiracleSelectMenu miracleSelect) {
|
||||
super(CmdId.NONE); // TODO update
|
||||
|
||||
var data = SyncRogueMiracleSelectInfoScNotify.newInstance()
|
||||
.setMiracleSelectInfo(miracleSelect.toProto());
|
||||
|
||||
this.setData(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user