コード例 #1
0
void CUser::MerchantProcess(Packet & pkt)
{
    uint8 opcode = pkt.read<uint8>();
    switch (opcode)
    {
    // Regular merchants
    case MERCHANT_OPEN:
        MerchantOpen();
        break;

    case MERCHANT_CLOSE:
        MerchantClose();
        break;

    case MERCHANT_ITEM_ADD:
        MerchantItemAdd(pkt);
        break;

    case MERCHANT_ITEM_CANCEL:
        MerchantItemCancel(pkt);
        break;

    case MERCHANT_ITEM_LIST:
        MerchantItemList(pkt);
        break;

    case MERCHANT_ITEM_BUY:
        MerchantItemBuy(pkt);
        break;

    case MERCHANT_INSERT:
        MerchantInsert(pkt);
        break;

    case MERCHANT_TRADE_CANCEL:
        CancelMerchant();
        break;

#if __VERSION >= 1700
    // Buying merchants
    case MERCHANT_BUY_OPEN:
        BuyingMerchantOpen(pkt);
        break;

    case MERCHANT_BUY_CLOSE:
        BuyingMerchantClose();
        break;

    case MERCHANT_BUY_LIST:
        BuyingMerchantList(pkt);
        break;

    case MERCHANT_BUY_INSERT:
        BuyingMerchantInsert(pkt);
        break;

    case MERCHANT_BUY_BUY: // seeya!
        BuyingMerchantBuy(pkt);
        break;
#endif
    }
}
コード例 #2
0
void CUser::MerchantProcess(char *pBuf)
{
	int index = 0;
	BYTE subcommand = GetByte(pBuf, index);

	switch (subcommand)
	{
		// Regular merchants
		case MERCHANT_OPEN: 
			MerchantOpen(pBuf+index); 
			break;

		case MERCHANT_CLOSE: 
			MerchantClose(); 
			break;

		case MERCHANT_ITEM_ADD: 
			MerchantItemAdd(pBuf+index); 
			break;

		case MERCHANT_ITEM_CANCEL: 
			MerchantItemCancel(pBuf+index); 
			break;

		case MERCHANT_ITEM_LIST: 
			MerchantItemList(pBuf+index); 
			break;

		case MERCHANT_ITEM_BUY: 
			MerchantItemBuy(pBuf+index); 
			break;

		case MERCHANT_INSERT: 
			MerchantInsert(pBuf+index); 
			break;

		case MERCHANT_TRADE_CANCEL: 
			CancelMerchant(); 
			break;

#if __VERSION >= 1700
		// Buying merchants
		case MERCHANT_BUY_OPEN: 
			BuyingMerchantOpen(pBuf+index); 
			break;

		case MERCHANT_BUY_CLOSE: 
			BuyingMerchantClose(); 
			break;

		case MERCHANT_BUY_LIST: 
			BuyingMerchantList(pBuf+index); 
			break;

		case MERCHANT_BUY_INSERT: 
			BuyingMerchantInsert(pBuf+index); 
			break;

		case MERCHANT_BUY_BUY: // seeya!
			BuyingMerchantBuy(pBuf+index); 
			break;
#endif
	}
}