MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / sell

Method sell

source/frontend/StarMerchantInterface.cpp:346–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void MerchantPane::sell() {
347 if (m_sellTotal > 0) {
348 auto sellSummary = JsonObject{{"items", m_itemBag->toJson()}, {"total", m_sellTotal}};
349 m_worldClient->sendEntityMessage(m_sourceEntityId, "onSell", {sellSummary});
350
351 m_player->inventory()->addCurrency("money", m_sellTotal);
352 m_itemBag->clearItems();
353 updateSellTotal();
354
355 auto& guiContext = GuiContext::singleton();
356 guiContext.playAudio(Root::singleton().assets()->json("/merchant.config:sellSound").toString());
357 }
358}
359
360int MerchantPane::maxBuyCount() {
361 if (auto selected = m_itemGuiList->selectedWidget()) {

Callers

nothing calls this directly

Calls 10

singletonClass · 0.85
addCurrencyMethod · 0.80
inventoryMethod · 0.80
clearItemsMethod · 0.80
playAudioMethod · 0.80
jsonMethod · 0.80
assetsMethod · 0.80
toJsonMethod · 0.45
sendEntityMessageMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected