Planeshift
ServerCharManager Class Reference

Manages character details over the net. More...

#include <psserverchar.h>

Public Member Functions

void BeginStoring (Client *client, gemObject *target, const csString &type)
 Handles a storing beginning. More...
 
void BeginTrading (Client *client, gemObject *target, const csString &type)
 Start trading. More...
 
bool HasConnected (csString name)
 Checked if the character exists still or if it hasn't connected in two months. More...
 
bool Initialize ()
 
bool IsBanned (const char *name)
 
virtual bool SendInventory (uint32_t clientNum, bool sendUpdatesOnly=true)
 Sends the client an inventory. More...
 
void SendOutEquipmentMessages (gemActor *actor, INVENTORY_SLOT_NUMBER slotID, psItem *item, int equipped)
 Sends out equipment messages to all the people around client. More...
 
void SendOutPlaySoundMessage (uint32_t clientNum, const char *itemsound, const char *action)
 Sends out sound messages to the client. More...
 
void SendPlayerMoney (Client *client, bool storage=false)
 
 ServerCharManager (CacheManager *cachemanager, GEMSupervisor *gemsupervisor)
 
virtual bool UpdateItemViews (uint32_t clientNum)
 Update all views with items. More...
 
void ViewItem (Client *client, int containerID, INVENTORY_SLOT_NUMBER slotID)
 
virtual ~ServerCharManager ()
 
- Public Member Functions inherited from MessageManager< ServerCharManager >
void HandleMessage (MsgEntry *msg, Client *client)
 Transfers the message to the manager specific function. More...
 
void Subscribe (FunctionPointer fpt, msgtype type, uint32_t flags=0x01)
 Subscribes this manager to a specific message type with a custom callback. More...
 
bool Unsubscribe (msgtype type)
 Unsubscribes this manager from a specific message type. More...
 
bool Unsubscribe (FunctionPointer handler, msgtype type)
 Unsubscribes a specific handler from a specific message type. More...
 
bool UnsubscribeAll ()
 Unsubscribes this manager from all message types. More...
 
virtual ~MessageManager ()
 Unsubscribes all messages then destroys this object. More...
 
- Public Member Functions inherited from MessageManagerBase
csArray< csString > DecodeCommandArea (Client *client, csString target)
 Decodes an area: expression. More...
 
gemObject * FindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
Client * FindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Static Public Member Functions

static bool TradingCheck (Client *client, gemObject *target, csString *errorMessage=NULL)
 Check if trading is allowed. More...
 

Protected Member Functions

int CalculateMerchantPrice (psItem *item, Client *client, bool sellPrice)
 
void HandleBookWrite (MsgEntry *me, Client *client)
 
void HandleCraftTransInfo (MsgEntry *me, Client *client)
 
void HandleFaction (MsgEntry *me, Client *client)
 
void HandleInventoryMessage (MsgEntry *me, Client *client)
 Handles any incoming messages about the character gui. More...
 
void HandleMerchantBuy (psGUIMerchantMessage &msg, Client *client)
 
void HandleMerchantCategory (psGUIMerchantMessage &msg, Client *client)
 
void HandleMerchantMessage (MsgEntry *me, Client *client)
 
void HandleMerchantRequest (psGUIMerchantMessage &msg, Client *client)
 
void HandleMerchantSell (psGUIMerchantMessage &msg, Client *client)
 
void HandleMerchantView (psGUIMerchantMessage &msg, Client *client)
 
void HandleStorageCategory (psGUIStorageMessage &msg, Client *client)
 Handles the request to change category from the player. More...
 
void HandleStorageMessage (MsgEntry *me, Client *client)
 Handles a message coming from the client for making operations with his storage. More...
 
void HandleStorageRequest (psGUIStorageMessage &msg, Client *client)
 Handles the request to access the storage from the player. More...
 
void HandleStorageStore (psGUIStorageMessage &msg, Client *client)
 Handles the request to store an item from the player. More...
 
void HandleStorageView (psGUIStorageMessage &msg, Client *client)
 Handles the request to check informations about a stored item. More...
 
void HandleStorageWithdraw (psGUIStorageMessage &msg, Client *client)
 Handles the request to withdraw an item from the NPC. More...
 
bool SendMerchantItems (Client *client, psCharacter *merchant, psItemCategory *category)
 
bool SendPlayerItems (Client *client, psItemCategory *category, bool storage)
 
