Planeshift
Public Member Functions | Protected Member Functions

PlayerToPlayerExchange Class Reference

#include <exchangemanager.h>

List of all members.

Public Member Functions

virtual bool AddItem (Client *fromClient, INVENTORY_SLOT_NUMBER fromSlot, int stackCount, int toSlot)
 Add an offering item from a client.
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 psItem * GetTargetOffer (int slot)
bool HandleAccept (Client *client)
 One of the client has accepted the exchange.
void HandleEnd (Client *client)
 One of the clients has ended this exchange.
 PlayerToPlayerExchange (Client *client, Client *target, ExchangeManager *manager)
virtual bool RemoveItem (Client *fromClient, int slot, int stackCount)
 Removes an item from the exchange.
void SendExchangeStatusToBoth ()
virtual ~PlayerToPlayerExchange ()

Protected Member Functions

virtual void SendAddItemMessage (Client *fromClient, int slot, psCharacterInventory::psCharacterInventoryItem *item)
virtual void SendRemoveItemMessage (Client *fromClient, int slot)

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 
) [protected, virtual]

Reimplemented from Exchange.

void PlayerToPlayerExchange::SendExchangeStatusToBoth ( )
virtual void PlayerToPlayerExchange::SendRemoveItemMessage ( Client *  fromClient,
int  slot 
) [protected, virtual]

Reimplemented from Exchange.


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