本文整理汇总了C++中House::getTransferItem方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getTransferItem方法的具体用法?C++ House::getTransferItem怎么用?C++ House::getTransferItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getTransferItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sellHouse
void Commands::sellHouse(Player& player, const std::string& param)
{
Player* tradePartner = g_game.getPlayerByName(param);
if (!tradePartner || tradePartner == &player) {
player.sendCancel("Trade player not found.");
return;
}
if (!Position::areInRange<2, 2, 0>(tradePartner->getPosition(), player.getPosition())) {
player.sendCancel("Trade player is too far away.");
return;
}
if (!tradePartner->isPremium()) {
player.sendCancel("Trade player does not have a premium account.");
return;
}
HouseTile* houseTile = dynamic_cast<HouseTile*>(player.getTile());
if (!houseTile) {
player.sendCancel("You must stand in your house to initiate the trade.");
return;
}
House* house = houseTile->getHouse();
if (!house || house->getOwner() != player.getGUID()) {
player.sendCancel("You don't own this house.");
return;
}
if (Houses::getInstance().getHouseByPlayerId(tradePartner->getGUID())) {
player.sendCancel("Trade player already owns a house.");
return;
}
if (IOLoginData::hasBiddedOnHouse(tradePartner->getGUID())) {
player.sendCancel("Trade player is currently the highest bidder of an auctioned house.");
return;
}
Item* transferItem = house->getTransferItem();
if (!transferItem) {
player.sendCancel("You can not trade this house.");
return;
}
transferItem->getParent()->setParent(&player);
if (!g_game.internalStartTrade(&player, tradePartner, transferItem)) {
house->resetTransferItem();
}
}
示例2: sellHouse
void Commands::sellHouse(Player* player, const std::string& cmd, const std::string& param)
{
House* house = Houses::getInstance().getHouseByPlayerId(player->guid);
if (!house) {
player->sendCancel("You do not own any house.");
return;
}
Player* tradePartner = g_game.getPlayerByName(param);
if (!(tradePartner && tradePartner != player)) {
player->sendCancel("Trade player not found.");
return;
}
if (tradePartner->level < 1) {
player->sendCancel("Trade player level is too low.");
return;
}
if (!Position::areInRange<2, 2, 0>(tradePartner->getPosition(), player->getPosition())) {
player->sendCancel("Trade player is too far away.");
return;
}
if (!tradePartner->isPremium()) {
player->sendCancel("Trade player does not have a premium account.");
return;
}
if (Houses::getInstance().getHouseByPlayerId(tradePartner->guid)) {
player->sendCancel("Trade player already owns a house.");
return;
}
if (IOLoginData::getInstance()->hasBiddedOnHouse(tradePartner->guid)) {
player->sendCancel("Trade player is currently the highest bidder of an auctioned house.");
return;
}
Item* transferItem = house->getTransferItem();
if (!transferItem) {
player->sendCancel("You can not trade this house.");
return;
}
transferItem->getParent()->setParent(player);
if (!g_game.internalStartTrade(player, tradePartner, transferItem)) {
house->resetTransferItem();
}
}
示例3: sellHouse
bool Commands::sellHouse(Creature* creature, const std::string& cmd, const std::string& param)
{
Player* player = creature->getPlayer();
if(player){
House* house = Houses::getInstance().getHouseByPlayerId(player->getGUID());
if(!house){
player->sendCancel("You do not own any house.");
return false;
}
Player* tradePartner = g_game.getPlayerByName(param);
if(!(tradePartner && tradePartner != player)){
player->sendCancel("Trade player not found.");
return false;
}
if(tradePartner->getPlayerInfo(PLAYERINFO_LEVEL) < 1){
player->sendCancel("Trade player level is too low.");
return false;
}
if(Houses::getInstance().getHouseByPlayerId(tradePartner->getGUID())){
player->sendCancel("Trade player already owns a house.");
return false;
}
if(!Position::areInRange<2,2,0>(tradePartner->getPosition(), player->getPosition())){
player->sendCancel("Trade player is too far away.");
return false;
}
Item* transferItem = house->getTransferItem();
if(!transferItem){
player->sendCancel("You can not trade this house.");
return false;
}
transferItem->getParent()->setParent(player);
if(g_game.internalStartTrade(player, tradePartner, transferItem)){
return true;
}
else{
house->resetTransferItem();
}
}
return false;
}
示例4: sellHouse
bool TalkAction::sellHouse(Player* player, const std::string& words, const std::string& param)
{
if (!player)
{
return false;
}
House* house = Houses::getInstance().getHouseByPlayerId(player->getGUID());
if (!house)
{
player->sendCancel("You do not own any house.");
return false;
}
if (!Houses::getInstance().payRent(player, house))
{
player->sendCancel("You have to pay the rent before selling your house and you do not have enough money.");
return false;
}
Player* tradePartner = g_game.getPlayerByName(param);
if (!(tradePartner && tradePartner != player))
{
player->sendCancel("Trade player not found.");
return false;
}
if (!tradePartner->isPremium() && g_config.getNumber(ConfigManager::HOUSE_ONLY_PREMIUM))
{
player->sendCancel("Trade player doesn't have a premium account.");
return false;
}
if (tradePartner->getPlayerInfo(PLAYERINFO_LEVEL) < g_config.getNumber(ConfigManager::HOUSE_LEVEL))
{
player->sendCancel("Trade player level is too low.");
return false;
}
if (Houses::getInstance().getHouseByPlayerId(tradePartner->getGUID()))
{
player->sendCancel("Trade player already owns a house.");
return false;
}
if (!Position::areInRange<2, 2, 0>(tradePartner->getPosition(), player->getPosition()))
{
player->sendCancel("Trade player is too far away.");
return false;
}
Item* transferItem = house->getTransferItem();
if (!transferItem)
{
player->sendCancel("You can not trade this house.");
return false;
}
transferItem->getParent()->setParent(player);
if (g_game.internalStartTrade(player, tradePartner, transferItem))
{
return true;
}
else
{
house->resetTransferItem();
}
return false;
}