bool SendStorageItems (Client *client, psCharacter *character, psItemCategory *category)
 Sends to the client the stored items for this category. More...
 
void UpdateMusicalSheet (MsgEntry *me, Client *client)
 
void UpdateSketch (MsgEntry *me, Client *client)
 
bool VerifyGoal (Client *client, psCharacter *character, psItem *goal)
 verifies that item dropped in mind slot is a valid goal More...
 
bool VerifyStorage (Client *client, psCharacter *character, psCharacter **storage, const char *trade, const char *itemName, PID storageID)
 Return true if all storage params are ok. More...
 
bool VerifyTrade (Client *client, psCharacter *character, psCharacter **merchant, psMerchantInfo **info, const char *trade, const char *itemName, PID merchantID)
 Return true if all trade params are ok. More...
 
void ViewItem (MsgEntry *me, Client *client)
 

Protected Attributes

CacheManager * cacheManager
 
MathScript * calc_item_merchant_price_buy
 
MathScript * calc_item_merchant_price_sell
 
GEMSupervisor * gemSupervisor
 
SlotManager * slotManager
 

Additional Inherited Members

- Public Types inherited from MessageManager< ServerCharManager >
typedef void(ServerCharManager::* FunctionPointer) (MsgEntry *, Client *)
 

Detailed Description

Manages character details over the net.

This is used instead of cel persistance because the persistance is an all or nothing sort of thing. By using this we can make more efficient use of the net traffic

Definition at line 58 of file psserverchar.h.

Constructor & Destructor Documentation

ServerCharManager::ServerCharManager ( CacheManager *  cachemanager,
GEMSupervisor *  gemsupervisor 
)
virtual ServerCharManager::~ServerCharManager ( )
virtual

Member Function Documentation

void ServerCharManager::BeginStoring ( Client *  client,
gemObject *  target,
const csString &  type 
)

Handles a storing beginning.

Parameters
clientThe client sending us the message.
targetThe target of the storage operation.
type?
void ServerCharManager::BeginTrading ( Client *  client,
gemObject *  target,
const csString &  type 
)

Start trading.

int ServerCharManager::CalculateMerchantPrice ( psItem *  item,
Client *  client,
bool  sellPrice 
)
protected
void ServerCharManager::HandleBookWrite ( MsgEntry *  me,
Client *  client 
)
protected
void ServerCharManager::HandleCraftTransInfo ( MsgEntry *  me,
Client *  client 
)
protected
void ServerCharManager::HandleFaction ( MsgEntry *  me,
Client *  client 
)
protected
void ServerCharManager::HandleInventoryMessage ( MsgEntry *  me,
Client *  client 
)
protected

Handles any incoming messages about the character gui.

void ServerCharManager::HandleMerchantBuy ( psGUIMerchantMessage &  msg,
Client *  client 
)
protected
void ServerCharManager::HandleMerchantCategory ( psGUIMerchantMessage &  msg,
Client *  client 
)
protected
void ServerCharManager::HandleMerchantMessage ( MsgEntry *  me,
Client *  client 
)
protected
void ServerCharManager::HandleMerchantRequest ( psGUIMerchantMessage &  msg,
Client *  client 
)
protected
void ServerCharManager::HandleMerchantSell ( psGUIMerchantMessage &  msg,
Client *  client 
)
protected
void ServerCharManager::HandleMerchantView ( psGUIMerchantMessage &  msg,
Client *  client 
)
protected
void ServerCharManager::HandleStorageCategory ( psGUIStorageMessage &  msg,
Client *  client 
)
protected

Handles the request to change category from the player.

Parameters
msgThe cracked message received from the client.
clientThe client sending us the message.
void ServerCharManager::HandleStorageMessage ( MsgEntry *  me,
Client *  client 
)
protected

Handles a message coming from the client for making operations with his storage.

Parameters
meThe message received from the client.
clientThe client sending us the message.
void ServerCharManager::HandleStorageRequest ( psGUIStorageMessage &  msg,
Client *  client 
)
protected

Handles the request to access the storage from the player.

Parameters
msgThe cracked message received from the client.
clientThe client sending us the message.
void ServerCharManager::HandleStorageStore ( psGUIStorageMessage &  msg,
Client *  client 
)
protected

Handles the request to store an item from the player.

Parameters
msgThe cracked message received from the client.
clientThe client sending us the message.
void ServerCharManager::HandleStorageView ( psGUIStorageMessage &  msg,
Client *  client 
)
protected

