⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mugongmanager.cpp

📁 墨香最新私服
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// MugongManager.cpp: implementation of the CMugongManager class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MugongManager.h"
#include "GameIn.h"
#include "./Interface/cWindowManager.h"
#include "./Interface/cScriptManager.h"

#include "ItemManager.h"
#include "chatmanager.h"
#include "GameDef.h"
#include "QuickManager.h"
#include "SkillManager_Client.h"
#include "JinBub.h"
#include "SimBub.h"
#include "ObjectManager.h"
#include "CheatMsgParser.h"
#include "GameEventManager.h"
#include "QuickDialog.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
GLOBALTON(CMugongManager)
CMugongManager::CMugongManager()
{
	m_pMugongDlg = NULL;
	m_MugongHash.Initialize(100);
	m_IconIndexCreator.Init(MAX_ITEMICON_NUM, IG_MUGONG_STARTINDEX);		
	
}

CMugongManager::~CMugongManager()
{
	Release();

	m_IconIndexCreator.Release();
}

void CMugongManager::Release()
{
	CMugongBase * pMugong = NULL;
	m_MugongHash.SetPositionHead();
	while(pMugong = m_MugongHash.GetData())
	{
		DeleteMugongIcon(pMugong);
		//m_IconIndexCreator.ReleaseIndex(pMugong->GetID());		
	}
	m_MugongHash.RemoveAll();
}
void CMugongManager::Init()
{
}

