Planeshift
WorkManager Class Reference

This class handles all calculations around work, using statistics and information from the pspccharacterinfo Prop Classes for both the worker and the target. More...

#include <workmanager.h>

Public Member Functions

void HandleCombine (Client *client)
 Start Combine work This gets called when the player tries to combine items in a container using /combine command. More...
 
void HandleConstruct (Client *client)
 Begins construction work. More...
 
void HandleProduction (gemActor *actor, const char *type, const char *reward)
 Handle production events from super clients. More...
 
void HandleUse (Client *client)
 Handles using an item for working. More...
 
bool LoadLocalVars (Client *client, gemObject *target=NULL)
 Sets up the internal structure of the work manager to handle a particular client. More...
 
void StartAutoWork (Client *client, gemContainer *container, psItem *autoItem, int count)
 Start a work event for this client. More...
 
void StartLockpick (Client *client, psItem *item)
 Lockpicking. More...
 
bool StartScriptWork (Client *client, gemObject *target, csString pattern)
 Checks to see if the progression script generated craft work can be done. More...
 
void StopWork (Client *client, psItem *item)
 Stop work event. More...
 
 WorkManager (CacheManager *cachemanager, EntityManager *entitymanager)
 
virtual ~WorkManager ()
 
Work Event Handlers

These are the functions fired when a psWorkGameEvent is Triggered.

void HandleWorkEvent (psWorkGameEvent *workEvent)
 Handles a transformation/combination event. More...
 
void HandleCleanupEvent (psWorkGameEvent *workEvent)
 Handles a cleanup event. More...
 
void HandleProductionEvent (psWorkGameEvent *workEvent)
 Handles a resource/harvesting event. More...
 
void HandleRepairEvent (psWorkGameEvent *workEvent)
 Handles a repair event, which occurs after a few seconds of repairing an item. More...
 
void LockpickComplete (psWorkGameEvent *workEvent)
 
- Public Member Functions inherited from MessageManager< WorkManager >
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)
 

Static Public Member Functions

Constraint Functions
static bool constraintTime (WorkManager *that, char *param)
 
static bool constraintFriends (WorkManager *that, char *param)
 
static bool constraintLocation (WorkManager *that, char *param)
 
static bool constraintMode (WorkManager *that, char *param)
 
static bool constraintGender (WorkManager *that, char *param)
 
static bool constraintRace (WorkManager *that, char *param)
 

Protected Member Functions

bool AnyCombination (csArray< psItem * > itemArray, uint32 &resultId, int &resultQty)
 Returns with the result ID and quantity of the combination if the item list is in set of unique ingredients for that pattern. More...
 
unsigned int AnyTransform (csArray< psTradePatterns * > &patterns, float &KFactor, uint32 targetId, int targetQty)
 Check to see if there is a possible trasnform available. More...
 
void ApplyProcessScript (psItem *oldItem, psItem *newItem, gemActor *worker, psTradeProcesses *process, psTradeTransformations *trans)
 Applies the mathscript defined for the process over items being produced. More...
 
int CalculateEventDuration (psTradeTransformations *trans, psTradeProcesses *process, psItem *transItem, gemActor *worker)
 Calculates the event duration to accomplish a work using a math script. More...
 
bool CalculateQuality (float factor, psItem *transItem, gemActor *worker, bool amountModifier, float &currentQuality, psTradeProcesses *process, psTradeTransformations *trans, csTicks time)
 Calculates the quality of the item based on the skills applied. More...
 
bool CheckStamina (psCharacter *owner) const
 
psItemCombineContainedItem (uint32 newId, int newQty, float itemQuality, psItem *containerItem)
 
bool CombineWork ()
 
psItemCreateTradeItem (uint32 newId, int newQty, float itemQuality, bool transient=false)
 
csArray< NearNaturalResourceFindNearestResource (iSector *sector, csVector3 &pos, const size_t action, const char *reward=NULL)
 Find the nearest resource to the player of the requested type. More...
 
void HandleLockPick (MsgEntry *me, Client *client)
 
void HandleProduction (gemActor *actor, size_t type, const char *reward, Client *client=NULL)
 Handle production events from clients. More...
 
