Skip to content

Commit

Permalink
Skillbooks now properly display graphics and authors(via RimWorld Mod…
Browse files Browse the repository at this point in the history
… Release Tool)
  • Loading branch information
jecrell committed Jan 4, 2019
1 parent 1a7803c commit 6191f31
Show file tree
Hide file tree
Showing 17 changed files with 634 additions and 371 deletions.
6 changes: 5 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>RimWriter - Books, Scrolls, Tablets, and Libraries</name>
<author>Jecrell</author>
<targetVersion>1.0.2059</targetVersion>
<description>1.20.0.1 (10-30-2018)
<description>1.20.0.2 (01-04-2019)

Add tablets, books, scrolls and more to your RimWorld playthroughs.

Expand Down Expand Up @@ -40,6 +40,10 @@ Maaxar, Shibby Says, TheJagermeister, Cory Bonifay, Kiya Nicoll, Matt Harris, Pa
========================
Changelog
========================
1.20.0.2 (01-04-2019)
========================
Skillbooks now properly display graphics and authors

1.20.0.1 (10-30-2018)
========================
Fixes for potential XML errors from inheritence from other mods.
Expand Down
4 changes: 4 additions & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.20.0.2 (01-04-2019)
========================
Skillbooks now properly display graphics and authors

1.20.0.1 (10-30-2018)
========================
Fixes for potential XML errors from inheritence from other mods.
Expand Down
2 changes: 1 addition & 1 deletion About/PatreonURL.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://www.patreon.com/posts/21613863
https://www.patreon.com/posts/rimwriter-for-1-22328618
2 changes: 1 addition & 1 deletion About/Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.0.1
1.20.0.2
Binary file modified Assemblies/RimWriter.dll
Binary file not shown.
23 changes: 15 additions & 8 deletions Defs/ThingDefs_Item/RimWriter_Books.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,25 @@


<ThingDef ParentName="Jecrell_Book">
<defName>Jecrell_GuideBook</defName>
<label>skillbook</label>
<defName>Jecrell_Guidebook</defName>
<label>skillbook</label>
<thingClass>RimWriter.GuideBook</thingClass>
<description>A skillbook used to help characters with their professions and skill improvement.</description>
<description>A skillbook used to help characters with their professions and skill improvement.</description>
<graphicData>
<texPath>Item/Resource/Journal/Jecrell_JournalBook</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<onGroundRandomRotateAngle>35</onGroundRandomRotateAngle>
<drawSize>0.5</drawSize>
</graphicData>
<recipeMaker Inherit="False">
</recipeMaker>
</recipeMaker>
<statBases>
<MarketValue>4000</MarketValue>
<SellPriceFactor>0.05</SellPriceFactor>
<MarketValue>4000</MarketValue>
<SellPriceFactor>0.05</SellPriceFactor>
</statBases>
<comps Inherit="False">
<li Class="CompProperties_Forbiddable"/>
<comps Inherit="False">
<li Class="CompProperties_Forbiddable"/>
<li>
<compClass>CompQuality</compClass>
</li>
Expand Down
7 changes: 7 additions & 0 deletions Defs/ThingDefs_Item/RimWriter_Skillbooks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<label>skillbook</label>
<thingClass>RimWriter.GuideBook</thingClass>
<description>A skillbook used to help characters with their professions and skill improvement.</description>
<graphicData>
<texPath>Item/Resource/Journal/Jecrell_JournalBook</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<onGroundRandomRotateAngle>35</onGroundRandomRotateAngle>
<drawSize>0.5</drawSize>
</graphicData>
<recipeMaker Inherit="False">
</recipeMaker>
<statBases>
Expand Down
1 change: 1 addition & 0 deletions Source/.idea/.idea.RimWriter/.idea/contentModel.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

798 changes: 456 additions & 342 deletions Source/.idea/.idea.RimWriter/.idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified Source/.vs/RimWriter/v15/.suo
Binary file not shown.
Binary file modified Source/.vs/RimWriter/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
56 changes: 56 additions & 0 deletions Source/Authors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Verse;

