public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader) { if (attribute == OtItemAttribute.DEPOT_ID) SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16()); else base.DeserializeAttribute(attribute, reader); }
public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader) { if (attribute == OtItemAttribute.TELE_DEST) SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation()); else base.DeserializeAttribute(attribute, reader); }
public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader) { if (attribute == OtItemAttribute.HOUSEDOORID) SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte()); else base.DeserializeAttribute(attribute, reader); }
public override void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader) { if (attribute == OtItemAttribute.CONTAINER_ITEMS) SetAttribute(OtItemAttribute.CONTAINER_ITEMS, reader.ReadUInt32()); else base.DeserializeAttribute(attribute, reader); }
public override void Deserialize(OtFileReader fileReader, OtFileNode node, OtPropertyReader reader, OtItems items) { base.Deserialize(fileReader, node, reader, items); var itemNode = node.Child; while (itemNode != null) { if ((OtMap.OtMapNodeTypes)itemNode.Type != OtMap.OtMapNodeTypes.ITEM) throw new Exception("Invalid item node inside container."); OtPropertyReader props = fileReader.GetPropertyReader(itemNode); var itemId = props.ReadUInt16(); var itemType = items.GetItem(itemId); if (itemType == null) throw new Exception("Unkonw item type " + itemId + " inside container."); var item = OtItem.Create(itemType); item.Deserialize(fileReader, itemNode, props, items); Items.Add(item); itemNode = itemNode.Next; } }
public virtual void DeserializeAttribute(OtItemAttribute attribute, OtPropertyReader reader) { switch (attribute) { case OtItemAttribute.COUNT: SetAttribute(OtItemAttribute.COUNT, reader.ReadByte()); break; case OtItemAttribute.ACTION_ID: SetAttribute(OtItemAttribute.ACTION_ID, reader.ReadUInt16()); break; case OtItemAttribute.UNIQUE_ID: SetAttribute(OtItemAttribute.UNIQUE_ID, reader.ReadUInt16()); break; case OtItemAttribute.NAME: SetAttribute(OtItemAttribute.NAME, reader.ReadString()); break; case OtItemAttribute.PLURALNAME: SetAttribute(OtItemAttribute.PLURALNAME, reader.ReadString()); break; case OtItemAttribute.ARTICLE: SetAttribute(OtItemAttribute.ARTICLE, reader.ReadString()); break; case OtItemAttribute.ATTACK: SetAttribute(OtItemAttribute.ATTACK, reader.ReadInt32()); break; case OtItemAttribute.EXTRAATTACK: SetAttribute(OtItemAttribute.EXTRAATTACK, reader.ReadInt32()); break; case OtItemAttribute.DEFENSE: SetAttribute(OtItemAttribute.DEFENSE, reader.ReadInt32()); break; case OtItemAttribute.EXTRADEFENSE: SetAttribute(OtItemAttribute.EXTRADEFENSE, reader.ReadInt32()); break; case OtItemAttribute.ARMOR: SetAttribute(OtItemAttribute.ARMOR, reader.ReadInt32()); break; case OtItemAttribute.ATTACKSPEED: SetAttribute(OtItemAttribute.ATTACKSPEED, reader.ReadInt32()); break; case OtItemAttribute.HITCHANCE: SetAttribute(OtItemAttribute.HITCHANCE, reader.ReadInt32()); break; case OtItemAttribute.SCRIPTPROTECTED: SetAttribute(OtItemAttribute.SCRIPTPROTECTED, reader.ReadByte() != 0); break; case OtItemAttribute.DUALWIELD: SetAttribute(OtItemAttribute.DUALWIELD, reader.ReadByte() != 0); break; case OtItemAttribute.TEXT: SetAttribute(OtItemAttribute.TEXT, reader.ReadString()); break; case OtItemAttribute.WRITTENDATE: SetAttribute(OtItemAttribute.WRITTENDATE, reader.ReadInt32()); break; case OtItemAttribute.WRITTENBY: SetAttribute(OtItemAttribute.WRITTENBY, reader.ReadString()); break; case OtItemAttribute.DESC: SetAttribute(OtItemAttribute.DESC, reader.ReadString()); break; case OtItemAttribute.RUNE_CHARGES: SetAttribute(OtItemAttribute.RUNE_CHARGES, reader.ReadByte()); break; case OtItemAttribute.CHARGES: SetAttribute(OtItemAttribute.CHARGES, reader.ReadUInt16()); break; case OtItemAttribute.DURATION: SetAttribute(OtItemAttribute.DURATION, reader.ReadInt32()); break; case OtItemAttribute.DECAYING_STATE: SetAttribute(OtItemAttribute.DECAYING_STATE, reader.ReadByte()); break; //specific item properties //case OtItemAttribute.DEPOT_ID: // SetAttribute(OtItemAttribute.DEPOT_ID, reader.ReadUInt16()); // break; //case OtItemAttribute.HOUSEDOORID: // SetAttribute(OtItemAttribute.HOUSEDOORID, reader.ReadByte()); // break; //case OtItemAttribute.TELE_DEST: // SetAttribute(OtItemAttribute.TELE_DEST, reader.ReadLocation()); // break; //case OtItemAttribute.SLEEPERGUID: // SetAttribute(OtItemAttribute.SLEEPERGUID, reader.ReadUInt32()); // break; //case OtItemAttribute.SLEEPSTART: // SetAttribute(OtItemAttribute.SLEEPSTART, reader.ReadUInt32()); // break; default: throw new Exception("Unkonw item attribute: " + (byte)attribute); } }
public virtual void Deserialize(OtFileReader fileReader, OtFileNode itemNode, OtPropertyReader reader, OtItems items) { Deserialize(reader); }
public virtual void Deserialize(OtPropertyReader reader) { while (reader.PeekChar() != -1) { var attrType = (OtItemAttribute)reader.ReadByte(); DeserializeAttribute(attrType, reader); } }