mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-11-23 04:19:48 +00:00
fix some AddBuff action
This commit is contained in:
parent
52ca89d6c9
commit
bac849d72a
@ -56,6 +56,8 @@ public class GameData {
|
|||||||
@Getter private static Int2ObjectMap<RogueMapExcel> rogueMapExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueMapExcel> rogueMapExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<RogueMonsterExcel> rogueMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueMonsterExcel> rogueMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<DialogueEventExcel> rogueDialogueEventList = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<DialogueEventExcel> rogueDialogueEventList = new Int2ObjectOpenHashMap<>();
|
||||||
|
@Getter private static Int2ObjectMap<RogueBuffExcel> rogueBuffTagExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
@Getter private static Int2ObjectMap<RogueBuffGroupExcel> rogueBuffGroupExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static Int2ObjectMap<RogueBuffExcel> rogueBuffExcelMap = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<RogueBuffExcel> rogueBuffExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
@ -2,6 +2,7 @@ package emu.lunarcore.data.excel;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import emu.lunarcore.data.GameData;
|
||||||
import emu.lunarcore.data.GameDepot;
|
import emu.lunarcore.data.GameDepot;
|
||||||
import emu.lunarcore.data.GameResource;
|
import emu.lunarcore.data.GameResource;
|
||||||
import emu.lunarcore.data.ResourceType;
|
import emu.lunarcore.data.ResourceType;
|
||||||
@ -16,6 +17,7 @@ public class RogueBuffExcel extends GameResource {
|
|||||||
private int MazeBuffLevel;
|
private int MazeBuffLevel;
|
||||||
private int RogueBuffType;
|
private int RogueBuffType;
|
||||||
private int RogueBuffRarity;
|
private int RogueBuffRarity;
|
||||||
|
private int RogueBuffTag;
|
||||||
private int AeonID;
|
private int AeonID;
|
||||||
private RogueBuffAeonType BattleEventBuffType = RogueBuffAeonType.Normal;
|
private RogueBuffAeonType BattleEventBuffType = RogueBuffAeonType.Normal;
|
||||||
|
|
||||||
@ -41,5 +43,7 @@ public class RogueBuffExcel extends GameResource {
|
|||||||
} else if (BattleEventBuffType == RogueBuffAeonType.BattleEventBuffEnhance) {
|
} else if (BattleEventBuffType == RogueBuffAeonType.BattleEventBuffEnhance) {
|
||||||
GameDepot.getRogueAeonEnhanceBuffs().computeIfAbsent(this.getAeonID(), e -> new ArrayList<>()).add(this);
|
GameDepot.getRogueAeonEnhanceBuffs().computeIfAbsent(this.getAeonID(), e -> new ArrayList<>()).add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameData.getRogueBuffTagExcelMap().put(this.getRogueBuffTag(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package emu.lunarcore.data.excel;
|
||||||
|
|
||||||
|
import emu.lunarcore.data.GameData;
|
||||||
|
import emu.lunarcore.data.GameResource;
|
||||||
|
import emu.lunarcore.data.ResourceType;
|
||||||
|
import emu.lunarcore.data.ResourceType.LoadPriority;
|
||||||
|
import emu.lunarcore.game.rogue.RogueBuffData;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ResourceType(name = {"RogueBuffGroup.json"}, loadPriority = LoadPriority.LOW)
|
||||||
|
public class RogueBuffGroupExcel extends GameResource {
|
||||||
|
private int JHOKDPADHFM; // RogueBuffGroupID
|
||||||
|
private List<Integer> ADJICNNJFEM; // RogueBuffTagList or RogueBuffGroupList
|
||||||
|
|
||||||
|
private List<RogueBuffData> rogueBuffList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return JHOKDPADHFM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
for (int rogueTagId : ADJICNNJFEM) {
|
||||||
|
if (rogueTagId >= 1000000 && rogueTagId <= 9999999) {
|
||||||
|
var rogueBuff = GameData.getRogueBuffTagExcelMap().get(rogueTagId);
|
||||||
|
if (rogueBuff != null) rogueBuffList.add(new RogueBuffData(rogueBuff.getMazeBuffID(), rogueBuff.getMazeBuffLevel()));
|
||||||
|
} else {
|
||||||
|
// RogueBuffGroup
|
||||||
|
var rogueBuffGroup = GameData.getRogueBuffGroupExcelMap().get(rogueTagId);
|
||||||
|
if (rogueBuffGroup != null) rogueBuffList.addAll(rogueBuffGroup.getRogueBuffList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GameData.getRogueBuffGroupExcelMap().put(JHOKDPADHFM, this);
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,11 @@ package emu.lunarcore.game.rogue;
|
|||||||
|
|
||||||
import emu.lunarcore.data.GameData;
|
import emu.lunarcore.data.GameData;
|
||||||
import emu.lunarcore.game.player.Player;
|
import emu.lunarcore.game.player.Player;
|
||||||
|
import emu.lunarcore.util.WeightedList;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class RogueEventManager {
|
public class RogueEventManager {
|
||||||
private RogueInstance rogueInstance;
|
private RogueInstance rogueInstance;
|
||||||
@ -17,12 +20,34 @@ public class RogueEventManager {
|
|||||||
public void handleEvent(int eventId) {
|
public void handleEvent(int eventId) {
|
||||||
var event = GameData.getRogueDialogueEventList().get(eventId);
|
var event = GameData.getRogueDialogueEventList().get(eventId);
|
||||||
if (event == null || event.getRogueEffectType() == null) return;
|
if (event == null || event.getRogueEffectType() == null) return;
|
||||||
var param = event.getRogueEffectParamList();
|
List<Integer> param = event.getRogueEffectParamList();
|
||||||
switch (event.getRogueEffectType()) {
|
switch (event.getRogueEffectType()) {
|
||||||
case GetItem -> rogueInstance.setMoney(rogueInstance.getMoney() + param.get(1));
|
case GetItem -> rogueInstance.setMoney(rogueInstance.getMoney() + param.get(1));
|
||||||
case TriggerBattle -> this.getPlayer().getServer().getBattleService().startBattle(player, param.get(0)); // Client Send Packet SceneEnterStageCsReq so we dont have to handle it here
|
case TriggerBattle -> this.getPlayer().getServer().getBattleService().startBattle(player, param.get(0));
|
||||||
case TriggerRogueMiracleSelect -> this.getRogueInstance().createMiracleSelect(1);
|
case TriggerRogueMiracleSelect -> this.getRogueInstance().createMiracleSelect(1);
|
||||||
case TriggerRogueBuffSelect -> this.getRogueInstance().createBuffSelect(1);
|
case TriggerRogueBuffSelect -> this.getRogueInstance().createBuffSelect(1);
|
||||||
|
case GetRogueBuff -> {
|
||||||
|
var rogueBuff = GameData.getRogueBuffGroupExcelMap().get(param.get(0));
|
||||||
|
if (rogueBuff != null) {
|
||||||
|
var weightList = new WeightedList<RogueBuffData>();
|
||||||
|
for (var buff : rogueBuff.getRogueBuffList()) {
|
||||||
|
weightList.add(1.0f, buff);
|
||||||
|
}
|
||||||
|
// random param.get(1) times
|
||||||
|
while (true) {
|
||||||
|
var buff = weightList.next();
|
||||||
|
if (buff == null || buff.getExcel() == null) break;
|
||||||
|
if (this.getRogueInstance().getBuffs().containsValue(buff)) continue;
|
||||||
|
this.getRogueInstance().addBuff(buff);
|
||||||
|
param.set(1, param.get(1) - 1);
|
||||||
|
if (param.get(1) <= 0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case GetAllRogueBuffInGroup -> {
|
||||||
|
var rogueBuff = GameData.getRogueBuffGroupExcelMap().get(param.get(0));
|
||||||
|
this.getRogueInstance().addBuff(rogueBuff.getRogueBuffList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
handleCost(eventId);
|
handleCost(eventId);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import emu.lunarcore.data.excel.RogueAreaExcel;
|
|||||||
import emu.lunarcore.data.excel.RogueMapExcel;
|
import emu.lunarcore.data.excel.RogueMapExcel;
|
||||||
import emu.lunarcore.game.battle.Battle;
|
import emu.lunarcore.game.battle.Battle;
|
||||||
import emu.lunarcore.game.enums.RogueBuffAeonType;
|
import emu.lunarcore.game.enums.RogueBuffAeonType;
|
||||||
|
import emu.lunarcore.game.inventory.GameItem;
|
||||||
import emu.lunarcore.game.player.Player;
|
import emu.lunarcore.game.player.Player;
|
||||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||||
import emu.lunarcore.proto.AvatarTypeOuterClass.AvatarType;
|
import emu.lunarcore.proto.AvatarTypeOuterClass.AvatarType;
|
||||||
@ -256,6 +257,18 @@ public class RogueInstance {
|
|||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void addBuff(List<RogueBuffData> buffs) {
|
||||||
|
for (var buff : buffs) {
|
||||||
|
this.addBuff(buff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void addBuff(RogueBuffData buff) {
|
||||||
|
this.getBuffs().put(buff.getId(), buff);
|
||||||
|
getPlayer().sendPacket(new PacketSyncRogueCommonActionResultScNotify(RogueBuffSource.ROGUE_BUFF_SOURCE_TYPE_DIALOGUE, buff.toDataProto()));
|
||||||
|
this.updateBuffSelect();
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void createMiracleSelect(int amount) {
|
public synchronized void createMiracleSelect(int amount) {
|
||||||
this.pendingMiracleSelects += amount;
|
this.pendingMiracleSelects += amount;
|
||||||
|
|
||||||
@ -360,6 +373,9 @@ public class RogueInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setMoney(int money) {
|
public synchronized void setMoney(int money) {
|
||||||
|
if (this.money <= money) {
|
||||||
|
getPlayer().sendPacket(new PacketScenePlaneEventScNotify(new GameItem(31, money - this.money)));
|
||||||
|
}
|
||||||
this.money = money;
|
this.money = money;
|
||||||
getPlayer().sendPacket(new PacketSyncRogueVirtualItemInfoScNotify(this.getPlayer()));
|
getPlayer().sendPacket(new PacketSyncRogueVirtualItemInfoScNotify(this.getPlayer()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user