Exemplo n.º 1
0
 static LootGenerator Instance()
 {
     if(sm_instance == null) {
         sm_instance = GameObject.FindGameObjectWithTag("loot").GetComponent<LootGenerator>();
     }
     return sm_instance;
 }
        private static void NewGenerateLocationsCode(List <BasicTile> startZonePlayer)
        {
            foreach (var item in enemies)
            {
                var temp       = GameProcessor.loadedMap.possibleTilesGameZoneForEnemyINITIALIZATION(CombatProcessor.zoneTiles).Except(startZonePlayer).ToList();
                int randomNum  = GamePlayUtility.Randomize(0, temp.Count);
                var randomTile = temp[randomNum];
                item.spriteGameSize        = new Rectangle(((Rectangle)randomTile.mapPosition).X, ((Rectangle)randomTile.mapPosition).Y, ((Rectangle)randomTile.mapPosition).Width, ((Rectangle)randomTile.mapPosition).Height);
                item.spriteGameSize.Width  = 64;
                item.spriteGameSize.Height = 64;
                item.rotationIndex         = GamePlayUtility.Randomize(0, 4);
                item.position = item.spriteGameSize.Location.ToVector2();
                //GameProcessor.encounterEnemies = enemies;
                CombatProcessor.encounterEnemies.Add(item);
            }

            LootGenerator.Generate(CombatProcessor.encounterEnemies);
            // GameProcessor.encounterEnemies = enemies;
            // CombatProcessor.encounterEnemies = enemies;
        }
Exemplo n.º 3
0
        public override void Execute()
        {
            Console.Clear();
            int turn = 1;

            while (World.Player.Health > 0 && World.Enemy.Health > 0)
            {
                Console.WriteLine("Turn #" + turn++);
                Console.WriteLine(World.Player);
                Console.WriteLine("Enemy: " + World.Enemy);
                DoCombatTurn();
            }

            bool victory = World.Player.Health > 0;

            if (victory)
            {
                Console.WriteLine("You have won.");
                List <Item> loot = LootGenerator.GenerateLootItems(World.Enemy.Level);
                World.Player.Inventory.AddRange(loot);
                if (loot.Count > 0)
                {
                    string s = loot.Count > 1 ? "s" : "";
                    Console.WriteLine("You have found " + loot.Count + " item" + s + " after the battle.");
                    for (int i = 0; i < loot.Count; i++)
                    {
                        Console.WriteLine("* " + loot[i]);
                    }
                }
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
                World.CurrentState = World.MainHandlerInstance;
            }
            else
            {
                Console.WriteLine("You have lost. Your adventure ends here.");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
                World.CurrentState = World.NewGameHandlerInstance;
            }
        }
Exemplo n.º 4
0
    public void HandleconfirmButton()
    {
        // Create a child clone under the parent Inventory
        Inventory inventory = Resources.FindObjectsOfTypeAll <Inventory>()[0];

        inventory.addModules(this.loot);

        // Close the tooltip panel
        this.Toggle();

        // Close the loot panel
        GameObject    canvas = GameObject.Find("Canvas");
        LootGenerator loot   = canvas.GetComponent <LootGenerator>();

        loot.Toggle();

        // Open the route panel
        RoutesGenerator routes = canvas.GetComponent <RoutesGenerator>();

        routes.Toggle();
    }
Exemplo n.º 5
0
 public override void Execute()
 {
     Console.Clear();
     if (Dice.RollCrit(10, 1) > 0)
     {
         Item item = LootGenerator.GenerateItem();
         Console.WriteLine(messages[3]);
         Console.WriteLine("You found an item:");
         Console.WriteLine("* " + item);
         World.Player.Inventory.Add(item);
     }
     else
     {
         int roll  = Dice.Roll();
         int index = (roll - 1) / 2;
         Console.WriteLine(messages[index]);
     }
     Console.WriteLine("Press any key to begin continue...");
     Console.ReadKey();
     World.CurrentState = World.MainHandlerInstance;
 }
Exemplo n.º 6
0
        /// <summary>
        /// This function is called when players take over a sap successfully
        /// </summary>
        private void HandleTakeOver(SAP sap)
        {
            Logger.Info($"Intrusion SAP taken. sap = {sap.Eid} {sap.ED.Name} ");

            using (var scope = Db.CreateTransaction())
            {
                try
                {
                    var gen = new LootGenerator(_lootService.GetIntrusionLootInfos(this, sap));
                    LootContainer.Create().AddLoot(gen).BuildAndAddToZone(Zone, sap.CurrentPosition);

                    var winnerCorporation = sap.GetWinnerCorporation();
                    if (winnerCorporation == null)
                    {
                        return;
                    }

                    var siteInfo     = GetIntrusionSiteInfo();
                    var oldStability = siteInfo.Stability;
                    var newStability = siteInfo.Stability;
                    var newOwner     = siteInfo.Owner;
                    var oldOwner     = siteInfo.Owner;

                    var logEvent = new IntrusionLogEvent
                    {
                        OldOwner             = siteInfo.Owner,
                        NewOwner             = siteInfo.Owner,
                        SapDefinition        = sap.Definition,
                        EventType            = IntrusionEvents.sapTakeOver,
                        WinnerCorporationEid = winnerCorporation.Eid,
                        OldStability         = oldStability
                    };

                    if (winnerCorporation is PrivateCorporation)
                    {
                        //Compare the Owner and Winner corp's relations
                        var ownerEid = siteInfo.Owner ?? default(long);
                        var ownerAndWinnerGoodRelation = false;

                        var friendlyOnly = 10;
                        //Compare both relations between corps:
                        //True IFF both corps have strictly friendly relations with eachother
                        ownerAndWinnerGoodRelation = _corporationManager.IsStandingMatch(winnerCorporation.Eid, ownerEid, friendlyOnly);
                        ownerAndWinnerGoodRelation = _corporationManager.IsStandingMatch(ownerEid, winnerCorporation.Eid, friendlyOnly) && ownerAndWinnerGoodRelation;

                        //Stability increase if winner is owner OR winner is in good standing with owner
                        if (winnerCorporation.Eid == siteInfo.Owner || ownerAndWinnerGoodRelation)
                        {
                            newStability = (newStability + sap.StabilityChange).Clamp(0, 100);
                        }
                        else
                        {
                            newStability = (newStability - sap.StabilityChange).Clamp(0, 100);

                            // csak akkor ha 0 lett a stability
                            if (newStability == 0)
                            {
                                if (siteInfo.Owner != null)
                                {
                                    // ha van owner akkor eloszor toroljuk a regit es majd a kovetkezo korben kap ujat
                                    logEvent.EventType = IntrusionEvents.siteOwnershipLost;
                                    newOwner           = null;
                                }
                                else
                                {
                                    // itt kap uj ownert es egy kezdo stability erteket
                                    logEvent.EventType = IntrusionEvents.siteOwnershipGain;
                                    newOwner           = winnerCorporation.Eid;
                                    newStability       = STARTING_STABILITY;
                                }
                            }
                        }

                        //set the resulting values
                        SetIntrusionOwnerAndPoints(newOwner, newStability);
                        ReactStabilityChanges(siteInfo, oldStability, newStability, newOwner, oldOwner);
                    }

                    logEvent.NewOwner     = newOwner;
                    logEvent.NewStability = newStability;
                    InsertIntrusionLog(logEvent);

                    foreach (var playerInfo in sap.GetPlayersWithScore())
                    {
                        var ep        = playerInfo.corporationEid == winnerCorporation.Eid ? EP_WINNER : EP_LOSER;
                        var character = playerInfo.character;
                        character.AddExtensionPointsBoostAndLog(EpForActivityType.Intrusion, ep);
                    }

                    //make dem toast anyways
                    Transaction.Current.OnCommited(() =>
                    {
                        if (oldStability != newStability)
                        {
                            OnIntrusionSiteInfoUpdated();
                            InformAllPlayers();
                        }

                        InformPlayersOnZone(Commands.ZoneSapActivityEnd, new Dictionary <string, object>
                        {
                            { k.siteEID, Eid },
                            { k.eventType, (int)logEvent.EventType },
                            { k.eid, sap.Eid },
                            { k.winner, winnerCorporation.Eid },
                        });
                    });

                    scope.Complete();
                }
                catch (Exception ex)
                {
                    Logger.Exception(ex);
                }
            }
        }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     inventory = GetComponent <Inventory>();
     lg        = FindObjectOfType <LootGenerator>();
 }
