Skip to content

Commit

Permalink
CFX-API: Important changes, read full description:
Browse files Browse the repository at this point in the history
- vMenuShared component is now removed. This has been integrated into just 2 .cs files in the SharedClasses folder, which is added to both the client and server project.
- CFX API packages have been updated to use the latest NuGet (official) versions. This required quite a bit of refactoring, including the removal of the vMenuShared project.
- Appveyor compatibility update for the new packages and removed project.
- MenuAPI update required refactoring of the dependency filename.
- New FiveM production build allowed me to implement the Radar Controls hotkeys without it crashing, so that's also been added in this commit.
- gitignore: ignore nuget package folder
  • Loading branch information
TomGrobbe committed Mar 14, 2019
1 parent b59b39f commit a754ead
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 74,546 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -154,7 +154,7 @@ PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
#**/packages/*
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
Expand Down
File renamed without changes.
Expand Up @@ -307,14 +307,27 @@ public enum Permission
public static Dictionary<Permission, bool> Permissions { get; private set; } = new Dictionary<Permission, bool>();
public static bool ArePermissionsSetup { get; set; } = false;


#if SERVER
/// <summary>
/// Public function to check if a permission is allowed.
/// </summary>
/// <param name="permission"></param>
/// <param name="source"></param>
/// <param name="checkAnyway">if true, then the permissions will be checked even if they aren't setup yet.</param>
/// <returns></returns>
public static bool IsAllowed(Permission permission, Player source = null, bool checkAnyway = false) => IsAllowedServer(permission, source);
#endif
#if CLIENT
/// <summary>
/// Public function to check if a permission is allowed.
/// </summary>
/// <param name="permission"></param>
/// <param name="source"></param>
/// <param name="checkAnyway">if true, then the permissions will be checked even if they aren't setup yet.</param>
/// <returns></returns>
public static bool IsAllowed(Permission permission, Player source = null, bool checkAnyway = false) => IsDuplicityVersion() ? IsAllowedServer(permission, source) : IsAllowedClient(permission, checkAnyway);
public static bool IsAllowed(Permission permission, Player source = null, bool checkAnyway = false) => IsAllowedClient(permission, checkAnyway);
#endif

private static Dictionary<Permission, bool> allowedPerms = new Dictionary<Permission, bool>();
/// <summary>
Expand Down Expand Up @@ -348,6 +361,7 @@ private static bool IsAllowedClient(Permission permission, bool checkAnyway)
return false;
}

#if SERVER
/// <summary>
/// Checks if the player is allowed that specific permission.
/// </summary>
Expand All @@ -369,6 +383,7 @@ private static bool IsAllowedServer(Permission permission, Player source)

return false;
}
#endif

private static Dictionary<Permission, List<Permission>> parentPermissions = new Dictionary<Permission, List<Permission>>();

Expand Down Expand Up @@ -408,6 +423,7 @@ public static List<Permission> GetPermissionAndParentPermissions(Permission perm

}

#if SERVER
/// <summary>
/// Sets the permissions for a specific player (checks server side, sends event to client side).
/// </summary>
Expand Down Expand Up @@ -471,7 +487,8 @@ public static void SetPermissionsForPlayer([FromSource]Player player)
// Also tell the client to do the addons setup.
player.TriggerEvent("vMenu:SetAddons");
}

#endif
#if CLIENT
/// <summary>
/// Sets the permission (client side event handler).
/// </summary>
Expand All @@ -489,7 +506,7 @@ public static void SetPermissions(string permissions)

}
}

#endif
/// <summary>
/// Gets the full permission ace name for the specific <see cref="Permission"/> enum.
/// </summary>
Expand Down
10 changes: 3 additions & 7 deletions appveyor.yml
@@ -1,13 +1,13 @@
pull_requests:
do_not_increment_build_number: false
# branches:
# only:
# - production
image: Visual Studio 2017
configuration: Release
before_build:
- nuget restore
build:
parallel: true
project: vMenu.sln
include_nuget_references: true
verbosity: minimal
after_build:
- cmd: copy README.md ..\build\README.md
Expand All @@ -16,8 +16,6 @@ after_build:
- cmd: if %APPVEYOR_REPO_TAG%==true (appveyor SetVariable -Name VERSION_NAME -Value %APPVEYOR_REPO_TAG_NAME%) else (appveyor SetVariable -Name VERSION_NAME -Value beta)
- cmd: 7z a vMenu-%VERSION_NAME%.zip -r ..\build\*
- cmd: appveyor PushArtifact vMenu-%VERSION_NAME%.zip
# - cmd: if %APPVEYOR_REPO_TAG%==false (7z a vMenu-beta.zip -r ..\build\*)
# - cmd: if %APPVEYOR_REPO_TAG%==false (appveyor PushArtifact vMenu-beta.zip)
deploy:
- provider: GitHub
release: "[Release] vMenu $(VERSION_NAME)"
Expand All @@ -29,8 +27,6 @@ deploy:
on:
APPVEYOR_REPO_TAG: true
description: "vMenu version $(VERSION_NAME)."
before_build:
- ps: if($env:APPVEYOR_REPO_TAG -eq $True) {Invoke-RestMethod https://raw.githubusercontent.com/TomGrobbe/appveyor-discord-webhook/master/send.ps1 -o send.ps1; ./send.ps1 start $env:WEBHOOK_URL; rm send.ps1;}
after_deploy:
- ps: if($env:APPVEYOR_REPO_TAG -eq $True) {Invoke-RestMethod https://raw.githubusercontent.com/TomGrobbe/appveyor-discord-webhook/master/send.ps1 -o send.ps1; ./send.ps1 deploy $env:WEBHOOK_URL; rm send.ps1;}
on_success:
Expand Down
Binary file removed dependencies/client/CitizenFX.Core.dll
Binary file not shown.

0 comments on commit a754ead

Please sign in to comment.