Skip to content

Commit 195509f

Browse files
committed
Release: Version 1.3
FossilOrigin-Name: 9f7e1f8b4e9fe05c319e678ee20dbc1aa49a5b7fa797b1e836817a4cc51af6ae
2 parents 774e5a3 + c806f90 commit 195509f

20 files changed

+544
-214
lines changed

Assets/cover.png

176 KB
Loading

Assets/favicon.png

327 Bytes
Loading

Assets/icon.aseprite

763 Bytes
Binary file not shown.

Assets/icon.png

1.75 KB
Loading

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changelog
2+
3+
## v1.3 — 2024-06-16
4+
Tested to work on game version 207.71
5+
6+
* Reorganizes options
7+
8+
Meta:
9+
10+
* Add `CHANGELOG.md`
11+
* Update icon
12+
* Update cover photo
13+
* Update `LICENSE`
14+
15+
## v1.2 — 2022-07-24
16+
Tested to work on game version 203.54
17+
18+
* Expands customization options (range of coloring highlight)
19+
20+
## v1.1 — 2022-07-24
21+
Tested to work on game version 203.54
22+
23+
* Adds customization options regarding hint display
24+
* coloring (on or off)
25+
* capitalization (key words, whole clue, and none)
26+
27+
## v1.0 — 2022-05-25
28+
29+
* Initial release

LICENSE

+3-119
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,5 @@
1-
Creative Commons Legal Code
1+
Copyright (C) 2022–2023 by librarianmage <[email protected]>
22

3-
CC0 1.0 Universal
3+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
44

