mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 17:05:20 +01:00
Support Team Toggle in Tower & Refactor MonsterTide
This commit is contained in:
@@ -28,7 +28,17 @@ public class ScriptLib {
|
||||
public SceneScriptManager getSceneScriptManager() {
|
||||
return sceneScriptManager;
|
||||
}
|
||||
|
||||
|
||||
private String printTable(LuaTable table){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{");
|
||||
for(var meta : table.keys()){
|
||||
sb.append(meta).append(":").append(table.get(meta)).append(",");
|
||||
}
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public int SetGadgetStateByConfigId(int configId, int gadgetState) {
|
||||
logger.debug("[LUA] Call SetGadgetStateByConfigId with {},{}",
|
||||
configId,gadgetState);
|
||||
@@ -123,7 +133,7 @@ public class ScriptLib {
|
||||
return 1;
|
||||
}
|
||||
|
||||
this.getSceneScriptManager().spawnMonstersInGroup(group, ordersConfigId, tideCount, sceneLimit);
|
||||
this.getSceneScriptManager().startMonsterTideInGroup(group, ordersConfigId, tideCount, sceneLimit);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -204,10 +214,13 @@ public class ScriptLib {
|
||||
getSceneScriptManager().getVariables().put(var, getSceneScriptManager().getVariables().get(var) + value);
|
||||
return LuaValue.ZERO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the actions and triggers to designated group
|
||||
*/
|
||||
public int RefreshGroup(LuaTable table) {
|
||||
logger.debug("[LUA] Call RefreshGroup with {}",
|
||||
table);
|
||||
printTable(table));
|
||||
// Kill and Respawn?
|
||||
int groupId = table.get("group_id").toint();
|
||||
int suite = table.get("suite").toint();
|
||||
@@ -218,8 +231,7 @@ public class ScriptLib {
|
||||
return 1;
|
||||
}
|
||||
|
||||
this.getSceneScriptManager().spawnMonstersInGroup(group, suite);
|
||||
this.getSceneScriptManager().spawnGadgetsInGroup(group, suite);
|
||||
getSceneScriptManager().refreshGroup(group, suite);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -260,7 +272,7 @@ public class ScriptLib {
|
||||
public int SetMonsterBattleByGroup(int var1, int var2, int var3){
|
||||
logger.debug("[LUA] Call SetMonsterBattleByGroup with {},{},{}",
|
||||
var1,var2,var3);
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -270,7 +282,7 @@ public class ScriptLib {
|
||||
|
||||
return 0;
|
||||
}
|
||||
// 8-1
|
||||
|
||||
public int GetGroupVariableValueByGroup(String name, int groupId){
|
||||
logger.debug("[LUA] Call GetGroupVariableValueByGroup with {},{}",
|
||||
name,groupId);
|
||||
@@ -288,7 +300,7 @@ public class ScriptLib {
|
||||
|
||||
public int KillEntityByConfigId(LuaTable table){
|
||||
logger.debug("[LUA] Call KillEntityByConfigId with {}",
|
||||
table);
|
||||
printTable(table));
|
||||
var configId = table.get("config_id");
|
||||
if(configId == LuaValue.NIL){
|
||||
return 1;
|
||||
@@ -306,6 +318,26 @@ public class ScriptLib {
|
||||
logger.debug("[LUA] Call SetGroupVariableValueByGroup with {},{},{}",
|
||||
key,value,groupId);
|
||||
|
||||
getSceneScriptManager().getVariables().put(key, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int CreateMonster(LuaTable table){
|
||||
logger.debug("[LUA] Call CreateMonster with {}",
|
||||
printTable(table));
|
||||
var configId = table.get("config_id").toint();
|
||||
var delayTime = table.get("delay_time").toint();
|
||||
|
||||
getSceneScriptManager().spawnMonstersByConfigId(configId, delayTime);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int TowerMirrorTeamSetUp(int team, int var1) {
|
||||
logger.debug("[LUA] Call TowerMirrorTeamSetUp with {},{}",
|
||||
team,var1);
|
||||
|
||||
getSceneScriptManager().getScene().getPlayers().get(0).getTowerManager().mirrorTeamSetUp(team-1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user