Skip to content

Commit

Permalink
Merge pull request #1 from ToboterXP/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ToboterXP authored Jul 2, 2022
2 parents d52ee25 + f17bd69 commit 9139916
Show file tree
Hide file tree
Showing 49 changed files with 1,028 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,4 @@ MigrationBackup/
FodyWeavers.xsd

AnnouncementDraft.txt
Cutscenes/
39 changes: 39 additions & 0 deletions CarefreeMelodyItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ItemChanger;
using ItemChanger.Items;
using UnityEngine;

namespace HKSecondQuest
{
internal class CarefreeMelodyItem : ItemChanger.Items.CharmItem
{
public class Sprite : ISprite
{
public UnityEngine.Sprite Value
{
get { return CharmIconList.Instance.nymmCharm; }
}

public ISprite Clone()
{
return new Sprite();
}
}
public CarefreeMelodyItem()
{
charmNum = 40;
}

public override void GiveImmediate(GiveInfo info)
{
base.GiveImmediate(info);
PlayerData.instance.charmCost_40 = 3;
PlayerData.instance.grimmChildLevel = 5;
GameObject.Find("Queen").LocateMyFSM("Conversation Control").SendEvent("GET ITEM MSG END"); //to make queen fsm advance
}
}
}
39 changes: 39 additions & 0 deletions Endings/EndingA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Video;

