Пример #1
0
    private void OnExecuteTask(uint nTaskID)
    {
        QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID);

        if (questInfo == null)
        {
            Engine.Utility.Log.Error(" Get questinfo error {0}", nTaskID);
            return;
        }

        uint npcid = 0;

        if (questInfo.IsKillMonster(out npcid))
        {
            Client.ISkillPart skillPart = Client.ClientGlobal.Instance().MainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            if (skillPart != null)
            {
                if (skillPart.GetCurSkillState() != (int)Client.SkillState.None)
                {
                    m_nDoingTaskID = nTaskID;
                    if (m_bAddSkillNoneListener)
                    {
                        return;
                    }
                    m_bAddSkillNoneListener = true;
                    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.SKILLNONESTATE_ENTER, OnEvent);
                    Engine.Utility.Log.Info("等待.......技能播放完毕 执行任务{0}  {1}", m_nDoingTaskID, Client.ClientGlobal.Instance().MainPlayer.GetCurState());
                    return;
                }
            }
        }
        ProcessTask(questInfo);
    }
Пример #2
0
    private void OnTaskCanCommit(uint nTaskID)
    {
        QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID);

        if (questInfo == null)
        {
            Engine.Utility.Log.Error(" Get questinfo error {0}", nTaskID);
            return;
        }
        if (!questInfo.QuestTable.dwAutoCommit)
        {
            return;
        }

        Client.ISkillPart skillPart = Client.ClientGlobal.Instance().MainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
        if (skillPart != null)
        {
            if (skillPart.GetCurSkillState() != (int)Client.SkillState.None)
            {
                m_nDoingTaskID = nTaskID;
                Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.SKILLNONESTATE_ENTER, OnEvent);
                Engine.Utility.Log.Info("等待.......技能播放完毕 执行任务{0} {1}", m_nDoingTaskID, Client.ClientGlobal.Instance().MainPlayer.GetCurState());
                StopRobot();
                return;
            }
        }

        ProcessTask(questInfo);
    }
Пример #3
0
    static bool EntityCanAttack(IEntity entity)
    {
        bool canAttack = true;

        Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart;
        if (skillPart != null)
        {
            int skillerror = 0;
            canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror);
        }
        return(canAttack);
    }
Пример #4
0
    public void AddSkillCD(uint skillid, int cd)
    {
        if (m_dictskill == null)
        {
            Client.IPlayer    player      = Client.ClientGlobal.Instance().MainPlayer;
            Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            m_dictskill = m_skillPart.GetCurSkills();
        }
        table.SkillDatabase skillTable = null;
        if (m_dictskill.ContainsKey(skillid))
        {
            skillTable = m_dictskill[skillid];
        }
        if (skillTable == null)
        {
            skillTable = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillid);
        }

        if (skillTable != null)
        {
            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            if (cd == -1)
            {
                m_dictSkillCD[skillid].totalTime = skillTable.dwIntervalTime;
            }
            else
            {
                m_dictSkillCD[skillid].totalTime = cd;
            }
            m_dictSkillCD[skillid].skillid  = (int)skillid;
            m_dictSkillCD[skillid].currTime = m_dictSkillCD[skillid].totalTime;
        }
        else
        {
            table.RideSkillDes rideskill = GameTableManager.Instance.GetTableItem <table.RideSkillDes>(skillid);
            if (rideskill == null)
            {
                return;
            }
            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            m_dictSkillCD[skillid].totalTime = rideskill.skillCD;
            m_dictSkillCD[skillid].skillid   = (int)skillid;
            m_dictSkillCD[skillid].currTime  = rideskill.skillCD;
        }
    }
