예제 #1
0
파일: house.cpp 프로젝트: CkyLua/tfs
void House::setAccessList(uint32_t listId, const std::string& textlist)
{
	if(listId == GUEST_LIST)
		guestList.parseList(textlist);
	else if(listId == SUBOWNER_LIST)
		subOwnerList.parseList(textlist);
	else
	{
		Door* door = getDoorByNumber(listId);
		if(door)
			door->setAccessList(textlist);
		else
		{
			#ifdef __DEBUG_HOUSES__
			std::cout << "Failure: [House::setAccessList] door == NULL, listId = " << listId <<std::endl;
			#endif
		}
		//We dont have kick anyone
		return;
	}

	//kick uninvited players
	typedef std::list<Player*> KickPlayerList;
	KickPlayerList kickList;
	HouseTileList::iterator it;
	for(it = houseTiles.begin(); it != houseTiles.end(); ++it)
	{
		HouseTile* hTile = *it;
		if(CreatureVector* creatures = hTile->getCreatures())
		{
			CreatureVector::iterator cit;
			for(cit = creatures->begin(); cit != creatures->end(); ++cit)
			{
				Player* player = (*cit)->getPlayer();
				if(player && isInvited(player) == false)
					kickList.push_back(player);
			}
		}
	}

	KickPlayerList::iterator itkick;
	for(itkick = kickList.begin(); itkick != kickList.end(); ++itkick)
	{
		if(g_game.internalTeleport(*itkick, getEntryPosition()) == RET_NOERROR)
			g_game.addMagicEffect(getEntryPosition(), NM_ME_TELEPORT);
	}
}
예제 #2
0
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;
}
예제 #3
0
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;
}
예제 #4
0
void House::setAccessList(uint32_t listId, const std::string& textlist)
{
  if(listId == GUEST_LIST){
    guestList.parseList(textlist);
  }
  else if(listId == SUBOWNER_LIST){
    subOwnerList.parseList(textlist);
  }
  else{
    Door* door = getDoorByNumber(listId);
    if(door){
      door->setAccessList(textlist);
    }
    else{
      #ifdef __DEBUG_HOUSES__
      std::cout << "Failure: [House::setAccessList] door == NULL, listId = " << listId <<std::endl;
      #endif
    }
    //We dont have kick anyone
    return;
  }

  //kick uninvited players
  typedef std::list<Player*> KickPlayerList;
  KickPlayerList kickList;
  HouseTileList::iterator it;
  HouseTile* houseTile;
  for(it = houseTiles.begin(); it != houseTiles.end(); ++it){
    houseTile = (*it);
    for(CreatureIterator cit = houseTile->creatures_begin(); cit != houseTile->creatures_end(); ++cit){
      Player* player = (*cit)->getPlayer();
      if(player && isInvited(player) == false){
        kickList.push_back(player);
      }
    }
  }

  KickPlayerList::iterator itkick;
  for(itkick = kickList.begin(); itkick != kickList.end(); ++itkick){
    if(g_game.internalTeleport(NULL, *itkick, getEntryPosition()) == RET_NOERROR){
      g_game.addMagicEffect(getEntryPosition(), MAGIC_EFFECT_BLUE_BUBBLE);
    }
  }
}
예제 #5
0
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;
}