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


C++ HouseTile::getHouse方法代码示例

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


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

示例1: setHouseOwner

bool Commands::setHouseOwner(Creature* creature, const std::string& cmd, const std::string& param)
{
	Player* player = creature->getPlayer();
	if(player){
		HouseTile* houseTile = player->getTile()->getHouseTile();
		if(houseTile){

			std::string real_name = param;
			uint32_t guid;
			if(param == "none"){
				houseTile->getHouse()->setHouseOwner(0);
			}
			else if(IOPlayer::instance()->getGuidByName(guid, real_name)){
				houseTile->getHouse()->setHouseOwner(guid);
			}
			else{
				player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, "Player not found.");
			}

			return true;
		}
	}

	return false;
}
开发者ID:ChubNtuck,项目名称:avesta74,代码行数:25,代码来源:commands.cpp

示例2: setHouseOwner

void Commands::setHouseOwner(Player* player, const std::string& cmd, const std::string& param)
{
	if (player->getTile()->hasFlag(TILESTATE_HOUSE)) {
		HouseTile* houseTile = dynamic_cast<HouseTile*>(player->getTile());
		if (houseTile) {
			uint32_t guid;
			std::string name = param;
			if (name == "none") {
				houseTile->getHouse()->setHouseOwner(0);
			} else if (IOLoginData::getGuidByName(guid, name)) {
				houseTile->getHouse()->setHouseOwner(guid);
			} else {
				player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, "Player not found.");
			}
		}
	}
}
开发者ID:KnightLogini,项目名称:forgottenserver,代码行数:17,代码来源:commands.cpp

示例3: 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();
	}
}
开发者ID:felipetmartini,项目名称:testec,代码行数:52,代码来源:commands.cpp

示例4: getHouseByPlayer

House* Houses::getHouseByPlayer(Player* player)
{
	if(!player || player->isRemoved())
		return nullptr;

	HouseTile* houseTile = player->getTile()->getHouseTile();
	if(!houseTile)
		return nullptr;

	if(House* house = houseTile->getHouse())
		return house;

	return nullptr;
}
开发者ID:novasdream,项目名称:tyano-core,代码行数:14,代码来源:house.cpp

示例5: buyHouse

