aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorPatrick Sapinski2010-08-24 14:40:28 -0400
committerMcCabe Maxsted2010-08-30 17:16:51 -0700
commit86acaec2979f6903d93d0cc277d380a2ec012b00 (patch)
tree76869e6da7645ef7654d4713857905f3a237985d /linden
parentforgot a few settings necessary for the translation feature (diff)
downloadmeta-impy-86acaec2979f6903d93d0cc277d380a2ec012b00.zip
meta-impy-86acaec2979f6903d93d0cc277d380a2ec012b00.tar.gz
meta-impy-86acaec2979f6903d93d0cc277d380a2ec012b00.tar.bz2
meta-impy-86acaec2979f6903d93d0cc277d380a2ec012b00.tar.xz
updated chatbar command line and added the necessary settings and hooks to use it
Diffstat (limited to '')
-rw-r--r--linden/indra/llmath/llvolume.h3
-rw-r--r--linden/indra/newview/app_settings/settings.xml225
-rw-r--r--linden/indra/newview/chatbar_as_cmdline.cpp958
-rw-r--r--linden/indra/newview/llchatbar.cpp3
-rw-r--r--linden/indra/newview/llinventorymodel.cpp22
-rw-r--r--linden/indra/newview/llinventorymodel.h2
-rw-r--r--linden/indra/newview/llprefsadvanced.cpp27
-rw-r--r--linden/indra/newview/llprefsadvanced.h2
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml109
9 files changed, 1351 insertions, 0 deletions
diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h
index e55fe52..2b1c60d 100644
--- a/linden/indra/llmath/llvolume.h
+++ b/linden/indra/llmath/llvolume.h
@@ -154,6 +154,9 @@ const U8 LL_PCODE_PATH_IGNORE = 0x00;
154const U8 LL_PCODE_PATH_MIN = 0x01; // min/max needs to be >> 4 of real min/max 154const U8 LL_PCODE_PATH_MIN = 0x01; // min/max needs to be >> 4 of real min/max
155const U8 LL_PCODE_PATH_LINE = 0x10; 155const U8 LL_PCODE_PATH_LINE = 0x10;
156const U8 LL_PCODE_PATH_CIRCLE = 0x20; 156const U8 LL_PCODE_PATH_CIRCLE = 0x20;
157//<-- Working33 by Gregory Maurer
158const U8 LL_PCODE_PATH_CIRCLE_33 = 0x21;
159//Working33 -->
157const U8 LL_PCODE_PATH_CIRCLE2 = 0x30; 160const U8 LL_PCODE_PATH_CIRCLE2 = 0x30;
158const U8 LL_PCODE_PATH_TEST = 0x40; 161const U8 LL_PCODE_PATH_TEST = 0x40;
159const U8 LL_PCODE_PATH_FLEXIBLE = 0x80; 162const U8 LL_PCODE_PATH_FLEXIBLE = 0x80;
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index d45eac2..42565b3 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -1299,6 +1299,231 @@
1299 1299
1300 <!-- End: Client Name Tag --> 1300 <!-- End: Client Name Tag -->
1301 1301
1302 <!-- Begin: chatbar_as_cmdline -->
1303
1304 <key>EmeraldCmdLine</key>
1305 <map>
1306 <key>Comment</key>
1307 <string>Enable usage of chat bar as a command line</string>
1308 <key>Persist</key>
1309 <integer>1</integer>
1310 <key>Type</key>
1311 <string>Boolean</string>
1312 <key>Value</key>
1313 <integer>1</integer>
1314 </map>
1315 <key>EmeraldCmdLineMapToKeepPos</key>
1316 <map>
1317 <key>Comment</key>
1318 <string>Whether to use current local pos on tp to the new sim</string>
1319 <key>Persist</key>
1320 <integer>1</integer>
1321 <key>Type</key>
1322 <string>Boolean</string>
1323 <key>Value</key>
1324 <integer>0</integer>
1325 </map>
1326 <key>EmeraldCmdLineAO</key>
1327 <map>
1328 <key>Comment</key>
1329 <string>Turn AO on/off</string>
1330 <key>Persist</key>
1331 <integer>1</integer>
1332 <key>Type</key>
1333 <string>String</string>
1334 <key>Value</key>
1335 <string>cao</string>
1336 </map>
1337 <key>EmeraldCmdLineAutocorrect</key>
1338 <map>
1339 <key>Comment</key>
1340 <string>Command for adding new entries to autocorrect</string>
1341 <key>Persist</key>
1342 <integer>1</integer>
1343 <key>Type</key>
1344 <string>String</string>
1345 <key>Value</key>
1346 <string>/addac</string>
1347 </map>
1348 <key>EmeraldCmdLineMedia</key>
1349 <map>
1350 <key>Comment</key>
1351 <string>Chat command for setting a media url</string>
1352 <key>Persist</key>
1353 <integer>1</integer>
1354 <key>Type</key>
1355 <string>String</string>
1356 <key>Value</key>
1357 <string>/media</string>
1358 </map>
1359 <key>EmeraldCmdLineMusic</key>
1360 <map>
1361 <key>Comment</key>
1362 <string>Chat command for setting a music url</string>
1363 <key>Persist</key>
1364 <integer>1</integer>
1365 <key>Type</key>
1366 <string>String</string>
1367 <key>Value</key>
1368 <string>/music</string>
1369 </map>
1370 <key>EmeraldCmdLineClearChat</key>
1371 <map>
1372 <key>Comment</key>
1373 <string>Clear chat hsitory to stop lag from chat spam</string>
1374 <key>Persist</key>
1375 <integer>1</integer>
1376 <key>Type</key>
1377 <string>String</string>
1378 <key>Value</key>
1379 <string>clrchat</string>
1380 </map>
1381 <key>EmeraldCmdLineHeight</key>
1382 <map>
1383 <key>Comment</key>
1384 <string>Teleport to height function command</string>
1385 <key>Persist</key>
1386 <integer>1</integer>
1387 <key>Type</key>
1388 <string>String</string>
1389 <key>Value</key>
1390 <string>gth</string>
1391 </map>
1392 <key>EmeraldCmdLinePos</key>
1393 <map>
1394 <key>Comment</key>
1395 <string>Teleport to position function command</string>
1396 <key>Persist</key>
1397 <integer>1</integer>
1398 <key>Type</key>
1399 <string>String</string>
1400 <key>Value</key>
1401 <string>gtp</string>
1402 </map>
1403 <key>EmeraldCmdLineGround</key>
1404 <map>
1405 <key>Comment</key>
1406 <string>Teleport to ground function command</string>
1407 <key>Persist</key>
1408 <integer>1</integer>
1409 <key>Type</key>
1410 <string>String</string>
1411 <key>Value</key>
1412 <string>flr</string>
1413 </map>
1414 <key>EmeraldCmdLineTeleportHome</key>
1415 <map>
1416 <key>Comment</key>
1417 <string>Teleport to home function command</string>
1418 <key>Persist</key>
1419 <integer>1</integer>
1420 <key>Type</key>
1421 <string>String</string>
1422 <key>Value</key>
1423 <string>tph</string>
1424 </map>
1425 <key>EmeraldCmdLineRezPlatform</key>
1426 <map>
1427 <key>Comment</key>
1428 <string>Rez a platform underneath you</string>
1429 <key>Persist</key>
1430 <integer>1</integer>
1431 <key>Type</key>
1432 <string>String</string>
1433 <key>Value</key>
1434 <string>rezplat</string>
1435 </map>
1436 <key>EmeraldCmdLinePlatformSize</key>
1437 <map>
1438 <key>Comment</key>
1439 <string>How wide the rezzed platform will appear to be.</string>
1440 <key>Persist</key>
1441 <integer>1</integer>
1442 <key>Type</key>
1443 <string>F32</string>
1444 <key>Value</key>
1445 <real>30</real>
1446 </map>
1447 <key>EmeraldCmdLineMapTo</key>
1448 <map>
1449 <key>Comment</key>
1450 <string>Teleport to a region by name rapidly</string>
1451 <key>Persist</key>
1452 <integer>1</integer>
1453 <key>Type</key>
1454 <string>String</string>
1455 <key>Value</key>
1456 <string>mapto</string>
1457 </map>
1458 <key>EmeraldCmdLineDrawDistance</key>
1459 <map>
1460 <key>Comment</key>
1461 <string>Change draw distance quickly</string>
1462 <key>Persist</key>
1463 <integer>1</integer>
1464 <key>Type</key>
1465 <string>String</string>
1466 <key>Value</key>
1467 <string>dd</string>
1468 </map>
1469 <key>EmeraldCmdTeleportToCam</key>
1470 <map>
1471 <key>Comment</key>
1472 <string>Teleport to your camera</string>
1473 <key>Persist</key>
1474 <integer>1</integer>
1475 <key>Type</key>
1476 <string>String</string>
1477 <key>Value</key>
1478 <string>tp2cam</string>
1479 </map>
1480 <key>EmeraldCmdLineKeyToName</key>
1481 <map>
1482 <key>Comment</key>
1483 <string>Use a fast key to name querry</string>
1484 <key>Persist</key>
1485 <integer>1</integer>
1486 <key>Type</key>
1487 <string>String</string>
1488 <key>Value</key>
1489 <string>key2name</string>
1490 </map>
1491 <key>EmeraldCmdLineOfferTp</key>
1492 <map>
1493 <key>Comment</key>
1494 <string>Offer a teleport to target avatar</string>
1495 <key>Persist</key>
1496 <integer>1</integer>
1497 <key>Type</key>
1498 <string>String</string>
1499 <key>Value</key>
1500 <string>offertp</string>
1501 </map>
1502 <key>EmeraldCmdLineCalc</key>
1503 <map>
1504 <key>Comment</key>
1505 <string>Calculates an expression</string>
1506 <key>Persist</key>
1507 <integer>1</integer>
1508 <key>Type</key>
1509 <string>String</string>
1510 <key>Value</key>
1511 <string>calc</string>
1512 </map>
1513 <key>EmeraldCmdLineTP2</key>
1514 <map>
1515 <key>Comment</key>
1516 <string>Teleport to a person by name, partials work.</string>
1517 <key>Persist</key>
1518 <integer>1</integer>
1519 <key>Type</key>
1520 <string>String</string>
1521 <key>Value</key>
1522 <string>tp2</string>
1523 </map>
1524
1525 <!-- End: chatbar_as_cmdline -->
1526
1302 <!-- Begin: Spellcheck & Translation --> 1527 <!-- Begin: Spellcheck & Translation -->
1303 1528
1304 <key>EmeraldEnableAutoCorrect</key> 1529 <key>EmeraldEnableAutoCorrect</key>
diff --git a/linden/indra/newview/chatbar_as_cmdline.cpp b/linden/indra/newview/chatbar_as_cmdline.cpp
new file mode 100644
index 0000000..3e1d817
--- /dev/null
+++ b/linden/indra/newview/chatbar_as_cmdline.cpp
@@ -0,0 +1,958 @@
1/* Copyright (c) 2010
2 *
3 * Modular Systems All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or
6 * without modification, are permitted provided that the following
7 * conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials provided
14 * with the distribution.
15 * 3. Neither the name Modular Systems nor the names of its contributors
16 * may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS “AS IS”
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include "llviewerprecompiledheaders.h"
33
34#include "chatbar_as_cmdline.h"
35
36#include "llcalc.h"
37
38#include "llchatbar.h"
39#include "llagent.h"
40#include "stdtypes.h"
41#include "llviewerregion.h"
42#include "llworld.h"
43#include "lluuid.h"
44#include "llviewercontrol.h"
45
46#include "material_codes.h"
47#include "llvolume.h"
48#include "object_flags.h"
49#include "llvolumemessage.h"
50#include "llurldispatcher.h"
51#include "llworld.h"
52#include "llworldmap.h"
53//KOW #include "floateravatarlist.h"
54#include "floaterao.h"
55#include "llviewerobjectlist.h"
56#include "llviewertexteditor.h"
57#include "llvoavatar.h"
58#include "lltooldraganddrop.h"
59#include "llinventorymodel.h"
60#include "llselectmgr.h"
61
62#include <iosfwd>
63
64#include <float.h>
65
66#include "llchat.h"
67
68#include "llfloaterchat.h"
69#include "llviewerparcelmgr.h"
70#include "llviewerparcelmedia.h"
71#include "llparcel.h"
72#include "audioengine.h"
73#include "llviewerparcelmediaautoplay.h"
74#include "lloverlaybar.h"
75//KOW #include "lggautocorrectfloater.h"
76#include "lggautocorrect.h"
77
78//#define JC_PROFILE_GSAVED
79
80void cmdline_printchat(std::string message);
81void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0);
82void cmdline_tp2name(std::string target);
83
84LLUUID cmdline_partial_name2key(std::string name);
85
86
87
88LLViewerInventoryItem::item_array_t findInventoryInFolder(const std::string& ifolder)
89{
90 LLUUID folder = gInventory.findCategoryByName(ifolder);
91 LLViewerInventoryCategory::cat_array_t cats;
92 LLViewerInventoryItem::item_array_t items;
93 //ObjectContentNameMatches objectnamematches(ifolder);
94 gInventory.collectDescendents(folder,cats,items,FALSE);//,objectnamematches);
95
96 return items;
97}
98
99class JCZface : public LLEventTimer
100{
101public:
102 JCZface(std::stack<LLViewerInventoryItem*> stack, LLUUID dest, F32 pause) : LLEventTimer( pause )
103 {
104 cmdline_printchat("initialized");
105 instack = stack;
106 indest = dest;
107 }
108 ~JCZface()
109 {
110 cmdline_printchat("deinitialized");
111 }
112 BOOL tick()
113 {
114 LLViewerInventoryItem* subj = instack.top();
115 instack.pop();
116 LLViewerObject *objectp = gObjectList.findObject(indest);
117 if(objectp)
118 {
119 cmdline_printchat(std::string("dropping ")+subj->getName());
120 LLToolDragAndDrop::dropInventory(objectp,subj,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
121 return (instack.size() == 0);
122 }else
123 {
124 cmdline_printchat("object lost");
125 return TRUE;
126 }
127 }
128
129
130private:
131 std::stack<LLViewerInventoryItem*> instack;
132 LLUUID indest;
133};
134
135class JCZtake : public LLEventTimer
136{
137public:
138 BOOL mRunning;
139
140 JCZtake(const LLUUID& target) : LLEventTimer(1.25f), mTarget(target), mRunning(FALSE), mCountdown(5)
141 {
142 cmdline_printchat("Ztake initialised.");
143 }
144 ~JCZtake()
145 {
146 cmdline_printchat("Ztake shutdown.");
147 }
148 BOOL tick()
149 {
150 {
151 LLMessageSystem *msg = gMessageSystem;
152 for(LLObjectSelection::iterator itr=LLSelectMgr::getInstance()->getSelection()->begin();
153 itr!=LLSelectMgr::getInstance()->getSelection()->end();++itr)
154 {
155 LLSelectNode* node = (*itr);
156 LLViewerObject* object = node->getObject();
157 U32 localid=object->getLocalID();
158 if(mDonePrims.find(localid) == mDonePrims.end())
159 {
160 mDonePrims.insert(localid);
161 std::string name = llformat("%ix%ix%i",(int)object->getScale().mV[VX],(int)object->getScale().mV[VY],(int)object->getScale().mV[VZ]);
162 msg->newMessageFast(_PREHASH_ObjectName);
163 msg->nextBlockFast(_PREHASH_AgentData);
164 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
165 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
166 msg->nextBlockFast(_PREHASH_ObjectData);
167 msg->addU32Fast(_PREHASH_LocalID, localid);
168 msg->addStringFast(_PREHASH_Name, name);
169 gAgent.sendReliableMessage();
170 mToTake.push_back(localid);
171 }
172 }
173
174 if(mCountdown > 0) {
175 cmdline_printchat(llformat("%i...", mCountdown--));
176 }
177 else if(mToTake.size() > 0) {
178 msg->newMessageFast(_PREHASH_DeRezObject);
179 msg->nextBlockFast(_PREHASH_AgentData);
180 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
181 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
182 msg->nextBlockFast(_PREHASH_AgentBlock);
183 msg->addUUIDFast(_PREHASH_GroupID, LLUUID::null);
184 msg->addU8Fast(_PREHASH_Destination, 4);
185 msg->addUUIDFast(_PREHASH_DestinationID, mTarget);
186 LLUUID rand;
187 rand.generate();
188 msg->addUUIDFast(_PREHASH_TransactionID, rand);
189 msg->addU8Fast(_PREHASH_PacketCount, 1);
190 msg->addU8Fast(_PREHASH_PacketNumber, 0);
191 msg->nextBlockFast(_PREHASH_ObjectData);
192 msg->addU32Fast(_PREHASH_ObjectLocalID, mToTake[0]);
193 gAgent.sendReliableMessage();
194 mToTake.erase(mToTake.begin());
195 if(mToTake.size() % 10 == 0) {
196 if(mToTake.size() == 0) {
197 cmdline_printchat("Ztake done! (You might want to try \"ztake off\")");
198 } else {
199 cmdline_printchat(llformat("Ztake: %i left to take.", mToTake.size()));
200 }
201 }
202 }
203
204 }
205 return mRunning;
206 }
207
208private:
209 std::set<U32> mDonePrims;
210 std::vector<U32> mToTake;
211 LLUUID mTarget;
212 int mCountdown;
213};
214
215JCZtake *ztake;
216
217void invrepair()
218{
219 LLViewerInventoryCategory::cat_array_t cats;
220 LLViewerInventoryItem::item_array_t items;
221 //ObjectContentNameMatches objectnamematches(ifolder);
222 gInventory.collectDescendents(gAgent.getInventoryRootID(),cats,items,FALSE);//,objectnamematches);
223}
224
225/*static BOOL *sEmeraldCmdLine;
226static std::string *sEmeraldCmdLinePos;
227static std::string *sEmeraldCmdLineDrawDistance;
228static std::string *sEmeraldCmdTeleportToCam;
229static std::string *sEmeraldCmdLineAO;
230static std::string *sEmeraldCmdLineKeyToName;
231static std::string *sEmeraldCmdLineOfferTp;
232static std::string *sEmeraldCmdLineGround;
233static std::string *sEmeraldCmdLineHeight;
234static std::string *sEmeraldCmdLineTeleportHome;
235static std::string *sEmeraldCmdLineRezPlatform;
236static std::string *sEmeraldCmdLineMapTo;
237static BOOL *sEmeraldCmdLineMapToKeepPos;
238static std::string *sEmeraldCmdLineCalc;
239static std::string *sEmeraldCmdLineTP2;
240static std::string *sEmeraldCmdLineClearChat;
241static F32 *sEmeraldCmdLinePlatformSize;*/
242
243/*
244class another_rebind_group
245{
246
247}
248
249template <class T>
250class another_rebind
251{
252 T *mVal;
253 static std::map<another_rebind*, std::map<std::string, T*> > instances;
254
255
256
257};
258*/
259
260
261#ifdef JC_PROFILE_GSAVED
262std::map<std::string, int> get_gsaved_calls();
263#endif
264
265bool cmd_line_chat(std::string revised_text, EChatType type)
266{
267 static BOOL *sEmeraldCmdLine = rebind_llcontrol<BOOL>("EmeraldCmdLine", &gSavedSettings, true);
268 static std::string *sEmeraldCmdLinePos = rebind_llcontrol<std::string>("EmeraldCmdLinePos", &gSavedSettings, true);
269 static std::string *sEmeraldCmdLineDrawDistance = rebind_llcontrol<std::string>("EmeraldCmdLineDrawDistance", &gSavedSettings, true);
270 static std::string *sEmeraldCmdTeleportToCam = rebind_llcontrol<std::string>("EmeraldCmdTeleportToCam", &gSavedSettings, true);
271 static std::string *sEmeraldCmdLineAO = rebind_llcontrol<std::string>("EmeraldCmdLineAO", &gSavedSettings, true);
272 static std::string *sEmeraldCmdLineKeyToName = rebind_llcontrol<std::string>("EmeraldCmdLineKeyToName", &gSavedSettings, true);
273 static std::string *sEmeraldCmdLineOfferTp = rebind_llcontrol<std::string>("EmeraldCmdLineOfferTp", &gSavedSettings, true);
274 static std::string *sEmeraldCmdLineGround = rebind_llcontrol<std::string>("EmeraldCmdLineGround", &gSavedSettings, true);
275 static std::string *sEmeraldCmdLineHeight = rebind_llcontrol<std::string>("EmeraldCmdLineHeight", &gSavedSettings, true);
276 static std::string *sEmeraldCmdLineTeleportHome = rebind_llcontrol<std::string>("EmeraldCmdLineTeleportHome", &gSavedSettings, true);
277 static std::string *sEmeraldCmdLineRezPlatform = rebind_llcontrol<std::string>("EmeraldCmdLineRezPlatform", &gSavedSettings, true);
278 static std::string *sEmeraldCmdLineMapTo = rebind_llcontrol<std::string>("EmeraldCmdLineMapTo", &gSavedSettings, true);
279 static BOOL *sEmeraldCmdLineMapToKeepPos = rebind_llcontrol<BOOL>("EmeraldCmdLineMapToKeepPos", &gSavedSettings, true);
280 static std::string *sEmeraldCmdLineCalc = rebind_llcontrol<std::string>("EmeraldCmdLineCalc", &gSavedSettings, true);
281 static std::string *sEmeraldCmdLineTP2 = rebind_llcontrol<std::string>("EmeraldCmdLineTP2", &gSavedSettings, true);
282 static std::string *sEmeraldCmdLineClearChat = rebind_llcontrol<std::string>("EmeraldCmdLineClearChat", &gSavedSettings, true);
283 static std::string *sEmeraldCmdLineMedia = rebind_llcontrol<std::string>("EmeraldCmdLineMedia", &gSavedSettings, true);
284 static std::string *sEmeraldCmdLineMusic = rebind_llcontrol<std::string>("EmeraldCmdLineMusic", &gSavedSettings, true);
285 static std::string *sEmeraldCmdLineAutocorrect = rebind_llcontrol<std::string>("EmeraldCmdLineAutocorrect", &gSavedSettings, true);
286 //static std::string *sEmeraldCmdUndeform = rebind_llcontrol<std::string>("EmeraldCmdUndeform", &gSavedSettings, true);
287 //gSavedSettings.getString("EmeraldCmdUndeform")
288
289 if(*sEmeraldCmdLine)
290 {
291 std::istringstream i(revised_text);
292 std::string command;
293 i >> command;
294 if(command != "")
295 {
296 if(command == *sEmeraldCmdLinePos)
297 {
298 F32 x,y,z;
299 if (i >> x)
300 {
301 if (i >> y)
302 {
303 if (i >> z)
304 {
305 LLVector3 agentPos = gAgent.getPositionAgent();
306 LLViewerRegion* agentRegionp = gAgent.getRegion();
307 if(agentRegionp)
308 {
309 LLVector3 targetPos(x,y,z);
310 LLVector3d pos_global = from_region_handle(agentRegionp->getHandle());
311 pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
312 gAgent.teleportViaLocation(pos_global);
313 return false;
314 }
315 }
316 }
317 }
318 }
319 else if(command == *sEmeraldCmdLineDrawDistance)
320 {
321 int drawDist;
322 if(i >> drawDist)
323 {
324 gSavedSettings.setF32("RenderFarClip", drawDist);
325 gAgent.mDrawDistance=drawDist;
326 char buffer[DB_IM_MSG_BUF_SIZE * 2];
327 snprintf(buffer,sizeof(buffer),"Draw distance set to: %dm",drawDist);
328 cmdline_printchat(std::string(buffer));
329 return false;
330 }
331 }
332 else if(command == *sEmeraldCmdTeleportToCam)
333 {
334 gAgent.teleportViaLocation(gAgent.getCameraPositionGlobal());
335 return false;
336 }
337 /*else if(command == *sEmeraldCmdUndeform)
338 {
339 llinfos << "UNDEFORM: Do you feel your bones cracking back into place?" << llendl;
340 gAgent.getAvatarObject()->undeform();
341 return false;
342 }*/ //what the fuck is this shit, thought it would be something useful like repairing the skeleton but its some shitty playing of inworld anims
343 else if(command == *sEmeraldCmdLineMedia)
344 {
345 std::string url;
346 std::string type;
347
348 if(i >> url)
349 {
350 if(i >> type)
351 {
352 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
353 parcel->setMediaURL(url);
354 parcel->setMediaType(type);
355 LLViewerParcelMedia::play(parcel);
356 LLViewerParcelMediaAutoPlay::playStarted();
357 return false;
358 }
359 }
360 }
361 else if(command == *sEmeraldCmdLineMusic)
362 {
363 std::string status;
364 if(i >> status)
365 {
366 if(!gOverlayBar->musicPlaying())
367 {
368 gOverlayBar->toggleMusicPlay(gOverlayBar);
369 }
370 gAudiop->startInternetStream(status);
371 return false;
372 }
373 }
374 else if(command == *sEmeraldCmdLineAO)
375 {
376 std::string status;
377 if(i >> status)
378 {
379 if (status == "on" )
380 {
381 gSavedPerAccountSettings.setBOOL("AOEnabled",TRUE);
382// LLFloaterAO::init();
383 LLFloaterAO::run();
384 }
385 else if (status == "off" )
386 {
387 gSavedPerAccountSettings.setBOOL("AOEnabled",FALSE);
388 LLFloaterAO::run();
389 }
390 else if (status == "sit" )
391 {
392 gSavedPerAccountSettings.setBOOL("AOSitsEnabled",!gSavedPerAccountSettings.getBOOL("AOSitsEnabled"));
393 }
394 }
395 return false;
396 }
397 else if(command == *sEmeraldCmdLineKeyToName)
398 {
399 LLUUID targetKey;
400 if(i >> targetKey)
401 {
402 std::string object_name;
403 gCacheName->getFullName(targetKey, object_name);
404 char buffer[DB_IM_MSG_BUF_SIZE * 2];
405 snprintf(buffer,sizeof(buffer),"%s: (%s)",targetKey.asString().c_str(), object_name.c_str());
406 cmdline_printchat(std::string(buffer));
407 }
408 return false;
409 }
410 else if(command == "/touch")
411 {
412 LLUUID targetKey;
413 if(i >> targetKey)
414 {
415 LLViewerObject* myObject = gObjectList.findObject(targetKey);
416 char buffer[DB_IM_MSG_BUF_SIZE * 2];
417
418 if (!myObject)
419 {
420 snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str());
421 cmdline_printchat(std::string(buffer));
422 return false;
423 }
424
425 LLMessageSystem *msg = gMessageSystem;
426 msg->newMessageFast(_PREHASH_ObjectGrab);
427 msg->nextBlockFast( _PREHASH_AgentData);
428 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
429 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
430 msg->nextBlockFast( _PREHASH_ObjectData);
431 msg->addU32Fast( _PREHASH_LocalID, myObject->mLocalID);
432 msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero );
433 msg->nextBlock("SurfaceInfo");
434 msg->addVector3("UVCoord", LLVector3::zero);
435 msg->addVector3("STCoord", LLVector3::zero);
436 msg->addS32Fast(_PREHASH_FaceIndex, 0);
437 msg->addVector3("Position", myObject->getPosition());
438 msg->addVector3("Normal", LLVector3::zero);
439 msg->addVector3("Binormal", LLVector3::zero);
440 msg->sendMessage( myObject->getRegion()->getHost());
441
442 // *NOTE: Hope the packets arrive safely and in order or else
443 // there will be some problems.
444 // *TODO: Just fix this bad assumption.
445 msg->newMessageFast(_PREHASH_ObjectDeGrab);
446 msg->nextBlockFast(_PREHASH_AgentData);
447 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
448 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
449 msg->nextBlockFast(_PREHASH_ObjectData);
450 msg->addU32Fast(_PREHASH_LocalID, myObject->mLocalID);
451 msg->nextBlock("SurfaceInfo");
452 msg->addVector3("UVCoord", LLVector3::zero);
453 msg->addVector3("STCoord", LLVector3::zero);
454 msg->addS32Fast(_PREHASH_FaceIndex, 0);
455 msg->addVector3("Position", myObject->getPosition());
456 msg->addVector3("Normal", LLVector3::zero);
457 msg->addVector3("Binormal", LLVector3::zero);
458 msg->sendMessage(myObject->getRegion()->getHost());
459 snprintf(buffer,sizeof(buffer),"Touched object with key %s",targetKey.asString().c_str());
460 cmdline_printchat(std::string(buffer));
461 }
462 return false;
463 }
464 else if(command == "/siton")
465 {
466 LLUUID targetKey;
467 if(i >> targetKey)
468 {
469 LLViewerObject* myObject = gObjectList.findObject(targetKey);
470 char buffer[DB_IM_MSG_BUF_SIZE * 2];
471
472 if (!myObject)
473 {
474 snprintf(buffer,sizeof(buffer),"Object with key %s not found!",targetKey.asString().c_str());
475 cmdline_printchat(std::string(buffer));
476 return false;
477 }
478 LLMessageSystem *msg = gMessageSystem;
479 msg->newMessageFast(_PREHASH_AgentRequestSit);
480 msg->nextBlockFast(_PREHASH_AgentData);
481 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
482 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
483 msg->nextBlockFast(_PREHASH_TargetObject);
484 msg->addUUIDFast(_PREHASH_TargetID, targetKey);
485 msg->addVector3Fast(_PREHASH_Offset, LLVector3::zero);
486 gAgent.getRegion()->sendReliableMessage();
487
488 snprintf(buffer,sizeof(buffer),"Sat on object with key %s",targetKey.asString().c_str());
489 cmdline_printchat(std::string(buffer));
490 }
491 return false;
492 }
493 else if(command == "/standup")
494 {
495 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
496 cmdline_printchat(std::string("Standing up"));
497 return false;
498 }
499 else if(command == *sEmeraldCmdLineOfferTp)
500 {
501 std::string avatarKey;
502// llinfos << "CMD DEBUG 0 " << command << " " << avatarName << llendl;
503 if(i >> avatarKey)
504 {
505// llinfos << "CMD DEBUG 0 afterif " << command << " " << avatarName << llendl;
506 LLUUID tempUUID;
507 if(LLUUID::parseUUID(avatarKey, &tempUUID))
508 {
509 char buffer[DB_IM_MSG_BUF_SIZE * 2];
510 LLDynamicArray<LLUUID> ids;
511 ids.push_back(tempUUID);
512 std::string tpMsg="Join me!";
513 LLMessageSystem* msg = gMessageSystem;
514 msg->newMessageFast(_PREHASH_StartLure);
515 msg->nextBlockFast(_PREHASH_AgentData);
516 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
517 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
518 msg->nextBlockFast(_PREHASH_Info);
519 msg->addU8Fast(_PREHASH_LureType, (U8)0);
520
521 msg->addStringFast(_PREHASH_Message, tpMsg);
522 for(LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
523 {
524 msg->nextBlockFast(_PREHASH_TargetData);
525 msg->addUUIDFast(_PREHASH_TargetID, *itr);
526 }
527 gAgent.sendReliableMessage();
528 snprintf(buffer,sizeof(buffer),"Offered TP to key %s",tempUUID.asString().c_str());
529 cmdline_printchat(std::string(buffer));
530 return false;
531 }
532 }
533 }
534
535 else if(command == *sEmeraldCmdLineGround)
536 {
537 LLVector3 agentPos = gAgent.getPositionAgent();
538 U64 agentRegion = gAgent.getRegion()->getHandle();
539 LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],LLWorld::getInstance()->resolveLandHeightAgent(agentPos));
540 LLVector3d pos_global = from_region_handle(agentRegion);
541 pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
542 gAgent.teleportViaLocation(pos_global);
543 return false;
544 }else if(command == *sEmeraldCmdLineHeight)
545 {
546 F32 z;
547 if(i >> z)
548 {
549 LLVector3 agentPos = gAgent.getPositionAgent();
550 U64 agentRegion = gAgent.getRegion()->getHandle();
551 LLVector3 targetPos(agentPos.mV[0],agentPos.mV[1],z);
552 LLVector3d pos_global = from_region_handle(agentRegion);
553 pos_global += LLVector3d((F64)targetPos.mV[0],(F64)targetPos.mV[1],(F64)targetPos.mV[2]);
554 gAgent.teleportViaLocation(pos_global);
555 return false;
556 }
557 }else if(command == *sEmeraldCmdLineTeleportHome)
558 {
559 gAgent.teleportHome();
560 return false;
561 }else if(command == *sEmeraldCmdLineRezPlatform)
562 {
563 F32 width;
564 if (i >> width) cmdline_rezplat(false, width);
565 else cmdline_rezplat();
566 return false;
567 }else if(command == *sEmeraldCmdLineMapTo)
568 {
569 if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek
570 {
571 LLVector3d agentPos = gAgent.getPositionGlobal();
572 S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
573 S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
574 S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
575 std::string region_name = LLWeb::escapeURL(revised_text.substr(command.length()+1));
576 std::string url;
577
578 if(!*sEmeraldCmdLineMapToKeepPos)
579 {
580 agent_x = 128;
581 agent_y = 128;
582 agent_z = 0;
583 }
584
585 url = llformat("secondlife:///app/teleport/%s/%d/%d/%d",region_name.c_str(),agent_x,agent_y,agent_z);
586 LLURLDispatcher::dispatch(url, NULL, true);
587 }
588 return false;
589 }else if(command == *sEmeraldCmdLineCalc)//Cryogenic Blitz
590 {
591 bool success;
592 F32 result = 0.f;
593 if(revised_text.length() > command.length() + 1)
594 {
595
596 std::string expr = revised_text.substr(command.length()+1);
597 LLStringUtil::toUpper(expr);
598 success = LLCalc::getInstance()->evalString(expr, result);
599
600 std::string out;
601
602 if (!success)
603 {
604 out = "Calculation Failed";
605 }
606 else
607 {
608 // Replace the expression with the result
609 std::ostringstream result_str;
610 result_str << expr;
611 result_str << " = ";
612 result_str << result;
613 out = result_str.str();
614 }
615 cmdline_printchat(out);
616 return false;
617 }
618 }else if(command == *sEmeraldCmdLineTP2)
619 {
620 if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek
621 {
622 std::string name = revised_text.substr(command.length()+1);
623 cmdline_tp2name(name);
624 }
625 return false;
626 } /*
627 else if(revised_text == "/ac")
628 {
629 lggAutoCorrectFloaterStart::show(TRUE,NULL);
630 cmdline_printchat("Displaying AutoCorrection Floater.");
631 return false;
632 } */
633 else if(command == *sEmeraldCmdLineAutocorrect)
634 {
635 if (revised_text.length() <= command.length() + 1) //KOW: verify that we have params
636 {
637 cmdline_printchat("No parameter specified, correct usage is "+
638 *sEmeraldCmdLineAutocorrect+" list Name|wrong word|right word.");
639 return false;
640 }
641
642 std::string info = revised_text.substr((*sEmeraldCmdLineAutocorrect).length()+1);
643 //addac list name|wrong word|right word
644 int bar = info.find("|");
645 if (bar==std::string::npos)
646 {
647 cmdline_printchat("Wrong usage, correct usage is "+
648 *sEmeraldCmdLineAutocorrect+" list name|wrong word|right word.");
649 return false;
650 }
651
652
653 std::string listName = info.substr(0,bar);
654 info = info.substr(bar+1);
655
656 bar = info.find("|");
657 if (bar==std::string::npos)
658 {
659 cmdline_printchat("Wrong usage, correct usage is"+
660 *sEmeraldCmdLineAutocorrect+" list name|wrong word|right word.");
661 return false;
662 }
663
664 std::string wrong = info.substr(0,bar);
665 std::string right = info.substr(bar+1);
666 if(LGGAutoCorrect::getInstance()->addEntryToList(wrong,right,listName))
667 {
668 cmdline_printchat("Added "+wrong+"=>"+right+" to the "+listName+" list.");
669 LGGAutoCorrect::getInstance()->save();
670 return false;
671 }
672 else
673 cmdline_printchat("Invalid list specified, the default list is 'Custom'.");
674
675
676 }
677// else if (revised_text=="/reform")
678// {
679// cmdline_printchat("Reforming avatar.");
680//
681// gAgent.getAvatarObject()->initClass();
682// gAgent.getAvatarObject()->buildCharacter();
683// //gAgent.getAvatarObject()->loadAvatar();
684// return false;
685// }
686 else if(command == *sEmeraldCmdLineClearChat)
687 {
688 LLFloaterChat* chat = LLFloaterChat::getInstance(LLSD());
689 if(chat)
690 {
691 LLViewerTextEditor* history_editor = chat->getChild<LLViewerTextEditor>("Chat History Editor");
692 LLViewerTextEditor* history_editor_with_mute = chat->getChild<LLViewerTextEditor>("Chat History Editor with mute");
693 history_editor->clear();
694 history_editor_with_mute->clear();
695 return false;
696 }
697 }
698 else if(command == "zdrop")
699 {
700 cmdline_printchat("Zdrop running");
701 std::string lolfolder;
702 if(i >> lolfolder)
703 {
704 cmdline_printchat("Looking for folder");
705 std::stack<LLViewerInventoryItem*> lolstack;
706 LLDynamicArray<LLPointer<LLViewerInventoryItem> > lolinv = findInventoryInFolder(lolfolder);
707 for(LLDynamicArray<LLPointer<LLViewerInventoryItem> >::iterator it = lolinv.begin(); it != lolinv.end(); ++it)
708 {
709 LLViewerInventoryItem* item = *it;
710 lolstack.push(item);
711 }
712
713 if(lolstack.size())
714 {
715 std::string loldest;
716 if(i >> loldest)
717 {
718 cmdline_printchat("Found destination");
719 LLUUID sdest = LLUUID(loldest);
720 new JCZface(lolstack, sdest, 2.5f);
721 }
722 }
723 else
724 {
725 cmdline_printchat("Couldn't find folder.");
726 }
727 }
728 }
729 else if(command == "ztake")
730 {
731 std::string setting;
732 if(i >> setting)
733 {
734 if(setting == "on")
735 {
736 if(ztake != NULL)
737 {
738 cmdline_printchat("You're already doing that, I think.");
739 }
740 else
741 {
742 std::string folder_name;
743 if(i >> folder_name)
744 {
745 LLUUID folder = gInventory.findCategoryByName(folder_name);
746 if(folder.notNull())
747 {
748 ztake = new JCZtake(folder);
749 }
750 else
751 {
752 cmdline_printchat(llformat("You can't see any %s here!", folder_name.c_str()));
753 }
754 }
755 else
756 {
757 cmdline_printchat("What do you want to put the objects in?");
758 }
759 }
760 }
761 else if(setting == "off")
762 {
763 if(ztake == NULL)
764 {
765 cmdline_printchat("You weren't doing that anyway, were you?");
766 }
767 else
768 {
769 ztake->mRunning = TRUE;
770 delete ztake;
771 ztake = NULL;
772 }
773 }
774 else
775 {
776 cmdline_printchat(llformat("I don't know the word \"%s\".", setting.c_str()));
777 }
778 return false;
779 }
780 else
781 {
782 cmdline_printchat("I beg your pardon?");
783 }
784 return false;
785 }
786 else if(command == "invrepair")
787 {
788 invrepair();
789 }
790#ifdef JC_PROFILE_GSAVED
791 else if(command == "gsavedprofile")
792 {
793 int count = 0;
794 int top = 0;
795 if(i >> top)
796 {
797 cmdline_printchat("printing top " + llformat("%d", top) + " calls");
798 std::map<std::string, int> data = get_gsaved_calls();
799
800 std::multimap<int, std::string> flip;
801 for(std::map<std::string, int>::iterator iter = data.begin(); iter != data.end(); ++iter )
802 {
803 flip.insert(std::pair<int, std::string>(iter->second,iter->first));
804 }
805 for(std::multimap<int, std::string>::reverse_iterator iter = flip.rbegin(); iter != flip.rend() && count < top; ++iter)
806 {
807 cmdline_printchat(iter->second + " = " + llformat("%d", iter->first) + " calls");
808 count += 1;
809 }
810 }
811 }else if(command == "gsavedcalls")
812 {
813 std::string name;
814 if(i >> name)
815 {
816 std::map<std::string, int> data = get_gsaved_calls();
817 if(data.find(name) != data.end())
818 {
819 cmdline_printchat(llformat("%d", data[name])+" calls for "+name);
820 }else
821 {
822 cmdline_printchat("no entry for "+name);
823 }
824 }
825 }
826#endif
827 }
828 }
829 return true;
830}
831
832//case insensative search for avatar in draw distance
833//TODO: make this use the avatar list floaters list so we have EVERYONE
834// even if they are out of draw distance.
835LLUUID cmdline_partial_name2key(std::string partial_name)
836{
837 std::vector<LLUUID> avatars;
838 std::string av_name;
839 LLStringUtil::toLower(partial_name);
840 LLWorld::getInstance()->getAvatars(&avatars);
841 typedef std::vector<LLUUID>::const_iterator av_iter;
842// bool has_avatarlist = (LLFloaterAvatarList::getInstance() ? true : false);
843// if(has_avatarlist)
844// LLFloaterAvatarList::getInstance()->updateAvatarList();
845 for(av_iter i = avatars.begin(); i != avatars.end(); ++i)
846 {
847// if(has_avatarlist)
848// {
849// LLAvatarListEntry* entry = LLFloaterAvatarList::getInstance()->getAvatarEntry(*i);
850// if(entry)
851// {
852// av_name = entry->getName();
853// }
854// }
855 if (av_name.empty() && !gCacheName->getFullName(*i, av_name))
856 {
857 LLViewerObject *obj = gObjectList.findObject(*i);
858 if(obj)
859 {
860 LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(obj);
861 av_name = avatarp->getFullname();
862 }
863 }
864 LLStringUtil::toLower(av_name);
865 if(strstr(av_name.c_str(), partial_name.c_str()))
866 {
867 return *i;
868 }
869 }
870 return LLUUID::null;
871}
872
873
874
875void cmdline_tp2name(std::string target)
876{
877 LLUUID avkey = cmdline_partial_name2key(target);
878 if(avkey.isNull())
879 {
880 cmdline_printchat("Avatar not found.");
881 return;
882 }
883// LLFloaterAvatarList* avlist = LLFloaterAvatarList::getInstance();
884 LLViewerObject* obj = gObjectList.findObject(avkey);
885 if(obj)
886 {
887 LLVector3d pos = obj->getPositionGlobal();
888 pos.mdV[VZ] += 2.0;
889 gAgent.teleportViaLocation(pos);
890 }
891/* else if(avlist)
892 {
893 LLAvatarListEntry* entry = avlist->getAvatarEntry(avkey);
894 if(entry)
895 {
896 LLVector3d pos = entry->getPosition();
897 pos.mdV[VZ] += 2.0;
898 gAgent.teleportViaLocation(pos);
899 }
900 } */
901}
902
903void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat() will still work... just will use the saved value
904{
905 LLVector3 agentPos = gAgent.getPositionAgent()+(gAgent.getVelocity()*(F32)0.333);
906 LLMessageSystem* msg = gMessageSystem;
907 msg->newMessageFast(_PREHASH_ObjectAdd);
908 msg->nextBlockFast(_PREHASH_AgentData);
909 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
910 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
911 msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
912 msg->nextBlockFast(_PREHASH_ObjectData);
913 msg->addU8Fast(_PREHASH_PCode, LL_PCODE_VOLUME);
914 msg->addU8Fast(_PREHASH_Material, LL_MCODE_METAL);
915
916 if(agentPos.mV[2] > 4096.0)msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED);
917 else msg->addU32Fast(_PREHASH_AddFlags, 0);
918
919 LLVolumeParams volume_params;
920
921 volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_CIRCLE_33 );
922 volume_params.setRatio ( 2, 2 );
923 volume_params.setShear ( 0, 0 );
924 volume_params.setTaper(2.0f,2.0f);
925 volume_params.setTaperX(0.f);
926 volume_params.setTaperY(0.f);
927
928 LLVolumeMessage::packVolumeParams(&volume_params, msg);
929 LLVector3 rezpos = agentPos - LLVector3(0.0f,0.0f,2.5f);
930 LLQuaternion rotation;
931 rotation.setQuat(90.f * DEG_TO_RAD, LLVector3::y_axis);
932
933 static F32 *sEmeraldCmdLinePlatformSize = rebind_llcontrol<F32>("EmeraldCmdLinePlatformSize", &gSavedSettings, true);
934
935 if (use_saved_value) visual_radius = *sEmeraldCmdLinePlatformSize;
936 F32 realsize = visual_radius / 3.0f;
937 if (realsize < 0.01f) realsize = 0.01f;
938 else if (realsize > 10.0f) realsize = 10.0f;
939
940 msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.01f,realsize,realsize) );
941 msg->addQuatFast(_PREHASH_Rotation, rotation );
942 msg->addVector3Fast(_PREHASH_RayStart, rezpos );
943 msg->addVector3Fast(_PREHASH_RayEnd, rezpos );
944 msg->addU8Fast(_PREHASH_BypassRaycast, (U8)1 );
945 msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
946 msg->addU8Fast(_PREHASH_State, 0);
947 msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null );
948 msg->sendReliable(gAgent.getRegionHost());
949}
950
951void cmdline_printchat(std::string message)
952{
953 LLChat chat;
954 chat.mText = message;
955 chat.mSourceType = CHAT_SOURCE_SYSTEM;
956 LLFloaterChat::addChat(chat, FALSE, FALSE);
957}
958
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index 3c977dd..dc67448 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -69,6 +69,7 @@
69#include "llui.h" 69#include "llui.h"
70#include "lluictrlfactory.h" 70#include "lluictrlfactory.h"
71 71
72#include "chatbar_as_cmdline.h"
72 73
73// 74//
74// Globals 75// Globals
@@ -457,6 +458,8 @@ void LLChatBar::sendChat( EChatType type )
457 utf8_revised_text = utf8str_trim(utf8_revised_text); 458 utf8_revised_text = utf8str_trim(utf8_revised_text);
458 459
459 if (!utf8_revised_text.empty()) 460 if (!utf8_revised_text.empty())
461
462 if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type))
460 { 463 {
461 // Chat with animation 464 // Chat with animation
462 sendChatFromViewer(utf8_revised_text, type, TRUE); 465 sendChatFromViewer(utf8_revised_text, type, TRUE);
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp
index aaaa1dd..c066a04 100644
--- a/linden/indra/newview/llinventorymodel.cpp
+++ b/linden/indra/newview/llinventorymodel.cpp
@@ -361,6 +361,28 @@ LLUUID LLInventoryModel::findCatUUID(LLAssetType::EType preferred_type)
361 return LLUUID::null; 361 return LLUUID::null;
362} 362}
363 363
364LLUUID LLInventoryModel::findCategoryByName(std::string name)
365{
366 LLUUID root_id = gAgent.getInventoryRootID();
367 if(root_id.notNull())
368 {
369 cat_array_t* cats = NULL;
370 cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
371 if(cats)
372 {
373 S32 count = cats->count();
374 for(S32 i = 0; i < count; ++i)
375 {
376 if(cats->get(i)->getName() == name)
377 {
378 return cats->get(i)->getUUID();
379 }
380 }
381 }
382 }
383 return LLUUID::null;
384}
385
364// Convenience function to create a new category. You could call 386// Convenience function to create a new category. You could call
365// updateCategory() with a newly generated UUID category, but this 387// updateCategory() with a newly generated UUID category, but this
366// version will take care of details like what the name should be 388// version will take care of details like what the name should be
diff --git a/linden/indra/newview/llinventorymodel.h b/linden/indra/newview/llinventorymodel.h
index 74a2ec7..fee509b 100644
--- a/linden/indra/newview/llinventorymodel.h
+++ b/linden/indra/newview/llinventorymodel.h
@@ -312,6 +312,8 @@ public:
312 LLAssetType::EType preferred_type, 312 LLAssetType::EType preferred_type,
313 const std::string& name); 313 const std::string& name);
314 314
315 LLUUID findCategoryByName(std::string name);
316
315 // methods to load up inventory skeleton & meat. These are used 317 // methods to load up inventory skeleton & meat. These are used
316 // during authentication. return true if everything parsed. 318 // during authentication. return true if everything parsed.
317 typedef std::map<std::string, std::string> response_t; 319 typedef std::map<std::string, std::string> response_t;
diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp
index 4ae093e..3c4af02 100644
--- a/linden/indra/newview/llprefsadvanced.cpp
+++ b/linden/indra/newview/llprefsadvanced.cpp
@@ -96,6 +96,22 @@ BOOL LLPrefsAdvanced::postBuild()
96 LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox"); 96 LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox");
97 crash_behavior_combobox->setCurrentByIndex(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING)); 97 crash_behavior_combobox->setCurrentByIndex(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING));
98 98
99 childSetCommitCallback("EmeraldCmdLinePos", onCommitApplyControl);
100 childSetCommitCallback("EmeraldCmdLineGround", onCommitApplyControl);
101 childSetCommitCallback("EmeraldCmdLineHeight", onCommitApplyControl);
102 childSetCommitCallback("EmeraldCmdLineTeleportHome", onCommitApplyControl);
103 childSetCommitCallback("EmeraldCmdLineRezPlatform", onCommitApplyControl);
104 childSetCommitCallback("EmeraldCmdLineMapTo", onCommitApplyControl);
105 childSetCommitCallback("EmeraldCmdLineCalc", onCommitApplyControl);
106
107 childSetCommitCallback("EmeraldCmdLineDrawDistance", onCommitApplyControl);
108 childSetCommitCallback("EmeraldCmdTeleportToCam", onCommitApplyControl);
109 childSetCommitCallback("EmeraldCmdLineKeyToName", onCommitApplyControl);
110 childSetCommitCallback("EmeraldCmdLineOfferTp", onCommitApplyControl);
111 childSetCommitCallback("EmeraldCmdLineTP2", onCommitApplyControl);
112 childSetCommitCallback("EmeraldCmdLineAO", onCommitApplyControl);
113 childSetCommitCallback("EmeraldCmdLineClearChat", onCommitApplyControl);
114
99 getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit); 115 getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit);
100 getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this); 116 getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this);
101 getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this); 117 getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this);
@@ -273,6 +289,17 @@ bool LLPrefsAdvanced::callbackReset(const LLSD& notification, const LLSD& respon
273 return false; 289 return false;
274} 290}
275 291
292//workaround for lineeditor dumbness in regards to control_name
293void LLPrefsAdvanced::onCommitApplyControl(LLUICtrl* caller, void* user_data)
294{
295 LLLineEditor* line = (LLLineEditor*)caller;
296 if(line)
297 {
298 LLControlVariable *var = line->findControl(line->getControlName());
299 if(var)var->setValue(line->getValue());
300 }
301}
302
276void LLPrefsAdvanced::onSpellAdd(void* data) 303void LLPrefsAdvanced::onSpellAdd(void* data)
277{ 304{
278 LLPrefsAdvanced* panel = (LLPrefsAdvanced*)data; 305 LLPrefsAdvanced* panel = (LLPrefsAdvanced*)data;
diff --git a/linden/indra/newview/llprefsadvanced.h b/linden/indra/newview/llprefsadvanced.h
index 4bf2ff1..f5fba10 100644
--- a/linden/indra/newview/llprefsadvanced.h
+++ b/linden/indra/newview/llprefsadvanced.h
@@ -53,6 +53,8 @@ private:
53 53
54 static bool callbackReset(const LLSD& notification, const LLSD& response, LLPrefsAdvanced *self); 54 static bool callbackReset(const LLSD& notification, const LLSD& response, LLPrefsAdvanced *self);
55 55
56 static void onCommitApplyControl(LLUICtrl* caller, void* user_data);
57
56 static void onSpellAdd(void* data); 58 static void onSpellAdd(void* data);
57 static void onSpellRemove(void* data); 59 static void onSpellRemove(void* data);
58 static void onSpellGetMore(void* data); 60 static void onSpellGetMore(void* data);
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
index 669f0e2..d0a0c21 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
@@ -125,6 +125,115 @@
125 tool_tip="Reset all preferences to their default values (requires a restart)" /> 125 tool_tip="Reset all preferences to their default values (requires a restart)" />
126 </panel> 126 </panel>
127 127
128 <panel border="true" bottom="-580" follows="left|top|right|bottom" height="525" label="CmdLine"
129 left="1" mouse_opaque="true" name="CmdLine" width="418">
130 <button bottom="-25" follows="left|top" font="SansSerifSmall" height="18" label="?"
131 name="EmeraldHelp_CmdLine" tool_tip="Click here for help regarding the settings in this page."
132 right="490" width="18"/>
133 <check_box bottom="-25" enabled="true" follows="left|top" font="SansSerifSmall" height="16"
134 initial_value="false" label="Enable usage of chat bar as a command line" left="5"
135 mouse_opaque="true" name="chat_cmd_toggle" radio_style="false" width="270" control_name="EmeraldCmdLine"/>
136 <text bottom_delta="-25" follows="left|top" font="SansSerifSmall" height="16" left_delta="10"
137 name="loltxt2" width="512"> Teleport within sim (usage: cmd x y z)</text>
138 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
139 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
140 tool_tip="" name="EmeraldCmdLinePos" control_name="EmeraldCmdLinePos" width="200"/>
141 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
142 name="loltxt3" width="512"> Teleport to ground (usage: cmd)</text>
143 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
144 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
145 tool_tip="" name="EmeraldCmdLineGround" control_name="EmeraldCmdLineGround" width="200"/>
146 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
147 name="loltxt4" width="512"> Teleport to altitude (usage: cmd z)</text>
148 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
149 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
150 tool_tip="" name="EmeraldCmdLineHeight" control_name="EmeraldCmdLineHeight" width="200"/>
151 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
152 name="loltxt5" width="512"> Teleport home (usage: cmd)</text>
153 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
154 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
155 tool_tip="" name="EmeraldCmdLineTeleportHome" control_name="EmeraldCmdLineTeleportHome"
156 width="200"/>
157 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
158 name="loltxt6" width="512"> Rez a platform (usage: cmd 0 - 30)</text>
159 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
160 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
161 tool_tip="" name="EmeraldCmdLineRezPlatform" control_name="EmeraldCmdLineRezPlatform"
162 width="200"/>
163 <slider bottom_delta="-20" left="15" name="EmeraldCmdLinePlatformSize" control_name="EmeraldCmdLinePlatformSize"
164 decimal_digits="1" enabled="true" follows="left|top" height="18" increment="0.5"
165 initial_val="5" label="Width" label_width="30" max_val="30" min_val="5"
166 mouse_opaque="true" show_text="true" width="200" auto_resize="false" tool_tip="How big do you want the platform to appear to be?"/>
167 <text bottom_delta="-15" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
168 name="loltxt7" width="512"> Teleport to sim x (usage: cmd simname)</text>
169 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
170 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
171 tool_tip="" name="EmeraldCmdLineMapTo" control_name="EmeraldCmdLineMapTo" width="200"/>
172 <check_box bottom_delta="-20" enabled="true" follows="left|top" font="SansSerifSmall" height="16"
173 initial_value="false" label="Use same position between sims" left_delta="0" mouse_opaque="true"
174 name="toggle" radio_style="false" width="270" control_name="EmeraldCmdLineMapToKeepPos"/>
175 <text bottom_delta="-20" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
176 name="loltxt8" width="512"> Calc. expressions (usage: cmd SIN(2+2))</text>
177 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
178 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
179 tool_tip="" name="EmeraldCmdLineCalc" control_name="EmeraldCmdLineCalc" width="200"/>
180 <text bottom_delta="-20" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
181 width="512">Add autocorrect word(cmd list|bad|good)</text>
182 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
183 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
184 tool_tip="" name="EmeraldCmdLineAutocorrect" control_name="EmeraldCmdLineAutocorrect" width="200"/>
185
186 <text bottom_delta="326" follows="left|top" font="SansSerifSmall" height="16" left_delta="230"
187 name="loltxt9" width="512"> Change Draw Distance (usage: cmd meters)</text>
188 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
189 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
190 tool_tip="" name="EmeraldCmdLineDrawDistance" control_name="EmeraldCmdLineDrawDistance"
191 width="200"/>
192 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
193 name="loltxt10" width="512"> Teleport to cam position (usage: cmd)</text>
194 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
195 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
196 tool_tip="" name="EmeraldCmdTeleportToCam" control_name="EmeraldCmdTeleportToCam"
197 width="200"/>
198 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
199 name="loltxt11" width="512"> Get avatar name from key (usage: cmd key)</text>
200 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
201 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
202 tool_tip="" name="EmeraldCmdLineKeyToName" control_name="EmeraldCmdLineKeyToName"
203 width="200"/>
204 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
205 name="loltxt12" width="512"> Offer teleport to avatar (usage: cmd key)</text>
206 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
207 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
208 tool_tip="" name="EmeraldCmdLineOfferTp" control_name="EmeraldCmdLineOfferTp" width="200"/>
209 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
210 name="loltxt13" width="512"> Teleport to avatar (usage: cmd name)</text>
211 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
212 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
213 tool_tip="The syntax of this command allows partial names and is not case sensitive. Better results if used while the Radar is open."
214 name="EmeraldCmdLineTP2" control_name="EmeraldCmdLineTP2" width="200"/>
215 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
216 name="loltxt14" width="512"> Turn AO on/off (usage: cmd on/off)</text>
217 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
218 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
219 tool_tip="" name="EmeraldCmdLineAO" control_name="EmeraldCmdLineAO" width="200"/>
220 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
221 name="loltxt15" width="512"> Clear the chat history (usage: cmd)</text>
222 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
223 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
224 tool_tip="Clears the Chat History to prevent lag effects from chat spammers." name="EmeraldCmdLineClearChat" control_name="EmeraldCmdLineClearChat" width="200"/>
225 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
226 name="loltxt15" width="512"> Set the media url (usage: cmd url type)</text>
227 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
228 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
229 tool_tip="Sets and plays your media stream to the entered url" name="EmeraldCmdLineMedia" control_name="EmeraldCmdLineMedia" width="200"/>
230 <text bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" left_delta="0"
231 name="loltxt15" width="512"> Set the music stream url (usage: cmd url)</text>
232 <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-20" follows="left|top"
233 font="SansSerifSmall" height="20" left_delta="0" max_length="256" mouse_opaque="true"
234 tool_tip="sets and plays your music stream to the entered url" name="EmeraldCmdLineMusic" control_name="EmeraldCmdLineMusic" width="200"/>
235 </panel>
236
128 <panel border="true" bottom="-580" follows="left|top|right|bottom" height="525" label="SpellCheck" 237 <panel border="true" bottom="-580" follows="left|top|right|bottom" height="525" label="SpellCheck"
129 left="1" mouse_opaque="true" name="SpellCheck" width="418"> 238 left="1" mouse_opaque="true" name="SpellCheck" width="418">
130 <button bottom="-25" follows="left|top" font="SansSerifSmall" height="18" label="?" 239 <button bottom="-25" follows="left|top" font="SansSerifSmall" height="18" label="?"