namespace RimWriter
{
public class Authors
{
public static string Random => new[] {
"Hemingway",
"Austen",
"Woolf",
"Dickens",
"Tolstoy",
"Orwell",
"Faulkner",
"Tolkien",
"Melville",
"Kafka",
"King",
"Poe",
"Conan",
"Agatha",
"Salinger",
"Eliot",
"Dante",
"Proust",
"Victor",
"Verne",
"Rowling",
"Morrison",
"Dumas",
"Dahl",
"Carrol",
"Plato",
"Giovanni",
"Lovecraft",
"Chekhov",
"Aesop",
"Ursula",
"Balzac",
"Neil",
"Sartre",
"Mark",
"Arthur",
"Jane",
"Asimov",
"Murakami",
"Homer",
"Frost",
"Lee",
"Lucas",
"Spielberg",
"Abrams"

}.RandomElement();
}
}
2 changes: 1 addition & 1 deletion Source/Building_Bookcase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ProcessInput()
{
string text = current.Label;
if (current.TryGetComp<CompArt>() is CompArt compArt)
text = "RimWriter_BookTitle".Translate(new object[] { compArt.Title, compArt.AuthorName });
text = TranslatorFormattedStringExtensions.Translate("RimWriter_BookTitle", compArt.Title, compArt.AuthorName);
List<FloatMenuOption> arg_121_0 = list;
Func<Rect, bool> extraPartOnGUI = (Rect rect) => Widgets.InfoCardButton(rect.x + 5f, rect.y + (rect.height - 24f) / 2f, current);
arg_121_0.Add(new FloatMenuOption(text, delegate
Expand Down
9 changes: 2 additions & 7 deletions Source/Building_Typewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,8 @@ public override IEnumerable<FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
}
if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))
{
FloatMenuOption item4 = new FloatMenuOption("CannotUseReason".Translate(new object[]
{
"IncapableOfCapacity".Translate(new object[]
{
PawnCapacityDefOf.Manipulation.label
})
}), null, MenuOptionPriority.Default, null, null, 0f, null);
FloatMenuOption item4 = new FloatMenuOption(TranslatorFormattedStringExtensions.Translate("CannotUseReason",
TranslatorFormattedStringExtensions.Translate("IncapableOfCapacity", PawnCapacityDefOf.Manipulation.label)), null, MenuOptionPriority.Default, null, null, 0f, null);
return new List<FloatMenuOption>
{
item4
Expand Down
84 changes: 79 additions & 5 deletions Source/GuideBook.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using Harmony;
using JetBrains.Annotations;
using RimWorld;
using UnityEngine;
using Verse;
using Verse.Grammar;

namespace RimWriter
{
Expand Down Expand Up @@ -75,25 +78,96 @@ public override string Label
{
if (CompArt != null)
{
var authorNameInt = Traverse.Create(CompArt).Field("authorNameInt").GetValue<string>();
return (authorNameInt.NullOrEmpty())

return (Author.NullOrEmpty())
? "RimWriter_GuideTitle".Translate(skillDef.LabelCap) + " (" + CompQuality.Quality.GetLabel() + ")"
: "RimWriter_GuideTitleWithAuthor".Translate(new object[]{CompArt.AuthorName, skillDef.LabelCap}) + " (" + CompQuality.Quality.GetLabel() + ")";
: "RimWriter_GuideTitleWithAuthor".Translate(Author, skillDef.LabelCap) + " (" + CompQuality.Quality.GetLabel() + ")";
}

return base.Label;
//var compArt = new CompArt();
//this.AllComps.Add(compArt);
//var authorNameInt = Traverse.Create(CompArt).Field("authorNameInt").GetValue<string>();
//return (authorNameInt.NullOrEmpty())
// ? "RimWriter_GuideTitle".Translate(skillDef.LabelCap) + " (" + CompQuality.Quality.GetLabel() + ")"
// : "RimWriter_GuideTitleWithAuthor".Translate(CompArt.AuthorName, skillDef.LabelCap) + " (" + CompQuality.Quality.GetLabel() + ")";

}
}

[CanBeNull] private string author = null;
[CanBeNull]
public string Author
{
get
{
if (author == null)
{
var authorNameInt = Traverse.Create(CompArt).Field("authorNameInt").GetValue<string>();
Log.Message(authorNameInt);
if (!string.IsNullOrEmpty(authorNameInt) && !authorNameInt.StartsWith(" "))
{
author = authorNameInt;
}
else
{
author = Authors.Random;
Traverse.Create(CompArt).Field("authorNameInt").SetValue(author);
}
}
return author;
}
}

private Color? skillColor = null;
public Color SkillColor
{
get
{
if (skillColor == null)
{
var result = Color.white;
if (skillDef == SkillDefOf.Animals)
result = new Color(0.14f, 0.19f, 0.42f); //Color.steelblue;
else if (skillDef == SkillDefOf.Artistic)
result = new Color(0.33f, 0.1f, 0.55f); //Color.purple
else if (skillDef == SkillDefOf.Construction)
result = new Color(0.8f, 0.4f, 0f); //Color.orange;
else if (skillDef == SkillDefOf.Cooking)
result = new Color(0.4f, 0f, 0f); //Color.dullred;
else if (skillDef == SkillDefOf.Crafting)
result = new Color(0.5f, 0.16f, 0.16f); //Color.brown;
else if (skillDef == SkillDefOf.Intellectual)
result = new Color(0f, 0f, 0.5f); //Color.navy;
else if (skillDef == SkillDefOf.Medicine)
result = Color.white;
else if (skillDef == SkillDefOf.Melee)
result = Color.red;
else if (skillDef == SkillDefOf.Mining)
result = Color.black;
else if (skillDef == SkillDefOf.Plants)
result = new Color(0.13f, 0.55f, 0.13f); //Color.forestgreen;
else if (skillDef == SkillDefOf.Shooting)
result = Color.gray;
else if (skillDef == SkillDefOf.Social)
result = new Color(0.93f, 0.8f, 0.68f);
skillColor = result;
}
return skillColor.Value;
}
}

public override Graphic Graphic { get => this.DefaultGraphic.GetColoredVersion(ShaderDatabase.CutoutComplex, SkillColor, SkillColor); }

public override string DescriptionFlavor
{
get => "RimWriter_GuideSkillDesc".Translate(new object[]{skillDef.label, QualityRate.ToStringPercent()}) + "\n" + base.DescriptionFlavor;
get => "RimWriter_GuideSkillDesc".Translate(skillDef.label, QualityRate.ToStringPercent()) + "\n" + base.DescriptionFlavor;
}

public override void ExposeData()
{
base.ExposeData();
Scribe_Defs.Look(ref skillDef, "skillDef");
Scribe_Values.Look(ref author, "author");
}
}
}
1 change: 1 addition & 0 deletions Source/RimWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Authors.cs" />
<Compile Include="Building_Bookcase.cs" />
<Compile Include="Building_InternalStorage.cs" />
<Compile Include="Building_Typewriter.cs" />
Expand Down
10 changes: 5 additions & 5 deletions updateinfo
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
==============================

RimWriter - Books, Scrolls, Tablets, and Libraries Update
v1.20.0.0 (10-26-2018)
v1.20.0.1 (10-30-2018)
====================

Available now for RimWorld 1.0.
Fixes for potential XML errors from inheritence from other mods.
--------------------

Download now on...
Expand All @@ -25,9 +25,9 @@ Discuss the mod on...
[img width=260]https://raw.githubusercontent.com/jecrell/RimWriter/master/About/Preview.png[/img]
[hr]
[b]RimWriter - Books, Scrolls, Tablets, and Libraries
Version: 1.20.0.0
Updated: 10-26-2018
Description: [color=orange]Available now for RimWorld 1.0.[/color]
Version: 1.20.0.1
Updated: 10-30-2018
Description: [color=orange]Fixes for potential XML errors from inheritence from other mods.[/color]
[hr]
[b]Download now on...[/b]
[url=https://www.patreon.com/posts/21613863]Patreon[/url]
Expand Down

0 comments on commit 6191f31

Please sign in to comment.