Adjusts price cumulation and logs

This commit is contained in:
Hubblenaut
2016-03-09 19:06:58 +01:00
parent 6ea7295e87
commit 2c815af526
2 changed files with 42 additions and 22 deletions

View File

@@ -123,7 +123,7 @@
transaction_amount += t_amount
price_list += t_amount
playsound(src, 'sound/machines/twobeep.ogg', 25)
src.visible_message("\icon[src][transaction_purpose]: [transaction_amount] Thaler\s.")
src.visible_message("\icon[src][transaction_purpose]: [t_amount] Thaler\s.")
if("reset_log")
transaction_logs.Cut()
usr << "\icon[src]<span class='notice'>Transaction log reset.</span>"
@@ -180,18 +180,18 @@
if (!transaction_amount)
return
if(!confirm(I))
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(I))
return
if (!linked_account)
usr.visible_message("\icon[src]<span class='warning'>Unable to connect to linked account.</span>")
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
return
// Access account for transaction
if(check_account())
var/datum/money_account/D = get_account(I.associated_account_number)
@@ -245,14 +245,14 @@
if (!transaction_amount)
return
if(!confirm(E))
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(E))
return
// Access account for transaction
if(check_account())
if(transaction_amount > E.worth)
@@ -283,14 +283,14 @@
if (!transaction_amount)
return
if(!confirm(SC))
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
return
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(SC))
return
if(transaction_amount > SC.worth)
src.visible_message("\icon[src]<span class='warning'>Not enough money.</span>")
else
@@ -313,6 +313,9 @@
/obj/machinery/cash_register/proc/scan_item_price(obj/O)
if(!istype(O)) return
if(item_list.len > 10)
src.visible_message("\icon[src]<span class='warning'>Only up to ten different items allowed per purchase.</span>")
return
if (cash_open)
playsound(src, 'sound/machines/buzz-sigh.ogg', 25)
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
@@ -330,8 +333,13 @@
transaction_purpose += "<br>"
transaction_purpose += "[O]: [price] Thaler\s"
transaction_amount += price
item_list += "[O]"
price_list += price
for(var/obj/previously_scanned in item_list)
if(O == previously_scanned || istype(O, previously_scanned.type))
. = item_list[previously_scanned]++
if(!.)
item_list[O] = 1
price_list += price
. = 1
// Animation and sound
playsound(src, 'sound/machines/twobeep.ogg', 25)
// Reset confirmation
@@ -356,8 +364,10 @@
</table>
<table width=300>
"}
var/obj/O
for(var/i=1, i<=item_list.len, i++)
dat += "<tr><td class=\"tx-name\">[item_list[i]]</td><td class=\"tx-data\" width=50>[price_list[i]] &thorn</td></tr>"
O = item_list[i]
dat += "<tr><td class=\"tx-name\">[item_list[O]] x [O.name]</td><td class=\"tx-data\" width=50>[price_list[i] * item_list[O]] &thorn</td></tr>"
dat += "<tr></tr><tr><td colspan=\"2\" class=\"tx-name\" style='text-align: right'><b>Total Amount: [transaction_amount] &thorn</b></td></tr>"
dat += "</table></html>"

View File

@@ -116,7 +116,7 @@
transaction_amount += t_amount
price_list += t_amount
playsound(src, 'sound/machines/twobeep.ogg', 25)
src.visible_message("\icon[src][transaction_purpose]: [transaction_amount] Thaler\s.")
src.visible_message("\icon[src][transaction_purpose]: [t_amount] Thaler\s.")
if("reset_log")
transaction_logs.Cut()
usr << "\icon[src]<span class='notice'>Transaction log reset.</span>"
@@ -161,7 +161,7 @@
if (!transaction_amount)
return
if(!confirm(I))
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(I))
return
if (!linked_account)
@@ -221,7 +221,7 @@
if (!transaction_amount)
return
if(!confirm(E))
if((item_list.len > 1 || item_list[item_list[1]] > 1) && !confirm(E))
return
// Access account for transaction
@@ -252,6 +252,9 @@
/obj/item/device/retail_scanner/proc/scan_item_price(var/obj/O)
if(!istype(O)) return
if(item_list.len > 10)
src.visible_message("\icon[src]<span class='warning'>Only up to ten different items allowed per purchase.</span>")
return
// First check if item has a valid price
var/price = O.get_item_cost()
if(isnull(price))
@@ -264,8 +267,13 @@
transaction_purpose += "<br>"
transaction_purpose += "[O]: [price] Thaler\s"
transaction_amount += price
item_list += "[O]"
price_list += price
for(var/obj/previously_scanned in item_list)
if(O == previously_scanned || istype(O, previously_scanned.type))
. = item_list[previously_scanned]++
if(!.)
item_list[O] = 1
price_list += price
. = 1
// Animation and sound
flick("retail_scan", src)
playsound(src, 'sound/machines/twobeep.ogg', 25)
@@ -290,8 +298,10 @@
</table>
<table width=300>
"}
var/obj/O
for(var/i=1, i<=item_list.len, i++)
dat += "<tr><td class=\"tx-name\">[item_list[i]]</td><td class=\"tx-data\" width=50>[price_list[i]] &thorn</td></tr>"
O = item_list[i]
dat += "<tr><td class=\"tx-name\">[item_list[O]] x [O.name]</td><td class=\"tx-data\" width=50>[price_list[i] * item_list[O]] &thorn</td></tr>"
dat += "<tr></tr><tr><td colspan=\"2\" class=\"tx-name\" style='text-align: right'><b>Total Amount: [transaction_amount] &thorn</b></td></tr>"
dat += "</table>"