corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * Copyright (c) 2006-2014, openmetaverse.org |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * - Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions are met: |
||
7 | * |
||
8 | * - Redistributions of source code must retain the above copyright notice, this |
||
9 | * list of conditions and the following disclaimer. |
||
10 | * - Neither the name of the openmetaverse.org nor the names |
||
11 | * of its contributors may be used to endorse or promote products derived from |
||
12 | * this software without specific prior written permission. |
||
13 | * |
||
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
24 | * POSSIBILITY OF SUCH DAMAGE. |
||
25 | */ |
||
26 | |||
27 | using System; |
||
28 | using System.Drawing; |
||
29 | using System.Collections.Generic; |
||
30 | using System.ComponentModel; |
||
31 | using System.Windows.Forms; |
||
32 | using System.Data; |
||
33 | using OpenMetaverse; |
||
34 | using OpenMetaverse.Packets; |
||
35 | |||
36 | namespace GridAccountant |
||
37 | { |
||
38 | /// <summary> |
||
39 | /// Summary description for Form1. |
||
40 | /// </summary> |
||
41 | public class frmGridAccountant : System.Windows.Forms.Form |
||
42 | { |
||
43 | private System.Windows.Forms.GroupBox grpLogin; |
||
44 | private System.Windows.Forms.TextBox txtPassword; |
||
45 | private System.Windows.Forms.TextBox txtLastName; |
||
46 | private System.Windows.Forms.Button cmdConnect; |
||
47 | private System.Windows.Forms.TextBox txtFirstName; |
||
48 | private System.Windows.Forms.Label label1; |
||
49 | private System.Windows.Forms.Label label2; |
||
50 | private System.Windows.Forms.Label label3; |
||
51 | /// <summary> |
||
52 | /// Required designer variable. |
||
53 | /// </summary> |
||
54 | private System.ComponentModel.Container components = null; |
||
55 | private System.Windows.Forms.Label label4; |
||
56 | private System.Windows.Forms.Label lblName; |
||
57 | private System.Windows.Forms.Label lblBalance; |
||
58 | private System.Windows.Forms.Label label6; |
||
59 | private System.Windows.Forms.Label label5; |
||
60 | private System.Windows.Forms.TextBox txtFind; |
||
61 | private System.Windows.Forms.Button cmdFind; |
||
62 | private System.Windows.Forms.TextBox txtTransfer; |
||
63 | private System.Windows.Forms.Button cmdTransfer; |
||
64 | private System.Windows.Forms.Label label7; |
||
65 | private System.Windows.Forms.ListView lstFind; |
||
66 | private System.Windows.Forms.ColumnHeader colName; |
||
67 | private System.Windows.Forms.ColumnHeader colOnline; |
||
68 | private System.Windows.Forms.ColumnHeader colUuid; |
||
69 | |||
70 | private GridClient Client; |
||
71 | |||
72 | public frmGridAccountant() |
||
73 | { |
||
74 | // |
||
75 | // Required for Windows Form Designer support |
||
76 | // |
||
77 | InitializeComponent(); |
||
78 | } |
||
79 | |||
80 | /// <summary> |
||
81 | /// Clean up any resources being used. |
||
82 | /// </summary> |
||
83 | protected override void Dispose( bool disposing ) |
||
84 | { |
||
85 | Client.Network.Logout(); |
||
86 | |||
87 | if( disposing ) |
||
88 | { |
||
89 | if (components != null) |
||
90 | { |
||
91 | components.Dispose(); |
||
92 | } |
||
93 | } |
||
94 | base.Dispose( disposing ); |
||
95 | } |
||
96 | |||
97 | #region Windows Form Designer generated code |
||
98 | /// <summary> |
||
99 | /// Required method for Designer support - do not modify |
||
100 | /// the contents of this method with the code editor. |
||
101 | /// </summary> |
||
102 | private void InitializeComponent() |
||
103 | { |
||
104 | this.grpLogin = new System.Windows.Forms.GroupBox(); |
||
105 | this.label3 = new System.Windows.Forms.Label(); |
||
106 | this.label2 = new System.Windows.Forms.Label(); |
||
107 | this.label1 = new System.Windows.Forms.Label(); |
||
108 | this.txtPassword = new System.Windows.Forms.TextBox(); |
||
109 | this.txtLastName = new System.Windows.Forms.TextBox(); |
||
110 | this.cmdConnect = new System.Windows.Forms.Button(); |
||
111 | this.txtFirstName = new System.Windows.Forms.TextBox(); |
||
112 | this.label4 = new System.Windows.Forms.Label(); |
||
113 | this.lblName = new System.Windows.Forms.Label(); |
||
114 | this.lblBalance = new System.Windows.Forms.Label(); |
||
115 | this.label6 = new System.Windows.Forms.Label(); |
||
116 | this.label5 = new System.Windows.Forms.Label(); |
||
117 | this.txtFind = new System.Windows.Forms.TextBox(); |
||
118 | this.cmdFind = new System.Windows.Forms.Button(); |
||
119 | this.txtTransfer = new System.Windows.Forms.TextBox(); |
||
120 | this.cmdTransfer = new System.Windows.Forms.Button(); |
||
121 | this.label7 = new System.Windows.Forms.Label(); |
||
122 | this.lstFind = new System.Windows.Forms.ListView(); |
||
123 | this.colName = new System.Windows.Forms.ColumnHeader(); |
||
124 | this.colOnline = new System.Windows.Forms.ColumnHeader(); |
||
125 | this.colUuid = new System.Windows.Forms.ColumnHeader(); |
||
126 | this.grpLogin.SuspendLayout(); |
||
127 | this.SuspendLayout(); |
||
128 | // |
||
129 | // grpLogin |
||
130 | // |
||
131 | this.grpLogin.Controls.Add(this.label3); |
||
132 | this.grpLogin.Controls.Add(this.label2); |
||
133 | this.grpLogin.Controls.Add(this.label1); |
||
134 | this.grpLogin.Controls.Add(this.txtPassword); |
||
135 | this.grpLogin.Controls.Add(this.txtLastName); |
||
136 | this.grpLogin.Controls.Add(this.cmdConnect); |
||
137 | this.grpLogin.Controls.Add(this.txtFirstName); |
||
138 | this.grpLogin.Enabled = false; |
||
139 | this.grpLogin.Location = new System.Drawing.Point(16, 344); |
||
140 | this.grpLogin.Name = "grpLogin"; |
||
141 | this.grpLogin.Size = new System.Drawing.Size(560, 80); |
||
142 | this.grpLogin.TabIndex = 50; |
||
143 | this.grpLogin.TabStop = false; |
||
144 | // |
||
145 | // label3 |
||
146 | // |
||
147 | this.label3.Location = new System.Drawing.Point(280, 24); |
||
148 | this.label3.Name = "label3"; |
||
149 | this.label3.Size = new System.Drawing.Size(120, 16); |
||
150 | this.label3.TabIndex = 50; |
||
151 | this.label3.Text = "Password"; |
||
152 | // |
||
153 | // label2 |
||
154 | // |
||
155 | this.label2.Location = new System.Drawing.Point(152, 24); |
||
156 | this.label2.Name = "label2"; |
||
157 | this.label2.Size = new System.Drawing.Size(120, 16); |
||
158 | this.label2.TabIndex = 50; |
||
159 | this.label2.Text = "Last Name"; |
||
160 | // |
||
161 | // label1 |
||
162 | // |
||
163 | this.label1.Location = new System.Drawing.Point(16, 24); |
||
164 | this.label1.Name = "label1"; |
||
165 | this.label1.Size = new System.Drawing.Size(120, 16); |
||
166 | this.label1.TabIndex = 50; |
||
167 | this.label1.Text = "First Name"; |
||
168 | // |
||
169 | // txtPassword |
||
170 | // |
||
171 | this.txtPassword.Location = new System.Drawing.Point(280, 40); |
||
172 | this.txtPassword.Name = "txtPassword"; |
||
173 | this.txtPassword.PasswordChar = '*'; |
||
174 | this.txtPassword.Size = new System.Drawing.Size(120, 20); |
||
175 | this.txtPassword.TabIndex = 2; |
||
176 | this.txtPassword.Text = ""; |
||
177 | // |
||
178 | // txtLastName |
||
179 | // |
||
180 | this.txtLastName.Location = new System.Drawing.Point(152, 40); |
||
181 | this.txtLastName.Name = "txtLastName"; |
||
182 | this.txtLastName.Size = new System.Drawing.Size(112, 20); |
||
183 | this.txtLastName.TabIndex = 1; |
||
184 | this.txtLastName.Text = ""; |
||
185 | // |
||
186 | // cmdConnect |
||
187 | // |
||
188 | this.cmdConnect.Location = new System.Drawing.Point(424, 40); |
||
189 | this.cmdConnect.Name = "cmdConnect"; |
||
190 | this.cmdConnect.Size = new System.Drawing.Size(120, 24); |
||
191 | this.cmdConnect.TabIndex = 3; |
||
192 | this.cmdConnect.Text = "Connect"; |
||
193 | this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click); |
||
194 | // |
||
195 | // txtFirstName |
||
196 | // |
||
197 | this.txtFirstName.Location = new System.Drawing.Point(16, 40); |
||
198 | this.txtFirstName.Name = "txtFirstName"; |
||
199 | this.txtFirstName.Size = new System.Drawing.Size(120, 20); |
||
200 | this.txtFirstName.TabIndex = 0; |
||
201 | this.txtFirstName.Text = ""; |
||
202 | // |
||
203 | // label4 |
||
204 | // |
||
205 | this.label4.Location = new System.Drawing.Point(16, 8); |
||
206 | this.label4.Name = "label4"; |
||
207 | this.label4.Size = new System.Drawing.Size(48, 16); |
||
208 | this.label4.TabIndex = 50; |
||
209 | this.label4.Text = "Name:"; |
||
210 | // |
||
211 | // lblName |
||
212 | // |
||
213 | this.lblName.Location = new System.Drawing.Point(64, 8); |
||
214 | this.lblName.Name = "lblName"; |
||
215 | this.lblName.Size = new System.Drawing.Size(184, 16); |
||
216 | this.lblName.TabIndex = 50; |
||
217 | // |
||
218 | // lblBalance |
||
219 | // |
||
220 | this.lblBalance.Location = new System.Drawing.Point(512, 8); |
||
221 | this.lblBalance.Name = "lblBalance"; |
||
222 | this.lblBalance.Size = new System.Drawing.Size(64, 16); |
||
223 | this.lblBalance.TabIndex = 50; |
||
224 | this.lblBalance.TextAlign = System.Drawing.ContentAlignment.TopRight; |
||
225 | // |
||
226 | // label6 |
||
227 | // |
||
228 | this.label6.Location = new System.Drawing.Point(456, 8); |
||
229 | this.label6.Name = "label6"; |
||
230 | this.label6.Size = new System.Drawing.Size(56, 16); |
||
231 | this.label6.TabIndex = 50; |
||
232 | this.label6.Text = "Balance:"; |
||
233 | // |
||
234 | // label5 |
||
235 | // |
||
236 | this.label5.Location = new System.Drawing.Point(16, 40); |
||
237 | this.label5.Name = "label5"; |
||
238 | this.label5.Size = new System.Drawing.Size(88, 16); |
||
239 | this.label5.TabIndex = 50; |
||
240 | this.label5.Text = "People Search"; |
||
241 | // |
||
242 | // txtFind |
||
243 | // |
||
244 | this.txtFind.Enabled = false; |
||
245 | this.txtFind.Location = new System.Drawing.Point(16, 56); |
||
246 | this.txtFind.Name = "txtFind"; |
||
247 | this.txtFind.Size = new System.Drawing.Size(184, 20); |
||
248 | this.txtFind.TabIndex = 4; |
||
249 | this.txtFind.Text = ""; |
||
250 | // |
||
251 | // cmdFind |
||
252 | // |
||
253 | this.cmdFind.Enabled = false; |
||
254 | this.cmdFind.Location = new System.Drawing.Point(208, 56); |
||
255 | this.cmdFind.Name = "cmdFind"; |
||
256 | this.cmdFind.Size = new System.Drawing.Size(48, 24); |
||
257 | this.cmdFind.TabIndex = 5; |
||
258 | this.cmdFind.Text = "Find"; |
||
259 | this.cmdFind.Click += new System.EventHandler(this.cmdFind_Click); |
||
260 | // |
||
261 | // txtTransfer |
||
262 | // |
||
263 | this.txtTransfer.Enabled = false; |
||
264 | this.txtTransfer.Location = new System.Drawing.Point(360, 192); |
||
265 | this.txtTransfer.MaxLength = 7; |
||
266 | this.txtTransfer.Name = "txtTransfer"; |
||
267 | this.txtTransfer.Size = new System.Drawing.Size(104, 20); |
||
268 | this.txtTransfer.TabIndex = 7; |
||
269 | this.txtTransfer.Text = ""; |
||
270 | // |
||
271 | // cmdTransfer |
||
272 | // |
||
273 | this.cmdTransfer.Enabled = false; |
||
274 | this.cmdTransfer.Location = new System.Drawing.Point(472, 192); |
||
275 | this.cmdTransfer.Name = "cmdTransfer"; |
||
276 | this.cmdTransfer.Size = new System.Drawing.Size(104, 24); |
||
277 | this.cmdTransfer.TabIndex = 8; |
||
278 | this.cmdTransfer.Text = "Transfer Lindens"; |
||
279 | this.cmdTransfer.Click += new System.EventHandler(this.cmdTransfer_Click); |
||
280 | // |
||
281 | // label7 |
||
282 | // |
||
283 | this.label7.Location = new System.Drawing.Point(360, 176); |
||
284 | this.label7.Name = "label7"; |
||
285 | this.label7.Size = new System.Drawing.Size(88, 16); |
||
286 | this.label7.TabIndex = 17; |
||
287 | this.label7.Text = "Amount:"; |
||
288 | // |
||
289 | // lstFind |
||
290 | // |
||
291 | this.lstFind.Activation = System.Windows.Forms.ItemActivation.OneClick; |
||
292 | this.lstFind.AllowColumnReorder = true; |
||
293 | this.lstFind.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { |
||
294 | this.colName, |
||
295 | this.colOnline, |
||
296 | this.colUuid}); |
||
297 | this.lstFind.FullRowSelect = true; |
||
298 | this.lstFind.HideSelection = false; |
||
299 | this.lstFind.Location = new System.Drawing.Point(16, 88); |
||
300 | this.lstFind.Name = "lstFind"; |
||
301 | this.lstFind.Size = new System.Drawing.Size(336, 248); |
||
302 | this.lstFind.Sorting = System.Windows.Forms.SortOrder.Ascending; |
||
303 | this.lstFind.TabIndex = 6; |
||
304 | this.lstFind.View = System.Windows.Forms.View.Details; |
||
305 | // |
||
306 | // colName |
||
307 | // |
||
308 | this.colName.Text = "Name"; |
||
309 | this.colName.Width = 120; |
||
310 | // |
||
311 | // colOnline |
||
312 | // |
||
313 | this.colOnline.Text = "Online"; |
||
314 | this.colOnline.Width = 50; |
||
315 | // |
||
316 | // colUuid |
||
317 | // |
||
318 | this.colUuid.Text = "UUID"; |
||
319 | this.colUuid.Width = 150; |
||
320 | // |
||
321 | // frmGridAccountant |
||
322 | // |
||
323 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
||
324 | this.ClientSize = new System.Drawing.Size(592, 437); |
||
325 | this.Controls.Add(this.lstFind); |
||
326 | this.Controls.Add(this.label7); |
||
327 | this.Controls.Add(this.cmdTransfer); |
||
328 | this.Controls.Add(this.txtTransfer); |
||
329 | this.Controls.Add(this.txtFind); |
||
330 | this.Controls.Add(this.cmdFind); |
||
331 | this.Controls.Add(this.label5); |
||
332 | this.Controls.Add(this.lblBalance); |
||
333 | this.Controls.Add(this.label6); |
||
334 | this.Controls.Add(this.lblName); |
||
335 | this.Controls.Add(this.label4); |
||
336 | this.Controls.Add(this.grpLogin); |
||
337 | this.Name = "frmGridAccountant"; |
||
338 | this.Text = "Grid Accountant"; |
||
339 | this.Load += new System.EventHandler(this.frmGridAccountant_Load); |
||
340 | this.grpLogin.ResumeLayout(false); |
||
341 | this.ResumeLayout(false); |
||
342 | |||
343 | } |
||
344 | #endregion |
||
345 | |||
346 | /// <summary> |
||
347 | /// The main entry point for the application. |
||
348 | /// </summary> |
||
349 | [STAThread] |
||
350 | static void Main() |
||
351 | { |
||
352 | frmGridAccountant frm = new frmGridAccountant(); |
||
353 | frm.ShowDialog(); |
||
354 | } |
||
355 | |||
356 | private delegate void StringParamInvoker(string value); |
||
357 | private delegate void ListViewItemParamInvoker(ListViewItem item); |
||
358 | |||
359 | private void UpdateBalance(string value) |
||
360 | { |
||
361 | lblBalance.Text = value; |
||
362 | } |
||
363 | |||
364 | private void AddFindItem(ListViewItem item) |
||
365 | { |
||
366 | lock (lstFind) |
||
367 | { |
||
368 | lstFind.Items.Add(item); |
||
369 | } |
||
370 | } |
||
371 | |||
372 | protected void BalanceHandler(object sender, PacketReceivedEventArgs e) |
||
373 | { |
||
374 | Packet packet = e.Packet; |
||
375 | string value = ((MoneyBalanceReplyPacket)packet).MoneyData.MoneyBalance.ToString(); |
||
376 | this.BeginInvoke(new StringParamInvoker(UpdateBalance), new object[] { value }); |
||
377 | } |
||
378 | |||
379 | private void DirPeopleHandler(object sender, PacketReceivedEventArgs e) |
||
380 | { |
||
381 | Packet packet = e.Packet; |
||
382 | |||
383 | DirPeopleReplyPacket reply = (DirPeopleReplyPacket)packet; |
||
384 | |||
385 | foreach (DirPeopleReplyPacket.QueryRepliesBlock block in reply.QueryReplies) |
||
386 | { |
||
387 | ListViewItem listItem = new ListViewItem(new string[] { |
||
388 | Utils.BytesToString(block.FirstName) + " " + Utils.BytesToString(block.LastName), |
||
389 | (block.Online ? "Yes" : "No"), block.AgentID.ToString() }); |
||
390 | |||
391 | this.BeginInvoke(new ListViewItemParamInvoker(AddFindItem), new object[] { listItem }); |
||
392 | } |
||
393 | } |
||
394 | |||
395 | private void frmGridAccountant_Load(object sender, System.EventArgs e) |
||
396 | { |
||
397 | Client = new GridClient(); |
||
398 | |||
399 | Client.Settings.MULTIPLE_SIMS = false; |
||
400 | |||
401 | Client.Network.LoginProgress += Network_OnLogin; |
||
402 | |||
403 | // Install our packet handlers |
||
404 | Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, BalanceHandler); |
||
405 | Client.Network.RegisterCallback(PacketType.DirPeopleReply, DirPeopleHandler); |
||
406 | |||
407 | grpLogin.Enabled = true; |
||
408 | } |
||
409 | |||
410 | private void Network_OnLogin(object sender, LoginProgressEventArgs e) |
||
411 | { |
||
412 | if (e.Status == LoginStatus.Success) |
||
413 | { |
||
414 | Random rand = new Random(); |
||
415 | |||
416 | // AgentSetAppearance |
||
417 | AgentSetAppearancePacket appearance = new AgentSetAppearancePacket(); |
||
418 | appearance.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[251]; |
||
419 | // Setup some random appearance values |
||
420 | for (int i = 0; i < 251; i++) |
||
421 | { |
||
422 | appearance.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock(); |
||
423 | appearance.VisualParam[i].ParamValue = (byte)rand.Next(255); |
||
424 | } |
||
425 | appearance.AgentData.AgentID = Client.Self.AgentID; |
||
426 | appearance.AgentData.SessionID = Client.Self.SessionID; |
||
427 | appearance.AgentData.SerialNum = 1; |
||
428 | appearance.AgentData.Size = new Vector3(0.45F, 0.6F, 1.831094F); |
||
429 | appearance.ObjectData.TextureEntry = Utils.EmptyBytes; |
||
430 | |||
431 | Client.Network.SendPacket(appearance); |
||
432 | |||
433 | // Request our balance |
||
434 | Client.Self.RequestBalance(); |
||
435 | |||
436 | BeginInvoke( |
||
437 | (MethodInvoker)delegate() |
||
438 | { |
||
439 | lblName.Text = Client.ToString(); |
||
440 | txtFind.Enabled = cmdFind.Enabled = true; |
||
441 | txtTransfer.Enabled = cmdTransfer.Enabled = true; |
||
442 | }); |
||
443 | } |
||
444 | else if (e.Status == LoginStatus.Failed) |
||
445 | { |
||
446 | BeginInvoke( |
||
447 | (MethodInvoker)delegate() |
||
448 | { |
||
449 | MessageBox.Show(this, "Error logging in: " + Client.Network.LoginMessage); |
||
450 | cmdConnect.Text = "Connect"; |
||
451 | txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; |
||
452 | txtFind.Enabled = cmdFind.Enabled = false; |
||
453 | lblName.Text = lblBalance.Text = String.Empty; |
||
454 | txtTransfer.Enabled = cmdTransfer.Enabled = false; |
||
455 | }); |
||
456 | } |
||
457 | } |
||
458 | |||
459 | private void cmdConnect_Click(object sender, System.EventArgs e) |
||
460 | { |
||
461 | if (cmdConnect.Text == "Connect") |
||
462 | { |
||
463 | cmdConnect.Text = "Disconnect"; |
||
464 | txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = false; |
||
465 | |||
466 | LoginParams loginParams = Client.Network.DefaultLoginParams(txtFirstName.Text, txtLastName.Text, |
||
467 | txtPassword.Text, "GridAccountant", "1.0.0"); |
||
468 | Client.Network.BeginLogin(loginParams); |
||
469 | } |
||
470 | else |
||
471 | { |
||
472 | Client.Network.Logout(); |
||
473 | cmdConnect.Text = "Connect"; |
||
474 | txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; |
||
475 | txtFind.Enabled = cmdFind.Enabled = false; |
||
476 | lblName.Text = lblBalance.Text = ""; |
||
477 | txtTransfer.Enabled = cmdTransfer.Enabled = false; |
||
478 | } |
||
479 | } |
||
480 | |||
481 | private void cmdFind_Click(object sender, System.EventArgs e) |
||
482 | { |
||
483 | lstFind.Items.Clear(); |
||
484 | |||
485 | DirFindQueryPacket query = new DirFindQueryPacket(); |
||
486 | query.AgentData.AgentID = Client.Self.AgentID; |
||
487 | query.AgentData.SessionID = Client.Self.SessionID; |
||
488 | query.QueryData.QueryFlags = 1; |
||
489 | query.QueryData.QueryID = UUID.Random(); |
||
490 | query.QueryData.QueryStart = 0; |
||
491 | query.QueryData.QueryText = Utils.StringToBytes(txtFind.Text); |
||
492 | query.Header.Reliable = true; |
||
493 | |||
494 | Client.Network.SendPacket(query); |
||
495 | } |
||
496 | |||
497 | private void cmdTransfer_Click(object sender, System.EventArgs e) |
||
498 | { |
||
499 | int amount = 0; |
||
500 | |||
501 | try |
||
502 | { |
||
503 | amount = System.Convert.ToInt32(txtTransfer.Text); |
||
504 | } |
||
505 | catch (Exception) |
||
506 | { |
||
507 | MessageBox.Show(txtTransfer.Text + " is not a valid amount"); |
||
508 | return; |
||
509 | } |
||
510 | |||
511 | if (lstFind.SelectedItems.Count != 1) |
||
512 | { |
||
513 | MessageBox.Show("Find an avatar using the directory search and select " + |
||
514 | "their name to transfer money"); |
||
515 | return; |
||
516 | } |
||
517 | |||
518 | Client.Self.GiveAvatarMoney(new UUID(lstFind.SelectedItems[0].SubItems[2].Text), |
||
519 | amount, "GridAccountant payment"); |
||
520 | } |
||
521 | } |
||
522 | } |