Пример #1
0
// ***************************************************************************
// Used also in game_context_menu
void	outpostTestUserCanBan(CCDBNodeLeaf *dbBanRight, bool &okForBanPlayer, bool &okForBanGuild)
{
	okForBanPlayer= false;
	okForBanGuild= false;

	/** A player can ban a player in a PVP outpost if:
	 *	- The player has right to ban AND his guild attack/owns the outpost the player attacks (all this is in RIGHT_BANNISH)
	 *	- The player and the target are in the same war of the outpost, and in same alliance.
	 *	- The player and the target are not in same guild
	 */
	if(dbBanRight && dbBanRight->getValueBool() && UserEntity)
	{
		CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection());
		if(selection && selection->isPlayer())
		{
			// in same outpost War and Side
			if( selection->getOutpostId() == UserEntity->getOutpostId() &&
				selection->getOutpostSide() == UserEntity->getOutpostSide() )
			{
				// not in same guild
				if( selection->getGuildNameID() != UserEntity->getGuildNameID() )
				{
					okForBanPlayer= true;
					okForBanGuild= selection->getGuildNameID()!=0;
				}
			}
		}
	}
}