void HandleRepair (gemActor *actor, Client *client, const csString &repairSlotName)
 This function handles commands like "/repair" using the following sequence of steps. More...
 
void HandleWorkCommand (MsgEntry *me, Client *client)
 
void Initialize ()
 
bool IsContainerCombinable (uint32 &resultId, int &resultQty)
 Returns with the result ID and quantity of the combination if work item container has the correct items in the correct amounts. More...
 
bool IsHandCombinable (uint32 &resultId, int &resultQty)
 Returns with the result ID and quantity of the combination if player has the correct items in the correct amounts in hand. More...
 
bool IsIngredient (uint32 patternId, uint32 targetId)
 
bool IsOnHand (uint32 equipId)
 
unsigned int IsTransformable (uint32 patternId, uint32 targetId, int targetQty)
 Check to see if there is a possible trasnform available. More...
 
bool MatchCombinations (csArray< psItem * > itemArray, CombinationConstruction *current, int &multiplier)
 Returns true then item array matchs combination array regardless of order. More...
 
bool SameProductionPosition (gemActor *actor, const csVector3 &startPos)
 
bool ScriptAction (gemActionLocation *gemAction)
 
bool ScriptActor (gemActor *gemAct)
 
bool ScriptItem (gemItem *gemItm)
 
bool ScriptNoTarget ()
 
void SendTransformError (uint32_t clientNum, unsigned int result, uint32 curItemId=0, int CurItemQty=0)
 Sends an error message to the client based on the trade pattern error. More...
 
void StartCleanupEvent (int transType, Client *client, psItem *item, gemActor *worker)
 
void StartCombineWork (Client *client)
 Checks to see if the work container item can be used for combining. More...
 
void StartConstructWork (Client *client)
 Checks to see if the item can be constructed. More...
 
void StartTransformationEvent (int transType, INVENTORY_SLOT_NUMBER transSlot, int resultQty, float resultQuality, psItem *autoItem)
 
void StartUseWork (Client *client)
 Checks to see if the item can be used for working. More...
 
void StopAutoWork (Client *client, psItem *autoItem)
 Stop auto work event. More...
 
void StopCleanupWork (Client *client, psItem *cleanItem)
 Handles stopping the cleanup event for a particular item. More...
 
void StopCombineWork (Client *client)
 Handles stopping the combining in the work container. More...
 
void StopConstructWork (Client *client)
 Handles stopping the constructing of an item. More...
 
void StopUseWork (MsgEntry *me, Client *client)
 Handles stopping the use of the item for working. More...
 
psItemTransformContainedItem (psItem *oldItem, uint32 newId, int newQty, float itemQuality, psTradeProcesses *process, psTradeTransformations *trans)
 
psItemTransformSelfContainerItem (psItem *oldItem, uint32 newId, int newQty, float itemQuality, psTradeProcesses *process, psTradeTransformations *trans)
 
psItemTransformSlotItem (INVENTORY_SLOT_NUMBER slot, uint32 newId, int newQty, float itemQuality, psTradeProcesses *process, psTradeTransformations *trans)
 
psItemTransformTargetItem (psItem *oldItem, uint32 newId, int newQty, float itemQuality, psTradeProcesses *process, psTradeTransformations *trans)
 
void TransformTargetItemToNpc (psItem *workItem, Client *client)
 
psItemTransformTargetSlotItem (INVENTORY_SLOT_NUMBER slot, uint32 newId, int newQty, float itemQuality, psTradeProcesses *process, psTradeTransformations *trans)
 
bool ValidateCombination (csArray< psItem * > itemArray, uint32 &resultId, int &resultQty)
 Returns with the result ID and quantity of the combination if the item list matches every item in a valid combination. More...
 
bool ValidateConstraints (psTradeTransformations *transCandidate, psTradeProcesses *processCandidate)
 
bool ValidateMind ()
 
bool ValidateNotOverSkilled (psTradeTransformations *transCandidate, psTradeProcesses *processCandidate)
 
bool ValidateSkills (psTradeTransformations *transCandidate, psTradeProcesses *processCandidate)
 
bool ValidateStamina (Client *client)
 
bool ValidateTarget (Client *client)
 
bool ValidateTraining (psTradeTransformations *transCandidate, psTradeProcesses *processCandidate)
 
bool ValidateWork ()
 

