string MMatchClient::GetObjName(const MUID& uid) { MMatchObjCache* pCache = FindObjCache(uid); char szName[32]; if (pCache && strlen(pCache->GetName()) > 2) sprintf(szName, "%s", pCache->GetName()); else sprintf(szName, "%d%d", uid.High, uid.Low); string name = szName; return name; }
void ZCharacterView::SetCharacter( MUID uid ) { m_Info.UID = uid; MMatchObjCacheMap* pObjCacheMap = ZGetGameClient()->GetObjCacheMap(); for(MMatchObjCacheMap::iterator itor = pObjCacheMap->begin(); itor != pObjCacheMap->end(); ++itor) { MMatchObjCache* pObj = (*itor).second; if( pObj->GetUID() == m_Info.UID ) { InitCharParts( pObj->GetCostume()->nSex, pObj->GetCostume()->nHair, pObj->GetCostume()->nFace, pObj->GetCostume()->nEquipedItemID ); MCOLOR _color; char sp_name[255]; MMatchUserGradeID gid; if(GetUserInfoUID(m_Info.UID,_color,sp_name,gid)) { SetText( sp_name ); m_Info.nLevel = 0; } else { SetText( pObj->GetName() ); m_Info.nLevel = pObj->GetLevel(); } SetDrawInfo( true ); } } }
void MMatchObjectCacheBuilder::AddObject(MMatchObject* pObj) { MMatchObjCache* pCache = new MMatchObjCache; int nItemID=0; MMatchItemDesc* pItemDesc = NULL; MMatchCharInfo* pCharInfo = pObj->GetCharInfo(); // _ASSERT(pCharInfo); if (pCharInfo == NULL) { delete pCache; return; } MMatchObjectDuelTournamentCharInfo* pDTCharInfo = pObj->GetDuelTournamentCharInfo(); int nDTLastWeekGrade = pDTCharInfo ? pDTCharInfo->GetLastWeekGrade() : 0; pCache->SetInfo(pObj->GetUID(), pObj->GetName(), pCharInfo->m_ClanInfo.m_szClanName, pCharInfo->m_nLevel, pObj->GetAccountInfo()->m_nUGrade, pObj->GetAccountInfo()->m_nPGrade , pCharInfo->m_nRank, pCharInfo->m_nTotalKillCount, pCharInfo->m_nTotalDeathCount, nDTLastWeekGrade ); pCache->SetCLID(pObj->GetCharInfo()->m_ClanInfo.m_nClanID); MMatchClan* pClan = MMatchServer::GetInstance()->GetClanMap()->GetClan(pObj->GetCharInfo()->m_ClanInfo.m_nClanID); if (pClan) pCache->SetEmblemChecksum(pClan->GetEmblemChecksum()); else pCache->SetEmblemChecksum(0); pCache->GetCostume()->nSex = pObj->GetCharInfo()->m_nSex; pCache->GetCostume()->nHair = pObj->GetCharInfo()->m_nHair; pCache->GetCostume()->nFace = pObj->GetCharInfo()->m_nFace; for (int i=0; i < MMCIP_END; i++) { if (!pObj->GetCharInfo()->m_EquipedItem.IsEmpty(MMatchCharItemParts(i))) { pCache->GetCostume()->nEquipedItemID[i] = pObj->GetCharInfo()->m_EquipedItem.GetItem(MMatchCharItemParts(i))->GetDescID(); } else { pCache->GetCostume()->nEquipedItemID[i] = 0; } } pCache->SetFlags(pObj->GetPlayerFlags()); m_ObjectCacheList.push_back(pCache); }
bool ZSurvival::OnSectorStart(MCommand* pCommand) { char nSectorIndex; unsigned char nRepeatIndex; pCommand->GetParameter(&nSectorIndex, 0, MPT_CHAR); pCommand->GetParameter(&nRepeatIndex, 1, MPT_UCHAR); m_bIsRoundClear = false; ZGetQuest()->GetGameInfo()->ClearNPCKilled(); // 만약 섹터가 틀리면 강제로 이동한다. if (m_GameInfo.GetCurrSectorIndex() != nSectorIndex || m_GameInfo.GetCurrRepeatIndex() != nRepeatIndex) { // 새로운 섹터로 이동 m_GameInfo.OnMovetoNewSector((int)nSectorIndex, nRepeatIndex); MoveToNextSector(); } // 모든 사람들을 보여준다. for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++) { i->second->SetVisible(true); } // npc의 타겟팅 후보 제외 목록을 비운다 ZGetGame()->ClearListExceptionFromNpcTargetting(); // 전 화면에서 남아있을 수 있는 탄을 제거한다 ZGetGame()->m_WeaponManager.Clear(); ZGetWorldItemManager()->Reset(); m_CharactersGone.clear(); // admin hide 이면 다시 옵저버를 활성화 MMatchObjCache* pObjCache = ZGetGameClient()->FindObjCache(ZGetMyUID()); if (pObjCache && pObjCache->CheckFlag(MTD_PlayerFlags_AdminHide)) { ZGetGameInterface()->GetCombatInterface()->SetObserverMode(true); } return true; }
void MMatchClient::OnObjectCache(unsigned int nType, void* pBlob, int nCount) { if (nType == MATCHCACHEMODE_REPLACE) { for(int i=0; i<nCount; i++){ MMatchObjCache* pCache = (MMatchObjCache*)MGetBlobArrayElement(pBlob, i); ReplaceObjCache(pCache); } } else { if (nType == MATCHCACHEMODE_UPDATE) ClearObjCaches(); for(int i=0; i<nCount; i++){ MMatchObjCache* pCache = (MMatchObjCache*)MGetBlobArrayElement(pBlob, i); if (nType==MATCHCACHEMODE_ADD || nType==MATCHCACHEMODE_UPDATE) UpdateObjCache(pCache); else if (nType == MATCHCACHEMODE_REMOVE) RemoveObjCache(pCache->GetUID()); } } }
bool ZSurvival::OnRefreshPlayerStatus(MCommand* pCommand) { // 운영자 hide는 제외 bool bAdminHide = false; if (ZGetMyInfo()->IsAdminGrade()) { MMatchObjCache* pCache = ZGetGameClient()->FindObjCache(ZGetMyUID()); if (pCache && pCache->CheckFlag(MTD_PlayerFlags_AdminHide)) bAdminHide = true; } if (!bAdminHide) { // 옵저버이거나 옵저버 예약상태를 푼다. ZGetGame()->ReleaseObserver(); // 죽어있으면 리스폰 if (ZGetGame()->m_pMyCharacter->IsDie()) { ZGetGame()->GetMatch()->RespawnSolo(); } } // 피와 총알을 채운다 for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++) { ZCharacter* pCharacter = i->second; if (!pCharacter->IsAdminHide()) pCharacter->InitStatus(); } ZGetGame()->CancelSuicide(); return true; }
void MMatchClient::UpdateObjCache(MMatchObjCache* pCache) { MMatchObjCache* pScanCache = FindObjCache(pCache->GetUID()); if (pScanCache != NULL) return; MMatchObjCache* pNewCache = new MMatchObjCache; pNewCache->SetInfo(pCache->GetUID(), pCache->GetName(), pCache->GetClanName(), pCache->GetLevel(), pCache->GetUGrade(), pCache->GetPGrade() , pCache->GetRank(), pCache->GetKillCount(), pCache->GetDeathCount(), pCache->GetDTGrade()); pNewCache->SetCLID(pCache->GetCLID()); pNewCache->SetEmblemChecksum(pCache->GetEmblemChecksum()); pNewCache->AssignCostume(pCache->GetCostume()); pNewCache->SetFlags(pCache->GetFlags()); _ASSERT(m_ObjCacheMap.find(pNewCache->GetUID())==m_ObjCacheMap.end()); m_ObjCacheMap.Insert(pNewCache->GetUID(), pNewCache); }
void MMatchClient::ReplaceObjCache(MMatchObjCache* pCache) { MMatchObjCache* pScanCache = FindObjCache(pCache->GetUID()); if (pScanCache == NULL) return; pScanCache->SetInfo(pCache->GetUID(), pCache->GetName(), pCache->GetClanName(), pCache->GetLevel(), pCache->GetUGrade(), pCache->GetPGrade() , pCache->GetRank(), pCache->GetKillCount(), pCache->GetDeathCount(), pCache->GetDTGrade() ); pScanCache->SetCLID(pCache->GetCLID()); pScanCache->SetEmblemChecksum(pCache->GetEmblemChecksum()); pScanCache->AssignCostume(pCache->GetCostume()); pScanCache->SetFlags(pCache->GetFlags()); }
MCommand* MMatchObjectCacheBuilder::GetResultCmd(MATCHCACHEMODE nMode, MCommandCommunicator* pCmdComm) { MCommand* pCmd = pCmdComm->CreateCommand(MC_MATCH_OBJECT_CACHE, MUID(0,0)); pCmd->AddParameter(new MCmdParamUChar(nMode)); int nCount = (int)m_ObjectCacheList.size(); void* pCacheArray = MMakeBlobArray(sizeof(MMatchObjCache), nCount); int nIndex=0; for (MMatchObjCacheList::iterator itor=m_ObjectCacheList.begin(); itor!=m_ObjectCacheList.end(); itor++) { MMatchObjCache* pTrgCache = (MMatchObjCache*)MGetBlobArrayElement(pCacheArray, nIndex++); MMatchObjCache* pSrcCache = (*itor); pTrgCache->SetInfo(pSrcCache->GetUID(), pSrcCache->GetName(), pSrcCache->GetClanName(), pSrcCache->GetLevel(), pSrcCache->GetUGrade(), pSrcCache->GetPGrade() , pSrcCache->GetRank(), pSrcCache->GetKillCount(), pSrcCache->GetDeathCount(), pSrcCache->GetDTGrade() ); pTrgCache->SetFlags(pSrcCache->GetFlags()); pTrgCache->SetCLID(pSrcCache->GetCLID()); pTrgCache->SetEmblemChecksum(pSrcCache->GetEmblemChecksum()); pTrgCache->AssignCostume(pSrcCache->GetCostume()); } pCmd->AddParameter(new MCmdParamBlob(pCacheArray, MGetBlobArraySize(pCacheArray))); MEraseBlobArray(pCacheArray); return pCmd; }