private static void __InstanceKillMonster_Listener(EventDispatcher listener, object data)
        {
            //获取副本数据
            ChallengeInstance instance = listener as ChallengeInstance;

            if (null == instance || null == instance.mCopyTplData)
            {
                return;
            }

            NPCInstance target = data as NPCInstance;

            if (null == target)
            {
                return;
            }

            instance.mKilledMobNum++;
            if (instance.mCopyTplData.targetId == 0) //杀光所有怪物
            {
                if (instance.mKilledMobNum == instance.mTotalMobNum)
                {
                    instance.OnFinish(true);
                }
            }
            else
            {
                if (instance.mCopyTplData.targetId == target.NPCData.TemplateId)
                {
                    instance.OnFinish(true);
                }
            }
        }
Beispiel #2
0
        private static void __InstanceProtectTarget_Listener(EventDispatcher listener, object data)
        {
            //获取副本数据
            ChallengeInstance instance = listener as ChallengeInstance;

            if (null == instance || null == instance.mCopyTplData)
            {
                return;
            }

            NPCInstance target = data as NPCInstance;

            if (null == target)
            {
                return;
            }

            instance.mKilledMobNum++;
            if (instance.mCopyTplData.targetId == target.NPCData.TemplateId) //保护目标已死,任务失败
            {
                instance.OnFinish(false);
            }
            else
            {
                if (instance.mKilledMobNum == instance.mTotalMobNum)
                {
                    NPCInstance protectTarget = instance.GetNPC(instance.mCopyTplData.targetId);
                    if (null != protectTarget && !protectTarget.IsDie)
                    {
                        instance.OnFinish(true);
                    }
                }
            }
        }
        private static void __InstanceGatherItem_Listener(EventDispatcher listener, object data)
        {
            //获取副本数据
            ChallengeInstance instance = listener as ChallengeInstance;

            if (null == instance || null == instance.mCopyTplData)
            {
                return;
            }
        }
Beispiel #4
0
        public MapInstance CreateMapInstance(PlanesInstance planes, ulong mapInstanceId, ushort mapSourceId, PlayerInstance creater)
        {
            for (UInt16 i = 0; i < UInt16.MaxValue; i++)
            {
                if (mAllMaps[i] == null)
                {
                    var info = MapInstanceManager.GetMapInitBySourceId(mapSourceId);
                    if (info == null)
                    {
                        return(new NullMapInstance());
                    }
                    var         mapType = (CSCommon.eMapType)info.MapData.mapType;
                    MapInstance map     = null;
                    switch (mapType)
                    {
                    case CSCommon.eMapType.World:
                        map = new WolrdMap();
                        break;

                    case CSCommon.eMapType.NULL:
                        map = new NullMapInstance();
                        break;

                    case CSCommon.eMapType.InstanceStart:
                        map = new NullMapInstance();
                        break;

                    case CSCommon.eMapType.Master:
                        map = new MasterInstance();
                        break;

                    case CSCommon.eMapType.Arena:
                        map = new ArenaInstance();
                        break;

                    case CSCommon.eMapType.Challenge:
                        map = new ChallengeInstance();
                        break;

                    case CSCommon.eMapType.BattelStart:
                        break;

                    default:
                        map = new NullMapInstance();
                        break;
                    }
                    if (map == null)
                    {
                        return(new NullMapInstance());
                    }

                    if (map.InitMap(planes, i, mapInstanceId, info, creater))
                    {
                        mAllMaps[i] = map;
                        LogicProcessorManager.Instance.PushMap(map);
                        return(map);
                    }
                    else
                    {
                        Log.FileLog.WriteLine("CreateMapInstance {0} Failed", mapSourceId);
                        return(null);
                    }
                }
            }
            return(null);
        }