//------------------------------------------------------------------------------------------------------------------------
//
// 제목         : 혈맹창 (리뉴얼) - SCALEFORM UI
//
//------------------------------------------------------------------------------------------------------------------------
class ClanGfxWnd extends L2UIGFxScript;

function OnRegisterEvent()
{	
	// 10080
	//registerGfxEvent( EV_FactionInfo );		

	//RegisterGFxEvent( EV_ClanInfo );
	//RegisterGFxEvent( EV_ClanInfoUpdate );
	//RegisterGFxEvent( EV_ClanDeleteAllMember );
	//RegisterGFxEvent( EV_ClanAddMember );
	//RegisterGFxEvent( EV_ClanMemberInfoUpdate );
	//RegisterGFxEvent( EV_ClanAddMemberMultiple );
	//RegisterGFxEvent( EV_ClanDeleteMember );
	//RegisterGFxEvent( EV_ClanMyAuth );
	//RegisterGFxEvent( EV_ClanSubClanUpdated );

	//RegisterGFxEvent( EV_ResultJoinDominionWar );
	//RegisterGFxEvent( EV_RequestStartPledgeWar );

	//RegisterGFxEvent( EV_ClanAuthGradeList );
	//RegisterGFxEvent( EV_ClanCrestChange );
	//RegisterGFxEvent( EV_ClanAuth );
	//RegisterGFxEvent( EV_ClanAuthMember );
	//RegisterGFxEvent( EV_ClanMemberInfo );	
	//RegisterGFxEvent( EV_ClanSkillList );
	//RegisterGFxEvent( EV_ClanSkillListRenew);
	//RegisterGFxEvent( EV_ClanWarList );
	//RegisterGFxEvent( EV_ClanClearWarList );

	//RegisterGFxEvent( EV_SendIsActiveUnionInfoBtn) ; 
	//RegisterGFxEvent( EV_PledgeBonusMarkReset ); 

	// 공헌도
	RegisterGFxEvent( EV_PledgeContributionRank );    //혈맹공헌도 랭킹
	RegisterGFxEvent( EV_PledgeContributionInfo );    //혈맹공헌도 정보
	RegisterGFxEvent( EV_PledgeContributionReward );  //혈맹공헌도 보상

	RegisterGFxEvent( EV_PledgeLevelUp ); // = 10420;	//혈맹 레벨 업
	RegisterGFxEvent( EV_PledgeShowInfoUpdate ); //	= 10430;	//혈맹 기본 정보 업데이트

	// --- New Clan Event -- 
	RegisterGFxEvent( EV_GFX_ClanInfo ); //                 = 10450;
	RegisterGFxEvent( EV_GFX_ClanInfoUpdate ); //           = 10460;
	RegisterGFxEvent( EV_GFX_ClanDeleteAllMember ); //      = 10470;
	RegisterGFxEvent( EV_GFX_ClanAddMember ); //            = 10480;
	RegisterGFxEvent( EV_GFX_ClanAddMemberMultiple ); //    = 10490;
	RegisterGFxEvent( EV_GFX_ClanDeleteMember ); //         = 10500;
	RegisterGFxEvent( EV_GFX_ClanMemberInfoUpdate ); //     = 10510;

	RegisterGFxEvent( EV_GFX_ClanMyAuth ); //               = 10520;
	RegisterGFxEvent( EV_GFX_ClanAuth ); //                 = 10530;
	RegisterGFxEvent( EV_GFX_ClanAuthMember ); //           = 10540;
	RegisterGFxEvent( EV_GFX_ClanAuthGradeList ); //        = 10550;
	RegisterGFxEvent( EV_GFX_ClanSubClanUpdated ); //       = 10560;
	RegisterGFxEvent( EV_GFX_ResultJoinDominionWar ); //    = 10570;

	RegisterGFxEvent( EV_GFX_ClanCrestChange ); //          = 10590;
	RegisterGFxEvent( EV_GFX_ClanMemberInfo ); //           = 10600;
	RegisterGFxEvent( EV_GFX_ClanSkillList ); //            = 10610;
	RegisterGFxEvent( EV_GFX_ClanSkillListRenew ); //       = 10620;
	RegisterGFxEvent( EV_GFX_ClanWarList ); //              = 10630;
	RegisterGFxEvent( EV_GFX_ClanClearWarList ); //         = 10640;
	RegisterGFxEvent( EV_GFX_ReceivePledgeMemberList ); //  = 10650;
	RegisterGFxEvent( EV_GFX_AskStopPledgeWar  ); //        = 10660;
	RegisterGFxEvent( EV_GFX_AskStartPledgeWar );     //    = 10580;

	/// 혈맹 특화
	RegisterGFxEvent( EV_PledgeSkillInfo );           //    = 10710;
	RegisterGFxEvent( EV_PledgeSkillActivate );       //    = 10720;
	RegisterGFxEvent( EV_PledgeItemList );            //    = 10730;
	RegisterGFxEvent( EV_PledgeItemActivate );        //    = 10740;

	RegisterGFxEvent( EV_PledgeMasteryInfo );         //    = 10670;
	RegisterGFxEvent( EV_PledgeMasterySet );          //    = 10680;
	RegisterGFxEvent( EV_PledgeMasteryReset );        //    = 10690;

	RegisterGFxEvent( EV_PledgeAnnounce );            //    = 10750;
	RegisterGFxEvent( EV_PledgeAnnounceSet );         //    = 10760;

	//혈맹 문장/마크 관련
	RegisterGFxEvent( EV_PledgeCrestSet );            //    = 10770;
	RegisterGFxEvent( EV_PledgeEmblemSet );           //    = 10780;
	RegisterGFxEvent( EV_AllyCrestSet );              //    = 10790;

	RegisterGFxEvent( EV_DismissPledge );              //    = 10830; //혈맹 해산되는 순간에 접속하고 있는 혈맹원 
	RegisterGFxEvent( EV_OustPledge );                 //    = 10840; //제명당한 멤버
	RegisterGFxEvent( EV_WithdrawPledge );             //    = 10850; //탈퇴한 멤버
	

	RegisterGFxEvent( EV_GFX_ClanInfoEnd );  // 
	                               

	// Etc
	RegisterGFxEvent( EV_GamingStateEnter );
	RegisterGFxEvent( EV_GamingStateExit );
	RegisterGFxEventForLoaded( EV_Restart );	

	//registerEvent(EV_DialogOK);
	//registerEvent(EV_DialogCancel);
}

