Skip to content

Commit

Permalink
Adventure console exchange shop and tweaks (#2020)
Browse files Browse the repository at this point in the history
guest profile

Update adventure_layout.dm

tweak: change numbered nameStat to their definitions.

Update console.dm

Adventure Console Exchange Shop

A foundation for kirie to give the adventure console a more rewarding purpose.

add: adventure console exchange shop
  • Loading branch information
InsightfulParasite authored Apr 3, 2024
1 parent b4f3f94 commit 4467e2d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 21 deletions.
53 changes: 42 additions & 11 deletions ModularTegustation/_adventure_console/adventure_layout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* Adventures that are mostly predefined paths.
* This was difficult to finalize since i havent made a text based adventure before.
* Special defines such as button macros are in the code/_DEFINES/~lobotomy_defines.dm
*
* The way i made this system is unusual to say the least. Its a stand alone datum that
* is vaguely connected to the console that created it. While this does make the program
* portable it also makes it so that when the console is destroyed there is just a datum
* floating around in the code. Unsure how bad this is. -IP
*/

/datum/adventure_layout
Expand Down Expand Up @@ -58,6 +63,21 @@
"<b>Recorded Rat</b>:A low life from the backstreets. Their face is disfigured beyond recognition, all you can make out are their eyes.<br>",
"<b>Digital Reflection</b>:Its you! Well it looks LIKE you.<br>",
)
/*
* Exchange shop for digital coins. The only other use for coins is during events
* where you want to increase your chance of success in a event or have a unique
* interaction. For defeating enemeies the calculation for coins rewarded is
* enemy_coin = round((sides of damage die * amount of damage die)/5)
* this means that enemies that deal 1d5 damage will grant 1 coin. theoretically
* beelining enemy encounters will result in about 5 coins before the user is
* defeated. -IP
*/
var/list/exchange_shop_list = list(
new /datum/data/extraction_cargo("SNAP POP ", /obj/item/toy/snappop, 10) = 1,
new /datum/data/extraction_cargo("CAT TOY ", /obj/item/toy/cattoy, 15) = 1,
new /datum/data/extraction_cargo("CHILDRENS TOY",/obj/item/toy/prize/ripley, 20) = 1,
new /datum/data/extraction_cargo("HOURGLASS", /obj/item/hourglass, 25) = 1,
)

/datum/adventure_layout/New(set_debug_menu = FALSE)
. = ..()
Expand Down Expand Up @@ -99,7 +119,7 @@
|ENVY:[virtual_stats[ENVY_STAT]]|<br>\
</tt>"
//From highest menu define to lowest. -IP
for(var/mode_option = NORMAL_TEXT_DISPLAY to ADVENTURE_TEXT_DISPLAY)
for(var/mode_option = NORMAL_TEXT_DISPLAY to EXCHANGE_TEXT_DISPLAY)
. += "<A href='byond://?src=[REF(caller)];set_display=[mode_option]'>[mode_option == display_mode ? "<b><u>[nameMenu(mode_option)]</u></b>" : "[nameMenu(mode_option)]"]</A>"
if(debug_menu)
. += "<A href='byond://?src=[REF(caller)];set_display=[DEBUG_TEXT_DISPLAY]'>[display_mode == DEBUG_TEXT_DISPLAY ? "<b><u>[nameMenu(DEBUG_TEXT_DISPLAY)]</u></b>" : "[nameMenu(DEBUG_TEXT_DISPLAY)]"]</A>"
Expand Down Expand Up @@ -159,6 +179,15 @@
if(ADVENTURE_TEXT_DISPLAY)
. += "[TravelUI(interfacer)]"

if(EXCHANGE_TEXT_DISPLAY)
. += "COIN EXCHANGE <br> \
<tt>--------------------| </tt><br>\
PHYSICAL_MERCHANDISE<br>"
//Code taken from fish_market.dm
for(var/datum/data/extraction_cargo/A in exchange_shop_list)
. += " <A href='byond://?src=[REF(interfacer)];purchase=[REF(A)]'>[A.equipment_name]([A.cost] Points)</A><br>"
. += "<tt>--------------------| </tt><br>"

/datum/adventure_layout/proc/TravelUI(obj/machinery/call_machine)
switch(travel_mode)
if(ADVENTURE_MODE_BATTLE, ADVENTURE_MODE_EVENT_BATTLE)
Expand Down Expand Up @@ -404,28 +433,30 @@
//for each catagory please place the number its defined as -IP
/datum/adventure_layout/proc/nameMenu(cat)
switch(cat)
if(1)
if(DEBUG_TEXT_DISPLAY)
return "CHOOSE EVENT"
if(2)
if(NORMAL_TEXT_DISPLAY)
return "MAIN MENU"
if(3)
if(ADVENTURE_TEXT_DISPLAY)
return "ADVENTURE"
if(EXCHANGE_TEXT_DISPLAY)
return "COIN SHOP"

/datum/adventure_layout/proc/nameStat(stat_named)
switch(stat_named)
if(1)
if(WRATH_STAT)
return "WRATH"
if(2)
if(LUST_STAT)
return "LUST"
if(3)
if(SLOTH_STAT)
return "SLOTH"
if(4)
if(GLUTT_STAT)
return "GLUTT"
if(5)
if(GLOOM_STAT)
return "GLOOM"
if(6)
if(PRIDE_STAT)
return "PRIDE"
if(7)
if(ENVY_STAT)
return "ENVY"

