mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-03 18:13:11 -04:00
Structure terminal work
Creation of player_house_deed class terminal menus made py scripts arranged
This commit is contained in:
+2
-2
@@ -1,3 +1,3 @@
|
||||
LOAD.SNAPSHOT_OBJECTS=1
|
||||
LOAD.BUILDOUT_OBJECTS=1
|
||||
LOAD.SNAPSHOT_OBJECTS=0
|
||||
LOAD.BUILDOUT_OBJECTS=0
|
||||
LOAD.RESOURCE.SYSTEM=1
|
||||
@@ -6,7 +6,7 @@ def setup():
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
tarObj = core.objectService.getObject(actor.getTargetId())
|
||||
|
||||
actor.sendSystemMessage('target template ' + tarObj.getTemplate(),1)
|
||||
container = actor.getContainer()
|
||||
parsedMsg = commandString.split(' ', 2)
|
||||
|
||||
|
||||
@@ -5,5 +5,7 @@ def setup(core, object):
|
||||
print(sign)
|
||||
object.setAttachment("structureSign", sign)
|
||||
|
||||
core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -5, 0.74, -1.81, 0.707107, -0.707107, 1)
|
||||
structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -5, 0.74, -1.81, 0.707107, -0.707107, 1)
|
||||
structureterminal.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
structureterminal.setAttachment('housing_parentstruct', object)
|
||||
return
|
||||
@@ -1,7 +1,11 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'structureDeed');
|
||||
object.setAttachment('radial_filename', 'structureDeed')
|
||||
object.setConstructorTemplate('object/building/player/construction/shared_construction_player_house_corellia_small_style_01.iff')
|
||||
object.setStructureTemplate('object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff')
|
||||
object.setLotRequirement(1)
|
||||
object.setBMR(15)
|
||||
return
|
||||
|
||||
def use(core, actor, object):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
return
|
||||
@@ -0,0 +1,59 @@
|
||||
from resources.common import RadialOptions
|
||||
from protocol.swg import ResourceListForSurveyMessage
|
||||
from services.sui.SUIService import MessageBoxType
|
||||
from services.SurveyService import createSurveyRangeSUIWindow
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
#(byte parentId, short optionId, byte optionType, String description)
|
||||
radials.clear()
|
||||
owner.sendSystemMessage('target template ' + target.getTemplate(),1)
|
||||
radials.add(RadialOptions(0, 7, 0, 'Examine'))
|
||||
radials.add(RadialOptions(0, 78, 0, '@player_structure:management'))
|
||||
radials.add(RadialOptions(0, 117, 0, '@player_structure:permissions'))
|
||||
radials.add(RadialOptions(2, 118, 0, '@harvester:manage'))
|
||||
radials.add(RadialOptions(2, 128, 0, '@player_structure:permission_destroy'))
|
||||
radials.add(RadialOptions(2, 124, 0, '@player_structure:management_status'))
|
||||
radials.add(RadialOptions(2, 129, 0, '@player_structure:management_pay'))
|
||||
radials.add(RadialOptions(2, 50, 0, '@base_player:set_name'))
|
||||
radials.add(RadialOptions(2, 51, 0, '@player_structure:management_power'))
|
||||
radials.add(RadialOptions(3, 121, 0, '@player_structure:permission_admin'))
|
||||
radials.add(RadialOptions(3, 123, 0, '@player_structure:permissions'))
|
||||
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
if option == 118 and target:
|
||||
if owner is not None:
|
||||
core.housingService.handleOperateMachinery(owner,target)
|
||||
return
|
||||
if option == 128:
|
||||
if owner is not None:
|
||||
core.housingService.createDestroySUIPage(owner,target)
|
||||
return
|
||||
if option == 124:
|
||||
if owner is not None:
|
||||
core.housingService.createStatusSUIPage(owner,target)
|
||||
return
|
||||
if option == 129:
|
||||
if owner is not None:
|
||||
core.housingService.createPayMaintenanceSUIPage(owner,target)
|
||||
return
|
||||
if option == 50:
|
||||
if owner is not None:
|
||||
core.housingService.createRenameSUIPage(owner,target)
|
||||
return
|
||||
if option == 51:
|
||||
if owner is not None:
|
||||
core.housingService.handleDepositPower(owner,target)
|
||||
return
|
||||
if option == 121:
|
||||
if owner is not None:
|
||||
core.housingService.handlePermissionAdmin(owner,target)
|
||||
return
|
||||
if option == 123:
|
||||
if owner is not None:
|
||||
core.housingService.handlePermissionHopper(owner,target)
|
||||
return
|
||||
@@ -23,34 +23,44 @@ package resources.objects.building;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import resources.objects.cell.CellObject;
|
||||
|
||||
import com.sleepycat.je.Environment;
|
||||
import com.sleepycat.je.Transaction;
|
||||
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.IPersistent;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Entity(version=0)
|
||||
@Entity(version=2)
|
||||
public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
|
||||
@NotPersistent
|
||||
private BuildingMessageBuilder messageBuilder;
|
||||
@NotPersistent
|
||||
private Transaction txn;
|
||||
|
||||
private float maintenanceAmount = 0;
|
||||
private String deedTemplate;
|
||||
|
||||
public BuildingObject() {
|
||||
super();
|
||||
messageBuilder = new BuildingMessageBuilder(this);
|
||||
this.setConditionDamage(100);
|
||||
}
|
||||
|
||||
public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, Template, position, orientation);
|
||||
messageBuilder = new BuildingMessageBuilder(this);
|
||||
this.setConditionDamage(100);
|
||||
}
|
||||
|
||||
public CellObject getCellByCellNumber(final int cellNumber) {
|
||||
@@ -67,6 +77,22 @@ public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
return ref.get();
|
||||
|
||||
}
|
||||
|
||||
public float getMaintenanceAmount() {
|
||||
return maintenanceAmount;
|
||||
}
|
||||
|
||||
public void setMaintenanceAmount(float maintenanceAmount) {
|
||||
this.maintenanceAmount = maintenanceAmount;
|
||||
}
|
||||
|
||||
public void setDeedTemplate(String deedTemplate){
|
||||
this.deedTemplate = deedTemplate;
|
||||
}
|
||||
|
||||
public String getDeedTemplate(){
|
||||
return this.deedTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects.deed;
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
/**
|
||||
* @author Seefo
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
@Persistent(version=0)
|
||||
public class Player_House_Deed extends Deed {
|
||||
|
||||
private String name;
|
||||
private String structureTemplate;
|
||||
private String constructorTemplate;
|
||||
private int BMR=0;
|
||||
private int surplusMaintenance=0;
|
||||
private int lotRequirement;
|
||||
|
||||
|
||||
public Player_House_Deed(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
|
||||
super(objectID, planet, template, position, orientation);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getStructureTemplate() {
|
||||
return structureTemplate;
|
||||
}
|
||||
public void setStructureTemplate(String structureTemplate) {
|
||||
this.structureTemplate = structureTemplate;
|
||||
}
|
||||
public int getLotRequirement() {
|
||||
return lotRequirement;
|
||||
}
|
||||
public void setLotRequirement(int lotRequirement) {
|
||||
this.lotRequirement = lotRequirement;
|
||||
}
|
||||
public String getConstructorTemplate() {
|
||||
return constructorTemplate;
|
||||
}
|
||||
public void setConstructorTemplate(String constructorTemplate) {
|
||||
this.constructorTemplate = constructorTemplate;
|
||||
}
|
||||
public int getBMR() {
|
||||
return BMR;
|
||||
}
|
||||
public void setBMR(int BMR) {
|
||||
this.BMR = BMR;
|
||||
}
|
||||
public int getSurplusMaintenance() {
|
||||
return surplusMaintenance;
|
||||
}
|
||||
public void setSurplusMaintenance(int surplusMaintenance) {
|
||||
this.surplusMaintenance = surplusMaintenance;
|
||||
}
|
||||
|
||||
public void setAttributes() {
|
||||
this.getAttributes().put("@obj_attr_n:volume", "1");
|
||||
this.getAttributes().put("@obj_attr_n:examine_maintenance_rate", ""+this.getBMR() + "/hour");
|
||||
if (this.getSurplusMaintenance()>0)
|
||||
this.getAttributes().put("@obj_attr_n:examine_maintenance", ""+this.getSurplusMaintenance());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import resources.common.SpawnPoint;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.deed.Harvester_Deed;
|
||||
import resources.objects.deed.Player_House_Deed;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.tool.SurveyTool;
|
||||
@@ -87,7 +88,8 @@ public class DevService implements INetworkDispatch {
|
||||
suiOptions.put((long) 23, "Jedi Items");
|
||||
suiOptions.put((long) 26, "Installations");
|
||||
suiOptions.put((long) 110, "Survey Devices");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
|
||||
//if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
|
||||
suiOptions.put((long) 120, "House Deeds");
|
||||
break;
|
||||
case 3: // [Items] Weapons
|
||||
suiOptions.put((long) 30, "Jedi Weapons");
|
||||
@@ -1192,8 +1194,15 @@ public class DevService implements INetworkDispatch {
|
||||
core.resourceService.spawnSpecificResourceContainer("Radioactive", player, 100000);
|
||||
break;
|
||||
case 120:
|
||||
SWGObject houseDeed = core.objectService.createObject("object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff", planet);
|
||||
inventory.add(houseDeed);
|
||||
// SWGObject houseDeed = core.objectService.createObject("object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff", planet);
|
||||
// inventory.add(houseDeed);
|
||||
|
||||
templateString="object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff";
|
||||
Player_House_Deed deed = (Player_House_Deed)core.objectService.createObject(templateString, planet);
|
||||
deed.setBMR(15);
|
||||
deed.setAttributes();
|
||||
inventory.add(deed);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,14 +30,23 @@ import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.EnterStructurePlacementModeMessage;
|
||||
import protocol.swg.SceneDestroyObject;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.deed.Harvester_Deed;
|
||||
import resources.objects.deed.Player_House_Deed;
|
||||
import resources.objects.harvester.HarvesterObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.sui.SUIWindow;
|
||||
import services.sui.SUIWindow.SUICallback;
|
||||
import services.sui.SUIWindow.Trigger;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
@@ -58,11 +67,11 @@ public class HousingService implements INetworkDispatch {
|
||||
|
||||
public void enterStructureMode(CreatureObject actor, TangibleObject deed)
|
||||
{
|
||||
if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, actor.getWorldPosition().x, actor.getWorldPosition().z))
|
||||
{
|
||||
actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf
|
||||
return;
|
||||
}
|
||||
// if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, actor.getWorldPosition().x, actor.getWorldPosition().z))
|
||||
// {
|
||||
// actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf
|
||||
// return;
|
||||
// }
|
||||
|
||||
if(housingTemplates.containsKey(deed.getTemplate()))
|
||||
{
|
||||
@@ -79,24 +88,24 @@ public class HousingService implements INetworkDispatch {
|
||||
int structureLotCost = houseTemplate.getLotCost();
|
||||
String structureTemplate = houseTemplate.getBuildingTemplate();
|
||||
|
||||
if(!houseTemplate.canBePlacedOn(actor.getPlanet().getName()))
|
||||
{
|
||||
actor.sendSystemMessage("You may not place this structure on this planet.", (byte) 0); // should probably load this from an stf
|
||||
return;
|
||||
}
|
||||
|
||||
if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, positionX, positionZ))
|
||||
{
|
||||
actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf
|
||||
return;
|
||||
}
|
||||
|
||||
// Lot stuff
|
||||
if(!actor.getPlayerObject().deductLots(structureLotCost))
|
||||
{
|
||||
actor.sendSystemMessage("You do not have enough available lots to place this structure.", (byte) 0); // should probably load this from an stf
|
||||
return;
|
||||
}
|
||||
// if(!houseTemplate.canBePlacedOn(actor.getPlanet().getName()))
|
||||
// {
|
||||
// actor.sendSystemMessage("You may not place this structure on this planet.", (byte) 0); // should probably load this from an stf
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor, positionX, positionZ))
|
||||
// {
|
||||
// actor.sendSystemMessage("You may not place a structure here.", (byte) 0); // should probably load this from an stf
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Lot stuff
|
||||
// if(!actor.getPlayerObject().deductLots(structureLotCost))
|
||||
// {
|
||||
// actor.sendSystemMessage("You do not have enough available lots to place this structure.", (byte) 0); // should probably load this from an stf
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Calculate our orientation and height
|
||||
Quaternion quaternion = new Quaternion(1, 0, 0, 0);
|
||||
@@ -122,6 +131,7 @@ public class HousingService implements INetworkDispatch {
|
||||
|
||||
building.setAttachment("structureOwner", actor.getObjectID());
|
||||
building.setAttachment("structureAdmins", admins);
|
||||
building.setDeedTemplate(deed.getTemplate());
|
||||
|
||||
// Save structure to DB
|
||||
//building.createTransaction(core.getBuildingODB().getEnvironment());
|
||||
@@ -160,6 +170,132 @@ public class HousingService implements INetworkDispatch {
|
||||
catch (IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
|
||||
public void createDestroySUIPage(final SWGObject owner, final TangibleObject target) {
|
||||
|
||||
final BuildingObject building = (BuildingObject) target.getAttachment("housing_parentstruct");
|
||||
//final BuildingObject building = (BuildingObject) core.objectService.getObject(target.getParentId());
|
||||
// harvester.getStfFilename(); installation_n .getTemplate();
|
||||
String displayname = "@installation_n:"+building.getStfName();
|
||||
if (building.getCustomName()!=null)
|
||||
displayname = building.getCustomName();
|
||||
final SUIWindow window = core.suiService.createSUIWindow("Script.listBox", owner, target, 0);
|
||||
window.setProperty("bg.caption.lblTitle:Text", displayname);
|
||||
window.setProperty("Prompt.lblPrompt:Text", "@player_structure:confirm_destruction_d1 " +
|
||||
"@player_structure:confirm_destruction_d2 " +
|
||||
"\n \n @player_structure:confirm_destruction_d3a " +
|
||||
"\\#32CD32 @player_structure:confirm_destruction_d3b \\#FFFFFF " +
|
||||
"@player_structure:confirm_destruction_d4 ");
|
||||
if (building.getConditionDamage()<20 && building.getMaintenanceAmount()<3000){
|
||||
window.addListBoxMenuItem("@player_structure:redeed_confirmation \\#BB0000 @player_structure:can_redeed_no_suffix \\#FFFFFF ",1 );
|
||||
} else {
|
||||
window.addListBoxMenuItem("@player_structure:redeed_confirmation \\#32CD32 @player_structure:can_redeed_yes_suffix \\#FFFFFF ",1 );
|
||||
}
|
||||
if (building.getConditionDamage()<20){
|
||||
window.addListBoxMenuItem("@player_structure:redeed_condition \\#BB0000 " + building.getConditionDamage() + " \\#FFFFFF ",1 );
|
||||
} else {
|
||||
window.addListBoxMenuItem("@player_structure:redeed_condition \\#32CD32 " + building.getConditionDamage() + " \\#FFFFFF ",1 );
|
||||
}
|
||||
if (building.getMaintenanceAmount()<0){
|
||||
window.addListBoxMenuItem("@player_structure:redeed_maintenance \\#BB0000 " + (int)building.getMaintenanceAmount() + " \\#FFFFFF ",2 );
|
||||
} else {
|
||||
window.addListBoxMenuItem("@player_structure:redeed_maintenance \\#32CD32 " + (int)building.getMaintenanceAmount() + " \\#FFFFFF ",2 );
|
||||
}
|
||||
window.setProperty("btnOk:visible", "True");
|
||||
window.setProperty("btnCancel:visible", "True");
|
||||
window.setProperty("btnOk:Text", "@yes");
|
||||
window.setProperty("btnCancel:Text", "@no");
|
||||
Vector<String> returnList = new Vector<String>();
|
||||
returnList.add("List.lstList:SelectedRow");
|
||||
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
createCodeWindow(owner, target);
|
||||
}
|
||||
});
|
||||
window.addHandler(1, "", Trigger.TRIGGER_CANCEL, returnList, new SUICallback() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
}
|
||||
});
|
||||
core.suiService.openSUIWindow(window);
|
||||
}
|
||||
|
||||
public void createCodeWindow(SWGObject owner, TangibleObject target) {
|
||||
|
||||
final BuildingObject building = (BuildingObject) target.getAttachment("housing_parentstruct");
|
||||
//final BuildingObject building = (BuildingObject)target;
|
||||
// harvester.getStfFilename(); installation_n .getTemplate();
|
||||
Random rnd = new Random();
|
||||
final int confirmCode = 100000 + rnd.nextInt(900000);
|
||||
final SUIWindow window = core.suiService.createInputBox(2,"@player_structure:structure_status","@player_structure:structure_name_prompt", owner, target, 0);
|
||||
window.setProperty("bg.caption.lblTitle:Text", "@player_structure:confirm_destruction_t");
|
||||
window.setProperty("Prompt.lblPrompt:Text", "@player_structure:your_structure_prefix " +
|
||||
"\\#32CD32 @player_structure:will_redeed_confirm \\#FFFFFF "+
|
||||
"@player_structure:will_redeed_suffix " +
|
||||
"\n \n Code: " + confirmCode);
|
||||
|
||||
window.setProperty("btnOk:visible", "True");
|
||||
window.setProperty("btnCancel:visible", "True");
|
||||
window.setProperty("btnOk:Text", "@yes");
|
||||
window.setProperty("btnCancel:Text", "@no");
|
||||
Vector<String> returnList = new Vector<String>();
|
||||
returnList.add("txtInput:LocalText");
|
||||
|
||||
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
CreatureObject crafter = (CreatureObject)owner;
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
if (returnList.get(0).equals(""+confirmCode)){
|
||||
// handle creation of correct deed in player inventory
|
||||
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
|
||||
String deedTemplate = building.getDeedTemplate();
|
||||
|
||||
Player_House_Deed deed = (Player_House_Deed)core.objectService.createObject(deedTemplate, owner.getPlanet());
|
||||
if(player.getLotsRemaining()+deed.getLotRequirement()>10){
|
||||
// Something went wrong or hacking attempt
|
||||
crafter.sendSystemMessage("Structure can't be redeeded. Maximum lot count exceeded.",(byte)1);
|
||||
return;
|
||||
}
|
||||
|
||||
deed.setStructureTemplate(building.getTemplate());
|
||||
deed.setSurplusMaintenance((int)building.getMaintenanceAmount());
|
||||
deed.setAttributes();
|
||||
|
||||
SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(building.getObjectID());
|
||||
owner.getClient().getSession().write(destroyObjectMsg.serialize());
|
||||
core.objectService.destroyObject(building.getObjectID());
|
||||
|
||||
SWGObject ownerInventory = owner.getSlottedObject("inventory");
|
||||
ownerInventory.add(deed);
|
||||
|
||||
if(player.getLotsRemaining()+deed.getLotRequirement()<=10)
|
||||
player.setLotsRemaining(player.getLotsRemaining()+deed.getLotRequirement());
|
||||
|
||||
crafter.sendSystemMessage("@player_structure:processing_destruction",(byte)1);
|
||||
crafter.sendSystemMessage("@player_structure:deed_reclaimed",(byte)1);
|
||||
|
||||
} else {
|
||||
crafter.sendSystemMessage("@player_structure:incorrect_destroy_code",(byte)1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
window.addHandler(1, "", Trigger.TRIGGER_CANCEL, returnList, new SUICallback() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
}
|
||||
});
|
||||
core.suiService.openSUIWindow(window);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,6 +97,7 @@ import resources.objects.building.BuildingObject;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.deed.Harvester_Deed;
|
||||
import resources.objects.deed.Player_House_Deed;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.guild.GuildObject;
|
||||
import resources.objects.harvester.HarvesterObject;
|
||||
@@ -320,7 +321,11 @@ public class ObjectService implements INetworkDispatch {
|
||||
} else if(Template.startsWith("object/tangible/deed/harvester_deed") || Template.startsWith("object/tangible/deed/generator_deed")) {
|
||||
|
||||
object = new Harvester_Deed(objectID, planet, Template, position, orientation);
|
||||
|
||||
|
||||
} else if(Template.startsWith("object/tangible/deed/player_house_deed")) {
|
||||
|
||||
object = new Player_House_Deed(objectID, planet, Template, position, orientation);
|
||||
|
||||
} else if(Template.startsWith("object/tangible")) {
|
||||
|
||||
object = new TangibleObject(objectID, planet, Template, position, orientation);
|
||||
|
||||
Reference in New Issue
Block a user