Protected Attributes

MathScriptcalc_combine_quality
 This is the calculation for the quality of combined work items. More...
 
MathScriptcalc_lockpick_time
 This is the calculation for how long it takes to pick a lock. More...
 
MathScriptcalc_lockpicking_exp
 This is the calculation for the experience to assign to player for lockpicking. More...
 
MathScriptcalc_mining_chance
 This is the calculation for chance of successful mining. More...
 
MathScriptcalc_mining_exp
 This is the calculation for the experience to assign to player for mining. More...
 
MathScriptcalc_repair_exp
 This is the calculation for the experience to assign to player for repairing. More...
 
MathScriptcalc_repair_quality
 This calculates the item ending quality and max quality at the end of repair. More...
 
MathScriptcalc_repair_rank
 This is the calculation for how much skill is required to repair. More...
 
MathScriptcalc_repair_result
 This is the calculation for how many points of quality are added in a repair. More...
 
MathScriptcalc_repair_time
 This is the calculation for how long a repair takes. More...
 
MathScriptcalc_transform_apply_skill
 This is the calculation for the quality resulting from the item. More...
 
MathScriptcalc_transform_exp
 This is the calculation for the experience to assign to player for trasformations. More...
 
MathScriptcalc_transform_practice
 This is the calculation for the practice to assign to player for trasformations. More...
 
MathScriptcalc_transform_time
 This is the calculation for the time needed to accomplish a transformation. More...
 
csPDelArray< NaturalResourceresources
 list of all natural resources in game. More...
 
csStringArray resourcesActions
 List of all actions usable with natural resources. More...
 

Additional Inherited Members

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

Detailed Description

This class handles all calculations around work, using statistics and information from the pspccharacterinfo Prop Classes for both the worker and the target.

Definition at line 159 of file workmanager.h.

Constructor & Destructor Documentation

WorkManager::WorkManager ( CacheManager cachemanager,
EntityManager entitymanager 
)
virtual WorkManager::~WorkManager ( )
virtual

Member Function Documentation

bool WorkManager::AnyCombination ( csArray< psItem * >  itemArray,
uint32 &  resultId,
int resultQty 
)
protected

Returns with the result ID and quantity of the combination if the item list is in set of unique ingredients for that pattern.

Parameters
itemArrayThe array of items that need to be checked.
resultIdThe item ID of the resulting item.
resultQtyThe stack quantity of the resulting item.
Returns
False if combination is not possible.
unsigned int WorkManager::AnyTransform ( csArray< psTradePatterns * > &  patterns,
float KFactor,
uint32  targetId,
int  targetQty 
)
protected

Check to see if there is a possible trasnform available.

Parameters
patternsThe list of all applicable patters to apply (including group patterns)
KFactorThe KFactor
targetIdThe id of the item trying to transform.
targetQtyThe stack count of the item to transform.
Returns
An indicator of pattern match status.
void WorkManager::ApplyProcessScript ( psItem oldItem,
psItem newItem,
gemActor worker,
psTradeProcesses process,
psTradeTransformations trans 
)
protected

Applies the mathscript defined for the process over items being produced.

It checks if there is a mathscript defined (empty string to disable), if it's defined it will try to recover the mathscript if available, if it succeeds it sets NewItem OldItem Worker and Process in the math environment and runs the script. The function has no return as the mathscript is supposed to apply the effects directly on the targets passed in the environmnent.

Parameters
oldItemThe item which is going to be destructed (the old item).
newItemThe newly created item.
workerThe actor which is working on the item.
processThe process applied to create the new item by the worker.
transThe transform applied to create the new item by the worker.
int WorkManager::CalculateEventDuration ( psTradeTransformations trans,
psTradeProcesses process,
psItem transItem,
gemActor worker 
)
protected

Calculates the event duration to accomplish a work using a math script.

Parameters
transThe transformation which is being applied.
processThe process.
transItemThe item which is being transformed.
workerThe actor which is working on the object.
Returns
The amount of time which will be needed to complete the work.
bool WorkManager::CalculateQuality ( float  factor,
psItem transItem,
gemActor worker,
bool  amountModifier,
float currentQuality,
psTradeProcesses process,
psTradeTransformations trans,
csTicks  time 
)
protected

