server core pbo

This commit is contained in:
vbawol 2015-08-28 15:33:37 -05:00
parent c8a2c1363e
commit dadc11c46f
15 changed files with 407 additions and 1 deletions

View File

@ -0,0 +1,13 @@
/*
Hive Delete by Key
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveDEL.sqf
*/
//_PREFIX = _this select 0;
//_KEY = _this select 1;
"epochserver" callExtension format["400|%1:%2", _this select 0, _this select 1];

View File

@ -0,0 +1,21 @@
/*
Hive Expire
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveEXPIRE.sqf
*/
private ["_prefix","_key","_expires","_call"];
_prefix = _this select 0;
_key = _this select 1;
_expires = _this select 2;
_call = 131;
if !(EPOCH_hiveAsync) then {
_call = 130;
};
"epochserver" callExtension format ["%1|%2:%3|%4", _call, _prefix, _key, _expires];

View File

@ -0,0 +1,43 @@
/*
Hive Expire
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGET.sqf
*/
private ["_hiveResponse","_hiveStatus","_hiveMessage"];
//_PREFIX = _this select 0;
//_KEY = _this select 1;
_hiveStatus = -1;
_hiveMessage = "";
while {_hiveStatus < 0 || _hiveStatus == 2} do {
_hiveResponse = "epochserver" callExtension format ["200|%1:%2", _this select 0, _this select 1];
_hiveStatus = 0;
if (_hiveResponse != "") then {
_hiveResponse = call compile _hiveResponse;
if !(isNil "_hiveResponse") then {
if (typeName _hiveResponse == "ARRAY" && !(_hiveResponse isEqualTo [])) then {
_hiveStatus = _hiveResponse select 0;
if (_hiveStatus >= 1) then {
_hiveMessage = _hiveMessage + (_hiveResponse select 1);
};
};
};
};
};
if (_hiveStatus > 0 && _hiveMessage find "<null>" == -1) then {
_hiveMessage = call compile _hiveMessage;
if (isNil "_hiveMessage") then { _hiveMessage = [];}
}
else {
_hiveMessage = [];
};
[_hiveStatus, _hiveMessage]

View File

@ -0,0 +1,29 @@
/*
Hive Getbit
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETBIT.sqf
*/
private ["_hiveResponse","_hiveStatus","_hiveMessage"];
//_PREFIX = _this select 0;
//_KEY = _this select 1;
//_BIT = _this select 2;
_hiveMessage = false;
_hiveResponse = "epochserver" callExtension format["240|%1:%2|%3", _this select 0, _this select 1, _this select 2];
if (_hiveResponse != "") then {
_hiveResponse = call compile _hiveResponse;
if !(isNil "_hiveResponse") then {
if (typeName _hiveResponse == "ARRAY" && !(_hiveResponse isEqualTo[])) then {
if ((_hiveResponse select 0) == 1) then {
_hiveMessage = ((_hiveResponse select 1) == "1");
};
};
};
};
_hiveMessage

View File

@ -0,0 +1,68 @@
/*
Hive Getrange
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETRANGE.sqf
*/
private["_hiveResponse", "_hiveStatus", "_hiveMessage", "_currentIndex", "_hiveMakeCall", "_data"];
// GetRange
//_PREFIX = _this select 0;
//_KEY = _this select 1;
_hiveMessage = "";
_hiveStatus = 0;
_currentIndex = 0;
_hiveMakeCall = true;
while {_hiveMakeCall} do {
_hiveMakeCall = false;
// get 8k chars
_currentIndexMax = _currentIndex + 8000;
_hiveResponse = "epochserver" callExtension format["220|%1:%2|%3|%4", _this select 0, _this select 1, _currentIndex, (_currentIndexMax-1)];
//0 _hiveResponse: [1,""]
//diag_log format["%2:%3 _hiveResponse: %1", _hiveResponse, _currentIndex, count _hiveResponse];
if (_hiveResponse != "") then {
_hiveResponse = call compile _hiveResponse;
if !(isNil "_hiveResponse") then{
if (typeName _hiveResponse == "ARRAY" && !(_hiveResponse isEqualTo[])) then{
_hiveStatus = _hiveResponse select 0;
if (_hiveStatus == 1) then{
_data = _hiveResponse select 1;
if !(_data isEqualTo []) then{
// add data to string
_hiveMessage = _hiveMessage + _data;
// if data returned is exactly 8k chars then we likely need to make another call
if (count _data == 8000) then{
_currentIndex = _currentIndexMax;
_hiveMakeCall = true;
};
};
};
};
};
};
};
if (_hiveStatus == 1) then{
_hiveMessage = call compile _hiveMessage;
if (isNil "_hiveMessage") then{ _hiveMessage = []; }
};
[_hiveStatus, _hiveMessage]

