bool NormalCloseInAttackAI::StepEndAI() { if(m_pSkill) { CMoveShape* pMoveshape = dynamic_cast<CMoveShape*>(GetGame()->GetRegion()->FindChildObject(m_pSkill->GetSourType(), m_pSkill->GetSourID())); if(pMoveshape) { AnimInfo::tagActionInfo *pActionInfo = pMoveshape->GetAnimInfo()->GetActionInfo(); if(pActionInfo && pMoveshape->GetAction() >= CShape::ACT_PERFORM) { pActionInfo->bCurActionLooped = FALSE; } } if (pMoveshape->GetType() == TYPE_PET) { CPet *pPet = (CPet*)pMoveshape; if (pPet->IsMainPlayerPet()) { tagPetSkillInfo *pPetSkill = pPet->GetPetSkillInfoByID(m_pSkill->GetSkillID()); if(pPetSkill) pPetSkill->bIsSkillUsingEnd = true; //pPet->SkillSuccReceived(); } } // 删除特效 m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_START); m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_RUN); m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_END); m_pSkill->SetIsDeleted(true); return true; } return false; }
void GuardSearch::Execute( BaseType::EntityType *entity ) { CMonster *pSelf = dynamic_cast<CMonster*>( entity->GetOwner() ); ShapeListType player_list; ShapeListType monster_list; CServerRegion *pRegion = static_cast<CServerRegion*>( pSelf->GetFather() ); CMoveShape *pTarget = NULL; if( CanAttackCurrent( pSelf, entity ) ) { return; } // find the around players pRegion->FindAroundObject( pSelf, TYPE_PLAYER, player_list ); // find the around monsters including the guards. pRegion->FindAroundObject( pSelf, TYPE_MONSTER, monster_list ); // filter the result Filter filter( static_cast<CMonster*>( pSelf ) ); filter_shape( player_list, filter ); filter_shape( monster_list, filter ); // retrieve the ai reference DWORD ai_ref = pSelf->GetAIReferrence( 0 ); if( ai_ref >= 0 ) { pTarget = SearchByAIRef1( pSelf, player_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 1 ) ) > 0 ) { pTarget = SearchByAIRef2( pSelf, player_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 2 ) ) > 0 ) { pTarget = SearchByAIRef3( pSelf, monster_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 3 ) ) > 0 ) { pTarget = SearchByAIRef4( pSelf, monster_list, ai_ref ); } if( pTarget != NULL ) { // search successfully entity->SetTarget( pTarget->GetExID(), pTarget->GetType() ); } else if( entity->HasTarget() ) { AI_EVENT_SENDER( entity ).ReturnPeace(); } }
void FightObj::ReturnPeace() { CMoveShape *target = m_AI->GetTarget(); if(target) { TauntEvents events(m_Owner->GetTauntHandler()); events.TargetLost(target->GetExID(), target->GetType()); } m_AI->ChangeState(ST_RETURN, ReturnEvent(m_EnterFightPos.x, m_EnterFightPos.y)); }
BOOL Guard::CanAttackCurrent() { if( !HasTarget() ) { return FALSE; } CMoveShape *pTarget = GetTarget(); long dis = m_pOwner->Distance( pTarget ); long attack_range = static_cast<CMonster*>( m_pOwner )->GetAttribute( string( "C_GuardRange" ) ); if( dis > attack_range ) { return FALSE; } CMonster *pSelf = static_cast<CMonster*>( m_pOwner ); DWORD ai_ref = 0; if( pTarget->GetType() == TYPE_PLAYER ) { CPlayer *pPlayer = static_cast<CPlayer*>( pTarget ); // ai reference 1 ai_ref = pSelf->GetAIReferrence( 0 ); if( ai_ref >= 0 ) { if( pPlayer->GetPVPValue() >= ai_ref && !IsSameCamp( pPlayer, pSelf ) ) { return TRUE; } } // ai reference 2 ai_ref = pSelf->GetAIReferrence( 1 ); if( ai_ref > 0 ) { if( pPlayer->GetPkValue() >= ai_ref ) { return TRUE; } } } // actually, it's not necessary to judge monsters, that because the property for the monsters will // not changed .So ignored here. // ... return FALSE; }
bool CFixSummonAI::StepEndAI() { DelAllEffect(); m_pSkill->SetIsDeleted(true); CMoveShape* pMoveshape = dynamic_cast<CMoveShape*>(GetGame()->GetRegion()->FindChildObject(m_pSkill->GetSourType(), m_pSkill->GetSourID())); if(pMoveshape && pMoveshape->GetType() == TYPE_PET) { CPet *pPet = (CPet*)pMoveshape; if (pPet->IsMainPlayerPet()) { tagPetSkillInfo *pPetSkill = pPet->GetPetSkillInfoByID(m_pSkill->GetSkillID()); if(pPetSkill) pPetSkill->bIsSkillUsingEnd = true; } } return true; }
unsigned int CEffEventByParam::GetEffectObjs(list<CMoveShape*>& listObjs) { listObjs.clear(); int nNum=0; if (m_pParam->pEventVar && m_pParam->pEventVar->pVar) { CMoveShape *pMoveShape = (CMoveShape*)(m_pParam->pEventVar->pVar); if (pMoveShape) { m_pParam->pMouseShape = pMoveShape; m_pParam->nMouseShapeType = pMoveShape->GetType(); m_pParam->MouseShapeID = pMoveShape->GetExID(); listObjs.push_back(pMoveShape); ++nNum; } } return nNum; }
//发送技能失败消息 void COpSendMsg::CreateSKillFailMsg() { CMoveShape* pUser = m_pParam->pUser; if(m_strVariaName !="") { // [5/4/2009 chenxianj] m_lValue = (long)m_pParam->pVariableList->GetVarValue<double>(m_strVariaName.c_str(),0); // [5/4/2009 chenxianj] } //技能失败重置吟唱时间 if (pUser) { m_pParam->pUser->SetIntonateTime(timeGetTime(),0); } CMessage msg(MSG_S2C_SKILL_USE); msg.Add((CHAR)SKILL_USE_RESULT_FAILED); msg.Add( pUser->GetExID()); //id和等级 msg.Add((long)m_pParam->nID); msg.Add((BYTE)m_pParam->nLvl ); //全局id msg.Add(m_pParam->dwGlobleID); //错误类型 msg.Add((BYTE)m_lValue); CMoveShape* pPlayer = pUser; if( TYPE_PET == pUser->GetType() ) { pPlayer = pUser->GetHost(); } if(m_eRange == MsgRange_Single) msg.SendToPlayer(pPlayer->GetExID(), false); else if(m_eRange == MsgRange_Around) msg.SendToPlayers(m_pParam->SendMsgPlayers); #ifdef _DEBUG char str[256]=""; _snprintf(str, 256, "发送技能失败消息:技能ID:%6d,全局ID:%6d,阶段号:%d\n",m_pParam->nID,m_pParam->dwGlobleID, m_pParam->nProceNum); OutputDebugString(str); #endif }
double CScript::ChangeBaseSpeed(const char* cmd, char* retStr) { double dbRet = 1; int nRideState = GetIntParam(cmd, 0); DWORD dwSrc = GetIntParam(cmd,1); if(nRideState != ERROR_CODE && nRideState != INVILID_VALUE && dwSrc != ERROR_CODE && dwSrc != INVILID_VALUE) { CMoveShape* pMoveShape = (CMoveShape*)(dwSrc); if(pMoveShape && pMoveShape->GetType()==TYPE_PLAYER) { if (!pMoveShape->GetIsRide()) { //骑状态 if(!pMoveShape->GetIsRun()) { pMoveShape->SetSpeed(CGlobeSetup::GetSetup()->fRidePlayerWalkSpeed); } else { pMoveShape->SetSpeed(CGlobeSetup::GetSetup()->fRidePlayerRunSpeed); } } else { if(!pMoveShape->GetIsRun()) { pMoveShape->SetSpeed(CGlobeSetup::GetSetup()->fPlayerWalkSpeed); } else { pMoveShape->SetSpeed(CGlobeSetup::GetSetup()->fPlayerRunSpeed); } } pMoveShape->SendChangedSpeedToClients(); } } return dbRet; }
BOOL Guard::SearchEnemy() { if( !CanSearchEnemy() ) { return FALSE; } if( CanAttackCurrent() ) { return FALSE; } ShapeListType player_list; ShapeListType monster_list; CServerRegion *pRegion = static_cast<CServerRegion*>( m_pOwner->GetFather() ); CMonster *pSelf = static_cast<CMonster*>( m_pOwner ); CMoveShape *pTarget = NULL; // find the around players pRegion->FindAroundObject( m_pOwner, TYPE_PLAYER, player_list ); // find the around monsters including the guards. pRegion->FindAroundObject( m_pOwner, TYPE_MONSTER, monster_list ); // filter the result Filter filter( static_cast<CMonster*>( m_pOwner ) ); filter_shape( player_list, filter ); filter_shape( monster_list, filter ); // retrieve the ai reference DWORD ai_ref = pSelf->GetAIReferrence( 0 ); if( ai_ref >= 0 ) { pTarget = SearchByAIRef1( player_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 1 ) ) > 0 ) { pTarget = SearchByAIRef2( player_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 2 ) ) > 0 ) { pTarget = SearchByAIRef3( monster_list, ai_ref ); } if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 3 ) ) > 0 ) { pTarget = SearchByAIRef4( monster_list, ai_ref ); } if( pTarget != NULL ) { // search successfully SetTarget( pTarget->GetType(), pTarget->GetExID() ); return TRUE; } else if( HasTarget() ) { WhenLoseTarget(); } return FALSE; }
// 响应SKILL消息 void OnSkillMessage(CMessage* pMsg) { switch(pMsg->GetType()) { case MSG_S2C_SKILL_LOCK_GOODS: { long lExtendID = pMsg->GetLong(); long lPos = pMsg->GetLong(); CPlayer* pMainPlayer = GetGame()->GetMainPlayer(); if (pMainPlayer!=NULL) { CGoods* pGoods = pMainPlayer->GetGoodsByPosition(lExtendID,lPos); if (pGoods!=NULL&&!pGoods->IsLocked()) { pGoods->Lock(); //CItemPageEx* pPage = GetGame()->GetCGuiEx()->GetItemPageEx(); //if (pPage!=NULL) //{ // pPage->UpdateGoodsShow(lExtendID,(int)lPos); //} } } } break; case MSG_S2C_SKILL_UNLOCK_GOODS: { DWORD lExtendID = pMsg->GetDWord(); DWORD lPos = pMsg->GetDWord(); CPlayer* pMainPlayer = GetGame()->GetMainPlayer(); if (pMainPlayer!=NULL) { CGoods* pGoods = pMainPlayer->GetGoodsByPosition(lExtendID,lPos); if (pGoods!=NULL&&pGoods->IsLocked()) { pGoods->UnLock(); CMainPlayerHand* pHand = 0;//GetGame()->GetCGuiEx()->GetPMainPlayerHand(); if (pHand!=NULL&&pHand->GetPGoodsOfMainPlayerHand()!=NULL&& pHand->GetPGoodsOfMainPlayerHand()->GetExID()==pGoods->GetExID()) { pGoods->SetHaveShadowState(true); } } } } break; case MSG_S2C_SKILL_STATE_CHANGE: //##同步状态消息 { LONG lType = pMsg -> GetLong(); CGUID ID; pMsg->GetGUID(ID); DWORD dwHP = pMsg -> GetDWord(); WORD wMP = pMsg -> GetWord(); WORD eg = pMsg -> GetWord(); if(lType==TYPE_PLAYER) { CPlayer* pMainPlayer = pMsg -> GetPlayer(); //是自己则改变自己 if(pMainPlayer->GetExID() == ID) { pMainPlayer -> SetHp( dwHP ); pMainPlayer -> SetMp(wMP); pMainPlayer -> SetEnergy(eg); //pMainPlayer -> SetRP( wRP ); //pMainPlayer -> SetYP( wYP ); } else { //看是否是队友 vector<CPlayer::tagTeammate>& vTeammate = pMainPlayer -> GetTeam(); for( size_t i = 0; i < vTeammate.size(); i ++ ) { if( vTeammate[i].ID == ID ) { vTeammate[i].wHP = (WORD)dwHP; break; } } } } else { //改变怪物状态 CMoveShape* pShape = (CMoveShape*)GetGame()->GetRegion()->FindChildObject(lType, ID); if (pShape) { pShape->SetHp(dwHP); } } } break; case MSG_S2C_SKILL_USE: { CHAR cResult = pMsg->GetChar(); DWORD dwCurTime = GetCurTickCount(); switch(cResult) { case SKILL_USE_RESULT_BEGIN: { CGUID ID; pMsg->GetGUID(ID); float fDir = pMsg->GetFloat(); // 释放者朝向 long lSkillKey = pMsg->GetDWord(); // 从服务器取得技能键值和ID long lSkillID = pMsg -> GetLong(); long lLevel = pMsg->GetByte(); // 技能等级 long lCurType = pMsg->GetByte(); // 技能的释放状态(吟唱/释放) long lTime = pMsg->GetLong(); // 技能的吟唱时间(吟唱阶段有用) long lRestoreTime = pMsg->GetLong(); // 技能的冷却时间 long lDestX = pMsg->GetShort(); // 释放目标的坐标(x,y) long lDestY = pMsg->GetShort(); long lTypeSize = pMsg->GetByte(); // 释放目标的个数 vector<long> vecType; // 目标类型列表 vector<CGUID> vecID; // 目标类型的GUID CGUID destID; for (int i =0; i<lTypeSize; i++) { vecType.push_back(pMsg->GetLong()); pMsg->GetGUID(destID); vecID.push_back(destID); } // 确定基本攻击技能 if(lSkillID == SKILL_BASE_BUFF) lSkillID = GetGame()->GetMainPlayer()->GetDefaultAttackSkillID(); // 技能释放者 CMoveShape* pMoveShape = (CMoveShape*)pMsg->GetRegion()->FindChildObject(ID); if(pMoveShape) { long lType = pMoveShape->GetType(); //判断是否是怪物,如果是怪物,播放怪物音效 if(lType == TYPE_MONSTER) { GetGame()->GetAudioList()->Play(pMoveShape,TYPE_MONSTER,0xFFF0,Vector3(pMoveShape->GetPosY(),pMoveShape->GetHeight(),pMoveShape->GetPosX())); } if(lCurType == 1) // 吟唱阶段 { CPlayer::tagSkill *ptagS = GetGame()->GetMainPlayer()->GetSkill(lSkillID); if(ptagS) { UpdateHotKeyCoolDownEffect(lSkillID); } if(pMoveShape->GetType() == TYPE_PET) { CPet *pPet = (CPet*)pMoveShape; //更新当前技能的开始冷却时间 tagPetSkillInfo *pSkill = pPet->GetPetSkillInfoByID(lSkillID); if(pSkill) pSkill->lRestorTimeLength = lRestoreTime; pPet->SkillSuccReceived(); } /***********************************************************************/ /* 赵航 fix */ //CSkillXml *m_pSkill = new CSkillXml(); /***********************************************************************/ ConcreteSkillComp* SkillCom = new ConcreteSkillComp(); //SkillCom的内存交给了CSkillXml的析构来管理 CSkillXml* pSkill = new ConcreteDecSkillXml(SkillCom); CSkillListXml::tagSkill *pTagSkill = CSkillListXml::GetProperty(lSkillID); if (pTagSkill && pTagSkill->dwSkillType == CSkillListXml::SKILLTYPE_PLAY) // 直接施放 { // 引导类技能添加吟唱条显示时间 DWORD dwlev = pTagSkill->vectorLevels.size() >= (DWORD)lLevel? (DWORD)lLevel-1:((DWORD)pTagSkill->vectorLevels.size() - 1); long lAiID = pTagSkill->vectorLevels[dwlev].dwSkillLevelAI; if(pTagSkill->bIsLead) pSkill->IntonateTime(lTime); // 直接从开始阶段执行 if(pSkill->StepBegin(lSkillID, lLevel, lType, ID, lDestX, lDestY,fDir,vecType, vecID)) { pSkill->SetSkillKey(lSkillKey); pMoveShape->AddCurSkillList(lSkillKey,pSkill); } else SAFE_DELETE(pSkill); // 如果开始阶段成功就直接执行施放阶段 if(pSkill&&pSkill->StepRun(lSkillID, lLevel, lType, ID, lDestX, lDestY, fDir, vecType, vecID) == false) { //pSkill->SetIsDeleted(true); pMoveShape->DeleteCurSkill(lSkillKey); } if(lType == TYPE_PLAYER ) { if (GetGame()->GetMainPlayer()->GetExID()==ID) { GetGame()->GetGameControl()->SetControlAble(true); GetGame()->GetGameControl()->SetMoveAble(true); /***********************************************************************/ /* zhaohang fix */ /***********************************************************************/ // 引导类技能 if(pTagSkill->bIsLead) GetGame()->GetMainPlayer()->SetIntonateSkillKey(lSkillKey); else GetGame()->GetMainPlayer()->SetIntonateSkillKey(0); // 自动攻击累计发送次数清0 GetGame()->GetGameControl()->SetSendedUseSkillMsgCount(0); if(g_bDebug) { Log4c::Trace(ROOT_MODULE,"直接使用技能,次数清0:%d,key:%d",lSkillID,lSkillKey); } }else if (lSkillID>=50000&&lSkillID<=50006) { if (lSkillID>=50000&&lSkillID<=50002) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_Collection); }else if (lSkillID>=50003&&lSkillID<=50005) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_Facture); }else if (lSkillID==50006) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_TaskCollection,lLevel); } } ///////////////////////////////////////////////////////////////// //char strInfo[512]=""; //_snprintf(strInfo,512,"SKILLTYPE_PLAY_Set Intonate Skill Key:%d",0); //PutStringToFile("IntonateSkillTest",strInfo); ///////////////////////////////////////////////////////////////// } else if (lType == TYPE_PET) { CPet *pPet = (CPet*)pMoveShape; if (pPet->IsMainPlayerPet()) { /***********************************************************************/ /* zhaohang fix */ /***********************************************************************/ if(pTagSkill->bIsLead) pPet->SetIntonateSkillKey(lSkillKey); else pPet->SetIntonateSkillKey(0); } } } else if(pTagSkill && pTagSkill->dwSkillType == CSkillListXml::SKILLTYPE_INTONATE) // 吟唱施放 { pSkill->IntonateTime(lTime); if(g_bDebug && lType == TYPE_PLAYER) { dwCurTime = GetCurTickCount(); Log4c::Trace(ROOT_MODULE,"吟唱技能设置时间:%d,%d,%d",lSkillID,lTime,dwCurTime); } /***********************************************************************/ /* zhaohang fix */ /***********************************************************************/ bool bIsLead = pTagSkill->bIsLead; pTagSkill->bIsLead = false; if(pSkill->StepBegin(lSkillID, lLevel, lType, ID, lDestX, lDestY,fDir,vecType, vecID)) { /***********************************************************************/ /* zhaohang fix */ /***********************************************************************/ pTagSkill->bIsLead = bIsLead; pSkill->SetSkillKey(lSkillKey); pMoveShape->AddCurSkillList(lSkillKey,pSkill); } else SAFE_DELETE(pSkill); if( lType == TYPE_PLAYER ) { if (GetGame()->GetMainPlayer()->GetExID()==ID) { // 吟唱阶段允许玩家移动取消技能 GetGame()->GetGameControl()->SetControlAble(true); GetGame()->GetGameControl()->SetMoveAble(true); GetGame()->GetMainPlayer()->SetIntonateSkillKey(lSkillKey); // 自动攻击累计发送次数清0 GetGame()->GetGameControl()->SetSendedUseSkillMsgCount(0); /*if(g_bDebug) { char strInfo[512]=""; _snprintf(strInfo,512,"技能吟唱中,次数清0:%d,key:%d",lSkillID,lSkillKey); PutStringToFile("SkillTimesTest",strInfo); }*/ }else if (lSkillID>=50000&&lSkillID<=50006) { if (lSkillID>=50000&&lSkillID<=50002) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_Collection); }else if (lSkillID>=50003&&lSkillID<=50005) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_Facture); }else if (lSkillID==50006) { ((CPlayer*)pMoveShape)->SetToolsID(CDeputyOccuSystemClient::OB_TaskCollection,lLevel); } } ///////////////////////////////////////////////////////////////// //char strInfo[512]=""; //_snprintf(strInfo,512,"SKILLTYPE_INTONATE_Set Intonate Skill Key:%d",lSkillKey); //PutStringToFile("IntonateSkillTest",strInfo); ///////////////////////////////////////////////////////////////// } } else { SAFE_DELETE(pSkill); return; } pMoveShape->SetDirEx(fDir); // 更新快捷栏的冷却动画 if(pMoveShape==GetGame()->GetMainPlayer()) { GetGame()->GetMainPlayer()->UpdateSkillCoolDownTime(true); //CSkillListXml::tagSkill *pS = CSkillListXml::GetProperty(lSkillID); /***********************************************************************/ /* zhaohang fix */ /***********************************************************************/ if(ptagS && pTagSkill && pTagSkill->dwSkillState != 0 && !pTagSkill->bLockSkill) { ptagS->dwUseingStartTime = timeGetTime(); } } } else // 施放阶段 { /***********************************************************************/ /* 赵航 fix */ //CSkillXml *m_pSkill = new CSkillXml(); /***********************************************************************/ ConcreteSkillComp* SkillCom = new ConcreteSkillComp(); //SkillCom的内存交给了CSkillXml的析构来管理 CSkillXml* pSkill = new ConcreteDecSkillXml(SkillCom); pSkill->IntonateTime(lTime); if(pSkill&&pSkill->StepRun(lSkillID, lLevel, lType, ID, lDestX, lDestY, fDir, vecType, vecID) ) { pSkill->SetSkillKey(lSkillKey); pMoveShape->AddCurSkillList(lSkillKey,pSkill); CSkillListXml::tagSkill *pTagSkill = CSkillListXml::GetProperty(lSkillID); // 引导类技能 if(pTagSkill && pTagSkill->bIsLead) GetGame()->GetMainPlayer()->SetIntonateSkillKey(lSkillKey); } else { SAFE_DELETE(pSkill); } if(lType == TYPE_PLAYER ) { if (GetGame()->GetMainPlayer()->GetExID()==ID) { GetGame()->GetGameControl()->SetControlAble(true); GetGame()->GetMainPlayer()->SetIntonateSkillKey(0); // 自动攻击累计发送次数清0 GetGame()->GetGameControl()->SetSendedUseSkillMsgCount(0); if(g_bDebug) { Log4c::Trace(ROOT_MODULE,"吟唱技能释放阶段,次数清0,吟唱清空:%d,key:%d",lSkillID,lSkillKey); } } if (lSkillID>=50000&&lSkillID<=50006) { ((CPlayer*)pMoveShape)->SetToolsID(0); } ///////////////////////////////////////////////////////////////// //char strInfo[512]=""; //_snprintf(strInfo,512,"STEP_PLAY Set Intonate Skill Key:%d",0); //PutStringToFile("IntonateSkillTest",strInfo); ///////////////////////////////////////////////////////////////// } } } else { /////////////////////////////////////////////////////////////start //test add or delete shape,(author:wangqiao) char pszTestInfo[1024]=""; char pszGUID[64]=""; ID.tostring(pszGUID); //_snprintf(pszTestInfo,1024,"When Use skill,the Firer is not exist.(type:%d,id:%s)", // lType,pszGUID); //PutStringToFile("AddDelShapeTest",pszTestInfo); ////////////////////////////////////////////////////////////end } } break; case SKILL_USE_RESULT_END: { CGUID ID; pMsg->GetGUID(ID); float fDir = pMsg->GetFloat(); long lSkillKey = pMsg->GetDWord(); // 从服务器取得技能键值 long lSkillID = pMsg -> GetLong(); long lLevel = pMsg->GetByte(); long lCurType = pMsg->GetByte(); CMoveShape* pMoveShape = (CMoveShape*)pMsg->GetRegion()->FindChildObject(ID); if(pMoveShape) { long lType = pMoveShape->GetType(); CSkillXml* pSkill = pMoveShape->GetCurSkill(lSkillKey); if(pSkill) { pSkill->StepEnd(lSkillID, lLevel, lType, ID, fDir); pMoveShape->DeleteCurSkill(lSkillKey); } if(lType == TYPE_PLAYER ) { if (lSkillID>=50000&&lSkillID<=50006) { ((CPlayer*)pMoveShape)->SetToolsID(0); } if(GetGame()->GetMainPlayer()->GetExID() == ID) { // 自动攻击累计发送次数清0 GetGame()->GetGameControl()->SetSendedUseSkillMsgCount(0); GetGame()->GetGameControl()->SetControlAble(true); // 结束的技能是正在吟唱的技能,取消吟唱 if(lSkillKey == GetGame()->GetMainPlayer()->GetIntonateKey()) //|| lSkillID == GetGame()->GetMainPlayer()->GetIntonateState()) { GetGame()->GetMainPlayer()->SetCurIntonateTime(0,0); GetGame()->GetMainPlayer()->SetIntonateSkillKey(0); if(g_bDebug) { Log4c::Trace(ROOT_MODULE,"技能结束,吟唱清空,次数清0:%d,key:%d",lSkillID,lSkillKey); } } else { // 光环类技能重设使用状态 CPlayer::tagSkill *ptagS = GetGame()->GetMainPlayer()->GetSkill(lSkillID); if(ptagS) ptagS->dwUseingStartTime = 0; } // 当使用的是制作的技能时,进行特殊的处理 if (lSkillID>=50003&&lSkillID<=50005) { //CFacturePageEx* pFacturePage = GetGame()->GetCGuiEx()->GetFacturePageEx(); //if (lCurType==2&&pFacturePage!=NULL) //{ // pFacturePage->UpdateInputNum(); // pFacturePage->SetFactureState(false); // if ((CFacturePageEx::eErrorNotice)pFacturePage->IsCanFacture()==CFacturePageEx::eErrorNotice_NoError) // { // pFacturePage->SendFactureOneMes(); // } //pFacturePage->UpdateFactureLevelExpProcessBar(); //} } } } if (lType == TYPE_PET) { CPet *pPet = (CPet*)pMoveShape; if (pPet->IsMainPlayerPet()) { if(lSkillKey == pPet->GetIntonateKey() && lSkillID == pPet->GetIntonateState()) { GetGame()->GetMainPlayer()->SetCurIntonateTime(0,0); GetGame()->GetMainPlayer()->SetIntonateSkillKey(0); } tagPetSkillInfo *pPetSkill = pPet->GetPetSkillInfoByID(lSkillID); if(pPetSkill) pPetSkill->bIsSkillUsingEnd = true; } } } } break; case SKILL_USE_RESULT_FAILED: CGUID ID; pMsg->GetGUID(ID); long lSkillID = pMsg->GetLong(); long lLevel = pMsg->GetByte(); long lSkillKey = pMsg->GetLong(); long lFaildRet = pMsg->GetByte(); // 将该技能结束 CMoveShape* pMoveShape = (CMoveShape*)pMsg->GetRegion()->FindChildObject(ID); if(pMoveShape) { long lType = pMoveShape->GetType(); CSkillXml* pSkill = pMoveShape->GetCurSkill(lSkillKey); if(pSkill) { pSkill->StepEnd(lSkillID, lLevel, lType, ID, pMoveShape->GetDirEx()); pMoveShape->DeleteCurSkill(lSkillKey); } if(pMoveShape->GetType() == TYPE_PET) { CPet *pPet = (CPet*)pMoveShape; tagPetSkillInfo *pPetSkill = pPet->GetPetSkillInfoByID(lSkillID); if(pPetSkill) pPetSkill->bIsSkillUsingEnd = true; pPet->SkillFailReceived(); } // 其他对象的技能,不提示 if( pMoveShape == GetGame()->GetMainPlayer()) { // 自动攻击累计发送次数清0 GetGame()->GetGameControl()->SetSendedUseSkillMsgCount(0); // 如果是本玩家释放的技能,且失败技能为连续技能,停止本玩家自动攻击状态 CSkillListXml::tagSkill *pS = CSkillListXml::GetProperty(lSkillID); if(pS && pS->bLockSkill) { // 连续攻击技能的mp不足,切换到基本攻击 if(lFaildRet == SKILL_USE_FAILED_INVALID_MP) { DWORD dwID = GetGame()->GetMainPlayer()->GetDefaultAttackSkillID(); GetGame()->GetGameControl()->SetBufferSkillID(dwID); CPlayer::tagSkill * pPlayerSkill = GetGame()->GetMainPlayer()->GetSkill(dwID); if(pPlayerSkill) pPlayerSkill->dwUseingStartTime = timeGetTime(); } if(lFaildRet == SKILL_USE_FAILED_INVALID_HP || lFaildRet == SKILL_USE_FAILED_INVALID_RP) GetGame()->GetGameControl()->AutoAttactStop(); } // 光环类技能重设使用状态 CPlayer::tagSkill *ptagS = GetGame()->GetMainPlayer()->GetSkill(lSkillID); if(ptagS && pS && !pS->bLockSkill) ptagS->dwUseingStartTime = 0; // 结束的技能是正在吟唱的技能,取消吟唱 if(lSkillKey > 0 && lSkillKey == GetGame()->GetMainPlayer()->GetIntonateKey()) { GetGame()->GetMainPlayer()->SetCurIntonateTime(0,0); GetGame()->GetMainPlayer()->SetIntonateSkillKey(0); if(g_bDebug) { Log4c::Trace(ROOT_MODULE,"技能使用失败,次数清0,吟唱清空:%d,类型:%d,key:%d",lSkillID,lFaildRet,lSkillKey); } } if (lSkillID>=50000&&lSkillID<=50006) { ((CPlayer*)pMoveShape)->SetToolsID(0); } // 如果正处于制作过程中 //CFacturePageEx* pFacturePage = GetGame()->GetCGuiEx()->GetFacturePageEx(); /*if (pFacturePage!=NULL && pFacturePage->IsOpen()) { pFacturePage->SetFactureState(false); if (pFacturePage->GetCurFactureNum()!=0 || pFacturePage->GetAllFactureState()) { pFacturePage->ClearFactureNum(); } }*/ } } GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-48.wav"); if(pMoveShape && (pMoveShape == GetGame()->GetMainPlayer() || pMoveShape->GetType() == TYPE_PET && ((CPet*)pMoveShape)->IsMainPlayerPet() )) { switch (lFaildRet) { case SKILL_USE_FAILED_INVALID_STATE: { // 自动攻击技能 if(GetGame()->GetGameControl()->GetAutoSkillID() == lSkillID) GetGame()->GetGameControl()->SetAutoSkillID(0); //GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, //CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_STATE), //D3DCOLOR_ARGB(255,255,0,0)); } break; case SKILL_USE_FAILED_INVALID_HP: //GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_HP), // D3DCOLOR_ARGB(255,255,0,0)); break; case SKILL_USE_FAILED_INVALID_MP: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_MP), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_RP: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_NP), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_YP: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_YVALUE), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_TARGET: { // 自动攻击技能 if(GetGame()->GetGameControl()->GetAutoSkillID() == lSkillID) GetGame()->GetGameControl()->SetAutoSkillID(0); //GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_OBJERROR), // D3DCOLOR_ARGB(255,255,0,0)); } break; case SKILL_USE_FAILED_INVALID_DISTANT: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_OUTAREA), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_SKILL: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_NOSKILL), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_TIME: //##允许再次使用技能的时间未到达 { /*if(GetGame()->GetGameControl()->GetAutoSkillID() != lSkillID) GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_COOLTIME), D3DCOLOR_ARGB(255,255,0,0)); else GetGame()->GetGameControl()->SetBufferSkillID(SKILL_BASE_BUFF);*/ if( GetGame()->GetGameControl()->GetAutoSkillID() == lSkillID) GetGame()->GetGameControl()->SetBufferSkillID(SKILL_BASE_BUFF); } break; case SKILL_USE_FAILED_CANNOTCOLLECTION_STATE: //当前状态(人物的状态)不能采集 { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(205,18), D3DCOLOR_ARGB(255,255,0,0));*/ } break; case SKILL_USE_FAILED_CANNOTFACTURE_STATE: //当前状态(人物的状态)不能制作 { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(205,19), D3DCOLOR_ARGB(255,255,0,0));*/ } break; case SKILL_USE_FAILED_INVALID_EQUIP: //##无效的装备 /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_ARM), D3DCOLOR_ARGB(255,255,0,0));*/ // 取消连续攻击技能 GetGame()->GetGameControl()->SetAutoSkillID(0); break; case SKILL_USE_FAILED_BLOCKED: //##被阻挡了 /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_BLOCK), D3DCOLOR_ARGB(255,255,0,0));*/ // 取消连续攻击技能 GetGame()->GetGameControl()->SetAutoSkillID(0); break; case SKILL_USE_FAILED_BREAK: { if (lSkillID>=50000&&lSkillID<=50007) { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(205,40), D3DCOLOR_ARGB(255,255,0,0));*/ } else { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_DELSKILL), D3DCOLOR_ARGB(255,255,0,0));*/ } // 取消连续攻击技能 if(lSkillID != GetGame()->GetGameControl()->GetAutoSkillID()) { GetGame()->GetGameControl()->SetAutoSkillID(0); GetGame()->GetMainPlayer()->SetAction(CShape::ACT_STAND); } } break; case SKILL_USE_FAILED_NOOBJECT: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_NOOBJ), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_INTONATE: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_INTTIME), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_OCCUPATION: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_OUCC), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_FACTURE: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_MADE), D3DCOLOR_ARGB(255,255,0,0)); GetGame()->GetCGuiEx()->GetFacturePageEx()->Close();*/ break; case SKILL_USE_FAILED_INVALID_COLLECT: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_COLLECTION), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_ACT: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_ACTING), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_INVALID_MOVING: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_USE_UNSUCCESS_MOVEING), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_NOCOLLECTION: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_NOOBJ), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_STATE_ERROR: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_STATE), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_UNKNOW_COLLECTION: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_NOINFO), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_DOCCU_ERROR: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_OCCUEX), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_LEVEL_ERROR: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_LEV), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_GOODSCONDITION_ERROR: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_GOODS), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_NO_BAGSPACE: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_PACK), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_NOT_ROLECOLLECTION: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_NOTQUESTOBJ), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_QUESTSTEP_ERROR: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_SPECQUEST), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_C_UNKOWN_COLLECTTYPE: /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_CONDITION_TYPE), D3DCOLOR_ARGB(255,255,0,0));*/ break; case SKILL_USE_FAILED_F_NO_FACTURE: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_NOOBJ), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_DOCCU_ERROR: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_OCCUEX), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_NOTHAS_FACTURE: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_NOSKILL), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_GOODSCONDITION_ERROR: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_TOOL), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_MATERIALS_ERROR: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_GOODS), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_NPC_ERROR: { /*GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_NPCDEST), D3DCOLOR_ARGB(255,255,0,0));*/ GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; case SKILL_USE_FAILED_F_NO_BAGSPACE: { // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_MADE_PACK), // D3DCOLOR_ARGB(255,255,0,0)); GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-12.wav"); } break; // 场景错误 case SKILL_USE_FAILED_INVALID_REGION: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_ERROR_BYREGION), // D3DCOLOR_ARGB(255,255,0,0)); break; default: break; } } break; } } break; case MSG_S2C_SKILL_ADD_EX_STATE: // 加入一个异常状态 { // 状态承受着的类型和GUID long lType = pMsg->GetLong(); CGUID ID; pMsg->GetGUID(ID); // 状态ID DWORD dwStateID = pMsg->GetDWord(); DWORD dwLevel = pMsg->GetDWord(); // 状态等级 DWORD dwRemainedTime = pMsg->GetDWord(); BYTE bFlag = pMsg->GetByte(); CMoveShape *pMoveShape = (CMoveShape*)pMsg->GetRegion()->FindChildObject(lType, ID); if (pMoveShape) { pMoveShape->AddStateEx(dwStateID, dwLevel, dwRemainedTime,0,bFlag); } } break; case MSG_S2C_SKILL_END_EX_STATE: // 结束一个异常状态 { long lType = pMsg->GetLong(); CGUID ID; pMsg->GetGUID(ID); DWORD dwStateID = pMsg->GetDWord(); DWORD dwlev = pMsg->GetDWord(); CMoveShape *pMoveShape = (CMoveShape*)pMsg->GetRegion()->FindChildObject(lType, ID); if (pMoveShape) { pMoveShape->RemoveStateEx(dwStateID,dwlev); } } break; case MSG_S2C_SKILL_EX_STATE_ADDITIONAL_DATA: { long lType = pMsg->GetLong(); CGUID ID; pMsg->GetGUID(ID); long lStateID = pMsg->GetLong(); DWORD dwValue = pMsg->GetDWord(); if( lStateID == STATE_TEAM ) { CPlayer *pPlayer = dynamic_cast<CPlayer*>(pMsg->GetRegion()->FindChildObject(lType, ID)); if (pPlayer) pPlayer->SetTeammateAmount(dwValue&0xffff); } } break; // 打开技能学习页面 case MSG_S2C_SKILL_STUDY_BEGIN: { CGUID guid; pMsg->GetGUID(guid); long num = pMsg->GetLong(); if(num > 0) { //GetGame()->GetCGuiEx()->GetLearnSkillPage()->Close(); for(long i=0; i<num; ++i) { BYTE bType = pMsg->GetByte(); DWORD dwSkillID = pMsg->GetDWord(); //if(dwSkillID > 0) // GetGame()->GetCGuiEx()->GetLearnSkillPage()->PushSkillID(dwSkillID,bType); } //GetGame()->GetCGuiEx()->GetLearnSkillPage()->Open(); //GetGame()->GetCGuiEx()->GetLearnSkillPage()->SetNpcGUID(guid); //GetGame()->GetCGuiEx()->GetLearnSkillPage()->OpenPage(CLearnSkillPage::TYPE_FIGHTSKILLPAGE); GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-20.wav"); } // 职业不符,弹出警告对话框 else { } } break; // 打开制作技能学习页面 case MSG_S2C_OCCUSKILL_STUDY_BEGIN: { CGUID guid; pMsg->GetGUID(guid); //GetGame()->GetCGuiEx()->GetLearnSkillPage()->Close(); long num = pMsg->GetDWord(); for(WORD i=0; i<num; ++i) { DWORD dwSkillID = pMsg->GetDWord(); DWORD dwSkillCost = pMsg->GetDWord(); //if(dwSkillID > 0) // GetGame()->GetCGuiEx()->GetLearnSkillPage()->AddOccuSkill(dwSkillID,dwSkillCost); } //GetGame()->GetCGuiEx()->GetLearnSkillPage()->SetNpcGUID(guid); //GetGame()->GetCGuiEx()->GetLearnSkillPage()->OpenPage(CLearnSkillPage::TYPE_ASSITSKILLPAGE); } break; case MSG_S2C_OCCUSKILL_STUDY: { long lBeSucceed = pMsg->GetLong(); DWORD dwFactureID = pMsg->GetDWord(); if (lBeSucceed!=0) { //GetGame()->GetCGuiEx()->GetLearnSkillPage()->ChoseNextSkill(dwFactureID); } //GetGame()->GetCGuiEx()->GetLearnSkillPage()->StudyOccuSkillResult(lBeSucceed,dwFactureID); //long lOccType = GetGame()->GetCGuiEx()->GetMainBarPageEx()->GetOuccType(); //GetGame()->GetCGuiEx()->GetMainBarPageEx()->SetOccuButtonSpecialState(true,lOccType); //GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-27.wav"); } break; case MSG_S2C_OCCUSKILL_DELETE: { GetGame()->GetMainPlayer()->DeleteAllFactureSkill(); //DWORD dwBeSucceed = pMsg->GetDWord(); //DWORD dwFactureID = pMsg->GetDWord(); //GetGame()->GetCGuiEx()->GetLearnSkillPage()->StudyOccuSkillResult(dwBeSucceed,dwFactureID); }break; // 技能学习失败 case MSG_S2C_SKILL_STUDY_FAILED: { long lFaildRet = pMsg->GetLong(); switch (lFaildRet) { //职业不符合学习条件 case SKILL_STUDY_FAILED_OCCUPATION: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_OUCC), // D3DCOLOR_ARGB(255,255,0,0)); break; //等级不符合学习条件 case SKILL_STUDY_FAILED_RANK: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_LEV), // D3DCOLOR_ARGB(255,255,0,0)); break; //SP不符合学习条件 case SKILL_STUDY_FAILED_SP: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_SP), // D3DCOLOR_ARGB(255,255,0,0)); break; //前置技能不符合学习条件 case SKILL_STUDY_FAILED_SKILL: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_PRESKILL), // D3DCOLOR_ARGB(255,255,0,0)); break; //前置限制技能不符合条件 case SKILL_STUDY_FAILED_LIMIT_SKILL: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_LIMITSKILL), // D3DCOLOR_ARGB(255,255,0,0)); break; //物品 case SKILL_STUDY_FAILED_GOOD: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_GOODS), // D3DCOLOR_ARGB(255,255,0,0)); break; //金币不足 case SKILL_STUDY_FAILED_GOLD: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_NOGOLDS), // D3DCOLOR_ARGB(255,255,0,0)); break; //银币不足 case SKILL_STUDY_FAILED_SILVER: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_NOSILVER), // D3DCOLOR_ARGB(255,255,0,0)); //职业等级不符合条件 case SKILL_STUDY_FAILED_OCCULV: // GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddText(eNOTIFYPOS_CENTER, // CStringReading::LoadText(eIDS_SKILL,eIDS_STUDY_FAILED_OCCULV), // D3DCOLOR_ARGB(255,255,0,0)); break; } } break; // 宠物添加技能 case MSG_S2C_SKILL_ADD_PET: { //得到宠物GUID CGUID guid; pMsg->GetGUID(guid); tagPetSkillInfo skill; pMsg->GetEx(&skill, sizeof(tagSkill)); //技能冷却总时间长度 skill.lRestorTimeLength = pMsg->GetLong(); //技能当前冷却时间 skill.lStartCoolTime = 0; // 技能范围改为float TODO:修改客户端技能范围相关逻辑 //最小攻击距离 skill.lMinAtkDistance = (long)pMsg->GetFloat(); //最大攻击距离 skill.lMaxAtkDistance = (long)pMsg->GetFloat(); //需要花费MP值 skill.lCostMp = pMsg->GetLong(); CPet* pPet = dynamic_cast<CPet*>(GetGame()->GetRegion()->FindChildObject(TYPE_PET,guid)) ; if (pPet == NULL) return; if (skill.lPos == 0) { skill.bAuto = true; //如果是第一个技能 则打开自动释放 } pPet->AddSkill(skill); //CPetPageEx *pPage = GetGame()->GetCGuiEx()->GetPetPageEx(); //if (pPage) // pPage->LearnedNewSkill(pPet,&skill); } break; /***********************************************************************/ /* zhaohang 2010-10-18 //技能免疫*/ /***********************************************************************/ //case MSG_S2C_SHAPE_ATK_IMMUNITY: // { // } // break; } }
bool PetAI::SearchEnemy() { CPet *owner = (CPet*) m_Owner; CMoveShape *host = owner->GetHost(); if(NULL == host) { LogError(AI_MODULE, "m_Owner->GetHost() error."); return false; } CMoveShape *target = GetTarget(); // 当前有追踪目标 if(target != NULL) { long dis = owner->Distance(target); long tracDis = owner->GetTrackRange(); if(!target->IsDied() && tracDis > dis && !target->IsGod()) { return true; } } // 寻找所在场景 CServerRegion *region = dynamic_cast<CServerRegion*>(host->GetFather()); if(NULL == region) { return false; } vector<CShape*> vOut; region->FindAroundObject(owner, TYPE_PLAYER, vOut); region->FindAroundObject(owner, TYPE_MONSTER, vOut); region->FindAroundObject(owner, TYPE_PET, vOut); bool ret = false; map<long, CMoveShape*> AroundObjs; long distance = 0; for(size_t i=0; i < vOut.size(); ++i) { target = (CMoveShape*)vOut[i]; if(target != NULL && target->IsDied() && !target->IsGod() && target->IsAttackAble(owner)) { distance = m_Owner->Distance(target->GetTileX(), target->GetTileY()); AroundObjs[distance] = target; ret = true; } } if(ret) // 满足条件设置对象 { map<long, CMoveShape*>::iterator itr = AroundObjs.begin(); target = itr->second; SetTarget(target->GetExID(), target->GetType()); //if(PET_TYPE_TRAP == owner->GetPetType()) //{ // owner->SetActTime(0, 0); // 避免寻敌后无法攻击 // owner->OnTrapSpring(); //} } return true; }
void CPKSys::SetPKValue(CMoveShape *pAttacker,CMoveShape *pBeenAttacker,int nAddSub) { //主动攻击(包含使用减益技能)本国白名玩家,每次攻击将增加20点PK值,因此方法获得的PK值上限为20,若PK值已经达到或超过20,则不会再因此方法而增加。 if (pAttacker==NULL || pBeenAttacker==NULL) { return; } if (pAttacker->GetType()==TYPE_MONSTER) { return; } if (pBeenAttacker->GetType()==TYPE_MONSTER) { if (((CMonster*)pBeenAttacker)->GetNpcType()!=NT_Guard) { return; } } CMoveShape* pAtker = pAttacker; CMoveShape* pDefer = pBeenAttacker; if( TYPE_PET == pAtker->GetType() ) { pAtker = pAtker->GetHost(); } if( TYPE_PET == pDefer->GetType() ) { pDefer = pDefer->GetHost(); } if( NULL == pAtker || NULL == pDefer ) { //PutoutLog("Pet", LT_ERROR, "..."); return; } // [8/24/2009 chenxianj] ////////////////////////////////////////////////////////////////////////// //竞技区域不进行pk值设定 CServerRegion* pRegion = dynamic_cast<CServerRegion*>( pAttacker->GetFather() ); if( !pRegion ) { return; } CRegion::eSecurity eSecurityType = pRegion->GetSecurity(pAttacker->GetTileX(),pAttacker->GetTileY()); if (eSecurityType==CRegion::SECURTIY_FIGHT) { return; } ////////////////////////////////////////////////////////////////////////// long lNum = pAtker->GetPkValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack; //攻击本阵营PK值为0的角色(白名角色)/攻击本国或本阵营PK值大于0小于等于20的角色(紫名角色) if (nAddSub==2 && IsSameCamp(pAtker,pDefer)&& (pDefer->GetPkValue()>=0 && pDefer->GetPkValue()<=20 )&& (pAtker->GetPkValue()<20)) { if (lNum>20) { lNum = 20; } pAtker->SetPkValue(lNum); } //对紫名、红名玩家释放增益技能,每次使用增益技能将增加20点PK值,因此方法获得的PK值上限为20,若PK值已经达到或超过20,则PK值不会再因此方法增加 else if (nAddSub==1 && (pDefer->GetPkValue()>0) && (pAtker->GetPkValue()<20) && pAtker!=pDefer) { if (lNum>20) { lNum = 20; } pAtker->SetPkValue(lNum); } else if (nAddSub==2 && !IsSameCamp(pAtker,pDefer) && pDefer->GetPVPValue()==0 && pDefer->GetPkValue()<=20 && pAtker->GetPVPValue()<20) { if(pRegion->GetStrongPointFlag()==false) // 未开启据点战标志 { //攻击非本阵营恶名值为0且PK值小于等于20的角色 long lNum = pAtker->GetPVPValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack; if( lNum > (long) GlobalSetup::GetSetup()->dwPkCountPerAttack) { lNum = GlobalSetup::GetSetup()->dwPkCountPerAttack; } pAtker->SetAttribute("PVPValue",lNum); pAtker->UpdateAttribute(); } } else if (nAddSub==1 && pDefer->GetPVPValue()>0 && pAtker->GetPVPValue()<20 && pAtker!=pDefer) { if(pRegion->GetStrongPointFlag()==false) // 未开启据点战标志 { //对已有恶名值的角色使用增益技能&& !IsSameCamp(pAtker,pDefer) long lNum = pAtker->GetPVPValue() + GlobalSetup::GetSetup()->dwPkCountPerAttack; if (lNum>20) { lNum = 20; } pAtker->SetAttribute("PVPValue",lNum); pAtker->UpdateAttribute(); } } }
double CScript::DestUndefine(const char* cmd, char* retStr) { CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_DesShape); if(!pMoveShape) return false; char* varname=GetStringParam(cmd,0); if (varname) { if(pMoveShape->GetType() == TYPE_PLAYER || pMoveShape->GetType() == TYPE_MONSTER ) { if(varname[0] == '$') pMoveShape->GetVariableList()->RemoveVar(varname); else if(varname[0] == '@' ||varname[0] == '#' ) { // 数组下标值 int lArray = CVariableList::VAR_NOT_FOUND; char MainVarName[256]; char InnVarName[256]; // m_Var[num].c_str() 第一个字符作为整数数组和字符串数组的标识符 char* MainVarNamePtr = MainVarName; char* InnVarNamePtr = InnVarName; char* varTypeFlag = (char*)varname; long tempPos = 0; double ret = CheckParamStringForArray(varTypeFlag, strlen(varname), &MainVarNamePtr, 256, &InnVarNamePtr, 256, tempPos); if(1.0f == ret) { if(InnVarNamePtr[0] == '$') // 下标是变量 lArray = GetScriptVarValue((CMoveShape*)pMoveShape, InnVarName, 0); else lArray = atoi(InnVarName); for(int i=0; i<lArray; i++) { char szStrNewName[128]; _snprintf(szStrNewName, 128, "%s%d", MainVarNamePtr, i); if(MainVarNamePtr[0] == '#') pMoveShape->GetVariableList()->RemoveVar(szStrNewName); else if(MainVarNamePtr[0] == '@') pMoveShape->GetVariableList()->RemoveGuid(szStrNewName); } } else if(0.0f == ret) { if(varname[0] == '#') pMoveShape->GetVariableList()->RemoveVar(varname); else if(varname[0] == '@') pMoveShape->GetVariableList()->RemoveGuid(varname); } } if( pMoveShape->GetType() == TYPE_PLAYER ) { GetGame()->UpdateSavePlayer((CPlayer*)pMoveShape, SAVE_DETAIL_ATTRVARLIST); } M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return 1.0f; } } M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return 0; }
double CScript::DestDefine(const char* cmd, char* retStr) { CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_DesShape); if(!pMoveShape) return false; char* varname=GetStringParam(cmd,0); if (varname) { // 数组下标值 int lArray = CVariableList::VAR_NOT_FOUND; char MainVarName[256]; char InnVarName[256]; // m_Var[num].c_str() 第一个字符作为整数数组和字符串数组的标识符 char* MainVarNamePtr = MainVarName; char* InnVarNamePtr = InnVarName; char* varTypeFlag = (char*)varname; long tempPos = 0; double ret = CheckParamStringForArray(varTypeFlag, strlen(varname), &MainVarNamePtr, 256, &InnVarNamePtr, 256, tempPos); if(1.0f == ret) //数组 { if(InnVarNamePtr[0] == '$') // 下标是变量 lArray = GetScriptVarValue(pMoveShape, InnVarName, 0); else lArray = atoi(InnVarName); if(MainVarNamePtr[0] == '#') // 字符串 { char* chValue = GetStringParam(cmd, 1); if(chValue) { char szNewStrName[128]; for(int lArrPos=0; lArrPos<lArray; lArrPos++) { _snprintf(szNewStrName, 128, "%s%d", MainVarNamePtr, lArrPos); if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { ((CPlayer*)pMoveShape)->GetVariableList()->AddVar(szNewStrName, chValue); } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_MONSTER) { ((CMonster*)pMoveShape)->GetVariableList()->AddVar(szNewStrName, chValue); } } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { GetGame()->UpdateSavePlayer(dynamic_cast<CPlayer*>(pMoveShape), SAVE_DETAIL_ATTRVARLIST); } M_FREE( chValue, sizeof(char)*MAX_VAR_LEN ); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } } else { int value = GetIntParam(cmd, 1); if(value != ERROR_CODE) { if(pMoveShape->GetType() == TYPE_PLAYER) { if(MainVarNamePtr[0] == '$') // 整数数组 ((CPlayer*)pMoveShape)->GetVariableList()->AddVar(MainVarNamePtr, lArray, value); else if(MainVarNamePtr[0] == '@') // GUID数组 { char szGuidName[128]; for(int lArrPos=0; lArrPos<lArray; lArrPos++) { _snprintf(szGuidName, 128, "%s%d", MainVarNamePtr, lArrPos); ((CPlayer*)pMoveShape)->GetVariableList()->AddGuid(szGuidName, NULL_GUID); } } GetGame()->UpdateSavePlayer(dynamic_cast<CPlayer*>(pMoveShape), SAVE_DETAIL_ATTRVARLIST); } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_MONSTER) { if(MainVarNamePtr[0] == '$') // 整数数组 ((CMonster*)pMoveShape)->GetVariableList()->AddVar(MainVarNamePtr, lArray, value); else if(MainVarNamePtr[0] == '@') // GUID数组 { char szGuidName[128]; for(int lArrPos=0; lArrPos<lArray; lArrPos++) { _snprintf(szGuidName, 128, "%s%d", MainVarNamePtr, lArrPos); ((CMonster*)pMoveShape)->GetVariableList()->AddGuid(szGuidName, NULL_GUID); } } } } else { TestLog(CStringReading::LoadString(IDS_GS_FUNCTION, STR_GS_FUNCTION_DEFINEVARNOTINT)); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return false; } } } else if(0.0f == ret) { if(varname[0] == '$') // 整数 { int value = GetIntParam(cmd, 1); if(value != ERROR_CODE) { if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { ((CPlayer*)pMoveShape)->GetVariableList()->AddVar(varname, value); GetGame()->UpdateSavePlayer((CPlayer*)pMoveShape, SAVE_DETAIL_ATTRVARLIST); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_MONSTER) { ((CMonster*)pMoveShape)->GetVariableList()->AddVar(varname, value); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } } else { TestLog(CStringReading::LoadString(IDS_GS_FUNCTION, STR_GS_FUNCTION_DEFINEVARNOTINT)); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return false; } } else if(varname[0] == '@') { if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { ((CPlayer*)pMoveShape)->GetVariableList()->AddGuid(varname, NULL_GUID); GetGame()->UpdateSavePlayer((CPlayer*)pMoveShape, SAVE_DETAIL_ATTRVARLIST); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_MONSTER) { ((CMonster*)pMoveShape)->GetVariableList()->AddGuid(varname, NULL_GUID); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } } else if(varname[0] == '#') { char* chValue = GetStringParam(cmd, 1); if(chValue) { if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { ((CPlayer*)pMoveShape)->GetVariableList()->AddVar(varname, chValue); } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_MONSTER) { ((CMonster*)pMoveShape)->GetVariableList()->AddVar(varname, chValue); } if((OBJECT_TYPE)pMoveShape->GetType() == TYPE_PLAYER) { GetGame()->UpdateSavePlayer(dynamic_cast<CPlayer*>(pMoveShape), SAVE_DETAIL_ATTRVARLIST); } M_FREE( chValue, sizeof(char)*MAX_VAR_LEN ); M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } } } M_FREE( varname, sizeof(char)*MAX_VAR_LEN ); return true; } return false; }