//Recover Health based on time. I may scrap this because the thought of mobile game stamina makes me feel sick -IP
Expand Down
42 changes: 32 additions & 10 deletions ModularTegustation/_adventure_console/console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "This computer has a program on it that can decrypt abnormality data."
icon = 'icons/obj/machines/research.dmi'
icon_state = "nanite_program_hub"
//Feels weird to make it indestructable but it is a unique machine.
//Feels weird to make it indestructable but it is a unique machine. Also if the machine is destroyed the adventure datum would continue to exist. -IP
resistance_flags = INDESTRUCTIBLE
anchored = TRUE
density = TRUE
Expand Down Expand Up @@ -31,8 +31,10 @@
var/dat
if(adventure_data)
dat += adventure_data.Adventure(src, user)
dat += "<br><A href='byond://?src=[REF(src)];log_out_profile=[REF(src)]'>LOG OUT</A><br>\
<A href='byond://?src=[REF(src)];new_profile_password=[REF(src)]'>CREATE PASSWORD</A>"
dat += "<br><A href='byond://?src=[REF(src)];log_out_profile=[REF(src)]'>LOG OUT</A><br>"
//Unsure if this method is extremely bad. -IP
if(profile_list.Find(adventure_data) != 1)
dat += "<A href='byond://?src=[REF(src)];new_profile_password=[REF(src)]'>CREATE PASSWORD</A>"
else
dat += ProfileMenu()
var/datum/browser/popup = new(user, "Adventure", "AdventureTest", 500, 600)
Expand Down Expand Up @@ -72,6 +74,8 @@
return TRUE

if(href_list["new_profile"])
if(!profile_list.len)
to_chat(usr, "FIRST PROFILE IS ALWAYS A PUBLIC ACCOUNT")
NewProfile()
updateUsrDialog()
return TRUE
Expand All @@ -87,7 +91,7 @@
//Setting display menu for the text adventure.
if(href_list["set_display"])
var/set_display = text2num(href_list["set_display"])
if(!(set_display < 1 || set_display > 3) && set_display != adventure_data.display_mode)
if(isnum(set_display) && set_display != adventure_data.display_mode)
adventure_data.display_mode = set_display
playsound(get_turf(src), 'sound/machines/terminal_prompt_confirm.ogg', 50, TRUE)
updateUsrDialog()
Expand All @@ -97,7 +101,7 @@
if(href_list["travel"])
var/travel_num = text2num(href_list["travel"])
adventure_data.AdventureModeReact(travel_num)
playsound(get_turf(src), 'sound/machines/terminal_prompt_confirm.ogg', 50, TRUE)
playsound(get_turf(src), 'sound/machines/pda_button2.ogg', 50, TRUE)
updateUsrDialog()
return TRUE

Expand All @@ -110,7 +114,7 @@
*/
var/created_event = text2path(href_list["adventure"])
adventure_data.GenerateEvent(created_event)
playsound(get_turf(src), 'sound/machines/uplinkpurchase.ogg', 50, TRUE)
playsound(get_turf(src), 'sound/machines/pda_button2.ogg', 50, TRUE)
updateUsrDialog()
return TRUE

Expand Down Expand Up @@ -148,17 +152,35 @@
updateUsrDialog()
return TRUE

//Exchange Shop for exchanging coins for rewards
if(href_list["purchase"])
var/datum/data/extraction_cargo/product_datum = locate(href_list["purchase"]) in adventure_data.exchange_shop_list //The href_list returns the individual number code and only works if we have it in the first column. -IP
if(!product_datum)
to_chat(usr, span_warning("ERROR."))
return FALSE
if(adventure_data.virtual_coins < product_datum.cost)
to_chat(usr, span_warning("ERROR: INSUFFICENT CURRENCY."))
playsound(get_turf(src), 'sound/machines/terminal_prompt_deny.ogg', 50, TRUE)
return FALSE
new product_datum.equipment_path(get_turf(src))
adventure_data.AdjustCoins(-1 * product_datum.cost)
playsound(get_turf(src), 'sound/machines/terminal_prompt_confirm.ogg', 50, TRUE)
updateUsrDialog()
return TRUE

/obj/machinery/text_adventure_console/proc/ProfileMenu(href, href_list)
. = "<tt>\
-------------------<br>\
|PROFILE SELECTION|<br>\
-------------------<br></tt>"
var/profile_num = 1
for(var/i in profile_list)
if(i)
. += "|<A href='byond://?src=[REF(src)];profile=[profile_num]'>PROFILE [profile_num]</A><br>"
profile_num++

//Guest profile is the true first variable in the list. So for display the 2nd profile is the 1st one.
if(profile_num == 1)
. += "|<A href='byond://?src=[REF(src)];profile=1'>PUBLIC PROFILE</A><br>"
else
. += "|<A href='byond://?src=[REF(src)];profile=[profile_num]'>PROFILE [profile_num - 1]</A><br>"
profile_num++
. += "|<A href='byond://?src=[REF(src)];new_profile=[ref(src)]'>NEW PROFILE</A><br>\
<tt>-----------------</tt>"

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/~lobotomy_defines/adventure.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define DEBUG_TEXT_DISPLAY 1
#define NORMAL_TEXT_DISPLAY 2
#define ADVENTURE_TEXT_DISPLAY 3
#define EXCHANGE_TEXT_DISPLAY 4

//Modes for what is displayed on the adventure panel.
#define ADVENTURE_MODE_TRAVEL 1
Expand Down

0 comments on commit 4467e2d

Please sign in to comment.