Skip to content

Commit

Permalink
bodybag fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Nov 13, 2023
1 parent 9af7f83 commit 51bdfe2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
23 changes: 12 additions & 11 deletions arma/client/addons/bodybag/functions/fnc_contents.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

params ["_bodybag"];

private _items = [];

_items pushBack (getBackpackCargo _bodybag);
_items pushBack (getItemCargo _bodybag);
_items pushBack (getMagazineCargo _bodybag);
_items pushBack (getWeaponCargo _bodybag);

private _contents = createHashMap;

{
_x params ["_class", "_quantity"];
private _existing = _contents get [_class, 0];
_contents set [_class, _existing + _quantity];
} forEach _items;
_x params ["_classes", "_quantities"];
{
private _existing = _contents get [_x, 0];
private _quantity = _quantities select _forEachIndex;
_contents set [_x, _existing + _quantity];
} forEach _classes;
} forEach [
(getBackpackCargo _bodybag),
(getItemCargo _bodybag),
(getMagazineCargo _bodybag),
(getWeaponCargo _bodybag)
];

_contents
12 changes: 11 additions & 1 deletion arma/client/addons/discord/XEH_preInitServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

if !(isMultiplayer) exitWith {};

["ace_placedInBodyBag", {
params ["_unit", "_bodybag"];
private _discord = _unit getVariable [QGVAR(id), ""];
if (_discord isEqualTo "") exitWith {};
private _steam = _unit getVariable [QGVAR(steam), ""];
if (_steam isEqualTo "") exitWith {};
_bodybag setVariable [QGVAR(id), _discord, true];
_bodybag setVariable [QGVAR(steam), _steam, true];
}] call CBA_fnc_addEventHandler;

[QGVAR(member), {
params [
["_steam", "", [""]],
Expand All @@ -18,7 +28,7 @@ if !(isMultiplayer) exitWith {};
["_dlc", [], [[]]]
];
if (isNull _player) exitWith {};
private _discord = _player getVariable [QEGVAR(discord,id), ""];
private _discord = _player getVariable [QGVAR(id), ""];
if (_discord isEqualTo "") exitWith {};
EXTCALL("discord:member:save_dlc",[ARR_2(_discord,_dlc)]);
}] call CBA_fnc_addEventHandler;
Expand Down
2 changes: 1 addition & 1 deletion bin/bot/src/discord/slash/gear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async fn ugl(
let guild = command
.guild_id
.expect("Brodsky is only in Synixe")
.to_guild_cached(&ctx)
.to_guild_cached(ctx)
.expect("Brodsky is only in Synixe");
let member = guild
.member(&ctx, command.user.id)
Expand Down

0 comments on commit 51bdfe2

Please sign in to comment.