Fixed newly emerged noise handling issue: now NPC's can send chat messages again

This commit is contained in:
Alexander Sazonov 2022-04-20 18:32:53 +02:00
parent 743ac7b1c4
commit 32bce6f2c7
2 changed files with 11 additions and 4 deletions

View File

@ -104,7 +104,11 @@ public class ServerGameInfoHandler {
*/ */
public static void ghostNpcParser(GhostNPC npc, String msg, Game game) { public static void ghostNpcParser(GhostNPC npc, String msg, Game game) {
switch (msg) { switch (msg) {
case ClientGameInfoHandler.noiseNotification: case ClientGameInfoHandler.noiseNotification + 1 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 2 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 3 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 4 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 5 + " time(s)":
String outMsg = npc.getName() + ": " + noiseRandomizer(); String outMsg = npc.getName() + ": " + noiseRandomizer();
game.getLobby().getAdmin().broadcastNpcChatMessageToLobby(outMsg); game.getLobby().getAdmin().broadcastNpcChatMessageToLobby(outMsg);
break; break;
@ -122,9 +126,12 @@ public class ServerGameInfoHandler {
*/ */
public static void humanNpcParser(HumanNPC npc, String msg, Game game) { public static void humanNpcParser(HumanNPC npc, String msg, Game game) {
switch (msg) { switch (msg) {
case ClientGameInfoHandler.noiseNotification: case ClientGameInfoHandler.noiseNotification + 1 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 2 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 3 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 4 + " time(s)":
case ClientGameInfoHandler.noiseNotification + 5 + " time(s)":
String outMsg = npc.getName() + ": " + noiseRandomizer(); String outMsg = npc.getName() + ": " + noiseRandomizer();
;
game.getLobby().getAdmin().broadcastNpcChatMessageToLobby(outMsg); game.getLobby().getAdmin().broadcastNpcChatMessageToLobby(outMsg);
break; break;
case ClientGameInfoHandler.humanVoteRequest: case ClientGameInfoHandler.humanVoteRequest:

View File

@ -101,7 +101,7 @@ public class VoteHandler {
} }
} }
for (int i = 0; i < passengers.length; i++) { for (int i = 0; i < passengers.length; i++) {
if (!passengers[i].getIsGhost() && noiseAmount[i] != 0) { // passenger is human and someone walked by him if (noiseAmount[i] != 0) { // someone walked by this player
passengers[i].send(ClientGameInfoHandler.noiseNotification + noiseAmount[i] + " time(s)", game); passengers[i].send(ClientGameInfoHandler.noiseNotification + noiseAmount[i] + " time(s)", game);
} }
} }