Пример #1
0
 public static void ReportActivityStart(MyEntity sourceEntity, string activityName, string activityFocus, string activityType, string activityItemUsage, bool expectActivityEnd = true)
 {
     if (!Sandbox.Engine.Platform.Game.IsDedicated && !SanityCheckAmountPerMinute(ReportChecksActivityStart, 60))
     {
         try
         {
             if (IsReportedPlayer(sourceEntity))
             {
                 if (((MySession.Static == null) || (MySession.Static.LocalCharacter == null)) || (MySession.Static.LocalCharacter.PositionComp == null))
                 {
                     MyAnalyticsManager.Instance.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, "", "", MyPhysics.SimulationRatio, Sync.ServerSimulationRatio);
                 }
                 else
                 {
                     MyPlanetNamesData planetNames = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                     MyAnalyticsManager.Instance.ReportActivityStart(activityName, activityFocus, activityType, activityItemUsage, expectActivityEnd, planetNames.planetName, planetNames.planetType, MyPhysics.SimulationRatio, Sync.ServerSimulationRatio);
                 }
                 ReportChecksActivityStart++;
             }
         }
         catch (Exception exception)
         {
             MyLog.Default.WriteLine(exception);
         }
     }
 }
Пример #2
0
        public static MyPlanetNamesData GetPlanetNames(Vector3D position)
        {
            MyPlanetNamesData data          = new MyPlanetNamesData();
            MyPlanet          closestPlanet = MyGamePruningStructure.GetClosestPlanet(position);
            Vector3           vector        = MyGravityProviderSystem.CalculateNaturalGravityInPoint(position);

            if ((closestPlanet == null) || (vector.LengthSquared() <= 0f))
            {
                data.planetName = "";
                data.planetType = "";
            }
            else
            {
                data.planetName = closestPlanet.StorageName;
                data.planetType = closestPlanet.Generator.FolderName;
            }
            return(data);
        }
Пример #3
0
 public static void ReportPlayerDeath(bool isLocallyControlled, ulong playerSteamId)
 {
     if (!Sandbox.Engine.Platform.Game.IsDedicated)
     {
         try
         {
             if (isLocallyControlled)
             {
                 int    isVanilla;
                 string deathCause = m_lastDamageInformation.Type.String;
                 bool   flag       = false;
                 bool   flag2      = false;
                 if ((m_lastDamageInformation.Type != MyStringHash.NullOrEmpty) && (m_lastDamageInformation.AttackerId != 0))
                 {
                     if (m_lastDamageInformation.Type == MyDamageType.Suicide)
                     {
                         flag2 = true;
                     }
                     else
                     {
                         MyEntity entity = null;
                         MyEntities.TryGetEntityById(m_lastDamageInformation.AttackerId, out entity, false);
                         IMyControllableEntity entity2 = entity as IMyControllableEntity;
                         if (entity2 == null)
                         {
                             if (((entity is IMyGunBaseUser) || (entity is IMyHandheldGunObject <MyToolBase>)) || (entity is IMyHandheldGunObject <MyGunBase>))
                             {
                                 flag = true;
                             }
                         }
                         else
                         {
                             MyEntityController controller = entity2.ControllerInfo.Controller;
                             if (controller != null)
                             {
                                 if (controller.Player.Id.SteamId != playerSteamId)
                                 {
                                     flag = true;
                                 }
                                 else
                                 {
                                     flag2 = true;
                                 }
                             }
                         }
                     }
                 }
                 string            deathType   = !flag ? (!flag2 ? (!(m_lastDamageInformation.Type == MyDamageType.Destruction) ? ((m_lastDamageInformation.Type == MyDamageType.Environment) ? "environment" : "unknown") : "cockpit_destruction") : "self_inflicted") : "pvp";
                 MyPlanetNamesData planetNames = GetPlanetNames(MySession.Static.LocalCharacter.PositionComp.GetPosition());
                 bool campaign = (MyCampaignManager.Static != null) && MyCampaignManager.Static.IsCampaignRunning;
                 if (!campaign || (MyCampaignManager.Static.ActiveCampaign == null))
                 {
                     isVanilla = 0;
                 }
                 else
                 {
                     isVanilla = (int)MyCampaignManager.Static.ActiveCampaign.IsVanilla;
                 }
                 MyAnalyticsManager.Instance.ReportPlayerDeath(deathType, deathCause, planetNames.planetName, planetNames.planetType, campaign, (bool)isVanilla, MySession.Static.Settings.GameMode.ToString(), GetModList(), MySession.Static.Mods.Count);
             }
         }
         catch (Exception exception)
         {
             MyLog.Default.WriteLine(exception);
         }
     }
 }