Exemplo n.º 1
0
    private string GenerateDescription()
    {
        StringBuilder sb = ToolTipManager.TipBody;

        switch (PartyActionType)
        {
        case PartyActionType.Tutorial:
            #region Tutorial
            if (!Alive[0] || !Alive[1])
            {
                if (!Alive[0] && !Alive[1])
                {
                    string tutAllPerish = string.Format(LocalizationManager.GetString("str_party_members_2"),
                                                        DarkestDungeonManager.Data.HexColors["notable"], Names[0], Names[1]);
                    sb.AppendFormat(LocalizationManager.GetString("str_tutorial_all_perished"), tutAllPerish);
                }
                else
                {
                    string tutSurv = string.Format(LocalizationManager.GetString("str_party_members_1"),
                                                   DarkestDungeonManager.Data.HexColors["notable"], Alive[0] ? Names[0] : Names[1]);
                    string tutPerish = string.Format(LocalizationManager.GetString("str_party_members_1"),
                                                     DarkestDungeonManager.Data.HexColors["harmful"], Alive[1] ? Names[0] : Names[1]);
                    sb.AppendFormat(LocalizationManager.GetString("str_tutorial_alive_perished_mixed"), tutSurv, tutPerish);
                }
            }
            else
            {
                string tutWinners = string.Format(LocalizationManager.GetString("str_party_members_2"),
                                                  DarkestDungeonManager.Data.HexColors["notable"], Names[0], Names[1]);
                sb.AppendFormat(LocalizationManager.GetString("str_tutorial_all_alive"), tutWinners);
            }
            #endregion
            break;

        case PartyActionType.Embark:
            #region Embark
            string strEmbarkers = string.Format(LocalizationManager.GetString("str_party_members_4"),
                                                DarkestDungeonManager.Data.HexColors["notable"], Names[0], Names[1], Names[2], Names[3]);
            string embarkId = "str_embarked_on_";
            switch (QuestType)
            {
            case "explore":
            case "cleanse":
            case "kill_boss":
            case "gather":
            case "inventory_activate":
                embarkId += QuestType + "_" + Dungeon;
                break;

            default:
                embarkId += QuestType;
                break;
            }
            sb.AppendFormat(LocalizationManager.GetString(embarkId), strEmbarkers,
                            LocalizationManager.GetString("str_difficulty_" + QuestDifficulty),
                            LocalizationManager.GetString("town_quest_length_" + QuestLength));
            #endregion
            break;

        case PartyActionType.Result:
            #region Result
            string strRaiders = string.Format(LocalizationManager.GetString("str_party_members_4"),
                                              DarkestDungeonManager.Data.HexColors["notable"], Names[0], Names[1], Names[2], Names[3]);
            string returnId = "str_returned_from_";
            switch (QuestType)
            {
            case "explore":
            case "cleanse":
            case "kill_boss":
            case "gather":
            case "inventory_activate":
                returnId += QuestType + "_" + Dungeon;
                break;

            default:
                returnId += QuestType;
                break;
            }
            if (IsSuccessfull)
            {
                returnId += "_success";
            }
            else
            {
                returnId += "_failure";
            }

            sb.AppendFormat(LocalizationManager.GetString(returnId), strRaiders,
                            LocalizationManager.GetString("str_difficulty_" + QuestDifficulty),
                            LocalizationManager.GetString("town_quest_length_" + QuestLength));

            if (Alive.Contains(false))
            {
                if (Alive.Contains(true))
                {
                    string deadHeroes = "";
                    switch (Alive.FindAll(x => !x).Count)
                    {
                    case 1:
                        deadHeroes = string.Format(LocalizationManager.GetString("str_party_members_1"),
                                                   DarkestDungeonManager.Data.HexColors["harmful"],
                                                   Alive[0] ? Alive[1] ? Alive[2] ? Names[3] : Names[2] : Names[1] : Names[0]);
                        break;

                    case 2:
                        int deadOne = 0;
                        int deadTwo = 0;
                        for (int i = 0; i < Alive.Count; i++)
                        {
                            if (!Alive[i])
                            {
                                deadTwo = i;
                            }
                        }
                        for (int i = Alive.Count - 1; i >= 0; i--)
                        {
                            if (!Alive[i])
                            {
                                deadOne = i;
                            }
                        }
                        deadHeroes = string.Format(LocalizationManager.GetString("str_party_members_2"),
                                                   DarkestDungeonManager.Data.HexColors["harmful"], Names[deadOne], Names[deadTwo]);
                        break;

                    case 3:
                        int dead = 0;
                        int live = Alive.IndexOf(true);
                        deadHeroes = string.Format(LocalizationManager.GetString("str_party_members_3"),
                                                   DarkestDungeonManager.Data.HexColors["harmful"],
                                                   dead++ == live ? Names[dead++] : Names[dead - 1],
                                                   dead++ == live ? Names[dead++] : Names[dead - 1],
                                                   dead++ == live ? Names[dead] : Names[dead - 1]);
                        break;
                    }
                    sb.AppendFormat("\n" + LocalizationManager.GetString("str_perished"), deadHeroes);
                }
                else
                {
                    string deadParty = string.Format(LocalizationManager.GetString("str_party_members_4"),
                                                     DarkestDungeonManager.Data.HexColors["harmful"], Names[0], Names[1], Names[2], Names[3]);
                    sb.AppendFormat("\n" + LocalizationManager.GetString("str_allperished"), deadParty);
                }
            }
            #endregion
            break;
        }
        cachedDescription = sb.ToString();
        return(cachedDescription);
    }