mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-09-28 13:12:59 -04:00
Fixed an issue where targeting a terminal would activate it
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
/************************************************************************************
|
||||
* Copyright (c) 2015 /// Project SWG /// www.projectswg.com *
|
||||
* *
|
||||
* ProjectSWG is the first NGE emulator 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. *
|
||||
* *
|
||||
* 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 intents.radial;
|
||||
|
||||
import resources.control.Intent;
|
||||
import resources.objects.SWGObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
|
||||
public class ObjectClickedIntent extends Intent {
|
||||
|
||||
public static final String TYPE = "ObjectClickedIntent";
|
||||
|
||||
private CreatureObject requestor;
|
||||
private SWGObject target;
|
||||
|
||||
public ObjectClickedIntent(CreatureObject requestor, SWGObject target) {
|
||||
super(TYPE);
|
||||
setRequestor(requestor);
|
||||
setTarget(target);
|
||||
}
|
||||
|
||||
public void setRequestor(CreatureObject requestor) {
|
||||
this.requestor = requestor;
|
||||
}
|
||||
|
||||
public void setTarget(SWGObject target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public CreatureObject getRequestor() {
|
||||
return requestor;
|
||||
}
|
||||
|
||||
public SWGObject getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
***********************************************************************************/
|
||||
package services.galaxy.terminals;
|
||||
|
||||
import intents.radial.ObjectClickedIntent;
|
||||
import intents.radial.RadialRegisterIntent;
|
||||
import intents.radial.RadialRequestIntent;
|
||||
import intents.radial.RadialResponseIntent;
|
||||
@@ -43,7 +42,6 @@ import java.util.Set;
|
||||
|
||||
import resources.control.Intent;
|
||||
import resources.control.Service;
|
||||
import resources.radial.RadialItem;
|
||||
import resources.radial.RadialOption;
|
||||
import resources.radial.Radials;
|
||||
import resources.server_info.Log;
|
||||
@@ -71,7 +69,6 @@ public class TerminalService extends Service {
|
||||
|
||||
registerForIntent(RadialRequestIntent.TYPE);
|
||||
registerForIntent(RadialSelectionIntent.TYPE);
|
||||
registerForIntent(ObjectClickedIntent.TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,19 +122,6 @@ public class TerminalService extends Service {
|
||||
Radials.handleSelection(script, rsi.getPlayer(), rsi.getTarget(), rsi.getSelection());
|
||||
}
|
||||
break;
|
||||
case ObjectClickedIntent.TYPE:
|
||||
if (i instanceof ObjectClickedIntent) {
|
||||
ObjectClickedIntent oci = (ObjectClickedIntent) i;
|
||||
String script = lookupScript(oci.getTarget().getTemplate());
|
||||
if (script == null)
|
||||
return;
|
||||
List<RadialOption> options = Radials.getRadialOptions(script, oci.getRequestor().getOwner(), oci.getTarget());
|
||||
if (options.isEmpty())
|
||||
return;
|
||||
RadialItem item = RadialItem.getFromId(options.get(0).getId());
|
||||
Radials.handleSelection(script, oci.getRequestor().getOwner(), oci.getTarget(), item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,9 @@ import resources.control.Intent;
|
||||
import resources.control.Service;
|
||||
import network.packets.Packet;
|
||||
import network.packets.swg.zone.ObjectMenuSelect;
|
||||
import network.packets.swg.zone.object_controller.IntendedTarget;
|
||||
import network.packets.swg.zone.object_controller.ObjectMenuRequest;
|
||||
import network.packets.swg.zone.object_controller.ObjectMenuResponse;
|
||||
import intents.network.GalacticPacketIntent;
|
||||
import intents.radial.ObjectClickedIntent;
|
||||
import intents.radial.RadialRegisterIntent;
|
||||
import intents.radial.RadialRequestIntent;
|
||||
import intents.radial.RadialResponseIntent;
|
||||
@@ -73,8 +71,6 @@ public class RadialService extends Service {
|
||||
onRequest(gpi.getObjectManager(), (ObjectMenuRequest) p);
|
||||
} else if (p instanceof ObjectMenuSelect) {
|
||||
onSelection(gpi.getGalacticManager(), gpi.getNetworkId(), (ObjectMenuSelect) p);
|
||||
} else if (p instanceof IntendedTarget) {
|
||||
onObjectClicked(gpi.getObjectManager(), (IntendedTarget) p);
|
||||
}
|
||||
} else if (i instanceof RadialResponseIntent) {
|
||||
onResponse((RadialResponseIntent) i);
|
||||
@@ -131,27 +127,6 @@ public class RadialService extends Service {
|
||||
new RadialSelectionIntent(player, target, selection).broadcast();
|
||||
}
|
||||
|
||||
private void onObjectClicked(ObjectManager objectManager, IntendedTarget it) {
|
||||
SWGObject requestor = objectManager.getObjectById(it.getObjectId());
|
||||
SWGObject target = objectManager.getObjectById(it.getTargetId());
|
||||
if (target == null)
|
||||
return;
|
||||
if (!(requestor instanceof CreatureObject)) {
|
||||
Log.w("RadialService", "Requestor of target: %s is not a creature object! %s", target, requestor);
|
||||
return;
|
||||
}
|
||||
Player player = requestor.getOwner();
|
||||
if (player == null) {
|
||||
Log.w("RadialService", "Requestor of target: %s does not have an owner! %s", target, requestor);
|
||||
return;
|
||||
}
|
||||
synchronized (templatesRegistered) {
|
||||
if (templatesRegistered.contains(target.getTemplate())) {
|
||||
new ObjectClickedIntent((CreatureObject) requestor, target).broadcast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendResponse(Player player, SWGObject target, List<RadialOption> options, int counter) {
|
||||
ObjectMenuResponse menuResponse = new ObjectMenuResponse(player.getCreatureObject().getObjectId());
|
||||
menuResponse.setTargetId(target.getObjectId());
|
||||
|
||||
Reference in New Issue
Block a user