/* * This file is part of Deliantra clientV. * * Copyright (©) 2017 Marek Olszewski * * Deliantra clientV is free software: you can redistribute it and/or * modify it under the terms of the Affero GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the Affero GNU General Public Licens * and the GNU General Public License along with this program. If not, see * . * * The authors can be reached via e-mail to */ function CFeedItem2 (name, data, networking) { CFeedBase.call (this, name, data, networking); } CFeedItem2.prototype = Object.create (CFeedBase.prototype); CFeedItem2.prototype.constructor = CFeedItem2; CFeedItem2.prototype.process = function () { CFeedBase.prototype.process.apply (this); var buff = this.getBuffer (); var container = buff.readUint32 (); var containerObject = this.game.containers.find (container) || this.game.containers.add (container); // containerObject.clear(); // containerObject.clear(); while (buff.position < buff.length) { var tag = buff.readUint32 (); var item = this.game.items[tag]; if (item) { item.containerObject.remove (item.itemId); } else { item = new CItem (); } item.itemId = tag; item.flags = buff.readUint32 (); item.weight = buff.readUint32 (); item.face = buff.readUint32 (); var len = (buff.readUint8 ()); var names = (buff.readUtf8StringFromBinaryString (this.data, buff.position, len)).split (String.fromCharCode (0)); buff.position += len; item.name = names[0]; item.namepl = ""; if (names.length > 1) item.namepl = names[1]; item.animation_id = buff.readUint16 (); item.anim_speed = buff.readUint8 (); item.nr_of = buff.readUint32 (); item.clientType = buff.readUint16 (); item.container = container; this.game.items[item.itemId] = item; // console.log ("added " + item.itemId + " " + item.name); containerObject.add (item, true); // console.log ("final item container id " + item.containerObject.id); } this.game.containerWindow.draw (); this.game.floorWindow.draw (); this.game.macroWindow.notifyWorkersOfContainersUpdate (); };