mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 21:12:57 +08:00
Copy some files from Grasscutter-Quests
NOT completely finished, nor is it completely done. Protocol issues remain! (including lack of packet IDs)
This commit is contained in:
parent
262ee38ded
commit
daa51e53b7
@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
|
||||
import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.AchievementData;
|
||||
import emu.grasscutter.data.excels.achievement.AchievementData;
|
||||
import emu.grasscutter.game.achievement.AchievementControlReturns;
|
||||
import emu.grasscutter.game.achievement.Achievements;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
permissionTargeted = "player.achievement.others",
|
||||
targetRequirement = Command.TargetRequirement.PLAYER,
|
||||
threading = true)
|
||||
public class AchievementCommand implements CommandHandler {
|
||||
public final class AchievementCommand implements CommandHandler {
|
||||
private static void sendSuccessMessage(Player sender, String cmd, Object... args) {
|
||||
CommandHandler.sendTranslatedMessage(
|
||||
sender, AchievementControlReturns.Return.SUCCESS.getKey() + cmd, args);
|
||||
|
@ -1,5 +1,8 @@
|
||||
package emu.grasscutter.command.commands;
|
||||
|
||||
import static emu.grasscutter.command.CommandHelpers.*;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.game.entity.*;
|
||||
@ -9,32 +12,29 @@ import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.server.event.entity.EntityDamageEvent;
|
||||
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static emu.grasscutter.command.CommandHelpers.*;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
import lombok.Setter;
|
||||
|
||||
@Command(
|
||||
label = "entity",
|
||||
usage = {
|
||||
"<configId gadget> [state<state>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]",
|
||||
"<configId monster> [ai<aiId>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]"},
|
||||
permission = "server.entity")
|
||||
label = "entity",
|
||||
usage = {
|
||||
"<configId gadget> [state<state>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]",
|
||||
"<configId monster> [ai<aiId>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]"
|
||||
},
|
||||
permission = "server.entity")
|
||||
public final class EntityCommand implements CommandHandler {
|
||||
private static final Map<Pattern, BiConsumer<EntityParameters, Integer>> intCommandHandlers = Map.ofEntries(
|
||||
Map.entry(stateRegex, EntityParameters::setState),
|
||||
Map.entry(maxHPRegex, EntityParameters::setMaxHP),
|
||||
Map.entry(hpRegex, EntityParameters::setHp),
|
||||
Map.entry(defRegex, EntityParameters::setDef),
|
||||
Map.entry(atkRegex, EntityParameters::setAtk),
|
||||
Map.entry(aiRegex, EntityParameters::setAi)
|
||||
);
|
||||
private static final Map<Pattern, BiConsumer<EntityParameters, Integer>> intCommandHandlers =
|
||||
Map.ofEntries(
|
||||
Map.entry(stateRegex, EntityParameters::setState),
|
||||
Map.entry(maxHPRegex, EntityParameters::setMaxHP),
|
||||
Map.entry(hpRegex, EntityParameters::setHp),
|
||||
Map.entry(defRegex, EntityParameters::setDef),
|
||||
Map.entry(atkRegex, EntityParameters::setAtk),
|
||||
Map.entry(aiRegex, EntityParameters::setAi));
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||
@ -44,7 +44,7 @@ public final class EntityCommand implements CommandHandler {
|
||||
|
||||
// At this point, first remaining argument MUST be the id and the rest the pos
|
||||
if (args.size() != 1) {
|
||||
sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar
|
||||
sendUsageMessage(sender); // Reachable if someone does `/give lv90` or similar
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public final class EntityCommand implements CommandHandler {
|
||||
param.scene = targetPlayer.getScene();
|
||||
var entity = param.scene.getEntityByConfigId(param.configId);
|
||||
|
||||
if(entity == null){
|
||||
if (entity == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.entity.not_found_error"));
|
||||
return;
|
||||
}
|
||||
@ -68,25 +68,23 @@ public final class EntityCommand implements CommandHandler {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.status.success"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void applyGadgetParams(GameEntity entity, EntityParameters param) {
|
||||
if(!(entity instanceof EntityGadget)){
|
||||
if (!(entity instanceof EntityGadget)) {
|
||||
return;
|
||||
}
|
||||
if(param.state != -1 ){
|
||||
if (param.state != -1) {
|
||||
((EntityGadget) entity).updateState(param.state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void applyMonsterParams(GameEntity entity, EntityParameters param) {
|
||||
if(!(entity instanceof EntityMonster)){
|
||||
if (!(entity instanceof EntityMonster)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(param.ai != -1 ){
|
||||
if (param.ai != -1) {
|
||||
((EntityMonster) entity).setAiId(param.ai);
|
||||
//TODO notify
|
||||
// TODO notify
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +97,8 @@ public final class EntityCommand implements CommandHandler {
|
||||
float targetHp = param.hp == 0 ? Float.MAX_VALUE : param.hp;
|
||||
float oldHp = entity.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
|
||||
setFightProperty(entity, FightProperty.FIGHT_PROP_CUR_HP, targetHp, changedFields);
|
||||
EntityDamageEvent event = new EntityDamageEvent(entity, oldHp-targetHp, ElementType.None, null);
|
||||
EntityDamageEvent event =
|
||||
new EntityDamageEvent(entity, oldHp - targetHp, ElementType.None, null);
|
||||
callHPEvents(entity, event);
|
||||
}
|
||||
if (param.atk != -1) {
|
||||
@ -110,16 +109,19 @@ public final class EntityCommand implements CommandHandler {
|
||||
setFightProperty(entity, FightProperty.FIGHT_PROP_DEFENSE, param.def, changedFields);
|
||||
setFightProperty(entity, FightProperty.FIGHT_PROP_CUR_DEFENSE, param.def, changedFields);
|
||||
}
|
||||
if(!changedFields.isEmpty()) {
|
||||
entity.getScene().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, changedFields));
|
||||
if (!changedFields.isEmpty()) {
|
||||
entity
|
||||
.getScene()
|
||||
.broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, changedFields));
|
||||
}
|
||||
}
|
||||
|
||||
private void callHPEvents(GameEntity entity, EntityDamageEvent event){
|
||||
private void callHPEvents(GameEntity entity, EntityDamageEvent event) {
|
||||
entity.callLuaHPEvent(event);
|
||||
}
|
||||
|
||||
private void setFightProperty(GameEntity entity, FightProperty property, float value, List<FightProperty> modifiedProps){
|
||||
private void setFightProperty(
|
||||
GameEntity entity, FightProperty property, float value, List<FightProperty> modifiedProps) {
|
||||
entity.setFightProperty(property, value);
|
||||
modifiedProps.add(property);
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameDepot;
|
||||
import emu.grasscutter.data.excels.AvatarData;
|
||||
import emu.grasscutter.data.excels.avatar.AvatarData;
|
||||
import emu.grasscutter.data.excels.ItemData;
|
||||
import emu.grasscutter.data.excels.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.excels.ReliquaryMainPropData;
|
||||
import emu.grasscutter.data.excels.reliquary.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.excels.reliquary.ReliquaryMainPropData;
|
||||
import emu.grasscutter.game.avatar.Avatar;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.inventory.ItemType;
|
||||
|
@ -1,19 +1,19 @@
|
||||
package emu.grasscutter.command.commands;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.world.SceneGroupInstance;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
@Command(label = "group",
|
||||
aliases = {"g"},
|
||||
usage = {"(refresh) [<groupId>] [<suiteId>]"},
|
||||
permission = "player.group",
|
||||
permissionTargeted = "player.group.others")
|
||||
@Command(
|
||||
label = "group",
|
||||
aliases = {"g"},
|
||||
usage = {"(refresh) [<groupId>] [<suiteId>]"},
|
||||
permission = "player.group",
|
||||
permissionTargeted = "player.group.others")
|
||||
public final class GroupCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
@ -25,20 +25,18 @@ public final class GroupCommand implements CommandHandler {
|
||||
|
||||
int groupId = 0;
|
||||
int suiteId = 0;
|
||||
switch (args.size()){
|
||||
switch (args.size()) {
|
||||
case 2:
|
||||
try {
|
||||
suiteId = Integer.parseInt(args.get(1));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_suiteid"));
|
||||
return;
|
||||
} // Fallthrough
|
||||
} // Fallthrough
|
||||
case 1:
|
||||
try {
|
||||
groupId = Integer.parseInt(args.get(0));
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_groupid"));
|
||||
return;
|
||||
}
|
||||
@ -50,13 +48,15 @@ public final class GroupCommand implements CommandHandler {
|
||||
|
||||
switch (cmd) {
|
||||
case "refresh" -> {
|
||||
SceneGroupInstance groupInstance = targetPlayer.getScene().getScriptManager().getGroupInstanceById(groupId);
|
||||
if(groupInstance == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.group_not_found", groupId));
|
||||
SceneGroupInstance groupInstance =
|
||||
targetPlayer.getScene().getScriptManager().getGroupInstanceById(groupId);
|
||||
if (groupInstance == null) {
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.group.group_not_found", groupId));
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.size() >= 2) {
|
||||
if (args.size() >= 2) {
|
||||
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance, suiteId, false);
|
||||
} else {
|
||||
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance);
|
||||
|
@ -9,7 +9,7 @@ import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.GadgetData;
|
||||
import emu.grasscutter.data.excels.ItemData;
|
||||
import emu.grasscutter.data.excels.MonsterData;
|
||||
import emu.grasscutter.data.excels.monster.MonsterData;
|
||||
import emu.grasscutter.game.entity.*;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.EntityType;
|
||||
|
@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
|
||||
import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.AvatarSkillDepotData;
|
||||
import emu.grasscutter.data.excels.avatar.AvatarSkillDepotData;
|
||||
import emu.grasscutter.game.avatar.Avatar;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.utils.Language;
|
||||
|
@ -1,28 +1,27 @@
|
||||
package emu.grasscutter.command.commands;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
import emu.grasscutter.command.Command;
|
||||
import emu.grasscutter.command.CommandHandler;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.trialavatar.TrialAvatarActivityHandler;
|
||||
import emu.grasscutter.game.activity.trialavatar.TrialAvatarPlayerData;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.ActivityType;
|
||||
import emu.grasscutter.net.proto.ActivityInfoOuterClass.ActivityInfo;
|
||||
import emu.grasscutter.server.packet.send.PacketActivityInfoNotify;
|
||||
import emu.grasscutter.utils.JsonUtils;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.val;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
@Command(
|
||||
label = "trialAvatarActivity",
|
||||
aliases = {"taa"},
|
||||
usage = {"change <scheduleId>", "toggleDungeon <index(start from 1)|all>", "toggleReward <index(start from 1)|all>"},
|
||||
permission = "player.trialavataractivity",
|
||||
permissionTargeted = "player.trialavataractivity.others")
|
||||
label = "trialAvatarActivity",
|
||||
aliases = {"taa"},
|
||||
usage = {
|
||||
"change <scheduleId>",
|
||||
"toggleDungeon <index(start from 1)|all>",
|
||||
"toggleReward <index(start from 1)|all>"
|
||||
},
|
||||
permission = "player.trialavataractivity",
|
||||
permissionTargeted = "player.trialavataractivity.others")
|
||||
public final class TrialAvatarActivityCommand implements CommandHandler {
|
||||
@Override
|
||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||
@ -31,95 +30,127 @@ public final class TrialAvatarActivityCommand implements CommandHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
String action = args.get(0).toLowerCase();
|
||||
String param = args.get(1);
|
||||
var action = args.get(0).toLowerCase();
|
||||
var param = args.get(1);
|
||||
|
||||
val playerDataOption = targetPlayer.getActivityManager()
|
||||
.getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_TRIAL_AVATAR);
|
||||
if (playerDataOption == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
return;
|
||||
}
|
||||
val playerData = playerDataOption.get();
|
||||
if (playerData == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
var playerDataOption =
|
||||
targetPlayer
|
||||
.getActivityManager()
|
||||
.getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_TRIAL_AVATAR);
|
||||
if (playerDataOption.isEmpty()) {
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
return;
|
||||
}
|
||||
|
||||
var playerData = playerDataOption.get();
|
||||
var handler = (TrialAvatarActivityHandler) playerData.getActivityHandler();
|
||||
if (handler == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
return;
|
||||
}
|
||||
TrialAvatarPlayerData trialAvatarPlayerData = JsonUtils.decode(playerData.getDetail(), TrialAvatarPlayerData.class);
|
||||
|
||||
var trialAvatarPlayerData =
|
||||
JsonUtils.decode(playerData.getDetail(), TrialAvatarPlayerData.class);
|
||||
if (trialAvatarPlayerData == null) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
default -> {
|
||||
sendUsageMessage(sender);
|
||||
}
|
||||
default -> this.sendUsageMessage(sender);
|
||||
case "change" -> {
|
||||
if (!param.chars().allMatch(Character::isDigit)) { // if its not number
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
return;
|
||||
}
|
||||
if (TrialAvatarPlayerData.getAvatarIdList(Integer.parseInt(param)).isEmpty()) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.schedule_not_found", Integer.parseInt(param)));
|
||||
CommandHandler.sendMessage(
|
||||
sender,
|
||||
translate(
|
||||
sender,
|
||||
"commands.trialAvatarActivity.schedule_not_found",
|
||||
Integer.parseInt(param)));
|
||||
return;
|
||||
}
|
||||
playerData.setDetail(TrialAvatarPlayerData.create(Integer.parseInt(param)));
|
||||
playerData.save();
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_schedule", Integer.parseInt(param)));
|
||||
CommandHandler.sendMessage(
|
||||
sender,
|
||||
translate(
|
||||
sender, "commands.trialAvatarActivity.success_schedule", Integer.parseInt(param)));
|
||||
}
|
||||
case "toggledungeon" -> {
|
||||
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
||||
if (Integer.parseInt(param)-1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||
|| Integer.parseInt(param)-1 <= 0) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
if (Integer.parseInt(param) - 1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||
|| Integer.parseInt(param) - 1 <= 0) {
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
return;
|
||||
}
|
||||
TrialAvatarPlayerData.RewardInfoItem rewardInfo = trialAvatarPlayerData.getRewardInfoList().get(Integer.parseInt(param)-1);
|
||||
TrialAvatarPlayerData.RewardInfoItem rewardInfo =
|
||||
trialAvatarPlayerData.getRewardInfoList().get(Integer.parseInt(param) - 1);
|
||||
rewardInfo.setPassedDungeon(!rewardInfo.isPassedDungeon());
|
||||
playerData.setDetail(trialAvatarPlayerData);
|
||||
playerData.save();
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_dungeon", Integer.parseInt(param)));
|
||||
CommandHandler.sendMessage(
|
||||
sender,
|
||||
translate(
|
||||
sender, "commands.trialAvatarActivity.success_dungeon", Integer.parseInt(param)));
|
||||
} else {
|
||||
if (!param.equals("all")) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
return;
|
||||
}
|
||||
trialAvatarPlayerData.getRewardInfoList().forEach(r -> r.setPassedDungeon(!r.isPassedDungeon()));
|
||||
trialAvatarPlayerData
|
||||
.getRewardInfoList()
|
||||
.forEach(r -> r.setPassedDungeon(!r.isPassedDungeon()));
|
||||
playerData.setDetail(trialAvatarPlayerData);
|
||||
playerData.save();
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_dungeon_all"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.success_dungeon_all"));
|
||||
}
|
||||
}
|
||||
case "togglereward" -> {
|
||||
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
||||
if (Integer.parseInt(param)-1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||
|| Integer.parseInt(param)-1 <= 0) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
if (Integer.parseInt(param) - 1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||
|| Integer.parseInt(param) - 1 <= 0) {
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
return;
|
||||
}
|
||||
TrialAvatarPlayerData.RewardInfoItem rewardInfo = trialAvatarPlayerData.getRewardInfoList().get(Integer.parseInt(param)-1);
|
||||
TrialAvatarPlayerData.RewardInfoItem rewardInfo =
|
||||
trialAvatarPlayerData.getRewardInfoList().get(Integer.parseInt(param) - 1);
|
||||
rewardInfo.setReceivedReward(!rewardInfo.isReceivedReward());
|
||||
playerData.setDetail(trialAvatarPlayerData);
|
||||
playerData.save();
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_reward", Integer.parseInt(param)));
|
||||
CommandHandler.sendMessage(
|
||||
sender,
|
||||
translate(
|
||||
sender, "commands.trialAvatarActivity.success_reward", Integer.parseInt(param)));
|
||||
} else {
|
||||
if (!param.toLowerCase().equals("all")) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||
return;
|
||||
}
|
||||
trialAvatarPlayerData.getRewardInfoList().forEach(r -> r.setReceivedReward(!r.isReceivedReward()));
|
||||
trialAvatarPlayerData
|
||||
.getRewardInfoList()
|
||||
.forEach(r -> r.setReceivedReward(!r.isReceivedReward()));
|
||||
playerData.setDetail(trialAvatarPlayerData);
|
||||
playerData.save();
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_reward_all"));
|
||||
CommandHandler.sendMessage(
|
||||
sender, translate(sender, "commands.trialAvatarActivity.success_reward_all"));
|
||||
}
|
||||
}
|
||||
}
|
||||
targetPlayer.sendPacket(new PacketActivityInfoNotify(handler.toProto(playerData, targetPlayer.getActivityManager().getConditionExecutor())));
|
||||
|
||||
targetPlayer.sendPacket(
|
||||
new PacketActivityInfoNotify(
|
||||
handler.toProto(playerData, targetPlayer.getActivityManager().getConditionExecutor())));
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,41 @@ package emu.grasscutter.data;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.binout.*;
|
||||
import emu.grasscutter.data.binout.config.*;
|
||||
import emu.grasscutter.data.binout.routes.*;
|
||||
import emu.grasscutter.data.custom.*;
|
||||
import emu.grasscutter.data.excels.*;
|
||||
import emu.grasscutter.game.quest.QuestEncryptionKey;
|
||||
import emu.grasscutter.data.excels.achievement.*;
|
||||
import emu.grasscutter.data.excels.activity.*;
|
||||
import emu.grasscutter.data.excels.avatar.*;
|
||||
import emu.grasscutter.data.excels.codex.*;
|
||||
import emu.grasscutter.data.excels.dungeon.*;
|
||||
import emu.grasscutter.data.excels.monster.*;
|
||||
import emu.grasscutter.data.excels.reliquary.*;
|
||||
import emu.grasscutter.data.excels.tower.*;
|
||||
import emu.grasscutter.data.excels.trial.*;
|
||||
import emu.grasscutter.data.excels.weapon.*;
|
||||
import emu.grasscutter.data.excels.world.*;
|
||||
import emu.grasscutter.data.server.*;
|
||||
import emu.grasscutter.game.dungeons.*;
|
||||
import emu.grasscutter.game.quest.*;
|
||||
import emu.grasscutter.game.world.*;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.Tolerate;
|
||||
import lombok.val;
|
||||
|
||||
public class GameData {
|
||||
protected static final Map<String, AbilityData> abilityDataMap = new HashMap<>();
|
||||
protected static final Int2ObjectMap<ScenePointEntry> scenePointEntryMap =
|
||||
@SuppressWarnings({"unused", "MismatchedQueryAndUpdateOfCollection"})
|
||||
public final class GameData {
|
||||
@Getter private static final Map<String, AbilityData> abilityDataMap = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<ScenePointEntry> scenePointEntryMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// BinOutputs
|
||||
@Getter
|
||||
private static final Int2ObjectMap<HomeworldDefaultSaveData> homeworldDefaultSaveData =
|
||||
@ -29,16 +51,28 @@ public class GameData {
|
||||
@Getter private static final Map<String, ConfigGadget> gadgetConfigData = new HashMap<>();
|
||||
@Getter private static final Map<String, OpenConfigEntry> openConfigEntries = new HashMap<>();
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
@Getter
|
||||
private static final Map<String, ScenePointEntry> scenePointEntries = new HashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<MainQuestData> mainQuestData = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<QuestEncryptionKey> questsKeys = new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<SceneNpcBornData> npcBornData = new Int2ObjectOpenHashMap<>();
|
||||
private static final Map<String, AbilityEmbryoEntry> abilityEmbryos = new HashMap<>();
|
||||
|
||||
// ExcelConfigs
|
||||
@Getter
|
||||
private static final Int2ObjectMap<ActivityCondExcelConfigData> activityCondExcelConfigDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<DungeonPassConfigData> dungeonPassConfigDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<DungeonChallengeConfigData> dungeonChallengeConfigDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<Int2ObjectMap<Route>> sceneRouteData =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final ArrayList<CodexReliquaryData> codexReliquaryArrayList = new ArrayList<>();
|
||||
|
||||
@ -276,6 +310,26 @@ public class GameData {
|
||||
private static final Int2ObjectMap<TriggerExcelConfigData> triggerExcelConfigDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialAvatarData> trialAvatarDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialAvatarActivityData> trialAvatarActivityDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialAvatarActivityDataData> trialAvatarActivityDataDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialAvatarTemplateData> trialAvatarTemplateDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialReliquaryData> trialReliquaryDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
@ -299,6 +353,16 @@ public class GameData {
|
||||
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<RewindData> rewindDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TeleportData> teleportDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<RefreshPolicyExcelConfigData> refreshPolicyExcelConfigDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Int2ObjectMap<AvatarPromoteData> avatarPromoteDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||
@ -306,6 +370,7 @@ public class GameData {
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// The following are accessed via getMapByResourceDef, and will show as unused
|
||||
private static final Int2ObjectMap<CodexMaterialData> codexMaterialDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
@ -316,34 +381,65 @@ public class GameData {
|
||||
private static final Int2ObjectMap<CodexWeaponData> codexWeaponDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// Custom community server resources
|
||||
@Getter
|
||||
private static final Int2ObjectMap<List<DungeonDropEntry>> dungeonDropDataMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<GadgetMapping> gadgetMappingMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<ActivityCondGroup> activityCondGroupMap =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<GroupReplacementData> groupReplacements =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// Cache
|
||||
@Getter private static final IntList scenePointIdList = new IntArrayList();
|
||||
@Getter private static final List<OpenStateData> openStateList = new ArrayList<>();
|
||||
@Getter private static final Map<Integer, List<Integer>> scenePointsPerScene = new HashMap<>();
|
||||
@Getter private static final Map<String, ScriptSceneData> scriptSceneDataMap = new HashMap<>();
|
||||
protected static Int2ObjectMap<IntSet> proudSkillGroupLevels = new Int2ObjectOpenHashMap<>();
|
||||
protected static Int2IntMap proudSkillGroupMaxLevels = new Int2IntOpenHashMap();
|
||||
protected static Int2ObjectMap<IntSet> avatarSkillLevels = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Map<String, ConfigLevelEntity> configLevelEntityDataMap = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<IntSet> proudSkillGroupLevels = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter private static final Int2IntMap proudSkillGroupMaxLevels = new Int2IntOpenHashMap();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<IntSet> avatarSkillLevels = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Map<String, List<QuestData>> beginCondQuestMap =
|
||||
new HashMap<>(); // cache filled by QuestData
|
||||
|
||||
@Getter private static final Map<Integer, Integer> questTalkMap = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2ObjectMap<TrialAvatarCustomData> trialAvatarCustomData =
|
||||
new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Map<Integer, TrialAvatarActivityCustomData> trialAvatarActivityCustomData =
|
||||
new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Map<Integer, TrialAvatarActivityDataData> trialAvatarActivityDataCustomData =
|
||||
new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private static final Int2IntMap trialAvatarIndexIdTrialActivityDataDataMap =
|
||||
new Int2IntOpenHashMap();
|
||||
|
||||
private static final Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||
private static final Map<Integer, List<ShopGoodsData>> shopGoods = new HashMap<>();
|
||||
|
||||
// Getters with wrong names, remove later
|
||||
@Deprecated(forRemoval = true)
|
||||
public static Int2ObjectMap<CodexReliquaryData> getcodexReliquaryIdMap() {
|
||||
return codexReliquaryDataIdMap;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static Int2ObjectMap<DungeonEntryData> getDungeonEntryDatatMap() {
|
||||
return dungeonEntryDataMap;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
@Tolerate
|
||||
public static ArrayList<CodexReliquaryData> getcodexReliquaryArrayList() {
|
||||
return codexReliquaryArrayList;
|
||||
}
|
||||
|
||||
// Getters with different names that stay for now
|
||||
public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() {
|
||||
return mainQuestData;
|
||||
@ -468,6 +564,33 @@ public class GameData {
|
||||
return shopGoods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the route data for a scene by ID.
|
||||
*
|
||||
* @param sceneId The ID of the scene to fetch the route data for.
|
||||
* @return The route data for the scene, or an empty map if the scene has no route data.
|
||||
*/
|
||||
public static Int2ObjectMap<Route> getSceneRoutes(int sceneId) {
|
||||
return sceneRouteData.computeIfAbsent(sceneId, k -> new Int2ObjectOpenHashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the trial data
|
||||
*
|
||||
* @param trialAvatarIndexId
|
||||
* @return
|
||||
*/
|
||||
@Nullable public static TrialAvatarActivityDataData getTrialAvatarActivityDataByAvatarIndex(
|
||||
int trialAvatarIndexId) {
|
||||
// prefer custom data over official data
|
||||
val dataId = trialAvatarIndexIdTrialActivityDataDataMap.get(trialAvatarIndexId);
|
||||
val datamap =
|
||||
GameData.getTrialAvatarActivityDataCustomData().isEmpty()
|
||||
? GameData.getTrialAvatarActivityDataDataMap()
|
||||
: GameData.getTrialAvatarActivityDataCustomData();
|
||||
return datamap.get(dataId);
|
||||
}
|
||||
|
||||
public static Int2ObjectMap<AchievementData> getAchievementDataMap() {
|
||||
AchievementData.divideIntoGroups();
|
||||
return achievementDataMap;
|
||||
|
@ -2,8 +2,8 @@ package emu.grasscutter.data;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.ResourceLoader.AvatarConfig;
|
||||
import emu.grasscutter.data.excels.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.excels.ReliquaryMainPropData;
|
||||
import emu.grasscutter.data.excels.reliquary.ReliquaryAffixData;
|
||||
import emu.grasscutter.data.excels.reliquary.ReliquaryMainPropData;
|
||||
import emu.grasscutter.game.managers.blossom.BlossomConfig;
|
||||
import emu.grasscutter.game.world.SpawnDataEntry;
|
||||
import emu.grasscutter.utils.WeightedList;
|
||||
|
@ -221,14 +221,13 @@ public class ResourceLoader {
|
||||
pointData.setId(pointId);
|
||||
|
||||
GameData.getScenePointIdList().add(pointId);
|
||||
GameData.getScenePointEntries().put(scenePoint.getName(), scenePoint);
|
||||
GameData.scenePointEntryMap.put((sceneId << 16) + pointId, scenePoint);
|
||||
GameData.getScenePointEntryMap().put((sceneId << 16) + pointId, scenePoint);
|
||||
|
||||
pointData.updateDailyDungeon();
|
||||
});
|
||||
GameData.getScenePointsPerScene().put(sceneId, scenePoints);
|
||||
});
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
Grasscutter.getLogger()
|
||||
.error("Scene point files cannot be found, you cannot use teleport waypoints!");
|
||||
}
|
||||
@ -239,19 +238,23 @@ public class ResourceLoader {
|
||||
GameData.getProudSkillDataMap()
|
||||
.forEach(
|
||||
(id, data) ->
|
||||
GameData.proudSkillGroupLevels
|
||||
GameData.getProudSkillGroupLevels()
|
||||
.computeIfAbsent(data.getProudSkillGroupId(), i -> new IntArraySet())
|
||||
.add(data.getLevel()));
|
||||
// All known levels, keyed by avatarSkillId
|
||||
GameData.getAvatarSkillDataMap()
|
||||
.forEach(
|
||||
(id, data) ->
|
||||
GameData.avatarSkillLevels.put(
|
||||
(int) id, GameData.proudSkillGroupLevels.get(data.getProudSkillGroupId())));
|
||||
GameData.getAvatarSkillLevels()
|
||||
.put(
|
||||
(int) id,
|
||||
GameData.getProudSkillGroupLevels().get(data.getProudSkillGroupId())));
|
||||
// Maximum known levels, keyed by proudSkillGroupId
|
||||
GameData.proudSkillGroupLevels.forEach(
|
||||
(id, set) ->
|
||||
GameData.proudSkillGroupMaxLevels.put((int) id, set.intStream().max().getAsInt()));
|
||||
GameData.getProudSkillGroupLevels()
|
||||
.forEach(
|
||||
(id, set) ->
|
||||
GameData.getProudSkillGroupMaxLevels()
|
||||
.put((int) id, set.intStream().max().orElse(-1)));
|
||||
}
|
||||
|
||||
private static void loadAbilityEmbryos() {
|
||||
@ -266,42 +269,41 @@ public class ResourceLoader {
|
||||
|
||||
if (embryoList == null) {
|
||||
// Load from BinOutput
|
||||
val pattern = Pattern.compile("ConfigAvatar_(.+?)\\.json");
|
||||
var pattern = Pattern.compile("ConfigAvatar_(.+?)\\.json");
|
||||
|
||||
val l = new ArrayList<AbilityEmbryoEntry>();
|
||||
try {
|
||||
Files.newDirectoryStream(getResourcePath("BinOutput/Avatar/"), "ConfigAvatar_*.json")
|
||||
.forEach(
|
||||
path -> {
|
||||
val matcher = pattern.matcher(path.getFileName().toString());
|
||||
if (!matcher.find()) return;
|
||||
String avatarName = matcher.group(1);
|
||||
AvatarConfig config;
|
||||
var entries = new ArrayList<AbilityEmbryoEntry>();
|
||||
try (var stream =
|
||||
Files.newDirectoryStream(getResourcePath("BinOutput/Avatar/"), "ConfigAvatar_*.json")) {
|
||||
|
||||
try {
|
||||
config = JsonUtils.loadToClass(path, AvatarConfig.class);
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error loading player ability embryos:", e);
|
||||
return;
|
||||
}
|
||||
stream.forEach(
|
||||
path -> {
|
||||
var matcher = pattern.matcher(path.getFileName().toString());
|
||||
if (!matcher.find()) return;
|
||||
|
||||
if (config.abilities == null) return;
|
||||
var avatarName = matcher.group(1);
|
||||
AvatarConfig config;
|
||||
try {
|
||||
config = JsonUtils.loadToClass(path, AvatarConfig.class);
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error loading player ability embryos:", e);
|
||||
return;
|
||||
}
|
||||
|
||||
int s = config.abilities.size();
|
||||
AbilityEmbryoEntry al =
|
||||
new AbilityEmbryoEntry(
|
||||
avatarName,
|
||||
config.abilities.stream()
|
||||
.map(Object::toString)
|
||||
.toArray(size -> new String[s]));
|
||||
l.add(al);
|
||||
});
|
||||
if (config.abilities == null) return;
|
||||
|
||||
entries.add(
|
||||
new AbilityEmbryoEntry(
|
||||
avatarName,
|
||||
config.abilities.stream()
|
||||
.map(Object::toString)
|
||||
.toArray(size -> new String[config.abilities.size()])));
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Error loading ability embryos: no files found");
|
||||
return;
|
||||
}
|
||||
|
||||
embryoList = l;
|
||||
embryoList = entries;
|
||||
|
||||
try {
|
||||
GameDepot.setPlayerAbilities(
|
||||
@ -351,7 +353,7 @@ public class ResourceLoader {
|
||||
}
|
||||
|
||||
private static void loadAbilityData(AbilityData data) {
|
||||
GameData.abilityDataMap.put(data.abilityName, data);
|
||||
GameData.getAbilityDataMap().put(data.abilityName, data);
|
||||
|
||||
val modifiers = data.modifiers;
|
||||
if (modifiers == null || modifiers.size() == 0) return;
|
||||
|
@ -1,4 +1,3 @@
|
||||
package emu.grasscutter.data.binout.config;
|
||||
|
||||
public class ConfigEntityAvatar extends ConfigEntityBase {
|
||||
}
|
||||
public class ConfigEntityAvatar extends ConfigEntityBase {}
|
||||
|
@ -4,18 +4,14 @@ import emu.grasscutter.data.binout.config.fields.ConfigAbilityData;
|
||||
import emu.grasscutter.data.binout.config.fields.ConfigCombat;
|
||||
import emu.grasscutter.data.binout.config.fields.ConfigCommon;
|
||||
import emu.grasscutter.data.binout.config.fields.ConfigGlobalValue;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ConfigEntityBase {
|
||||
@Nullable
|
||||
ConfigCommon configCommon;
|
||||
@Nullable
|
||||
ConfigCombat combat;
|
||||
@Nullable ConfigCommon configCommon;
|
||||
@Nullable ConfigCombat combat;
|
||||
Collection<ConfigAbilityData> abilities;
|
||||
ConfigGlobalValue globalValue; // used for SGV in monsters and Gadgets
|
||||
|
||||
}
|
||||
|
@ -3,5 +3,4 @@ package emu.grasscutter.data.binout.config;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ConfigEntityMonster extends ConfigEntityBase {
|
||||
}
|
||||
public class ConfigEntityMonster extends ConfigEntityBase {}
|
||||
|
@ -1,13 +1,12 @@
|
||||
package emu.grasscutter.data.binout.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.binout.config.fields.ConfigAbilityData;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
public class ConfigLevelEntity {
|
||||
|
||||
@Getter private List<ConfigAbilityData> abilities; //monster abilities
|
||||
@Getter private List<ConfigAbilityData> abilities; // monster abilities
|
||||
@Getter private List<ConfigAbilityData> avatarAbilities;
|
||||
@Getter private List<ConfigAbilityData> teamAbilities;
|
||||
@Getter private List<Integer> preloadMonsterEntityIDs;
|
||||
|
@ -8,8 +8,11 @@ import lombok.experimental.FieldDefaults;
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class ConfigCombatDie {
|
||||
@SerializedName(value="dieEndTime", alternate={"HGGPMFGGBNC"})
|
||||
@SerializedName(
|
||||
value = "dieEndTime",
|
||||
alternate = {"HGGPMFGGBNC"})
|
||||
double dieEndTime;
|
||||
|
||||
double dieForceDisappearTime;
|
||||
boolean hasAnimatorDie;
|
||||
}
|
||||
|
@ -3,5 +3,4 @@ package emu.grasscutter.data.binout.config.fields;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ConfigCommon {
|
||||
}
|
||||
public class ConfigCommon {}
|
||||
|
@ -1,13 +1,10 @@
|
||||
package emu.grasscutter.data.binout.config.fields;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Contains information about the entities SGVs
|
||||
*/
|
||||
/** Contains information about the entities SGVs */
|
||||
@Data
|
||||
public class ConfigGlobalValue {
|
||||
Set<String> serverGlobalValues;
|
||||
|
@ -1,22 +1,21 @@
|
||||
package emu.grasscutter.data.binout.routes;
|
||||
|
||||
//import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||
// import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum RotAngleType /*implements IntValueEnum */{
|
||||
public enum RotAngleType /*implements IntValueEnum */ {
|
||||
ROT_NONE(-1),
|
||||
ROT_ANGLE_X(0),
|
||||
ROT_ANGLE_Y(1),
|
||||
ROT_ANGLE_Z(2);
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
@Getter private final int id;
|
||||
|
||||
RotAngleType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//@Override
|
||||
// @Override
|
||||
public int getValue() {
|
||||
return id;
|
||||
}
|
||||
|
@ -17,13 +17,11 @@ public class Route {
|
||||
private RotType rotType; // optional
|
||||
private RotAngleType rotAngleType; // optional
|
||||
|
||||
public RouteOuterClass.Route toProto(){
|
||||
val builder = RouteOuterClass.Route.newBuilder()
|
||||
.setRouteType(type.getValue());
|
||||
if(points !=null){
|
||||
for(var routePoint : points){
|
||||
builder.addRoutePoints(routePoint.toProto()
|
||||
.setArriveRange(arriveRange));
|
||||
public RouteOuterClass.Route toProto() {
|
||||
val builder = RouteOuterClass.Route.newBuilder().setRouteType(type.getValue());
|
||||
if (points != null) {
|
||||
for (var routePoint : points) {
|
||||
builder.addRoutePoints(routePoint.toProto().setArriveRange(arriveRange));
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
|
@ -4,7 +4,6 @@ import emu.grasscutter.net.proto.RoutePointOuterClass;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.val;
|
||||
|
||||
@ -12,23 +11,21 @@ import lombok.val;
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class RoutePoint {
|
||||
private Position pos;
|
||||
private int speedLevel; //optional
|
||||
private float waitTime; //optional
|
||||
private float targetVelocity; //optional
|
||||
private boolean hasReachEvent; //optional
|
||||
private int speedLevel; // optional
|
||||
private float waitTime; // optional
|
||||
private float targetVelocity; // optional
|
||||
private boolean hasReachEvent; // optional
|
||||
// rotRoundReachDir //optional Pos with optional values
|
||||
// rotRoundLeaveDir //optional Pos with optional values
|
||||
|
||||
public RoutePointOuterClass.RoutePoint.Builder toProto(){
|
||||
val builder = RoutePointOuterClass.RoutePoint.newBuilder()
|
||||
.setPosition(pos.toProto());
|
||||
if(waitTime!=0){
|
||||
public RoutePointOuterClass.RoutePoint.Builder toProto() {
|
||||
val builder = RoutePointOuterClass.RoutePoint.newBuilder().setPosition(pos.toProto());
|
||||
if (waitTime != 0) {
|
||||
builder.setTime(waitTime);
|
||||
} else if(targetVelocity!=0){
|
||||
} else if (targetVelocity != 0) {
|
||||
builder.setVelocity(targetVelocity);
|
||||
}
|
||||
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package emu.grasscutter.data.binout.routes;
|
||||
|
||||
//import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||
// import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum RouteType /*implements IntValueEnum*/ {
|
||||
@ -9,14 +9,13 @@ public enum RouteType /*implements IntValueEnum*/ {
|
||||
Reciprocate(1),
|
||||
Loop(2);
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
@Getter private final int id;
|
||||
|
||||
RouteType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//@Override
|
||||
// @Override
|
||||
public int getValue() {
|
||||
return id;
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package emu.grasscutter.data.binout.routes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class SceneRoutes {
|
||||
|
@ -4,5 +4,6 @@ import java.util.List;
|
||||
|
||||
public interface BaseTrialActivityData {
|
||||
List<Integer> getAvatarIndexIdList();
|
||||
|
||||
List<Integer> getRewardIdList();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package emu.grasscutter.data.common;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.DailyDungeonData;
|
||||
import emu.grasscutter.data.excels.dungeon.DailyDungeonData;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package emu.grasscutter.data.custom;
|
||||
|
||||
import emu.grasscutter.data.common.BaseTrialActivityData;
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
public class TrialAvatarActivityCustomData implements BaseTrialActivityData {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package emu.grasscutter.data.custom;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
public class TrialAvatarCustomData {
|
||||
|
@ -1,33 +0,0 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "DungeonExcelConfigData.json")
|
||||
public class DungeonData extends GameResource {
|
||||
@Getter(onMethod_ = @Override)
|
||||
private int id;
|
||||
|
||||
@Getter private int sceneId;
|
||||
@Getter private int showLevel;
|
||||
private int passRewardPreviewID;
|
||||
private String involveType; // TODO enum
|
||||
|
||||
private RewardPreviewData previewData;
|
||||
|
||||
@Getter private int statueCostID;
|
||||
@Getter private int statueCostCount;
|
||||
|
||||
public RewardPreviewData getRewardPreview() {
|
||||
return previewData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
if (this.passRewardPreviewID > 0) {
|
||||
this.previewData = GameData.getRewardPreviewDataMap().get(this.passRewardPreviewID);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,8 @@ import emu.grasscutter.data.ResourceType;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data @EqualsAndHashCode(callSuper=false)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ResourceType(name = "GuideTriggerExcelConfigData.json")
|
||||
public class GuideTriggerData extends GameResource {
|
||||
// more like open state guide than quest guide
|
||||
|
@ -1,109 +1,121 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.quest.enums.LogicType;
|
||||
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||
import emu.grasscutter.game.quest.enums.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.*;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@ResourceType(name = "QuestExcelConfigData.json")
|
||||
@Getter
|
||||
@ToString
|
||||
public class QuestData extends GameResource {
|
||||
private int subId;
|
||||
private int mainId;
|
||||
private int order;
|
||||
private long descTextMapHash;
|
||||
@Getter private int subId;
|
||||
@Getter private int mainId;
|
||||
@Getter private int order;
|
||||
@Getter private long descTextMapHash;
|
||||
|
||||
private boolean finishParent;
|
||||
private boolean isRewind;
|
||||
@Getter private boolean finishParent;
|
||||
@Getter private boolean isRewind;
|
||||
|
||||
private LogicType acceptCondComb;
|
||||
private LogicType finishCondComb;
|
||||
private LogicType failCondComb;
|
||||
@Getter private LogicType acceptCondComb;
|
||||
@Getter private LogicType finishCondComb;
|
||||
@Getter private LogicType failCondComb;
|
||||
|
||||
private List<QuestCondition> acceptCond;
|
||||
private List<QuestCondition> finishCond;
|
||||
private List<QuestCondition> failCond;
|
||||
private List<QuestExecParam> beginExec;
|
||||
private List<QuestExecParam> finishExec;
|
||||
private List<QuestExecParam> failExec;
|
||||
private Guide guide;
|
||||
@Getter private List<QuestAcceptCondition> acceptCond;
|
||||
@Getter private List<QuestContentCondition> finishCond;
|
||||
@Getter private List<QuestContentCondition> failCond;
|
||||
@Getter private List<QuestExecParam> beginExec;
|
||||
@Getter private List<QuestExecParam> finishExec;
|
||||
@Getter private List<QuestExecParam> failExec;
|
||||
@Getter private Guide guide;
|
||||
@Getter private List<Integer> trialAvatarList;
|
||||
|
||||
public static String questConditionKey(
|
||||
@Nonnull Enum<?> type, int firstParam, @Nullable String paramsStr) {
|
||||
return type.name() + firstParam + (paramsStr != null ? paramsStr : "");
|
||||
}
|
||||
|
||||
// ResourceLoader not happy if you remove getId() ~~
|
||||
public int getId() {
|
||||
return subId;
|
||||
}
|
||||
|
||||
// Added getSubId() for clarity
|
||||
public int getSubId() {
|
||||
return subId;
|
||||
}
|
||||
|
||||
public int getMainId() {
|
||||
return mainId;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public long getDescTextMapHash() {
|
||||
return descTextMapHash;
|
||||
}
|
||||
|
||||
public boolean finishParent() {
|
||||
return finishParent;
|
||||
}
|
||||
|
||||
public boolean isRewind() {
|
||||
return isRewind;
|
||||
}
|
||||
|
||||
public LogicType getAcceptCondComb() {
|
||||
return acceptCondComb == null ? LogicType.LOGIC_NONE : acceptCondComb;
|
||||
}
|
||||
|
||||
public List<QuestCondition> getAcceptCond() {
|
||||
return acceptCond;
|
||||
}
|
||||
|
||||
public LogicType getFinishCondComb() {
|
||||
return finishCondComb == null ? LogicType.LOGIC_NONE : finishCondComb;
|
||||
}
|
||||
|
||||
public List<QuestCondition> getFinishCond() {
|
||||
return finishCond;
|
||||
}
|
||||
|
||||
public LogicType getFailCondComb() {
|
||||
return failCondComb == null ? LogicType.LOGIC_NONE : failCondComb;
|
||||
}
|
||||
|
||||
public List<QuestCondition> getFailCond() {
|
||||
return failCond;
|
||||
}
|
||||
|
||||
public void onLoad() {
|
||||
this.acceptCond = acceptCond.stream().filter(p -> p.type != null).toList();
|
||||
this.finishCond = finishCond.stream().filter(p -> p.type != null).toList();
|
||||
this.failCond = failCond.stream().filter(p -> p.type != null).toList();
|
||||
this.acceptCond = acceptCond.stream().filter(p -> p.getType() != null).toList();
|
||||
this.finishCond = finishCond.stream().filter(p -> p.getType() != null).toList();
|
||||
this.failCond = failCond.stream().filter(p -> p.getType() != null).toList();
|
||||
|
||||
this.beginExec = beginExec.stream().filter(p -> p.type != null).toList();
|
||||
this.finishExec = finishExec.stream().filter(p -> p.type != null).toList();
|
||||
this.failExec = failExec.stream().filter(p -> p.type != null).toList();
|
||||
|
||||
if (this.acceptCondComb == null) this.acceptCondComb = LogicType.LOGIC_NONE;
|
||||
|
||||
if (this.finishCondComb == null) this.finishCondComb = LogicType.LOGIC_NONE;
|
||||
|
||||
if (this.failCondComb == null) this.failCondComb = LogicType.LOGIC_NONE;
|
||||
|
||||
addToCache();
|
||||
}
|
||||
|
||||
private void addToCache() {
|
||||
if (this.acceptCond == null) {
|
||||
Grasscutter.getLogger().warn("missing AcceptConditions for quest {}", getSubId());
|
||||
return;
|
||||
}
|
||||
|
||||
var cacheMap = GameData.getBeginCondQuestMap();
|
||||
if (getAcceptCond().isEmpty()) {
|
||||
var list =
|
||||
cacheMap.computeIfAbsent(
|
||||
QuestData.questConditionKey(QuestCond.QUEST_COND_NONE, 0, null),
|
||||
e -> new ArrayList<>());
|
||||
list.add(this);
|
||||
} else {
|
||||
this.getAcceptCond()
|
||||
.forEach(
|
||||
questCondition -> {
|
||||
if (questCondition.getType() == null) {
|
||||
Grasscutter.getLogger().warn("null accept type for quest {}", getSubId());
|
||||
return;
|
||||
}
|
||||
|
||||
var key = questCondition.asKey();
|
||||
var list = cacheMap.computeIfAbsent(key, e -> new ArrayList<>());
|
||||
list.add(this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class QuestCondition {
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public static class QuestExecParam {
|
||||
@SerializedName("_type")
|
||||
private QuestTrigger type;
|
||||
QuestExec type;
|
||||
|
||||
@SerializedName("_param")
|
||||
String[] param;
|
||||
|
||||
@SerializedName("_count")
|
||||
String count;
|
||||
}
|
||||
|
||||
public static class QuestAcceptCondition extends QuestCondition<QuestCond> {}
|
||||
|
||||
public static class QuestContentCondition extends QuestCondition<QuestContent> {}
|
||||
|
||||
@Data
|
||||
public static class QuestCondition<TYPE extends Enum<?> & QuestTrigger> {
|
||||
@SerializedName("_type")
|
||||
private TYPE type;
|
||||
|
||||
@SerializedName("_param")
|
||||
private int[] param;
|
||||
@ -112,7 +124,11 @@ public class QuestData extends GameResource {
|
||||
private String paramStr;
|
||||
|
||||
@SerializedName("_count")
|
||||
private String count;
|
||||
private int count;
|
||||
|
||||
public String asKey() {
|
||||
return questConditionKey(getType(), getParam()[0], getParamStr());
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@ -121,17 +137,4 @@ public class QuestData extends GameResource {
|
||||
private List<String> param;
|
||||
private int guideScene;
|
||||
}
|
||||
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class QuestExecParam {
|
||||
@SerializedName("_type")
|
||||
QuestTrigger type;
|
||||
|
||||
@SerializedName("_param")
|
||||
String[] param;
|
||||
|
||||
@SerializedName("_count")
|
||||
String count;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.RefreshType;
|
||||
import emu.grasscutter.game.world.World;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "RefreshPolicyExcelConfigData.json")
|
||||
@ -18,7 +17,7 @@ public class RefreshPolicyExcelConfigData extends GameResource {
|
||||
private static int upperBound(List<Integer> list, int low, int high, int value) {
|
||||
while (low < high) {
|
||||
int middle = (high + low) / 2;
|
||||
if(list.size() >= middle) return low; //Just in case
|
||||
if (list.size() >= middle) return low; // Just in case
|
||||
if (list.get(middle) > value) {
|
||||
high = middle;
|
||||
} else {
|
||||
@ -29,7 +28,7 @@ public class RefreshPolicyExcelConfigData extends GameResource {
|
||||
}
|
||||
|
||||
public int getIntervalInSeconds(World world) {
|
||||
if(time.isEmpty()) return -1;
|
||||
if (time.isEmpty()) return -1;
|
||||
|
||||
var currentTimestamp = world.getTotalGameTimeMinutes();
|
||||
|
||||
@ -37,44 +36,49 @@ public class RefreshPolicyExcelConfigData extends GameResource {
|
||||
List<String> paramsStr = Arrays.asList(time.split(";"));
|
||||
List<Integer> params = paramsStr.stream().map(Integer::parseInt).toList();
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case REFRESH_NONE:
|
||||
return -1;
|
||||
case REFRESH_INTERVAL:
|
||||
if(params.isEmpty()) return -1;
|
||||
if (params.isEmpty()) return -1;
|
||||
return params.get(0);
|
||||
case REFRESH_DAILY:
|
||||
{
|
||||
var dayTime = (world.getTotalGameTimeMinutes() / (24 * 60)) * 24 * 60 * 60;
|
||||
var temp = currentTimestamp - dayTime;
|
||||
var upper_bound_idx = upperBound(params, (int)params.get(0), (int)params.get(params.size() - 1), (int)temp);
|
||||
var upper_bound_idx =
|
||||
upperBound(
|
||||
params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp);
|
||||
var upper_bound = params.get(upper_bound_idx);
|
||||
if(params.get(params.size() - 1) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
} else if(params.get(0) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
if (params.get(params.size() - 1) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
} else if (params.get(0) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
}
|
||||
return (params.get(upper_bound_idx - 1) - params.get(0));
|
||||
}
|
||||
case REFRESH_WEEKlY:
|
||||
if(params.size() < 2) return -1;
|
||||
if (params.size() < 2) return -1;
|
||||
{
|
||||
var weekTime = (world.getTotalGameTimeDays() / 7) * 60 * 60 * 24 * 7;
|
||||
var temp = currentTimestamp - weekTime;
|
||||
var upper_bound_idx = upperBound(params, (int)params.get(0), (int)params.get(params.size() - 1), (int)temp);
|
||||
var upper_bound_idx =
|
||||
upperBound(
|
||||
params, (int) params.get(0), (int) params.get(params.size() - 1), (int) temp);
|
||||
var upper_bound = params.get(upper_bound_idx);
|
||||
if(params.get(params.size() - 1) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
} else if(params.get(0) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
if (params.get(params.size() - 1) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
} else if (params.get(0) == upper_bound) {
|
||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||
}
|
||||
return (params.get(upper_bound_idx - 1) - params.get(0));
|
||||
}
|
||||
case REFRESH_DAYBEGIN_INTERVAL:
|
||||
if(params.size() == 0) return -1;
|
||||
if (params.size() == 0) return -1;
|
||||
return params.get(0) * 60 * 60 * 24;
|
||||
}
|
||||
} catch(Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.props.SceneType;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "SceneExcelConfigData.json")
|
||||
@ -16,4 +17,6 @@ public class SceneData extends GameResource {
|
||||
private SceneType sceneType;
|
||||
|
||||
private String scriptData;
|
||||
private String levelEntityConfig;
|
||||
private List<Integer> specifiedAvatarList;
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.achievement;
|
||||
|
||||
import com.github.davidmoten.guavamini.Lists;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.excels.BattlePassMissionData;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.achievement;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,15 +1,14 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.activity;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditions;
|
||||
import emu.grasscutter.game.quest.enums.LogicType;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ResourceType(name = "NewActivityCondExcelConfigData.json")
|
||||
@Getter
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
@ -19,10 +18,8 @@ public class ActivityCondExcelConfigData extends GameResource {
|
||||
List<ActivityConfigCondition> cond;
|
||||
|
||||
public static class ActivityConfigCondition {
|
||||
@Getter
|
||||
private ActivityConditions type;
|
||||
@Getter
|
||||
private List<Integer> param;
|
||||
@Getter private ActivityConditions type;
|
||||
@Getter private List<Integer> param;
|
||||
|
||||
public int[] paramArray() {
|
||||
return param.stream().mapToInt(Integer::intValue).toArray();
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.activity;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.activity;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.activity;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
@ -23,9 +23,10 @@ public class ActivityWatcherData extends GameResource {
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
triggerConfig.paramList =
|
||||
triggerConfig.paramList.stream().filter(x -> (x != null) && !x.isBlank()).toList();
|
||||
triggerConfig.watcherTriggerType = WatcherTriggerType.getTypeByName(triggerConfig.triggerType);
|
||||
this.triggerConfig.paramList =
|
||||
this.triggerConfig.paramList.stream().filter(x -> (x != null) && !x.isBlank()).toList();
|
||||
this.triggerConfig.watcherTriggerType =
|
||||
WatcherTriggerType.getTypeByName(this.triggerConfig.triggerType);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ -35,5 +36,10 @@ public class ActivityWatcherData extends GameResource {
|
||||
List<String> paramList;
|
||||
|
||||
transient WatcherTriggerType watcherTriggerType;
|
||||
|
||||
public void onLoad() {
|
||||
this.paramList = this.paramList.stream().filter(x -> (x != null) && !x.isBlank()).toList();
|
||||
this.watcherTriggerType = WatcherTriggerType.getTypeByName(this.triggerType);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameData;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
@ -173,16 +173,22 @@ public class AvatarData extends GameResource {
|
||||
*/
|
||||
|
||||
// Cache abilities
|
||||
String[] split = this.iconName.split("_");
|
||||
this.buildEmbryo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create ability embryos.
|
||||
*/
|
||||
public void buildEmbryo() {
|
||||
var split = this.iconName.split("_");
|
||||
if (split.length > 0) {
|
||||
this.name = split[split.length - 1];
|
||||
|
||||
AbilityEmbryoEntry info = GameData.getAbilityEmbryoInfo().get(this.name);
|
||||
var info = GameData.getAbilityEmbryoInfo().get(this.name);
|
||||
if (info != null) {
|
||||
this.abilities = new IntArrayList(info.getAbilities().length);
|
||||
for (String ability : info.getAbilities()) {
|
||||
for (var ability : info.getAbilities())
|
||||
this.abilities.add(Utils.abilityHash(ability));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,18 +1,20 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@ResourceType(name = "AvatarReplaceCostumeExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AvatarReplaceCostumeData extends GameResource {
|
||||
private int avatarId;
|
||||
@SerializedName(value = "costumeId", alternate={"MGLCOPOIJIC", "BDBMOBGKIAP"})
|
||||
private int avatarId;
|
||||
|
||||
@SerializedName(
|
||||
value = "costumeId",
|
||||
alternate = {"MGLCOPOIJIC", "BDBMOBGKIAP"})
|
||||
private int costumeId;
|
||||
|
||||
@Override
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameDepot;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.avatar;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.codex;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.codex;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.codex;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.codex;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.codex;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.dungeon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,18 +1,16 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.dungeon;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
import emu.grasscutter.game.dungeons.challenge.enums.ChallengeType;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "DungeonChallengeConfigData.json")
|
||||
public class DungeonChallengeConfigData extends GameResource {
|
||||
private int id;
|
||||
private int id;
|
||||
private ChallengeType challengeType;
|
||||
private boolean noSuccessHint;
|
||||
private boolean noFailHint;
|
||||
@ -25,45 +23,57 @@ public class DungeonChallengeConfigData extends GameResource {
|
||||
private SubChallengeBannerType subChallengeBannerRule;
|
||||
private InterruptButtonType interruptButtonType;
|
||||
|
||||
@SerializedName(value = "subChallengeSortType", alternate={"PNCLDNBHKDJ"})
|
||||
@SerializedName(
|
||||
value = "subChallengeSortType",
|
||||
alternate = {"PNCLDNBHKDJ"})
|
||||
private SubChallengeSortType subChallengeSortType;
|
||||
@SerializedName(value = "animationOnSubStart", alternate={"DNFAFNMMMDP"})
|
||||
|
||||
@SerializedName(
|
||||
value = "animationOnSubStart",
|
||||
alternate = {"DNFAFNMMMDP"})
|
||||
private AllowAnimationType animationOnSubStart;
|
||||
@SerializedName(value = "animationOnSubSuccess", alternate={"ENONHOGJDDN"})
|
||||
|
||||
@SerializedName(
|
||||
value = "animationOnSubSuccess",
|
||||
alternate = {"ENONHOGJDDN"})
|
||||
private AllowAnimationType animationOnSubSuccess;
|
||||
@SerializedName(value = "animationOnSubFail", alternate={"NJBJIKAIENN"})
|
||||
|
||||
@SerializedName(
|
||||
value = "animationOnSubFail",
|
||||
alternate = {"NJBJIKAIENN"})
|
||||
private AllowAnimationType animationOnSubFail;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public enum InterruptButtonType{
|
||||
public enum InterruptButtonType {
|
||||
INTERRUPT_BUTTON_TYPE_NONE,
|
||||
INTERRUPT_BUTTON_TYPE_HOST,
|
||||
INTERRUPT_BUTTON_TYPE_ALL
|
||||
}
|
||||
|
||||
public enum SubChallengeFadeOutType{
|
||||
public enum SubChallengeFadeOutType {
|
||||
SUBCHALLENGE_FADEOUT_TYPE_NONE,
|
||||
SUBCHALLENGE_FADEOUT_TYPE_SUCCESS,
|
||||
SUBCHALLENGE_FADEOUT_TYPE_FAIL,
|
||||
SUBCHALLENGE_FADEOUT_TYPE_FINISH
|
||||
}
|
||||
|
||||
public enum SubChallengeBannerType{
|
||||
public enum SubChallengeBannerType {
|
||||
SUBCHALLENGE_BANNER_TYPE_NONE,
|
||||
SUBCHALLENGE_BANNER_TYPE_SUCCESS,
|
||||
SUBCHALLENGE_BANNER_TYPE_FAIL,
|
||||
SUBCHALLENGE_BANNER_TYPE_HIDE_FINAL,
|
||||
SUBCHALLENGE_BANNER_TYPE_SHOW_FINAL
|
||||
}
|
||||
public enum SubChallengeSortType{
|
||||
|
||||
public enum SubChallengeSortType {
|
||||
SUB_CHALLENGE_SORT_TYPE_DEFAULT,
|
||||
SUB_CHALLENGE_SORT_TYPE_CHALLENGEINDEX
|
||||
}
|
||||
|
||||
public enum AllowAnimationType{
|
||||
public enum AllowAnimationType {
|
||||
SUB_CHALLENGE_ANIM_TYPE_DEFAULT,
|
||||
SUB_CHALLENGE_ANIM_TYPE_FORBID,
|
||||
SUB_CHALLENGE_ANIM_TYPE_SUCCESS,
|
@ -0,0 +1,71 @@
|
||||
package emu.grasscutter.data.excels.dungeon;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.excels.RewardPreviewData;
|
||||
import emu.grasscutter.game.dungeons.enums.*;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "DungeonExcelConfigData.json")
|
||||
public class DungeonData extends GameResource {
|
||||
|
||||
@Getter(onMethod = @__(@Override))
|
||||
private int id;
|
||||
|
||||
@Getter private int sceneId;
|
||||
@Getter private int showLevel;
|
||||
private DungeonType type;
|
||||
private DungeonSubType subType;
|
||||
private DungeonPlayType playType;
|
||||
private DungeonInvolveType involveType;
|
||||
@Getter private int limitLevel;
|
||||
@Getter private int passCond;
|
||||
@Getter private int reviveMaxCount;
|
||||
@Getter private int settleCountdownTime;
|
||||
@Getter private int failSettleCountdownTime;
|
||||
@Getter private int quitSettleCountdownTime;
|
||||
@Getter private List<SettleShowType> settleShows;
|
||||
@Getter private int passRewardPreviewID;
|
||||
@Getter private int statueCostID;
|
||||
@Getter private int statueCostCount;
|
||||
|
||||
// not part of DungeonExcelConfigData
|
||||
@Getter private RewardPreviewData rewardPreviewData;
|
||||
|
||||
public DungeonType getType() {
|
||||
if (type == null) {
|
||||
return DungeonType.DUNGEON_NONE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public DungeonSubType getSubType() {
|
||||
if (subType == null) {
|
||||
return DungeonSubType.DUNGEON_SUB_NONE;
|
||||
}
|
||||
return subType;
|
||||
}
|
||||
|
||||
public DungeonPlayType getPlayType() {
|
||||
if (playType == null) {
|
||||
return DungeonPlayType.DUNGEON_PLAY_TYPE_NONE;
|
||||
}
|
||||
return playType;
|
||||
}
|
||||
|
||||
public DungeonInvolveType getInvolveType() {
|
||||
if (involveType == null) {
|
||||
return DungeonInvolveType.INVOLVE_NONE;
|
||||
}
|
||||
return involveType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
if (this.passRewardPreviewID > 0) {
|
||||
this.rewardPreviewData = GameData.getRewardPreviewDataMap().get(this.passRewardPreviewID);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.dungeon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,21 +1,19 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.dungeon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
|
||||
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
|
||||
import emu.grasscutter.game.quest.enums.LogicType;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "DungeonPassExcelConfigData.json")
|
||||
public class DungeonPassConfigData extends GameResource {
|
||||
@Getter private int id;
|
||||
@Getter private int id;
|
||||
@Getter private LogicType logicType;
|
||||
@Getter private List<DungeonPassCondition> conds;
|
||||
|
||||
public static class DungeonPassCondition{
|
||||
public static class DungeonPassCondition {
|
||||
@Getter private DungeonPassConditionType condType;
|
||||
@Getter int[] param;
|
||||
}
|
||||
@ -23,6 +21,6 @@ public class DungeonPassConfigData extends GameResource {
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
conds = conds.stream().filter(condition -> condition.getCondType()!=null).toList();
|
||||
conds = conds.stream().filter(condition -> condition.getCondType() != null).toList();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameData;
|
||||
@ -6,6 +6,7 @@ import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.PropGrowCurve;
|
||||
import emu.grasscutter.data.excels.GadgetData;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.game.props.MonsterType;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.monster;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
@ -7,7 +7,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ResourceType(name = "MonsterSpecialNameExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class MonsterSpecialNameData extends GameResource {
|
||||
private int specialNameId;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.reliquary;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.reliquary;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.reliquary;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.reliquary;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import emu.grasscutter.data.GameResource;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.tower;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.tower;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.tower;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,13 +1,13 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.trial;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.common.BaseTrialActivityData;
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@ResourceType(name = "TrialAvatarActivityExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class TrialAvatarActivityData extends GameResource implements BaseTrialActivityData {
|
||||
private int ScheduleId;
|
@ -1,18 +1,20 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.trial;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.excels.activity.ActivityWatcherData;
|
||||
import lombok.*;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@ResourceType(name = "TrialAvatarActivityDataExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class TrialAvatarActivityDataData extends GameResource {
|
||||
@Getter(onMethod = @__(@Override))
|
||||
private int id;
|
||||
|
||||
private int trialAvatarIndexId;
|
||||
private int trialAvatarId;
|
||||
private int dungeonId;
|
||||
@ -23,7 +25,7 @@ public class TrialAvatarActivityDataData extends GameResource {
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
triggerConfig.onLoad();
|
||||
this.triggerConfig.onLoad();
|
||||
GameData.getTrialAvatarIndexIdTrialActivityDataDataMap().put(trialAvatarIndexId, id);
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.trial;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@ResourceType(name = "TrialAvatarExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class TrialAvatarData extends GameResource {
|
||||
private int trialAvatarId;
|
@ -1,12 +1,12 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.trial;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@ResourceType(name = "TrialAvatarTemplateExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class TrialAvatarTemplateData extends GameResource {
|
||||
private int TrialAvatarLevel;
|
@ -1,12 +1,12 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.trial;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import lombok.*;
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
@ResourceType(name = "TrialReliquaryExcelConfigData.json")
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class TrialReliquaryData extends GameResource {
|
||||
private int Id;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.weapon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.weapon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.weapon;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.world;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.world;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,4 +1,4 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
package emu.grasscutter.data.excels.world;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
@ -1,8 +1,7 @@
|
||||
package emu.grasscutter.data.server;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ActivityCondGroup {
|
||||
|
@ -1,12 +1,11 @@
|
||||
package emu.grasscutter.data.server;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.utils.GridPosition;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Grid {
|
||||
public Map<GridPosition, Set<Integer>> grid;
|
||||
@ -19,12 +18,13 @@ public class Grid {
|
||||
GridPosition pos = new GridPosition(position, width);
|
||||
|
||||
Set<Integer> nearbyGroups = new HashSet<>();
|
||||
//construct a nearby pisition list, add 1 more because a player can be in an edge case, this should not affect much the loading
|
||||
for(int x = 0; x < vision_range_grid + 1; x++) {
|
||||
for(int z = 0; z < vision_range_grid + 1; z++) {
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone( x, z), new HashSet<>()));
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone(-x, z), new HashSet<>()));
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone( x, -z), new HashSet<>()));
|
||||
// construct a nearby pisition list, add 1 more because a player can be in an edge case, this
|
||||
// should not affect much the loading
|
||||
for (int x = 0; x < vision_range_grid + 1; x++) {
|
||||
for (int z = 0; z < vision_range_grid + 1; z++) {
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone(x, z), new HashSet<>()));
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone(-x, z), new HashSet<>()));
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone(x, -z), new HashSet<>()));
|
||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone(-x, -z), new HashSet<>()));
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import emu.grasscutter.game.entity.GameEntity;
|
||||
import emu.grasscutter.game.entity.gadget.GadgetGatherObject;
|
||||
import emu.grasscutter.game.player.BasePlayerManager;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.quest.enums.QuestContent;
|
||||
import emu.grasscutter.net.proto.AbilityInvokeEntryHeadOuterClass.AbilityInvokeEntryHead;
|
||||
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
|
||||
import emu.grasscutter.net.proto.AbilityMetaModifierChangeOuterClass.AbilityMetaModifierChange;
|
||||
@ -39,6 +40,7 @@ public final class AbilityManager extends BasePlayerManager {
|
||||
case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke);
|
||||
case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(invoke);
|
||||
case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke);
|
||||
case ABILITY_INVOKE_ARGUMENT_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke);
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
@ -202,6 +204,22 @@ public final class AbilityManager extends BasePlayerManager {
|
||||
this.player.getEnergyManager().handleGenerateElemBall(invoke);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a float value ability entry.
|
||||
*
|
||||
* @param invoke The ability invoke entry.
|
||||
*/
|
||||
private void handleGlobalFloatValue(AbilityInvokeEntry invoke)
|
||||
throws InvalidProtocolBufferException {
|
||||
var entry = AbilityScalarValueEntry.parseFrom(invoke.getAbilityData());
|
||||
if (entry.getKey().hasStr()
|
||||
&& entry.hasFloatValue()
|
||||
&& entry.getFloatValue() == 2.0f
|
||||
&& entry.getKey().getStr().equals("_ABILITY_UziExplode_Count")) {
|
||||
player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_SKILL, 10006);
|
||||
}
|
||||
}
|
||||
|
||||
private void invokeAction(
|
||||
AbilityModifierAction action, GameEntity target, GameEntity sourceEntity) {
|
||||
switch (action.type) {
|
||||
|
@ -6,7 +6,7 @@ import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Transient;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.AchievementData;
|
||||
import emu.grasscutter.data.excels.achievement.AchievementData;
|
||||
import emu.grasscutter.database.DatabaseHelper;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
|
@ -14,7 +14,19 @@ public class ActivityConfigItem {
|
||||
int scheduleId;
|
||||
List<Integer> meetCondList;
|
||||
Date beginTime;
|
||||
Date openTime;
|
||||
Date closeTime;
|
||||
Date endTime;
|
||||
|
||||
transient ActivityHandler activityHandler;
|
||||
|
||||
void onLoad() {
|
||||
if (openTime == null) {
|
||||
this.openTime = beginTime;
|
||||
}
|
||||
|
||||
if (closeTime == null) {
|
||||
this.closeTime = endTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,12 @@ package emu.grasscutter.game.activity;
|
||||
|
||||
import com.esotericsoftware.reflectasm.ConstructorAccess;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.ActivityData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityData;
|
||||
import emu.grasscutter.data.server.ActivityCondGroup;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditionExecutor;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.WatcherTriggerType;
|
||||
import emu.grasscutter.game.quest.enums.QuestCond;
|
||||
import emu.grasscutter.net.proto.ActivityInfoOuterClass;
|
||||
import emu.grasscutter.utils.DateHelper;
|
||||
import java.util.*;
|
||||
@ -19,9 +22,9 @@ import lombok.experimental.FieldDefaults;
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public abstract class ActivityHandler {
|
||||
/** Must set before initWatchers */
|
||||
ActivityConfigItem activityConfigItem;
|
||||
@Getter ActivityConfigItem activityConfigItem;
|
||||
|
||||
ActivityData activityData;
|
||||
@Getter ActivityData activityData;
|
||||
Map<WatcherTriggerType, List<ActivityWatcher>> watchersMap = new HashMap<>();
|
||||
|
||||
public abstract void onProtoBuild(
|
||||
@ -57,6 +60,43 @@ public abstract class ActivityHandler {
|
||||
});
|
||||
}
|
||||
|
||||
protected void triggerCondEvents(Player player) {
|
||||
if (activityData == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var questManager = player.getQuestManager();
|
||||
activityData
|
||||
.getCondGroupId()
|
||||
.forEach(
|
||||
condGroupId -> {
|
||||
var condGroup = GameData.getActivityCondGroupMap().get((int) condGroupId);
|
||||
condGroup
|
||||
.getCondIds()
|
||||
.forEach(
|
||||
condition ->
|
||||
questManager.queueEvent(QuestCond.QUEST_COND_ACTIVITY_COND, condition));
|
||||
});
|
||||
}
|
||||
|
||||
private List<Integer> getActivityConditions() {
|
||||
if (activityData == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return activityData.getCondGroupId().stream()
|
||||
.map(condGroupId -> GameData.getActivityCondGroupMap().get((int) condGroupId))
|
||||
.filter(Objects::nonNull)
|
||||
.map(ActivityCondGroup::getCondIds)
|
||||
.flatMap(Collection::stream)
|
||||
.toList();
|
||||
}
|
||||
|
||||
// TODO handle possible overwrites
|
||||
private List<Integer> getMeetConditions(ActivityConditionExecutor conditionExecutor) {
|
||||
return conditionExecutor.getMeetActivitiesConditions(getActivityConditions());
|
||||
}
|
||||
|
||||
private Map<Integer, PlayerActivityData.WatcherInfo> initWatchersDataForPlayer() {
|
||||
return watchersMap.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
@ -76,7 +116,8 @@ public abstract class ActivityHandler {
|
||||
return playerActivityData;
|
||||
}
|
||||
|
||||
public ActivityInfoOuterClass.ActivityInfo toProto(PlayerActivityData playerActivityData) {
|
||||
public ActivityInfoOuterClass.ActivityInfo toProto(
|
||||
PlayerActivityData playerActivityData, ActivityConditionExecutor conditionExecutor) {
|
||||
var proto = ActivityInfoOuterClass.ActivityInfo.newBuilder();
|
||||
proto
|
||||
.setActivityId(activityConfigItem.getActivityId())
|
||||
@ -85,7 +126,7 @@ public abstract class ActivityHandler {
|
||||
.setBeginTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
||||
.setFirstDayStartTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
||||
.setEndTime(DateHelper.getUnixTime(activityConfigItem.getEndTime()))
|
||||
.addAllMeetCondList(activityConfigItem.getMeetCondList());
|
||||
.addAllMeetCondList(getMeetConditions(conditionExecutor));
|
||||
|
||||
if (playerActivityData != null) {
|
||||
proto.addAllWatcherInfoList(playerActivityData.getAllWatcherInfoList());
|
||||
|
@ -4,6 +4,7 @@ import com.esotericsoftware.reflectasm.ConstructorAccess;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.DataLoader;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.game.activity.condition.*;
|
||||
import emu.grasscutter.game.player.BasePlayerManager;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.ActivityType;
|
||||
@ -12,6 +13,7 @@ import emu.grasscutter.net.proto.ActivityInfoOuterClass;
|
||||
import emu.grasscutter.server.packet.send.PacketActivityScheduleInfoNotify;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import lombok.Getter;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
@ -19,6 +21,8 @@ import org.reflections.Reflections;
|
||||
public class ActivityManager extends BasePlayerManager {
|
||||
private static final Map<Integer, ActivityConfigItem> activityConfigItemMap;
|
||||
@Getter private static final Map<Integer, ActivityConfigItem> scheduleActivityConfigMap;
|
||||
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
||||
private final ActivityConditionExecutor conditionExecutor;
|
||||
|
||||
static {
|
||||
activityConfigItemMap = new HashMap<>();
|
||||
@ -26,30 +30,6 @@ public class ActivityManager extends BasePlayerManager {
|
||||
loadActivityConfigData();
|
||||
}
|
||||
|
||||
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
||||
|
||||
public ActivityManager(Player player) {
|
||||
super(player);
|
||||
|
||||
playerActivityDataMap = new ConcurrentHashMap<>();
|
||||
// load data for player
|
||||
activityConfigItemMap
|
||||
.values()
|
||||
.forEach(
|
||||
item -> {
|
||||
var data = PlayerActivityData.getByPlayer(player, item.getActivityId());
|
||||
if (data == null) {
|
||||
data = item.getActivityHandler().initPlayerActivityData(player);
|
||||
data.save();
|
||||
}
|
||||
data.setPlayer(player);
|
||||
data.setActivityHandler(item.getActivityHandler());
|
||||
playerActivityDataMap.put(item.getActivityId(), data);
|
||||
});
|
||||
|
||||
player.sendPacket(new PacketActivityScheduleInfoNotify(activityConfigItemMap.values()));
|
||||
}
|
||||
|
||||
private static void loadActivityConfigData() {
|
||||
// scan activity type handler & watcher type
|
||||
var activityHandlerTypeMap = new HashMap<ActivityType, ConstructorAccess<?>>();
|
||||
@ -75,6 +55,7 @@ public class ActivityManager extends BasePlayerManager {
|
||||
DataLoader.loadList("ActivityConfig.json", ActivityConfigItem.class)
|
||||
.forEach(
|
||||
item -> {
|
||||
item.onLoad();
|
||||
var activityData = GameData.getActivityDataMap().get(item.getActivityId());
|
||||
if (activityData == null) {
|
||||
Grasscutter.getLogger().warn("activity {} not exist.", item.getActivityId());
|
||||
@ -104,6 +85,36 @@ public class ActivityManager extends BasePlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
public ActivityManager(Player player) {
|
||||
super(player);
|
||||
|
||||
playerActivityDataMap = new ConcurrentHashMap<>();
|
||||
// load data for player
|
||||
activityConfigItemMap
|
||||
.values()
|
||||
.forEach(
|
||||
item -> {
|
||||
var data = PlayerActivityData.getByPlayer(player, item.getActivityId());
|
||||
if (data == null) {
|
||||
data = item.getActivityHandler().initPlayerActivityData(player);
|
||||
data.save();
|
||||
}
|
||||
data.setPlayer(player);
|
||||
data.setActivityHandler(item.getActivityHandler());
|
||||
playerActivityDataMap.put(item.getActivityId(), data);
|
||||
});
|
||||
|
||||
player.sendPacket(new PacketActivityScheduleInfoNotify(activityConfigItemMap.values()));
|
||||
|
||||
conditionExecutor =
|
||||
new BasicActivityConditionExecutor(
|
||||
activityConfigItemMap,
|
||||
GameData.getActivityCondExcelConfigDataMap(),
|
||||
PlayerActivityDataMappingBuilder.buildPlayerActivityDataByActivityCondId(
|
||||
playerActivityDataMap),
|
||||
AllActivityConditionBuilder.buildActivityConditions());
|
||||
}
|
||||
|
||||
/** trigger activity watcher */
|
||||
public void triggerWatcher(WatcherTriggerType watcherTriggerType, String... params) {
|
||||
var watchers =
|
||||
@ -124,11 +135,71 @@ public class ActivityManager extends BasePlayerManager {
|
||||
params));
|
||||
}
|
||||
|
||||
public boolean isActivityActive(int activityId) {
|
||||
var activityConfig = activityConfigItemMap.get(activityId);
|
||||
if (activityConfig == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
return now.after(activityConfig.getBeginTime()) && now.before(activityConfig.getEndTime());
|
||||
}
|
||||
|
||||
public boolean hasActivityEnded(int activityId) {
|
||||
var activityConfig = activityConfigItemMap.get(activityId);
|
||||
if (activityConfig == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return new Date().after(activityConfig.getEndTime());
|
||||
}
|
||||
|
||||
public boolean isActivityOpen(int activityId) {
|
||||
var activityConfig = activityConfigItemMap.get(activityId);
|
||||
if (activityConfig == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
return now.after(activityConfig.getOpenTime()) && now.before(activityConfig.getCloseTime());
|
||||
}
|
||||
|
||||
public int getOpenDay(int activityId) {
|
||||
var activityConfig = activityConfigItemMap.get(activityId);
|
||||
if (activityConfig == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
return (int)
|
||||
TimeUnit.DAYS.convert(
|
||||
now.getTime() - activityConfig.getOpenTime().getTime(), TimeUnit.MILLISECONDS)
|
||||
+ 1;
|
||||
}
|
||||
|
||||
public boolean isActivityClosed(int activityId) {
|
||||
var activityConfig = activityConfigItemMap.get(activityId);
|
||||
if (activityConfig == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
return now.after(activityConfig.getCloseTime());
|
||||
}
|
||||
|
||||
public boolean meetsCondition(int activityCondId) {
|
||||
return conditionExecutor.meetsCondition(activityCondId);
|
||||
}
|
||||
|
||||
public void triggerActivityConditions() {
|
||||
activityConfigItemMap.forEach((k, v) -> v.getActivityHandler().triggerCondEvents(player));
|
||||
}
|
||||
|
||||
public ActivityInfoOuterClass.ActivityInfo getInfoProtoByActivityId(int activityId) {
|
||||
var activityHandler = activityConfigItemMap.get(activityId).getActivityHandler();
|
||||
var activityData = playerActivityDataMap.get(activityId);
|
||||
|
||||
return activityHandler.toProto(activityData);
|
||||
return activityHandler.toProto(activityData, conditionExecutor);
|
||||
}
|
||||
|
||||
public Optional<ActivityHandler> getActivityHandler(ActivityType type) {
|
||||
@ -138,7 +209,6 @@ public class ActivityManager extends BasePlayerManager {
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ActivityHandler> Optional<T> getActivityHandlerAs(
|
||||
ActivityType type, Class<T> clazz) {
|
||||
return getActivityHandler(type).map(x -> (T) x);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package emu.grasscutter.game.activity;
|
||||
|
||||
import emu.grasscutter.data.excels.ActivityWatcherData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityWatcherData;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -5,7 +5,7 @@ import dev.morphia.annotations.Id;
|
||||
import dev.morphia.annotations.Transient;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.common.ItemParamData;
|
||||
import emu.grasscutter.data.excels.ActivityWatcherData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityWatcherData;
|
||||
import emu.grasscutter.database.DatabaseHelper;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
|
@ -1,15 +1,14 @@
|
||||
package emu.grasscutter.game.activity.condition;
|
||||
|
||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
||||
|
||||
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
|
||||
/**
|
||||
* This annotation marks condition types for NewActivityCondExcelConfigData.json ({@link ActivityCondExcelConfigData}). To use it you should mark
|
||||
* class that extends ActivityConditionBaseHandler, and it will be automatically picked during activity manager initiation.
|
||||
*
|
||||
* This annotation marks condition types for NewActivityCondExcelConfigData.json ({@link
|
||||
* ActivityCondExcelConfigData}). To use it you should mark class that extends
|
||||
* ActivityConditionBaseHandler, and it will be automatically picked during activity manager
|
||||
* initiation.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ActivityCondition {
|
||||
|
@ -1,21 +1,23 @@
|
||||
package emu.grasscutter.game.activity.condition;
|
||||
|
||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
|
||||
/**
|
||||
* Base handler for all activity conditions that are listed in NewActivityCondExcelConfigData.json ({@link ActivityCondExcelConfigData})
|
||||
* Base handler for all activity conditions that are listed in NewActivityCondExcelConfigData.json
|
||||
* ({@link ActivityCondExcelConfigData})
|
||||
*/
|
||||
public abstract class ActivityConditionBaseHandler {
|
||||
|
||||
/**
|
||||
* Execute activity condition handler and return result of it's calculation
|
||||
*
|
||||
* @param activityData {@link PlayerActivityData} object containing info about activity
|
||||
* @param activityData {@link PlayerActivityData} object containing info about activity
|
||||
* @param activityConfig
|
||||
* @param params params for handler
|
||||
* @param params params for handler
|
||||
* @return result of condition calculation
|
||||
*/
|
||||
public abstract boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params);
|
||||
public abstract boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params);
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
package emu.grasscutter.game.activity.condition;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
/**
|
||||
* Class that used for scanning classpath, picking up all activity conditions (for NewActivityCondExcelConfigData.json {@link ActivityCondExcelConfigData})
|
||||
* and saving them to map. Check for more info {@link ActivityCondition}
|
||||
* Class that used for scanning classpath, picking up all activity conditions (for
|
||||
* NewActivityCondExcelConfigData.json {@link ActivityCondExcelConfigData}) and saving them to map.
|
||||
* Check for more info {@link ActivityCondition}
|
||||
*/
|
||||
public class AllActivityConditionBuilder {
|
||||
|
||||
@ -20,22 +19,24 @@ public class AllActivityConditionBuilder {
|
||||
*
|
||||
* @return map containing all condition handlers for NewActivityCondExcelConfigData.json
|
||||
*/
|
||||
static public Map<ActivityConditions, ActivityConditionBaseHandler> buildActivityConditions() {
|
||||
public static Map<ActivityConditions, ActivityConditionBaseHandler> buildActivityConditions() {
|
||||
return new AllActivityConditionBuilder().initActivityConditions();
|
||||
}
|
||||
|
||||
private Map<ActivityConditions, ActivityConditionBaseHandler> initActivityConditions() {
|
||||
Reflections reflector = Grasscutter.reflector;
|
||||
return reflector.getTypesAnnotatedWith(ActivityCondition.class).stream()
|
||||
.map(this::newInstance)
|
||||
.map(h -> new AbstractMap.SimpleEntry<>(extractActionType(h), h))
|
||||
.collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
|
||||
.map(this::newInstance)
|
||||
.map(h -> new AbstractMap.SimpleEntry<>(extractActionType(h), h))
|
||||
.collect(
|
||||
Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
|
||||
}
|
||||
|
||||
private ActivityConditions extractActionType(ActivityConditionBaseHandler e) {
|
||||
ActivityCondition condition = e.getClass().getAnnotation(ActivityCondition.class);
|
||||
if (condition == null) {
|
||||
Grasscutter.getLogger().error("Failed to read command type for class {}", e.getClass().getName());
|
||||
Grasscutter.getLogger()
|
||||
.error("Failed to read command type for class {}", e.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -48,13 +49,15 @@ public class AllActivityConditionBuilder {
|
||||
if (result instanceof ActivityConditionBaseHandler) {
|
||||
return (ActivityConditionBaseHandler) result;
|
||||
}
|
||||
Grasscutter.getLogger().error("Failed to initiate activity condition: {}, object have wrong type", clazz.getName());
|
||||
Grasscutter.getLogger()
|
||||
.error(
|
||||
"Failed to initiate activity condition: {}, object have wrong type", clazz.getName());
|
||||
} catch (Exception e) {
|
||||
String message = String.format("Failed to initiate activity condition: %s, %s", clazz.getName(), e.getMessage());
|
||||
String message =
|
||||
String.format(
|
||||
"Failed to initiate activity condition: %s, %s", clazz.getName(), e.getMessage());
|
||||
Grasscutter.getLogger().error(message, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
package emu.grasscutter.game.activity.condition;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.all.UnknownActivityConditionHandler;
|
||||
import emu.grasscutter.game.quest.enums.LogicType;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@ -21,12 +20,14 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
||||
private final Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId;
|
||||
private final Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers;
|
||||
|
||||
private static final UnknownActivityConditionHandler UNKNOWN_CONDITION_HANDLER = new UnknownActivityConditionHandler();
|
||||
private static final UnknownActivityConditionHandler UNKNOWN_CONDITION_HANDLER =
|
||||
new UnknownActivityConditionHandler();
|
||||
|
||||
public BasicActivityConditionExecutor(Map<Integer, ActivityConfigItem> activityConfigItemMap,
|
||||
Int2ObjectMap<ActivityCondExcelConfigData> activityConditions,
|
||||
Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId,
|
||||
Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers) {
|
||||
public BasicActivityConditionExecutor(
|
||||
Map<Integer, ActivityConfigItem> activityConfigItemMap,
|
||||
Int2ObjectMap<ActivityCondExcelConfigData> activityConditions,
|
||||
Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId,
|
||||
Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers) {
|
||||
this.activityConfigItemMap = activityConfigItemMap;
|
||||
this.activityConditions = activityConditions;
|
||||
this.playerActivityDataByActivityCondId = playerActivityDataByActivityCondId;
|
||||
@ -35,9 +36,7 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
||||
|
||||
@Override
|
||||
public List<Integer> getMeetActivitiesConditions(List<Integer> condIds) {
|
||||
return condIds.stream()
|
||||
.filter(this::meetsCondition)
|
||||
.collect(Collectors.toList());
|
||||
return condIds.stream().filter(this::meetsCondition).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +44,8 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
||||
ActivityCondExcelConfigData condData = activityConditions.get(activityCondId);
|
||||
|
||||
if (condData == null) {
|
||||
Grasscutter.getLogger().error("Could not find condition for activity with id = {}", activityCondId);
|
||||
Grasscutter.getLogger()
|
||||
.error("Could not find condition for activity with id = {}", activityCondId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -55,16 +55,20 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
||||
}
|
||||
|
||||
PlayerActivityData activity = playerActivityDataByActivityCondId.get(activityCondId);
|
||||
if(activity==null){
|
||||
if (activity == null) {
|
||||
return false;
|
||||
}
|
||||
ActivityConfigItem activityConfig = activityConfigItemMap.get(activity.getActivityId());
|
||||
List<BooleanSupplier> predicates = condData.getCond()
|
||||
.stream()
|
||||
.map(c -> (BooleanSupplier) () ->
|
||||
activityConditionsHandlers
|
||||
.getOrDefault(c.getType(), UNKNOWN_CONDITION_HANDLER).execute(activity, activityConfig, c.paramArray()))
|
||||
.collect(Collectors.toList());
|
||||
List<BooleanSupplier> predicates =
|
||||
condData.getCond().stream()
|
||||
.map(
|
||||
c ->
|
||||
(BooleanSupplier)
|
||||
() ->
|
||||
activityConditionsHandlers
|
||||
.getOrDefault(c.getType(), UNKNOWN_CONDITION_HANDLER)
|
||||
.execute(activity, activityConfig, c.paramArray()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return LogicType.calculate(condComb, predicates);
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
package emu.grasscutter.game.activity.condition;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap.BasicEntry;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is used for building mapping for PlayerActivityData
|
||||
*/
|
||||
/** This class is used for building mapping for PlayerActivityData */
|
||||
public class PlayerActivityDataMappingBuilder {
|
||||
|
||||
|
||||
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
||||
|
||||
private final Int2ObjectMap<ActivityCondExcelConfigData> activityCondMap;
|
||||
@ -22,10 +18,12 @@ public class PlayerActivityDataMappingBuilder {
|
||||
/**
|
||||
* Build mapping for PlayerActivityData.
|
||||
*
|
||||
* @return mapping for activity data. Key is condId from NewActivityCondExcelConfigData.json ({@link ActivityCondExcelConfigData}) resource,
|
||||
* value is {@link PlayerActivityData} class for related activity.
|
||||
* @return mapping for activity data. Key is condId from NewActivityCondExcelConfigData.json
|
||||
* ({@link ActivityCondExcelConfigData}) resource, value is {@link PlayerActivityData} class
|
||||
* for related activity.
|
||||
*/
|
||||
public static Int2ObjectMap<PlayerActivityData> buildPlayerActivityDataByActivityCondId(Map<Integer, PlayerActivityData> activities) {
|
||||
public static Int2ObjectMap<PlayerActivityData> buildPlayerActivityDataByActivityCondId(
|
||||
Map<Integer, PlayerActivityData> activities) {
|
||||
return new PlayerActivityDataMappingBuilder(activities).buildMappings();
|
||||
}
|
||||
|
||||
@ -37,12 +35,13 @@ public class PlayerActivityDataMappingBuilder {
|
||||
private Int2ObjectMap<PlayerActivityData> buildMappings() {
|
||||
Int2ObjectMap<PlayerActivityData> result = new Int2ObjectRBTreeMap<>();
|
||||
|
||||
activityCondMap
|
||||
.int2ObjectEntrySet()
|
||||
.stream()
|
||||
.map(entry -> new BasicEntry<>(entry.getIntKey(), getPlayerActivityDataByCondId(entry.getIntKey())))
|
||||
.filter(entry -> entry.getValue() != null)
|
||||
.forEach(entry -> result.put(entry.getIntKey(), entry.getValue()));
|
||||
activityCondMap.int2ObjectEntrySet().stream()
|
||||
.map(
|
||||
entry ->
|
||||
new BasicEntry<>(
|
||||
entry.getIntKey(), getPlayerActivityDataByCondId(entry.getIntKey())))
|
||||
.filter(entry -> entry.getValue() != null)
|
||||
.forEach(entry -> result.put(entry.getIntKey(), entry.getValue()));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -52,17 +51,19 @@ public class PlayerActivityDataMappingBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect activity data id by cond id. Cond id comes from condId field from NewActivityCondExcelConfigData.json.
|
||||
* See {@link ActivityCondExcelConfigData} for condId.
|
||||
* <p>
|
||||
* Generally, there are 3 cases:
|
||||
* Detect activity data id by cond id. Cond id comes from condId field from
|
||||
* NewActivityCondExcelConfigData.json. See {@link ActivityCondExcelConfigData} for condId.
|
||||
*
|
||||
* <p>Generally, there are 3 cases:
|
||||
*
|
||||
* <ol>
|
||||
* <li>Activity data id >= 5003. Then cond id will be activity data id plus 3 additional digits.
|
||||
* For example: activity data id = 5087, cond id = 5087xxx (x - any digit)</li>
|
||||
* <li>Activity data id = 5001. Then cond id will be activity data id plus 2 additional digits.
|
||||
* For example: activity data id = 5001, cond id = 5001xx (x - any digit)</li>
|
||||
* <li>Activity data id one of [1001]. Then cond id will be activity data id plus 2 additional digits.
|
||||
* This also applied to activity data id = 1002. For example: activity data id = 1001, cond id = 1001x (x - any digit></li>
|
||||
* <li>Activity data id >= 5003. Then cond id will be activity data id plus 3 additional digits.
|
||||
* For example: activity data id = 5087, cond id = 5087xxx (x - any digit)
|
||||
* <li>Activity data id = 5001. Then cond id will be activity data id plus 2 additional digits.
|
||||
* For example: activity data id = 5001, cond id = 5001xx (x - any digit)
|
||||
* <li>Activity data id one of [1001]. Then cond id will be activity data id plus 2 additional
|
||||
* digits. This also applied to activity data id = 1002. For example: activity data id =
|
||||
* 1001, cond id = 1001x (x - any digit>
|
||||
* </ol>
|
||||
*
|
||||
* @param key cond id for which activity data id should be defined
|
||||
|
@ -1,16 +1,17 @@
|
||||
package emu.grasscutter.game.activity.condition.all;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_DAYS_LESS;
|
||||
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_DAYS_LESS;
|
||||
|
||||
@ActivityCondition(NEW_ACTIVITY_COND_DAYS_LESS)
|
||||
public class DayLess extends ActivityConditionBaseHandler {
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
return true; //TODO implement this and add possibility to always return true
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
return true; // TODO implement this and add possibility to always return true
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
package emu.grasscutter.game.activity.condition.all;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_DAYS_GREAT_EQUAL;
|
||||
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_DAYS_GREAT_EQUAL;
|
||||
|
||||
@ActivityCondition(NEW_ACTIVITY_COND_DAYS_GREAT_EQUAL)
|
||||
public class DaysGreatEqual extends ActivityConditionBaseHandler {
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
Date activityBeginTime = activityConfig.getBeginTime();
|
||||
long timeDiff = System.currentTimeMillis() - activityBeginTime.getTime();
|
||||
int days = (int) (timeDiff / (1000 * 60 * 60 * 24L));
|
||||
|
@ -11,11 +11,12 @@ import lombok.val;
|
||||
public class FinishWatcher extends ActivityConditionBaseHandler {
|
||||
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
val watcherMap = activityData.getWatcherInfoMap();
|
||||
for (int param : params) {
|
||||
val watcher = watcherMap.get(param);
|
||||
if(watcher == null || !watcher.isFinished()){
|
||||
if (watcher == null || !watcher.isFinished()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,21 @@
|
||||
package emu.grasscutter.game.activity.condition.all;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_NOT_FINISH_TALK;
|
||||
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_NOT_FINISH_TALK;
|
||||
|
||||
@ActivityCondition(NEW_ACTIVITY_COND_NOT_FINISH_TALK)
|
||||
public class NotFinishTalk extends ActivityConditionBaseHandler {
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
return activityData
|
||||
.getPlayer()
|
||||
.getQuestManager()
|
||||
.getMainQuests()
|
||||
.int2ObjectEntrySet()
|
||||
.stream()
|
||||
.noneMatch(q -> q.getValue().getTalks().get(params[0]) != null); //FIXME taken from ContentCompleteTalk
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
return activityData.getPlayer().getQuestManager().getMainQuests().int2ObjectEntrySet().stream()
|
||||
.noneMatch(
|
||||
q ->
|
||||
q.getValue().getTalks().get(params[0])
|
||||
!= null); // FIXME taken from ContentCompleteTalk
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
package emu.grasscutter.game.activity.condition.all;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_PLAYER_LEVEL_GREAT_EQUAL;
|
||||
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_PLAYER_LEVEL_GREAT_EQUAL;
|
||||
|
||||
@ActivityCondition(NEW_ACTIVITY_COND_PLAYER_LEVEL_GREAT_EQUAL)
|
||||
public class PlayerLevelGreatEqualActivityActivityCondition extends ActivityConditionBaseHandler {
|
||||
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
return activityData.getPlayer().getLevel() >= params[0];
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package emu.grasscutter.game.activity.condition.all;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_QUEST_FINISH;
|
||||
|
||||
import emu.grasscutter.game.activity.ActivityConfigItem;
|
||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||
@ -7,16 +9,12 @@ import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||
import emu.grasscutter.game.quest.GameQuest;
|
||||
import emu.grasscutter.game.quest.enums.QuestState;
|
||||
|
||||
import static emu.grasscutter.game.activity.condition.ActivityConditions.NEW_ACTIVITY_COND_QUEST_FINISH;
|
||||
|
||||
@ActivityCondition(NEW_ACTIVITY_COND_QUEST_FINISH)
|
||||
public class QuestFinished extends ActivityConditionBaseHandler {
|
||||
@Override
|
||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
GameQuest quest = activityData
|
||||
.getPlayer()
|
||||
.getQuestManager()
|
||||
.getQuestById(params[0]);
|
||||
public boolean execute(
|
||||
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||
GameQuest quest = activityData.getPlayer().getQuestManager().getQuestById(params[0]);
|
||||
|
||||
return quest != null && quest.getState() == QuestState.QUEST_STATE_FINISHED;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user