|
| 1 | +ScriptName PlanetDBTerminal_Menu Extends TerminalMenu |
| 2 | +{ award planet trait discovery data, optionally set a quest stage } |
| 3 | + |
| 4 | +;-- Variables --------------------------------------- |
| 5 | +; ObjectReference planetDataRef |
| 6 | + |
| 7 | +;-- Properties -------------------------------------- |
| 8 | +sq_parentscript Property SQ_Parent Auto Const mandatory |
| 9 | +{ used to get planet traits } |
| 10 | +Int Property DiscoverTraitMenuItemID = 1 Auto Const |
| 11 | +{ the ID of the menu item that should discover the planet trait } |
| 12 | +Bool Property DiscoverTraitCompletely = True Auto Const |
| 13 | +{ TRUE = player fully discovers the trait |
| 14 | + FALSE = player increments discovery as if they had fully explored a trait overlay } |
| 15 | +TerminalMenu Property Planet_Survey Auto Const mandatory |
| 16 | +{ autofill } |
| 17 | + |
| 18 | +Int Property DiscoverTraitBodyTextIndex = 0 Auto Const |
| 19 | +Int Property NoTraitBodyTextIndex = 1 Auto Const |
| 20 | + |
| 21 | +;-- Functions --------------------------------------- |
| 22 | + |
| 23 | +Event OnTerminalMenuEnter(TerminalMenu akTerminalBase, ObjectReference akTerminalRef) |
| 24 | + |
| 25 | + PlanetDBTerminal myTerminalRef = akTerminalRef as PlanetDBTerminal ; #DEBUG_LINE_NO:23 |
| 26 | + Actor PlayerRef = Game.GetPlayer() |
| 27 | + Location CurrentLocation = PlayerRef.GetCurrentLocation() |
| 28 | + |
| 29 | + If myTerminalRef as Bool && myTerminalRef.planetToCheck == None ; #DEBUG_LINE_NO:24 |
| 30 | + Int bodyTextIndex = NoTraitBodyTextIndex ; #DEBUG_LINE_NO:26 |
| 31 | + GlobalVariable vAllTraitsSurvey = Game.GetFormFromFile(2062, "PlanetDatabankConsole.esm") as GlobalVariable ; Get Global Value to calculate the messege about all traits are already survey or not |
| 32 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->GlobalVariable vAllTraitsSurvey: " + vAllTraitsSurvey.GetValue() as string, 0) |
| 33 | + vAllTraitsSurvey.SetValue(1.0) |
| 34 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->GlobalVariable vAllTraitsSurvey: " + vAllTraitsSurvey.GetValue() as string, 0) |
| 35 | + myTerminalRef.planetToCheck = akTerminalRef.GetCurrentPlanet() ; #DEBUG_LINE_NO:29 |
| 36 | + planet planetToCheck = myTerminalRef.planetToCheck ; #DEBUG_LINE_NO:30 |
| 37 | + Keyword[] planetTraitsKW = planetToCheck.GetKeywordTypeList(SQ_Parent.KeywordType_PlanetTrait) |
| 38 | + Keyword[] planetFloraAbundanceKW = planetToCheck.GetKeywordTypeList(SQ_Parent.KeywordType_PlanetFloraAbundance) |
| 39 | + Keyword[] planetFaunaAbundanceKW = planetToCheck.GetKeywordTypeList(SQ_Parent.KeywordType_PlanetFaunaAbundance) |
| 40 | + |
| 41 | + ;planetDataRef = planetToCheck as ObjectReference |
| 42 | + ;Flora[] floraPlanet = planetDataRef.GetBiomeFlora(100) |
| 43 | + |
| 44 | + sq_parentscript:planettraitdata theData = SQ_Parent.FindMatchingPlanetTrait(CurrentLocation, planetToCheck) ; #DEBUG_LINE_NO:610 |
| 45 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->theData: " + theData as string, 0) |
| 46 | + If theData ; #DEBUG_LINE_NO:611 |
| 47 | + |
| 48 | + EndIf |
| 49 | + |
| 50 | + ;Game.GetPlayer().GetBiomeActors(100) |
| 51 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->Game.GetPlayer().GetBiomeActors(100): " + Game.GetPlayer().GetBiomeActors(100) as string, 0) |
| 52 | + |
| 53 | + ;-- Debug Planetary Information |
| 54 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck: " + planetToCheck as string, 0) |
| 55 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->CurrentLocation: " + CurrentLocation as String, 0) |
| 56 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->CurrentLocation.IsExplored() : " + CurrentLocation.IsExplored() as String, 0) |
| 57 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->CurrentLocation.GetCurrentPlanet() : " + CurrentLocation.GetCurrentPlanet() as String, 0) |
| 58 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->CurrentLocation.HasEverBeenExplored() : " + CurrentLocation.HasEverBeenExplored() as String, 0) |
| 59 | + |
| 60 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetType(): " + planetToCheck.GetType() as string, 0) |
| 61 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetAtmosphereType(): " + planetToCheck.GetAtmosphereType() as string, 0) |
| 62 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetDayLength(): " + planetToCheck.GetDayLength() as string, 0) |
| 63 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetGravity(): " + planetToCheck.GetGravity() as string, 0) |
| 64 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetPressure(): " + planetToCheck.GetPressure() as string, 0) |
| 65 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet planetToCheck.GetTemperature(): " + planetToCheck.GetTemperature() as string, 0) |
| 66 | + |
| 67 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet Keyword[] planetTraitsKW: " + planetTraitsKW as string, 0) |
| 68 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet Keyword[] planetFloraAbundanceKW: " + planetFloraAbundanceKW as string, 0) |
| 69 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planet Keyword[] planetFaunaAbundanceKW: " + planetFaunaAbundanceKW as string, 0) |
| 70 | + |
| 71 | + ;Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->Flora[] floraPlanet: " + floraPlanet as String, 0) |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + ;-- ## PLANET TRAIT |
| 77 | + ;-- Get all Planet Traits from the Planet object |
| 78 | + Keyword[] matchingKeywords = planetToCheck.GetKeywordTypeList(SQ_Parent.KeywordType_PlanetTrait) |
| 79 | + Debug.Trace(":04:PlanetDBTerminal_Menu::DEBUG::VERBOSE->Keyword[] matchingKeywords: " + matchingKeywords as string, 0) |
| 80 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->matchingKeywords.Length: " + matchingKeywords.Length as string, 0) |
| 81 | + |
| 82 | + ;-- Loop in the Array of Keywords from Planet Traits. |
| 83 | + If matchingKeywords.Length > 0 ; #DEBUG_LINE_NO:34 |
| 84 | + Int I = matchingKeywords.Length - 1 ; #DEBUG_LINE_NO:36 |
| 85 | + While I > -1 ; #DEBUG_LINE_NO:37 |
| 86 | + ;-- If Trait from the planet had been already surveyed then remove it from the traits array |
| 87 | + If planetToCheck.IsTraitKnown(matchingKeywords[I]) ; #DEBUG_LINE_NO:38 |
| 88 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->planetToCheck.IsTraitKnown(" + matchingKeywords[I] as string + "): " + planetToCheck.IsTraitKnown(matchingKeywords[I]) as string, 0) |
| 89 | + matchingKeywords.remove(I, 1) ; #DEBUG_LINE_NO:39 |
| 90 | + EndIf |
| 91 | + I += -1 ; #DEBUG_LINE_NO:41 |
| 92 | + EndWhile |
| 93 | + If matchingKeywords.Length == 0 ; #DEBUG_LINE_NO:43 |
| 94 | + matchingKeywords = planetToCheck.GetKeywordTypeList(SQ_Parent.KeywordType_PlanetTrait) ; #DEBUG_LINE_NO:45 |
| 95 | + EndIf |
| 96 | + vAllTraitsSurvey.SetValue(0.0) ; To show the text in terminal that all traits had been survey |
| 97 | + myTerminalRef.traitsKeywordToDiscover = matchingKeywords |
| 98 | + bodyTextIndex = DiscoverTraitBodyTextIndex ; #DEBUG_LINE_NO:50 |
| 99 | + EndIf |
| 100 | + |
| 101 | + ;-- Loop into the array of traits to be discovery to show in the terminal |
| 102 | + Form[] textSurveyTraitsReplacementArray = new Form[matchingKeywords.Length - 1] ; #DEBUG_LINE_NO:82 |
| 103 | + Int I = matchingKeywords.Length - 1 |
| 104 | + While I > -1 |
| 105 | + textSurveyTraitsReplacementArray.add(matchingKeywords[I] as Form, 1) |
| 106 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->matchingKeywords[" + I as String + "]: " + matchingKeywords[I] as string, 0) |
| 107 | + I += -1 |
| 108 | + EndWhile |
| 109 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->textSurveyTraitsReplacementArray: " + textSurveyTraitsReplacementArray as String, 0) |
| 110 | + |
| 111 | + PD_T_02_SurveyTraits.ClearDynamicBodyTextItems(myTerminalRef as ObjectReference) ; #DEBUG_LINE_NO:54 |
| 112 | + PD_T_02_SurveyTraits.AddDynamicBodyTextItem(myTerminalRef as ObjectReference, bodyTextIndex, 1, textSurveyTraitsReplacementArray) ; #DEBUG_LINE_NO:55 |
| 113 | + EndIf |
| 114 | + ;-- ## END PLANET TRAIT |
| 115 | +EndEvent |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +Event OnTerminalMenuItemRun(Int auiMenuItemID, TerminalMenu akTerminalBase, ObjectReference akTerminalRef) |
| 121 | + ;-- Planetary Information Submenu |
| 122 | + If auiMenuItemID == 0 |
| 123 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->auiMenuItemID: " + auiMenuItemID as String, 0) |
| 124 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->Entered menu of Planetary Information", 0) |
| 125 | + |
| 126 | + EndIf |
| 127 | + |
| 128 | + ;-- Survey Planet Traits Submenu |
| 129 | + If auiMenuItemID == 1 |
| 130 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->auiMenuItemID: " + auiMenuItemID as String, 0) |
| 131 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->Entered menu of Survey Planet Traits", 0) |
| 132 | + PlanetDBTerminal myTerminalRef = akTerminalRef as PlanetDBTerminal ; #DEBUG_LINE_NO:63 |
| 133 | + If myTerminalRef ; #DEBUG_LINE_NO:64 |
| 134 | + planet planetToCheck = myTerminalRef.planetToCheck ; #DEBUG_LINE_NO:66 |
| 135 | + |
| 136 | + ;-- Set to 100% the chance to scan trait in order to get completed |
| 137 | + GlobalVariable vChance = Game.GetForm(2427122) as GlobalVariable ; #DEBUG_LINE_NO:27 - Skill_Astrophysics_DiscoverTraitChance [GLOB:002508F2] |
| 138 | + vChance.SetValue(100.0) |
| 139 | + |
| 140 | + ;-- Loop into the array of traits to be discovery and trigger the action |
| 141 | + Int I = myTerminalRef.traitsKeywordToDiscover.Length - 1 |
| 142 | + While I > -1 |
| 143 | + SQ_Parent.OnPlayerScanPlanet(planetToCheck) |
| 144 | + I += -1 |
| 145 | + EndWhile |
| 146 | + |
| 147 | + GlobalVariable vAllTraitsSurvey = Game.GetForm(2062) as GlobalVariable ; Get Global Value to calculate the messege about all traits are already survey or not |
| 148 | + vAllTraitsSurvey.SetValue(1.0) |
| 149 | + EndIf |
| 150 | + EndIf |
| 151 | + |
| 152 | + ;-- Planet Survey Slate Submenu |
| 153 | + If auiMenuItemID == 2 |
| 154 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG::VERBOSE->auiMenuItemID: " + auiMenuItemID as String, 0) |
| 155 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->Entered menu of Download Planet Survey Slate", 0) |
| 156 | + |
| 157 | + PlanetDBTerminal myTerminalRef = akTerminalRef as PlanetDBTerminal ; #DEBUG_LINE_NO:63 |
| 158 | + If myTerminalRef ; #DEBUG_LINE_NO:64 |
| 159 | + planet planetToCheck = myTerminalRef.planetToCheck ; #DEBUG_LINE_NO:66 |
| 160 | + ;-- Trigger the Quest to get the Planet Survey Slate |
| 161 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->Start quest to get the Planet Survey Slate", 0) |
| 162 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->planet planetToCheck: " + planetToCheck as string, 0) |
| 163 | + SQ_Parent.CheckCompletePlanetSurvey(planetToCheck, True) |
| 164 | + Debug.Trace("::PlanetDBTerminal_Menu::DEBUG->End quest to get the Planet Survey Slate", 0) |
| 165 | + EndIf |
| 166 | + EndIf |
| 167 | +EndEvent |
| 168 | + |
0 commit comments