Skip to content

Commit

Permalink
Merge pull request #543 from bitpredator/dev
Browse files Browse the repository at this point in the history
Refactor: (esx_property)
  • Loading branch information
bitpredator authored Oct 16, 2023
2 parents 2bc8a11 + e05a1ec commit 6a77d38
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 371 deletions.
11 changes: 10 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@
<!-- ⚠⚠ Please follow the format provided ⚠⚠ -->
<!-- Always use "1." at the start instead of "2. " or "X. " as GitHub will auto renumber everything. -->
<!-- Use the following format below -->
<!-- 1. [Changed Area] Title of changes - @github username -->
<!-- 1. [Changed Area] Title of changes - @github username -->

<!-- Version 1.0.0 -->
1. [.github\PULL_REQUEST_TEMPLATE.md]: update the pull request template file @bitpredator
2. [esx_property\config.lua]: improves code formatting @bitpredator
[esx_property\client\html\copy.html]: remove jquery @bitpredator
[esx_property\client\main.lua]: add copy to clipboard to /getoffset @bitpredator
[esx_property\locales\en.lua & it.lua]: corrected typos @bitpredator
[esx_property\server\main.lua]: correction of lint errors @bitpredator
[esx_property\config.lua]: correction of lint errors @bitpredator
14 changes: 7 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
Fixes #[issue_no]
### All Submissions:

* Have you followed the guidelines in our Contributing document?
* Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?
* []Have you followed the guidelines in our Contributing document?
* []Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### New Feature Submissions:

1. Does your submission pass tests?
2. Have you lint your code locally prior to submission?
1. []Does your submission pass tests?
2. []Have you lint your code locally prior to submission?

### Changes to Core Features:

* Have you added an explanation of what your changes do and why you'd like us to include them?
* Have you written new tests for your core changes, as applicable?
* Have you successfully ran tests with your changes locally?
* []Have you added an explanation of what your changes do and why you'd like us to include them?
* []Have you written new tests for your core changes, as applicable?
* []Have you successfully ran tests with your changes locally?

<!-- You may optionally provide your discord username, so that we may contact you directly about the issue. -->
Discord username (if different from GitHub):
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<!-- Cred: https://github.com/TerbSEC/FiveM-CoordsSaver/tree/master/html -->
<html>
<head>
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
</head>
<script>
function ready(fn) {
if (document.readyState !== "loading") {
fn();
} else {
document.addEventListener("DOMContentLoaded", fn);
}}

<script>
$(document).ready(function(){
window.addEventListener("message", function(event) {
var node = document.createElement("textarea");
var selection = document.getSelection();

node.textContent = event.data.link;
document.body.appendChild(node);

selection.removeAllRanges();
node.select();
document.execCommand("copy");

selection.removeAllRanges();
document.body.removeChild(node);
});
});
</script>
ready(function () {
window.addEventListener("message", function (event) {
let node = document.createElement("textarea");
let selection = document.getSelection();

node.textContent = event.data.link;
document.body.appendChild(node);

selection.removeAllRanges();
node.select();
document.execCommand("copy");

selection.removeAllRanges();
document.body.removeChild(node);
});
});
</script>
</html>
36 changes: 12 additions & 24 deletions server-data/resources/[esx_addons]/esx_property/client/main.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
--[[
ESX Property - Properties Made Right!
Copyright (C) 2022 ESX-Framework
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]] local GameBuild = GetGameBuildNumber()
local GameBuild = GetGameBuildNumber()
Properties = {}
CurrentId = 0
local CurrentDrawing = {}
Expand Down Expand Up @@ -207,7 +191,8 @@ function ManageKeys(Property)
local Elements = {{unselectable = true, title = _U("key_management"), icon = "fas fa-key"},
{title = _U("back"), icon = "fas fa-arrow-left", value = "go_back"},
{title = _U("give_keys"), icon = "fas fa-plus", value = "give_keys"},
{title = _U("remove_keys"), icon = "fas fa-minus", value = "remove_keys"}}
{title = _U("remove_keys"), icon = "fas fa-minus", value = "remove_keys"}
}

