mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 08:44:45 +00:00
Optimize content handlers
This commit is contained in:
parent
597574ddda
commit
948dd5df59
@ -9,12 +9,7 @@ import emu.grasscutter.net.proto.BargainResultTypeOuterClass.BargainResultType;
|
||||
public final class ContentBargainFail extends BaseContent {
|
||||
@Override
|
||||
public boolean execute(GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
var bargain = quest.getOwner()
|
||||
.getPlayerProgress()
|
||||
.getBargains()
|
||||
.get(condition.getParam()[0]);
|
||||
if (bargain == null) return false;
|
||||
|
||||
return bargain.getResult() == BargainResultType.BARGAIN_COMPLETE_FAIL;
|
||||
return condition.getParam()[0] == params[0] &&
|
||||
condition.getParam()[1] == params[1];
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,7 @@ import emu.grasscutter.net.proto.BargainResultTypeOuterClass.BargainResultType;
|
||||
public final class ContentBargainLessThan extends BaseContent {
|
||||
@Override
|
||||
public boolean execute(GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
var bargain = quest.getOwner()
|
||||
.getPlayerProgress()
|
||||
.getBargains()
|
||||
.get(condition.getParam()[0]);
|
||||
if (bargain == null) return false;
|
||||
|
||||
return bargain.getResult() == BargainResultType.BARGAIN_SINGLE_FAIL;
|
||||
return condition.getParam()[0] == params[0] &&
|
||||
condition.getParam()[1] == params[1];
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,12 @@ package emu.grasscutter.game.quest.content;
|
||||
import emu.grasscutter.data.excels.quest.QuestData;
|
||||
import emu.grasscutter.game.quest.*;
|
||||
import emu.grasscutter.game.quest.enums.QuestContent;
|
||||
import emu.grasscutter.net.proto.BargainResultTypeOuterClass.BargainResultType;
|
||||
|
||||
@QuestValueContent(QuestContent.QUEST_CONTENT_BARGAIN_SUCC)
|
||||
public final class ContentBargainSuccess extends BaseContent {
|
||||
@Override
|
||||
public boolean execute(GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
var bargain = quest.getOwner()
|
||||
.getPlayerProgress()
|
||||
.getBargains()
|
||||
.get(condition.getParam()[0]);
|
||||
if (bargain == null) return false;
|
||||
|
||||
return bargain.getResult() == BargainResultType.BARGAIN_COMPLETE_SUCC;
|
||||
return condition.getParam()[0] == params[0] &&
|
||||
condition.getParam()[1] == params[1];
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,7 @@ import emu.grasscutter.game.quest.enums.QuestContent;
|
||||
public final class ContentFinishGivingItem extends BaseContent {
|
||||
@Override
|
||||
public boolean execute(GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||
var giveAction = quest.getOwner()
|
||||
.getPlayerProgress()
|
||||
.getItemGivings()
|
||||
.get(condition.getParam()[0]);
|
||||
return giveAction != null && giveAction.isFinished();
|
||||
return condition.getParam()[0] == params[0] &&
|
||||
condition.getParam()[1] == params[1];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user