Calculates the quality of the item based on the skills applied.

bool WorkManager::CheckStamina ( psCharacter owner) const
protected
psItem* WorkManager::CombineContainedItem ( uint32  newId,
int  newQty,
float  itemQuality,
psItem containerItem 
)
protected
Parameters
newIdThe new ID
newQtyThe new number of items.
itemQualityThe new items quality.
containerItemThe container.
bool WorkManager::CombineWork ( )
protected
static bool WorkManager::constraintFriends ( WorkManager that,
char *  param 
)
static
static bool WorkManager::constraintGender ( WorkManager that,
char *  param 
)
static
static bool WorkManager::constraintLocation ( WorkManager that,
char *  param 
)
static
static bool WorkManager::constraintMode ( WorkManager that,
char *  param 
)
static
static bool WorkManager::constraintRace ( WorkManager that,
char *  param 
)
static
static bool WorkManager::constraintTime ( WorkManager that,
char *  param 
)
static
psItem* WorkManager::CreateTradeItem ( uint32  newId,
int  newQty,
float  itemQuality,
bool  transient = false 
)
protected
csArray<NearNaturalResource> WorkManager::FindNearestResource ( iSector *  sector,
csVector3 &  pos,
const size_t  action,
const char *  reward = NULL 
)
protected

Find the nearest resource to the player of the requested type.

Parameters
sectorA pointer to the iSector the player is currently in.
posA csVector3 with the position of the player in the current sector.
actionThe position in the resourcesActions array of the requested production type.
rewardThe name of the natural resource we are looking for.
void WorkManager::HandleCleanupEvent ( psWorkGameEvent workEvent)

Handles a cleanup event.

Basically removing discarded items from public containers.

Parameters
workEventThe work event that was in the queue to fire.
void WorkManager::HandleCombine ( Client client)

Start Combine work This gets called when the player tries to combine items in a container using /combine command.

Parameters
clientThe client that combines
void WorkManager::HandleConstruct ( Client client)

Begins construction work.

This is called when a player attempts to build a constructable item.

Parameters
clientThe client that construct
void WorkManager::HandleLockPick ( MsgEntry me,
Client client 
)
protected
void WorkManager::HandleProduction ( gemActor actor,
const char *  type,
const char *  reward 
)

Handle production events from super clients.

void WorkManager::HandleProduction ( gemActor actor,
size_t  type,
const char *  reward,
Client client = NULL 
)
protected

Handle production events from clients.

This function handles commands like "/dig for gold" using the following sequence of steps:

  1. Make sure client isn't already busy digging, etc.
  2. Find closest natural resource
  3. Validate category of equipped item
  4. Calculate time required
  5. Send anim and confirmation message to client
  6. Queue up game event for success
Parameters
actorThe actor
typeThe position in the resourcesActions array of the requested production type.
rewardThe name of the natural resource we are looking for.
clientThe client that issues the command
void WorkManager::HandleProductionEvent ( psWorkGameEvent workEvent)

Handles a resource/harvesting event.

Basically the production events.

Parameters
workEventThe work event that was in the queue to fire.
void WorkManager::HandleRepair ( gemActor actor,
Client client,
const csString &  repairSlotName 
)
protected

This function handles commands like "/repair" using the following sequence of steps.

  1. Make sure client isn't already busy digging, etc.
  2. Check for repairable item in right hand slot
  3. Check for required repair kit item in any inventory slot
  4. Calculate time required for repair based on item and skill level
  5. Calculate result after repair
  6. Queue time event to trigger when repair is complete, if not canceled.
    Parameters
    actorThe actor that issues the command
    clientThe client that issues the command, NULL if NPCClient
    repairSlotNamethe slot name which should be repaired.
void WorkManager::HandleRepairEvent ( psWorkGameEvent workEvent)

Handles a repair event, which occurs after a few seconds of repairing an item.

This function handles the conclusion timer of when a repair is completed. It is not called if the event is cancelled. It follows the following sequence of steps.

  1. The values are all pre-calculated, so just adjust the quality of the item directly.
  2. Consume the repair required item, if flagged to do so.
  3. Notify the user.
Parameters
workEventThe work event that was in the queue to fire.
void WorkManager::HandleUse ( Client client)

