Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion In System Trader

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Introduces a living market to systems with rewards and risks for in system trading. Introduces a living market to systems with rewards and risks for in system trading.
Identifier oolite.oxp.DrTripsa.InSystemTrader oolite.oxp.DrTripsa.InSystemTrader
Title In System Trader In System Trader
Category Mechanics Mechanics
Author Dr.Tripsa Dr.Tripsa
Version 1.40 1.40
Tags Mechanics Mechanics
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/In_System_Trader n/a
Download URL https://wiki.alioth.net/img_auth.php/3/3d/Oolite.oxp.DrTripsa.InSystemTrader.oxz n/a
License CC BY-NC-SA 3.0 CC BY-NC-SA 3.0
File Size n/a
Upload date 1610873279

Documentation

Also read http://wiki.alioth.net/index.php/In%20System%20Trader

Readme.txt

In System Trader OXP

Version 1.40
(req 1.77+)

Oolite has lacked a certain capability, that is to cater to the less wanderlust-full In System Trader. After all, a single system typically has loads of opportunity. 

All those ships flying in and out of the main station all day and yet none of the stock or prices change to reflect this unless one braves witchspace...? What's an In System Trader to do?

Well, install this OXP for one!

What it does:

One item type is cycled randomly, ammount and price, while you are in system and not docked, this happens periodically based on how active the system is (More traders =  more often). Prices will always fall within system averages so don't go expecting to find 0.1cr computers and impossible deals like that!
The more you trade in system the more your in system reputation grows, beware though, knowing more people also means being known!
What it does not do:

Illegal and or otherwise controlled goods will not be refreshed, Vinnie the Blue Rodent is good... but not that good.

Install this OXP as you would any other.

Notes: 

Yes, this makes it possible to make a (meager) living without witching out to other systems, however, all main station prices will stay well within system average so the real credits remain deeper out in the black. 

It is advised to use this OXP with other OXP's that provide other trade station/locations in system, Such as Y.A.H., HOopyCasinos, etc.

(as of 1.30)
About the Tripsa Tel-com Autonomous Market Watch (A.M.W.) Unit 
     While GalCop heavily encrypts Market Data to prevent price manuipulation, the AMW carefully applies bitshifts and fourier transforms to inform its user of changes in the local system main market. It can identify the commodity which has had a change in price and or availability and prompts the user to view their Market Datascreen.
     Price: 500cr
     Availability: Tech level 9 and above systems.


Changes 
1.0  
     First release
1.01 
     Gold, platinum, liqour/wines, and alien items added to rotation.
     restock capped at 64 units.
     Moved Readme.
1.05 
     Repeatedly redocking now increases the chance you will get the attention of a pirate ambush!
     Well meaning but nosy friends now will try to set you up with good parcel deals to get you out more!
1.10
     Moved Chatter to external plist
     Stock now only cycled if it has been more than one hour (game time) since your last debark with a fresh market!
     Pirates make crude, and embarrasing, threats!
1.11 
     Minor Corrections	
1.20
     Ambush and greetings (when they make no sense) fixed
     Code cleanup and timer use (as suggested by spara)
     Debark timer remover, in favor of 1.77 timer function!
     cycleMarket now explicitly mainStation
1.21
     Very minor code fix
1.22
     1.21 broke it! 1.22 fixed it
1.30 
     Added Autonomous Market Watch Unit
1.35 
     Bugfixes as well as balancing refactored
	 Pirates now harrass spacelanes instead of furballing, slowing traffic and impeading Market
	 Pirates no longer taunt.
	 Station greetings probability reduced and refactored for more random chatter. 
1.40
     Trade at any station will boost System Reputation!
     Pirate ambushes and taunts returned!
	 Number of pirates in ambush, and chances of an ambush, tied to in system reputation!
	 Ambushes can happen at any time... anywhere in system!
	 over 5,880 randomly set chatters!

Equipment

Name Visible Cost [deci-credits] Tech-Level
AMW_Unit yes 5000 9+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/.InSystemTrader_worldscript.js.swp
b0VIM 7.4�4Q�7h�vladSFC~vlad/Dropbox/Development/Game Development/OOLite/dev/In_System_Trader_1.4.oxp/Scripts/InSystemTrader_worldscript.js
3210#"! UtpQ��������KR�adfQ����d4���k'�
j
���T���t6�
�
�
�
h
a