ESX.OpenContext("right", Elements, function(menu, element)
if element.value == "go_back" then
Expand All @@ -226,7 +211,8 @@ function SetPropertyName(Property)
local Name = Properties[Property].setName ~= "" and Properties[Property].setName or Properties[Property].Name
local Elements = {{unselectable = true, title = _U("name_edit"), icon = "fa-solid fa-signature"},
{icon = "", title = _U("name"), input = true, inputType = "text", inputValue = Name, inputPlaceholder = Properties[Property].Name,
name = "setName"}, {icon = "fa-solid fa-check", title = _U("confirm"), name = "confirm"}}
name = "setName"}, {icon = "fa-solid fa-check", title = _U("confirm"), name = "confirm"}
}

ESX.OpenContext("right", Elements, function(menu, element)
if element.name == "confirm" then
Expand Down Expand Up @@ -281,7 +267,7 @@ function PropertyMenuElements(PropertyId)
value = 'property_wardrobe'})
end
table.insert(elements,
{title = _U("Furniture_title"), description = _U("Furniture_desc"), icon = "fas fa-boxes-stacked", value = 'property_furniture'})
{title = _U("furniture_title"), description = _U("furniture_desc"), icon = "fas fa-boxes-stacked", value = 'property_furniture'})
end
end
if (not Property.Locked or Config.OwnerCanAlwaysEnter and ESX.PlayerData.identifier == Property.Owner) and not InProperty then
Expand Down Expand Up @@ -454,7 +440,7 @@ function OpenPropertyMenu(PropertyId)
local eles = PropertyMenuElements(PropertyId)
exports["esx_context"]:Refresh(eles)
else
ESX.ShowNotification(_U("cannot_Sell"), "error")
ESX.ShowNotification(_U("cannot_sell"), "error")
end
end, PropertyId, element.value)
end
Expand All @@ -476,7 +462,7 @@ function OpenPropertyMenu(PropertyId)
local eles = PropertyMenuElements(PropertyId)
exports["esx_context"]:Refresh(eles)
else
ESX.ShowNotification(_U("cannot_Sell"), "error")
ESX.ShowNotification(_U("cannot_sell"), "error")
end
end, PropertyId)
end
Expand Down Expand Up @@ -521,6 +507,9 @@ RegisterCommand("getoffset", function(source)
local Property = Properties[CurrentId]
local Interior = GetInteriorValues(Property.Interior)
print(vector3(Property.Entrance.x, Property.Entrance.y, 2000) - Pcoords)
SendNUIMessage({
link = tostring(vector3(Property.Entrance.x, Property.Entrance.y, 2000) - Pcoords)
})
end
end)

Expand Down Expand Up @@ -944,7 +933,7 @@ RegisterNetEvent("esx_property:CreateProperty", function()
{value = 0, title = _U("element_title1"), icon = "fas fa-list-ol", description = _U("element_description1"), input = true,
inputType = "number", inputPlaceholder = "Number...", inputValue = nil, inputMin = 1, inputMax = 90000, index = "hnumber"},
{title = _U("element_title2"), icon = "fas fa-dollar-sign", input = true, inputType = "number",description = _U("element_description2"),
inputPlaceholder = "Price...", inputValue = nil, inputMin = 1, inputMax = 50000000, index = "price"},
inputPlaceholder = "Price...", inputValue = SuggestedPrice, inputMin = 1, inputMax = 900000000, index = "price"},
{title = _U("element_title3"), description = _U("element_description3"), icon = "fas fa-home", index = "interior"},
{title = _U("element_title4"), description = _U("element_description4"), icon = "fas fa-warehouse", value = {enabled = false},
index = "garage", disabled = not (Config.Garage.Enabled)},
Expand Down Expand Up @@ -1513,4 +1502,3 @@ RegisterNetEvent("esx_property:AdminMenu", function()
end
end)
end)

Loading

0 comments on commit 6a77d38

Please sign in to comment.