Пример #5
0
        void InitSkill()
        {
            IPlayer mainPlayer = ControllerSystem.m_ClientGlobal.MainPlayer;

            if (mainPlayer == null)
            {
                Engine.Utility.Log.Error("MainPlayer is NULL");
                return;
            }
            m_skillPart = mainPlayer.GetPart(Client.EntityPart.Skill) as ISkillPart;
            if (m_skillPart == null)
            {
                Engine.Utility.Log.Error("MainPlayer SKILLPART is NULL");
                return;
            }

            m_nSkillUseIndex = 1;
            m_uNextSkill     = 0;
            if (m_skillPart != null)
            {
                m_lstSkills = m_skillPart.GetCurStateSkillList();

                if (m_lstSkills == null)
                {
                    Engine.Utility.Log.Error("MainPlayer SKILLPART is NULL");
                    return;
                }

                for (int i = 0; i < m_lstSkills.Count; i++)
                {
                    if (!m_lstSkills[i].autoplay)
                    {
                        m_lstSkills.RemoveAt(i);
                        i--;
                    }
                }

                if (m_CombatRobotMono != null)
                {
                    m_CombatRobotMono.m_lstSkillids.Clear();
                    if (m_lstSkills != null)
                    {
                        for (int i = 0; i < m_lstSkills.Count; i++)
                        {
                            m_CombatRobotMono.m_lstSkillids.Add((int)m_lstSkills[i].wdID);
                        }
                    }
                }
            }
        }
Пример #6
0
    //public void AddSkillCD(uint skillid)
    //{
    //    if (m_dictskill == null)
    //    {
    //        Client.IPlayer player = Client.ClientGlobal.Instance().MainPlayer;
    //        Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
    //        m_dictskill = m_skillPart.GetCurSkills();
    //    }
    //    table.SkillDatabase skillTable = null;
    //    if (m_dictskill.ContainsKey(skillid))
    //    {
    //        skillTable =  m_dictskill[skillid];
    //    }
    //    if (skillTable == null)
    //    {
    //        skillTable = GameTableManager.Instance.GetTableItem<table.SkillDatabase>(skillid);
    //    }

    //    if (skillTable != null)
    //    {
    //        if (!m_dictSkillCD.ContainsKey(skillid))
    //        {
    //            m_dictSkillCD.Add(skillid, new SkillCDInfo());
    //            cdkeys.Add(skillid);
    //        }
    //        m_dictSkillCD[skillid].totalTime = skillTable.dwIntervalTime;
    //        m_dictSkillCD[skillid].skillid = (int)skillid;
    //        m_dictSkillCD[skillid].currTime = skillTable.dwIntervalTime;
    //    }
    //    else
    //    {
    //        table.RideSkillDes rideskill = GameTableManager.Instance.GetTableItem<table.RideSkillDes>(skillid);
    //        if (rideskill == null)
    //        {
    //            return;
    //        }
    //        if (!m_dictSkillCD.ContainsKey(skillid))
    //        {
    //            m_dictSkillCD.Add(skillid, new SkillCDInfo());
    //            cdkeys.Add(skillid);
    //        }
    //        m_dictSkillCD[skillid].totalTime = rideskill.skillCD;
    //        m_dictSkillCD[skillid].skillid = (int)skillid;
    //        m_dictSkillCD[skillid].currTime = rideskill.skillCD;
    //    }
    //}

    public void AddCommonSkillCD(uint skillid)
    {
        if (m_dictskill == null)
        {
            Client.IPlayer    player      = Client.ClientGlobal.Instance().MainPlayer;
            Client.ISkillPart m_skillPart = player.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            m_dictskill = m_skillPart.GetCurSkills();
        }
        table.SkillDatabase skillTable = null;
        if (m_dictskill.ContainsKey(skillid))
        {
            skillTable = m_dictskill[skillid];

            if (!m_dictSkillCD.ContainsKey(skillid))
            {
                m_dictSkillCD.Add(skillid, new SkillCDInfo());
                cdkeys.Add(skillid);
            }
            m_dictSkillCD[skillid].totalTime = skillTable.dwCommonCDTime;
            m_dictSkillCD[skillid].skillid   = (int)skillid;
            m_dictSkillCD[skillid].currTime  = skillTable.dwCommonCDTime;
        }
    }
