aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs37
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index be0d56e..69c16c7 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -34,13 +34,17 @@ using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.CoreModules.World.Estate; 36using OpenSim.Region.CoreModules.World.Estate;
37using log4net;
38using System.Reflection;
39using System.Xml;
37 40
38namespace OpenSim.Region.OptionalModules.World.NPC 41namespace OpenSim.Region.OptionalModules.World.NPC
39{ 42{
40 public class NPCAvatar : IClientAPI, INPC 43 public class NPCAvatar : IClientAPI, INPC
41 { 44 {
42 public bool SenseAsAgent { get; set; } 45 private static readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
43 46
47 public bool SenseAsAgent { get; set; }
44 private readonly string m_firstname; 48 private readonly string m_firstname;
45 private readonly string m_lastname; 49 private readonly string m_lastname;
46 private readonly Vector3 m_startPos; 50 private readonly Vector3 m_startPos;
@@ -57,8 +61,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
57 m_scene = scene; 61 m_scene = scene;
58 m_ownerID = ownerID; 62 m_ownerID = ownerID;
59 SenseAsAgent = senseAsAgent; 63 SenseAsAgent = senseAsAgent;
64
60 } 65 }
61 66
67 static NPCAvatar()
68 {
69 InitDefaultAnimations();
70 }
71
72
73
62 public IScene Scene 74 public IScene Scene
63 { 75 {
64 get { return m_scene; } 76 get { return m_scene; }
@@ -130,8 +142,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC
130 142
131 } 143 }
132 144
145 private static void InitDefaultAnimations()
146 {
147 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
148 {
149 XmlDocument doc = new XmlDocument();
150 doc.Load(reader);
151 if (doc.DocumentElement != null)
152 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
153 {
154 if (nod.Attributes["name"] != null)
155 {
156 string name = nod.Attributes["name"].Value.ToLower();
157 string id = nod.InnerText;
158 m_defaultAnimations.Add(name, (UUID)id);
159 }
160 }
161 }
162 }
163
133 public UUID GetDefaultAnimation(string name) 164 public UUID GetDefaultAnimation(string name)
134 { 165 {
166 if (m_defaultAnimations.ContainsKey(name))
167 {
168 return m_defaultAnimations[name];
169 }
135 return UUID.Zero; 170 return UUID.Zero;
136 } 171 }
137 172