Handles using an item for working.

This is called when an item is tagetted and the use command issued.

Parameters
clientThe client that placed the item inside
void WorkManager::HandleWorkCommand ( MsgEntry me,
Client client 
)
protected
void WorkManager::HandleWorkEvent ( psWorkGameEvent workEvent)

Handles a transformation/combination event.

Basically the manufacturing events.

Parameters
workEventThe work event that was in the queue to fire.
void WorkManager::Initialize ( )
protected
bool WorkManager::IsContainerCombinable ( uint32 &  resultId,
int resultQty 
)
protected

Returns with the result ID and quantity of the combination if work item container has the correct items in the correct amounts.

Note
This assumes that the combination items array is sorted by resultId and then itemId
Parameters
resultIdThe item ID of the resulting item.
resultQtyThe stack quantity of the resulting item.
Returns
False if combination is not possible.
bool WorkManager::IsHandCombinable ( uint32 &  resultId,
int resultQty 
)
protected

Returns with the result ID and quantity of the combination if player has the correct items in the correct amounts in hand.

Note
This assumes that the combination items array is sorted by resultId and then itemId.
Parameters
resultIdThe item ID of the resulting item.
resultQtyThe stack quantity of the resulting item.
Returns
False if combination is not possible.
bool WorkManager::IsIngredient ( uint32  patternId,
uint32  targetId 
)
protected
bool WorkManager::IsOnHand ( uint32  equipId)
protected
unsigned int WorkManager::IsTransformable ( uint32  patternId,
uint32  targetId,
int  targetQty 
)
protected

Check to see if there is a possible trasnform available.

Parameters
patternIdThe current pattern to use
targetIdthe id of the item trying to transform.
targetQtyThe stack count of the item to transform.
Returns
An indicator of pattern match status.
bool WorkManager::LoadLocalVars ( Client client,
gemObject target = NULL 
)

Sets up the internal structure of the work manager to handle a particular client.

This sets many variables of the workmanager to work with a single user at a time.

Parameters
clientThe client that is the current one to use.
targetThe object for which the client is targetting.
Returns
False if there is a problem loading stuff.
void WorkManager::LockpickComplete ( psWorkGameEvent workEvent)
bool WorkManager::MatchCombinations ( csArray< psItem * >  itemArray,
CombinationConstruction current,
int multiplier 
)
protected

Returns true then item array matchs combination array regardless of order.

Parameters
itemArrayThe array of items that need to be checked.
currentThe combination structure that includes an array of items
multiplierthis value will tell how many times this combination is run
Returns
False if combination is not possible.
bool WorkManager::SameProductionPosition ( gemActor actor,
const csVector3 &  startPos 
)
protected
bool WorkManager::ScriptAction ( gemActionLocation gemAction)
protected
bool WorkManager::ScriptActor ( gemActor gemAct)
protected
bool WorkManager::ScriptItem ( gemItem gemItm)
protected
bool WorkManager::ScriptNoTarget ( )
protected
void WorkManager::SendTransformError ( uint32_t  clientNum,
unsigned int  result,
uint32  curItemId = 0,
int  CurItemQty = 0 
)
protected

Sends an error message to the client based on the trade pattern error.

See also
TradePatternMatch for the list of error conditions.
Parameters
clientNumthe client to send the message to.
resultThe error code from the transformable test.
curItemIdThe current item ID.
CurItemQtyThe current item quantity.
void WorkManager::StartAutoWork ( Client client,
gemContainer container,
psItem autoItem,
int  count 
)

Start a work event for this client.

This is called when an item is placed in a container. If the container is an auto-transform container it can transform items automatically ( ie placing items in automatically triggers the transformation process to start ).

Parameters
clientThe client that placed the item inside
containerThe work item container that can transform an item.
autoItemThe item that was placed inside and to be transformed.
countThe stack count of the item placed in.
void WorkManager::StartCleanupEvent ( int  transType,
Client client,
psItem item,
gemActor worker 
)
protected
void WorkManager::StartCombineWork ( Client client)
protected

Checks to see if the work container item can be used for combining.

Parameters
clientThe client that issues the /combine command
void WorkManager::StartConstructWork ( Client client)
protected

Checks to see if the item can be constructed.

