コード例 #1
0
ファイル: house.cpp プロジェクト: HeavenIsLost/ChronusServer
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);
		}

		// We dont have kick anyone
		return;
	}

	//kick uninvited players
	for (HouseTile* tile : houseTiles) {
		if (CreatureVector* creatures = tile->getCreatures()) {
			for (int32_t i = creatures->size(); --i >= 0;) {
				Player* player = (*creatures)[i]->getPlayer();
				if (player && !isInvited(player)) {
					kickPlayer(nullptr, player);
				}
			}
		}
	}
}
コード例 #2
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);
	}
}
コード例 #3
0
ファイル: house.cpp プロジェクト: OMARTINEZ210/server
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);
    }
  }
}