Exemplo n.º 1
0
        public void EndPlayingMap(GameState state, String reason)
        {
            Mechanics.EndAllActiveScripts();

            GameState  = state;
            LostReason = reason;
            if (GameState == GameState.Won && Map.Settings.Stages > 0 &&
                Map.Settings.MapType != Client.Game.Map.MapType.Cinematic &&
                CurrentStageInfos[Map.Settings.Stages - 1] == null)
            {
                StageCompleted(Map.Settings.Stages);
            }
            Program.Instance.SignalEvent(new ProgramEvents.StopPlayingMap
            {
                GameState   = state,
                MapFileName = Map.MapName ?? "",
                TimeElapsed = GameTime,
                HitsTaken   = Statistics.Actions.HitsTaken,
                DamageDone  = Statistics.Actions.DamageDealt,
                SilverYield = SilverYield,
                GoldYield   = GoldYield
            });


            if (Program.Settings.SendStatisticsFeedback)
            {
                FeedbackCommon.Stage highestStage = null;
                for (int i = CurrentStageInfos.Length - 1; i >= 0; i--)
                {
                    if (CurrentStageInfos[i] != null)
                    {
                        var si = CurrentStageInfos[i];
                        highestStage = new FeedbackCommon.Stage
                        {
                            HitPoints    = si.HitPoints,
                            MaxHitPoints = si.MaxHitPoints,
                            Rage         = (int)(si.Rage * 100f),
                            Time         = si.Time,
                            Ammo         = si.Ammo,
                            StageNumber  = si.Stage,
                            MapStages    = CurrentStageInfos.Length
                        };
                        break;
                    }
                }
                if (highestStage == null && CurrentStageInfos.Length > 0)
                {
                    highestStage = new FeedbackCommon.Stage
                    {
                        StageNumber = 0,
                        MapStages   = CurrentStageInfos.Length
                    };
                }

                var mc  = Map.MainCharacter;
                var mcp = mc.Position;
                if (Program.Instance.Profile.FeedbackInfo == null)
                {
                    FeedbackInfo.Profile = new FeedbackCommon.Profile
                    {
                        Name = "NullProfile",
                        HWID = Common.Utils.GetMac()
                    };
                }
                FeedbackInfo.MapName      = Map.MapName;
                FeedbackInfo.MapVersion   = Map.Settings.MapVersion;
                FeedbackInfo.EndTime      = DateTime.Now;
                FeedbackInfo.TimePlayed   = GameTime;
                FeedbackInfo.Frames       = FrameId;
                FeedbackInfo.Reason       = reason;
                FeedbackInfo.EndPosX      = mcp.X;
                FeedbackInfo.EndPosY      = mcp.Y;
                FeedbackInfo.EndPosZ      = mcp.Z;
                FeedbackInfo.Hitpoints    = mc.HitPoints;
                FeedbackInfo.Rage         = (int)(100 * (mc.RageLevel + mc.RageLevelProgress));
                FeedbackInfo.Ammunition   = mc.PistolAmmo;
                FeedbackInfo.MeleeWeapon  = (int)mc.MeleeWeapon;
                FeedbackInfo.RangedWeapon = (int)mc.RangedWeapon;
                FeedbackInfo.GameVersion  = Program.GameVersion.ToString();
                FeedbackInfo.HighestStage = highestStage;

                FeedbackInfo.HitsTaken   = Statistics.Actions.HitsTaken;
                FeedbackInfo.DamageDealt = Statistics.Actions.DamageDealt;
                FeedbackInfo.DamageTaken = Statistics.Actions.DamageTaken;
                FeedbackInfo.TimesNetted = Statistics.Actions.TimesNetted;
                FeedbackInfo.NSlams      = Statistics.CharacterActions.Slams;
                FeedbackInfo.GBShots     = Statistics.CharacterActions.GhostRifleFired;
                FeedbackInfo.TotalShots  = Statistics.CharacterActions.TotalShots;
                FeedbackInfo.KilledUnits = Statistics.Kills.TotalKills;

                FeedbackInfo.HttpPost(Settings.StatisticsURI);
            }
        }