Logging changes (move levels down & add toString for some objects)

This commit is contained in:
KingRainbow44 2023-08-30 23:28:54 -04:00
parent aad4529b0e
commit 67c0e82dfb
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
5 changed files with 29 additions and 9 deletions

View File

@ -1,15 +1,14 @@
package emu.grasscutter.game; package emu.grasscutter.game;
import static emu.grasscutter.config.Configuration.ACCOUNT;
import static emu.grasscutter.config.Configuration.LANGUAGE;
import dev.morphia.annotations.*; import dev.morphia.annotations.*;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.*;
import emu.grasscutter.utils.Utils; import org.bson.Document;
import java.util.*; import java.util.*;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.bson.Document;
import static emu.grasscutter.config.Configuration.*;
@Entity(value = "accounts", useDiscriminator = false) @Entity(value = "accounts", useDiscriminator = false)
public class Account { public class Account {
@ -242,4 +241,10 @@ public class Account {
this.locale = LANGUAGE; this.locale = LANGUAGE;
} }
} }
@Override
public String toString() {
return "Account ID: %s; Username: %s"
.formatted(this.id, this.username);
}
} }

View File

@ -24,7 +24,7 @@ public final class ActionSetGlobalValueToOverrideMap extends AbilityActionHandle
var abilityFormula = action.abilityFormula; var abilityFormula = action.abilityFormula;
if (!entity.getGlobalAbilityValues().containsKey(globalValueKey)) { if (!entity.getGlobalAbilityValues().containsKey(globalValueKey)) {
Grasscutter.getLogger().debug("Action does not contains {} global key", globalValueKey); Grasscutter.getLogger().trace("Action does not contains {} global key", globalValueKey);
return true; return true;
} }

View File

@ -1545,6 +1545,12 @@ public class Player implements PlayerHook, FieldFetch {
this.id == otherPlayer.getUid(); this.id == otherPlayer.getUid();
} }
@Override
public String toString() {
return "Player UID: %s; Nickname: %s; Account: %s"
.formatted(this.id, this.nickname, this.account);
}
public enum SceneLoadState { public enum SceneLoadState {
NONE(0), LOADING(1), INIT(2), LOADED(3); NONE(0), LOADING(1), INIT(2), LOADED(3);

View File

@ -1,5 +1,8 @@
package emu.grasscutter.scripts.data; package emu.grasscutter.scripts.data;
import lombok.ToString;
@ToString
public class ScriptArgs { public class ScriptArgs {
public int param1; public int param1;
public int param2; public int param2;

View File

@ -4,10 +4,16 @@ import emu.grasscutter.*;
import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import emu.grasscutter.scripts.*; import emu.grasscutter.scripts.*;
import javax.script.*;
import org.luaj.vm2.*; import org.luaj.vm2.*;
import javax.script.*;
import java.util.Set;
public class EntityController { public class EntityController {
private static final Set<String> SERVER_CALLED = Set.of(
"OnBeHurt", "OnDie", "OnTimer"
);
private transient CompiledScript entityController; private transient CompiledScript entityController;
private transient Bindings entityControllerBindings; private transient Bindings entityControllerBindings;
@ -92,7 +98,7 @@ public class EntityController {
error); error);
ret = LuaValue.valueOf(-1); ret = LuaValue.valueOf(-1);
} }
} else if (funcName != null && !funcName.equals("OnTimer")) { } else if (funcName != null && !SERVER_CALLED.contains(funcName)) {
ScriptLib.logger.error( ScriptLib.logger.error(
"[LUA] unknown func in gadget {} with {} {} {} {}", "[LUA] unknown func in gadget {} with {} {} {} {}",
entity.getEntityTypeId(), entity.getEntityTypeId(),