Planeshift
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

ServerCharManager Class Reference

Manages character details over the net. More...

#include <psserverchar.h>

List of all members.

Public Member Functions

void BeginStoring (Client *client, gemObject *target, const csString &type)
 Handles a storing beginning.
void BeginTrading (Client *client, gemObject *target, const csString &type)
 Start trading.
bool HasConnected (csString name)
 Checked if the character exists still or if it hasn't connected in two months.
bool Initialize ()
bool IsBanned (const char *name)
virtual bool SendInventory (uint32_t clientNum, bool sendUpdatesOnly=true)
 Sends the client an inventory.
void SendOutEquipmentMessages (gemActor *actor, INVENTORY_SLOT_NUMBER slotID, psItem *item, int equipped)
 Sends out equipment messages to all the people around client.
void SendOutPlaySoundMessage (uint32_t clientNum, const char *itemsound, const char *action)
 Sends out sound messages to the client.
void SendPlayerMoney (Client *client, bool storage=false)
 ServerCharManager (CacheManager *cachemanager, GEMSupervisor *gemsupervisor)
virtual bool UpdateItemViews (uint32_t clientNum)
 Update all views with items.
void ViewItem (Client *client, int containerID, INVENTORY_SLOT_NUMBER slotID)
virtual ~ServerCharManager ()

Static Public Member Functions

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

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.
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.
void HandleStorageMessage (MsgEntry *me, Client *client)
 Handles a message coming from the client for making operations with his storage.
void HandleStorageRequest (psGUIStorageMessage &msg, Client *client)
 Handles the request to access the storage from the player.
void HandleStorageStore (psGUIStorageMessage &msg, Client *client)
 Handles the request to store an item from the player.
void HandleStorageView (psGUIStorageMessage &msg, Client *client)
 Handles the request to check informations about a stored item.
void HandleStorageWithdraw (psGUIStorageMessage &msg, Client *client)
 Handles the request to withdraw an item from the NPC.
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.
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
bool VerifyStorage (Client *client, psCharacter *character, psCharacter **storage, const char *trade, const char *itemName, PID storageID)
 Return true if all storage params are ok.
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.
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

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

Definition at line 209 of file psserverchar.h.

Definition at line 212 of file psserverchar.h.

Definition at line 213 of file psserverchar.h.

Definition at line 210 of file psserverchar.h.

Definition at line 208 of file psserverchar.h.


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