Parameters
clientThe client that issues the /construct command
void WorkManager::StartLockpick ( Client client,
psItem item 
)

Lockpicking.

bool WorkManager::StartScriptWork ( Client client,
gemObject target,
csString  pattern 
)

Checks to see if the progression script generated craft work can be done.

Parameters
clientThe client for the actor that initiates that progressions script
targetTargetted item
patternPattern name passed in progressions cript
Returns
False if there is a problem doing the craft.
void WorkManager::StartTransformationEvent ( int  transType,
INVENTORY_SLOT_NUMBER  transSlot,
int  resultQty,
float  resultQuality,
psItem autoItem 
)
protected
void WorkManager::StartUseWork ( Client client)
protected

Checks to see if the item can be used for working.

Parameters
clientThe client that issues the /use command
void WorkManager::StopAutoWork ( Client client,
psItem autoItem 
)
protected

Stop auto work event.

This is called when a client removes an item from any container before it has had a chance to transform the item.

Parameters
clientThe client that removed the item.
autoItemThe item that was being transformed.
void WorkManager::StopCleanupWork ( Client client,
psItem cleanItem 
)
protected

Handles stopping the cleanup event for a particular item.

This is called when an item is removed from a container.

Parameters
clientThe client that removes the item
cleanItemThe item that is removed
void WorkManager::StopCombineWork ( Client client)
protected

Handles stopping the combining in the work container.

This is called when an item is tagetted and the /combine command issued and it's already in use.

Parameters
clientThe client that issues the /combine command
void WorkManager::StopConstructWork ( Client client)
protected

Handles stopping the constructing of an item.

This is called when an item is tagetted and the /construct command issued and it's already in use.

Parameters
clientThe client that issues the /construct command
void WorkManager::StopUseWork ( MsgEntry me,
Client client 
)
protected

Handles stopping the use of the item for working.

This is called when an item is tagetted and the /use command issued and it's already in use.

Parameters
meThe message entry.
clientThe client that issues the /use command.
void WorkManager::StopWork ( Client client,
psItem item 
)

Stop work event.

This is called when a client removes an item from a container.

Parameters
clientThe client that removed the item.
itemThe item that was being transformed.
psItem* WorkManager::TransformContainedItem ( psItem oldItem,
uint32  newId,
int  newQty,
float  itemQuality,
psTradeProcesses process,
psTradeTransformations trans 
)
protected
Parameters
oldItemThe item which is going to be destructed (the old item).
newIdThe id of the new.
newQtyThe new number of items.
itemQualityThe new items quality.
processThe process which was applied in order to generate this item, if any, else NULL.
transThe transformation which was applied in order to generate this item, if any, else NULL.
psItem* WorkManager::TransformSelfContainerItem ( psItem oldItem,
uint32  newId,
int  newQty,
float  itemQuality,
psTradeProcesses process,
psTradeTransformations trans 
)
protected
Parameters
oldItemThe item which is going to be destructed (the old item).
newIdThe id of the new.
newQtyThe new number of items.
itemQualityThe new items quality.
processThe process which was applied in order to generate this item, if any, else NULL.
transThe transformation which was applied in order to generate this item, if any, else NULL.
psItem* WorkManager::TransformSlotItem ( INVENTORY_SLOT_NUMBER  slot,
uint32  newId,
int  newQty,
float  itemQuality,
psTradeProcesses process,
psTradeTransformations trans 
)
protected
Parameters
slotThe slot
newIdThe new ID
newQtyThe new number of items.
itemQualityThe new items quality.
processThe process which was applied in order to generate this item, if any, else NULL.
transThe transformation which was applied in order to generate this item, if any, else NULL.
psItem* WorkManager::TransformTargetItem ( psItem oldItem,
uint32  newId,
int  newQty,
float  itemQuality,
psTradeProcesses process,
psTradeTransformations trans 
)
protected
Parameters
oldItemThe item which is going to be destructed (the old item).
newIdThe id of the new.
newQtyThe new number of items.
itemQualityThe new items quality.
processThe process which was applied in order to generate this item, if any, else NULL.
transThe transformation which was applied in order to generate this item, if any, else NULL.
void WorkManager::TransformTargetItemToNpc ( psItem workItem,
Client client 
)
protected
psItem* WorkManager::TransformTargetSlotItem ( INVENTORY_SLOT_NUMBER  slot,
uint32  newId,
int  newQty,
float  itemQuality,
psTradeProcesses process,
psTradeTransformations trans 
)
protected
Parameters
slotThe slot
newIdThe new ID
newQtyThe new number of items.
itemQualityThe new items quality.
processThe process which was applied in order to generate this item, if any, else NULL.
transThe transformation which was applied in order to generate this item, if any, else NULL.
bool WorkManager::ValidateCombination ( csArray< psItem * >  itemArray,
uint32 &  resultId,
int resultQty 
)
protected

