1+ /* **********************************************************************************
2+ * Copyright (c) 2025 /// Project SWG /// www.projectswg.com *
3+ * *
4+ * ProjectSWG is an emulation project for Star Wars Galaxies founded on *
5+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
6+ * Our goal is to create one or more emulators which will provide servers for *
7+ * players to continue playing a game similar to the one they used to play. *
8+ * *
9+ * This file is part of Holocore. *
10+ * *
11+ * --------------------------------------------------------------------------------*
12+ * *
13+ * Holocore is free software: you can redistribute it and/or modify *
14+ * it under the terms of the GNU Affero General Public License as *
15+ * published by the Free Software Foundation, either version 3 of the *
16+ * License, or (at your option) any later version. *
17+ * *
18+ * Holocore is distributed in the hope that it will be useful, *
19+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21+ * GNU Affero General Public License for more details. *
22+ * *
23+ * You should have received a copy of the GNU Affero General Public License *
24+ * along with Holocore. If not, see <http://www.gnu.org/licenses/>. *
25+ ***********************************************************************************/
26+ package com.projectswg.holocore.resources.support.objects.radial.`object`
27+
28+ import com.projectswg.common.data.radial.RadialItem
29+ import com.projectswg.common.data.radial.RadialOption
30+ import com.projectswg.holocore.intents.gameplay.entertainment.WatchIntent
31+ import com.projectswg.holocore.resources.support.global.player.Player
32+ import com.projectswg.holocore.resources.support.objects.radial.RadialHandlerInterface
33+ import com.projectswg.holocore.resources.support.objects.swg.SWGObject
34+ import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject
35+
36+ class CreatureObjectRadial : RadialHandlerInterface {
37+ override fun getOptions (options : MutableCollection <RadialOption >, player : Player , target : SWGObject ) {
38+ if (target !is CreatureObject ) return
39+
40+ watch(options, player, target)
41+ }
42+
43+ override fun handleSelection (player : Player , target : SWGObject , selection : RadialItem ) {
44+ when (selection) {
45+ RadialItem .SERVER_PERFORMANCE_WATCH -> WatchIntent (player, target, true ).broadcast()
46+ RadialItem .SERVER_PERFORMANCE_WATCH_STOP -> WatchIntent (player, target, false ).broadcast()
47+ else -> {}
48+ }
49+ }
50+
51+ private fun watch (options : MutableCollection <RadialOption >, player : Player , target : CreatureObject ) {
52+ if (! target.isPlayer) return
53+ if (! target.isPerforming) return
54+ val dancing = target.performanceId == 0
55+ if (! dancing) return
56+
57+ val currentlyWatching = player.creatureObject.performanceListenTarget == target.objectId
58+
59+ if (currentlyWatching) {
60+ options.add(RadialOption .create(RadialItem .SERVER_PERFORMANCE_WATCH_STOP , " @radial_performance:watch_stop" ))
61+ } else {
62+ options.add(RadialOption .create(RadialItem .SERVER_PERFORMANCE_WATCH , " @radial_performance:watch" ))
63+ }
64+ }
65+ }
0 commit comments