-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from CWolfs/develop
v0.2.0
- Loading branch information
Showing
10 changed files
with
327 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"todohighlight.keywords": [ | ||
{ | ||
"text": "TODO:", | ||
"color": "blue", | ||
"backgroundColor": "#aec6cf", | ||
"overviewRulerColor": "grey" | ||
} | ||
], | ||
"git.ignoreLimitWarning": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using UnityEngine; | ||
using System; | ||
using Harmony; | ||
|
||
using BattleTech; | ||
using TScript; | ||
using TScript.Ops; | ||
using HBS.Logging; | ||
using HBS.Collections; | ||
|
||
using ExtendedConversations; | ||
using ExtendedConversations.Utils; | ||
|
||
namespace ExtendedConversations.Core { | ||
public class Actions { | ||
public static object TimeSkip(TsEnvironment env, object[] inputs) { | ||
int daysToSkip = env.ToInt(inputs[0]); | ||
Main.Logger.Log($"[TimeSkip] Triggered with days to skip '{daysToSkip}'"); | ||
|
||
SimGameState simulation = UnityGameInstance.BattleTechGame.Simulation; | ||
|
||
for (int i = 0; i < daysToSkip; i++) { | ||
ReflectionHelper.InvokePrivateMethod(simulation, "OnDayPassed", new object[] { 0 }); | ||
} | ||
|
||
Main.Logger.Log($"[TimeSkip] Skip complete"); | ||
return null; | ||
} | ||
|
||
public static object SetCurrentSystem(TsEnvironment env, object[] inputs) { | ||
string systemName = env.ToString(inputs[0]); | ||
bool includeTravelTime = env.ToBool(inputs[1]); | ||
Main.Logger.Log($"[SetCurrentSystem] Travelling to '{systemName}' and includeTravelTime is '{includeTravelTime}'"); | ||
|
||
SimGameState simulation = UnityGameInstance.BattleTechGame.Simulation; | ||
|
||
if (includeTravelTime) { | ||
simulation.TravelToSystemByString(systemName, true); | ||
} else { | ||
StarSystemNode systemNode = simulation.Starmap.GetSystemByID(systemName); | ||
ReflectionHelper.SetReadOnlyProperty(simulation, "CurSystem", systemNode.System); | ||
simulation.SetCurrentSystem(systemNode.System, true, false); | ||
} | ||
|
||
Main.Logger.Log($"[SetCurrentSystem] Travel complete"); | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using UnityEngine; | ||
using System; | ||
using Harmony; | ||
|
||
using BattleTech; | ||
using TScript; | ||
using TScript.Ops; | ||
using HBS.Logging; | ||
using HBS.Collections; | ||
|
||
using ExtendedConversations; | ||
|
||
namespace ExtendedConversations.Core { | ||
public class Conditions { | ||
public static object EvaluateTagForCurrentSystem(TsEnvironment env, object[] inputs) { | ||
bool flag = env.ToBool(inputs[0]); | ||
string value = env.ToString(inputs[1]); | ||
Main.Logger.Log($"[EvaluateTagForCurrentSystem] Triggered with flag {flag} and value {value}."); | ||
|
||
TagSet currentSystemTags = UnityGameInstance.BattleTechGame.Simulation.CurSystem.Tags; | ||
bool flag2 = currentSystemTags.Contains(value) == flag; | ||
Main.Logger.Log("[EvaluateTagForCurrentSystem] Finished with result of " + flag2); | ||
return flag2; | ||
} | ||
|
||
public static object EvaluateBattleTechInt(TsEnvironment env, object[] inputs) { | ||
int statScope = env.ToInt(inputs[0]); | ||
string statName = env.ToString(inputs[1]); | ||
int operation = env.ToInt(inputs[2]); | ||
int compareValue = env.ToInt(inputs[3]); | ||
Main.Logger.Log($"[EvaluateBattleTechInt] Triggered with scope '{statScope}', statName '{statName}', operation '{operation}', compareValue '{compareValue}"); | ||
|
||
StatCollection statCollection; | ||
switch (statScope) { | ||
case 1: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CompanyStats; | ||
break; | ||
case 2: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CommanderStats; | ||
break; | ||
case 3: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CurSystem.Stats; | ||
break; | ||
default: | ||
return false; | ||
} | ||
|
||
if (statCollection.ContainsStatistic(statName)) { | ||
int stat = statCollection.GetValue<int>(statName); | ||
|
||
switch (operation) { | ||
case 1: // less than | ||
return (stat < compareValue); | ||
case 2: // equal to | ||
return (stat == compareValue); | ||
case 3: // greater than | ||
return (stat > compareValue); | ||
case 4: // less than or equal to | ||
return (stat <= compareValue); | ||
case 5: // greater than or equal to | ||
return (stat >= compareValue); | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
Main.Logger.Log($"[EvaluateBattleTechInt] Stat {statName} does not exist for conversation operation."); | ||
return false; | ||
} | ||
|
||
public static object EvaluateFunds(TsEnvironment env, object[] inputs) { | ||
int operation = env.ToInt(inputs[0]); | ||
int moneyCheckValue = env.ToInt(inputs[1]); | ||
int funds = UnityGameInstance.BattleTechGame.Simulation.Funds; | ||
|
||
switch (operation) { | ||
case 1: // less than | ||
return (funds < moneyCheckValue); | ||
case 2: // equal to | ||
return (funds == moneyCheckValue); | ||
case 3: // greater than | ||
return (funds > moneyCheckValue); | ||
case 4: // less than or equal to | ||
return (funds <= moneyCheckValue); | ||
case 5: // greater than or equal to | ||
return (funds >= moneyCheckValue); | ||
default: | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using UnityEngine; | ||
using System; | ||
using Harmony; | ||
|
||
using BattleTech; | ||
using TScript; | ||
using TScript.Ops; | ||
using HBS.Logging; | ||
using HBS.Collections; | ||
|
||
using ExtendedConversations; | ||
using ExtendedConversations.Utils; | ||
|
||
namespace ExtendedConversations.Core { | ||
public class ValueGetters { | ||
public static object GetBattleTechString(TsEnvironment env, object[] inputs) { | ||
int statScope = env.ToInt(inputs[0]); | ||
string statName = env.ToString(inputs[1]); | ||
Main.Logger.Log($"[GetBattleTechString] Triggered with scope {statScope} and statName {statName}."); | ||
|
||
StatCollection statCollection; | ||
switch (statScope) { | ||
case 1: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CompanyStats; | ||
break; | ||
case 2: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CommanderStats; | ||
break; | ||
case 3: | ||
statCollection = UnityGameInstance.BattleTechGame.Simulation.CurSystem.Stats; | ||
break; | ||
default: | ||
return false; | ||
} | ||
|
||
if (statCollection.ContainsStatistic(statName)) { | ||
string stat = statCollection.GetValue<string>(statName); | ||
Main.Logger.Log($"[GetBattleTechString] Stat {statName} found with value {stat}."); | ||
return stat; | ||
} | ||
|
||
Main.Logger.LogError($"[GetBattleTechString] Stat {statName} does not exist for conversation operation."); | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace ExtendedConversations { | ||
public class Settings { | ||
public bool doCoolStuff = false; | ||
public bool placeHolder = false; | ||
public int badStuffToAvoid = 0; | ||
} | ||
} |
Oops, something went wrong.