ACR_Items.Pricing.AdjustPrice C# (CSharp) Метод

AdjustPrice() публичный статический Метод

public static AdjustPrice ( CLRScriptBase script, uint target, int adjustBy ) : void
script CLRScriptFramework.CLRScriptBase
target uint
adjustBy int
Результат void
        public static void AdjustPrice(CLRScriptBase script, uint target, int adjustBy)
        {
            if (script.GetObjectType(target) != OBJECT_TYPE_ITEM)
                return;

            if (adjustBy == 0)
                return;

            string itemKey = PriceChangeVarName + target.ToString();
            if (script.GetItemStackSize(target) > 1)
            {
                stackSizes.Add(itemKey, script.GetItemStackSize(target));
                script.SetItemStackSize(target, 1, FALSE);
            }
            script.StoreCampaignObject(ItemChangeDBName, itemKey, target, script.OBJECT_SELF);
            if (ALFA.Shared.Modules.InfoStore.ModifiedGff.Keys.Contains(itemKey))
            {
                int currentModifyCost = 0;
                currentModifyCost = ALFA.Shared.Modules.InfoStore.ModifiedGff[itemKey].TopLevelStruct["ModifyCost"].ValueInt + adjustBy;
                ALFA.Shared.Modules.InfoStore.ModifiedGff[itemKey].TopLevelStruct["ModifyCost"].ValueInt = currentModifyCost;
                
                script.DestroyObject(target, 0.0f, FALSE);
                script.DelayCommand(0.1f, delegate() 
                { 
                    uint newObject = script.RetrieveCampaignObject(ItemChangeDBName, itemKey, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF);
                    if (stackSizes.Keys.Contains(itemKey))
                    {
                        script.SetItemStackSize(newObject, stackSizes[itemKey], FALSE);
                        stackSizes.Remove(itemKey);
                    }
                    if (script.GetObjectType(script.OBJECT_SELF) != OBJECT_TYPE_PLACEABLE)
                    {
                        script.CopyItem(newObject, script.OBJECT_SELF, TRUE);
                        script.DestroyObject(newObject, 0.0f, FALSE);
                    }
                });
            }
        }