KF2-Server-Extension/ServerExt/Classes/ExtMenu_Inventory.uc

66 lines
1.4 KiB
Ucode
Raw Permalink Normal View History

class ExtMenu_Inventory extends KFGFxMenu_Inventory;
function bool IsItemActive(int ItemDefinition)
{
local class<KFWeaponDefinition> WeaponDef;
local int ItemIndex;
ItemIndex = class'ExtWeaponSkinList'.default.Skins.Find('Id', ItemDefinition);
2020-11-28 20:12:58 +00:00
if (ItemIndex == INDEX_NONE)
{
return false;
}
WeaponDef = class'ExtWeaponSkinList'.default.Skins[ItemIndex].WeaponDef;
2020-11-28 20:12:58 +00:00
if (WeaponDef != none)
{
return class'ExtWeaponSkinList'.Static.IsSkinEquip(WeaponDef, ItemDefinition, ExtPlayerController(KFPC));
}
return false;
}
2020-11-28 20:04:55 +00:00
function Callback_Equip(int ItemDefinition)
{
local class<KFWeaponDefinition> WeaponDef;
local int ItemIndex;
ItemIndex = class'ExtWeaponSkinList'.default.Skins.Find('Id', ItemDefinition);
2020-11-28 20:12:58 +00:00
if (ItemIndex == INDEX_NONE)
{
return;
}
WeaponDef = class'ExtWeaponSkinList'.default.Skins[ItemIndex].WeaponDef;
2020-11-28 20:12:58 +00:00
if (WeaponDef != none)
{
2020-11-28 20:12:58 +00:00
if (IsItemActive(ItemDefinition))
{
class'ExtWeaponSkinList'.Static.SaveWeaponSkin(WeaponDef, 0, ExtPlayerController(KFPC));
2020-11-28 20:12:58 +00:00
if (class'WorldInfo'.static.IsConsoleBuild())
{
Manager.CachedProfile.ClearWeaponSkin(WeaponDef.default.WeaponClassPath);
}
}
else
{
class'ExtWeaponSkinList'.Static.SaveWeaponSkin(WeaponDef, ItemDefinition, ExtPlayerController(KFPC));
2020-11-28 20:12:58 +00:00
if (class'WorldInfo'.static.IsConsoleBuild())
{
Manager.CachedProfile.SaveWeaponSkin(WeaponDef.default.WeaponClassPath, ItemDefinition);
}
}
}
InitInventory();
}
defaultproperties
{
2023-05-14 02:49:12 +00:00
}