Exemplo n.º 8
0
 private void Awake()
 {
     inst = this;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Stores a generator in a cache to reused the same generators multiple times
 /// </summary>
 /// <param name="dbGenerator"></param>
 /// <param name="generator"></param>
 private static void PutGeneratorInCache(LootGenerator dbGenerator, ILootGenerator generator)
 {
     m_ClassGenerators[dbGenerator.LootGeneratorClass + dbGenerator.ExclusivePriority] = generator;
 }
Exemplo n.º 10
0
        //public static bool derp = false;
        //public static void ValidateCacheOutput(HttpContext context, Object data,
        //    ref HttpValidationStatus status)
        //{
        //    if (derp == true)
        //        status = HttpValidationStatus.Valid;
        //    else
        //        status = HttpValidationStatus.Invalid;
        //    if (context.Request.QueryString["Status"] != null)
        //    {
        //        string pageStatus = context.Request.QueryString["Status"];

        //        if (pageStatus == "invalid")
        //            status = HttpValidationStatus.Invalid;
        //        else if (pageStatus == "ignore")
        //            status = HttpValidationStatus.IgnoreThisRequest;
        //        else
        //            status = HttpValidationStatus.Valid;
        //    }
        //    else
        //        status = HttpValidationStatus.Valid;
        //}
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Cache.AddValidationCallback(
            //    new HttpCacheValidateHandler(ValidateCacheOutput),
            //    null);
            //Response.Cache.SetExpires(DateTime.Now.AddSeconds(600));
            //Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            //Response.Cache.SetValidUntilExpires(true);

            bool filteredData = PageUtility.GetQueryString(Request, "Filtered", "true") == "true";
            int  uniqueRaidID = PageUtility.GetQueryInt(Request, "Raid", -1);

            if (uniqueRaidID == -1)
            {
                Response.Redirect("RaidList.aspx");
            }

            this.Title = "Raid " + uniqueRaidID + " | RaidStats";

#if false//LIMIT_USERS_USING_LOGIN_SYSTEM
            if ((DateTime.Now - ApplicationInstance.Instance.GetRaidDate(uniqueRaidID)).TotalDays > 30)
            {
                var user = Authentication.GetSessionUser(Page, true);
                if (user.IsPremium() == false)
                {
                    m_TrashHTML = new MvcHtmlString("Sorry. Raids that are older than 30 days are only viewable for Premium users!");
                    return;
                }
            }
#endif
            if (PageUtility.GetQueryString(Request, "Debug", "null") != "null")
            {
                var raidFiles = ApplicationInstance.Instance.GetRaidFiles(uniqueRaidID);
                if (raidFiles != null)
                {
                    Logger.ConsoleWriteLine("RaidOverview::Debug(): GetRaidFiles was: \"" + raidFiles.MergeToStringVF("\", \"") + "\"", ConsoleColor.DarkYellow);
                }
                else
                {
                    Logger.ConsoleWriteLine("RaidOverview::Debug(): GetRaidFiles was null!", ConsoleColor.DarkYellow);
                }
            }
            var orderedFights = ApplicationInstance.Instance.GetRaidBossFights(uniqueRaidID);
            if (orderedFights == null || orderedFights.Count() == 0)
            {
                Response.Redirect("RaidList.aspx");
            }

            var orderedTrashFights = ApplicationInstance.Instance.GetRaidTrashFights(uniqueRaidID);

            var realmDB = ApplicationInstance.Instance.GetRealmDB(orderedFights.First().GetRaid().Realm);

            var currRaid = orderedFights.First().GetRaid();
            if (currRaid.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server && PageUtility.GetQueryString(Request, "Debug") == "null")
            {
                Response.Redirect("RaidList.aspx");
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRaidList()
                                                 + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + currRaid.RaidOwnerName + "&realm=" + StaticValues.ConvertRealmParam(realmDB.Realm), currRaid.RaidOwnerName)
                                                 + PageUtility.BreadCrumb_AddFinish(currRaid.RaidInstance + "(" + currRaid.RaidID.ToString() + ")"));

            bool displayLoot = false;
            if (orderedFights.FindIndex((_Value) => _Value.GetItemDrops().Count > 0) != -1)
            {
                displayLoot = true;
            }

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("#Nr") +
                                           PageUtility.CreateTableColumnHead("Boss") +
                                           PageUtility.CreateTableColumnHead("Players") +
                                           (displayLoot == true ? PageUtility.CreateTableColumnHead("Items Dropped") : "") +
                                           //PageUtility.CreateTableColumnHead(PageUtility.CreateTooltipText("Recorded Damage", "Recorded damage done by players during the fight")) +
                                           PageUtility.CreateTableColumnHead("Player Deaths") +
                                           PageUtility.CreateTableColumnHead("Fight Duration") +
                                           PageUtility.CreateTableColumnHead("Kill Time") +
                                           PageUtility.CreateTableColumnHead(PageUtility.CreateTooltipText("Precision", "How much percentage of the recorded fight is vs the boss intended. Calculated using the formula: Boss+Adds DmgTaken/Recorded Damage"))));


            List <string> attendingRaidPlayers = new List <string>();
            string        tableBody            = "";
            foreach (var fight in orderedFights)
            {
                var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, fight)); });
                attendingRaidPlayers.AddRange(attendingFightPlayers);

                double precision = fight.CalculatePrecision(realmDB.RD_IsPlayerFunc(fight));

                var    attemptType = fight.GetFightData().GetAttemptType();
                string attemptStr  = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    attemptStr = "(kill)";
                }
                else if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.WipeAttempt)
                {
                    attemptStr = "(attempt)";
                }

                string trashPercentageStr = "<font color='#FF0000'>???</font>";
                if (precision != 0)
                {
                    double trashPercentage = precision;
                    if (precision >= 1.0)
                    {
                        precision = 1.0;
                    }
                    trashPercentageStr = PageUtility.CreateColorisedPercentage(precision);
                }
                var realm = fight.GetRaid().Realm;
                ///////////////////////
                string lootDropped = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    lootDropped = LootGenerator.CreateLootDroppedData(fight.GetItemDrops(), realmDB, ApplicationInstance.Instance.GetItemSummaryDatabase(), ApplicationInstance.Instance.GetItemInfo);
                }
                ///////////////////////

                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + (fight.GetRaidBossFightIndex() + 1)) +
                                                        PageUtility.CreateTableColumn(PageUtility.CreateLink("FightOverview.aspx?Raid=" + uniqueRaidID + "&Fight=" + fight.GetRaidBossFightIndex(), "<font color='#f70002'>" + fight.GetFightData().FightName + "</font>") + attemptStr) +
                                                        PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) +
                                                        (displayLoot == true ? PageUtility.CreateTableColumn(lootDropped) : "") +
                                                        //PageUtility.CreateTableColumn(((int)(totalValue / 1000)).ToString() + "k") +
                                                        PageUtility.CreateTableColumn(((int)fight.GetTotal((_Value) => { return(_Value.I.Death); }
                                                                                                           , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, fight) && _Value.Item2.I.Death > 0); })).ToString()) +
                                                        PageUtility.CreateTableColumn(fight.GetFightDuration().ToString() + " sec") +
                                                        PageUtility.CreateTableColumn(fight.GetFightData().StartDateTime.AddSeconds(fight.GetFightData().GetFightRecordDuration()).ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                        PageUtility.CreateTableColumn(trashPercentageStr));//PageUtility.CreateTooltipText(trashPercentageStr, (bossPlusAddsDmgTaken != 0 ? bossPlusAddsDmgTaken.ToString() : "???") + "/" + totalValue.ToString())));
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            /////////////////////
            List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> > playersAttending = new List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> >();

            foreach (var playerName in attendingRaidPlayers.Distinct())
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingRaidPlayers);
                if (playerData != null)
                {
                    playersAttending.Add(new Tuple <string, VF_RealmPlayersDatabase.PlayerClass>(playerName, playerData.Character.Class));
                }
            }
            string playersAttendingStr     = "<h3>Players attending(" + playersAttending.Count + "):</h3>";
            var    orderedPlayersAttending = playersAttending.OrderBy((_Value) => { return("" + (int)_Value.Item2 + _Value.Item1); });

            try
            {
                var lastClass = orderedPlayersAttending.First().Item2;
                foreach (var player in orderedPlayersAttending)
                {
                    if (lastClass != player.Item2)
                    {
                        playersAttendingStr += "<br />";
                    }
                    playersAttendingStr += PageUtility.CreateColorCodedName(player.Item1, player.Item2) + " ";
                    lastClass            = player.Item2;
                }
            }
            catch (Exception ex)
            {
            }
            /////////////////////

            var    recordedBy       = currRaid.GetRecordedByPlayers();
            string recordedByString = "";
            foreach (var playerName in recordedBy)
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingRaidPlayers);
                if (playerData != null)
                {
                    if (recordedByString == "")
                    {
                        recordedByString += " by ";
                    }
                    recordedByString += PageUtility.CreateColorCodedName(playerData) + ", ";
                }
            }
            if (recordedByString != "")
            {
                recordedByString = recordedByString.Substring(0, recordedByString.Length - 2); //Get rid of last ", "
                if (recordedByString.Contains(", "))
                {
                    var subStr      = recordedByString.Substring(recordedByString.LastIndexOf(", "));
                    var replacement = subStr.Replace(", ", " and ");
                    recordedByString = recordedByString.Replace(subStr, replacement);
                }
            }

            var startRecordTime = orderedFights.First().GetFightData().StartDateTime.ToLocalTime();
            var endRecordTime   = orderedFights.Last().GetFightData().GetEndDateTime().ToLocalTime();

            var totalRecordTime = " (" + ((int)(endRecordTime - startRecordTime).TotalMinutes) + " minutes and " + (endRecordTime - startRecordTime).Seconds + " seconds)";

            m_RaidOverviewInfoHTML = "<h1>" + currRaid.RaidOwnerName + " vs "
                                     + currRaid.RaidInstance + "(" + currRaid.RaidID.ToString() + ")<span class='badge badge-inverse'>" + orderedFights.Count() + " fights</span></h1>"
                                     + "<p>Fights recorded" + recordedByString + " between " + startRecordTime.ToString("yyy-MM-dd HH:mm:ss") + " and "
                                     + endRecordTime.ToString("yyy-MM-dd HH:mm:ss") + totalRecordTime + "</p>" + playersAttendingStr;

            string graphStyle      = "<style>" + PageUtility.CreateStatsBars_HTML_CSSCode() + "</style>";
            string totalBossMeters = "<h2>Damage/Healing total(only bosses)</h2>" +
                                     "<p>Total for all boss fights";
            string totalTrashMeters = "<h2>Damage/Healing total(only trash)</h2>" +
                                      "<p>Total for all trash fights";

            if (filteredData == true)
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                   + "'>View Unfiltered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                    + "'>View Unfiltered</a></p><br />";
            }
            else
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                   + "'>View Filtered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                    + "'>View Filtered</a></p><br />";
            }

            totalBossMeters += GenerateTotalMeters(filteredData, orderedFights, realmDB, attendingRaidPlayers);
            if (orderedTrashFights.Count > 0)
            {
                totalTrashMeters += GenerateTotalMeters(filteredData, orderedTrashFights, realmDB, attendingRaidPlayers);
            }
            else
            {
                totalTrashMeters = "";
            }
            m_GraphSection = new MvcHtmlString(graphStyle + "<div class='blackframe'>" + totalBossMeters + "</div><br/><div class='blackframe'>" + totalTrashMeters + "</div>");

            //TRASH HANDLING
            {
                if (orderedTrashFights.Count > 0)
                {
                    System.Text.StringBuilder trashSection = new System.Text.StringBuilder(4000);

                    trashSection.Append("<div class='row'><div class='span12'><table class='table'><thead>");
                    trashSection.Append(PageUtility.CreateTableRow("",
                                                                   PageUtility.CreateTableColumnHead("Trash") +
                                                                   PageUtility.CreateTableColumnHead("Players") +
                                                                   PageUtility.CreateTableColumnHead("Player Deaths") +
                                                                   PageUtility.CreateTableColumnHead("Trash Duration")));

                    trashSection.Append("</thead><tbody>");

                    foreach (var fight in orderedTrashFights)
                    {
                        var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, attendingRaidPlayers)); });

                        var endTime = fight.GetStartDateTime().AddSeconds(fight.GetFightData().GetFightRecordDuration());
                        trashSection.Append(PageUtility.CreateTableRow("",
                                                                       PageUtility.CreateTableColumn(PageUtility.CreateLink("FightOverview.aspx?Raid=" + uniqueRaidID + "&Trash=" + fight.GetRaidBossFightIndex(), "<font color='#f70002'>" + fight.GetStartDateTime().ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + " to " + endTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "</font>")) +
                                                                       PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) +
                                                                       PageUtility.CreateTableColumn(((int)fight.GetTotal((_Value) => { return(_Value.I.Death); }
                                                                                                                          , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, attendingRaidPlayers) && _Value.Item2.I.Death > 0); })).ToString()) +
                                                                       PageUtility.CreateTableColumn((int)(endTime - fight.GetStartDateTime()).TotalMinutes + " min")
                                                                       ));
                    }

                    trashSection.Append("</tbody></table></div></div>");

                    m_TrashHTML = new MvcHtmlString(trashSection.ToString());
                }
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool filteredData    = PageUtility.GetQueryString(Request, "Filtered", "true") == "true";
            int  uniqueDungeonID = PageUtility.GetQueryInt(Request, "Dungeon", -1);

            if (uniqueDungeonID == -1)
            {
                Response.Redirect("DungeonList.aspx");
            }

            this.Title = "Dungeon " + uniqueDungeonID + " | RaidStats";


            var orderedFights = ApplicationInstance.Instance.GetDungeonBossFights(uniqueDungeonID);

            if (orderedFights == null || orderedFights.Count() == 0)
            {
                Response.Redirect("DungeonList.aspx");
            }

            var realmDB = ApplicationInstance.Instance.GetRealmDB(orderedFights.First().GetDungeon().Realm);

            var currDungeon = orderedFights.First().GetDungeon();

            if (currDungeon.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server && PageUtility.GetQueryString(Request, "Debug") == "null")
            {
                Response.Redirect("DungeonList.aspx");
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddDungeonList()
                                                 + PageUtility.BreadCrumb_AddFinish(currDungeon.m_Dungeon + "(" + currDungeon.m_UniqueDungeonID.ToString() + ")"));

            bool displayLoot = false;

            if (orderedFights.FindIndex((_Value) => _Value.GetItemDrops().Count > 0) != -1)
            {
                displayLoot = true;
            }

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("#Nr") +
                                           PageUtility.CreateTableColumnHead("Boss") +
                                           PageUtility.CreateTableColumnHead("Players") +
                                           (displayLoot == true ? PageUtility.CreateTableColumnHead("Items Dropped") : "") +
                                           PageUtility.CreateTableColumnHead("Player Deaths") +
                                           PageUtility.CreateTableColumnHead("Fight Duration") +
                                           PageUtility.CreateTableColumnHead("Kill Time") +
                                           PageUtility.CreateTableColumnHead(PageUtility.CreateTooltipText("Precision", "How much percentage of the recorded fight is vs the boss intended. Calculated using the formula: Boss+Adds DmgTaken/Recorded Damage"))));

            List <string> attendingDungeonPlayers = new List <string>();
            string        tableBody = "";

            foreach (var fight in orderedFights)
            {
                var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, fight)); });
                attendingDungeonPlayers.AddRange(attendingFightPlayers);

                double precision = fight.CalculatePrecision(realmDB.RD_IsPlayerFunc(fight));

                var    attemptType = fight.GetFightData().GetAttemptType();
                string attemptStr  = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    attemptStr = "(kill)";
                }
                else if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.WipeAttempt)
                {
                    attemptStr = "(attempt)";
                }

                string trashPercentageStr = "<font color='#FF0000'>???</font>";
                if (precision != 0)
                {
                    double trashPercentage = precision;
                    if (precision >= 1.0)
                    {
                        precision = 1.0;
                    }
                    trashPercentageStr = PageUtility.CreateColorisedPercentage(precision);
                }
                var realm = fight.GetDungeon().Realm;
                ///////////////////////
                string lootDropped = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    lootDropped = LootGenerator.CreateLootDroppedData(fight.GetItemDrops(), realmDB, ApplicationInstance.Instance.GetItemSummaryDatabase(), ApplicationInstance.Instance.GetItemInfo);
                }
                ///////////////////////

                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + (fight.GetRaidBossFightIndex() + 1)) +
                                                        PageUtility.CreateTableColumn(/*PageUtility.CreateLink("FightOverview.aspx?Dungeon=" + uniqueDungeonID + "&Fight=" + fight.GetRaidBossFightIndex(), */ "<font color='#f70002'>" + fight.GetFightData().FightName + "</font>" /*)*/ + attemptStr) +
                                                        PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) +
                                                        (displayLoot == true ? PageUtility.CreateTableColumn(lootDropped) : "") +
                                                        PageUtility.CreateTableColumn(((int)fight.GetTotal((_Value) => { return(_Value.I.Death); }
                                                                                                           , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, fight) && _Value.Item2.I.Death > 0); })).ToString()) +
                                                        PageUtility.CreateTableColumn(fight.GetFightDuration().ToString() + " sec") +
                                                        PageUtility.CreateTableColumn(fight.GetFightData().StartDateTime.AddSeconds(fight.GetFightData().GetFightRecordDuration()).ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                        PageUtility.CreateTableColumn(trashPercentageStr));
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            /////////////////////
            List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> > playersAttending = new List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> >();

            foreach (var playerName in attendingDungeonPlayers.Distinct())
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingDungeonPlayers);
                if (playerData != null)
                {
                    playersAttending.Add(new Tuple <string, VF_RealmPlayersDatabase.PlayerClass>(playerName, playerData.Character.Class));
                }
            }
            string playersAttendingStr     = "<h3>Players attending(" + playersAttending.Count + "):</h3>";
            var    orderedPlayersAttending = playersAttending.OrderBy((_Value) => { return("" + (int)_Value.Item2 + _Value.Item1); });

            try
            {
                var lastClass = orderedPlayersAttending.First().Item2;
                foreach (var player in orderedPlayersAttending)
                {
                    if (lastClass != player.Item2)
                    {
                        playersAttendingStr += "<br />";
                    }
                    playersAttendingStr += PageUtility.CreateColorCodedName(player.Item1, player.Item2) + " ";
                    lastClass            = player.Item2;
                }
            }
            catch (Exception ex)
            {
            }
            /////////////////////

            var    recordedBy       = currDungeon.GetRecordedByPlayers();
            string recordedByString = "";

            foreach (var playerName in recordedBy)
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingDungeonPlayers);
                if (playerData != null)
                {
                    if (recordedByString == "")
                    {
                        recordedByString += " by ";
                    }
                    recordedByString += PageUtility.CreateColorCodedName(playerData) + ", ";
                }
            }
            if (recordedByString != "")
            {
                recordedByString = recordedByString.Substring(0, recordedByString.Length - 2); //Get rid of last ", "
                if (recordedByString.Contains(", "))
                {
                    var subStr      = recordedByString.Substring(recordedByString.LastIndexOf(", "));
                    var replacement = subStr.Replace(", ", " and ");
                    recordedByString = recordedByString.Replace(subStr, replacement);
                }
            }

            var startRecordTime = orderedFights.First().GetFightData().StartDateTime.ToLocalTime();
            var endRecordTime   = orderedFights.Last().GetFightData().GetEndDateTime().ToLocalTime();

            var totalRecordTime = " (" + ((int)(endRecordTime - startRecordTime).TotalMinutes) + " minutes and " + (endRecordTime - startRecordTime).Seconds + " seconds)";

            m_RaidOverviewInfoHTML = "<h1>\"" + currDungeon.m_GroupMembers.MergeToStringVF("\", \"") + "\" vs "
                                     + currDungeon.m_Dungeon + "(" + currDungeon.m_UniqueDungeonID.ToString() + ")<span class='badge badge-inverse'>" + orderedFights.Count() + " fights</span></h1>"
                                     + "<p>Fights recorded" + recordedByString + " between " + startRecordTime.ToString("yyy-MM-dd HH:mm:ss") + " and "
                                     + endRecordTime.ToString("yyy-MM-dd HH:mm:ss") + totalRecordTime + "</p>" + "<p><font color='red'>Did you attend this dungeon run and dont want this dungeon recording being publicly available? Send a PM to <a href='http://realmplayers.com:5555/memberlist.php?mode=viewprofile&u=2'>Dilatazu</a> on <a href='http://forum.realmplayers.com'>RealmPlayers forum</a>. Include some kind of proof that you are the player you say you are, dont forget to mention the unique DungeonID of the dungeon run. I will remove any dungeon recordings that requests to be hidden by any attending player.</font></p>" + playersAttendingStr;

            string graphStyle      = "<style>" + PageUtility.CreateStatsBars_HTML_CSSCode() + "</style>";
            string totalBossMeters = "<h2>Damage/Healing total(only bosses)</h2>" +
                                     "<p>Total for all boss fights";
            string totalTrashMeters = "<h2>Damage/Healing total(only trash)</h2>" +
                                      "<p>Total for all trash fights";

            if (filteredData == true)
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                   + "'>View Unfiltered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                    + "'>View Unfiltered</a></p><br />";
            }
            else
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                   + "'>View Filtered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                    + "'>View Filtered</a></p><br />";
            }

            totalBossMeters += RaidOverview.GenerateTotalMeters(filteredData, orderedFights, realmDB, attendingDungeonPlayers);

            m_GraphSection = new MvcHtmlString(graphStyle + "<div class='blackframe'>" + totalBossMeters + "</div><br/><div class='blackframe'>" + totalTrashMeters + "</div>");
        }