mirror of
https://github.com/Bjanski/ExAd.git
synced 2024-08-30 16:52:14 +00:00
added Scratchie plugin
This commit is contained in:
parent
ef5cdffcc5
commit
fc41f89e57
45
docs/Scratchie/installation.md
Normal file
45
docs/Scratchie/installation.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Introduction
|
||||
|
||||
PLEASE NOTE THIS GUIDE ONLY COVERES THE ExAd MISSION FILE INSTALLATION.<br />
|
||||
THE MISSING SERVER AND DATABASE INSTRUCTION CAN BE FOUND [HERE](https://github.com/ole1986/a3-exile-scratchie/tree/ExAd)
|
||||
|
||||
**Requirements**
|
||||
|
||||
Please note that the Scratchie plugin has the following ExAd dependencies
|
||||
|
||||
* Core
|
||||
* XM8
|
||||
|
||||
**Installation**
|
||||
|
||||
* Copy the folder "source\ExAdClient\Scratchie" into "mpmissions\exile.\ExAdClient"
|
||||
|
||||
* Open the "mpmissions\exile.\ExAdClient\CfgFunctions.cpp" and add the following line inside `class ExAd`
|
||||
|
||||
```
|
||||
#include "Scratchie\CfgFunctions.cpp"
|
||||
```
|
||||
|
||||
* Amend the `class CfgXM8` from "mpmissions\exile.\config.cpp" the following (to make Scratchie app available in XM8)
|
||||
|
||||
```
|
||||
class CfgXM8 {
|
||||
extraApps[] = {"ExAd_Scratchie"};
|
||||
|
||||
class ExAd_Scratchie
|
||||
{
|
||||
title = "Play Scratchie";
|
||||
controlID = 80000;
|
||||
logo = "ExAdClient\Scratchie\icons\scratchie.paa";
|
||||
onLoad = "ExAdClient\Scratchie\onLoad.sqf";
|
||||
onOpen = "ExAdClient\Scratchie\onOpen.sqf";
|
||||
onClose = "ExAdClient\Scratchie\onClose.sqf";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
* Customize the "mpmissions\exile.\description.ext" by adding the below line into `class CfgRemoteExec` -> `class Functions`
|
||||
|
||||
```
|
||||
class ExileServer_lottery_network_request { allowedTargets = 2; }
|
||||
```
|
@ -0,0 +1,3 @@
|
||||
class Scratchie {
|
||||
class postInitScratchie {file = "ExAdClient\Scratchie\postInit.sqf"; postInit = 1;};
|
||||
}
|
Binary file not shown.
Binary file not shown.
BIN
mpmissions/Exile.Altis/ExAdClient/Scratchie/icons/scratchie.paa
Normal file
BIN
mpmissions/Exile.Altis/ExAdClient/Scratchie/icons/scratchie.paa
Normal file
Binary file not shown.
4
mpmissions/Exile.Altis/ExAdClient/Scratchie/onClose.sqf
Normal file
4
mpmissions/Exile.Altis/ExAdClient/Scratchie/onClose.sqf
Normal file
@ -0,0 +1,4 @@
|
||||
if (ExileClientXM8CurrentSlide == "ExAd_Scratchie") then {
|
||||
ExileClientXM8CurrentSlide = "apps";
|
||||
};
|
||||
ExAdCurFlagNetId = nil;
|
51
mpmissions/Exile.Altis/ExAdClient/Scratchie/onLoad.sqf
Normal file
51
mpmissions/Exile.Altis/ExAdClient/Scratchie/onLoad.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
onLoad.sqf
|
||||
|
||||
Copyright 2017 ole
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
params["_display","_slide","_idc"];
|
||||
|
||||
_pW = 0.025;
|
||||
_pH = 0.04;
|
||||
_leftCol = 0;
|
||||
_leftColW = 10;
|
||||
|
||||
_margin = 0.02;
|
||||
|
||||
_posX = _margin + _leftCol * _pW;
|
||||
|
||||
_slideClass = "ExAd_Scratchie";
|
||||
|
||||
// fixing index issue from ExAd_fnc_getNextIDC and ExAd_fnc_getAppCtrl
|
||||
[_slideClass,"dummy"] call ExAd_fnc_getNextIDC;
|
||||
|
||||
[_display,_slide,([_slideClass,"InfoTitle"] call ExAd_fnc_getNextIDC),[_leftCol * _pW, 2.75 * _pH, 20 * _pW, 2 * _pH],"Counting Scratchies...","PuristaMedium",1.2,"#ffffff","left",1] call ExAd_fnc_createStructuredText;
|
||||
[_display,_slide,([_slideClass,"backButton"] call ExAd_fnc_getNextIDC),[27.6 * _pW, 17.7 * _pH, 6 * _pW, 1 * _pH],'["extraApps", 1] call ExileClient_gui_xm8_slide;','Back'] call ExAd_fnc_createButton;
|
||||
|
||||
/* Buy button */
|
||||
[_display,_slide,([_slideClass,"picBuy"] call ExAd_fnc_getNextIDC),[_posX, 5 * _pH, _leftColW * _pW, 7 * _pH],"ExAdClient\Scratchie\icons\scratchie-buy.paa",[1,1,1,1],false,false,""] call ExAd_fnc_createPicture;
|
||||
[_display,_slide,([_slideClass,"buyButton"] call ExAd_fnc_getNextIDC),[_posX, 12 * _pH, _leftColW*_pW, 1*_pH],"['buy',ExileClientSessionId, player, ''] remoteExecCall ['ExileServer_lottery_network_request', 2]; [] spawn Scratchie_UpdateCount;",'Buy Scratchie',""] call ExAd_fnc_createButton;
|
||||
|
||||
/* Use button */
|
||||
_posX = _posX + _margin + _leftColW * _pW;
|
||||
[_display,_slide,([_slideClass,"picUse"] call ExAd_fnc_getNextIDC),[_posX, 5 * _pH, _leftColW * _pW, 7 * _pH],"ExAdClient\Scratchie\icons\scratchie.paa",[1,1,1,1],false,false,""] call ExAd_fnc_createPicture;
|
||||
[_display,_slide,([_slideClass,"useButton"] call ExAd_fnc_getNextIDC),[_posX, 12 * _pH, _leftColW * _pW, 1 * _pH],"['use',ExileClientSessionId, player, ''] remoteExecCall ['ExileServer_lottery_network_request', 2]; [] spawn Scratchie_UpdateCount;",'Use Scratchie',""] call ExAd_fnc_createButton;
|
||||
|
||||
/* Get Prize button */
|
||||
_posX = _posX + _margin + _leftColW * _pW;
|
||||
[_display,_slide,([_slideClass,"picPrize"] call ExAd_fnc_getNextIDC),[_posX, 5 * _pH, _leftColW * _pW, 7 * _pH],"ExAdClient\Scratchie\icons\scratchie-prize.paa",[1,1,1,1],false,false,""] call ExAd_fnc_createPicture;
|
||||
[_display,_slide,([_slideClass,"useButton"] call ExAd_fnc_getNextIDC),[_posX, 12 * _pH, _leftColW * _pW, 1 * _pH],"['get',ExileClientSessionId, player, ''] remoteExecCall ['ExileServer_lottery_network_request', 2];",'Get Prize',""] call ExAd_fnc_createButton;
|
||||
|
||||
true
|
18
mpmissions/Exile.Altis/ExAdClient/Scratchie/onOpen.sqf
Normal file
18
mpmissions/Exile.Altis/ExAdClient/Scratchie/onOpen.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
private ["_flags","_flag"];
|
||||
|
||||
try
|
||||
{
|
||||
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
|
||||
if(isNull _display)exitWith{
|
||||
throw "XM8 not loaded!";
|
||||
};
|
||||
|
||||
diag_log "Opening Scratchies slide";
|
||||
|
||||
[] spawn Scratchie_UpdateCount;
|
||||
}
|
||||
catch
|
||||
{
|
||||
["ErrorTitleAndText", ["ExAd - Scratchies", _exception]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
["extraApps", 1] call ExileClient_gui_xm8_slide
|
||||
}
|
34
mpmissions/Exile.Altis/ExAdClient/Scratchie/postInit.sqf
Normal file
34
mpmissions/Exile.Altis/ExAdClient/Scratchie/postInit.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
postInit.sqf - Scratchie postInit used for ExAd
|
||||
|
||||
Copyright 2017 - ole1986
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
if (isDedicated) exitWith {};
|
||||
|
||||
private _code = {
|
||||
disableSerialization;
|
||||
|
||||
private _display = uiNameSpace getVariable ["RscExileXM8", displayNull];
|
||||
private _ctrl = [_display,"ExAd_Scratchie","InfoTitle"] call ExAd_fnc_getAppCtrl;
|
||||
|
||||
_ctrl ctrlSetStructuredText parseText "Counting Scratchies...";
|
||||
sleep 3;
|
||||
_ctrl ctrlSetStructuredText parseText (format ["You have <t color='#1ab42e'>%1 Scratchies</t> in your pocket", missionNamespace getVariable ["scratchieCount", 0]]);
|
||||
};
|
||||
|
||||
missionNamespace setVariable ['Scratchie_UpdateCount', _code];
|
||||
|
||||
diag_log "Loaded Scratchie postInit";
|
Loading…
Reference in New Issue
Block a user