2.1 KiB
2.1 KiB
Skill Learn Flow (C++)
-
CDlgSkillSubListItem::OnCommand_Upgrade
- Triggered when the player clicks the learn/upgrade button on a skill.
- Performs status checks (dead, trading, etc.), evaluates
CheckLearnCondition, and shows theGame_LearnSkillconfirmation dialog. - If the NPC greeting has not been received yet, calls
CECHostSkillModel::SendHelloToSkillLearnNPC().
-
CECHostSkillModel
- Maintains
m_skillLearnNPCNID, the NPC ID that currently offers skill learning. ProcessServiceList()scanscmd_scene_service_npc_listfrom the server, keeps the valid NPC, and resetsm_bReceivedNPCGreetingwhen a new NPC is selected.SendHelloToSkillLearnNPC()issuesc2s_CmdNPCSevHello(m_skillLearnNPCNID)to start the NPC service handshake.OnNpcGreeting()is invoked whenNPC_GREETING(cmd 70) arrives; it marks the greeting as received so future learns skip re-hello.
- Maintains
-
CDlgSkillAction::TryOpenDialog
- Called when the skill dialog is being opened (skill vs action mode).
- If the host isn’t currently “talking with the NPC,” it forces the dialog to open, sends
SendHelloToSkillLearnNPC(), and clears the “received greeting” flag so the next dialog confirms again.
-
Game UI dialog
- Player confirms the
Game_LearnSkillmessage box (EC_GameUIMan::OnMessageBoxClose). - If
IDOKandCheckSkillLearnConditionstill returns zero, it sendsc2s_CmdNPCSevLearnSkill(skillID). - The dialog name
"Game_LearnSkill"ensures the server hasn’t rejected the skill because it missed the handshake.
- Player confirms the
-
Server round-trip
SEVNPC_HELLOestablishes the NPC service context.- Server replies with
NPC_GREETING, parsed byGameSessionand forwarded toCECHostSkillModel::OnNpcGreeting. - Only after the greeting can
SEVNPC_SERVEwithGP_NPCSEV_LEARNbe trusted; else, the server often drops it without aLEARN_SKILLresponse.
Use this sequence when troubleshooting missing LEARN_SKILL responses: show/confirm dialog → send SEVNPC_HELLO → wait for NPC_GREETING → send GP_NPCSEV_LEARN.