20 #ifndef __WORKMANAGER_H__ 21 #define __WORKMANAGER_H__ 26 #include <csutil/sysfunc.h> 51 #define GARBAGE_PATTERNID 1 52 #define CLEANUP_DELAY 600 53 //#define CLEANUP_DELAY 10 177 void HandleUse(
Client* client);
185 void HandleCombine(
Client* client);
194 void HandleConstruct(
Client* client);
218 bool StartScriptWork(
Client* client,
gemObject* target, csString pattern);
281 static bool constraintTime(
WorkManager* that,
char* param);
282 static bool constraintFriends(
WorkManager* that,
char* param);
283 static bool constraintLocation(
WorkManager* that,
char* param);
284 static bool constraintMode(
WorkManager* that,
char* param);
285 static bool constraintGender(
WorkManager* that,
char* param);
286 static bool constraintRace(
WorkManager* that,
char* param);
318 void HandleProduction(
gemActor* actor,
const char* type,
const char*
reward);
371 void StartUseWork(
Client* client);
379 void StopCombineWork(
Client* client);
386 void StartCombineWork(
Client* client);
393 void StartConstructWork(
Client* client);
401 void StopConstructWork(
Client* client);
410 void StopCleanupWork(
Client* client,
psItem* cleanItem);
422 void SendTransformError(uint32_t clientNum,
unsigned int result, uint32 curItemId = 0,
int CurItemQty = 0);
436 bool IsContainerCombinable(uint32 &resultId,
int &resultQty);
450 bool IsHandCombinable(uint32 &resultId,
int &resultQty);
462 bool ValidateCombination(csArray<psItem*> itemArray, uint32 &resultId,
int &resultQty);
474 bool AnyCombination(csArray<psItem*> itemArray, uint32 &resultId,
int &resultQty);
497 unsigned int AnyTransform(csArray<psTradePatterns*> &patterns,
float &KFactor, uint32 targetId,
int targetQty);
508 unsigned int IsTransformable(uint32 patternId, uint32 targetId,
int targetQty);
510 bool ScriptNoTarget();
512 bool ScriptItem(
gemItem* gemItm);
516 bool IsIngredient(uint32 patternId, uint32 targetId);
545 psItem* CombineContainedItem(uint32 newId,
int newQty,
float itemQuality,
psItem* containerItem);
577 void TransformTargetItemToNpc(
psItem* workItem,
Client* client);
599 float resultQuality,
psItem* autoItem);
602 bool ValidateTarget(
Client* client);
605 bool ValidateStamina(
Client* client);
606 bool IsOnHand(uint32 equipId);
607 psItem* CreateTradeItem(uint32 newId,
int newQty,
float itemQuality,
bool transient =
false);
647 void HandleRepair(
gemActor* actor,
Client* client,
const csString &repairSlotName);
667 void HandleProduction(
gemActor* actor,
size_t type,
const char* reward,
Client* client = NULL);
669 bool SameProductionPosition(
gemActor* actor,
const csVector3 &startPos);
679 csArray<NearNaturalResource> FindNearestResource(iSector*
sector, csVector3 &pos,
const size_t action,
const char* reward = NULL);
683 csWeakRef<gemActor> worker;
690 csArray<psTradePatterns*> patterns;
691 uint32 groupPatternId;
692 float patternKFactor;
693 float currentQuality;
696 const char* preworkModeString;
716 csArray<NearNaturalResource>* natres=NULL,
719 float repairAmount=0.0F);
724 virtual void Trigger();
737 return transformation;
755 return resultQuantity;
759 resultQuantity = newQuantity;
765 return resultQuality;
769 resultQuality = newQuality;
831 csArray<NearNaturalResource>
nrr;
int anim_duration_seconds
Length of time the animation should play.
There was a any item garbage transform that matched correctly.
This class keeps the hit of natural resources found for the player and allows ordering of them in an ...
void SetResultQuantity(int newQuantity)
size_t action
The action you need to take to get this resource. < Id Corresponding to resourcesActions index...
csPDelArray< NaturalResource > resources
list of all natural resources in game.
Manages CEL entities on the server.
MathScript * calc_mining_chance
This is the calculation for chance of successful mining.
Transforming an item in an equipped slot.
int GetTransformationType()
transformation type
There was no pattern found.
MathScript * calc_repair_rank
This is the calculation for how much skill is required to repair.
void SetTransformationItem(psItem *i)
Failed one or more contstraints on the transform.
Represents a skill an NPC, player or pet can learn.
NearNaturalResource(NaturalResource *res, float distance)
MathScript * calc_lockpicking_exp
This is the calculation for the experience to assign to player for lockpicking.
csWeakRef< gemActor > worker
MathScript * calc_mining_exp
This is the calculation for the experience to assign to player for mining.
No item found to use with work item.
A MathScript is a mini-program to run.
Too tired to do trade skill work.
INVENTORY_SLOT_NUMBER
Holds a list of the possible socket identifiers that items can be attached to.
MathScript * calc_transform_exp
This is the calculation for the experience to assign to player for trasformations.
void SetKFactor(float newFactor)
void SetResultQuality(float newQuality)
The structure of 1 queue entry (pointer to a message)
psTradeProcesses * process
Transforming an item that is in a container.
Transform found but not correct equipment.
psSkillInfo * skill
Skill used to harvest resource.
MathScript * calc_lockpick_time
This is the calculation for how long it takes to pick a lock.
float visible_radius
Radius around the centre where resource is visible.
int sector
The id of the sector this resource is in.
Any semi-autonomous object, either a player or an NPC.
void SetTransformationSlot(INVENTORY_SLOT_NUMBER curSlot)
MathScript * calc_repair_time
This is the calculation for how long a repair takes.
psItem * GetTranformationItem()
float GetResultQuality()
result quality is calculated immediately before the event
Transforming a container to another item.
gemContainers are the public containers in the world for crafting, like forges or ovens...
csString reward_nickname
Item name of the reward.
csVector3 loc
Centre point of resource location.
MathScript * calc_repair_exp
This is the calculation for the experience to assign to player for repairing.
MathScript * calc_transform_time
This is the calculation for the time needed to accomplish a transformation.
Combination items or ammounts not correct.
Transforming an item that is in a container in an equipped slot.
Each item has a list of items required for its construction.
MathScript * calc_combine_quality
This is the calculation for the quality of combined work items.
csString anim
Name of animation to play while harvesting.
csStringArray resourcesActions
List of all actions usable with natural resources.
float probability
Probability of finding resource on attempt.
Item was ok for transform but quantity was not.
uint32_t effectID
The id of the psEffect tied to event.
INVENTORY_SLOT_NUMBER GetTransformationSlot()
slot to perform the transformation
void SetProcess(psTradeProcesses *p)
Set the active trade process for the event.
This class collects data of a netclient.
void void Initialize(iObjectRegistry *object_reg)
Over skilled for this task.
void SetTargetGem(gemObject *g)
float GetKFactor()
pattern Kfactor is based on the current pattern
MathScript * calc_repair_result
This is the calculation for how many points of quality are added in a repair.
int skill_level
Skill level required to be able to harvest resource.
Item is not used with any available transform.
float item_quality
Quality of equipment for the ressource.
WorkManager * workmanager
Transforming an item by putting it into auto-transform container.
NaturalResource * resource
This class manages the caching of data that is unchanging during server operation.
This class holds the master list of all trade processes possible in the game.
gemObject * GetTargetGem()
psTradeTransformations * transformation
A gemObject is any solid, graphical object visible in PS with normal physics and normal collision det...
MathScript * calc_transform_practice
This is the calculation for the practice to assign to player for trasformations.
Transforming an item that is targeted.
psTradeTransformations * GetTransformation()
Return the active transformation, if any for this event.
No work item container choosen.
Correct ingredients but wrong number or wrong process.
void SetWorkItem(psItem *w)
psTradeProcesses * GetProcess()
Return the active process, if any for this event.
int GetResultQuantity()
result quantity is only used when transaction result is zero
TradePatternMatch
Holds the possible return values for a test to see if an item is transformable.
MathScript * calc_transform_apply_skill
This is the calculation for the quality resulting from the item.
Transforming an item that is targeted to an npc type.
csArray< NearNaturalResource > nrr
This class handles all calculations around work, using statistics and information from the pspccharac...
Use of item or ammounts not correct.
void SetTransformationType(int t)
TradeTransfomType
Holds the possible transformation types.
void SetTransformation(psTradeTransformations *t)
Set the active trade transformation for the event.
Tried to transform too many items.
float radius
Radius around the centre where resource can be found.
MathScript * calc_repair_quality
This calculates the item ending quality and max quality at the end of repair.
All scheduled events must inherit from this class.
There was a transform that matched correctly.
This class generically allows objects to be notified when a gemObject is removed. ...
csArray< PublishDestination > multi
unsigned int item_cat_id
Category of tool needed for the ressource.
Transforming an item that is in a targetted actors equipped slot.
int reward
Item ID of the reward.
Did not meet required skills.
bool operator<(const NearNaturalResource &oth) const
Did not meet required skills.
This class keeps natural resource concentrations across the world.
This class embodies item instances in the game.
Provides a manager to facilitate subscriptions.