Пример #7
0
 public static bool IsNeedHpSlider(Client.IEntity entity)
 {
     if (entity.GetEntityType() == EntityType.EntityType_NPC)
     {
         INPC npc = entity as INPC;
         //是可以攻击的NPC
         if (npc.IsCanAttackNPC())
         {
             Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart;
             bool canAttack = true;
             if (skillPart != null)
             {
                 int skillerror = 0;
                 canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror);
             }
             if (npc.IsPet())
             {
                 if (npc.IsMainPlayerSlave())
                 {
                     return(true);
                 }
                 else
                 {
                     if (canAttack)
                     {
                         return(true);
                     }
                 }
                 return(false);
             }
             else if (npc.IsSummon())
             {
                 if (npc.IsMainPlayerSlave())
                 {
                     return(true);
                 }
                 else
                 {
                     if (canAttack)
                     {
                         return(true);
                     }
                 }
                 return(false);
             }
             else if (npc.IsMonster())
             {
                 int hp    = entity.GetProp((int)CreatureProp.Hp);
                 int maxhp = entity.GetProp((int)CreatureProp.MaxHp);
                 return(hp < maxhp);
             }
         }
         else
         {
             table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID));
             if (npcdb != null)
             {
                 if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_TRANSFER || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT ||
                     npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_FUNCTION)
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
Пример #8
0
    /// <summary>
    /// 请求读条上马
    /// </summary>
    public bool TryUsingRide(Action <object> callback, object param)
    {
        Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
        if (ms == null)
        {
            return(false);
        }
        table.MapDataBase mapdata = GameTableManager.Instance.GetTableItem <table.MapDataBase>(ms.GetMapID());
        if (mapdata == null)
        {
            return(false);
        }

        if (mapdata.canUsingRide != 1)
        {
            TipsManager.Instance.ShowTips("该地图不能上马");
            if (callback != null)
            {
                callback(param);
            }
            return(false);
        }
        Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            Client.ISkillPart skillpart = mainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            if (skillpart != null)
            {
                if (skillpart.GetCurSkillState() != (int)Client.SkillState.None)
                {
                    TipsManager.Instance.ShowTips(LocalTextType.Ride_Commond_shifangjinengzhongwufashangma);
                    if (callback != null)
                    {
                        callback(param);
                    }
                    return(false);
                }
            }
            bool isChangeBody = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsChange, null);
            if (isChangeBody)
            {
                if (callback != null)
                {
                    callback(param);
                }
                return(false);
            }
            bool bRide = DataManager.Manager <RideManager>().IsRide;
            if (bRide)
            {
                if (callback != null)
                {
                    callback(param);
                }
                return(false);
            }
            else if (Auto_Ride == 0)
            {
                if (callback != null)
                {
                    callback(param);
                }
                return(false);
            }
        }

        UsingRideCallback      = callback;
        UsingRideCallbackParam = param;
        if (Auto_Ride != 0)
        {
            //先发送读条 读条 结束在上马
            Client.stUninterruptMagic stparam = new Client.stUninterruptMagic();
            if (GetRideDataById(Auto_Ride) != null)
            {
                stparam.time = GetRideDataById(Auto_Ride).spellTime;
            }
            stparam.type = GameCmd.UninterruptActionType.UninterruptActionType_DEMON;
            stparam.uid  = MainPlayerHelper.GetPlayerUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART, stparam);
            //NetService.Instance.Send(new stUsingRideUserCmd_C());
        }
        return(true);
    }
