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

📄 handler_cg_item.h

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 H
字号:
#ifndef __HANDLER_CG_ITEM_H__
#define __HANDLER_CG_ITEM_H__

#pragma once

#include <PacketStruct.h>

class ServerSession;


#define Handler_CG_ITEM_DECL( p )			static VOID On##p( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize )
#define Handler_CG_ITEM_IMPL( p )			VOID Handler_CG_ITEM::On##p( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize )


class Handler_CG_ITEM
{
public:
	Handler_CG_ITEM();
	~Handler_CG_ITEM();

	static VOID OnCG_ITEM_MOVE_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );

	static VOID OnCG_ITEM_PICK_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );
	static VOID OnCG_ITEM_DROP_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );
	static VOID OnCG_ITEM_COMBINE_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );

	static VOID OnCG_ITEM_USE_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );


	static VOID OnCG_ITEM_SELL_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );
	static VOID OnCG_ITEM_BUY_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );

	static VOID OnCG_ITEM_PICK_MONEY_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );
	static VOID OnCG_ITEM_DROP_MONEY_SYN( ServerSession * pServerSession, MSG_BASE * pMsg, WORD wSize );

	Handler_CG_ITEM_DECL( CG_ITEM_ENCHANTUP_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_RANKUP_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_SOCKET_FILL_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_SOCKET_EXTRACT_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_ACCESSORY_CREATE_SYN );

	Handler_CG_ITEM_DECL( CG_ITEM_QUICK_LINKITEM_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_QUICK_LINKSKILL_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_QUICK_UNLINK_SYN );
	Handler_CG_ITEM_DECL( CG_ITEM_QUICK_MOVE_SYN );

	Handler_CG_ITEM_DECL( CG_ITEM_ENCHANT_SYN );

};

template<class PACKET_TYPE>
class SharingMoney
{
	float				m_limitDistance;
	Player *			m_pStandardPlayer;
	MONEY				m_SharingMoney;
	PACKET_TYPE			m_packet;
public:
	SharingMoney( Player * pStandardPlayer, MONEY sharingMoney ):m_limitDistance(0.0f),m_pStandardPlayer(pStandardPlayer),m_SharingMoney(sharingMoney){}
	~SharingMoney(){}

	inline VOID	SetDistance(  float limitDistance ) { m_limitDistance = limitDistance;	}

	VOID operator()( Player * pTargetPlayer )
	{
		if( pTargetPlayer->GetObjectKey() == m_pStandardPlayer->GetObjectKey() ) return;

		if( m_limitDistance == 0.0f )
		{
//			pTargetPlayer->SetMoney( pTargetPlayer->GetMoney() + m_SharingMoney );
			pTargetPlayer->PlusMoney( m_SharingMoney );	// SetMoney肺 捣 冈绰 何盒 傈何 PlusMoney()肺 背眉吝(泅芒)
			m_packet.m_Money = pTargetPlayer->GetMoney();
			pTargetPlayer->SendPacket( &m_packet, sizeof( m_packet ) );
		}
		else
		{
			if( pTargetPlayer->GetDist(m_pStandardPlayer) < m_limitDistance )
			{
//				pTargetPlayer->SetMoney( pTargetPlayer->GetMoney() + m_SharingMoney );
				pTargetPlayer->PlusMoney( m_SharingMoney );	// SetMoney肺 捣 冈绰 何盒 傈何 PlusMoney()肺 背眉吝(泅芒)
				m_packet.m_Money = pTargetPlayer->GetMoney();
				pTargetPlayer->SendPacket( &m_packet, sizeof( m_packet ) );
			}
		}
	}
};

#endif // __HANDLER_CG_ITEM_H__

⌨️ 快捷键说明

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