KF2-Server-Extension/ServerExt/Classes/ExtMenu_Inventory.uc
2020-11-28 23:04:55 +03:00

65 lines
1.4 KiB
Ucode

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);
if(ItemIndex == INDEX_NONE)
{
return false;
}
WeaponDef = class'ExtWeaponSkinList'.default.Skins[ItemIndex].WeaponDef;
if(WeaponDef != none)
{
return class'ExtWeaponSkinList'.Static.IsSkinEquip(WeaponDef, ItemDefinition, ExtPlayerController(KFPC));
}
return false;
}
function Callback_Equip(int ItemDefinition)
{
local class<KFWeaponDefinition> WeaponDef;
local int ItemIndex;
ItemIndex = class'ExtWeaponSkinList'.default.Skins.Find('Id', ItemDefinition);
if(ItemIndex == INDEX_NONE)
{
return;
}
WeaponDef = class'ExtWeaponSkinList'.default.Skins[ItemIndex].WeaponDef;
if(WeaponDef != none)
{
if(IsItemActive(ItemDefinition))
{
class'ExtWeaponSkinList'.Static.SaveWeaponSkin(WeaponDef, 0, ExtPlayerController(KFPC));
if(class'WorldInfo'.static.IsConsoleBuild())
{
Manager.CachedProfile.ClearWeaponSkin(WeaponDef.default.WeaponClassPath);
}
}
else
{
class'ExtWeaponSkinList'.Static.SaveWeaponSkin(WeaponDef, ItemDefinition, ExtPlayerController(KFPC));
if(class'WorldInfo'.static.IsConsoleBuild())
{
Manager.CachedProfile.SaveWeaponSkin(WeaponDef.default.WeaponClassPath, ItemDefinition);
}
}
}
InitInventory();
}
defaultproperties
{
}