Skip to content

Commit d6670f4

Browse files
committed
- Resolved KeyNotFoundException
1 parent 7ca5370 commit d6670f4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

StackSizeController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Oxide.Plugins
99
{
10-
[Info("Stack Size Controller", "AnExiledGod", "3.2.1")]
10+
[Info("Stack Size Controller", "AnExiledGod", "3.2.2")]
1111
[Description("Allows configuration of most items max stack size.")]
1212
class StackSizeController : CovalencePlugin
1313
{
@@ -791,7 +791,7 @@ private int GetStackSize(ItemDefinition itemDefinition)
791791
{
792792
return GetVanillaStackSize(itemDefinition);
793793
}
794-
794+
795795
// Individual Limit set by shortname
796796
if (_config.IndividualItemStackHardLimits.ContainsKey(itemDefinition.shortname))
797797
{
@@ -803,15 +803,15 @@ private int GetStackSize(ItemDefinition itemDefinition)
803803
{
804804
return _config.IndividualItemStackHardLimits[itemDefinition.itemid.ToString()];
805805
}
806-
806+
807807
// Custom stack exists
808808
if (customStackInfo.CustomStackSize > 0)
809809
{
810810
return Mathf.RoundToInt(customStackInfo.CustomStackSize * _config.GlobalStackMultiplier);
811811
}
812-
812+
813813
// Individual Multiplier set by shortname
814-
int stackable = _vanillaDefaults[itemDefinition.shortname];
814+
int stackable = _vanillaDefaults.ContainsKey(itemDefinition.shortname) ? _vanillaDefaults[itemDefinition.shortname] : itemDefinition.stackable;
815815
if (_config.IndividualItemStackMultipliers.ContainsKey(itemDefinition.shortname))
816816
{
817817
return Mathf.RoundToInt(stackable * _config.IndividualItemStackMultipliers[itemDefinition.shortname]);
@@ -829,7 +829,7 @@ private int GetStackSize(ItemDefinition itemDefinition)
829829
{
830830
return _config.CategoryStackHardLimits[itemDefinition.category.ToString()];
831831
}
832-
832+
833833
// Category stack multiplier defined
834834
if (_config.CategoryStackMultipliers.ContainsKey(itemDefinition.category.ToString()) &&
835835
_config.CategoryStackMultipliers[itemDefinition.category.ToString()] > 1.0f)

0 commit comments

Comments
 (0)