function item(name, role, mass, durability, price, req, act, prop, desc, dung){
	it={}
	it.name=name;
	it.role=role;
	it.mass=mass;
	it.durability=durability;
	it.price=price;
	it.req=req;
	it.act=act;
	it.prop=prop;
	it.desc=desc;
	it.dung=dung;
	return it;
}

var link={
	build: function(a,b,c,d){
		return a+"."+b+"."+c+"."+d;
	},
	get: function(l){
		if(!l)	return undefined;
		var s=l.split(".");
		return items[s[0]][s[1]][s[2]][s[3]];
	},
	getWeared: function(i, l){
		var li = pers[i].own["items"][l], item = clone(link.get(li.lnk)), k;
		if(item)
		{
			for(var type in li.specmods)
				for(var t = 0; t < drc.specmods[type].length; t++)
				{
					var charname = drc.specmods[type][t][0];
					if(!item.act[charname])
					{
						item.act[charname] = [];
						for(var j = 0; j < drc.charnames[charname].length; j++)
							item.act[charname][j] = 0;
					}
					item.act[charname][ drc.specmods[type][t][1] ] += li.specmods[type][t];
				}
			
			for(j in li.mod)
			{
				if(!item.act[j])	item.act[j] = [];
				for(k in li.mod[j]){
					if(j == "armor")
					{
						if(!item.act[j][k])	item.act[j][k] = [0,0];
						item.act[j][k][0] += parseInt(li.mod[j][k]);
						item.act[j][k][1] += parseInt(li.mod[j][k]);
					}
					else
					{
						if(!item.act[j][k])	item.act[j][k] = 0;
						item.act[j][k] += parseInt(li.mod[j][k]);
					}
				}
			}
			for(var type in li.specmods)
			{
				var sum = 0;
				for(var j = 0; j < drc.specmods[type].length; j++)
					sum += li.specmods[type][j] * drc.specmods[type][j][2];
				item.act.spec[type] -= sum;
			}
			return item;
		}else
			return undefined;
	}
}

// items[слот][уровень][качество][имя]

var items={
	fist: {prop:{damage: [0, 0], chance: [0.9,0.1,0,0,0,0,0,0], block:1}, name:"Кулак"},
	link: function(name){
		if(name){
			var a = name.split(".");
			return items[a[0]][a[1]][a[2]][a[3]];
		}else
			return false;
	},
	is_weapon: function(name){
		var weap = items.link(name).prop;
		return weap ? (weap.wtype>=0 ? weap : false) : false;
	},
	def: function()
	{
	var a, b, c, d;
		for(a = 1; a <= 19; a++)
		{
			items[a] = [];
			for(b = 0; b <= exp.maxLevel(); b++)
			{
				items[a][b] = [];
				for(c = 0; c <= 9; c++)
					items[a][b][c] = [];
			}
		}
	},
	armed: function(i){
		return pers[i].calc.weapon[0].item!='fist' || pers[i].calc.weapon[1].item ? true : false;
	}
};

items.def();
