#pragma once

#pragma warning (disable:4949)
#include "../NetWakerPGEnum.h"
#include "../../RoleData/RoleDataEx.h"

#pragma unmanaged

//-----------------------------------------------------------------------------------------------------
//資料轉送 到某一群組Srv 
// 所有 Srv -> Chat

struct PG_ChannelBase_toChat_DataTransmitToGSrv_Group
{
    GamePGCommandEnum	Command;
    int                 SenderDBID;
    int                 DataSize;
    int                 ChannelID;
    GroupObjectTypeEnum Type;

    PacketBaseMaxStruct Data;

    PG_ChannelBase_toChat_DataTransmitToGSrv_Group()
    {
        Command = EM_PG_ChannelBase_toChat_DataTransmitToGSrv_Group;
    }

    int     Size( )
    {
        return (sizeof(*this) + DataSize - sizeof(Data));
    }
};
//-----------------------------------------------------------------------------------------------------
//資料轉送 到某一群組Cli
// 所有 Srv -> Chat

struct PG_ChannelBase_toChat_DataTransmitToCli_Group
{
    GamePGCommandEnum	Command;
    int                 SenderDBID;
    int                 DataSize;
    int                 ChannelID;
    GroupObjectTypeEnum Type;

    PacketBaseMaxStruct Data;

    PG_ChannelBase_toChat_DataTransmitToCli_Group()
    {
        Command = EM_PG_ChannelBase_toChat_DataTransmitToCli_Group;
    }
    int     Size( )
    {
        return (sizeof(*this) + DataSize - sizeof(Data));
    }
};
//-----------------------------------------------------------------------------------------------------
//資料轉送 到某人的Srv
// 所有 Srv -> Chat

struct PG_ChannelBase_toChat_DataTransmitToSrv
{
    GamePGCommandEnum	Command;
    int                 SenderDBID;
    int                 DataSize;
    int                 DBID;

	StaticString <_MAX_NAMESTRING_LEN_> Name;

    PacketBaseMaxStruct Data;

    PG_ChannelBase_toChat_DataTransmitToSrv()
    {
        Command = EM_PG_ChannelBase_toChat_DataTransmitToSrv;
    }
    int     Size( )
    {
        return (sizeof(*this) + DataSize - sizeof(Data));
    }
};
//-----------------------------------------------------------------------------------------------------
//資料轉送 到某人的Cli
// 所有 Srv -> Chat

struct PG_ChannelBase_toChat_DataTransmitToCli
{
    GamePGCommandEnum	Command;
    int                 SenderDBID;
    int                 DataSize;
    int                 DBID;
    StaticString <_MAX_NAMESTRING_LEN_> Name;    
    PacketBaseMaxStruct Data;

    PG_ChannelBase_toChat_DataTransmitToCli()
    {
        Command = EM_PG_ChannelBase_toChat_DataTransmitToCli;
    }
    int     Size( )
    {
        return (sizeof(*this) + DataSize - sizeof(Data));
    }
};
//-----------------------------------------------------------------------------------------------------
//資料註冊 或 產生
//-----------------------------------------------------------------------------------------------------
//要求產生一個 Channel
struct PG_ChannelBase_LtoChat_CreateChannel
{
    GamePGCommandEnum	Command;

    GroupObjectTypeEnum Type;
    int                 UserDBID;       //命令要求者

	StaticString <_MAX_NAMESTRING_LEN_> Name;    
	StaticString <_MAX_NAMESTRING_LEN_> Password;

    PG_ChannelBase_LtoChat_CreateChannel()
    {
        Command = EM_PG_ChannelBase_LtoChat_CreateChannel;
    }
};
//-----------------------------------------------------------------------------------------------------
//產生 Channel 結果
struct PG_ChannelBase_ChattoL_CreateChannelResult
{
    GamePGCommandEnum	Command;

    bool                Result;         // true 成功  false 失敗
    GroupObjectTypeEnum Type;
    int                 ChannelID;

	StaticString <_MAX_NAMESTRING_LEN_> Name;    


    int                 UserDBID;       //命令要求者

    PG_ChannelBase_ChattoL_CreateChannelResult()
    {
        Command = EM_PG_ChannelBase_ChattoL_CreateChannelResult;
    }
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道
struct PG_ChannelBase_LtoChat_AddUser
{
    GamePGCommandEnum	Command;