namespace HKSecondQuest.Endings
{
internal class CutsceneChanger : MonoBehaviour
{
bool changed = false;
public string Cutscene;
void Update()
{
if (!changed && GetComponent<VideoPlayer>())
{
changed = true;
string dir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Cutscenes", Cutscene);
GetComponent<VideoPlayer>().Stop();
GetComponent<VideoPlayer>().url = dir;
GetComponent<VideoPlayer>().aspectRatio = VideoAspectRatio.FitInside;
GetComponent<VideoPlayer>().Play();
}
}
}
internal class EndingA : Room
{
public EndingA() : base("Cinematic_Ending_A") { }

public override void OnLoad()
{
GameObject.Find("Cinematic Player").AddComponent<CutsceneChanger>().Cutscene = "Ending1.mp4";
}
}
}
20 changes: 20 additions & 0 deletions Endings/EndingC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace HKSecondQuest.Endings
{
internal class EndingC : Room
{
public EndingC() : base("Cinematic_Ending_C") { }

public override void OnLoad()
{
GameObject.Find("Cinematic Player").AddComponent<CutsceneChanger>().Cutscene = "Ending2.mp4";

}
}
}
9 changes: 5 additions & 4 deletions GameCompletion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void CalculateCompletion(On.PlayerData.orig_CountGameCompletion or

if (!Enabled) return;

int charmCount = self.GetInt("charmsOwned"); //max 17
int charmCount = self.GetInt("charmsOwned"); //max 19

int nailUpgrades = self.GetInt("nailSmithUpgrades"); // max 3

Expand All @@ -38,24 +38,25 @@ public static void CalculateCompletion(On.PlayerData.orig_CountGameCompletion or
if (self.GetInt("screamLevel") > 0) spells++;
if (self.GetInt("quakeLevel") > 0) spells++;

int mainUpgrades = 0; //max 7
int mainUpgrades = 0; //max 8
if (self.GetBool("hasDoubleJump")) mainUpgrades++;
if (self.GetBool("hasSuperDash")) mainUpgrades++;
if (self.GetBool("hasTramPass")) mainUpgrades++;
if (self.GetBool("hasWalljump")) mainUpgrades++;
if (self.GetBool("hasLantern")) mainUpgrades++;
if (self.GetBool("hasDreamNail")) mainUpgrades++;
if (self.GetBool("hasDreamGate")) mainUpgrades++;
if (self.GetBool("dreamNailUpgraded")) mainUpgrades++;

int dreamers = 0; //max 3
if (self.GetBool("monomonDefeated")) dreamers++;
if (self.GetBool("hegemolDefeated")) dreamers++;
if (self.GetBool("lurienDefeated")) dreamers++;

int masks = self.GetInt("maxHealth") - 5; //max 1
int masks = self.GetInt("maxHealth") - 5; //max 2
int vessels = self.GetInt("MPReserveMax") / 33; //max 1

float percentage = 3 * charmCount + 2 * nailUpgrades + 3 * charmNotches + 2 * spells + 2 * mainUpgrades + 3 * dreamers + 3 * masks + 2 * vessels;
float percentage = 3 * charmCount + 1 * nailUpgrades + 2 * charmNotches + 2 * spells + 2 * mainUpgrades + 2 * dreamers + 2 * masks + 2 * vessels;

if (percentage > 100) percentage = 100;

Expand Down
18 changes: 18 additions & 0 deletions GeneralChanges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public static void ChangeText()
ReplaceText("STAG_RUINS2", "Welcome traveler, to the Glimmering City! It seems to be a little worse for wear at the moment, though.<page>No wonder the stag network is so dilapitated, with all this water running in.");
ReplaceText("STAG_CROSSROADS", "Ah, the old village on the road to the Glimmering City! Travelers often stayed here for the night, in one of the Inns.<page>Not sure how many are left, though.<page>I heard there's a little cleptomaniac bug that lives deep within the plantations. Maybe you should pay him a visit. You also seem to like collecting things.");
ReplaceText("STAG_NEST", "This is where we stags live. Please don't wake anyone up, being a stag is hard work!", "Stag");
ReplaceText("STAG_HIDDEN", "Ah, the old station at the King's Palace. It does seem to be in quite bad shape, a wonder that it still works.<page>Though I doubt it will see much travel in the future.");
ReplaceText("STAG_DREAM", "I wonder how my brethren are doing? I really can handle all trafic on my own these days...");
ReplaceText("STAG_TRAM", "Oh, you carry a tram pass! They are beautiful machines, aren't they? Though I always said they should leave out the windows. Travel just isn't the same without the fresh breeze in your mane.");
ReplaceText("STAG_HOPE_1", "The stag nest. Be careful, it's quite crammed. Once dozens of stags were necessary to run the stag network. Now I can easily handle everyone. I'm the youngest, you see? So the burden fell on me.");
ReplaceText("STAG_HOPE_2", "There have been now new stags as well for quite some time. It just isn't necessary these days. So everyone just gets older and older.");
ReplaceText("STAG_REMEMBER_1", "Ah, Cornifer has been busy, hasn't he? At least some of the network is up and running again. I'm sure business will be right back to normal soon.");

//inventory text
ReplaceText("INV_DESC_WHITEKEY", "A very fancy, glimmering key");
Expand Down Expand Up @@ -65,6 +71,8 @@ public static void ChangeText()
ReplaceText("CHARM_DESC_30", "A strange medal given to you by Mothman. It might contain drugs.");
ReplaceText("CHARM_DESC_3", "A present from an old catapillar. Probably won't change your size though.");
ReplaceText("CHARM_DESC_31", "A very pretty medal. Could probably be sold for a good prize to a collector. If you had a mouth to barter with, that is.");
ReplaceText("CHARM_DESC_40_N", "A finely crafted medal, eternally giving off a faint lullaby.<br>Crafted by a mother mourning her family.");
ReplaceText("CHARM_DESC_38", "A little medal with an emblem shaped like a flower. Used by gardeners across the world to repell snail invasions.");

//Replace Elegy to Hallownest
ReplaceText("PROLOGUE_EXCERPT_01", "A note to all who it may concern:");
Expand All @@ -81,6 +89,13 @@ public static void ChangeText()
/// </summary>
public static void OnSceneLoad()
{

//fix bug when diving into direction changing transition
string entryGate = GameManager.instance.entryGateName;
if (entryGate.StartsWith("left") || entryGate.StartsWith("right")) HeroController.instance.exitedQuake = false;
if (entryGate.StartsWith("top") || entryGate.StartsWith("bot")) HeroController.instance.exitedSuperDashing = false;

//fix playerdata bools
if (HeroController.instance != null)
{
SetBool("crossroadsInfected", false); //uninfect crossroads
Expand All @@ -99,6 +114,9 @@ public static void OnSceneLoad()
SetBool("corn_abyssLeft", false);
SetBool("corniferAtHome", false);
SetBool("city2_sewerDoor", true); //open Emilitia entrance
SetBool("bathHouseWall", true); //break wall in right city elevator
SetBool("gladeDoorOpened", false); //lock glade door permanently
SetBool("whitePalaceMidWarp", false); //so the TFK dream warp works
//SetBool("quirrelLeftEggTemple", true); //despawn quirrel in TBE
}
}
Expand Down
38 changes: 35 additions & 3 deletions HKSecondQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace HKSecondQuest
public class SaveSettings
{
public bool glimmeringRealmEnabled = false;
public int revision = 1;
}

/// <summary>
Expand All @@ -54,6 +55,8 @@ public class HKSecondQuest : Mod, ILocalSettings<SaveSettings>
/// </summary>
public Room ActiveRoom = null;

public Room PreviousRoom = null;

public RoomMirrorer RoomMirrorer = new RoomMirrorer();

/// <summary>
Expand All @@ -65,10 +68,12 @@ public class HKSecondQuest : Mod, ILocalSettings<SaveSettings>
public void OnLoadLocal(SaveSettings s) => saveSettings = s;
public SaveSettings OnSaveLocal() => saveSettings;

public const int CurrentRevision = 2;


public HKSecondQuest() : base("The Glimmering Realm")
{
Instance = this;
Instance = this;

//Make sure the main menu text is changed, but disable all other functionalitly
SetEnabled(false);
Expand All @@ -87,7 +92,7 @@ public HKSecondQuest() : base("The Glimmering Realm")

public override string GetVersion()
{
return "v1.0.4.1";
return "v1.1.0.0";
}

public void SetEnabled(bool enabled)
Expand Down Expand Up @@ -128,6 +133,7 @@ public void InitializeWorld(On.UIManager.orig_StartNewGame orig, UIManager self,

//save that this is a glimmeringRealm save file
saveSettings.glimmeringRealmEnabled = true;
saveSettings.revision = CurrentRevision;

//Call OnWorldInit for all Room subclasses
foreach (Room room in rooms)
Expand All @@ -146,6 +152,8 @@ public void InitializeWorld(On.UIManager.orig_StartNewGame orig, UIManager self,
/// </summary>
public void CorrectGrubfather()
{
if (!saveSettings.glimmeringRealmEnabled) return;

Settings set = (Settings)typeof(ItemChangerMod).GetField("SET", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
foreach(var placement in set.GetPlacements())
{
Expand All @@ -162,6 +170,26 @@ public void CorrectGrubfather()
}
}

public void OnSaveLoad()
{
if (!saveSettings.glimmeringRealmEnabled) return;

if (saveSettings.revision < CurrentRevision)
{
RevisionManager.OnRevision(saveSettings.revision, CurrentRevision);

//apply changes from new revisions if old revisions are loaded
foreach(Room room in rooms)
{
if (room.Revision > saveSettings.revision)
{
room.OnWorldInit();
}
}
}
saveSettings.revision = CurrentRevision;
}


/// <summary>
/// Called when the mod is loaded
Expand All @@ -185,6 +213,7 @@ public override void Initialize(Dictionary<string, Dictionary<string, GameObject
On.HeroController.Start += OnGameStart;

Events.OnEnterGame += CorrectGrubfather;
Events.OnEnterGame += OnSaveLoad;

UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnBeforeSceneLoad;

Expand Down Expand Up @@ -262,6 +291,8 @@ public void OnBeforeSceneLoad(Scene current, Scene next)

GeneralChanges.OnSceneLoad();

PreviousRoom = ActiveRoom;

//find and set the active room (if there is one
foreach (Room room in rooms)
{
Expand Down Expand Up @@ -327,7 +358,7 @@ public void OnMainMenu(On.MenuStyleTitle.orig_SetTitle orig, global::MenuStyleTi
title.GetComponent<SpriteRenderer>().sprite = titleSprite;
//slightly blue, to make it stand apart from the background
title.GetComponent<SpriteRenderer>().color = new UnityEngine.Color(193 / 255f, 225 / 255f, 253 / 255f);
title.transform.SetScaleMatching(2.7f);
title.transform.SetScaleMatching(2.7f);
}
}
}
Expand All @@ -344,5 +375,6 @@ public void OnUpdate(On.HeroController.orig_Update orig, global::HeroController
GeneralChanges.OnUpdate();
}


}
}
14 changes: 13 additions & 1 deletion HKSecondQuest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- Uncomment this to generate a documentation file to be included with the mod -->
<!--<DocumentationFile>$(OutputPath)/$(AssemblyTitle).xml</DocumentationFile>-->
</PropertyGroup>
<PropertyGroup>
<PropertyGroup>
<RootNamespace>HKSecondQuest</RootNamespace>
<AssemblyName>TheGlimmeringRealm</AssemblyName>
<TargetFramework>net472</TargetFramework>
Expand All @@ -24,13 +24,25 @@
<Target Name="CopyMod" AfterTargets="PostBuildEvent">
<RemoveDir Condition="Exists('$(ExportDir)/$(TargetName)/')" Directories="$(ExportDir)/$(TargetName)/" />
<MakeDir Directories="$(ExportDir)/$(TargetName)/" />

<MakeDir Directories="$(ExportDir)/$(TargetName)/zip/" />
<MakeDir Directories="$(ExportDir)/$(TargetName)/zip/Cutscenes/" />
<MakeDir Condition="!Exists('$(HollowKnightRefs)/Mods/$(TargetName)/')" Directories="$(HollowKnightRefs)/Mods/$(TargetName)/" />
<MakeDir Directories="$(HollowKnightRefs)/Mods/$(TargetName)/Cutscenes/" />


<Copy Condition="'$(DocumentationFile)' != ''" SourceFiles="$(TargetPath);$(TargetDir)/$(TargetName).pdb;$(TargetDir)/$(TargetName).xml" DestinationFolder="$(HollowKnightRefs)/Mods/$(TargetName)/" />
<Copy Condition="'$(DocumentationFile)' == ''" SourceFiles="$(TargetPath);$(TargetDir)/$(TargetName).pdb" DestinationFolder="$(HollowKnightRefs)/Mods/$(TargetName)/" />

<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ExportDir)/$(TargetName)/" />

<!--Copy cutscenes into the ZIP file-->
<ItemGroup>
<CutsceneFiles Include="Resources/Cutscenes/*.*" />
</ItemGroup>

<Copy SourceFiles="@(CutsceneFiles)" DestinationFolder="$(ExportDir)/$(TargetName)/zip/Cutscenes/" />
<Copy SourceFiles="@(CutsceneFiles)" DestinationFolder="$(HollowKnightRefs)/Mods/$(TargetName)/Cutscenes/" />

<Copy Condition="'$(DocumentationFile)' != ''" SourceFiles="ReadMe.md;$(TargetPath);$(TargetDir)/$(TargetName).pdb;$(TargetDir)/$(TargetName).xml" DestinationFolder="$(ExportDir)/$(TargetName)/zip/" />
<Copy Condition="'$(DocumentationFile)' == ''" SourceFiles="ReadMe.md;$(TargetPath);$(TargetDir)/$(TargetName).pdb" DestinationFolder="$(ExportDir)/$(TargetName)/zip/" />
Expand Down
Binary file modified Maps/Layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion Maps/PlacedCharms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ Shaman Stone 19
Quick Slash 32
Dream Wielder 30
Grubsong 3
Dashmaster 31
Dashmaster 31
Carefree Melody 40N
Dreamshield

Don't include Flukenest without adding Flukehermit dialog
Binary file modified Maps/Used Rooms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Prefabs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ internal class Prefabs
public static Prefab LARGE_PLATFORM = new Prefab("Crossroads_01", "_Scenery/plat_float_07");
public static Prefab GARDENS_PLATFORM = new Prefab("Fungus3_08", "Royal Gardens Plat S");
public static Prefab BOUNCE_MUSHROOM = new Prefab("Fungus2_20", "Bounce Shroom B");
public static Prefab DUSK_KNIGHT = new Prefab("Abyss_05", "Dusk Knight");
public static Prefab WHITE_PALACE_ENTRANCE = new Prefab("White_Palace_11", "door1");
public static Prefab DREAM_ENTRY = new Prefab("White_Palace_11", "Dream Entry");
public static Prefab WHITE_PALACE_LEVER = new Prefab("White_Palace_14", "White Palace Orb Lever");
public static Prefab PURE_VESSEL_STATUE = new Prefab("GG_Workshop", "GG_Statue_HollowKnight");
}
}
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ItemChanger\
MenuChanger

Made by Toboter
Cutscenes drawn by Gaia - the Dancer On The Sun

Available on Scarab

Expand Down
Loading

0 comments on commit 9139916

Please sign in to comment.