mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Updated Housing service
Housing service detects if new citizen builds structure and adds him as citizen to the city
This commit is contained in:
@@ -2,13 +2,8 @@ import sys
|
||||
from services.housing import HouseTemplate
|
||||
from engine.resources.scene import Point3D
|
||||
|
||||
|
||||
def setup(core):
|
||||
<<<<<<< HEAD
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff", "object/building/player/city/shared_cityhall_tatooine.iff", 5)
|
||||
=======
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff", "object/building/player/city/shared_cityhall_tatooine.iff", 0)
|
||||
>>>>>>> upstream/master
|
||||
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/guild_deed/shared_corellia_guild_deed.iff", "object/building/player/shared_player_guildhall_corellia_style_01.iff", 5)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(18.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("talus")
|
||||
houseTemplate.setDefaultItemLimit(400)
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/guild_deed/shared_generic_guild_deed.iff", "object/building/player/shared_player_guildhall_generic_style_01.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(18.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/guild_deed/shared_naboo_guild_deed.iff", "object/building/player/shared_player_guildhall_naboo_style_01.iff", 5)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(18.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
houseTemplate.addPlaceablePlanet("rori")
|
||||
houseTemplate.addPlaceablePlanet("dantooine")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/guild_deed/shared_tatooine_guild_deed.iff", "object/building/player/shared_player_guildhall_tatooine_style_01.iff", 5)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(18.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("dantooine")
|
||||
houseTemplate.addPlaceablePlanet("lok")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/guild_deed/shared_tatooine_guild_style_02_deed.iff", "object/building/player/shared_player_guildhall_tatooine_style_02.iff", 5)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(5.5), float(4), float(12.7)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("dantooine")
|
||||
houseTemplate.addPlaceablePlanet("lok")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_corellia_house_large_deed.iff", "object/building/player/shared_player_house_corellia_large_style_01.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(13.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("talus")
|
||||
houseTemplate.setDefaultItemLimit(500)
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_corellia_house_large_style_02_deed.iff", "object/building/player/shared_player_house_generic_large_style_02.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(-13.4), float(3), float(9.1)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("talus")
|
||||
houseTemplate.setDefaultItemLimit(500)
|
||||
|
||||
@@ -5,12 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_corellia_house_medium_deed.iff", "object/building/player/shared_player_house_corellia_medium_style_01.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(5.3),float(2.26),float(7.7)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("talus")
|
||||
houseTemplate.setDefaultItemLimit(200)
|
||||
core.housingService.addHousingTemplate(houseTemplate)
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_corellia_house_medium_style_02_deed.iff", "object/building/player/shared_player_house_corellia_medium_style_02.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(5.3), float(2.26), float(7.7)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("talus")
|
||||
houseTemplate.setDefaultItemLimit(200)
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_large_style_02_deed.iff", "object/building/player/shared_player_house_generic_large_style_02.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(6), float(3), float(13.4)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_large_deed.iff", "object/building/player/shared_player_house_generic_large_style_01.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(-13.4), float(3), float(9.1)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_large_window_s01_deed.iff", "object/building/player/shared_player_house_generic_large_window_s01.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(-13.7), float(3), float(9.1)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
|
||||
@@ -5,11 +5,7 @@ from engine.resources.scene import Point3D
|
||||
def setup(core):
|
||||
houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_large_window_s02_deed.iff", "object/building/player/shared_player_house_generic_large_window_s02.iff", 2)
|
||||
|
||||
<<<<<<< HEAD
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
|
||||
=======
|
||||
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(10.4), float(3), float(-11)))
|
||||
>>>>>>> upstream/master
|
||||
houseTemplate.addPlaceablePlanet("tatooine")
|
||||
houseTemplate.addPlaceablePlanet("corellia")
|
||||
houseTemplate.addPlaceablePlanet("naboo")
|
||||
|
||||
@@ -3,14 +3,6 @@ from engine.resources.scene import Point3D
|
||||
from engine.resources.scene import Quaternion
|
||||
|
||||
def setup(core, object):
|
||||
<<<<<<< HEAD
|
||||
|
||||
structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', Point3D(float(18.9), float(1.5), float(10)), Quaternion(float(1), float(1), float(1), float(0)),7)
|
||||
#structureterminal.setAttachment('radial_filename', 'structure_management_terminal')
|
||||
structureterminal.setAttachment('housing_parentstruct', object)
|
||||
|
||||
cityterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_city.iff', Point3D(float(0), float(2.6), float(0)), Quaternion(float(1), float(1), float(1), float(0)),3)
|
||||
=======
|
||||
sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -13.7, 3, 9.1, -1, 0, -1)
|
||||
print(sign)
|
||||
object.setAttachment("structureSign", sign)
|
||||
@@ -23,11 +15,6 @@ def setup(core, object):
|
||||
#cityterminal.setAttachment('housing_parentstruct', object)
|
||||
|
||||
city_vote_terminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_city_vote.iff', Point3D(float(0), float(1.85), float(-8.5)), Quaternion(float(1), float(1), float(1), float(0)),3)
|
||||
>>>>>>> upstream/master
|
||||
#cityterminal.setAttachment('housing_parentstruct', object)
|
||||
cityterminal.setAttachment('radial_filename', 'terminal/city_maintenance_terminal')
|
||||
|
||||
sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -7.39, 2.36, 2, -1, 0, -1)
|
||||
object.setAttachment("structureSign", sign)
|
||||
|
||||
return
|
||||
@@ -5,11 +5,7 @@ def setup(core, object):
|
||||
object.setConstructorTemplate('object/building/player/shared_construction_structure.iff')
|
||||
object.setStructureTemplate('object/tangible/deed/city_deed/shared_cityhall_tatooine_deed.iff')
|
||||
#object.setLotRequirement(5)
|
||||
<<<<<<< HEAD
|
||||
#object.setBMR(100)
|
||||
=======
|
||||
object.setBMR(308)
|
||||
>>>>>>> upstream/master
|
||||
return
|
||||
|
||||
def use(core, actor, object):
|
||||
|
||||
@@ -70,7 +70,7 @@ def handleSelection(core, owner, target, option):
|
||||
return
|
||||
if option == 121:
|
||||
if owner is not None:
|
||||
handleCityInfo(core, owner, target, option)
|
||||
handleCityRankInfo(core, owner, target, option)
|
||||
return
|
||||
if option == 122:
|
||||
if owner is not None:
|
||||
@@ -101,6 +101,11 @@ def setnameCallBack(owner, window, eventType, returnList):
|
||||
|
||||
def handleAdjustTaxes(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
if playerCity.getRank()<2:
|
||||
owner.sendSystemMessage('@city/city:no_rank_taxes', 0)
|
||||
return
|
||||
|
||||
window = core.suiService.createSUIWindow('Script.listBox', owner, target, 0);
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:adjust_taxes_t')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:adjust_taxes_d')
|
||||
@@ -373,7 +378,7 @@ def setCityInfoCallBack(owner, window, eventType, returnList):
|
||||
def handleRegisterMap(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
if playerCity.getCityRank()<3:
|
||||
if playerCity.getRank()<3:
|
||||
owner.sendSystemMessage('@city/city:cant_register_rank', 0)
|
||||
return
|
||||
|
||||
@@ -396,9 +401,9 @@ def setRegisterMapCallBack(owner, window, eventType, returnList):
|
||||
def handleSpecialization(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
#if playerCity.getCityRank()<3:
|
||||
#owner.sendSystemMessage('@city/city:no_rank_spec', 0)
|
||||
#return
|
||||
if playerCity.getRank()<3:
|
||||
owner.sendSystemMessage('@city/city:no_rank_spec', 0)
|
||||
return
|
||||
|
||||
window = core.suiService.createSUIWindow('Script.listBox', owner, target, 0);
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_specs_t')
|
||||
|
||||
@@ -151,7 +151,9 @@ public class BuildingObject extends TangibleObject implements IPersistent {
|
||||
public Vector<TangibleObject> getItemsList() {
|
||||
Vector<TangibleObject> items = new Vector<TangibleObject>();
|
||||
getCells().forEach(c -> c.viewChildren(c, true, false, (item) -> {
|
||||
if(!(item instanceof CreatureObject) && item.getTemplate() != "object/tangible/terminal/shared_terminal_player_structure.iff")
|
||||
if(!(item instanceof CreatureObject) && item.getTemplate() != "object/tangible/terminal/shared_terminal_player_structure.iff"
|
||||
&& item.getTemplate() != "object/tangible/terminal/shared_terminal_city.iff"
|
||||
&& item.getTemplate() != "object/tangible/terminal/shared_terminal_city_vote.iff")
|
||||
items.add((TangibleObject) item);
|
||||
}));
|
||||
return items;
|
||||
|
||||
@@ -1223,20 +1223,15 @@ public class DevService implements INetworkDispatch {
|
||||
Player_House_Deed deed = (Player_House_Deed)core.objectService.createObject(templateString, planet);
|
||||
deed.setBMR(15);
|
||||
deed.setAttributes();
|
||||
<<<<<<< HEAD
|
||||
inventory.add(deed);
|
||||
|
||||
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);
|
||||
|
||||
break;
|
||||
=======
|
||||
inventory.add(deed);
|
||||
return;
|
||||
>>>>>>> upstream/master
|
||||
return;
|
||||
|
||||
case 125:
|
||||
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
|
||||
genericCraftingTool.setCustomName("Generic Crafting Tool");
|
||||
|
||||
@@ -119,7 +119,9 @@ public class HousingService implements INetworkDispatch {
|
||||
// Name the sign
|
||||
TangibleObject sign = (TangibleObject) building.getAttachment("structureSign");
|
||||
String playerFirstName = actor.getCustomName().split(" ")[0];
|
||||
sign.setCustomName2(playerFirstName + "'s House");
|
||||
|
||||
if (sign !=null)
|
||||
sign.setCustomName2(playerFirstName + "'s House");
|
||||
//building.add(sign);
|
||||
|
||||
core.objectService.destroyObject(deed);
|
||||
@@ -140,6 +142,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());
|
||||
@@ -436,6 +452,8 @@ public class HousingService implements INetworkDispatch {
|
||||
public void declareResidency(SWGObject owner, TangibleObject target) {
|
||||
final BuildingObject building = (BuildingObject) target.getAttachment("housing_parentstruct");
|
||||
building.setResidency((CreatureObject)owner);
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(owner);
|
||||
owner.setAttachment("residentCity", cityActorIsIn.getCityID());
|
||||
//owner.setResidence();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,17 @@
|
||||
******************************************************************************/
|
||||
package services.playercities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
import services.chat.Mail;
|
||||
import services.chat.WaypointAttachment;
|
||||
import main.NGECore;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
@@ -254,7 +259,8 @@ public class PlayerCity {
|
||||
Vector<Long> citizenList = getCitizens();
|
||||
int founderCitizenCount = 0;
|
||||
for (long founderId : founders){
|
||||
if (citizenList.contains(founderId))
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(founderId);
|
||||
if (citizenList.contains(founderId) && (long)citizenObject.getAttachment("residentCity")==this.getCityID())
|
||||
founderCitizenCount++;
|
||||
}
|
||||
if (founderCitizenCount==founders.size())
|
||||
@@ -335,6 +341,12 @@ public class PlayerCity {
|
||||
this.placedStructures = placedStructures;
|
||||
}
|
||||
}
|
||||
|
||||
public void addNewStructure(long newStructure) {
|
||||
synchronized(placedStructures){
|
||||
this.placedStructures.add(newStructure);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<Long> getCitizens() {
|
||||
synchronized(citizens){
|
||||
@@ -352,6 +364,9 @@ public class PlayerCity {
|
||||
synchronized(citizens){
|
||||
this.citizens.add(citizen);
|
||||
}
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen);
|
||||
sendNewCitizenMailAll(citizenObject);
|
||||
sendNewCitizenMail(citizenObject);
|
||||
}
|
||||
|
||||
public void removeCitizen(long citizen) {
|
||||
@@ -470,15 +485,6 @@ public class PlayerCity {
|
||||
this.cityID = cityID;
|
||||
}
|
||||
|
||||
public void sendSpecUpdateMail(int cityID) {
|
||||
// city_version_update_subject_4
|
||||
// city_version_update_body_4
|
||||
}
|
||||
|
||||
public void sendNameChangeMail(String name) {
|
||||
|
||||
}
|
||||
|
||||
public int getIncomeTax() {
|
||||
return incomeTax;
|
||||
}
|
||||
@@ -550,4 +556,109 @@ public class PlayerCity {
|
||||
public List<String> getSpecializationSTFNamesAsList() {
|
||||
return Arrays.asList(specialisationSTFNames);
|
||||
}
|
||||
|
||||
public void sendSpecUpdateMail(int cityID) {
|
||||
// city_version_update_subject_4
|
||||
// city_version_update_body_4
|
||||
Vector<Long> citizenList = getCitizens();
|
||||
for (long citizen : citizenList){
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen);
|
||||
Mail actorMail = new Mail();
|
||||
actorMail.setMailId(NGECore.getInstance().chatService.generateMailId());
|
||||
actorMail.setRecieverId(citizen);
|
||||
actorMail.setStatus(Mail.NEW);
|
||||
actorMail.setTimeStamp((int) (new Date().getTime() / 1000));
|
||||
actorMail.setMessage("@city/city:city_version_update_body_4");
|
||||
actorMail.setSubject("@city/city:city_version_update_subject_4");
|
||||
actorMail.setSenderName("City " + this.cityName);
|
||||
|
||||
// List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
// WaypointAttachment attachment = new WaypointAttachment();
|
||||
// attachment.active = false;
|
||||
// attachments.add(attachment);
|
||||
// attachment.cellID = constructionWaypoint.getCellId();
|
||||
// attachment.color = (byte)1;
|
||||
// attachment.name = "City";
|
||||
// attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(citizenObject.getPlanet().getName());
|
||||
// attachment.positionX = object.getPosition().x;
|
||||
// attachment.positionY = 0;
|
||||
// attachment.positionZ = object.getPosition().z;
|
||||
// actorMail.setAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
// if (newCitizen.getClient()!=null)
|
||||
// NGECore.getInstance().chatService.sendPersistentMessageHeader(newCitizen.getClient(), actorMail);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendNameChangeMail(String name) {
|
||||
|
||||
}
|
||||
|
||||
public void sendNewCitizenMailAll(CreatureObject newCitizen) {
|
||||
|
||||
Vector<Long> citizenList = getCitizens();
|
||||
for (long citizen : citizenList){
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen);
|
||||
Mail actorMail = new Mail();
|
||||
actorMail.setMailId(NGECore.getInstance().chatService.generateMailId());
|
||||
actorMail.setRecieverId(citizen);
|
||||
actorMail.setStatus(Mail.NEW);
|
||||
actorMail.setTimeStamp((int) (new Date().getTime() / 1000));
|
||||
actorMail.setMessage("@city/city:new_city_citizen_body");
|
||||
actorMail.setSubject("@city/city:new_city_citizen_subject");
|
||||
actorMail.setSenderName("City " + this.cityName);
|
||||
|
||||
List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", citizenObject.getPlanet(), citizenObject.getPosition().x, 0 ,citizenObject.getPosition().z);
|
||||
WaypointAttachment attachment = new WaypointAttachment();
|
||||
attachment.active = false;
|
||||
attachment.cellID = constructionWaypoint.getCellId();
|
||||
attachment.color = (byte)1;
|
||||
attachment.name = "City";
|
||||
attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(citizenObject.getPlanet().getName());
|
||||
attachment.positionX = citizenObject.getPosition().x;
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizenObject.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
if (newCitizen.getClient()!=null)
|
||||
NGECore.getInstance().chatService.sendPersistentMessageHeader(newCitizen.getClient(), actorMail);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendNewCitizenMail(CreatureObject citizen) {
|
||||
|
||||
Mail actorMail = new Mail();
|
||||
actorMail.setMailId(NGECore.getInstance().chatService.generateMailId());
|
||||
actorMail.setRecieverId(citizen.getObjectID());
|
||||
actorMail.setStatus(Mail.NEW);
|
||||
actorMail.setTimeStamp((int) (new Date().getTime() / 1000));
|
||||
actorMail.setMessage("@city/city:new_city_citizen_other_body");
|
||||
actorMail.setSubject("@city/city:new_city_citizen_other_subject");
|
||||
actorMail.setSenderName("City " + this.cityName);
|
||||
|
||||
List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", citizen.getPlanet(), citizen.getPosition().x, 0 ,citizen.getPosition().z);
|
||||
WaypointAttachment attachment = new WaypointAttachment();
|
||||
attachment.active = false;
|
||||
attachment.cellID = constructionWaypoint.getCellId();
|
||||
attachment.color = (byte)1;
|
||||
attachment.name = "City";
|
||||
attachment.planetCRC = engine.resources.common.CRC.StringtoCRC(citizen.getPlanet().getName());
|
||||
attachment.positionX = citizen.getPosition().x;
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizen.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
NGECore.getInstance().chatService.sendPersistentMessageHeader(citizen.getClient(), actorMail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,6 +90,19 @@ public class PlayerCityService implements INetworkDispatch {
|
||||
return newCity;
|
||||
}
|
||||
|
||||
public PlayerCity getCityObjectIsIn(SWGObject object) {
|
||||
PlayerCity foundCity = null;
|
||||
synchronized(playerCities){
|
||||
for (PlayerCity city : playerCities){
|
||||
int radius = city.getCityRadius();
|
||||
if (object.getPosition().getDistance2D(city.getCityCenterPosition())<radius){
|
||||
foundCity = city;
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundCity;
|
||||
}
|
||||
|
||||
public PlayerCity getPlayerCity(CreatureObject citizen) {
|
||||
PlayerCity foundCity = null;
|
||||
synchronized(playerCities){
|
||||
@@ -103,6 +116,8 @@ public class PlayerCityService implements INetworkDispatch {
|
||||
return foundCity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void newCitySUI1(CreatureObject citizen, final PlayerCity newCity) {
|
||||
final SUIWindow window = core.suiService.createSUIWindow("Script.messageBox", citizen, citizen, 0);
|
||||
window.setProperty("bg.caption.lblTitle:Text", "@city/city:rank0");
|
||||
|
||||
Reference in New Issue
Block a user