Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Inventory Management #41

Merged
merged 6 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PIN.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UGSS/@EntryIndexedValue">UGSS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ABRT/@EntryIndexedValue">ABRT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=a4f433b8_002Dabcd_002D4e55_002Da08f_002D82e78cef0f0c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"&gt;&lt;ElementKinds&gt;&lt;Kind Name="LOCAL_CONSTANT" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Baneclaw/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Battlelab/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cinerarium/@EntryIndexedValue">True</s:Boolean>
Expand Down
40 changes: 40 additions & 0 deletions UdpHosts/GameServer/Controllers/Character/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using GameServer.Extensions;
using GameServer.Packets;
using Serilog;
using LoadoutVisualType = AeroMessages.GSS.V66.Character.LoadoutConfig_Visual.LoadoutVisualType;

namespace GameServer.Controllers.Character;

Expand Down Expand Up @@ -407,4 +408,43 @@
var shard = player.CharacterEntity.Shard;
shard.Chat.CharacterPerformTextChat(client, character, query);
}

[MessageID((byte)Commands.SlotGearRequest)]
public void SlotGearRequest(INetworkClient client, IPlayer player, ulong entityId, GamePacket packet)
{
var request = packet.Unpack<SlotGearRequest>();

player.CharacterEntity.EquipItemByGUID(request.LoadoutId, (LoadoutSlotType) request.SlotIdx, request.ItemGUID);

Check warning on line 417 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 417 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 417 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8


var response = new SlotGearResponse()
{
ItemGUID = request.ItemGUID,
SlotIdx = request.SlotIdx,
LoadoutId = request.LoadoutId,
Unk1 = request.Unk,
Result = 1,
};

client.NetChannels[ChannelType.ReliableGss].SendIAero(response, entityId);
client.NetChannels[ChannelType.ReliableGss].SendIAero(player.CharacterEntity.Character_EquipmentView, entityId);
}

[MessageID((byte)Commands.SlotVisualRequest)]
public void SlotVisualRequest(INetworkClient client, IPlayer player, ulong entityId, GamePacket packet)
{
var request = packet.Unpack<SlotVisualRequest>();

player.CharacterEntity.EquipVisualBySdbId(request.LoadoutId, (LoadoutVisualType) request.SlotIdx1, (LoadoutSlotType) request.SlotIdx2, request.ItemSdbId);

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

Check warning on line 437 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8


var response = new SlotVisualResponse()
{
ConfigId = 1,
SlotIdx = request.SlotIdx2,
LoadoutId = (int) request.LoadoutId,

Check warning on line 443 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 443 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 443 in UdpHosts/GameServer/Controllers/Character/BaseController.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

Result = 1,
};

client.NetChannels[ChannelType.ReliableGss].SendIAero(response, entityId);
client.NetChannels[ChannelType.ReliableGss].SendIAero(player.CharacterEntity.Character_ObserverView, entityId);
}
}
118 changes: 117 additions & 1 deletion UdpHosts/GameServer/Data/CharacterInventory.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using AeroMessages.GSS.V66.Character;
using AeroMessages.GSS.V66.Character.Controller;
using System;

Check warning on line 3 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Using directive for 'System' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 3 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Using directive for 'System' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 3 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

Using directive for 'System' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Collections.Generic;

Check warning on line 4 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Using directive for 'System.Collections.Generic' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 4 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Using directive for 'System.Collections.Generic' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 4 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

Using directive for 'System.Collections.Generic' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Linq;

Check warning on line 5 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Using directive for 'System.Linq' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 5 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Using directive for 'System.Linq' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)

Check warning on line 5 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

Using directive for 'System.Linq' should appear before directive for 'AeroMessages.GSS.V66.Character.Controller' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using AeroMessages.GSS.V66.Character.Event;
using GameServer.Data.SDB;
using GameServer.Data.SDB.Records.dbcharacter;
using GameServer.Entities.Character;
using GameServer.Enums;
using LoadoutVisualType = AeroMessages.GSS.V66.Character.LoadoutConfig_Visual.LoadoutVisualType;

namespace GameServer.Data;

Expand Down Expand Up @@ -84,7 +87,7 @@
var refData = new LoadoutReferenceData()
{
LoadoutId = loadoutId,
ChassisId = loadout.ChassisID,
ChassisId = loadout.ChassisID
};