View File

@ -0,0 +1,59 @@
/*
Hive Get w/ TTL
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveGETTTL.sqf
*/
private ["_hiveResponse","_hiveStatus","_hiveMessage","_whileCount"];
//_PREFIX = _this select 0;
//_KEY = _this select 1;
_hiveStatus = -1;
_hiveMessage = "";
_hiveTTL = -1;
_hiveResponse = "";
_whileCount = 0;
while {_hiveStatus < 0 || _hiveStatus == 2} do {
if (_whileCount == 0) then {
_hiveResponse = "epochserver" callExtension format ["210|%1:%2", _this select 0, _this select 1];
}
else {
_hiveResponse = "epochserver" callExtension format ["200|%1:%2", _this select 0, _this select 1];
};
_hiveStatus = 0;
if (_hiveResponse != "") then {
_hiveResponse = call compile _hiveResponse;
if !(isNil "_hiveResponse") then {
if (typeName _hiveResponse == "ARRAY" && !(_hiveResponse isEqualTo [])) then {
_hiveStatus = _hiveResponse select 0;
if (_hiveStatus >= 1) then {
if (_whileCount == 0) then {
_hiveTTL = _hiveResponse select 1;
_hiveMessage = _hiveMessage + (_hiveResponse select 2);
}
else {
_hiveMessage = _hiveMessage + (_hiveResponse select 1);
};
};
};
};
};
_whileCount = _whileCount + 1;
};
if (_hiveStatus > 0 && _hiveMessage find "<null>" == -1) then {
_hiveMessage = call compile _hiveMessage;
if (isNil "_hiveMessage") then { _hiveMessage = [];}
}
else {
_hiveMessage = [];
};
[_hiveStatus, _hiveMessage, _hiveTTL]

View File

@ -0,0 +1,14 @@
/*
Hive Log
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveLog.sqf
*/
//_PREFIX = _this select 0;
//_VAL = _this select 1;
"epochserver" callExtension format["700|%1|%2", _this select 0, _this select 1];

View File

@ -0,0 +1,54 @@
/*
Hive SET
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveSET.sqf
*/
private ["_prefix","_key","_value","_valueLength","_callStack","_call","_setterCall","_index","_charLimit"];
_prefix = _this select 0;
_key = _this select 1;
_value = str (_this select 2);
_valueLength = count _value;
_callStack = 101;
_call = 111;
if !(EPOCH_hiveAsync) then {
_setterCall = 100;
_call = 110;
};
_index = 0;
_charLimit = 8000;
if (_valueLength > _charLimit) then{
if (isNil "EPOCH_hiveCallID") then{
EPOCH_hiveCallID = 0;
} else {
if (EPOCH_hiveCallID > 10) then{
EPOCH_hiveCallID = 0;
};
EPOCH_hiveCallID = EPOCH_hiveCallID + 1;
};
while {_valueLength > _charLimit} do {
_valueLength = _valueLength - _charLimit;
"epochserver" callExtension format["%1|%2:%3|%4|%5", _callStack, _prefix, _key, EPOCH_hiveCallID, _value select[_index, _charLimit]];
//diag_log format["Append: %1", [_index, _callStack, _prefix, _key, EPOCH_hiveCallID, _value select[_index, _charLimit]]];
_index = _index + _charLimit;
};
"epochserver" callExtension format["%1|%2:%3|%4|%5", _call, _prefix, _key, EPOCH_hiveCallID, _value select[_index, _charLimit]];
//diag_log format["Large: %1", [_index, _call, _prefix, _key, EPOCH_hiveCallID, _value select[_index, _charLimit]]];
}
else {
"epochserver" callExtension format["%1|%2:%3|%4|%5", _call, _prefix, _key, "", _value select[_index, _charLimit]];
//diag_log format["Small: %1", [_index, _call, _prefix, _key, _value select[_index, _charLimit]]];
};

