Esempio n. 1
0
        private IEntity GetNearestMonster()
        {
            Client.IPlayer mainplayer = ControllerSystem.m_ClientGlobal.MainPlayer;
            if (mainplayer == null)
            {
                return(null);
            }
            IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem();

            if (es == null)
            {
                return(null);
            }

            IMapSystem ms = ControllerSystem.m_ClientGlobal.GetMapSystem();

            if (ms == null)
            {
                return(null);
            }

            IEntity monster = null;

            if (m_nTargetID != 0)
            {
                monster = es.FindNPCByBaseId(m_nTargetID, true);
            }
            else
            {
                PLAYERPKMODEL     pkmodel = (PLAYERPKMODEL)mainplayer.GetProp((int)PlayerProp.PkMode);
                MapAreaType       atype   = ms.GetAreaTypeByPos(mainplayer.GetPos());
                IControllerHelper ch      = GetControllerHelper();
                if (ch != null)
                {
                    uint attackPriority = ch.GetAttackPriority();
                    monster = es.FindEntityByArea_PkModel(atype, pkmodel, m_centerPos, m_nSearchRang, attackPriority);
                }
            }

            return(monster);
        }