From ed3b35c9dc76d42e34d8d3e2c7f2e3e4e039d32b Mon Sep 17 00:00:00 2001 From: Josh Larson Date: Thu, 10 Oct 2024 16:41:07 -0500 Subject: [PATCH] Fixed chat emotions and talking to a target --- .../support/global/chat/SpatialChatIntent.kt | 9 +++--- .../callbacks/chat/CmdSpatialChatInternal.kt | 29 ++++++++++++++++++- .../global/chat/ChatSpatialService.java | 27 ++++++++++++++++- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/projectswg/holocore/intents/support/global/chat/SpatialChatIntent.kt b/src/main/java/com/projectswg/holocore/intents/support/global/chat/SpatialChatIntent.kt index c8372f0b6..7cc6fc30c 100644 --- a/src/main/java/com/projectswg/holocore/intents/support/global/chat/SpatialChatIntent.kt +++ b/src/main/java/com/projectswg/holocore/intents/support/global/chat/SpatialChatIntent.kt @@ -1,11 +1,10 @@ /*********************************************************************************** * Copyright (c) 2024 /// Project SWG /// www.projectswg.com * * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * + * ProjectSWG is an emulation project for Star Wars Galaxies founded on * * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * + * Our goal is to create one or more emulators which will provide servers for * + * players to continue playing a game similar to the one they used to play. * * * * This file is part of Holocore. * * * @@ -29,4 +28,4 @@ package com.projectswg.holocore.intents.support.global.chat import com.projectswg.holocore.resources.support.global.player.Player import me.joshlarson.jlcommon.control.Intent -data class SpatialChatIntent(val player: Player, val chatType: Int, val message: String, val moodId: Int, val languageId: Int) : Intent() +data class SpatialChatIntent(val player: Player, val targetId: Long, val chatType: Int, val message: String, val moodId: Int, val languageId: Int) : Intent() diff --git a/src/main/java/com/projectswg/holocore/resources/support/global/commands/callbacks/chat/CmdSpatialChatInternal.kt b/src/main/java/com/projectswg/holocore/resources/support/global/commands/callbacks/chat/CmdSpatialChatInternal.kt index 91a914bbb..19f948893 100644 --- a/src/main/java/com/projectswg/holocore/resources/support/global/commands/callbacks/chat/CmdSpatialChatInternal.kt +++ b/src/main/java/com/projectswg/holocore/resources/support/global/commands/callbacks/chat/CmdSpatialChatInternal.kt @@ -1,14 +1,41 @@ +/*********************************************************************************** + * Copyright (c) 2024 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is an emulation project for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create one or more emulators which will provide servers for * + * players to continue playing a game similar to the one they used to play. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ package com.projectswg.holocore.resources.support.global.commands.callbacks.chat import com.projectswg.holocore.intents.support.global.chat.SpatialChatIntent import com.projectswg.holocore.resources.support.global.commands.ICmdCallback import com.projectswg.holocore.resources.support.global.player.Player import com.projectswg.holocore.resources.support.objects.swg.SWGObject +import me.joshlarson.jlcommon.log.Log class CmdSpatialChatInternal : ICmdCallback { override fun execute(player: Player, target: SWGObject?, args: String) { val cmdArgs = args.split(" ".toRegex(), limit = 6).toTypedArray() + Log.d("Spatial Chat: '$args'") - SpatialChatIntent(player, cmdArgs[1].toInt(), args.substring(10), cmdArgs[2].toInt(), cmdArgs[4].toInt()).broadcast() + SpatialChatIntent(player, cmdArgs[0].toLong(), cmdArgs[1].toInt(), cmdArgs[5], cmdArgs[2].toInt(), cmdArgs[4].toInt()).broadcast() } } diff --git a/src/main/java/com/projectswg/holocore/services/support/global/chat/ChatSpatialService.java b/src/main/java/com/projectswg/holocore/services/support/global/chat/ChatSpatialService.java index 2b260b4bd..d4c89ce62 100644 --- a/src/main/java/com/projectswg/holocore/services/support/global/chat/ChatSpatialService.java +++ b/src/main/java/com/projectswg/holocore/services/support/global/chat/ChatSpatialService.java @@ -1,3 +1,28 @@ +/*********************************************************************************** + * Copyright (c) 2024 /// Project SWG /// www.projectswg.com * + * * + * ProjectSWG is an emulation project for Star Wars Galaxies founded on * + * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * + * Our goal is to create one or more emulators which will provide servers for * + * players to continue playing a game similar to the one they used to play. * + * * + * This file is part of Holocore. * + * * + * --------------------------------------------------------------------------------* + * * + * Holocore is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * Holocore is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with Holocore. If not, see . * + ***********************************************************************************/ package com.projectswg.holocore.services.support.global.chat; import com.projectswg.common.network.packets.swg.zone.object_controller.SpatialChat; @@ -24,7 +49,7 @@ public class ChatSpatialService extends Service { String senderName = sender.getCharacterFirstName(); // Send to self - SpatialChat message = new SpatialChat(actor.getObjectId(), actor.getObjectId(), 0, spi.getMessage(), (short) spi.getChatType(), (short) 0, (byte) spi.getLanguageId()); + SpatialChat message = new SpatialChat(actor.getObjectId(), actor.getObjectId(), spi.getTargetId(), spi.getMessage(), (short) spi.getChatType(), (short) spi.getMoodId(), (byte) spi.getLanguageId()); // Notify observers of the chat message for (Player owner : actor.getObservers()) {