diff --git a/scripts/radial/terminal/city_maintenance_terminal.py b/scripts/radial/terminal/city_maintenance_terminal.py index e5dce527..b1c82336 100644 --- a/scripts/radial/terminal/city_maintenance_terminal.py +++ b/scripts/radial/terminal/city_maintenance_terminal.py @@ -20,9 +20,10 @@ def createRadial(core, owner, target, radials): 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(3, 121, 0, '@city/city:citizens')) - radials.add(RadialOptions(3, 123, 0, '@city/city:citizens')) + 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 @@ -55,9 +56,9 @@ def handleSelection(core, owner, target, option): if owner is not None: core.housingService.handleListAllItems(owner,target) return - if option == 175: + if option == 219: if owner is not None: - core.housingService.handleDeleteAllItems(owner,target) + handleAdjustTaxes(core, owner, target, option) return if option == 225: if owner is not None: @@ -69,7 +70,11 @@ def handleSelection(core, owner, target, option): return if option == 121: if owner is not None: - handleCitizenList(core, owner, target, option) + handleCityInfo(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: @@ -77,7 +82,7 @@ def handleSelection(core, owner, target, option): return def handleSetCityName(core, owner, target, option): - window = core.suiService.createInputBox(2,'@player_structure:structure_status','@player_structure:structure_name_prompt', owner, target, 0) + 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) @@ -93,21 +98,166 @@ def setnameCallBack(owner, window, eventType, returnList): owner.sendSystemMessage('@city/city:name_changed', 0) return -def handleTaxes(core, owner, target, option): - window = core.suiService.createInputBox(2,'@player_structure:structure_status','@player_structure:structure_name_prompt', owner, target, 0) + +def handleAdjustTaxes(core, owner, target, option): + + 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('txtInput:LocalText') - window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setnameCallBack) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setnameCallBack) + 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 setTaxesCallBack(owner, window, eventType, returnList): +def setAdjustTaxesCallBack(owner, window, eventType, returnList): if returnList.size()==0: + owner.sendSystemMessage('NULL', 0) return - playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner) - playerCity.setCityName(returnList.get(0)) - owner.sendSystemMessage('@city/city:name_changed', 0) + + 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): @@ -188,6 +338,38 @@ 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) @@ -212,19 +394,28 @@ def setRegisterMapCallBack(owner, window, eventType, returnList): return 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 + 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('Cloning Lab',0) - window.addListBoxMenuItem('DNA Laboratory',1) - window.addListBoxMenuItem('Encore Performance',2) - window.addListBoxMenuItem('Entertainment District',3) - window.addListBoxMenuItem('Improved Job Market',4) - window.addListBoxMenuItem('Manufacturing Center',5) - window.addListBoxMenuItem('Medical Center',6) - window.addListBoxMenuItem('Research Center',7) - window.addListBoxMenuItem('Sample Rich',8) + 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') @@ -234,9 +425,12 @@ def handleSpecialization(core, owner, target, option): returnList = Vector() returnList.add('List.lstList:SelectedRow') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setSpecializationCallBack) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, 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): @@ -285,7 +479,7 @@ def showCloning(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleCloningCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleCloningCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -306,7 +500,7 @@ def showDNA(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleDNACallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleDNACallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -327,7 +521,7 @@ def showEncore(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleEncoreCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleEncoreCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -349,7 +543,7 @@ def showEntertainment(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleEntertainmentCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleEntertainmentCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -370,7 +564,7 @@ def showImproved(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleImprovedCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleImprovedCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -391,7 +585,7 @@ def showManufacturing(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleManufacturingCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleManufacturingCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -412,7 +606,7 @@ def showMedical(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleMedicalCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleMedicalCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -433,7 +627,7 @@ def showResearch(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleResearchCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleResearchCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -454,7 +648,7 @@ def showSample(owner): returnList = Vector() returnList.add('txtInput:LocalText') window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, handleSampleCallback) - window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, handleSampleCallback) + window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setSpecializationCancelCallBack) main.NGECore.getInstance().suiService.openSUIWindow(window); return @@ -463,7 +657,7 @@ def handleSampleCallback(owner, window, eventType, returnList): 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') diff --git a/src/services/playercities/PlayerCity.java b/src/services/playercities/PlayerCity.java index 4a5f7941..893e727f 100644 --- a/src/services/playercities/PlayerCity.java +++ b/src/services/playercities/PlayerCity.java @@ -21,8 +21,11 @@ ******************************************************************************/ package services.playercities; +import java.util.Arrays; +import java.util.List; import java.util.Vector; +import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import main.NGECore; import engine.resources.objects.SWGObject; @@ -34,29 +37,45 @@ import engine.resources.scene.Point3D; public class PlayerCity { - public static int DESERTED = 0; - public static int OUTPOST = 1; - public static int VILLAGE = 2; - public static int TOWNSHIP = 3; - public static int CITY = 4; - public static int METROPOLIS = 5; + 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 int CLONING_LAB = 1; - public static int DNA_LABORATORY = 2; - public static int ENCORE_PERFORMANCE = 3; - public static int ENTERTAINMENT_DISTRICT = 4; - public static int IMPROVED_JOB_MARKET = 5; - public static int MANUFACTURING_CENTER = 6; - public static int MEDICAL_CENTER = 7; - public static int RESEARCH_CENTER = 8; - public static int SAMPLE_RICH = 9; + 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 int BANK = 1; - public static int CLONING_FACILITY = 2; - public static int GARAGE = 3; - public static int MEDIUM_GARDEN = 4; - public static int LARGE_GARDEN = 5; - public static int SHUTTLEPORT = 6; + 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 = ""; @@ -64,7 +83,7 @@ public class PlayerCity { private Point3D cityCenterPosition = new Point3D(0,0,0); private int cityRadius = 0; private int cityRank = 0; - private int specialisation = -1; + private int specialization = -1; private long mayorID = 0L; private int cityTreasury = 0; private int maintenanceFee = 0; @@ -72,8 +91,15 @@ public class PlayerCity { private long nextElectionDate = 0L; private long nextCityUpdate = 0L; private long foundationTime = 0L; - private int tax = 0; + 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; @@ -113,7 +139,7 @@ public class PlayerCity { } public void processElection() { - + // ToDo: handle everything long winnerID = mayorID; mayorID = winnerID; electionVotes.clear(); @@ -126,6 +152,7 @@ public class PlayerCity { // 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); @@ -159,9 +186,21 @@ public class PlayerCity { // collect taxes for (long citizen : citizens){ CreatureObject citizenObject = (CreatureObject) NGECore.getInstance().objectService.getObject(citizen); - citizenObject.setBankCredits(citizenObject.getBankCredits()-tax); - cityTreasury += tax; + // ToDo: Handle tax evaders etc. + int incomeTax = getIncomeTax(); + citizenObject.setBankCredits(citizenObject.getBankCredits()-incomeTax); + cityTreasury += incomeTax; + + int propertyTaxRate = getPropertyTax()/100; + Vector allStructuresOfCitizen = new Vector(); // Collect the structures + int cumulatedPropertyTax = 0; + for (BuildingObject structure : allStructuresOfCitizen){ + cumulatedPropertyTax += propertyTaxRate*structure.getBMR(); + } + + citizenObject.setBankCredits(citizenObject.getBankCredits()-cumulatedPropertyTax); + cityTreasury += cumulatedPropertyTax; } demolishHighRankStructures(); @@ -236,7 +275,7 @@ public class PlayerCity { } - public int getCityRank() { + public int getRank() { return cityRank; } @@ -244,13 +283,13 @@ public class PlayerCity { this.cityRank = cityRank; } - public int getSpecialisation() { - return specialisation; + public int getSpecialization() { + return specialization; } - - public void setSpecialisation(int specialisation) { - this.specialisation = specialisation; - sendSpecUpdateMail(specialisation); + + public void setSpecialization(int specialization) { + this.specialization = specialization; + sendSpecUpdateMail(specialization); } public long getMayorID() { @@ -420,6 +459,7 @@ public class PlayerCity { public void setCityName(String cityName) { this.cityName = cityName; + sendNameChangeMail(cityName); } public int getCityID() { @@ -431,10 +471,83 @@ public class PlayerCity { } public void sendSpecUpdateMail(int cityID) { - this.cityID = cityID; // city_version_update_subject_4 // city_version_update_body_4 } + public void sendNameChangeMail(String name) { + + } + 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 getSpecializationSTFNamesAsList() { + return Arrays.asList(specialisationSTFNames); + } }