var pveConfig = loadout.LoadoutConfigs[0];
Expand Down Expand Up @@ -307,6 +310,44 @@
_player.NetChannels[ChannelType.ReliableGss].SendIAero(update, _character.EntityId);
}

public void SendEquipmentChanges(ulong oldItemGuid, ulong newItemGuid)
{
if (!EnablePartialUpdates)
{
return;
}

var itemChanges = new Item[] {};
if (oldItemGuid != 0)
{
var oldItem = _items[oldItemGuid];
itemChanges = itemChanges.Append(oldItem).ToArray();
}

Check warning on line 325 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 325 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 325 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

if (newItemGuid != 0)
{
var newItem = _items[newItemGuid];
itemChanges = itemChanges.Append(newItem).ToArray();
}

var update = new InventoryUpdate()
{
ClearExistingData = 0,
ItemsPart1Length = (byte) itemChanges.Length,
ItemsPart1 = itemChanges,
ItemsPart2Length = 0,
ItemsPart2 = Array.Empty<Item>(),
ItemsPart3Length = 0,
ItemsPart3 = Array.Empty<Item>(),
Resources = Array.Empty<Resource>(),
Loadouts = _loadouts.Values.ToArray(),
Unk = 1,
SecondItems = Array.Empty<Item>(),
SecondResources = Array.Empty<Resource>()
};

_player.NetChannels[ChannelType.ReliableGss].SendIAero(update, _character.EntityId);
}

private byte GetInventoryTypeByItemTypeId(uint sdbId)
{
var itemInfo = SDBInterface.GetRootItem(sdbId);
Expand Down Expand Up @@ -368,4 +409,79 @@

return (byte)result;
}

public void EquipItemByGUID(int loadoutId, LoadoutSlotType slot, ulong guid)

Check warning on line 413 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

{
ulong changedOldItemGUID = 0;
ulong changedNewItemGUID = guid;

// Unequip old Item (if any)
if (_loadouts[(uint)loadoutId].LoadoutConfigs[0].Items.Any((e) => e.SlotIndex == (byte)slot))
{
// Set Item to unequipped
var oldItemGUID = _loadouts[(uint)loadoutId].LoadoutConfigs[0].Items.First((e) => e.SlotIndex == (byte) slot).ItemGUID;
changedOldItemGUID = oldItemGUID;
var oldItem = _items[oldItemGUID];
oldItem.DynamicFlags = (byte) ((oldItem.DynamicFlags) ^ (byte)ItemDynamicFlags.IsEquipped);

Check warning on line 425 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 425 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

_items[oldItemGUID] = oldItem;

// Update CurrentLoadout
_character.CurrentLoadout.SlottedItems[slot] = 0;

// Update LoadoutConfigs
_loadouts[(uint)loadoutId].LoadoutConfigs[0].Items = _loadouts[(uint)loadoutId].LoadoutConfigs[0].Items
.Where(e => e.SlotIndex != (byte)slot).ToArray();
}

// Equip new item (if any)
if (guid != 0)
{
// Update Item to Equipped
var item = _items[guid];
item.DynamicFlags = (byte) (item.DynamicFlags | (byte) ItemDynamicFlags.IsEquipped);
_items[guid] = item;

// Update CurrentLoadout
_character.CurrentLoadout.SlottedItems[slot] = item.SdbId;

// Update LoadoutConfig
_loadouts[(uint)loadoutId].LoadoutConfigs[0].Items = _loadouts[(uint)loadoutId].LoadoutConfigs[0].Items.Append(new LoadoutConfig_Item() { ItemGUID = guid, SlotIndex = (byte)slot }).ToArray();
}

// Update StaticInfo when visuals are changed
var equippedSdbId = (guid != 0) ? _items[guid].SdbId : 0;
switch (slot)
{
case LoadoutSlotType.Glider:
_character.SetStaticInfo(_character.StaticInfo with { LoadoutGlider = equippedSdbId });
break;
case LoadoutSlotType.Vehicle:
_character.SetStaticInfo(_character.StaticInfo with { LoadoutVehicle = equippedSdbId });
break;
}

Check warning on line 461 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Linux .NET 8

Check warning on line 461 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / Windows VS2022 .NET 8

Check warning on line 461 in UdpHosts/GameServer/Data/CharacterInventory.cs

View workflow job for this annotation

GitHub Actions / macOS .NET 8

SendEquipmentChanges(changedOldItemGUID, changedNewItemGUID);
}