function OnLoad()
{
	SetSaveWnd(True,False);

	AddState( "GAMINGSTATE" );
	AddState( "ARENAGAMINGSTATE" );
	SetContainerWindow(WINDOWTYPE_DECO_NORMAL, 7285);
}

function OnFlashLoaded()
{
	RegisterDelegateHandler(EDelegateHandlerType.EDHandler_PledgeWnd);
}

function OnShow () 
{		
	getInstanceL2Util().checkIsPrologueGrowType ( string(self) );
}


//파일윈도우를 보여준다. 핸들러를 지정하고, 
//FileWnd.uc의 Upload함수를 수정해서 파일등록시 실행될 함수를 지정해 주자.
/*
	FH_NONE,                    0
	FH_PLEDGE_CREST_UPLOAD,     1
	FH_PLEDGE_EMBLEM_UPLOAD,    2
	FH_ALLIANCE_CREST_UPLOAD,   3
	FH_WEBBROWSER_FILE_UPLOAD,  4 
	FH_MAX      
*/


function OnCallUCFunction( string funcName, string param )
{
	local FileRegisterWnd script;
	local string strParam;

	Debug("funcName:" @ funcName);
	Debug("param:" @ param);

	if(funcName == "FileRegisterWndShowByTypeStr")
	{
		script = FileRegisterWnd(GetScript("FileRegisterWnd"));

		script.FileRegisterWndShowByTypeStr(param);		
	}
	else if(funcName == "pledgepenalty")
	{
		ExecuteCommandFromAction("pledgepenalty");
	}
	else if(funcName == "ClanSearch")
	{
		if ( class'UIAPI_WINDOW'.static.IsShowWindow("ClanSearch") )
		{
			class'UIAPI_WINDOW'.static.HideWindow("ClanSearch");
		}
		else
		{
			class'UIAPI_WINDOW'.static.ShowWindow("ClanSearch");
			class'UIAPI_WINDOW'.static.SetFocus("ClanSearch");
		}
	}
	else if(funcName == "ClanShopWnd")
	{
		if ( class'UIAPI_WINDOW'.static.IsShowWindow("ClanShopWnd") )
		{
			class'UIAPI_WINDOW'.static.HideWindow("ClanShopWnd");
		}
		else
		{
			class'UIAPI_WINDOW'.static.ShowWindow("ClanShopWnd");
			class'UIAPI_WINDOW'.static.SetFocus("ClanShopWnd");
		}

	}
	else if(funcName == "ToDoListClanWnd")
	{
		if ( class'UIAPI_WINDOW'.static.IsShowWindow("ToDoListClanWnd") )
		{
			class'UIAPI_WINDOW'.static.HideWindow("ToDoListClanWnd");
		}
		else
		{
			class'UIAPI_WINDOW'.static.ShowWindow("ToDoListClanWnd");
			class'UIAPI_WINDOW'.static.SetFocus("ToDoListClanWnd");
		}
	}
	else if(funcName == "InviteFriend")
	{
		class'PersonalConnectionAPI'.static.RequestAddFriend(param);						
	}

	else if(funcName == "InviteParty")
	{
		RequestInviteParty(param);
	}
	else if(funcName == "ClanBoard")
	{
		strParam = "";
		ParamAdd(strParam, "Index", "3");
		ExecuteEvent(EV_ShowBBS, strParam);
	}
	else if(funcName == "ClanHelp")
	{
		ExecuteEvent(EV_ShowHelp, "147");
	}
	else if(funcName == "benefit")
	{
		ExecuteEvent(EV_ShowHelp, "153");
	}
	// 아지트 버튼
	else if(funcName == "agit")
	{
		// ExecuteEvent(EV_ShowHelp, "153");
	}

	//--혈맹원 메인 리스트
	else if(funcName == "addFriend")
	{
		class'PersonalConnectionAPI'.static.RequestAddFriend(param);						
	}
	else if(funcName == "inviteParty")
	{
		RequestInviteParty(param);
	}
	else if(funcName == "whisper")
	{
		whisperToUser(param);
	}
}

//귓속말하기
function whisperToUser(string userName)
{
	local ChatWnd chatWndScript;
	if (userName != "")
	{
		//callGFxFunction("ChatMessage", "sendWhisper", userName);
		//클라쪽 귓속말 확인
		chatWndScript = ChatWnd(GetScript("ChatWnd"));
		chatWndScript.SetChatEditBox("\"" $ userName $ " ");
	}
}
defaultproperties
{
}
