Example #1
0
    void StartAutoFight()
    {
        if (m_bIsEnterCopy)
        {
            CopyDataBase cdb = GameTableManager.Instance.GetTableItem <CopyDataBase>(m_uEnterCopyID);
            if (cdb != null)
            {
                //进入副本 如果还是组队跟随状态 跟随状态挂起,进入挂机状态
                Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                if (cs != null)
                {
                    Client.ICombatRobot robot = cs.GetCombatRobot();
                    if (robot != null) //&& robot.Status != Client.CombatRobotStatus.STOP)
                    {
                        if (DataManager.Manager <TeamDataManager>().IsJoinTeam&& DataManager.Manager <TeamDataManager>().IsFollow)
                        {
                            robot.StartInCopy(m_uEnterCopyID, LaskSkillWave, LastTransmitWave);
                        }

                        if (cdb.IsAutoFight)
                        {
                            robot.StartInCopy(m_uEnterCopyID, LaskSkillWave, LastTransmitWave);
                        }
                    }
                }
            }
        }
    }
Example #2
0
    void onClick_BtnAI_Btn(GameObject caster)
    {
        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
        if (cs == null)
        {
            Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null");
            return;
        }

        Client.ICombatRobot robot = cs.GetCombatRobot();
        if (robot.Status == Client.CombatRobotStatus.STOP)
        {
            ComBatCopyDataManager comBat = DataManager.Manager <ComBatCopyDataManager>();
            if (comBat.IsEnterCopy && comBat.EnterCopyID != 0)
            {
                robot.StartInCopy(comBat.EnterCopyID, comBat.LaskSkillWave, comBat.LastTransmitWave);
            }
            else
            {
                robot.Start();
            }
        }
        else
        {
            robot.Stop();
        }
    }
Example #3
0
 /// <summary>
 /// 开启挂机
 /// </summary>
 void StartRobot()
 {
     Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
     if (cs != null)
     {
         Client.ICombatRobot robot = cs.GetCombatRobot();
         if (robot != null) //&& robot.Status != Client.CombatRobotStatus.STOP)
         {
             robot.Start();
         }
     }
 }
Example #4
0
    void AutoFindPath(Vector3 targetPos, uint npcID = 0, bool isNpc = false)
    {
        IController ctrl   = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl();
        IMapSystem  mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }
        // 需要添加一个寻路的过程
        if (isNpc)
        {
            int mapID = DataManager.Manager <MapDataManager>().GetCurMapID();
            if (mapID > 0)
            {
                Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().VisiteNPC((uint)mapID, npcID, false);
                HideSelf();
            }
            else
            {
                Engine.Utility.Log.Error("mapid error ");
            }
        }
        else
        {
            if (ctrl != null)
            {
                Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                if (cs != null)
                {
                    Client.ICombatRobot robot = cs.GetCombatRobot();
                    if (robot != null && robot.Status != CombatRobotStatus.STOP)
                    {
                        robot.Stop();
                    }
                }
                m_vecTargetPos = new Vector2(targetPos.x, targetPos.z);
                mapSys.AddFindPathCallback(FindPathCallBack);
                ctrl.MoveToTarget(targetPos, null, true);
                mapSys.RemoveFindPathCallback(FindPathCallBack);
            }
        }
    }
Example #5
0
    public void SetFightRide(uint id)
    {
        m_auto_ride = id;
        ValueUpdateEventArgs arg = new ValueUpdateEventArgs("RideFightState", id, m_auto_ride);

        DispatchValueUpdateEvent(arg);
        TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Ride_Commond_Xchenggongchuzhan, m_lstRides.Find(C => C.id == id).name);
        Client.ICombatRobot robot = Client.ClientGlobal.Instance().GetControllerSystem().GetCombatRobot();
        if (robot == null)
        {
            Engine.Utility.Log.Error("robotis null");

            return;
        }
        if (robot.Status == Client.CombatRobotStatus.RUNNING)
        {
            Engine.Utility.Log.LogGroup("ZDY", "正在挂机杀怪,不直接上坐骑");
            return;
        }
        NetService.Instance.Send(new GameCmd.stUsingRideUserCmd_C());
    }
Example #6
0
        // 添加buff表现特效效果
        void AddBuffEffect(uint buffID, uint runID)
        {
            if (m_Master == null)
            {
                return;
            }
            if (m_Master.GetNode() == null)
            {
                if (!m_unCreateEffectList.Contains(runID))
                {
                    m_unCreateEffectList.Add(runID);
                }
            }
            else
            {
                CreateEffect(runID);
            }
            BuffDataBase db = GetBuffDataBase(runID);

            if (db == null)
            {
                //Log.Error("读取Buff配置数据出错:{0}", buffID);
                return;
            }


            for (int i = 0; i < db.buffEffect.Count; i++)
            {
                var item = db.buffEffect[i];
                if (item == 0)
                {
                    continue;
                }
                FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(item);
                if (edb == null)
                {
                    // Log.Error("get FxResDataBase is null id is " + item.ToString());
                    return;
                }
                string aniName = edb.targetAniName;
                if (string.IsNullOrEmpty(aniName))
                {
                    return;
                }
                PlayAni anim_param = new PlayAni();
                anim_param.strAcionName = aniName;
                anim_param.fSpeed       = 1;
                anim_param.nStartFrame  = 0;
                anim_param.nLoop        = edb.playAniTime;
                //if(db.buffBigType == (int)BuffBigType.Control)
                //{
                //    anim_param.nLoop = -1;
                //}
                //else
                //{
                //    anim_param.nLoop = 1;
                //}

                anim_param.fBlendTime = 0.2f;
                bool bRide = (bool)m_Master.SendMessage(EntityMessage.EntityCommond_IsRide, null);
                if (bRide)
                {
                    return;
                }
                if (m_Master.GetCurState() == CreatureState.Contrl)
                {//眩晕不播放其他动画
                    anim_param.aniCallback   = OnHitCallback;
                    anim_param.callbackParam = m_Master;
                    if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID()))
                    {
                        Engine.Utility.Log.Info("buff 播放眩晕动作 {0}", anim_param.strAcionName);
                    }
                    m_Master.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                }
                else
                {
                    if (m_Master.GetCurState() != CreatureState.Move)
                    {//移动中不播放受击动作
                        Client.IControllerSystem cs = m_ClientGlobal.GetControllerSystem();
                        if (cs != null)
                        {
                            Client.ICombatRobot robot = cs.GetCombatRobot();
                            if (robot.Status == CombatRobotStatus.RUNNING)
                            {
                                if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID()))
                                {//自动挂机 不播受击
                                    return;
                                }
                            }
                        }

                        m_Master.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                    }
                }
            }
        }
