mob/NPCs icon='NPCs.dmi' New() src.AddName() return Item_Seller icon_state="Item Seller" verb Shop() set src in oview(1) var/list/ItemList=list("Potion"=200,"ManaPotion"=300,"Regen"=2000,"Restore"=600,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item var/Price=ItemList[Item2Buy] //this gets the price based on the list if(Price) //if it has no price you cant buy it! if(usr.Gold<Price) usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!" else usr<<"You Buy a [Item2Buy]" var/obj/NewItem if(Item2Buy=="Potion")NewItem=new/obj/Items/Potion if(Item2Buy=="ManaPotion")NewItem=new/obj/Items/ManaPotion if(Item2Buy=="Regen")NewItem=new/obj/Items/Regen if(Item2Buy=="Restore")NewItem=new/obj/Items/Restore if(Item2Buy=="Beam")NewItem=new/obj/Items/Beam if(Item2Buy=="torch")NewItem=new/obj/Items/torch usr.contents+=NewItem//add it to both their contents and Items list" usr.Gold-=Price usr<<"Item Seller: Come again!"
obj/Items verb get() set src in oview(1) usr<<"You picked up an [src]" var/counter=0 switch(src.oname) if("torch") for(var/obj/Items/torch/O in usr.contents) counter+=1 if(counter<=0) Move(usr) else for(var/obj/Items/torch/O in usr.contents) O.amount+=src.amount O.name= "[O.oname] ([O.amount])" del(src)
code: