Beispiel #1
0
        private void CalcKillIncome(UserInfo user)
        {
            long curTime = TimeUtility.GetServerMilliseconds();

            if (m_IsPvpScene)
            {
                int lvl2 = user.GetLevel();
                int lvl1 = lvl2 - 1;
                if (lvl1 < 0)
                {
                    lvl1 = 0;
                }
                PlayerLevelupExpConfig cfg1 = PlayerConfigProvider.Instance.GetPlayerLevelupExpConfigById(lvl1);
                PlayerLevelupExpConfig cfg2 = PlayerConfigProvider.Instance.GetPlayerLevelupExpConfigById(lvl2);
                if (null != cfg1 && null != cfg2)
                {
                    int      exp    = (cfg2.m_ConsumeExp - cfg1.m_ConsumeExp) * 70 / 100;
                    UserInfo killer = UserManager.GetUserInfo(user.KillerId);
                    if (null != killer)
                    {
                        //被英雄击杀连杀数清0
                        user.GetCombatStatisticInfo().ClearContinueKillCount();
                        //击杀英雄连死数清0
                        killer.GetCombatStatisticInfo().ClearContinueDeadCount();

                        user.GetCombatStatisticInfo().AddContinueDeadCount(1);
                        killer.GetCombatStatisticInfo().AddContinueKillCount(1);

                        killer.GetCombatStatisticInfo().AddKillHeroCount(1);
                        if (killer.GetCombatStatisticInfo().LastKillHeroTime + 10000 < curTime)
                        {
                            killer.GetCombatStatisticInfo().ClearMultiKillCount();
                        }
                        killer.GetCombatStatisticInfo().AddMultiKillCount(1);
                        killer.GetCombatStatisticInfo().LastKillHeroTime = curTime;

                        User us       = killer.CustomData as User;
                        User killedUs = user.CustomData as User;
                        if (us != null && killedUs != null)
                        {
                            CalcPvpCombatInfo(killer.GetLinkId(), user.GetLinkId(), us.Name, killedUs.Name);
                        }
                        if (user.AttackerInfos.Count > 0)
                        {
                            foreach (int id in user.AttackerInfos.Keys)
                            {
                                UserInfo assit = UserManager.GetUserInfo(id);
                                CharacterInfo.AttackerInfo attackInfo = user.AttackerInfos[id];
                                if (null != assit && killer != assit && attackInfo.m_AttackTime + 5000 >= curTime)
                                {
                                    assit.GetCombatStatisticInfo().AddAssitKillCount(1);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void TickUsers()
        {
            for (LinkedListNode <UserInfo> linkNode = UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next)
            {
                UserInfo info = linkNode.Value;
                if (info.GetEquipmentStateInfo().EquipmentChanged)
                {
                    RefreshItemSkills(info);
                }
                if (info.LevelChanged || info.GetSkillStateInfo().BuffChanged || info.GetEquipmentStateInfo().EquipmentChanged || info.GetLegacyStateInfo().LegacyChanged)
                {
                    UserAttrCalculator.Calc(info);
                    info.LevelChanged = false;
                    info.GetSkillStateInfo().BuffChanged          = false;
                    info.GetEquipmentStateInfo().EquipmentChanged = false;
                    info.GetLegacyStateInfo().LegacyChanged       = false;
                }
                if (info.Hp <= 0)
                {
                    if (info.DeadTime <= 0)
                    {
                        //计算击杀收益
                        CalcKillIncome(info);
                        info.GetCombatStatisticInfo().AddDeadCount(1);  //死亡计数+1
                                                                        //解除控制
                        ReleaseControl(info);
                        //发送玩家死亡消息
                        Msg_RC_Dead build = new Msg_RC_Dead();
                        build.role_id = info.GetId();
                        NotifyAllUser(build);
                        PlayerLevelupExpConfig cfg = PlayerConfigProvider.Instance.GetPlayerLevelupExpConfigById(info.GetLevel());
                        info.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_BODY);

                        m_StorySystem.SendMessage("userkilled", info.GetId(), GetLivingUserCount());

                        TryFireAllUserKilled();
                        NoticeAttempRoomClosing();

                        info.DeadTime = TimeUtility.GetServerMilliseconds();
                        if (null != cfg && m_IsPvpScene)
                        {
                            info.ReviveTime = TimeUtility.GetServerMilliseconds() + cfg.m_RebornTime * 1000;
                        }
                        else
                        {
                            info.ReviveTime = TimeUtility.GetServerMilliseconds() + info.ReleaseTime + 2000;
                        }
                        NpcInfo npc = NpcManager.GetNpcInfo(info.PartnerId);
                        if (null != npc && npc.NpcType == (int)NpcTypeEnum.Partner)
                        {
                            npc.NeedDelete = true;
                        }
                    }
                    else
                    {
                        /*
                         * long delta = TimeUtility.GetServerMilliseconds() - info.DeadTime;
                         * if (delta > info.ReleaseTime) {
                         * info.DeadTime = info.ReviveTime;
                         * Msg_RC_Disappear build = new Msg_RC_Disappear();
                         * build.role_id = info.GetId();
                         * NotifyAllUser(build);
                         * }
                         */
                    }
                }
            }
        }