mirror of
https://github.com/Anime-Game-Servers/AnimeGamesLua.git
synced 2024-11-23 04:19:41 +00:00
[Fix] State 0 is also a valid state for a gadget
This commit is contained in:
parent
62c72e24e0
commit
f8fa45d060
@ -1144,14 +1144,18 @@ public class ScriptLib {
|
||||
* @param parametersTable The parameter table, contains the following fields: config_id:int, state:int
|
||||
*/
|
||||
public static int ChangeGroupGadget(GroupEventLuaContext context, Object parametersTable) {
|
||||
val handler = context.getScriptLibHandlerProvider().getGroupGadgetHandler();
|
||||
if(handler == null){
|
||||
return NOT_IMPLEMENTED.getValue();
|
||||
}
|
||||
val table = context.getEngine().getTable(parametersTable);
|
||||
val configId = table.optInt("config_id", -1);
|
||||
val state = table.optInt("state", -1);
|
||||
if(configId <= 0 || state <= 0){
|
||||
if(configId <= 0 || state < 0){
|
||||
scriptLogger.error(() -> "[ChangeGroupGadget] Invalid configId (" + configId + ") or state (" + state + ")");
|
||||
return INVALID_PARAMETER_TABLE_CONTENT.getValue();
|
||||
}
|
||||
return context.getScriptLibHandlerProvider().getGroupGadgetHandler().ChangeGroupGadget(context, configId, state);
|
||||
return handler.ChangeGroupGadget(context, configId, state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user