void Commands::buyHouse(Player* player, const std::string& cmd, const std::string& param)
{
	if (!player->isPremium()) {
		player->sendCancelMessage(RET_YOUNEEDPREMIUMACCOUNT);
		return;
	}

	Position pos = player->getPosition();
	pos = getNextPosition(player->direction, pos);

	Tile* tile = g_game.getTile(pos.x, pos.y, pos.z);

	if (!tile) {
		player->sendCancel("You have to be looking at the door of the house you would like to buy.");
		return;
	}

	HouseTile* houseTile = dynamic_cast<HouseTile*>(tile);
	if (!houseTile) {
		player->sendCancel("You have to be looking at the door of the house you would like to buy.");
		return;
	}

	House* house = houseTile->getHouse();
	if (!house || !house->getDoorByPosition(pos)) {
		player->sendCancel("You have to be looking at the door of the house you would like to buy.");
		return;
	}

	if (house->getHouseOwner()) {
		player->sendCancel("This house alreadly has an owner.");
		return;
	}

	for (const auto& it : Houses::getInstance().getHouses()) {
		if (it.second->getHouseOwner() == player->guid) {
			player->sendCancel("You are already the owner of a house.");
			return;
		}
	}

	uint64_t price = house->getHouseTiles().size() * g_config.getNumber(ConfigManager::HOUSE_PRICE);
	if (!g_game.removeMoney(player, price)) {
		player->sendCancel("You do not have enough money.");
		return;
	}

	house->setHouseOwner(player->guid);
	player->sendTextMessage(MSG_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.");
}
开发者ID:Remoq7,项目名称:forgottenserver,代码行数:50,代码来源:commands.cpp

示例6: kickPlayer

bool House::kickPlayer(Player* player, Player* target)
{
	if(!target || target->isRemoved())
		return false;

	HouseTile* houseTile = target->getTile()->getHouseTile();
	if(!houseTile || houseTile->getHouse() != this)
		return false;

	bool self = player == target;
	if(getHouseAccessLevel(player) < getHouseAccessLevel(target) && !self)
		return false;

	removePlayer(target, self);
	return true;
}
开发者ID:081421,项目名称:otxserver,代码行数:16,代码来源:house.cpp

示例7: kickPlayer

bool House::kickPlayer(Player* player, const std::string& name)
{
	Player* kickingPlayer = g_game.getPlayerByName(name);
	if(kickingPlayer){
		HouseTile* houseTile = dynamic_cast<HouseTile*>(kickingPlayer->getTile());

		if(houseTile && houseTile->getHouse() == this){
			if(getHouseAccessLevel(player) >= getHouseAccessLevel(kickingPlayer) && !kickingPlayer->hasFlag(PlayerFlag_CanEditHouses)){
				if(g_game.internalTeleport(kickingPlayer, getEntryPosition()) == RET_NOERROR){
					g_game.addMagicEffect(getEntryPosition(), NM_ME_ENERGY_AREA);
				}
				return true;
			}
		}
	}
	return false;
}
开发者ID:WeDontGiveAF,项目名称:OOServer,代码行数:17,代码来源:house.cpp

示例8: kickPlayer

bool House::kickPlayer(Player* player, const std::string& name)
{
  Player* kickingPlayer = g_game.getPlayerByName(name);
  if(kickingPlayer){
    HouseTile* houseTile = kickingPlayer->getParentTile()->getHouseTile();

    if(houseTile && houseTile->getHouse() == this){
      if(getHouseAccessLevel(player) >= getHouseAccessLevel(kickingPlayer) && !kickingPlayer->hasFlag(PlayerFlag_CanEditHouses)){
        if(g_game.internalTeleport(player, kickingPlayer, getEntryPosition()) == RET_NOERROR){
          g_game.addMagicEffect(getEntryPosition(), MAGIC_EFFECT_BLUE_BUBBLE);
        }
        return true;
      }
    }
  }
  return false;
}
开发者ID:OMARTINEZ210,项目名称:server,代码行数:17,代码来源:house.cpp

示例9: kickPlayer

bool House::kickPlayer(Player* player, Player* target)
{
	if (!target) {
		return false;
	}

	HouseTile* houseTile = dynamic_cast<HouseTile*>(target->getTile());
	if (!houseTile || houseTile->getHouse() != this) {
		return false;
	}

	if (getHouseAccessLevel(player) < getHouseAccessLevel(target) || target->hasFlag(PlayerFlag_CanEditHouses)) {
		return false;
	}

	Position oldPosition = target->getPosition();
	if (g_game.internalTeleport(target, getEntryPosition()) == RETURNVALUE_NOERROR) {
		g_game.addMagicEffect(oldPosition, CONST_ME_POFF);
		g_game.addMagicEffect(getEntryPosition(), CONST_ME_TELEPORT);
	}
	return true;
}
开发者ID:HeavenIsLost,项目名称:ChronusServer,代码行数:22,代码来源:house.cpp

示例10: kickPlayer

bool House::kickPlayer(Player* player, Player* target)
{
	if(!target || target->isRemoved())
		return false;

	HouseTile* houseTile = target->getTile()->getHouseTile();
	if(!houseTile || houseTile->getHouse() != this)
		return false;

	if(player == target)
	{
		removePlayer(target, true);
		return true;
	}

	if(getHouseAccessLevel(player) >= getHouseAccessLevel(target))
	{
		removePlayer(target, false);
		return true;
	}

	return false;
}
开发者ID:novasdream,项目名称:tyano-core,代码行数:23,代码来源:house.cpp


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