Skip to content

Commit 1577bee

Browse files
authored
Merge pull request #1761 from madsboddum/fix/entertainer/watch-radial
Added missing radial option for watching a dancer
2 parents 480d686 + 6123d04 commit 1577bee

2 files changed

Lines changed: 71 additions & 5 deletions

File tree

src/main/java/com/projectswg/holocore/resources/support/objects/radial/RadialHandler.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/***********************************************************************************
2-
* Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
2+
* Copyright (c) 2025 /// Project SWG /// www.projectswg.com *
33
* *
4-
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
4+
* ProjectSWG is an emulation project for Star Wars Galaxies founded on *
55
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
6-
* Our goal is to create an emulator which will provide a server for players to *
7-
* continue playing a game similar to the one they used to play. We are basing *
8-
* it on the final publish of the game prior to end-game events. *
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. *
98
* *
109
* This file is part of Holocore. *
1110
* *
@@ -40,6 +39,7 @@
4039
import com.projectswg.holocore.resources.support.objects.radial.pet.VehicleMountRadial;
4140
import com.projectswg.holocore.resources.support.objects.radial.terminal.*;
4241
import com.projectswg.holocore.resources.support.objects.swg.SWGObject;
42+
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
4343
import com.projectswg.holocore.resources.support.objects.swg.custom.AIObject;
4444
import com.projectswg.holocore.resources.support.objects.swg.tangible.CreditObject;
4545
import org.jetbrains.annotations.NotNull;
@@ -71,6 +71,7 @@ public enum RadialHandler {
7171

7272
classHandlers.put(AIObject.class, aiHandler);
7373
classHandlers.put(CreditObject.class, new CreditObjectRadial());
74+
classHandlers.put(CreatureObject.class, new CreatureObjectRadial());
7475
}
7576

7677
private void initializeMeleeWeaponRadials() {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)