karma changes(deaths, suicides, pvp, revives, trades, tradersKilled)

This commit is contained in:
DESKTOP-UH65DCE\MusTanG 2017-09-24 15:01:54 -05:00
parent 2f292d889a
commit 01446e50ad
4 changed files with 75 additions and 4 deletions

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayer.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_bankBalance","_bankData","_cIndex","_current_crypto","_defaultVars","_playerName","_playerUID","_pos","_response","_triggerType","_vars","_killerUID","_deathType","_killerCommunityStats","_mIndex","_current_murders","_communityStats","_sIndex","_current_suicides","_dIndex","_current_deaths"];
private ["_bankBalance","_bankData","_cIndex","_current_crypto","_defaultVars","_playerName","_playerUID","_pos","_response","_triggerType","_vars","_killerUID","_deathType","_killerCommunityStats","_mIndex","_current_murders","_communityStats","_sIndex","_current_suicides","_dIndex","_current_deaths","_playerKarmaAdj","_killerKarmaAdj","_kIndex","_playerCStats","_playerKarma","_playerIsNeutral","_playerIsBandit","_playerIsHero","_killerCStats","_killerKarma"];
//[[[end]]]
params ["_playerObj","_killer","_playerName",["_token","",[""]] ];
@ -23,9 +23,21 @@ if !([_playerObj, _token] call EPOCH_server_getPToken) exitWith{};
_playerUID = getPlayerUID _playerObj;
_killerUID = getPlayerUID _killer;
_pos = getposATL _playerObj;
// find player's Karma status
_kIndex = EPOCH_communityStats find "Karma";
_playerCStats = _playerObj getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_playerKarma = _playerCStats select _kIndex;
_playerIsNeutral = (_playerKarma < 5000 && _playerKarma > -5000);
_playerIsBandit = (_playerKarma <= -5000);
_playerIsHero = (_playerKarma >= 5000);
// default deathType is suicide
_deathType = 666;
_playerKarmaAdj = -2;
if (_playerObj != _killer) then {
_playerKarmaAdj = -5;
if (random 1 <= EPOCH_antagonistChancePDeath) then {
_triggerType = 2;
if (surfaceIsWater _pos) then {
@ -41,8 +53,36 @@ if (_playerObj != _killer) then {
['deathlog', format['%1 (%2) Killed By %3 (%4) with weapon %5 from %6m at %7', _playerName, _playerUID, name _killer, _killerUID, currentWeapon _killer, _playerObj distance _killer, _pos]] call EPOCH_fnc_server_hiveLog;
// player karma changes
if(_playerIsNeutral)then{_playerKarmaAdj = abs((-_playerKarma) * 0.03)};
if(_playerIsBandit)then{_playerKarmaAdj = abs((-_playerKarma) * 0.055)};
if(_playerIsHero)then{_playerKarmaAdj = abs((-_playerKarma) * 0.025)};
if!(_killerUID isEqualTo "")then{
[_killer, "Murders", 1, true] call EPOCH_server_updatePlayerStats;
// find killer's Karma status
_killerCStats = _killer getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_killerKarma = _killerCStats select _kIndex;
// killer karma changes
_killerKarmaAdj = -5;
if(_killerKarma < 5000 && _killerKarma > -5000)then{
if(_playerIsNeutral)then{_killerKarmaAdj = abs((-_killerKarma) * 0.03) + _playerKarmaAdj};
if(_playerIsBandit)then{_killerKarmaAdj = abs((_killerKarma) * 0.05) + _playerKarmaAdj};
if(_playerIsHero)then{_killerKarmaAdj = abs((-_killerKarma) * 0.025) + _playerKarmaAdj};
};
if(_killerKarma <= -5000)then{
if(_playerIsNeutral)then{_killerKarmaAdj = abs((_killerKarma) * 0.05) + _playerKarmaAdj};
if(_playerIsBandit)then{_killerKarmaAdj = abs((-_killerKarma) * 0.15) + _playerKarmaAdj};
if(_playerIsHero)then{_killerKarmaAdj = abs((_killerKarma) * 0.15) + _playerKarmaAdj};
};
if(_killerKarma >= 5000)then{
if(_playerIsNeutral)then{_killerKarmaAdj = abs((-_killerKarma) * 0.10) + _playerKarmaAdj};
if(_playerIsBandit)then{_killerKarmaAdj = abs((_killerKarma) * 0.15) + _playerKarmaAdj};
if(_playerIsHero)then{_killerKarmaAdj = abs((-_killerKarma) * 0.25) + _playerKarmaAdj};
};
[_killer, "Karma", _killerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
};
_deathType = 1;
};
@ -50,9 +90,11 @@ if (_playerObj != _killer) then {
switch(_deathType)do{
case 666: {
[_playerObj, "Suicides", 1] call EPOCH_server_updatePlayerStats;
[_playerObj, "Karma", _playerKarmaAdj] call EPOCH_server_updatePlayerStats;
};
case 1: {
[_playerObj, "Deaths", 1] call EPOCH_server_updatePlayerStats;
[_playerObj, "Karma", _playerKarmaAdj] call EPOCH_server_updatePlayerStats;
};
};
_defaultVars = call EPOCH_defaultVars_SEPXVar;

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_loadout","_CorpseCrypto","_PlayerCrypto","_attachments","_cIndex","_class","_currwh","_deleteprimary","_deletesecondary","_dir","_droppedPrimary","_droppedSecondary","_droppedWeapons","_equipped","_group","_location","_newPlyr","_playerGroup","_playerUID","_primaryWeapon","_secondaryWeapon","_token","_type","_vars","_wMags","_wMagsArray","_weapon","_wh"];
private ["_loadout","_CorpseCrypto","_PlayerCrypto","_attachments","_cIndex","_class","_currwh","_deleteprimary","_deletesecondary","_dir","_droppedPrimary","_droppedSecondary","_droppedWeapons","_equipped","_group","_location","_newPlyr","_playerGroup","_playerUID","_primaryWeapon","_secondaryWeapon","_token","_type","_vars","_wMags","_wMagsArray","_weapon","_wh","_kIndex","_reviver","_reviverCStats","_reviverKarma","_reviverKarmaAdj"];
//[[[end]]]
params ["_player","_reviver",["_token","",[""]] ];
@ -203,6 +203,14 @@ if (!local _player) then {
// send stat to reviver
[_reviver, "Revives", 1, true] call EPOCH_server_updatePlayerStats;
// send karma stat to reviver
_kIndex = EPOCH_communityStats find "Karma";
_reviverCStats = _reviver getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_reviverKarma = _reviverCStats select _kIndex;
_reviverKarmaAdj = 5;
if(_reviverKarma < 0)then{_reviverKarmaAdj = -5};
[_reviver, "Karma", _reviverKarmaAdj, true] call EPOCH_server_updatePlayerStats;
};
};
};

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_server/EPOCH_server_traderKilled.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_marker","_objHiveKey","_slot"];
private ["_marker","_objHiveKey","_slot","_playerCStats","_playerKarma","_playerKarmaAdj","_kIndex"];
//[[[end]]]
params ["_trader","_player"];
if (!isNull _trader) then {
@ -28,4 +28,11 @@ if (!isNull _trader) then {
_objHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID), _slot];
["AI", _objHiveKey] call EPOCH_fnc_server_hiveDEL;
};
// send karma stat to seller
_kIndex = EPOCH_communityStats find "Karma";
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_playerKarma = _playerCStats select _kIndex;
_playerKarmaAdj = -5;
if(_playerKarma < 0)then{_playerKarmaAdj = 5};
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
};

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_MaxBankDebit","_SkipOut","_VAL","_aiItems","_bankBalance","_bankData","_cIndex","_config","_currQty","_current_crypto","_current_cryptoRaw","_errorMsg","_final_location","_foundSmoke","_group","_helipad","_helipads","_item","_itemClasses","_itemQty","_itemQtys","_itemTax","_itemWorth","_itemsIn","_itemsOut","_lockOwner","_makeTradeIn","_message","_nearByHolder","_objHiveKey","_objOwner","_playerCryptoLimit","_playerGroup","_playerNetID","_playerUID","_position","_qtyIndex","_response","_return","_returnIn","_returnOut","_road","_serverSettingsConfig","_slot","_smoke","_tax","_tmpposition","_tradeIn","_tradeOut","_tradeQtyTotal","_tradeTotal","_vars","_vehHiveKey","_vehObj","_vehSlot","_vehicle","_vehicleBought","_vehicleSold","_vehicles","_vehslot","_wH","_wHPos","_wp"];
private ["_MaxBankDebit","_SkipOut","_VAL","_aiItems","_bankBalance","_bankData","_cIndex","_config","_currQty","_current_crypto","_current_cryptoRaw","_errorMsg","_final_location","_foundSmoke","_group","_helipad","_helipads","_item","_itemClasses","_itemQty","_itemQtys","_itemTax","_itemWorth","_itemsIn","_itemsOut","_lockOwner","_makeTradeIn","_message","_nearByHolder","_objHiveKey","_objOwner","_playerCryptoLimit","_playerGroup","_playerNetID","_playerUID","_position","_qtyIndex","_response","_return","_returnIn","_returnOut","_road","_serverSettingsConfig","_slot","_smoke","_tax","_tmpposition","_tradeIn","_tradeOut","_tradeQtyTotal","_tradeTotal","_vars","_vehHiveKey","_vehObj","_vehSlot","_vehicle","_vehicleBought","_vehicleSold","_vehicles","_vehslot","_wH","_wHPos","_wp","_kIndex","_playerCStats","_playerKarma","_playerKarmaAdj"];
//[[[end]]]
params ["_trader","_itemsIn","_itemsOut","_player",["_token","",[""]] ];
@ -118,6 +118,13 @@ if (_slot != -1) then {
_current_crypto = _current_crypto + _itemWorth;
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
};
// send karma stat to seller
_kIndex = EPOCH_communityStats find "Karma";
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_playerKarma = _playerCStats select _kIndex;
_playerKarmaAdj = 1;
if(_playerKarma > 0)then{_playerKarmaAdj = -1};
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
};
};
} forEach _itemsIn;
@ -294,6 +301,13 @@ if (_slot != -1) then {
_current_crypto = _current_crypto - _itemWorth;
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
};
// send karma stat to buyer
_kIndex = EPOCH_communityStats find "Karma";
_playerCStats = _player getVariable["COMMUNITY_STATS", EPOCH_defaultStatVars];
_playerKarma = _playerCStats select _kIndex;
_playerKarmaAdj = 1;
if(_playerKarma > 0)then{_playerKarmaAdj = -1};
[_player, "Karma", _playerKarmaAdj, true] call EPOCH_server_updatePlayerStats;
};
};
};