Handles the request to check informations about a stored item.

Parameters
msgThe cracked message received from the client.
clientThe client sending us the message.
void ServerCharManager::HandleStorageWithdraw ( psGUIStorageMessage &  msg,
Client *  client 
)
protected

Handles the request to withdraw an item from the NPC.

Parameters
msgThe cracked message received from the client.
clientThe client sending us the message.
bool ServerCharManager::HasConnected ( csString  name)

Checked if the character exists still or if it hasn't connected in two months.

bool ServerCharManager::Initialize ( )
bool ServerCharManager::IsBanned ( const char *  name)
virtual bool ServerCharManager::SendInventory ( uint32_t  clientNum,
bool  sendUpdatesOnly = true 
)
virtual

Sends the client an inventory.

bool ServerCharManager::SendMerchantItems ( Client *  client,
psCharacter *  merchant,
psItemCategory *  category 
)
protected
void ServerCharManager::SendOutEquipmentMessages ( gemActor *  actor,
INVENTORY_SLOT_NUMBER  slotID,
psItem *  item,
int  equipped 
)

Sends out equipment messages to all the people around client.

This is used when a player changes their visible equipment and needs to be reflected on other nearby clients. Visible changes can be either new weapons/shields ( new mesh ) or texture changes for clothes ( new material ).

Parameters
actorThe actor that has changed equipment.
slotIDTo what slot has changed.
itemThe item that is the piece of visible equipment.
equippedThe equiping type. One of: psEquipmentMessage::DEEQUIP psEquipmentMessage::EQUIP
void ServerCharManager::SendOutPlaySoundMessage ( uint32_t  clientNum,
const char *  itemsound,
const char *  action 
)

Sends out sound messages to the client.

Todo:
Modify to be able to send to all the people around client
bool ServerCharManager::SendPlayerItems ( Client *  client,
psItemCategory *  category,
bool  storage 
)
protected
void ServerCharManager::SendPlayerMoney ( Client *  client,
bool  storage = false 
)
bool ServerCharManager::SendStorageItems ( Client *  client,
psCharacter *  character,
psItemCategory *  category 
)
protected

Sends to the client the stored items for this category.

Parameters
clientThe client sending us the message.
charactermerchant ?????
categoryThe category we are browsing
Returns
Always TRUE.
static bool ServerCharManager::TradingCheck ( Client *  client,
gemObject *  target,
csString *  errorMessage = NULL 
)
static

Check if trading is allowed.

Will return true if trading is allowed. Returning a reasion in the errorMessage if a pointer is given.

virtual bool ServerCharManager::UpdateItemViews ( uint32_t  clientNum)
virtual

Update all views with items.

void ServerCharManager::UpdateMusicalSheet ( MsgEntry *  me,
Client *  client 
)
protected
void ServerCharManager::UpdateSketch ( MsgEntry *  me,
Client *  client 
)
protected
bool ServerCharManager::VerifyGoal ( Client *  client,
psCharacter *  character,
psItem *  goal 
)
protected

verifies that item dropped in mind slot is a valid goal

bool ServerCharManager::VerifyStorage ( Client *  client,
psCharacter *  character,
psCharacter **  storage,
const char *  trade,
const char *  itemName,
PID  storageID 
)
protected

Return true if all storage params are ok.

bool ServerCharManager::VerifyTrade ( Client *  client,
psCharacter *  character,
psCharacter **  merchant,
psMerchantInfo **  info,
const char *  trade,
const char *  itemName,
PID  merchantID 
)
protected

Return true if all trade params are ok.

void ServerCharManager::ViewItem ( Client *  client,
int  containerID,
INVENTORY_SLOT_NUMBER  slotID 
)
void ServerCharManager::ViewItem ( MsgEntry *  me,
Client *  client 
)
protected

Member Data Documentation

CacheManager* ServerCharManager::cacheManager
protected

Definition at line 209 of file psserverchar.h.

MathScript* ServerCharManager::calc_item_merchant_price_buy
protected

Definition at line 212 of file psserverchar.h.

MathScript* ServerCharManager::calc_item_merchant_price_sell
protected

Definition at line 213 of file psserverchar.h.

GEMSupervisor* ServerCharManager::gemSupervisor
protected

Definition at line 210 of file psserverchar.h.

SlotManager* ServerCharManager::slotManager
protected

Definition at line 208 of file psserverchar.h.


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