various small bug fixes (#2270)

* various small bug fixes

* Upgrade warning to error

* A few more state changes to match the others in this pull
This commit is contained in:
Nazrin 2023-07-22 20:17:59 -07:00 committed by GitHub
parent fe169398ec
commit 47971dc931
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 36 additions and 22 deletions

View File

@ -70,7 +70,7 @@ public abstract class EntityBaseGadget extends GameEntity {
getGadgetId())
.setSourceEntityId(getId())
.setParam3((int) this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP))
.setEventSource(Integer.toString(getConfigId())));
.setEventSource(getConfigId()));
}
protected void fillFightProps(ConfigEntityGadget configGadget) {

View File

@ -235,7 +235,7 @@ public class EntityMonster extends GameEntity {
getScene().getScriptManager().callEvent(new ScriptArgs(this.getGroupId(), EVENT_SPECIFIC_MONSTER_HP_CHANGE, getConfigId(), monsterData.getId())
.setSourceEntityId(getId())
.setParam3((int) this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP))
.setEventSource(Integer.toString(getConfigId())));
.setEventSource(getConfigId()));
}
@Override

View File

@ -13,9 +13,11 @@ public class ContentQuestStateEqual extends BaseContent {
public boolean execute(
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(condition.getParam()[0]);
if (checkQuest == null) {
return false;
}
return checkQuest.getState().getValue() == params[1];
return checkQuest.getState().getValue() == condition.getParam()[1];
}
}

View File

@ -12,12 +12,12 @@ public class ContentQuestStateNotEqual extends BaseContent {
@Override
public boolean execute(
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(params[0]);
GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(condition.getParam()[0]);
if (checkQuest != null) {
return checkQuest.getState().getValue() != params[1];
if (checkQuest == null) {
return false;
}
return false;
return checkQuest.getState().getValue() != condition.getParam()[1];
}
}

View File

@ -13,8 +13,8 @@ public class ContentQuestVarEqual extends BaseContent {
@Override
public boolean execute(
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
int questVarValue = quest.getMainQuest().getQuestVars()[params[0]];
Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue);
return questVarValue == params[1];
int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]];
Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue);
return questVarValue == condition.getParam()[1];
}
}

View File

@ -13,8 +13,8 @@ public class ContentQuestVarGreater extends BaseContent {
@Override
public boolean execute(
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
int questVarValue = quest.getMainQuest().getQuestVars()[params[0]];
Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue);
return questVarValue > params[1];
int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]];
Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue);
return questVarValue > condition.getParam()[1];
}
}

View File

@ -13,8 +13,8 @@ public class ContentQuestVarLess extends BaseContent {
@Override
public boolean execute(
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
int questVarValue = quest.getMainQuest().getQuestVars()[params[0]];
Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue);
return questVarValue < params[1];
int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]];
Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue);
return questVarValue < condition.getParam()[1];
}
}

View File

@ -215,7 +215,13 @@ public class SceneScriptManager {
var suiteData = group.getSuiteByIndex(suiteIndex);
if (suiteData == null) {
Grasscutter.getLogger().warn("Group {} suite {} not found", group.id, suiteIndex);
return 0;
group.setLoaded(false);
group.load(this.scene.getId());
suiteData = group.getSuiteByIndex(suiteIndex);
if (suiteData == null) {
return 0;
}
Grasscutter.getLogger().error("Group {} suite {} nvm, I found it. This is BAD", group.id, suiteIndex);
}
int prevSuiteIndex = groupInstance.getActiveSuiteId();

View File

@ -380,7 +380,7 @@ public class ScriptLib {
logger.debug("[LUA] Call SetGroupVariableValue with {},{}",
var, value);
val groupId= currentGroup.get().id;
val groupId = currentGroup.get().id;
val variables = getSceneScriptManager().getVariables(groupId);
val old = variables.getOrDefault(var, value);
@ -393,7 +393,7 @@ public class ScriptLib {
logger.debug("[LUA] Call ChangeGroupVariableValue with {},{}",
var, value);
val groupId= currentGroup.get().id;
val groupId = currentGroup.get().id;
val variables = getSceneScriptManager().getVariables(groupId);
val old = variables.getOrDefault(var, 0);
@ -962,7 +962,7 @@ public class ScriptLib {
return 0;
}
public int EndTimeAxis(String var1){
logger.warn("[LUA] Call unimplemented EndTimeAxis with {} {} {}", var1);
logger.warn("[LUA] Call unimplemented EndTimeAxis with {}", var1);
//TODO implement var1 == name?
return 0;
}
@ -1078,6 +1078,12 @@ public class ScriptLib {
return 0;
}
public int ClearPlayerEyePoint(int var1){
logger.warn("[LUA] Call unimplemented ClearPlayerEyePoint with {}", var1);
//TODO implement
return 0;
}
public int MoveAvatarByPointArray(int uid, int targetId, LuaTable var3, String var4){
logger.warn("[LUA] Call unimplemented MoveAvatarByPointArray with {} {} {} {}", uid, targetId, printTable(var3), var4);
//TODO implement var3 contains int speed, var4 is a json string
@ -1136,7 +1142,7 @@ public class ScriptLib {
}
public int PlayCutSceneWithParam(int cutsceneId, int var2, LuaTable var3){
logger.warn("[LUA] Call unimplemented PlayCutScene with {} {}", cutsceneId, var2, var3);
logger.warn("[LUA] Call unimplemented PlayCutScene with {} {} {}", cutsceneId, var2, var3);
//TODO implement
return 0;
}

View File

@ -19,10 +19,10 @@ public class ScriptArgs {
}
public ScriptArgs(int groupId, int eventType, int param1, int param2) {
this.group_id = groupId;
this.type = eventType;
this.param1 = param1;
this.param2 = param2;
this.group_id = groupId;
}
public int getParam1() {