Where is X in the code?
Jump to navigation
Jump to search
Introduction
Sometimes I have hard times to find where a specific action is executed in the code. For example in which class or method does an NPC dialog start. Feel free to add yours.
Please list the functions in order those get called.
NPC responds to a player phrase
Serverside
- ChatManager::HandleChatMessage() line 236
- ChatManager::CheckNPCResponse()
- psNPCDialog::Respond()
- psNPCDialog::FindResponse()
- psNPCDialog::FindResponse()
- psNPCDialog::Respond()
- NpcResponse::ExecuteScript()
- then if it's a normal say action it uses SayResponseOp::Run(), if it's an action it uses ActionResponseOp::Run()
- ChatManager::CheckNPCResponse()
Clientside
After this the message is send to the client and each client side widget registered to MSGTYPE_CHAT handles the request. Example pawsChatWindow::HandleMessage()
NPCs or player modes
Like walk, run, combat, die, ...
Serverside
ModeHandler::HandleModeMessage
psModeMessage defines:
enum playerMode { PEACE = 1, COMBAT, SPELL_CASTING, WORK, DEAD, SIT, OVERWEIGHT, EXHAUSTED, DEFEATED, STATUE, PLAY };
Clientside
ModeHandler::HandleModeMessage (receives the message from the server)
- GEMClientActor::SetMode
GEMClientActor::SetCharacterMode
Crafting
For transformations:
- WorkManager::HandleUse() handles the /use command
- WorkManager::StartUseWork() validates all prerequisites, and checks for a valid transformation
- WorkManager::StartTransformationEvent() calculates time and schedules an event for completion of the work. (psWorkGameEvent)
- WorkManager::StartUseWork() validates all prerequisites, and checks for a valid transformation
when time has passed:
- WorkManager::HandleWorkEvent()
- WorkManager::ApplySkills() calculates final quality with script "Calculate Transformation Apply Skill"
- different calls for each tranform type: TransformSlotItem(), TransformTargetSlotItem(), ... create the item
- ApplyProcessScript() used for advanced crafting
- it calls script "Calculate Transformation Experience"