diff options
author | gareth | 2007-03-01 01:38:41 +0000 |
---|---|---|
committer | gareth | 2007-03-01 01:38:41 +0000 |
commit | 0eabb4b98ccff663de034ac666bfcb531edb7a30 (patch) | |
tree | be42c12a9ff9ef0b72830e006943788d7e1503c2 /src/world/Avatar.cs | |
parent | Brought in newer libsl (diff) | |
download | opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.zip opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.gz opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.bz2 opensim-SC-0eabb4b98ccff663de034ac666bfcb531edb7a30.tar.xz |
Broken asset code + ObjectUpdate FIXME
Diffstat (limited to 'src/world/Avatar.cs')
-rw-r--r-- | src/world/Avatar.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index 6177f6e..d579463 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs | |||
@@ -1,5 +1,6 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | ||
3 | using System.Text; | 4 | using System.Text; |
4 | using libsecondlife; | 5 | using libsecondlife; |
5 | using libsecondlife.Packets; | 6 | using libsecondlife.Packets; |
@@ -11,12 +12,42 @@ namespace OpenSim.world | |||
11 | public string firstname; | 12 | public string firstname; |
12 | public string lastname; | 13 | public string lastname; |
13 | public OpenSimClient ControllingClient; | 14 | public OpenSimClient ControllingClient; |
15 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
14 | 16 | ||
15 | public Avatar(OpenSimClient TheClient) { | 17 | public Avatar(OpenSimClient TheClient) { |
16 | Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); | 18 | Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); |
17 | ControllingClient=TheClient; | 19 | ControllingClient=TheClient; |
20 | SetupTemplate("avatar-template.dat"); | ||
18 | } | 21 | } |
19 | 22 | ||
23 | private void SetupTemplate(string name) | ||
24 | { | ||
25 | |||
26 | int i = 0; | ||
27 | FileInfo fInfo = new FileInfo(name); | ||
28 | long numBytes = fInfo.Length; | ||
29 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
30 | BinaryReader br = new BinaryReader(fStream); | ||
31 | byte [] data1 = br.ReadBytes((int)numBytes); | ||
32 | br.Close(); | ||
33 | fStream.Close(); | ||
34 | |||
35 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
36 | |||
37 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
38 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
39 | pos.X = 100f; | ||
40 | objdata.ID = 8880000; | ||
41 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
42 | libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f); | ||
43 | //objdata.FullID=user.AgentID; | ||
44 | byte[] pb = pos.GetBytes(); | ||
45 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
46 | |||
47 | AvatarTemplate = objdata; | ||
48 | |||
49 | } | ||
50 | |||
20 | public void CompleteMovement(World RegionInfo) { | 51 | public void CompleteMovement(World RegionInfo) { |
21 | Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); | 52 | Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); |
22 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | 53 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); |
@@ -33,6 +64,29 @@ namespace OpenSim.world | |||
33 | } | 64 | } |
34 | 65 | ||
35 | public void SendInitialPosition() { | 66 | public void SendInitialPosition() { |
67 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
68 | |||
69 | |||
70 | //send a objectupdate packet with information about the clients avatar | ||
71 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
72 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
73 | objupdate.RegionData.TimeDilation = 64096; | ||
74 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
75 | |||
76 | objupdate.ObjectData[0] = AvatarTemplate; | ||
77 | //give this avatar object a local id and assign the user a name | ||
78 | objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber; | ||
79 | //User_info.name="Test"+this.local_numer+" User"; | ||
80 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
81 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
82 | |||
83 | libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f); | ||
84 | |||
85 | byte[] pb = pos2.GetBytes(); | ||
86 | |||
87 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
88 | OpenSim_Main.local_world._localNumber++; | ||
89 | this.ControllingClient.OutPacket(objupdate); | ||
36 | } | 90 | } |
37 | 91 | ||
38 | public void SendInitialAppearance() { | 92 | public void SendInitialAppearance() { |