Current Selection: [currTag ? GLOB.TAGGERLOCATIONS[currTag] : "None"]"
user << browse(dat, "window=destTagScreen;size=450x350")
onclose(user, "destTagScreen")
/obj/item/dest_tagger/attack_self(mob/user)
if(!locked_destination)
openwindow(user)
return
/obj/item/dest_tagger/Topic(href, href_list)
add_fingerprint(usr)
if(href_list["nextTag"])
var/n = text2num(href_list["nextTag"])
currTag = n
openwindow(usr)
/obj/item/sales_tagger
name = "sales tagger"
desc = "A scanner that lets you tag wrapped items for sale, splitting the profit between you and cargo."
icon = 'icons/obj/device.dmi'
icon_state = "salestagger"
item_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
///The account which is recieving the split profits.
var/datum/bank_account/payments_acc = null
var/paper_count = 10
var/max_paper_count = 20
///Details the percentage the scanned account recieves off the final sale.
///The person who tagged this will receive the sale value multiplied by this number.
var/cut_multiplier = 0.5
///Maximum value for cut_multiplier.
var/cut_max = 0.5
///Minimum value for cut_multiplier.
var/cut_min = 0.01
/obj/item/sales_tagger/examine(mob/user)
. = ..()
. += "[src] has [paper_count]/[max_paper_count] available barcodes. Refill with paper."
. += "Profit split on sale is currently set to [round(cut_multiplier*100)]%. Alt-click to change."
if(payments_acc)
. += "Ctrl-click to clear the registered account."
/obj/item/sales_tagger/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(istype(I, /obj/item/card/id))
var/obj/item/card/id/potential_acc = I
if(potential_acc.registered_account)
payments_acc = potential_acc.registered_account
playsound(src, 'sound/machines/ping.ogg', 40, TRUE)
to_chat(user, "[src] registers the ID card. Tag a wrapped item to create a barcode.")
else if(!potential_acc.registered_account)
to_chat(user, "This ID card has no account registered!")
return
else if(payments_acc != potential_acc.registered_account)
to_chat(user, "ID card already registered.")
if(istype(I, /obj/item/paper))
if (!(paper_count >= max_paper_count))
paper_count += 10
qdel(I)
if (paper_count >= max_paper_count)
paper_count = max_paper_count
to_chat(user, "[src]'s paper supply is now full.")
return
to_chat(user, "You refill [src]'s paper supply, you have [paper_count] left.")
return
else
to_chat(user, "[src]'s paper supply is full.")
return
/obj/item/sales_tagger/attack_self(mob/user)
. = ..()
if(paper_count <= 0)
to_chat(user, "You're out of paper!'.")
return
if(!payments_acc)
to_chat(user, "You need to swipe [src] with an ID card first.")
return
paper_count -= 1
playsound(src, 'sound/machines/click.ogg', 40, TRUE)
to_chat(user, "You print a new barcode.")
var/obj/item/barcode/new_barcode = new /obj/item/barcode(src)
new_barcode.payments_acc = payments_acc // The sticker gets the scanner's registered account.
new_barcode.cut_multiplier = cut_multiplier // Also the registered percent cut.
user.put_in_hands(new_barcode)
/obj/item/sales_tagger/CtrlClick(mob/user)
. = ..()
payments_acc = null
to_chat(user, "You clear the registered account.")
/obj/item/sales_tagger/AltClick(mob/user)
. = ..()
var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null
if(!potential_cut)
cut_multiplier = initial(cut_multiplier)
cut_multiplier = clamp(round(potential_cut/100, cut_min), cut_min, cut_max)
to_chat(user, "[round(cut_multiplier*100)]% profit will be received if a package with a barcode is sold.")
/obj/item/barcode
name = "Barcode tag"
desc = "A tiny tag, associated with a crewmember's account. Attach to a wrapped item to give that account a portion of the wrapped item's profit."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "barcode"
w_class = WEIGHT_CLASS_TINY
///All values inheirited from the sales tagger it came from.
var/datum/bank_account/payments_acc = null
var/cut_multiplier = 0.5