�	�	n	5	����gKD����P������Z�����vtO������kG"���fe		 var workingStation = system.mainStation;		 //Will need to watch for Errors here! 		 //Illeagal/Controlled items are not refreshed!		 //We choose a single commodity to alter/refresh!		 var ChoiceCom = CommList[Choice];		 ChoiceName = CommNames[Choice];1		 if(Choice != 3 && Choice != 6 && Choice != 10){		 var Choice    = Math.floor(Math.random() * CommNames.length);		 var CommList  = ["food","textiles","radioactives","slaves","liquor_wines","luxuries","narcotics","computers","machinery","alloys","firearms","furs","minerals","gold","platinum","gem_stones","alien_items"];		 var CommNames = ["Food","Textiles","Radioactives","Slaves","Liquor/Wines","Luxuries","Narcotics","Computers","Machinery","Alloys","Firearms","Furs","Minerals","Gold","Platinum","Gem-Stones","Alien Items"];		 //we will only allow the market to change when there IS a market and we are not docked!		 {		 if((!system.isInterstellarSpace) && (!player.ship.docked))		 // I'm a moron, me. This needed to be an AND         var ChoiceName = "nothing";{this.cycleMarket = function()}    //We will check docked status in the cycleMarket and do nothing if docked or if there is no MainStation!    //initially this is a 300 second timer delay, to prevent changes While docked. 	this.timer = new Timer(this, this.cycleMarket, 300, 300);	}	    this.IN_SYSTEM_TRADER_REP = missionVariables.IN_SYSTEM_TRADER_REP;	{	else    }		//otherwise we use a this.property		//we only want to touch the missionVariables on save/load		//missionVariables.IN_SYSTEM_TRADER_LAST_DEBARK = 0;        missionVariables.IN_SYSTEM_TRADER_REP = 0;    if (!missionVariables.IN_SYSTEM_TRADER_REP){    */    Handle first use of oxp, if we have no rep we set it to 0 for the first time!    /*this.startUp = function (){//     Ambushes now happen where the player is //     Although in Modified format//     By popular demand, returned ambush and taunt//1.4//     Fixed a bug that was causing Market updates while docked!//     Friendly com traffic reduced (multiplier removed)//     Pirate taunts, while fun, have also been removed, as they make less sense now.//     -Much rarer as well (multiplier removed)//     rather than attack player directly//     Refactored pirate attack, now I use them to impeade traders//1.35//     Added A.M.W. Unit Equipment and notification//1.30 //     Fixed something I broke when fixing things... //1.22//     Fixed a code redundancy//1.21 //     cycleMarket now explicitly mainStation//     Debark timer remover, in favor of 1.77 timer function!//     Code cleanup and timer use (as suggested by spara)//     Ambush and greetings (when they make no sense) fixed//1.20//     Bugfix, refactored plist values//1.11//     Pirates make crude, and embarrasing, threats!//     Stock now only cycled if it has been more than one hour (game time) since your last debark with a fresh market!//     Moved Chatter to external plist//1.10//     Well meaning but medlesome friends now will try to set you up with good parcel deals to get you out more!//     Repeatdly redocking now increases the chance you will get the attention of a pirate wing!//1.05 Added IN_SYSTEM_TRADER_REP property, will be used for tracking w/ mission variables.//1.01 added remaining items, no illegals, capped item stock at 63.//1.0 Basic changes, re-calculate prices/quantities when player leaves main station.//this.IN_SYSTEM_TRADER_LAST_DEBARK = 0; <=No longer usedthis.IN_SYSTEM_TRADER_REP = 0;this.version     = "1.4";this.description = "In system trader support"; this.licence     = "CC BY 3.0"; this.copyright   = "2013 Rob Hess";this.author      = "Dr.Tripsa"; this.name        = "In_System_Trader"; "use strict";ad�������}	}		 player.commsMessage(system.name + " traffic control: " + expandDescription("[in_system_trader_greet] [in_system_trader_invite] [in_system_trader_relation] [nom]. [in_system_trader_offer]"));		 //This too has had it's multiplier removed to make it less predictable[
Scripts/InSystemTrader_worldscript.js
"use strict";
this.name        = "In_System_Trader"; 
this.author      = "Dr.Tripsa"; 
this.copyright   = "2013 Rob Hess";
this.licence     = "CC BY 3.0"; 
this.description = "In system trader support"; 
this.version     = "1.4";
this.IN_SYSTEM_TRADER_REP = 0;
//this.IN_SYSTEM_TRADER_LAST_DEBARK = 0; <=No longer used

