Surveying debugging

Improved surveying
This commit is contained in:
CharonInferar
2014-03-31 19:50:02 +02:00
parent f4527d60f4
commit e692120b8f
9 changed files with 276 additions and 116 deletions
+3
View File
@@ -57,6 +57,9 @@ odb/guild/je.info.*
odb/mails/je.info.*
odb/oids/je.info.*
odb/chatRooms/je.info.*
odb/resourcehistory/je.info.*
odb/resourceroots/je.info.*
odb/resources/je.info.*
# PSWG Configs
options.cfg
+2 -4
View File
@@ -9,18 +9,16 @@ import sys
def createRadial(core, owner, target, radials):
radials.clear()
radials.add(RadialOptions(0, 21, 1, 'Use'))
radials.add(RadialOptions(0, 133, 4, 'Tool Options'))
radials.add(RadialOptions(0, 134, 6, 'Tool Resolution'))
radials.add(RadialOptions(0, 132, 1, 'Tool Options'))
return
def handleSelection(core, owner, target, option):
owner.sendSystemMessage('Distance to nearest Deposit : ' ,0)
if option == 21 and target:
if owner is not None:
rlfsm = ResourceListForSurveyMessage(core,target,owner)
owner.getClient().getSession().write(rlfsm.serialize())
return
if option == 133:
if option == 132:
if owner is not None:
surSvc = core.surveyService
surSvc.createSurveyRangeSUIWindow(owner, target)
+7 -1
View File
@@ -196,7 +196,7 @@ public class NGECore {
private ObjectDatabase buildingODB;
private ObjectDatabase resourcesODB;
private ObjectDatabase resourceRootsODB;
private ObjectDatabase resourceHistoryODB;
public NGECore() {
@@ -245,6 +245,7 @@ public class NGECore {
chatRoomODB = new ObjectDatabase("chatRooms", true, false, true);
resourcesODB = new ObjectDatabase("resources", true, false, true);
resourceRootsODB = new ObjectDatabase("resourceroots", true, false, true);
resourceHistoryODB = new ObjectDatabase("resourcehistory", true, false, true);
// Services
loginService = new LoginService(this);
@@ -556,6 +557,11 @@ public class NGECore {
return resourceRootsODB;
}
public ObjectDatabase getResourceHistoryODB() {
return resourceHistoryODB;
}
public int getActiveClients() {
int connections = 0;
for (Map.Entry<IoSession, Client> c : clients.entrySet()) {
@@ -213,12 +213,13 @@ public class GalacticResource extends SWGObject implements IPersistent {
setIffFileName(resourceRoot.getResourceFileName());
this.category = resourceRoot.getResourceClass();
this.setGeneralType(resourceRoot.getGeneralType());
this.setResourceRootID(resourceRoot.getResourceRootID()); // FK
//setResourceContainerTemplateID(resourceRoot.getTemplateID());
}
public void generateResourceType(){
// theResource.setResourceType(template.getResourceType());
// theResource.setResourceClass(template.getResourceClass());
// this.setResourceType(template.getResourceType());
// this.setResourceClass(template.getResourceClass());
}
public void generateResourceStats(){
@@ -379,6 +380,7 @@ public class GalacticResource extends SWGObject implements IPersistent {
}
public void constructResourceName(Vector<String> completeResourceNameHistory){
// ToDo: This is where the database check for past names must be added
boolean check=true;
while(check)
{
@@ -592,7 +594,7 @@ public class GalacticResource extends SWGObject implements IPersistent {
this.getresourceType = getresourceType;
}
public GalacticResource convertIntoHistoricResource(){
public GalacticResource convertToHistoricResource(){
GalacticResource historicResource = new GalacticResource();
historicResource.setName(this.getName());
historicResource.setResourceClass(this.getResourceClass());
+60 -36
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.tool;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
import engine.resources.scene.Planet;
@@ -38,21 +39,32 @@ import resources.objects.tangible.TangibleObject;
public class SurveyTool extends TangibleObject{
private byte toolType;
private String surveyEffectString;
private String sampleEffectString;
private boolean currentlySurveying;
private boolean currentlySampling;
private boolean currentlyCoolingDown;
private boolean exceptionalState;
private boolean RecoveryMode;
private Long lastSurveyTime;
private Long lastSampleTime;
private Long recoveryTime;
private GalacticResource surveyResource;
private CreatureObject user;
private Long tanoID;
private byte SurveyRangeSetting;
@NotPersistent
private String surveyEffectString;
@NotPersistent
private String sampleEffectString;
@NotPersistent
private boolean currentlySurveying;
@NotPersistent
private boolean currentlySampling;
@NotPersistent
private boolean currentlyCoolingDown;
@NotPersistent
private boolean exceptionalState;
@NotPersistent
private boolean recoveryMode;
@NotPersistent
private Long lastSurveyTime;
@NotPersistent
private Long lastSampleTime;
@NotPersistent
private Long recoveryTime;
public static byte MineralSurveyDevice = 1;
public static byte ChemicalSurveyDevice = 2;
public static byte FloraSurveyTool = 3;
@@ -73,6 +85,7 @@ public class SurveyTool extends TangibleObject{
sampleEffectString = "";
this.tanoID = objectID;
this.exceptionalState = false;
this.recoveryMode = false;
switch (template) {
case "object/tangible/survey_tool/shared_survey_tool_mineral.iff" :
toolType = 1;
@@ -84,7 +97,7 @@ public class SurveyTool extends TangibleObject{
surveyEffectString = "clienteffect/survey_tool_lumber.cef";
sampleEffectString = "clienteffect/survey_sample_lumber.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_lumber.iff" :
case "object/tangible/survey_tool/shared_survey_tool_lumber.iff" :
toolType = 3;
surveyEffectString = "clienteffect/survey_tool_lumber.cef";
sampleEffectString = "clienteffect/survey_sample_lumber.cef";
@@ -94,14 +107,26 @@ public class SurveyTool extends TangibleObject{
surveyEffectString = "clienteffect/survey_tool_gas.cef";
sampleEffectString = "clienteffect/survey_sample_gas.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_liquid.iff" :
case "object/tangible/survey_tool/shared_survey_tool_moisture.iff" :
toolType = 5;
surveyEffectString = "clienteffect/survey_tool_liquid.cef";
sampleEffectString = "clienteffect/survey_sample_liquid.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_wind.iff" : toolType = 6; break;
case "object/tangible/survey_tool/shared_survey_tool_solar.iff" : toolType = 7; break;
case "object/tangible/survey_tool/shared_survey_tool_all.iff" : toolType = 8; break;
case "object/tangible/survey_tool/shared_survey_tool_wind.iff" :
toolType = 6;
surveyEffectString = "clienteffect/survey_tool_gas.cef";
sampleEffectString = "clienteffect/survey_sample_gas.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_solar.iff" :
toolType = 7;
surveyEffectString = "clienteffect/survey_tool_moisture.cef";
sampleEffectString = "clienteffect/survey_sample_moisture.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_all.iff" :
toolType = 8;
surveyEffectString = "clienteffect/survey_tool_liquid.cef";
sampleEffectString = "clienteffect/survey_sample_liquid.cef";
break;
default: toolType = -1;
}
System.out.println("TOOLTYPE " + toolType);
@@ -124,7 +149,7 @@ public class SurveyTool extends TangibleObject{
surveyEffectString = "clienteffect/survey_tool_lumber.cef";
sampleEffectString = "clienteffect/survey_sample_lumber.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_lumber.iff" :
case "object/tangible/survey_tool/shared_survey_tool_lumber.iff" :
toolType = 3;
surveyEffectString = "clienteffect/survey_tool_lumber.cef";
sampleEffectString = "clienteffect/survey_sample_lumber.cef";
@@ -134,14 +159,26 @@ public class SurveyTool extends TangibleObject{
surveyEffectString = "clienteffect/survey_tool_gas.cef";
sampleEffectString = "clienteffect/survey_sample_gas.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_liquid.iff" :
case "object/tangible/survey_tool/shared_survey_tool_moisture.iff" :
toolType = 5;
surveyEffectString = "clienteffect/survey_tool_liquid.cef";
sampleEffectString = "clienteffect/survey_sample_liquid.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_wind.iff" : toolType = 6; break;
case "object/tangible/survey_tool/shared_survey_tool_solar.iff" : toolType = 7; break;
case "object/tangible/survey_tool/shared_survey_tool_all.iff" : toolType = 8; break;
case "object/tangible/survey_tool/shared_survey_tool_wind.iff" :
toolType = 6;
surveyEffectString = "clienteffect/survey_tool_gas.cef";
sampleEffectString = "clienteffect/survey_sample_gas.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_solar.iff" :
toolType = 7;
surveyEffectString = "clienteffect/survey_tool_moisture.cef";
sampleEffectString = "clienteffect/survey_sample_moisture.cef";
break;
case "object/tangible/survey_tool/shared_survey_tool_all.iff" :
toolType = 8;
surveyEffectString = "clienteffect/survey_tool_liquid.cef";
sampleEffectString = "clienteffect/survey_sample_liquid.cef";
break;
default: toolType = -1;
}
System.out.println("TOOLTYPE " + toolType);
@@ -244,11 +281,11 @@ public class SurveyTool extends TangibleObject{
}
public boolean isRecoveryMode() {
return RecoveryMode;
return this.recoveryMode;
}
public void setRecoveryMode(boolean recoveryMode) {
RecoveryMode = recoveryMode;
recoveryMode = recoveryMode;
}
public byte getSurveyRangeSetting() {
@@ -258,17 +295,4 @@ public class SurveyTool extends TangibleObject{
public void setSurveyRangeSetting(byte surveyRangeSetting) {
SurveyRangeSetting = surveyRangeSetting;
}
}
//"clienteffect/survey_tool_mineral.cef",
//"clienteffect/survey_tool_lumber.cef",
//"clienteffect/survey_tool_moisture.cef",
//"clienteffect/survey_tool_liquid.cef",
//"clienteffect/survey_tool_gas.cef",
//"clienteffect/survey_sample_mineral.cef",
//"clienteffect/survey_sample_lumber.cef",
//"clienteffect/survey_sample_moisture.cef",
//"clienteffect/survey_sample_liquid.cef",
//"clienteffect/survey_sample_gas.cef",
}
+65 -1
View File
@@ -32,7 +32,9 @@ import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import protocol.swg.ExpertiseRequestMessage;
import protocol.swg.SceneCreateObjectByCrc;
import protocol.swg.SceneEndBaselines;
import protocol.swg.UpdateContainmentMessage;
import resources.common.Console;
import resources.common.FileUtilities;
import resources.common.Opcodes;
@@ -41,6 +43,7 @@ import resources.objects.building.BuildingObject;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import resources.objects.tool.SurveyTool;
import services.sui.SUIWindow;
import services.sui.SUIService.ListBoxType;
import services.sui.SUIWindow.SUICallback;
@@ -49,6 +52,7 @@ import main.NGECore;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.clients.Client;
import engine.resources.common.CRC;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
@@ -85,6 +89,7 @@ public class DevService implements INetworkDispatch {
suiOptions.put((long) 22, "Composite Armor");
suiOptions.put((long) 23, "Weapons");
suiOptions.put((long) 24, "Misc Items");
suiOptions.put((long) 25, "Tools");
break;
case 3: // [Items] Weapons
suiOptions.put((long) 30, "Jedi Weapons");
@@ -93,6 +98,15 @@ public class DevService implements INetworkDispatch {
break;
case 4: // [Items] Misc Items
suiOptions.put((long) 40, "Unity Ring");
case 5: // [Items] Tools
suiOptions.put((long) 110, "Mineral Survey Device");
suiOptions.put((long) 111, "Chemical Survey Device");
suiOptions.put((long) 112, "Flora Survey Device");
suiOptions.put((long) 113, "Gas Survey Device");
suiOptions.put((long) 114, "Water Survey Device");
suiOptions.put((long) 115, "Wind Survey Device");
suiOptions.put((long) 116, "Solar Survey Device");
suiOptions.put((long) 117, "Swoop");
}
final SUIWindow window = core.suiService.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "Character Builder Terminal", "Select the desired option and click OK.", suiOptions, creature, null, 10);
@@ -229,6 +243,10 @@ public class DevService implements INetworkDispatch {
case 24: // Misc Items
sendCharacterBuilderSUI(player, 4);
return;
case 25: // Tools
sendCharacterBuilderSUI(player, 5);
return;
// [Items] Weapons
case 30: // Jedi Weapons
TangibleObject lightsaber1 = (TangibleObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet);
@@ -286,6 +304,52 @@ public class DevService implements INetworkDispatch {
TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet);
ring.setCustomName("Unity Ring");
inventory.add(ring);
case 110:
SurveyTool mineralSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_mineral.iff", planet);
mineralSurveyTool.setCustomName("Mineral Survey Device");
inventory.add(mineralSurveyTool);
case 111:
SurveyTool chemicalSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_inorganic.iff", planet);
chemicalSurveyTool.setCustomName("Chemical Survey Device");
inventory.add(chemicalSurveyTool);
case 112:
SurveyTool floraSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_lumber.iff", planet);
floraSurveyTool.setCustomName("Flora Survey Device");
inventory.add(floraSurveyTool);
case 113:
SurveyTool gasSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_gas.iff", planet);
gasSurveyTool.setCustomName("Gas Survey Device");
inventory.add(gasSurveyTool);
case 114:
SurveyTool waterSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_moisture.iff", planet);
waterSurveyTool.setCustomName("Water Survey Device");
inventory.add(waterSurveyTool);
case 115:
SurveyTool windSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_wind.iff", planet);
windSurveyTool.setCustomName("Wind Survey Device");
inventory.add(windSurveyTool);
case 116:
SurveyTool solarSurveyTool = (SurveyTool) core.objectService.createObject("object/tangible/survey_tool/shared_survey_tool_solar.iff", planet);
solarSurveyTool.setCustomName("Solar Survey Device");
inventory.add(solarSurveyTool);
case 117:
// CreatureObject swoop = (CreatureObject) core.objectService.createObject("object/mobile/vehicle/shared_speederbike_swoop.iff", planet);
// swoop.setCustomName("Swoop");
// int resCRC = CRC.StringtoCRC("object/mobile/vehicle/shared_speederbike_swoop.iff");
// SceneCreateObjectByCrc createObjectMsg = new SceneCreateObjectByCrc(swoop.getObjectID(), player.getOrientation().x, player.getOrientation().y, player.getOrientation().z, player.getOrientation().w, player.getPosition().x, player.getPosition().y, player.getPosition().z, resCRC, (byte) 0);
// player.getClient().getSession().write(createObjectMsg.serialize());
// services.resources.CharonPacketUtils.printAnalysis(createObjectMsg.serialize());
// swoop.sendBaselines(player.getClient());
// SceneEndBaselines sceneEndBaselinesMsg = new SceneEndBaselines(swoop.getObjectID());
// player.getClient().getSession().write(sceneEndBaselinesMsg.serialize());
// services.resources.CharonPacketUtils.printAnalysis(sceneEndBaselinesMsg.serialize());
// System.out.println("SWOOP");
// UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(player.getObjectID(), swoop.getObjectID(), -1);
// player.getClient().getSession().write(updateContainmentMessage.serialize());
TangibleObject deed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", planet);
inventory.add(deed);
}
}
});
+88 -47
View File
@@ -277,6 +277,7 @@ public class SurveyService implements INetworkDispatch {
}
} else { // Mismatch -> new container
String resourceContainerIFF = ResourceRoot.CONTAINER_TYPE_IFF_SIGNIFIER[sampleResource.getResourceRoot().getContainerType()];
ResourceContainerObject containerObject = (ResourceContainerObject) core.objectService.createObject(resourceContainerIFF, crafter.getPlanet());
containerObject.initializeStats(sampleResource);
containerObject.setProprietor(crafter);
@@ -373,7 +374,7 @@ public class SurveyService implements INetworkDispatch {
// Counter too frequent survey button activation
if(surveyTool.getCurrentlySurveying()){
System.out.println("TOO FREQUENT!");
//System.out.println("TOO FREQUENT!");
return;
}
@@ -434,6 +435,9 @@ public class SurveyService implements INetworkDispatch {
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
SurveyTool surveyTool = player.getLastUsedSurveyTool();
if (crafter.getPosture()!=1) // QA
surveyTool.setCurrentlySampling(false);
if (surveyTool.getCurrentlySampling()) { // QA
crafter.sendSystemMessage("@survey:already_sampling", (byte) 0);
return;
@@ -544,61 +548,96 @@ public class SurveyService implements INetworkDispatch {
crafter.setPosture((byte) 0);
surveyTool.setCurrentlySampling(false);
surveyTool.setExceptionalState(false);
removeActiveSurveyTool(surveyTool);
//removeActiveSurveyTool(surveyTool);
return;
}
int exceptionalChance = new Random().nextInt(100);
if (exceptionalChance<7 && ! surveyTool.isExceptionalState()){
crafter.sendSystemMessage("@survey:gnode_d", (byte) 0);
surveyTool.setExceptionalState(true);
final SUIWindow window = core.suiService.createSUIWindow("Script.listBox", crafter, surveyTool, 0);
window.setProperty("bg.caption.lblTitle:Text", "@base_player:swg");
window.setProperty("Prompt.lblPrompt:Text", "@survey:gnode_d");
window.addListBoxMenuItem("@survey:gnode_1", 0);
window.addListBoxMenuItem("@survey:gnode_2", 1);
window.setProperty("btnOk:visible", "True");
window.setProperty("btnCancel:visible", "True");
window.setProperty("btnOk:Text", "@ok");
window.setProperty("btnCancel:Text", "@cancel");
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) {
int index = Integer.parseInt(returnList.get(0));
if (index==0){
// Continue working
CreatureObject crafter = (CreatureObject)owner;
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
if (crafter!=null){
SurveyTool surveyTool = player.getLastUsedSurveyTool();
if (! surveyTool.isRecoveryMode()){
int exceptionalChance = new Random().nextInt(100);
if (exceptionalChance<7 && ! surveyTool.isExceptionalState()){
crafter.sendSystemMessage("@survey:gnode_d", (byte) 0);
surveyTool.setExceptionalState(true);
final SUIWindow window = core.suiService.createSUIWindow("Script.listBox", crafter, surveyTool, 0);
window.setProperty("bg.caption.lblTitle:Text", "@base_player:swg");
window.setProperty("Prompt.lblPrompt:Text", "@survey:gnode_d");
window.addListBoxMenuItem("@survey:gnode_1", 0);
window.addListBoxMenuItem("@survey:gnode_2", 1);
window.setProperty("btnOk:visible", "True");
window.setProperty("btnCancel:visible", "True");
window.setProperty("btnOk:Text", "@ok");
window.setProperty("btnCancel:Text", "@cancel");
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) {
int index = Integer.parseInt(returnList.get(0));
if (index==0){
// Continue working
CreatureObject crafter = (CreatureObject)owner;
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
if (crafter!=null){
SurveyTool surveyTool = player.getLastUsedSurveyTool();
if (surveyTool!=null){
surveyTool.setExceptionalState(false);
core.suiService.closeSUIWindow(owner, 0);
continueSampling(surveyTool);
}
}
} else {
// Attempt to recover
CreatureObject crafter = (CreatureObject)owner;
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
SurveyTool surveyTool = player.getLastUsedSurveyTool();
if (surveyTool!=null){
surveyTool.setRecoveryMode(true);
surveyTool.setExceptionalState(false);
core.suiService.closeSUIWindow(owner, 0);
continueSampling(surveyTool);
}
}
} else {
// Attempt to recover
CreatureObject crafter = (CreatureObject)owner;
PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost");
SurveyTool surveyTool = player.getLastUsedSurveyTool();
if (surveyTool!=null){
surveyTool.setRecoveryMode(true);
surveyTool.setExceptionalState(false);
core.suiService.closeSUIWindow(owner, 0);
continueSampling(surveyTool);
}
}
}
});
}
}
});
core.suiService.openSUIWindow(window);
return;
}
surveyTool.setCurrentlySampling(true);
surveyTool.setLastSampleTime(System.currentTimeMillis());
String effectFile = surveyTool.getSampleEffectString();
PlayClientEffectLocMessage cEffMsg = new PlayClientEffectLocMessage(effectFile,crafter.getPlanet().getName(),crafter.getPosition());
crafter.getClient().getSession().write(cEffMsg.serialize());
crafter.setAction(crafter.getAction()-samplingCost);
} else {
// sampling cost for recovery
surveyTool.setRecoveryMode(false);
samplingCost = 200;
if (crafter.getAction()-samplingCost<0){
crafter.sendSystemMessage("@survey:gamble_no_action", (byte) 0);
crafter.setPosture((byte) 0);
surveyTool.setCurrentlySampling(false);
surveyTool.setExceptionalState(false);
surveyTool.setLastSampleTime(System.currentTimeMillis());
removeActiveSurveyTool(surveyTool);
return;
}
surveyTool.setCurrentlySampling(true);
surveyTool.setLastSampleTime(System.currentTimeMillis());
surveyTool.setExceptionalState(false);
String effectFile = surveyTool.getSampleEffectString();
PlayClientEffectLocMessage cEffMsg = new PlayClientEffectLocMessage(effectFile,crafter.getPlanet().getName(),crafter.getPosition());
crafter.getClient().getSession().write(cEffMsg.serialize());
crafter.setAction(crafter.getAction()-samplingCost);
core.suiService.openSUIWindow(window);
return;
}
surveyTool.setCurrentlySampling(true);
@@ -607,6 +646,8 @@ public class SurveyService implements INetworkDispatch {
String effectFile = surveyTool.getSampleEffectString();
PlayClientEffectLocMessage cEffMsg = new PlayClientEffectLocMessage(effectFile,crafter.getPlanet().getName(),crafter.getPosition());
crafter.getClient().getSession().write(cEffMsg.serialize());
crafter.setAction(crafter.getAction()-samplingCost);
} else {
crafter.sendSystemMessage("There are only trace amounts of " + sampleResource.getName() + " here. Find a higher concentration of the resource, and try sampling again.", (byte) 0); // "@survey:trace_amount:"
+19 -6
View File
@@ -95,6 +95,7 @@ import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import resources.objects.group.GroupObject;
import resources.objects.guild.GuildObject;
import resources.objects.intangible.IntangibleObject;
import resources.objects.mission.MissionObject;
import resources.objects.player.PlayerObject;
import resources.objects.resource.GalacticResource;
@@ -183,7 +184,7 @@ public class ObjectService implements INetworkDispatch {
EntityCursor<ResourceRoot> cursor = core.getResourceRootsODB().getCursor(Integer.class, ResourceRoot.class);
Iterator<ResourceRoot> it = cursor.iterator();
int loadedResourceRootsCounter = 0;
System.out.println("Loading resource roots...");
while(it.hasNext()) {
final ResourceRoot resourceRoot = it.next();
System.err.println("resourceRoot loaded ID: " + resourceRoot.getResourceRootID() + " " + resourceRoot.getResourceFileName());
@@ -194,8 +195,9 @@ public class ObjectService implements INetworkDispatch {
if (loadedResourceRootsCounter==0){
//big bang will take care of it
}
System.err.println("loadedResourceRootsCounter " + loadedResourceRootsCounter);
//System.err.println("loadedResourceRootsCounter " + loadedResourceRootsCounter);
cursor.close();
System.out.println("Finished loading resource roots.");
}
// loads the currently spawned resources at server start
@@ -203,10 +205,10 @@ public class ObjectService implements INetworkDispatch {
EntityCursor<GalacticResource> cursor = core.getResourcesODB().getCursor(Long.class, GalacticResource.class);
Iterator<GalacticResource> it = cursor.iterator();
int loadedResourceCounter = 0;
System.out.println("Loading resources...");
while(it.hasNext()) {
final GalacticResource resource = it.next();
System.err.println("resource " + resource.getName());
System.err.println("resource " + resource.getName() + " rootID " + resource.getResourceRootID());
objectList.put(resource.getId(), resource);
// re-reference ResourceRoot
@@ -242,6 +244,7 @@ public class ObjectService implements INetworkDispatch {
}
cursor.close();
System.out.println("Finished loading resources.");
}
public SWGObject createResource() {
@@ -281,6 +284,7 @@ public class ObjectService implements INetworkDispatch {
public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation, String customServerTemplate, boolean overrideSnapshot, boolean loadServerTemplate) {
SWGObject object = null;
System.out.println("Template passed " + Template);
CrcStringTableVisitor crcTable;
try {
crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class);
@@ -313,7 +317,11 @@ public class ObjectService implements INetworkDispatch {
object = new TangibleObject(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/weapon")) {
} else if(Template.startsWith("object/intangible")) {
object = new IntangibleObject(objectID, planet, position, orientation,Template);
}else if(Template.startsWith("object/weapon")) {
object = new WeaponObject(objectID, planet, Template, position, orientation);
@@ -362,7 +370,7 @@ public class ObjectService implements INetworkDispatch {
object = new ResourceContainerObject(objectID, planet, Template, position, orientation);
}else {
System.err.println("return null;");
return null;
}
@@ -397,6 +405,7 @@ public class ObjectService implements INetworkDispatch {
((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.USABLE);
} else if (Template.startsWith("object/mobile/vehicle/")) {
((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE | Options.MOUNT);
System.err.println("Options.MOUNT");
} else if (Template.startsWith("object/mobile/hologram/")) {
((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE);
} else if (Template.startsWith("object/creature/npc/theme_park/")) {
@@ -681,9 +690,13 @@ public class ObjectService implements INetworkDispatch {
} else {
if (!(getObject(objectId) instanceof CreatureObject))
return;
creature = (CreatureObject) getObject(objectId);
if(creature.getAttachment("disconnectTask") != null && creature.getClient() != null && !creature.getClient().getSession().isClosing())
return;
}
+27 -18
View File
@@ -69,6 +69,7 @@ public class ResourceService implements INetworkDispatch {
private NGECore core;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private boolean enableResourceHistory = true; // Set this to false, to prevent persistence of resources into history Db
private Hashtable<Integer, ResourceRoot> resourceRootTable = new Hashtable<Integer, ResourceRoot>(); // synchronized
private Vector<ResourceRoot> ironRoots = new Vector<ResourceRoot>();
@@ -11108,10 +11109,12 @@ public class ResourceService implements INetworkDispatch {
core.getResourcesODB().put(resource, Long.class, GalacticResource.class, resource.getTransaction());
resource.getTransaction().commitSync();
// GalacticResource historicResource = resource.convertIntoHistoricResource();
// historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
// core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
// historicResource.getTransaction().commitSync();
if (enableResourceHistory){
GalacticResource historicResource = resource.convertToHistoricResource();
historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
historicResource.getTransaction().commitSync();
}
completeResourceNameHistory.add(resource.getName());
spawnedResourcesPool1.add(resource);
@@ -11135,11 +11138,13 @@ public class ResourceService implements INetworkDispatch {
core.getResourcesODB().put(resource, Long.class, GalacticResource.class, resource.getTransaction());
resource.getTransaction().commitSync();
// GalacticResource historicResource = resource.convertIntoHistoricResource();
// historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
// core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
// historicResource.getTransaction().commitSync();
if (enableResourceHistory){
GalacticResource historicResource = resource.convertToHistoricResource();
historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
historicResource.getTransaction().commitSync();
}
completeResourceNameHistory.add(resource.getName());
spawnedResourcesPool2.add(resource);
allSpawnedResources.add(resource);
@@ -11162,11 +11167,13 @@ public class ResourceService implements INetworkDispatch {
core.getResourcesODB().put(resource, Long.class, GalacticResource.class, resource.getTransaction());
resource.getTransaction().commitSync();
// GalacticResource historicResource = resource.convertIntoHistoricResource();
// historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
// core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
// historicResource.getTransaction().commitSync();
if (enableResourceHistory){
GalacticResource historicResource = resource.convertToHistoricResource();
historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
historicResource.getTransaction().commitSync();
}
completeResourceNameHistory.add(resource.getName());
spawnedResourcesPool3.add(resource);
allSpawnedResources.add(resource);
@@ -11190,10 +11197,12 @@ public class ResourceService implements INetworkDispatch {
core.getResourcesODB().put(resource, Long.class, GalacticResource.class, resource.getTransaction());
resource.getTransaction().commitSync();
// GalacticResource historicResource = resource.convertIntoHistoricResource();
// historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
// core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
// historicResource.getTransaction().commitSync();
if (enableResourceHistory){
GalacticResource historicResource = resource.convertToHistoricResource();
historicResource.createTransaction(core.getResourceHistoryODB().getEnvironment());
core.getResourceHistoryODB().put(historicResource, Long.class, GalacticResource.class, historicResource.getTransaction());
historicResource.getTransaction().commitSync();
}
completeResourceNameHistory.add(resource.getName());
spawnedResourcesPool4.add(resource);