Skip to content

Commit

Permalink
Merge pull request #12 from KillahPotatoes/v2.0.2
Browse files Browse the repository at this point in the history
V2.0.2
  • Loading branch information
Wyqer authored Aug 25, 2018
2 parents 4e91ab0 + ece1043 commit c50bc02
Show file tree
Hide file tree
Showing 42 changed files with 648 additions and 212 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@
"KPR_tkPenalty",
"KPR_updateInterval",
"KPR_fnc_addActions",
"KPR_fnc_addScore",
"KPR_fnc_applyRank",
"KPR_fnc_autoLoop",
"KPR_fnc_entityKilled",
"KPR_fnc_getAceKiller",
"KPR_fnc_getInsigniaData",
"KPR_fnc_getPlayerIndex",
"KPR_fnc_getPlaytime",
"KPR_fnc_getPlaytimePlain",
"KPR_fnc_getUniformIndex",
"KPR_fnc_getRank",
"KPR_fnc_getScore",
"KPR_fnc_initACE",
"KPR_fnc_isAdmin",
"KPR_fnc_openDialogPlayers",
Expand All @@ -42,6 +50,7 @@
"KPR_fnc_savePlayers",
"KPR_fnc_scoreUpdate",
"KPR_fnc_setDefaultUniforms",
"KPR_fnc_setScore",
"KPR_fnc_showHint",
"KPR_fnc_uniformFill"
]
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Currently the mod is localized for:
* English
* German
* Polish
* Portuguese
* Spanish

## Mods
Required:
Expand Down Expand Up @@ -65,8 +67,26 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

