#include "NetCli_RoleValue.h"

//-------------------------------------------------------------------
NetCli_RoleValue*    NetCli_RoleValue::This         = NULL;

//-------------------------------------------------------------------
bool NetCli_RoleValue::_Init()
{
    Cli_NetReg( PG_RoleValue_LtoC_FixAllRoleValue );
    Cli_NetReg( PG_RoleValue_LtoC_FixRoleValue    );
    Cli_NetReg( PG_RoleValue_LtoC_ResultSetPoint  );
    Cli_NetReg( PG_RoleValue_LtoC_NotifyLvUp      );
    Cli_NetReg( PG_RoleValue_LtoC_SetTitleFlag    );
    Cli_NetReg( PG_RoleValue_LtoC_SetFlag         );
    Cli_NetReg( PG_RoleValue_LtoC_SetTitleResult  );
    Cli_NetReg( PG_RoleValue_LtoC_Title           );

    return true;
}
//-------------------------------------------------------------------
bool NetCli_RoleValue::_Release()
{
    return true;
}
//-------------------------------------------------------------------
void NetCli_RoleValue::_PG_RoleValue_LtoC_FixAllRoleValue   ( int Sockid , int Size , void* Data )
{
    PG_RoleValue_LtoC_FixAllRoleValue *  PG = (PG_RoleValue_LtoC_FixAllRoleValue *)Data;
    This->R_FixAllRoleValue( PG->Ability );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_FixRoleValue      ( int Sockid , int Size , void* Data )        
{
    PG_RoleValue_LtoC_FixRoleValue *  PG = (PG_RoleValue_LtoC_FixRoleValue *)Data;
    This->R_FixRoleValue( PG->ValueName , PG->Value );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_ResultSetPoint    ( int Sockid , int Size , void* Data )     
{
    PG_RoleValue_LtoC_ResultSetPoint *  PG = (PG_RoleValue_LtoC_ResultSetPoint *)Data;
    if( PG->Result == true )
    {
        This->R_SetPoint_OK( );
    }
    else
    {
        This->R_SetPoint_Failed( );
    }

}
void NetCli_RoleValue::_PG_RoleValue_LtoC_NotifyLvUp        ( int Sockid , int Size , void* Data )     
{
    PG_RoleValue_LtoC_NotifyLvUp *  PG = (PG_RoleValue_LtoC_NotifyLvUp *)Data;
    This->R_NotifyLvUp( PG->ItemID , PG->LV );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_SetTitleFlag      ( int Sockid , int Size , void* Data )     
{
    PG_RoleValue_LtoC_SetTitleFlag *  PG = (PG_RoleValue_LtoC_SetTitleFlag *)Data;
    This->R_SetTitleFlag( PG->TitleID , PG->Flag );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_SetFlag           ( int Sockid , int Size , void* Data )        
{
    PG_RoleValue_LtoC_SetFlag *  PG = (PG_RoleValue_LtoC_SetFlag *)Data;
    This->R_SetFlag( PG->ID , PG->Flag );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_SetTitleResult    ( int Sockid , int Size , void* Data )     
{
    PG_RoleValue_LtoC_SetTitleResult *  PG = (PG_RoleValue_LtoC_SetTitleResult *)Data;
    if( PG->Result == true )
        This->R_SetTitle_OK( PG->TitleID );
    else
        This->R_SetTitle_Failed( );
}
void NetCli_RoleValue::_PG_RoleValue_LtoC_Title             ( int Sockid , int Size , void* Data )    
{
    PG_RoleValue_LtoC_Title *  PG = (PG_RoleValue_LtoC_Title *)Data;
    This->R_Title( PG->ItemID , PG->TitleID );
}

void NetCli_RoleValue::S_RequestFixRoleValue   ( )
{
    PG_RoleValue_CtoL_RequestFixRoleValue Send;
    SendToLocal( sizeof(Send) , &Send );
}
void NetCli_RoleValue::S_RequestSetPoint       ( RoleValueName_ENUM ValueName  )
{
    PG_RoleValue_CtoL_RequestSetPoint Send;
    Send.ValueName = ValueName;
//    Send.Value = Value;
    SendToLocal( sizeof(Send) , &Send );

}
void NetCli_RoleValue::S_SetTitlRequest        ( int TitleID )
{
    PG_RoleValue_CtoL_SetTitlRequest Send;
    Send.TitleID = TitleID;

    SendToLocal( sizeof(Send) , &Send );

}