    GroupObjectTypeEnum Type;
    int                 ChannelID;
    int                 UserDBID;
    int                 SenderDBID;
	StaticString <_MAX_NAMESTRING_LEN_> Password;    
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;    

    PG_ChannelBase_LtoChat_AddUser()
    {
        Command = EM_PG_ChannelBase_LtoChat_AddUser;
    }
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道 結果
struct PG_ChannelBase_ChattoL_AddUserResult
{
    GamePGCommandEnum	Command;

    bool                Result;         // true 成功  false 失敗

    GroupObjectTypeEnum Type;
    int                 ChannelID;
    int                 UserDBID;
    int                 SenderDBID;
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;    

    PG_ChannelBase_ChattoL_AddUserResult()
    {
        Command = EM_PG_ChannelBase_ChattoL_AddUserResult;
    }
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道
struct PG_ChannelBase_LtoChat_DelUser
{
    GamePGCommandEnum	Command;

    GroupObjectTypeEnum Type;
    int                 ChannelID;
    int                 UserDBID;

    PG_ChannelBase_LtoChat_DelUser()
    {
        Command = EM_PG_ChannelBase_LtoChat_DelUser;
    }
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道 結果
struct PG_ChannelBase_ChattoL_DelUserResult
{
    GamePGCommandEnum	Command;

    bool                Result;         // true 成功  false 失敗

    GroupObjectTypeEnum Type;
    int                 ChannelID;
    int                 UserDBID;

    PG_ChannelBase_ChattoL_DelUserResult()
    {
        Command = EM_PG_ChannelBase_ChattoL_DelUserResult;
    }
};
//-----------------------------------------------------------------------------------------------------
//Local -> Chat
//當玩家進入時通知Chat 的資料
struct PG_ChannelBase_LtoChat_UserChangeZone
{
    GamePGCommandEnum	Command;

	StaticString <_MAX_NAMESTRING_LEN_> Account;
	OnlinePlayerInfoStruct Info;
	/*
    //角色資訊
    int		DBID;								    // 該角色的 DBID (應該是唯一)

	
	StaticString <_MAX_NAMESTRING_LEN_> RoleName;

    //區域資訊
    int		ZoneID;								// Local Server 本身的 ZoneID
    int		LocalID;							// 該角色在 Local 中的區域ID
*/
    PG_ChannelBase_LtoChat_UserChangeZone()
    {
        Command = EM_PG_ChannelBase_LtoChat_UserChangeZone;
    };
};
//-----------------------------------------------------------------------------------------------------
// Client 到 Local 產生 Channel 的封包
//-----------------------------------------------------------------------------------------------------
//要求產生一個 Channel
struct PG_ChannelBase_CtoL_CreateChannel
{
	GamePGCommandEnum	Command;
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;
	StaticString <_MAX_NAMESTRING_LEN_> Password;

	PG_ChannelBase_CtoL_CreateChannel()
	{
		Command = EM_PG_ChannelBase_CtoL_CreateChannel;
	}
};
//-----------------------------------------------------------------------------------------------------
//產生 Channel 結果
struct PG_ChannelBase_LtoC_CreateChannelResult
{
	GamePGCommandEnum	Command;

	bool                Result;         // true 成功  false 失敗
	GroupObjectTypeEnum Type;
	int                 ChannelID;
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;

	PG_ChannelBase_LtoC_CreateChannelResult()
	{
		Command = EM_PG_ChannelBase_LtoC_CreateChannelResult;
	}
};
//-----------------------------------------------------------------------------------------------------
//要求 加入到某一頻道
struct PG_ChannelBase_CtoL_JoinChannel
{
	GamePGCommandEnum	Command;
	//int                 ChannelID;
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;
	StaticString <_MAX_NAMESTRING_LEN_> Password;
	GroupObjectTypeEnum Type;

	PG_ChannelBase_CtoL_JoinChannel()
	{
		Command = EM_PG_ChannelBase_CtoL_JoinChannel;
	}
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道 結果
struct PG_ChannelBase_LtoC_JoinChannelResult
{
	GamePGCommandEnum	Command;
	bool                Result;         // true 成功  false 失敗
	int                 ChannelID;
	GroupObjectTypeEnum Type;
	StaticString <_MAX_NAMESTRING_LEN_> ChannelName;

