Project-Sloth / ps-housing

Advanced housing system for QBCore.
https://discord.gg/projectsloth
Other
334 stars 107 forks source link

Add support for multiple realtor jobs #207

Closed r3ps4J closed 2 months ago

r3ps4J commented 4 months ago

Overview

Hi! This pull request adds support for multiple realtor jobs. It's done in the same way as the PoliceJobNames. For the payout using qb-banking, I've changed it to get the current job of of the realtor instead of the configured realtor job, for all other things it indexes RealtorJobs with the player's job name. I have also made a similar pull request for ps-realtor which I will link below once I've made it.

The housing menu itself is not split up as this would require keeping track of the realtor who made the property. Although this is really simple to implement, it also means that other realtors would not be able to sell already owned properties made by other realtors. This can also be circumvented by clearing the realtor field after and not filtering those out, but including this hassle for so little gain seemed pointless to me at this time. And this would also add a column to the database table. If this is something you guys would like I can look into it in a future pull request.

I'd say the best way to implement this then is to store the realtor job on the property once they change it to "For Sale" or create the property in the first place, then clear it once it gets sold. You'd then only manage properties your job put up for sale, but will still be able to see the other properties and put sold properties back on sale.

Details

I think it's useful to be able to have multiple realtors. It allows for competition in the market for instance.

UI Changes / Functionality

Config.RealtorJobName was changed to Config.RealtorJobNames and is now an array of job names. It uses the same mechanism as Config.PoliceJobNames to check for the jobs. It's nothing visible in the UI, just that you're able to sell houses with different jobs.

Testing Steps

  1. Add another job to Config.RealtorJobNames or just leave "realestate".
  2. Go in game and see that you can sell houses and interact with them etc. as the other job.
  3. Check the /housing menu from ps-realtor with the pull request linked below.
r3ps4J commented 4 months ago

Related pull request for ps-realtor: https://github.com/Project-Sloth/ps-realtor/pull/42