Revert the last two commits

This reverts commits b5f3f30 and 3e0ddef.

Discussed with oiad on discord:
- BIS_fnc_areEqual is much slower than short string comparisons
- String in array form is three times longer, which means more data sent over the network

This way keeps authKey as a string and still avoids pvval kicks.
This commit is contained in:
ebayShopper
2018-01-21 13:54:20 -05:00
parent 3e0ddef7b1
commit d48c9070e8
4 changed files with 8 additions and 7 deletions

View File

@@ -217,10 +217,10 @@ _playerObj setVariable ["lastPos",getPosATL _playerObj];
_clientID = owner _playerObj;
_randomKey = [];
_randomInput = toArray "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$^*";
for "_i" from 0 to 12 do {
_randomKey set [count _randomKey, (_randomInput call BIS_fnc_selectRandom)];
_randomKey set [_i, (ceil(random 128)) + 256]; //Latin Extended-A characters not filtered in publicvariableval.txt
};
_randomKey = toString _randomKey;
_findIndex = dayz_serverPUIDArray find _playerID;
if (_findIndex > -1) then {
dayz_serverClientKeys set [_findIndex, [_clientID,_randomKey]];

View File

@@ -188,11 +188,11 @@ _object_killed = {
_exitReason = switch true do {
//Can't use owner because player may already be dead, can't use distance because player may be far from vehicle wreck
case ([_clientKey,dayz_serverKey] call BIS_fnc_areEqual): {""};
case (_clientKey == dayz_serverKey): {""};
case (_index < 0): {
format["Server_UpdateObject error: PUID NOT FOUND ON SERVER. PV ARRAY: %1",_this]
};
case !([((dayz_serverClientKeys select _index) select 1),_clientKey] call BIS_fnc_areEqual): {
case ((dayz_serverClientKeys select _index) select 1 != _clientKey): {
format["Server_UpdateObject error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %1",_this]
};
case (alive _object && {!(_class isKindOf "TentStorage_base" or _class isKindOf "IC_Tent")}): {

View File

@@ -26,7 +26,7 @@ _exitReason = switch true do {
case (_index < 0): {
format["%1 error: PUID NOT FOUND ON SERVER. PV ARRAY: %2",_function,_params]
};
case (((dayz_serverClientKeys select _index) select 0 != owner _player) or !([((dayz_serverClientKeys select _index) select 1),_clientKey] call BIS_fnc_areEqual)): {
case (((dayz_serverClientKeys select _index) select 0 != owner _player) or ((dayz_serverClientKeys select _index) select 1 != _clientKey)): {
format["%1 error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %2",_function,_params]
};
default {""};