	PG_ChannelBase_LtoC_JoinChannelResult()
	{
		Command = EM_PG_ChannelBase_LtoC_JoinChannelResult;
	}
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道
struct PG_ChannelBase_CtoL_LeaveChannel
{
	GamePGCommandEnum	Command;

	int                 ChannelID;
	GroupObjectTypeEnum Type;

	PG_ChannelBase_CtoL_LeaveChannel()
	{
		Command = EM_PG_ChannelBase_CtoL_LeaveChannel;
	}
};
//-----------------------------------------------------------------------------------------------------
//要求加入某角色到某一頻道 結果
struct PG_ChannelBase_LtoC_LeaveChannelResult
{
	GamePGCommandEnum	Command;

	bool                Result;         // true 成功  false 失敗
	int                 ChannelID;
	GroupObjectTypeEnum Type;

	PG_ChannelBase_LtoC_LeaveChannelResult()
	{
		Command = EM_PG_ChannelBase_LtoC_LeaveChannelResult;
	}
};
//-----------------------------------------------------------------------------------------------------
// 資料轉送
//-----------------------------------------------------------------------------------------------------
//資料轉送 到某一群組 Cli
// 所有 C -> chat
struct PG_ChannelBase_CtoChat_DataTransmitToCli_Group
{
	GamePGCommandEnum	Command;
	int                 ChannelID;
	GroupObjectTypeEnum Type;
	
	short	DataSize;
	char	Data[ 0x100 ];

	PG_ChannelBase_CtoChat_DataTransmitToCli_Group()
	{
		Command = EM_PG_ChannelBase_CtoChat_DataTransmitToCli_Group;
	}
	int     Size( )
	{
		return (sizeof(*this) + DataSize - sizeof(Data));
	}
};
//-----------------------------------------------------------------------------------------------------
//  Cli -> Cli 轉送透過 Chat
//  Chat -> C
struct PG_ChannelBase_ChattoC_DataTransmitCliToCli
{
	GamePGCommandEnum	Command;

	short	DataSize;
	char	Data[ 0x100 ];

	PG_ChannelBase_ChattoC_DataTransmitCliToCli()
	{
		Command = EM_PG_ChannelBase_ChattoC_DataTransmitCliToCli;
	}
	int     Size( )
	{
		return (sizeof(*this) + DataSize - sizeof(Data));
	}
};
//-----------------------------------------------------------------------------------------------------
//資料轉送 到某一個 Cli
// 所有 C -> chat
struct PG_ChannelBase_CtoChat_DataTransmitToCli_Name
{
	GamePGCommandEnum	Command;

	StaticString <_MAX_NAMESTRING_LEN_> Name;

	short	DataSize;
	char	Data[ 0x100 ];

	PG_ChannelBase_CtoChat_DataTransmitToCli_Name()
	{
		Command = EM_PG_ChannelBase_CtoChat_DataTransmitToCli_Name;
	}
	int     Size( )
	{
		return (sizeof(*this) + DataSize - sizeof(Data));
	}
};
//-----------------------------------------------------------------------------------------------------
//通知Cli聯結到Chat
// Chat -> C
struct PG_ChannelBase_ChattoC_ClientConnectToChat
{
	GamePGCommandEnum	Command;

	PG_ChannelBase_ChattoC_ClientConnectToChat()
	{
		Command = EM_PG_ChannelBase_ChattoC_ClientConnectToChat;
	}

};
//-----------------------------------------------------------------------------------------------------
//新增玩家
// Chat -> L
struct PG_ChannelBase_ChattoL_AddorSetOnlinePlayer
{
	GamePGCommandEnum		Command;
	OnlinePlayerInfoStruct	Info;

	PG_ChannelBase_ChattoL_AddorSetOnlinePlayer()
	{
		Command = EM_PG_ChannelBase_ChattoL_AddorSetOnlinePlayer;
	}
};
//-----------------------------------------------------------------------------------------------------
//玩家離線
// Chat -> L
struct PG_ChannelBase_ChattoL_DelOnlinePlayer
{
	GamePGCommandEnum		Command;
	StaticString< _MAX_NAMERECORD_SIZE_ >   Name;
	int						DBID;

	PG_ChannelBase_ChattoL_DelOnlinePlayer()
	{
		Command = EM_PG_ChannelBase_ChattoL_DelOnlinePlayer;
	}
};
//-----------------------------------------------------------------------------------------------------
//某頻道的玩家資訊(自己加入的)
//C -> Chat
struct PG_ChannelBase_CtoChat_ChannelPlayerList
{
	GamePGCommandEnum		Command;
	GroupObjectTypeEnum		Type;
	int						ChannelID;


