Jump to content

About purches using scrap

Pending 3.1.5

xkirax20ax
xkirax20ax

Posted

Hi nivex,

Thank you very much for your continued work and support with Raidable Bases.

I would like to report a possible issue with the custom item currency payment system in Raidable Bases version 3.1.5.

The Expert raid purchase price is correctly displayed as 1,500 scrap. The configuration is also set to:

Custom costs: enabled

Economics costs: disabled

ServerRewards costs: disabled

Expert custom cost: 1,500 scrap

However, when a player purchased an Expert raid while carrying a stack of 10,000 scrap, the entire 10,000-scrap stack disappeared instead of only 1,500 scrap being removed.

Expected result:
10,000 → 8,500 scrap

Actual result:
10,000 → 0 scrap

Our server uses a stack-size plugin, so I am wondering whether there may be a compatibility issue with the following item withdrawal process:

var taken = slot.amount > amountLeft ? slot.SplitItem(amountLeft) : slot; taken.Drop(Vector3.zero, Vector3.zero); amountLeft -= taken.amount;

Could SplitItem() or dropping the split item at Vector3.zero possibly cause the original oversized stack to be removed entirely when used with a stack-size plugin?

I am not certain that this is the exact cause, so I would greatly appreciate it if you could check the payment handling.

I can provide the current configuration, plugin file, and any other information needed for testing.

Thank you very much for your time and for always supporting the community.

nivex

Posted (edited)

heya, yes, it is currently bugged for purchases and refunds and will be fixed in the next update 🙂

yep, your hunch is right. that code is the problem for both issues. the fix is to simply replace lines 16521 to 16525 with this:

    int amount = Math.Min(slot.amount, amountLeft);
    amountLeft -= amount;
    slot.amount -= amount;
    slot.ReduceItemOwnership(amount);
    if (slot.amount <= 0) slot.Remove();
    else slot.MarkDirty();

 

Edited by nivex
xkirax20ax

Posted

Thank you so much for confirming the issue and providing the fix so quickly! I will apply the replacement code and test both the purchase and refund functions.
I really appreciate your quick support and detailed explanation. 😊

nivex

Posted

you're welcome, enjoy:)

 

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.8m
Total downloads
Customers
11.7k
Customers served
Files Sold
167.2k
Total sales
Payments
3.6m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.