-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 666e587
Showing
25 changed files
with
1,679 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PACKAGE_NAME=CustomWeaponsAPI | ||
PACKAGE_README_USE=1 | ||
|
||
PACKAGE_COMPILED_PLUGINS_USE=1 | ||
PACKAGE_COMPILED_PLUGINS_SAVE=0 | ||
|
||
PACKAGE_PLUINGS_LIST_USE=0 | ||
PACKAGE_ASSETS_USE=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths-ignore: | ||
- "**.md" | ||
|
||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
release: | ||
types: [published] | ||
|
||
env: | ||
PACKAGE_NAME: CustomWeaponsAPI | ||
STORE_READMY: 1 | ||
PARAMS_CONRTOLLER_TAG: 1.0.0-b4 | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
COMMIT_SHA: ${{ steps.declare_sha.outputs.COMMIT_SHA }} | ||
SEMVER: ${{ steps.declare_sha.outputs.SEMVER }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Parse SemVer string (release) | ||
id: semver_parser | ||
if: | | ||
github.event_name == 'release' && | ||
github.event.action == 'published' && | ||
startsWith(github.ref, 'refs/tags/') | ||
uses: booxmedialtd/[email protected] | ||
with: | ||
input_string: ${{ github.ref }} | ||
version_extractor_regex: 'refs\/tags\/(.*)$' | ||
|
||
- name: Declare SHA & package name | ||
id: declare_sha | ||
shell: bash | ||
run: | | ||
SHA=$(git rev-parse --short HEAD) | ||
echo "COMMIT_SHA=$SHA" >> $GITHUB_OUTPUT | ||
echo "SEMVER=${{ steps.semver_parser.outputs.fullversion }}" >> $GITHUB_OUTPUT | ||
- name: Setup latest ReAPI includes | ||
env: | ||
REPO: "rehlds/reapi" | ||
run: | | ||
mkdir -p dep/reapi | ||
cd dep/reapi | ||
curl \ | ||
--silent \ | ||
https://api.github.com/repos/$REPO/releases/latest | \ | ||
jq .assets[0].browser_download_url -r | \ | ||
xargs wget | ||
7z x *.zip | ||
echo "REAPI_INCLUDE_PATH=$(pwd)/addons/amxmodx/scripting/include" >> $GITHUB_ENV | ||
- name: Setup ParamsController includes | ||
env: | ||
REPO: AmxxModularEcosystem/ParamsController | ||
TAG: ${{ env.PARAMS_CONRTOLLER_TAG }} | ||
OUTPUT_VAR_NAME: PARAMS_CONRTOLLER_INCLUDE_PATH | ||
run: | | ||
mkdir -p dep/${REPO} | ||
cd dep/${REPO} | ||
if [ -z "${TAG}" ]; then | ||
TAG=`curl --silent https://api.github.com/repos/${REPO}/releases/latest | jq .tag_name -r` | ||
fi | ||
wget https://github.com/${REPO}/archive/refs/tags/${TAG}.zip | ||
7z x ${TAG}.zip | ||
REPO_NAME=`echo "${REPO}" | grep -Po '(?<=\/)\w+'` | ||
echo "${OUTPUT_VAR_NAME}=$(pwd)/${REPO_NAME}-${TAG}/${INCLUDE_PATH:-amxmodx/scripting/include}" >> $GITHUB_ENV | ||
- name: Setup AMXXPawn Compiler | ||
uses: wopox1337/[email protected] | ||
with: | ||
version: "1.10.5428" | ||
|
||
- name: Compile plugins | ||
working-directory: amxmodx/scripting/ | ||
env: | ||
REAPI_INCLUDE: ${{ env.REAPI_INCLUDE_PATH }} | ||
PARAMS_CONRTOLLER_INCLUDE: ${{ env.PARAMS_CONRTOLLER_INCLUDE_PATH }} | ||
run: | | ||
compile() { | ||
sourcefile=$1 | ||
amxxfile="$(echo $sourcefile | sed -e 's/\.sma$/.amxx/')" | ||
output_path="../plugins/$amxxfile" | ||
mkdir -p $(dirname $output_path) | ||
echo -n "Compiling $sourcefile ... " | ||
amxxpc $sourcefile -o"$output_path" \ | ||
-i"include" \ | ||
-i"$REAPI_INCLUDE" \ | ||
-i"$PARAMS_CONRTOLLER_INCLUDE" | ||
} | ||
export -f compile | ||
find . -type f -name "*.sma" -exec bash -c 'compile "$0"' {} \; | ||
- name: Move files | ||
env: | ||
STORE_READMY: ${{ env.STORE_READMY }} | ||
run: | | ||
mkdir -p publish/${{ env.PACKAGE_NAME }}/addons | ||
mv amxmodx/ publish/${{ env.PACKAGE_NAME }}/addons | ||
if [ ! -z "${STORE_READMY}" ]; then | ||
mv README.md publish/ | ||
fi | ||
- name: Deploy artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.PACKAGE_NAME }}-${{ steps.declare_sha.outputs.COMMIT_SHA }}-dev | ||
path: publish/* | ||
|
||
publish: | ||
name: "Publish release" | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
if: | | ||
github.event_name == 'release' && | ||
github.event.action == 'published' && | ||
startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Download artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.PACKAGE_NAME }}-${{ needs.build.outputs.COMMIT_SHA }}-dev | ||
|
||
- name: Packaging binaries | ||
id: packaging | ||
run: 7z a -mm=Deflate -mfb=258 -mpass=15 -r ${{ env.PACKAGE_NAME }}-${{ needs.build.outputs.SEMVER }}.zip | ||
|
||
- name: Publish artifacts | ||
uses: softprops/[email protected] | ||
id: publish-job | ||
if: | | ||
startsWith(github.ref, 'refs/tags/') && | ||
steps.packaging.outcome == 'success' | ||
with: | ||
files: | | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.amxx | ||
*.zip | ||
.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Extended Menu System |
21 changes: 21 additions & 0 deletions
21
amxmodx/configs/plugins/ExtendedMenuSystem/Menus/MenuExample1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"Command": "example_menu_1", | ||
"ChatCommands": [ | ||
"say /menu1" | ||
], | ||
"Title": [ | ||
"Заголовок", | ||
" Подзаголовок 1", | ||
" Подзаголовок 2" | ||
], | ||
"Items": [ | ||
{ | ||
"Title": "Пункт 1", | ||
"Command": "say Я нажал на пункт 1" | ||
}, | ||
{ | ||
"Title": "Пункт 2", | ||
"Command": "say Я нажал на пункт 2" | ||
} | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
amxmodx/configs/plugins/ExtendedMenuSystem/Menus/MenuExample2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"Command": "example_menu_2", | ||
"ChatCommands": [ | ||
"say /menu2" | ||
], | ||
"Title": "Кого вызвать на дуэль?", | ||
"Controller": { | ||
"Controller": "Players", | ||
|
||
"ExcludeSelf": true, | ||
"ExcludeDead": true, | ||
"ExcludeTeammates": true, | ||
|
||
"Title": "{i:playerName} \\d#{i:playerIndex}", | ||
"Command": "tipa_vyzov_na_duel {i:playerIndex}; say {i:playerName}, вызываю тебя на дуэль!" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
amxmodx/configs/plugins/ExtendedMenuSystem/Menus/MenuExample3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"Command": "example_menu_3", | ||
"ChatCommands": [ | ||
"say /menu3" | ||
], | ||
"Title": "Привет, {m:playerName}!", | ||
"Extensions": [ | ||
"PlayerPlaceholders" | ||
], | ||
"Items": [ | ||
{ | ||
"Title": "Твой SteamId: {m:playerSteamId}" | ||
}, | ||
{ | ||
"Title": "Твой индекс: {m:playerIndex}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <amxmodx> | ||
#include <ems> | ||
#include <ParamsController> | ||
#include "EMS/Objects/MenuController" | ||
|
||
API_MenuController_Init() { | ||
register_native("MenuController_Register", "@_MenuController_Register"); | ||
register_native("MenuController_AddParams", "@_MenuController_AddParams"); | ||
} | ||
|
||
T_MenuController:@_MenuController_Register(const pluginIndex) { | ||
enum {Arg_Key = 1, Arg_Callback}; | ||
|
||
new controllerKey[EMS_CONTROLLER_KEY_MAX_LEN]; | ||
new controllerCallback[EMS_EVENT_HANDLER_MAX_LEN]; | ||
|
||
get_string(Arg_Key, controllerKey, charsmax(controllerKey)); | ||
get_string(Arg_Callback, controllerCallback, charsmax(controllerCallback)); | ||
|
||
return MenuController_Register(controllerKey, MenuController_MakeCallback(pluginIndex, controllerCallback)); | ||
} | ||
|
||
@_MenuController_AddParams(const pluginIndex, const paramsCount) { | ||
enum {Arg_Controller = 1, Arg_Params}; | ||
|
||
new T_MenuController:controller = get_param(Arg_Controller); | ||
new Array:newParams = ParamsController_Param_ListFromNativeParams(Arg_Params, paramsCount); | ||
|
||
MenuController_AddParams(controller, newParams); | ||
|
||
ArrayDestroy(newParams); | ||
} |
Empty file.
Oops, something went wrong.