mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-03 04:16:19 -04:00
merge conflict
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
@@ -105,111 +104,3 @@ public class BountyListItem {
|
||||
assignedHunters.remove(objectId);
|
||||
}
|
||||
}
|
||||
=======
|
||||
/*******************************************************************************
|
||||
* 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.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import com.sleepycat.persist.model.PrimaryKey;
|
||||
|
||||
@Entity
|
||||
public class BountyListItem {
|
||||
|
||||
@PrimaryKey
|
||||
private long objectId;
|
||||
private int creditReward;
|
||||
private String profession;
|
||||
private String faction;
|
||||
private String name;
|
||||
private List<Long> assignedHunters;
|
||||
|
||||
public BountyListItem() { }
|
||||
|
||||
public BountyListItem(long objectId, int creditReward, String profession, String faction, String name) {
|
||||
this.objectId = objectId;
|
||||
this.creditReward = creditReward;
|
||||
this.profession = profession;
|
||||
this.faction = faction;
|
||||
this.setName(name);
|
||||
this.setAssignedHunters(new ArrayList<Long>(3));
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
public void setObjectId(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
public int getCreditReward() {
|
||||
return creditReward;
|
||||
}
|
||||
public void setCreditReward(int creditReward) {
|
||||
this.creditReward = creditReward;
|
||||
}
|
||||
public String getProfession() {
|
||||
return profession;
|
||||
}
|
||||
public void setProfession(String profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
public String getFaction() {
|
||||
return faction;
|
||||
}
|
||||
|
||||
public void setFaction(String faction) {
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void addBounty(int amountToAdd) {
|
||||
this.creditReward += amountToAdd;
|
||||
}
|
||||
|
||||
public List<Long> getAssignedHunters() {
|
||||
return assignedHunters;
|
||||
}
|
||||
|
||||
public void setAssignedHunters(List<Long> assignedHunters) {
|
||||
this.assignedHunters = assignedHunters;
|
||||
}
|
||||
|
||||
public void addBountyHunter(long objectId) {
|
||||
assignedHunters.add(objectId);
|
||||
}
|
||||
|
||||
public void removeBountyHunter(long objectId) {
|
||||
assignedHunters.remove(objectId);
|
||||
}
|
||||
}
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
@@ -79,85 +78,3 @@ public class BountyMissionObjective extends MissionObjective {
|
||||
public void setMarkObjId(long markObjId) { this.markObjId = markObjId; }
|
||||
|
||||
}
|
||||
=======
|
||||
/*******************************************************************************
|
||||
* 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.objectives;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import engine.resources.scene.Point3D;
|
||||
import main.NGECore;
|
||||
import resources.common.BountyListItem;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.mission.MissionObject;
|
||||
import services.mission.MissionObjective;
|
||||
|
||||
public class BountyMissionObjective extends MissionObjective {
|
||||
|
||||
private Point3D lastKnownLocation;
|
||||
private long markObjId;
|
||||
|
||||
public BountyMissionObjective(MissionObject parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(NGECore core, CreatureObject player) {
|
||||
if (isActivated())
|
||||
return;
|
||||
|
||||
BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId());
|
||||
|
||||
setMarkObjId(bountyTarget.getObjectId());
|
||||
|
||||
// TODO: Change this to a comm message.
|
||||
player.sendSystemMessage("@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(5)), (byte) 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(NGECore core, CreatureObject player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abort(NGECore core, CreatureObject player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(NGECore core, CreatureObject player) {
|
||||
|
||||
}
|
||||
|
||||
public Point3D getLastKnownLocation() { return lastKnownLocation; }
|
||||
|
||||
public void setLastKnownLocation(Point3D lastKnownLocation) { this.lastKnownLocation = lastKnownLocation; }
|
||||
|
||||
public long getMarkObjId() { return markObjId; }
|
||||
|
||||
public void setMarkObjId(long markObjId) { this.markObjId = markObjId; }
|
||||
|
||||
}
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -91,7 +91,6 @@ public class DevService implements INetworkDispatch {
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds");
|
||||
if(creature.getClient().isGM()) suiOptions.put((long) 121, "Sandbox City");
|
||||
|
||||
break;
|
||||
case 3: // [Items] Weapons
|
||||
@@ -1167,29 +1166,6 @@ public class DevService implements INetworkDispatch {
|
||||
case 120:
|
||||
// SWGObject houseDeed = core.objectService.createObject("object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff", planet);
|
||||
// inventory.add(houseDeed);
|
||||
<<<<<<< HEAD
|
||||
|
||||
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);
|
||||
|
||||
templateString="object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff";
|
||||
deed = (Player_House_Deed)core.objectService.createObject(templateString, planet);
|
||||
deed.setBMR(15);
|
||||
deed.setAttributes();
|
||||
inventory.add(deed);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
case 121:
|
||||
NGECore.getInstance().playerCityService.buildSandboxTestCity(player);
|
||||
|
||||
return;
|
||||
|
||||
=======
|
||||
|
||||
TangibleObject deed = (TangibleObject) core.objectService.createObject("object/tangible/deed/player_house_deed/shared_generic_house_small_deed.iff", planet);
|
||||
deed.setIntAttribute("examine_maintenance_rate", 15);
|
||||
@@ -1200,7 +1176,6 @@ public class DevService implements INetworkDispatch {
|
||||
inventory.add(deed);
|
||||
|
||||
return;
|
||||
>>>>>>> origin/master
|
||||
case 125:
|
||||
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
|
||||
genericCraftingTool.setCustomName("Generic Crafting Tool");
|
||||
@@ -1212,8 +1187,6 @@ public class DevService implements INetworkDispatch {
|
||||
inventory.add(swoopDeed);
|
||||
inventory.add(av21deed);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package services.housing;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.FileVisitor;
|
||||
import java.nio.file.Files;
|
||||
@@ -86,15 +85,8 @@ public class HousingService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if(housingTemplates.containsKey(deed.getTemplate()))
|
||||
{
|
||||
=======
|
||||
if (housingTemplates.containsKey(deed.getTemplate())) {
|
||||
>>>>>>> origin/master
|
||||
HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate());
|
||||
System.out.println("DEED FOUND " + houseTemplate.getBuildingTemplate());
|
||||
System.out.println("DEED TEMP " + deed.getTemplate());
|
||||
EnterStructurePlacementModeMessage packet = new EnterStructurePlacementModeMessage(deed, houseTemplate.getBuildingTemplate());
|
||||
actor.getClient().getSession().write(packet.serialize());
|
||||
}
|
||||
@@ -103,11 +95,6 @@ public class HousingService implements INetworkDispatch {
|
||||
public void placeStructure(final CreatureObject actor, TangibleObject deed, float positionX, float positionZ, float rotation) {
|
||||
HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate());
|
||||
int structureLotCost = houseTemplate.getLotCost();
|
||||
|
||||
if (deed.getTemplate().contains("cityhall"))
|
||||
structureLotCost = 0;
|
||||
|
||||
|
||||
String structureTemplate = houseTemplate.getBuildingTemplate();
|
||||
|
||||
if (!houseTemplate.canBePlacedOn(actor.getPlanet().getName())) {
|
||||
@@ -132,69 +119,10 @@ public class HousingService implements INetworkDispatch {
|
||||
|
||||
float positionY = core.terrainService.getHeight(actor.getPlanetId(), positionX, positionZ) + 2f;
|
||||
|
||||
boolean canBuild = true;
|
||||
|
||||
// Check for city founders joining a new city
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(actor);
|
||||
|
||||
if (cityActorIsIn != null){
|
||||
// Actor is inside the bounds of a city, so zoning must be checked
|
||||
//actor.setAttachment("Has24HZoningFor",cityActorIsIn.getCityID()); // for testing
|
||||
//actor.setAttachment("Has24HZoningUntil",System.currentTimeMillis()+1000000); // for testing
|
||||
|
||||
|
||||
if (deed.getTemplate().contains("shuttleport")){
|
||||
|
||||
if (actor.getObjectID()!=cityActorIsIn.getMayorID())
|
||||
actor.sendSystemMessage("You must be the mayor of this city to place the structure.", (byte) 0);
|
||||
|
||||
if (cityActorIsIn.getRank()<0){
|
||||
actor.sendSystemMessage("@city/city:rank_req", (byte) 0);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (actor.getAttachment("Has24HZoningFor")==null || actor.getAttachment("Has24HZoningFor")==null)
|
||||
return;
|
||||
int cityActorHasZoning = (int)actor.getAttachment("Has24HZoningFor");
|
||||
BigInteger zoningUntilBI = (BigInteger) actor.getAttachment("Has24HZoningUntil");
|
||||
long zoningUntil = zoningUntilBI.longValue();
|
||||
if (cityActorHasZoning==cityActorIsIn.getCityID() && System.currentTimeMillis()<zoningUntil){
|
||||
if (! cityActorIsIn.getCitizens().contains(actor.getObjectID())){
|
||||
// Create the building
|
||||
canBuild = true;
|
||||
}
|
||||
} else {
|
||||
// Player has no zoning rights
|
||||
canBuild = false;
|
||||
if (cityActorHasZoning!=cityActorIsIn.getCityID()){
|
||||
actor.sendSystemMessage("@city/city:city_invalid_subject",(byte) 0);
|
||||
return;
|
||||
}
|
||||
|
||||
actor.sendSystemMessage("@city/city:city_invalid_subject",(byte) 0);
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
//System.out.println("cityActorIsIn null");
|
||||
}
|
||||
|
||||
if (!canBuild)
|
||||
return;
|
||||
|
||||
// Create the building
|
||||
BuildingObject building = (BuildingObject) core.objectService.createObject(structureTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion);
|
||||
core.simulationService.add(building, building.getPosition().x, building.getPosition().z, true);
|
||||
|
||||
if (cityActorIsIn != null){
|
||||
building.setAttachment("structureCity", cityActorIsIn.getCityID());
|
||||
// actor.setAttachment("residentCity", cityActorIsIn.getCityID()); He must do it manually
|
||||
//cityActorIsIn.addCitizen(actor.getObjectID());
|
||||
//cityActorIsIn.addNewStructure(building.getObjectID());
|
||||
}
|
||||
|
||||
|
||||
// Name the sign
|
||||
TangibleObject sign = (TangibleObject) building.getAttachment("structureSign");
|
||||
String playerFirstName = actor.getCustomName().split(" ")[0];
|
||||
@@ -223,7 +151,20 @@ public class HousingService implements INetworkDispatch {
|
||||
actor.setAttachment("residentCity", newCity.getCityID());
|
||||
}
|
||||
|
||||
// Check for city founders joining a new city
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(actor);
|
||||
|
||||
actor.setAttachment("Has24HZoningFor",cityActorIsIn.getCityID()); // for testing
|
||||
|
||||
int cityActorHasZoning = (int)actor.getAttachment("Has24HZoningFor");
|
||||
if (cityActorIsIn!=null && cityActorHasZoning==cityActorIsIn.getCityID()){
|
||||
if (! cityActorIsIn.getCitizens().contains(actor.getObjectID())){
|
||||
building.setAttachment("structureCity", cityActorIsIn.getCityID());
|
||||
// actor.setAttachment("residentCity", cityActorIsIn.getCityID()); He must do it manually
|
||||
cityActorIsIn.addCitizen(actor.getObjectID());
|
||||
cityActorIsIn.addNewStructure(building.getObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
// Save structure to DB
|
||||
/*building.createTransaction(core.getBuildingODB().getEnvironment());
|
||||
@@ -505,16 +446,8 @@ public class HousingService implements INetworkDispatch {
|
||||
//final BuildingObject building = (BuildingObject) target.getAttachment("housing_parentstruct");
|
||||
building.setResidency((CreatureObject)owner);
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(owner);
|
||||
if (cityActorIsIn==null)
|
||||
((CreatureObject)owner).sendSystemMessage("Serious error City object is null", (byte) 0);
|
||||
|
||||
if (cityActorIsIn!=null)
|
||||
if (! cityActorIsIn.hasCitizen(owner.getObjectID())){
|
||||
owner.setAttachment("residentCity", cityActorIsIn.getCityID());
|
||||
building.setAttachment("structureCity", cityActorIsIn.getCityID());
|
||||
cityActorIsIn.addCitizen(owner.getObjectID());
|
||||
cityActorIsIn.addNewStructure(building.getObjectID());
|
||||
}
|
||||
owner.setAttachment("residentCity", cityActorIsIn.getCityID());
|
||||
//owner.setResidence();
|
||||
}
|
||||
|
||||
public void handleListAllItems(SWGObject owner, TangibleObject target) {
|
||||
|
||||
Reference in New Issue
Block a user