Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SQL #13

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
94ac1fc
Fixing for latest unturned
fr34kyn01535 May 1, 2019
b81ca8b
..
fr34kyn01535 May 9, 2019
305aede
..
fr34kyn01535 May 9, 2019
5b0456b
Fixing libraries
fr34kyn01535 May 9, 2019
f10b1df
Add files via upload
fr34kyn01535 Jun 24, 2019
84cc8a3
Update LICENSE
fr34kyn01535 Jul 18, 2019
e6123ad
Cleanup code (minor), update MySql.Data
Pustalorc Jul 22, 2019
8b34fbf
Merge pull request #6 from Pustalorc/legacy
fr34kyn01535 Jul 22, 2019
e31e6a1
Fixed NRE on /sell {item name}
Pustalorc Aug 3, 2019
04e57bf
Stopped 3 libraries from getting copied to output
Pustalorc Aug 3, 2019
c9b8fab
Fixed Sequence contains no matching element
Pustalorc Aug 5, 2019
6ff1760
Merge pull request #7 from Pustalorc/legacy
cemahseri Aug 5, 2019
b2c0709
Fixed OutOfRange error with invalid names
Pustalorc Aug 5, 2019
9321ed6
Merge pull request #8 from Pustalorc/legacy
cemahseri Aug 5, 2019
8775cab
Added params MySqlParameter[] to ExecuteQuery
Pustalorc Aug 18, 2019
fc9a748
Patched the update queries as well
Pustalorc Aug 18, 2019
e8b680e
Merge pull request #9 from Pustalorc/legacy
cemahseri Aug 18, 2019
59a43c2
Updated MySql.Data to 8.0.18
Pustalorc Oct 31, 2019
7c5e6a6
Merge pull request #10 from Pustalorc/legacy
Trojaner Nov 1, 2019
6f38698
What A Disaster
Kr4ken-9 May 4, 2020
7e8796f
One More Command Redone
Kr4ken-9 May 5, 2020
81e3cd3
Fix Some Errors
Kr4ken-9 May 5, 2020
267f646
Rewritten All Commands
Kr4ken-9 May 5, 2020
4e26ca1
Cleaning And Fix
Kr4ken-9 May 5, 2020
5d498bd
Creating Groups
Kr4ken-9 May 5, 2020
6fbe813
Deleting Groups
Kr4ken-9 May 6, 2020
92af055
Adding And Removing IDs
Kr4ken-9 May 6, 2020
942a67b
Not Tested Yet
Kr4ken-9 May 7, 2020
0794828
Fixes
Kr4ken-9 May 7, 2020
c9aaa50
Merge pull request #11 from Kr4ken-9/legacy
archie426 May 13, 2020
1eff9d2
#000 - Remove Group and fix command BUY.
ElMargaritox Sep 16, 2024
e86994b
#Remove SQL added JSON.
ElMargaritox Sep 23, 2024
ea50772
# Fix.
ElMargaritox Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions AssetUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using System.Linq;
using SDG.Unturned;

namespace ZaupShop
{
public class AssetUtils
{
public static VehicleAsset GetVehicle(string searchTerm)
{
VehicleAsset vehicleAsset = null;
if (!ushort.TryParse(searchTerm, out ushort vehicleID))
{
vehicleAsset = Assets.find(EAssetType.VEHICLE).Cast<VehicleAsset>()
.Where(veh => !string.IsNullOrEmpty(veh.vehicleName))
.FirstOrDefault(veh =>
veh.vehicleName.ToUpperInvariant().Contains(searchTerm.ToUpperInvariant()));


if (vehicleAsset == null)
return null;
}

if (vehicleAsset != null)
return vehicleAsset;

Asset potentialMatch = Assets.find(EAssetType.VEHICLE, vehicleID);

if (potentialMatch == null)
return null;

vehicleAsset = (VehicleAsset) potentialMatch;

return vehicleAsset;
}

public static ItemAsset GetItem(string searchTerm)
{
ItemAsset itemAsset = null;

if (!ushort.TryParse(searchTerm, out ushort itemID))
{
itemAsset = Assets.find(EAssetType.ITEM).Cast<ItemAsset>()
.Where(i => !string.IsNullOrEmpty(i.itemName)).OrderBy(i => i.itemName.Length)
.FirstOrDefault(i => i.itemName.ToUpperInvariant().Contains(searchTerm.ToUpperInvariant()));

if (itemAsset == null)
return null;
}

if (itemAsset != null)
return itemAsset;

Asset potentialMatch = Assets.find(EAssetType.ITEM, itemID);

if (potentialMatch == null)
return null;

itemAsset = (ItemAsset) potentialMatch;

return itemAsset;
}

public static Asset GetAssetByID(ushort id, bool vehicle) => Assets.find(vehicle ? EAssetType.VEHICLE : EAssetType.ITEM, id);

public static ushort? GetAssetIDBySearch(string searchTerm, out bool vehicle)
{
vehicle = false;
string[] type = Parser.getComponentsFromSerial(searchTerm, '.');
if (type.Length > 1 && type[0] != "v")
return null;

string unprocessedID = type.Length > 1 ? type[1] : type[0];

if (!ushort.TryParse(unprocessedID, out ushort id))
return null;

if (type[0] == "v")
vehicle = true;

return id;
}
}
}
55 changes: 0 additions & 55 deletions CommandBuy.cs

This file was deleted.

58 changes: 0 additions & 58 deletions CommandCost.cs

This file was deleted.

55 changes: 0 additions & 55 deletions CommandSell.cs

This file was deleted.

Loading