	PG_ChannelBase_CtoChat_ChannelPlayerList()
	{
		Command = EM_PG_ChannelBase_CtoChat_ChannelPlayerList;
	}
};
//-----------------------------------------------------------------------------------------------------
//某頻道的玩家資訊(自己有加入的頻道)
//Chat -> C
struct PG_ChannelBase_ChattoC_ChannelPlayerListResult
{
	GamePGCommandEnum		Command;
	GroupObjectTypeEnum		Type;
	int						ChannelID;
	int						Count;		//人數
	
	StaticString <_MAX_NAMESTRING_LEN_> PlayerNameList[ 0x1000 ];

	PG_ChannelBase_ChattoC_ChannelPlayerListResult()
	{
		Command = EM_PG_ChannelBase_ChattoC_ChannelPlayerListResult;
	}
	int PGSize()
	{
		int Size = sizeof(*this) - sizeof( PlayerNameList ) + Count * sizeof(PlayerNameList[0]);
		return Size;
	}
};
//-----------------------------------------------------------------------------------------------------
//允許玩家加入與否的開關(管理者)
//C -> Chat
struct PG_ChannelBase_CtoChat_JoinPlayerDisabled
{
	GamePGCommandEnum		Command;
	GroupObjectTypeEnum		Type;
	int						ChannelID;	
	bool					JoinEnabled;

	PG_ChannelBase_CtoChat_JoinPlayerDisabled()
	{
		Command = EM_PG_ChannelBase_CtoChat_JoinPlayerDisabled;
	}
};
//-----------------------------------------------------------------------------------------------------
//允許玩家加入與否的開關 
//成功 通知所有人如果
//Chat -> C
struct PG_ChannelBase_ChattoC_JoinPlayerDisabledResult
{
	GamePGCommandEnum		Command;
	int						ChannelID;
	GroupObjectTypeEnum		Type;
	bool					JoinEnabled;

	PG_ChannelBase_ChattoC_JoinPlayerDisabledResult()
	{
		Command = EM_PG_ChannelBase_ChattoC_JoinPlayerDisabledResult;
	}
};
//-----------------------------------------------------------------------------------------------------
//踢出頻道(管理者)
//C -> Chat
struct PG_ChannelBase_CtoChat_KickPlayer
{
	GamePGCommandEnum		Command;
	GroupObjectTypeEnum		Type;
	int						ChannelID;

	StaticString <_MAX_NAMESTRING_LEN_> PlayerName;


	PG_ChannelBase_CtoChat_KickPlayer()
	{
		Command = EM_PG_ChannelBase_CtoChat_KickPlayer;
	}
};
//-----------------------------------------------------------------------------------------------------
//設定管理者(管理者)
//C -> Chat
struct PG_ChannelBase_CtoChat_SetManager
{
	GamePGCommandEnum		Command;
	GroupObjectTypeEnum		Type;
	int						ChannelID;
	
	StaticString <_MAX_NAMESTRING_LEN_> PlayerName;


	PG_ChannelBase_CtoChat_SetManager()
	{
		Command = EM_PG_ChannelBase_CtoChat_SetManager;
	}
};
//-----------------------------------------------------------------------------------------------------
//通知有那些已存在的系統頻道
//Chat -> C
struct PG_ChannelBase_ChattoC_SysChannel
{
	GamePGCommandEnum		Command;
	int						ChannelID;
	GroupObjectTypeEnum		Type;
	StaticString <_MAX_NAMESTRING_LEN_> Name;

	PG_ChannelBase_ChattoC_SysChannel()
	{
		Command = EM_PG_ChannelBase_ChattoC_SysChannel;
	}
};
//-----------------------------------------------------------------------------------------------------
//通知Chat現在 Client 所在的區域頻道
//C -> Chat
struct PG_ChannelBase_CtoChat_ZoneChannelID
{
	GamePGCommandEnum		Command;
	int						MapZoneID;		//地圖區域id

	PG_ChannelBase_CtoChat_ZoneChannelID()
	{
		Command = EM_PG_ChannelBase_CtoChat_ZoneChannelID;
	}
};
//-----------------------------------------------------------------------------------------------------
#pragma managed

