Resource icon

Approved StackSizes 1.0 BETA

No permission to download

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
295
63
I have seen a problem trying to change the stacks of sulfur, metal and wood fragments, when I change these values 250-500 something wrong .. resources disappear

Nevertheless

LargeSpikeWall 1 to 5 PERFECT
SmallSpikeWall 1 to 10 PERFECT

Any solution???

Thanks .. amazing plugin
 

Jakkee

Plugin Developer
Plugin Developer
Contributor
Jul 28, 2014
1,463
472
83
Australia
I have seen a problem trying to change the stacks of sulfur, metal and wood fragments, when I change these values 250-500 something wrong .. resources disappear

Nevertheless

LargeSpikeWall 1 to 5 PERFECT
SmallSpikeWall 1 to 10 PERFECT

Any solution???

Thanks .. amazing plugin
255 is the most you can stack
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
3,992
2,174
113
At your house.
github.com
I have seen a problem trying to change the stacks of sulfur, metal and wood fragments, when I change these values 250-500 something wrong .. resources disappear

Nevertheless

LargeSpikeWall 1 to 5 PERFECT
SmallSpikeWall 1 to 10 PERFECT

Any solution???

Thanks .. amazing plugin
Oh hey there new guy.

I don't exactly know what causes that. The max value you can set It to is 255. I think there is a List in the rust code / item that is limited to the number 255 (0th element + 255 = 256) I need to find that one. If I can find It and change It, It might be possible to increase It.
 

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
295
63
Oh hey there new guy.

I don't exactly know what causes that. The max value you can set It to is 255. I think there is a List in the rust code / item that is limited to the number 255 (0th element + 255 = 256) I need to find that one. If I can find It and change It, It might be possible to increase It.
Amazing.... Great job
 

Jianxian

New Member
Trusted Member
Member
Feb 8, 2017
26
1
3
China
Client need to change some code so that make item more than 250+,but if i change client dll,the server will kick me.
I want rb could do this.
 

Jianxian

New Member
Trusted Member
Member
Feb 8, 2017
26
1
3
China
here are some source code.
maybe useful to you.
And AssemblyInfo.dll(sure about stacksize 2000+) is too large to upload,you can give me a emaile
C#:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using RustProto;
using uLink;
using UnityEngine;

