Planeshift
HireManager Class Reference

The Hire Manager will manage all aspects related to hiring of NPCs. More...

#include <hiremanager.h>

Public Member Functions

bool AddHiredNPC (gemNPC *hiredNPC)
 Register a hired NPC with the hire manager. More...
 
bool AddOwner (gemActor *owner)
 Register an owner with the hire manager. More...
 
bool CheckWorkLocationResult (gemNPC *hiredNPC, bool valid, const char *errorMessage)
 Result from work location check. More...
 
gemActorConfirmHire (gemActor *owner)
 Confirm the hire. More...
 
bool HandleScriptMessageRequest (uint32_t clientnum, gemActor *owner, gemNPC *hiredNPC)
 Start Scripting the hire. More...
 
 HireManager ()
 Constructor. More...
 
bool Initialize ()
 Initialize the Hire Manager. More...
 
bool ReleaseHire (gemActor *owner, gemNPC *hiredNPC)
 Release the hire. More...
 
bool SetHireMasterPID (gemActor *owner, PID masterPID)
 Set the PID of the master NPC to use when hiring for a pending hire. More...
 
bool SetHireType (gemActor *owner, const csString &name, const csString &npcType)
 Set the type of NPC to hire for a pending hire. More...
 
bool StartHire (gemActor *owner)
 Start a new Hire Session. More...
 
virtual ~HireManager ()
 Destructor. More...
 
- Public Member Functions inherited from MessageManager< HireManager >
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...
 
gemObjectFindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
ClientFindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Additional Inherited Members

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

Detailed Description

The Hire Manager will manage all aspects related to hiring of NPCs.

Players is allowed to Hire NPCs to do tasks for them. This can include selling of items, standing guard for the guild, etc. This manager handle the business logic related to this. For each hire a HireSession object is created to manage the details of each hire.

Definition at line 49 of file hiremanager.h.

Constructor & Destructor Documentation

HireManager::HireManager ( )

Constructor.

virtual HireManager::~HireManager ( )
virtual

Destructor.

Member Function Documentation

bool HireManager::AddHiredNPC ( gemNPC hiredNPC)

Register a hired NPC with the hire manager.

bool HireManager::AddOwner ( gemActor owner)

Register an owner with the hire manager.

bool HireManager::CheckWorkLocationResult ( gemNPC hiredNPC,
bool  valid,
const char *  errorMessage 
)

Result from work location check.

gemActor* HireManager::ConfirmHire ( gemActor owner)

Confirm the hire.

The Hired NPC will be created and given to player.

bool HireManager::HandleScriptMessageRequest ( uint32_t  clientnum,
gemActor owner,
gemNPC hiredNPC 
)

Start Scripting the hire.

Start scripting of a NPC. This will open the scripting dialog for the NPC.

Parameters
clientnumThe client ID that request scripting.
ownerThe actor that has hired the NPC.
hiredNPCThe NPC that is to be released from hire.
Returns
True if scripting is allowed.
bool HireManager::Initialize ( )

Initialize the Hire Manager.

Handle all initialization that can go wrong.

Returns
True if load suceeded. False if error is fatale and server should not start.
bool HireManager::ReleaseHire ( gemActor owner,
gemNPC hiredNPC 
)

Release the hire.

Release a NPC from hire if the hiredNPC is hired by the owner. The hired NPC will be deleted.

Parameters
ownerThe actor that has hired the NPC.
hiredNPCThe NPC that is to be released from hire.
Returns
True if the NPC was released.
bool HireManager::SetHireMasterPID ( gemActor owner,
PID  masterPID 
)

Set the PID of the master NPC to use when hiring for a pending hire.

Parameters
ownerAn actor that is in progress of hiring.
masterNPCThe master NPC PID.
bool HireManager::SetHireType ( gemActor owner,
const csString &  name,
const csString &  npcType 
)

Set the type of NPC to hire for a pending hire.

Parameters
ownerAn actor that is in progress of hiring.
nameThe name of the type of NPC to hire.
npcTypeThe NPC Type of the type of NPC to hire.
Returns
True if the type was set for a pending hire.
bool HireManager::StartHire ( gemActor owner)

Start a new Hire Session.

Establish the hire session for modification in the hiring process.

Parameters
ownerThe actor that start the process of hiring a NPC.
Returns
True if actor was allowed to start a new hire process.

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