View File

@ -0,0 +1,19 @@
/*
Hive SETBit
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveSETBIT.sqf
*/
private ["_prefix","_key","_value","_bitIndex"];
_prefix = _this select 0;
_key = _this select 1;
_bitIndex = _this select 2;
_value = _this select 3;
"epochserver" callExtension format["141|%1:%2|%3|%4", _prefix, _key, _bitIndex, _value];

View File

@ -0,0 +1,54 @@
/*
Hive SETEX
by Aaron Clark - EpochMod.com
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
http://creativecommons.org/licenses/by-nc-nd/4.0/
Improvements and or bugfixes and other contributions are welcome via the github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveSETEX.sqf
*/
private ["_prefix","_key","_expires","_value","_valueLength","_callStack","_call","_index","_charLimit"];
_prefix = _this select 0;
_key = _this select 1;
_expires = _this select 2;
_value = str (_this select 3);
_valueLength = count _value;
_callStack = 101;
_call = 121;
if !(EPOCH_hiveAsync) then {
_callStack = 100;
_call = 120;
};
_index = 0;
_charLimit = 8000;
if (_valueLength > _charLimit) then{
if (isNil "EPOCH_hiveCallID") then{
EPOCH_hiveCallID = 0;
} else {
if (EPOCH_hiveCallID > 10) then{
EPOCH_hiveCallID = 0;
};
EPOCH_hiveCallID = EPOCH_hiveCallID + 1;
};
while {_valueLength > _charLimit} do {
_valueLength = _valueLength - _charLimit;
"epochserver" callExtension format["%1|%2:%3|%4|%5", _callStack, _prefix, _key, EPOCH_hiveCallID, _value select[_index, _charLimit]];
//diag_log format["Append: %1", [_index, _callStack, _prefix, _key, _value select[_index, _charLimit]]];
_index = _index + _charLimit;
};
"epochserver" callExtension format["%1|%2:%3|%4|%5|%6", _call, _prefix, _key, _expires, EPOCH_hiveCallID, _value select[_index, _charLimit]];
//diag_log format["Large: %1", [_index, _call, _prefix, _key, _expires, _value select[_index, _charLimit]]];
} else {
"epochserver" callExtension format["%1|%2:%3|%4|%5|%6", _call, _prefix, _key, _expires, "", _value select[_index, _charLimit]];
//diag_log format["Small: %1", [_index, _call, _prefix, _key, _expires, _value select[_index, _charLimit]]];
};

View File

@ -0,0 +1,32 @@
/****************************************************************************
Copyright (C) 2015 - ARMA 3 EPOCH MOD [EpochMod.com] (v0.3.3.0)
*****************************************************************************/
#define _ARMA_
class CfgPatches {
class A3_epoch_server_core {
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {};
};
};
class cfgFunctions
{
class A3E_CORE
{
tag = "EPOCH";
file = "\epoch_server_core\compile";
class epoch_hive {
file = "\epoch_server_core\compile\epoch_hive";
class server_hiveSET {};
class server_hiveSETBIT {};
class server_hiveSETEX {};
class server_hiveEXPIRE {};
class server_hiveGET {};
class server_hiveGETRANGexperimental branchE {};
class server_hiveGETBIT {};
class server_hiveGETTTL {};
class server_hiveDEL {};
};
};
};

View File

@ -33,7 +33,7 @@ if !(EPOCH_WeatherStaticForecast isEqualTo []) then {
} else {
// Make database call to get "Weather:InstanceID" that can be set in the database to allow for weather controls outside of the game.
_response = ["Weather", (call EPOCH_fn_InstanceID)] call EPOCH_server_hiveGETRANGE;
_response = ["Weather", (call EPOCH_fn_InstanceID)] call EPOCH_fnc_server_hiveGETRANGE;
if ((_response select 0) == 1 && typeName(_response select 1) == "ARRAY" && !((_response select 1) isEqualTo[])) then {
_arr = _response select 1;
_tempOVRD = _arr select 0;