/// <summary> /// Use WantInformation::LoadWant() to create a new Instance /// </summary> /// <param name="guid">The guid of the Want</param> protected WantInformation(uint guid) { this.guid = guid; wnt = WantLoader.GetWant(guid); str = WantLoader.LoadText(wnt); primicon = WantLoader.LoadIcon(wnt); }
/// <summary> /// Returns a XWAnt File for this Item or null /// </summary> /// <param name="guid">The GUID of the Want</param> /// <returns>The Xant Object representing That want (or null if not found)</returns> public static XWant GetWant(uint guid) { if (wants == null) { LoadWants(); } SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem wts = (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem)wants[guid]; if (wts != null) { XWant xwnt = new XWant(); wts.FileDescriptor.UserData = wts.Package.Read(wts.FileDescriptor).UncompressedData; xwnt.ProcessData(wts); return(xwnt); } return(null); }
/// <summary> /// Load Informations about a specific Want /// </summary> /// <param name="guid">The GUID of the want</param> /// <returns>A Want Information Structure</returns> public static WantCacheInformation LoadWant(SimPe.Cache.WantCacheItem wci) { WantCacheInformation ret = new WantCacheInformation(); ret.icon = wci.Icon; ret.name = wci.Name; ret.guid = wci.Guid; XWant w = new XWant(); SimPe.PackedFiles.Wrapper.CpfItem i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "id"; i.UIntegerValue = wci.Guid; w.AddItem(i, true); i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "folder"; i.StringValue = wci.Folder; w.AddItem(i, true); i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "score"; i.IntegerValue = wci.Score; w.AddItem(i, true); i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "influence"; i.IntegerValue = wci.Influence; w.AddItem(i, true); i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "objectType"; i.StringValue = wci.ObjectType; w.AddItem(i, true); ret.wnt = w; return(ret); }
/// <summary> /// Returns the Icon File for the passed Want /// </summary> /// <param name="wnt">The Want File</param> /// <returns>The Picture File or null if none was found</returns> public static SimPe.PackedFiles.Wrapper.Picture LoadIcon(XWant wnt) { if (wnt == null) { return(null); } if (txtpkg == null) { LoadTextPackage(); } Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFile(wnt.IconFileDescriptor, null); if (items.Length > 0) { SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture(); items[0].FileDescriptor.UserData = items[0].Package.Read(items[0].FileDescriptor).UncompressedData; pic.ProcessData(items[0]); return(pic); } return(null); }
/// <summary> /// Returns the String File describing that want /// </summary> /// <param name="wnt">The Want File</param> /// <returns>The Str File or null if none was found</returns> public static SimPe.PackedFiles.Wrapper.Str LoadText(XWant wnt) { if (wnt == null) { return(null); } if (txtpkg == null) { LoadTextPackage(); } Interfaces.Files.IPackedFileDescriptor[] pfds = txtpkg.FindFile(Data.MetaData.STRING_FILE, 0, wnt.StringInstance); if (pfds.Length > 0) { SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str(); pfds[0].UserData = txtpkg.Read(pfds[0]).UncompressedData; str.ProcessData(pfds[0], txtpkg); return(str); } return(null); }