database
var/list/data
proc
add(arg1, arg2)
if(!data[arg1])
data[arg1] = list()
if(!data[arg1][arg2])
data[arg1][arg2] = list()
modify(arg1, arg2, toggle, arg3)
switch(toggle)
if("-")
data[arg1][arg2] -= arg3
if("=")
data[arg1][arg2] = arg3
if("+")
data[arg1][arg2] += arg3
var/database/database = new
world/New()
.=..()
database.data = list()
mob/Player
Login()
.=..()
if(!database.data[src.ckey])
database.add(src.ckey, "items")
Equipment:
Equipment
parent_type = /obj
var/slot
proc
Equip(mob/m, Equipment/item)
if(isOpen(m, item.slot))
Add2Equip(m, item)
else
var/previousItem = database.data[m.ckey][item.slot]
//Same item. just unequip it
if(istype(previousItem,item))
Unequip(m, previousItem)
else
//Different item, unequip previous and equip new
Unequip(m, previousItem)
Add2Equip(m, item)
Pickup(mob/m, Equipment/item)
database.modify(m.ckey, "items", "+", item)
item.loc = m
m << "You picked up ([item])!"
Drop(mob/m, Equipment/item)
//Unequip before dropping
if(isEquipped(m, item))
Unequip(m, item)
database.modify(m.ckey, "items", "-", item)
item.loc = m.loc
m << "You dropped ([item])"
Add2Equip(mob/m, Equipment/item)
database.modify(m.ckey, item.slot, "=", item)
m << "Equipped [item]: Slot([item.slot])"
Unequip(mob/m, Equipment/item)
database.modify(m.ckey, item.slot, "=", null)
m << "Unequipped [item]: Slot([item.slot])"
isOpen(mob/m, slot)
if(database.data[m.ckey][slot])return 0
return 1
isEquipped(mob/m, Equipment/item)
if(database.data[m.ckey][item.slot] == item)return 1
return 0
verb/Get()
set src in oview(1)
Equipment.Pickup(usr,src)
usr.verbs += typesof(/mob/Equipment/verb)
//Test (:
Head
slot = "Head"
Helmet{icon='Helmets/Basic.dmi'}
Weapon
slot = "RHand"
Sword1{icon='Swords/Basic.dmi';icon_state="1"}
Sword2{icon='Swords/Basic.dmi';icon_state="2"}
var/Equipment/Equipment = new
mob/Equipment/verb
Equip(var/item in database.data[usr.ckey]["items"])
Equipment.Equip(usr, item)
Drop(var/item in database.data[usr.ckey]["items"])
Equipment.Drop(usr, item):</b>
it keeps saying bad argument definition. and its reffering to the *item.loc = m.loc* and the *m << "unequipped text"*. none of these codes seem wrong to me. and im kind of a noob at coding so someone please help me!: