Planeshift
|
ExchangingCharacter holds relevant information about character that is participating in exchange of items with another character. More...
#include <exchangemanager.h>
Public Member Functions | |
void | AdjustMoney (int coin, int delta) |
Change the amount of money this character is offering in the exchange. | |
void | AdjustMoney (const psMoney &amount) |
ExchangingCharacter (int client, psCharacterInventory &inv) | |
bool | GetExchangedItems (csString &text) |
psItem * | GetOfferedItem (int slot) |
psMoney | GetOfferedMoney () |
void | GetOffering (csString &buff) |
Constructs an XML list of the items that are being offered. | |
void | GetOfferingCSV (csString &buff) |
void | GetSimpleOffering (csString &buff, psCharacter *chr, bool exact=true) |
Constructs a simple XML list of the items that are being offered. | |
float | GetSumSize () |
Gets the total size of all the items that are offered. | |
float | GetSumWeight () |
Gets the total weight of all the items that are offered. | |
bool | IsOfferingSane () |
Make sure all offered items still have legal stack counts. | |
bool | MoveOfferedItem (int fromSlot, int stackcount, int toSlot) |
bool | OfferItem (int exchSlotNum, INVENTORY_SLOT_NUMBER invSlot, int stackcount, bool test) |
Inserts item to position 'itemNum'. | |
bool | RemoveItemFromOffer (int itemNum, int count, int &remain) |
Removes items from position 'itemNum'. | |
void | TransferMoney (int targetClientNum) |
Transfers the trias from this exchanging player to a different player. | |
void | TransferMoney (psCharacter *target) |
Transfers the trias from this exchanging player to another character. | |
void | TransferOffer (psCharacter *npc) |
Transfers offered items and money to an NPC 'npc'. | |
void | TransferOffer (int targetClientNum) |
Transfers offered items and money to character 'target'. | |
void | UpdateOfferingMoney () |
Update the money box for money that is being offered by this character. | |
void | UpdateReceivingMoney (psMoney &money) |
Update the money box for money that will be received by this character. | |
Public Attributes | |
psMoney | offeringMoney |
Protected Member Functions | |
psCharacter * | GetClientCharacter (int clientNum) |
Protected Attributes | |
psCharacterInventory * | chrinv |
int | client |
Stuff that was removed from character inventory and offered to the other character. |
ExchangingCharacter holds relevant information about character that is participating in exchange of items with another character.
Definition at line 54 of file exchangemanager.h.
ExchangingCharacter::ExchangingCharacter | ( | int | client, |
psCharacterInventory & | inv | ||
) |
Change the amount of money this character is offering in the exchange.
coin | Is one of the 4 coin types. Defined in common/rpgrules/psmoney.h |
delta | The amount to change by. Can be +/- |
void ExchangingCharacter::AdjustMoney | ( | const psMoney & | amount | ) |
psCharacter* ExchangingCharacter::GetClientCharacter | ( | int | clientNum | ) | [protected] |
bool ExchangingCharacter::GetExchangedItems | ( | csString & | text | ) |
psMoney ExchangingCharacter::GetOfferedMoney | ( | ) | [inline] |
Definition at line 113 of file exchangemanager.h.
void ExchangingCharacter::GetOffering | ( | csString & | buff | ) |
Constructs an XML list of the items that are being offered.
The format of the xml is: <L MONEY=psMoney.ToString> <ITEM N=name SLT_POS=slotposition C=count WT=weight IMG=icon image> ... </L>
buff | [CHANGES] Is where the resulting xml message is built. |
void ExchangingCharacter::GetOfferingCSV | ( | csString & | buff | ) |
void ExchangingCharacter::GetSimpleOffering | ( | csString & | buff, |
psCharacter * | chr, | ||
bool | exact = true |
||
) |
Constructs a simple XML list of the items that are being offered.
The format of the xml is when exact: <L MONEY="psMoney.ToString"><ITEM N=name C=count Q=quality />...</L> else: <L MONEY="0,0,0,psMoney.GetTotal"><ITEM N=name C=count Q=quality />...</L>
buff | [CHANGES] Is where the resulting xml message is built. |
chr | The character |
exact | Should the offer be exactly |
float ExchangingCharacter::GetSumSize | ( | ) |
Gets the total size of all the items that are offered.
float ExchangingCharacter::GetSumWeight | ( | ) |
Gets the total weight of all the items that are offered.
bool ExchangingCharacter::IsOfferingSane | ( | ) |
Make sure all offered items still have legal stack counts.
bool ExchangingCharacter::OfferItem | ( | int | exchSlotNum, |
INVENTORY_SLOT_NUMBER | invSlot, | ||
int | stackcount, | ||
bool | test | ||
) |
Inserts item to position 'itemNum'.
If there is another item at this position already, it tries to stack them.
Removes items from position 'itemNum'.
Can return NULL if there is no item. Returned item instance now belongs to caller.
itemNum | The position to remove from. |
count | Count=-1 means take everything. |
remain | [CHANGES] The number of items left in the slot ( if any ) |
void ExchangingCharacter::TransferMoney | ( | psCharacter * | target | ) |
Transfers the trias from this exchanging player to another character.
void ExchangingCharacter::TransferMoney | ( | int | targetClientNum | ) |
Transfers the trias from this exchanging player to a different player.
targetClientNum | The client id of the client that should be receiving this characters offering money. |
void ExchangingCharacter::TransferOffer | ( | psCharacter * | npc | ) |
Transfers offered items and money to an NPC 'npc'.
void ExchangingCharacter::TransferOffer | ( | int | targetClientNum | ) |
Transfers offered items and money to character 'target'.
Target can be 0 - in this case everything is just destroyed.
void ExchangingCharacter::UpdateOfferingMoney | ( | ) |
Update the money box for money that is being offered by this character.
void ExchangingCharacter::UpdateReceivingMoney | ( | psMoney & | money | ) |
Update the money box for money that will be received by this character.
psCharacterInventory* ExchangingCharacter::chrinv [protected] |
Definition at line 193 of file exchangemanager.h.
int ExchangingCharacter::client [protected] |
Stuff that was removed from character inventory and offered to the other character.
Definition at line 192 of file exchangemanager.h.
Definition at line 168 of file exchangemanager.h.