Interface ITrade
ITrades provide functionality allowing a player to exchange one ICurrency for another. The input and output ICurrencys that make up a ITrade are specified via tag Ids held in the ITradeData. This allows for multiple input and output ICurrencys to be specified on each ITrade. For example, a ITrade could be authored to exchange any ICurrencys tagged with both "Common" and "Generator" for a certain amount of "Soft" ICurrency.
Inherited Members
Namespace: IdleKit.Framework
Assembly: cs.temp.dll.dll
Syntax
public interface ITrade : IEntity, IInjectable
Properties
inputCurrencyAmount
The current input CurrencyAmount that will be taken from the player if MakeTrade() is called.
Declaration
CurrencyAmount inputCurrencyAmount { get; }
Property Value
| Type | Description |
|---|---|
| CurrencyAmount |
inputCurrencyTagDatas
Declaration
ITagData[] inputCurrencyTagDatas { get; }
Property Value
| Type | Description |
|---|---|
| ITagData[] |
Remarks
These tags are inclusive, meaning that if multiple tags are specified, each must be present on the ICurrency for it to be included as an input to the ITrade.
outputCurrencyAmount
The current output CurrencyAmount that the player will receive if MakeTrade() is called.
Declaration
CurrencyAmount outputCurrencyAmount { get; }
Property Value
| Type | Description |
|---|---|
| CurrencyAmount |
outputCurrencyTagDatas
Declaration
ITagData[] outputCurrencyTagDatas { get; }
Property Value
| Type | Description |
|---|---|
| ITagData[] |
Remarks
These tags are inclusive, meaning that if multiple tags are specified, each must be present on the ICurrency for it to be included as an output to the ITrade.
tradeData
The ITradeData associated with the ITrade
Declaration
ITradeData tradeData { get; }
Property Value
| Type | Description |
|---|---|
| ITradeData |
Methods
CalculateCurrencyAmounts(Int32)
Regenerates the inputCurrencyAmount and outputCurrencyAmount randomly based on the ITagData within the ITradeData.
Declaration
bool CalculateCurrencyAmounts(int randomSeed)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | randomSeed |
Returns
| Type | Description |
|---|---|
| Boolean | Will return false if there are currently no valid input/output CurrencyAmount combinations. |
DeclineTrade()
Notifies every listener subscribed to a TradeDeclinedAction that the current ITrade has been declined.
Declaration
void DeclineTrade()
GetValidInputCurrencies()
Declaration
ICurrency[] GetValidInputCurrencies()
Returns
| Type | Description |
|---|---|
| ICurrency[] | A list of all ICurrency associated with this ITrade's input ITagData. |
GetValidOutputCurrencies()
Declaration
ICurrency[] GetValidOutputCurrencies()
Returns
| Type | Description |
|---|---|
| ICurrency[] | A list of all ICurrency associated with this ITrade's output ITagData. |
IsValid()
Checks if the ITrade can be performed with the current input and output CurrencyAmounts.
Declaration
bool IsValid()
Returns
| Type | Description |
|---|---|
| Boolean | Whether or not the ITrade has valid input and output CurrencyAmounts. |
MakeTrade()
Performs the actual trading of the inputCurrencyAmount and outputCurrencyAmount.
Declaration
bool MakeTrade()
Returns
| Type | Description |
|---|---|
| Boolean | Whether or not the trade was successfully made. |
SetInputCurrencyAmount(CurrencyAmount)
Sets the input CurrencyAmount for this ITrade. Because an ITrade does not have its own ISavedData, the input and output CurrencyAmount must be set once the associated IContent has been loaded.
Declaration
void SetInputCurrencyAmount(CurrencyAmount currencyAmount)
Parameters
| Type | Name | Description |
|---|---|---|
| CurrencyAmount | currencyAmount |
SetOutputCurrencyAmount(CurrencyAmount)
Sets the output CurrencyAmount for this ITrade. Because an ITrade does not have its own ISavedData, the input and output CurrencyAmount must be set once the associated IContent has been loaded.
Declaration
void SetOutputCurrencyAmount(CurrencyAmount currencyAmount)
Parameters
| Type | Name | Description |
|---|---|---|
| CurrencyAmount | currencyAmount |