Пример #9
0
    EntityHpSprite GetSpiteName(IEntity entity)
    {
        EntityHpSprite spriteParams = new EntityHpSprite();

        spriteParams.spriteType = UISprite.Type.Filled;
        bool needHp = RoleStateBarManagerOld.Instance().IsNeedHpSlider(entity);

        Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart;
        bool canAttack = true;

        if (skillPart != null)
        {
            int skillerror = 0;
            canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror);
        }
        if (entity.GetEntityType() == EntityType.EntityType_Player)
        {
            GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp);
            GameCmd.eCamp camp   = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp);
            spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg);
            if (entity == MainPlayerHelper.GetMainPlayer())
            {
                spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Me);
            }
            else
            {
                if (canAttack)
                {
                    spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Enemy);
                }
                else
                {
                    spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend);
                }
            }
            spriteParams.bShow = true;
        }
        else if (entity.GetEntityType() == EntityType.EntityType_NPC)
        {
            INPC npc = entity as INPC;
            //任意NPC先给一个默认的血条
            spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.NoneBg);
            spriteParams.spriteName   = RoleStateBarManager.GetHpSpriteName(HpSpriteType.None);
            spriteParams.bShow        = needHp;
            //是可以攻击的NPC
            if (npc.IsCanAttackNPC())
            {
                //是不是佣兵
                if (npc.IsMercenary())
                {
                    spriteParams.spriteName   = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend);
                    spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg);
                    spriteParams.bShow        = true;
                }
                else
                {
                    if (npc.IsPet())
                    {
                        spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PetBg);
                        if (npc.IsMainPlayerSlave())
                        {
                            spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MyPet);
                        }
                        else
                        {
                            if (canAttack)
                            {
                                spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.EnemyPet);
                            }
                        }
                    }
                    else if (npc.IsSummon())
                    {
                        spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.SummonBg);
                        if (npc.IsMainPlayerSlave())
                        {
                            spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MySummon);
                        }
                        else
                        {
                            if (canAttack)
                            {
                                spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.EnemySummon);
                            }
                        }
                    }
                    else if (npc.IsMonster())
                    {
                        spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MonsterBg);
                        spriteParams.spriteName   = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Monster);
                        spriteParams.spriteType   = UISprite.Type.Simple;
                    }
                }
            }
        }
        else if (entity.GetEntityType() == EntityType.EntityTYpe_Robot)
        {
            GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp);
            GameCmd.eCamp camp   = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp);
            spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg);
            if (entity == MainPlayerHelper.GetMainPlayer())
            {
                spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Me);
            }
            else
            {
                if (canAttack)
                {
                    spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Enemy);
                }
                else
                {
                    spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend);
                }
            }
            spriteParams.bShow = true;
        }


        return(spriteParams);
    }
Пример #10
0
    private void OnCommitTask(QuestTraceInfo taskInfo)
    {
        table.QuestDataBase questDB = taskInfo.QuestTable;
        if (questDB == null)
        {
            Engine.Utility.Log.Error("QuestTable is null");
            return;
        }

        if (taskInfo.taskSubType == TaskSubType.Guild)
        {
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MissionMessagePanel, data: taskInfo.taskId);
            return;
        }

        PanelID pid;
        int     tab    = 0;
        int     copyId = 0;

        uint jumpId;

        if (taskInfo.IsOpenUI(out jumpId))
        {
            ItemManager.DoJump(jumpId);
            return;
        }
        else if (taskInfo.IsChangeBodyTask())
        {
            //bool isChange = (bool)Client.ClientGlobal.Instance().MainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsChange, null);
            //if (!isChange)
            //{
            //    m_nDoingTaskID = taskInfo.taskId;
            //    if (m_bAddChangeListener)
            //    {
            //        return;
            //    }

            //    m_bAddChangeListener = true;
            //    Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID);
            //    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent);
            //    return;
            //}

            m_nDoingTaskID = taskInfo.taskId;
            if (false == m_bAddChangeListener && false == MainPlayerIsChangeBody())
            {
                m_bAddChangeListener = true;
                Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID);
                Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent);
            }

            VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID);
            return;
        }
        uint npcid = 0;

        if (taskInfo.IsKillMonster(out npcid))
        {
            Client.ISkillPart skillPart = Client.ClientGlobal.Instance().MainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            if (skillPart != null)
            {
                if (skillPart.GetCurSkillState() != (int)Client.SkillState.None)
                {
                    m_nDoingTaskID = taskInfo.taskId;
                    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.SKILLNONESTATE_ENTER, OnEvent);
                    Engine.Utility.Log.Info("等待.......技能播放完毕 执行任务{0}", m_nDoingTaskID);
                    return;
                }
            }
        }

        //令牌悬赏无交任务npc
        if (taskInfo.taskType != GameCmd.TaskType.TaskType_Token)
        {
            DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
            {
                VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID);
            }, null);
        }
    }