예제 #1
0
        public static NWCreature DeserializeCreature(string base64String, Location location)
        {
            if (location == null)
            {
                throw new ArgumentException("Invalid target location during creature deserialization.");
            }

            NWCreature creature = NWNXObject.Deserialize(base64String);

            creature.Location = location;

            return(creature);
        }
예제 #2
0
        public static NWItem DeserializeItem(string base64String, Location targetLocation)
        {
            if (targetLocation == null)
            {
                throw new ArgumentException("Invalid target location during item deserialization.");
            }

            NWItem item = NWNXObject.Deserialize(base64String);

            item.Location = targetLocation;

            return(item);
        }
예제 #3
0
        public static NWItem DeserializeItem(string base64String, NWCreature target)
        {
            if (target == null || !target.IsValid)
            {
                throw new ArgumentException("Invalid target creature during item deserialization.");
            }

            NWItem item   = NWNXObject.Deserialize(base64String);
            var    result = _.CopyItem(item.Object, target.Object, true);

            item.Destroy();

            return(result);
        }
예제 #4
0
        public static NWItem DeserializeItem(string base64String, NWPlaceable target)
        {
            if (target == null || !target.IsValid)
            {
                throw new ArgumentException("Invalid target placeable during item deserialization.");
            }

            NWItem item = NWNXObject.Deserialize(base64String).Object;

            if (item.Object == null)
            {
                throw new NullReferenceException("Unable to deserialize item.");
            }
            var result = _.CopyItem(item.Object, target.Object, TRUE);

            item.Destroy();

            return(result);
        }