Add notification messages for group changes

This commit is contained in:
ebaydayz
2016-11-08 16:39:50 -05:00
parent ba43900036
commit 32b9c84784
9 changed files with 36 additions and 26 deletions

View File

@@ -13,5 +13,4 @@ dayz_groupDisbandThread = _group spawn {
{[_x] joinSilent grpNull} count (units _this);
deleteGroup _this;
dayz_myGroup = [];
};

View File

@@ -1,5 +1,5 @@
// Two second loop
private ["_count","_found","_group","_hasGPS","_index","_marker","_markBody","_markGroup","_markSelf","_pos","_self","_uid","_vehicle"];
private ["_count","_found","_group","_hasGPS","_index","_marker","_markBody","_markGroup","_markSelf","_pos","_self","_vehicle"];
_group = player call dayz_filterGroup;
@@ -10,14 +10,6 @@ if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)})
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
};
{
_uid = getPlayerUID _x;
if (!(_uid in dayz_myGroup) && _x != player) then {
dayz_myGroup set [count dayz_myGroup,_uid];
systemChat format [localize "STR_EPOCH_PLAYER_JOINED",name _x];
};
} count _group;
if (visibleMap or !isNull findDisplay 88890) then {
_hasGPS = "ItemGPS" in items player;
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));

View File

@@ -3,8 +3,14 @@ private ["_add","_inviter","_recipient","_uid","_unit"];
_add = _this select 0;
_uid = _this select 1;
if (typeName _add == "OBJECT") exitWith {
(group player) selectLeader _add;
if (typeName _add == "SCALAR") exitWith {
switch _add do {
case -1: { (group player) selectLeader _uid; }; //Promote
case 1: { systemChat format[localize "STR_EPOCH_PLAYER_JOINED",_uid]; };
case 2: { systemChat format[localize "STR_EPOCH_PLAYER_KICKED",name (_uid call dayz_getPlayer)]; };
case 3: { systemChat format[localize "STR_EPOCH_PLAYER_LEFT",_uid]; };
case 4: { localize "STR_EPOCH_GROUP_DISBANDED" call dayz_rollingMessages; };
};
};
// Update active invites on all machines with the change

View File

@@ -13,7 +13,7 @@ if (count dayz_myGroup > 1 && {!dayz_requireRadio or {dayz_requireRadio && "Item
_oldGroup = group player;
[player] joinSilent _x;
if (count (units _oldGroup) == 0) then {deleteGroup _oldGroup;};
systemChat format [localize "STR_EPOCH_REJOINED_GROUP",name _leader];
format[localize "STR_EPOCH_REJOINED_GROUP",name _leader] call dayz_rollingMessages;
// Update saved group in DB
PVDZ_Server_UpdateGroup = [1,player];

View File

@@ -27,12 +27,6 @@ if (!isNull _inviter) then {
_oldGroup = group player;
[player] joinSilent (group _inviter);
if (count (units _oldGroup) == 0) then {deleteGroup _oldGroup;};
{
_uid = getPlayerUID _x;
if !(_uid in dayz_myGroup) then {
dayz_myGroup set [count dayz_myGroup,_uid];
};
} count (units group player);
// Update saved group in DB
PVDZ_Server_UpdateGroup = [1,player];

View File

@@ -8,7 +8,6 @@ _target = _targetUID call dayz_getPlayer;
if (isNull _target or _target == player or player != leader group player) exitWith {};
[_target] joinSilent grpNull;
dayz_myGroup = dayz_myGroup - [_targetUID];
PVDZ_Server_UpdateGroup = [2,player,_targetUID];
publicVariableServer "PVDZ_Server_UpdateGroup";

View File

@@ -11,5 +11,4 @@ dayz_groupLeaveThread = [] spawn {
//Wait for response from server to confirm group finished updating in DB
waitUntil {!isNil "dayz_groupLeft"};
[player] joinSilent grpNull;
dayz_myGroup = [];
};

View File

@@ -1,7 +1,8 @@
private ["_event","_groupUIDs","_newGroup","_player","_playerUID","_save"];
private ["_event","_groupUIDs","_name","_newGroup","_player","_playerUID","_save","_unit"];
_event = _this select 0;
_player = _this select 1;
_name = if (alive _player) then {name _player} else {"unknown"};
_playerUID = getPlayerUID _player;
if (_event < 3) then {
@@ -11,7 +12,7 @@ if (_event < 3) then {
if (_event == -1) exitWith {
//Promote _player
PVDZ_groupInvite = [_player,0];
PVDZ_groupInvite = [-1,_player];
(owner (leader group _player)) publicVariableClient "PVDZ_groupInvite";
};
@@ -28,7 +29,8 @@ _newGroup = switch _event do {
case 1: {_groupUIDs};
//Kick (target was already kicked from group)
case 2: {
format["CHILD:204:%1:%2:%3:",(_this select 2),dayZ_instance,[]] call server_hiveWrite;
_name = _this select 2; //Kicked player's UID
format["CHILD:204:%1:%2:%3:",_name,dayZ_instance,[]] call server_hiveWrite;
_groupUIDs
};
//Leave
@@ -39,14 +41,24 @@ _newGroup = switch _event do {
};
//Disband
case 4: {
_name = 0; //Not needed
dayz_groupDisbanded = true;
(owner _player) publicVariableClient "dayz_groupDisbanded";
[]
};
};
// Update all group members' saved group in DB
//Update all group members' saved group in DB
{
_save = if (_event == 3 && _x == _playerUID) then {[]} else {_newGroup};
format["CHILD:204:%1:%2:%3:",_x,dayZ_instance,_save] call server_hiveWrite;
} count _groupUIDs;
} count _groupUIDs;
//Notify group members of the change
PVDZ_groupInvite = [_event,_name];
{
_unit = getPlayerUID _x;
if (_unit in _groupUIDs && {_unit != _playerUID}) then {
owner _x publicVariableClient "PVDZ_groupInvite";
};
} count allUnits;

View File

@@ -16317,6 +16317,12 @@
<English>You invited %1 to join the group.</English>
<German>Du hast %1 eingeladen der Gruppe beizutreten.</German>
</Key>
<Key ID="STR_EPOCH_PLAYER_KICKED">
<English>%1 was kicked from the group.</English>
</Key>
<Key ID="STR_EPOCH_PLAYER_LEFT">
<English>%1 left the group.</English>
</Key>
<Key ID="STR_EPOCH_PLAYER_JOINED">
<English>%1 joined the group.</English>
<German>%1 ist der Gruppe beigetreten.</German>
@@ -16357,6 +16363,9 @@
<Russian>распускать</Russian>
<German>Auflösen</German>
</Key>
<Key ID="STR_EPOCH_GROUP_DISBANDED">
<English>The group disbanded</English>
</Key>
<Key ID="STR_EPOCH_LEAVE">
<English>Leave</English>
<Russian>Оставлять</Russian>