Added store computer & minor updates

This commit is contained in:
ZomgPonies
2013-10-05 03:24:22 -04:00
parent 77567ba6cd
commit e4145fdac3
8 changed files with 322 additions and 10 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ mob/verb/check_karma()
var/currentkarma = (text2num(totalkarma) - text2num(karmaspent))
if(totalkarma)
usr << {"<br>You have <b>[currentkarma]</b> available.<br>
You've gained <b>[totalkarma]</b> total karma in your time here.<br>"}
You've gained <b>[totalkarma]</b> total karma in your time here.<br>"}
else
usr << "<b>Your total karma is:</b> 0<br>"
+2 -1
View File
@@ -151,7 +151,7 @@
access_theatre, access_chapel_office, access_library, access_research, access_mining, access_heads_vault, access_mining_station,
access_clown, access_mime, access_hop, access_RC_announce, access_keycard_auth, access_gateway)
minimal_access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers,
access_medical, access_engine, access_ai_upload, access_eva, access_heads,
access_medical, access_engine, access_eva, access_heads,
access_all_personal_lockers, access_maint_tunnels, access_bar, access_janitor, access_construction, access_morgue,
access_crematorium, access_kitchen, access_cargo, access_cargo_bot, access_mailsorting, access_qm, access_hydroponics, access_lawyer,
access_theatre, access_chapel_office, access_library, access_research, access_mining, access_heads_vault, access_mining_station,
@@ -168,6 +168,7 @@
H.equip_to_slot_or_del(new /obj/item/clothing/gloves/combat(H), slot_gloves)
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/jackboots(H), slot_shoes)
H.equip_if_possible(new /obj/item/clothing/under/rank/centcom/representative(H), slot_w_uniform)
H.equip_if_possible(new /obj/item/clothing/suit/armor/vest/fluff/deus_blueshield(H), slot_wear_suit)
H.equip_to_slot_or_del(new /obj/item/device/pda/heads/hop(H), slot_belt)
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
L.imp_in = H
+2 -1
View File
@@ -380,7 +380,8 @@ var/global/datum/controller/occupations/job_master
//give them an account in the station database
if(centcomm_account_db)
var/datum/money_account/M = create_account(H.real_name, rand(50,500)*10, null)
var/balance = round(rand(1,5))*100 // Between $100 and $500
var/datum/money_account/M = create_account(H.real_name, balance , null)
if(H.mind)
var/remembered_info = ""
remembered_info += "<b>Your account number is:</b> #[M.account_number]<br>"
+9 -5
View File
@@ -43,13 +43,17 @@
/datum/game_mode/proc/declare_job_completion()
var/text = "<FONT size = 2><B>Job Completion:</B></FONT>"
for(var/datum/mind/employee in player_list)
var/numEmployees=0
for(var/datum/mind/employee in ticker.minds)
if(!employee.job_objectives.len)//If the employee had no objectives, don't need to process this.
return
continue
if(!employee.assigned_role=="MODE")//If the employee is a gamemode thing, skip.
continue
numEmployees++
var/tasks_completed=0
//text += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job]:\n"
text += "<br>[employee.key] was [employee.name] ("
text += "<br>[employee.key] was [employee.name], the [employee.assigned_role] ("
if(employee.current)
if(employee.current.stat == DEAD)
text += "died"
@@ -78,6 +82,6 @@
else
text += "<br><font color='red'><B>The [employee.assigned_role] was a worthless sack of shit!</B></font>"
feedback_add_details("employee_success","FAIL")
world << text
if(numEmployees>0)
world << text
return 1
+153
View File
@@ -0,0 +1,153 @@
/obj/machinery/computer/merch
name = "Merch Computer"
icon = 'icons/obj/computer.dmi'
icon_state = "comm_logs"
circuit = "/obj/item/weapon/circuitboard/merch"
/obj/machinery/computer/merch/New()
..()
/obj/machinery/computer/merch/attack_paw(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/merch/attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/computer/merch/attack_hand(mob/user as mob)
user.set_machine(src)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
var/balance=user.mind.initial_account.money
var/dat = {"
<html>
<head>
<title>[command_name()] Merchandise</title>
<style type="text/css">
* {
font-family:sans-serif;
font-size:x-small;
}
html {
background:#333;
color:#999;
}
a {
color:#cfcfcf;
text-decoration:none;
font-weight:bold;
}
a:hover {
color:#ffffff;
}
tr {
background:#303030;
border-radius:6px;
margin-bottom:0.5em;
border-bottom:1px solid black;
}
tr:nth-child(even) {
background:#3f3f3f;
}
td.cost {
font-size:20pt;
font-weight:bold;
}
td.cost.affordable {
background:green;
}
td.cost.toomuch {
background:maroon;
}
</style>
</head>
<body>
<p style="float:right"><a href='byond://?src=\ref[src];refresh=1'>Refresh</a> | <b>Balance:</b> $[balance]</p>
<h1>[command_name()] Merchandise</h1>
<p>
<b>Doing your job and not getting any recognition at work?</b> Well, welcome to the
merch shop! Here, you can buy cool things in exchange for money you earn when you've
completed your Job Objectives.
</p>
<p>Work hard. Get cash. Acquire bragging rights.</p>
<h2>In Stock:</h2>
<table cellspacing="0" cellpadding="0">
<thead>
<th>#</th>
<th>Name/Description</th>
<th>Price</th>
</thead>
<tbody>
"}
for(var/datum/storeitem/item in centcomm_store.items)
var/cost_class="affordable"
if(item.cost>balance)
cost_class="toomuch"
var/itemID=centcomm_store.items.Find(item)
dat += {"
<tr>
<th>
[itemID]
</th>
<td>
<p><b>[item.name]</b></p>
<p>[item.desc]</p>
</td>
<td class="cost [cost_class]">
<a href="byond://?src=\ref[src];buy=[itemID]">$[item.cost]</a>
</td>
</tr>
"}
dat += {"
</tbody>
</table>
</body>
</html>"}
user << browse(dat, "window=merch")
onclose(user, "merch")
return
/obj/machinery/computer/merch/Topic(href, href_list)
if(..())
return
//testing(href)
src.add_fingerprint(usr)
if (href_list["buy"])
var/itemID = text2num(href_list["buy"])
var/datum/storeitem/item = centcomm_store.items[itemID]
var/sure = alert(usr,"Are you sure you wish to purchase [item.name] for $[item.cost]?","You sure?","Yes","No") in list("Yes","No")
if(sure=="No")
updateUsrDialog()
return
if(!centcomm_store.PlaceOrder(usr,itemID))
usr << "\red Unable to charge your account."
else
usr << "\blue You've successfully purchased the item. It should be in your hands or on the floor."
src.updateUsrDialog()
return
/obj/machinery/computer/cloning/update_icon()
if(stat & BROKEN)
icon_state = "comm_logs0"
else
if(stat & NOPOWER)
src.icon_state = "comm_logs"
stat |= NOPOWER
else
icon_state = initial(icon_state)
stat &= ~NOPOWER
+2 -2
View File
@@ -52,11 +52,11 @@ var/global/list/possibleEvents = list()
possibleEvents[/datum/event/falsealarm] = 300
possibleEvents[/datum/event/immovable_rod] = 200
possibleEvents[/datum/event/vent_clog] = 300
possibleEvents[/datum/event/anomaly/anomaly_bluespace] = 200
possibleEvents[/datum/event/anomaly/anomaly_bluespace] = 150
possibleEvents[/datum/event/anomaly/anomaly_flux] = 200
possibleEvents[/datum/event/anomaly/anomaly_grav] = 200
possibleEvents[/datum/event/anomaly/anomaly_pyro] = 200
possibleEvents[/datum/event/anomaly/anomaly_vortex] = 200
possibleEvents[/datum/event/anomaly/anomaly_vortex] = 150
possibleEvents[/datum/event/pda_spam] = max(min(25, player_list.len) * 4, 200)
possibleEvents[/datum/event/money_lotto] = max(min(5, player_list.len), 50)
+88
View File
@@ -0,0 +1,88 @@
/////////////////////////////
// Store Item
/////////////////////////////
/datum/storeitem
var/name="Thing"
var/desc="It's a thing."
var/typepath=/obj/item/weapon/storage/box
var/cost=0
/datum/storeitem/proc/deliver(var/mob/usr)
if(!istype(typepath,/obj/item/weapon/storage))
var/obj/item/weapon/storage/box/box=new(usr.loc)
new typepath(box)
box.name="[name] package"
box.desc="A special gift for doing your job."
usr.put_in_hands(box)
else
var/thing = new typepath(usr.loc)
usr.put_in_hands(thing)
/////////////////////////////
// Shit for robotics/science
/////////////////////////////
/*
/datum/storeitem/robotnik_labcoat
name = "Robotnik's Research Labcoat"
desc = "Join the empire and display your hatred for woodland animals."
typepath = /obj/item/clothing/suit/storage/labcoat/custom/N3X15/robotics
cost = 350
/datum/storeitem/robotnik_jumpsuit
name = "Robotics Interface Suit"
desc = "A modern black and red design with reinforced seams and brass neural interface fittings."
typepath = /obj/item/clothing/under/custom/N3X15/robotics
cost = 500
*/
/////////////////////////////
// General
/////////////////////////////
/datum/storeitem/snap_pops
name = "Snap-Pops"
desc = "Ten-thousand-year-old chinese fireworks: IN SPACE"
typepath = /obj/item/weapon/storage/box/snappops
cost = 200
/datum/storeitem/crayons
name = "Crayons"
desc = "Let security know how they're doing by scrawling lovenotes all over their hallways."
typepath = /obj/item/weapon/storage/fancy/crayons
cost = 350
/datum/storeitem/pipe
name = "smoking pipe"
desc = "A pipe, for smoking. Probably made of meershaum or something."
typepath = /obj/item/clothing/mask/cigarette/pipe
cost = 350
/datum/storeitem/katana
name = "replica katana"
desc = "Woefully underpowered in D20."
typepath = /obj/item/toy/katana
cost = 500
/datum/storeitem/violin
name = "space violin"
desc = "A wooden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\""
typepath = /obj/item/device/violin
cost = 500
/datum/storeitem/baby
name = "Toddler"
desc = "This baby looks almost real. Wait, did it just burp?"
typepath = /obj/item/weapon/toddler
cost = 1000
/datum/storeitem/laserpointer
name = "laser pointer"
desc = "Don't shine it in your eyes!"
typepath = /obj/item/device/laser_pointer
cost = 1000
/datum/storeitem/banhammer
desc = "A banhammer"
name = "banhammer"
typepath = /obj/item/weapon/banhammer
cost = 2000
+65
View File
@@ -0,0 +1,65 @@
/*****************************
* /vg/station In-Game Store *
*****************************
By Nexypoo
The idea is to give people who do their jobs a reward.
Ideally, these items should be cosmetic in nature to avoid fucking up round balance.
People joining the round get between $100 and $500. Keep this in mind.
Money should not persist between rounds, although a "bank" system to voluntarily store
money between rounds might be cool. It'd need to be a bit volatile: perhaps completing
job objectives = good stock market, shitty job objective completion = shitty economy.
Goal for now is to get the store itself working, however.
*/
var/global/datum/store/centcomm_store=new
/datum/store
var/list/datum/storeitem/items=list()
var/list/datum/storeorder/orders=list()
var/obj/machinery/account_database/linked_db
/datum/store/New()
for(var/itempath in typesof(/datum/storeitem) - /datum/storeitem/)
items += new itempath()
/datum/store/proc/charge(var/datum/mind/mind,var/amount,var/datum/storeitem/item)
if(!mind.initial_account)
//testing("No initial_account")
return 0
if(mind.initial_account.money < amount)
//testing("Not enough cash")
return 0
mind.initial_account.money -= amount
var/datum/transaction/T = new()
T.target_name = "[command_name()] Merchandising"
T.purpose = "Purchase of [item.name]"
T.amount = -amount
T.date = current_date_string
T.time = worldtime2text()
T.source_terminal = "\[CLASSIFIED\] Terminal #[rand(111,333)]"
mind.initial_account.transaction_log.Add(T)
return 1
/datum/store/proc/reconnect_database()
for(var/obj/machinery/account_database/DB in world)
if(DB.z == 1)
linked_db = DB
break
/datum/store/proc/PlaceOrder(var/mob/living/usr, var/itemID)
// Get our item, first.
var/datum/storeitem/item = items[itemID]
if(!item)
return 0
// Try to deduct funds.
if(!charge(usr.mind,item.cost,item))
return 0
// Give them the item.
item.deliver(usr)
return 1