-----------------------------LOL专用事件-----------------------------
WM_DATA_GUILD		= 0x478

WM_YYIPC_STATE	= 0x47A
WM_CUSTOM_LOGIN	= 0x47B
WM_INIT_LOL_INFO	= 0x47C	-- 收到LOL游戏信息
WM_MAIN_FINISHED	= 0x47D	-- 窗口关闭

-- 消息包
WM_DATA_PACKET	= 0x479	-- 收到Protocol消息
WM_MSG_PACKET	= 0x47E	-- 收到消息包

-----------------------------内嵌YY专用消息-----------------------------
--local WM_USER			= 0x400
--local WM_CUSTOMBASE	= 300
WM_SHOWINTERNALYY	= 0x52D	-- 隐藏或者显示内置yy窗口
WM_MOVEINTERNALYY = 0x52E	-- 移动内置yy的窗口位置
WM_SETNICKNAME	= 0x52F	-- 设置yy用户显示昵称(*)
WM_JOINCHANNEL		= 0x530	-- 进入指定频道
WM_LEAVECHANNEL	= 0x531	-- 退出频道
WM_CHANGEROOM		= 0x532	-- 进入房间
WM_JOININVITEROOM	= 0x533	-- 进入房间,无视密码
WM_GETCURSID		= 0x534	-- 返回当前频道id
WM_GETCURRID		= 0x535	-- 返回当前房间id

WM_RENDER_FINISH	= 0x931	-- 内嵌YY绘制完毕


--提供给厂商使用的消息类型
WM_PRODUCT_SHOW_MOUSE = 0x536   --显示鼠标
WM_PRODUCT_START_LOGIN	= 0x537  --开始登录
WM_PRODUCT_COMMIT_IDX	= 0x538   --提交厂商标识

WM_GET_BIND_INFO		= 0x539   --获取公会绑定的YY频道
WM_SHOW_BIND_WND 		= 0x53A	  --显示绑定YY频道界面
WM_SHOW_BIND_CONFIG	= 0x53B	  --显示设置YY频道界面
WM_SHOW_INVITATION		= 0x53C	  --显示语音召集提示

WM_GAME_GET_USER_GROUP_LIST	= 0x53D  -- 获取当前用户的公会id个数和列表
WM_PRODUCT_COMMIT_SVRID	= 0x53E   --提交游戏服务器标识
WM_QUERY_LOGIN_STATE		= 0x53F        --查询登录状态
WM_RESET_SMARTYY			= 0x541        --重置内置YY到初始状态
WM_COMMIT_GAME_ACCOUNT = 0x542    --提交游戏账号

WM_MOVE_MINIYY_MAINBAR = 0x543		-- 移动小队语音工具条窗口
WM_SHOW_TEAMVOICE_UI = 0x544		-- 隐藏或者显示小队语音UI
WM_TEAMVOICE_ADDPLAYERINFO = 0x545	-- 增加一个玩家信息，并且传入x和y坐标，用于在指定的坐标位置显示一个喇叭，当点击这个喇叭时可以屏蔽或取消屏蔽 这个玩家的声音，如果不添加玩家信息，则不会显示喇叭
WM_TEAMVOICE_START = 0x546			-- 通知小队语音，开始语音聊天
WM_TEAMVOICE_STOP = 0x547			-- 通知小队语音，结束语音聊天，自动隐藏小队语音UI，并且自动清空所添加的玩家信息
WM_TEAMVOICE_DELPLAYERINFO = 0x548  -- 删除一个玩家信息，被删除的玩家如果仍然在频道的话，无法被听到说话。
WM_TEAMVOICE_SETSHOWMOD = 0x549  	-- 设置小队语音工具条设置窗口的显示模式,0 设置窗口显示在工具条上方,1 设置窗口显示在工具条下方
WM_TEAMVOICE_UPDATE_PLAYERINFO = 0x54A	-- 更新一个玩家信息的x和y坐标,显示或隐藏喇叭，重设喇叭位置
WM_TEAMVOICE_SETMINIYYSNAME = 0x54B -- 设置miniYY的链接名称
WM_TEAMVOICE_UPDATE_PLAYERINFOEX = 0x54C  -- 根据标志更新playerinfo数据
WM_TEAMVOICE_SETDEFAULTKEY = 0x54D	-- 设置小队语音说话默认按键
WM_SET_MOVE_MOD = 0x54C				-- 设置内置YY移动接口的行为模式

WM_ON_INVITATION_RESPOND = 0x554	-- 收到语音召集消息的回复 0x554
WM_SET_GROUP_USER_LIST	 = 0x555	-- 设置工会组织的成员列表到脚本
WM_ON_UPDATE_PROGRESS	 = 0x556	-- 收到yy更新进度消息
WM_START_UPDATE_YY		 = 0x557	-- 收到开始更新yy的消息
WM_FINISH_UPDATE_YY		 = 0x558	-- 收到YY更新完成的消息

------------------------队伍频道封装模块发送给画中画的协议-----------------------
YYT_TO_PIP_LOGIN_TEAM				= 0x8B0000 --已经成功登陆
YYT_TO_PIP_JOIN_TEAM				= 0x8B0001 -- 进入队伍频道
YYT_TO_PIP_LEAVE_TEAM				= 0x8B0002 -- 离开队伍频道
YYT_TO_PIP_USER_TALKING				= 0x8B0003 -- 某个用户说话状态改变
YYT_TO_PIP_USER_LEAVE				= 0x8B0004 -- 某个用户离开频道
YYT_TO_PIP_USER_JOIN				= 0x8B0005 -- 某个用户进入频道
YYT_TO_PIP_USER_UPDATE				= 0x8B0006 -- 某个用户昵称改变
YYT_TO_PIP_CHANGE_SETTINGS			= 0x8B0007 -- 设置改变
YYT_TO_PIP_RECV_CUSTOMMSG			= 0x8B000B -- 收到团队语音发来的用户自定义消息

------------------------miniYY封装模块发送给画中画的协议-----------------------
YYT_TO_PIP_UDB_REGISTERRESULT		= 0x8B0008 -- 收到udb发来的注册结果
YYT_TO_PIP_UDB_CERTIFICATE			= 0x8B0009 -- 收到udb发来的登录凭证
YYT_TO_PIP_UDB_PICCODEIMG			= 0x8B000A -- 收到udb发来的验证码图片数据
YYT_TO_PIP_ONCLOSE					= 0x8B000C -- 收到与yy客户端断开连接的消息
YYT_TO_PIP_ONCONNENT				= 0x8B000D -- 收到与yy客户端连接的消息
YYT_TO_PIP_ONTERMINATE				= 0x8B000E -- 收到与yy客户端断开连接的消息
YYT_TO_PIP_AUDIOINPUTLIST			= 0x8B000F -- 收到麦克风设备列表
YYT_TO_PIP_AUDIOOUTPUTLIST			= 0x8B0010 -- 收到喇叭设备列表
YYT_TO_PIP_INPUTDATAVOLUMELEVEL		= 0x8B0011 -- 收到试麦麦克风的音量
YYT_TO_PIP_OUTPUTDATAVOLUMELEVEL	= 0x8B0012 -- 收到试麦喇叭的音量(*)
YYT_TO_PIP_ONGETURLFINISHED			= 0x8B0013 -- 成功获取url数据
YYT_TO_PIP_ONDOWNFINISHED 			= 0x8B0014 -- 成功下载文件
YYT_TO_PIP_MINIYYCONNECT			= 0x8B0015 -- 成功与miniYY连接
YYT_TO_PIP_YYLISTINIT				= 0x8B0016 -- yy客户端列表初始化
YYT_TO_PIP_ONGETURLFAIL 			= 0x8B0017 -- GetUrlInfo失败事件
YYT_TO_PIP_ONDOWNFAIL 				= 0x8B0018 -- DownFileByUrl失败事件
YYT_TO_PIP_MINIYYCLOSE				= 0x8B0019 -- 与miniYY断开连接
YYT_TO_PIP_MINIYYSTATE				= 0x8B001A -- 通知，miniYY的状态
YYT_TO_PIP_GETTICKTRESULT			= 0x8B0020 -- 收到YY发来的票据
YYT_TO_PIP_UDB_ISACSAVERESULT 		= 0x8B002A -- 获取账号是否被udb模块保存的结果

-----------------------------YY客户端发送到画中画的协议-----------------------------
YY_TO_LOGIN_STATUS      		= 0x8C0001 -- YY登录状态
YY_TO_PIP_FAVORITE_INIT     		= 0x8C0002 -- 频道收藏列表
YY_TO_PIP_CHANNEL_INIT      		= 0x8C0003 -- 进入频道成功
YY_TO_PIP_LEAVE_CHANNEL     		= 0x8C0004 -- 离开频道
YY_TO_PIP_USER_INIT         		= 0x8C0005 -- 当前房间用户列表
YY_TO_PIP_ROOM_USER_TALKING 		= 0x8C0006 -- 房间有人说话
YY_TO_PIP_SET_MUTE          		= 0x8C0007 -- 设置声音开关
YY_TO_PIP_SET_VOLUME        		= 0x8C0008 -- 设置音量
YY_TO_PIP_CHANGE_ROOM_RES   		= 0x8C0009 -- 进入房间结果
YY_TO_PIP_CHANNEL_ENTER_RES 		= 0x8C000A -- 进入频道失败
YY_TO_PIP_ROOM_STYLE        		= 0x8C000B -- 收到子房间麦序设置
YY_TO_PIP_ROOM_LIST         		= 0x8C000C -- 收到查询房间的下一级子房间列表
YY_TO_PIP_ROOM_LIST_CHANGE  		= 0x8C000D -- 房间列表改变
YY_TO_PIP_GAME_STAT_ID      		= 0x8C000E -- 已废弃
YY_TO_PIP_RECENT_SESSLIST_INIT 		= 0x8C000F -- 频道访问历史列表
YY_TO_PIP_VOICE_HOTKEY      		= 0x8C0010 -- 频道按键说话设置
YY_TO_PIP_OPIDREQUEST       		= 0x8C0011 -- 已废弃,OPENID收到YY客户端发来的登录验证信息
YY_TO_PIP_OPIDSEND          		= 0x8C0012 -- 已废弃
YY_TO_PIP_CURDEVICE         		= 0x8C0013 -- 当前音频硬件GUID
YY_TO_PIP_MAIXULIST					= 0x8C0014 -- 麦序列表
YY_TO_PIP_MAITURN					= 0x8C0015 -- 首麦切换
YY_TO_PIP_RECVCUSTOMMESSAGE			= 0x8C0016 -- 收到其他用户发来的自定义消息(*)
YY_TO_PIP_NICKNAME					= 0x8C0017 -- 用户昵称
YY_TO_PIP_SIDBYASID					= 0x8C0018 -- 频道短id对应的长id
YY_TO_PIP_GUESTJOINMAIXU			= 0x8C0019 -- 是否允许游客上麦
YY_TO_PIP_SET_ENHANCEMIC			= 0x8C001A -- YY客户端操作麦克风增强开关
YY_TO_PIP_SET_DENOISE				= 0x8C001B -- YY客户端操作麦克风降噪开关
YY_TO_PIP_SET_AEC					= 0x8C001C -- YY客户端操作回音消除开关
YY_TO_PIP_USER_LIST_CHANGE			= 0x8C001D -- 用户列表改变
YY_TO_PIP_MAIXU_LIST_CHANGE			= 0x8C001E -- 麦序用户信息改变
YY_TO_PIP_FAVORITE_CHANGE			= 0x8C001F -- 收藏夹列表改变
YY_TO_PIP_MAISTATUS					= 0x8C0021 -- 收到歪歪客户端关于禁麦控麦状态的通知
YY_TO_PIP_MYGUILD_LIST				= 0x8C0022 -- 收到歪歪客户端的我的频道列表
YY_TO_PIP_HIST_NICKNAMES			= 0x8C0023 -- 收到歪歪客户端的历史昵称列表
YY_TO_PIP_POPUP_WINDOW				= 0x8C0024 -- 收到歪歪客户端需要弹窗信息
YY_TO_PIP_MY_INFO                   = 0x8C0025 -- YY登录账户信息
YY_TO_PIP_GUEST_VOICE_CFG			= 0x8C0026 -- 游客是否能够发言
YY_TO_PIP_ENABLE_USER_VOICE			= 0x8C0027 -- 频道内用户是否被禁言
YY_TO_PIP_GUEST_ENTERCH_LIMIT		= 0x8C0028 -- 频道是否禁止游客进入
YYT_TO_PIP_RecvMsg 							= 0x8B001b --接收lol喊话
YYT_TO_PIP_AddSummonerInfo			= 0x8B001c --添加召唤师信息
YYT_TO_PIP_AddMonsterTime				= 0x8B001d --添加野怪计时

TEAMVOICE_PINFO_ANOTHERNAME			= 1				-- 别名
TEAMVOICE_PINFO_AVATARPOS			= 2				-- 头像喇叭位置

--------------------------------------------------------------
-- 事件名定义
EVENT_TO_NAME = {
	-- LOL专用事件
	[WM_DATA_GUILD] = "WM_DATA_GUILD",	
	[WM_YYIPC_STATE] = "WM_YYIPC_STATE",
	[WM_CUSTOM_LOGIN] = "WM_CUSTOM_LOGIN",
	[WM_INIT_LOL_INFO] = "WM_INIT_LOL_INFO",
	[WM_MAIN_FINISHED] = "WM_MAIN_FINISHED",	
	-- 消息包
	[WM_DATA_PACKET] = "WM_DATA_PACKET",
	[WM_MSG_PACKET] = "WM_MSG_PACKET",
	
	-- WM_SHOWINTERNALYY
	--	arg1(boolean)	- 是否显示内置YY
	[WM_SHOWINTERNALYY] = {"WM_SHOWINTERNALYY", function(wParam, lParam) return wParam == 1 end},

	-- WM_MOVEINTERNALYY
	--	arg1(number)	- x坐标
	--	arg2(number)	- y坐标
	[WM_MOVEINTERNALYY] = {"WM_MOVEINTERNALYY", function(wParam, lParam) return wParam, lParam end},

	-- WM_SET_MOVE_MOD
	-- arg1(boolean)	是否显示移动模式
	[WM_SET_MOVE_MOD] = {"WM_SET_MOVE_MOD", function(wParam, lParam) return wParam ~= 0 end},

	-- WM_JOINCHANNEL
	--	arg1(number)	- 频道长位ID
	[WM_JOINCHANNEL] = {"WM_JOINCHANNEL", function(wParam, lParam) return wParam end},
	-- WM_LEAVECHANNEL
	--	空
	[WM_LEAVECHANNEL] = {"WM_LEAVECHANNEL", function(wParam, lParam) return end},
	-- WM_JOININVITEROOM
	--	arg1(number)	- 频道长位ID
	--	arg2(number)	- 房间ID
	[WM_JOININVITEROOM] = {"WM_JOININVITEROOM", function(wParam, lParam) return wParam, lParam end},
	-- WM_LEAVECHANNEL
	--	空
	[WM_GETCURSID] = {"WM_GETCURSID", function(wParam, lParam) return end},
	-- WM_GETCURRID
	--	空
	[WM_GETCURRID] = {"WM_GETCURRID", function(wParam, lParam) return end},
	-- WM_RENDER_FINISH
	--	空
	[WM_RENDER_FINISH] = {"WM_RENDER_FINISH", function(wParam, lParam) return end},
	-- WM_PRODUCT_SHOW_MOUSE
	--	arg1(boolean)	- 是否显示鼠标指针
	[WM_PRODUCT_SHOW_MOUSE] = {"WM_PRODUCT_SHOW_MOUSE", function(wParam, lParam) return wParam ~= 0 end},
	-- WM_PRODUCT_COMMIT_IDX
	--	arg1(number)	- 厂商表示ID
	[WM_PRODUCT_COMMIT_IDX] = {"WM_PRODUCT_COMMIT_IDX", function(wParam, lParam) return wParam end},	
	-- WM_PRODUCT_COMMIT_SVRID
	--	arg1(number)	- 游戏服务器ID
	[WM_PRODUCT_COMMIT_SVRID] = {"WM_PRODUCT_COMMIT_SVRID", function(wParam, lParam) return wParam end},
	-- WM_QUERY_LOGIN_STATE
	--	空
	[WM_QUERY_LOGIN_STATE] = {"WM_QUERY_LOGIN_STATE", function(wParam, lParam) return end},
	-- WM_RESET_SMARTYY
	--	空
	[WM_RESET_SMARTYY] = {"WM_RESET_SMARTYY", function(wParam, lParam) return end},	
	-- WM_MOVE_MINIYY_MAINBAR
	--	arg1(number)	- x坐标
	--	arg2(number)	- y坐标
	[WM_MOVE_MINIYY_MAINBAR] = {"WM_MOVE_MINIYY_MAINBAR", function(wParam, lParam) return wParam, lParam end},
	-- WM_SHOW_TEAMVOICE_UI
	--	arg1(boolean)	- 是否显示内置YY
	[WM_SHOW_TEAMVOICE_UI] = {"WM_SHOW_TEAMVOICE_UI", function(wParam, lParam) return wParam == 1 end},
	-- WM_TEAMVOICE_STOP
	--	空
	[WM_TEAMVOICE_STOP] = {"WM_TEAMVOICE_STOP", function(wParam, lParam) return end},
	
	-- WM_ON_UPDATE_PROGRESS			-- 收到yy更新进度消息
	--	arg1(number)	- progress
	--	arg2(number)	- total
	[WM_ON_UPDATE_PROGRESS] = {"WM_ON_UPDATE_PROGRESS", function(wParam, lParam) return wParam, lParam end},
};


PROTOCOL_TO_NAME = {
	-- YYT_TO_PIP_RECV_CUSTOMMSG	-- 收到自定义消息
	--	arg1(string)	- uid
	--	arg2(string)	- 内容
	[YYT_TO_PIP_RECV_CUSTOMMSG] = {"YYT_TO_PIP_RECV_CUSTOMMSG", function(packet) local uid = packet:GetAcharString(); local body = packet:GetAcharString(); return uid, body; end},
	-- YYT_TO_PIP_LOGIN_TEAM	-- 已经成功登陆
	--	arg1(string)	- uid
	[YYT_TO_PIP_LOGIN_TEAM] = {"YYT_TO_PIP_LOGIN_TEAM", function(packet) local uid = packet:GetAcharString(); return uid; end},
	-- YYT_TO_PIP_JOIN_TEAM		-- 进入队伍频道
	--	空
	[YYT_TO_PIP_JOIN_TEAM] = {"YYT_TO_PIP_JOIN_TEAM", function(packet) return; end},
	-- YYT_TO_PIP_LEAVE_TEAM	-- 离开队伍频道
	--	空
	[YYT_TO_PIP_LEAVE_TEAM] = {"YYT_TO_PIP_LEAVE_TEAM", function(packet) return; end},
	-- YYT_TO_PIP_USER_TALKING	- 说话事件（包括自己和其他人）
	--	arg1(string)	- uid
	--  arg2(number)  - talking 1表示开始说话 0表示结束说话
	--	arg3(string)		- 用户名字
	[YYT_TO_PIP_USER_TALKING] = {"YYT_TO_PIP_USER_TALKING", function(packet) local uid = packet:GetAcharString(); local talking = packet:GetInteger(4); local name = packet:GetAcharString(); return uid, talking, name; end},
	-- YYT_TO_PIP_USER_LEAVE	- 其他用户离开频道事件
	--	arg1(string)	- uid
	--	arg2(string)		- 用户名字
	[YYT_TO_PIP_USER_LEAVE] = {"YYT_TO_PIP_USER_LEAVE", function(packet) local uid = packet:GetAcharString(); local name = packet:GetAcharString(); return uid, name; end},
	-- YYT_TO_PIP_USER_JOIN	- 其他用户进入频道事件
	--	arg1(string)	- uid
	--	arg2(string)		- 用户名字
	[YYT_TO_PIP_USER_JOIN] = {"YYT_TO_PIP_USER_JOIN", function(packet) local uid = packet:GetAcharString(); local name = packet:GetAcharString(); return uid, name; end},
	-- YYT_TO_PIP_USER_UPDATE	- 用户数据更新事件
	--	arg1(string)	- uid
	--	arg2(string)		- 用户名字
	[YYT_TO_PIP_USER_UPDATE] = {"YYT_TO_PIP_USER_UPDATE", function(packet) local uid = packet:GetAcharString(); local name = packet:GetAcharString(); return uid, name; end},
	-- YYT_TO_PIP_CHANGE_SETTINGS	- 设置成功改变反馈事件
	--	arg1(number)	- 类型标志
	--	arg2(number)		- 改变的值
	[YYT_TO_PIP_CHANGE_SETTINGS] = {"YYT_TO_PIP_CHANGE_SETTINGS", function(packet) local type_flg = packet:GetInteger(4); local value = packet:GetInteger(4); return type_flg, value; end},
	-- YYT_TO_PIP_UDB_REGISTERRESULT	- UDB发送来的注册结果
	--	arg1(number)	- 注册结果ID
	--	arg2(string)		- 注册结果字符串
	[YYT_TO_PIP_UDB_REGISTERRESULT] = {"YYT_TO_PIP_UDB_REGISTERRESULT", function(packet) local iRet = packet:GetInteger(4); local error_msg = packet:GetAcharString(); return iRet, error_msg; end},
	-- YYT_TO_PIP_UDB_CERTIFICATE		- UDB发送来的登录凭证
	--	arg1(number)	- 登录凭证结果ID
	--	arg2(string)		- 凭证 certificate, 当arg1==0时有该值
	--	arg3(string)		- accesstoken, 当arg1==0时有该值
	--	arg4(string)		- taccount, 当arg1==0时有该值
	[YYT_TO_PIP_UDB_CERTIFICATE] = {"YYT_TO_PIP_UDB_CERTIFICATE", function(packet)	local iRet = packet:GetInteger32(4); if (iRet == 0) then local certificate = packet:GetAcharString(); local accesstoken = packet:GetAcharString(); local taccount = packet:GetAcharString(); return iRet, certificate, accesstoken, taccount; end return iRet; end},
	-- YYT_TO_PIP_UDB_PICCODEIMG		- UDB发送来的图片验证码数据
	--	arg1(number)	- iLen
	--	arg2(string)		- iOffset
	--	arg3(string)		- PicodeID
	[YYT_TO_PIP_UDB_PICCODEIMG] = {"YYT_TO_PIP_UDB_PICCODEIMG", function(packet) local iLen = packet:GetInteger(4); local ioffset = packet:GetAcharString(); local picode_id = packet:GetAcharString(); return iLen, ioffset, picode_id; end},
	-- YYT_TO_PIP_ONCLOSE		- 收到与yy客户端断开连接的消息
	--	空
	[YYT_TO_PIP_ONCLOSE] = {"YYT_TO_PIP_ONCLOSE", function(packet) return; end},
	-- YYT_TO_PIP_ONCONNENT		- 收到与yy客户端连接的消息
	--	空
	[YYT_TO_PIP_ONCONNENT] = {"YYT_TO_PIP_ONCONNENT", function(packet) return; end},
	-- YYT_TO_PIP_ONTERMINATE		- 收到与yy客户端断开连接的消息
	--	空
	[YYT_TO_PIP_ONTERMINATE] = {"YYT_TO_PIP_ONTERMINATE", function(packet) return; end},
	-- YYT_TO_PIP_MINIYYCONNECT		- 成功与miniYY连接
	--	空
	[YYT_TO_PIP_MINIYYCONNECT] = {"YYT_TO_PIP_MINIYYCONNECT", function(packet) return; end},
	-- YYT_TO_PIP_MINIYYCLOSE		- 与miniYY断开连接
	--	空
	[YYT_TO_PIP_MINIYYCLOSE] = {"YYT_TO_PIP_MINIYYCLOSE", function(packet) return; end},
	-- YYT_TO_PIP_MINIYYSTATE		- 通知，miniYY的状态
	--	空
	[YYT_TO_PIP_MINIYYSTATE] = {"YYT_TO_PIP_MINIYYSTATE", function(packet) local uid = packet:GetInteger(4); local sid = packet:GetInteger(4); return uid, sid; end},
	
	-- YYT_TO_PIP_AUDIOINPUTLIST		- 收到麦克风设备列表
	--	arg1(number)	- count 麦克风设备数量
	--	arg2(table)		- {name, no, guid} 设备表	
	[YYT_TO_PIP_AUDIOINPUTLIST] = {"YYT_TO_PIP_AUDIOINPUTLIST", function(packet) local count = packet:GetInteger(4); local t = {}; for i=1, count do local d = {}; d.name = packet:GetAcharString(2); d.no = packet:GetAcharString(2); d.guid = packet:GetAcharString(2); table.insert(t, d);	end return count, t; end},
	-- YYT_TO_PIP_AUDIOOUTPUTLIST		- 收到扬声器设备列表
	--	arg1(number)	- count 扬声器设备数量
	--	arg2(table)		- {name, no, guid} 设备表	
	[YYT_TO_PIP_AUDIOOUTPUTLIST] = {"YYT_TO_PIP_AUDIOOUTPUTLIST", function(packet) local count = packet:GetInteger(4); local t = {}; for i=1, count do local d = {}; d.name = packet:GetAcharString(2); d.no = packet:GetAcharString(2); d.guid = packet:GetAcharString(2); table.insert(t, d);	end return count, t; end},
	-- YYT_TO_PIP_INPUTDATAVOLUMELEVEL		- 收到试麦麦克风的音量
	--	arg1(number)	- volume 音量
	[YYT_TO_PIP_INPUTDATAVOLUMELEVEL] = {"YYT_TO_PIP_INPUTDATAVOLUMELEVEL", function(packet) local volume = packet:GetInteger(4); return volume; end},
	-- YYT_TO_PIP_INPUTDATAVOLUMELEVEL		- 收到试麦扬声器的音量
	--	arg1(number)	- volume 音量
	[YYT_TO_PIP_OUTPUTDATAVOLUMELEVEL] = {"YYT_TO_PIP_OUTPUTDATAVOLUMELEVEL", function(packet) local volume = packet:GetInteger(4); return volume; end},
	-- YYT_TO_PIP_ONGETURLFINISHED		- 成功获取url数据
	--	arg1(number)	- sid
	--	arg2(number)	- subid
	--	arg3(string)		- json_string
	[YYT_TO_PIP_ONGETURLFINISHED] = {"YYT_TO_PIP_ONGETURLFINISHED", function(packet) local sid = packet:GetInteger(4); local subid = packet:GetInteger(4); local json_string = packet:GetAcharString(); return sid, subid, json_string; end},
	-- YYT_TO_PIP_ONDOWNFINISHED		- 成功下载文件
	--	arg1(number)	- sid
	--	arg2(number)	- subid	
	[YYT_TO_PIP_ONDOWNFINISHED] = {"YYT_TO_PIP_ONDOWNFINISHED", function(packet) local sid = packet:GetInteger(4); local subid = packet:GetInteger(4); return sid, subid; end},
	-- YYT_TO_PIP_YYLISTINIT			- yy客户端列表初始化
	--	空	
	[YYT_TO_PIP_YYLISTINIT] = {"YYT_TO_PIP_YYLISTINIT", function(packet) return; end},
	-- YYT_TO_PIP_ONGETURLFAIL		- GetUrlInfo失败事件
	--	arg1(number)	- sid
	--	arg2(number)	- subid
	[YYT_TO_PIP_ONGETURLFAIL] = {"YYT_TO_PIP_ONGETURLFAIL", function(packet) local sid = packet:GetInteger(4); local subid = packet:GetInteger(4); return sid, subid; end},
	-- YYT_TO_PIP_ONDOWNFAIL			- DownFileByUrl失败事件
	--	arg1(number)	- sid
	--	arg2(number)	- subid
	[YYT_TO_PIP_ONDOWNFAIL] = {"YYT_TO_PIP_ONDOWNFAIL", function(packet) local sid = packet:GetInteger(4); local subid = packet:GetInteger(4); return sid, subid; end},
	-- YYT_TO_PIP_GETTICKTRESULT			- 收到YY发来的票据
	--	arg1(number)	- serviceId
	--	arg2(string)		- ticket
	[YYT_TO_PIP_GETTICKTRESULT] = {"YYT_TO_PIP_GETTICKTRESULT", function(packet) local id = packet:GetInteger(4); local ticket = packet:GetAcharString(); return id, ticket; end},
	-- YYT_TO_PIP_UDB_ISACSAVERESULT		- 获取账号是否被udb模块保存的结果
	--	arg1(number)	- saved		- 账号是否已经保存
	--	arg2(number)	- id 		- 脚本调用UdbIsAccountSave时的返回值
	--	arg2(string)	- accname	- 账号名字
	[YYT_TO_PIP_UDB_ISACSAVERESULT] = {"YYT_TO_PIP_UDB_ISACSAVERESULT", function(packet) local saved = packet:GetInteger(4)==1; local id = packet:GetInteger(4); local accname = packet:GetAcharString(); return saved, id, accname; end},
	
	-- YY_TO_LOGIN_STATUS			- 收到YY客户端的登录状态反馈
	--	arg1(boolean)	- state_code
	--	arg2(number)		- uid YY登录后的uid
	[YY_TO_LOGIN_STATUS] = {"YY_TO_LOGIN_STATUS", function(packet) local code = packet:GetInteger(4); local uid = packet:GetInteger(4); return code, uid; end},
	-- YY_TO_PIP_FAVORITE_INIT			- 收到收藏夹列表
	--	arg1(number)	- count
	--	arg2(table)		- {sid, asid, name}
	[YY_TO_PIP_FAVORITE_INIT] = {"YY_TO_PIP_FAVORITE_INIT", function(packet) local count = packet:GetInteger(4); local list = {}; for i=1, count do	local t = {}; t.sid = packet:GetInteger(4); t.asid = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); table.insert(list, t); end return count, list; end},
	-- YY_TO_PIP_CHANNEL_INIT			- 进入频道
	--	arg1(number)	- sid
	--	arg2(string)	- name
	--	arg2(number)	- asid
	[YY_TO_PIP_CHANNEL_INIT] = {"YY_TO_PIP_CHANNEL_INIT", function(packet) local long_id = packet:GetInteger(4); local name = packet:GetAcharFromWchar(4, true); local short_id = packet:GetInteger(4); return long_id, name, short_id; end},
	-- YY_TO_PIP_LEAVE_CHANNEL			- 退出频道
	--	空
	[YY_TO_PIP_LEAVE_CHANNEL] = {"YY_TO_PIP_LEAVE_CHANNEL", function(packet) return; end},
	-- YY_TO_PIP_FAVORITE_INIT			- 频道用户列表
	--	arg1(number)	- room_id
	--	arg2(number)	- count
	--	arg3(table)		- {uid, leavel, name}
	[YY_TO_PIP_USER_INIT] = {"YY_TO_PIP_USER_INIT", function(packet) local cur_room_id = packet:GetInteger(4); local count = packet:GetInteger(4); local list = {}; for i=1, count do local t = {}; t.uid = packet:GetInteger(4); t.level = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); table.insert(list, t); end return cur_room_id, count, list; end},
	-- YY_TO_PIP_ROOM_USER_TALKING			- 用户说话
	--	arg1(number)	- uid
	--	arg2(boolean)	- 1说话,0停止
	--	arg3(string)	- name
	[YY_TO_PIP_ROOM_USER_TALKING] = {"YY_TO_PIP_ROOM_USER_TALKING", function(packet) local uid = packet:GetInteger(4); local istalking = packet:GetInteger(4); local speak_name = istalking and packet:GetAcharFromWchar(4, true) or nil; return uid, istalking, speak_name; end},
	-- YY_TO_PIP_SET_MUTE			- 声音设置
	--	arg1(number)	- 1扬声器,2麦克风
	--	arg2(boolean)	- 1打开,0关闭
	[YY_TO_PIP_SET_MUTE] = {"YY_TO_PIP_SET_MUTE", function(packet) local object = packet:GetInteger(4); local bmute = packet:GetInteger(4); return object, bmute; end},
	-- YY_TO_PIP_SET_VOLUME			- 音量设置
	--	arg1(number)	- 1扬声器,2麦克风
	--	arg2(number)	- size
	[YY_TO_PIP_SET_VOLUME] = {"YY_TO_PIP_SET_VOLUME", function(packet) local object = packet:GetInteger(4); local size = packet:GetInteger(4); return object, size; end},
	-- YY_TO_PIP_CHANGE_ROOM_RES			- 进入房间结果
	--	arg1(number)	- channel_id
	--	arg2(number)	- room_id
	--	arg3(number)	- error_id(1子频道不存在,2已经在该房间,3请输入子频道密码,4没有进入频道的权限,5密码错误或人数已满,6频道不允许游客进入)
	[YY_TO_PIP_CHANGE_ROOM_RES] = {"YY_TO_PIP_CHANGE_ROOM_RES", function(packet) local channel_id = packet:GetInteger(4); local room_id = packet:GetInteger(4); local error_id = packet:GetInteger(4); return channel_id, room_id, error_id; end},
	-- YY_TO_PIP_CHANNEL_ENTER_RES			- 进入频道失败
	--	arg1(number)	- error_id(1频道不存在,2网络错误,3无法连接服务器,4连接已中断,5被管理员请出频道,6可能被管理禁止ID/IP,7被封ID,8被封IP,9短位ID已被回收,10频道已被冻结,11被管理员请出频道并封IP)
	[YY_TO_PIP_CHANNEL_ENTER_RES] = {"YY_TO_PIP_CHANNEL_ENTER_RES", function(packet) local error_id = packet:GetInteger( 4 ) return error_id; end},
	-- YY_TO_PIP_ROOM_STYLE			- 房间麦序设置
	--	arg1(number)	- room_id
	--	arg2(number)	- 0自由,1主席,2麦序
	[YY_TO_PIP_ROOM_STYLE] = {"YY_TO_PIP_ROOM_STYLE", function(packet) local room_id = packet:GetInteger(4); local mic_type = packet:GetInteger(4); return room_id, mic_type; end},
	-- YY_TO_PIP_ROOM_LIST			- 房间列表
	--	arg1(number)	- father_id
	--	arg2(number)	- count
	--	arg3(table)		- {father_id, id, bLocked, userCount, childCount, index, name} 房间表
	[YY_TO_PIP_ROOM_LIST] = {"YY_TO_PIP_ROOM_LIST", function(packet) local father_id = packet:GetInteger(4); local count = packet:GetInteger(4); local rooms = {}; for i=1, count do	local t = {}; t.father_id = packet:GetInteger(4); t.id = packet:GetInteger(4); t.bLocked = packet:GetInteger(4); t.userCount = packet:GetInteger(4); t.childCount = packet:GetInteger(4); t.index = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); table.insert(rooms, {t.index, t}); end return father_id, count, rooms; end},
	-- YY_TO_PIP_ROOM_LIST_CHANGE			- 房间列表改变
	--	arg1(number)	- type(0添加,1删除,2信息改变)
	--	arg2(number)	- count
	--	arg3(table)		- {father_id, id, bLocked, userCount, childCount, index, name} 房间表
	[YY_TO_PIP_ROOM_LIST_CHANGE] = {"YY_TO_PIP_ROOM_LIST_CHANGE", function(packet) local ntype = packet:GetInteger(4); local count = packet:GetInteger(4); local rooms = {}; for i=1, count do local r = {}; r.father_id = packet:GetInteger(4); r.id = packet:GetInteger(4); r.bLocked = packet:GetInteger(4); r.userCount = packet:GetInteger(4); r.childCount = packet:GetInteger(4); r.index = packet:GetInteger(4); r.name = packet:GetAcharFromWchar(4, true); table.insert(rooms, r); end return ntype, count, rooms; end},
	[YY_TO_PIP_GAME_STAT_ID] = "YY_TO_PIP_GAME_STAT_ID", -- 已废弃
	-- YY_TO_PIP_RECENT_SESSLIST_INIT			- 最近访问列表
	--	arg1(number)	- count
	--	arg2(table)		- {sid, asid, name}
	[YY_TO_PIP_RECENT_SESSLIST_INIT] = {"YY_TO_PIP_RECENT_SESSLIST_INIT", function(packet) local count = packet:GetInteger(4); local list = {}; for i=1, count do	local t = {}; t.sid = packet:GetInteger(4); t.asid = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); table.insert(list, t); end return count, list; end},
	-- YY_TO_PIP_VOICE_HOTKEY			- 按键说话设置
	--	arg1(number)	- type(0按键,1鼠标,2自由)
	--	arg2(number)	- mic_scancode
	--	arg3(number)	- mousecode
	--	arg4(number)	- env_value(环境音量)
	[YY_TO_PIP_VOICE_HOTKEY] = {"YY_TO_PIP_VOICE_HOTKEY", function(packet) local speak_type = packet:GetInteger(4); local key_scan_code = packet:GetInteger(4); local mouse_code = packet:GetInteger(4); local env_value = packet:GetInteger(4); return speak_type, key_scan_code, mouse_code, env_value; end},
	[YY_TO_PIP_OPIDREQUEST] = "YY_TO_PIP_OPIDREQUEST",  -- 已废弃
	[YY_TO_PIP_OPIDSEND] = "YY_TO_PIP_OPIDSEND", -- 已废弃
	-- YY_TO_PIP_CURDEVICE			- 音频硬件GUID
	--	arg1(string)	- voice
	--	arg2(string)	- mic
	[YY_TO_PIP_CURDEVICE] = {"YY_TO_PIP_CURDEVICE", function(packet) local voice_dvice = packet:GetAcharFromWchar(4, true); local mic_device = packet:GetAcharFromWchar(4, true); return voice_dvice, mic_device; end},
	-- YY_TO_PIP_MAIXULIST			- 麦序列表
	--	arg1(number)	- time
	--	arg2(number)	- count
	--	arg3(table)		- {uid, leavel, name}
	[YY_TO_PIP_MAIXULIST] = {"YY_TO_PIP_MAIXULIST", function(packet) local time = packet:GetInteger(4); local count = packet:GetInteger(4); local list = {}; for i=1, count do local u = {}; u.uid = packet:GetInteger(4); u.level = packet:GetInteger(4); u.name = packet:GetAcharFromWchar(4, true); table.insert(list, u); end return time, count, list; end},
	-- YY_TO_PIP_MAITURN			- 首麦切换
	--	arg1(number)	- uid
	--	arg2(number)	- time
	[YY_TO_PIP_MAITURN] = {"YY_TO_PIP_MAITURN", function(packet) local uid = packet:GetInteger(4); local time = packet:GetInteger(4); return uid, time; end},
	[YY_TO_PIP_RECVCUSTOMMESSAGE] = "YY_TO_PIP_RECVCUSTOMMESSAGE", -- 收到其他用户发来的自定义消息(*)
	-- YY_TO_PIP_NICKNAME			- 收到uid对应的YY昵称
	--	arg1(number)	- uid
	--	arg2(string)	- name
	[YY_TO_PIP_NICKNAME] = {"YY_TO_PIP_NICKNAME", function(packet) local uid = packet:GetInteger(4); local name = packet:GetAcharFromWchar(4, true); return uid, name; end},
	-- YY_TO_PIP_SIDBYASID
	[YY_TO_PIP_SIDBYASID] = {"YY_TO_PIP_SIDBYASID", function(packet) local asid = packet:GetInteger( 4 ); local sid = packet:GetInteger( 4 ); return sid, asid; end},
	-- YY_TO_PIP_GUESTJOINMAIXU			- 是否允许游客上麦
	--	arg1(number)	- sid
	--	arg2(number)	- 0禁止,1允许
	[YY_TO_PIP_GUESTJOINMAIXU] = {"YY_TO_PIP_GUESTJOINMAIXU", function(packet) local sid = packet:GetInteger(4); local iRet = packet:GetInteger(4); return sid, iRet; end},
	-- YY_TO_PIP_SET_ENHANCEMIC			- 麦克风增强
	--	arg1(boolean)	- 0关闭,1开启
	[YY_TO_PIP_SET_ENHANCEMIC] = {"YY_TO_PIP_SET_ENHANCEMIC", function(packet) local value = packet:GetInteger(4); return value; end},
	-- YY_TO_PIP_SET_DENOISE			- 麦克风降噪
	--	arg1(boolean)	- 0关闭,1开启
	[YY_TO_PIP_SET_DENOISE] = {"YY_TO_PIP_SET_DENOISE", function(packet) local value = packet:GetInteger(4); return value; end},
	-- YY_TO_PIP_SET_AEC			- 回音消除
	--	arg1(boolean)	- 0关闭,1开启
	[YY_TO_PIP_SET_AEC] = {"YY_TO_PIP_SET_AEC", function(packet) local value = packet:GetInteger(4); return value; end},
	-- YY_TO_PIP_USER_LIST_CHANGE			- 用户列表改变
	--	arg1(number)	- type(0添加,1删除,2信息改变)
	--	arg2(number)	- count
	--	arg3(table)		- {uid, leavel, name}
	[YY_TO_PIP_USER_LIST_CHANGE] = {"YY_TO_PIP_USER_LIST_CHANGE", function(packet) local ntype = packet:GetInteger(4); local count = packet:GetInteger(4); local users = {}; for i=1, count do local u = {}; u.uid = packet:GetInteger(4); u.level = packet:GetInteger(4); u.name = packet:GetAcharFromWchar(4, true); table.insert(users, u); end return ntype, count, users; end},
	-- YY_TO_PIP_MAIXU_LIST_CHANGE			- 麦序用户信息改变
	--	arg1(number)	- count
	--	arg2(table)		- {uid, leavel, name}
	[YY_TO_PIP_MAIXU_LIST_CHANGE] = {"YY_TO_PIP_MAIXU_LIST_CHANGE", function(packet) local count = packet:GetInteger(4); local users = {}; for i=1, count do local u = {}; u.uid = packet:GetInteger(4); u.level = packet:GetInteger(4); u.name = packet:GetAcharFromWchar(4, true); table.insert(users, u); end return count, users; end},
	-- YY_TO_PIP_FAVORITE_CHANGE			- 收藏夹列表改变
	--	arg1(number)	- type(0添加,1删除,2信息改变)
	--	arg2(number)	- count
	--	arg3(table)		- {sid, asid, name}
	[YY_TO_PIP_FAVORITE_CHANGE] = {"YY_TO_PIP_FAVORITE_CHANGE", function(packet) local ntype = packet:GetInteger(4); local count = packet:GetInteger(4); local list = {}; for i=1, count do local t = {}; t.sid = packet:GetInteger(4); t.asid = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); table.insert(list, t); end return ntype, count, list; end},
	-- YY_TO_PIP_MAISTATUS			- 禁麦/开麦,控麦/放麦
	--	arg1(number)	- type(1禁麦,2开麦,3控麦,4放麦)
	--	arg2(number)	- uid
	[YY_TO_PIP_MAISTATUS] = {"YY_TO_PIP_MAISTATUS", function(packet) local status = packet:GetInteger(4); local uid = packet:GetInteger(4); return status, uid; end},
	-- YY_TO_PIP_MYGUILD_LIST			- 我的频道列表
	--	arg1(number)	- count
	--	arg2(table)		- {sid, asid, name, role, roleIdx, flag}
	[YY_TO_PIP_MYGUILD_LIST] = {"YY_TO_PIP_MYGUILD_LIST", function(packet) local count = packet:GetInteger(4); local list = {}; for i=1, count do	local t = {}; t.sid = packet:GetInteger(4); t.asid = packet:GetInteger(4); t.name = packet:GetAcharFromWchar(4, true); t.role = packet:GetInteger(4); t.roleIdx = packet:GetInteger(4); t.flag = false; table.insert(list, t); end return count, list; end},
	-- YY_TO_PIP_HIST_NICKNAMES			- 历史昵称列表
	--	arg1(number)	- count
	--	arg2(string)	- name
	[YY_TO_PIP_HIST_NICKNAMES] = {"YY_TO_PIP_HIST_NICKNAMES", function(packet) local count = packet:GetInteger(4); local list = {}; for i=1, count do local nick_name = packet:GetAcharFromWchar(4, true); table.insert(list, nick_name); end return count, list; end},
	-- YY_TO_PIP_POPUP_WINDOW			- YY客户端传来弹窗
	--	arg1(string)	- message
	[YY_TO_PIP_POPUP_WINDOW] = {"YY_TO_PIP_POPUP_WINDOW", function(packet) local msg = packet:GetAcharFromWchar(4,true); return msg; end},

	-- YY_TO_PIP_MY_INFO                            - yy登录信息（目前只获得通行证）
	--      arg1(string)    - yy_account
	[YY_TO_PIP_MY_INFO] = {"YY_TO_PIP_MY_INFO", function(packet) local yy_account = packet:GetAcharFromWchar(4, true); return yy_account; end},

	-- YY_TO_PIP_GUEST_VOICE_CFG                    - 游客是否能够发言
	--      arg1(number)    - flag 1允许发言 0不允许
	[YY_TO_PIP_GUEST_VOICE_CFG] = {"YY_TO_PIP_GUEST_VOICE_CFG", function(packet) local sid = packet:GetInteger(4); local iRet = packet:GetInteger(4); return sid, iRet; end},
	
	-- YY_TO_PIP_GUEST_VOICE_CFG                    - 游客是否能够发言
	--      arg1(number)    - flag 1允许发言 0不允许
	[YY_TO_PIP_GUEST_VOICE_CFG] = {"YY_TO_PIP_GUEST_VOICE_CFG", function(packet) local sid = packet:GetInteger(4); local iRet = packet:GetInteger(4); return sid, iRet; end},
	
	-- YY_TO_PIP_ENABLE_USER_VOICE                    - 频道内用户是否被禁言
	--      arg1(number)    - 用户列表长度
	--		arg2(table)		- 用户uid和禁言状态组成的列表
	[YY_TO_PIP_ENABLE_USER_VOICE] = {"YY_TO_PIP_ENABLE_USER_VOICE", function(packet) local ncount = packet:GetInteger(4); 
						local list = {}; 
						for i=1, ncount do
							local tbl = {}
							tbl.uid   = packet:GetInteger(4)
							tbl.speak = packet:GetInteger(4) == 1
							table.insert(list, tbl);
						end
						return ncount, list;
				end},
	-- YY_TO_PIP_GUEST_ENTERCH_LIMIT 	- 是否限制游客进入子房间
	--		arg1(number) 	- 子频道ID
	--      arg2(number)    - 0 不限制 1 是限制
	[YY_TO_PIP_GUEST_ENTERCH_LIMIT] = {"YY_TO_PIP_GUEST_ENTERCH_LIMIT", function(packet) local ssid = packet:GetInteger(4); local flag = packet:GetInteger(4) == 0; return ssid, flag; end},
	
	
	[YYT_TO_PIP_RecvMsg] = {"YYT_TO_PIP_RecvMsg", function(packet) local uid = packet:GetAcharString(); return uid; end},
	
	
	[YYT_TO_PIP_AddSummonerInfo] = {"YYT_TO_PIP_AddSummonerInfo", function(packet) local szIconPath = packet:GetAcharString(); local szSummName = packet:GetAcharString();local szRank = packet:GetAcharString();
																																		local szDuan = packet:GetAcharString();  local szWinLose = packet:GetAcharString();  local szWinRatio = packet:GetAcharString();  
																																		local szWinPoint = packet:GetAcharString();
																																		return szIconPath,szSummName,szRank,szDuan,szWinLose,szWinRatio,szWinPoint; 
																																		end},	
																																		
	[YYT_TO_PIP_AddMonsterTime] = {"YYT_TO_PIP_AddMonsterTime", function(packet) local uid = packet:GetAcharString(); local pX = packet:GetInteger(4);local pY = packet:GetInteger(4);local pWid = packet:GetInteger(4);
																local pHeghit = packet:GetInteger(4);local nTxtId = packet:GetInteger(4);
																return uid,pX,pY,pWid,pHeghit,nTxtId; end},
	-- WM_MSG_PACKET
	-- WM_GET_BIND_INFO			- 获取公会绑定的YY频道
	--	arg1(number)	- groupid 公会id
	--	arg2(number)	- callback 回调函数
	[WM_GET_BIND_INFO] = {"WM_GET_BIND_INFO", function(packet) local callback = packet:GetInteger(4); local groupid = packet:GetAcharString(); return groupid, callback; end},
	-- WM_SHOW_BIND_WND		- 显示绑定YY频道界面
	--	arg1(number)	- callback 回调函数
	--	arg2(string)		- name 
	--	arg3(number)	- group_id 公会ID 
	[WM_SHOW_BIND_WND] = {"WM_SHOW_BIND_WND", function(packet) local callback = packet:GetInteger(4); local name = packet:GetAcharString(); local id = packet:GetAcharString(); return callback, name, id; end},
	[WM_SHOW_BIND_CONFIG] = "WM_SHOW_BIND_CONFIG", --显示设置YY频道界面
	[WM_SHOW_INVITATION] = "WM_SHOW_INVITATION", --显示语音召集提示 
	-- WM_SHOW_INVITATION  -- 显示语音召集窗口
	--	arg1(number)	- sid 		- 主频道id
	--  arg2(number)	- shortid	- 频道短id
	--	arg3(number)	- subsid 	- 子频道id
	--	arg3(string)	- name 		- 玩家名字
	--	arg5(string)	- msg 		- 附加消息
	--	arg6(string)	- pwd 		- 房间密码
	--	arg7(string)	- grouptype - 组织类型
	[WM_SHOW_INVITATION] = {"WM_SHOW_INVITATION", function(packet) 
						local sid 		= 	packet:GetInteger(4); 
						local shortid 	= 	packet:GetInteger(4); 
						local subsid 	= 	packet:GetInteger(4); 
						local groupid 	= 	packet:GetInteger(4); 
						local name 		= 	packet:GetAcharString(); 
						local msg 		= 	packet:GetAcharString(); 
						local pwd 		= 	packet:GetAcharString(); 
						local grouptype = 	packet:GetAcharString(); 
						return sid, shortid, subsid, groupid, name, msg, pwd, grouptype; 
					end},
	-- WM_PRODUCT_START_LOGIN		- 开始登录
	--	arg1(string)		- uid 
	[WM_PRODUCT_START_LOGIN] = {"WM_PRODUCT_START_LOGIN", function(packet) local username = packet:GetAcharString(); local password = packet:GetAcharString(); local visible = packet:GetInteger(4) == 1; return username,password,visible; end},
	
	-- WM_GAME_GET_USER_GROUP_LIST		- 获取当前用户的公会id个数和列表
	--	arg1(number)	- count 个数
	--	arg2(table)	- {id} 列表 
	[WM_GAME_GET_USER_GROUP_LIST] = {"WM_GAME_GET_USER_GROUP_LIST", 
					 function(packet)
					    local list = {}; 
					    local count = packet:GetInteger(4);
					    if (count > 0) then
					       for i=1, count do
					       	local t = {}
					       	t.groupId = packet:GetInteger(4)
					       	t.groupName = packet:GetAcharString()
					       	t.groupType = packet:GetAcharString()
					       	if packet:GetInteger(4) == 1 then
					       		t.isMaster = true
					       	else
					       		t.isMaster = false
					       	end
					       	if tonumber(t.groupId) ~= 0 then
					       		table.insert(list, t);
					       	else
					       		__LOG__("WM_GAME_GET_USER_GROUP_LIST group id is 0! ignored!")
					       	end
					       end
					    end
					    __LOG__("WM_GAME_GET_USER_GROUP_LIST count: " .. count)
					    return count, list;
					 end
	},

	-- WM_SETNICKNAME		- 设置yy用户显示昵称
	--	arg1(string)		- nickname 昵称
	[WM_SETNICKNAME] = {"WM_SETNICKNAME", function(packet) local nickname = packet:GetAcharString(); return nickname; end},
	-- WM_CHANGEROOM		- 进入房间
	--	arg1(number)	- room_id 房间号
	--	arg2(string)		- password
	[WM_CHANGEROOM] = {"WM_CHANGEROOM", function(packet) local room_id = packet:GetInteger(4); local password = packet:GetAcharString(); return room_id, password; end},
	
	-- WM_COMMIG_GAME_ACCOUNT       - 提交游戏账号
	-- arg1(string)                 - 游戏账号
	[WM_COMMIT_GAME_ACCOUNT] = {"WM_COMMIT_GAME_ACCOUNT", function(packet) local game_account = packet:GetAcharString(); return game_account; end},

	-- WM_TEAMVOICE_ADDPLAYERINFO			-- 增加一个玩家信息，并且传入x和y坐标，用于在指定的坐标位置显示一个喇叭，当点击这个喇叭时可以屏蔽或取消屏蔽 这个玩家的声音，如果不添加玩家信息，则不会显示喇叭
	--	arg1(string)	- player_name
	--	arg2(number)	- x
	--	arg2(number)	- y
	[WM_TEAMVOICE_ADDPLAYERINFO] = {"WM_TEAMVOICE_ADDPLAYERINFO", function(packet) local player_name = packet:GetAcharString(); local x = packet:GetInteger(4); local y = packet:GetInteger(4); return player_name, x, y; end},

	-- WM_TEAMVOICE_UPDATE_PLAYERINFO		-- 更新一个玩家信息的x和y坐标,显示或隐藏喇叭，重设喇叭位置
	--	arg1(string)	- player_name
	--	arg2(number)	- x
	--	arg2(number)	- y
	--	arg3(number)	- bshow
	[WM_TEAMVOICE_UPDATE_PLAYERINFO] = {"WM_TEAMVOICE_UPDATE_PLAYERINFO", function(packet) local player_name = packet:GetAcharString(); local x = packet:GetInteger(4); local y = packet:GetInteger(4); local bshow = packet:GetInteger(4) == 1; return player_name, x, y, bshow; end},
	
	--	WM_TEAMVOICE_SETDEFAULTKEY
	--	arg1(int)	- flg
	--	arg2(boolean)
	[WM_TEAMVOICE_SETDEFAULTKEY] = {"WM_TEAMVOICE_SETDEFAULTKEY", function(packet) local key = packet:GetInteger(4); local keymod = packet:GetInteger(4); return key, keymod == 1; end},

	[WM_TEAMVOICE_UPDATE_PLAYERINFOEX] = {
		"WM_TEAMVOICE_UPDATE_PLAYERINFOEX", 
		function(packet)
			local flg = packet:GetInteger(4);
			local player_name = packet:GetAcharString();

			if flg == TEAMVOICE_PINFO_ANOTHERNAME then
				local another_name = packet:GetAcharString();
				return flg, player_name, another_name;
			elseif flg == TEAMVOICE_PINFO_AVATARPOS then
				local x = packet:GetInteger(4);
				local y = packet:GetInteger(4);
				local bshow = packet:GetInteger(4) == 1;
				return flg, player_name, x, y, bshow;
			else
				return flg;
			end
		end
	},

	-- WM_TEAMVOICE_DELPLAYERINFO			-- 删除一个玩家信息，被删除的玩家如果仍然在频道的话，无法被听到说话。
	--	arg1(string)	- player_name
	[WM_TEAMVOICE_DELPLAYERINFO] = {"WM_TEAMVOICE_DELPLAYERINFO", function(packet) local player_name = packet:GetAcharString(); return player_name; end},
	--	arg1(int)	- flg
	[WM_TEAMVOICE_SETSHOWMOD] = {"WM_TEAMVOICE_SETSHOWMOD", function(packet) local flg = packet:GetInteger(4); return flg; end},
	--	arg1(string)	- player_name
	[WM_TEAMVOICE_SETMINIYYSNAME] = {"WM_TEAMVOICE_SETMINIYYSNAME", function(packet) local sname = packet:GetAcharString(); return sname; end},
	-- WM_TEAMVOICE_START			-- 通知小队语音，开始语音聊天
	--	arg1(string)	- player_name
	--	arg2(string)	- team_name
	[WM_TEAMVOICE_START] = {"WM_TEAMVOICE_START", function(packet) local player_name = packet:GetAcharString(); local team_name = packet:GetAcharString(); return team_name, player_name; end},
	
	-- WM_ON_INVITATION_RESPOND			-- 收到语音召集消息的回复。
	--	arg1(number)	- accept		-- 是否接受了邀请，true=接受,false=拒绝
	--	arg2(string)	- name			-- 玩家名字
	[WM_ON_INVITATION_RESPOND] = {"WM_ON_INVITATION_RESPOND", function(packet) local accept = packet:GetInteger(4) == 1; local uid = packet:GetAcharString(); local name = packet:GetAcharString(); return accept, uid, name; end},
	
	-- WM_SET_GROUP_USER_LIST			-- 设置工会组织的成员列表到脚本
	--	arg1(number)	- ncount		-- 数组长度
	--	arg2(string)	- names			-- 玩家名字数组
	[WM_SET_GROUP_USER_LIST] = {"WM_SET_GROUP_USER_LIST", function(packet) local groupid = packet:GetInteger(4); local nsize = packet:GetInteger(4); 
							local userlist = {}
							for i= 1, nsize do
								local user = {};
								user.uid  = packet:GetAcharString(); 
								user.name = packet:GetAcharString(); 
								table.insert( userlist, user )
								__LOG__(("WM_SET_GROUP_USER_LIST: uid=%d, name=%s"):format(user.uid, user.name))
							end
							return groupid, nsize, userlist; 
							end},
	-- WM_FINISH_UPDATE_YY
	[WM_FINISH_UPDATE_YY] = {"WM_FINISH_UPDATE_YY", function(packet) local success = packet:GetInteger(4) == 1; return success; end},
	-- WM_START_UPDATE_YY			-- 收到开始更新yy的消息
	[WM_START_UPDATE_YY] = {"WM_START_UPDATE_YY", function(packet) return; end},
	

}
