void MMatchServer::OnAsyncGetAccountItemList( MAsyncJob* pJobResult ) { MAsyncDBJob_GetAccountItemList* pJob = (MAsyncDBJob_GetAccountItemList*)pJobResult; if( MASYNC_RESULT_SUCCEED != pJob->GetResult() ) { mlog("GetAccountItemList Failed\n"); return; } MMatchObject* pObj = GetObject( pJob->GetPlayerUID() ); if( NULL == pObj ) return; if( !pJob->GetExpiredAccountItems().empty() ) { ResponseExpiredItemIDList(pObj, pJob->GetExpiredAccountItems()); } const int nAccountItemCount = pJob->GetAccountItemCount(); if (nAccountItemCount > 0) { MAccountItemNode* accountItems = pJob->GetAccountItemList(); if( NULL == accountItems ) return; MCommand* pNew = CreateCommand(MC_MATCH_RESPONSE_ACCOUNT_ITEMLIST, pObj->GetUID()); // 갖고 있는 아이템 리스트 전송 int nCountableAccountItemCount = 0; for(int i = 0; i < nAccountItemCount; i++ ) { if( accountItems[i].nCount > 0 && accountItems[i].nItemID > 0 ) { nCountableAccountItemCount++; } } void* pItemArray = MMakeBlobArray(sizeof(MTD_AccountItemNode), nCountableAccountItemCount); int nIndex = 0; for (int i = 0; i < nAccountItemCount; i++) { if( accountItems[i].nItemID == 0 ) continue; MTD_AccountItemNode* pItemNode = (MTD_AccountItemNode*)MGetBlobArrayElement(pItemArray, nIndex); _ASSERTE( ((NULL != MGetMatchItemDescMgr()->GetItemDesc(accountItems[i].nItemID)) || (NULL != m_GambleMachine.GetGambleItemByGambleItemID(accountItems[i].nItemID))) && "zitem.xml or GambleItem에 기술되어 있지 않는 아이템입니다." ); if( accountItems[i].nCount > 0 ) { Make_MTDAccountItemNode(pItemNode, accountItems[i].nAIID, accountItems[i].nItemID , accountItems[i].nRentMinutePeriodRemainder, accountItems[i].nCount); nIndex++; if( nIndex == nCountableAccountItemCount ) { break; } } } pNew->AddParameter(new MCommandParameterBlob(pItemArray, MGetBlobArraySize(pItemArray))); MEraseBlobArray(pItemArray); PostSafeQueue( pNew ); } }
void ZCharacterView::SetParts(MMatchCharItemParts nParts, unsigned int nItemID) { MMatchItemDesc* pItemDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemID); if (pItemDesc == NULL) { if (nItemID != 0) return; } else { if (IsSuitableItemSlot(pItemDesc->m_nSlot, nParts) == false) return; if (pItemDesc->m_nResSex != -1) { if (pItemDesc->m_nResSex != int(ZGetMyInfo()->GetSex())) return; } } m_ItemSlots[nParts].m_nItemID = nItemID; if (nParts == MMCIP_PRIMARY) { ZChangeCharWeaponMesh(m_pTVisualMesh.GetVMesh(), m_ItemSlots[MMCIP_PRIMARY].m_nItemID); } else { u32 itemids[MMCIP_END]; for (int i = 0; i < MMCIP_END; i++) itemids[i] = m_ItemSlots[i].m_nItemID; ZChangeCharParts(m_pTVisualMesh.GetVMesh(), m_Info.nSex, m_Info.nHair, m_Info.nFace, itemids); } if( Enable_Cloth ) m_pTVisualMesh.m_pVisualMesh->ChangeChestCloth(0.9f,1); }
void ZApplication::OnDestroy() { m_WorldManager.Destroy(); ZGetEmblemInterface()->Destroy(); MGetMatchWorldItemDescMgr()->Clear(); m_SoundEngine.Destroy(); DestroyConsole(); mlog("Destroy console.\n"); SAFE_DELETE(m_pLogFrame); SAFE_DELETE(m_pGameInterface); SAFE_DELETE(m_pStageInterface); SAFE_DELETE(m_pOptionInterface); m_NPCMeshMgr.DelAll(); m_MeshMgr.DelAll(); mlog("Destroy mesh manager.\n"); m_WeaponMeshMgr.DelAll(); mlog("Destroy weapon mesh manager.\n"); m_SkillManager.Destroy(); mlog("Clear SkillManager.\n"); #ifdef _QUEST_ITEM GetQuestItemDescMgr().Clear(); mlog( "Clear QuestItemDescMgr.\n" ); #endif MGetMatchItemDescMgr()->Clear(); mlog("Clear MatchItemDescMgr.\n"); MGetChattingFilter()->Clear(); mlog("Clear ChattingFilter.\n"); ZGetChannelRuleMgr()->Clear(); mlog("Clear ChannelRuleMgr.\n"); if (m_nTimerRes != 0) { timeEndPeriod(m_nTimerRes); m_nTimerRes = 0; } //CoUninitialize(); RGetParticleSystem()->Destroy(); mlog("destroy game application done.\n"); }
void ZApplication::OnUpdate() { __BP(0,"ZApplication::OnUpdate"); float fElapsed; fElapsed = ZApplication::m_Timer.UpdateFrame(); __BP(1,"ZApplication::OnUpdate::m_pInterface->Update"); if (m_pGameInterface) m_pGameInterface->Update(fElapsed); __EP(1); // RGetParticleSystem()->Update(fElapsed); __BP(2,"ZApplication::OnUpdate::SoundEngineRun"); #ifdef _BIRDSOUND m_SoundEngine.Update(); #else m_SoundEngine.Run(); #endif __EP(2); //// ANTIHACK //// { static DWORD dwLastAntiHackTick = 0; if (timeGetTime() - dwLastAntiHackTick > 10000) { dwLastAntiHackTick = timeGetTime(); if (m_GlobalDataChecker.UpdateChecksum() == false) { Exit(); } } } // 아무곳에서나 찍기 위해서.. // if(Mint::GetInstance()) { if(ZIsActionKeyPressed(ZACTION_SCREENSHOT)) { if(m_pGameInterface) m_pGameInterface->SaveScreenShot(); } // } // 실행중 메모리 조작으로 item 속성값을 변경하는 해킹대응 MGetMatchItemDescMgr()->ShiftMemoryGradually(); __EP(0); }
static char* GetTrapMeshName(int nItemId) { MMatchItemDesc* pDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemId); if (!pDesc) return NULL; switch (pDesc->m_nDamageType.Ref()) { case MMDT_FIRE: return "trap_firefield"; case MMDT_COLD: return "trap_frozenfield"; } _ASSERT(0); return NULL; }
bool ZCharacterItem::EquipItem(MMatchCharItemParts parts, int nItemDescID, int nItemCount) { if (nItemDescID == 0) { m_Items[parts].Create(MUID(0,0), NULL, 0); return true; } MMatchItemDesc* pDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemDescID); if (pDesc == NULL) { _ASSERT(0); return false; } if (!Confirm(parts, pDesc)) { // _ASSERT(0); return false; } m_Items[parts].Create(MUID(0,0), pDesc, 1, nItemCount); return true; }
void MMatchActiveTrapMgr::AddThrowedTrap( const MUID& uidOwner, int nItemId ) { if (!m_pStage) return; if (!m_pStage->GetObj(uidOwner)) return; MMatchItemDesc* pItemDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemId); if (!pItemDesc) return; MMatchActiveTrap* pTrap = new MMatchActiveTrap; pTrap->m_nTimeThrowed = MGetMatchServer()->GetGlobalClockCount(); pTrap->m_uidOwner = uidOwner; pTrap->m_nTrapItemId = nItemId; pTrap->m_nLifeTime = pItemDesc->m_nLifeTime.Ref(); m_listTrap.push_back(pTrap); OutputDebugStr("AddThrowedTrap\n"); }
bool ZSurvival::OnObtainZItem(MCommand* pCommand) { unsigned long int nItemID; pCommand->GetParameter(&nItemID, 0, MPT_UINT); m_GameInfo.IncreaseObtainQuestItem(); #ifdef _QUEST_ITEM MMatchItemDesc* pItemDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemID); if (pItemDesc) { char szMsg[ 128]; ZTransMsg( szMsg, MSG_GAME_GET_QUEST_ITEM, 1, pItemDesc->m_pMItemName->Ref().m_szItemName); ZChatOutput( MCOLOR(ZCOLOR_CHAT_SYSTEM_GAME), szMsg); } #endif return true; }
int ZShopEquipInterface::_CheckRestrictBringAccountItem() { // Return -1 : Error // 0 : No restriction // 1 : Sex restricted // 2 : Level restricted ZShopEquipListItem* pListItem = GetListCurSelItem("AccountItemList"); if (pListItem == NULL) return -1; if (pListItem->GetItemData()->GetHandleBringAccount()) { int nAIID = pListItem->GetItemData()->GetHandleBringAccount()->GetAIID(); ZMyItemNode* pMyItemNode = ZGetMyInfo()->GetItemList()->GetAccountItemByAIID(nAIID); if (!pMyItemNode) return 0; unsigned long nItemID = pMyItemNode->GetItemID(); MMatchItemDesc* pItemDesc = MGetMatchItemDescMgr()->GetItemDesc(nItemID); if (!pItemDesc) { if( ZGetGambleItemDefineMgr().GetGambleItemDefine(nItemID) ) { return 0; // 겜블 아이템은 존재만 확인하면 된다. } else { return -1; } } if ((pItemDesc->m_nResSex.Ref() != -1) && (ZGetMyInfo()->GetSex() != pItemDesc->m_nResSex.Ref())) return 1; // Sex restricted if (ZGetMyInfo()->GetLevel() < pItemDesc->m_nResLevel.Ref()) return 2; // Level restricted } return 0; // No Restriction }
bool ZShopEquipInterface::Equip(void) { static unsigned long int st_LastRequestTime = 0; ///< 막 누르는 것 방지 unsigned long int nNowTime = timeGetTime(); if ((nNowTime - st_LastRequestTime) < 1000) return false; st_LastRequestTime = nNowTime; ZShopEquipListItem* pListItem = GetListCurSelItem("EquipmentList"); if (!pListItem) { ZApplication::GetGameInterface()->ShowErrorMessage( MERR_NO_SELITEM ); return false; } // 갬블 아이템 if (ZSEIT_GAMBLE == pListItem->GetItemData()->GetType()) { ZShopEquipItem_Gamble* pWrapperGItem = (ZShopEquipItem_Gamble*)pListItem->GetItemData(); const ZGambleItemDefine* pGItemDesc = pWrapperGItem->GetDesc(); if (pGItemDesc) { // 이번에 캐시용 겜블아이템 추가로 수정 // 기존 일본 요청으로 퀘스트용 겜블아이템을 추가했었음 (1000100~1000199사이) // 퀘스트용 겜블아이템은 1000100에서 1000200로 제한한다 if( ZGetGameClient()->GetServerMode() != MSM_TEST && 1000100 <= pGItemDesc->GetGambleItemID() && pGItemDesc->GetGambleItemID() < 1000200) { ZApplication::GetGameInterface()->ShowErrorMessage( MERR_CANNOT_CAHNGE_THIS_ITEM ); } else { if (!pWrapperGItem->GetHandleSell()) { _ASSERT(0); return false; } ZPostRequestGamble( pWrapperGItem->GetHandleSell()->GetItemUID() ); ZPostRequestCharacterItemList( ZGetGameClient()->GetPlayerUID() ); } } } // 일반 아이템 if (ZSEIT_MATCH != pListItem->GetItemData()->GetType()) { return false; } ZShopEquipItem_Match* pWrappedZItem = (ZShopEquipItem_Match*)pListItem->GetItemData(); if (!pWrappedZItem->GetHandleSell()) { _ASSERT(0); return false; } MUID uidItem = pWrappedZItem->GetHandleSell()->GetItemUID(); MMatchItemDesc* pItemDesc = MGetMatchItemDescMgr()->GetItemDesc(ZGetMyInfo()->GetItemList()->GetItemID(uidItem)); if (!pItemDesc) return false; if (pItemDesc->m_nSlot == MMIST_NONE) return false; MMatchCharItemParts parts = RecommendEquipParts(pItemDesc->m_nSlot); if (parts == MMCIP_END) return false; WidgetHideDisableShow("Equip"); WidgetHideDisableShow("SendAccountItemBtn"); SetKindableItem( MMIST_NONE); return Equip(parts, uidItem); }
bool ZApplication::OnCreate(ZLoadingProgress *pLoadingProgress) { string strFileNameZItem(FILENAME_ZITEM_DESC); string strFileNameZItemLocale(FILENAME_ZITEM_DESC_LOCALE); string strFileNameZBuff(FILENAME_BUFF_DESC); string strFileNameWorlditem(FILENAME_WORLDITEM); string strFileNameAbuse(FILENAME_ABUSE); // #ifndef _DEBUG // strFileNameZItem += ".mef"; // strFileNameZItemLocale += ".mef"; // strFileNameZBuff += ".mef"; // strFileNameWorlditem += ".mef"; // strFileNameAbuse += ".mef"; // #endif MInitProfile(); // 멀티미디어 타이머 초기화 TIMECAPS tc; mlog("ZApplication::OnCreate : begin\n"); //ZGetSoundEngine()->Enumerate(); //for( int i = 0 ; i < ZGetSoundEngine()->GetEnumDeviceCount() ; ++i) //{ // sprintf(szDesc, "Sound Device %d = %s\n", i, ZGetSoundEngine()->GetDeviceDescription( i ) ); // mlog(szDesc); //} __BP(2000,"ZApplication::OnCreate"); #define MMTIMER_RESOLUTION 1 if (TIMERR_NOERROR == timeGetDevCaps(&tc,sizeof(TIMECAPS))) { m_nTimerRes = min(max(tc.wPeriodMin,MMTIMER_RESOLUTION),tc.wPeriodMax); timeBeginPeriod(m_nTimerRes); } // 한국도 서버리스트 선택 과정이 추가된다. // IP가 없으면 로그인화면으로 이동, IP가 있으면 바로 캐릭터 선택창으로 이동 if (ZApplication::GetInstance()->GetLaunchMode() == ZApplication::ZLAUNCH_MODE_NETMARBLE) m_nInitialState = GUNZ_DIRECTLOGIN; if (ZGameInterface::m_sbRemainClientConnectionForResetApp == true) m_nInitialState = GUNZ_LOBBY; // if during reload client for changing language, pass login step. DWORD _begin_time,_end_time; #define BEGIN_ { _begin_time = timeGetTime(); } #define END_(x) { _end_time = timeGetTime(); float f_time = (_end_time - _begin_time) / 1000.f; mlog("\n-------------------> %s : %f \n\n", x,f_time ); } __BP(2001,"m_SoundEngine.Create"); ZLoadingProgress soundLoading("Sound",pLoadingProgress,.12f); BEGIN_; #ifdef _BIRDSOUND m_SoundEngine.Create(RealSpace2::g_hWnd, 44100, Z_AUDIO_HWMIXING, GetFileSystem()); #else m_SoundEngine.Create(RealSpace2::g_hWnd, Z_AUDIO_HWMIXING, &soundLoading ); #endif END_("Sound Engine Create"); soundLoading.UpdateAndDraw(1.f); __EP(2001); // mlog("ZApplication::OnCreate : m_SoundEngine.Create\n"); mlog( "sound engine create.\n" ); // ZGetInitialLoading()->SetPercentage( 15.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(.3f); RegisterForbidKey(); __BP(2002,"m_pInterface->OnCreate()"); ZLoadingProgress giLoading("GameInterface",pLoadingProgress,.35f); BEGIN_; m_pGameInterface=new ZGameInterface("GameInterface",Mint::GetInstance()->GetMainFrame(),Mint::GetInstance()->GetMainFrame()); m_pGameInterface->m_nInitialState = m_nInitialState; if(!m_pGameInterface->OnCreate(&giLoading)) { mlog("Failed: ZGameInterface OnCreate\n"); SAFE_DELETE(m_pGameInterface); return false; } // mlog("Bird : 5\n"); m_pGameInterface->SetBounds(0,0,MGetWorkspaceWidth(),MGetWorkspaceHeight()); END_("GameInterface Create"); giLoading.UpdateAndDraw(1.f); m_pStageInterface = new ZStageInterface(); m_pOptionInterface = new ZOptionInterface; __EP(2002); #ifdef _BIRDTEST goto BirdGo; #endif // ZGetInitialLoading()->SetPercentage( 30.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(.7f); __BP(2003,"Character Loading"); ZLoadingProgress meshLoading("Mesh",pLoadingProgress,.41f); BEGIN_; // zip filesystem 을 사용하기 때문에 꼭 ZGameInterface 다음에 사용한다... // if(m_MeshMgr.LoadXmlList("model/character_lobby.xml")==-1) return false; if(m_MeshMgr.LoadXmlList("model/character.xml",ZProgressCallBack,&meshLoading)==-1) return false; mlog( "Load character.xml success,\n" ); END_("Character Loading"); meshLoading.UpdateAndDraw(1.f); // ZLoadingProgress npcLoading("NPC",pLoadingProgress,.1f); #ifdef _QUEST //if(m_NPCMeshMgr.LoadXmlList("model/npc.xml",ZProgressCallBack,&npcLoading) == -1) if(m_NPCMeshMgr.LoadXmlList("model/npc.xml") == -1) return false; #endif __EP(2003); // 모션에 연결된 사운드 파일중 없는것을 제거한다.. // 엔진에서는 사운드에 접근할수없어서.. // 파일체크는 부담이크고~ CheckSound(); // npcLoading.UpdateAndDraw(1.f); __BP(2004,"WeaponMesh Loading"); BEGIN_; string strFileNameWeapon("model/weapon.xml"); // #ifndef _DEBUG // strFileNameWeapon += ".mef"; // #endif if(m_WeaponMeshMgr.LoadXmlList((char*)strFileNameWeapon.c_str())==-1) return false; END_("WeaponMesh Loading"); __EP(2004); __BP(2005,"Worlditem Loading"); ZLoadingProgress etcLoading("etc",pLoadingProgress,.02f); BEGIN_; #ifdef _WORLD_ITEM_ m_MeshMgr.LoadXmlList((char*)strFileNameWorlditem.c_str()); #endif mlog("Load weapon.xml success. \n"); //*/ END_("Worlditem Loading"); __EP(2005); #ifdef _BIRDTEST BirdGo: #endif __BP(2006,"ETC .. XML"); BEGIN_; CreateConsole(ZGetGameClient()->GetCommandManager()); // mlog("ZApplication::OnCreate : CreateConsole \n"); m_pLogFrame = new MCommandLogFrame("Command Log", Mint::GetInstance()->GetMainFrame(), Mint::GetInstance()->GetMainFrame()); int nHeight = MGetWorkspaceHeight()/3; m_pLogFrame->SetBounds(0, MGetWorkspaceHeight()-nHeight-1, MGetWorkspaceWidth()-1, nHeight); m_pLogFrame->Show(false); m_pGameInterface->SetFocusEnable(true); m_pGameInterface->SetFocus(); m_pGameInterface->Show(true); if (!MGetMatchItemDescMgr()->ReadCache()) { if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItem.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileNameZItem.c_str()); } if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItemLocale.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileNameZItemLocale.c_str()); } MGetMatchItemDescMgr()->WriteCache(); } mlog("Load zitem info success.\n"); if( !MGetMatchBuffDescMgr()->ReadXml(GetFileSystem(), strFileNameZBuff.c_str()) ) { MLog("Error while Read Buff Descriptor %s\n", strFileNameZBuff.c_str()); } mlog("Load zBuff info success.\n"); // if (!MGetMatchItemEffectDescMgr()->ReadXml(GetFileSystem(), FILENAME_ZITEMEFFECT_DESC)) // { // MLog("Error while Read Item Descriptor %s\n", FILENAME_ZITEMEFFECT_DESC); // } // mlog("Init effect manager success.\n"); if (!MGetMatchWorldItemDescMgr()->ReadXml(GetFileSystem(), strFileNameWorlditem.c_str() )) { MLog("Error while Read Item Descriptor %s\n", strFileNameWorlditem.c_str()); } mlog("Init world item manager success.\n"); if (!MGetMapDescMgr()->Initialize(GetFileSystem(), "system/map.xml")) { MLog("Error while Read map Descriptor %s\n", "system/map.xml"); } mlog("Init map Descriptor success.\n"); string strFileChannelRule("system/channelrule.xml"); // #ifndef _DEBUG // strFileChannelRule += ".mef"; // #endif if (!ZGetChannelRuleMgr()->ReadXml(GetFileSystem(), strFileChannelRule.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileChannelRule.c_str()); } mlog("Init channel rule manager success.\n"); /* if (!MGetNPCGroupMgr()->ReadXml(GetFileSystem(), "system/monstergroup.xml")) { MLog("Error while Read Item Descriptor %s", "system/monstergroup.xml"); } mlog("ZApplication::OnCreate : ZGetNPCGroupMgr()->ReadXml \n"); */ // if (!MGetChattingFilter()->Create(GetFileSystem(), "system/abuse.xml")) bool bSucceedLoadAbuse = MGetChattingFilter()->LoadFromFile(GetFileSystem(), strFileNameAbuse.c_str()); if (!bSucceedLoadAbuse || MGetChattingFilter()->GetNumAbuseWords() == 0) { // 해킹으로 abuse-list 파일자체를 없애거나 내용을 비웠을 경우 실행을 멈추게 하자 MLog("Error while Read Abuse Filter %s\n", strFileNameAbuse.c_str()); MessageBox(NULL, ZErrStr(MERR_FIND_INVALIDFILE), ZMsg( MSG_WARNING), MB_OK); // TODO: 풀스크린에서 메시지 박스는 좀 곤란함; return false; } mlog( "Init abuse manager success.\n" ); #ifdef _QUEST_ITEM if( !GetQuestItemDescMgr().ReadXml(GetFileSystem(), FILENAME_QUESTITEM_DESC) ) { MLog( "Error while read quest tiem descrition xml file.\n" ); } #endif mlog("Init chatting filter. success\n"); if(!m_SkillManager.Create()) { MLog("Error while create skill manager\n"); } END_("ETC .."); #ifndef _BIRDTEST etcLoading.UpdateAndDraw(1.f); #endif //CoInitialize(NULL); // ZGetInitialLoading()->SetPercentage( 40.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(1.f); ZGetEmblemInterface()->Create(); __EP(2006); __EP(2000); __SAVEPROFILE("profile_loading.txt"); if (ZCheckFileHack() == true) { MLog("File Check Failed\n"); return false; } ZSetupDataChecker_Global(&m_GlobalDataChecker); #ifdef LOCALE_NHNUSA GetNHNUSAReport().ReportInitComplete(); #endif return true; }