Planeshift
|
A basic exchange. More...
#include <exchangemanager.h>
Public Member Functions | |
virtual bool | AddItem (Client *fromClient, INVENTORY_SLOT_NUMBER fromSlot, int stackCount, int toSlot) |
Add a new item to the exchange. | |
virtual bool | AdjustMoney (Client *client, int moneyType, int newMoney) |
virtual bool | AdjustMoney (Client *client, const psMoney &money) |
bool | CheckRange (int clientNum, gemObject *ourActor, gemObject *otherActor) |
Exchange (Client *starter, bool automaticExchange, ExchangeManager *manager) | |
int | GetID () const |
virtual psMoney | GetOfferedMoney (Client *client) |
Client * | GetStarterClient () |
psItem * | GetStarterOffer (int slot) |
virtual psItem * | GetTargetOffer (int slot) |
virtual bool | HandleAccept (Client *client)=0 |
One of the client has accepted the exchange. | |
virtual void | HandleEnd (Client *client)=0 |
One of the clients has ended this exchange. | |
virtual void | MoveItem (Client *client, int fromSlot, int stackCount, int toSlot) |
Move an item from one slot to another in the exchange. | |
virtual bool | RemoveItem (Client *fromClient, int slot, int stackCount) |
Removes an item from the exchange. | |
virtual | ~Exchange () |
Protected Member Functions | |
virtual void | SendAddItemMessage (Client *fromClient, int slot, psCharacterInventory::psCharacterInventoryItem *item) |
void | SendEnd (int clientNum) |
virtual void | SendRemoveItemMessage (Client *fromClient, int slot) |
Protected Attributes | |
bool | automaticExchange |
the exchange is done entirely server side don't open windows on the client. This is used only with NPC! | |
bool | exchangeEnded |
exchange ended and should be deleted | |
ExchangeManager * | exchangeMgr |
bool | exchangeSuccess |
exchange was successful and items should not be returned to owners | |
int | id |
unique exchange ID | |
uint32_t | player |
ExchangingCharacter | starterChar |
Information about the player that initiated the exchange. | |
Client * | starterClient |
Static Protected Attributes | |
static int | next_id |
A basic exchange.
This shares the qualities of any exchange and stores the players involved as well as functionality to start/stop the exchange.
Definition at line 204 of file exchangemanager.h.
Exchange::Exchange | ( | Client * | starter, |
bool | automaticExchange, | ||
ExchangeManager * | manager | ||
) |
virtual Exchange::~Exchange | ( | ) | [virtual] |
virtual bool Exchange::AddItem | ( | Client * | fromClient, |
INVENTORY_SLOT_NUMBER | fromSlot, | ||
int | stackCount, | ||
int | toSlot | ||
) | [virtual] |
Add a new item to the exchange.
Will add to the offering slot of the person that offered it an the receiving slot of the other person. Sends out the relevant network messages.
fromClient | The client that this item came from. |
fromSlot | The originating slot in the exchange window for the item moved. |
stackCount | The number of items being moved. |
toSlot | Where in the exchange the item is to be placed. |
Reimplemented in PlayerToPlayerExchange.
Reimplemented in PlayerToPlayerExchange.
Reimplemented in PlayerToPlayerExchange.
int Exchange::GetID | ( | ) | const [inline] |
Definition at line 276 of file exchangemanager.h.
Reimplemented in PlayerToPlayerExchange.
Client* Exchange::GetStarterClient | ( | ) | [inline] |
Definition at line 282 of file exchangemanager.h.
Reimplemented in PlayerToPlayerExchange.
Definition at line 288 of file exchangemanager.h.
virtual bool Exchange::HandleAccept | ( | Client * | client | ) | [pure virtual] |
One of the client has accepted the exchange.
If both clients have accepted the exchange will end and the items will be exchanged.
client | The client that has accepted the exchange. |
Implemented in PlayerToPlayerExchange, and PlayerToNPCExchange.
virtual void Exchange::HandleEnd | ( | Client * | client | ) | [pure virtual] |
One of the clients has ended this exchange.
This will close the exchange on both the clients without transfer of items.
client | The client that has ended the exchange. |
Implemented in PlayerToPlayerExchange, and PlayerToNPCExchange.
virtual void Exchange::MoveItem | ( | Client * | client, |
int | fromSlot, | ||
int | stackCount, | ||
int | toSlot | ||
) | [virtual] |
Move an item from one slot to another in the exchange.
Will swap items if another item is already in the destination slot. Sends out the relevant network messages.
client | The client that this item came from. |
fromSlot | The originating slot in the exchange window for the item moved. |
stackCount | The number of items being moved. |
toSlot | Where in the exchange the item is to be placed. |
Removes an item from the exchange.
Sends out the network messages to update the clients' views.
fromClient | The client that has removed an item. |
slot | The slot that the items were removed from. |
stackCount | The amount to remove from that slot. |
Reimplemented in PlayerToPlayerExchange.
virtual void Exchange::SendAddItemMessage | ( | Client * | fromClient, |
int | slot, | ||
psCharacterInventory::psCharacterInventoryItem * | item | ||
) | [protected, virtual] |
Reimplemented in PlayerToPlayerExchange.
void Exchange::SendEnd | ( | int | clientNum | ) | [protected] |
Reimplemented in PlayerToPlayerExchange.
bool Exchange::automaticExchange [protected] |
the exchange is done entirely server side don't open windows on the client. This is used only with NPC!
Definition at line 311 of file exchangemanager.h.
bool Exchange::exchangeEnded [protected] |
exchange ended and should be deleted
Definition at line 308 of file exchangemanager.h.
ExchangeManager* Exchange::exchangeMgr [protected] |
Definition at line 313 of file exchangemanager.h.
bool Exchange::exchangeSuccess [protected] |
exchange was successful and items should not be returned to owners
Definition at line 309 of file exchangemanager.h.
int Exchange::id [protected] |
unique exchange ID
Definition at line 301 of file exchangemanager.h.
int Exchange::next_id [static, protected] |
Definition at line 298 of file exchangemanager.h.
uint32_t Exchange::player [protected] |
Definition at line 306 of file exchangemanager.h.
ExchangingCharacter Exchange::starterChar [protected] |
Information about the player that initiated the exchange.
Definition at line 304 of file exchangemanager.h.
Client* Exchange::starterClient [protected] |
Definition at line 305 of file exchangemanager.h.