Skip to content

Commit

Permalink
Merge pull request #81 from GNCLORD-MDB/update_Sektorcontrol_punkteer…
Browse files Browse the repository at this point in the history
…fassung

Update sektorcontrol punkteerfassung
  • Loading branch information
gelir95 authored Sep 13, 2020
2 parents 312fd38 + 5b6bdd2 commit e6d594e
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 56 deletions.
2 changes: 1 addition & 1 deletion addons/OPT/GELDZEIT/fn_serverInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ DFUNC(Mission_Ende) =
ERROR_LOG("Missionende: Fehlehalte Datenübergabe keine Fraktionauswahl erkannt");
};
};
["Mission", "End", [GVAR(nato_points), GVAR(csat_points), GVAR(aaf_points), missionName]] call OPT_LOGGING_fnc_writelog;
["Mission", "End", [OPT_SECTORCONTROL_nato_points, OPT_SECTORCONTROL_csat_points, OPT_SECTORCONTROL_aaf_points, missionName]] call OPT_LOGGING_fnc_writelog;

};

Expand Down
160 changes: 106 additions & 54 deletions addons/OPT/SECTORCONTROL/fn_Punkte.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

#include "macros.hpp"

//Init
GVAR(csat_points_f)=0;
GVAR(nato_points_f)=0;
GVAR(aaf_points_f)=0;
GVAR(points_logtime) =0;

GVAR(Punktecount) = [{

// Logge und übertrage Punktestand alle 60 Sekunden, solange Spiel noch läuft
Expand All @@ -30,39 +36,54 @@ GVAR(Punktecount) = [{

if (GVAR(dominator) isEqualTo east) then
{

GVAR(csat_points) = GVAR(csat_points) + 1;
publicVariable QGVAR(csat_points);
private _message = format ["CSAT +1 (AAF %1 | CSAT %2)", GVAR(aaf_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

GVAR(csat_points_f) = GVAR(csat_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(csat_points_f);
if (round GVAR(csat_points_f) > GVAR(csat_points)) then
{
GVAR(csat_points) = round GVAR(csat_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(csat_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["CSAT +1 (AAF %1 | CSAT %2)", GVAR(aaf_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

if (GVAR(dominator) isEqualTo independent) then
{

GVAR(aaf_points) = GVAR(aaf_points) + 1;
publicVariable QGVAR(aaf_points);
private _message = format ["AAF +1 (AAF %1 | CSAT %2)", GVAR(AAF_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
GVAR(aaf_points_f) = GVAR(aaf_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(aaf_points_f);
if (round GVAR(aaf_points_f) > GVAR(aaf_points)) then
{
GVAR(aaf_points) = round GVAR(aaf_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(aaf_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["AAF +1 (AAF %1 | CSAT %2)", GVAR(AAF_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

}
else
{

if ((serverTime - GVAR(points_logtime)) >= 60) then // letzter logeintrag 1 Minute alt?
{
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["Kein Dominator (AAF %1 | CSAT %2)", GVAR(aaf_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

};
};
};

Expand All @@ -75,38 +96,54 @@ GVAR(Punktecount) = [{
if (GVAR(dominator) isEqualTo east) then
{

GVAR(csat_points) = GVAR(csat_points) + 1;
publicVariable QGVAR(csat_points);
private _message = format ["CSAT +1 (NATO %1 | CSAT %2)", GVAR(nato_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

GVAR(csat_points_f) = GVAR(csat_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(csat_points_f);
if (round GVAR(csat_points_f) > GVAR(csat_points)) then
{
GVAR(csat_points) = round GVAR(csat_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(csat_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["CSAT +1 (NATO %1 | CSAT %2)", GVAR(nato_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

if (GVAR(dominator) isEqualTo west) then
{

GVAR(nato_points) = GVAR(nato_points) + 1;
publicVariable QGVAR(nato_points);
private _message = format ["NATO +1 (NATO %1 | CSAT %2)", GVAR(nato_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
GVAR(nato_points_f) = GVAR(nato_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(nato_points_f);
if (round GVAR(nato_points_f) > GVAR(nato_points)) then
{
GVAR(nato_points) = round GVAR(nato_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(nato_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["NATO +1 (NATO %1 | CSAT %2)", GVAR(nato_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

}
else
{

if ((serverTime - GVAR(points_logtime)) >= 60) then // letzter logeintrag 1 Minute alt?
{
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["Kein Dominator (NATO %1 | CSAT %2)", GVAR(nato_points), GVAR(csat_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

};
};
};

Expand All @@ -119,39 +156,54 @@ GVAR(Punktecount) = [{
if (GVAR(dominator) isEqualTo west) then
{

GVAR(nato_points) = GVAR(nato_points) + 1;
publicVariable QGVAR(nato_points);
private _message = format ["NATO +1 (NATO %1 | AAF %2)", GVAR(nato_points), GVAR(aaf_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

GVAR(nato_points_f) = GVAR(nato_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(nato_points_f);
if (round GVAR(nato_points_f) > GVAR(nato_points)) then
{
GVAR(nato_points) = round GVAR(nato_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(nato_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["NATO +1 (NATO %1 | AAF %2)", GVAR(nato_points), GVAR(aaf_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

if (GVAR(dominator) isEqualTo independent) then
{

GVAR(aaf_points) = GVAR(aaf_points) + 1;
publicVariable QGVAR(aaf_points);
private _message = format ["AAF +1 (Nato %1 | AAF %2)", GVAR(nato_points), GVAR(aaf_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

GVAR(aaf_points_f) = GVAR(aaf_points_f) + (1 / 60); // 1 Punkt pro Minute
publicVariable QGVAR(aaf_points_f);
if (round GVAR(aaf_points_f) > GVAR(aaf_points)) then
{
GVAR(aaf_points) = round GVAR(aaf_points_f); // übernahme in bisherige integer-zählweise
publicVariable QGVAR(aaf_points);
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["AAF +1 (Nato %1 | AAF %2)", GVAR(nato_points), GVAR(aaf_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];
};
};

}
else
{

if ((serverTime - GVAR(points_logtime)) >= 60) then // letzter logeintrag 1 Minute alt?
{
GVAR(points_logtime) = serverTime;
publicVariable QGVAR(points_logtime);
private _message = format ["Kein Dominator (NATO %1 | AAF %2)", GVAR(nato_points), GVAR(aaf_points)];
private _timestamp = [serverTime - OPT_GELDZEIT_startTime] call CBA_fnc_formatElapsedTime;

//Log
diag_log format["[%1] (%2) Log: %3 --- %4","OPT","Fahne",_timestamp,_message];

};
};
};

Expand All @@ -168,4 +220,4 @@ GVAR(Punktecount) = [{
};
};

}, 60] call CFUNC(addPerFrameHandler);
}, 1] call CFUNC(addPerFrameHandler);
1 change: 0 additions & 1 deletion addons/OPT/SECTORCONTROL/fn_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ GVAR(aaf_flags) = [];
{
private _cursorObject = cursorObject;
if (
(_cursorObject in GVAR(nato_flags) or _cursorObject in GVAR(csat_flags) or _cursorObject in GVAR(aaf_flags)) and
[_cursorObject, player] call FUNC(captureFlagCondition)
) then {
[_cursorObject, player] call FUNC(captureFlag);
Expand Down

0 comments on commit e6d594e

Please sign in to comment.