//1.0 Basic changes, re-calculate prices/quantities when player leaves main station.
//1.01 added remaining items, no illegals, capped item stock at 63.
//1.05 Added IN_SYSTEM_TRADER_REP property, will be used for tracking w/ mission variables.
//     Repeatdly redocking now increases the chance you will get the attention of a pirate wing!
//     Well meaning but medlesome friends now will try to set you up with good parcel deals to get you out more!
//1.10
//     Moved Chatter to external plist
//     Stock now only cycled if it has been more than one hour (game time) since your last debark with a fresh market!
//     Pirates make crude, and embarrasing, threats!
//1.11
//     Bugfix, refactored plist values
//1.20
//     Ambush and greetings (when they make no sense) fixed
//     Code cleanup and timer use (as suggested by spara)
//     Debark timer remover, in favor of 1.77 timer function!
//     cycleMarket now explicitly mainStation
//1.21 
//     Fixed a code redundancy
//1.22
//     Fixed something I broke when fixing things... 
//1.30 
//     Added A.M.W. Unit Equipment and notification
//1.35
//     Refactored pirate attack, now I use them to impeade traders
//     rather than attack player directly
//     -Much rarer as well (multiplier removed)
//     Pirate taunts, while fun, have also been removed, as they make less sense now.
//     Friendly com traffic reduced (multiplier removed)
//     Fixed a bug that was causing Market updates while docked!
//1.4
//     By popular demand, returned ambush and taunt
//     Although in Modified format
//     Ambushes now happen where the player is 
this.startUp = function (){
    /*
    Handle first use of oxp, if we have no rep we set it to 0 for the first time!
    */
    if (!missionVariables.IN_SYSTEM_TRADER_REP){
        missionVariables.IN_SYSTEM_TRADER_REP = 0;
		//missionVariables.IN_SYSTEM_TRADER_LAST_DEBARK = 0;
		//we only want to touch the missionVariables on save/load
		//otherwise we use a this.property
    }
	else
	{
	    this.IN_SYSTEM_TRADER_REP = missionVariables.IN_SYSTEM_TRADER_REP;
	}
	this.timer = new Timer(this, this.cycleMarket, 300, 300);
    //initially this is a 300 second timer delay, to prevent changes While docked. 
    //We will check docked status in the cycleMarket and do nothing if docked or if there is no MainStation!
}