public void EquipVisualBySdbId(uint loadoutId, LoadoutVisualType visual, LoadoutSlotType slot, uint sdb_id)
{
// Unequip old item (if any)
if (_loadouts[loadoutId].LoadoutConfigs[0].Visuals.Any(i => i.VisualType == visual))
{
// Update Visuals
_loadouts[loadoutId].LoadoutConfigs[0].Visuals = _loadouts[loadoutId].LoadoutConfigs[0].Visuals
.Where(e => e.VisualType != visual).ToArray();
}

// Equip new item (if any)
if (sdb_id != 0)
{
// Update Visuals
_loadouts[(uint)loadoutId].LoadoutConfigs[0].Visuals = _loadouts[(uint)loadoutId].LoadoutConfigs[0].Visuals.Append(new LoadoutConfig_Visual() { ItemSdbId = sdb_id, VisualType = visual, Data1 = 0, Data2 = 0, Transform = []}).ToArray();
var item = _items.First(e => e.Value.SdbId == sdb_id).Value;

}

var equippedGUID = (sdb_id != 0) ? _items.First(e => e.Value.SdbId == sdb_id).Value.GUID : 0;
EquipItemByGUID((int) loadoutId, slot, equippedGUID);
}
}
11 changes: 8 additions & 3 deletions UdpHosts/GameServer/Data/CharacterLoadout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace GameServer.Data;

