XRWS           Ï   “  <ext_01.cat ext_01.dat md/XG001_BuyTradeSubscription.xml 6648 1459981614 5a41830dcdec67f5af6c9960e8313c2a
t/0001-L044.xml 324 1420397373 86c57a859b608b2cb76d256096258b27
ï»¿<?xml version="1.0" encoding="utf-8"?>
<mdscript name="XG001_BuyTradeSubscription" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../md.xsd">
	<documentation>
		<author name="SilentStorm" alias="XGamer" contact="XGamer on Egosoft Forums http://forum.egosoft.com"/>
		<content name="Buy Trade Subscription" description="Eliminates the tediousness of being forced to play the stupid Smalltalk Minigame a zillion times over in order to be able to trade in the first place"/>
		<version number="4" date="4/6/2016" status="release"/>
	</documentation>
	<cues>
		<cue name="Root" instantiate="true" namespace="this" version="4">
			<conditions>
				<check_all>
					<event_conversation_started conversation="default"/>
					<check_value value="event.object.isplayerowned" exact="0" comment="Not for player owned Actors"/>
					<check_value value="event.object.isremotecommable" exact="1" comment="Must be able to contact this actor remotely"/>
					<check_value value="event.object.zone" exact="player.zone" comment="Player must be in the same zone as the actor"/>
					<check_value value="event.object.type" exact="entitytype.manager" comment="Actor must be a Station Manager"/>
					<check_value value="event.object.station.isclass.station" exact="1" comment="Must be on a Station"/>
					<check_value value="event.object.station.isoperational" exact="1" comment="Station the actor is on must be operational (working) [This is most likely superflous as any other station wouldn't have a manager or any entities on board but w/e]"/>
					<check_value value="event.object.station.isplayerowned" exact="0" comment="Must not be a player owned station"/>
					<!--<check_value value="event.object.station.revealedpercentage" min="50" comment="Must have discovered at least half of the station already (seems too OP otherwise)"/>-->
					<check_value value="event.object" exact="event.object.station.controlentity.{entitytype.manager}" comment="Actor we have the conversation with must be THE station manager"/>
					<!--<check_value value="event.object.station.hastradesubscription" exact="0" comment="Only if player doesn't already have Trade Offer Subscription for this station"/>-->
				</check_all>
			</conditions>
			<actions>
				<do_all>
					<set_value name="$actor" exact="event.object"/>
					<set_value name="$station" exact="$actor.station"/>
					
					<do_if value="$station.hastradesubscription" exact="0">
						<set_value name="$price" min="45000" max="95000" profile="increasing" comment="Propably pretty darn cheap but meh... it's supposed to make life easier so I guess it's fine."/>
						<add_player_choice section="xg001_trdsub_buy" text="{1337001, 2}.[$price]" choiceparam="$price" position="right" selectable="(player.money ge ($price * 100) and $station.revealedpercentage ge 50)"/>
					</do_if>

					<do_if value="$station.revealedpercentage" max="99">
						<set_value name="$priceScan" min="8000" max="25000"/>
						<set_value name="$priceScan" exact="($priceScan * $station.numinfoslots) / 100 * (100 - $station.revealedpercentage)"/>
						<add_player_choice section="xg001_trdsub_scan" text="{1337001, 3}.[$priceScan]" choiceparam="$priceScan" position="left" selectable="player.money ge ($priceScan * 100)" />
					</do_if>
				</do_all>
			</actions>
			<cues>
				<cue name="ConvBuyUpdates" version="2">
					<conditions>
						<check_all>
							<event_conversation_next_section actor="$actor" section="xg001_trdsub_buy"/>
							<check_value value="event.object.station.isclass.station"/>
						</check_all>
					</conditions>
					<actions>
						<do_all>
							<do_if value="player.money" min="$price" comment="Only if player has the money">
								<reward_player money="($price * -1) Cr"/>
								<add_npc_line line="4119"/>
								<add_trade_subscription object="$actor.station"/>
							</do_if>
							<do_else comment="Not enough money">
								<add_npc_line line="42"/>
								<write_to_logbook text="'Failed to buy trade subscription due to lack of money. Player Account: %1 Credits. Required: %2 Credits. Player Missing: %3 Credits.'.[(player.money)Cr, $price, (((player.money)Cr) - (($price)Cr))]" category="general"/>
							</do_else>
						</do_all>
					</actions>
				</cue>
				<cue name="ConvBuyStationScan" version="1">
					<conditions>
						<event_conversation_next_section actor="$actor" section="xg001_trdsub_scan"/>
					</conditions>
					<actions>
						<do_all>
							<do_if value="player.money" min="$priceScan">
								<reward_player money="($priceScan * -1) Cr"/>
								<add_npc_line line="4119"/>
								<set_known object="$station" known="1"/>
								<reveal_object object="$station" exact="100"/>
							</do_if>
							<do_else>
								<add_npc_line line="42"/>
							</do_else>
						</do_all>
					</actions>
				</cue>
				<cue name="ConvRestoreOption" instantiate="true" version="3" comment="Required since for some reason, the added option is lost when returning to this menu from another sub-conversation">
					<conditions>
						<event_conversation_returned_to_section actor="parent.$actor" section="default"/>
					</conditions>
					<actions>
						<do_all>
							<do_if value="ConvBuyUpdates.state" exact="cuestate.waiting" comment="Only if we didn't complete the purchase (in which case waiting is the only possible state. If we completed it's either complete or cancelled. If it's in disabled state this cue wouldn't exist in the first place.">
								<do_if value="$station.hastradesubscription" exact="0">
									<add_player_choice section="xg001_trdsub_buy" text="{1337001, 2}.[$price]" choiceparam="$price" position="right" selectable="(player.money ge ($price * 100) and $station.revealedpercentage ge 50)"/>
								</do_if>
							</do_if>
							<do_if value="ConvBuyStationScan.state" exact="cuestate.waiting">
								<do_if value="$station.revealedpercentage" max="99">
									<add_player_choice section="xg001_trdsub_scan" text="{1337001, 3}.[$priceScan]" choiceparam="$priceScan" position="left" selectable="player.money ge ($priceScan * 100)" />
								</do_if>
							</do_if>
						</do_all>
					</actions>
				</cue>
				<cue name="Cleanup" version="1">
					<conditions>
						<event_conversation_finished actor="$actor"/>
					</conditions>
					<actions>
						<do_all>
							<cancel_cue cue="parent" comment="Kill this and any other cues in this instance to allow it to be removed"/>
						</do_all>
					</actions>
				</cue>
			</cues>
		</cue>
	</cues>
</mdscript><?xml version="1.0" encoding="utf-8"?>
<language id="44">
	<page id="1337001" title="Buy Trade Subscription" desc="Texts for the Buy Trade Subscription Mod" voice="no">
		<t id="1">Buy Trade Subscription</t>
		<t id="2">Get Trade Updates \(%1 Cr.\)</t>
		<t id="3">Buy Station Info \(%1 Cr.\)</t>
	</page>
</language><?xml version="1.0" encoding="utf-8"?>
<content id="" name="" date="2016-04-07" version="104" save="false" description="" author="ï®’Ä­Î¶ÎµÎ·Å§ï¯–Å£oÅ•Ð¼" lastupdate="">
  <text lang="44" name="Buy Trade Subscription" description="Removes the need to play the highly repetitive Smalltalk minigame over and over again, just to maybe get lucky and have the option to subscribe to trade offers, which is (kind of) required to do any trading in the first place.&#10;Now you can just purchase it from the Trade Manager for a small fee, after you've scanned at least half the station." author="XGamer"/>
  <dependency version="310"/>
</content>
