mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-29 14:12:52 -04:00
Merge remote-tracking branch 'origin/master' into LootDrops
This commit is contained in:
@@ -3,11 +3,7 @@ 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,7 +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)
|
||||
|
||||
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):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('radial_filename', 'terminal/city_maintenance_terminal')
|
||||
return
|
||||
@@ -0,0 +1,685 @@
|
||||
from resources.common import RadialOptions
|
||||
from protocol.swg import ResourceListForSurveyMessage
|
||||
from services.sui.SUIService import MessageBoxType
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from java.util import Vector
|
||||
import main.NGECore
|
||||
import sys
|
||||
|
||||
def createRadial(core, owner, target, radials):
|
||||
#(byte parentId, short optionId, byte optionType, String description)
|
||||
radials.clear()
|
||||
radials.add(RadialOptions(0, 7, 0, 'Examine'))
|
||||
radials.add(RadialOptions(0, 216, 0, '@city/city:city_management'))
|
||||
radials.add(RadialOptions(0, 226, 0, '@city/city:city_info'))
|
||||
radials.add(RadialOptions(0, 227, 0, '@city/city:remove_trainers'))
|
||||
radials.add(RadialOptions(2, 217, 0, '@city/city:city_name_new_t'))
|
||||
radials.add(RadialOptions(2, 222, 0, '@city/city:city_register'))
|
||||
radials.add(RadialOptions(2, 224, 0, '@city/city:unzone'))
|
||||
radials.add(RadialOptions(2, 218, 0, '@city/city:city_militia'))
|
||||
radials.add(RadialOptions(2, 219, 0, '@city/city:treasury_taxes'))
|
||||
radials.add(RadialOptions(2, 221, 0, '@city/city:treasury_withdraw'))
|
||||
radials.add(RadialOptions(2, 225, 0, '@city/city:city_specializations'))
|
||||
radials.add(RadialOptions(2, 228, 0, '@city/city:align'))
|
||||
radials.add(RadialOptions(3, 121, 0, '@city/city:non_citizen_city_status'))
|
||||
radials.add(RadialOptions(3, 122, 0, '@city/city:rank_info_t'))
|
||||
radials.add(RadialOptions(3, 123, 0, '@city/city:citizen_list_t'))
|
||||
|
||||
return
|
||||
|
||||
def handleSelection(core, owner, target, option):
|
||||
playerCity = core.playerCityService.getPlayerCity(owner)
|
||||
if playerCity==None:
|
||||
return
|
||||
|
||||
if option == 217:
|
||||
if owner is not None:
|
||||
handleSetCityName(core, owner, target, option)
|
||||
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 == 222:
|
||||
if owner is not None:
|
||||
handleRegisterMap(core, owner, target, option)
|
||||
return
|
||||
if option == 171:
|
||||
if owner is not None:
|
||||
core.housingService.handleListAllItems(owner,target)
|
||||
return
|
||||
if option == 219:
|
||||
if owner is not None:
|
||||
handleAdjustTaxes(core, owner, target, option)
|
||||
return
|
||||
if option == 225:
|
||||
if owner is not None:
|
||||
handleSpecialization(core, owner, target, option)
|
||||
return
|
||||
if option == 221:
|
||||
if owner is not None:
|
||||
handleWithdrawal(core, owner, target, option)
|
||||
return
|
||||
if option == 121:
|
||||
if owner is not None:
|
||||
handleCityRankInfo(core, owner, target, option)
|
||||
return
|
||||
if option == 122:
|
||||
if owner is not None:
|
||||
handleCityRankInfo(core, owner, target, option)
|
||||
return
|
||||
if option == 123:
|
||||
if owner is not None:
|
||||
handleCitizenList(core, owner, target, option)
|
||||
return
|
||||
|
||||
def handleSetCityName(core, owner, target, option):
|
||||
window = core.suiService.createInputBox(2,'@city/city:city_name_new_t','@city/city:city_name_new_d', owner, target, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setnameCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setnameCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setnameCallBack(owner, window, eventType, returnList):
|
||||
if returnList.size()==0:
|
||||
return
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setCityName(returnList.get(0))
|
||||
owner.sendSystemMessage('@city/city:name_changed', 0)
|
||||
return
|
||||
|
||||
|
||||
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')
|
||||
|
||||
window.addListBoxMenuItem('@city/city:set_tax_t_income',0)
|
||||
window.addListBoxMenuItem('@city/city:set_tax_t_property',1)
|
||||
window.addListBoxMenuItem('@city/city:set_tax_t_sales',2)
|
||||
window.addListBoxMenuItem('@city/city:set_tax_t_travel',3)
|
||||
window.addListBoxMenuItem('@city/city:set_tax_t_garage',4)
|
||||
|
||||
window.setProperty('btnOk:visible', 'True')
|
||||
window.setProperty('btnCancel:visible', 'True')
|
||||
window.setProperty('btnOk:Text', '@ok')
|
||||
window.setProperty('btnCancel:Text', '@cancel')
|
||||
|
||||
returnList = Vector()
|
||||
returnList.add('List.lstList:SelectedRow')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setAdjustTaxesCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setAdjustTaxesCallBack(owner, window, eventType, returnList):
|
||||
if returnList.size()==0:
|
||||
owner.sendSystemMessage('NULL', 0)
|
||||
return
|
||||
|
||||
if returnList.get(0)=='0':
|
||||
handleSetIncomeTax(owner)
|
||||
return
|
||||
if returnList.get(0)=='1':
|
||||
handleSetPropertyTax(owner)
|
||||
return
|
||||
if returnList.get(0)=='2':
|
||||
handleSetSalesTax(owner)
|
||||
return
|
||||
if returnList.get(0)=='3':
|
||||
handleSetTravelTax(owner)
|
||||
return
|
||||
if returnList.get(0)=='4':
|
||||
handleSetGarageTax(owner)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def handleSetIncomeTax(owner):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
window = main.NGECore.getInstance().suiService.createInputBox(2,'@city/city:set_tax_t_income','@city/city:set_tax_d_income \n \n @city/city:income_tax_prompt : %s' % playerCity.getIncomeTax(), owner, owner, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSetIncomeTaxCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSetIncomeTaxCallBack(owner, window, eventType, returnList):
|
||||
if int(returnList.get(0))>2000 or int(returnList.get(0))<0:
|
||||
owner.sendSystemMessage('Income tax value is out of range of accepteable values.', 0)
|
||||
handleSetIncomeTax(owner)
|
||||
return
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setIncomeTax(int(returnList.get(0)))
|
||||
owner.sendSystemMessage('@city/city:set_income_tax', 0)
|
||||
return
|
||||
|
||||
def handleSetSalesTax(owner):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
window = main.NGECore.getInstance().suiService.createInputBox(2,'@city/city:set_tax_t_sales','@city/city:set_tax_d_sales \n \n @city/city:sales_tax_prompt : %s' % playerCity.getSalesTax(), owner, owner, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSetSalesTaxCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSetSalesTaxCallBack(owner, window, eventType, returnList):
|
||||
if int(returnList.get(0))>20 or int(returnList.get(0))<0:
|
||||
owner.sendSystemMessage('Sales tax value is out of range of accepteable values.', 0)
|
||||
handleSetSalesTax(owner)
|
||||
return
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setIncomeTax(int(returnList.get(0)))
|
||||
owner.sendSystemMessage('@city/city:set_sales_tax', 0)
|
||||
return
|
||||
|
||||
def handleSetPropertyTax(owner):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
window = main.NGECore.getInstance().suiService.createInputBox(2,'@city/city:set_tax_t_property','@city/city:set_tax_d_property \n \n @city/city:property_tax_prompt : %s' % playerCity.getPropertyTax(), owner, owner, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSetPropertyTaxCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSetPropertyTaxCallBack(owner, window, eventType, returnList):
|
||||
if int(returnList.get(0))>50 or int(returnList.get(0))<0:
|
||||
owner.sendSystemMessage('Property tax value is out of range of accepteable values.', 0)
|
||||
handleSetPropertyTax(owner)
|
||||
return
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setIncomeTax(int(returnList.get(0)))
|
||||
owner.sendSystemMessage('@city/city:set_property_tax', 0)
|
||||
return
|
||||
|
||||
def handleSetTravelTax(owner):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
if playerCity.hasShuttlePort()==0:
|
||||
owner.sendSystemMessage('@city/city:no_shuttleport', 0)
|
||||
return
|
||||
|
||||
window = main.NGECore.getInstance().suiService.createInputBox(2,'@city/city:set_tax_t_travel','@city/city:set_tax_d_travel \n \n @city/city:travel_tax_prompt : %s' % playerCity.getTravelTax(), owner, owner, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSetTravelTaxCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSetTravelTaxCallBack(owner, window, eventType, returnList):
|
||||
if int(returnList.get(0))>500 or int(returnList.get(0))<1:
|
||||
owner.sendSystemMessage('Travel tax value is out of range of accepteable values.', 0)
|
||||
handleSetIncomeTax(owner)
|
||||
return
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setTravelTax(int(returnList.get(0)))
|
||||
owner.sendSystemMessage('@city/city:set_travel_fee', 0)
|
||||
return
|
||||
|
||||
def handleSetGarageTax(owner):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
window = main.NGECore.getInstance().suiService.createInputBox(2,'@city/city:set_tax_t_garage','@city/city:set_tax_d_garage \n\n @city/city:garage_tax : %s' % playerCity.getGarageTax(), owner, owner, 0)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSetGarageTaxCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSetGarageTaxCallBack(owner, window, eventType, returnList):
|
||||
if int(returnList.get(0))>500 or int(returnList.get(0))<1:
|
||||
owner.sendSystemMessage('Garage tax value is out of range of accepteable values.', 0)
|
||||
handleSetIncomeTax(owner)
|
||||
return
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setGarageTax(int(returnList.get(0)))
|
||||
owner.sendSystemMessage('@city/city:set_garage_tax', 0)
|
||||
return
|
||||
|
||||
def handleWithdrawal(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
window = core.suiService.createSUIWindow("Script.transfer", owner, target, 10)
|
||||
|
||||
window.setProperty("bg.caption.lblTitle:Text", "@city/city:treasury_withdraw_subject")
|
||||
window.setProperty("Prompt.lblPrompt:Text", "@city/city:treasury_withdraw_prompt" + "\n \n @city/city:treasury_status : %s" % playerCity.getCityTreasury())
|
||||
|
||||
window.setProperty("msgPayMaintenance", "transaction.txtInputFrom");
|
||||
|
||||
window.setProperty("transaction.lblFrom:Text", "@city/city:treasury_balance_t");
|
||||
window.setProperty("transaction.lblTo:Text", "@city/city:treasury_withdraw");
|
||||
window.setProperty("transaction.lblFrom", "@city/city:treasury_balance_t");
|
||||
window.setProperty("transaction.lblTo", "@city/city:treasury_withdraw");
|
||||
|
||||
window.setProperty("transaction.lblStartingFrom:Text", '%s' % playerCity.getCityTreasury());
|
||||
window.setProperty("transaction.lblStartingTo:Text", '0');
|
||||
|
||||
window.setProperty("transaction:InputFrom", "555555");
|
||||
window.setProperty("transaction:InputTo", "666666");
|
||||
|
||||
window.setProperty("transaction:txtInputFrom", '%s' % playerCity.getCityTreasury());
|
||||
window.setProperty("transaction:txtInputTo", "1");
|
||||
window.setProperty("transaction.txtInputFrom:Text", '%s' % playerCity.getCityTreasury());
|
||||
window.setProperty("transaction.txtInputTo:Text", "" + "0");
|
||||
|
||||
window.setProperty("transaction.ConversionRatioFrom", "1");
|
||||
window.setProperty("transaction.ConversionRatioTo", "0");
|
||||
|
||||
window.setProperty("btnOk:visible", "True");
|
||||
window.setProperty("btnCancel:visible", "True");
|
||||
window.setProperty("btnOk:Text", "@ok");
|
||||
window.setProperty("btnCancel:Text", "@cancel");
|
||||
|
||||
returnList = Vector()
|
||||
returnList.add('transaction.txtInputFrom:Text')
|
||||
returnList.add('ransaction.txtInputTo:Text')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setWithdrawalCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setWithdrawalCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setWithdrawalCallBack(owner, window, eventType, returnList):
|
||||
if returnList.size()==0:
|
||||
return
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setCityName(returnList.get(0))
|
||||
owner.sendSystemMessage('@city/city:name_changed', 0)
|
||||
return
|
||||
|
||||
def handleCitizenList(core, owner, target, option):
|
||||
window = core.suiService.createSUIWindow('Script.listBox', owner, target, 0);
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:citizen_list_t')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:citizen_list_prompt')
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
index = 1;
|
||||
for citizen in playerCity.getCitizens():
|
||||
citizenObject = core.objectService.getObject(citizen)
|
||||
window.addListBoxMenuItem(citizenObject.getCustomName(),index)
|
||||
index += 1
|
||||
|
||||
window.setProperty('btnOk:visible', 'True')
|
||||
window.setProperty('btnCancel:visible', 'True')
|
||||
window.setProperty('btnOk:Text', '@ok')
|
||||
window.setProperty('btnCancel:Text', '@cancel')
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setCitizenListCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setCitizenListCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setCitizenListCallBack(owner, window, eventType, returnList):
|
||||
#handle waypoint creation to citizen's house
|
||||
return
|
||||
|
||||
def handleCityRankInfo(core, owner, target, option):
|
||||
window = core.suiService.createSUIWindow('Script.listBox', owner, target, 0);
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:rank_info_t')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:rank_info_d')
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
|
||||
window.addListBoxMenuItem('City : ' + playerCity.getCityName(),0)
|
||||
window.addListBoxMenuItem('@city/city:radius_prompt : %s' % playerCity.getCityRadius(),1)
|
||||
window.addListBoxMenuItem('@city/city:city_rank_prompt : @city/city:rank' + str(playerCity.getRank()),2)
|
||||
window.addListBoxMenuItem('@city/city:reg_citizen_prompt : %s' % len(playerCity.getCitizens()),3)
|
||||
if playerCity.getRank()>=3 and playerCity.getSpecialization()>-1:
|
||||
window.addListBoxMenuItem('@city/city:specialization_prompt : @city/city:' + playerCity.getSpecializationSTFNamesAsList().get(playerCity.getSpecialization()),4)
|
||||
|
||||
|
||||
window.setProperty('btnOk:visible', 'True')
|
||||
window.setProperty('btnCancel:visible', 'True')
|
||||
window.setProperty('btnOk:Text', '@ok')
|
||||
window.setProperty('btnCancel:Text', '@cancel')
|
||||
window.setProperty('btnCancel:Text', '@cancel')
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setCityInfoCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setCitizenListCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setCityInfoCallBack(owner, window, eventType, returnList):
|
||||
#handle waypoint creation to citizen's house
|
||||
return
|
||||
|
||||
def handleRegisterMap(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
if playerCity.getRank()<3:
|
||||
owner.sendSystemMessage('@city/city:cant_register_rank', 0)
|
||||
return
|
||||
|
||||
if owner.getObjectId()!=playerCity.getMayorID():
|
||||
owner.sendSystemMessage('@city/city:cant_register', 0)
|
||||
return
|
||||
|
||||
# now register it somehow
|
||||
|
||||
return
|
||||
|
||||
def setRegisterMapCallBack(owner, window, eventType, returnList):
|
||||
if returnList.size()==0:
|
||||
return
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
playerCity.setCityName(returnList.get(0))
|
||||
owner.sendSystemMessage('@city/city:name_changed', 0)
|
||||
return
|
||||
|
||||
def handleSpecialization(core, owner, target, option):
|
||||
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
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')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_specs_d')
|
||||
|
||||
window.addListBoxMenuItem('@city/city:city_spec_cloning',0)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_bm_incubator',1)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_storyteller',2)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_entertainer',3)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_missions',4)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_industry',5)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_doctor',6)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_research',7)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_sample_rich',8)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_master_manufacturing',9)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_master_healing',10)
|
||||
window.addListBoxMenuItem('@city/city:city_spec_stronghold',11)
|
||||
|
||||
window.setProperty('btnOk:visible', 'True')
|
||||
window.setProperty('btnCancel:visible', 'True')
|
||||
window.setProperty('btnOk:Text', '@ok')
|
||||
window.setProperty('btnCancel:Text', '@cancel')
|
||||
|
||||
returnList = Vector()
|
||||
returnList.add('List.lstList:SelectedRow')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setSpecializationCallBack)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
core.suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def setSpecializationCancelCallBack(owner, window, eventType, returnList):
|
||||
return
|
||||
|
||||
def setSpecializationCallBack(owner, window, eventType, returnList):
|
||||
|
||||
if returnList.size()==0:
|
||||
owner.sendSystemMessage('NULL', 0)
|
||||
return
|
||||
|
||||
if returnList.get(0)=='0':
|
||||
showCloning(owner)
|
||||
return
|
||||
if returnList.get(0)=='1':
|
||||
showDNA(owner)
|
||||
return
|
||||
if returnList.get(0)=='2':
|
||||
showEncore(owner)
|
||||
return
|
||||
if returnList.get(0)=='3':
|
||||
showEntertainment(owner)
|
||||
return
|
||||
if returnList.get(0)=='4':
|
||||
showImproved(owner)
|
||||
return
|
||||
if returnList.get(0)=='5':
|
||||
showManufacturing(owner)
|
||||
return
|
||||
if returnList.get(0)=='6':
|
||||
showMedical(owner)
|
||||
return
|
||||
if returnList.get(0)=='7':
|
||||
showResearch(owner)
|
||||
return
|
||||
if returnList.get(0)=='8':
|
||||
showSample(owner)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def showCloning(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_cloning')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_cloning_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleCloningCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleCloningCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',1)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showDNA(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_bm_incubator')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_bm_incubator_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleDNACallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleDNACallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',2)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showEncore(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_storyteller')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_storyteller_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleEncoreCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleEncoreCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',3)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
|
||||
def showEntertainment(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_entertainer')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_entertainer_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleEntertainmentCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleEntertainmentCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',4)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showImproved(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_missions')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_missions_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleImprovedCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleImprovedCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',5)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showManufacturing(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_industry')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_industry_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleManufacturingCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleManufacturingCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',6)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showMedical(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_doctor')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_doctor_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleMedicalCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleMedicalCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',7)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showResearch(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_research')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_research_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleResearchCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleResearchCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',8)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showSample(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:city_spec_sample_rich')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:city_spec_sample_rich_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Select")
|
||||
window.setProperty("btnCancel:Text", "@cancel")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSampleCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSampleCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
owner.setAttachment('ChosenCitySpec',9)
|
||||
showSpecConfirmWindow(owner)
|
||||
return
|
||||
|
||||
def showSpecConfirmWindow(owner):
|
||||
window = main.NGECore.getInstance().suiService.createSUIWindow('Script.messageBox', owner, owner, 0)
|
||||
window.setProperty('bg.caption.lblTitle:Text', '@city/city:confirm_spec_t')
|
||||
window.setProperty('Prompt.lblPrompt:Text', '@city/city:confirm_spec_d')
|
||||
window.setProperty("btnOk:visible", "True")
|
||||
window.setProperty("btnCancel:visible", "True")
|
||||
window.setProperty("btnOk:Text", "Yes")
|
||||
window.setProperty("btnCancel:Text", "No")
|
||||
returnList = Vector()
|
||||
returnList.add('txtInput:LocalText')
|
||||
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSpecConfirmCallback)
|
||||
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleSpecConfirmCallback)
|
||||
main.NGECore.getInstance().suiService.openSUIWindow(window);
|
||||
return
|
||||
|
||||
def handleSpecConfirmCallback(owner, window, eventType, returnList):
|
||||
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
|
||||
chosenSpec = owner.getAttachment('ChosenCitySpec')
|
||||
playerCity.setSpecialisation(chosenSpec)
|
||||
return
|
||||
@@ -86,6 +86,7 @@ import services.map.MapService;
|
||||
import services.object.ObjectService;
|
||||
import services.object.UpdateService;
|
||||
import services.pet.MountService;
|
||||
import services.playercities.PlayerCityService;
|
||||
import services.resources.HarvesterService;
|
||||
import services.resources.ResourceService;
|
||||
import services.retro.RetroService;
|
||||
@@ -183,6 +184,7 @@ public class NGECore {
|
||||
public LootService lootService;
|
||||
public HarvesterService harvesterService;
|
||||
public MountService mountService;
|
||||
public PlayerCityService playerCityService;
|
||||
|
||||
|
||||
// Login Server
|
||||
@@ -305,6 +307,7 @@ public class NGECore {
|
||||
lootService = new LootService(this);
|
||||
harvesterService = new HarvesterService(this);
|
||||
mountService = new MountService(this);
|
||||
playerCityService = new PlayerCityService(this);
|
||||
|
||||
if (config.keyExists("JYTHONCONSOLE.PORT")) {
|
||||
int jythonPort = config.getInt("JYTHONCONSOLE.PORT");
|
||||
@@ -360,6 +363,7 @@ public class NGECore {
|
||||
zoneDispatch.addService(bazaarService);
|
||||
zoneDispatch.addService(lootService);
|
||||
zoneDispatch.addService(mountService);
|
||||
zoneDispatch.addService(playerCityService);
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) {
|
||||
zoneDispatch.addService(surveyService);
|
||||
|
||||
@@ -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,14 +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);
|
||||
|
||||
break;
|
||||
=======
|
||||
inventory.add(deed);
|
||||
return;
|
||||
>>>>>>> upstream/master
|
||||
|
||||
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 125:
|
||||
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
|
||||
genericCraftingTool.setCustomName("Generic Crafting Tool");
|
||||
|
||||
@@ -42,6 +42,7 @@ import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.deed.Player_House_Deed;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.playercities.PlayerCity;
|
||||
import services.sui.SUIWindow;
|
||||
import services.sui.SUIWindow.SUICallback;
|
||||
import services.sui.SUIWindow.Trigger;
|
||||
@@ -118,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);
|
||||
@@ -133,6 +136,27 @@ public class HousingService implements INetworkDispatch {
|
||||
building.setBMR(playerHourseDeed.getBMR());
|
||||
building.setConditionDamage(100);
|
||||
|
||||
if (structureTemplate.contains("cityhall")){
|
||||
PlayerCity newCity = core.playerCityService.addNewPlayerCity(actor);
|
||||
building.setAttachment("structureCity", newCity.getCityID());
|
||||
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());
|
||||
//core.getBuildingODB().put(building, Long.class, BuildingObject.class, building.getTransaction());
|
||||
@@ -428,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,699 @@
|
||||
/*******************************************************************************
|
||||
* 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 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;
|
||||
|
||||
/**
|
||||
* @author Charon
|
||||
*/
|
||||
|
||||
public class PlayerCity {
|
||||
|
||||
public static final int DESERTED = 0;
|
||||
public static final int OUTPOST = 1;
|
||||
public static final int VILLAGE = 2;
|
||||
public static final int TOWNSHIP = 3;
|
||||
public static final int CITY = 4;
|
||||
public static final int METROPOLIS = 5;
|
||||
|
||||
public static final int CLONE_LAB = 1;
|
||||
public static final int DNA_LABORATORY = 2;
|
||||
public static final int ENCORE_PERFORMANCE = 3;
|
||||
public static final int ENTERTAINMENT_DISTRICT = 4;
|
||||
public static final int IMPROVED_JOB_MARKET = 5;
|
||||
public static final int MANUFACTURING_CENTER = 6;
|
||||
public static final int MEDICAL_CENTER = 7;
|
||||
public static final int RESEARCH_CENTER = 8;
|
||||
public static final int SAMPLE_RICH = 9;
|
||||
public static final int INDUSTRIAL_SOCIETY = 10;
|
||||
public static final int SCIENTIFIC_SOCIETY = 11;
|
||||
public static final int STRONGHOLD = 12;
|
||||
|
||||
public static final String[] specialisationSTFNames = new String[]{"city_spec_cloning",
|
||||
"city_spec_bm_incubator",
|
||||
"city_spec_storyteller",
|
||||
"city_spec_entertainer",
|
||||
"city_spec_missions",
|
||||
"city_spec_industry",
|
||||
"city_spec_doctor",
|
||||
"city_spec_research",
|
||||
"city_spec_sample_rich",
|
||||
"city_spec_master_manufacturing",
|
||||
"city_spec_master_healing",
|
||||
"city_spec_stronghold"};
|
||||
|
||||
public static final int BANK = 1;
|
||||
public static final int CLONING_FACILITY = 2;
|
||||
public static final int GARAGE = 3;
|
||||
public static final int MEDIUM_GARDEN = 4;
|
||||
public static final int LARGE_GARDEN = 5;
|
||||
public static final int SHUTTLEPORT = 6;
|
||||
|
||||
|
||||
private String cityName = "";
|
||||
private int cityID = -1;
|
||||
private Point3D cityCenterPosition = new Point3D(0,0,0);
|
||||
private int cityRadius = 0;
|
||||
private int cityRank = 0;
|
||||
private int specialization = -1;
|
||||
private long mayorID = 0L;
|
||||
private int cityTreasury = 0;
|
||||
private int maintenanceFee = 0;
|
||||
private int GCW_Alignment = 0;
|
||||
private long nextElectionDate = 0L;
|
||||
private long nextCityUpdate = 0L;
|
||||
private long foundationTime = 0L;
|
||||
private int incomeTax = 0;
|
||||
private int propertyTax = 0;
|
||||
private int salesTax = 0;
|
||||
private int travelTax = 0;
|
||||
private int garageTax = 0;
|
||||
private boolean founded = false;
|
||||
private boolean shuttlePort = false;
|
||||
private boolean registered = false;
|
||||
private boolean zoningEnabled = false;
|
||||
|
||||
private final long cityUpdateSpan = 7*86400*1000;
|
||||
private final long legislationPeriod = 21*86400*1000;
|
||||
|
||||
private Vector<Long> placedStructures = new Vector<Long>();
|
||||
private Vector<Long> citizens = new Vector<Long>();
|
||||
private Vector<Long> electionCandidates = new Vector<Long>();
|
||||
private Vector<Byte> electionVotes = new Vector<Byte>();
|
||||
private Vector<Long> cityBanList = new Vector<Long>();
|
||||
private Vector<Long> militiaList = new Vector<Long>();
|
||||
private Vector<Long> foundersList = new Vector<Long>();
|
||||
|
||||
public PlayerCity(){}
|
||||
|
||||
public PlayerCity(CreatureObject founder, int cityID){
|
||||
|
||||
setCityCenterPosition(founder.getPosition());
|
||||
setCityRadius(150);
|
||||
setFoundationTime(System.currentTimeMillis());
|
||||
setMaintenanceFee(1);
|
||||
setNextCityUpdate(foundationTime+cityUpdateSpan);
|
||||
setNextElectionDate(foundationTime+legislationPeriod);
|
||||
citizens.add(founder.getObjectID());
|
||||
this.cityID = cityID;
|
||||
}
|
||||
|
||||
public void handleGrantZoning() {
|
||||
|
||||
}
|
||||
|
||||
public void handleBuildRequest() {
|
||||
|
||||
}
|
||||
|
||||
public void checkPlacementPermission() {
|
||||
|
||||
}
|
||||
|
||||
public void processElection() {
|
||||
// ToDo: handle everything
|
||||
long winnerID = mayorID;
|
||||
mayorID = winnerID;
|
||||
electionVotes.clear();
|
||||
electionCandidates.clear();
|
||||
electionCandidates.add(mayorID);
|
||||
setNextElectionDate(System.currentTimeMillis()+legislationPeriod);
|
||||
}
|
||||
|
||||
public void processCityUpdate() {
|
||||
// has something changed?
|
||||
System.out.println("processCityUpdate");
|
||||
int censusResult = citizens.size();
|
||||
// ToDo: Consider 1 rank per update changes
|
||||
if (censusResult<5){
|
||||
setRank(DESERTED); // City is technically not a city anymore
|
||||
setCityRadius(0);
|
||||
}
|
||||
|
||||
if (censusResult>=5 && censusResult<10){
|
||||
setRank(OUTPOST);
|
||||
setCityRadius(150);
|
||||
}
|
||||
|
||||
if (censusResult>=10 && censusResult<15){
|
||||
setRank(VILLAGE);
|
||||
setCityRadius(200);
|
||||
}
|
||||
|
||||
if (censusResult>=15 && censusResult<30){
|
||||
setRank(TOWNSHIP);
|
||||
setCityRadius(300);
|
||||
}
|
||||
|
||||
if (censusResult>=30 && censusResult<40){
|
||||
setRank(CITY);
|
||||
setCityRadius(400);
|
||||
}
|
||||
|
||||
if (censusResult>=40){
|
||||
setRank(METROPOLIS);
|
||||
setCityRadius(450);
|
||||
}
|
||||
|
||||
// collect taxes
|
||||
for (long citizen : citizens){
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen);
|
||||
|
||||
// ToDo: Handle tax evaders etc.
|
||||
int incomeTax = getIncomeTax();
|
||||
citizenObject.setBankCredits(citizenObject.getBankCredits()-incomeTax);
|
||||
cityTreasury += incomeTax;
|
||||
|
||||
int propertyTaxRate = getPropertyTax()/100;
|
||||
Vector<BuildingObject> allStructuresOfCitizen = new Vector<BuildingObject>(); // Collect the structures
|
||||
int cumulatedPropertyTax = 0;
|
||||
for (BuildingObject structure : allStructuresOfCitizen){
|
||||
cumulatedPropertyTax += propertyTaxRate*structure.getBMR();
|
||||
}
|
||||
|
||||
citizenObject.setBankCredits(citizenObject.getBankCredits()-cumulatedPropertyTax);
|
||||
cityTreasury += cumulatedPropertyTax;
|
||||
}
|
||||
|
||||
demolishHighRankStructures();
|
||||
setNextCityUpdate(System.currentTimeMillis()+cityUpdateSpan);
|
||||
}
|
||||
|
||||
public void demolishHighRankStructures() {
|
||||
// Check if there are any structures in the city
|
||||
// that require a higher rank than the current one
|
||||
synchronized(placedStructures){
|
||||
Vector<SWGObject> wreckingBall = new Vector<SWGObject>();
|
||||
for (long structureID : placedStructures){
|
||||
SWGObject structure = NGECore.getInstance().objectService.getObject(structureID);
|
||||
int structureCode = (int) structure.getAttachment("CityStructureCode");
|
||||
|
||||
if (structureCode==BANK && cityRank<2){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
|
||||
if (structureCode==CLONING_FACILITY && cityRank<3){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
|
||||
if (structureCode==GARAGE && cityRank<2){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
|
||||
if (structureCode==MEDIUM_GARDEN && cityRank<2){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
|
||||
if (structureCode==LARGE_GARDEN && cityRank<3){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
|
||||
if (structureCode==SHUTTLEPORT && cityRank<4){
|
||||
wreckingBall.add(structure);
|
||||
}
|
||||
}
|
||||
|
||||
for (SWGObject wreck : wreckingBall){
|
||||
placedStructures.remove(wreck.getObjectID());
|
||||
NGECore.getInstance().objectService.destroyObject(wreck.getObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkFoundationSuccess() {
|
||||
|
||||
Vector<Long> founders = getFoundersList();
|
||||
Vector<Long> citizenList = getCitizens();
|
||||
int founderCitizenCount = 0;
|
||||
for (long founderId : founders){
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(founderId);
|
||||
if (citizenList.contains(founderId) && (long)citizenObject.getAttachment("residentCity")==this.getCityID())
|
||||
founderCitizenCount++;
|
||||
}
|
||||
if (founderCitizenCount==founders.size())
|
||||
return true; // All founders are citizens now
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void calculateMaintenance() {
|
||||
|
||||
}
|
||||
|
||||
public void handleBanRequest() {
|
||||
|
||||
}
|
||||
|
||||
public void handlePardonRequest() {
|
||||
|
||||
}
|
||||
|
||||
public int getRank() {
|
||||
return cityRank;
|
||||
}
|
||||
|
||||
public void setRank(int cityRank) {
|
||||
this.cityRank = cityRank;
|
||||
}
|
||||
|
||||
public int getSpecialization() {
|
||||
return specialization;
|
||||
}
|
||||
|
||||
public void setSpecialization(int specialization) {
|
||||
this.specialization = specialization;
|
||||
sendSpecUpdateMail(specialization);
|
||||
}
|
||||
|
||||
public long getMayorID() {
|
||||
return mayorID;
|
||||
}
|
||||
|
||||
public void setMayorID(long mayorID) {
|
||||
this.mayorID = mayorID;
|
||||
}
|
||||
|
||||
public int getCityTreasury() {
|
||||
return cityTreasury;
|
||||
}
|
||||
|
||||
public void setCityTreasury(int cityTreasury) {
|
||||
this.cityTreasury = cityTreasury;
|
||||
}
|
||||
|
||||
public int getMaintenanceFee() {
|
||||
return maintenanceFee;
|
||||
}
|
||||
|
||||
public void setMaintenanceFee(int maintenanceFee) {
|
||||
this.maintenanceFee = maintenanceFee;
|
||||
}
|
||||
|
||||
public int getGCW_Alignment() {
|
||||
return GCW_Alignment;
|
||||
}
|
||||
|
||||
public void setGCW_Alignment(int gCW_Alignment) {
|
||||
GCW_Alignment = gCW_Alignment;
|
||||
}
|
||||
|
||||
public Vector<Long> getPlacedStructures() {
|
||||
synchronized(placedStructures){
|
||||
return placedStructures;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlacedStructures(Vector<Long> placedStructures) {
|
||||
synchronized(placedStructures){
|
||||
this.placedStructures = placedStructures;
|
||||
}
|
||||
}
|
||||
|
||||
public void addNewStructure(long newStructure) {
|
||||
synchronized(placedStructures){
|
||||
this.placedStructures.add(newStructure);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<Long> getCitizens() {
|
||||
synchronized(citizens){
|
||||
return citizens;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCitizens(Vector<Long> citizens) {
|
||||
synchronized(citizens){
|
||||
this.citizens = citizens;
|
||||
}
|
||||
}
|
||||
|
||||
public void addCitizen(long citizen) {
|
||||
synchronized(citizens){
|
||||
this.citizens.add(citizen);
|
||||
}
|
||||
CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen);
|
||||
sendNewCitizenMailAll(citizenObject);
|
||||
sendNewCitizenMail(citizenObject);
|
||||
}
|
||||
|
||||
public void removeCitizen(long citizen) {
|
||||
synchronized(citizens){
|
||||
this.citizens.remove(citizen);
|
||||
}
|
||||
}
|
||||
|
||||
public long getNextElectionDate() {
|
||||
return nextElectionDate;
|
||||
}
|
||||
|
||||
public void setNextElectionDate(long nextElectionDate) {
|
||||
this.nextElectionDate = nextElectionDate;
|
||||
}
|
||||
|
||||
public Vector<Long> getElectionCandidates() {
|
||||
return electionCandidates;
|
||||
}
|
||||
|
||||
public void setElectionCandidates(Vector<Long> electionCandidates) {
|
||||
this.electionCandidates = electionCandidates;
|
||||
}
|
||||
|
||||
public long getNextCityUpdate() {
|
||||
return nextCityUpdate;
|
||||
}
|
||||
|
||||
public void setNextCityUpdate(long nextCityUpdate) {
|
||||
this.nextCityUpdate = nextCityUpdate;
|
||||
}
|
||||
|
||||
public Vector<Long> getCityBanList() {
|
||||
return cityBanList;
|
||||
}
|
||||
|
||||
public void setCityBanList(Vector<Long> cityBanList) {
|
||||
this.cityBanList = cityBanList;
|
||||
}
|
||||
|
||||
public Vector<Byte> getElectionVotes() {
|
||||
return electionVotes;
|
||||
}
|
||||
|
||||
public void addToElectionVotes(byte vote) {
|
||||
electionVotes.add(vote);
|
||||
}
|
||||
|
||||
// Stalinesque method :D
|
||||
public void setElectionVotes(Vector<Byte> electionVotes) {
|
||||
this.electionVotes = electionVotes;
|
||||
}
|
||||
|
||||
public Point3D getCityCenterPosition() {
|
||||
return cityCenterPosition;
|
||||
}
|
||||
|
||||
public void setCityCenterPosition(Point3D cityCenterPosition) {
|
||||
this.cityCenterPosition = cityCenterPosition;
|
||||
}
|
||||
|
||||
public int getCityRadius() {
|
||||
return cityRadius;
|
||||
}
|
||||
|
||||
public void setCityRadius(int cityRadius) {
|
||||
this.cityRadius = cityRadius;
|
||||
}
|
||||
|
||||
public Vector<Long> getMilitiaList() {
|
||||
return militiaList;
|
||||
}
|
||||
|
||||
public void setMilitiaList(Vector<Long> militiaList) {
|
||||
this.militiaList = militiaList;
|
||||
}
|
||||
|
||||
public Vector<Long> getFoundersList() {
|
||||
return foundersList;
|
||||
}
|
||||
|
||||
public void setFoundersList(Vector<Long> foundersList) {
|
||||
this.foundersList = foundersList;
|
||||
}
|
||||
|
||||
public long getFoundationTime() {
|
||||
return foundationTime;
|
||||
}
|
||||
|
||||
public void setFoundationTime(long foundationTime) {
|
||||
this.foundationTime = foundationTime;
|
||||
}
|
||||
|
||||
public boolean isFounded() {
|
||||
return founded;
|
||||
}
|
||||
|
||||
public void setFounded(boolean founded) {
|
||||
this.founded = founded;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
sendNameChangeMail(cityName);
|
||||
}
|
||||
|
||||
public int getCityID() {
|
||||
return cityID;
|
||||
}
|
||||
|
||||
public void setCityID(int cityID) {
|
||||
this.cityID = cityID;
|
||||
}
|
||||
|
||||
public int getIncomeTax() {
|
||||
return incomeTax;
|
||||
}
|
||||
|
||||
public void setIncomeTax(int incomeTax) {
|
||||
this.incomeTax = incomeTax;
|
||||
}
|
||||
|
||||
public int getPropertyTax() {
|
||||
return propertyTax;
|
||||
}
|
||||
|
||||
public void setPropertyTax(int propertyTax) {
|
||||
this.propertyTax = propertyTax;
|
||||
}
|
||||
|
||||
public int getSalesTax() {
|
||||
return salesTax;
|
||||
}
|
||||
|
||||
public void setSalesTax(int salesTax) {
|
||||
this.salesTax = salesTax;
|
||||
}
|
||||
|
||||
public int getTravelTax() {
|
||||
return travelTax;
|
||||
}
|
||||
|
||||
public void setTravelTax(int travelTax) {
|
||||
this.travelTax = travelTax;
|
||||
}
|
||||
|
||||
public int getGarageTax() {
|
||||
return garageTax;
|
||||
}
|
||||
|
||||
public void setGarageTax(int garageTax) {
|
||||
this.garageTax = garageTax;
|
||||
}
|
||||
|
||||
public boolean hasShuttlePort() {
|
||||
return shuttlePort;
|
||||
}
|
||||
|
||||
public void setShuttlePort(boolean shuttlePort) {
|
||||
this.shuttlePort = shuttlePort;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public void setRegistered(boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
||||
public boolean isZoningEnabled() {
|
||||
return zoningEnabled;
|
||||
}
|
||||
|
||||
public void setZoningEnabled(boolean zoningEnabled) {
|
||||
this.zoningEnabled = zoningEnabled;
|
||||
}
|
||||
|
||||
public static String[] getSpecialisationSTFNames() {
|
||||
return specialisationSTFNames;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void sendCitizenLeftMailAll(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:lost_citizen_body");
|
||||
actorMail.setSubject("@city/city:lost_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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*******************************************************************************
|
||||
* 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 services.playercities;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.RGB;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import services.sui.SUIWindow;
|
||||
import services.sui.SUIWindow.SUICallback;
|
||||
import services.sui.SUIWindow.Trigger;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
import main.NGECore;
|
||||
|
||||
public class PlayerCityService implements INetworkDispatch {
|
||||
|
||||
private NGECore core;
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
private Vector<PlayerCity> playerCities = new Vector<PlayerCity>();
|
||||
private int cityID = 0; // This must be persisted or handled via objectservice somehow
|
||||
|
||||
public PlayerCityService(NGECore core) {
|
||||
this.core = core;
|
||||
|
||||
scheduler.scheduleAtFixedRate(() -> {
|
||||
administratePlayerCities();
|
||||
}, 0, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
public void administratePlayerCities() {
|
||||
synchronized(playerCities){
|
||||
Vector<PlayerCity> unfoundedCities = new Vector<PlayerCity>();
|
||||
for (PlayerCity city : playerCities){
|
||||
|
||||
if (city.getNextCityUpdate()<=System.currentTimeMillis())
|
||||
city.processCityUpdate();
|
||||
|
||||
if (city.getNextElectionDate()<=System.currentTimeMillis())
|
||||
city.processElection();
|
||||
|
||||
if (! city.isFounded() && city.getFoundationTime()<=System.currentTimeMillis()-(60*60*24*1000)){
|
||||
if (! city.checkFoundationSuccess())
|
||||
unfoundedCities.add(city);
|
||||
}
|
||||
}
|
||||
|
||||
if (unfoundedCities.size()>0){
|
||||
playerCities.removeAll(unfoundedCities);
|
||||
}
|
||||
playerCities.removeAll(Collections.singleton(null));
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerCity addNewPlayerCity(CreatureObject founder) {
|
||||
PlayerCity newCity = null;
|
||||
synchronized(playerCities){
|
||||
newCity = new PlayerCity(founder,cityID++);
|
||||
playerCities.add(newCity);
|
||||
}
|
||||
newCitySUI1(founder,newCity);
|
||||
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){
|
||||
for (PlayerCity city : playerCities){
|
||||
int id = (int)citizen.getAttachment("residentCity");
|
||||
if (city.getCityID()==id){
|
||||
foundCity = city;
|
||||
}
|
||||
}
|
||||
}
|
||||
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");
|
||||
window.setProperty("Prompt.lblPrompt:Text", "@city/city:new_city_body");
|
||||
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>();
|
||||
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
}
|
||||
});
|
||||
core.suiService.openSUIWindow(window);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0,
|
||||
Map<Integer, INetworkRemoteEvent> arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user