aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Asset_manager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Asset_manager.cs73
1 files changed, 67 insertions, 6 deletions
diff --git a/Asset_manager.cs b/Asset_manager.cs
index 20cf3a1..94832f7 100644
--- a/Asset_manager.cs
+++ b/Asset_manager.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) 2007 Michael Wright 2Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3 3
4* Copyright (c) <year>, <copyright holder> 4* Copyright (c) <year>, <copyright holder>
5* All rights reserved. 5* All rights reserved.
@@ -45,6 +45,9 @@ namespace OpenSim
45 public ArrayList requests=new ArrayList(); //should change to a generic 45 public ArrayList requests=new ArrayList(); //should change to a generic
46 // public ArrayList uploads=new ArrayList(); 46 // public ArrayList uploads=new ArrayList();
47 private Server server; 47 private Server server;
48 public TextureManager TextureMan;
49 public InventoryManager InventoryManager;
50 private System.Text.Encoding enc = System.Text.Encoding.ASCII;
48 51
49 public AssetManager(Server serve) 52 public AssetManager(Server serve)
50 { 53 {
@@ -55,7 +58,7 @@ namespace OpenSim
55 58
56 public void AddRequest(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req) 59 public void AddRequest(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req)
57 { 60 {
58 61 Console.WriteLine("Asset Request "+ asset_id);
59 if(!this.Assets.ContainsKey(asset_id)) 62 if(!this.Assets.ContainsKey(asset_id))
60 { 63 {
61 //not found asset 64 //not found asset
@@ -103,7 +106,44 @@ namespace OpenSim
103 server.SendPacket(tran_p,true,user); 106 server.SendPacket(tran_p,true,user);
104 } 107 }
105 108
109 }
110 public void CreateNewBaseSet(ref AvatarData Avata,User_Agent_info UserInfo)
111 {
112 //LLUUID BaseFolder=new LLUUID("4f5f559e-77a0-a4b9-84f9-8c74c07f7cfc");//*/"4fb2dab6-a987-da66-05ee-96ca82bccbf1");
113 //LLUUID BaseFolder=new LLUUID("480e2d92-61f6-9f16-f4f5-0f77cfa4f8f9");
114 LLUUID BaseFolder=Avata.BaseFolder;
115 InventoryManager.CreateNewFolder(UserInfo,Avata.InventoryFolder);
116 InventoryManager.CreateNewFolder(UserInfo, BaseFolder);
117
118 AssetInfo Base=this.Assets[new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")];
119 AssetInfo Shape=new AssetInfo();
120
121 Shape.filename="";
122 Shape.data=new byte[Base.data.Length];
123 Array.Copy(Base.data,Shape.data,Base.data.Length);
124 Shape.Full_ID=LLUUID.Random();
125 Shape.Name="Default Skin";
126 Shape.Description="Default";
127 Shape.InvType=18;
128
129 Shape.Type=libsecondlife.AssetSystem.Asset.ASSET_TYPE_WEARABLE_BODY;
130 byte[] Agentid=enc.GetBytes(UserInfo.AgentID.ToStringHyphenated());
131 Array.Copy(Agentid,0,Shape.data,294,Agentid.Length);
132 this.Assets.Add(Shape.Full_ID,Shape);
133 /*FileStream fStream = new FileStream("Assetshape.dat", FileMode.CreateNew);
134 BinaryWriter bw = new BinaryWriter(fStream);
135 bw.Write(Shape.data);
136 bw.Close();
137 fStream.Close();*/
106 138
139 Avata.Wearables[0].ItemID=InventoryManager.AddToInventory(UserInfo,BaseFolder,Shape);
140 Avata.Wearables[0].AssetID=Shape.Full_ID;
141 //Avata.RootFolder=BaseFolder;
142
143 //give test texture
144
145 TextureImage Texture=TextureMan.textures[new LLUUID("00000000-0000-0000-5005-000000000005")];
146 InventoryManager.AddToInventory(UserInfo,BaseFolder,Texture);
107 147
108 } 148 }
109 149
@@ -115,6 +155,13 @@ namespace OpenSim
115 im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 155 im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
116 this.loadAsset(im); 156 this.loadAsset(im);
117 this.Assets.Add(im.Full_ID,im); 157 this.Assets.Add(im.Full_ID,im);
158
159
160 im=new AssetInfo();
161 im.filename="base_skin.dat";
162 im.Full_ID=new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49");
163 this.loadAsset(im);
164 this.Assets.Add(im.Full_ID,im);
118 } 165 }
119 private void loadAsset(AssetInfo info) 166 private void loadAsset(AssetInfo info)
120 { 167 {
@@ -152,11 +199,10 @@ namespace OpenSim
152 199
153 } 200 }
154 } 201 }
155 public class AssetInfo 202 public class AssetInfo:AssetBase
156 { 203 {
157 public byte[] data; 204 //public byte[] data;
158 public LLUUID Full_ID; 205 //public LLUUID Full_ID;
159 public string name;
160 public string filename; 206 public string filename;
161 public bool loaded; 207 public bool loaded;
162 public ulong last_used; //need to add a tick/time counter and keep record 208 public ulong last_used; //need to add a tick/time counter and keep record
@@ -167,4 +213,19 @@ namespace OpenSim
167 213
168 } 214 }
169 } 215 }
216
217 public class AssetBase
218 {
219 public byte[] data;
220 public LLUUID Full_ID;
221 public sbyte Type;
222 public sbyte InvType;
223 public string Name;
224 public string Description;
225
226 public AssetBase()
227 {
228
229 }
230 }
170} 231}