## Changelog
### v2.0.2
* Added: Portuguese localization. Thanks to [AngusDLX](https://github.com/AngusDLX)
* Added: Spanish localization. Thanks to [Jettfiremachine](https://github.com/amunoz20)
* Added: Some more functions which could become handy for mission creators:
* [KPR_fnc_getInsigniaData](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getInsigniaData.sqf)
* [KPR_fnc_getRankName](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getRankName.sqf)
* [KPR_fnc_getPlaytime](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getPlaytime.sqf)
* [KPR_fnc_getPlaytimePlain](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getPlaytimePlain.sqf)
* [KPR_fnc_getRankScore](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getRankScore.sqf)
* [KPR_fnc_getRankScoreNext](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getRankScoreNext.sqf)
* Added: Tooltip for deactivated rank setting in the player dialog, if the leveling system is enabled.
* Added: Playtime in the player name tooltip in the player management dialog.
* Added: [KP Ranks Wiki](https://github.com/KillahPotatoes/KP-Ranks/wiki) on GitHub with examples to use the functions.
* Tweaked: Undefined arguments for calls replaced with empty arrays as arguments.
* Tweaked: Usage of getter/setter functions in internal scripts.
* Fixed: Rank apply auto loop could be running in two instances.
* Fixed: Dialogs close directly if opened with "standard action" key.

### v2.0.1
* Added: Getter/Setter and helpful functions, so content/mission creators can easily access the KP Ranks data.
* Added: Getter/Setter and helpful functions, so content/mission creators can easily access the KP Ranks data:
* [KPR_fnc_getRank](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_getRank.sqf)
* [KPR_fnc_setRank](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_setRank.sqf)
* [KPR_fnc_hasRank](https://github.com/KillahPotatoes/KP-Ranks/blob/master/addons/KP_Ranks/fnc/fn_hasRank.sqf)
Expand Down
8 changes: 4 additions & 4 deletions addons/KP_Ranks/KPR_dialogs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class KPR_playerList {
};

class controls {
class KPR_DialogCross: KP_DialogCross {};

class KPR_ControlsGroup: KP_ControlsGroup {
idc = 75801;
x = KP_GETCX(KP_X_VAL,KP_WIDTH_VAL,0,1);
Expand Down Expand Up @@ -103,6 +101,8 @@ class KPR_playerList {
tooltip = "$STR_KPR_DIALOG_SAVEDESC";
onButtonClick = "call KPR_fnc_playerSave";
};

class KPR_DialogCross: KP_DialogCross {};
};
};

Expand Down Expand Up @@ -183,8 +183,6 @@ class KPR_uniformList {
};

class controls {
class KPR_DialogCross: KP_DialogCross {};

class KPR_ListActive: KP_Listbox {
idc = 75801;
x = KP_GETCX(KP_X_VAL,KP_WIDTH_VAL,0,1);
Expand Down Expand Up @@ -250,5 +248,7 @@ class KPR_uniformList {
tooltip = "$STR_KPR_DIALOG_EXPORTDESC";
onButtonClick = "call KPR_fnc_uniformExport";
};

class KPR_DialogCross: KP_DialogCross {};
};
};
48 changes: 40 additions & 8 deletions addons/KP_Ranks/KP_uiDefines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: KP_uiDefines.hpp
Author: Wyqer - https://github.com/KillahPotatoes
Date: 2018-07-10
Last Update: 2018-07-27
Last Update: 2018-08-07
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Expand All @@ -14,15 +14,19 @@
// BI class includes
// Details via: "Default" call BIS_fnc_exportGUIBaseClasses;
class ScrollBar;
class RscActivePicture;
class RscActiveText;
class RscButton;
class RscCheckBox;
class RscCombo;
class RscControlsGroup;
class RscEdit;
class RscListBox;
class RscListNBox;
class RscShortcutButton;
class RscText;
class RscXListBox;
class RscXSliderH;

/*
--- General Defines ---
Expand Down Expand Up @@ -138,6 +142,12 @@ class KP_Text: RscText {
sizeEx = KP_TEXT_M;
};

// Inline Title
class KP_InlineTitle: RscText {
style = 2;
sizeEx = KP_TEXT_L;
};

// Active Text
class KP_ActiveText: RscActiveText {
style = 2;
Expand All @@ -149,24 +159,30 @@ class KP_Picture: RscText {
style = 48;
};

class KP_ActivePicture: RscActivePicture {};

// Picture which keeps aspect ratio
class KP_PictureRatio: RscText {
style = 48 + 2048;
};

// Button
class KP_Button: RscButton {
colorBackground[] = KP_COLOR_BACKGROUND;
colorFocused[] = KP_COLOR_BACKGROUND;
h = safeZoneH * KP_HEIGTH_BUTTON;
sizeEx = KP_TEXT_M;
};

// Shortcut Button
class KP_ShortcutButton: RscShortcutButton {
colorBackground[] = {0.2, 0.2, 0.2, 1};
colorBackgroundFocused[] = {0.25, 0.25, 0.25, 1};
colorBackground2[] = {0.25, 0.25, 0.25, 1};
style = 2;
// Inline Button
class KP_InlineButton: RscButton {
colorBackground[] = {0.25, 0.25, 0.25, 1};
colorBackgroundDisabled[] = {0, 1, 0, 1};
colorBackgroundActive[] = {0.3, 0.3, 0.3, 1};
colorFocused[] = {0.25, 0.25, 0.25, 1};
sizeEx = KP_TEXT_M;
offsetPressedX = safeZoneW * 0.0005;
offsetPressedY = safeZoneH * 0.001;
}

// Controls group
Expand All @@ -190,12 +206,28 @@ class KP_ListBox: RscListBox {
sizeEx = KP_TEXT_M;
};

class KP_ListNBox: RscListNBox {
sizeEx = KP_TEXT_M;
};

// XListBox
class KP_XListBox: RscXListBox {
colorBackground[] = KP_COLOR_BACKGROUND;
sizeEx = KP_TEXT_M;
};

// Slider
class KP_Slider: RscXSliderH {
color[] = {1, 1, 1, 0.6};
colorActive[] = {1, 1, 1, 0.6};
};

// Editbox
class KP_EditBox: RscEdit {
colorBackground[] = {0, 0, 0, 0.3};
sizeEx = KP_TEXT_M;
};

/*
--- Standard sized dialog components ---
(X from 0.25 - 0.75, Y from 0.2 - 0.8)
Expand Down Expand Up @@ -276,7 +308,7 @@ class KP_DialogButtonL: KP_Button {

/*
--- Corner dialog components ---
(X from 0.035 - 0.285, Y from 0.05 - 0.8)
(X from 0.035 - 0.235, Y from 0.05 - 0.8)
*/

#define KP_X_VAL_C 0.035
Expand Down
38 changes: 31 additions & 7 deletions addons/KP_Ranks/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: config.cpp
Author: Wyqer - https://github.com/KillahPotatoes
Date: 2018-07-09
Last Update: 2018-07-23
Last Update: 2018-08-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Expand All @@ -22,15 +22,15 @@ class CfgPatches {
url = "https://github.com/KillahPotatoes/KP-Ranks";
units[] = {"KPR_force"};
weapons[] = {};
requiredVersion = 1.82;
requiredVersion = 1.84;
requiredAddons[] = {
"A3_Modules_F",
"cba_main"
};
versionDesc = "KP Ranks";
version = 2.0.1;
versionStr = "2.0.1";
versionAr[] = {2,0,1};
version = 2.0.2;
versionStr = "2.0.2";
versionAr[] = {2,0,2};
authors[] = {"Wyqer"};
};
};
Expand Down Expand Up @@ -58,7 +58,7 @@ class CfgSettings {

class Extended_PreInit_EventHandlers {
class KPR_preInit {
init = "call KPR_fnc_initCBA";
init = "[] call KPR_fnc_initCBA";
};
};

Expand All @@ -68,7 +68,7 @@ class Extended_PreInit_EventHandlers {

class Extended_PostInit_EventHandlers {
class KPR_postInit {
init = "call KPR_fnc_initRanks";
init = "[] call KPR_fnc_initRanks";
};
};

Expand Down Expand Up @@ -162,12 +162,36 @@ class CfgFunctions {
// Request ACE ace_medical_lastDamageSource variable from unit owner
class getAceKiller {};

// Get data of the players rank insignia class
class getInsigniaData {};

// Get a players index in the KPR_players array
class getPlayerIndex {};

// Get a players playtime formatted to days, hours and minutes
class getPlaytime {};

// Get a players playtime in plain minutes
class getPlaytimePlain {};

// Get the rank of a player
class getRank {};

// Get the name of the rank of a player
class getRankName {};

// Get the needed score to keep the current player rank
class getRankScore {};

// Get the needed score for a players next rank
class getRankScoreNext {};

// Get the score of a player
class getScore {};

// Get the index in the KPR_uniforms array of an uniform
class getUniformIndex {};

// Check if player has at least given rank
class hasRank {};

Expand Down
6 changes: 3 additions & 3 deletions addons/KP_Ranks/fnc/fn_addActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_addActions.sqf
Author: Wyqer - https://github.com/KillahPotatoes
Date: 2018-07-09
Last Update: 2018-07-19
Last Update: 2018-08-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Expand All @@ -31,7 +31,7 @@ if (!isNull _corpse) then {
};

KPR_actionIdCheck = player addAction [localize "STR_KPR_ACTION_CHECKRANK", {[true] call KPR_fnc_applyRank;}, nil, -1200, false, true, "", "!KPR_autoMode || KPR_levelSystem"];
KPR_actionIdPlayers = player addAction [localize "STR_KPR_ACTION_PLAYERMANAGE", {call KPR_fnc_openDialogPlayers;}, nil, -1201, false, true, "", "KPR_isAdmin"];
KPR_actionIdUniforms = player addAction [localize "STR_KPR_ACTION_UNIFORMMANAGE", {call KPR_fnc_openDialogUniforms;}, nil, -1201, false, true, "", "KPR_isAdmin"];
KPR_actionIdPlayers = player addAction [localize "STR_KPR_ACTION_PLAYERMANAGE", {[] call KPR_fnc_openDialogPlayers;}, nil, -1201, false, true, "", "KPR_isAdmin"];
KPR_actionIdUniforms = player addAction [localize "STR_KPR_ACTION_UNIFORMMANAGE", {[] call KPR_fnc_openDialogUniforms;}, nil, -1201, false, true, "", "KPR_isAdmin"];

true
20 changes: 14 additions & 6 deletions addons/KP_Ranks/fnc/fn_addScore.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_addScore.sqf
Author: Wyqer - https://github.com/KillahPotatoes
Date: 2018-07-23
Last Update: 2018-07-23
Last Update: 2018-08-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Expand All @@ -22,13 +22,21 @@ if (!isServer) exitWith {false};

params ["_uid", ["_change", 0]];

private _index = KPR_players findIf {_x select 1 == _uid};
// Get current score
private _score = [_uid] call KPR_fnc_getScore;

// Return false, if uid wasn't found in the players array
if (_index == -1) exitWith {false};
if (_score == -1) exitWith {false};

// Adjust score and save
KPR_players select _index set [5, (KPR_players select _index select 5) + _change];
[KPR_players] call KPR_fnc_savePlayers;
// Adjust score
_score = _score + _change;

// Prevent negative score
if (_score < 0) then {
_score = 0;
};

// Save new score
[_uid, _score] call KPR_fnc_setScore;

true
Loading

0 comments on commit c50bc02

Please sign in to comment.