%% ---------------------------------------------------------------------------
%% @doc lib_mutex_check.erl

%% @author  hjh
%% @email  hejiahua@163.com
%% @since  2017-06-12
%% @deprecated 功能互斥禁止进入。
%% ---------------------------------------------------------------------------
-module(lib_mutex_check).
-export([]).

-compile(export_all).

-include("server.hrl").
-include("errcode.hrl").
-include("guild.hrl").

%% 是否能被踢出公会
check_kick_out_guild(Player, _LevelId) ->
    _PlayerId = Player#player_status.id,
    List = [
        {fun() -> mod_guild_boss_mgr:check_open() == false end, ?ERRCODE(err400_not_allow_kickout_when_guild_boss)},
        {fun() -> guild_war_api:is_during_guild_war() == false end, ?ERRCODE(err400_not_allow_when_guild_war)},
        {fun() -> camp_war_api:is_during_camp_war() == false end, ?ERRCODE(err410_on_camp_war)},
        {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)},
        {fun() -> madness_land_api:is_during_madness_land() == false end, ?ERRCODE(err415_on_madness_ban)}
    ],
    util:check_list(List).

%% 是否主动退出公会
check_quit_guild(Player) ->
    _PlayerId = Player#player_status.id,
    List = [
        {fun() -> mod_guild_boss_mgr:check_open() == false end, ?ERRCODE(err400_not_allow_kickout_when_guild_boss)},
        {fun() -> guild_war_api:is_during_guild_war() == false end, ?ERRCODE(err400_not_allow_when_guild_war)},
        {fun() -> camp_war_api:is_during_camp_war() == false end, ?ERRCODE(err410_on_camp_war)},
        {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)},
        {fun() -> madness_land_api:is_during_madness_land() == false end, ?ERRCODE(err415_on_madness_ban)}
    ],
    util:check_list(List).

%% 是否转让会长
check_appoint_position(?POS_CHIEF)  ->
    List = [
         {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)}
    ],
    util:check_list(List);
%% 踢出公会
check_appoint_position(?KICK_OUT_POSTION) ->
    List = [
         {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)}
    ],
    util:check_list(List);
check_appoint_position(_)  -> true.

%% 是否能主动解散公会
check_disband_guild(_GuildId)  ->
    List = [
        {fun() -> guild_war_api:is_during_guild_war() == false end, ?ERRCODE(err400_not_allow_when_guild_war)},
        {fun() -> camp_war_api:is_during_camp_war() == false end, ?ERRCODE(err410_on_camp_war)},
         {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)}
    ],
    util:check_list(List).

%%能否合并社团
check_merge_guild() ->
    List = [
        {fun() -> mod_guild_boss_mgr:check_open() == false end, ?ERRCODE(err400_not_allow_merge_when_guild_boss)},
        {fun() -> guild_war_api:is_during_guild_war() == false end, ?ERRCODE(err400_not_allow_when_guild_war)},
        {fun() -> camp_war_api:is_during_camp_war() == false end, ?ERRCODE(err410_on_camp_war)},
        {fun() -> cross_guild_war_local:is_cgwar_open() == false end, ?ERRCODE(err601_cant_change_scene_cross_gwar)},
        {fun() -> guild_collect_mgr:collect_act_is_open() == false end, ?ERRCODE(err400_in_guild_collect)}
    ],
    util:check_list(List).

%% 能否创建公会
check_create_guild(Player) ->
    _PlayerId = Player#player_status.id,
    List = [
    ],
    util:check_list(List).

%% 能否申请公会
check_apply_guild(Player) ->
    _PlayerId = Player#player_status.id,
    List = [
    ],
    util:check_list(List).

%% 能否能改名
check_rename(Player) ->
    _PlayerId = Player#player_status.id,
    List = [
    ],
    util:check_list(List).