Returns with the result ID and quantity of the combination if the item list matches every item in a valid combination.

Parameters
itemArrayThe array of items that need to be checked.
resultIdThe item ID of the resulting item.
resultQtyThe stack quantity of the resulting item.
Returns
False if combination is not possible.
bool WorkManager::ValidateConstraints ( psTradeTransformations transCandidate,
psTradeProcesses processCandidate 
)
protected
bool WorkManager::ValidateMind ( )
protected
bool WorkManager::ValidateNotOverSkilled ( psTradeTransformations transCandidate,
psTradeProcesses processCandidate 
)
protected
bool WorkManager::ValidateSkills ( psTradeTransformations transCandidate,
psTradeProcesses processCandidate 
)
protected
bool WorkManager::ValidateStamina ( Client client)
protected
bool WorkManager::ValidateTarget ( Client client)
protected
bool WorkManager::ValidateTraining ( psTradeTransformations transCandidate,
psTradeProcesses processCandidate 
)
protected
bool WorkManager::ValidateWork ( )
protected

Member Data Documentation

MathScript* WorkManager::calc_combine_quality
protected

This is the calculation for the quality of combined work items.

Definition at line 340 of file workmanager.h.

MathScript* WorkManager::calc_lockpick_time
protected

This is the calculation for how long it takes to pick a lock.

Definition at line 337 of file workmanager.h.

MathScript* WorkManager::calc_lockpicking_exp
protected

This is the calculation for the experience to assign to player for lockpicking.

Definition at line 332 of file workmanager.h.

MathScript* WorkManager::calc_mining_chance
protected

This is the calculation for chance of successful mining.

Definition at line 333 of file workmanager.h.

MathScript* WorkManager::calc_mining_exp
protected

This is the calculation for the experience to assign to player for mining.

Definition at line 334 of file workmanager.h.

MathScript* WorkManager::calc_repair_exp
protected

This is the calculation for the experience to assign to player for repairing.

Definition at line 331 of file workmanager.h.

MathScript* WorkManager::calc_repair_quality
protected

This calculates the item ending quality and max quality at the end of repair.

Definition at line 330 of file workmanager.h.

MathScript* WorkManager::calc_repair_rank
protected

This is the calculation for how much skill is required to repair.

Definition at line 327 of file workmanager.h.

MathScript* WorkManager::calc_repair_result
protected

This is the calculation for how many points of quality are added in a repair.

Definition at line 329 of file workmanager.h.

MathScript* WorkManager::calc_repair_time
protected

This is the calculation for how long a repair takes.

Definition at line 328 of file workmanager.h.

MathScript* WorkManager::calc_transform_apply_skill
protected

This is the calculation for the quality resulting from the item.

Definition at line 338 of file workmanager.h.

MathScript* WorkManager::calc_transform_exp
protected

This is the calculation for the experience to assign to player for trasformations.

Definition at line 335 of file workmanager.h.

MathScript* WorkManager::calc_transform_practice
protected

This is the calculation for the practice to assign to player for trasformations.

Definition at line 336 of file workmanager.h.

MathScript* WorkManager::calc_transform_time
protected

This is the calculation for the time needed to accomplish a transformation.

Definition at line 339 of file workmanager.h.

csPDelArray<NaturalResource> WorkManager::resources
protected

list of all natural resources in game.

Definition at line 321 of file workmanager.h.

csStringArray WorkManager::resourcesActions
protected

List of all actions usable with natural resources.

Note
this must be never sorted in any way as it's cross referenced in resources so the array position of the string is extremely important to be mantained

Definition at line 326 of file workmanager.h.


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