Пример #1
0
        /// <summary>
        /// Section "Camp Supremacy"
        /// </summary>
        /// <param name="oImage"></param>
        /// <param name="oGraphics"></param>
        /// <param name="oMatch"></param>
        /// <param name="oWeek"></param>
        /// <returns></returns>
        private string RenderCampSupremacy(ref Image oImage, ref Graphics oGraphics, Model.Database.Match oMatch, Model.Database.Week oWeek)
        {
            string cRetVal = "x";
            Dictionary<short, long> oDictCountCampFlipsByWorldID = null;
            List<short> oLstWorldsOrder;


            RectangleF oRectangleFlipsFirstName;
            RectangleF oRectangleFlipsFirstValue;
            RectangleF oRectangleFlipsSecondName;
            RectangleF oRectangleFlipsSecondValue;
            RectangleF oRectangleFlipsThirdName;
            RectangleF oRectangleFlipsThirdValue;

            RectangleF oRectangleFlipsTotal;

            RectangleF oRectanglePossessionFirstName;
            RectangleF oRectanglePossessionFirstValue;
            RectangleF oRectanglePossessionSecondName;
            RectangleF oRectanglePossessionSecondValue;
            RectangleF oRectanglePossessionThirdName;
            RectangleF oRectanglePossessionThirdValue;
            RectangleF oRectanglePossessionAverage;

            RectangleF oRectangleMostCampsFlipped;
            RectangleF oRectangleMostCampsFlippedValue;

            StringFormat oFormatFlips;
            StringFormat oFormatPossession;
            StringFormat oFormatMostCampsFlipped;

            Dictionary<short, List<Model.Timespans.ObjectiveTimespan>> oDictTimespans;
            List<Model.Additional.Objective_Owner_Change_Extended> oLstOwnerChanges;

            Dictionary<short, List<TimeSpan>> oDictTimespansProWelt;
            Dictionary<short, double> oDictAverageSeconds;
            Dictionary<short, TimeSpan> oDictAverageTimespans;

            Model.Timespans.ObjectiveTimespan oTimespan;

            TimeSpan oTimespanAll;
            int nAnzTimespans = 0;

            Model.Additional.CountObjectiveID oTopCamp;

            try
            {
                SetLoadingLabelCurrents("Camp Supremacy...", 4, ANZ_SCHRITTE);

                oDictCountCampFlipsByWorldID = DBWRAPPER.GetCampsFuerMatchID(oMatch.ID);
                oLstWorldsOrder = oDictCountCampFlipsByWorldID.Keys.OrderByDescending(x => oDictCountCampFlipsByWorldID[x]).ToList();

                //Flips
                oRectangleFlipsFirstName = new RectangleF(163, m_oDictWelten[oLstWorldsOrder[0]].NAME.Length > 17 ? 1763 : 1760, 790, 100);
                oRectangleFlipsFirstValue = new RectangleF(158, 1800, 790, 100);
                oRectangleFlipsSecondName = new RectangleF(163, m_oDictWelten[oLstWorldsOrder[1]].NAME.Length > 17 ? 1843 : 1840, 790, 100);
                oRectangleFlipsSecondValue = new RectangleF(158, 1880, 790, 100);
                oRectangleFlipsThirdName = new RectangleF(163, m_oDictWelten[oLstWorldsOrder[2]].NAME.Length > 17 ? 1923 : 1920, 790, 100);
                oRectangleFlipsThirdValue = new RectangleF(158, 1960, 790, 100);
                oRectangleFlipsTotal = new RectangleF(158, 1993, 790, 100);

                oFormatFlips = new StringFormat();
                oFormatFlips.Alignment = StringAlignment.Far;


                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[0]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[0]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsFirstName,
                    oFormatFlips);
                oGraphics.DrawString(string.Format("{0} camp{1} captured", oDictCountCampFlipsByWorldID[oLstWorldsOrder[0]], oDictCountCampFlipsByWorldID[oLstWorldsOrder[0]] == 1 ? "" : "s"),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsFirstValue,
                    oFormatFlips);

                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[1]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[1]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsSecondName,
                    oFormatFlips);
                oGraphics.DrawString(string.Format("{0} camp{1} captured", oDictCountCampFlipsByWorldID[oLstWorldsOrder[1]], oDictCountCampFlipsByWorldID[oLstWorldsOrder[1]] == 1 ? "" : "s"),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsSecondValue,
                    oFormatFlips);

                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[2]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[1]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsThirdName,
                    oFormatFlips);
                oGraphics.DrawString(string.Format("{0} camp{1} captured", oDictCountCampFlipsByWorldID[oLstWorldsOrder[2]], oDictCountCampFlipsByWorldID[oLstWorldsOrder[2]] == 1 ? "" : "s"),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsThirdValue,
                    oFormatFlips);

                oGraphics.DrawString(string.Format("{0} camp{1} captured in total", oLstWorldsOrder.Sum(x => oDictCountCampFlipsByWorldID[x]), oDictCountCampFlipsByWorldID[oLstWorldsOrder[2]] == 1 ? "" : "s"),
                    new Font("Caviar Dreams", 25, FontStyle.Bold),
                    Brushes.White,
                    oRectangleFlipsTotal,
                    oFormatFlips);

                //Possession

                oLstOwnerChanges = DBWRAPPER.GetObjectiveOwnerChangesFuerObjectiveType(oMatch.ID, 5);
                //oLstOwnerChanges = oLstOwnerChanges.OrderBy(x => x.TIME).ToList();

                Dictionary<short, List<Model.Additional.Objective_Owner_Change_Extended>> oDictOwnerChanges = oLstOwnerChanges.GroupBy(x => x.OBJECTIVE_ID).ToDictionary(k => k.Key, y => y.ToList());

                oDictTimespans = new Dictionary<short, List<Model.Timespans.ObjectiveTimespan>>();

                foreach (KeyValuePair<short, List<Model.Additional.Objective_Owner_Change_Extended>> oKVPObjective in oDictOwnerChanges)
                {
                    foreach (Model.Additional.Objective_Owner_Change_Extended oChange in oKVPObjective.Value)
                    {
                        if (!oDictTimespans.ContainsKey(oChange.OBJECTIVE_ID))
                        {
                            oDictTimespans.Add(oChange.OBJECTIVE_ID, new List<Model.Timespans.ObjectiveTimespan>());
                        }

                        if (oKVPObjective.Value.IndexOf(oChange) == 0)
                        {
                            //Erster
                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                        else if (oChange != oKVPObjective.Value.Last())
                        {
                            //Alle außer letzter
                            oDictTimespans[oChange.OBJECTIVE_ID][oKVPObjective.Value.IndexOf(oChange) - 1].Ende = oChange.TIME;

                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                        else
                        {
                            //Letzer 
                            oDictTimespans[oChange.OBJECTIVE_ID][oKVPObjective.Value.IndexOf(oChange) - 1].Ende = oChange.TIME;

                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                            oTimespan.Ende = oWeek.END_TIME;

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                    }
                }

                foreach (KeyValuePair<short, List<Model.Timespans.ObjectiveTimespan>> oKVPObjective in oDictTimespans)
                {
                    oKVPObjective.Value.RemoveAll(x => x.Dauer.TotalSeconds < 290);
                }

                oDictTimespansProWelt = new Dictionary<short, List<TimeSpan>>();

                foreach (KeyValuePair<short, List<Model.Timespans.ObjectiveTimespan>> oKVPObjective in oDictTimespans)
                {
                    foreach (Model.Timespans.ObjectiveTimespan oTimespanObjective in oKVPObjective.Value)
                    {
                        if (!oDictTimespansProWelt.ContainsKey(oTimespanObjective.Owner.ID))
                        {
                            oDictTimespansProWelt.Add(oTimespanObjective.Owner.ID, new List<TimeSpan>());
                        }
                        oDictTimespansProWelt[oTimespanObjective.Owner.ID].Add(oTimespanObjective.Dauer);
                    }
                }


                oDictAverageSeconds = new Dictionary<short, double>();
                oDictAverageTimespans = new Dictionary<short, TimeSpan>();
                oTimespanAll = new TimeSpan();

                foreach (KeyValuePair<short, List<TimeSpan>> oKVPWorld in oDictTimespansProWelt)
                {
                    oDictAverageSeconds.Add(oKVPWorld.Key, 0);
                    oDictAverageTimespans.Add(oKVPWorld.Key, new TimeSpan());

                    foreach (TimeSpan oTimespanInDict in oKVPWorld.Value)
                    {
                        oDictAverageSeconds[oKVPWorld.Key] += oTimespanInDict.TotalSeconds;
                        oTimespanAll += oTimespanInDict;
                        nAnzTimespans++;
                    }

                    oDictAverageTimespans[oKVPWorld.Key] = new TimeSpan(0, 0, Convert.ToInt32(Math.Floor(oDictAverageSeconds[oKVPWorld.Key] / oKVPWorld.Value.Count)));
                }

                oDictAverageTimespans = oDictAverageTimespans.OrderByDescending(x => x.Value).ToDictionary(k => k.Key, v => v.Value);
                oLstWorldsOrder = oDictAverageTimespans.Keys.ToList();

                oRectanglePossessionFirstName = new RectangleF(58, m_oDictWelten[oLstWorldsOrder[0]].NAME.Length > 17 ? 1763 : 1760, 800, 100);
                oRectanglePossessionFirstValue = new RectangleF(60, 1800, 800, 100);
                oRectanglePossessionSecondName = new RectangleF(58, m_oDictWelten[oLstWorldsOrder[1]].NAME.Length > 17 ? 1843 : 1840, 800, 100);
                oRectanglePossessionSecondValue = new RectangleF(60, 1880, 800, 100);
                oRectanglePossessionThirdName = new RectangleF(58, m_oDictWelten[oLstWorldsOrder[2]].NAME.Length > 17 ? 1923 : 1920, 800, 100);
                oRectanglePossessionThirdValue = new RectangleF(60, 1960, 800, 100);
                oRectanglePossessionAverage = new RectangleF(60, 1993, 800, 100);

                oFormatPossession = new StringFormat();
                oFormatPossession.Alignment = StringAlignment.Near;

                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[0]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[0]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionFirstName,
                    oFormatPossession);
                oGraphics.DrawString(GetTimespanAsString(oDictAverageTimespans[oLstWorldsOrder[0]]),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionFirstValue,
                    oFormatPossession);

                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[1]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[1]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionSecondName,
                    oFormatPossession);
                oGraphics.DrawString(GetTimespanAsString(oDictAverageTimespans[oLstWorldsOrder[1]]),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionSecondValue,
                    oFormatPossession);

                oGraphics.DrawString(m_oDictWelten[oLstWorldsOrder[2]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldsOrder[2]].NAME.Length > 17 ? 30 : 40, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionThirdName,
                    oFormatPossession);
                oGraphics.DrawString(GetTimespanAsString(oDictAverageTimespans[oLstWorldsOrder[2]]),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectanglePossessionThirdValue,
                    oFormatPossession);

                oGraphics.DrawString(GetTimespanAsString(new TimeSpan(0, 0, Convert.ToInt32(oTimespanAll.TotalSeconds / nAnzTimespans))) + " average",
                    new Font("Caviar Dreams", 25, FontStyle.Bold),
                    Brushes.Black,
                    oRectanglePossessionAverage,
                    oFormatPossession);

                //Most flipped
                oTopCamp = DBWRAPPER.GetTopCamp(oMatch.ID);

                oRectangleMostCampsFlipped = new RectangleF(0, 2163, 1000, 100);
                oRectangleMostCampsFlippedValue = new RectangleF(0, 2218, 1000, 100);

                oFormatMostCampsFlipped = new StringFormat();
                oFormatMostCampsFlipped.Alignment = StringAlignment.Center;


                oGraphics.DrawString(m_oLstObjectives.Single(x => x.ID == oTopCamp.OBJECTIVE_ID).ALT_NAME,
                    new Font("Caviar Dreams", 50, FontStyle.Regular),
                    Brushes.White,
                    oRectangleMostCampsFlipped,
                    oFormatMostCampsFlipped);

                oGraphics.DrawString(string.Format("flipped {0} times over the course of the week", oTopCamp.COUNT),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.White,
                    oRectangleMostCampsFlippedValue,
                    oFormatMostCampsFlipped);

                cRetVal = string.Empty;
            }
            catch (Exception oEx)
            {
                LOGWRITER.WriteMessage(oEx.ToString(), LogWriter.MESSAGE_TYPE.Error);
                cRetVal = "x";
            }
            return cRetVal;
        }
Пример #2
0
        /// <summary>
        /// Schreibt die Steinnebel-Sektion
        /// </summary>
        /// <param name="oImage"></param>
        /// <param name="oGraphics"></param>
        /// <param name="oMatch"></param>
        /// <param name="oWeek"></param>
        /// <returns></returns>
        private string RenderSMC(ref Image oImage, ref Graphics oGraphics, Model.Database.Match oMatch, Model.Database.Week oWeek)
        {
            string cRetVal = "x";
            List<Model.Timespans.ObjectiveTimespan> oLstTimespans;
            List<Model.Additional.Objective_Owner_Change_Extended> oLstOwnerChanges;
            List<KeyValuePair<short, TimeSpan>> oLstTimespansOrdered;

            Dictionary<short, TimeSpan> oDictTimespansProWelt;
            Model.Database.Objective oObjectiveSM;
            Model.Timespans.ObjectiveTimespan oTimespan;


            RectangleF oRectangleFirstName;
            RectangleF oRectangleFirstValue;
            RectangleF oRectangleSecondName;
            RectangleF oRectangleSecondValue;
            RectangleF oRectangleThirdName;
            RectangleF oRectangleThirdValue;

            StringFormat oFormat;


            try
            {
                SetLoadingLabelCurrents("King of Stonemist Castle...", 2, ANZ_SCHRITTE);

                //SM bestimmen
                oObjectiveSM = m_oLstObjectives.Single(x => x.SCORE == 35);

                //Changes für SM laden
                oLstOwnerChanges = DBWRAPPER.GetObjectiveOwnerChanges(oMatch.ID, oObjectiveSM.ID);
                //oLstOwnerChanges = oLstOwnerChanges.OrderBy(x => x.TIME).ToList();

                oLstTimespans = new List<Model.Timespans.ObjectiveTimespan>();

                foreach (Model.Additional.Objective_Owner_Change_Extended oChange in oLstOwnerChanges)
                {
                    if (oLstOwnerChanges.IndexOf(oChange) == 0)
                    {
                        //Erster
                        oTimespan = new Model.Timespans.ObjectiveTimespan();
                        oTimespan.Anfang = oChange.TIME;
                        oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];
                        oTimespan.Objective = oObjectiveSM;

                        oLstTimespans.Add(oTimespan);
                    }
                    else if (oChange != oLstOwnerChanges.Last())
                    {
                        //Alle außer letzter
                        oLstTimespans[oLstOwnerChanges.IndexOf(oChange) - 1].Ende = oChange.TIME;

                        oTimespan = new Model.Timespans.ObjectiveTimespan();
                        oTimespan.Anfang = oChange.TIME;
                        oTimespan.Objective = oObjectiveSM;
                        oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                        oLstTimespans.Add(oTimespan);
                    }
                    else
                    {
                        //Letzer 
                        oLstTimespans[oLstOwnerChanges.IndexOf(oChange) - 1].Ende = oChange.TIME;

                        oTimespan = new Model.Timespans.ObjectiveTimespan();
                        oTimespan.Anfang = oChange.TIME;
                        oTimespan.Objective = oObjectiveSM;
                        oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                        oTimespan.Ende = oWeek.END_TIME;

                        oLstTimespans.Add(oTimespan);
                    }
                }

                oDictTimespansProWelt = new Dictionary<short, TimeSpan>();

                foreach (Model.Timespans.ObjectiveTimespan oTimespanObjective in oLstTimespans)
                {
                    if (!oDictTimespansProWelt.ContainsKey(oTimespanObjective.Owner.ID))
                    {
                        oDictTimespansProWelt.Add(oTimespanObjective.Owner.ID, new TimeSpan(0, 0, 0));
                    }
                    oDictTimespansProWelt[oTimespanObjective.Owner.ID] += oTimespanObjective.Dauer;
                }

                oLstTimespansOrdered = oDictTimespansProWelt.ToList().OrderByDescending(x => x.Value).ToList();

                //Anzeige
                oRectangleFirstName = new RectangleF(160, 750, 800, 100);
                oRectangleFirstValue = new RectangleF(160, 820, 790, 100);
                oRectangleSecondName = new RectangleF(160, 860, 800, 100);
                oRectangleSecondValue = new RectangleF(160, 930, 790, 100);
                oRectangleThirdName = new RectangleF(160, 970, 800, 100);
                oRectangleThirdValue = new RectangleF(160, 1040, 790, 100);

                oFormat = new StringFormat();
                oFormat.Alignment = StringAlignment.Far;


                oGraphics.DrawString(m_oDictWelten[oLstTimespansOrdered[0].Key].NAME,
                    new Font("Caviar Dreams", 60, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleFirstName,
                    oFormat);
                oGraphics.DrawString(GetTimespanAsString(oLstTimespansOrdered[0].Value),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleFirstValue,
                    oFormat);

                oGraphics.DrawString(m_oDictWelten[oLstTimespansOrdered[1].Key].NAME,
                    new Font("Caviar Dreams", 60, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleSecondName,
                    oFormat);
                oGraphics.DrawString(GetTimespanAsString(oLstTimespansOrdered[1].Value),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleSecondValue,
                    oFormat);

                oGraphics.DrawString(m_oDictWelten[oLstTimespansOrdered[2].Key].NAME,
                    new Font("Caviar Dreams", 60, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleThirdName,
                    oFormat);
                oGraphics.DrawString(GetTimespanAsString(oLstTimespansOrdered[2].Value),
                    new Font("Caviar Dreams", 25, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleThirdValue,
                    oFormat);

                cRetVal = string.Empty;
            }
            catch (Exception oEx)
            {
                LOGWRITER.WriteMessage(oEx.ToString(), LogWriter.MESSAGE_TYPE.Error);
                cRetVal = "x";
            }
            return cRetVal;
        }
Пример #3
0
        /// <summary>
        /// Section "In Battle"
        /// </summary>
        /// <param name="oImage"></param>
        /// <param name="oGraphics"></param>
        /// <param name="oMatch"></param>
        /// <param name="oWeek"></param>
        /// <returns></returns>
        private string RenderInBattle(ref Image oImage, ref Graphics oGraphics, Model.Database.Match oMatch, Model.Database.Week oWeek)
        {
            string cRetVal = "x";


            RectangleF oRectangleFlipsFirstName;
            RectangleF oRectangleFlipsFirstValue;
            RectangleF oRectangleFlipsSecondName;
            RectangleF oRectangleFlipsSecondValue;
            RectangleF oRectangleFlipsThirdName;
            RectangleF oRectangleFlipsThirdValue;

            RectangleF oRectanglePossessionFirstName;
            RectangleF oRectanglePossessionFirstValue;
            RectangleF oRectanglePossessionSecondName;
            RectangleF oRectanglePossessionSecondValue;
            RectangleF oRectanglePossessionThirdName;
            RectangleF oRectanglePossessionThirdValue;

            RectangleF oRectangleTickFirstName;
            RectangleF oRectangleTickFirstValue;
            RectangleF oRectangleTickSecondName;
            RectangleF oRectangleTickSecondValue;
            RectangleF oRectangleTickThirdName;
            RectangleF oRectangleTickThirdValue;

            RectangleF oRectangleStompsFirstName;
            RectangleF oRectangleStompsFirstValue;
            RectangleF oRectangleStompsSecondName;
            RectangleF oRectangleStompsSecondValue;
            RectangleF oRectangleStompsThirdName;
            RectangleF oRectangleStompsThirdValue;


            StringFormat oFormatLeftNames;
            StringFormat oFormatLeftValues;

            StringFormat oFormatRightNames;
            StringFormat oFormatRightValues;


            Dictionary<short, long> oDictFlips;
            List<short> oLstWorldOrder;

            Dictionary<short, List<Model.Timespans.ObjectiveTimespan>> oDictTimespans;
            List<Model.Additional.Objective_Owner_Change_Extended> oLstOwnerChanges;

            Dictionary<short, List<TimeSpan>> oDictTimespansProWelt;
            Dictionary<short, double> oDictAverageSeconds;
            Dictionary<short, TimeSpan> oDictAverageTimespans;

            Model.Timespans.ObjectiveTimespan oTimespan;

            TimeSpan oTimespanAll;
            int nAnzTimespans = 0;


            Dictionary<short, long> oDictPointsNotFromTick;
            Dictionary<short, long> oDictPointsTotal;
            Dictionary<short, long> oDictPointsFromTick;
            Model.Database.Score oLetzterScore;

            try
            {
                SetLoadingLabelCurrents("In Battle...", 5, ANZ_SCHRITTE);

                //Flips
                oDictFlips = DBWRAPPER.GetObjectivesFuerMatchID(oMatch.ID);
                oDictFlips = oDictFlips.OrderByDescending(x => x.Value).ToDictionary(k => k.Key, v => v.Value);
                oLstWorldOrder = oDictFlips.Keys.ToList();

                oRectangleFlipsFirstName = new RectangleF(5, 2460, 950, 60);
                oRectangleFlipsFirstValue = new RectangleF(0, 2510, 950, 100);
                oRectangleFlipsSecondName = new RectangleF(5, 2540, 950, 60);
                oRectangleFlipsSecondValue = new RectangleF(0, 2590, 950, 100);
                oRectangleFlipsThirdName = new RectangleF(5, 2620, 950, 60);
                oRectangleFlipsThirdValue = new RectangleF(0, 2670, 950, 100);

                oFormatRightNames = new StringFormat();
                oFormatRightNames.Alignment = StringAlignment.Far;
                oFormatRightNames.LineAlignment = StringAlignment.Center;
                oFormatRightValues = new StringFormat();
                oFormatRightValues.Alignment = StringAlignment.Far;

                oFormatLeftNames = new StringFormat();
                oFormatLeftNames.Alignment = StringAlignment.Near;
                oFormatLeftNames.LineAlignment = StringAlignment.Center;
                oFormatLeftValues = new StringFormat();
                oFormatLeftValues.Alignment = StringAlignment.Near;


                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[0]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[0]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsFirstName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("captured {0} objectives", oDictFlips[oLstWorldOrder[0]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsFirstValue,
                    oFormatRightValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[1]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[1]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsSecondName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("captured {0} objectives", oDictFlips[oLstWorldOrder[1]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsSecondValue,
                    oFormatRightValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[2]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[2]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsThirdName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("captured {0} objectives", oDictFlips[oLstWorldOrder[2]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleFlipsThirdValue,
                    oFormatRightValues);




                //Average Possession

                oLstOwnerChanges = DBWRAPPER.GetObjectiveOwnerChangesFuerMatchID(oMatch.ID);
                //oLstOwnerChanges = oLstOwnerChanges.OrderBy(x => x.TIME).ToList();

                Dictionary<short, List<Model.Additional.Objective_Owner_Change_Extended>> oDictOwnerChanges = oLstOwnerChanges.GroupBy(x => x.OBJECTIVE_ID).ToDictionary(k => k.Key, y => y.ToList());

                oDictTimespans = new Dictionary<short, List<Model.Timespans.ObjectiveTimespan>>();

                foreach (KeyValuePair<short, List<Model.Additional.Objective_Owner_Change_Extended>> oKVPObjective in oDictOwnerChanges)
                {
                    foreach (Model.Additional.Objective_Owner_Change_Extended oChange in oKVPObjective.Value)
                    {
                        if (!oDictTimespans.ContainsKey(oChange.OBJECTIVE_ID))
                        {
                            oDictTimespans.Add(oChange.OBJECTIVE_ID, new List<Model.Timespans.ObjectiveTimespan>());
                        }

                        if (oKVPObjective.Value.IndexOf(oChange) == 0)
                        {
                            //Erster
                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                        else if (oChange != oKVPObjective.Value.Last())
                        {
                            //Alle außer letzter
                            oDictTimespans[oChange.OBJECTIVE_ID][oKVPObjective.Value.IndexOf(oChange) - 1].Ende = oChange.TIME;

                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                        else
                        {
                            //Letzer 
                            oDictTimespans[oChange.OBJECTIVE_ID][oKVPObjective.Value.IndexOf(oChange) - 1].Ende = oChange.TIME;

                            oTimespan = new Model.Timespans.ObjectiveTimespan();
                            oTimespan.Anfang = oChange.TIME;
                            oTimespan.Objective = m_oLstObjectives.Single(x => x.ID == oChange.OBJECTIVE_ID);
                            oTimespan.Owner = m_oDictWelten[oChange.WORLD_ID];

                            oTimespan.Ende = oWeek.END_TIME;

                            oDictTimespans[oChange.OBJECTIVE_ID].Add(oTimespan);
                        }
                    }
                }

                foreach (KeyValuePair<short, List<Model.Timespans.ObjectiveTimespan>> oKVPObjective in oDictTimespans)
                {
                    oKVPObjective.Value.RemoveAll(x => x.Dauer.TotalSeconds < 290);
                }

                oDictTimespansProWelt = new Dictionary<short, List<TimeSpan>>();

                foreach (KeyValuePair<short, List<Model.Timespans.ObjectiveTimespan>> oKVPObjective in oDictTimespans)
                {
                    foreach (Model.Timespans.ObjectiveTimespan oTimespanObjective in oKVPObjective.Value)
                    {
                        if (!oDictTimespansProWelt.ContainsKey(oTimespanObjective.Owner.ID))
                        {
                            oDictTimespansProWelt.Add(oTimespanObjective.Owner.ID, new List<TimeSpan>());
                        }
                        oDictTimespansProWelt[oTimespanObjective.Owner.ID].Add(oTimespanObjective.Dauer);
                    }
                }


                oDictAverageSeconds = new Dictionary<short, double>();
                oDictAverageTimespans = new Dictionary<short, TimeSpan>();
                oTimespanAll = new TimeSpan();

                foreach (KeyValuePair<short, List<TimeSpan>> oKVPWorld in oDictTimespansProWelt)
                {
                    oDictAverageSeconds.Add(oKVPWorld.Key, 0);
                    oDictAverageTimespans.Add(oKVPWorld.Key, new TimeSpan());

                    foreach (TimeSpan oTimespanInDict in oKVPWorld.Value)
                    {
                        oDictAverageSeconds[oKVPWorld.Key] += oTimespanInDict.TotalSeconds;
                        oTimespanAll += oTimespanInDict;
                        nAnzTimespans++;
                    }

                    oDictAverageTimespans[oKVPWorld.Key] = new TimeSpan(0, 0, Convert.ToInt32(Math.Floor(oDictAverageSeconds[oKVPWorld.Key] / oKVPWorld.Value.Count)));
                }

                oDictAverageTimespans = oDictAverageTimespans.OrderByDescending(x => x.Value).ToDictionary(k => k.Key, v => v.Value);
                oLstWorldOrder = oDictAverageTimespans.Keys.ToList();



                oRectanglePossessionFirstName = new RectangleF(5, 2810, 950, 60);
                oRectanglePossessionFirstValue = new RectangleF(0, 2860, 950, 100);
                oRectanglePossessionSecondName = new RectangleF(5, 2890, 950, 60);
                oRectanglePossessionSecondValue = new RectangleF(0, 2940, 950, 100);
                oRectanglePossessionThirdName = new RectangleF(5, 2970, 950, 60);
                oRectanglePossessionThirdValue = new RectangleF(0, 3020, 950, 100);


                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[0]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[0]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionFirstName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("{0} average", GetTimespanAsString(oDictAverageTimespans[oLstWorldOrder[0]])),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionFirstValue,
                    oFormatRightValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[1]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[1]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionSecondName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("{0} average", GetTimespanAsString(oDictAverageTimespans[oLstWorldOrder[1]])),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionSecondValue,
                    oFormatRightValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[2]].NAME,
                    new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[2]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionThirdName,
                    oFormatRightNames);
                oGraphics.DrawString(string.Format("{0} average", GetTimespanAsString(oDictAverageTimespans[oLstWorldOrder[2]])),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectanglePossessionThirdValue,
                    oFormatRightValues);


                //Points from tick

                oDictPointsNotFromTick = DBWRAPPER.GetPointsNotFromTick(oMatch);
                oDictPointsTotal = new Dictionary<short, long>();
                oLetzterScore = DBWRAPPER.GetLatestScore(oMatch.ID);
                oDictPointsTotal.Add(oMatch.RED_WORLD_ID, Convert.ToInt32(oLetzterScore.FULL_SCORE.Split('/')[0]));
                oDictPointsTotal.Add(oMatch.BLUE_WORLD_ID, Convert.ToInt32(oLetzterScore.FULL_SCORE.Split('/')[1]));
                oDictPointsTotal.Add(oMatch.GREEN_WORLD_ID, Convert.ToInt32(oLetzterScore.FULL_SCORE.Split('/')[2]));

                oDictPointsFromTick = new Dictionary<short, long>();
                oDictPointsFromTick.Add(oMatch.RED_WORLD_ID, oDictPointsTotal[oMatch.RED_WORLD_ID] - oDictPointsNotFromTick[oMatch.RED_WORLD_ID]);
                oDictPointsFromTick.Add(oMatch.GREEN_WORLD_ID, oDictPointsTotal[oMatch.GREEN_WORLD_ID] - oDictPointsNotFromTick[oMatch.GREEN_WORLD_ID]);
                oDictPointsFromTick.Add(oMatch.BLUE_WORLD_ID, oDictPointsTotal[oMatch.BLUE_WORLD_ID] - oDictPointsNotFromTick[oMatch.BLUE_WORLD_ID]);

                oDictPointsFromTick = oDictPointsFromTick.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, y => y.Value);
                oLstWorldOrder = oDictPointsFromTick.Keys.ToList();

                oRectangleTickFirstName = new RectangleF(45, 2460, 950, 60);
                oRectangleTickFirstValue = new RectangleF(50, 2510, 950, 100);
                oRectangleTickSecondName = new RectangleF(45, 2540, 950, 60);
                oRectangleTickSecondValue = new RectangleF(50, 2590, 950, 100);
                oRectangleTickThirdName = new RectangleF(45, 2620, 950, 60);
                oRectangleTickThirdValue = new RectangleF(50, 2670, 950, 100);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[0]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[0]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.Black,
                   oRectangleTickFirstName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points from tick", oDictPointsFromTick[oLstWorldOrder[0]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleTickFirstValue,
                    oFormatLeftValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[1]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[1]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.Black,
                   oRectangleTickSecondName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points from tick", oDictPointsFromTick[oLstWorldOrder[1]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleTickSecondValue,
                    oFormatLeftValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[2]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[2]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.Black,
                   oRectangleTickThirdName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points from tick", oDictPointsFromTick[oLstWorldOrder[2]]),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.Black,
                    oRectangleTickThirdValue,
                    oFormatLeftValues);


                //Not from tick

                oDictPointsNotFromTick = oDictPointsNotFromTick.OrderByDescending(x => Convert.ToDouble(x.Value) / oDictPointsTotal[x.Key] * 100).ToDictionary(x => x.Key, x => x.Value);
                oLstWorldOrder = oDictPointsNotFromTick.Keys.ToList();

                oRectangleStompsFirstName = new RectangleF(45, 2810, 950, 60);
                oRectangleStompsFirstValue = new RectangleF(50, 2860, 950, 100);
                oRectangleStompsSecondName = new RectangleF(45, 2890, 950, 60);
                oRectangleStompsSecondValue = new RectangleF(50, 2940, 950, 100);
                oRectangleStompsThirdName = new RectangleF(45, 2970, 950, 60);
                oRectangleStompsThirdValue = new RectangleF(50, 3020, 950, 100);


                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[0]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[0]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.White,
                   oRectangleStompsFirstName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points not from tick ({1}%)",
                        oDictPointsNotFromTick[oLstWorldOrder[0]],
                        Math.Round(Convert.ToDouble(oDictPointsNotFromTick[oLstWorldOrder[0]]) / oDictPointsTotal[oLstWorldOrder[0]] * 100, 1)),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleStompsFirstValue,
                    oFormatLeftValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[1]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[1]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.White,
                   oRectangleStompsSecondName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points not from tick ({1}%)",
                        oDictPointsNotFromTick[oLstWorldOrder[1]],
                        Math.Round(Convert.ToDouble(oDictPointsNotFromTick[oLstWorldOrder[1]]) / oDictPointsTotal[oLstWorldOrder[1]] * 100, 1)),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleStompsSecondValue,
                    oFormatLeftValues);

                oGraphics.DrawString(m_oDictWelten[oLstWorldOrder[2]].NAME,
                   new Font("Caviar Dreams", m_oDictWelten[oLstWorldOrder[2]].NAME.Length > 17 ? 40 : 50, FontStyle.Regular),
                   Brushes.White,
                   oRectangleStompsThirdName,
                   oFormatLeftNames);
                oGraphics.DrawString(string.Format(CultureInfo.GetCultureInfo("en-AU"), "{0:0,0} points not from tick ({1}%)",
                         oDictPointsNotFromTick[oLstWorldOrder[2]],
                         Math.Round(Convert.ToDouble(oDictPointsNotFromTick[oLstWorldOrder[2]]) / oDictPointsTotal[oLstWorldOrder[2]] * 100, 1)),
                    new Font("Caviar Dreams", 20, FontStyle.Regular),
                    Brushes.White,
                    oRectangleStompsThirdValue,
                    oFormatLeftValues);



                cRetVal = string.Empty;
            }
            catch (Exception oEx)
            {
                LOGWRITER.WriteMessage(oEx.ToString(), LogWriter.MESSAGE_TYPE.Error);
                cRetVal = "x";
            }
            return cRetVal;
        }