Esempio n. 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);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        internal static Msg_RC_Revive BuildReviveMessage(UserInfo user)
        {
            Msg_RC_Revive builder = new Msg_RC_Revive();

            builder.camp_id        = user.GetCampId();
            builder.face_direction = user.GetMovementStateInfo().GetFaceDir();
            builder.hero_id        = user.GetLinkId();
            builder.is_player_self = true;
            builder.position       = new ArkCrossEngineMessage.Position();
            builder.position.x     = user.GetMovementStateInfo().GetPosition3D().X;
            builder.position.z     = user.GetMovementStateInfo().GetPosition3D().Z;
            builder.role_id        = user.GetId();
            return(builder);
        }