Esempio n. 1
0
    public void NpcMouseEventHandler(object sender, MousePickable.RMouseClickEvent e)
    {
        Pathea.PeEntity npc = e.mousePickable.GetComponent <Pathea.PeEntity>();

        if (npc == null)
        {
            return;
        }

        float dist = Vector3.Distance(npc.position, GetPlayerPos());

        if (dist > 7)
        {
            return;
        }

        if (IsRandomNpc(npc) && npc.IsDead())
        {
            if (npc.Id == 9203 || npc.Id == 9204)
            {
                return;
            }

            if (npc.Id == 9214 || npc.Id == 9215)
            {
                if (!MissionManager.Instance.HasMission(MissionManager.m_SpecialMissionID10))
                {
                    return;
                }
            }

            if (GameConfig.IsMultiMode)
            {
                //if (null != PlayerFactory.mMainPlayer)
                //    PlayerFactory.mMainPlayer.RequestDeadObjItem(npc.OwnerView);
            }
            else
            {
                //if (GameUI.Instance.mItemGetGui.UpdateItem(npc))
                //{
                //    GameUI.Instance.mItemGetGui.Show();
                //}
            }

            if (npc.IsRecruited())
            {
                GameUI.Instance.mRevive.ShowServantRevive(npc);
            }

            return;
        }


        if (IsRandomNpc(npc) && npc.IsFollower())
        {
            return;
        }

        if (!npc.GetTalkEnable())
        {
            return;
        }

        if (IsRandomNpc(npc) && !npc.IsDead())
        {
            NpcMissionData missionData = npc.GetUserData() as NpcMissionData;
            if (null != missionData)
            {
                if (!MissionManager.Instance.HasMission(missionData.m_RandomMission))
                {
                    if (PeGameMgr.IsStory)
                    {
                        RMRepository.CreateRandomMission(missionData.m_RandomMission);
                    }
                    else if (PeGameMgr.IsMultiAdventure || PeGameMgr.IsMultiBuild)
                    {
                        PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_NewMission, missionData.m_RandomMission, npc.Id);
                    }
                    else
                    {
                        AdRMRepository.CreateRandomMission(missionData.m_RandomMission);
                    }
                }
            }
        }

        GameUI.Instance.mNpcWnd.SetCurSelNpc(npc);
        GameUI.Instance.mNpcWnd.Show();
    }