XRWS           (ˆ   Ç  'Áext_01.cat ext_01.dat changelog.txt 57 1609412806 d7b32fbe7cc724b50544ce3e654d11a5
content.xml 1809 1609413121 94327233ccba24fefa023181160ce87d
md/JP_CreateMiningFleet.xml 8311 1609346574 e8f592a7370f1ff554aa01eb6c60eb76
~ Updated: Optimized a bit for performance.. just a bit..<?xml version="1.0" encoding="utf-8"?>

<content id="JP_CreateMiningFleet" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera" version="102" date="2020-12-31" save="0" enabled="1">
  <text language="7"  name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="33" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="34" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="39" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="44" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="49" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="55" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="81" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="82" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="86" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="88" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
</content><?xml version="1.0" encoding="utf-8" ?>

<mdscript name="JP_CreateMiningFleet_MD" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>

    <cue name="JP_CreateMiningFleet_LOOP" instantiate="true" checkinterval="2s">
      <actions>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <set_value name="$DEBUG" exact="0"/>
        <do_if value="$DEBUG gt 0">
          <set_value name="$DebugScriptName" exact="'JP_CreateMiningFleet_LOOP'"/>
          <set_value name="$DebugFolderName" exact="'JP_CreateMiningFleet.logs'"/>
          <set_value name="$DebugFileName" exact="$DebugScriptName + '.xml.log'"/>
          <debug_to_file append="false" directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'[' + player.systemtime.{'%F - %X'} + '] ' + '~~ ' + $DebugScriptName + '.xml ~ Started ~~' + '\n'"/>
        </do_if>
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

        <do_if value="$DEBUG gt 0">
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'TimeMeasurement ~ Start: ' + player.age"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'"/>
        </do_if>

        <create_list name="$_FoundShips"/>
        <find_ship name="$_FoundShips" space="player.galaxy" owner="faction.player" multiple="true">
          <match checkoperational="true"/>
          <match class="[class.ship_s, class.ship_m, class.ship_l, class.ship_xl]"/>
        </find_ship>

        <do_if value="$_FoundShips.count gt 0">
          <do_for_each name="$_FoundShip" in="$_FoundShips" reverse="true">
            <substitute_text source="@$_FoundShip.fleet.name" text="$_FleetName">
              <replace string="'MiningRoutine'" with="''"/>
            </substitute_text>
            <do_if value="$_FoundShip.subordinates.count le 0 or @$_FoundShip.fleet.name == $_FleetName or 
                   ($_FoundShip.defaultorder.id != 'MiningRoutine_Basic' and $_FoundShip.defaultorder.id != 'MiningRoutine_Advanced' and $_FoundShip.defaultorder.id != 'MiningRoutine_Expert')">
              <remove_from_list name="$_FoundShips" list="[$_FoundShip]"/>
            </do_if>
          </do_for_each>
          <remove_value name="$_FleetName"/>
        </do_if>

        <do_for_each name="$_FoundShip" in="$_FoundShips">
          <do_for_each name="$_Subordinate" in="$_FoundShip.subordinates">
            <do_if value="$_Subordinate.isunit">
              <continue/>
            </do_if>
            <do_if value="$_Subordinate.defaultorder.id != $_FoundShip.defaultorder.id or $_Subordinate.assignment != assignment.assist">
              <set_object_commander object="$_Subordinate" commander="$_FoundShip" assignment="assignment.assist"/>
              <create_order object="$_Subordinate" id="$_FoundShip.defaultorder.id" default="true">
                <param name="warebasket" value="$_FoundShip.defaultorder.$warebasket"/>
                <param name="range" value="$_FoundShip.defaultorder.$range"/>
                <param name="minbuy" value="$_FoundShip.defaultorder.$minbuy"/>
                <param name="maxbuy" value="$_FoundShip.defaultorder.$maxbuy"/>
                <param name="minsell" value="$_FoundShip.defaultorder.$minsell"/>
                <param name="maxsell" value="$_FoundShip.defaultorder.$maxsell"/>
              </create_order>
            </do_if>
            <do_else>
              <do_if value="$_Subordinate.defaultorder.$warebasket != $_FoundShip.defaultorder.$warebasket">
                <edit_order_param order="$_Subordinate.defaultorder" param="'warebasket'" value="$_FoundShip.defaultorder.$warebasket"/>
              </do_if>
              <do_if value="$_Subordinate.defaultorder.$range != $_FoundShip.defaultorder.$range">
                <edit_order_param order="$_Subordinate.defaultorder" param="'range'" value="$_FoundShip.defaultorder.$range"/>
              </do_if>
              <do_if value="$_Subordinate.defaultorder.$minbuy != [$_FoundShip.defaultorder.$minbuy, ($_Subordinate.pilot.skill.piloting / 3)].min">
                <edit_order_param order="$_Subordinate.defaultorder" param="'minbuy'" value="[$_FoundShip.defaultorder.$minbuy, ($_Subordinate.pilot.skill.piloting / 3)].min"/>
              </do_if>
              <do_if value="$_Subordinate.defaultorder.$maxbuy != [$_FoundShip.defaultorder.$maxbuy, ($_Subordinate.pilot.skill.piloting / 3)].min">
                <edit_order_param order="$_Subordinate.defaultorder" param="'maxbuy'" value="[$_FoundShip.defaultorder.$maxbuy, ($_Subordinate.pilot.skill.piloting / 3)].min"/>
              </do_if>
              <do_if value="$_Subordinate.defaultorder.$minsell != [$_FoundShip.defaultorder.$minsell, ($_Subordinate.pilot.skill.piloting / 3)].min">
                <edit_order_param order="$_Subordinate.defaultorder" param="'minsell'" value="[$_FoundShip.defaultorder.$minsell, ($_Subordinate.pilot.skill.piloting / 3)].min"/>
              </do_if>
              <do_if value="$_Subordinate.defaultorder.$maxsell != [$_FoundShip.defaultorder.$maxsell, ($_Subordinate.pilot.skill.piloting / 3)].min">
                <edit_order_param order="$_Subordinate.defaultorder" param="'maxsell'" value="[$_FoundShip.defaultorder.$maxsell, ($_Subordinate.pilot.skill.piloting / 3)].min"/>
              </do_if>
            </do_else>
          </do_for_each>
          <set_value name="$_FleetName" exact="'\033#FF03A1FC#' + 'MiningRoutine ~ Sector ' + $_FoundShip.defaultorder.$range.knownname + ' ['"/>
          <do_if value="@$_FoundShip.defaultorder.$warebasket.count gt 0">
            <do_for_each name="$_Ware" in="$_FoundShip.defaultorder.$warebasket" counter="$_it">
              <do_if value="$_it gt 4">
                <set_value name="$_FleetName" operation="add" exact="', ...'"/>
                <break/>
              </do_if>
              <do_if value="$_it gt 1">
                <set_value name="$_FleetName" operation="add" exact="', '"/>
              </do_if>
              <set_value name="$_FleetName" operation="add" exact="$_Ware"/>
            </do_for_each>
            <set_value name="$_FleetName" operation="add" exact="']'"/>
          </do_if>
          <do_else>
            <set_value name="$_FleetName" exact="'\033#FF03A1FC#' + 'MiningRoutine ~ Sector ' + $_FoundShip.defaultorder.$range.knownname + ' [' + $_FoundShip.defaultorder.$warebasket + ']'"/>
          </do_else>
          <do_if value="$_FoundShip.fleet.name != $_FleetName">
            <set_object_fleet_name object="$_FoundShip" name="$_FleetName"/>
          </do_if>
        </do_for_each>

        <do_if value="$DEBUG gt 0">
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'TimeMeasurement ~ End: ' + player.age"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'"/>
        </do_if>

        <remove_value name="$_FoundShips"/>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <do_if value="$DEBUG gt 0">
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'[' + player.systemtime.{'%F - %X'} + '] ' + '~~ ' + $DebugScriptName + '.xml ~ Finished ~~'"/>
          <debug_to_file directory="$DebugFolderName" name="$DebugFileName" text="'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'"/>
          <remove_value name="$DebugFileName"/>
          <remove_value name="$DebugFolderName"/>
          <remove_value name="$DebugScriptName"/>
        </do_if>
        <remove_value name="$DEBUG"/>
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

      </actions>
    </cue>

  </cues>
</mdscript><?xml version="1.0" encoding="utf-8"?>
<content id="" name="" description="" author="JanPanthera" version="102" date="2020-12-31" save="0" lastupdate="">
  <text language="7" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="33" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="34" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="39" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="44" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="49" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="55" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="81" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="82" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="86" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
  <text language="88" name="JP_CreateMiningFleet" description="This gives you a simple way to create mining fleets." author="JanPanthera"/>
</content>
