Exemplo n.º 1
0
    static public void CreateDummy(uint eid, int x, int y, int cfgId, int difficulty, int spawnPointCfgId)
    {
        //LoggerHelper.Error("CreateDummy difficulty:" + difficulty);
        if (!MonsterData.dataMap.ContainsKey(cfgId))
        {
            return;
        }
        MonsterData m = MonsterData.GetData(cfgId, MogoWorld.thePlayer.ApplyMissionID == Mogo.Game.RandomFB.RAIDID ? MogoWorld.thePlayer.level : difficulty);
        EntityDummy entity = new EntityDummy();
        CellAttachedInfo info = new CellAttachedInfo();
        info.x = (short)x;
        info.y = (short)y;
        info.id = eid;
        entity.spawnPointCfgId = spawnPointCfgId;
        entity.MonsterData = m;
        entity.ID = eid;
        entity.clientTrapId = m.clientTrapId;
        entity.SetEntityCellInfo(info);
        if (m.clientBoss == 1)
        {//为体验关特制
            entity.stateFlag = 1 << 13;
        }
        entity.SetCfg(m);
        //entity.curHp = (uint)currHp;因为现在不用重新登录刷怪,所以直接前端设一次就够了,现在curHp换成difficulty了,如果大于0则要根据difficulty匹配怪物的能力in MonsterValue
        entity.OnEnterWorld();

        entity.enterX = (short)x;
        entity.enterZ = (short)y;
        OnEnterWorld(entity);

        if (isLoadingScene)//在副本下线重新登录后isLoadingScene没有置回去false 导致dummy刷不出
        {
            //entity.ReadyCreateModel();
        }
        else
        {
            TimerHeap.AddTimer(1000, 0, DelayCreateDummy, entity);
        }
    }
Exemplo n.º 2
0
 static private void DelayCreateDummy(EntityDummy e)
 {
     if (!mainCameraCompleted)
     {
         TimerHeap.AddTimer(1000, 0, DelayCreateDummy, e);
         return;
     }
     e.ReadyCreateModel();
 }
Exemplo n.º 3
0
    // 协议处理函数, 新的 entity 进入视野
    static private void AOINewEntity(CellAttachedInfo info)
    {
        // todo:  先硬编码, 以后改成 从 def 中 自动化
        EntityParent entity;
        LoggerHelper.Debug(info.entity.Name);
        if (isReConnect && !mainCameraCompleted)
        {//断线重连场景没加载完,缓存起来
            others.Add(info);
            return;
        }
        if (Entities.ContainsKey(info.id) || (thePlayer != null && thePlayer.ID == info.id))
        {
            LoggerHelper.Debug("has same id entity in world");
            return;
        }
        if ((info.entity.Name == "Monster" ||
            info.entity.Name == "Mercenary" ||
            info.entity.Name == "Drop") && inCity)
        {
            //主城不出现Monster Mercenary,用于切场景的瞬间收到创建协议
            return;
        }
        switch (info.entity.Name)
        {
            case "Avatar"://对应Avatar.def
                if (SystemConfig.Instance.PlayerCountInScreen <= playerCount
                    || (MogoWorld.thePlayer != null && MogoWorld.thePlayer.IsNewPlayer))
                {
                    LoggerHelper.Debug("EntityPlayer over count: " + playerCount);
                    return;
                }
                if (MogoWorld.IsClientMission)
                {
                    return;
                }
                entity = new EntityPlayer();
                entity.vocation = Vocation.Warrior;
                break;
            case "NPC"://对应NPC.def
                // entity = new EntityNPC();
                entity = new EntityParent();
                break;
            case "Monster": //对应Monster.def
                entity = new EntityMonster();
                break;
            case "Mercenary": //对应Monster.def
                entity = new EntityMercenary();
                break;
            case "Drop": //对应Drop.def
                entity = new EntityDrop();
                Vector3 newPosi = MogoWorld.FindEmptyDropPoint(info.position);
                (entity as EntityDrop).SetTweenTarget(newPosi);
                //LoggerHelper.Error("f**k end " + info.id + " n " + newPosi.x + " " + newPosi.y + " " + newPosi.z);
                break;
            case "TeleportPointSrc": //对应TeleportPointSrc.def
                entity = new EntityTeleportSrc();
                break;
            case "Dummy": //CMonster.def
                entity = new EntityDummy();
                break;
            default:
                entity = new EntityParent();
                break;
        }
        entity.ID = info.id;
        entity.entity = info.entity;
        entity.SetEntityCellInfo(info);
        entity.OnEnterWorld();
        if (!isLoadingScene)
            entity.CreateModel();
        //LoggerHelper.Error("AOINewEntity: etype: " + info.entity.Name + " eid: " + entity.ID + " pos: " + entity.position);
        OnEnterWorld(entity);

        EventDispatcher.TriggerEvent(Events.CampaignEvent.SetPlayerMessage, entity);
    }