EstateSettings.cs 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  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. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.IO;
  29. using System.Reflection;
  30. using libsecondlife;
  31. using log4net;
  32. namespace OpenSim.Framework
  33. {
  34. public class EstateSettings
  35. {
  36. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  37. private ConfigurationMember configMember;
  38. //Settings to this island
  39. private float m_billableFactor;
  40. private uint m_estateID;
  41. private LLUUID m_estateManager0;
  42. private LLUUID m_estateManager1;
  43. private LLUUID m_estateManager2;
  44. private LLUUID m_estateManager3;
  45. private LLUUID m_estateManager4;
  46. private LLUUID m_estateManager5;
  47. private LLUUID m_estateManager6;
  48. private LLUUID m_estateManager7;
  49. private LLUUID m_estateManager8;
  50. private LLUUID m_estateManager9;
  51. private string m_estateName;
  52. private byte m_maxAgents;
  53. private float m_objectBonusFactor;
  54. private uint m_parentEstateID;
  55. private int m_pricePerMeter;
  56. private int m_redirectGridX;
  57. private int m_redirectGridY;
  58. private bool m_regionAllowTerraform;
  59. private Simulator.RegionFlags m_regionFlags;
  60. private ushort m_regionWaterHeight;
  61. private Simulator.SimAccess m_simAccess;
  62. private float m_sunHour;
  63. private LLVector3 m_sunPosition;
  64. private LLUUID m_terrainBase0;
  65. private LLUUID m_terrainBase1;
  66. private LLUUID m_terrainBase2;
  67. private LLUUID m_terrainBase3;
  68. private LLUUID m_terrainDetail0;
  69. private LLUUID m_terrainDetail1;
  70. private LLUUID m_terrainDetail2;
  71. private LLUUID m_terrainDetail3;
  72. private string m_terrainFile;
  73. private float m_terrainHeightRange0;
  74. private float m_terrainHeightRange1;
  75. private float m_terrainHeightRange2;
  76. private float m_terrainHeightRange3;
  77. private LLUUID m_terrainImageID;
  78. private float m_terrainLowerLimit;
  79. private double m_terrainMultiplier;
  80. private float m_terrainRaiseLimit;
  81. private float m_terrainStartHeight0;
  82. private float m_terrainStartHeight1;
  83. private float m_terrainStartHeight2;
  84. private float m_terrainStartHeight3;
  85. private bool m_useFixedSun;
  86. private float m_waterHeight;
  87. public EstateSettings()
  88. {
  89. // Temporary hack to prevent multiple loadings.
  90. if (configMember == null)
  91. {
  92. configMember =
  93. new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS",
  94. loadConfigurationOptions, handleIncomingConfiguration, true);
  95. configMember.performConfigurationRetrieve();
  96. }
  97. }
  98. public float billableFactor
  99. {
  100. get { return m_billableFactor; }
  101. set
  102. {
  103. m_billableFactor = value;
  104. configMember.forceSetConfigurationOption("billable_factor", m_billableFactor.ToString());
  105. }
  106. }
  107. public uint estateID
  108. {
  109. get { return m_estateID; }
  110. set
  111. {
  112. m_estateID = value;
  113. configMember.forceSetConfigurationOption("estate_id", m_estateID.ToString());
  114. }
  115. }
  116. public uint parentEstateID
  117. {
  118. get { return m_parentEstateID; }
  119. set
  120. {
  121. m_parentEstateID = value;
  122. configMember.forceSetConfigurationOption("parent_estate_id", m_parentEstateID.ToString());
  123. }
  124. }
  125. public byte maxAgents
  126. {
  127. get { return m_maxAgents; }
  128. set
  129. {
  130. m_maxAgents = value;
  131. configMember.forceSetConfigurationOption("max_agents", m_maxAgents.ToString());
  132. }
  133. }
  134. public float objectBonusFactor
  135. {
  136. get { return m_objectBonusFactor; }
  137. set
  138. {
  139. m_objectBonusFactor = value;
  140. configMember.forceSetConfigurationOption("object_bonus_factor", m_objectBonusFactor.ToString());
  141. }
  142. }
  143. public int redirectGridX
  144. {
  145. get { return m_redirectGridX; }
  146. set
  147. {
  148. m_redirectGridX = value;
  149. configMember.forceSetConfigurationOption("redirect_grid_x", m_redirectGridX.ToString());
  150. }
  151. }
  152. public int redirectGridY
  153. {
  154. get { return m_redirectGridY; }
  155. set
  156. {
  157. m_redirectGridY = value;
  158. configMember.forceSetConfigurationOption("redirect_grid_y", m_redirectGridY.ToString());
  159. }
  160. }
  161. public Simulator.RegionFlags regionFlags
  162. {
  163. get { return m_regionFlags; }
  164. set
  165. {
  166. //m_regionFlags = (Simulator.RegionFlags)0x400000;
  167. m_regionFlags = value;
  168. configMember.forceSetConfigurationOption("region_flags", ((uint) m_regionFlags).ToString());
  169. }
  170. }
  171. public Simulator.SimAccess simAccess
  172. {
  173. get { return m_simAccess; }
  174. set
  175. {
  176. m_simAccess = value;
  177. configMember.forceSetConfigurationOption("sim_access", ((byte) m_simAccess).ToString());
  178. }
  179. }
  180. public float sunHour
  181. {
  182. get { return m_sunHour; }
  183. set
  184. {
  185. m_sunHour = value;
  186. if (useFixedSun)
  187. configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString());
  188. }
  189. }
  190. public LLVector3 sunPosition
  191. {
  192. get { return m_sunPosition; }
  193. set
  194. {
  195. //Just set - does not need to be written to settings file
  196. m_sunPosition = value;
  197. }
  198. }
  199. public float terrainRaiseLimit
  200. {
  201. get { return m_terrainRaiseLimit; }
  202. set
  203. {
  204. m_terrainRaiseLimit = value;
  205. configMember.forceSetConfigurationOption("terrain_raise_limit", m_terrainRaiseLimit.ToString());
  206. }
  207. }
  208. public float terrainLowerLimit
  209. {
  210. get { return m_terrainLowerLimit; }
  211. set
  212. {
  213. m_terrainLowerLimit = value;
  214. configMember.forceSetConfigurationOption("terrain_lower_limit", m_terrainLowerLimit.ToString());
  215. }
  216. }
  217. public bool useFixedSun
  218. {
  219. get { return m_useFixedSun; }
  220. set
  221. {
  222. m_useFixedSun = value;
  223. configMember.forceSetConfigurationOption("use_fixed_sun", m_useFixedSun.ToString());
  224. }
  225. }
  226. public int pricePerMeter
  227. {
  228. get { return m_pricePerMeter; }
  229. set
  230. {
  231. m_pricePerMeter = value;
  232. configMember.forceSetConfigurationOption("price_per_meter", m_pricePerMeter.ToString());
  233. }
  234. }
  235. public ushort regionWaterHeight
  236. {
  237. get { return m_regionWaterHeight; }
  238. set
  239. {
  240. m_regionWaterHeight = value;
  241. configMember.forceSetConfigurationOption("region_water_height", m_regionWaterHeight.ToString());
  242. }
  243. }
  244. public bool regionAllowTerraform
  245. {
  246. get { return m_regionAllowTerraform; }
  247. set
  248. {
  249. m_regionAllowTerraform = value;
  250. configMember.forceSetConfigurationOption("region_allow_terraform", m_regionAllowTerraform.ToString());
  251. }
  252. }
  253. // Region Information
  254. // Low resolution 'base' textures. No longer used.
  255. public LLUUID terrainBase0
  256. {
  257. get { return m_terrainBase0; }
  258. set
  259. {
  260. m_terrainBase0 = value;
  261. configMember.forceSetConfigurationOption("terrain_base_0", m_terrainBase0.ToString());
  262. }
  263. }
  264. public LLUUID terrainBase1
  265. {
  266. get { return m_terrainBase1; }
  267. set
  268. {
  269. m_terrainBase1 = value;
  270. configMember.forceSetConfigurationOption("terrain_base_1", m_terrainBase1.ToString());
  271. }
  272. }
  273. public LLUUID terrainBase2
  274. {
  275. get { return m_terrainBase2; }
  276. set
  277. {
  278. m_terrainBase2 = value;
  279. configMember.forceSetConfigurationOption("terrain_base_2", m_terrainBase2.ToString());
  280. }
  281. }
  282. public LLUUID terrainBase3
  283. {
  284. get { return m_terrainBase3; }
  285. set
  286. {
  287. m_terrainBase3 = value;
  288. configMember.forceSetConfigurationOption("terrain_base_3", m_terrainBase3.ToString());
  289. }
  290. }
  291. // Higher resolution terrain textures
  292. public LLUUID terrainDetail0
  293. {
  294. get { return m_terrainDetail0; }
  295. set
  296. {
  297. m_terrainDetail0 = value;
  298. configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString());
  299. }
  300. }
  301. public LLUUID terrainDetail1
  302. {
  303. get { return m_terrainDetail1; }
  304. set
  305. {
  306. m_terrainDetail1 = value;
  307. configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString());
  308. }
  309. }
  310. public LLUUID terrainDetail2
  311. {
  312. get { return m_terrainDetail2; }
  313. set
  314. {
  315. m_terrainDetail2 = value;
  316. configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString());
  317. }
  318. }
  319. public LLUUID terrainDetail3
  320. {
  321. get { return m_terrainDetail3; }
  322. set
  323. {
  324. m_terrainDetail3 = value;
  325. configMember.forceSetConfigurationOption("terrain_detail_3", m_terrainDetail3.ToString());
  326. }
  327. }
  328. // First quad - each point is bilinearly interpolated at each meter of terrain
  329. public float terrainStartHeight0
  330. {
  331. get { return m_terrainStartHeight0; }
  332. set
  333. {
  334. m_terrainStartHeight0 = value;
  335. configMember.forceSetConfigurationOption("terrain_start_height_0", m_terrainStartHeight0.ToString());
  336. }
  337. }
  338. public float terrainStartHeight1
  339. {
  340. get { return m_terrainStartHeight1; }
  341. set
  342. {
  343. m_terrainStartHeight1 = value;
  344. configMember.forceSetConfigurationOption("terrain_start_height_1", m_terrainStartHeight1.ToString());
  345. }
  346. }
  347. public float terrainStartHeight2
  348. {
  349. get { return m_terrainStartHeight2; }
  350. set
  351. {
  352. m_terrainStartHeight2 = value;
  353. configMember.forceSetConfigurationOption("terrain_start_height_2", m_terrainStartHeight2.ToString());
  354. }
  355. }
  356. public float terrainStartHeight3
  357. {
  358. get { return m_terrainStartHeight3; }
  359. set
  360. {
  361. m_terrainStartHeight3 = value;
  362. configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString());
  363. }
  364. }
  365. // Second quad - also bilinearly interpolated.
  366. // Terrain texturing is done that:
  367. // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
  368. public float terrainHeightRange0
  369. {
  370. get { return m_terrainHeightRange0; }
  371. set
  372. {
  373. m_terrainHeightRange0 = value;
  374. configMember.forceSetConfigurationOption("terrain_height_range_0", m_terrainHeightRange0.ToString());
  375. }
  376. }
  377. public float terrainHeightRange1
  378. {
  379. get { return m_terrainHeightRange1; }
  380. set
  381. {
  382. m_terrainHeightRange1 = value;
  383. configMember.forceSetConfigurationOption("terrain_height_range_1", m_terrainHeightRange1.ToString());
  384. }
  385. }
  386. public float terrainHeightRange2
  387. {
  388. get { return m_terrainHeightRange2; }
  389. set
  390. {
  391. m_terrainHeightRange2 = value;
  392. configMember.forceSetConfigurationOption("terrain_height_range_2", m_terrainHeightRange2.ToString());
  393. }
  394. }
  395. public float terrainHeightRange3
  396. {
  397. get { return m_terrainHeightRange3; }
  398. set
  399. {
  400. m_terrainHeightRange3 = value;
  401. configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString());
  402. }
  403. }
  404. // Terrain Default (Must be in F32 Format!)
  405. public string terrainFile
  406. {
  407. get { return m_terrainFile; }
  408. set
  409. {
  410. m_terrainFile = value;
  411. configMember.forceSetConfigurationOption("terrain_file", m_terrainFile.ToString());
  412. }
  413. }
  414. public double terrainMultiplier
  415. {
  416. get { return m_terrainMultiplier; }
  417. set
  418. {
  419. m_terrainMultiplier = value;
  420. configMember.forceSetConfigurationOption("terrain_multiplier", m_terrainMultiplier.ToString());
  421. }
  422. }
  423. public float waterHeight
  424. {
  425. get { return m_waterHeight; }
  426. set
  427. {
  428. m_waterHeight = value;
  429. configMember.forceSetConfigurationOption("water_height", m_waterHeight.ToString());
  430. }
  431. }
  432. public LLUUID terrainImageID
  433. {
  434. get { return m_terrainImageID; }
  435. set
  436. {
  437. m_terrainImageID = value;
  438. // I don't think there is a reason that this actually
  439. // needs to be written back to the estate settings
  440. // file.
  441. // configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString());
  442. }
  443. }
  444. // Estate name
  445. public string estateName
  446. {
  447. get { return m_estateName; }
  448. set
  449. {
  450. m_estateName = value;
  451. configMember.forceSetConfigurationOption("estate_name", m_estateName.ToString());
  452. }
  453. }
  454. public LLUUID[] estateManagers
  455. {
  456. get
  457. {
  458. // returns a condensed array of LLUUIDs
  459. return GetEstateManagers();
  460. }
  461. set
  462. {
  463. // Sets a Condensed array of LLUUIDS
  464. int i = 0;
  465. for (i = 0; i < value.Length; i++)
  466. {
  467. switch (i)
  468. {
  469. case 0:
  470. m_estateManager0 = value[i];
  471. break;
  472. case 1:
  473. m_estateManager1 = value[i];
  474. break;
  475. case 2:
  476. m_estateManager2 = value[i];
  477. break;
  478. case 3:
  479. m_estateManager3 = value[i];
  480. break;
  481. case 4:
  482. m_estateManager4 = value[i];
  483. break;
  484. case 5:
  485. m_estateManager5 = value[i];
  486. break;
  487. case 6:
  488. m_estateManager6 = value[i];
  489. break;
  490. case 7:
  491. m_estateManager7 = value[i];
  492. break;
  493. case 8:
  494. m_estateManager8 = value[i];
  495. break;
  496. case 9:
  497. m_estateManager9 = value[i];
  498. break;
  499. }
  500. }
  501. // Clear the rest of them.. as they're no longer valid
  502. for (int j = i; j < 10; j++)
  503. {
  504. switch (j)
  505. {
  506. case 0:
  507. m_estateManager0 = LLUUID.Zero;
  508. break;
  509. case 1:
  510. m_estateManager1 = LLUUID.Zero;
  511. break;
  512. case 2:
  513. m_estateManager2 = LLUUID.Zero;
  514. break;
  515. case 3:
  516. m_estateManager3 = LLUUID.Zero;
  517. break;
  518. case 4:
  519. m_estateManager4 = LLUUID.Zero;
  520. break;
  521. case 5:
  522. m_estateManager5 = LLUUID.Zero;
  523. break;
  524. case 6:
  525. m_estateManager6 = LLUUID.Zero;
  526. break;
  527. case 7:
  528. m_estateManager7 = LLUUID.Zero;
  529. break;
  530. case 8:
  531. m_estateManager8 = LLUUID.Zero;
  532. break;
  533. case 9:
  534. m_estateManager9 = LLUUID.Zero;
  535. break;
  536. }
  537. }
  538. for (i = 0; i < 10; i++)
  539. {
  540. // Writes out the Estate managers to the XML file.
  541. configMember.forceSetConfigurationOption("estate_manager_" + i, (GetEstateManagerAtPos(i)).ToString());
  542. }
  543. }
  544. }
  545. #region EstateManager Get Methods to sort out skipped spots in the XML (suser error)
  546. private LLUUID GetEstateManagerAtPos(int pos)
  547. {
  548. // This is a helper for writing them out to the xml file
  549. switch (pos)
  550. {
  551. case 0:
  552. return m_estateManager0;
  553. case 1:
  554. return m_estateManager1;
  555. case 2:
  556. return m_estateManager2;
  557. case 3:
  558. return m_estateManager3;
  559. case 4:
  560. return m_estateManager4;
  561. case 5:
  562. return m_estateManager5;
  563. case 6:
  564. return m_estateManager6;
  565. case 7:
  566. return m_estateManager7;
  567. case 8:
  568. return m_estateManager8;
  569. case 9:
  570. return m_estateManager9;
  571. default:
  572. return LLUUID.Zero;
  573. }
  574. }
  575. private LLUUID[] GetEstateManagers()
  576. {
  577. int numEstateManagers = GetNumberOfEstateManagers();
  578. LLUUID[] rEstateManagers = new LLUUID[numEstateManagers];
  579. int pos = 0;
  580. for (int i = 0; i < numEstateManagers; i++)
  581. {
  582. pos = GetNextEstateManager(pos);
  583. rEstateManagers[i] = GetEstateManagerAtPos(pos);
  584. pos++;
  585. }
  586. return rEstateManagers;
  587. }
  588. private int GetNextEstateManager(int startpos)
  589. {
  590. // This is a utility function that skips over estate managers set to LLUUID.Zero
  591. int i = startpos;
  592. for (i = startpos; i < 10; i++)
  593. {
  594. if (GetEstateManagerAtPos(i) != LLUUID.Zero) return i;
  595. }
  596. return i;
  597. }
  598. private int GetNumberOfEstateManagers()
  599. {
  600. // This function returns the number of estate managers set
  601. // Regardless of whether there is a skipped spot
  602. int numEstateManagers = 0;
  603. if (m_estateManager0 != LLUUID.Zero) numEstateManagers++;
  604. if (m_estateManager1 != LLUUID.Zero) numEstateManagers++;
  605. if (m_estateManager2 != LLUUID.Zero) numEstateManagers++;
  606. if (m_estateManager3 != LLUUID.Zero) numEstateManagers++;
  607. if (m_estateManager4 != LLUUID.Zero) numEstateManagers++;
  608. if (m_estateManager5 != LLUUID.Zero) numEstateManagers++;
  609. if (m_estateManager6 != LLUUID.Zero) numEstateManagers++;
  610. if (m_estateManager7 != LLUUID.Zero) numEstateManagers++;
  611. if (m_estateManager8 != LLUUID.Zero) numEstateManagers++;
  612. if (m_estateManager9 != LLUUID.Zero) numEstateManagers++;
  613. return numEstateManagers;
  614. }
  615. public void AddEstateManager(LLUUID avatarID)
  616. {
  617. LLUUID[] testateManagers = GetEstateManagers();
  618. LLUUID[] nestateManagers = new LLUUID[testateManagers.Length + 1];
  619. int i = 0;
  620. for (i = 0; i < testateManagers.Length; i++)
  621. {
  622. nestateManagers[i] = testateManagers[i];
  623. }
  624. nestateManagers[i] = avatarID;
  625. //Saves it to the estate settings file
  626. estateManagers = nestateManagers;
  627. }
  628. public void RemoveEstateManager(LLUUID avatarID)
  629. {
  630. int notfoundparam = 11; // starting high so the condense routine (max ten) doesn't run if we don't find it.
  631. LLUUID[] testateManagers = GetEstateManagers(); // temporary estate managers list
  632. int i = 0;
  633. int foundpos = notfoundparam;
  634. // search for estate manager.
  635. for (i = 0; i < testateManagers.Length; i++)
  636. {
  637. if (testateManagers[i] == avatarID)
  638. {
  639. foundpos = i;
  640. break;
  641. }
  642. }
  643. if (foundpos < notfoundparam)
  644. {
  645. LLUUID[] restateManagers = new LLUUID[testateManagers.Length - 1];
  646. // fill new estate managers array up to the found spot
  647. for (int j = 0; j < foundpos; j++)
  648. restateManagers[j] = testateManagers[j];
  649. // skip over the estate manager we're removing and compress
  650. for (int j = foundpos + 1; j < testateManagers.Length; j++)
  651. restateManagers[j - 1] = testateManagers[j];
  652. estateManagers = restateManagers;
  653. }
  654. else
  655. {
  656. m_log.Error("[ESTATESETTINGS]: Unable to locate estate manager : " + avatarID.ToString() + " for removal");
  657. }
  658. }
  659. #endregion
  660. public void loadConfigurationOptions()
  661. {
  662. configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty,
  663. "0.0", true);
  664. configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty, "100",
  665. true);
  666. configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
  667. String.Empty, "1", true);
  668. configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "40",
  669. true);
  670. configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
  671. String.Empty, "1.0", true);
  672. configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty,
  673. "0", true);
  674. configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty,
  675. "0", true);
  676. configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty,
  677. "336723974", true); //Taken from a Linden sim for the moment.
  678. configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "21",
  679. true);
  680. configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0",
  681. true);
  682. configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
  683. String.Empty, "4.0", true); //4 is the LL default
  684. configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
  685. String.Empty, "-4.0", true); //-4.0 is the LL default
  686. configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty,
  687. "false", true);
  688. configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
  689. String.Empty, "1", true);
  690. configMember.addConfigurationOption("region_water_height",
  691. ConfigurationOption.ConfigurationTypes.TYPE_UINT16, String.Empty, "20", true);
  692. configMember.addConfigurationOption("region_allow_terraform",
  693. ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty, "true", true);
  694. configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty,
  695. "b8d3965a-ad78-bf43-699b-bff8eca6c975", true);
  696. configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty,
  697. "abb783e6-3e93-26c0-248a-247666855da3", true);
  698. configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty,
  699. "179cdabd-398a-9b6b-1391-4dc333ba321f", true);
  700. configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty,
  701. "beb169c7-11ea-fff2-efe5-0f24dc881df2", true);
  702. configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  703. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  704. configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  705. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  706. configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  707. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  708. configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  709. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  710. configMember.addConfigurationOption("terrain_start_height_0",
  711. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "10.0", true);
  712. configMember.addConfigurationOption("terrain_start_height_1",
  713. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "10.0", true);
  714. configMember.addConfigurationOption("terrain_start_height_2",
  715. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "10.0", true);
  716. configMember.addConfigurationOption("terrain_start_height_3",
  717. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "10.0", true);
  718. configMember.addConfigurationOption("terrain_height_range_0",
  719. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "60.0", true);
  720. configMember.addConfigurationOption("terrain_height_range_1",
  721. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "60.0", true);
  722. configMember.addConfigurationOption("terrain_height_range_2",
  723. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "60.0", true);
  724. configMember.addConfigurationOption("terrain_height_range_3",
  725. ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "60.0", true);
  726. configMember.addConfigurationOption("terrain_file",
  727. ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, String.Empty,
  728. "default.r32", true);
  729. configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
  730. String.Empty, "60.0", true);
  731. configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, String.Empty,
  732. "20.0", true);
  733. configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  734. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  735. configMember.addConfigurationOption("estate_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
  736. String.Empty, "TestEstate", true);
  737. configMember.addConfigurationOption("estate_manager_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  738. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  739. configMember.addConfigurationOption("estate_manager_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  740. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  741. configMember.addConfigurationOption("estate_manager_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  742. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  743. configMember.addConfigurationOption("estate_manager_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  744. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  745. configMember.addConfigurationOption("estate_manager_4", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  746. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  747. configMember.addConfigurationOption("estate_manager_5", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  748. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  749. configMember.addConfigurationOption("estate_manager_6", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  750. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  751. configMember.addConfigurationOption("estate_manager_7", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  752. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  753. configMember.addConfigurationOption("estate_manager_8", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  754. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  755. configMember.addConfigurationOption("estate_manager_9", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
  756. String.Empty, "00000000-0000-0000-0000-000000000000", true);
  757. }
  758. public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
  759. {
  760. switch (configuration_key)
  761. {
  762. case "billable_factor":
  763. m_billableFactor = (float) configuration_result;
  764. break;
  765. case "estate_id":
  766. m_estateID = (uint) configuration_result;
  767. break;
  768. case "parent_estate_id":
  769. m_parentEstateID = (uint) configuration_result;
  770. break;
  771. case "max_agents":
  772. m_maxAgents = (byte) configuration_result;
  773. break;
  774. case "object_bonus_factor":
  775. m_objectBonusFactor = (float) configuration_result;
  776. break;
  777. case "redirect_grid_x":
  778. m_redirectGridX = (int) configuration_result;
  779. break;
  780. case "redirect_grid_y":
  781. m_redirectGridY = (int) configuration_result;
  782. break;
  783. case "region_flags":
  784. m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result);
  785. break;
  786. case "sim_access":
  787. m_simAccess = (Simulator.SimAccess) ((byte) configuration_result);
  788. break;
  789. case "sun_hour":
  790. m_sunHour = (float) configuration_result;
  791. break;
  792. case "terrain_raise_limit":
  793. m_terrainRaiseLimit = (float) configuration_result;
  794. break;
  795. case "terrain_lower_limit":
  796. m_terrainLowerLimit = (float) configuration_result;
  797. break;
  798. case "use_fixed_sun":
  799. m_useFixedSun = (bool) configuration_result;
  800. break;
  801. case "price_per_meter":
  802. m_pricePerMeter = Convert.ToInt32(configuration_result);
  803. break;
  804. case "region_water_height":
  805. m_regionWaterHeight = (ushort) configuration_result;
  806. break;
  807. case "region_allow_terraform":
  808. m_regionAllowTerraform = (bool) configuration_result;
  809. break;
  810. case "terrain_base_0":
  811. m_terrainBase0 = (LLUUID) configuration_result;
  812. break;
  813. case "terrain_base_1":
  814. m_terrainBase1 = (LLUUID) configuration_result;
  815. break;
  816. case "terrain_base_2":
  817. m_terrainBase2 = (LLUUID) configuration_result;
  818. break;
  819. case "terrain_base_3":
  820. m_terrainBase3 = (LLUUID) configuration_result;
  821. break;
  822. case "terrain_detail_0":
  823. m_terrainDetail0 = (LLUUID) configuration_result;
  824. break;
  825. case "terrain_detail_1":
  826. m_terrainDetail1 = (LLUUID) configuration_result;
  827. break;
  828. case "terrain_detail_2":
  829. m_terrainDetail2 = (LLUUID) configuration_result;
  830. break;
  831. case "terrain_detail_3":
  832. m_terrainDetail3 = (LLUUID) configuration_result;
  833. break;
  834. case "terrain_start_height_0":
  835. m_terrainStartHeight0 = (float) configuration_result;
  836. break;
  837. case "terrain_start_height_1":
  838. m_terrainStartHeight1 = (float) configuration_result;
  839. break;
  840. case "terrain_start_height_2":
  841. m_terrainStartHeight2 = (float) configuration_result;
  842. break;
  843. case "terrain_start_height_3":
  844. m_terrainStartHeight3 = (float) configuration_result;
  845. break;
  846. case "terrain_height_range_0":
  847. m_terrainHeightRange0 = (float) configuration_result;
  848. break;
  849. case "terrain_height_range_1":
  850. m_terrainHeightRange1 = (float) configuration_result;
  851. break;
  852. case "terrain_height_range_2":
  853. m_terrainHeightRange2 = (float) configuration_result;
  854. break;
  855. case "terrain_height_range_3":
  856. m_terrainHeightRange3 = (float) configuration_result;
  857. break;
  858. case "terrain_file":
  859. m_terrainFile = (string) configuration_result;
  860. break;
  861. case "estate_name":
  862. m_estateName = (string) configuration_result;
  863. break;
  864. case "terrain_multiplier":
  865. m_terrainMultiplier = Convert.ToDouble(configuration_result);
  866. break;
  867. case "water_height":
  868. double tmpVal = (double) configuration_result;
  869. m_waterHeight = (float) tmpVal;
  870. break;
  871. case "terrain_image_id":
  872. m_terrainImageID = (LLUUID) configuration_result;
  873. break;
  874. case "estate_manager_0":
  875. m_estateManager0 = (LLUUID) configuration_result;
  876. break;
  877. case "estate_manager_1":
  878. m_estateManager1 = (LLUUID) configuration_result;
  879. break;
  880. case "estate_manager_2":
  881. m_estateManager2 = (LLUUID) configuration_result;
  882. break;
  883. case "estate_manager_3":
  884. m_estateManager3 = (LLUUID) configuration_result;
  885. break;
  886. case "estate_manager_4":
  887. m_estateManager4 = (LLUUID) configuration_result;
  888. break;
  889. case "estate_manager_5":
  890. m_estateManager5 = (LLUUID) configuration_result;
  891. break;
  892. case "estate_manager_6":
  893. m_estateManager6 = (LLUUID) configuration_result;
  894. break;
  895. case "estate_manager_7":
  896. m_estateManager7 = (LLUUID) configuration_result;
  897. break;
  898. case "estate_manager_8":
  899. m_estateManager8 = (LLUUID) configuration_result;
  900. break;
  901. case "estate_manager_9":
  902. m_estateManager9 = (LLUUID) configuration_result;
  903. break;
  904. }
  905. return true;
  906. }
  907. }
  908. }