this.cycleMarket = function()
{
         var ChoiceName = "nothing";
		 // I'm a moron, me. This needed to be an AND
		 if((!system.isInterstellarSpace) && (!player.ship.docked))
		 {
		 //we will only allow the market to change when there IS a market and we are not docked!
		 var CommNames = ["Food","Textiles","Radioactives","Slaves","Liquor/Wines","Luxuries","Narcotics","Computers","Machinery","Alloys","Firearms","Furs","Minerals","Gold","Platinum","Gem-Stones","Alien Items"];
		 var CommList  = ["food","textiles","radioactives","slaves","liquor_wines","luxuries","narcotics","computers","machinery","alloys","firearms","furs","minerals","gold","platinum","gem_stones","alien_items"];
		 var Choice    = Math.floor(Math.random() * CommNames.length);
		 if(Choice != 3 && Choice != 6 && Choice != 10){
		 ChoiceName = CommNames[Choice];1
		 var ChoiceCom = CommList[Choice];
		 //We choose a single commodity to alter/refresh!
		 //Illeagal/Controlled items are not refreshed!
		 //Will need to watch for Errors here! 
		 var workingStation = system.mainStation;
		 var RAND_MULT = (system.scrambledPseudoRandomNumber(clock.minutes) * 255);
		 workingStation.setMarketPrice(ChoiceName,((Number(workingStation.market[ChoiceCom].marketBasePrice)) + (RAND_MULT & Number(workingStation.market[ChoiceCom].marketMaskPrice)) + ( Number(system.economy) * Number(workingStation.market[ChoiceCom].marketEcoAdjustPrice)))*4);
		 workingStation.setMarketQuantity(ChoiceName,(Number(workingStation.market[ChoiceCom].marketBaseQuantity) + (RAND_MULT & Number(workingStation.market[ChoiceCom].marketMaskQuantity)) - ( Number(system.economy) * Number(workingStation.market[ChoiceCom].marketEcoAdjustQuantity))) & 63);
		 //If the player has the EQ_SYSTEM_MARKET_WATCH, let us inform them of a change!
		 if(player.ship.equipmentStatus("EQ_SYSTEM_MARKET_WATCH") == "EQUIPMENT_OK")
		 {
		     var mySound = new SoundSource;
             mySound.sound = "beep.ogg";
             mySound.play();
			 player.consoleMessage("A.M.W.: Stock rotation detected on commodity: " + ChoiceName + ". See market datascreen (F8) for details.",8);
		 }
		 }
		 else
		 {
		     //Move pirate ambush code here as well, to be triggered when an invalid commodity is chosen
		     var RAND_MULTB = (Math.random() * 255);
		     //yes, we have a new RAND_MULT for this, separate of the clock
		     if((this.IN_SYSTEM_TRADER_REP >= RAND_MULTB) && (this.IN_SYSTEM_TRADER_REP >= 2))
		     {   
		         //Ambush redux, the bitwise and caps the number of pirates at 16
			     //and comparing RAND_MULTB in the if keeps the players IN_SYSTEM_TRADER_REP relevant
			     //as the number of pirates will never be more than the players IN_SYSTEM_TRADER_REP
			     //I also removed the multiplier but kept the 'Rep must be at least 2' factor
			     var ambush = system.addShips("pirate",((RAND_MULTB & 15) +1), player.ship.position);
			     //Returning taunts
			     ambush[0].commsMessage(expandDescription("[in_system_trader_pgreet] [in_system_trader_ptaunt]"));
		     }
		 }
		 //Change the timer.interval, based on system activity, TY Spara!
         var traders = system.countShipsWithPrimaryRole("trader");
         if (traders > 0)
             {
                 // 1/traders * (30 + [0 - 30]) mins till next price and restock check
                 this.timer.interval = Math.round((1 / traders) * (1800 + (Math.random() * 1800)));
             }
         }
}

this.shipLaunchedFromStation = function(station)
{
         // Here we will give the IN_SYSTEM_TRADER_REP a boost
		 // We used to limit this to main station, now any station in system 
		 // will boost IN_SYSTEM_TRADER_REP!
		 this.IN_SYSTEM_TRADER_REP += 1;
		 // If our IN_SYSTEM_TRADER_REP has crossed a threshhold of 16, we give a parcel Reputation bonus for knowing "the right" people!
		 // Note this probably will not have any effect until the player witches out and a new set of parcels is generated!
		 var test = this.IN_SYSTEM_TRADER_REP % 16;
		 if(test === 0)
		 {
		     player.increaseParcelReputation();
		 }
		 
}

this.shipExitedWitchspace = function()
{
     //Divide IN_SYSTEM_TRADER_REP by 2
	 //This will cause decrease as the once system bound player explores the Ooniverse
	 this.IN_SYSTEM_TRADER_REP /= 2;
}

this.playerWillSaveGame = function(message)
{
     //Here we move the property back to mission variable for save.
	 missionVariables.IN_SYSTEM_TRADER_REP = this.IN_SYSTEM_TRADER_REP;
}

this.shipEnteredStationAegis = function(station)
{
     //Give player a hint that the friends they have made might have deals for them
	 var RAND_MULT = (Math.random() * 255);
	 // this is indepandant of the clock
	 if((this.IN_SYSTEM_TRADER_REP >= RAND_MULT) && (this.IN_SYSTEM_TRADER_REP >=2))
	{
	     //periodically we give the player a hint... friend of a friend etc
		 //This too has had it's multiplier removed to make it less predictable[
		 player.commsMessage(system.name + " traffic control: " + expandDescription("[in_system_trader_greet] [in_system_trader_invite] [in_system_trader_relation] [nom]. [in_system_trader_offer]"));
	}
}