Bank terminals now show two of the four sub-options in the "Use Bank" radial

This commit is contained in:
Obique PSWG
2015-08-05 00:51:50 -05:00
parent df239e149c
commit e1b1d4fe1e
6 changed files with 96 additions and 12 deletions
@@ -87,6 +87,8 @@ public class ObjectMenuResponse extends ObjectController {
optionsDataSize += 9;
if (o.getText() != null || !o.getText().isEmpty())
optionsDataSize += o.getText().length()*2;
else
optionsDataSize += 4;
}
ByteBuffer data = ByteBuffer.allocate(HEADER_LENGTH + optionsDataSize + 21);
encodeHeader(data);
@@ -103,7 +105,8 @@ public class ObjectMenuResponse extends ObjectController {
addByte(data, option.getOptionType());
if (option.getText() != null || !option.getText().isEmpty())
addUnicode(data, option.getText());
else data.putInt(0);
else
data.putInt(0);
}
addByte(data, counter);
return data;
+7 -7
View File
@@ -29,16 +29,16 @@ package resources;
public class RadialOption {
private short id;
private byte parentId;
private byte optionType; // 1 unless the option text isn't listed in the radial item list (datatable). - ANHWiki
private int id;
private int parentId;
private int optionType; // 1 unless the option text isn't listed in the radial item list (datatable). - ANHWiki
private String text;
public RadialOption() {
}
public RadialOption(String text, short id, byte parentId, byte optionType) {
public RadialOption(String text, int id, int parentId, int optionType) {
this.text = text;
this.id = id;
this.parentId = parentId;
@@ -50,9 +50,9 @@ public class RadialOption {
public void setOptionType(byte optionType) { this.optionType = optionType; }
public void setText(String text) { this.text = text; }
public byte getParentId() { return parentId; }
public short getId() { return id; }
public byte getOptionType() { return optionType; }
public int getParentId() { return parentId; }
public int getId() { return id; }
public int getOptionType() { return optionType; }
public String getText() { return text; }
@Override
+8 -4
View File
@@ -29,24 +29,28 @@ package services.galaxy;
import resources.control.Manager;
import services.commands.CommandService;
import services.galaxy.terminals.TerminalManager;
import services.sui.SuiService;
public class GameManager extends Manager {
private CommandService commandService;
private ConnectionService connectionService;
private SuiService suiService;
private WeatherService weatherService;
private final CommandService commandService;
private final ConnectionService connectionService;
private final SuiService suiService;
private final WeatherService weatherService;
private final TerminalManager terminalManager;
public GameManager() {
commandService = new CommandService();
connectionService = new ConnectionService();
suiService = new SuiService();
weatherService = new WeatherService();
terminalManager = new TerminalManager();
addChildService(commandService);
addChildService(connectionService);
addChildService(suiService);
addChildService(weatherService);
addChildService(terminalManager);
}
}
@@ -0,0 +1,58 @@
package services.galaxy.terminals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import intents.radial.RadialRegisterIntent;
import intents.radial.RadialRequestIntent;
import intents.radial.RadialResponseIntent;
import intents.radial.RadialUnregisterIntent;
import resources.RadialOption;
import resources.control.Intent;
import resources.control.Service;
import resources.server_info.Log;
public class BankingService extends Service {
private static final Set<String> TEMPLATES = new HashSet<>(Arrays.asList("object/tangible/terminal/shared_terminal_bank.iff"));
public BankingService() {
}
@Override
public boolean initialize() {
registerForIntent(RadialRequestIntent.TYPE);
return super.initialize();
}
@Override
public boolean start() {
new RadialRegisterIntent(TEMPLATES).broadcast();
return super.start();
}
@Override
public boolean stop() {
new RadialUnregisterIntent(TEMPLATES).broadcast();
return super.stop();
}
@Override
public void onIntentReceived(Intent i) {
if (i instanceof RadialRequestIntent) {
RadialRequestIntent rri = (RadialRequestIntent) i;
List<RadialOption> options = new ArrayList<>();
options.add(new RadialOption("", 21, 0, 1));
options.add(new RadialOption("", 7, 0, 1));
options.add(new RadialOption("@sui:bank_credits", 112, 1, 3));
options.add(new RadialOption("@sui:bank_items", 113, 1, 3));
Log.d("BankingService", "Received Radial Request! Player: " + rri.getPlayer() + " Template: " + rri.getTarget().getTemplate());
new RadialResponseIntent(rri.getPlayer(), rri.getTarget(), options, rri.getRequest().getCounter()).broadcast();
}
}
}
@@ -0,0 +1,15 @@
package services.galaxy.terminals;
import resources.control.Manager;
public class TerminalManager extends Manager {
private final BankingService bankingService;
public TerminalManager() {
bankingService = new BankingService();
addChildService(bankingService);
}
}
+4
View File
@@ -58,6 +58,7 @@ public class RadialService extends Service {
if (target == null) {
System.err.println(requestor + " requested a null target! ID: " + request.getTargetId());
Log.w("RadialService", "%s requested a null target! ID: %d", requestor, request.getTargetId());
return;
}
if (!(requestor instanceof CreatureObject)) {
System.err.println("Requestor of target: " + target + " is not a creature object!");
@@ -91,6 +92,9 @@ public class RadialService extends Service {
menuResponse.setRadialOptions(options);
menuResponse.setCounter(counter);
player.sendPacket(menuResponse);
Log.d("RadialService", "Options: " + options.size());
for (RadialOption option : options)
Log.d("RadialService", " Option: %s %d %d %d", option.getText(), option.getParentId(), option.getId(), option.getOptionType());
}
}