Example #7
0
    public void ExecuteSkillFailed(GameCmd.stMultiAttackReturnMagicUserCmd_S cmd)
    {
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.dwUserID, EntityType.EntityType_Player);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取主角技能部件失败!");
            return;
        }
        else
        {
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK,
                                                                new stGuildBreak()
            {
                action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.dwUserID, skillid = cmd.wdSkillID
            });
            TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this);
            string str = "";// "skill error code = " + cmd.fail_code + " ";
            if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_success)
            {
                //使用成功
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_break)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengbeidaduan);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_use)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengzhengzaishiyong);
                Log.Error("使用过程 error code {0}", cmd.fail_code);
            }

            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_outRange)
            {
                Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();
                if (cs != null)
                {
                    Client.ICombatRobot robot = cs.GetCombatRobot();
                    if (robot != null && robot.Status == CombatRobotStatus.RUNNING)
                    {
                        if (MainPlayerHelper.GetMainPlayer() == null)
                        {
                            return;
                        }
                        ISkillPart sp = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as ISkillPart;
                        if (sp == null)
                        {
                            return;
                        }

                        if (sp.GetSkillTarget() != null)
                        {
                            Move    move     = new Move();
                            Vector3 targePos = sp.GetSkillTarget().GetPos();
                            Vector3 dir      = targePos - MainPlayerHelper.GetMainPlayer().GetPos();
                            targePos           = targePos - dir.normalized * 1f;
                            move.m_target      = targePos;
                            move.m_ignoreStand = true;
                            Log.Error("自动挂机,打不到,朝向目标移动");

                            IController ctr = cs.GetActiveCtrl();
                            if (ctr != null)
                            {
                                ctr.MoveToTarget(targePos);
                            }
                            //MainPlayerHelper.GetMainPlayer().SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move);
                            // Vector3 lookat = playerSkill.GetSkillTarget().GetNode().GetTransForm().forward;
                            return;
                        }
                    }
                }

                str = GetLocalText(LocalTextType.Skill_Commond_mubiaochaochugongjijuli);
                Log.Error("技能使用超超出范围 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_shapeErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_bianshenzhuangtaixiabunengshiyongjineng);
                Log.Error("变身不能使用技能 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_petFight)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_chongwuweichuzhanbunengshiyongjineng);
                Log.Error("宠物未出战不能使用技能 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_notExist)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengbucunzai);
                Log.Error("技能不存在 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_none)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu);
                Log.Error("技能未知 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_needAim)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_shifanggaijinengxuyaoxuanzemubiao);
                Log.Error("技能需要目标error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_aimErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_mubiaoxuanzecuowu);
                Log.Error("技能目标错误 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_cantAtt)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_dangqianmubiaowufagongji);
                Log.Error("目标无法攻击 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_inCD)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinenglengquezhong);
                Log.Error("技能冷却中 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_lackSP)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_fashuzhibuzu);
                Log.Error("缺蓝 error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_flagsErr)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_dangqianjinengzhuangtaicuowu);
                Log.Error("flags error code {0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_NeedItemNumNotEnough)
            {
                str = GetLocalText(LocalTextType.Skill_Commond_shiyongchongwujinnegsuoxudaojubuzu);
                Log.Error("使用宠物技能所需道具不足{0}", cmd.fail_code);
            }
            else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_rideCantUse)
            {
                NetService.Instance.Send(new GameCmd.stDownRideUserCmd_C()
                {
                });
                return;
                //str = GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng);
                //Log.Error("骑乘无法使用技能{0}", cmd.fail_code);
            }
            else if (cmd.fail_code == 16)
            {                        //协议未更新 先写数字防止后期忘了
                str = "眩晕状态,技能不能使用"; // GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng);
                Log.Error("瞬移技能不能使用{0}", cmd.fail_code);
            }
            else
            {
                str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu);
                Log.Error("技能未知错误 ");
            }
            if (cmd.dwUserID == MainPlayerHelper.GetPlayerID())
            {
                TipsManager.Instance.ShowTips(str);
            }
        }

        skillPart.OnUseSkillFailed(cmd.dwUserID, cmd.wdSkillID);
    }
        private void SendPlayDefenerAniMessage(IEntity defender, string aniName)
        {
            CreatureState state = defender.GetCurState();

            ShowFlashColor(defender);
            if (state != CreatureState.Dead)
            {
                bool bRide = (bool)defender.SendMessage(EntityMessage.EntityCommond_IsRide, null);
                if (bRide)
                {
                    return;
                }
                SkillState skillState = GetTargetSkillState(defender);
                if (skillState != SkillState.Attack && skillState != SkillState.Prepare)
                {
                    if (defender.GetCurState() == CreatureState.Contrl)
                    {
                        return;
                    }
                    if (state != CreatureState.Move)
                    {
                        Client.IControllerSystem cs = m_ClientGlobal.GetControllerSystem();
                        if (cs != null)
                        {
                            Client.ICombatRobot robot = cs.GetCombatRobot();
                            if (robot.Status == CombatRobotStatus.RUNNING)
                            {
                                if (SkillSystem.GetClientGlobal().IsMainPlayer(defender.GetID()))
                                {//自动挂机 不播受击
                                    return;
                                }
                            }
                        }
                        INPC npc = defender as INPC;
                        if (npc != null)
                        {
                            int         baseID = npc.GetProp((int)EntityProp.BaseID);
                            NpcDataBase ndb    = GameTableManager.Instance.GetTableItem <NpcDataBase>((uint)baseID);
                            if (ndb != null)
                            {
                                if (ndb.dwMonsterType == 3)
                                {
                                    return;
                                }
                            }
                        }
                        //defender.SendMessage( EntityMessage.EntityCommand_StopMove , defender.GetPos() );
                        //移动不播放受击动作
                        PlayAni anim_param = new PlayAni();
                        anim_param.strAcionName  = aniName;
                        anim_param.fSpeed        = 1;
                        anim_param.nStartFrame   = 0;
                        anim_param.nLoop         = 1;
                        anim_param.fBlendTime    = 0.2f;
                        anim_param.aniCallback   = OnHitCallback;
                        anim_param.callbackParam = defender;

                        //                         if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID()))
                        //                         {
                        //                             Engine.Utility.Log.Info("技能 播放受击动作 {0} {1}", anim_param.strAcionName, state);
                        //                         }
                        defender.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);
                    }
                    else
                    {
                        if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID()))
                        {
                            //Engine.Utility.Log.Info("移动不播放受击动作");
                        }
                    }
                }
                else
                {
                    //  Engine.Utility.Log.Error(string.Format("{0}技能状态错误不能播放受击动作 状态:{1}", defender.GetName(), GetTargetSkillState(defender)));
                }
            }
        }
Example #9
0
    private void OnDoingTask(QuestTraceInfo taskInfo)
    {
        DataManager.Manager <TaskDataManager>().DoingTaskID = taskInfo.taskId;

        Client.IController controller = Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl();
        if (controller == null)
        {
            Engine.Utility.Log.Error("IController is null");

            return;
        }
        table.QuestDataBase questDB = taskInfo.QuestTable;
        if (questDB == null)
        {
            Engine.Utility.Log.Error("QuestTable is null");
            return;
        }
        UnityEngine.Vector2 pos;
        uint    npcid = 0;
        PanelID pid;
        int     copyID;
        int     tab = 0;
        uint    jumpId;

        //背包满了  无法执行任务
        if (false == taskInfo.TaskItemCanPutInKanpsack())
        {
            TipsManager.Instance.ShowTips(LocalTextType.Task_Commond_3);
            return;
        }

        if (MainPlayerIsChangeBody())
        {
            return;
        }
        else if (taskInfo.taskSubType == TaskSubType.SubmitLimit) //断档任务
        {
            if (taskInfo.IsOpenUI(out jumpId))
            {
                ItemManager.DoJump(jumpId);
            }
            else
            {
                string des = string.Format("将等级提升到{0}级继续主线任务", taskInfo.finishLevel);
                TipsManager.Instance.ShowTips(des);
            }
            return;
        }
        else if (taskInfo.IsDynamicCommitItem) //动态道具递交(蚩尤乱世除外)
        {
            taskInfo.DoJump();
            return;
        }
        else if (DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy == false && taskInfo.IsOpenUI(out jumpId))
        {
            ItemManager.DoJump(jumpId);
            return;
        }
        else if (taskInfo.IsMoveToTargetPos(out pos))
        {
            //if (DataManager.Manager<TaskDataManager>().IsShowSlider)
            if (DataManager.Manager <SliderDataManager>().IsReadingSlider)
            {
                return;
            }
            Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
            if (cs == null)
            {
                return;
            }

            if (!m_bAddStopMoveListener)
            {
                m_bAddStopMoveListener = true;
                Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent);
            }

            if (EqualsMapID(questDB.destMapID))
            {
                cs.GetCombatRobot().Stop();
                DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
                {
                    //if (!m_bAddStopMoveListener)
                    //{
                    //    m_bAddStopMoveListener = true;
                    //    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent);
                    //}
                    m_nDoingTaskID = taskInfo.taskId;
                    controller.GotoMap(questDB.destMapID, new Vector3(pos.x, 0, -pos.y));
                }, null);
                return;
            }
            else
            {
                DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
                {
                    if (questDB.dwHelpDoing)
                    {
                        m_nDoingTaskID = taskInfo.taskId;

                        //下载地图检查
                        if (!KHttpDown.Instance().SceneFileExists(questDB.destMapID))
                        {
                            //打开下载界面
                            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                            return;
                        }

                        controller.GotoMapDirectly(questDB.destMapID, new Vector3(pos.x, 0, -pos.y), questDB.dwID);
                    }
                }, null);
            }
        }
        else if (taskInfo.IsVisitCollectNpc(out npcid) || taskInfo.IsDeleverItem(out npcid))
        {
            AddCollectNpcEffect(taskInfo);

            DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
            {
                VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID);
            }, null);
        }
        else if (taskInfo.IsDirectlyVisitCopy(taskInfo.copyId) && false == EqualsMapID(questDB.destMapID))
        {
            //直接跳副本
            VisitCopy(taskInfo.copyId);
        }
        else if (taskInfo.IsKillMonster(out npcid))
        {
            Client.ICombatRobot robot = Client.ClientGlobal.Instance().GetControllerSystem().GetCombatRobot();
            if (robot == null)
            {
                Engine.Utility.Log.Error("robotis null");

                return;
            }
            if (robot.Status == Client.CombatRobotStatus.RUNNING && robot.TargetId == npcid)
            {
                Engine.Utility.Log.Info("已经在挂机杀怪{0}", npcid);
                return;
            }
            //TODO 优化
            bool getPos = false;
            if (EqualsMapID(questDB.destMapID))
            {
                Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
                if (ms.GetClienNpcPos((int)npcid, out pos))
                {
                    getPos = true;
                    Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos();
                    if ((mainPos - new Vector3(pos.x, mainPos.y, -pos.y)).sqrMagnitude < 5)
                    {
                        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                        if (cs != null)
                        {
                            cs.GetCombatRobot().StartWithTarget((int)npcid);
                            Engine.Utility.Log.LogGroup("ZCX", "挂机杀怪物{0}", npcid);
                            return;
                        }
                    }
                }
            }

            DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
            {
                if (!m_bAddStopMoveListener)
                {
                    m_bAddStopMoveListener = true;
                    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent);
                }
                m_nDoingTaskID = taskInfo.taskId;
                if (getPos)
                {
                    controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true);
                }
                else if (EqualsMapID(questDB.destMapID))
                {
                    Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
                    if (ms.GetClienNpcPos((int)npcid, out pos))
                    {
                        controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true);
                    }
                }
                else
                {
                    VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID);
                }
            }, null);
        }
    }