Send system hint when a player joins/leaves a world in multiplayer

This commit is contained in:
KingRainbow44 2023-06-02 21:41:47 -04:00
parent 8870675dcd
commit e8bfdc3c01
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -1,20 +1,15 @@
package emu.grasscutter.game.world;
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.dungeon.DungeonData;
import emu.grasscutter.game.entity.EntityTeam;
import emu.grasscutter.game.entity.EntityWorld;
import emu.grasscutter.game.entity.*;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.Player.SceneLoadState;
import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.game.props.*;
import emu.grasscutter.game.quest.enums.QuestContent;
import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo.SystemHint;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.scripts.data.SceneConfig;
import emu.grasscutter.server.event.player.PlayerTeleportEvent;
@ -22,17 +17,14 @@ import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.ConversionUtils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import lombok.Getter;
import lombok.val;
import it.unimi.dsi.fastutil.ints.*;
import lombok.*;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
public class World implements Iterable<Player> {
@Getter private final GameServer server;
@Getter private final Player host;
@ -164,6 +156,14 @@ public class World implements Iterable<Player> {
player.getTeamManager().getCurrentSinglePlayerTeamInfo(),
player.getTeamManager().getMaxTeamSize());
player.getTeamManager().setCurrentCharacterIndex(0);
if (player != this.getHost()) {
this.broadcastPacket(new PacketPlayerChatNotify(
player, 0,
SystemHint.newBuilder()
.setType(1).build()
));
}
}
// Add to scene
@ -217,6 +217,12 @@ public class World implements Iterable<Player> {
victim.getSceneId(),
victim.getPosition()));
}
} else {
this.broadcastPacket(new PacketPlayerChatNotify(
player, 0,
SystemHint.newBuilder()
.setType(2).build()
));
}
}