5-
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6-
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7-
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8-
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9-
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10-
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11-
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12-
HEREUNDER.
13-
14-
Statement of Purpose
15-
16-
The laws of most jurisdictions throughout the world automatically confer
17-
exclusive Copyright and Related Rights (defined below) upon the creator
18-
and subsequent owner(s) (each and all, an "owner") of an original work of
19-
authorship and/or a database (each, a "Work").
20-
21-
Certain owners wish to permanently relinquish those rights to a Work for
22-
the purpose of contributing to a commons of creative, cultural and
23-
scientific works ("Commons") that the public can reliably and without fear
24-
of later claims of infringement build upon, modify, incorporate in other
25-
works, reuse and redistribute as freely as possible in any form whatsoever
26-
and for any purposes, including without limitation commercial purposes.
27-
These owners may contribute to the Commons to promote the ideal of a free
28-
culture and the further production of creative, cultural and scientific
29-
works, or to gain reputation or greater distribution for their Work in
30-
part through the use and efforts of others.
31-
32-
For these and/or other purposes and motivations, and without any
33-
expectation of additional consideration or compensation, the person
34-
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35-
is an owner of Copyright and Related Rights in the Work, voluntarily
36-
elects to apply CC0 to the Work and publicly distribute the Work under its
37-
terms, with knowledge of his or her Copyright and Related Rights in the
38-
Work and the meaning and intended legal effect of CC0 on those rights.
39-
40-
1. Copyright and Related Rights. A Work made available under CC0 may be
41-
protected by copyright and related or neighboring rights ("Copyright and
42-
Related Rights"). Copyright and Related Rights include, but are not
43-
limited to, the following:
44-
45-
i. the right to reproduce, adapt, distribute, perform, display,
46-
communicate, and translate a Work;
47-
ii. moral rights retained by the original author(s) and/or performer(s);
48-
iii. publicity and privacy rights pertaining to a person's image or
49-
likeness depicted in a Work;
50-
iv. rights protecting against unfair competition in regards to a Work,
51-
subject to the limitations in paragraph 4(a), below;
52-
v. rights protecting the extraction, dissemination, use and reuse of data
53-
in a Work;
54-
vi. database rights (such as those arising under Directive 96/9/EC of the
55-
European Parliament and of the Council of 11 March 1996 on the legal
56-
protection of databases, and under any national implementation
57-
thereof, including any amended or successor version of such
58-
directive); and
59-
vii. other similar, equivalent or corresponding rights throughout the
60-
world based on applicable law or treaty, and any national
61-
implementations thereof.
62-
63-
2. Waiver. To the greatest extent permitted by, but not in contravention
64-
of, applicable law, Affirmer hereby overtly, fully, permanently,
65-
irrevocably and unconditionally waives, abandons, and surrenders all of
66-
Affirmer's Copyright and Related Rights and associated claims and causes
67-
of action, whether now known or unknown (including existing as well as
68-
future claims and causes of action), in the Work (i) in all territories
69-
worldwide, (ii) for the maximum duration provided by applicable law or
70-
treaty (including future time extensions), (iii) in any current or future
71-
medium and for any number of copies, and (iv) for any purpose whatsoever,
72-
including without limitation commercial, advertising or promotional
73-
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74-
member of the public at large and to the detriment of Affirmer's heirs and
75-
successors, fully intending that such Waiver shall not be subject to
76-
revocation, rescission, cancellation, termination, or any other legal or
77-
equitable action to disrupt the quiet enjoyment of the Work by the public
78-
as contemplated by Affirmer's express Statement of Purpose.
79-
80-
3. Public License Fallback. Should any part of the Waiver for any reason
81-
be judged legally invalid or ineffective under applicable law, then the
82-
Waiver shall be preserved to the maximum extent permitted taking into
83-
account Affirmer's express Statement of Purpose. In addition, to the
84-
extent the Waiver is so judged Affirmer hereby grants to each affected
85-
person a royalty-free, non transferable, non sublicensable, non exclusive,
86-
irrevocable and unconditional license to exercise Affirmer's Copyright and
87-
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88-
maximum duration provided by applicable law or treaty (including future
89-
time extensions), (iii) in any current or future medium and for any number
90-
of copies, and (iv) for any purpose whatsoever, including without
91-
limitation commercial, advertising or promotional purposes (the
92-
"License"). The License shall be deemed effective as of the date CC0 was
93-
applied by Affirmer to the Work. Should any part of the License for any
94-
reason be judged legally invalid or ineffective under applicable law, such
95-
partial invalidity or ineffectiveness shall not invalidate the remainder
96-
of the License, and in such case Affirmer hereby affirms that he or she
97-
will not (i) exercise any of his or her remaining Copyright and Related
98-
Rights in the Work or (ii) assert any associated claims and causes of
99-
action with respect to the Work, in either case contrary to Affirmer's
100-
express Statement of Purpose.
101-
102-
4. Limitations and Disclaimers.
103-
104-
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105-
surrendered, licensed or otherwise affected by this document.
106-
b. Affirmer offers the Work as-is and makes no representations or
107-
warranties of any kind concerning the Work, express, implied,
108-
statutory or otherwise, including without limitation warranties of
109-
title, merchantability, fitness for a particular purpose, non
110-
infringement, or the absence of latent or other defects, accuracy, or
111-
the present or absence of errors, whether or not discoverable, all to
112-
the greatest extent permissible under applicable law.
113-
c. Affirmer disclaims responsibility for clearing rights of other persons
114-
that may apply to the Work or any use thereof, including without
115-
limitation any person's Copyright and Related Rights in the Work.
116-
Further, Affirmer disclaims responsibility for obtaining any necessary
117-
consents, permissions or other rights required for any use of the
118-
Work.
119-
d. Affirmer understands and acknowledges that Creative Commons is not a
120-
party to this document and has no duty or obligation with respect to
121-
this CC0 or use of the Work.
5+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Options.xml

+43-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<options>
3-
<option ID="Books_FinderOfRuin_Highlight" DisplayText="Highlight hint text" Category="Finder of Ruin" Type="Combo" Values="None,Key Words,Entire Clue" Default="Key Words"/>
4-
<option ID="Books_FinderOfRuin_HighlightStyle" DisplayText="Highlight color style" Category="Finder of Ruin" Type="Combo" Values="White,Colored Key Words" Default="Colored Key Words" />
5-
<option ID="Books_FinderOfRuin_Capitalization" DisplayText="CAPTIALIZE hint text" Category="Finder of Ruin" Type="Combo" Values="Default,Key Words,Entire Clue" Default="Default" />
3+
<option ID="Books_FinderOfRuin_EnableFormatting" DisplayText="Enable clue formatting" Category="Finder of Ruin" Type="Checkbox" Default="Yes">
4+
<helptext>
5+
Add visual indicators to the Ruin of House Isner clues, found in white-titled books.
6+
</helptext>
7+
</option>
8+
9+
<option ID="Books_FinderOfRuin_EnableHighlight" Requires="Books_FinderOfRuin_EnableFormatting==Yes" DisplayText="Enable hint text highlighting" Category="Finder of Ruin" Type="Checkbox" Default="Yes">
10+
<helptext>
11+
Adds color-based indicators to Ruin of Isner clues.
12+
</helptext>
13+
</option>
14+
<option ID="Books_FinderOfRuin_HighlightSpan" Requires="Books_FinderOfRuin_EnableFormatting==Yes,Books_FinderOfRuin_EnableHighlight==Yes" DisplayText="Span of highlight" Category="Finder of Ruin" Type="Combo" Values="Key Words,Entire Clue" Default="Key Words">
15+
<helptext>
16+
Controls which parts of the clue gets highlighted.
17+
18+
{{W|Key Words}}: The phrases "masterwork", "Ruin", and "House Isner" will be highlighted.
19+
{{W|Entire Clue}}: The entire clue phrase will be highlighted.
20+
</helptext>
21+
</option>
22+
<option ID="Books_FinderOfRuin_HighlightStyle" Requires="Books_FinderOfRuin_EnableFormatting==Yes,Books_FinderOfRuin_EnableHighlight==Yes" DisplayText="Highlight color style" Category="Finder of Ruin" Type="Combo" Values="Only White,Colored Key Words" Default="Colored Key Words">
23+
<helptext>
24+
Controls how the clue gets colored.
25+
26+
{{W|Only White}}: The above span will be colored in {{Y|a brighter white}}.
27+
{{W|Colored Key Words}}: The phrases "{{c|masterwork}}", "{{r|Ruin}}", and "{{M|House Isner}}" will be colored distinctively, while the rest of the span will be in a {{Y|brighter white}}.
28+
</helptext>
29+
</option>
30+
31+
<option ID="Books_FinderOfRuin_EnableUppercasing" Requires="Books_FinderOfRuin_EnableFormatting==Yes" DisplayText="Enable uppercasing hint text" Category="Finder of Ruin" Type="Checkbox" Default="No">
32+
<helptext>
33+
Adds case-based indicators to Ruin of Isner clues.
34+
</helptext>
35+
</option>
36+
<option ID="Books_FinderOfRuin_UppercasingSpan" Requires="Books_FinderOfRuin_EnableFormatting==Yes,Books_FinderOfRuin_EnableUppercasing==Yes" DisplayText="Span of uppercasing" Category="Finder of Ruin" Type="Combo" Values="Key Words,Entire Clue" Default="Key Words">
37+
<helptext>
38+
Controls which parts of the clue gets uppercased.
39+
40+
{{W|Key Words}}: The phrases "MASTERWORK", "RUIN", and "HOUSE ISNER" will be uppercased.
41+
{{W|Entire Clue}}: The entire clue phrase will be uppercased.
42+
</helptext>
43+
</option>
44+
<option ID="Books_FinderOfRuin_OptionsVersion" Requires="Books_FinderOfRuin_EnableFormatting==Yes,Books_FinderOfRuin_EnableFormatting==No" Category="Finder of Ruin" Type="Slider" Default="0">
45+
</option>
646
</options>

README.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Finder of Ruin
22
A mod that aids in the finding of the Ruin of House Isner by making the clues a bit more obvious.
33

4-
The mod offers two aids: coloring or capitalizing the hint text (key words or the entire clue).
4+
The mod offers two aids: coloring or uppercasing the hint text (key words or the entire clue).
55

6-
Tested to work on game version 203.54
6+
Tested to work on game version 207.71
77

88
[Github Page](https://github.com/librarianmage/FinderOfRuin) \| [Workshop Page](https://steamcommunity.com/sharedfiles/filedetails/?id=2812261314) \| [My Caves of Qud Mods (Steam Workshop)](https://steamcommunity.com/profiles/76561198836298826/myworkshopfiles/?appid=333640)
9+
10+
## Installation
11+
12+
Please refer to the Caves of Qud Wiki for [mod installation instructions](https://wiki.cavesofqud.com/wiki/Modding:Installing_a_mod).
13+
14+
## Development
15+
16+
In order for type-checking and auto-completion to work, place the game-generated `Mods.csproj` into the parent directory of this folder.
17+
18+
## License
19+
20+
I share the source of my mods with the intent that they can be useful for others. To this end, the code of this mod has been released with the Zero-Clause BSD (0BSD) license and the assets of this mod (namely, files in the `Assets/` folder) have been released with the Creative Commons Zero v1.0 Universal (CC0-1.0) license.

Scripts/ClueFormatter.cs

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.RegularExpressions;
5+
using ConsoleLib.Console;
6+
using static FinderOfRuin.Options.Formatting;
7+
8+
namespace FinderOfRuin
9+
{
10+
/// <summary>
11+
/// Utilities for formatting Isner clues.
12+
/// </summary>
13+
public static class LoreFormatter
14+
{
15+
/// <remarks>
16+
/// Inspired by <see href="https://stackoverflow.com/a/7899205">Scott Rippey's StackOverflow answer</see>.
17+
/// </remarks>
18+
private const string MatchingCurlyBraces =
19+
@"(?:[^\{\}]|(?<open>\{)|(?<-open>\}))+(?(open)(?!))";
20+
21+
/// <remarks>
22+
/// Made public for <see cref="Patches.FormattingPatcher"/>.
23+
/// </remarks>
24+
public static readonly string CluePattern = $@"\{{({MatchingCurlyBraces})\}}";
25+
26+
/// <summary>
27+
/// Matches the entire clue fragment. The first group is the inner clue text.
28+
/// </summary>
29+
public static readonly Regex ClueRegex = new(CluePattern);
30+
31+
private static readonly string ClueInnerPattern = $@"(?<=\{{){MatchingCurlyBraces}(?=\}})";
32+
33+
/// <summary>
34+
/// Matches the inner clue text, without the braces.
35+
/// </summary>
36+
public static readonly Regex ClueInnerRegex = new(ClueInnerPattern);
37+
38+
/// <summary>
39+
/// Formats the entire clue based on <see cref="Options.Formatting" />.
40+
/// </summary>
41+
/// <remarks>
42+
/// This function gets used as a <see cref="MatchEvaluator" />.
43+
/// </remarks>
44+
/// <returns>
45+
/// The formatted match.
46+
/// </returns>
47+
/// <param name="ClueMatch">
48+
/// A <see cref="Match"/> of the inside of a clue.
49+
/// </param>
50+
public static string FormatClueInner(Match ClueMatch)
51+
{
52+
var clue = ClueMatch.Value;
53+
54+
if (!WantEntireClue)
55+
{
56+
return clue;
57+
}
58+
59+
if (Highlight.WantEntireClue)
60+
{
61+
clue = Highlight.Style switch
62+
{
63+
Highlight.HighlightStyle.OnlyWhite => Markup.Color("Y", clue),
64+
Highlight.HighlightStyle.ColoredKeyWords => Markup.Color("Y", clue),
65+
_
66+
=> throw new ArgumentOutOfRangeException(
67+
nameof(Highlight.HighlightStyle),
68+
$"Finder of Ruin: Unexpected highlight style: {Highlight.Style}"
69+
)
70+
};
71+
}
72+
73+
if (Uppercasing.WantEntireClue)
74+
{
75+
clue = ColorUtility.ToUpperExceptFormatting(clue);
76+
}
77+
78+
return clue;
79+
}
80+
81+
private const string KeyWordPattern = @"(?:masterwork)|(?:Ruin)|(?:House Isner)";
82+
83+
/// <summary>
84+
/// Matches the notable key words.
85+
/// </summary>
86+
public static readonly Regex KeyWordRegex = new(KeyWordPattern);
87+
88+
/// <summary>
89+
/// Map of key word to color format.
90+
/// </summary>
91+
public static readonly ReadOnlyDictionary<string, string> KeyWordColors =
92+
new(
93+
new Dictionary<string, string>
94+
{
95+
{ "masterwork", "c" },
96+
{ "Ruin", "r" },
97+
{ "House Isner", "M" }
98+
}
99+
);
100+
101+
/// <summary>
102+
/// Formats the key word matches based on <see cref="Options.Formatting" />.
103+
/// </summary>
104+
/// <remarks>
105+
/// This function gets used as a <see cref="MatchEvaluator" />.
106+
/// </remarks>
107+
/// <returns>
108+
/// The formatted match.
109+
/// </returns>
110+
/// <param name="KeyWordMatch">
111+
/// A <see cref="Match"/> of a key word.
112+
/// </param>
113+
public static string FormatKeyWords(Match KeyWordMatch)
114+
{
115+
var keyWord = KeyWordMatch.Value;
116+
117+
if (!WantKeyWords)
118+
{
119+
return keyWord;
120+
}
121+
122+
if (Highlight.WantKeyWords)
123+
{
124+
keyWord = Highlight.Style switch
125+
{
126+
Highlight.HighlightStyle.OnlyWhite => Markup.Color("Y", keyWord),
127+
Highlight.HighlightStyle.ColoredKeyWords
128+
=> KeyWordColors.TryGetValue(keyWord, out var color)
129+
? Markup.Color(color, keyWord)
130+
: keyWord,
131+
_
132+
=> throw new ArgumentOutOfRangeException(
133+
nameof(Highlight.HighlightStyle),
134+
$"Finder of Ruin: Unexpected highlight style: {Highlight.Style}"
135+
)
136+
};
137+
}
138+
139+
if (Uppercasing.WantKeyWords)
140+
{
141+
keyWord = ColorUtility.ToUpperExceptFormatting(keyWord);
142+
}
143+
144+
return keyWord;
145+
}
146+
147+
///<summary>Formats an Isner clue.</summary>
148+
///<remarks>For use in <see cref="Patches.LoreFormatterPatch"/>.</remarks>
149+
public static string FormatLore(string Lore)
150+
{
151+
if (!Wanted)
152+
{
153+
return Lore;
154+
}
155+
156+
if (WantKeyWords)
157+
{
158+
var keyWordMatcher = new MatchEvaluator(FormatKeyWords);
159+
Lore = KeyWordRegex.Replace(Lore, keyWordMatcher);
160+
}
161+
162+
if (WantEntireClue)
163+
{
164+
var clueMatcher = new MatchEvaluator(FormatClueInner);
165+
Lore = ClueInnerRegex.Replace(Lore, clueMatcher);
166+
}
167+
168+
return Lore;
169+
}
170+
}
171+
}

0 commit comments

Comments
 (0)