BOOL cQuickSlotDlg::CanEquip(cIcon* pIcon) { if(pIcon->GetType() == WT_QUICKITEM) { return TRUE; } else if(pIcon->GetType() == WT_ITEM) { CItem * pItem = (CItem *)pIcon; if( pItem->GetItemInfo()->Category == eItemCategory_Equip ) { return TRUE; } if( pItem->GetItemInfo()->Category == eItemCategory_Expend ) { return TRUE; } return FALSE; } else if( pIcon->GetType() == WT_SKILL ) { cSkillBase * pSkill = (cSkillBase *)pIcon; cSkillInfo* pSkillInfo = SKILLMGR->GetSkillInfo( pSkill->GetSkillIdx()); if( pSkillInfo->GetKind() == SKILLKIND_PASSIVE || pSkillInfo->GetKind() == SKILLKIND_BUFF ) { return FALSE; } return TRUE; } // 070216 LYW --- QuickManager : Add conduct part to CanEquip function. else if( pIcon->GetType() == WT_CONDUCT ) { return TRUE ; } CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(352) ); return FALSE; }
BOOL CPetResurrectionDialog::FakeMoveIcon( LONG x, LONG y, cIcon* icon ) { if( WT_ITEM != icon->GetType() || icon->IsLocked() || m_bDisable ) { return FALSE; } CItem* pItem = (CItem *)icon; if( pItem->GetItemInfo()->SupplyType != ITEM_KIND_PET ) { return FALSE; } PET_OBJECT_INFO* pPetObjectInfo = PETMGR->GetPetObjectInfo( pItem->GetDBIdx() ); if( !pPetObjectInfo ) { return FALSE; } if( pPetObjectInfo->State != ePetState_Die ) { return FALSE; } CItem* old = ( CItem* )( mSourceItem->GetLinkItem() ); if( old ) old->SetLock( FALSE ); mSourceItem->SetData( pItem->GetItemIdx() ); mSourceItem->SetLinkItem( pItem ); ITEMMGR->AddToolTip( mSourceItem ); mIconDialog->AddIcon( 0, mSourceItem ); pItem->SetLock( TRUE ); return FALSE; }
void CPetManager::NetworkMsgParse(BYTE Protocol,void* pMsg) { switch( Protocol ) { case MP_PET_HATCH: { MSG_PET_INFO* pmsg = ( MSG_PET_INFO* )pMsg; PET_OBJECT_INFO* pObjectInfo = new PET_OBJECT_INFO; memcpy( pObjectInfo, &( pmsg->PetObjectInfo ), sizeof( PET_OBJECT_INFO ) ); mPetObjectInfoTable.Add( pObjectInfo, pObjectInfo->ItemDBIdx ); PET_INFO* pInfo = mPetInfoTable.GetData( pObjectInfo->Kind ); CItem* pItem = ITEMMGR->GetItem( pObjectInfo->ItemDBIdx ); if( !pInfo || !pItem ) return; CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1573), pInfo->Name, pObjectInfo->SkillSlot ); pItem->ForcedUnseal(); ITEMMGR->RefreshItem( pItem ); } break; case MP_PET_EXP_NOTIFY: { HEROPET->AddExp(); } break; case MP_PET_LEVELUP_NOTIFY: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; CPet* pPet = ( CPet* )OBJECTMGR->GetObject( pmsg->dwData ); if( !pPet ) return; pPet->LevelUp(); APPEARANCEMGR->InitAppearance( pPet ); if( pPet == HEROPET ) { HEROPET->CalcStats(); // 081112 LYW --- PetManager : 펫이 레벨업 했을경우 잘못 출력되던 // 메시지 번호를 수정함. 1647 ->1659 (정진문) CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1659)); } TARGETSET set; set.pTarget = pPet; EFFECTMGR->StartEffectProcess(mLevelUpEffect,pPet,&set,0,pPet->GetID()); } break; case MP_PET_LEVEL_NOTIFY: { MSG_DWORDBYTE* pmsg = ( MSG_DWORDBYTE* )pMsg; CPet* pPet = ( CPet* )OBJECTMGR->GetObject( pmsg->dwData ); if( !pPet ) return; pPet->SetLevel( pmsg->bData ); APPEARANCEMGR->InitAppearance( pPet ); if( pPet == HEROPET ) { HEROPET->CalcStats(); // 081112 LYW --- PetManager ; 펫이 레벨업 했을 경우 잘못 출력되던 메시지 번호를 수정함. // 메시지 번호를 수정함. 1647 ->1659 (정진문) CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1659)); } } break; case MP_PET_GRADEUP_NOTIFY: { MSG_DWORDBYTE2* pmsg = ( MSG_DWORDBYTE2* )pMsg; CPet* pPet = ( CPet* )OBJECTMGR->GetObject( pmsg->dwData ); if( !pPet ) return; pPet->GradeUp(); APPEARANCEMGR->InitAppearance( pPet ); if( pPet == HEROPET ) { HEROPET->SetType( ePetType(pmsg->bData1)); HEROPET->SetSkillSlot( pmsg->bData2); HEROPET->CalcStats(); CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1576)); CItem* pItem = ITEMMGR->GetItem( HEROPET->GetItemDBIdx() ); if( pItem ) { ITEMMGR->RefreshItem( pItem ); } } TARGETSET set; set.pTarget = pPet; EFFECTMGR->StartEffectProcess(mGradeUpEffect,pPet,&set,0,pPet->GetID()); } break; case MP_PET_FRIENDLY_SYNC: { MSG_BYTE* pmsg = ( MSG_BYTE* )pMsg; HEROPET->SetFriendly( pmsg->bData ); } break; case MP_PET_RESURRECTION_ACK: { MSG_PET_INFO* pmsg = ( MSG_PET_INFO* )pMsg; PET_OBJECT_INFO* oldinfo = mPetObjectInfoTable.GetData( pmsg->PetObjectInfo.ItemDBIdx ); if( oldinfo ) { memcpy( oldinfo, &( pmsg->PetObjectInfo ), sizeof( PET_OBJECT_INFO ) ); } CItem* pItem = ITEMMGR->GetItem( pmsg->PetObjectInfo.ItemDBIdx ); if( pItem ) { ITEMMGR->RefreshItem( pItem ); } CPetResurrectionDialog* window = GAMEIN->GetPetResurrectionDlg(); if( window && window->IsActive() ) { window->SetUsedItem( NULL ); window->SetActive( FALSE ); } QUICKMGR->RefreshQickItem(); } break; case MP_PET_LIFE_NOTIFY: { MSG_INT* pmsg = ( MSG_INT* )pMsg; if( HEROPET ) HEROPET->SetLife( HEROPET->GetLife() + pmsg->nData ); } break; case MP_PET_MAXLIFE_NOTIFY: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; CPet* pPet = (CPet*)OBJECTMGR->GetObject( pmsg->dwObjectID ); if( pPet ) pPet->SetMaxLife( pmsg->dwData ); } break; case MP_PET_MANA_NOTIFY: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; if( HEROPET ) HEROPET->SetMana( pmsg->dwData ); } break; case MP_PET_MAXMANA_NOTIFY: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; if( HEROPET ) HEROPET->SetMaxMana( pmsg->dwData ); } break; case MP_PET_OBJECT_INFO: { MSG_PET_INFO* pmsg = ( MSG_PET_INFO* )pMsg; PET_OBJECT_INFO* oldinfo = mPetObjectInfoTable.GetData( pmsg->PetObjectInfo.ItemDBIdx ); if( oldinfo ) { memcpy( oldinfo, &( pmsg->PetObjectInfo ), sizeof( PET_OBJECT_INFO ) ); } else { PET_OBJECT_INFO* pObjectInfo = new PET_OBJECT_INFO; memcpy( pObjectInfo, &( pmsg->PetObjectInfo ), sizeof( PET_OBJECT_INFO ) ); mPetObjectInfoTable.Add( pObjectInfo, pObjectInfo->ItemDBIdx ); } ITEMMGR->RefreshItemToolTip( pmsg->PetObjectInfo.ItemDBIdx ); // 퀵슬롯이 세팅된 후에 펫 정보가 전송된다. 따라서 사망 등의 정보가 변경되려면 재호출한다 QUICKMGR->RefreshQickItem(); } break; case MP_PET_DIE_NOTIFY: { MSG_DWORD* pmsg = ( MSG_DWORD* )pMsg; PET_OBJECT_INFO* oldinfo = mPetObjectInfoTable.GetData( pmsg->dwData ); if( oldinfo ) { oldinfo->HP = 0; oldinfo->MP = 0; oldinfo->Friendly = 0; oldinfo->State = ePetState_Die; } CItem* pItem = ITEMMGR->GetItem( pmsg->dwData ); if( pItem ) { ITEMMGR->RefreshItem( pItem ); } CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1578)); // 081112 LYW --- PetManager : 펫이 사망하였을 경우 펫 ui를 닫도록 수정함. cDialog* pDlg = GAMEIN->GetPetUIDlg() ; if( pDlg ) { pDlg->SetActive( FALSE ) ; } // 090212 NYJ - 봉인중 죽어버리면 봉인취소 CProgressDialog* pProgressDlg = ( CProgressDialog* )WINDOWMGR->GetWindowForID( PROGRESS_DIALOG ); if(pProgressDlg && pProgressDlg->GetActionType()==CProgressDialog::eActionPetSummon) { pProgressDlg->Cancel(); } QUICKMGR->RefreshQickItem(); } break; case MP_PET_ITEM_INFO: { MSG_PET_ITEM_INFO* pmsg = ( MSG_PET_ITEM_INFO* )pMsg; CPet* pPet = ( CPet* )OBJECTMGR->GetObject( pmsg->ID ); if( pPet ) { pPet->SetWearedItem( pmsg->Item ); APPEARANCEMGR->InitAppearance( pPet ); } } break; case MP_PET_ITEM_DISCARD_ACK: { MSG_BYTE2* pmsg = ( MSG_BYTE2* )pMsg; //시간 소모로 삭제 되었다면 TRUE if( pmsg->bData2 ) { CPetWearedDialog* pDlg = GAMEIN->GetPetWearedDlg(); CItem* pItem = (pDlg) ? (CItem*)pDlg->GetIconForIdx( pmsg->bData1 ) : NULL ; if( pItem ) { CHATMGR->AddMsg( CTC_CHEAT_1, CHATMGR->GetChatMsg( 1192 ), CHATMGR->GetChatMsg( 1926 ), pItem->GetItemInfo()->ItemName ); } } GAMEIN->GetPetWearedDlg()->DeleteAck( pmsg->bData1 ); } break; case MP_PET_ITEM_MOVE_PLAYER_ACK: { MSG_PET_ITEM_MOVE_SYN* pmsg = ( MSG_PET_ITEM_MOVE_SYN* )pMsg; CInventoryExDialog* pPlayerInven = GAMEIN->GetInventoryDialog(); CStorageDialog* pPlayerStorage = GAMEIN->GetStorageDialog(); CPetWearedDialog* pPetInven = GAMEIN->GetPetWearedDlg(); CItem* pPlayerItem = NULL; const eITEMTABLE TableIdx = ITEMMGR->GetTableIdxForAbsPos( pmsg->PlayerPos ); if( TableIdx == eItemTable_Storage) { pPlayerStorage->DeleteItem( pmsg->PlayerPos, &pPlayerItem ); } else if( TableIdx == eItemTable_Inventory ) { pPlayerInven->DeleteItem( pmsg->PlayerPos, &pPlayerItem ); } else return; cIcon* pIcon = NULL; CItem* pPetItem = NULL; pPetInven->DeleteItem( pmsg->PetPos, &pIcon ); pPetItem = ( CItem* )pIcon; if( pPlayerItem ) { pPlayerItem->SetPosition( pmsg->PetPos ); pPetInven->AddItem( pmsg->PetPos, pPlayerItem ); } if( pPetItem ) { pPetItem->SetPosition( pmsg->PlayerPos ); if( TableIdx == eItemTable_Storage) { pPlayerStorage->AddItem( pPetItem ); } else if( TableIdx == eItemTable_Inventory ) { pPlayerInven->AddItem( pPetItem ); } else return; } } break; case MP_PET_ITEM_MOVE_PLAYER_NACK: { MSG_WORD* msg = (MSG_WORD*)pMsg; switch(msg->wData) { case 1: CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1739)); break; } } break; // 090625 pdy 펫 기간제 아이템 착용처리 추가 case MP_PET_ITEM_TIMELIMT_ONEMINUTE_FROM_PETINVEN: { MSG_DWORD2* pmsg = (MSG_DWORD2*)pMsg ; ITEM_INFO* pItemInfo = NULL ; pItemInfo = ITEMMGR->GetItemInfo( pmsg->dwData1 ) ; if( !pItemInfo ) return ; POSTYPE pos = (POSTYPE)pmsg->dwData2 ; CPetWearedDialog* pDlg = GAMEIN->GetPetWearedDlg(); CItem* pItem= (pDlg) ? (CItem*)pDlg->GetIconForIdx(pos) : NULL ; const ITEMBASE* pItemBase = (pItem) ? &pItem->GetItemBaseInfo() : NULL ; if( pItemBase ) { CItem* pItem = NULL ; pItem = ITEMMGR->GetItem( pItemBase->dwDBIdx ) ; if( pItem ) { pItem->SetItemBaseInfo( *pItemBase ) ; pItem->SetLastCheckTime(gCurTime) ; pItem->SetRemainTime( 50 ) ; } } CHATMGR->AddMsg( CTC_CHEAT_1, CHATMGR->GetChatMsg( 1191 ), CHATMGR->GetChatMsg( 1926 ), pItemInfo->ItemName ) ; } break; case MP_PET_LIFE_BROAD: { const MSG_INT* const msg = (MSG_INT*)pMsg; CPet* pPet = (CPet*)OBJECTMGR->GetObject( msg->dwObjectID ); if( pPet ) { DWORD dwNewLife = pPet->GetLife() + msg->nData; pPet->SetLife( dwNewLife ); } } break; } }