Fixed chat emotions and talking to a target

This commit is contained in:
Josh Larson
2024-10-10 16:41:07 -05:00
parent b8096cd020
commit ed3b35c9dc
3 changed files with 58 additions and 7 deletions
@@ -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()
@@ -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 <http://www.gnu.org/licenses/>. *
***********************************************************************************/
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()
}
}
@@ -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 <http://www.gnu.org/licenses/>. *
***********************************************************************************/
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()) {