Refactored Building and Harvester Permission Lists, fixed AI pathing into cells

This commit is contained in:
Light2
2014-06-09 19:05:58 +02:00
parent 55624e8fd4
commit dd48daaca1
11 changed files with 172 additions and 52 deletions
+37 -20
View File
@@ -692,45 +692,62 @@ public class HarvesterService implements INetworkDispatch {
public void handlePermissionAdmin(CreatureObject owner, TangibleObject target) {
String listName = "ADMIN";
String listName = "admin";
((HarvesterObject) target).setPermissionAdmin(listName,owner);
}
public void handlePermissionHopper(CreatureObject owner, TangibleObject target) {
String listName = "HOPPER";
String listName = "hopper";
((HarvesterObject) target).setPermissionHopper(listName,owner);
}
public void handlePermissionListModify(CreatureObject crafter, SWGObject target, String commandArgs){
String[] commandSplit = commandArgs.split(" ");
if (commandSplit.length==3){
if (core.characterService.playerExists(commandSplit[2])){
if (commandSplit[2].equals("ADMIN")){
if (commandSplit.length >= 3) {
if (core.characterService.playerExists(commandSplit[2])) {
SWGObject obj = core.objectService.getObject(core.characterService.getPlayerOID(commandSplit[2]));
if (commandSplit[2].equals("admin")){
Vector<String> adminList = ((HarvesterObject)target).getAdminList();
if (commandSplit[0].equals("add") && (!adminList.contains(commandSplit[2]))){
crafter.sendSystemMessage(commandSplit[2] + " added as administrator", (byte) 0);
adminList.add(commandSplit[2]);
((HarvesterObject)target).setAdminList(adminList);
}
if (commandSplit[0].equals("remove") && (adminList.contains(commandSplit[2]))){
if (commandSplit[0].equals("remove") && (adminList.contains(commandSplit[2]))){
if(((HarvesterObject)target).getOwner() == obj.getObjectID()) {
crafter.sendSystemMessage("@player_structure:cannot_remove_owner", (byte) 0);
return;
}
if(crafter == obj) {
crafter.sendSystemMessage("@player_structure:cannot_remove_self", (byte) 0);
return;
}
crafter.sendSystemMessage(commandSplit[2] + " removed as administrator", (byte) 0);
adminList.remove(commandSplit[2]);
((HarvesterObject)target).setAdminList(adminList);
}
}
if (commandSplit[2].equals("HOPPER")){
Vector<String> hopperList = ((HarvesterObject)target).getHopperList();
if (commandSplit[0].equals("add") && (!hopperList.contains(commandSplit[2]))){
crafter.sendSystemMessage(commandSplit[2] + " added as administrator", (byte) 0);
hopperList.add(commandSplit[2]);
((HarvesterObject)target).setHopperList(hopperList);
}
if (commandSplit[0].equals("remove") && (hopperList.contains(commandSplit[2]))){
crafter.sendSystemMessage(commandSplit[2] + " removed as administrator", (byte) 0);
hopperList.remove(commandSplit[2]);
((HarvesterObject)target).setHopperList(hopperList);
if (commandSplit[2].equals("hopper")){
Vector<String> hopperList = ((HarvesterObject)target).getHopperList();
if (commandSplit[0].equals("add") && (!hopperList.contains(commandSplit[2]))){
crafter.sendSystemMessage(commandSplit[2] + " added as administrator", (byte) 0);
hopperList.add(commandSplit[2]);
((HarvesterObject)target).setHopperList(hopperList);
}
if (commandSplit[0].equals("remove") && (hopperList.contains(commandSplit[2]))) {
if(((HarvesterObject)target).getOwner() == obj.getObjectID()) {
crafter.sendSystemMessage("@player_structure:cannot_remove_owner", (byte) 0);
return;
}
if(crafter == obj) {
crafter.sendSystemMessage("@player_structure:cannot_remove_self", (byte) 0);
return;
}
crafter.sendSystemMessage(commandSplit[2] + " removed as administrator", (byte) 0);
hopperList.remove(commandSplit[2]);
((HarvesterObject)target).setHopperList(hopperList);
}
}
}
} else {
@@ -1015,8 +1032,8 @@ public class HarvesterService implements INetworkDispatch {
String structureTemplate = (String) object.getAttachment("StructureTemplate");
HarvesterObject harvester = (HarvesterObject) NGECore.getInstance().objectService.createObject(structureTemplate, actor.getPlanet());
Vector<String> adminList = harvester.getAdminList();
//String[] fullName = ((CreatureObject)actor).getCustomName().split(" ");
adminList.add(actor.getCustomName());
String[] fullName = ((CreatureObject)actor).getCustomName().split(" ");
adminList.add(fullName[0]);
// Set BER and outputhopper capacity here, take it from deed
harvester.setBER((int)object.getAttachment("Deed_BER"));
harvester.setSpecRate((int)(1.5F*(int)object.getAttachment("Deed_BER")));