// 最大血量 BOOL FactionManager::SetMaxLife( KCharacter& rcCharacter, DWORD nOldValue, DWORD nNewValue ) { INT nDelta = nNewValue - nOldValue; PROCESS_ERROR(nDelta != 0); if(IS_PLAYER(rcCharacter.GetId())) { KPlayer* pPlayer = (KPlayer*)&rcCharacter; ScriptSafe cSafeScript = g_cScriptManager.GetSafeScript(); cSafeScript->CallTableFunction("BufferMagicEffect", "Add_MaxLifeEx", 2, "od", pPlayer->GetScriptInterface(), nDelta); } EXIT0: return TRUE; }
BOOL KPlayerBaseProcess::PtcPlayerData( LPCBYTE pData, UINT uDataLen ) { KS2C_PLAYERDATA* pSData = (KS2C_PLAYERDATA* )pData; // CheckSize QCONFIRM_RET_FALSE(_offsetof(KS2C_PLAYERDATA, sVarSync.aMapVarSet) + sizeof(KMAP_VAR_VALUE) * (pSData->sVarSync.wMapVarNum) == uDataLen); Q_Printl("Received Player Data. Client Player Rolename: " << pSData->szPlayerName << " Id:" << pSData->dwPlayerId); g_cOrpgWorld.m_dwClientPlayerId = pSData->dwPlayerId; g_cOrpgWorld.m_dwLogicFrames = pSData->dwLogicFrames; g_cOrpgWorld.m_nServerId = pSData->nServerId; InitStartTimeEvaluation(&g_cOrpgWorld.m_StartTimeEvaluation); g_cOrpgWorld.m_nStartLoop = g_cOrpgWorld.m_dwLogicFrames; g_cOrpgWorld.m_nGSGameLoop = g_cOrpgWorld.m_dwLogicFrames; g_cOrpgWorld.m_dwStartTime = timeGetTime(); g_cOrpgWorld.m_dwServerTime = pSData->dwServerTime; KPlayer* pPlayer = g_cOrpgWorld.AddPlayer(pSData->szPlayerName, pSData->dwPlayerId); QCONFIRM_RET_FALSE(pPlayer); g_cScriptManager.SetMe((QLunaBase*)pPlayer->GetScriptInterface()); pPlayer->SetKinId(0); pPlayer->SetKinName(""); pPlayer->SetKinFigure(0); pPlayer->m_cPlayerClient.LoadSyncVarSelf(pSData->sVarSync); g_cOrpgWorld.m_cEventCreator.FireEvent(emKOBJEVENTTYPE_PLAYER_LOGIN, g_cOrpgWorld.m_dwClientPlayerId, 0, 0); // by houxuan, 玩家登陆事件 // 通知服务端已完成加载 DoSyncEnd(); return TRUE; }