Planeshift
PlayerToPlayerExchange Class Reference

#include <exchangemanager.h>

Public Member Functions

virtual bool AddItem (Client *fromClient, INVENTORY_SLOT_NUMBER fromSlot, int stackCount, int toSlot)
 Add an offering item from a client. More...
 
bool AdjustMoney (Client *client, int moneyType, int newMoney)
 
bool AdjustMoney (Client *client, const psMoney &money)
 
bool CheckExchange (uint32_t clientNum, bool checkRange=false)
 
virtual void DeleteObjectCallback (iDeleteNotificationObject *object)
 
psMoney GetOfferedMoney (Client *client)
 
virtual psItemGetTargetOffer (int slot)
 
bool HandleAccept (Client *client)
 One of the client has accepted the exchange. More...
 
void HandleEnd (Client *client)
 One of the clients has ended this exchange. More...
 
 PlayerToPlayerExchange (Client *client, Client *target, ExchangeManager *manager)
 
virtual bool RemoveItem (Client *fromClient, int slot, int stackCount)
 Removes an item from the exchange. More...
 
void SendExchangeStatusToBoth ()
 
virtual ~PlayerToPlayerExchange ()
 
- Public Member Functions inherited from Exchange
bool CheckRange (int clientNum, gemObject *ourActor, gemObject *otherActor)
 
 Exchange (Client *starter, bool automaticExchange, ExchangeManager *manager)
 
int GetID () const
 
ClientGetStarterClient ()
 
psItemGetStarterOffer (int slot)
 
virtual void MoveItem (Client *client, int fromSlot, int stackCount, int toSlot)
 Move an item from one slot to another in the exchange. More...
 
virtual ~Exchange ()
 
- Public Member Functions inherited from iDeleteObjectCallback
virtual ~iDeleteObjectCallback ()
 

Protected Member Functions

virtual void SendAddItemMessage (Client *fromClient, int slot, psCharacterInventory::psCharacterInventoryItem *item)
 
virtual void SendRemoveItemMessage (Client *fromClient, int slot)
 
- Protected Member Functions inherited from Exchange
void SendEnd (int clientNum)
 

Additional Inherited Members

- Protected Attributes inherited from Exchange
bool automaticExchange
 the exchange is done entirely server side don't open windows on the client. This is used only with NPC! More...
 
bool exchangeEnded
 exchange ended and should be deleted More...
 
ExchangeManagerexchangeMgr
 
bool exchangeSuccess
 exchange was successful and items should not be returned to owners More...
 
int id
 unique exchange ID More...
 
uint32_t player
 
ExchangingCharacter starterChar
 Information about the player that initiated the exchange. More...
 
ClientstarterClient
 
- Static Protected Attributes inherited from Exchange
static int next_id
 

Detailed Description

Definition at line 318 of file exchangemanager.h.

Constructor & Destructor Documentation

PlayerToPlayerExchange::PlayerToPlayerExchange ( Client client,
Client target,
ExchangeManager manager 
)
virtual PlayerToPlayerExchange::~PlayerToPlayerExchange ( )
virtual

Member Function Documentation

virtual bool PlayerToPlayerExchange::AddItem ( Client fromClient,
INVENTORY_SLOT_NUMBER  fromSlot,
int  stackCount,
int  toSlot 
)
virtual

Add an offering item from a client.

Parameters
fromClientThe client that is offering the item.
fromSlotThe originating slot in the exchange window for the item moved.
stackCountThe number of items being moved.
toSlotThe slot that the item should go in.
Returns
True if the item was added to the exchange correctly.

Reimplemented from Exchange.

bool PlayerToPlayerExchange::AdjustMoney ( Client client,
int  moneyType,
int  newMoney 
)
virtual

Reimplemented from Exchange.

bool PlayerToPlayerExchange::AdjustMoney ( Client client,
const psMoney money 
)
virtual

Reimplemented from Exchange.

bool PlayerToPlayerExchange::CheckExchange ( uint32_t  clientNum,
bool  checkRange = false 
)
virtual void PlayerToPlayerExchange::DeleteObjectCallback ( iDeleteNotificationObject object)
virtual

Implements iDeleteObjectCallback.

psMoney PlayerToPlayerExchange::GetOfferedMoney ( Client client)
virtual

Reimplemented from Exchange.

virtual psItem* PlayerToPlayerExchange::GetTargetOffer ( int  slot)
virtual

Reimplemented from Exchange.

bool PlayerToPlayerExchange::HandleAccept ( Client client)
virtual

One of the client has accepted the exchange.

If both clients have accepted the exchange will end and the items will be exchanged.

Parameters
clientThe client that has accepted the exchange.
Returns
true If the exchange has ended.

Implements Exchange.

void PlayerToPlayerExchange::HandleEnd ( Client client)
virtual

One of the clients has ended this exchange.

This will close the exchange on both the clients without transfer of items.

Parameters
clientThe client that has ended the exchange.

Implements Exchange.

virtual bool PlayerToPlayerExchange::RemoveItem ( Client fromClient,
int  slot,
int  stackCount 
)
virtual

Removes an item from the exchange.

Sends out the network messages to update the clients' views.

Parameters
fromClientThe client that has removed an item.
slotThe slot that the items were removed from.
stackCountThe amount to remove from that slot.
Returns
A new psItem for the items removed.

Reimplemented from Exchange.

virtual void PlayerToPlayerExchange::SendAddItemMessage ( Client fromClient,
int  slot,
psCharacterInventory::psCharacterInventoryItem item 
)
protectedvirtual

Reimplemented from Exchange.

void PlayerToPlayerExchange::SendExchangeStatusToBoth ( )
virtual void PlayerToPlayerExchange::SendRemoveItemMessage ( Client fromClient,
int  slot 
)
protectedvirtual

Reimplemented from Exchange.


The documentation for this class was generated from the following file: