mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-11 04:15:36 +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.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.data.GameData;
|
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.AchievementControlReturns;
|
||||||
import emu.grasscutter.game.achievement.Achievements;
|
import emu.grasscutter.game.achievement.Achievements;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
permissionTargeted = "player.achievement.others",
|
permissionTargeted = "player.achievement.others",
|
||||||
targetRequirement = Command.TargetRequirement.PLAYER,
|
targetRequirement = Command.TargetRequirement.PLAYER,
|
||||||
threading = true)
|
threading = true)
|
||||||
public class AchievementCommand implements CommandHandler {
|
public final class AchievementCommand implements CommandHandler {
|
||||||
private static void sendSuccessMessage(Player sender, String cmd, Object... args) {
|
private static void sendSuccessMessage(Player sender, String cmd, Object... args) {
|
||||||
CommandHandler.sendTranslatedMessage(
|
CommandHandler.sendTranslatedMessage(
|
||||||
sender, AchievementControlReturns.Return.SUCCESS.getKey() + cmd, args);
|
sender, AchievementControlReturns.Return.SUCCESS.getKey() + cmd, args);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package emu.grasscutter.command.commands;
|
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.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.entity.*;
|
import emu.grasscutter.game.entity.*;
|
||||||
@ -9,32 +12,29 @@ import emu.grasscutter.game.props.FightProperty;
|
|||||||
import emu.grasscutter.game.world.Scene;
|
import emu.grasscutter.game.world.Scene;
|
||||||
import emu.grasscutter.server.event.entity.EntityDamageEvent;
|
import emu.grasscutter.server.event.entity.EntityDamageEvent;
|
||||||
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
|
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import lombok.Setter;
|
||||||
import static emu.grasscutter.command.CommandHelpers.*;
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
label = "entity",
|
label = "entity",
|
||||||
usage = {
|
usage = {
|
||||||
"<configId gadget> [state<state>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]",
|
"<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>]"},
|
"<configId monster> [ai<aiId>] [maxhp<maxhp>] [hp<hp>(0 for infinite)] [atk<atk>] [def<def>]"
|
||||||
|
},
|
||||||
permission = "server.entity")
|
permission = "server.entity")
|
||||||
public final class EntityCommand implements CommandHandler {
|
public final class EntityCommand implements CommandHandler {
|
||||||
private static final Map<Pattern, BiConsumer<EntityParameters, Integer>> intCommandHandlers = Map.ofEntries(
|
private static final Map<Pattern, BiConsumer<EntityParameters, Integer>> intCommandHandlers =
|
||||||
|
Map.ofEntries(
|
||||||
Map.entry(stateRegex, EntityParameters::setState),
|
Map.entry(stateRegex, EntityParameters::setState),
|
||||||
Map.entry(maxHPRegex, EntityParameters::setMaxHP),
|
Map.entry(maxHPRegex, EntityParameters::setMaxHP),
|
||||||
Map.entry(hpRegex, EntityParameters::setHp),
|
Map.entry(hpRegex, EntityParameters::setHp),
|
||||||
Map.entry(defRegex, EntityParameters::setDef),
|
Map.entry(defRegex, EntityParameters::setDef),
|
||||||
Map.entry(atkRegex, EntityParameters::setAtk),
|
Map.entry(atkRegex, EntityParameters::setAtk),
|
||||||
Map.entry(aiRegex, EntityParameters::setAi)
|
Map.entry(aiRegex, EntityParameters::setAi));
|
||||||
);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
@ -57,7 +57,7 @@ public final class EntityCommand implements CommandHandler {
|
|||||||
param.scene = targetPlayer.getScene();
|
param.scene = targetPlayer.getScene();
|
||||||
var entity = param.scene.getEntityByConfigId(param.configId);
|
var entity = param.scene.getEntityByConfigId(param.configId);
|
||||||
|
|
||||||
if(entity == null){
|
if (entity == null) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.entity.not_found_error"));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.entity.not_found_error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -68,25 +68,23 @@ public final class EntityCommand implements CommandHandler {
|
|||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.status.success"));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.status.success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void applyGadgetParams(GameEntity entity, EntityParameters param) {
|
private void applyGadgetParams(GameEntity entity, EntityParameters param) {
|
||||||
if(!(entity instanceof EntityGadget)){
|
if (!(entity instanceof EntityGadget)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(param.state != -1 ){
|
if (param.state != -1) {
|
||||||
((EntityGadget) entity).updateState(param.state);
|
((EntityGadget) entity).updateState(param.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyMonsterParams(GameEntity entity, EntityParameters param) {
|
private void applyMonsterParams(GameEntity entity, EntityParameters param) {
|
||||||
if(!(entity instanceof EntityMonster)){
|
if (!(entity instanceof EntityMonster)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param.ai != -1 ){
|
if (param.ai != -1) {
|
||||||
((EntityMonster) entity).setAiId(param.ai);
|
((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 targetHp = param.hp == 0 ? Float.MAX_VALUE : param.hp;
|
||||||
float oldHp = entity.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
|
float oldHp = entity.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP);
|
||||||
setFightProperty(entity, FightProperty.FIGHT_PROP_CUR_HP, targetHp, changedFields);
|
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);
|
callHPEvents(entity, event);
|
||||||
}
|
}
|
||||||
if (param.atk != -1) {
|
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_DEFENSE, param.def, changedFields);
|
||||||
setFightProperty(entity, FightProperty.FIGHT_PROP_CUR_DEFENSE, param.def, changedFields);
|
setFightProperty(entity, FightProperty.FIGHT_PROP_CUR_DEFENSE, param.def, changedFields);
|
||||||
}
|
}
|
||||||
if(!changedFields.isEmpty()) {
|
if (!changedFields.isEmpty()) {
|
||||||
entity.getScene().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, changedFields));
|
entity
|
||||||
|
.getScene()
|
||||||
|
.broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, changedFields));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callHPEvents(GameEntity entity, EntityDamageEvent event){
|
private void callHPEvents(GameEntity entity, EntityDamageEvent event) {
|
||||||
entity.callLuaHPEvent(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);
|
entity.setFightProperty(property, value);
|
||||||
modifiedProps.add(property);
|
modifiedProps.add(property);
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ import emu.grasscutter.command.Command;
|
|||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.GameDepot;
|
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.ItemData;
|
||||||
import emu.grasscutter.data.excels.ReliquaryAffixData;
|
import emu.grasscutter.data.excels.reliquary.ReliquaryAffixData;
|
||||||
import emu.grasscutter.data.excels.ReliquaryMainPropData;
|
import emu.grasscutter.data.excels.reliquary.ReliquaryMainPropData;
|
||||||
import emu.grasscutter.game.avatar.Avatar;
|
import emu.grasscutter.game.avatar.Avatar;
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.inventory.ItemType;
|
import emu.grasscutter.game.inventory.ItemType;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.world.SceneGroupInstance;
|
import emu.grasscutter.game.world.SceneGroupInstance;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
@Command(
|
||||||
|
label = "group",
|
||||||
@Command(label = "group",
|
|
||||||
aliases = {"g"},
|
aliases = {"g"},
|
||||||
usage = {"(refresh) [<groupId>] [<suiteId>]"},
|
usage = {"(refresh) [<groupId>] [<suiteId>]"},
|
||||||
permission = "player.group",
|
permission = "player.group",
|
||||||
@ -25,20 +25,18 @@ public final class GroupCommand implements CommandHandler {
|
|||||||
|
|
||||||
int groupId = 0;
|
int groupId = 0;
|
||||||
int suiteId = 0;
|
int suiteId = 0;
|
||||||
switch (args.size()){
|
switch (args.size()) {
|
||||||
case 2:
|
case 2:
|
||||||
try {
|
try {
|
||||||
suiteId = Integer.parseInt(args.get(1));
|
suiteId = Integer.parseInt(args.get(1));
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_suiteid"));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_suiteid"));
|
||||||
return;
|
return;
|
||||||
} // Fallthrough
|
} // Fallthrough
|
||||||
case 1:
|
case 1:
|
||||||
try {
|
try {
|
||||||
groupId = Integer.parseInt(args.get(0));
|
groupId = Integer.parseInt(args.get(0));
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_groupid"));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.group.invalid_groupid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,13 +48,15 @@ public final class GroupCommand implements CommandHandler {
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "refresh" -> {
|
case "refresh" -> {
|
||||||
SceneGroupInstance groupInstance = targetPlayer.getScene().getScriptManager().getGroupInstanceById(groupId);
|
SceneGroupInstance groupInstance =
|
||||||
if(groupInstance == null) {
|
targetPlayer.getScene().getScriptManager().getGroupInstanceById(groupId);
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.group_not_found", groupId));
|
if (groupInstance == null) {
|
||||||
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.group.group_not_found", groupId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.size() >= 2) {
|
if (args.size() >= 2) {
|
||||||
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance, suiteId, false);
|
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance, suiteId, false);
|
||||||
} else {
|
} else {
|
||||||
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance);
|
targetPlayer.getScene().getScriptManager().refreshGroup(groupInstance);
|
||||||
|
@ -9,7 +9,7 @@ import emu.grasscutter.command.CommandHandler;
|
|||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.excels.GadgetData;
|
import emu.grasscutter.data.excels.GadgetData;
|
||||||
import emu.grasscutter.data.excels.ItemData;
|
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.entity.*;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.props.EntityType;
|
import emu.grasscutter.game.props.EntityType;
|
||||||
|
@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
|
|||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.data.GameData;
|
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.avatar.Avatar;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.utils.Language;
|
import emu.grasscutter.utils.Language;
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
package emu.grasscutter.command.commands;
|
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.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
|
||||||
import emu.grasscutter.game.activity.trialavatar.TrialAvatarActivityHandler;
|
import emu.grasscutter.game.activity.trialavatar.TrialAvatarActivityHandler;
|
||||||
import emu.grasscutter.game.activity.trialavatar.TrialAvatarPlayerData;
|
import emu.grasscutter.game.activity.trialavatar.TrialAvatarPlayerData;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.props.ActivityType;
|
import emu.grasscutter.game.props.ActivityType;
|
||||||
import emu.grasscutter.net.proto.ActivityInfoOuterClass.ActivityInfo;
|
|
||||||
import emu.grasscutter.server.packet.send.PacketActivityInfoNotify;
|
import emu.grasscutter.server.packet.send.PacketActivityInfoNotify;
|
||||||
import emu.grasscutter.utils.JsonUtils;
|
import emu.grasscutter.utils.JsonUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
label = "trialAvatarActivity",
|
label = "trialAvatarActivity",
|
||||||
aliases = {"taa"},
|
aliases = {"taa"},
|
||||||
usage = {"change <scheduleId>", "toggleDungeon <index(start from 1)|all>", "toggleReward <index(start from 1)|all>"},
|
usage = {
|
||||||
|
"change <scheduleId>",
|
||||||
|
"toggleDungeon <index(start from 1)|all>",
|
||||||
|
"toggleReward <index(start from 1)|all>"
|
||||||
|
},
|
||||||
permission = "player.trialavataractivity",
|
permission = "player.trialavataractivity",
|
||||||
permissionTargeted = "player.trialavataractivity.others")
|
permissionTargeted = "player.trialavataractivity.others")
|
||||||
public final class TrialAvatarActivityCommand implements CommandHandler {
|
public final class TrialAvatarActivityCommand implements CommandHandler {
|
||||||
@ -31,95 +30,127 @@ public final class TrialAvatarActivityCommand implements CommandHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String action = args.get(0).toLowerCase();
|
var action = args.get(0).toLowerCase();
|
||||||
String param = args.get(1);
|
var param = args.get(1);
|
||||||
|
|
||||||
val playerDataOption = targetPlayer.getActivityManager()
|
var playerDataOption =
|
||||||
|
targetPlayer
|
||||||
|
.getActivityManager()
|
||||||
.getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_TRIAL_AVATAR);
|
.getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_TRIAL_AVATAR);
|
||||||
if (playerDataOption == null) {
|
if (playerDataOption.isEmpty()) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
CommandHandler.sendMessage(
|
||||||
return;
|
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||||
}
|
|
||||||
val playerData = playerDataOption.get();
|
|
||||||
if (playerData == null) {
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var playerData = playerDataOption.get();
|
||||||
var handler = (TrialAvatarActivityHandler) playerData.getActivityHandler();
|
var handler = (TrialAvatarActivityHandler) playerData.getActivityHandler();
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TrialAvatarPlayerData trialAvatarPlayerData = JsonUtils.decode(playerData.getDetail(), TrialAvatarPlayerData.class);
|
|
||||||
|
var trialAvatarPlayerData =
|
||||||
|
JsonUtils.decode(playerData.getDetail(), TrialAvatarPlayerData.class);
|
||||||
if (trialAvatarPlayerData == null) {
|
if (trialAvatarPlayerData == null) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.not_found"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
default -> {
|
default -> this.sendUsageMessage(sender);
|
||||||
sendUsageMessage(sender);
|
|
||||||
}
|
|
||||||
case "change" -> {
|
case "change" -> {
|
||||||
if (!param.chars().allMatch(Character::isDigit)) { // if its not number
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (TrialAvatarPlayerData.getAvatarIdList(Integer.parseInt(param)).isEmpty()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
playerData.setDetail(TrialAvatarPlayerData.create(Integer.parseInt(param)));
|
playerData.setDetail(TrialAvatarPlayerData.create(Integer.parseInt(param)));
|
||||||
playerData.save();
|
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" -> {
|
case "toggledungeon" -> {
|
||||||
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
||||||
if (Integer.parseInt(param)-1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
if (Integer.parseInt(param) - 1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||||
|| Integer.parseInt(param)-1 <= 0) {
|
|| Integer.parseInt(param) - 1 <= 0) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||||
return;
|
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());
|
rewardInfo.setPassedDungeon(!rewardInfo.isPassedDungeon());
|
||||||
playerData.setDetail(trialAvatarPlayerData);
|
playerData.setDetail(trialAvatarPlayerData);
|
||||||
playerData.save();
|
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 {
|
} else {
|
||||||
if (!param.equals("all")) {
|
if (!param.equals("all")) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trialAvatarPlayerData.getRewardInfoList().forEach(r -> r.setPassedDungeon(!r.isPassedDungeon()));
|
trialAvatarPlayerData
|
||||||
|
.getRewardInfoList()
|
||||||
|
.forEach(r -> r.setPassedDungeon(!r.isPassedDungeon()));
|
||||||
playerData.setDetail(trialAvatarPlayerData);
|
playerData.setDetail(trialAvatarPlayerData);
|
||||||
playerData.save();
|
playerData.save();
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.success_dungeon_all"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.success_dungeon_all"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "togglereward" -> {
|
case "togglereward" -> {
|
||||||
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
if (param.chars().allMatch(Character::isDigit)) { // if its number
|
||||||
if (Integer.parseInt(param)-1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
if (Integer.parseInt(param) - 1 >= trialAvatarPlayerData.getRewardInfoList().size()
|
||||||
|| Integer.parseInt(param)-1 <= 0) {
|
|| Integer.parseInt(param) - 1 <= 0) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||||
return;
|
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());
|
rewardInfo.setReceivedReward(!rewardInfo.isReceivedReward());
|
||||||
playerData.setDetail(trialAvatarPlayerData);
|
playerData.setDetail(trialAvatarPlayerData);
|
||||||
playerData.save();
|
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 {
|
} else {
|
||||||
if (!param.toLowerCase().equals("all")) {
|
if (!param.toLowerCase().equals("all")) {
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
CommandHandler.sendMessage(
|
||||||
|
sender, translate(sender, "commands.trialAvatarActivity.invalid_param"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trialAvatarPlayerData.getRewardInfoList().forEach(r -> r.setReceivedReward(!r.isReceivedReward()));
|
trialAvatarPlayerData
|
||||||
|
.getRewardInfoList()
|
||||||
|
.forEach(r -> r.setReceivedReward(!r.isReceivedReward()));
|
||||||
playerData.setDetail(trialAvatarPlayerData);
|
playerData.setDetail(trialAvatarPlayerData);
|
||||||
playerData.save();
|
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.Grasscutter;
|
||||||
import emu.grasscutter.data.binout.*;
|
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.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 emu.grasscutter.utils.Utils;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.Tolerate;
|
import lombok.val;
|
||||||
|
|
||||||
public class GameData {
|
@SuppressWarnings({"unused", "MismatchedQueryAndUpdateOfCollection"})
|
||||||
protected static final Map<String, AbilityData> abilityDataMap = new HashMap<>();
|
public final class GameData {
|
||||||
protected static final Int2ObjectMap<ScenePointEntry> scenePointEntryMap =
|
@Getter private static final Map<String, AbilityData> abilityDataMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final Int2ObjectMap<ScenePointEntry> scenePointEntryMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
// BinOutputs
|
// BinOutputs
|
||||||
@Getter
|
@Getter
|
||||||
private static final Int2ObjectMap<HomeworldDefaultSaveData> homeworldDefaultSaveData =
|
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, ConfigGadget> gadgetConfigData = new HashMap<>();
|
||||||
@Getter private static final Map<String, OpenConfigEntry> openConfigEntries = 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<MainQuestData> mainQuestData = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<QuestEncryptionKey> questsKeys = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<QuestEncryptionKey> questsKeys = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<SceneNpcBornData> npcBornData = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<SceneNpcBornData> npcBornData = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Map<String, AbilityEmbryoEntry> abilityEmbryos = new HashMap<>();
|
private static final Map<String, AbilityEmbryoEntry> abilityEmbryos = new HashMap<>();
|
||||||
|
|
||||||
// ExcelConfigs
|
// 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
|
@Getter
|
||||||
private static final ArrayList<CodexReliquaryData> codexReliquaryArrayList = new ArrayList<>();
|
private static final ArrayList<CodexReliquaryData> codexReliquaryArrayList = new ArrayList<>();
|
||||||
|
|
||||||
@ -276,6 +310,26 @@ public class GameData {
|
|||||||
private static final Int2ObjectMap<TriggerExcelConfigData> triggerExcelConfigDataMap =
|
private static final Int2ObjectMap<TriggerExcelConfigData> triggerExcelConfigDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
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
|
@Getter
|
||||||
private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap =
|
private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
@ -299,6 +353,16 @@ public class GameData {
|
|||||||
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap =
|
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
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 =
|
private static final Int2ObjectMap<AvatarPromoteData> avatarPromoteDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
@ -306,6 +370,7 @@ public class GameData {
|
|||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap =
|
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
// The following are accessed via getMapByResourceDef, and will show as unused
|
// The following are accessed via getMapByResourceDef, and will show as unused
|
||||||
private static final Int2ObjectMap<CodexMaterialData> codexMaterialDataMap =
|
private static final Int2ObjectMap<CodexMaterialData> codexMaterialDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
new Int2ObjectOpenHashMap<>();
|
||||||
@ -316,34 +381,65 @@ public class GameData {
|
|||||||
private static final Int2ObjectMap<CodexWeaponData> codexWeaponDataMap =
|
private static final Int2ObjectMap<CodexWeaponData> codexWeaponDataMap =
|
||||||
new Int2ObjectOpenHashMap<>();
|
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
|
// Cache
|
||||||
@Getter private static final IntList scenePointIdList = new IntArrayList();
|
@Getter private static final IntList scenePointIdList = new IntArrayList();
|
||||||
@Getter private static final List<OpenStateData> openStateList = new ArrayList<>();
|
@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<Integer, List<Integer>> scenePointsPerScene = new HashMap<>();
|
||||||
@Getter private static final Map<String, ScriptSceneData> scriptSceneDataMap = 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();
|
@Getter
|
||||||
protected static Int2ObjectMap<IntSet> avatarSkillLevels = new Int2ObjectOpenHashMap<>();
|
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<Integer>> fetters = new HashMap<>();
|
||||||
private static final Map<Integer, List<ShopGoodsData>> shopGoods = 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
|
// Getters with different names that stay for now
|
||||||
public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() {
|
public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() {
|
||||||
return mainQuestData;
|
return mainQuestData;
|
||||||
@ -468,6 +564,33 @@ public class GameData {
|
|||||||
return shopGoods;
|
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() {
|
public static Int2ObjectMap<AchievementData> getAchievementDataMap() {
|
||||||
AchievementData.divideIntoGroups();
|
AchievementData.divideIntoGroups();
|
||||||
return achievementDataMap;
|
return achievementDataMap;
|
||||||
|
@ -2,8 +2,8 @@ package emu.grasscutter.data;
|
|||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.ResourceLoader.AvatarConfig;
|
import emu.grasscutter.data.ResourceLoader.AvatarConfig;
|
||||||
import emu.grasscutter.data.excels.ReliquaryAffixData;
|
import emu.grasscutter.data.excels.reliquary.ReliquaryAffixData;
|
||||||
import emu.grasscutter.data.excels.ReliquaryMainPropData;
|
import emu.grasscutter.data.excels.reliquary.ReliquaryMainPropData;
|
||||||
import emu.grasscutter.game.managers.blossom.BlossomConfig;
|
import emu.grasscutter.game.managers.blossom.BlossomConfig;
|
||||||
import emu.grasscutter.game.world.SpawnDataEntry;
|
import emu.grasscutter.game.world.SpawnDataEntry;
|
||||||
import emu.grasscutter.utils.WeightedList;
|
import emu.grasscutter.utils.WeightedList;
|
||||||
|
@ -221,14 +221,13 @@ public class ResourceLoader {
|
|||||||
pointData.setId(pointId);
|
pointData.setId(pointId);
|
||||||
|
|
||||||
GameData.getScenePointIdList().add(pointId);
|
GameData.getScenePointIdList().add(pointId);
|
||||||
GameData.getScenePointEntries().put(scenePoint.getName(), scenePoint);
|
GameData.getScenePointEntryMap().put((sceneId << 16) + pointId, scenePoint);
|
||||||
GameData.scenePointEntryMap.put((sceneId << 16) + pointId, scenePoint);
|
|
||||||
|
|
||||||
pointData.updateDailyDungeon();
|
pointData.updateDailyDungeon();
|
||||||
});
|
});
|
||||||
GameData.getScenePointsPerScene().put(sceneId, scenePoints);
|
GameData.getScenePointsPerScene().put(sceneId, scenePoints);
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException ignored) {
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.error("Scene point files cannot be found, you cannot use teleport waypoints!");
|
.error("Scene point files cannot be found, you cannot use teleport waypoints!");
|
||||||
}
|
}
|
||||||
@ -239,19 +238,23 @@ public class ResourceLoader {
|
|||||||
GameData.getProudSkillDataMap()
|
GameData.getProudSkillDataMap()
|
||||||
.forEach(
|
.forEach(
|
||||||
(id, data) ->
|
(id, data) ->
|
||||||
GameData.proudSkillGroupLevels
|
GameData.getProudSkillGroupLevels()
|
||||||
.computeIfAbsent(data.getProudSkillGroupId(), i -> new IntArraySet())
|
.computeIfAbsent(data.getProudSkillGroupId(), i -> new IntArraySet())
|
||||||
.add(data.getLevel()));
|
.add(data.getLevel()));
|
||||||
// All known levels, keyed by avatarSkillId
|
// All known levels, keyed by avatarSkillId
|
||||||
GameData.getAvatarSkillDataMap()
|
GameData.getAvatarSkillDataMap()
|
||||||
.forEach(
|
.forEach(
|
||||||
(id, data) ->
|
(id, data) ->
|
||||||
GameData.avatarSkillLevels.put(
|
GameData.getAvatarSkillLevels()
|
||||||
(int) id, GameData.proudSkillGroupLevels.get(data.getProudSkillGroupId())));
|
.put(
|
||||||
|
(int) id,
|
||||||
|
GameData.getProudSkillGroupLevels().get(data.getProudSkillGroupId())));
|
||||||
// Maximum known levels, keyed by proudSkillGroupId
|
// Maximum known levels, keyed by proudSkillGroupId
|
||||||
GameData.proudSkillGroupLevels.forEach(
|
GameData.getProudSkillGroupLevels()
|
||||||
|
.forEach(
|
||||||
(id, set) ->
|
(id, set) ->
|
||||||
GameData.proudSkillGroupMaxLevels.put((int) id, set.intStream().max().getAsInt()));
|
GameData.getProudSkillGroupMaxLevels()
|
||||||
|
.put((int) id, set.intStream().max().orElse(-1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadAbilityEmbryos() {
|
private static void loadAbilityEmbryos() {
|
||||||
@ -266,18 +269,19 @@ public class ResourceLoader {
|
|||||||
|
|
||||||
if (embryoList == null) {
|
if (embryoList == null) {
|
||||||
// Load from BinOutput
|
// Load from BinOutput
|
||||||
val pattern = Pattern.compile("ConfigAvatar_(.+?)\\.json");
|
var pattern = Pattern.compile("ConfigAvatar_(.+?)\\.json");
|
||||||
|
|
||||||
val l = new ArrayList<AbilityEmbryoEntry>();
|
var entries = new ArrayList<AbilityEmbryoEntry>();
|
||||||
try {
|
try (var stream =
|
||||||
Files.newDirectoryStream(getResourcePath("BinOutput/Avatar/"), "ConfigAvatar_*.json")
|
Files.newDirectoryStream(getResourcePath("BinOutput/Avatar/"), "ConfigAvatar_*.json")) {
|
||||||
.forEach(
|
|
||||||
|
stream.forEach(
|
||||||
path -> {
|
path -> {
|
||||||
val matcher = pattern.matcher(path.getFileName().toString());
|
var matcher = pattern.matcher(path.getFileName().toString());
|
||||||
if (!matcher.find()) return;
|
if (!matcher.find()) return;
|
||||||
String avatarName = matcher.group(1);
|
|
||||||
AvatarConfig config;
|
|
||||||
|
|
||||||
|
var avatarName = matcher.group(1);
|
||||||
|
AvatarConfig config;
|
||||||
try {
|
try {
|
||||||
config = JsonUtils.loadToClass(path, AvatarConfig.class);
|
config = JsonUtils.loadToClass(path, AvatarConfig.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -287,21 +291,19 @@ public class ResourceLoader {
|
|||||||
|
|
||||||
if (config.abilities == null) return;
|
if (config.abilities == null) return;
|
||||||
|
|
||||||
int s = config.abilities.size();
|
entries.add(
|
||||||
AbilityEmbryoEntry al =
|
|
||||||
new AbilityEmbryoEntry(
|
new AbilityEmbryoEntry(
|
||||||
avatarName,
|
avatarName,
|
||||||
config.abilities.stream()
|
config.abilities.stream()
|
||||||
.map(Object::toString)
|
.map(Object::toString)
|
||||||
.toArray(size -> new String[s]));
|
.toArray(size -> new String[config.abilities.size()])));
|
||||||
l.add(al);
|
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Grasscutter.getLogger().error("Error loading ability embryos: no files found");
|
Grasscutter.getLogger().error("Error loading ability embryos: no files found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
embryoList = l;
|
embryoList = entries;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GameDepot.setPlayerAbilities(
|
GameDepot.setPlayerAbilities(
|
||||||
@ -351,7 +353,7 @@ public class ResourceLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadAbilityData(AbilityData data) {
|
private static void loadAbilityData(AbilityData data) {
|
||||||
GameData.abilityDataMap.put(data.abilityName, data);
|
GameData.getAbilityDataMap().put(data.abilityName, data);
|
||||||
|
|
||||||
val modifiers = data.modifiers;
|
val modifiers = data.modifiers;
|
||||||
if (modifiers == null || modifiers.size() == 0) return;
|
if (modifiers == null || modifiers.size() == 0) return;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
package emu.grasscutter.data.binout.config;
|
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.ConfigCombat;
|
||||||
import emu.grasscutter.data.binout.config.fields.ConfigCommon;
|
import emu.grasscutter.data.binout.config.fields.ConfigCommon;
|
||||||
import emu.grasscutter.data.binout.config.fields.ConfigGlobalValue;
|
import emu.grasscutter.data.binout.config.fields.ConfigGlobalValue;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ConfigEntityBase {
|
public class ConfigEntityBase {
|
||||||
@Nullable
|
@Nullable ConfigCommon configCommon;
|
||||||
ConfigCommon configCommon;
|
@Nullable ConfigCombat combat;
|
||||||
@Nullable
|
|
||||||
ConfigCombat combat;
|
|
||||||
Collection<ConfigAbilityData> abilities;
|
Collection<ConfigAbilityData> abilities;
|
||||||
ConfigGlobalValue globalValue; // used for SGV in monsters and Gadgets
|
ConfigGlobalValue globalValue; // used for SGV in monsters and Gadgets
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,4 @@ package emu.grasscutter.data.binout.config;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ConfigEntityMonster extends ConfigEntityBase {
|
public class ConfigEntityMonster extends ConfigEntityBase {}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package emu.grasscutter.data.binout.config;
|
package emu.grasscutter.data.binout.config;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import emu.grasscutter.data.binout.config.fields.ConfigAbilityData;
|
import emu.grasscutter.data.binout.config.fields.ConfigAbilityData;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class ConfigLevelEntity {
|
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> avatarAbilities;
|
||||||
@Getter private List<ConfigAbilityData> teamAbilities;
|
@Getter private List<ConfigAbilityData> teamAbilities;
|
||||||
@Getter private List<Integer> preloadMonsterEntityIDs;
|
@Getter private List<Integer> preloadMonsterEntityIDs;
|
||||||
|
@ -8,8 +8,11 @@ import lombok.experimental.FieldDefaults;
|
|||||||
@Data
|
@Data
|
||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
public class ConfigCombatDie {
|
public class ConfigCombatDie {
|
||||||
@SerializedName(value="dieEndTime", alternate={"HGGPMFGGBNC"})
|
@SerializedName(
|
||||||
|
value = "dieEndTime",
|
||||||
|
alternate = {"HGGPMFGGBNC"})
|
||||||
double dieEndTime;
|
double dieEndTime;
|
||||||
|
|
||||||
double dieForceDisappearTime;
|
double dieForceDisappearTime;
|
||||||
boolean hasAnimatorDie;
|
boolean hasAnimatorDie;
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,4 @@ package emu.grasscutter.data.binout.config.fields;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ConfigCommon {
|
public class ConfigCommon {}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package emu.grasscutter.data.binout.config.fields;
|
package emu.grasscutter.data.binout.config.fields;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/** Contains information about the entities SGVs */
|
||||||
* Contains information about the entities SGVs
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
public class ConfigGlobalValue {
|
public class ConfigGlobalValue {
|
||||||
Set<String> serverGlobalValues;
|
Set<String> serverGlobalValues;
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
package emu.grasscutter.data.binout.routes;
|
package emu.grasscutter.data.binout.routes;
|
||||||
|
|
||||||
//import emu.grasscutter.scripts.constants.IntValueEnum;
|
// import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public enum RotAngleType /*implements IntValueEnum */{
|
public enum RotAngleType /*implements IntValueEnum */ {
|
||||||
ROT_NONE(-1),
|
ROT_NONE(-1),
|
||||||
ROT_ANGLE_X(0),
|
ROT_ANGLE_X(0),
|
||||||
ROT_ANGLE_Y(1),
|
ROT_ANGLE_Y(1),
|
||||||
ROT_ANGLE_Z(2);
|
ROT_ANGLE_Z(2);
|
||||||
|
|
||||||
@Getter
|
@Getter private final int id;
|
||||||
private final int id;
|
|
||||||
|
|
||||||
RotAngleType(int id) {
|
RotAngleType(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
// @Override
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,11 @@ public class Route {
|
|||||||
private RotType rotType; // optional
|
private RotType rotType; // optional
|
||||||
private RotAngleType rotAngleType; // optional
|
private RotAngleType rotAngleType; // optional
|
||||||
|
|
||||||
public RouteOuterClass.Route toProto(){
|
public RouteOuterClass.Route toProto() {
|
||||||
val builder = RouteOuterClass.Route.newBuilder()
|
val builder = RouteOuterClass.Route.newBuilder().setRouteType(type.getValue());
|
||||||
.setRouteType(type.getValue());
|
if (points != null) {
|
||||||
if(points !=null){
|
for (var routePoint : points) {
|
||||||
for(var routePoint : points){
|
builder.addRoutePoints(routePoint.toProto().setArriveRange(arriveRange));
|
||||||
builder.addRoutePoints(routePoint.toProto()
|
|
||||||
.setArriveRange(arriveRange));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
@ -4,7 +4,6 @@ import emu.grasscutter.net.proto.RoutePointOuterClass;
|
|||||||
import emu.grasscutter.utils.Position;
|
import emu.grasscutter.utils.Position;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
|
||||||
@ -12,23 +11,21 @@ import lombok.val;
|
|||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
public class RoutePoint {
|
public class RoutePoint {
|
||||||
private Position pos;
|
private Position pos;
|
||||||
private int speedLevel; //optional
|
private int speedLevel; // optional
|
||||||
private float waitTime; //optional
|
private float waitTime; // optional
|
||||||
private float targetVelocity; //optional
|
private float targetVelocity; // optional
|
||||||
private boolean hasReachEvent; //optional
|
private boolean hasReachEvent; // optional
|
||||||
// rotRoundReachDir //optional Pos with optional values
|
// rotRoundReachDir //optional Pos with optional values
|
||||||
// rotRoundLeaveDir //optional Pos with optional values
|
// rotRoundLeaveDir //optional Pos with optional values
|
||||||
|
|
||||||
public RoutePointOuterClass.RoutePoint.Builder toProto(){
|
public RoutePointOuterClass.RoutePoint.Builder toProto() {
|
||||||
val builder = RoutePointOuterClass.RoutePoint.newBuilder()
|
val builder = RoutePointOuterClass.RoutePoint.newBuilder().setPosition(pos.toProto());
|
||||||
.setPosition(pos.toProto());
|
if (waitTime != 0) {
|
||||||
if(waitTime!=0){
|
|
||||||
builder.setTime(waitTime);
|
builder.setTime(waitTime);
|
||||||
} else if(targetVelocity!=0){
|
} else if (targetVelocity != 0) {
|
||||||
builder.setVelocity(targetVelocity);
|
builder.setVelocity(targetVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package emu.grasscutter.data.binout.routes;
|
package emu.grasscutter.data.binout.routes;
|
||||||
|
|
||||||
//import emu.grasscutter.scripts.constants.IntValueEnum;
|
// import emu.grasscutter.scripts.constants.IntValueEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public enum RouteType /*implements IntValueEnum*/ {
|
public enum RouteType /*implements IntValueEnum*/ {
|
||||||
@ -9,14 +9,13 @@ public enum RouteType /*implements IntValueEnum*/ {
|
|||||||
Reciprocate(1),
|
Reciprocate(1),
|
||||||
Loop(2);
|
Loop(2);
|
||||||
|
|
||||||
@Getter
|
@Getter private final int id;
|
||||||
private final int id;
|
|
||||||
|
|
||||||
RouteType(int id) {
|
RouteType(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
// @Override
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package emu.grasscutter.data.binout.routes;
|
package emu.grasscutter.data.binout.routes;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
public class SceneRoutes {
|
public class SceneRoutes {
|
||||||
|
@ -4,5 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface BaseTrialActivityData {
|
public interface BaseTrialActivityData {
|
||||||
List<Integer> getAvatarIndexIdList();
|
List<Integer> getAvatarIndexIdList();
|
||||||
|
|
||||||
List<Integer> getRewardIdList();
|
List<Integer> getRewardIdList();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package emu.grasscutter.data.common;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.excels.DailyDungeonData;
|
import emu.grasscutter.data.excels.dungeon.DailyDungeonData;
|
||||||
import emu.grasscutter.utils.Position;
|
import emu.grasscutter.utils.Position;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package emu.grasscutter.data.custom;
|
package emu.grasscutter.data.custom;
|
||||||
|
|
||||||
import emu.grasscutter.data.common.BaseTrialActivityData;
|
import emu.grasscutter.data.common.BaseTrialActivityData;
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TrialAvatarActivityCustomData implements BaseTrialActivityData {
|
public class TrialAvatarActivityCustomData implements BaseTrialActivityData {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package emu.grasscutter.data.custom;
|
package emu.grasscutter.data.custom;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TrialAvatarCustomData {
|
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.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Data @EqualsAndHashCode(callSuper=false)
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ResourceType(name = "GuideTriggerExcelConfigData.json")
|
@ResourceType(name = "GuideTriggerExcelConfigData.json")
|
||||||
public class GuideTriggerData extends GameResource {
|
public class GuideTriggerData extends GameResource {
|
||||||
// more like open state guide than quest guide
|
// more like open state guide than quest guide
|
||||||
|
@ -1,109 +1,121 @@
|
|||||||
package emu.grasscutter.data.excels;
|
package emu.grasscutter.data.excels;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import emu.grasscutter.Grasscutter;
|
||||||
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.*;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.AccessLevel;
|
import javax.annotation.Nonnull;
|
||||||
import lombok.Data;
|
import javax.annotation.Nullable;
|
||||||
import lombok.Getter;
|
import lombok.*;
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
@ResourceType(name = "QuestExcelConfigData.json")
|
@ResourceType(name = "QuestExcelConfigData.json")
|
||||||
@Getter
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
public class QuestData extends GameResource {
|
public class QuestData extends GameResource {
|
||||||
private int subId;
|
@Getter private int subId;
|
||||||
private int mainId;
|
@Getter private int mainId;
|
||||||
private int order;
|
@Getter private int order;
|
||||||
private long descTextMapHash;
|
@Getter private long descTextMapHash;
|
||||||
|
|
||||||
private boolean finishParent;
|
@Getter private boolean finishParent;
|
||||||
private boolean isRewind;
|
@Getter private boolean isRewind;
|
||||||
|
|
||||||
private LogicType acceptCondComb;
|
@Getter private LogicType acceptCondComb;
|
||||||
private LogicType finishCondComb;
|
@Getter private LogicType finishCondComb;
|
||||||
private LogicType failCondComb;
|
@Getter private LogicType failCondComb;
|
||||||
|
|
||||||
private List<QuestCondition> acceptCond;
|
@Getter private List<QuestAcceptCondition> acceptCond;
|
||||||
private List<QuestCondition> finishCond;
|
@Getter private List<QuestContentCondition> finishCond;
|
||||||
private List<QuestCondition> failCond;
|
@Getter private List<QuestContentCondition> failCond;
|
||||||
private List<QuestExecParam> beginExec;
|
@Getter private List<QuestExecParam> beginExec;
|
||||||
private List<QuestExecParam> finishExec;
|
@Getter private List<QuestExecParam> finishExec;
|
||||||
private List<QuestExecParam> failExec;
|
@Getter private List<QuestExecParam> failExec;
|
||||||
private Guide guide;
|
@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() ~~
|
// ResourceLoader not happy if you remove getId() ~~
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return subId;
|
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() {
|
public void onLoad() {
|
||||||
this.acceptCond = acceptCond.stream().filter(p -> p.type != null).toList();
|
this.acceptCond = acceptCond.stream().filter(p -> p.getType() != null).toList();
|
||||||
this.finishCond = finishCond.stream().filter(p -> p.type != null).toList();
|
this.finishCond = finishCond.stream().filter(p -> p.getType() != null).toList();
|
||||||
this.failCond = failCond.stream().filter(p -> p.type != null).toList();
|
this.failCond = failCond.stream().filter(p -> p.getType() != null).toList();
|
||||||
|
|
||||||
this.beginExec = beginExec.stream().filter(p -> p.type != null).toList();
|
this.beginExec = beginExec.stream().filter(p -> p.type != null).toList();
|
||||||
this.finishExec = finishExec.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();
|
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
|
@Data
|
||||||
public static class QuestCondition {
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
|
public static class QuestExecParam {
|
||||||
@SerializedName("_type")
|
@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")
|
@SerializedName("_param")
|
||||||
private int[] param;
|
private int[] param;
|
||||||
@ -112,7 +124,11 @@ public class QuestData extends GameResource {
|
|||||||
private String paramStr;
|
private String paramStr;
|
||||||
|
|
||||||
@SerializedName("_count")
|
@SerializedName("_count")
|
||||||
private String count;
|
private int count;
|
||||||
|
|
||||||
|
public String asKey() {
|
||||||
|
return questConditionKey(getType(), getParam()[0], getParamStr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -121,17 +137,4 @@ public class QuestData extends GameResource {
|
|||||||
private List<String> param;
|
private List<String> param;
|
||||||
private int guideScene;
|
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;
|
package emu.grasscutter.data.excels;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.game.props.RefreshType;
|
import emu.grasscutter.game.props.RefreshType;
|
||||||
import emu.grasscutter.game.world.World;
|
import emu.grasscutter.game.world.World;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ResourceType(name = "RefreshPolicyExcelConfigData.json")
|
@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) {
|
private static int upperBound(List<Integer> list, int low, int high, int value) {
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
int middle = (high + low) / 2;
|
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) {
|
if (list.get(middle) > value) {
|
||||||
high = middle;
|
high = middle;
|
||||||
} else {
|
} else {
|
||||||
@ -29,7 +28,7 @@ public class RefreshPolicyExcelConfigData extends GameResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getIntervalInSeconds(World world) {
|
public int getIntervalInSeconds(World world) {
|
||||||
if(time.isEmpty()) return -1;
|
if (time.isEmpty()) return -1;
|
||||||
|
|
||||||
var currentTimestamp = world.getTotalGameTimeMinutes();
|
var currentTimestamp = world.getTotalGameTimeMinutes();
|
||||||
|
|
||||||
@ -37,44 +36,49 @@ public class RefreshPolicyExcelConfigData extends GameResource {
|
|||||||
List<String> paramsStr = Arrays.asList(time.split(";"));
|
List<String> paramsStr = Arrays.asList(time.split(";"));
|
||||||
List<Integer> params = paramsStr.stream().map(Integer::parseInt).toList();
|
List<Integer> params = paramsStr.stream().map(Integer::parseInt).toList();
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case REFRESH_NONE:
|
case REFRESH_NONE:
|
||||||
return -1;
|
return -1;
|
||||||
case REFRESH_INTERVAL:
|
case REFRESH_INTERVAL:
|
||||||
if(params.isEmpty()) return -1;
|
if (params.isEmpty()) return -1;
|
||||||
return params.get(0);
|
return params.get(0);
|
||||||
case REFRESH_DAILY:
|
case REFRESH_DAILY:
|
||||||
{
|
{
|
||||||
var dayTime = (world.getTotalGameTimeMinutes() / (24 * 60)) * 24 * 60 * 60;
|
var dayTime = (world.getTotalGameTimeMinutes() / (24 * 60)) * 24 * 60 * 60;
|
||||||
var temp = currentTimestamp - dayTime;
|
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);
|
var upper_bound = params.get(upper_bound_idx);
|
||||||
if(params.get(params.size() - 1) == upper_bound) {
|
if (params.get(params.size() - 1) == upper_bound) {
|
||||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||||
} else if(params.get(0) == upper_bound) {
|
} else if (params.get(0) == upper_bound) {
|
||||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||||
}
|
}
|
||||||
return (params.get(upper_bound_idx - 1) - params.get(0));
|
return (params.get(upper_bound_idx - 1) - params.get(0));
|
||||||
}
|
}
|
||||||
case REFRESH_WEEKlY:
|
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 weekTime = (world.getTotalGameTimeDays() / 7) * 60 * 60 * 24 * 7;
|
||||||
var temp = currentTimestamp - weekTime;
|
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);
|
var upper_bound = params.get(upper_bound_idx);
|
||||||
if(params.get(params.size() - 1) == upper_bound) {
|
if (params.get(params.size() - 1) == upper_bound) {
|
||||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||||
} else if(params.get(0) == upper_bound) {
|
} else if (params.get(0) == upper_bound) {
|
||||||
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
return (params.get(params.size() - 1) - params.get(0)) + 60 * 60 * 24 * 7;
|
||||||
}
|
}
|
||||||
return (params.get(upper_bound_idx - 1) - params.get(0));
|
return (params.get(upper_bound_idx - 1) - params.get(0));
|
||||||
}
|
}
|
||||||
case REFRESH_DAYBEGIN_INTERVAL:
|
case REFRESH_DAYBEGIN_INTERVAL:
|
||||||
if(params.size() == 0) return -1;
|
if (params.size() == 0) return -1;
|
||||||
return params.get(0) * 60 * 60 * 24;
|
return params.get(0) * 60 * 60 * 24;
|
||||||
}
|
}
|
||||||
} catch(Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.game.props.SceneType;
|
import emu.grasscutter.game.props.SceneType;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ResourceType(name = "SceneExcelConfigData.json")
|
@ResourceType(name = "SceneExcelConfigData.json")
|
||||||
@ -16,4 +17,6 @@ public class SceneData extends GameResource {
|
|||||||
private SceneType sceneType;
|
private SceneType sceneType;
|
||||||
|
|
||||||
private String scriptData;
|
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 com.github.davidmoten.guavamini.Lists;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
import emu.grasscutter.data.excels.BattlePassMissionData;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityConditions;
|
import emu.grasscutter.game.activity.condition.ActivityConditions;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
|
import java.util.List;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@ResourceType(name = "NewActivityCondExcelConfigData.json")
|
@ResourceType(name = "NewActivityCondExcelConfigData.json")
|
||||||
@Getter
|
@Getter
|
||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
@ -19,10 +18,8 @@ public class ActivityCondExcelConfigData extends GameResource {
|
|||||||
List<ActivityConfigCondition> cond;
|
List<ActivityConfigCondition> cond;
|
||||||
|
|
||||||
public static class ActivityConfigCondition {
|
public static class ActivityConfigCondition {
|
||||||
@Getter
|
@Getter private ActivityConditions type;
|
||||||
private ActivityConditions type;
|
@Getter private List<Integer> param;
|
||||||
@Getter
|
|
||||||
private List<Integer> param;
|
|
||||||
|
|
||||||
public int[] paramArray() {
|
public int[] paramArray() {
|
||||||
return param.stream().mapToInt(Integer::intValue).toArray();
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
@ -23,9 +23,10 @@ public class ActivityWatcherData extends GameResource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
triggerConfig.paramList =
|
this.triggerConfig.paramList =
|
||||||
triggerConfig.paramList.stream().filter(x -> (x != null) && !x.isBlank()).toList();
|
this.triggerConfig.paramList.stream().filter(x -> (x != null) && !x.isBlank()).toList();
|
||||||
triggerConfig.watcherTriggerType = WatcherTriggerType.getTypeByName(triggerConfig.triggerType);
|
this.triggerConfig.watcherTriggerType =
|
||||||
|
WatcherTriggerType.getTypeByName(this.triggerConfig.triggerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -35,5 +36,10 @@ public class ActivityWatcherData extends GameResource {
|
|||||||
List<String> paramList;
|
List<String> paramList;
|
||||||
|
|
||||||
transient WatcherTriggerType watcherTriggerType;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameData;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
@ -173,17 +173,23 @@ public class AvatarData extends GameResource {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Cache abilities
|
// Cache abilities
|
||||||
String[] split = this.iconName.split("_");
|
this.buildEmbryo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create ability embryos.
|
||||||
|
*/
|
||||||
|
public void buildEmbryo() {
|
||||||
|
var split = this.iconName.split("_");
|
||||||
if (split.length > 0) {
|
if (split.length > 0) {
|
||||||
this.name = split[split.length - 1];
|
this.name = split[split.length - 1];
|
||||||
|
|
||||||
AbilityEmbryoEntry info = GameData.getAbilityEmbryoInfo().get(this.name);
|
var info = GameData.getAbilityEmbryoInfo().get(this.name);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
this.abilities = new IntArrayList(info.getAbilities().length);
|
this.abilities = new IntArrayList(info.getAbilities().length);
|
||||||
for (String ability : info.getAbilities()) {
|
for (var ability : info.getAbilities())
|
||||||
this.abilities.add(Utils.abilityHash(ability));
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ResourceType(name = "AvatarReplaceCostumeExcelConfigData.json")
|
@ResourceType(name = "AvatarReplaceCostumeExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class AvatarReplaceCostumeData extends GameResource {
|
public class AvatarReplaceCostumeData extends GameResource {
|
||||||
private int avatarId;
|
private int avatarId;
|
||||||
@SerializedName(value = "costumeId", alternate={"MGLCOPOIJIC", "BDBMOBGKIAP"})
|
|
||||||
|
@SerializedName(
|
||||||
|
value = "costumeId",
|
||||||
|
alternate = {"MGLCOPOIJIC", "BDBMOBGKIAP"})
|
||||||
private int costumeId;
|
private int costumeId;
|
||||||
|
|
||||||
@Override
|
@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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameDepot;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
@ -1,13 +1,11 @@
|
|||||||
package emu.grasscutter.data.excels;
|
package emu.grasscutter.data.excels.dungeon;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
|
||||||
import emu.grasscutter.game.dungeons.challenge.enums.ChallengeType;
|
import emu.grasscutter.game.dungeons.challenge.enums.ChallengeType;
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ResourceType(name = "DungeonChallengeConfigData.json")
|
@ResourceType(name = "DungeonChallengeConfigData.json")
|
||||||
@ -25,45 +23,57 @@ public class DungeonChallengeConfigData extends GameResource {
|
|||||||
private SubChallengeBannerType subChallengeBannerRule;
|
private SubChallengeBannerType subChallengeBannerRule;
|
||||||
private InterruptButtonType interruptButtonType;
|
private InterruptButtonType interruptButtonType;
|
||||||
|
|
||||||
@SerializedName(value = "subChallengeSortType", alternate={"PNCLDNBHKDJ"})
|
@SerializedName(
|
||||||
|
value = "subChallengeSortType",
|
||||||
|
alternate = {"PNCLDNBHKDJ"})
|
||||||
private SubChallengeSortType subChallengeSortType;
|
private SubChallengeSortType subChallengeSortType;
|
||||||
@SerializedName(value = "animationOnSubStart", alternate={"DNFAFNMMMDP"})
|
|
||||||
|
@SerializedName(
|
||||||
|
value = "animationOnSubStart",
|
||||||
|
alternate = {"DNFAFNMMMDP"})
|
||||||
private AllowAnimationType animationOnSubStart;
|
private AllowAnimationType animationOnSubStart;
|
||||||
@SerializedName(value = "animationOnSubSuccess", alternate={"ENONHOGJDDN"})
|
|
||||||
|
@SerializedName(
|
||||||
|
value = "animationOnSubSuccess",
|
||||||
|
alternate = {"ENONHOGJDDN"})
|
||||||
private AllowAnimationType animationOnSubSuccess;
|
private AllowAnimationType animationOnSubSuccess;
|
||||||
@SerializedName(value = "animationOnSubFail", alternate={"NJBJIKAIENN"})
|
|
||||||
|
@SerializedName(
|
||||||
|
value = "animationOnSubFail",
|
||||||
|
alternate = {"NJBJIKAIENN"})
|
||||||
private AllowAnimationType animationOnSubFail;
|
private AllowAnimationType animationOnSubFail;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum InterruptButtonType{
|
public enum InterruptButtonType {
|
||||||
INTERRUPT_BUTTON_TYPE_NONE,
|
INTERRUPT_BUTTON_TYPE_NONE,
|
||||||
INTERRUPT_BUTTON_TYPE_HOST,
|
INTERRUPT_BUTTON_TYPE_HOST,
|
||||||
INTERRUPT_BUTTON_TYPE_ALL
|
INTERRUPT_BUTTON_TYPE_ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SubChallengeFadeOutType{
|
public enum SubChallengeFadeOutType {
|
||||||
SUBCHALLENGE_FADEOUT_TYPE_NONE,
|
SUBCHALLENGE_FADEOUT_TYPE_NONE,
|
||||||
SUBCHALLENGE_FADEOUT_TYPE_SUCCESS,
|
SUBCHALLENGE_FADEOUT_TYPE_SUCCESS,
|
||||||
SUBCHALLENGE_FADEOUT_TYPE_FAIL,
|
SUBCHALLENGE_FADEOUT_TYPE_FAIL,
|
||||||
SUBCHALLENGE_FADEOUT_TYPE_FINISH
|
SUBCHALLENGE_FADEOUT_TYPE_FINISH
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SubChallengeBannerType{
|
public enum SubChallengeBannerType {
|
||||||
SUBCHALLENGE_BANNER_TYPE_NONE,
|
SUBCHALLENGE_BANNER_TYPE_NONE,
|
||||||
SUBCHALLENGE_BANNER_TYPE_SUCCESS,
|
SUBCHALLENGE_BANNER_TYPE_SUCCESS,
|
||||||
SUBCHALLENGE_BANNER_TYPE_FAIL,
|
SUBCHALLENGE_BANNER_TYPE_FAIL,
|
||||||
SUBCHALLENGE_BANNER_TYPE_HIDE_FINAL,
|
SUBCHALLENGE_BANNER_TYPE_HIDE_FINAL,
|
||||||
SUBCHALLENGE_BANNER_TYPE_SHOW_FINAL
|
SUBCHALLENGE_BANNER_TYPE_SHOW_FINAL
|
||||||
}
|
}
|
||||||
public enum SubChallengeSortType{
|
|
||||||
|
public enum SubChallengeSortType {
|
||||||
SUB_CHALLENGE_SORT_TYPE_DEFAULT,
|
SUB_CHALLENGE_SORT_TYPE_DEFAULT,
|
||||||
SUB_CHALLENGE_SORT_TYPE_CHALLENGEINDEX
|
SUB_CHALLENGE_SORT_TYPE_CHALLENGEINDEX
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AllowAnimationType{
|
public enum AllowAnimationType {
|
||||||
SUB_CHALLENGE_ANIM_TYPE_DEFAULT,
|
SUB_CHALLENGE_ANIM_TYPE_DEFAULT,
|
||||||
SUB_CHALLENGE_ANIM_TYPE_FORBID,
|
SUB_CHALLENGE_ANIM_TYPE_FORBID,
|
||||||
SUB_CHALLENGE_ANIM_TYPE_SUCCESS,
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
@ -1,13 +1,11 @@
|
|||||||
package emu.grasscutter.data.excels;
|
package emu.grasscutter.data.excels.dungeon;
|
||||||
|
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
|
||||||
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
|
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
@ResourceType(name = "DungeonPassExcelConfigData.json")
|
@ResourceType(name = "DungeonPassExcelConfigData.json")
|
||||||
public class DungeonPassConfigData extends GameResource {
|
public class DungeonPassConfigData extends GameResource {
|
||||||
@ -15,7 +13,7 @@ public class DungeonPassConfigData extends GameResource {
|
|||||||
@Getter private LogicType logicType;
|
@Getter private LogicType logicType;
|
||||||
@Getter private List<DungeonPassCondition> conds;
|
@Getter private List<DungeonPassCondition> conds;
|
||||||
|
|
||||||
public static class DungeonPassCondition{
|
public static class DungeonPassCondition {
|
||||||
@Getter private DungeonPassConditionType condType;
|
@Getter private DungeonPassConditionType condType;
|
||||||
@Getter int[] param;
|
@Getter int[] param;
|
||||||
}
|
}
|
||||||
@ -23,6 +21,6 @@ public class DungeonPassConfigData extends GameResource {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
super.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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
@ -6,6 +6,7 @@ import emu.grasscutter.data.GameResource;
|
|||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||||
import emu.grasscutter.data.common.PropGrowCurve;
|
import emu.grasscutter.data.common.PropGrowCurve;
|
||||||
|
import emu.grasscutter.data.excels.GadgetData;
|
||||||
import emu.grasscutter.game.props.FightProperty;
|
import emu.grasscutter.game.props.FightProperty;
|
||||||
import emu.grasscutter.game.props.MonsterType;
|
import emu.grasscutter.game.props.MonsterType;
|
||||||
import java.util.List;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
@ -7,7 +7,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@ResourceType(name = "MonsterSpecialNameExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
@ResourceType(name = "MonsterSpecialNameExcelConfigData.json", loadPriority = LoadPriority.HIGH)
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
public class MonsterSpecialNameData extends GameResource {
|
public class MonsterSpecialNameData extends GameResource {
|
||||||
private int specialNameId;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
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 com.google.gson.annotations.SerializedName;
|
||||||
import emu.grasscutter.data.GameResource;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import emu.grasscutter.data.common.BaseTrialActivityData;
|
import emu.grasscutter.data.common.BaseTrialActivityData;
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@ResourceType(name = "TrialAvatarActivityExcelConfigData.json")
|
@ResourceType(name = "TrialAvatarActivityExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
public class TrialAvatarActivityData extends GameResource implements BaseTrialActivityData {
|
public class TrialAvatarActivityData extends GameResource implements BaseTrialActivityData {
|
||||||
private int ScheduleId;
|
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.GameData;
|
||||||
import emu.grasscutter.data.GameResource;
|
import emu.grasscutter.data.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
import emu.grasscutter.data.excels.activity.ActivityWatcherData;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
@ResourceType(name = "TrialAvatarActivityDataExcelConfigData.json")
|
@ResourceType(name = "TrialAvatarActivityDataExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
public class TrialAvatarActivityDataData extends GameResource {
|
public class TrialAvatarActivityDataData extends GameResource {
|
||||||
@Getter(onMethod = @__(@Override))
|
@Getter(onMethod = @__(@Override))
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private int trialAvatarIndexId;
|
private int trialAvatarIndexId;
|
||||||
private int trialAvatarId;
|
private int trialAvatarId;
|
||||||
private int dungeonId;
|
private int dungeonId;
|
||||||
@ -23,7 +25,7 @@ public class TrialAvatarActivityDataData extends GameResource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
triggerConfig.onLoad();
|
this.triggerConfig.onLoad();
|
||||||
GameData.getTrialAvatarIndexIdTrialActivityDataDataMap().put(trialAvatarIndexId, id);
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@ResourceType(name = "TrialAvatarExcelConfigData.json")
|
@ResourceType(name = "TrialAvatarExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
public class TrialAvatarData extends GameResource {
|
public class TrialAvatarData extends GameResource {
|
||||||
private int trialAvatarId;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@ResourceType(name = "TrialAvatarTemplateExcelConfigData.json")
|
@ResourceType(name = "TrialAvatarTemplateExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
public class TrialAvatarTemplateData extends GameResource {
|
public class TrialAvatarTemplateData extends GameResource {
|
||||||
private int TrialAvatarLevel;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
||||||
import lombok.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
@ResourceType(name = "TrialReliquaryExcelConfigData.json")
|
@ResourceType(name = "TrialReliquaryExcelConfigData.json")
|
||||||
@EqualsAndHashCode(callSuper=false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
public class TrialReliquaryData extends GameResource {
|
public class TrialReliquaryData extends GameResource {
|
||||||
private int Id;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
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.GameResource;
|
||||||
import emu.grasscutter.data.ResourceType;
|
import emu.grasscutter.data.ResourceType;
|
@ -1,8 +1,7 @@
|
|||||||
package emu.grasscutter.data.server;
|
package emu.grasscutter.data.server;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ActivityCondGroup {
|
public class ActivityCondGroup {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package emu.grasscutter.data.server;
|
package emu.grasscutter.data.server;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.utils.GridPosition;
|
import emu.grasscutter.utils.GridPosition;
|
||||||
import emu.grasscutter.utils.Position;
|
import emu.grasscutter.utils.Position;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class Grid {
|
public class Grid {
|
||||||
public Map<GridPosition, Set<Integer>> grid;
|
public Map<GridPosition, Set<Integer>> grid;
|
||||||
@ -19,12 +18,13 @@ public class Grid {
|
|||||||
GridPosition pos = new GridPosition(position, width);
|
GridPosition pos = new GridPosition(position, width);
|
||||||
|
|
||||||
Set<Integer> nearbyGroups = new HashSet<>();
|
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
|
// construct a nearby pisition list, add 1 more because a player can be in an edge case, this
|
||||||
for(int x = 0; x < vision_range_grid + 1; x++) {
|
// should not affect much the loading
|
||||||
for(int z = 0; z < vision_range_grid + 1; z++) {
|
for (int x = 0; x < vision_range_grid + 1; x++) {
|
||||||
nearbyGroups.addAll(grid.getOrDefault(pos.addClone( x, z), new HashSet<>()));
|
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<>()));
|
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.entity.gadget.GadgetGatherObject;
|
||||||
import emu.grasscutter.game.player.BasePlayerManager;
|
import emu.grasscutter.game.player.BasePlayerManager;
|
||||||
import emu.grasscutter.game.player.Player;
|
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.AbilityInvokeEntryHeadOuterClass.AbilityInvokeEntryHead;
|
||||||
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
|
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
|
||||||
import emu.grasscutter.net.proto.AbilityMetaModifierChangeOuterClass.AbilityMetaModifierChange;
|
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_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke);
|
||||||
case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(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_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke);
|
||||||
|
case ABILITY_INVOKE_ARGUMENT_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke);
|
||||||
default -> {}
|
default -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,6 +204,22 @@ public final class AbilityManager extends BasePlayerManager {
|
|||||||
this.player.getEnergyManager().handleGenerateElemBall(invoke);
|
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(
|
private void invokeAction(
|
||||||
AbilityModifierAction action, GameEntity target, GameEntity sourceEntity) {
|
AbilityModifierAction action, GameEntity target, GameEntity sourceEntity) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
@ -6,7 +6,7 @@ import dev.morphia.annotations.Id;
|
|||||||
import dev.morphia.annotations.Transient;
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.GameData;
|
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.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
|
@ -14,7 +14,19 @@ public class ActivityConfigItem {
|
|||||||
int scheduleId;
|
int scheduleId;
|
||||||
List<Integer> meetCondList;
|
List<Integer> meetCondList;
|
||||||
Date beginTime;
|
Date beginTime;
|
||||||
|
Date openTime;
|
||||||
|
Date closeTime;
|
||||||
Date endTime;
|
Date endTime;
|
||||||
|
|
||||||
transient ActivityHandler activityHandler;
|
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 com.esotericsoftware.reflectasm.ConstructorAccess;
|
||||||
import emu.grasscutter.data.GameData;
|
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.player.Player;
|
||||||
import emu.grasscutter.game.props.WatcherTriggerType;
|
import emu.grasscutter.game.props.WatcherTriggerType;
|
||||||
|
import emu.grasscutter.game.quest.enums.QuestCond;
|
||||||
import emu.grasscutter.net.proto.ActivityInfoOuterClass;
|
import emu.grasscutter.net.proto.ActivityInfoOuterClass;
|
||||||
import emu.grasscutter.utils.DateHelper;
|
import emu.grasscutter.utils.DateHelper;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -19,9 +22,9 @@ import lombok.experimental.FieldDefaults;
|
|||||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||||
public abstract class ActivityHandler {
|
public abstract class ActivityHandler {
|
||||||
/** Must set before initWatchers */
|
/** Must set before initWatchers */
|
||||||
ActivityConfigItem activityConfigItem;
|
@Getter ActivityConfigItem activityConfigItem;
|
||||||
|
|
||||||
ActivityData activityData;
|
@Getter ActivityData activityData;
|
||||||
Map<WatcherTriggerType, List<ActivityWatcher>> watchersMap = new HashMap<>();
|
Map<WatcherTriggerType, List<ActivityWatcher>> watchersMap = new HashMap<>();
|
||||||
|
|
||||||
public abstract void onProtoBuild(
|
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() {
|
private Map<Integer, PlayerActivityData.WatcherInfo> initWatchersDataForPlayer() {
|
||||||
return watchersMap.values().stream()
|
return watchersMap.values().stream()
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
@ -76,7 +116,8 @@ public abstract class ActivityHandler {
|
|||||||
return playerActivityData;
|
return playerActivityData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActivityInfoOuterClass.ActivityInfo toProto(PlayerActivityData playerActivityData) {
|
public ActivityInfoOuterClass.ActivityInfo toProto(
|
||||||
|
PlayerActivityData playerActivityData, ActivityConditionExecutor conditionExecutor) {
|
||||||
var proto = ActivityInfoOuterClass.ActivityInfo.newBuilder();
|
var proto = ActivityInfoOuterClass.ActivityInfo.newBuilder();
|
||||||
proto
|
proto
|
||||||
.setActivityId(activityConfigItem.getActivityId())
|
.setActivityId(activityConfigItem.getActivityId())
|
||||||
@ -85,7 +126,7 @@ public abstract class ActivityHandler {
|
|||||||
.setBeginTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
.setBeginTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
||||||
.setFirstDayStartTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
.setFirstDayStartTime(DateHelper.getUnixTime(activityConfigItem.getBeginTime()))
|
||||||
.setEndTime(DateHelper.getUnixTime(activityConfigItem.getEndTime()))
|
.setEndTime(DateHelper.getUnixTime(activityConfigItem.getEndTime()))
|
||||||
.addAllMeetCondList(activityConfigItem.getMeetCondList());
|
.addAllMeetCondList(getMeetConditions(conditionExecutor));
|
||||||
|
|
||||||
if (playerActivityData != null) {
|
if (playerActivityData != null) {
|
||||||
proto.addAllWatcherInfoList(playerActivityData.getAllWatcherInfoList());
|
proto.addAllWatcherInfoList(playerActivityData.getAllWatcherInfoList());
|
||||||
|
@ -4,6 +4,7 @@ import com.esotericsoftware.reflectasm.ConstructorAccess;
|
|||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.DataLoader;
|
import emu.grasscutter.data.DataLoader;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
|
import emu.grasscutter.game.activity.condition.*;
|
||||||
import emu.grasscutter.game.player.BasePlayerManager;
|
import emu.grasscutter.game.player.BasePlayerManager;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.props.ActivityType;
|
import emu.grasscutter.game.props.ActivityType;
|
||||||
@ -12,6 +13,7 @@ import emu.grasscutter.net.proto.ActivityInfoOuterClass;
|
|||||||
import emu.grasscutter.server.packet.send.PacketActivityScheduleInfoNotify;
|
import emu.grasscutter.server.packet.send.PacketActivityScheduleInfoNotify;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
@ -19,6 +21,8 @@ import org.reflections.Reflections;
|
|||||||
public class ActivityManager extends BasePlayerManager {
|
public class ActivityManager extends BasePlayerManager {
|
||||||
private static final Map<Integer, ActivityConfigItem> activityConfigItemMap;
|
private static final Map<Integer, ActivityConfigItem> activityConfigItemMap;
|
||||||
@Getter private static final Map<Integer, ActivityConfigItem> scheduleActivityConfigMap;
|
@Getter private static final Map<Integer, ActivityConfigItem> scheduleActivityConfigMap;
|
||||||
|
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
||||||
|
private final ActivityConditionExecutor conditionExecutor;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
activityConfigItemMap = new HashMap<>();
|
activityConfigItemMap = new HashMap<>();
|
||||||
@ -26,30 +30,6 @@ public class ActivityManager extends BasePlayerManager {
|
|||||||
loadActivityConfigData();
|
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() {
|
private static void loadActivityConfigData() {
|
||||||
// scan activity type handler & watcher type
|
// scan activity type handler & watcher type
|
||||||
var activityHandlerTypeMap = new HashMap<ActivityType, ConstructorAccess<?>>();
|
var activityHandlerTypeMap = new HashMap<ActivityType, ConstructorAccess<?>>();
|
||||||
@ -75,6 +55,7 @@ public class ActivityManager extends BasePlayerManager {
|
|||||||
DataLoader.loadList("ActivityConfig.json", ActivityConfigItem.class)
|
DataLoader.loadList("ActivityConfig.json", ActivityConfigItem.class)
|
||||||
.forEach(
|
.forEach(
|
||||||
item -> {
|
item -> {
|
||||||
|
item.onLoad();
|
||||||
var activityData = GameData.getActivityDataMap().get(item.getActivityId());
|
var activityData = GameData.getActivityDataMap().get(item.getActivityId());
|
||||||
if (activityData == null) {
|
if (activityData == null) {
|
||||||
Grasscutter.getLogger().warn("activity {} not exist.", item.getActivityId());
|
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 */
|
/** trigger activity watcher */
|
||||||
public void triggerWatcher(WatcherTriggerType watcherTriggerType, String... params) {
|
public void triggerWatcher(WatcherTriggerType watcherTriggerType, String... params) {
|
||||||
var watchers =
|
var watchers =
|
||||||
@ -124,11 +135,71 @@ public class ActivityManager extends BasePlayerManager {
|
|||||||
params));
|
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) {
|
public ActivityInfoOuterClass.ActivityInfo getInfoProtoByActivityId(int activityId) {
|
||||||
var activityHandler = activityConfigItemMap.get(activityId).getActivityHandler();
|
var activityHandler = activityConfigItemMap.get(activityId).getActivityHandler();
|
||||||
var activityData = playerActivityDataMap.get(activityId);
|
var activityData = playerActivityDataMap.get(activityId);
|
||||||
|
|
||||||
return activityHandler.toProto(activityData);
|
return activityHandler.toProto(activityData, conditionExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<ActivityHandler> getActivityHandler(ActivityType type) {
|
public Optional<ActivityHandler> getActivityHandler(ActivityType type) {
|
||||||
@ -138,7 +209,6 @@ public class ActivityManager extends BasePlayerManager {
|
|||||||
.findFirst();
|
.findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T extends ActivityHandler> Optional<T> getActivityHandlerAs(
|
public <T extends ActivityHandler> Optional<T> getActivityHandlerAs(
|
||||||
ActivityType type, Class<T> clazz) {
|
ActivityType type, Class<T> clazz) {
|
||||||
return getActivityHandler(type).map(x -> (T) x);
|
return getActivityHandler(type).map(x -> (T) x);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package emu.grasscutter.game.activity;
|
package emu.grasscutter.game.activity;
|
||||||
|
|
||||||
import emu.grasscutter.data.excels.ActivityWatcherData;
|
import emu.grasscutter.data.excels.activity.ActivityWatcherData;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -5,7 +5,7 @@ import dev.morphia.annotations.Id;
|
|||||||
import dev.morphia.annotations.Transient;
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.common.ItemParamData;
|
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.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package emu.grasscutter.game.activity.condition;
|
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.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This annotation marks condition types for NewActivityCondExcelConfigData.json ({@link ActivityCondExcelConfigData}). To use it you should mark
|
* This annotation marks condition types for NewActivityCondExcelConfigData.json ({@link
|
||||||
* class that extends ActivityConditionBaseHandler, and it will be automatically picked during activity manager initiation.
|
* ActivityCondExcelConfigData}). To use it you should mark class that extends
|
||||||
*
|
* ActivityConditionBaseHandler, and it will be automatically picked during activity manager
|
||||||
|
* initiation.
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface ActivityCondition {
|
public @interface ActivityCondition {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package emu.grasscutter.game.activity.condition;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
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 {
|
public abstract class ActivityConditionBaseHandler {
|
||||||
|
|
||||||
@ -17,5 +18,6 @@ public abstract class ActivityConditionBaseHandler {
|
|||||||
* @param params params for handler
|
* @param params params for handler
|
||||||
* @return result of condition calculation
|
* @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;
|
package emu.grasscutter.game.activity.condition;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.excels.ActivityCondExcelConfigData;
|
import emu.grasscutter.data.excels.activity.ActivityCondExcelConfigData;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
|
||||||
import org.reflections.Reflections;
|
|
||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
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})
|
* Class that used for scanning classpath, picking up all activity conditions (for
|
||||||
* and saving them to map. Check for more info {@link ActivityCondition}
|
* NewActivityCondExcelConfigData.json {@link ActivityCondExcelConfigData}) and saving them to map.
|
||||||
|
* Check for more info {@link ActivityCondition}
|
||||||
*/
|
*/
|
||||||
public class AllActivityConditionBuilder {
|
public class AllActivityConditionBuilder {
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public class AllActivityConditionBuilder {
|
|||||||
*
|
*
|
||||||
* @return map containing all condition handlers for NewActivityCondExcelConfigData.json
|
* @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();
|
return new AllActivityConditionBuilder().initActivityConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,13 +28,15 @@ public class AllActivityConditionBuilder {
|
|||||||
return reflector.getTypesAnnotatedWith(ActivityCondition.class).stream()
|
return reflector.getTypesAnnotatedWith(ActivityCondition.class).stream()
|
||||||
.map(this::newInstance)
|
.map(this::newInstance)
|
||||||
.map(h -> new AbstractMap.SimpleEntry<>(extractActionType(h), h))
|
.map(h -> new AbstractMap.SimpleEntry<>(extractActionType(h), h))
|
||||||
.collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
|
.collect(
|
||||||
|
Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ActivityConditions extractActionType(ActivityConditionBaseHandler e) {
|
private ActivityConditions extractActionType(ActivityConditionBaseHandler e) {
|
||||||
ActivityCondition condition = e.getClass().getAnnotation(ActivityCondition.class);
|
ActivityCondition condition = e.getClass().getAnnotation(ActivityCondition.class);
|
||||||
if (condition == null) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +49,15 @@ public class AllActivityConditionBuilder {
|
|||||||
if (result instanceof ActivityConditionBaseHandler) {
|
if (result instanceof ActivityConditionBaseHandler) {
|
||||||
return (ActivityConditionBaseHandler) result;
|
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) {
|
} 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);
|
Grasscutter.getLogger().error(message, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package emu.grasscutter.game.activity.condition;
|
package emu.grasscutter.game.activity.condition;
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.all.UnknownActivityConditionHandler;
|
import emu.grasscutter.game.activity.condition.all.UnknownActivityConditionHandler;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
@ -21,9 +20,11 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
|||||||
private final Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId;
|
private final Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId;
|
||||||
private final Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers;
|
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,
|
public BasicActivityConditionExecutor(
|
||||||
|
Map<Integer, ActivityConfigItem> activityConfigItemMap,
|
||||||
Int2ObjectMap<ActivityCondExcelConfigData> activityConditions,
|
Int2ObjectMap<ActivityCondExcelConfigData> activityConditions,
|
||||||
Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId,
|
Int2ObjectMap<PlayerActivityData> playerActivityDataByActivityCondId,
|
||||||
Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers) {
|
Map<ActivityConditions, ActivityConditionBaseHandler> activityConditionsHandlers) {
|
||||||
@ -35,9 +36,7 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getMeetActivitiesConditions(List<Integer> condIds) {
|
public List<Integer> getMeetActivitiesConditions(List<Integer> condIds) {
|
||||||
return condIds.stream()
|
return condIds.stream().filter(this::meetsCondition).collect(Collectors.toList());
|
||||||
.filter(this::meetsCondition)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +44,8 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
|||||||
ActivityCondExcelConfigData condData = activityConditions.get(activityCondId);
|
ActivityCondExcelConfigData condData = activityConditions.get(activityCondId);
|
||||||
|
|
||||||
if (condData == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,15 +55,19 @@ public class BasicActivityConditionExecutor implements ActivityConditionExecutor
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerActivityData activity = playerActivityDataByActivityCondId.get(activityCondId);
|
PlayerActivityData activity = playerActivityDataByActivityCondId.get(activityCondId);
|
||||||
if(activity==null){
|
if (activity == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ActivityConfigItem activityConfig = activityConfigItemMap.get(activity.getActivityId());
|
ActivityConfigItem activityConfig = activityConfigItemMap.get(activity.getActivityId());
|
||||||
List<BooleanSupplier> predicates = condData.getCond()
|
List<BooleanSupplier> predicates =
|
||||||
.stream()
|
condData.getCond().stream()
|
||||||
.map(c -> (BooleanSupplier) () ->
|
.map(
|
||||||
|
c ->
|
||||||
|
(BooleanSupplier)
|
||||||
|
() ->
|
||||||
activityConditionsHandlers
|
activityConditionsHandlers
|
||||||
.getOrDefault(c.getType(), UNKNOWN_CONDITION_HANDLER).execute(activity, activityConfig, c.paramArray()))
|
.getOrDefault(c.getType(), UNKNOWN_CONDITION_HANDLER)
|
||||||
|
.execute(activity, activityConfig, c.paramArray()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return LogicType.calculate(condComb, predicates);
|
return LogicType.calculate(condComb, predicates);
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
package emu.grasscutter.game.activity.condition;
|
package emu.grasscutter.game.activity.condition;
|
||||||
|
|
||||||
import emu.grasscutter.data.GameData;
|
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 emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap.BasicEntry;
|
import it.unimi.dsi.fastutil.ints.AbstractInt2ObjectMap.BasicEntry;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
|
||||||
|
|
||||||
import java.util.Map;
|
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 {
|
public class PlayerActivityDataMappingBuilder {
|
||||||
|
|
||||||
|
|
||||||
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
private final Map<Integer, PlayerActivityData> playerActivityDataMap;
|
||||||
|
|
||||||
private final Int2ObjectMap<ActivityCondExcelConfigData> activityCondMap;
|
private final Int2ObjectMap<ActivityCondExcelConfigData> activityCondMap;
|
||||||
@ -22,10 +18,12 @@ public class PlayerActivityDataMappingBuilder {
|
|||||||
/**
|
/**
|
||||||
* Build mapping for PlayerActivityData.
|
* Build mapping for PlayerActivityData.
|
||||||
*
|
*
|
||||||
* @return mapping for activity data. Key is condId from NewActivityCondExcelConfigData.json ({@link ActivityCondExcelConfigData}) resource,
|
* @return mapping for activity data. Key is condId from NewActivityCondExcelConfigData.json
|
||||||
* value is {@link PlayerActivityData} class for related activity.
|
* ({@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();
|
return new PlayerActivityDataMappingBuilder(activities).buildMappings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,10 +35,11 @@ public class PlayerActivityDataMappingBuilder {
|
|||||||
private Int2ObjectMap<PlayerActivityData> buildMappings() {
|
private Int2ObjectMap<PlayerActivityData> buildMappings() {
|
||||||
Int2ObjectMap<PlayerActivityData> result = new Int2ObjectRBTreeMap<>();
|
Int2ObjectMap<PlayerActivityData> result = new Int2ObjectRBTreeMap<>();
|
||||||
|
|
||||||
activityCondMap
|
activityCondMap.int2ObjectEntrySet().stream()
|
||||||
.int2ObjectEntrySet()
|
.map(
|
||||||
.stream()
|
entry ->
|
||||||
.map(entry -> new BasicEntry<>(entry.getIntKey(), getPlayerActivityDataByCondId(entry.getIntKey())))
|
new BasicEntry<>(
|
||||||
|
entry.getIntKey(), getPlayerActivityDataByCondId(entry.getIntKey())))
|
||||||
.filter(entry -> entry.getValue() != null)
|
.filter(entry -> entry.getValue() != null)
|
||||||
.forEach(entry -> result.put(entry.getIntKey(), entry.getValue()));
|
.forEach(entry -> result.put(entry.getIntKey(), entry.getValue()));
|
||||||
|
|
||||||
@ -52,17 +51,19 @@ public class PlayerActivityDataMappingBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect activity data id by cond id. Cond id comes from condId field from NewActivityCondExcelConfigData.json.
|
* Detect activity data id by cond id. Cond id comes from condId field from
|
||||||
* See {@link ActivityCondExcelConfigData} for condId.
|
* NewActivityCondExcelConfigData.json. See {@link ActivityCondExcelConfigData} for condId.
|
||||||
* <p>
|
*
|
||||||
* Generally, there are 3 cases:
|
* <p>Generally, there are 3 cases:
|
||||||
|
*
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>Activity data id >= 5003. Then cond id will be activity data id plus 3 additional digits.
|
* <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>
|
* 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.
|
* <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>
|
* 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.
|
* <li>Activity data id one of [1001]. Then cond id will be activity data id plus 2 additional
|
||||||
* This also applied to activity data id = 1002. For example: activity data id = 1001, cond id = 1001x (x - any digit></li>
|
* digits. This also applied to activity data id = 1002. For example: activity data id =
|
||||||
|
* 1001, cond id = 1001x (x - any digit>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @param key cond id for which activity data id should be defined
|
* @param key cond id for which activity data id should be defined
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package emu.grasscutter.game.activity.condition.all;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
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)
|
@ActivityCondition(NEW_ACTIVITY_COND_DAYS_LESS)
|
||||||
public class DayLess extends ActivityConditionBaseHandler {
|
public class DayLess extends ActivityConditionBaseHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
public boolean execute(
|
||||||
return true; //TODO implement this and add possibility to always return true
|
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;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
||||||
|
|
||||||
import java.util.Date;
|
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)
|
@ActivityCondition(NEW_ACTIVITY_COND_DAYS_GREAT_EQUAL)
|
||||||
public class DaysGreatEqual extends ActivityConditionBaseHandler {
|
public class DaysGreatEqual extends ActivityConditionBaseHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
public boolean execute(
|
||||||
|
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||||
Date activityBeginTime = activityConfig.getBeginTime();
|
Date activityBeginTime = activityConfig.getBeginTime();
|
||||||
long timeDiff = System.currentTimeMillis() - activityBeginTime.getTime();
|
long timeDiff = System.currentTimeMillis() - activityBeginTime.getTime();
|
||||||
int days = (int) (timeDiff / (1000 * 60 * 60 * 24L));
|
int days = (int) (timeDiff / (1000 * 60 * 60 * 24L));
|
||||||
|
@ -11,11 +11,12 @@ import lombok.val;
|
|||||||
public class FinishWatcher extends ActivityConditionBaseHandler {
|
public class FinishWatcher extends ActivityConditionBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
public boolean execute(
|
||||||
|
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||||
val watcherMap = activityData.getWatcherInfoMap();
|
val watcherMap = activityData.getWatcherInfoMap();
|
||||||
for (int param : params) {
|
for (int param : params) {
|
||||||
val watcher = watcherMap.get(param);
|
val watcher = watcherMap.get(param);
|
||||||
if(watcher == null || !watcher.isFinished()){
|
if (watcher == null || !watcher.isFinished()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
package emu.grasscutter.game.activity.condition.all;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
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)
|
@ActivityCondition(NEW_ACTIVITY_COND_NOT_FINISH_TALK)
|
||||||
public class NotFinishTalk extends ActivityConditionBaseHandler {
|
public class NotFinishTalk extends ActivityConditionBaseHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
public boolean execute(
|
||||||
return activityData
|
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||||
.getPlayer()
|
return activityData.getPlayer().getQuestManager().getMainQuests().int2ObjectEntrySet().stream()
|
||||||
.getQuestManager()
|
.noneMatch(
|
||||||
.getMainQuests()
|
q ->
|
||||||
.int2ObjectEntrySet()
|
q.getValue().getTalks().get(params[0])
|
||||||
.stream()
|
!= null); // FIXME taken from ContentCompleteTalk
|
||||||
.noneMatch(q -> q.getValue().getTalks().get(params[0]) != null); //FIXME taken from ContentCompleteTalk
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package emu.grasscutter.game.activity.condition.all;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityConditionBaseHandler;
|
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)
|
@ActivityCondition(NEW_ACTIVITY_COND_PLAYER_LEVEL_GREAT_EQUAL)
|
||||||
public class PlayerLevelGreatEqualActivityActivityCondition extends ActivityConditionBaseHandler {
|
public class PlayerLevelGreatEqualActivityActivityCondition extends ActivityConditionBaseHandler {
|
||||||
|
|
||||||
@Override
|
@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];
|
return activityData.getPlayer().getLevel() >= params[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package emu.grasscutter.game.activity.condition.all;
|
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.ActivityConfigItem;
|
||||||
import emu.grasscutter.game.activity.PlayerActivityData;
|
import emu.grasscutter.game.activity.PlayerActivityData;
|
||||||
import emu.grasscutter.game.activity.condition.ActivityCondition;
|
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.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestState;
|
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)
|
@ActivityCondition(NEW_ACTIVITY_COND_QUEST_FINISH)
|
||||||
public class QuestFinished extends ActivityConditionBaseHandler {
|
public class QuestFinished extends ActivityConditionBaseHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
public boolean execute(
|
||||||
GameQuest quest = activityData
|
PlayerActivityData activityData, ActivityConfigItem activityConfig, int... params) {
|
||||||
.getPlayer()
|
GameQuest quest = activityData.getPlayer().getQuestManager().getQuestById(params[0]);
|
||||||
.getQuestManager()
|
|
||||||
.getQuestById(params[0]);
|
|
||||||
|
|
||||||
return quest != null && quest.getState() == QuestState.QUEST_STATE_FINISHED;
|
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