Exemplo n.º 1
0
        public void OnLoadDynamicMonsters(Monster monster)
        {
            MoRiMonsterTag tag = null;

            if (monster != null && (tag = (monster.Tag as MoRiMonsterTag)) != null)
            {
                MoRiJudgeCopy judgeCopy = null;
                lock (this.copyDict)
                {
                    if (!this.copyDict.TryGetValue(tag.CopySeqId, out judgeCopy))
                    {
                        return;
                    }
                }
                GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[]
                {
                    1,
                    this.BossConfigList[tag.MonsterIdx].Id,
                    judgeCopy.MonsterList[tag.MonsterIdx].BirthMs,
                    judgeCopy.MonsterList[tag.MonsterIdx].DeathMs
                }), judgeCopy.MyCopyMap, false);
                long toTick = TimeUtil.NowDateTime().Ticks + 36000000000L;
                if (tag.ExtPropDict != null)
                {
                    foreach (KeyValuePair <int, float> kvp in tag.ExtPropDict)
                    {
                        monster.TempPropsBuffer.AddTempExtProp(kvp.Key, (double)kvp.Value, toTick);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void OnLoadDynamicMonsters(Monster monster)
        {
            MoRiMonsterTag tag = null;

            if (monster == null || (tag = monster.Tag as MoRiMonsterTag) == null)
            {
                return;
            }

            MoRiJudgeCopy judgeCopy = null;

            lock (copyDict)
            {
                if (!copyDict.TryGetValue(tag.CopySeqId, out judgeCopy))
                {
                    return;
                }
            }

            // 通知怪物出生
            GameManager.ClientMgr.BroadSpecialCopyMapMessageStr((int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT,
                                                                string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Birth, BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs), judgeCopy.MyCopyMap);


            // 增强临时属性,副本时间只有15分钟,只有就暂时加1个小时吧,因为是永久加成的
            long toTick = TimeUtil.NowDateTime().Ticks + 3600L * 1000 * 10000;

            if (tag.ExtPropDict != null)
            {
                foreach (var kvp in tag.ExtPropDict)
                {
                    monster.TempPropsBuffer.AddTempExtProp(kvp.Key, kvp.Value, toTick);
                }
            }
        }
Exemplo n.º 3
0
        private void FlushMonster(MoRiJudgeCopy judgeCopy, int nextMonsterIdx)
        {
            MoRiMonsterTag tag = new MoRiMonsterTag();

            tag.CopySeqId   = judgeCopy.MyCopyMap.FuBenSeqID;
            tag.MonsterIdx  = nextMonsterIdx;
            tag.ExtPropDict = null;

            // 刷怪
            if (nextMonsterIdx == BossConfigList.Count - 1)
            {
                tag.ExtPropDict = new Dictionary <int, float>();
                // 刷boss
                for (int i = 0; i < judgeCopy.MonsterList.Count && i < judgeCopy.CurrMonsterIdx; ++i)
                {
                    if (BossConfigList[i].KillLimitSecond != -1 &&
                        (judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs) <= BossConfigList[i].KillLimitSecond * 1000L)
                    {
                        // 完成了限时击杀,需要给boss加成
                        foreach (var kvp in BossConfigList[i].ExtPropDict)
                        {
                            if (tag.ExtPropDict.ContainsKey(kvp.Key))
                            {
                                tag.ExtPropDict[kvp.Key] += kvp.Value;
                            }
                            else
                            {
                                tag.ExtPropDict.Add(kvp.Key, kvp.Value);
                            }
                        }
                    }
                }
            }

            GameManager.MonsterZoneMgr.AddDynamicMonsters(this.MapCode, BossConfigList[nextMonsterIdx].MonsterId,
                                                          judgeCopy.MyCopyMap.CopyMapID, 1,
                                                          BossConfigList[nextMonsterIdx].BirthX / copyMapGirdWidth, BossConfigList[nextMonsterIdx].BirthY / copyMapGirdHeight, 0, 0,
                                                          SceneUIClasses.MoRiJudge, tag);

            judgeCopy.MonsterList.Add(new MoRiMonsterData()
            {
                Id      = BossConfigList[nextMonsterIdx].Id,
                BirthMs = TimeUtil.NOW(),
                DeathMs = -1
            });

            judgeCopy.CurrMonsterIdx = nextMonsterIdx;
        }
Exemplo n.º 4
0
 public void processEvent(EventObject eventObject)
 {
     if (eventObject.getEventType() == 11)
     {
         MonsterDeadEventObject deadEv = eventObject as MonsterDeadEventObject;
         if (deadEv.getAttacker().ClientData.CopyMapID > 0 && deadEv.getAttacker().ClientData.FuBenSeqID > 0 && deadEv.getAttacker().ClientData.MapCode == this.MapCode && deadEv.getMonster().CurrentMapCode == this.MapCode)
         {
             MoRiMonsterTag tag = deadEv.getMonster().Tag as MoRiMonsterTag;
             if (tag != null)
             {
                 MoRiJudgeCopy judgeCopy = null;
                 lock (this.copyDict)
                 {
                     if (!this.copyDict.TryGetValue(tag.CopySeqId, out judgeCopy))
                     {
                         return;
                     }
                 }
                 lock (judgeCopy)
                 {
                     if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                     {
                         if (judgeCopy.MonsterList[tag.MonsterIdx].DeathMs <= 0L)
                         {
                             judgeCopy.MonsterList[tag.MonsterIdx].DeathMs = TimeUtil.NOW();
                             GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[]
                             {
                                 2,
                                 this.BossConfigList[tag.MonsterIdx].Id,
                                 judgeCopy.MonsterList[tag.MonsterIdx].BirthMs,
                                 judgeCopy.MonsterList[tag.MonsterIdx].DeathMs
                             }), judgeCopy.MyCopyMap, false);
                             this.CalcAwardRate(judgeCopy);
                             if (judgeCopy.MonsterList.Count == this.BossConfigList.Count)
                             {
                                 judgeCopy.Passed    = true;
                                 judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        private void FlushMonster(MoRiJudgeCopy judgeCopy, int nextMonsterIdx)
        {
            MoRiMonsterTag tag = new MoRiMonsterTag();

            tag.CopySeqId   = judgeCopy.MyCopyMap.FuBenSeqID;
            tag.MonsterIdx  = nextMonsterIdx;
            tag.ExtPropDict = null;
            if (nextMonsterIdx == this.BossConfigList.Count - 1)
            {
                tag.ExtPropDict = new Dictionary <int, float>();
                int i = 0;
                while (i < judgeCopy.MonsterList.Count && i < judgeCopy.CurrMonsterIdx)
                {
                    if (this.BossConfigList[i].KillLimitSecond != -1 && judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs <= (long)this.BossConfigList[i].KillLimitSecond * 1000L)
                    {
                        foreach (KeyValuePair <int, float> kvp in this.BossConfigList[i].ExtPropDict)
                        {
                            if (tag.ExtPropDict.ContainsKey(kvp.Key))
                            {
                                Dictionary <int, float> extPropDict;
                                int key;
                                (extPropDict = tag.ExtPropDict)[key = kvp.Key] = extPropDict[key] + kvp.Value;
                            }
                            else
                            {
                                tag.ExtPropDict.Add(kvp.Key, kvp.Value);
                            }
                        }
                    }
                    i++;
                }
            }
            GameManager.MonsterZoneMgr.AddDynamicMonsters(this.MapCode, this.BossConfigList[nextMonsterIdx].MonsterId, judgeCopy.MyCopyMap.CopyMapID, 1, this.BossConfigList[nextMonsterIdx].BirthX / this.copyMapGirdWidth, this.BossConfigList[nextMonsterIdx].BirthY / this.copyMapGirdHeight, 0, 0, SceneUIClasses.MoRiJudge, tag, null);
            judgeCopy.MonsterList.Add(new MoRiMonsterData
            {
                Id      = this.BossConfigList[nextMonsterIdx].Id,
                BirthMs = TimeUtil.NOW(),
                DeathMs = -1L
            });
            judgeCopy.CurrMonsterIdx = nextMonsterIdx;
        }
Exemplo n.º 6
0
        public void processEvent(EventObject eventObject)
        {
            if (eventObject.getEventType() == (int)EventTypes.MonsterDead)
            {
                MonsterDeadEventObject deadEv = eventObject as MonsterDeadEventObject;
                if (deadEv.getAttacker().ClientData.CopyMapID > 0 && deadEv.getAttacker().ClientData.FuBenSeqID > 0 &&
                    deadEv.getAttacker().ClientData.MapCode == this.MapCode &&
                    deadEv.getMonster().CurrentMapCode == this.MapCode
                    )
                {
                    MoRiMonsterTag tag = deadEv.getMonster().Tag as MoRiMonsterTag;
                    if (tag == null)
                    {
                        return;
                    }

                    MoRiJudgeCopy judgeCopy = null;
                    lock (copyDict)
                    {
                        if (!copyDict.TryGetValue(tag.CopySeqId, out judgeCopy))
                        {
                            return;
                        }
                    }

                    long killMs = 0;
                    lock (judgeCopy)
                    {
                        // 只有在战斗阶段的杀怪才有效
                        if (judgeCopy.m_eStatus != GameSceneStatuses.STATUS_BEGIN)
                        {
                            return;
                        }

                        // 只有一条命
                        if (judgeCopy.MonsterList[tag.MonsterIdx].DeathMs > 0)
                        {
                            return;
                        }

                        judgeCopy.MonsterList[tag.MonsterIdx].DeathMs = TimeUtil.NOW();


                        // 通知怪物死亡事件
                        GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(
                            (int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT,
                            string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Death, BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs),
                            judgeCopy.MyCopyMap);

                        CalcAwardRate(judgeCopy);

                        /*
                         * FuBenInfoItem fbItem = FuBenManager.FindFuBenInfoBySeqID(judgeCopy.MyCopyMap.FuBenSeqID);
                         * if (fbItem != null)
                         * {
                         *  fbItem.AwardRate += CalcAwardRate(judgeCopy);
                         * }*/

                        if (judgeCopy.MonsterList.Count == BossConfigList.Count)
                        {
                            judgeCopy.Passed    = true;
                            judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END;
                        }
                    }
                }
            }
        }