Changeset 517
- Timestamp:
- Sep 29, 2026, 6:55:40 PM (7 weeks ago)
- Location:
- binary-improvements
- Files:
-
- 18 edited
-
7dtd-server-fixes/7dtd-server-fixes.csproj (modified) (1 diff)
-
7dtd-server-fixes/ModInfo.xml (modified) (1 diff)
-
7dtd-server-fixes/src/PersistentData/Inventory.cs (modified) (3 diffs)
-
AllocsCommands/AllocsCommands.csproj (modified) (1 diff)
-
AllocsCommands/Commands/ShowInventory.cs (modified) (3 diffs)
-
AllocsCommands/ModInfo.xml (modified) (1 diff)
-
MapRendering/API/GetPlayerInventory.cs (modified) (2 diffs)
-
MapRendering/ModInfo.xml (modified) (1 diff)
-
MapRendering/WebAndMapRendering.csproj (modified) (1 diff)
-
bin/Mods/Allocs_CommandExtensions/AllocsCommands.dll (modified) ( previous)
-
bin/Mods/Allocs_CommandExtensions/AllocsCommands.pdb (modified) ( previous)
-
bin/Mods/Allocs_CommandExtensions/ModInfo.xml (modified) (1 diff)
-
bin/Mods/Allocs_CommonFunc/7dtd-server-fixes.dll (modified) ( previous)
-
bin/Mods/Allocs_CommonFunc/7dtd-server-fixes.pdb (modified) ( previous)
-
bin/Mods/Allocs_CommonFunc/ModInfo.xml (modified) (1 diff)
-
bin/Mods/Allocs_WebAndMapRendering/AllocsWeb.dll (modified) ( previous)
-
bin/Mods/Allocs_WebAndMapRendering/AllocsWeb.pdb (modified) ( previous)
-
bin/Mods/Allocs_WebAndMapRendering/ModInfo.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r470 r517 10 10 <AssemblyName>7dtd-server-fixes</AssemblyName> 11 11 <RootNamespace>AllocsFixes</RootNamespace> 12 <TargetFrameworkVersion>v4.8 </TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion> 13 13 <LangVersion>9</LangVersion> 14 14 </PropertyGroup> -
binary-improvements/7dtd-server-fixes/ModInfo.xml
r513 r517 5 5 <Description value="Common functions" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="3 8" />7 <Version value="39" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml> -
binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
r513 r517 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.IO; 3 4 4 5 namespace AllocsFixes.PersistentData { 5 6 [Serializable] 6 7 public class Inventory { 8 public static readonly EnumDictionary<EquipmentSlots, string> CustomEquipmentSlotNames = 9 new() { 10 { EquipmentSlots.Chest, "armor" }, 11 { EquipmentSlots.Hands, "gloves" }, 12 { EquipmentSlots.Feet, "boots" }, 13 }; 14 7 15 public List<InvItem> bag; 8 16 public List<InvItem> belt; … … 17 25 public void Update (PlayerDataFile _pdf) { 18 26 lock (this) { 19 //Log.Out ("Updating player inventory - player id: " + pdf.id); 20 ProcessInv (bag, _pdf.bag.items, _pdf.id); 21 ProcessInv (belt, _pdf.inventory, _pdf.id); 22 ProcessEqu (_pdf.equipment, _pdf.id); 27 ItemStackGrid toolbeltRead = readToolbelt (_pdf.inventoryData); 28 29 Bag bagRead = null; 30 StreamUtils.FromBlob (_pdf.bagData, pbr => bagRead = Bag.Read (pbr, XUiC_ItemStack.StackLocationTypes.Backpack, StreamModeRead.FromClient, null)); 31 32 Equipment equipRead = null; 33 StreamUtils.FromBlob (_pdf.equipmentData, pbr => equipRead = Equipment.Read (pbr, StreamModeRead.FromClient)); 34 35 ProcessInv (bag, bagRead.ItemGrid.items, _pdf.id); 36 ProcessInv (belt, toolbeltRead.items, _pdf.id); 37 ProcessEqu (equipRead, _pdf.id); 23 38 } 24 39 } 25 40 26 private void ProcessInv (ICollection<InvItem> _target, IReadOnlyList<ItemStack> _sourceFields, int _id) { 41 private ItemStackGrid readToolbelt (MemoryStream _ms) { 42 ItemStackGrid grid = ItemStackGrid.Create (new Vector2i (1, 1), XUiC_ItemStack.StackLocationTypes.ToolBelt, false, false, null); 43 StreamUtils.FromBlob (_ms, pbr => { 44 byte version = pbr.ReadByte (); 45 grid.ReadInto (pbr, StreamModeRead.FromClient); 46 }); 47 return grid; 48 } 49 50 private void ProcessInv (ICollection<InvItem> _target, IReadOnlyList<ItemStack> _sourceFields, int _playerId) { 27 51 _target.Clear (); 28 52 for (int i = 0; i < _sourceFields.Count; i++) { 29 InvItem item = CreateInvItem (_sourceFields [i].itemValue, _sourceFields [i].count, _id); 30 if (item != null && _sourceFields [i].itemValue.Modifications != null) { 31 ProcessParts (_sourceFields [i].itemValue.Modifications, item, _id); 53 ItemValue curItemValue = _sourceFields [i].itemValue; 54 InvItem item = CreateInvItem (curItemValue, _sourceFields [i].count, _playerId); 55 if (item != null) { 56 ProcessParts (curItemValue, item, _playerId); 32 57 } 33 58 … … 39 64 equipment = new InvItem[_sourceEquipment.GetSlotCount ()]; 40 65 for (int i = 0; i < _sourceEquipment.GetSlotCount (); i++) { 41 equipment [i] = CreateInvItem (_sourceEquipment.GetSlotItem (i), 1, _playerId); 66 ItemValue curItemValue = _sourceEquipment.GetSlotItem (i); 67 equipment [i] = CreateInvItem (curItemValue, 1, _playerId); 68 if (equipment [i] != null) { 69 ProcessParts (curItemValue, equipment [i], _playerId); 70 } 42 71 } 43 72 } 44 73 45 private void ProcessParts (IReadOnlyList<ItemValue> _parts, InvItem _item, int _playerId) { 46 InvItem[] itemParts = new InvItem[_parts.Count]; 47 for (int i = 0; i < _parts.Count; i++) { 48 InvItem partItem = CreateInvItem (_parts [i], 1, _playerId); 49 if (partItem != null && _parts [i].Modifications != null) { 50 ProcessParts (_parts [i].Modifications, partItem, _playerId); 74 private void ProcessParts (ItemValue _parent, InvItem _item, int _playerId) { 75 if (_parent.ModificationCount < 1) { 76 return; 77 } 78 79 InvItem[] itemParts = new InvItem[_parent.ModificationCount]; 80 for (int i = 0; i < _parent.ModificationCount; i++) { 81 ItemValue part = _parent.GetModification (i); 82 InvItem partItem = CreateInvItem (part, 1, _playerId); 83 if (partItem != null) { 84 ProcessParts (part, partItem, _playerId); 51 85 } 52 86 -
binary-improvements/AllocsCommands/AllocsCommands.csproj
r470 r517 10 10 <RootNamespace>AllocsCommands</RootNamespace> 11 11 <AssemblyName>AllocsCommands</AssemblyName> 12 <TargetFrameworkVersion>v4.8 </TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion> 13 13 </PropertyGroup> 14 14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> -
binary-improvements/AllocsCommands/Commands/ShowInventory.cs
r488 r517 103 103 104 104 private static void PrintEquipment (IReadOnlyList<InvItem> _equipment, int _entityId, string _location, string _tag) { 105 AddEquipment ("head", _equipment, EquipmentSlots.Head, _entityId, _location, _tag); 106 // AddEquipment ("eyes", _equipment, EquipmentSlots.Eyewear, _entityId, _location, _tag); 107 // AddEquipment ("face", _equipment, EquipmentSlots.Face, _entityId, _location, _tag); 108 109 AddEquipment ("armor", _equipment, EquipmentSlots.Chest, _entityId, _location, _tag); 110 // AddEquipment ("jacket", _equipment, EquipmentSlots.Jacket, _entityId, _location, _tag); 111 // AddEquipment ("shirt", _equipment, EquipmentSlots.Shirt, _entityId, _location, _tag); 112 113 // AddEquipment ("legarmor", _equipment, EquipmentSlots.LegArmor, _entityId, _location, _tag); 114 // AddEquipment ("pants", _equipment, EquipmentSlots.Legs, _entityId, _location, _tag); 115 AddEquipment ("boots", _equipment, EquipmentSlots.Feet, _entityId, _location, _tag); 116 117 AddEquipment ("gloves", _equipment, EquipmentSlots.Hands, _entityId, _location, _tag); 105 for (EquipmentSlots slot = 0; slot < EquipmentSlots.Count; slot++) { 106 if (!PersistentData.Inventory.CustomEquipmentSlotNames.TryGetValue (slot, out string slotName)) { 107 slotName = slot.ToStringCached ().ToLower (); 108 } 109 110 AddEquipment (slotName, _equipment, slot, _entityId, _location, _tag); 111 } 118 112 } 119 113 … … 122 116 int slotindex = (int)_slot; 123 117 124 if (_items == null || _items[slotindex] == null) {118 if (_items == null || slotindex >= _items.Count || _items[slotindex] == null) { 125 119 return; 126 120 } … … 130 124 // no Tag defined -> readable output 131 125 if (item.quality < 0) { 132 SdtdConsole.Instance.Output (string.Format (" Slot {0 :8}: {1:000}", _slotname,126 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1}", _slotname, 133 127 item.itemName)); 134 128 } else { 135 SdtdConsole.Instance.Output (string.Format (" Slot {0 :8}: {1:000} - quality: {2}",129 SdtdConsole.Instance.Output (string.Format (" Slot {0}: {1} - quality: {2}", 136 130 _slotname, item.itemName, item.quality)); 137 131 } -
binary-improvements/AllocsCommands/ModInfo.xml
r513 r517 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="3 0" />7 <Version value="31" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml> -
binary-improvements/MapRendering/API/GetPlayerInventory.cs
r488 r517 91 91 } 92 92 93 private static void DoEquipment (ref JsonWriter _writer, IReadOnlyList<InvItem> _equ , bool _showIconColor, bool _showIconName) {93 private static void DoEquipment (ref JsonWriter _writer, IReadOnlyList<InvItem> _equipment, bool _showIconColor, bool _showIconName) { 94 94 _writer.WriteBeginObject (); 95 96 AddEquipment (ref _writer, "head", _equ, EquipmentSlots.Head, _showIconColor, _showIconName);97 _writer.WriteValueSeparator ();98 95 99 AddEquipment (ref _writer, "armor", _equ, EquipmentSlots.Chest, _showIconColor, _showIconName); 100 _writer.WriteValueSeparator (); 101 102 AddEquipment (ref _writer, "boots", _equ, EquipmentSlots.Feet, _showIconColor, _showIconName); 103 _writer.WriteValueSeparator (); 104 105 AddEquipment (ref _writer, "gloves", _equ, EquipmentSlots.Hands, _showIconColor, _showIconName); 96 for (EquipmentSlots slot = 0; slot < EquipmentSlots.Count; slot++) { 97 if (slot > 0) { 98 _writer.WriteValueSeparator (); 99 } 100 101 if (!PersistentData.Inventory.CustomEquipmentSlotNames.TryGetValue (slot, out string slotName)) { 102 slotName = slot.ToStringCached ().ToLower (); 103 } 104 105 AddEquipment (ref _writer, slotName, _equipment, slot, _showIconColor, _showIconName); 106 } 106 107 107 108 _writer.WriteEndObject (); … … 113 114 int slotindex = (int)_slot; 114 115 115 if (_items == null || _items[slotindex] == null) {116 if (_items == null || slotindex >= _items.Count || _items[slotindex] == null) { 116 117 // Slot not found / empty 117 118 _writer.WriteNull (); -
binary-improvements/MapRendering/ModInfo.xml
r513 r517 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="5 2" />7 <Version value="53" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml> -
binary-improvements/MapRendering/WebAndMapRendering.csproj
r513 r517 10 10 <RootNamespace>MapRendering</RootNamespace> 11 11 <AssemblyName>AllocsWeb</AssemblyName> 12 <TargetFrameworkVersion>v4.8 </TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion> 13 13 <Nullable>warnings</Nullable> 14 14 <LangVersion>9</LangVersion> -
binary-improvements/bin/Mods/Allocs_CommandExtensions/ModInfo.xml
r513 r517 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="3 0" />7 <Version value="31" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml> -
binary-improvements/bin/Mods/Allocs_CommonFunc/ModInfo.xml
r513 r517 5 5 <Description value="Common functions" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="3 8" />7 <Version value="39" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml> -
binary-improvements/bin/Mods/Allocs_WebAndMapRendering/ModInfo.xml
r513 r517 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="5 2" />7 <Version value="53" /> 8 8 <Website value="https://7dtd.illy.bz" /> 9 9 </xml>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)