当前位置: 首页>>代码示例>>C++>>正文


C++ AuctionHouse::SendOwnerListPacket方法代码示例

本文整理汇总了C++中AuctionHouse::SendOwnerListPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ AuctionHouse::SendOwnerListPacket方法的具体用法?C++ AuctionHouse::SendOwnerListPacket怎么用?C++ AuctionHouse::SendOwnerListPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuctionHouse的用法示例。


在下文中一共展示了AuctionHouse::SendOwnerListPacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleAuctionSellItem


//.........这里部分代码省略.........
    case 4 * MIN_AUCTION_TIME:
        break;
    default:
        return;
    }

    Item* items[MAX_AUCTION_ITEMS];

    uint32 finalCount = 0;

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = _player->GetItemInterface()->GetItemByGUID(itemGUIDs[i]);

        if (!item)
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_ITEM_NOT_FOUND);
            return;
        }


        items[i] = item;
        finalCount += count[i];
    }

    if (!finalCount)
    {
        _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = items[i];

        if (item->GetStackCount() < finalCount)
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_DATABASE_ERROR);
            return;
        }
    }

    for (uint32 i = 0; i < itemsCount; ++i)
    {
        Item* item = items[i];
        uint32 auctionTime = uint32(etime);

        AuctionHouse* ah = pCreature->auctionHouse;

        uint32 item_worth = item->GetProto()->SellPrice * item->GetStackCount();
        uint32 item_deposit = (uint32)(item_worth * ah->deposit_percent) * (uint32)(etime / 240.0f); // deposit is per 4 hours

        if (!_player->HasGold((uint64)item_deposit))
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_NOT_ENOUGHT_MONEY);
            return;
        }

        _player->TakeGold(-int32(item_deposit));

        item = _player->GetItemInterface()->SafeRemoveAndRetreiveItemByGuid(itemGUIDs[i], false);
        if (!item)
        {
            _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_ITEM_NOT_FOUND);
            return;
        };

        if (item->IsInWorld())
        {
            item->RemoveFromWorld();
        }

        item->SetOwner(NULL);
        item->m_isDirty = true;
        item->SaveToDB(INVENTORY_SLOT_NOT_SET, 0, true, NULL);

        // Create auction
        Auction* auct = new Auction;
        auct->BuyoutPrice = buyout;
        auct->ExpiryTime = (uint32)UNIXTIME + (etime * 60);
        auct->StartingPrice = bid;
        auct->HighestBid = 0;
        auct->HighestBidder = 0;    // hm
        auct->Id = sAuctionMgr.GenerateAuctionId();
        auct->Owner = _player->GetLowGUID();
        auct->pItem = item;
        auct->Deleted = false;
        auct->DeletedReason = 0;
        auct->DepositAmount = item_deposit;

        // Add and save auction to DB
        ah->AddAuction(auct);
        auct->SaveToDB(ah->GetID());

        // Send result packet
        _player->SendAuctionCommandResult(NULL, AUCTION_CREATE, ERR_AUCTION_OK);
    }

    ah->SendOwnerListPacket(_player, &recv_data);
}
开发者ID:beyourself,项目名称:AscEmu_CATA,代码行数:101,代码来源:AuctionHouse.cpp


注:本文中的AuctionHouse::SendOwnerListPacket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。