void CMugongManager::NetworkMsgParse(BYTE Protocol,void* pMsg)
{
	switch(Protocol) 
	{
	case MP_MUGONG_TOTALINFO_LOCAL:
		{
			MUGONG_TOTALINFO * msg = (MUGONG_TOTALINFO *)pMsg;
			for(int i = 0 ; i < SLOT_MUGONGTOTAL_NUM ; i++)
			{
				m_pMugongDlg->AddMugong(&msg->mugong[i]);
				if(msg->mugong[i].QuickPosition != 0)
				{
					QUICKMGR->AddQuickItemReal(msg->mugong[i].QuickPosition,msg->mugong[i].Position, msg->mugong[i].wIconIdx);
				}
			}
		}
		break;
	case MP_MUGONG_MOVE_ACK:
		{
			MSG_MUGONG_MOVE_ACK * msg = (MSG_MUGONG_MOVE_ACK *)pMsg;
			m_pMugongDlg->MoveMugong(msg->ToPos, msg->FromPos);

			GAMEIN->GetMugongDialog()->SetDisable( FALSE );
			WINDOWMGR->DragWindowNull();
		}
		break;
	case MP_MUGONG_MOVE_NACK:
		{
			GAMEIN->GetMugongDialog()->SetDisable( FALSE );
			WINDOWMGR->BackDragWindow();
		}
	case MP_MUGONG_REM_ACK:
		{
			MSG_MUGONG_REM_ACK * pmsg = (MSG_MUGONG_REM_ACK *)pMsg;

			CMugongBase * mugongOut;
			m_pMugongDlg->DeleteMugong(pmsg->TargetPos, &mugongOut);
			DeleteMugongIcon(mugongOut);

			GAMEIN->GetMugongDialog()->SetDisable( FALSE );
/*
			MSG_MUGONG_REM_ACK * pmsg = (MSG_MUGONG_REM_ACK *)pMsg;
			switch(pmsg->wTableIdx)
			{
			case eItemTable_Mugong:
				{
					CMugongBase * mugongOut;
					m_pMugongDlg->DeleteMugong(pmsg->AbsPosition, &mugongOut);
					DeleteMugongIcon(mugongOut);
				}
				break;
			default:
				{
//					ASSERT(0);
				}
			}
			
			GAMEIN->GetMugongDialog()->SetDisable( FALSE );
*/
		}
		break;
	case MP_MUGONG_REM_NACK:
		{
			ASSERT(0);
			GAMEIN->GetMugongDialog()->SetDisable( FALSE );
			WINDOWMGR->BackDragWindow();
		}
		break;
/*
	case MP_MUGONG_DEL_ACK:
		{
			MSG_MUGONG_DELINFO * msg = (MSG_MUGONG_DELINFO *)pMsg;
			CMugongBase * mugongOut;
			m_pMugongDlg->DeleteMugong(msg->wPosition, &mugongOut);
			DeleteMugongIcon(mugongOut);
		}
		break;
	case MP_MUGONG_DEL_NACK:
		{
			ASSERT(0);
		}
		break;
*/
	case MP_MUGONG_ADD_ACK:
		{
			MSG_MUGONG_ADD_ACK * msg = (MSG_MUGONG_ADD_ACK *)pMsg;
			// 公傍氓 昏力
//			ITEMMGR->DeleteItem( msg->MugongBase.Position );
			// 公傍 积己, 殿废
			m_pMugongDlg->AddMugong(&msg->MugongBase);

			//msg免仿
			CMugongBase * icon = GetMugong(msg->MugongBase.dwDBIdx);
			if( !icon ) return;
			CSkillInfo* pCommSkill = icon->m_pSkillInfo;
			if(!pCommSkill)	return;
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(189), pCommSkill->GetSkillName() );

			GAMEIN->GetMugongDialog()->SetDisable(FALSE);
			
			// event
			GAMEEVENTMGR->AddEvent(eGameEvent_Mugong0);
		}
		break;
	case MP_MUGONG_ADD_NACK:
		{
//			ASSERT(0);
			GAMEIN->GetMugongDialog()->SetDisable(FALSE);
		}
		break;
/*		
	case MP_MUGONG_DELETEGROUNDADD_ACK:
		{
			// target : MUGONG DEL -> GROUND ADD(HERO困摹)
//			MSG_MUGONG_DELGRDADD_ACK * msg  = (MSG_MUGONG_DELGRDADD_ACK *)pMsg;
		//	m_pMugongDlg->DeleteMugong(msg->bMugongType);
			
		}
		break;
	case MP_MUGONG_DELETEINVENTORYADD_ACK:
		{
			// target : MUGONG DEL -> Inventory ADD
//			MSG_MUGONG_DELINVADD_ACK * msg  = (MSG_MUGONG_DELINVADD_ACK * )pMsg;
		}
		break;	
	case MP_MUGONG_DELETEGROUNDADD_NACK:
		{
			// invalid target
			// 俊矾 皋矫瘤 
			LOG(EC_MUGONG_ADDNITEMDELETE_FAILED);
		}
		break;
	case MP_MUGONG_DELETEINVENTORYADD_NACK:
		{
			// invalid target
			// 俊矾 皋矫瘤 
			LOG(EC_MUGONG_ADDNITEMDELETE_FAILED);
		}
		break;
*/
	case MP_MUGONG_SUNG_NOTIFY:
		{
			MSG_WORD3 * pmsg = (MSG_WORD3 * )pMsg;
			m_pMugongDlg->SetMugongSung(pmsg->wData1, (BYTE)pmsg->wData2);

			CMugongBase* mugong = (CMugongBase*)m_pMugongDlg->GetMugongAbs(pmsg->wData1);
			if( !mugong ) return;

			CSkillInfo* pInfo = mugong->m_pSkillInfo;

			if( pInfo )
			{
				if(pmsg->wData3 == eLog_MugongLevelup)
				{
					if( pmsg->wData2 < 12 )
						CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(182), pInfo->GetSkillName(), pmsg->wData2 );
					else
						CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(183), pInfo->GetSkillName() );
					
					if( pmsg->wData2 == 1 )
						GAMEEVENTMGR->AddEvent( eGameEvent_Mugong1 );
				}
				else if(pmsg->wData3 == eLog_MugongLevelDownByBadFame)	//厩疙摹 臭酒 颇鲍
					CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 677 ),pInfo->GetSkillName() );
				else if(pmsg->wData3 == eLog_MugongLevelDownByWanted)	//泅惑裹捞骨肺 颇鲍
					CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg( 687 ),pInfo->GetSkillName() );
			}

			/*
			CMugongBase * mugongOut = NULL;
			mugongOut = (CMugongBase *)m_pMugongDlg->GetIconForIdx(pmsg->wData1);
			if(mugongOut->GetDBIdx() > 0) mugongOut->SetSung(pmsg->wData2);
			// 牢磐其捞胶
			// 公傍 芒狼 己钎矫 
			// 公傍 芒狼 版氰摹 max 霸捞瘤 setting

			*/
			MUGONGMGR->RefreshMugong();
			ITEMMGR->RefreshAllItem();
		}
		break;
	case MP_MUGONG_EXPPOINT_NOTIFY:
		{
			MSG_MUGONGEXP* pmsg = (MSG_MUGONGEXP*)pMsg;
			m_pMugongDlg->SetMugongExpPoint(pmsg->absPos,pmsg->ExpPoint);
			GAMEIN->GetQuickDialog()->RefreshIcon(m_pMugongDlg->GetMugongAbs(pmsg->absPos)->GetQuickPosition());
		}
		break;
	}
}
CMugongBase * CMugongManager::NewMugongIcon(MUGONGBASE * mugongBase)
{
	CMugongBase * icon = NULL;
	if(!(icon = GetMugong(mugongBase->dwDBIdx)))
	{
		cImage skillLowImage;
		cImage skillHighImage;
		GetIconImage(mugongBase->wIconIdx, &skillLowImage, &skillHighImage);

		//////////////////////////////////////////////////////////////////////////
		// YH2DO Kind 沥府 鞘夸
		CSkillInfo* pSkillInfo = SKILLMGR->GetSkillInfo(mugongBase->wIconIdx);
		if(pSkillInfo == NULL)
		{
			icon = new CSimBub;
		}
		else if(pSkillInfo->GetSkillKind() == SKILLKIND_JINBUB)
		{
			icon = new CJinBub;
		}
		else
		{
			icon = new CMugongBase;
		}
		//////////////////////////////////////////////////////////////////////////
		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -