//执行脚本
        //id 脚本id
        //play 玩家对象
        public void ExecuteAction(uint id, PlayerObject play)
        {
            reset();
            if (play != null)
            {
                play.ClearScriptMenuLink();
            }
            uint nextid = id;
            while (true)
            {
                if (!mDicScripte.ContainsKey(nextid)) break;
                GameStruct.ActionInfo info = mDicScripte[nextid];
                 bool ret  = false;
                //做一个异常处理,防止脚本写错服务端崩溃
                try
                {
                    ret = SWITCH(info, play);
                }
                catch (System.Exception ex)
                {
                    Log.Instance().WriteLog(ex.Message);
                    Log.Instance().WriteLog(ex.StackTrace);
                    Log.Instance().WriteLog("执行脚本失败,脚本id:" + info.id.ToString() + "玩家昵称:" + play.GetName());
                    ret = false;
                }

                if (ret) nextid = info.id_next;
                else nextid = info.id_nextfail;
                //npc对话已经完成,发送结尾标记-
                if (info.id_next == 0 && mbEndTag && play != null)
                {
                    NetMsg.MsgNpcReply reple = new NetMsg.MsgNpcReply();
                    reple.Create(null, play.GetGamePackKeyEx());
                    play.SendData(reple.Flush());
                    break;
                }
                //退出
                if (nextid == 0) break;
            }
        }
 private void Action_MenuText(ActionInfo info, PlayerObject play)
 {
     NetMsg.MsgNpcReply msg = new NetMsg.MsgNpcReply();
     msg.Create(null, play.GetGamePackKeyEx());
     msg.interactType = 257;
     msg.optionid = 255;
     msg.text = Sprintf_string(info.param, play);
     play.SendData(msg.GetBuffer());
 }
 private void Action_MenuImage(ActionInfo info, PlayerObject play)
 {
     String[] option = info.param.Split(' ');
     NetMsg.MsgNpcReply msg = new NetMsg.MsgNpcReply();
     msg.Create(null, play.GetGamePackKeyEx());
     ushort id = Convert.ToUInt16(option[2]);
     play.SendData(msg.NpcImage(id));
 }
        private void Action_MenuLink(ActionInfo info, PlayerObject play)
        {
            NetMsg.MsgNpcReply msg = new NetMsg.MsgNpcReply();
            msg.Create(null, play.GetGamePackKeyEx());
            msg.interactType = 258;
            msg.param = 111;
            msg.param2 = 112;
            msg.param3[1] = 113;
            msg.param3[2] = 114;
            msg.param3[0] = 115;
            if (info.id_next == 0) msg.optionid = 255;
            else msg.optionid = mnSelectIndex;/**选项索引**/

            String[] option = info.param.Split(' ');
            play.GetMenuLink()[mnSelectIndex] = Convert.ToUInt32(option[1]);
            msg.text = option[0];
            play.SendData(msg.GetBuffer());
        }
        private void Action_MenuEdit(ActionInfo info, PlayerObject play)
        {
            NetMsg.MsgNpcReply msg = new NetMsg.MsgNpcReply();
            msg.Create(null, play.GetGamePackKeyEx());
            msg.interactType = 259;

            String[] option = info.param.Split(' ');
            if (option.Length != 3)
            {
                Log.Instance().WriteLog("Action_MenuEdit参数数量不对." + info.param);
            }
            ushort nAcceptLen = Convert.ToUInt16(option[0]);
            uint idTask = Convert.ToUInt32(option[1]);
            play.SetTaskID(idTask);
            String sText = option[2];
            msg.param2 = nAcceptLen;
            msg.text = sText;
            play.SendData(msg.GetBuffer());
            //byte[] data1 = { 29, 0, 240, 7, 0, 0, 0, 0, 15, 0, 0, 3, 1, 12, 190, 252, 205, 197, 207, 235, 189, 208, 161, 173, 161, 173, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
            //play.SendData(data1);
        }