rott/kf_sources/AcediaCore/Classes/TradableComponent.uc
2026-07-14 20:27:09 +07:00

97 lines
3.4 KiB
Ucode

/**
* Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2024 Anton Tarasenko
*------------------------------------------------------------------------------
* This file is part of Acedia.
*
* Acedia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License, or
* (at your option) any later version.
*
* Acedia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/
class TradableComponent extends Component
dependson(TradingGameplayAPI)
abstract;
//! A base class for tradable components that describes parameters of an entity
//! that can be bought and sold.
/// Returns flag that designates an entity as buyable.
///
/// Buying can still be prevented by other mechanics.
public function bool IsBuyable();
/// Changes whether entity can be bought.
///
/// Buying can still be prevented by other mechanics.
public function SetBuyable(bool value);
/// Returns flag that designates an entity as sellable.
///
/// Selling can still be prevented by other mechanics.
public function bool IsSellable();
/// Changes whether entity can be sold.
///
/// Selling can still be prevented by other mechanics.
public function SetSellable(bool value);
/// Returns the lot size of this entity.
///
/// Only makes sense for entities with an "item" component.
///
/// Lot size is the minimal transaction amount when selling or buying an entity.
/// Lot sizes below 1 are treated as 1.
public function int GetLotSize();
/// Changes the lot size of this entity.
///
/// Only makes sense for entities with an "item" component.
///
/// Lot sizes below 1 are treated as 1.
public function SetLotSize(int newLotSize);
/// Returns all available entity costs for buying.
///
/// This array stores multiple possible costs with different currencies.
public function array<TradingGameplayAPI.TradableCost> GetBuyingCosts();
/// Changes available entity costs for buying.
///
/// This sets the array of costs that define how entity is bought.
public function SetBuyingCosts(array<TradingGameplayAPI.TradableCost> newCosts);
/// Returns whether this entity uses a separate array of costs for selling.
///
/// If `false`, selling costs are determined by some scaled version of
/// buying costs.
public function bool IsUsingSellingCosts();
/// Changes whether this entity uses a separate array of costs for selling.
///
/// If `true`, stored selling costs are used directly.
/// If `false`, selling costs might be derived from buying costs.
public function SetUsingSellingCosts(bool useSellingCosts);
/// Returns all available entity costs for selling.
///
/// This array stores multiple possible costs with different currencies.
public function array<TradingGameplayAPI.TradableCost> GetSellingCosts();
/// Changes available entity costs for selling.
///
/// This sets the array of costs that define how entity is sold.
public function SetSellingCosts(array<TradingGameplayAPI.TradableCost> newCosts);
defaultproperties {
}