[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:EnumerationItemsMustBeDocumented", Justification = "Self explanatory")]
public enum LoadoutSlotType
public enum LoadoutSlotType : byte
{
Primary = 1,
Secondary = 2,
Expand All @@ -22,6 +22,7 @@ public enum LoadoutSlotType
Ability2 = 8,
Ability3 = 9,
Backpack = 11,

GearTorso = 116,
GearAuxWeapon = 122,
GearMedicalSystem = 123,
Expand All @@ -31,7 +32,9 @@ public enum LoadoutSlotType
GearReactor = 128,
GearOS = 129,
GearGadget1 = 130,
GearGadget2 = 137
GearGadget2 = 137,
Vehicle = 157,
Glider = 158,
}

[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:EnumerationItemsMustBeDocumented", Justification = "Self explanatory")]
Expand Down Expand Up @@ -98,9 +101,11 @@ public class CharacterLoadout
{ AbilitySlotType.AbilityHKM, LoadoutSlotType.AbilityHKM },
{ AbilitySlotType.AbilityAux, LoadoutSlotType.GearAuxWeapon },
{ AbilitySlotType.AbilityMedical, LoadoutSlotType.GearMedicalSystem },
{ AbilitySlotType.AbilityCalldownVehicle, LoadoutSlotType.Vehicle },
{ AbilitySlotType.AbilityCalldownGlider, LoadoutSlotType.Glider }
};

public Dictionary<LoadoutSlotType, uint> SlottedItems = new Dictionary<LoadoutSlotType, uint>();
public Dictionary<LoadoutSlotType, uint> SlottedItems = new Dictionary<LoadoutSlotType, uint>();
public Dictionary<ushort, float> ItemAttributes = new Dictionary<ushort, float>();

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions UdpHosts/GameServer/Data/HardcodedCharacterData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public static void GenerateLoadoutAndItems(CharacterInventory inventory, Loadout
FrameLoadoutId = loadoutId,
ChassisID = sourceData.ChassisId,
LoadoutName = $"Loadout {loadoutId}",
LoadoutType = "battleframe",
LoadoutType = "battleframe"
};

var chassisGuid = inventory.CreateItem(sourceData.ChassisId);
Expand Down Expand Up @@ -908,9 +908,9 @@ public static void GenerateLoadoutAndItems(CharacterInventory inventory, Loadout
var guid = inventory.CreateItem(typeId);
pveItems.Add(new LoadoutConfig_Item() { ItemGUID = guid, SlotIndex = (byte)slot });
}

pveConfig.Items = pveItems.ToArray();

var pvpConfig = new LoadoutConfig()
{
ConfigID = 1,
Expand All @@ -923,7 +923,7 @@ public static void GenerateLoadoutAndItems(CharacterInventory inventory, Loadout
PerkRespecLockRemainingSeconds = 0,
HaveExtraData = 0
};

var pvpItems = new List<LoadoutConfig_Item>();
foreach (var (slot, typeId) in sourceData.SlottedItemsPvP)
{
Expand All @@ -937,7 +937,7 @@ public static void GenerateLoadoutAndItems(CharacterInventory inventory, Loadout
}

pvpConfig.Items = pvpItems.ToArray();

loadout.LoadoutConfigs =
[
pveConfig,
Expand Down
28 changes: 23 additions & 5 deletions UdpHosts/GameServer/Entities/Character/CharacterEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
using GameServer.Enums;
using GameServer.Test;
using GrpcGameServerAPIClient;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using LoadoutVisualType = AeroMessages.GSS.V66.Character.LoadoutConfig_Visual.LoadoutVisualType;


namespace GameServer.Entities.Character;

Expand Down Expand Up @@ -475,7 +478,7 @@ public void ApplyLoadout(CharacterLoadout loadout)
var chassis = new SlottedItem
{
SdbId = loadout.ChassisID,
SlotIndex = 0,
SlotIndex = 255,
Flags = 0,
Unk2 = 0,
Modules = loadout.GetChassisModules(),
Expand All @@ -484,7 +487,7 @@ public void ApplyLoadout(CharacterLoadout loadout)
var backpack = new SlottedItem
{
SdbId = loadout.BackpackID,
SlotIndex = 0,
SlotIndex = 255,
Flags = 0,
Unk2 = 0,
Modules = loadout.GetBackpackModules(),
Expand All @@ -495,7 +498,7 @@ public void ApplyLoadout(CharacterLoadout loadout)
Item = new SlottedItem
{
SdbId = loadout.SlottedItems.GetValueOrDefault(LoadoutSlotType.Primary),
SlotIndex = 0,
SlotIndex = 255,
Flags = 0,
Unk2 = 0,
Modules = Array.Empty<SlottedModule>(),
Expand All @@ -520,7 +523,7 @@ public void ApplyLoadout(CharacterLoadout loadout)
Item = new SlottedItem
{
SdbId = loadout.SlottedItems.GetValueOrDefault(LoadoutSlotType.Secondary),
SlotIndex = 0,
SlotIndex = 255,
Flags = 0,
Unk2 = 0,
Modules = Array.Empty<SlottedModule>(),
Expand Down Expand Up @@ -964,7 +967,7 @@ public override void SetStatusEffect(byte index, ushort time, StatusEffectData d
Character_CombatView.GetType().GetProperty($"StatusEffectsChangeTime_{index}Prop").SetValue(Character_CombatView, time, null);
Character_CombatView.GetType().GetProperty($"StatusEffects_{index}Prop").SetValue(Character_CombatView, data, null);
}

public override void ClearStatusEffect(byte index, ushort time, uint debugEffectId)
{
Console.WriteLine($"Character.ClearStatusEffect Index {index}, Time {time}, Id {debugEffectId}");
Expand Down Expand Up @@ -1425,6 +1428,21 @@ private ulong GetCurrentPermissionsValue()
return result;
}

public void EquipItemByGUID(int loadoutId, LoadoutSlotType slot, ulong guid)
{
Player.Inventory.EquipItemByGUID(loadoutId, slot, guid);
ApplyLoadout(CurrentLoadout);

}

public void EquipVisualBySdbId(uint loadoutId, LoadoutVisualType visualSlot, LoadoutSlotType slot, uint sdb_id)
{

Player.Inventory.EquipVisualBySdbId(loadoutId, visualSlot, slot, sdb_id);
Player.CharacterEntity.CurrentLoadout.GliderID = sdb_id;
ApplyLoadout(CurrentLoadout);
}

public class ActiveStatModifier
{
public StatModifierIdentifier Stat { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion UdpHosts/GameServer/Enums/ItemDynamicFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace GameServer.Enums;

[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:EnumerationItemsMustBeDocumented", Justification = "TODO")]
[Flags]
public enum ItemDynamicFlags : uint
public enum ItemDynamicFlags : byte
{
IsBound = 0x01,
Unk_0x02 = 0x02, // is_new?
Expand Down
Loading