// Token: 0x0200021F RID: 543
[NGCAutoAddScript]
public partial class Inventory : IDLocal
{
    // Token: 0x0200022F RID: 559
    private static partial class Payload
    {
        // Token: 0x06000D3D RID: 3389 RVA: 0x0004DB68 File Offset: 0x0004BD68
        public static Inventory.Payload.Result AddItem(Inventory inventory, ref Inventory.Addition addition, Inventory.Payload.Opt options, InventoryItem reuseItem)
        {
            Inventory.Payload.Result result;
            if ((byte)(options & (Inventory.Payload.Opt.DoNotStack | Inventory.Payload.Opt.DoNotAssign)) == 3 || (byte)(options & (Inventory.Payload.Opt.IgnoreSlotOffset | Inventory.Payload.Opt.RestrictToOffset)) == 12)
            {
                result.item = null;
                result.flags = Inventory.Payload.Result.Flags.OptionsResultedInNoOp;
                result.usesRemaining = 0;
            }
            else
            {
                ItemDataBlock itemDataBlock = addition.ItemDataBlock;
                if (!itemDataBlock)
                {
                    result.item = null;
                    result.flags = Inventory.Payload.Result.Flags.NoItemDatablock;
                    result.usesRemaining = 0;
                    return result;
                }
                Inventory.Slot.KindFlags kindFlags = addition.SlotPreference.PrimaryKindFlags;
                Inventory.Slot.KindFlags kindFlags2 = addition.SlotPreference.SecondaryKindFlags;
                Inventory.Slot.Range explicitSlot;
                if ((byte)(options & Inventory.Payload.Opt.IgnoreSlotOffset) == 4)
                {
                    explicitSlot = default(Inventory.Slot.Range);
                }
                else
                {
                    explicitSlot = Inventory.Payload.RangeArray.CalculateExplicitSlotPosition(inventory, ref addition.SlotPreference);
                }
                bool flag = (byte)(options & Inventory.Payload.Opt.RestrictToOffset) == 8;
                bool any = explicitSlot.Any;
                if (flag && !any)
                {
                    result.item = null;
                    result.flags = Inventory.Payload.Result.Flags.MissingRequiredOffset;
                    result.usesRemaining = 0;
                    return result;
                }
                if (flag)
                {
                    Inventory.Payload.RangeArray.FillTemporaryRanges(ref Inventory.Payload.RangeArray.Primary, inventory, (Inventory.Slot.KindFlags)0, explicitSlot, true);
                    Inventory.Payload.RangeArray.FillTemporaryRanges(ref Inventory.Payload.RangeArray.Secondary, inventory, (Inventory.Slot.KindFlags)0, explicitSlot, false);
                }
                else
                {
                    Inventory.Payload.RangeArray.FillTemporaryRanges(ref Inventory.Payload.RangeArray.Primary, inventory, kindFlags, explicitSlot, true);
                    Inventory.Payload.RangeArray.FillTemporaryRanges(ref Inventory.Payload.RangeArray.Secondary, inventory, kindFlags2, explicitSlot, false);
                }
                int num;
                if (Inventory.Payload.RangeArray.Primary.Count == 0)
                {
                    kindFlags = (Inventory.Slot.KindFlags)0;
                    if (Inventory.Payload.RangeArray.Secondary.Count == 0)
                    {
                        kindFlags2 = (Inventory.Slot.KindFlags)0;
                        num = 0;
                    }
                    else
                    {
                        num = Inventory.Payload.RangeArray.Secondary.Count;
                    }
                }
                else if (Inventory.Payload.RangeArray.Secondary.Count == 0)
                {
                    kindFlags2 = (Inventory.Slot.KindFlags)0;
                    num = Inventory.Payload.RangeArray.Primary.Count;
                }
                else
                {
                    num = Inventory.Payload.RangeArray.Primary.Count + Inventory.Payload.RangeArray.Secondary.Count;
                }
                if (num == 0 || (!any && ((byte)(kindFlags | kindFlags2) & 7) == 0))
                {
                    result.item = null;
                    result.flags = Inventory.Payload.Result.Flags.NoSlotRanges;
                    result.usesRemaining = 0;
                }
                else
                {
                    int maxUses = itemDataBlock._maxUses;
                    bool flag2 = (byte)(options & Inventory.Payload.Opt.ReuseItem) == 16;
                    if (flag2 && (object.ReferenceEquals(reuseItem, null) || (itemDataBlock.untransferable && reuseItem.inventory != inventory)))
                    {
                        result.flags = Inventory.Payload.Result.Flags.FailedToReuse;
                        result.item = null;
                        result.usesRemaining = 0;
                    }
                    else
                    {
                        Inventory.Collection<InventoryItem> collection = inventory.collection;
                        result.usesRemaining = ((!flag2) ? addition.UsesQuantity.CalculateCount(itemDataBlock) : reuseItem.uses);
                        InventoryItem item;
                        Inventory.Payload.StackResult stackResult2;
                        if ((byte)(options & Inventory.Payload.Opt.DoNotStack) != 1 && (byte)(addition.SlotPreference.Flags & Inventory.Slot.PreferenceFlags.Stack) == 8)
                        {
                            Inventory.Payload.StackArguments stackArguments;
                            stackArguments.collection = collection;
                            stackArguments.datablockUID = itemDataBlock.uniqueID;
                            stackArguments.splittable = itemDataBlock.IsSplittable();
                            stackArguments.useCount = result.usesRemaining;
                            stackArguments.prefFlags = addition.SlotPreference.Flags;
                            InventoryItem inventoryItem;
                            Inventory.Payload.StackResult stackResult = Inventory.Payload.StackUses(ref stackArguments, ref Inventory.Payload.RangeArray.Primary, out inventoryItem);
                            if (stackResult == Inventory.Payload.StackResult.NoneUnsplittable || stackResult == Inventory.Payload.StackResult.Complete)
                            {
                                InventoryItem inventoryItem2 = item = inventoryItem;
                                stackResult2 = stackResult;
                            }
                            else
                            {
                                InventoryItem inventoryItem2;
                                Inventory.Payload.StackResult stackResult3 = Inventory.Payload.StackUses(ref stackArguments, ref Inventory.Payload.RangeArray.Secondary, out inventoryItem2);
                                if (stackResult > stackResult3)
                                {
                                    item = (inventoryItem ?? inventoryItem2);
                                    stackResult2 = stackResult;
                                }
                                else
                                {
                                    item = (inventoryItem ?? inventoryItem2);
                                    stackResult2 = stackResult3;
                                }
                            }
                            result.usesRemaining = stackArguments.useCount;
                        }
                        else
                        {
                            item = null;
                            stackResult2 = Inventory.Payload.StackResult.NoneNotMarked;
                        }
                        if (stackResult2 == Inventory.Payload.StackResult.Complete)
                        {
                            result.item = item;
                            result.flags = (Inventory.Payload.Result.Flags.Complete | Inventory.Payload.Result.Flags.Stacked);
                        }
                        else
                        {
                            if (stackResult2 == Inventory.Payload.StackResult.Partial)
                            {
                                result.item = item;
                                result.flags = Inventory.Payload.Result.Flags.Stacked;
                            }
                            else
                            {
                                result.flags = Inventory.Payload.Result.Flags.OptionsResultedInNoOp;
                            }
                            if ((byte)(options & Inventory.Payload.Opt.DoNotAssign) != 2)
                            {
                                if (collection.HasNoVacancy)
                                {
                                    result.item = item;
                                    result.flags |= Inventory.Payload.Result.Flags.NoVacancy;
                                }
                                else
                                {
                                    Inventory.Payload.Assignment assignment;
                                    assignment.inventory = inventory;
                                    assignment.collection = collection;
                                    assignment.fresh = !flag2;
                                    assignment.item = ((!assignment.fresh) ? reuseItem : (itemDataBlock.CreateItem() as InventoryItem));
                                    assignment.uses = result.usesRemaining;
                                    assignment.datablock = itemDataBlock;
                                    if (!flag2 && object.ReferenceEquals(assignment.item, null))
                                    {
                                        result.item = item;
                                        result.flags |= ((!assignment.fresh) ? Inventory.Payload.Result.Flags.FailedToReuse : Inventory.Payload.Result.Flags.FailedToCreate);
                                    }
                                    else
                                    {
                                        assignment.slot = -1;
                                        assignment.attemptsMade = 0;
                                        Inventory.Collection<InventoryItem>.VacantCollection.Enumerator vacantEnumerator = collection.VacantEnumerator;
                                        bool flag3;
                                        try
                                        {
                                            flag3 = (Inventory.Payload.AssignItemInsideRanges(ref vacantEnumerator, ref Inventory.Payload.RangeArray.Primary, ref assignment) || Inventory.Payload.AssignItemInsideRanges(ref vacantEnumerator, ref Inventory.Payload.RangeArray.Secondary, ref assignment));
                                        }
                                        finally
                                        {
                                            vacantEnumerator.Dispose();
                                        }
                                        if (flag3)
                                        {
                                            result.flags |= (Inventory.Payload.Result.Flags.Complete | Inventory.Payload.Result.Flags.AssignedInstance);
                                            result.item = assignment.item;
                                            result.usesRemaining -= result.item.uses;
                                        }
                                        else if (assignment.attemptsMade > 0)
                                        {
                                            result.flags |= Inventory.Payload.Result.Flags.NoVacancy;
                                            result.item = item;
                                        }
                                        else
                                        {
                                            result.flags |= Inventory.Payload.Result.Flags.NoSlotRanges;
                                            result.item = item;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                result.item = item;
                                if (result.flags == Inventory.Payload.Result.Flags.OptionsResultedInNoOp)
                                {
                                    result.flags = Inventory.Payload.Result.Flags.MissingRequiredOffset;
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }
    }
}