diff --git a/xtrn/druglord/ANSI.js b/xtrn/druglord/ANSI.js new file mode 100644 index 0000000000000000000000000000000000000000..f0a6212a9113370f3fbcea7334efbc4943ec574c --- /dev/null +++ b/xtrn/druglord/ANSI.js @@ -0,0 +1,27 @@ +// +// ANSI Object +// +ANSI = new Object(); + +ANSI.ESC = "["; + +ANSI.DEFAULT = ANSI.ESC + "0m"; + +ANSI.BOLD = ANSI.ESC + "1m"; + +ANSI.FG_BLACK = ANSI.ESC + "30m"; +ANSI.FG_RED = ANSI.ESC + "31m"; +ANSI.FG_GREEN = ANSI.ESC + "32m"; +ANSI.FG_YELLOW = ANSI.ESC + "33m"; +ANSI.FG_BLUE = ANSI.ESC + "34m"; +ANSI.FG_MAGENTA = ANSI.ESC + "35m"; +ANSI.FG_CYAN = ANSI.ESC + "36m"; +ANSI.FG_WHITE = ANSI.ESC + "37m"; +ANSI.BG_BLACK = ANSI.ESC + "40m"; +ANSI.BG_RED = ANSI.ESC + "41m"; +ANSI.BG_GREEN = ANSI.ESC + "42m"; +ANSI.BG_YELLOW = ANSI.ESC + "43m"; +ANSI.BG_BLUE = ANSI.ESC + "44m"; +ANSI.BG_MAGENTA = ANSI.ESC + "45m"; +ANSI.BG_CYAN = ANSI.ESC + "46m"; +ANSI.BG_WHITE = ANSI.ESC + "47m"; \ No newline at end of file diff --git a/xtrn/druglord/Drug.js b/xtrn/druglord/Drug.js new file mode 100644 index 0000000000000000000000000000000000000000..6c5b10564a7c2b77ff8ac78e20afb962f1ac629c --- /dev/null +++ b/xtrn/druglord/Drug.js @@ -0,0 +1,157 @@ +function Drug() { + this.name = "Drug"; + this.inventory = 0; + this.price = 0; +} + +function drugs_init() { + var drugs = new Array(); + + var cocaine = new Drug(); + cocaine.name = "Cocaine"; + drugs.push(cocaine); + + var hash = new Drug(); + hash.name = "Hash"; + drugs.push(hash); + + var heroin = new Drug(); + heroin.name = "Heroin"; + drugs.push(heroin); + + var lsd = new Drug(); + lsd.name = "LSD"; + drugs.push(lsd); + + var mdma = new Drug(); + mdma.name = "MDMA"; + drugs.push(mdma); + + var pcp = new Drug(); + pcp.name = "PCP"; + drugs.push(pcp); + + var peyote = new Drug(); + peyote.name = "Peyote"; + drugs.push(peyote); + + var shrooms = new Drug(); + shrooms.name = "Shrooms"; + drugs.push(shrooms); + + var speed = new Drug(); + speed.name = "Speed"; + drugs.push(speed); + + var weed = new Drug(); + weed.name = "Weed"; + drugs.push(weed); + + druglord_state['drugs'] = new Object(drugs); +} + +function buy_drugs() { + console.write("Buy what? "); + + var idx_buy = console.getnum(druglord_state['drugs'].length) - 1; + + if (idx_buy != NaN && druglord_state['drugs'][idx_buy] != undefined) { + var drug = druglord_state['drugs'][idx_buy]; + var price = druglord_state['location'].price[drug.name.toLowerCase()]; + + if ((druglord_state['cash'] / price) >= 1) { + var max_units = Math.min(Math.floor(druglord_state['cash'] / price), (druglord_state['inventory_size'] - get_player_drug_units())); + console.write("Buy how many units of " + drug.name + " for �" + nice_number(price) + "/unit? (CR: max - " + max_units + "): "); + + var buy_amt = console.getnum(max_units); + // Returns 0 if CR entered. + + /* Default to buy maximum possible. */ + if (buy_amt === 0) { + buy_amt = max_units; + } + + + if (buy_amt != NaN && buy_amt >= 1) { + + if ((get_player_drug_units() + buy_amt) <= druglord_state['inventory_size']) { + + var cost = buy_amt * price; + var buy_confirm = console.yesno(buy_amt + " units will cost �" + nice_number(cost)); + + if (buy_confirm) { + console.writeln("You pay for the transaction."); + + var player_drug = get_player_drug(drug.name); + player_drug.inventory += buy_amt; + + druglord_state['cash'] -= cost; + } + + } else { + console.writeln("You can't hold that much."); + } + + } + } else { + console.writeln("Nae. You can't afford that."); + } + } +} + +function get_player_drug(name) { + for (var a = 0; a < druglord_state['drugs'].length; a++) { + if (name.toLowerCase() == druglord_state['drugs'][a].name.toLowerCase()) { + //log("Returning: " + druglord_state['drugs'][a].name); + return druglord_state['drugs'][a]; + } + } +} + +/* Return number of units used in inventory. */ +function get_player_drug_units() { + var count = 0; + + for (var a = 0; a < druglord_state['drugs'].length; a++) { + count += druglord_state['drugs'][a].inventory; + } + + return count; +} + +function sell_drugs() { + console.write("Sell what? "); + + var idx_sell = console.getnum(druglord_state['drugs'].length) - 1; + + if (idx_sell != NaN && druglord_state['drugs'][idx_sell] != undefined) { + var drug = druglord_state['drugs'][idx_sell]; + var price = druglord_state['location'].price[drug.name.toLowerCase()]; + + if (drug.inventory >= 1) { + console.write("Sell how many units of " + drug.name + " for �" + nice_number(price) + "/unit? (CR: max - " + drug.inventory + "): "); + + var sell_amt = console.getnum(drug.inventory); + + if (sell_amt === 0) { + sell_amt = drug.inventory; + } + + /* Default to sell all. */ + + if (sell_amt != NaN & sell_amt >= 1) { + var cost = sell_amt * price; + var sell_confirm = console.yesno("Sell " + sell_amt + " units for �" + nice_number(cost)); + + if (sell_confirm) { + console.writeln("You get paid for the transaction."); + + var player_drug = get_player_drug(drug.name); + player_drug.inventory -= sell_amt; + + druglord_state['cash'] += cost; + } + } + } + } +} \ No newline at end of file diff --git a/xtrn/druglord/INSTALL.txt b/xtrn/druglord/INSTALL.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaa755163a794a748c37d4daee85204abc70c894 --- /dev/null +++ b/xtrn/druglord/INSTALL.txt @@ -0,0 +1,94 @@ +-------- +DrugLord +-------- +Please see README.txt. + +Note that InterBBS features are disabled by default. See the Requirements, Installation and Hosting sections. + +------------ +Requirements +------------ +- DrugLord's InterBBS capability relies on the following libraries from mcmlxxix: + - exec/load/json-client.js + You can grab this from the Synchronet CVS repository, if you don't have it already. + +------------------- +Supported Platforms +------------------- +Any platform that supports Synchronet and spidermonkey should be able to run DrugLord. + +DrugLord has been tested on: + +- Windows Server 2008 (x86). +- Arch Linux (ARM - Raspberry Pi). +- Ubuntu Linux (x64). + +------------ +Installation +------------ +1. Get the sources. They can be found on cvs.synchro.net, the official Synchronet repository. + + Git it: + For the latest code/unstable branch, you can click the first 'snapshot' link here: + http://git.poorcoding.com/?p=druglord + This will get the latest snapshot of the source from the repository in .tgz format. + Extract and put the 'druglord' folder into /sbbs/xtrn. + +2. Configure the door in SCFG: + ╔[■][?]════════════════════════════════════════════════════╗ + ║ DrugLord ║ + ╠══════════════════════════════════════════════════════════╣ + ║ │Name DrugLord ║ + ║ │Internal Code DRUGLORD ║ + ║ │Start-up Directory ../xtrn/druglord ║ + ║ │Command Line ?druglord ║ + ║ │Clean-up Command Line ║ + ║ │Execution Cost None ║ + ║ │Access Requirements ║ + ║ │Execution Requirements ║ + ║ │Multiple Concurrent Users Yes ║ + ║ │Intercept I/O No ║ + ║ │Native Executable No ║ + ║ │Use Shell to Execute No ║ + ║ │Modify User Data No ║ + ║ │Execute on Event No ║ + ║ │Pause After Execution No ║ + ║ │BBS Drop File Type None ║ + ║ │Place Drop File In Node Directory ║ + ╚══════════════════════════════════════════════════════════╝ + +3. InterBBS is disabled by default, but is simple to enable. Ensure you have read the requirements section. If you want to enable InterBBS mode, please edit 'druglord.js' and set the 'USE_JSON' key in druglord_config to true: + + var druglord_config = { + ... + USE_JSON: true, /* Use JSON interbbs functions? false to disable. */ + ... + } + + If you wish to host your own high scores service please read the hosting section below. + +------------ +Instructions +------------ +Please see the README.txt document for in-game instructions. + +------------------------ +Hosting the JSON Service +------------------------ +By default, when InterBBS enabled, DrugLord will send and retrieve InterBBS data from the global server (Fatcats BBS). If you want to host your own JSON service, you are mostly on your own, please note: + +1. Your BBS should be configured with the JSON service. In your ctrl/services.ini, ensure this is enabled: + [JSON] + Port=10088 + Options=STATIC | LOOP + Command=json-service.js + +2. Edit ctrl/json-service.ini, adding the line: + druglord=../xtrn/druglord/ + Note that if you changed the installation path, this line must be similarly changed. + +3. Restart the Synchronet Services service. + +4. Edit 'druglord.js'. Modify the line: + var json = new JSONClient("fatcatsbbs.com", 10088); + Change "fatcatsbbs.com" to "localhost", for example. \ No newline at end of file diff --git a/xtrn/druglord/Location.js b/xtrn/druglord/Location.js new file mode 100644 index 0000000000000000000000000000000000000000..570d373790a8aa1e3aeb8fdfad70cdd3617805b2 --- /dev/null +++ b/xtrn/druglord/Location.js @@ -0,0 +1,156 @@ +function Location() { + /* Location name. */ + this.name = "Location"; + + /* x,y global co-ordinates. */ + this.x = 0; + this.y = 0; + + this.drugs = undefined; + + this.news = ""; + + this.price = { + } +} + +function locations_init() { + var loc_walthamstow = new Location(); + loc_walthamstow.name = "Walthamstow Central"; + druglord_state['locations'].push(loc_walthamstow); + + var loc_camden = new Location(); + loc_camden.name = "Camden Town"; + druglord_state['locations'].push(loc_camden); + + var loc_kgx = new Location(); + loc_kgx.name = "King's Cross"; + druglord_state['locations'].push(loc_kgx); + + var loc_pad = new Location(); + loc_pad.name = "Paddington"; + druglord_state['locations'].push(loc_pad); + + var loc_soh = new Location(); + loc_soh.name = "Soho / Chinatown"; + druglord_state['locations'].push(loc_soh); + + var loc_brixton = new Location(); + loc_brixton.name = "Brixton"; + druglord_state['locations'].push(loc_brixton); + + var loc_pkm = new Location(); + loc_pkm.name = "Peckham"; + druglord_state['locations'].push(loc_pkm); + + randomize_prices(); +} + +/* Randomize prices for all locations. */ +function randomize_prices() { + for (var a = 0; a < druglord_state['locations'].length; a++) { + druglord_state['locations'][a].price = { + cocaine: 10000 + random(15000), + hash: 250 + random(700), + heroin: 5000 + random(10000), + lsd: 800 + random(1000), + mdma:1000 + random(2500), + pcp:700 + random(1500), + peyote:300 + random(500), + shrooms:200 + random(500), + speed: 100 + random(150), + weed: 140 + random(250), + + } + druglord_state['locations'][a].news = ""; + + /* TODO: Random events. */ + var r = random(4); + + if (r == 0) { + var r_drug = random(druglord_state['drugs'].length); + + var drug = druglord_state['drugs'][r_drug]; + + if (drug != undefined) { + + //log(druglord_state['drugs'].toSource()); + + var reason = random(5); + + var reason_str; + + switch (reason) { + case 0: + reason_str = "Drug convention drives prices for " + drug.name + " sky high!"; + break; + case 1: + reason_str = "Huge " + drug.name + " bust: addicts buy at ridiculous prices!"; + break; + case 2: + reason_str = "Busted " + drug.name + " dealer: shortage makes prices outrageous!"; + break; + case 3: + reason_str = drug.name + " drought: addicts will buy at any price!"; + break; + default: + reason_str = "Border control seizes " + drug.name + ": addicts are going insane!"; + break; + } + + druglord_state['locations'][a].news = reason_str; + + druglord_state['locations'][a].price[drug.name.toLowerCase()] *= 2 + random(3); + } + } + } +} + +function travel_locations() { + console.writeln(ANSI.BOLD + "Where do you want to go?" + ANSI.DEFAULT); + for (var a = 0; a < druglord_state['locations'].length; a++) { + console.writeln(" " + Number(a+1) + ". " + druglord_state['locations'][a].name + "."); + } + + console.write("Travel to: "); + + var idx_travel = console.getnum(druglord_state['locations'].length) - 1; + + if (druglord_state['location'] == druglord_state['locations'][idx_travel]) { + console.crlf(); + console.writeln(ANSI.FG_RED + "You're already here." + ANSI.DEFAULT); + console.crlf(); + } else if (druglord_state['locations'][idx_travel] != undefined) { + console.crlf(); + console.writeln(ANSI.FG_BLACK + ANSI.BOLD + "Travelling to " + druglord_state['locations'][idx_travel].name + "..." + ANSI.DEFAULT); + console.crlf(); + druglord_state['location'] = druglord_state['locations'][idx_travel]; + + /* Add time each travel. */ + druglord_state['day'] += 0.3; + + var event_triggered = false; + + /* Chance to buy pocket. */ + var r_pocket = random(10); + if (r_pocket == 0) { + buy_pockets(); + event_triggered = true; + } + + /* Generate random events. */ + if (event_triggered == false) { + var r_event = random(100); + switch (r_event) { + case 0: + event_cops(); + event_triggered = true; + break; + case 1: + event_dog(); + event_triggered = true; + break; + } + } + } +} \ No newline at end of file diff --git a/xtrn/druglord/README.txt b/xtrn/druglord/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fd7263fed04fd986872b5d709a71b8b7c05c1fc --- /dev/null +++ b/xtrn/druglord/README.txt @@ -0,0 +1,44 @@ +-------- +DrugLord +-------- +DrugLord is a game similar to Dope Wars and its derivatives. + +Website:�http://art.poorcoding.com. + +-------- +Features +-------- +- Buy and sell various drugs to profit. +- Travel between locations to maximise your return on investment. +- Random events help or hinder your enterprise. +- Pay off your high-interest debt as soon as you can. +- You have 30 days, how much is your net worth? +- "Zero-config" InterBBS scoreboards. * + +* You need to allow the proper outbound port if your policy restricts outbound traffic. + +------------ +Instructions +------------ +- 't'ravel between locations. +- 'b'uy drugs at low prices. +- 's'ell drugs at high prices. +- Take advantage of the 'n'ewspaper to maximise profits during shortages. +- You may be offered to purchase pocketspace--this increases the amount you can hold. +- You have until the end of the 30th day. +- Disasters may strike such as police operations which may affect your livelihood. +- If you find yourself with nothing, you can loan money from ATMs--this increases your debt. +- Score: score is your average profit per day. + +----------- +Coming soon +----------- +- More, more, more: drugs, events, locations. + +------- +Credits +------- + AUTHOR: art, at fatcatsbbs dot com. + LICENSE: Free for personal use. + SUPPORT: Fatcats BBS (fatcatsbbs.com). + art on #synchronet, irc.bbs-scene.org. \ No newline at end of file diff --git a/xtrn/druglord/atm.js b/xtrn/druglord/atm.js new file mode 100644 index 0000000000000000000000000000000000000000..a4d2bac39e5580b5862f882dc8d6773549be2d82 --- /dev/null +++ b/xtrn/druglord/atm.js @@ -0,0 +1,121 @@ +function atm() { + console.write(ANSI.DEFAULT); + console.crlf(); + console.crlf(); + /* TODO: Random ATM bank names. */ + console.write(ANSI.BOLD + ANSI.FG_GREEN) + console.writeln("\t*****************************"); + console.writeln("\t* LONDON THIRD NATIONAL ATM *"); + console.writeln("\t*****************************"); + console.write(ANSI.DEFAULT) + console.crlf(); + console.writeln(" 1. Repay debt.\t\tOutstanding:\t�" + nice_number(druglord_state['debt']) + "."); + console.writeln(ANSI.FG_WHITE + " 2. Deposit funds.\tBalance:\t�" + nice_number(druglord_state['bank']) + "."); + console.writeln(ANSI.FG_WHITE + " 3. Withdraw funds."); + console.writeln(ANSI.FG_WHITE + " 4. Borrow money."); + console.crlf(); + console.write(ANSI.BOLD + ANSI.FG_WHITE + "\tChoice: "); + var atm_cmd = console.getnum(4); + + if (atm_cmd != undefined) { + switch (atm_cmd) { + case 1: + /* Repay debt. */ + var max_repayment = Math.min(druglord_state['debt'], druglord_state['cash']); + + console.write(ANSI.BOLD + ANSI.FG_WHITE + "\tRepay how much? (�" + nice_number(max_repayment) + " max):"); + var atm_repay = console.getnum(max_repayment); + + /*if (atm_repay === 0) { + atm_repay = max_repayment; + }*/ + + var atm_confirm = console.yesno("Repay �" + nice_number(atm_repay) + " of your debt"); + + if (atm_confirm) { + console.writeln(" Repaying: �" + nice_number(atm_repay)); + + druglord_state['debt'] -= atm_repay; + druglord_state['cash'] -= atm_repay; + } + + console.pause(); + + break; + + case 2: + /* Deposit funds into account. */ + console.write(ANSI.BOLD + ANSI.FG_WHITE + "\tDeposit how much? (�" + nice_number(druglord_state['cash']) + " max):"); + var atm_deposit = console.getnum(druglord_state['cash']); + + /*if (atm_deposit === 0) { + atm_deposit = druglord_state['cash']; + }*/ + + var atm_confirm = console.yesno("Deposit �" + nice_number(atm_deposit) + " into your account"); + + if (atm_confirm) { + console.writeln(" Deposited: �" + nice_number(atm_deposit)); + + druglord_state['bank'] += atm_deposit; + druglord_state['cash'] -= atm_deposit; + } + + console.pause(); + + break; + + case 3: + /* Withdraw funds. */ + console.write(ANSI.BOLD + ANSI.FG_WHITE + "\tWithdraw how much? (�" + nice_number(druglord_state['bank']) + " max):"); + var atm_withdraw = console.getnum(druglord_state['bank']); + + if (atm_withdraw === 0) { + atm_withdraw = druglord_state['bank']; + } + + var atm_confirm = console.yesno("Withdraw �" + nice_number(atm_withdraw) + " from your account"); + if (atm_confirm) { + console.writeln(" Withdrew: �" + nice_number(atm_withdraw)); + + druglord_state['bank'] -= atm_withdraw; + druglord_state['cash'] += atm_withdraw; + + } + + console.pause(); + + break; + + case 4: + /* Borrow money. */ + var borrow_max = Math.max(0, druglord_config['MAX_LOAN'] - druglord_state['debt']); + + console.write(ANSI.BOLD + ANSI.FG_WHITE + "\tBorrow how much? (�" + nice_number(borrow_max) + " max):"); + var atm_borrow = console.getnum(borrow_max); + + /*if (atm_borrow === 0) { + atm_borrow = borrow_max; + }*/ + + var atm_brw_conf = console.noyes("Borrow �" + nice_number(atm_borrow)); + if (atm_brw_conf == false) { + console.writeln(" Borrowed: �" + nice_number(atm_borrow)); + + druglord_state['debt'] += atm_borrow; + druglord_state['cash'] += atm_borrow; + + console.writeln(" Total debt: �" + nice_number(druglord_state['debt'])); + + } + + console.pause(); + + break; + } + } + + console.write(ANSI.DEFAULT); + console.crlf(); + console.crlf(); +} \ No newline at end of file diff --git a/xtrn/druglord/druglord.ans b/xtrn/druglord/druglord.ans new file mode 100644 index 0000000000000000000000000000000000000000..9a80111d0bd87211508d2e6db2136dd197a60b9e --- /dev/null +++ b/xtrn/druglord/druglord.ans @@ -0,0 +1,24 @@ +[7h[0;40;37m[?33h[23C[32m� +[37m[22C[32mޱ +[37m[22C[32m��� +[37m[11C[32m� [37m[8C[32m�[1;42;30m�[0;32m�� +[37m[11C[32m��[37m[8C[1;42;30m���[0;32m��[37m[11C[32m �[37m[5C[35m�������������������� +[37m[10C[32m��[1;42;30m�[0;32m�[37m[7C[1;42;30m�[32m��[30m�[0;32m�[37m[9C[32m ܲ��[37m [45;35m�[1mAlthough you swore[0;45;35m�[1;40;30m� +[0m[11C[1;42;30m�[0;32m����[37m[5C[32m�[1;42m�[0;32m��[1;42;30m�[0m[7C[32m�[1;42;30m�[0;32m��[1;42;30m�[0;32m�[37m[5C[45;35m�[1myou'd never[0;45;35m�[1mbecome[0;45;35m�[1;40;30m� +[0m[12C[32m۲[1;42;30m�[0;32m�[1;42m�[0;32m�[37m [1;42;32m�[0;42;33m�[40;32m��[37m[5C[32m����[1;42m�[30m�[0;32m�[37m[6C[45;35m��[1mlike your father,[0;45;35m�[1;40;30m� +[0m[13C[32m�������[37m [32m�[1;42;33m�[0;32m��[37m [32m�[1;42m��[0;32m�[1;42;30m�[0;32m��[37m[8C[45;35m�[1mit appears[0;45;35m�[1mthat at[0;45;35m�[1;40;30m� +[0m[15C[32m�[1;42m��[0;32m��[1;42;30m�[0m [1;42;33m�[0;42;33m�[1;40;30m [42m��[0;32m����[37m[10C[45;35m���[1mleast for this[0;45;35m���[1;40;30m� +[0m[9C[32m�����[1;30m art[0;32m�[1;42;30m�[32m�[0;32m����[37m [32m�[1;42m�[0;32m���[37m[13C[45;35m��[1mmonth,[0;45;35m�[1myou'll be[0;45;35m��[1;40;30m� +[0m[11C[32m�[1;42m��[0;32m�����[37m [32m�߲��[1;42;33m�[0;32m�[1;30m [0;32m�����[1;42;30m��[0;32mܰ�[37m �� [45;35m���[1mplaying the...[0;45;35m���[1;40;30m�[0m [1;30m�� +[0m[11C[1;47;30m�[0m��[1;30m [0;32m��[1;42;30m�[32m��[0;32m���[1;42;33m�[0;42;33m�[40;32m���[42;33m��[40;32m�[1;42m��[0;32m���[1;42;30m�[0;32m��[37m [1;47;30m��[0m� [35m�[1;45;30m�������������������[40m�[0m [1;47;30m ��[40m� +[0m[11C�[1;47;30m��[0m[6C[32m��[42;33m�[1m�[0;42;33m�[1;32m�[0;32m���[37m [32m����[37m [1;30m�[47m��[0m[25C[1;30m�[47m��[0m +[12C[1;47;30m��[0m [32m�[1;42m�[0;42;33m�[40;32m�[37m [32m��[37m [1;30m [0;32m�߱�[37m �[1;30m�� ����[0m[26C[1;47;30m��[0m +[9C[1;30m���[47m��[0m [32m��[37m[5C[1;42;33m�[0m[6C[1;30m �[47m�����[40m�����[0m[5C[1;30m��� [0m[10C[1;30m��ܲ[47m�[0m +[5C[1;30m [0m�[1;47;30m���[40m�[0m [1;30m�[47m�[0m [1;30m� [0m [1;30m�� [0;32m�[1;42;33m�[0m [1;47;30m��[0m [1;30m�[47m�[40m�[0m [1;30m ��ݲ�[0m [1;30m [0m�[1;47;30m���[40m���� [0m �[1;30m [0m [1;30m�� [0m�[1;47;30m�[40m�۲[0m [1;30m�[47m�[0m +[5C[1;47;30m��[40m�[0m[5C[1;47;30m�[0m [1;30m�[47m��[40m��[47m�[40m��� [0m [1;47;30m��[40mݰ�[0m[5C[1;30m�[0m [1;30m��[0m [1;47;30m��[40m�[0m [1;30m߲��[47m���[40mܲ�����[0m[5C[1;30m� +[0m [1;47;30m��[40m�[0m[6C[1;47;30m�[0m [1;47;30m�[40m���[0m [1;30mܲ[0m [1;30m�[47m�[40mݰ��[0m[5C[1;30m��[0m [1;30m���[47m�[0m[5C[1;30m ��[0m [1;30m�[47m�[40m��[0m [1;30m���[0m[6C[1;47;30m�[0m + [1;47;30m�[40m�[0m[7C[1;30m��[0m [1;30m���[0m [1;30m���[0m [1;30m��� ��ܰ ������ݱ�[0m[5C[1;30m��[0m [1;30m���[0m [1;30m��[0m[7C[1;30m�� +[0m [1;30m���[0m[6C[1;30m��[0m [1;30m���[0m [1;30m���[0m [1;30m��[0m [1;30m�����[0m [1;30m���ݲ��� ��� ���[0m [1;30m�[47m�[40m�[0m[6C[1;30m��(c) 2012 +[0m[5C[1;30m���� [0m [1;30m�[0m [1;30m��[0m[5C[1;47;30m��[40m�[0m [1;30m����[0m[6C[1;30m���[0m [1;30m����[47m�[40m� ��[0m[5C[1;47;30m��[40m�� [0m [1;30m�[0m [1;30mArt @ +[0m[6C[1;30m��[47m��[40m��[0m [1;30m�[0m [1;30m�߲�[0m[5C[1;30m����[0m [1;30m߰��[0m [1;30m���[0m [1;30m��[47m�[40m�[0m[7C[1;30m�߲�[0m[5C[1;30m��[47m��[40m��[0m [1;30m�[0m [1;30mFATCATS +[0m[32C[1;30m���۲��� \ No newline at end of file diff --git a/xtrn/druglord/druglord.js b/xtrn/druglord/druglord.js new file mode 100644 index 0000000000000000000000000000000000000000..a87009667a547c8157c48358939ca241ce11f6df --- /dev/null +++ b/xtrn/druglord/druglord.js @@ -0,0 +1,509 @@ +/* DrugLord + * DrugLord is a game similar to Dope Wars and its derivatives for Synchronet. + * + * WEBSITE: + * http://art.poorcoding.com/druglord + * + * COPYRIGHT: + * No part of DrugLord may be used modified without consent from the author. + * + * AUTHOR: + * Art, at Fatcats BBS, dot com. + */ +load("sbbsdefs.js"); + +/* Path to DrugLord. */ +var PATH_DRUGLORD = js.exec_dir; + +load(PATH_DRUGLORD + "ANSI.js"); +load(PATH_DRUGLORD + "atm.js"); +load(PATH_DRUGLORD + "Drug.js"); +load(PATH_DRUGLORD + "event.js"); +load(PATH_DRUGLORD + "Location.js"); +load(PATH_DRUGLORD + "pocket.js"); + +var druglord_config = { + /* Player config */ + STARTING_CASH: 2000, + STARTING_DEBT: 50000, + GAME_DAYS: 30, + INTEREST_RATE: 1.05, + JSON_PORT: 10088, + JSON_SERVER: "fatcatsbbs.com", + MAX_INVENTORY: 100, /* Maximum number of units player can hold. */ + MAX_LOAN: 75000, /* Maximum amount bank will load. */ + USE_JSON: false, /* Use JSON interbbs functions? false to disable. */ +} + +var druglord_state = { + bank: 0, + cash: druglord_config['STARTING_CASH'], + debt: druglord_config['STARTING_DEBT'], + have_todays_newspaper: false, + is_playing: true, + day: 0, + drugs: new Array(), + inventory_size: druglord_config['MAX_INVENTORY'], + last_day_checked: 0, + locations: new Array(), + score: 0, +} + +var VER_DRUGLORD = "0.4b"; + +console.clear(); +console.write(ANSI.DEFAULT); + +/* Initialize locations. */ +locations_init(); + +/* Set player to a location. */ +druglord_state['location'] = druglord_state['locations'][0]; + +/* Initialize drugs. */ +drugs_init(); + +/* TODO: JSON initialize code. */ +if (druglord_config['USE_JSON']) { + load("json-client.js"); + + /* JSON client object. */ + var json = new JSONClient(druglord_config['JSON_SERVER'], druglord_config['JSON_PORT']); + /* If you want to host the JSON service on your own BBS, use the + localhost line below, and comment out the above. */ + //var json = new JSONClient("localhost", 10088); +} + +druglord_state['day'] = 0; + +/* Introductory movie. */ +intro(); + +/* Main prompt. */ +while (druglord_state['is_playing']) { + /* Ensure a nice day. Fixes X.0 day bug behavior. */ + druglord_state['day'] = Number(Number(druglord_state['day']).toFixed(1)); + + if (druglord_state['last_day_checked'] < Math.floor(druglord_state['day'])) { + /* Daily events */ + + druglord_state['last_day_checked']++; + + randomize_prices(); + + calculate_interest(); + + /* Reset have_todays_newspaper */ + druglord_state['have_todays_newspaper'] = false; + } + + /* Recalculate score. */ + calculate_score(); + + /* Display location information. */ + console.crlf(); + console.writeln(ANSI.BG_RED + " " + ANSI.BG_BLUE + ANSI.BOLD + ANSI.FG_WHITE + ' ' + druglord_state['location'].name + ' ' + ANSI.BG_RED + " " + ANSI.DEFAULT); + console.crlf(); + + if (druglord_state['location'].news.length > 0) { + console.writeln(ANSI.BOLD + ANSI.FG_YELLOW + druglord_state['location'].news + ANSI.DEFAULT); + console.crlf(); + } + + /* Display drugs. */ + for (var a = 0; a < druglord_state['drugs'].length; a++) { + /* TODO: Highlight good/bad deals. */ + console.write(" " + (a + 1) + '. (' + ANSI.BOLD + druglord_state['drugs'][a].inventory + ANSI.DEFAULT); + + if (a == 0) + console.write(' owned'); + + console.write(')\t\t' + ANSI.BOLD + druglord_state['drugs'][a].name + ANSI.DEFAULT); + console.write("\t\t�" + nice_number(druglord_state['location'].price[druglord_state['drugs'][a].name.toLowerCase()])); + + if (a == 0) + console.write("/unit"); + + console.crlf(); + } + console.crlf(); + + console.writeln(ANSI.BOLD + " b Buy drugs.\t\tt Travel.\t\tn Daily news."); + console.writeln(" s Sell drugs.\t\t$ Use ATM.\t\tq Quit."); + if (druglord_config['USE_JSON']) { + console.writeln("\t\t\t\t\t\ti InterBBS scoreboard."); + } + console.write(ANSI.DEFAULT) + console.crlf(); + + /* Display cash. */ + console.write(ANSI.FG_GREEN + " Cash: �" + ANSI.BOLD + nice_number(druglord_state['cash']) + ANSI.DEFAULT); + /* Display debt. */ + if (druglord_state['debt'] > 0) { + console.write("\t" + ANSI.FG_RED + " Debt: �" + ANSI.BOLD + nice_number(druglord_state['debt']) + ANSI.DEFAULT); + } + /* Display pockets. */ + console.writeln("\t" + ANSI.FG_CYAN + " Pockets: " + ANSI.BOLD + (druglord_state['inventory_size'] - get_player_drug_units()) + " spaces free." + ANSI.DEFAULT); + console.crlf(); + + /* Display date and prompt. */ + console.write(ANSI.BOLD + ANSI.FG_MAGENTA + 'Day ' + druglord_state['day'].toFixed(1) + ' of ' + druglord_config['GAME_DAYS'] + ', score: ' + nice_number(druglord_state['score']) + ' > ' + ANSI.DEFAULT); + + var dl_main_cmd = console.getkey().toLowerCase(); + + if (dl_main_cmd) { + console.writeln(dl_main_cmd); + + switch (dl_main_cmd) { + case '$': + /* ATM */ + atm(); + break; + + case 'b': + /* Buy. */ + buy_drugs(); + break; + + case 'i': + /* InterBBS Scores. */ + json_show_scores(); + break; + + case 'n': + /* Daily news */ + daily_news(); + break; + + case 's': + /* Sell. */ + sell_drugs(); + break; + + case 'q': + var q_cmd = console.noyes("Quit game -- progress will be lost"); + + if (q_cmd == false) { + if (druglord_config['USE_JSON']) { + var q_submit = console.yesno("Submit score: " + nice_number(druglord_state['score'])); + + if (q_submit) { + json_send_score(); + } + } + druglord_state['is_playing'] = false; + } + break; + + case 't': + /* Travel to another location. */ + travel_locations(); + break; + + case '?': + console.printfile(PATH_DRUGLORD + "druglord.ans"); + console.crlf(); + console.writeln("This is DrugLord v" + VER_DRUGLORD + "."); + console.crlf(); + console.pause(); + break; + + default: + console.crlf(); + console.crlf(); + break; + + } // End switch(dl_main_cmd). + + /* Recalculate score. */ + calculate_score(); + + /* Check if game over. */ + check_state(); + + } // End if (dl_main_cmd). +} + +/* Display scores. */ +if (console.yesno("Display InterBBS scores") == true) { + json_show_scores(); +} + +/* Quit DrugLord. */ +console.line_counter = 0; +console.printfile(PATH_DRUGLORD + "winners.ans", P_NOPAUSE); +console.write(ANSI.DEFAULT + " "); +console.getkey(); + +function calculate_interest() { + /* Daily interest rate. */ + druglord_state['debt'] = Math.round(druglord_state['debt'] * druglord_config['INTEREST_RATE']); +} + +/* Calculate and update score. */ +function calculate_score() { + /* Score is what you average profit per day is: + * Total profit / Total days elapsed. + */ + druglord_state['score'] = Math.max(0, (druglord_state['cash'] - druglord_state['debt']) / (druglord_config['GAME_DAYS'])).toFixed(0); +} + +function check_state() { + if (druglord_state['day'] > (druglord_config['GAME_DAYS'] + 1)) { + druglord_state['is_playing'] = false; + + console.crlf(); + console.crlf(); + console.crlf(); + console.writeln(" " + ANSI.BOLD + ANSI.FG_YELLOW + ANSI.BG_MAGENTA + " TIME'S UP! " + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.BOLD + "\tFinal balance:\t�" + nice_number((druglord_state['cash'] - druglord_state['debt'])) + "." + ANSI.DEFAULT); + console.crlf(); + console.crlf(); + console.writeln(ANSI.BOLD + "\tFinal score:\t�" + nice_number(druglord_state['score']) + "." + ANSI.DEFAULT); + + if (druglord_state['score'] >= 1000000) { + console.writeln(ANSI.BOLD + ANSI.FG_YELLOW + "\t\tYou've joined the Millionaire's Club--congratulations!" + ANSI.DEFAULT); + } + + console.crlf(); + console.crlf(); + console.pause(); + + if (druglord_config['USE_JSON']) { + /* Submit score to JSON server. */ + json_send_score(); + } + } +} + +function daily_news() { + if (druglord_state['have_todays_newspaper'] == false) { + var newspaper_price = 1000 * Math.floor(druglord_state['day']); + + console.crlf(); + console.writeln(ANSI.FG_RED + "You do not have today's edition of The Daily DrugLord Insider." + ANSI.DEFAULT); + var buy_paper = console.noyes("Purchase today's edition for �" + nice_number(newspaper_price)); + if (buy_paper == false) { + /* Buy today's newspaper edition. */ + + /* Sanity checks and debit amount from player. */ + if (druglord_state['cash'] >= newspaper_price) { + console.writeln(ANSI.BOLD + ANSI.FG_WHITE + "You purchase today's edition." + ANSI.DEFAULT); + druglord_state['cash'] -= newspaper_price; + druglord_state['have_todays_newspaper'] = true; + } else { + console.writeln(ANSI.BOLD + ANSI.FG_RED + "You don't have enough money." + ANSI.DEFAULT); + return; + } + } else { + return; + } + } + + var have_news = false; + console.crlf(); + console.writeln(ANSI.BG_WHITE + ANSI.FG_BLACK + " The Daily DrugLord Insider " + ANSI.DEFAULT) + console.crlf(); + + for (var a = 0; a < druglord_state['locations'].length; a++) { + if (druglord_state['locations'][a].news.length > 0) { + console.writeln(" " + ANSI.BOLD + druglord_state['locations'][a].name + ": " + ANSI.DEFAULT); + console.writeln(" \"" + druglord_state['locations'][a].news + "\""); + console.crlf(); + have_news = true; + } + } + + if (have_news) { + console.pause(); + } else { + console.writeln(" No news today. Remember to read our paper tomorrow!"); + console.pause(); + } +} + +function intro() { + /* Black out. */ + console.clear(); + console.crlf(); + + console.writeln(ANSI.BOLD + " You awake, bloodied and battered, lying in a pool of filth... " + ANSI.DEFAULT); + mswait(1500); + console.crlf(); + console.writeln(" Struggling to your feet, you recall the events leading to this disaster:"); + mswait(500); + console.crlf(); + console.writeln(ANSI.BOLD + ANSI.FG_BLACK + "<memory>" + ANSI.DEFAULT); + console.writeln(ANSI.FG_CYAN + " You:\t\t... Another month, that's all I need to pay you back--please!"); + mswait(500); + console.crlf(); + console.writeln(ANSI.FG_RED + " Bossman:\tAgain? This ain't a charity--you've got one month."); + console.writeln(ANSI.FG_RED + "\t\tAnd, to show that we're serious:"); + mswait(1000); + console.writeln(ANSI.BOLD + ANSI.FG_RED + "\t\t... TEACH THAT FOOL A LESSON, BOYZ!" + ANSI.DEFAULT); + mswait(1000); + console.crlf(); + console.writeln(ANSI.BOLD + " The gang deals out a vicious beating, you succumb in a heap of fear and rage." + ANSI.DEFAULT); + mswait(500); + console.writeln(ANSI.BOLD + " As your surroundings fade, the last thing you hear is:" + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.FG_RED + " Bossman:\tConsider this month's deposit paid: you have one month, bitch." + ANSI.DEFAULT); + mswait(1000); + console.writeln(ANSI.BOLD + ANSI.FG_RED + "\t\tThanks for doing business with London Third National--we value\r\n\t\tyour custom!" + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.BOLD + " You black out." + ANSI.DEFAULT); + console.writeln(ANSI.BOLD + ANSI.FG_BLACK + "</memory>" + ANSI.DEFAULT); + + console.pause(); + console.write(ANSI.DEFAULT); + + /* Fade in. */ + console.crlf(); + console.writeln(ANSI.BOLD + ANSI.FG_BLACK + "<instructions>" + ANSI.DEFAULT); + console.writeln(ANSI.DEFAULT + ANSI.FG_MAGENTA + " You have 30 days to repay the debt--with daily interest." + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.DEFAULT + ANSI.FG_MAGENTA + " Buy low, sell high, and take advantage of price fluctuations (purchase the daily newspapers for the inside scoop). Repay your debt at the bank's ATM machine as soon as possible. Increase your pocketspace to hold more items." + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.DEFAULT + ANSI.FG_MAGENTA + " Profit as much as you can before the end of the 30th day." + ANSI.DEFAULT); + console.writeln(ANSI.BOLD + ANSI.FG_BLACK + "</instructions>" + ANSI.DEFAULT); + console.crlf(); + console.writeln(ANSI.BOLD + " Composing your thoroughly-tenderized self," + ANSI.DEFAULT); + console.writeln(ANSI.BOLD + " you come to a dreadful realization..." + ANSI.DEFAULT); + console.crlf(); + console.pause(); + //console.clear(); + + console.line_counter = 0; + console.printfile(PATH_DRUGLORD + "druglord.ans", P_NOPAUSE); + console.pause(); +} + +/* Get updated list of scores from JSON server. */ +function json_get_scores() { + /* TODO: JSON initialize code. */ + if (druglord_config['USE_JSON']) { + /* Renew JSON object if required. */ + if (json == undefined) { + /* JSON client object. */ + json = new JSONClient(druglord_config['JSON_SERVER'], druglord_config['JSON_PORT']); + } + + var scores = json.read("druglord", "", 1); + + if (scores != undefined) { + return scores; + } + } else { + /* USE_JSON is false. */ + console.writeln(ANSI.FG_RED + "InterBBS is not configured--yell at your sysop. :|" + ANSI.DEFAULT); + console.pause(); + } + + return null; +} + +/* Submit score to JSON server. */ +function json_send_score() { + try { + if (druglord_config['USE_JSON']) { + + /* TODO: Update JSON scores. */ + + /* Renew JSON object if required. */ + if (json == undefined) { + /* JSON client object. */ + json = new JSONClient(druglord_config['JSON_SERVER'], druglord_config['JSON_PORT']); + } + + + /* Check it beats current JSON score. */ + var s1 = json.read("druglord", system.qwk_id + "." + user.alias + ".score", 1); + if (s1 == undefined) + s1 = 0; + + if (Number(druglord_state['score']) > Number(s1)) { + /* Send score to server. */ + console.writeln("New personal record! Sending score to server..."); + try { + if (user.alias && (user.alias.length > 0)) { + json.write("druglord", system.qwk_id + "." + user.alias + ".score", druglord_state['score'], 2); + } else { + console.writeln("Invalid user/alias. Not saved."); + } + } catch (e_json) { + console.writeln("There was an error sending score to server. Darkest condolences."); + log("json_send_score() Exception: " + e_json.message); + } + } else { + console.writeln("That does not beat your previous best score. Not saved."); + } + + } else { + /* USE_JSON is false. */ + console.writeln(ANSI.FG_RED + "InterBBS is not configured--yell at your sysop. :|" + ANSI.DEFAULT); + console.pause(); + } + + } catch (e) { + log("json_send_score() Exception: " + e.message); + //console.writeln("Error submitting score to server."); + console.pause(); + } +} + +/* Display InterBBS scores. */ +function json_show_scores() { + var scores = json_get_scores(); + + if (scores != null && scores != undefined) { + //console.clear(); + console.printfile(PATH_DRUGLORD + "highscore.ans"); + console.line_counter = 20; + + var bbses = Object.keys(scores); + + for (var b = 0; b < bbses.length; b++) { + /* For every BBS... */ + console.writeln(ANSI.BOLD + ANSI.FG_CYAN + " " + bbses[b] + ANSI.DEFAULT); + + var players = Object.keys(scores[bbses[b]]); + + for (var c = 0; c < players.length; c++) { + if (players[c] && (players[c].length > 0)) { + /* For every player (in every BBS)... */ + + /* Paginator. */ + if (console.line_counter >= console.screen_rows - 3) { + //log("Paginating."); + console.pause(); + console.line_counter = 0; + } + + var col = ANSI.DEFAULT; + var score = scores[bbses[b]][players[c]].score; + if (score >= 1000000) + col = ANSI.BOLD + ANSI.FG_YELLOW; + console.writeln(col + " " + players[c] + ANSI.DEFAULT + ":\t\t\t�" + nice_number(score)); + } + } + console.crlf(); + + } + + console.pause(); + } +} + +function nice_number(number) { + /* http://stackoverflow.com/questions/5731193/how-to-format-numbers-using-javascript */ + number = Number(number).toFixed(0) + ''; + x = number.split('.'); + x1 = x[0]; + x2 = x.length > 1 ? '.' + x[1] : ''; + var rgx = /(\d+)(\d{3})/; + while (rgx.test(x1)) { + x1 = x1.replace(rgx, '$1' + ',' + '$2'); + } + return x1 + x2; +} \ No newline at end of file diff --git a/xtrn/druglord/event.js b/xtrn/druglord/event.js new file mode 100644 index 0000000000000000000000000000000000000000..71ed8e60294e03320ecb69fa35506e858696a1a9 --- /dev/null +++ b/xtrn/druglord/event.js @@ -0,0 +1,44 @@ +function event_cops() { + + /* Check if carrying any drugs. */ + if (get_player_drug_units() > 0) { + /* TODO: chance of evasion. */ + + /* Player carrying drugs. */ + console.writeln(ANSI.BOLD + ANSI.FG_CYAN + "While travelling, you are caught by the police! All your drugs are belong to us! You narrowly escape capture." + ANSI.DEFAULT); + + /* Clear all drugs from inventory. */ + for (var a = 0; a < druglord_state['drugs'].length; a++) { + druglord_state['drugs'][a].inventory = 0; + } + + } else { + /* Player not carrying drugs. */ + console.writeln(ANSI.BOLD + ANSI.FG_CYAN + "While travelling, the police search you. They find nothing and let you go on your way. :D" + ANSI.DEFAULT); + } + console.crlf(); + console.pause(); + console.crlf(); +} + +function event_dog() { + /* Check if carrying any drugs. */ + if (get_player_drug_units() > 0) { + console.writeln(ANSI.BOLD + ANSI.FG_CYAN + "While travelling, a drug dog sniffs you out! They sieze all the drugs from you, but you evade capture escaping butt naked into the darkness!" + ANSI.DEFAULT); + + /* Clear all drugs from inventory. */ + for (var a = 0; a < druglord_state['drugs'].length; a++) { + druglord_state['drugs'][a].inventory = 0; + } + + /* Reset pocketspace. */ + druglord_state['inventory_size'] = druglord_config['MAX_INVENTORY']; + + } else { + console.writeln(ANSI.BOLD + ANSI.FG_CYAN + "While travelling, a drug dog sniffs at your crotch. After a humiliating search, they find nothing and let you go on your way. :|" + ANSI.DEFAULT); + } + + console.crlf(); + console.pause(); + console.crlf(); +} \ No newline at end of file diff --git a/xtrn/druglord/highscore.ans b/xtrn/druglord/highscore.ans new file mode 100644 index 0000000000000000000000000000000000000000..bbdd51b94828e23f0d52ecfd0583543053f4f84e --- /dev/null +++ b/xtrn/druglord/highscore.ans @@ -0,0 +1,17 @@ +[7h[0;40;37m[?33h[22C[35m������������������������[37m[8C[32m� +[37m[22C[1;45;33m InterBBS "[32mHigh[33m" Scores[0;35m�[1;45;30m�[0m[6C[32mޱ +[37m[22C[35m�[1;45;30m������������������������[0m[6C[32m��� +[37m[42C[32m� [37m[8C[32m�[1;42;30m�[0;32m�� +[37m[42C[32m��[37m[8C[1;42;30m���[0;32m��[37m[11C[32m � +[37m ���������������������������������[5C[32m��[1;42;30m�[0;32m�[37m[7C[1;42;30m�[0;32m��[1;42;30m�[0;32m�[37m[9C[32m ܲ�� +[37m [47m [30mScores are based on average[37m [1;30m�[0m[5C[1;42;30m�[0;32m����[37m[5C[32m�[1;42m��[0;32m�[1;42;30m�[0m[7C[32m�[1;42;30m�[0;32m��[1;42;30m�[0;32m� +[37m [47m [30mprofit per day.[37m [1;30m�[0m[6C[32m۲[1;42;30m�[32m�[0;32m��[37m [1;42;32m��[0;32m��[37m[5C[32m��[1;42m�[0;32m��[1;42;30m�[0;32m� +[37m �[1;47;30m���������������������������������[0m[7C[32m�[1;42m���[0;32m���[37m [32m�[1;42;33m�[0;32m��[37m [32m��[1;42m��[30m�[0;32m�� +[37m[46C[32m�[1;42;30m��[32m�[0;32m�[1;42;30m�[0m [1;42;33m�[0;42;33m�[1;40;30m [42m��[32m��[0;32m�� +[37m ��������������������������������� [32m�����[1;30m art[0;32m�[1;42;30m��[32m�[0;32m���[37m [32m�[42;33m�[40;32m��� +[37m [47m [1;33mYellow names: The Millionaire's[0;47m [1;30m�[0m [32m �[42;30m�[1m�[32m��[0;32m����[37m [32m�߲��[1;42;33m�[0;32m�[1;30m [0;32m�����[1;42;30m��[0;32m�ܰ� +[37m [47m [1;33mclub (earning over a million[0;47m [1;30m�[0m[7C[32m����[1;42;30m�[0;42;33m��[40;32m���[1;42;33m�[0;42;33m�[40;32m���[42;33m�[1;32m�[0;32m��[1;42m��[0;32m��[1;42;30m�[0;42;30m�[40;32m�� +[37m [47m [1;33mper day).[0;47m [1;30m�[0m[14C[32m��[42;33m�[1m�[0;42;33m��[40;32m���[37m [32m���� +[37m �[1;47;30m���������������������������������[0m[12C[32m��[42;33m�[40;32m�[37m [32m��[37m [1;30m [0;32m�߱� +[37m[48C[32m��[37m[5C[1;42;33m�[0m +[55C[32m�[1;42;33m�[0m diff --git a/xtrn/druglord/logos.ans b/xtrn/druglord/logos.ans new file mode 100644 index 0000000000000000000000000000000000000000..ecc929921141051c099641066e128e988a391ae7 --- /dev/null +++ b/xtrn/druglord/logos.ans @@ -0,0 +1,38 @@ +[7h[0;40;37m[?33h + + + + +[10C[1;30m��[0m[26C[1;30m��[0m[26C[1;30m�� +[0m[8C[1;30m����[0m[24C[1;30m����[0m[24C[1;30m���� +[0m[8C[1;30m���[0m[25C[1;30m���[0m[25C[1;30m��� +[0m[9C[1;30m��[0m[26C[1;30m��[0m[11C[1;30m [0m[13C[1;30m�� +[0m[6C[1;30m��ܲ�[0m[25C[1;30m ���[0m[5C[1;30m��� [0m[10C[1;30m��ܲ� +[0m [1;30m ���۲[0m [1;30m��[0m [1;30m� [0m [1;30m�� [0m [1;30m��[0m[6C[1;30m��ܱ����[0m [1;30m ���۲��� [0m [1;30m� [0m [1;30m�� ���۲[0m [1;30m�� +[0m [1;30m���[0m[5C[1;30m�[0m [1;30m����ܲ��� [0m [1;30m��[0m [1;30m ���۲������[0m [1;30m���[0m [1;30m߲�����ܲ��߰�[0m[5C[1;30m� +[0m [1;30m���[0m[6C[1;30m�[0m [1;30m����[0m [1;30m��[0m [1;30m��[0m [1;30m���[0m [1;30m ��ݲ�ޱ[0m[5C[1;30m ��[0m [1;30m����[0m [1;30m���[0m[6C[1;30m� +[0m [1;30m��[0m[7C[1;30m��[0m [1;30m���[0m [1;30m��[0m [1;30m�۰�[0m[5C[1;30m�[0m [1;30m��ݱ�[0m[5C[1;30m��[0m [1;30m���[0m [1;30m��[0m[7C[1;30m�� +[0m [1;30m���[0m[6C[1;30m��[0m [1;30m���[0m [1;30m��[0m [1;30m��[0m [1;30m��[0m[5C[1;30m��[0m [1;30m��ݲ��� ��� ���[0m [1;30m���[0m[6C[1;30m�� +[0m [1;30m���� [0m [1;30m�[0m [1;30m��[0m[5C[1;30m��[0m [1;30m��[0m [1;30m���� ���[0m [1;30m������ ��[0m[5C[1;30m���� [0m [1;30m� +[0m [1;30m������[0m [1;30m�[0m [1;30m�߲�[0m[5C[1;30m����[0m [1;30m��[0m [1;30m�����[0m [1;30m�[0m [1;30m����[0m[7C[1;30m�߲�[0m[5C[1;30m������[0m [1;30m� +[0m[36C[1;30m�� +[0m[28C[1;30m��[0m[5C[1;30m� +[0m[28C[1;30m��[0m[5C[1;30m��� +[0m[29C[1;30m�������� +[0m[21C[32m� +[37m[20C[32mޱ +[37m[20C[32m��� +[37m[9C[32m� [37m[8C[32m�[1;42;30m�[0;32m�� +[37m[9C[32m��[37m[8C[1;42;30m���[0;32m��[37m[11C[32m � +[37m[8C[32m��[1;42;30m�[0;32m�[37m[7C[1;42;30m�[0;32m��[1;42;30m�[0;32m�[37m[9C[32m ܲ�� +[37m[9C[1;42;30m�[0;32m����[37m[5C[32m����[1;42;30m�[0m[7C[32m�[1;42;30m�[0;32m��[1;42;30m�[0;32m� +[37m[10C[32m۲[1;42;30m�[0;32m���[37m [32m�[42;33m�[40;32m��[37m[5C[32m�����[1;42;30m�[0;32m� +[37m[11C[32m�������[37m [32m�[1;42;33m�[0;32m��[37m [32m����[1;42;30m�[0;32m�� +[37m[13C[32m�[1;42;30m��[0;32m��[1;42;30m�[0m [1;42;33m�[0;42;33m�[1;40;30m [42m��[0;32m���� +[37m[7C[32m�����[1;30m art[0;32m�[1;42;30m��[0;32m����[37m [32m�[42;33m�[40;32m��� +[37m[7C[32m �[42;30m�[1m�[0;32m������[37m [32m�߲��[1;42;33m�[0;32m�[1;30m [0;32m�����[1;42;30m��[0;32m�ܰ� +[37m[11C[32m����[1;42;30m�[0;42;33m��[40;32m���[1;42;33m�[0;42;33m�[40;32m���[42;33m��[40;32m������[1;42;30m�[0;42;30m�[40;32m�� +[37m[18C[32m��[42;33m�[1m�[0;42;33m��[40;32m���[37m [32m���� +[37m[16C[32m��[42;33m�[40;32m�[37m [32m��[37m [1;30m [0;32m�߱� +[37m[15C[32m��[37m[5C[1;42;33m�[0m +[22C[32m�[1;42;33m�[0m diff --git a/xtrn/druglord/pocket.js b/xtrn/druglord/pocket.js new file mode 100644 index 0000000000000000000000000000000000000000..a9f58d3705e0f072219ed90477a55f3b448cfc89 --- /dev/null +++ b/xtrn/druglord/pocket.js @@ -0,0 +1,30 @@ +function buy_pockets() { + var pockets = (random(3) + 1) * 10; + var price = 1000; + console.writeln("*Pssst* Hey--do you wanna buy some pocketspace?"); + + var max_pockets = Math.min(pockets, Math.floor(druglord_state['cash'] / price)); + + console.write("Buy pocketspace? (" + max_pockets + " max): "); + + var buy_amt = console.getnum(max_pockets); + + /*if (buy_amt === 0) { + buy_amt = max_pockets; + }*/ + + if (buy_amt != undefined && buy_amt > 0) { + + var buy_cfm = console.noyes("Buy " + buy_amt + " pocketspace for �" + nice_number(buy_amt * price)); + + if (buy_cfm == false) { + /* Increase pocket size. */ + console.crlf(); + console.writeln("You fit your clothes with more pockets."); + console.crlf(); + druglord_state['inventory_size'] += buy_amt; + druglord_state['cash'] -= buy_amt * price + } + } + +} \ No newline at end of file diff --git a/xtrn/druglord/winners.ans b/xtrn/druglord/winners.ans new file mode 100644 index 0000000000000000000000000000000000000000..ee671515447d56f737b77313d702bd764951e37b --- /dev/null +++ b/xtrn/druglord/winners.ans @@ -0,0 +1,24 @@ +[7h[0;40;37m[?33h + [1;31mDISCLAIMER:[0m[26C[33m��� +[37m [1mDrugLord is merely a [0m[8C[33m �[37m [1;33m��������������[0;33m� +[37m [1mfictional game. We do[0m[7C[1;33m���[44m��[37m��[0;34m��[1;44;37m@��[0;34m��[1;44;37m.�[33m�߲[40m�� +[0m [1mnot condone the using[0m[5C[1;33m��[44m�[37m���[33m������������[37m;�,[0;34m�[1;44;33m��[40m�[43m�[0;33m� +[37m [1m or dealing of any [0m [33m�[1;43m�[40m�[44m�[0;34m�[1;44;37m�[33m ��[0;44;33m *[40;34m����[44;33m [40;34m���[44;33m*[40;34m�[1;44;33m���[37m.��[33m �[40m� +[0m [1m[5Cnarcotics.[6C[0m [1;33m�[44m�[37m��[33m ��[0;34m���[44;33m [40;34m������۲۲���[1;44;33m��[0;34m�[1;44;37m;[0;34m�[1;44;33m�[40m� +[0m[24C[1;33m�[44m�[37m�[33m ��[0;34m�[44;33m*[40;34m۲[1;44;33m�����ܲ������[0;34m��[44;33m*[40;34m�[1;44;33m��[0;34m�[1;44;37m�[33m�[40m�[0;33m� +[37m[21C[33m �[1m�[44m�[0;34m��[1;44;33m��[0;34m���[1;44;33mܲ������ ߱���ܲ�[0;34m���[1;44;33m��[0;34m��[1;44;33m�[40m� +[0m[22C[1;33m��[44m [0;34m��[1;33m�[0;34m�[44;33m*[40;34m۲�[1;44;33m���ܲ��ܲ����ܲ[0;34m���[44;33m*[40;34m�[1;33m�[0;34m��[1;44;33m [40m�� +[0m[22C[1;33m�[44m�[0;34m��[1;44;33m��[0;34m���۲[44;31m���[1;37m���[0;44;31m۲�[1;37m���[0;44;31m۲�[40;34m�����[1;44;33m��[37m�[0;34m�[1;44;33m�[40m� +[0m[20C[33m��[1m�[44m�[37m�[0;34m�[1;33m�[0;34m����۲[44;31m���[1;37m�۲[0;44;31m�۲[1;37m���[0;44;31m���[40;34m����[44;33m [40;34m�[1;33m�[0;34m��[1;44;33m�[40m�[0;33m�� +[37m[22C[1;33m�[44m�[37m;,[33m��[0;44;33m*[40;34m�[1;44;37m.[0;34m��[44;31m߲�[1;37m���[0;44;31m���[1;37m�۲[0;44;31m���[40;34m��[1;44;37m.[0;34m�[44;33m*[1m��[37m�[0;34m�[1;44;33m�[40m� +[0m[22C[1;33m��[44m [37m�,[40;33m�[0;34m�[1;44;37m���[0;34m���[1;44;37m���[0;34m��[44;31m�[40;34m�[44;37m�[1m���[0;34m��[1;44;37m ���[0;34m�[1;33m�[0;34m�[1;44;37m;[33m [40m�� +[0m[23C[1;33m��[44;37m;�[33m��[0;44;33m*[1;37m [47m�[44m��[47m��[44m�[47m��[0;34m��[1;44;37m [0;44m�[1;47m�[44m�[47m��[44m��[47m�[0;34m�[44;33m*[1m��[37m�[0;34m�[1;33m�� +[0m[23C[33m�[1m��[0;34m��[1;44;33m��[0;34m��[1;44;37m�[47m��[44m��[47m��[0;34m���[1;47;37mܱ[44m��[47m��[44m�[0;34m��[1;44;33m��[37m�[0;34m�[1;33m��[0;33m� +[37m[25C[1;33m��[0;34m�[1;44;37m�,[33m��[0;44;33m*[40;34m����[1;44;37m�[47m��[44m�[47m��[44m�[0;34m����[44;33m*[1m��[37m��[0;34m�[1;33m�� +[0m[26C[1;33m��[44m�[37m���[33m�� [0;34m��[44;33m*[40;34m�����[44;33m*[40;34m��[1;44;33m ��[0;34m�[1;44;37m�[0;34m�[1;44;33m�[40m�� +[0m[26C[33m�[1;43m�[40m��[44m�[0;34m�[1;44;37m;�[33m�������������[0;34m���[1;44;33m�[40m��[43m�[0;33m� +[37m[30C[1;33m���[44m��[0;34m����[1;44;37m��[0;34m�[1;44;37m�[0;34m���[1;44;33m��[40m���[30mart +[0m[32C[33m�[1m���������������[0;33m� +[37m[39C[33m��� + +[37m[29C[1;33m"WINNERS DON'T USE DRUGS." \ No newline at end of file