RReasy

RReasy pour les RR

  1. // ==UserScript==
  2. // @name RReasy
  3. // @version 2.08l
  4. // @namespace www.lesroyaumes.com
  5. // @description RReasy pour les RR
  6. // @include http://www.lesroyaumes.com/EcranPrincipalAjax.php*
  7. // @include http://www.lesroyaumes.com/EcranPrincipal.php*
  8. // @exclude http://www.lesroyaumes.com/NouveauCourrier.php*
  9. // @priority 100
  10. // @grant unsafeWindow
  11. // @grant GM_deleteValue
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_listValues
  15. // @grant GM_addStyle
  16. // @grant GM_xmlhttpRequest
  17. // @grant GM_log
  18. // @grant GM_setClipboard
  19. // @grant GM_registerMenuCommand
  20. // @run-at document-end
  21. // ==/UserScript==
  22.  
  23. // --------------------------------------------------------------------
  24. // Ceci est un script utilisateur Scriptish.
  25. //
  26. // Pour installer :
  27. //
  28. // Sous Firefox NE FONCTIONNE PAS AVEC LES VERSIONS > 37 - Préférer la version 34.
  29. // Pour installer une ancienne version de Firefox :
  30. // https://forums.mozfr.org/viewtopic.php?t=93615
  31. //
  32. // installer Scriptish :
  33. // https://addons.mozilla.org/firefox/downloads/latest/scriptish/addon-231203-latest.xpi?src=ss
  34. //
  35. // Pour Google chrome : installer TamperMonkey :
  36. // https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=fr
  37. //
  38. // Après installation de Scriptish, ou TamperMonkey, redémarrez votre navigateur et visitez à nouveau ce script.
  39. // Il vous proposera de l'installer, faites-le.
  40. //
  41. // Le manuel : http://nsmf01.casimages.com/f/2016/06/12//1606121048461969821557.pdf
  42. // --------------------------------------------------------------------
  43.  
  44. /* A implémenter : la modification des métiers des utilisateurs
  45. Les fonctions de soldat qui ne travaillent pas sur les bonnes pages (Réputation notamment)
  46. Les états de guerre dans les préférences
  47. Les envois de courriers multiples
  48. */
  49.  
  50. /************* Initialisations des variables globales *************/
  51. if (lVersions == undefined) {
  52. var lVersions = [
  53. ["1.0a", "version de développement", "22/11/2012"]
  54. , ["1.0b", "évolution suite aux changements de l'IG", "18/01/2013"]
  55. , ["1.0c", "gestion du profile RReasy et des suspects", "21/01/2013"]
  56. , ["1.0d", "changement interface IG", "23/01/2013"]
  57. , ["1.1a", "début d'implémentation des fonctions de maire", "27/01/2013"]
  58. , ["1.1b", "correction du bug Encombrement", "29/01/2013"]
  59. , ["1.1c", "ajout des fonctions du marché", "03/02/2013"]
  60. , ["1.1d", "amélioration de la détection des suspects", "03/02/2013"]
  61. , ["1.1e", "amélioration de la liste des présents", "06/02/2013"]
  62. , ["1.1f", "corrections de bugs et améliorations", "09/02/2013"]
  63. , ["1.1g", "corrections d'un bug dans le recensement", "10/02/2013"]
  64. , ["1.1h", "corrections d'un bug dans les liens BBcode", "17/02/2013"]
  65. , ["1.1i", "ajout de la fonction Comptabilité du maire, correction d'un bug dans le dossier du soldat", "24/02/2013"]
  66. , ["1.1j", "correction de bugs pour la récupération des PR et l'affichage du registre", "26/02/2013"]
  67. , ["1.1k", "corrections dans la collecte d'informations, message de groupe depuis l'affichage du registre", "16/03/2013"]
  68. , ["1.1l", "corrections dans la collecte d'informations suite à modification IG (activité)", "28/03/2013"]
  69. , ["1.1m", "module 'Guet externe'", "01/04/2013"]
  70. , ["1.1n", "correction bug lien externe fiche personnage", "15/04/2013"]
  71. , ["1.1o", "correction suite à modifcation IG", "23/05/2013"]
  72. , ["1.1p", "intégration des fonctions liées à l'armée (commandant, intendant, trésorier)", "22/06/2013"]
  73. , ["1.1q", "correction perte du pseudo", "09/08/2013"]
  74. , ["1.1r", "correction perte du pseudo", "09/08/2013"]
  75. , ["1.1s", "correction perte des champs", "30/09/2013"]
  76. , ["2.0a", "évolution pour le calcul de l'impot", "01/10/2013"]
  77. , ["2.01", "correction dûe à l'évolution du code RR", "20/10/2014"]
  78. , ["2.02", "correction dûe à l'évolution du code RR (fin)", "21/10/2014"]
  79. , ["2.03", "Agencements et adaptations de Cigalou01", "07/02/2015"]
  80. , ["2.04", "Mod. affichage suspects, rapports", "22/02/2015"]
  81. , ["2.04", "Complément de métiers", "28/02/2015"]
  82. , ["2.04", "Modif pour ajout/modification de suspects", "04/03/2015"]
  83. , ["2.05", "Modif du localStorage pour villes multiples", "07/03/2015"]
  84. , ["2.05", "Correction du localStorage pour villes multiples", "08/03/2015"]
  85. , ["2.05", "Correction de l'extraction des Ville/Duché", "10/03/2015"]
  86. , ["2.06", "Correction des préférences pour villes multiples", "16/03/2015"]
  87. , ["2.06a", "Ajout des préférences d'alerte pour le Guet en villes multiples", "18/03/2015"]
  88. , ["2.07", "Corrections du localStorage pour comptes multiples.", "18/02/2016"]
  89. , ["2.07a", "Remise en conformité du Portrait robot.", "23/02/2016"]
  90. , ["2.07b", "Ajustements divers.", "08/03/2016"]
  91. , ["2.08", "Transfert des Prefs en localStorage", "08/06/2016"]
  92. , ["2.08c", "Modification du stockage des listes de villageois pour gérer les alphabets non latins", "09/06/2016"]
  93. , ["2.08d", "Correction affichage status - Divers ajustements", "10/06/2016"]
  94. , ["2.08e", "Divers ajustements", "11/06/2016"]
  95. , ["2.08f", "correction erreurs de transcription", "11/06/2016"]
  96. , ["2.08g", "correction bug sur synthèse Marché", "12/06/2016"]
  97. , ["2.08h", "Complément de guet extérieur : ajout de synthèse, de liste des résidents actifs, correction sur retraite spirituelle", "17/06/2016"]
  98. , ["2.08i", "Complément de Douane : ajout de la liste des résidents actifs", "21/06/2016"]
  99. , ["2.08J", "Corrections diverses", "30/07/2016"]
  100. , ["2.08k", "Corrections diverses, mise en conformité Compta Mairie, Inventaire Mairie, filtrage des noeuds pour alléger les localStorage, Ajout de la douane 'déportée' sur l'onglet 'Groupes et armées' pour les SDD qui sont en armée", "22/09/2016"]
  101. , ["2.08l", "évolution suite aux changements de l'IG", "29/09/2016"]
  102. ];
  103. var version = lVersions[lVersions.length - 1][0];
  104. }
  105. var xFavdb = "RReasy est une extension des RR réalisée par <a href='#' onClick='javascript:popupPerso(\"FichePersonnage.php?login=favdb\")'>FaVdB</a>, modifiée et aménagée par <a href='#' onClick='javascript:popupPerso(\"FichePersonnage.php?login=Cigalou01\")'>Cigalou01</a>";
  106.  
  107. /* A explorer :
  108. textePage[4][25]['Texte'] = '<form method="post" action="Action.php?action=310"> <p>L\'argent du village est devant vous et personne ne vous regarde.</p><select name="montant"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option><option value="32">32</option><option value="33">33</option><option value="34">34</option><option value="35">35</option><option value="36">36</option><option value="37">37</option><option value="38">38</option><option value="39">39</option><option value="40">40</option><option value="41">41</option><option value="42">42</option><option value="43">43</option><option value="44">44</option><option value="45">45</option><option value="46">46</option><option value="47">47</option><option value="48">48</option><option value="49">49</option><option value="50">50</option><option value="51">51</option><option value="52">52</option><option value="53">53</option><option value="54">54</option><option value="55">55</option><option value="56">56</option><option value="57">57</option><option value="58">58</option><option value="59">59</option><option value="60">60</option><option value="61">61</option><option value="62">62</option><option value="63">63</option><option value="64">64</option><option value="65">65</option><option value="66">66</option><option value="67">67</option><option value="68">68</option><option value="69">69</option><option value="70">70</option><option value="71">71</option><option value="72">72</option><option value="73">73</option><option value="74">74</option><option value="75">75</option><option value="76">76</option><option value="77">77</option><option value="78">78</option><option value="79">79</option><option value="80">80</option><option value="81">81</option><option value="82">82</option><option value="83">83</option><option value="84">84</option><option value="85">85</option><option value="86">86</option><option value="87">87</option><option value="88">88</option><option value="89">89</option><option value="90">90</option><option value="91">91</option><option value="92">92</option><option value="93">93</option><option value="94">94</option><option value="95">95</option><option value="96">96</option><option value="97">97</option><option value="98">98</option><option value="99">99</option><option value="100">100</option><option value="101">101</option><option value="102">102</option><option value="103">103</option><option value="104">104</option><option value="105">105</option><option value="106">106</option><option value="107">107</option><option value="108">108</option><option value="109">109</option><option value="110">110</option><option value="111">111</option><option value="112">112</option><option value="113">113</option><option value="114">114</option><option value="115">115</option><option value="116">116</option><option value="117">117</option><option value="118">118</option><option value="119">119</option><option value="120">120</option><option value="121">121</option><option value="122">122</option><option value="123">123</option><option value="124">124</option><option value="125">125</option><option value="126">126</option><option value="127">127</option><option value="128">128</option><option value="129">129</option><option value="130">130</option><option value="131">131</option><option value="132">132</option><option value="133">133</option><option value="134">134</option><option value="135">135</option><option value="136">136</option><option value="137">137</option><option value="138">138</option><option value="139">139</option><option value="140">140</option><option value="141">141</option><option value="142">142</option><option value="143">143</option><option value="144">144</option><option value="145">145</option><option value="146">146</option><option value="147">147</option><option value="148">148</option><option value="149">149</option><option value="150">150</option><option value="151">151</option><option value="152">152</option><option value="153">153</option><option value="154">154</option><option value="155">155</option><option value="156">156</option><option value="157">157</option><option value="158">158</option><option value="159">159</option><option value="160">160</option><option value="161">161</option><option value="162">162</option><option value="163">163</option><option value="164">164</option><option value="165">165</option><option value="166">166</option><option value="167">167</option><option value="168">168</option><option value="169">169</option><option value="170">170</option><option value="171">171</option><option value="172">172</option><option value="173">173</option><option value="174">174</option><option value="175">175</option><option value="176">176</option><option value="177">177</option><option value="178">178</option><option value="179">179</option><option value="180">180</option><option value="181">181</option><option value="182">182</option><option value="183">183</option><option value="184">184</option><option value="185">185</option><option value="186">186</option><option value="187">187</option><option value="188">188</option><option value="189">189</option><option value="190">190</option><option value="191">191</option><option value="192">192</option><option value="193">193</option><option value="194">194</option><option value="195">195</option><option value="196">196</option><option value="197">197</option><option value="198">198</option><option value="199">199</option><option value="200">200</option><option value="201">201</option><option value="202">202</option><option value="203">203</option><option value="204">204</option><option value="205">205</option><option value="206">206</option><option value="207">207</option><option value="208">208</option><option value="209">209</option><option value="210">210</option><option value="211">211</option><option value="212">212</option><option value="213">213</option><option value="214">214</option><option value="215">215</option><option value="216">216</option><option value="217">217</option><option value="218">218</option><option value="219">219</option><option value="220">220</option><option value="221">221</option><option value="222">222</option><option value="223">223</option><option value="224">224</option><option value="225">225</option><option value="226">226</option><option value="227">227</option><option value="228">228</option><option value="229">229</option><option value="230">230</option><option value="231">231</option><option value="232">232</option><option value="233">233</option><option value="234">234</option><option value="235">235</option><option value="236">236</option><option value="237">237</option><option value="238">238</option><option value="239">239</option><option value="240">240</option><option value="241">241</option><option value="242">242</option><option value="243">243</option><option value="244">244</option><option value="245">245</option><option value="246">246</option><option value="247">247</option><option value="248">248</option><option value="249">249</option><option value="250">250</option><option value="251">251</option><option value="252">252</option><option value="253">253</option><option value="254">254</option><option value="255">255</option><option value="256">256</option><option value="257">257</option><option value="258">258</option><option value="259">259</option><option value="260">260</option><option value="261">261</option><option value="262">262</option><option value="263">263</option><option value="264">264</option><option value="265">265</option><option value="266">266</option><option value="267">267</option><option value="268">268</option><option value="269">269</option><option value="270">270</option><option value="271">271</option><option value="272">272</option><option value="273">273</option><option value="274">274</option><option value="275">275</option><option value="276">276</option><option value="277">277</option><option value="278">278</option><option value="279">279</option><option value="280">280</option><option value="281">281</option><option value="282">282</option><option value="283">283</option><option value="284">284</option><option value="285">285</option><option value="286">286</option><option value="287">287</option><option value="288">288</option><option value="289">289</option><option value="290">290</option><option value="291">291</option><option value="292">292</option><option value="293">293</option><option value="294">294</option><option value="295">295</option><option value="296">296</option><option value="297">297</option><option value="298">298</option><option value="299">299</option><option value="300">300</option><option value="301">301</option><option value="302">302</option><option value="303">303</option><option value="304">304</option><option value="305">305</option><option value="306">306</option><option value="307">307</option><option value="308">308</option><option value="309">309</option><option value="310">310</option><option value="311">311</option><option value="312">312</option><option value="313">313</option><option value="314">314</option><option value="315">315</option><option value="316">316</option><option value="317">317</option><option value="318">318</option><option value="319">319</option><option value="320">320</option><option value="321">321</option><option value="322">322</option><option value="323">323</option><option value="324">324</option><option value="325">325</option><option value="326">326</option><option value="327">327</option><option value="328">328</option><option value="329">329</option><option value="330">330</option><option value="331">331</option><option value="332">332</option><option value="333">333</option><option value="334">334</option><option value="335">335</option><option value="336">336</option><option value="337">337</option><option value="338">338</option><option value="339">339</option><option value="340">340</option><option value="341">341</option><option value="342">342</option><option value="343">343</option><option value="344">344</option><option value="345">345</option><option value="346">346</option><option value="347">347</option><option value="348">348</option><option value="349">349</option><option value="350">350</option><option value="351">351</option><option value="352">352</option><option value="353">353</option><option value="354">354</option><option value="355">355</option><option value="356">356</option><option value="357">357</option><option value="358">358</option><option value="359">359</option><option value="360">360</option><option value="361">361</option><option value="362">362</option><option value="363">363</option><option value="364">364</option><option value="365">365</option><option value="366">366</option><option value="367">367</option><option value="368">368</option><option value="369">369</option><option value="370">370</option><option value="371">371</option><option value="372">372</option><option value="373">373</option><option value="374">374</option><option value="375">375</option><option value="376">376</option><option value="377">377</option><option value="378">378</option><option value="379">379</option><option value="380">380</option><option value="381">381</option><option value="382">382</option><option value="383">383</option><option value="384">384</option><option value="385">385</option><option value="386">386</option><option value="387">387</option><option value="388">388</option><option value="389">389</option><option value="390">390</option><option value="391">391</option><option value="392">392</option><option value="393">393</option><option value="394">394</option><option value="395">395</option><option value="396">396</option><option value="397">397</option><option value="398">398</option><option value="399">399</option><option value="400">400</option><option value="401">401</option><option value="402">402</option><option value="403">403</option><option value="404">404</option><option value="405">405</option><option value="406">406</option><option value="407">407</option><option value="408">408</option><option value="409">409</option><option value="410">410</option><option value="411">411</option><option value="412">412</option><option value="413">413</option><option value="414">414</option><option value="415">415</option><option value="416">416</option><option value="417">417</option><option value="418">418</option><option value="419">419</option><option value="420">420</option><option value="421">421</option><option value="422">422</option><option value="423">423</option><option value="424">424</option><option value="425">425</option><option value="426">426</option><option value="427">427</option><option value="428">428</option><option value="429">429</option><option value="430">430</option><option value="431">431</option><option value="432">432</option><option value="433">433</option><option value="434">434</option><option value="435">435</option><option value="436">436</option><option value="437">437</option><option value="438">438</option><option value="439">439</option><option value="440">440</option><option value="441">441</option><option value="442">442</option><option value="443">443</option><option value="444">444</option><option value="445">445</option><option value="446">446</option><option value="447">447</option><option value="448">448</option><option value="449">449</option><option value="450">450</option><option value="451">451</option><option value="452">452</option><option value="453">453</option><option value="454">454</option><option value="455">455</option><option value="456">456</option><option value="457">457</option><option value="458">458</option><option value="459">459</option><option value="460">460</option><option value="461">461</option><option value="462">462</option><option value="463">463</option><option value="464">464</option><option value="465">465</option><option value="466">466</option><option value="467">467</option><option value="468">468</option><option value="469">469</option><option value="470">470</option><option value="471">471</option><option value="472">472</option><option value="473">473</option><option value="474">474</option><option value="475">475</option><option value="476">476</option><option value="477">477</option><option value="478">478</option><option value="479">479</option><option value="480">480</option><option value="481">481</option><option value="482">482</option><option value="483">483</option><option value="484">484</option><option value="485">485</option><option value="486">486</option><option value="487">487</option><option value="488">488</option><option value="489">489</option><option value="490">490</option><option value="491">491</option><option value="492">492</option><option value="493">493</option><option value="494">494</option><option value="495">495</option><option value="496">496</option><option value="497">497</option><option value="498">498</option><option value="499">499</option><option value="500">500</option></select> <input type="hidden" name="voleur" value="maire"> <input type="submit" value="Voler"></form>'; */
  109.  
  110. /* A explorer :
  111. <form method="POST" target="mail" action="NouveauCourrier.php?multiCastMaire=1" id="FormulaireRepondre25378">\n <a class="lien_default" href="NouveauCourrier.php?multiCastMaire=1" onclick="popupMail(\'about:blank\'); setTimeout(function submitForm() { document.getElementById(\'FormulaireRepondre25378\').submit();}, 500); return false;">Envoyer un courrier &agrave; tous les villageois</a>\n <input type="hidden" name="Destinataire" value="" />\n <input type="hidden" name="Titre" value="" />\n </form>
  112. */
  113.  
  114. vers = navigator.userAgent.substring(navigator.userAgent.indexOf("rv:")+3,navigator.userAgent.indexOf(")"));
  115. var numVers = parseFloat(vers); //logit("numVers : " + numVers);
  116.  
  117. var SaveIG = "", SaveIG2 = "";
  118. var JSON2 = JSON;
  119. var RRoperation = "";
  120.  
  121. var Perso_minS_bk = 0, Perso_minF_bk = 0, Perso_minS_rd = 0, Perso_maxS_rd = 0;
  122. var Perso_minF_rd = 0, Perso_minS_or = 0; Perso_maxS_or = 0; Perso_minF_or = 0;
  123. var Perso_minS_grR = 0, Perso_maxS_grR = 0, Perso_maxS_gr = 0;
  124. var PersoPrefs="", hPersos="00/00/0000", hHier="00/00/0000";
  125. var PersoJour="", PersoGrade="", PersoGarnison="", PersoEscouade="", PersoMission="";
  126. var lastHier="00/00/0000", lastRapport="00/00/0000", PrefsAlerts="0", PersoAlerts="20|15|15|19|10|10|14|5|6|9|5", MarcheSeuil="|ø";
  127. var MandatVu="00/00/0000", MandatH = "0", MandatOH = "0", isMandat = false;
  128. var monPopup; var InfosPaysRR = new Array();//var InfosPaysRR = "";
  129. var nPersos = new Array, nFurtifs = new Array, nPresents = new Array, nHier = new Array, aColor = new Array, sColor = new Array;
  130. var nSuspects = new Array;
  131. var nbP = 0, nbPmort = 0, nbPretraite = 0, nbPretranche = 0,
  132. nbV = 0, nbVmort = 0, nbVretraite = 0, nbVretranche = 0,
  133. nbH = 0, nbHmort = 0, nbHretraite = 0, nbHretranche = 0,
  134. nbE = 0, nbEmort = 0, nbEretraite = 0, nbEretranche = 0,
  135. nbS = 0, nbSmort = 0, nbSretraite = 0, nbSretranche = 0, nbSurv=0;
  136. var nPointeur = 0, aPointeur = 0, pPointeur = 0, npFurtif = 0, nbF=0;
  137. var mVille = "", mDuche = "", mDate = "", lDate = "", MS_V = "|ø";
  138. var cMaire = "", cTribun = "";
  139. var aColor = Array("green","darkgreen","orange","red","black","black");
  140. var sColor = Array("Verte","Verte Renforcée","Orange","Rouge","Noire","Noire");
  141. var fightColor = ["#444444", "#B22222", "#FF0000", "#FFA500", "#A52A2A", "#FFFF00",
  142. "#008000", "#808000", "#00FFFF", "#0000FF", "#00008B", "#8A2BE2",
  143. "#EE82EE", "#FFFFFF"];
  144. var sfightC = ["Défaut", "Rouge foncé", "Rouge", "Orange", "Marron", "Jaune",
  145. "Vert", "Olive", "Cyan", "Bleu", "Bleu foncé", "Indigo",
  146. "Violet", "Blanc"];
  147. var ExtVille = "", ExtHier = "", ExtJour = "", nPointeurExt=0;
  148. var ADeparts = new Array, AArrivees = new Array, ASuspects = new Array;
  149. var ExtSynthese = "";
  150. var Xident = new Array, Xidx, nPresentsJour = new Array, nPresentsHier = new Array, nPersosExt = new Array;
  151. var Fraudeur = new Array, nFraudeur;
  152.  
  153. var libMetier = [
  154. 'boulanger', 'meunier', 'boucher', 'forgeron',
  155. 'charpentier', 'tisserand', 'botaniste', 'sculpteur', 'pressoir', 'whiskey',
  156. 'whisky', 'fromagerie', 'cave à vin', 'ferme à cidre'
  157. ];
  158. var libChamp = [
  159. 'blé', 'maïs', 'légumes', 'vaches', 'cochons', 'moutons', 'chèvres', 'oliviers', 'vigne', 'orge'
  160. ];
  161. var libGrade = [
  162. "--", "000000",
  163. "Prévôt", "FC0216",
  164. "Maréchal", "2305F9",
  165. "Aspirant maréchal", "02C0FC",
  166. "Sénéchal", "F65908",
  167. "Major", "FA7504",
  168. "Conseiller militaire", "4686B8",
  169. "Cartographe", "036234",
  170. "Adjudant", "78293E",
  171. "Sergent chef", "2305F9",
  172. "Sergent", "02C0FC",
  173. "Sergent intérimaire", "699672",
  174. "Brigadier chef", "ECC012",
  175. "Brigadier", "ECC012",
  176. "Soldat de 1ère classe", "97F905",
  177. "Soldat", "F0FA04",
  178. "Volontaire", "A14401"
  179. ];
  180. var LeRapport = "";
  181. var tStat = ['Surv.' ,'Assign.' ,'PNG' ,'Brig.' ,'Membre' ,'TOP' ,'MoV'
  182. ];
  183. var tStatc = ['660000' ,'0000ff' ,'008888' ,'660000' ,'ff0000' ,'ff3333' ,'ff3333'
  184. ];
  185. var tStath = ['660000' ,'0000ff' ,'008888' ,'660000' ,'ff0000' ,'ff3333' ,'ff3333'
  186. ];
  187. var mdlg = null;
  188. var db = "[b]", fb = "[/b]";
  189. var eActif = "État", eVille = "Ville", eComte = "Comté/Duché", eChamp = -1, eMetier = -1;
  190. var nProduits = new Array;
  191. /* Peuplement SELECT des select de Préférences **** Ajout 2016_02_24 */
  192. InfosPaysRR[0] = new Array();
  193. InfosPaysRR[0]['Nom'] = 'Royaume de France';
  194. InfosPaysRR[0]['Comtes'] = new Array();
  195. InfosPaysRR[0]['Comtes'][0] = new Array();
  196. InfosPaysRR[0]['Comtes'][0]['Nom'] = 'Comté d\'Artois';
  197. InfosPaysRR[0]['Comtes'][0]['Villages'] = new Array();
  198. InfosPaysRR[0]['Comtes'][0]['Villages'][4] = new Array();
  199. InfosPaysRR[0]['Comtes'][0]['Villages'][4]['Nom'] = 'Bertincourt';
  200. InfosPaysRR[0]['Comtes'][0]['Villages'][5] = new Array();
  201. InfosPaysRR[0]['Comtes'][0]['Villages'][5]['Nom'] = 'Cambrai';
  202. InfosPaysRR[0]['Comtes'][0]['Villages'][7] = new Array();
  203. InfosPaysRR[0]['Comtes'][0]['Villages'][7]['Nom'] = 'Péronne';
  204. InfosPaysRR[0]['Comtes'][0]['Villages'][8] = new Array();
  205. InfosPaysRR[0]['Comtes'][0]['Villages'][8]['Nom'] = 'Azincourt';
  206. InfosPaysRR[0]['Comtes'][0]['Villages'][19] = new Array();
  207. InfosPaysRR[0]['Comtes'][0]['Villages'][19]['Nom'] = 'Calais';
  208. InfosPaysRR[0]['Comtes'][0]['Villages'][135] = new Array();
  209. InfosPaysRR[0]['Comtes'][0]['Villages'][135]['Nom'] = 'Arras';
  210. InfosPaysRR[0]['Comtes'][1] = new Array();
  211. InfosPaysRR[0]['Comtes'][1]['Nom'] = 'Duché de Champagne (Domaine Royal)';
  212. InfosPaysRR[0]['Comtes'][1]['Villages'] = new Array();
  213. InfosPaysRR[0]['Comtes'][1]['Villages'][0] = new Array();
  214. InfosPaysRR[0]['Comtes'][1]['Villages'][0]['Nom'] = 'Sainte-Menehould';
  215. InfosPaysRR[0]['Comtes'][1]['Villages'][1] = new Array();
  216. InfosPaysRR[0]['Comtes'][1]['Villages'][1]['Nom'] = 'Clermont';
  217. InfosPaysRR[0]['Comtes'][1]['Villages'][2] = new Array();
  218. InfosPaysRR[0]['Comtes'][1]['Villages'][2]['Nom'] = 'Varennes';
  219. InfosPaysRR[0]['Comtes'][1]['Villages'][3] = new Array();
  220. InfosPaysRR[0]['Comtes'][1]['Villages'][3]['Nom'] = 'Argonne';
  221. InfosPaysRR[0]['Comtes'][1]['Villages'][6] = new Array();
  222. InfosPaysRR[0]['Comtes'][1]['Villages'][6]['Nom'] = 'Compiègne';
  223. InfosPaysRR[0]['Comtes'][1]['Villages'][9] = new Array();
  224. InfosPaysRR[0]['Comtes'][1]['Villages'][9]['Nom'] = 'Troyes';
  225. InfosPaysRR[0]['Comtes'][1]['Villages'][10] = new Array();
  226. InfosPaysRR[0]['Comtes'][1]['Villages'][10]['Nom'] = 'Conflans-lès-Sens';
  227. InfosPaysRR[0]['Comtes'][1]['Villages'][15] = new Array();
  228. InfosPaysRR[0]['Comtes'][1]['Villages'][15]['Nom'] = 'Langres';
  229. InfosPaysRR[0]['Comtes'][1]['Villages'][140] = new Array();
  230. InfosPaysRR[0]['Comtes'][1]['Villages'][140]['Nom'] = 'Reims';
  231. InfosPaysRR[0]['Comtes'][3] = new Array();
  232. InfosPaysRR[0]['Comtes'][3]['Nom'] = 'Duché de Normandie (Domaine Royal)';
  233. InfosPaysRR[0]['Comtes'][3]['Villages'] = new Array();
  234. InfosPaysRR[0]['Comtes'][3]['Villages'][11] = new Array();
  235. InfosPaysRR[0]['Comtes'][3]['Villages'][11]['Nom'] = 'Honfleur';
  236. InfosPaysRR[0]['Comtes'][3]['Villages'][12] = new Array();
  237. InfosPaysRR[0]['Comtes'][3]['Villages'][12]['Nom'] = 'Dieppe';
  238. InfosPaysRR[0]['Comtes'][3]['Villages'][14] = new Array();
  239. InfosPaysRR[0]['Comtes'][3]['Villages'][14]['Nom'] = 'Bayeux';
  240. InfosPaysRR[0]['Comtes'][3]['Villages'][16] = new Array();
  241. InfosPaysRR[0]['Comtes'][3]['Villages'][16]['Nom'] = 'Fécamp';
  242. InfosPaysRR[0]['Comtes'][3]['Villages'][23] = new Array();
  243. InfosPaysRR[0]['Comtes'][3]['Villages'][23]['Nom'] = 'Lisieux';
  244. InfosPaysRR[0]['Comtes'][3]['Villages'][26] = new Array();
  245. InfosPaysRR[0]['Comtes'][3]['Villages'][26]['Nom'] = 'Avranches';
  246. InfosPaysRR[0]['Comtes'][3]['Villages'][143] = new Array();
  247. InfosPaysRR[0]['Comtes'][3]['Villages'][143]['Nom'] = 'Rouen';
  248. InfosPaysRR[0]['Comtes'][4] = new Array();
  249. InfosPaysRR[0]['Comtes'][4]['Nom'] = 'Duché de Bretagne';
  250. InfosPaysRR[0]['Comtes'][4]['Villages'] = new Array();
  251. InfosPaysRR[0]['Comtes'][4]['Villages'][30] = new Array();
  252. InfosPaysRR[0]['Comtes'][4]['Villages'][30]['Nom'] = 'Rohan';
  253. InfosPaysRR[0]['Comtes'][4]['Villages'][31] = new Array();
  254. InfosPaysRR[0]['Comtes'][4]['Villages'][31]['Nom'] = 'Saint-Brieuc';
  255. InfosPaysRR[0]['Comtes'][4]['Villages'][32] = new Array();
  256. InfosPaysRR[0]['Comtes'][4]['Villages'][32]['Nom'] = 'Fougères';
  257. InfosPaysRR[0]['Comtes'][4]['Villages'][33] = new Array();
  258. InfosPaysRR[0]['Comtes'][4]['Villages'][33]['Nom'] = 'Vannes';
  259. InfosPaysRR[0]['Comtes'][4]['Villages'][34] = new Array();
  260. InfosPaysRR[0]['Comtes'][4]['Villages'][34]['Nom'] = 'Tréguier';
  261. InfosPaysRR[0]['Comtes'][4]['Villages'][51] = new Array();
  262. InfosPaysRR[0]['Comtes'][4]['Villages'][51]['Nom'] = 'Rieux';
  263. InfosPaysRR[0]['Comtes'][4]['Villages'][77] = new Array();
  264. InfosPaysRR[0]['Comtes'][4]['Villages'][77]['Nom'] = 'Saint Pol de Léon';
  265. InfosPaysRR[0]['Comtes'][4]['Villages'][105] = new Array();
  266. InfosPaysRR[0]['Comtes'][4]['Villages'][105]['Nom'] = 'Brest';
  267. InfosPaysRR[0]['Comtes'][4]['Villages'][153] = new Array();
  268. InfosPaysRR[0]['Comtes'][4]['Villages'][153]['Nom'] = 'Rennes';
  269. InfosPaysRR[0]['Comtes'][5] = new Array();
  270. InfosPaysRR[0]['Comtes'][5]['Nom'] = 'Duché de Bourgogne';
  271. InfosPaysRR[0]['Comtes'][5]['Villages'] = new Array();
  272. InfosPaysRR[0]['Comtes'][5]['Villages'][13] = new Array();
  273. InfosPaysRR[0]['Comtes'][5]['Villages'][13]['Nom'] = 'Tonnerre';
  274. InfosPaysRR[0]['Comtes'][5]['Villages'][18] = new Array();
  275. InfosPaysRR[0]['Comtes'][5]['Villages'][18]['Nom'] = 'Joinville';
  276. InfosPaysRR[0]['Comtes'][5]['Villages'][20] = new Array();
  277. InfosPaysRR[0]['Comtes'][5]['Villages'][20]['Nom'] = 'Cosne';
  278. InfosPaysRR[0]['Comtes'][5]['Villages'][21] = new Array();
  279. InfosPaysRR[0]['Comtes'][5]['Villages'][21]['Nom'] = 'Sémur';
  280. InfosPaysRR[0]['Comtes'][5]['Villages'][24] = new Array();
  281. InfosPaysRR[0]['Comtes'][5]['Villages'][24]['Nom'] = 'Nevers';
  282. InfosPaysRR[0]['Comtes'][5]['Villages'][25] = new Array();
  283. InfosPaysRR[0]['Comtes'][5]['Villages'][25]['Nom'] = 'Autun';
  284. InfosPaysRR[0]['Comtes'][5]['Villages'][27] = new Array();
  285. InfosPaysRR[0]['Comtes'][5]['Villages'][27]['Nom'] = 'Mâcon';
  286. InfosPaysRR[0]['Comtes'][5]['Villages'][28] = new Array();
  287. InfosPaysRR[0]['Comtes'][5]['Villages'][28]['Nom'] = 'Chalon';
  288. InfosPaysRR[0]['Comtes'][5]['Villages'][151] = new Array();
  289. InfosPaysRR[0]['Comtes'][5]['Villages'][151]['Nom'] = 'Dijon';
  290. InfosPaysRR[0]['Comtes'][6] = new Array();
  291. InfosPaysRR[0]['Comtes'][6]['Nom'] = 'Duché du Berry';
  292. InfosPaysRR[0]['Comtes'][6]['Villages'] = new Array();
  293. InfosPaysRR[0]['Comtes'][6]['Villages'][35] = new Array();
  294. InfosPaysRR[0]['Comtes'][6]['Villages'][35]['Nom'] = 'Sancerre';
  295. InfosPaysRR[0]['Comtes'][6]['Villages'][36] = new Array();
  296. InfosPaysRR[0]['Comtes'][6]['Villages'][36]['Nom'] = 'Châteauroux';
  297. InfosPaysRR[0]['Comtes'][6]['Villages'][37] = new Array();
  298. InfosPaysRR[0]['Comtes'][6]['Villages'][37]['Nom'] = 'Saint-Aignan';
  299. InfosPaysRR[0]['Comtes'][6]['Villages'][152] = new Array();
  300. InfosPaysRR[0]['Comtes'][6]['Villages'][152]['Nom'] = 'Bourges';
  301. InfosPaysRR[0]['Comtes'][7] = new Array();
  302. InfosPaysRR[0]['Comtes'][7]['Nom'] = 'Duché du Bourbonnais-Auvergne';
  303. InfosPaysRR[0]['Comtes'][7]['Villages'] = new Array();
  304. InfosPaysRR[0]['Comtes'][7]['Villages'][40] = new Array();
  305. InfosPaysRR[0]['Comtes'][7]['Villages'][40]['Nom'] = 'Bourbon';
  306. InfosPaysRR[0]['Comtes'][7]['Villages'][41] = new Array();
  307. InfosPaysRR[0]['Comtes'][7]['Villages'][41]['Nom'] = 'Moulins';
  308. InfosPaysRR[0]['Comtes'][7]['Villages'][42] = new Array();
  309. InfosPaysRR[0]['Comtes'][7]['Villages'][42]['Nom'] = 'Montpensier';
  310. InfosPaysRR[0]['Comtes'][7]['Villages'][44] = new Array();
  311. InfosPaysRR[0]['Comtes'][7]['Villages'][44]['Nom'] = 'Thiers';
  312. InfosPaysRR[0]['Comtes'][7]['Villages'][47] = new Array();
  313. InfosPaysRR[0]['Comtes'][7]['Villages'][47]['Nom'] = 'Montluçon';
  314. InfosPaysRR[0]['Comtes'][7]['Villages'][56] = new Array();
  315. InfosPaysRR[0]['Comtes'][7]['Villages'][56]['Nom'] = 'Montbrisson';
  316. InfosPaysRR[0]['Comtes'][7]['Villages'][57] = new Array();
  317. InfosPaysRR[0]['Comtes'][7]['Villages'][57]['Nom'] = 'Murat';
  318. InfosPaysRR[0]['Comtes'][7]['Villages'][58] = new Array();
  319. InfosPaysRR[0]['Comtes'][7]['Villages'][58]['Nom'] = 'Aurillac';
  320. InfosPaysRR[0]['Comtes'][7]['Villages'][109] = new Array();
  321. InfosPaysRR[0]['Comtes'][7]['Villages'][109]['Nom'] = 'Polignac';
  322. InfosPaysRR[0]['Comtes'][7]['Villages'][162] = new Array();
  323. InfosPaysRR[0]['Comtes'][7]['Villages'][162]['Nom'] = 'Clermont';
  324. InfosPaysRR[0]['Comtes'][8] = new Array();
  325. InfosPaysRR[0]['Comtes'][8]['Nom'] = 'Duché de Touraine';
  326. InfosPaysRR[0]['Comtes'][8]['Villages'] = new Array();
  327. InfosPaysRR[0]['Comtes'][8]['Villages'][45] = new Array();
  328. InfosPaysRR[0]['Comtes'][8]['Villages'][45]['Nom'] = 'Loches';
  329. InfosPaysRR[0]['Comtes'][8]['Villages'][46] = new Array();
  330. InfosPaysRR[0]['Comtes'][8]['Villages'][46]['Nom'] = 'Chinon';
  331. InfosPaysRR[0]['Comtes'][8]['Villages'][124] = new Array();
  332. InfosPaysRR[0]['Comtes'][8]['Villages'][124]['Nom'] = 'Vendôme';
  333. InfosPaysRR[0]['Comtes'][8]['Villages'][163] = new Array();
  334. InfosPaysRR[0]['Comtes'][8]['Villages'][163]['Nom'] = 'Tours';
  335. InfosPaysRR[0]['Comtes'][9] = new Array();
  336. InfosPaysRR[0]['Comtes'][9]['Nom'] = 'Duché d\'Anjou';
  337. InfosPaysRR[0]['Comtes'][9]['Villages'] = new Array();
  338. InfosPaysRR[0]['Comtes'][9]['Villages'][48] = new Array();
  339. InfosPaysRR[0]['Comtes'][9]['Villages'][48]['Nom'] = 'Saumur';
  340. InfosPaysRR[0]['Comtes'][9]['Villages'][49] = new Array();
  341. InfosPaysRR[0]['Comtes'][9]['Villages'][49]['Nom'] = 'La Flêche';
  342. InfosPaysRR[0]['Comtes'][9]['Villages'][50] = new Array();
  343. InfosPaysRR[0]['Comtes'][9]['Villages'][50]['Nom'] = 'Craon';
  344. InfosPaysRR[0]['Comtes'][9]['Villages'][164] = new Array();
  345. InfosPaysRR[0]['Comtes'][9]['Villages'][164]['Nom'] = 'Angers';
  346. InfosPaysRR[0]['Comtes'][10] = new Array();
  347. InfosPaysRR[0]['Comtes'][10]['Nom'] = 'Comté du Poitou';
  348. InfosPaysRR[0]['Comtes'][10]['Villages'] = new Array();
  349. InfosPaysRR[0]['Comtes'][10]['Villages'][52] = new Array();
  350. InfosPaysRR[0]['Comtes'][10]['Villages'][52]['Nom'] = 'Niort';
  351. InfosPaysRR[0]['Comtes'][10]['Villages'][53] = new Array();
  352. InfosPaysRR[0]['Comtes'][10]['Villages'][53]['Nom'] = 'La Rochelle';
  353. InfosPaysRR[0]['Comtes'][10]['Villages'][54] = new Array();
  354. InfosPaysRR[0]['Comtes'][10]['Villages'][54]['Nom'] = 'Thouars';
  355. InfosPaysRR[0]['Comtes'][10]['Villages'][55] = new Array();
  356. InfosPaysRR[0]['Comtes'][10]['Villages'][55]['Nom'] = 'La Trémouille';
  357. InfosPaysRR[0]['Comtes'][10]['Villages'][99] = new Array();
  358. InfosPaysRR[0]['Comtes'][10]['Villages'][99]['Nom'] = 'Saintes';
  359. InfosPaysRR[0]['Comtes'][10]['Villages'][324] = new Array();
  360. InfosPaysRR[0]['Comtes'][10]['Villages'][324]['Nom'] = 'Poitiers';
  361. InfosPaysRR[0]['Comtes'][11] = new Array();
  362. InfosPaysRR[0]['Comtes'][11]['Nom'] = 'Comté du Limousin et de La Marche';
  363. InfosPaysRR[0]['Comtes'][11]['Villages'] = new Array();
  364. InfosPaysRR[0]['Comtes'][11]['Villages'][59] = new Array();
  365. InfosPaysRR[0]['Comtes'][11]['Villages'][59]['Nom'] = 'Tulle';
  366. InfosPaysRR[0]['Comtes'][11]['Villages'][60] = new Array();
  367. InfosPaysRR[0]['Comtes'][11]['Villages'][60]['Nom'] = 'Ventadour';
  368. InfosPaysRR[0]['Comtes'][11]['Villages'][61] = new Array();
  369. InfosPaysRR[0]['Comtes'][11]['Villages'][61]['Nom'] = 'Bourganeuf';
  370. InfosPaysRR[0]['Comtes'][11]['Villages'][69] = new Array();
  371. InfosPaysRR[0]['Comtes'][11]['Villages'][69]['Nom'] = 'Guéret';
  372. InfosPaysRR[0]['Comtes'][11]['Villages'][100] = new Array();
  373. InfosPaysRR[0]['Comtes'][11]['Villages'][100]['Nom'] = 'Rochechouart';
  374. InfosPaysRR[0]['Comtes'][11]['Villages'][325] = new Array();
  375. InfosPaysRR[0]['Comtes'][11]['Villages'][325]['Nom'] = 'Limoges';
  376. InfosPaysRR[0]['Comtes'][13] = new Array();
  377. InfosPaysRR[0]['Comtes'][13]['Nom'] = 'Duché du Lyonnais-Dauphiné';
  378. InfosPaysRR[0]['Comtes'][13]['Villages'] = new Array();
  379. InfosPaysRR[0]['Comtes'][13]['Villages'][70] = new Array();
  380. InfosPaysRR[0]['Comtes'][13]['Villages'][70]['Nom'] = 'Vienne';
  381. InfosPaysRR[0]['Comtes'][13]['Villages'][71] = new Array();
  382. InfosPaysRR[0]['Comtes'][13]['Villages'][71]['Nom'] = 'Valence';
  383. InfosPaysRR[0]['Comtes'][13]['Villages'][72] = new Array();
  384. InfosPaysRR[0]['Comtes'][13]['Villages'][72]['Nom'] = 'Montélimar';
  385. InfosPaysRR[0]['Comtes'][13]['Villages'][73] = new Array();
  386. InfosPaysRR[0]['Comtes'][13]['Villages'][73]['Nom'] = 'Dié';
  387. InfosPaysRR[0]['Comtes'][13]['Villages'][74] = new Array();
  388. InfosPaysRR[0]['Comtes'][13]['Villages'][74]['Nom'] = 'Embrun';
  389. InfosPaysRR[0]['Comtes'][13]['Villages'][75] = new Array();
  390. InfosPaysRR[0]['Comtes'][13]['Villages'][75]['Nom'] = 'Briançon';
  391. InfosPaysRR[0]['Comtes'][13]['Villages'][166] = new Array();
  392. InfosPaysRR[0]['Comtes'][13]['Villages'][166]['Nom'] = 'Lyon';
  393. InfosPaysRR[0]['Comtes'][15] = new Array();
  394. InfosPaysRR[0]['Comtes'][15]['Nom'] = 'Comté de Flandres';
  395. InfosPaysRR[0]['Comtes'][15]['Villages'] = new Array();
  396. InfosPaysRR[0]['Comtes'][15]['Villages'][29] = new Array();
  397. InfosPaysRR[0]['Comtes'][15]['Villages'][29]['Nom'] = 'Dunkerque';
  398. InfosPaysRR[0]['Comtes'][15]['Villages'][38] = new Array();
  399. InfosPaysRR[0]['Comtes'][15]['Villages'][38]['Nom'] = 'Tournai';
  400. InfosPaysRR[0]['Comtes'][15]['Villages'][39] = new Array();
  401. InfosPaysRR[0]['Comtes'][15]['Villages'][39]['Nom'] = 'Gent';
  402. InfosPaysRR[0]['Comtes'][15]['Villages'][82] = new Array();
  403. InfosPaysRR[0]['Comtes'][15]['Villages'][82]['Nom'] = 'Antwerpen';
  404. InfosPaysRR[0]['Comtes'][15]['Villages'][161] = new Array();
  405. InfosPaysRR[0]['Comtes'][15]['Villages'][161]['Nom'] = 'Bruges';
  406. InfosPaysRR[0]['Comtes'][18] = new Array();
  407. InfosPaysRR[0]['Comtes'][18]['Nom'] = 'Comté du Languedoc';
  408. InfosPaysRR[0]['Comtes'][18]['Villages'] = new Array();
  409. InfosPaysRR[0]['Comtes'][18]['Villages'][89] = new Array();
  410. InfosPaysRR[0]['Comtes'][18]['Villages'][89]['Nom'] = 'Nîmes';
  411. InfosPaysRR[0]['Comtes'][18]['Villages'][90] = new Array();
  412. InfosPaysRR[0]['Comtes'][18]['Villages'][90]['Nom'] = 'Lodève';
  413. InfosPaysRR[0]['Comtes'][18]['Villages'][91] = new Array();
  414. InfosPaysRR[0]['Comtes'][18]['Villages'][91]['Nom'] = 'Béziers';
  415. InfosPaysRR[0]['Comtes'][18]['Villages'][92] = new Array();
  416. InfosPaysRR[0]['Comtes'][18]['Villages'][92]['Nom'] = 'Narbonne';
  417. InfosPaysRR[0]['Comtes'][18]['Villages'][93] = new Array();
  418. InfosPaysRR[0]['Comtes'][18]['Villages'][93]['Nom'] = 'Carcassonne';
  419. InfosPaysRR[0]['Comtes'][18]['Villages'][97] = new Array();
  420. InfosPaysRR[0]['Comtes'][18]['Villages'][97]['Nom'] = 'Alais';
  421. InfosPaysRR[0]['Comtes'][18]['Villages'][107] = new Array();
  422. InfosPaysRR[0]['Comtes'][18]['Villages'][107]['Nom'] = 'Mende';
  423. InfosPaysRR[0]['Comtes'][18]['Villages'][108] = new Array();
  424. InfosPaysRR[0]['Comtes'][18]['Villages'][108]['Nom'] = 'Uzès';
  425. InfosPaysRR[0]['Comtes'][18]['Villages'][326] = new Array();
  426. InfosPaysRR[0]['Comtes'][18]['Villages'][326]['Nom'] = 'Montpellier';
  427. InfosPaysRR[0]['Comtes'][20] = new Array();
  428. InfosPaysRR[0]['Comtes'][20]['Nom'] = 'Comté du Périgord';
  429. InfosPaysRR[0]['Comtes'][20]['Villages'] = new Array();
  430. InfosPaysRR[0]['Comtes'][20]['Villages'][101] = new Array();
  431. InfosPaysRR[0]['Comtes'][20]['Villages'][101]['Nom'] = 'Angoulême';
  432. InfosPaysRR[0]['Comtes'][20]['Villages'][102] = new Array();
  433. InfosPaysRR[0]['Comtes'][20]['Villages'][102]['Nom'] = 'Sarlat';
  434. InfosPaysRR[0]['Comtes'][20]['Villages'][103] = new Array();
  435. InfosPaysRR[0]['Comtes'][20]['Villages'][103]['Nom'] = 'Bergerac';
  436. InfosPaysRR[0]['Comtes'][20]['Villages'][104] = new Array();
  437. InfosPaysRR[0]['Comtes'][20]['Villages'][104]['Nom'] = 'Castillon';
  438. InfosPaysRR[0]['Comtes'][20]['Villages'][327] = new Array();
  439. InfosPaysRR[0]['Comtes'][20]['Villages'][327]['Nom'] = 'Périgueux';
  440. InfosPaysRR[0]['Comtes'][21] = new Array();
  441. InfosPaysRR[0]['Comtes'][21]['Nom'] = 'Duché d\'Orléans (Domaine Royal)';
  442. InfosPaysRR[0]['Comtes'][21]['Villages'] = new Array();
  443. InfosPaysRR[0]['Comtes'][21]['Villages'][111] = new Array();
  444. InfosPaysRR[0]['Comtes'][21]['Villages'][111]['Nom'] = 'Blois';
  445. InfosPaysRR[0]['Comtes'][21]['Villages'][112] = new Array();
  446. InfosPaysRR[0]['Comtes'][21]['Villages'][112]['Nom'] = 'Patay';
  447. InfosPaysRR[0]['Comtes'][21]['Villages'][113] = new Array();
  448. InfosPaysRR[0]['Comtes'][21]['Villages'][113]['Nom'] = 'Montargis';
  449. InfosPaysRR[0]['Comtes'][21]['Villages'][114] = new Array();
  450. InfosPaysRR[0]['Comtes'][21]['Villages'][114]['Nom'] = 'Gien';
  451. InfosPaysRR[0]['Comtes'][21]['Villages'][328] = new Array();
  452. InfosPaysRR[0]['Comtes'][21]['Villages'][328]['Nom'] = 'Orléans';
  453. InfosPaysRR[0]['Comtes'][22] = new Array();
  454. InfosPaysRR[0]['Comtes'][22]['Nom'] = 'Comté du Maine (Domaine Royal)';
  455. InfosPaysRR[0]['Comtes'][22]['Villages'] = new Array();
  456. InfosPaysRR[0]['Comtes'][22]['Villages'][125] = new Array();
  457. InfosPaysRR[0]['Comtes'][22]['Villages'][125]['Nom'] = 'Montmirail';
  458. InfosPaysRR[0]['Comtes'][22]['Villages'][126] = new Array();
  459. InfosPaysRR[0]['Comtes'][22]['Villages'][126]['Nom'] = 'Mayenne';
  460. InfosPaysRR[0]['Comtes'][22]['Villages'][133] = new Array();
  461. InfosPaysRR[0]['Comtes'][22]['Villages'][133]['Nom'] = 'Laval';
  462. InfosPaysRR[0]['Comtes'][22]['Villages'][329] = new Array();
  463. InfosPaysRR[0]['Comtes'][22]['Villages'][329]['Nom'] = 'Le Mans';
  464. InfosPaysRR[0]['Comtes'][23] = new Array();
  465. InfosPaysRR[0]['Comtes'][23]['Nom'] = 'Duché d\'Alençon (Domaine Royal)';
  466. InfosPaysRR[0]['Comtes'][23]['Villages'] = new Array();
  467. InfosPaysRR[0]['Comtes'][23]['Villages'][129] = new Array();
  468. InfosPaysRR[0]['Comtes'][23]['Villages'][129]['Nom'] = 'Mortagne';
  469. InfosPaysRR[0]['Comtes'][23]['Villages'][130] = new Array();
  470. InfosPaysRR[0]['Comtes'][23]['Villages'][130]['Nom'] = 'Verneuil';
  471. InfosPaysRR[0]['Comtes'][23]['Villages'][131] = new Array();
  472. InfosPaysRR[0]['Comtes'][23]['Villages'][131]['Nom'] = 'Argentan';
  473. InfosPaysRR[0]['Comtes'][23]['Villages'][330] = new Array();
  474. InfosPaysRR[0]['Comtes'][23]['Villages'][330]['Nom'] = 'Alençon';
  475. InfosPaysRR[0]['Comtes'][49] = new Array();
  476. InfosPaysRR[0]['Comtes'][49]['Nom'] = 'Duché de Guyenne';
  477. InfosPaysRR[0]['Comtes'][49]['Villages'] = new Array();
  478. InfosPaysRR[0]['Comtes'][49]['Villages'][257] = new Array();
  479. InfosPaysRR[0]['Comtes'][49]['Villages'][257]['Nom'] = 'La Teste-de-Buch';
  480. InfosPaysRR[0]['Comtes'][49]['Villages'][258] = new Array();
  481. InfosPaysRR[0]['Comtes'][49]['Villages'][258]['Nom'] = 'Bazas';
  482. InfosPaysRR[0]['Comtes'][49]['Villages'][259] = new Array();
  483. InfosPaysRR[0]['Comtes'][49]['Villages'][259]['Nom'] = 'Marmande';
  484. InfosPaysRR[0]['Comtes'][49]['Villages'][260] = new Array();
  485. InfosPaysRR[0]['Comtes'][49]['Villages'][260]['Nom'] = 'Agen';
  486. InfosPaysRR[0]['Comtes'][49]['Villages'][261] = new Array();
  487. InfosPaysRR[0]['Comtes'][49]['Villages'][261]['Nom'] = 'Montauban';
  488. InfosPaysRR[0]['Comtes'][49]['Villages'][262] = new Array();
  489. InfosPaysRR[0]['Comtes'][49]['Villages'][262]['Nom'] = 'Cahors';
  490. InfosPaysRR[0]['Comtes'][49]['Villages'][263] = new Array();
  491. InfosPaysRR[0]['Comtes'][49]['Villages'][263]['Nom'] = 'Blaye';
  492. InfosPaysRR[0]['Comtes'][49]['Villages'][461] = new Array();
  493. InfosPaysRR[0]['Comtes'][49]['Villages'][461]['Nom'] = 'Bordeaux';
  494. InfosPaysRR[0]['Comtes'][65] = new Array();
  495. InfosPaysRR[0]['Comtes'][65]['Nom'] = 'Duché de Gascogne';
  496. InfosPaysRR[0]['Comtes'][65]['Villages'] = new Array();
  497. InfosPaysRR[0]['Comtes'][65]['Villages'][364] = new Array();
  498. InfosPaysRR[0]['Comtes'][65]['Villages'][364]['Nom'] = 'Mimizan';
  499. InfosPaysRR[0]['Comtes'][65]['Villages'][365] = new Array();
  500. InfosPaysRR[0]['Comtes'][65]['Villages'][365]['Nom'] = 'Labrit';
  501. InfosPaysRR[0]['Comtes'][65]['Villages'][367] = new Array();
  502. InfosPaysRR[0]['Comtes'][65]['Villages'][367]['Nom'] = 'Dax';
  503. InfosPaysRR[0]['Comtes'][65]['Villages'][368] = new Array();
  504. InfosPaysRR[0]['Comtes'][65]['Villages'][368]['Nom'] = 'Bayonne';
  505. InfosPaysRR[0]['Comtes'][65]['Villages'][471] = new Array();
  506. InfosPaysRR[0]['Comtes'][65]['Villages'][471]['Nom'] = 'Mont-de-Marsan';
  507. InfosPaysRR[0]['Comtes'][66] = new Array();
  508. InfosPaysRR[0]['Comtes'][66]['Nom'] = 'Comté de Béarn';
  509. InfosPaysRR[0]['Comtes'][66]['Villages'] = new Array();
  510. InfosPaysRR[0]['Comtes'][66]['Villages'][366] = new Array();
  511. InfosPaysRR[0]['Comtes'][66]['Villages'][366]['Nom'] = 'Orthez';
  512. InfosPaysRR[0]['Comtes'][66]['Villages'][369] = new Array();
  513. InfosPaysRR[0]['Comtes'][66]['Villages'][369]['Nom'] = 'Mauléon';
  514. InfosPaysRR[0]['Comtes'][66]['Villages'][370] = new Array();
  515. InfosPaysRR[0]['Comtes'][66]['Villages'][370]['Nom'] = 'Tarbes';
  516. InfosPaysRR[0]['Comtes'][66]['Villages'][371] = new Array();
  517. InfosPaysRR[0]['Comtes'][66]['Villages'][371]['Nom'] = 'Lourdes';
  518. InfosPaysRR[0]['Comtes'][66]['Villages'][472] = new Array();
  519. InfosPaysRR[0]['Comtes'][66]['Villages'][472]['Nom'] = 'Pau';
  520. InfosPaysRR[0]['Comtes'][67] = new Array();
  521. InfosPaysRR[0]['Comtes'][67]['Nom'] = 'Comté d\'Armagnac et de Comminges';
  522. InfosPaysRR[0]['Comtes'][67]['Villages'] = new Array();
  523. InfosPaysRR[0]['Comtes'][67]['Villages'][372] = new Array();
  524. InfosPaysRR[0]['Comtes'][67]['Villages'][372]['Nom'] = 'Eauze';
  525. InfosPaysRR[0]['Comtes'][67]['Villages'][373] = new Array();
  526. InfosPaysRR[0]['Comtes'][67]['Villages'][373]['Nom'] = 'Lectoure';
  527. InfosPaysRR[0]['Comtes'][67]['Villages'][374] = new Array();
  528. InfosPaysRR[0]['Comtes'][67]['Villages'][374]['Nom'] = 'Muret';
  529. InfosPaysRR[0]['Comtes'][67]['Villages'][375] = new Array();
  530. InfosPaysRR[0]['Comtes'][67]['Villages'][375]['Nom'] = 'Saint-Liziers';
  531. InfosPaysRR[0]['Comtes'][67]['Villages'][376] = new Array();
  532. InfosPaysRR[0]['Comtes'][67]['Villages'][376]['Nom'] = 'Saint Bertrand de Comminges';
  533. InfosPaysRR[0]['Comtes'][67]['Villages'][473] = new Array();
  534. InfosPaysRR[0]['Comtes'][67]['Villages'][473]['Nom'] = 'Auch';
  535. InfosPaysRR[0]['Comtes'][68] = new Array();
  536. InfosPaysRR[0]['Comtes'][68]['Nom'] = 'Comté de Toulouse';
  537. InfosPaysRR[0]['Comtes'][68]['Villages'] = new Array();
  538. InfosPaysRR[0]['Comtes'][68]['Villages'][377] = new Array();
  539. InfosPaysRR[0]['Comtes'][68]['Villages'][377]['Nom'] = 'Foix';
  540. InfosPaysRR[0]['Comtes'][68]['Villages'][378] = new Array();
  541. InfosPaysRR[0]['Comtes'][68]['Villages'][378]['Nom'] = 'Castelnaudary';
  542. InfosPaysRR[0]['Comtes'][68]['Villages'][379] = new Array();
  543. InfosPaysRR[0]['Comtes'][68]['Villages'][379]['Nom'] = 'Castres';
  544. InfosPaysRR[0]['Comtes'][68]['Villages'][380] = new Array();
  545. InfosPaysRR[0]['Comtes'][68]['Villages'][380]['Nom'] = 'Albi';
  546. InfosPaysRR[0]['Comtes'][68]['Villages'][474] = new Array();
  547. InfosPaysRR[0]['Comtes'][68]['Villages'][474]['Nom'] = 'Toulouse';
  548. InfosPaysRR[0]['Comtes'][69] = new Array();
  549. InfosPaysRR[0]['Comtes'][69]['Nom'] = 'Comté de Rouergue';
  550. InfosPaysRR[0]['Comtes'][69]['Villages'] = new Array();
  551. InfosPaysRR[0]['Comtes'][69]['Villages'][381] = new Array();
  552. InfosPaysRR[0]['Comtes'][69]['Villages'][381]['Nom'] = 'Villefranche-de-Rouergue';
  553. InfosPaysRR[0]['Comtes'][69]['Villages'][382] = new Array();
  554. InfosPaysRR[0]['Comtes'][69]['Villages'][382]['Nom'] = 'Espalion';
  555. InfosPaysRR[0]['Comtes'][69]['Villages'][383] = new Array();
  556. InfosPaysRR[0]['Comtes'][69]['Villages'][383]['Nom'] = 'Millau';
  557. InfosPaysRR[0]['Comtes'][69]['Villages'][475] = new Array();
  558. InfosPaysRR[0]['Comtes'][69]['Villages'][475]['Nom'] = 'Rodez';
  559. InfosPaysRR[0]['Comtes'][100] = new Array();
  560. InfosPaysRR[0]['Comtes'][100]['Nom'] = 'ville franche';
  561. InfosPaysRR[2] = new Array();
  562. InfosPaysRR[2]['Nom'] = 'Sacrum Romanorum Imperium Nationis Germanicæ';
  563. InfosPaysRR[2]['Comtes'] = new Array();
  564. InfosPaysRR[2]['Comtes'][12] = new Array();
  565. InfosPaysRR[2]['Comtes'][12]['Nom'] = 'Franche-Comté';
  566. InfosPaysRR[2]['Comtes'][12]['Villages'] = new Array();
  567. InfosPaysRR[2]['Comtes'][12]['Villages'][64] = new Array();
  568. InfosPaysRR[2]['Comtes'][12]['Villages'][64]['Nom'] = 'Poligny';
  569. InfosPaysRR[2]['Comtes'][12]['Villages'][65] = new Array();
  570. InfosPaysRR[2]['Comtes'][12]['Villages'][65]['Nom'] = 'Saint Claude';
  571. InfosPaysRR[2]['Comtes'][12]['Villages'][66] = new Array();
  572. InfosPaysRR[2]['Comtes'][12]['Villages'][66]['Nom'] = 'Vesoul';
  573. InfosPaysRR[2]['Comtes'][12]['Villages'][67] = new Array();
  574. InfosPaysRR[2]['Comtes'][12]['Villages'][67]['Nom'] = 'Luxeuil';
  575. InfosPaysRR[2]['Comtes'][12]['Villages'][68] = new Array();
  576. InfosPaysRR[2]['Comtes'][12]['Villages'][68]['Nom'] = 'Pontarlier';
  577. InfosPaysRR[2]['Comtes'][12]['Villages'][165] = new Array();
  578. InfosPaysRR[2]['Comtes'][12]['Villages'][165]['Nom'] = 'Dole';
  579. InfosPaysRR[2]['Comtes'][14] = new Array();
  580. InfosPaysRR[2]['Comtes'][14]['Nom'] = 'Duché de Savoie';
  581. InfosPaysRR[2]['Comtes'][14]['Villages'] = new Array();
  582. InfosPaysRR[2]['Comtes'][14]['Villages'][78] = new Array();
  583. InfosPaysRR[2]['Comtes'][14]['Villages'][78]['Nom'] = 'Bourg';
  584. InfosPaysRR[2]['Comtes'][14]['Villages'][79] = new Array();
  585. InfosPaysRR[2]['Comtes'][14]['Villages'][79]['Nom'] = 'Belley';
  586. InfosPaysRR[2]['Comtes'][14]['Villages'][80] = new Array();
  587. InfosPaysRR[2]['Comtes'][14]['Villages'][80]['Nom'] = 'Annecy';
  588. InfosPaysRR[2]['Comtes'][14]['Villages'][167] = new Array();
  589. InfosPaysRR[2]['Comtes'][14]['Villages'][167]['Nom'] = 'Chambéry';
  590. InfosPaysRR[2]['Comtes'][16] = new Array();
  591. InfosPaysRR[2]['Comtes'][16]['Nom'] = 'Comté de Provence';
  592. InfosPaysRR[2]['Comtes'][16]['Villages'] = new Array();
  593. InfosPaysRR[2]['Comtes'][16]['Villages'][83] = new Array();
  594. InfosPaysRR[2]['Comtes'][16]['Villages'][83]['Nom'] = 'Marseille';
  595. InfosPaysRR[2]['Comtes'][16]['Villages'][85] = new Array();
  596. InfosPaysRR[2]['Comtes'][16]['Villages'][85]['Nom'] = 'Brignoles';
  597. InfosPaysRR[2]['Comtes'][16]['Villages'][96] = new Array();
  598. InfosPaysRR[2]['Comtes'][16]['Villages'][96]['Nom'] = 'Arles';
  599. InfosPaysRR[2]['Comtes'][16]['Villages'][331] = new Array();
  600. InfosPaysRR[2]['Comtes'][16]['Villages'][331]['Nom'] = 'Aix';
  601. InfosPaysRR[2]['Comtes'][29] = new Array();
  602. InfosPaysRR[2]['Comtes'][29]['Nom'] = 'Duché de Lorraine';
  603. InfosPaysRR[2]['Comtes'][29]['Villages'] = new Array();
  604. InfosPaysRR[2]['Comtes'][29]['Villages'][156] = new Array();
  605. InfosPaysRR[2]['Comtes'][29]['Villages'][156]['Nom'] = 'Epinal';
  606. InfosPaysRR[2]['Comtes'][29]['Villages'][158] = new Array();
  607. InfosPaysRR[2]['Comtes'][29]['Villages'][158]['Nom'] = 'Vaudemont';
  608. InfosPaysRR[2]['Comtes'][29]['Villages'][159] = new Array();
  609. InfosPaysRR[2]['Comtes'][29]['Villages'][159]['Nom'] = 'Toul';
  610. InfosPaysRR[2]['Comtes'][29]['Villages'][332] = new Array();
  611. InfosPaysRR[2]['Comtes'][29]['Villages'][332]['Nom'] = 'Nancy';
  612. InfosPaysRR[2]['Comtes'][32] = new Array();
  613. InfosPaysRR[2]['Comtes'][32]['Nom'] = 'Schweizerische Eidgenossenschaft';
  614. InfosPaysRR[2]['Comtes'][32]['Villages'] = new Array();
  615. InfosPaysRR[2]['Comtes'][32]['Villages'][180] = new Array();
  616. InfosPaysRR[2]['Comtes'][32]['Villages'][180]['Nom'] = 'Genève';
  617. InfosPaysRR[2]['Comtes'][32]['Villages'][182] = new Array();
  618. InfosPaysRR[2]['Comtes'][32]['Villages'][182]['Nom'] = 'Grandson';
  619. InfosPaysRR[2]['Comtes'][32]['Villages'][183] = new Array();
  620. InfosPaysRR[2]['Comtes'][32]['Villages'][183]['Nom'] = 'Fribourg';
  621. InfosPaysRR[2]['Comtes'][32]['Villages'][185] = new Array();
  622. InfosPaysRR[2]['Comtes'][32]['Villages'][185]['Nom'] = 'Sion';
  623.  
  624. /*InfosPaysRR[0] = new Array();
  625. InfosPaysRR[0]['Nom'] = 'Royaume de France';
  626. InfosPaysRR[0]['Comtes'] = new Array();
  627. InfosPaysRR[2] = new Array();
  628. InfosPaysRR[2]['Nom'] = 'Sacrum Romanorum Imperium Nationis Germanicæ';
  629. InfosPaysRR[2]['Comtes'] = new Array();
  630. InfosPaysRR[4] = new Array();
  631. InfosPaysRR[4]['Nom'] = 'Corona de Aragón';
  632. InfosPaysRR[4]['Comtes'] = new Array();
  633. InfosPaysRR[8] = new Array();
  634. InfosPaysRR[8]['Nom'] = 'Reino de Portugal';
  635. InfosPaysRR[8]['Comtes'] = new Array();
  636. InfosPaysRR[0]['Comtes'][0] = new Array();
  637. InfosPaysRR[0]['Comtes'][0]['Nom'] = 'Comté d\'Artois';
  638. InfosPaysRR[0]['Comtes'][1] = new Array();
  639. InfosPaysRR[0]['Comtes'][1]['Nom'] = 'Duché de Champagne (Domaine Royal)';
  640. InfosPaysRR[0]['Comtes'][3] = new Array();
  641. InfosPaysRR[0]['Comtes'][3]['Nom'] = 'Duché de Normandie (Domaine Royal)';
  642. InfosPaysRR[0]['Comtes'][4] = new Array();
  643. InfosPaysRR[0]['Comtes'][4]['Nom'] = 'Duché de Bretagne';
  644. InfosPaysRR[0]['Comtes'][5] = new Array();
  645. InfosPaysRR[0]['Comtes'][5]['Nom'] = 'Duché de Bourgogne';
  646. InfosPaysRR[0]['Comtes'][6] = new Array();
  647. InfosPaysRR[0]['Comtes'][6]['Nom'] = 'Duché du Berry';
  648. InfosPaysRR[0]['Comtes'][7] = new Array();
  649. InfosPaysRR[0]['Comtes'][7]['Nom'] = 'Duché du Bourbonnais-Auvergne';
  650. InfosPaysRR[0]['Comtes'][8] = new Array();
  651. InfosPaysRR[0]['Comtes'][8]['Nom'] = 'Duché de Touraine';
  652. InfosPaysRR[0]['Comtes'][9] = new Array();
  653. InfosPaysRR[0]['Comtes'][9]['Nom'] = 'Duché d\'Anjou';
  654. InfosPaysRR[0]['Comtes'][10] = new Array();
  655. InfosPaysRR[0]['Comtes'][10]['Nom'] = 'Comté du Poitou';
  656. InfosPaysRR[0]['Comtes'][11] = new Array();
  657. InfosPaysRR[0]['Comtes'][11]['Nom'] = 'Comté du Limousin et de La Marche';
  658. InfosPaysRR[0]['Comtes'][13] = new Array();
  659. InfosPaysRR[0]['Comtes'][13]['Nom'] = 'Duché du Lyonnais-Dauphiné';
  660. InfosPaysRR[0]['Comtes'][15] = new Array();
  661. InfosPaysRR[0]['Comtes'][15]['Nom'] = 'Comté de Flandres';
  662. InfosPaysRR[0]['Comtes'][18] = new Array();
  663. InfosPaysRR[0]['Comtes'][18]['Nom'] = 'Comté du Languedoc';
  664. InfosPaysRR[0]['Comtes'][20] = new Array();
  665. InfosPaysRR[0]['Comtes'][20]['Nom'] = 'Comté du Périgord';
  666. InfosPaysRR[0]['Comtes'][21] = new Array();
  667. InfosPaysRR[0]['Comtes'][21]['Nom'] = 'Duché d\'Orléans (Domaine Royal)';
  668. InfosPaysRR[0]['Comtes'][22] = new Array();
  669. InfosPaysRR[0]['Comtes'][22]['Nom'] = 'Comté du Maine (Domaine Royal)';
  670. InfosPaysRR[0]['Comtes'][23] = new Array();
  671. InfosPaysRR[0]['Comtes'][23]['Nom'] = 'Duché d\'Alençon (Domaine Royal)';
  672. InfosPaysRR[0]['Comtes'][49] = new Array();
  673. InfosPaysRR[0]['Comtes'][49]['Nom'] = 'Duché de Guyenne';
  674. InfosPaysRR[0]['Comtes'][65] = new Array();
  675. InfosPaysRR[0]['Comtes'][65]['Nom'] = 'Duché de Gascogne';
  676. InfosPaysRR[0]['Comtes'][66] = new Array();
  677. InfosPaysRR[0]['Comtes'][66]['Nom'] = 'Comté de Béarn';
  678. InfosPaysRR[0]['Comtes'][67] = new Array();
  679. InfosPaysRR[0]['Comtes'][67]['Nom'] = 'Comté d\'Armagnac et de Comminges';
  680. InfosPaysRR[0]['Comtes'][68] = new Array();
  681. InfosPaysRR[0]['Comtes'][68]['Nom'] = 'Comté de Toulouse';
  682. InfosPaysRR[0]['Comtes'][69] = new Array();
  683. InfosPaysRR[0]['Comtes'][69]['Nom'] = 'Comté de Rouergue';
  684. InfosPaysRR[2]['Comtes'][12] = new Array();
  685. InfosPaysRR[2]['Comtes'][12]['Nom'] = 'Franche-Comté';
  686. InfosPaysRR[2]['Comtes'][14] = new Array();
  687. InfosPaysRR[2]['Comtes'][14]['Nom'] = 'Duché de Savoie';
  688. InfosPaysRR[2]['Comtes'][16] = new Array();
  689. InfosPaysRR[2]['Comtes'][16]['Nom'] = 'Comté de Provence';
  690. InfosPaysRR[2]['Comtes'][17] = new Array();
  691. InfosPaysRR[2]['Comtes'][17]['Nom'] = 'Markgrafschaft von Baden';
  692. InfosPaysRR[2]['Comtes'][26] = new Array();
  693. InfosPaysRR[2]['Comtes'][26]['Nom'] = 'Grafschaft von Württemberg';
  694. InfosPaysRR[2]['Comtes'][29] = new Array();
  695. InfosPaysRR[2]['Comtes'][29]['Nom'] = 'Duché de Lorraine';
  696. InfosPaysRR[2]['Comtes'][30] = new Array();
  697. InfosPaysRR[2]['Comtes'][30]['Nom'] = 'Grafschaft von Augsburg';
  698. InfosPaysRR[2]['Comtes'][32] = new Array();
  699. InfosPaysRR[2]['Comtes'][32]['Nom'] = 'Schweizerische Eidgenossenschaft';
  700. InfosPaysRR[2]['Comtes'][33] = new Array();
  701. InfosPaysRR[2]['Comtes'][33]['Nom'] = 'Ducato di Milano';
  702. InfosPaysRR[2]['Comtes'][35] = new Array();
  703. InfosPaysRR[2]['Comtes'][35]['Nom'] = 'Graafschap Holland';
  704. InfosPaysRR[2]['Comtes'][37] = new Array();
  705. InfosPaysRR[2]['Comtes'][37]['Nom'] = 'Herzogtum von Bayern';
  706. InfosPaysRR[2]['Comtes'][44] = new Array();
  707. InfosPaysRR[2]['Comtes'][44]['Nom'] = 'Erzherzogtum von Österreich';
  708. InfosPaysRR[2]['Comtes'][54] = new Array();
  709. InfosPaysRR[2]['Comtes'][54]['Nom'] = 'Ducato di Modena';
  710. InfosPaysRR[2]['Comtes'][58] = new Array();
  711. InfosPaysRR[2]['Comtes'][58]['Nom'] = 'Repubblica di Genova';
  712. InfosPaysRR[2]['Comtes'][59] = new Array();
  713. InfosPaysRR[2]['Comtes'][59]['Nom'] = 'Burggrafschaft von Nürnberg';
  714. InfosPaysRR[2]['Comtes'][60] = new Array();
  715. InfosPaysRR[2]['Comtes'][60]['Nom'] = 'Fürstentum Mainz';
  716. InfosPaysRR[2]['Comtes'][70] = new Array();
  717. InfosPaysRR[2]['Comtes'][70]['Nom'] = 'Repubblica fiorentina';
  718. InfosPaysRR[2]['Comtes'][73] = new Array();
  719. InfosPaysRR[2]['Comtes'][73]['Nom'] = 'Herzogtum Steiermark';
  720. InfosPaysRR[2]['Comtes'][77] = new Array();
  721. InfosPaysRR[2]['Comtes'][77]['Nom'] = 'Repubblica di Siena';
  722. InfosPaysRR[4]['Comtes'][36] = new Array();
  723. InfosPaysRR[4]['Comtes'][36]['Nom'] = 'Principado de Cataluña';
  724. InfosPaysRR[4]['Comtes'][50] = new Array();
  725. InfosPaysRR[4]['Comtes'][50]['Nom'] = 'Reino de Valencia';
  726. InfosPaysRR[8]['Comtes'][41] = new Array();
  727. InfosPaysRR[8]['Comtes'][41]['Nom'] = 'Condado do Porto';
  728. InfosPaysRR[8]['Comtes'][56] = new Array();
  729. InfosPaysRR[8]['Comtes'][56]['Nom'] = 'Condado de Coimbra';
  730. InfosPaysRR[8]['Comtes'][72] = new Array();
  731. InfosPaysRR[8]['Comtes'][72]['Nom'] = 'Condado de Lisboa';*/
  732. /* Peuplement SELECT des select de Préférences **** Ajout 2016_02_24 */
  733.  
  734.  
  735. /************* Initialisations des fonctions globales *************/
  736.  
  737. function logit(msg) {
  738. var now = new Date();
  739. console.log(' @ ' + now.toTimeString().substring(0, 8) + '.' + now.getMilliseconds() + ': ' + msg);
  740. }
  741. function getNbJours(mois){
  742. var lgMois = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  743. return lgMois[mois]; // 0 < mois <11
  744. }
  745. function time_sleep_until (timestamp) {
  746. while (new Date() < timestamp * 1000) {}
  747. return true;
  748. }
  749. function pausecomp(ms) {
  750. currentTime = new Date().getTime();
  751. while (currentTime + ms >= new Date().getTime()) {
  752. }
  753. // while (new Date() < ms){}
  754. }
  755. function theHour() {
  756. var ladate=new Date()
  757. var h=ladate.getHours();
  758. if (h<10) {h = "0" + h};
  759. return (h);
  760. }
  761. function Personnage(nPseudo, nVillage, nComte, nPays, nStatus, nPR, nEcu, nNiveau, nMetier, nChamp1, nChamp2, date) {
  762. this.Pseudo = nPseudo;
  763. this.Village = nVillage;
  764. this.Comte = nComte;
  765. this.Pays = nPays;
  766. this.Status = nStatus;
  767. this.PR = nPR;
  768. this.Ecu = nEcu;
  769. this.Niveau = nNiveau;
  770. this.Metier = Number(nMetier);
  771. this.Champ1 = Number(nChamp1);
  772. this.Champ2 = Number(nChamp2);
  773. this.date = date;
  774. }
  775. function Present(nPseudo, nVillage, nComte, nPays, nStatus, nEcu) {
  776. this.Pseudo = nPseudo;
  777. this.Village = nVillage;
  778. this.Comte = nComte;
  779. this.Pays = nPays;
  780. this.Status = nStatus;
  781. this.Ecu = nEcu;
  782. }
  783. function aFraudeurs (Pseudo, Ecus, Stat, fDate) {
  784. this.Pseudo = Pseudo;
  785. this.Ecus = Ecus;
  786. this.Stat = Stat;
  787. this.fDate = fDate;
  788. }
  789. function Brigand(Pseudo, Motif, Date, Stat) {
  790. this.Pseudo = Pseudo;
  791. this.Motif = Motif;
  792. this.Date = Date;
  793. this.Stat = Stat;
  794. }
  795. function pluriel(n, t) {
  796. if (n > 1)
  797. return(t + 's');
  798. else
  799. return(t);
  800. }
  801. function siOnglet(x, t) {
  802. var el = document.getElementById("chaineNavigation");
  803. if (el.innerHTML.indexOf(x) == -1) {
  804. if (t != "")
  805. alert(t);
  806. return(0);
  807. }
  808. return(1);
  809. }
  810. function QuelOnglet() {
  811. var xBarre = document.getElementsByClassName("texteOnglet")[0];
  812. if (xBarre != null) {
  813. return (xBarre.innerHTML);
  814. } else {
  815. return("");
  816. }
  817. }
  818. function Apropos() {
  819. var m = RRpopup.init("RRleGuet", 1), t = "";
  820. t += "<h1>RReasy : Le Guet du RR...<br> et bien d'autres choses...</h1>";
  821. t += "<b>RReasy</b> est un script réalisé par <a href='FichePersonnage.php?login=favdb'>Favdb</a>, , modifié et aménagé par <a href='#' onClick='javascript:popupPerso(\"FichePersonnage.php?login=Cigalou01\")'>Cigalou01</a>";
  822. t += "<p><b>Versions:</b></p>";
  823. t += '<table cellspacing="2">\n';
  824. for (var i = 0; i < lVersions.length; i++) {
  825. t += '<tr style="font-size:10px">\n';
  826. t += '<td valign="top">' + lVersions[i][0] + '</td>\n';
  827. t += '<td valign="top">' + lVersions[i][2] + '</td>\n';
  828. t += '<td valign="top">' + lVersions[i][1] + '</td>\n';
  829. t += '</tr>\n';
  830. }
  831. t += "</table\n";
  832. RRpopup.setMessage(m, t + "<p>");
  833. ClipboardCopyTo(t);
  834. RRpopup.fermeture(m);
  835. }
  836. function getData(Src, d, f) {
  837. var p1 = Src.indexOf(d);
  838. if (p1 == -1)
  839. return("");
  840. p1 += d.length;
  841. var p2 = Src.indexOf(f, p1);
  842. if (p2 == -1)
  843. return("");
  844. return(Src.substring(p1, p2));
  845. }
  846. function triPseudo(a, b) {
  847. var aa = a.Pseudo, bb = b.Pseudo;
  848. var len = Math.min(aa.length, bb.length);
  849. for (i = 0; i < len; i++) {
  850. if (aa.charCodeAt(i) != bb.charCodeAt(i)) {
  851. return(aa.charCodeAt(i) - bb.charCodeAt(i));
  852. }
  853. }
  854. if (aa.length > len)
  855. return(1);
  856. if (bb.length > len)
  857. return(-1);
  858. return(0);
  859. }
  860. function AjouterMission() {
  861. var i = PersoMission;
  862. if (PersoJour != mDate) {
  863. PersoMission++;
  864. GM_setValue("PersoMission_"+mVille, PersoMission);
  865. }
  866. }
  867. function GetLocalisation(Src) {
  868.  
  869. }
  870. function SectionArmee(Src) {
  871. var x = getData(HtmlToString(Src), "Vous appartenez à l'armée ", "<form action=\"Action.php?action=150\"");
  872. x = str_replace(x, "</p>", "\n");
  873. x = str_replace(x, "<form", "\n<form");
  874. var y = x.split("\n"), i = 0, z = 0;
  875. x = "";
  876. for (i = 0; i < y.length; i++) {
  877. z = 0;
  878. if (y[i].indexOf("Salaire") != -1)
  879. z = 1;
  880. if (y[i].indexOf("Quitter") != -1)
  881. z = 1;
  882. if (y[i].indexOf("Si vous cliquez") != -1)
  883. z = 1;
  884. if (y[i].indexOf("Aucun ordre passé") != -1)
  885. z = 1;
  886. if (y[i].indexOf("Offres de vente") != -1)
  887. z = 1;
  888. if (y[i].indexOf("Vous pouvez donner") != -1)
  889. z = 1;
  890. if (y[i].indexOf("form method=") != -1)
  891. z = 1;
  892. if (y[i].indexOf("Encombrement") != -1)
  893. z = 1;
  894. if (y[i].indexOf("logistique") != -1)
  895. z = 1;
  896. if (y[i].indexOf("<div") != -1)
  897. z = 1;
  898. if (z == 0) {
  899. if (y[i].indexOf("Renvoyer") != -1)
  900. y[i] = y[i].substring(0, y[i].indexOf(" - <a class=\"boutonAction\""));
  901. if (y[i].length > 1)
  902. x += y[i] + "\n";
  903. }
  904. }
  905. x = BBc.fromHTML(x);
  906. x = str_replace(x, "\n\n", "\n");
  907. x = "Vous êtes dans l'armée " + x;
  908. return(x);
  909. }
  910. function VousAppartenez(Src) {
  911. var resu = "";
  912. resu += Src + "\n\n";
  913. var pp1 = 0, pp2 = 0, nx = 0;
  914. if (Src.indexOf("Vous appartenez ") != -1) {
  915. if (Src.indexOf("Vous appartenez &agrave; l\\'arm&eacute;e") != -1) {
  916. resu = SectionArmee(Src);
  917. } else {
  918. var xSrc = Src.substring(0, Src.indexOf("</li>"));
  919. resu = "[b]Vous appartenez à un groupe armé[/b] qui comprend aussi";
  920. pp1 = xSrc.indexOf("login=", pp2);
  921. pp2 = xSrc.indexOf("'", pp1);
  922. nx = 0;
  923. while ((pp1 != -1) && (pp2 != -1)) {
  924. resu += (nx > 0 ? ", " : " ");
  925. resu += Perso.lienBBcode(xSrc.substring(pp1 + 6, pp2));
  926. pp1 = xSrc.indexOf("login=", pp2);
  927. pp2 = xSrc.indexOf("'", pp1);
  928. nx++;
  929. }
  930. }
  931. resu += "\n";
  932. }
  933. return(resu);
  934. }
  935. function GetListeEscouade(Src) {
  936. if (Src.length < 1)
  937. GetListeEscouade(Src.substring(Src.indexOf("textePage[4]['Texte']")))
  938. var x = VousAppartenez(Src);
  939. if (x.indexOf("armée") != -1)
  940. return(x);
  941. if (x.indexOf("[url=") > 0)
  942. x = x.substring(x.indexOf("[url="), x.length - 1);
  943. else
  944. x = "";
  945. return(x);
  946. }
  947. function GetListeGroupes(Src) {
  948. var resu = "";
  949. resu = "[b]Groupes présents :[/b]";
  950. var nb = 0;
  951. if (Src.indexOf("Groupes présents ici :</li><ul>") == -1) {
  952. if (Src.indexOf("Groupes pr&eacute;sents ici :</li><ul>") == -1) {
  953. alert("L'information est impossible à analyser!");
  954. return(resu + "L'information est impossible à analyser!");
  955. }
  956. }
  957. var p1 = 0, p2 = 0;
  958. p1 = Src.indexOf("<tr class=\"ligneGroupe1\">", 0);
  959. p2 = Src.indexOf("</td></tr>", p1) + "</td></tr>".length;
  960. var xSrc = Src.substring(p1, p2);
  961. var pp1 = 0, pp2 = 0;
  962. while ((p1 != -1) && (p2 != -1)) {
  963. pp1 = xSrc.indexOf("<td colspan=\"2\">", pp1) + "<td colspan=\"2\">".length;
  964. pp2 = xSrc.indexOf("<", pp1);
  965. if (xSrc.substring(pp1, pp2) == "Corps d\\'armes de ")
  966. resu += "\n" + "Corps d'armes de ";
  967. else
  968. resu += "\n" + xSrc.substring(pp1, pp2);
  969. pp1 = xSrc.indexOf("login=", pp2);
  970. pp2 = xSrc.indexOf("')\">", pp1);
  971. nx = 0;
  972. while ((pp1 != -1) && (pp2 != -1)) {
  973. if (nx > 0) {
  974. resu += ", ";
  975. }
  976. resu += Perso.lienBBcode(xSrc.substring(pp1 + 6, pp2));
  977. pp1 = xSrc.indexOf("login=", pp2);
  978. if (pp1 != -1)
  979. pp2 = xSrc.indexOf("')\">", pp1);
  980. nx++;
  981. }
  982. p1 = Src.indexOf("<tr class=\"ligneGroupe1\">", p2);
  983. p2 = Src.indexOf("</td></tr>", p1) + "</td></tr>".length;
  984. if ((p1 != -1) && (p2 != -1))
  985. xSrc = Src.substring(p1, p2);
  986. nb++;
  987. pp1 = 0;
  988. pp2 = 0;
  989. }
  990. p1 = Src.indexOf("</ul><li>Contr", 0);
  991. p1 = Src.indexOf("</li><ul><li>", 0) + "</li><ul><li>".length;
  992. p2 = Src.indexOf("<", p1);
  993. resu += "\n" + cvCar(Src.substring(p1, p2)) + "\n";
  994. return(resu);
  995. }
  996. function GetNiveauAlerte() {
  997. var i = 0, n = ["Vert", "Jaune", "Orange", "Rouge", "Armée", "inconnu"], x = "Niveaud'alerte";
  998. for (i = 0; i < n.length; i++)
  999. x += "\n" + (i + 1) + "=" + n[i];
  1000. var z = window.prompt(x, "");
  1001. i = parseInt(z);
  1002. if ((i > 0) && (i < n.length))
  1003. x = n[i - 1] + " [img]http://fa.vdb.free.fr/RR/bouton" + n[i - 1] + ".gif[/img]";
  1004. else
  1005. x = "inconnu";
  1006. return(x);
  1007. }
  1008. function GetOrdreDuJour() {
  1009. var i = 0,
  1010. x = "Ordre du jour",
  1011. n = ["vous pouvez travailler", "travail invisible", "patrouille/escorte", "défense du pouvoir", "suivre l'armée", "inconnu"];
  1012. for (i = 0; i < n.length; i++)
  1013. x += "\n" + (i + 1) + "=" + n[i];
  1014. var z = window.prompt(x, "");
  1015. i = parseInt(z);
  1016. if ((i > 0) && (i < n.length))
  1017. x = n[i - 1];
  1018. else
  1019. x = "inconnu";
  1020. return(x);
  1021. }
  1022. function str_replace(SRs, SRt, SRu) {
  1023. if (SRs == undefined)
  1024. return("?");
  1025. var SRRi = SRs.indexOf(SRt);
  1026. var SRRr = '';
  1027. if (SRRi == -1)
  1028. return SRs;
  1029. SRRr += SRs.substring(0, SRRi) + SRu;
  1030. if (SRRi + SRt.length < SRs.length)
  1031. SRRr += str_replace(SRs.substring(SRRi + SRt.length, SRs.length), SRt, SRu);
  1032. return SRRr;
  1033. }
  1034. function ClipboardCopyTo(s) {
  1035. if (window.clipboardData) {
  1036. window.clipboardData.setData("Text", s);
  1037. }
  1038. else {
  1039. GM_setClipboard(s);
  1040. }
  1041. return(false);
  1042. }
  1043. function HtmlToString(Src) {
  1044. var spec = new Array("&eacute;", "&Eacute;", "&egrave;", "&ecirc;", "&euml;",
  1045. "&agrave;", "&acirc;", "&icirc;", "&iuml;", "&quot;", "&nbsp;", "&ocirc;", "&ucirc;", "â", "<br>", "<br />", "\\'");
  1046. var norm = new Array("é", "É", "è", "ê", "ë", "à", "â", "î", "ï", "'", " ", "ô", "û", "â", "\n", "\n", "'");
  1047. for (var i = 0; i < spec.length; i++) {
  1048. Src = str_replace(Src, spec[i], norm[i]);
  1049. }
  1050. return(Src);
  1051. }
  1052. function cvCar(x) {
  1053. var spec = new Array(
  1054. "é",
  1055. "É",
  1056. "è",
  1057. "e_circonflexe",
  1058. "e_trema",
  1059. "Ã",
  1060. "ê",
  1061. "à®",
  1062. "ï",
  1063. "û",
  1064. "ç",
  1065. "à§",
  1066. "ô",
  1067. "à¦",
  1068. "à´",
  1069. "à¼",
  1070. "à¢",
  1071. "àª",
  1072. "Â" //â
  1073. );
  1074. var norm = new Array(
  1075. "é",
  1076. "É",
  1077. "è",
  1078. "ê",
  1079. "ë",
  1080. "à",
  1081. "â",
  1082. "î",
  1083. "ï",
  1084. "û",
  1085. "ç",
  1086. "ç",
  1087. "ô",
  1088. "ae",
  1089. "ô",
  1090. "ü",
  1091. "â",
  1092. "ê",
  1093. ""
  1094. );
  1095. for (var i = 0; i < spec.length; i++) {
  1096. // logit ("cvCar l. 3572 : x-Spec-Norm : '" + x + "' - '" + spec[i] + "' - '" + norm[i] + "'");
  1097. x = str_replace(x, spec[i], norm[i]);
  1098. }
  1099. return(x);
  1100. }
  1101. function TexTConvert(text, body) {
  1102. var StrErr = String.fromCharCode(65535);
  1103. var result = "";
  1104. var code = "";
  1105. var len = 0;
  1106. var begin = 0;
  1107. var ptr = 0;
  1108. while ((pos = text.substring(begin).indexOf(StrErr)) != -1) {
  1109. ptr += pos;
  1110. code = bcode(body, ptr);
  1111. if (code <= 191)
  1112. len = 1;
  1113. else if (code <= 223)
  1114. len = 2;
  1115. else if (code <= 239)
  1116. len = 3;
  1117. else if (code <= 247)
  1118. len = 4;
  1119. else if (code <= 251)
  1120. len = 5;
  1121. else if (code <= 253)
  1122. len = 6;
  1123. else
  1124. len = 1;
  1125. if (code == 255)
  1126. result += text.substring(begin, pos + begin) + b2s(body, ptr, 0);
  1127. else
  1128. result += text.substring(begin, pos + begin) + b2s(body, ptr, ptr + len);
  1129. ptr += len;
  1130. if (code == 255)
  1131. begin = text.length;
  1132. else
  1133. begin += pos + 1;
  1134. }
  1135. result += text.substring(begin);
  1136. return(result);
  1137. }
  1138. function stringToDate(x) {
  1139. var z = x.split(" ");
  1140. if (isNaN(z[0])) {
  1141. z[0] = z[1];
  1142. z[1] = z[2];
  1143. z[2] = z[3];
  1144. }
  1145. var m = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
  1146. var i = 0;
  1147. for (i = 0; i < m.length; i++) {
  1148. if (HtmlToString(m[i]) == z[1])
  1149. break;
  1150. }
  1151. if (i == m.length)
  1152. i = 7;
  1153. return((z[0].length < 2 ? "0" + z[0] : z[0]) + "/" + (i < 9 ? "0" + (i + 1) : (i + 1)) + "/" + z[2]);
  1154. }
  1155. function difDate(str1, str2) {
  1156. var dt1 = Number(str1.substring(0, 2));
  1157. var mon1 = Number(str1.substring(3, 5));
  1158. var yr1 = Number(str1.substring(6, 10));
  1159. var dt2 = Number(str2.substring(0, 2));
  1160. var mon2 = Number(str2.substring(3, 5));
  1161. var yr2 = Number(str2.substring(6, 10));
  1162. var d1 = new Date(yr1, mon1 - 1, dt1);
  1163. var d2 = new Date(yr2, mon2 - 1, dt2);
  1164. var milli_d1 = d1.getTime();
  1165. var milli_d2 = d2.getTime();
  1166. var diff = milli_d1 - milli_d2;
  1167. var num_days = diff / 86400000;
  1168. return(num_days);
  1169. }
  1170. function SendXMLHttpRequest(Method, Url, Message, CallBack, Obj) {
  1171. var xhr_object = null;
  1172. var URLParam = "";
  1173. if (window.XMLHttpRequest) {
  1174. xhr_object = new XMLHttpRequest();
  1175. if (xhr_object.overrideMimeType)
  1176. xhr_object.overrideMimeType('text/html; charset=iso-8859-1');
  1177. }
  1178. else if (window.ActiveXObject)
  1179. xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
  1180. else {
  1181. alert("impossible de créer le xhr_object");
  1182. return(false);
  1183. }
  1184. if (Method == "GET")
  1185. URLParam = "?" + Message;
  1186. try {
  1187. xhr_object.open(Method, Url + URLParam, true);
  1188. } catch (e) {
  1189. alert("erreur sur xhr_object.open(" + Method + ", " + Url + URLParam + ", true)");
  1190. return(false);
  1191. }
  1192. xhr_object.onreadystatechange = function () {
  1193. if (xhr_object.readyState == 4) {
  1194. if (CallBack != undefined) {
  1195. if (Obj == undefined)
  1196. CallBack(TexTConvert(xhr_object.responseText, xhr_object.responseBody));
  1197. else
  1198. Obj[CallBack](TexTConvert(xhr_object.responseText, xhr_object.responseBody));
  1199. }
  1200. }
  1201. }
  1202. if (Method == "GET") {
  1203. xhr_object.send(null);
  1204. }
  1205. else {
  1206. xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=iso-8859-1");
  1207. xhr_object.setRequestHeader("Content-length", Message.length);
  1208. xhr_object.send(Message);
  1209. }
  1210. return(true);
  1211. }
  1212. function Produit(cat, image, nom, dispo) {
  1213. this.Cat = cat;
  1214. this.Image = image;
  1215. this.Nom = nom;
  1216. this.Dispo = dispo;
  1217. }
  1218.  
  1219. function Marche_surv(x) {
  1220. Marche.surv(x);
  1221. }
  1222. // codes pour table en BB code
  1223. var BBc = {
  1224. dtr: "[tr]",
  1225. ftr: "[/tr]\n",
  1226. dtd: "[td]",
  1227. ftd: "[/td]",
  1228. db: "[b]",
  1229. fb: "[/b]",
  1230. dftd: "[td][/td]",
  1231. dtdN: function (n) {
  1232. if (n > 1)
  1233. return ('[td colspan="' + n + ']');
  1234. return ('[td]');
  1235. },
  1236. toHTML: function (xt) {
  1237. if (xt != "") {
  1238. xt = str_replace(xt, "[url=", "<a href=");
  1239. xt = str_replace(xt, "[/url]", "</a>");
  1240. xt = str_replace(xt, "[color", "<font color");
  1241. xt = str_replace(xt, "[/color", "</font");
  1242. xt = str_replace(xt, "]", ">");
  1243. xt = str_replace(xt, "[", "<");
  1244. xt = str_replace(xt, "\n", "<br>");
  1245. }
  1246. return(xt);
  1247. },
  1248. fromHTML: function (x) {
  1249. var xt = x;
  1250. if (xt != "") {
  1251. xt = str_replace(xt, " class=\"lien_default lienPerso\"", "");
  1252. if (xt.indexOf("href=\"javascript:popupPerso('") != -1) {
  1253. xt = str_replace(xt, "href=\"javascript:popupPerso('", "http://www.lesroyaumes.com/");
  1254. xt = str_replace(xt, "')\"", "");
  1255. }
  1256. xt = str_replace(xt, ' target="_blank"', "");
  1257. xt = str_replace(xt, "<br>", "\n");
  1258. xt = str_replace(xt, "<br />", "\n");
  1259. xt = str_replace(xt, "<p>", "\n");
  1260. xt = str_replace(xt, "</p>", "\n");
  1261. xt = str_replace(xt, "<a href=\"", "[url=");
  1262. xt = str_replace(xt, "<a href=", "[url=");
  1263. xt = str_replace(xt, "<a ", "[url=");
  1264. xt = str_replace(xt, '"]', "]");
  1265. xt = str_replace(xt, "</a>", "[/url]");
  1266. xt = str_replace(xt, "<font size=\"1\">", "");
  1267. xt = str_replace(xt, "</font>", "");
  1268. xt = str_replace(xt, "<font color", "[color");
  1269. xt = str_replace(xt, "</font >", "[/color]");
  1270. xt = str_replace(xt, ">", "]");
  1271. xt = str_replace(xt, "<", "[");
  1272. xt = str_replace(xt, '"]', "]");
  1273. xt = str_replace(xt, "&nbsp;", " ");
  1274. }
  1275. return(xt);
  1276. }
  1277. }
  1278.  
  1279. var Bar = {
  1280. initStyle: function () {
  1281. var insertStyle = null;
  1282. var menuStyle = document.createElement("style");
  1283. var s = "";
  1284. s += '<style type="text/css">';
  1285. s += '#progressbar';
  1286. s += '{ position:relative; width:200px; padding:0 0 0 0; ';
  1287. s += 'height:14px; border:1px solid #CCC; -moz-border-radius:2px; border-radius:2px; z-index:1;}';
  1288. s += '#indicator';
  1289. s += '{ position:absolute; left:0; top:0; width:0px; background-color: #158bc8;';
  1290. s += 'height:14px; margin:0 0 0 0; z-index:2;}';
  1291. s += '</style>';
  1292. menuStyle.innerHTML = s;
  1293. document.body.insertBefore(menuStyle, insertStyle);
  1294. },
  1295. debut: function (titre, zoneTexte) {
  1296. var el = document.getElementById(zoneTexte);
  1297. if (el == null) {
  1298. alert("Pour cette fonction vous devez aller au tribunal");
  1299. return;
  1300. }
  1301. SaveIG = el.innerHTML;
  1302. Bar.initStyle();
  1303. el.innerHTML = "<h1>" + titre + "</h1>";
  1304. el.innerHTML += '<div id="progressionGuet"></div>';
  1305. el.innerHTML += '<div id="progressbar"><div id="indicator"></div></div>';
  1306. el.innerHTML += '<div id="texteGuet"></div>';
  1307. el.innerHTML += '<div id="messageGuet"></div>';
  1308. },
  1309. setTexte: function (t) {
  1310. document.getElementById("texteGuet").innerHTML = t;
  1311. },
  1312. setMessage: function (t) {
  1313. document.getElementById("messageGuet").innerHTML = t;
  1314. },
  1315. addMessage: function (t) {
  1316. document.getElementById("messageGuet").innerHTML += t;
  1317. },
  1318. progression: function (t, z) {
  1319. var m = document.getElementById("progressionGuet").innerHTML = t;
  1320. var indicator = document.getElementById("indicator");
  1321. if (z == -1) {
  1322. document.getElementById("progressbar").style.display = 'none';
  1323. indicator.style.display = 'none';
  1324. }
  1325. else {
  1326. document.getElementById("progressbar").style.display = 'block';
  1327. indicator.style.display = 'block';
  1328. indicator.style.width = (z * 2) + "px";
  1329. }
  1330. },
  1331. fermeture: function (m) {
  1332. m.document.getElementById("fermeture").innerHTML += "<input type=\"submit\" onClick=\"javascript:Bar.fin();\" value=\"" + "Fermer" + "\">&nbsp;&nbsp;";
  1333. },
  1334. fin: function () {
  1335. var el = document.getElementById("zoneTexte1");
  1336. el.innerHTML = SaveIG;
  1337. }
  1338. }
  1339.  
  1340. var RRpopup = {
  1341. init: function (titre, avecIcone) {
  1342. var width = 'width=800', height = 'height=600',
  1343. left = 'left=0', top = 'top=0';
  1344. if (window.innerWidth) {
  1345. left = 'left=' + (window.innerWidth - width) / 2;
  1346. top = 'top=' + (window.innerHeight - height) / 2;
  1347. }
  1348. else {
  1349. left = 'left=' + (document.body.clientWidth - width) / 2;
  1350. top = 'top=' + (document.body.clientHeight - height) / 2;
  1351. }
  1352. // ouvre une fenetre sans barre d'etat, ni d'ascenceur
  1353. mdlg = window.open("", 'popup' + titre, top + ',' + left + ',' + width + ',' + height +
  1354. ',menubar=no,toolbar=no,location=no,scrollbars=yes,resizable=yes,status=no');
  1355. var wmdlg = mdlg.document;
  1356. var xzx = "";
  1357. xzx = "";
  1358. xzx += ("<link href='http://www.lesroyaumes.com/styles/structure_EP.css' rel='stylesheet' type='text/css' />");
  1359. xzx += ("<link href='http://fonts.googleapis.com/css?family=Copse' rel='stylesheet' type='text/css'>");
  1360. xzx += ("<div class='zone_texte'>");
  1361. xzx += (" <div class='element elementTop'></div>");
  1362. xzx += (" <div class='element elementRepeat'>");
  1363. if (avecIcone)
  1364. xzx += (" <div class='texte'>");
  1365. else
  1366. xzx += (" <div class='texte texteLarge'>");
  1367. xzx += (" <div align='left'>");
  1368. xzx += (" <div id='texteGuet'></div>");
  1369. xzx += (" <div id='messageGuet'></div>");
  1370. xzx += ("<style type=\"text/css\">");
  1371. xzx += ("#progressbar");
  1372. xzx += ("{ position:relative; width:300px; padding:0 0 0 0; ");
  1373. xzx += (" height:12px; border:1px solid #CCC; -moz-border-radius:2px; border-radius:2px; z-index:1;}");
  1374. xzx += ("#indicator");
  1375. xzx += ("{ position:absolute; left:0; top:0; width:0px; background-color: #158bc8;");
  1376. xzx += (" height:14px; margin:0 0 0 0; z-index:2;}");
  1377. xzx += ("</style>");
  1378. xzx += (" <div id='progressionGuet'></div>");
  1379. xzx += (" <div id=\"progressbar\"><div id=\"indicator\"></div></div>");
  1380. xzx += (" <div id='fermeture'></div>");
  1381. xzx += (" </div>");
  1382. xzx += (" </div>");
  1383. xzx += (" </div>");
  1384. if (avecIcone) {
  1385. xzx += (" <div class='illustration'>");
  1386. xzx += (" <div class='illustrationImage'>");
  1387. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoins illustrationImageDecosCoinsTopLeft'></div>");
  1388. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoins illustrationImageDecosCoinsTopRight'></div>");
  1389. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoins illustrationImageDecosCoinsBottomLeft'></div>");
  1390. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoins illustrationImageDecosCoinsBottomRight'></div>");
  1391. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoteHorizontal illustrationImageDecosCoteHorizontal1'></div>");
  1392. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoteHorizontal illustrationImageDecosCoteHorizontal2'></div>");
  1393. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoteVertical illustrationImageDecosCoteVertical1'></div>");
  1394. xzx += (" <div class='illustrationImageDecos illustrationImageDecosCoteVertical illustrationImageDecosCoteVertical2'></div>");
  1395. xzx += (" <img src='images/deplacement_gpes_armees.jpg' alt='%PanneauImageAlt%'>");
  1396. xzx += (" </div>");
  1397. xzx += (" </div>");
  1398. }
  1399. xzx += (" </div>");
  1400. xzx += (" <div class='element elementBottom'></div>");
  1401. xzx += ("</div>");
  1402. xzx += ("</body>");
  1403. mdlg.document.body.innerHTML = xzx;
  1404. return mdlg;
  1405. },
  1406. setTexte: function (m, t) {
  1407. m.document.getElementById("texteGuet").innerHTML = t;
  1408. },
  1409. setMessage: function (m, t) {
  1410. m.document.getElementById("messageGuet").innerHTML = t;
  1411. },
  1412. addMessage: function (m, t) {
  1413. m.document.getElementById("messageGuet").innerHTML += t;
  1414. },
  1415. getMessage: function (m) {
  1416. return(m.document.getElementById("messageGuet").innerHTML);
  1417. },
  1418. progression: function (m, t, z) {
  1419. m.document.getElementById("progressionGuet").innerHTML = t;
  1420. var indicator = m.document.getElementById("indicator");
  1421. if (z == -1) {
  1422. m.document.getElementById("progressbar").style.display = 'none';
  1423. indicator.style.display = 'none';
  1424. }
  1425. else {
  1426. m.document.getElementById("progressbar").style.display = 'block';
  1427. indicator.style.display = 'block';
  1428. indicator.style.width = (z * 3) + "px";
  1429. }
  1430. },
  1431. terminer: function (m) {
  1432. mdlg.close();
  1433. mdlg = null;
  1434. },
  1435. addBouton: function (m, titre, fn) {
  1436. m.document.getElementById("fermeture").innerHTML += '&nbsp;<span id="' + titre + '">&nbsp;</span>';
  1437. var xa = m.document.createElement("input");
  1438. xa.setAttribute('type', 'button');
  1439. xa.setAttribute('id', titre);
  1440. xa.setAttribute('value', titre);
  1441. xa.onclick = function () {
  1442. fn();
  1443. return false;
  1444. }
  1445. m.document.getElementById(titre).appendChild(xa);
  1446. },
  1447. fermeture: function (m) {
  1448. m.document.getElementById("fermeture").innerHTML += "<input type=\"submit\" onClick=\"javascript:window.close();\" value=\"" + "Fermer" + "\">&nbsp;&nbsp;";
  1449. }
  1450. }
  1451. var Dossier = {
  1452. debut: function () {
  1453. if (QuelOnglet() != "Mon personnage") {
  1454. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', Dossier.faire);//Mon Personnage
  1455. return;
  1456. }
  1457. Dossier.faire(document.getElementsByTagName("body")[0].innerHTML);
  1458. },
  1459. faire: function (Src) {
  1460. //RRmenu.enVille();
  1461. if ((hPersos == undefined)||(hPersos == "00/00/0000"))
  1462. hPersos = mDate;
  1463. if (PersoGrade == "") PersoGrade = "--";
  1464. if (PersoGarnison == "") PersoGarnison = "--";
  1465. if (PersoEscouade == "") PersoEscouade = "--";
  1466. LeRapport = "[table cellspacing=\"0\" border=\"0\"]\n";
  1467. LeRapport += Dossier.fTable("Nom : ", "", "", "", db + Perso.lienBBcode(Perso.getPseudo()) + fb);
  1468. LeRapport += Dossier.fTable("Statut : ", db + "Actif" + fb, "", "", "");
  1469. LeRapport += Dossier.fTable("Date MAJ : ", "", "", "", db + mDate + fb);
  1470. LeRapport += Dossier.fTable("Niveau : ", db + Perso.getNiveau(Src) + fb, "", "", "");
  1471. LeRapport += Dossier.fTable("Réputation : ", db + Perso.getPR(Src) + fb, "", "", "");
  1472. LeRapport += Dossier.fTable("", "", "", "", "Encombrement : ");
  1473. var z = str_replace(Perso.getEncombrement(Src), "Encombrement : ", "");
  1474. LeRapport += Dossier.fTable(" ", "", "actuel : ", db + z.substring(0, z.indexOf('/')) + fb, "");
  1475. LeRapport += Dossier.fTable(" ", "", "maximum : ", db + z.substring(z.indexOf('/') + 1) + fb, "");
  1476. LeRapport += Dossier.fTable(" ", "", "charrette : ", db + Perso.getCharrette(Src) + fb, "");
  1477. LeRapport += Dossier.fTable("", "", "", "", "Caractéristiques : ");
  1478. LeRapport += Dossier.fTable(" ", "", "Force : ", db + Perso.getForce(Src) + fb, "");
  1479. LeRapport += Dossier.fTable(" ", "", "Intell. : ", db + Perso.getIntelligence(Src) + fb, "");
  1480. LeRapport += Dossier.fTable(" ", "", "Char. : ", db + Perso.getCharisme(Src) + fb, "");
  1481. LeRapport += Dossier.fTable("", "", "", "", "Équipement : ");
  1482. LeRapport += Dossier.fTable(" ", "", "Bâton : ", db + Perso.getBaton(Src) + fb, "");
  1483. LeRapport += Dossier.fTable(" ", "", "Hache : ", db + Perso.getHache(Src) + fb, "");
  1484. LeRapport += Dossier.fTable(" ", "", "Pioche : ", db + Perso.getPioche(Src) + fb, "");
  1485. LeRapport += Dossier.fTable(" ", "", "Épée : ", db + Perso.getEpee(Src) + fb, "");
  1486. LeRapport += Dossier.fTable(" ", "", "Bouclier : ", db + Perso.getBouclier(Src) + fb, "");
  1487. LeRapport += Dossier.fTable(" ", "", "PC : ", db + Perso.getPC(Src) + fb, "");
  1488. LeRapport += Dossier.fTable("Garnison : ", "", "", "", db + PersoGarnison + fb);
  1489. LeRapport += Dossier.fTable("Grade : ", "", "", "", db + PersoGrade + fb);
  1490. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + PersoLogin, Dossier.suite);//Champs, métier
  1491. },
  1492. fTable: function (l1, l2, l3, l4, l5) {
  1493. var span = 0, r = "[tr]", ftd = "[/td]";
  1494. if (l1 != "") {
  1495. r += "[td]" + l1 + ftd;
  1496. span = 0;
  1497. } else
  1498. span++;
  1499. if (l2 != "") {
  1500. if (span != 0) {
  1501. r += "[td colspan=\"" + (span + 1) + "\"]" + l2 + ftd;
  1502. span = 0;
  1503. } else
  1504. r += "[td]" + l2 + ftd;
  1505. } else
  1506. span++;
  1507. if (l3 != "") {
  1508. if (span != 0) {
  1509. r += "[td colspan=\"" + (span + 1) + "\"]" + l3 + ftd;
  1510. span = 0;
  1511. } else
  1512. r += "[td]" + l3 + ftd;
  1513. } else
  1514. span++;
  1515. if (l4 != "") {
  1516. if (span != 0) {
  1517. r += "[td colspan=\"" + (span + 1) + "\"]" + l4 + ftd;
  1518. span = 0;
  1519. } else
  1520. r += "[td]" + l4 + ftd;
  1521. } else
  1522. span++;
  1523. if (l5 != "") {
  1524. if (span != 0) {
  1525. r += "[td colspan=\"" + (span + 1) + "\"]" + l5 + ftd;
  1526. span = 0;
  1527. } else
  1528. r += "[td]" + l5 + ftd;
  1529. } else if (span > 0) {
  1530. r += "[td colspan=\"" + (span + 1) + "\"]" + "[/td]";
  1531. span = 0;
  1532. }
  1533. r += "[/tr]\n";
  1534. return(r);
  1535. },
  1536. suite: function (Src) {
  1537. LeRapport += Dossier.fTable("Champs : ", "", db + Perso.quelChamp(Perso.getChamp1(Src)) + fb,
  1538. "", db + Perso.quelChamp(Perso.getChamp2(Src)) + fb);
  1539. LeRapport += Dossier.fTable("Métier : ", "", "", "", db + Perso.quelMetier(Perso.getMetier(Src)) + fb);
  1540. if (QuelOnglet() != "Université") {
  1541. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipal.php', 'l=7', Dossier.fin);//connaissances
  1542. return;
  1543. }
  1544. Dossier.fin(document.getElementsByTagName("body")[0].innerHTML);
  1545. },
  1546. fin: function (Src) {
  1547. LeRapport += Dossier.fTable("Étude : ", "", "", "", db + Perso.getEtude(Src) + fb);
  1548. LeRapport += "[/table]";
  1549. ClipboardCopyTo(HtmlToString(LeRapport));
  1550. alert("Dossier disponible dans le presse-papiers.");
  1551. }
  1552. }
  1553. var Recensement = {
  1554. debut: function () {
  1555. //RRmenu.enVille();//alert(">>Recensement.debut");
  1556. nbP = 0, nbPmort = 0, nbPretraite = 0, nbPretranche = 0;
  1557. if (RRoperation == "") {
  1558. RRoperation = "Recensement";
  1559. LeRapport += "[b][u]" + mVille + "[/u][/b] le " + mDate + "\n\n";
  1560. if (monPopup != undefined)
  1561. monPopup.close();
  1562. monPopup = RRpopup.init("RReasy", 1);
  1563. RRpopup.setMessage(monPopup, "Recensement");
  1564. }
  1565. if (QuelOnglet() != "La mairie") {
  1566. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipal.php', 'l=3&a=0', Recensement.faire);
  1567. return;
  1568. }
  1569. Recensement.faire(document.getElementsByTagName("body")[0].innerHTML);
  1570. },
  1571. faire: function (Src) {
  1572. //si changement de jour sauvegarde ancienne liste pour détection des mouvements
  1573. if (lastRapport != mDate)//if (mDate != hPersos)
  1574. Fichier.enregistrerHier();
  1575. // logit("Recencement.faire.enregistrerHier() (l.1575) lastHier : '" + lastHier + "' lastRapport: '" + lastRapport + "' PersoLogin : '" + PersoLogin + "' PersoPrefs : " + PersoPrefs + "'");
  1576. //logit ("Recencement.faire.Src l. 1576: " + Src);
  1577. nPersos.splice(0, nPersos.length);
  1578. Recensement.getMaire(Src);
  1579. RRpopup.addMessage(monPopup, "<br>Le maire est " + Perso.lienHTML(cMaire));
  1580. Recensement.getTribun(Src);
  1581. RRpopup.addMessage(monPopup, "<br>Le tribun est " + Perso.lienHTML(cTribun));
  1582. Recensement.getPresent(Src);
  1583. },
  1584. getMaire: function (Src) {
  1585. var x = getData(Src, "<p>Le maire est ", "</p>");// logit ("getMaire x : " + x);
  1586. cMaire = getData(x, ">", "<");
  1587. return(cMaire);
  1588.  
  1589. },
  1590. getTribun: function (Src) {
  1591. var x = getData(Src, "<p>Le tribun est ", "</p>"); //logit ("getTribun x : " + x);
  1592. cTribun = getData(x, ">", "<");
  1593. return(cTribun);
  1594. },
  1595. getPresent: function (Src) {
  1596. // logit("Recensement.getpresent l 1596 Src : " + Src);
  1597. // var a = getData(Src, "<br>Liste des villageois<br>", "</table>");
  1598. var a = getData(Src, ")</strong><br><br>", "</table>");
  1599. // logit("Recensement.a l 1599 : " + a);
  1600. a = str_replace(a, "</tr>", "\n");
  1601. var b = a.split("\n");
  1602. var i, r = "";
  1603. nPresents.splice(0, nPresents.length);
  1604. for (i = 0; i < b.length; i++) {
  1605. if (b[i] != "")
  1606. nPresents.push(new Present(getData(b[i], "login=", "\\"), 0, 0, 0, 0));
  1607. }
  1608. nPointeur = 0;
  1609. errorCnt = 0;
  1610. if (RRoperation == "Recensement") {
  1611. logit("getPresent l. 1611 : Recensement");
  1612. Recensement.getFichePerso();
  1613. } else if (RRoperation == "RapportGuet") {
  1614. logit("getPresent l. 1614 : RapportGuet");
  1615. Recensement.getFichePerso();
  1616. } else if (RRoperation == "Furtifs") {
  1617. logit("getPresent l. 1617 : Furtifs");
  1618. Furtifs.suite(); //l. 1760
  1619. }
  1620. },
  1621. getFichePerso: function () {
  1622. if (nPointeur < nPresents.length) {
  1623. RRpopup.progression(monPopup, "en cours " + Math.floor(nPointeur + 1) + "/" + nPresents.length + " (" + nPresents[nPointeur].Pseudo + ")",
  1624. (Math.floor(nPointeur + 1) / nPresents.length) * 100);
  1625. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (nPresents[nPointeur].Pseudo), Recensement.getPersoInfo)
  1626. } else {
  1627. Recensement.fin();
  1628. }
  1629. },
  1630. getPersoInfo: function (Src) {
  1631. MessageErreur = ""; //logit("getPersoInfo (l.1631)-Src : "+Src);
  1632. if (Src.indexOf("Connexion perdue<") != 0) {
  1633. if (Src.indexOf("Informations sur") != -1) {
  1634. Recensement.setPersoInfo(nPresents[nPointeur].Pseudo, Src);
  1635. nPointeur++;
  1636. Recensement.getFichePerso();
  1637. }
  1638. else if ((Src.indexOf("Une erreur") == 0) || (Src.indexOf("<br><br>Ce personnage n") == 0)) {
  1639. nPointeur++;
  1640. Recensement.getFichePerso();
  1641. }
  1642. else {
  1643. errorCnt++;
  1644. if (errorCnt <= 3)
  1645. setTimeout(Recensement.getFichePerso, 1500);
  1646. else {
  1647. errorPersoCnt++;
  1648. if (errorPersoCnt <= 3) {
  1649. nPointeur++;
  1650. errorCnt = 0;
  1651. Recensement.getFichePerso();
  1652. }
  1653. else {
  1654. MessageErreur = "<b>Erreur pendant le recensement.</b>";
  1655. }
  1656. }
  1657. }
  1658. }
  1659. else {
  1660. MessageErreur = "<b>Erreur connexion perdue.</b>";
  1661. }
  1662. },
  1663. setPersoInfo: function (zPseudo, Src) {
  1664. var zVillage = "", zComte = "", zPays = "", zStatus = "", zNiveau = "", zEcu = 0, zChamp1 = 0, zChamp2 = 0, zMetier = 0, zPR = 0, zDate = 0;//logit("setPersoInfo (l.1665)- zPseudo : "+zPseudo+" - Src : "+Src);
  1665. zVillage = Perso.getVillage(Src);
  1666. zComte = Perso.getComte(Src);
  1667. zPays = Perso.getPays(Src);
  1668. zStatus = Perso.getStatus(Src);
  1669. // logit("setPersoInfo l. 1670 : zStatus = '" + zPseudo + "-" + zStatus +"'");
  1670. if (zStatus == "mort")
  1671. nbPmort++;
  1672. if (zStatus == "retraite")
  1673. nbPretraite++;
  1674. if (zStatus == "retranché")
  1675. nbPretranche++;
  1676. zDate = Perso.getStatusDate(Src);
  1677. zEcu = parseInt(Perso.getEcu(Src));
  1678. zNiveau = Perso.getNiveau(Src);
  1679. zPR = Perso.getPR2(Src);
  1680. zChamp1 = Perso.getChamp2(Src);
  1681. zChamp2 = Perso.getChamp1(Src);
  1682. zMetier = Perso.getMetier(Src);
  1683. // logit ("l.745 : zPseudo-zMetier '" +zPseudo+"-"+zMetier+"'");
  1684. //Victorien.,Thiers,Duché du Bourbonnais-Auvergne,,mort,1,0,00,I,0,0,0,18/11/1462
  1685. //Cersei...,Thiers,Duché du Bourbonnais-Auvergne,0,actif,41,37,83,V,2,1,0,27/11/1462
  1686. //logit("setPersoInfo (l.658) recap : "+zPseudo+","+zVillage+","+zComte+","+zPays+","+zStatus+","+zPR+","+zEcu+","+zNiveau+","+zMetier+","+zChamp1+","+zChamp2+","+zDate);
  1687. nPersos.push(new Personnage(zPseudo, zVillage, zComte, zPays, zStatus, zPR, zEcu, zNiveau, zMetier, zChamp1, zChamp2, zDate));
  1688. nbP++;
  1689. },
  1690. fin: function () {
  1691. nPersos.sort(triPseudo);
  1692. Fichier.enregistrer();
  1693. RRpopup.progression(monPopup, " ", -1);
  1694. if (RRoperation == "Recensement") {
  1695. RRoperation = "";
  1696. RRpopup.addMessage(monPopup, "<p>" + nPersos.length + " présents dans le village.</p>");
  1697. RRpopup.fermeture(monPopup);
  1698. } else if (RRoperation == "RapportGuet") {
  1699. RRpopup.addMessage(monPopup, "<p>" + nPersos.length + " présents dans le village.");
  1700. RapportGuet.listeEtrangers();
  1701. }
  1702. }
  1703. }
  1704. var RapportGroupes = {
  1705. debut: function () {
  1706. if (RRoperation == "") {
  1707. RRoperation = "RapportGroupes";
  1708. LeRapport = "[b][u]" + mVille + "[/u][/b] le " + lDate + "\n\n";
  1709. }
  1710. if (QuelOnglet() != "Groupes et armées") {
  1711. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipal.php', 'l=8&a=2', RapportGroupes.faire);
  1712. return;
  1713. }
  1714. RapportGroupes.faire(document.getElementsByTagName("body")[0].innerHTML);
  1715. },
  1716. faire: function (Src) {
  1717. var x = HtmlToString(Src);
  1718. if (x.indexOf("Armées présentes ici :") != -1)
  1719. RapportGroupes.faireArmee(x);
  1720. var y = GetListeEscouade(Src.substring(Src.indexOf("textePage[4]['Texte']")));
  1721. // logit("RapportGroupes.faire l.717 : y = '" + y + "'");
  1722. if (y != '') {
  1723. if (y.indexOf("Vous êtes dans l'armée") != -1)
  1724. LeRapport += y;
  1725. else {
  1726. LeRapport += "[b]Vous appartenez à un groupe comprenant[/b] : ";
  1727. LeRapport += y + "\n";
  1728. LeRapport += "\n";
  1729. }
  1730. }
  1731. LeRapport += GetListeGroupes(Src.substring(Src.indexOf("textePage[2]['Texte']")));
  1732. RapportGroupes.fin();
  1733. },
  1734. faireArmee: function (Src) {
  1735. var x = Src.substring(Src.indexOf("Armées présentes ici :"));
  1736. x = x.substring(x.indexOf("<div"), x.indexOf("</ul>"));//logit("faire armée l.722 - x = '" + x + "'");
  1737. var y = "", z = 0, r = "", n = 0;
  1738. while ((z = x.indexOf("<li")) != -1) {
  1739. y = getData(x, "<li>", "</li>");//logit("faireArmée l725 - y : " + y + " - n : " + n);
  1740. if (n == 0)
  1741. n++;
  1742. else {
  1743. r += y + '. ';
  1744. if (n == 2) {
  1745. n = 0;
  1746. r += "\n";
  1747. }
  1748. else
  1749. n++;
  1750. }
  1751. x = x.substring(z + 1);
  1752. }
  1753. r = str_replace(r, "<span class=\"styleErreur\">", "");
  1754. r = str_replace(r, "</span>", "");
  1755. r = str_replace(r, "(Après ce clic, le chef de l'armée devra valider cette fusion).", "\n");
  1756. LeRapport += "[b]Armée(s) présente(s) :[/b]\n" + BBc.fromHTML(r) + "\n";
  1757. },
  1758. fin: function () {
  1759. if (RRoperation == "RapportGroupes") {
  1760. ClipboardCopyTo(HtmlToString(LeRapport));
  1761. alert("Rapport des groupes disponible dans le presse papiers.");
  1762. RRoperation = "";
  1763. }
  1764. }
  1765. }
  1766. var RapportGuet = {
  1767. debut: function () {
  1768. //RRmenu.enVille();
  1769. logit ("RapportGuet.debut L.886");
  1770. Suspects.lire();
  1771. nbE = 0, nbEmort = 0, nbEretraite = 0, nbEretranche = 0;
  1772. nbV = 0, nbVmort = 0, nbVretraite = 0, nbVretranche = 0;
  1773. nbS = 0, nbSmort = 0, nbSretraite = 0, nbSretranche = 0, nbSurv = 0, nbSprison = 0;
  1774. if (RRoperation == "") {
  1775. RRoperation = "RapportGuet";
  1776. LeRapport = "";
  1777. LeRapportS = "";
  1778. monPopup = RRpopup.init("RReasy", 0);//logit("RapportGuet (l.762) cMaire:"+cMaire+"- mVille : "+mVille+"- mDate : "+mDate);
  1779. RRpopup.setMessage(monPopup, "<b><u>Rapport de Douane</u></b>");
  1780. }
  1781. Today = new Date;
  1782. Heure = Today.getHours();
  1783. // logit ("Today/hPersos/mDate/Heure L.895 = '"+ Today + " / " + hPersos + " / " + mDate + " / " + Heure + "' lastRapport : '" + lastRapport + "'");
  1784. if ((lastRapport != mDate) && (Heure > 4)) { //hPersos
  1785. logit("Recensement l.897 vers Recensement.debut");
  1786. Recensement.debut();
  1787. } else {
  1788. // logit("Recensement l.900 vers RapportGuet.listeEtrangers");
  1789. RRpopup.setMessage(monPopup, nPersos.length + " présents dans le village.");
  1790. RapportGuet.listeEtrangers();
  1791. }
  1792. },
  1793. unPseudoHtml: function (i) {
  1794. var tdNom = '- ',
  1795. tdVillage = ', ',
  1796. tdComte = ' (',
  1797. tdPays = ') - <i>',
  1798. tdStatus = '</i> ',
  1799. ftd = '';
  1800. if (i == -1)
  1801. return("");
  1802. var z = tdNom + Perso.lienHTML(nPersos[i].Pseudo) + ftd + tdVillage + nPersos[i].Village + ftd
  1803. if (nPersos[i].Comte != mDuche)
  1804. z += tdComte + nPersos[i].Comte + ftd + tdPays + nPersos[i].Pays + ftd +tdStatus; //logit("unPseudoHtml l.796 : " + z);
  1805. if (nPersos[i].Status != "actif")
  1806. z += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  1807. else
  1808. z += "&nbsp;";
  1809. z += "<br>";
  1810. return(z);
  1811. },
  1812. affichageEtrangers: function () {
  1813. var i = 0;
  1814. var z1 = "<br><b>" + nbE + "</> étrangers du " + mDuche + " en visite</b> : (dont " + nbEmort + " morts et " + nbEretraite + " retraités)\n";
  1815. z1 += RapportGuet.unPseudoHtml(-1);
  1816. for (i = 0; i < nPersos.length; i++) {
  1817. if (nPersos[i].Comte != mDuche) {
  1818. z1 += RapportGuet.unPseudoHtml(i);
  1819. }
  1820. }
  1821. var z2 = "<br><b>" + nbV + "</> étrangers habitants du " + mDuche + " en visite</b> : (dont " + nbVmort + " morts et " + nbVretraite + " retraités)\n";
  1822. z2 += RapportGuet.unPseudoHtml(-1);
  1823. for (i = 0; i < nPersos.length; i++) {
  1824. if ((nPersos[i].Village != mVille) && (nPersos[i].Comte == mDuche)) {
  1825. z2 += RapportGuet.unPseudoHtml(i);
  1826. }
  1827. }
  1828. return(z2 + z1);
  1829. },
  1830. affichageSuspects: function () {
  1831. var i = 0, s = -1;
  1832. var dtd = "", ftd = " ", dftd = ftd + dtd;
  1833. var z = "<br><b>" + nbS + "</> suspects</b> : (dont " + nbSmort + " morts et " + nbSretraite + " retraités)<br>\n";
  1834. z += "\n";
  1835. for (i = 0; i < nPersos.length; i++) {
  1836. s = RapportGuet.siSuspect(nPersos[i].Pseudo);
  1837. if (s != -1) {
  1838. z += dtd + Perso.lienHTML(nPersos[i].Pseudo) + dftd + " - " + nSuspects[s].Motif + dftd;
  1839. if (nPersos[i].Status != "actif")
  1840. z += "<font color=#ff0000><b>" + nPersos[i].Status + "</b></font>";
  1841. z += ftd + "<br>\n";
  1842. }
  1843. }
  1844. return(z);
  1845. },
  1846. unPersoBBc: function (x) {
  1847. var z = "";
  1848. if (x == -1) {
  1849. } else {
  1850. z += (Perso.lienBBcode(x.Pseudo) + ", " + x.Village);
  1851. if (x.Comte != mDuche) {
  1852. z =+ " (" + x.Comte + ") ";
  1853. z =+ " - [i]" + x.Pays + "[/i] - ";
  1854. }
  1855. if (x.Status != "actif")
  1856. z += " [color=#ff0000][b]" + x.Status + "[/b][/color]";
  1857. z += "\n";
  1858. }
  1859. return(z);
  1860. },
  1861. listeEtrangers: function () {
  1862. RRpopup.progression(monPopup, " ", -1);
  1863. RRpopup.addMessage(monPopup, "<br>Elaboration de la liste des étrangers... ");
  1864. var i = 0, z = "";
  1865. z = RapportGuet.unPseudoHtml(-1);
  1866. for (i = 0; i < nPersos.length; i++) {
  1867. if ((nPersos[i].Village != mVille) && (nPersos[i].Comte == mDuche)) {
  1868. z += RapportGuet.unPseudoHtml(i);
  1869. //logit ("nPersos[i].Status : " + nPersos[i].Status);
  1870. if (nPersos[i].Status == "mort")
  1871. nbVmort++;
  1872. if (nPersos[i].Status == "retraite")
  1873. nbVretraite++;
  1874. if (nPersos[i].Status == "retranché")
  1875. nbVretranche++;
  1876. nbV++;
  1877. }
  1878. }
  1879. if (nbV !=0)
  1880. LeRapport += "<b>" + nbV + " voisins du " + mDuche + " en visite</b> : (dont " + nbVmort + " morts et " + nbVretraite + " retraités)<br>" + z + "\n<br>";
  1881.  
  1882. z = RapportGuet.unPseudoHtml(-1);
  1883. for (i = 0; i < nPersos.length; i++) {
  1884. if (nPersos[i].Comte != mDuche) {
  1885. z += RapportGuet.unPseudoHtml(i);
  1886. if (nPersos[i].Status == "mort")
  1887. nbEmort++;
  1888. if (nPersos[i].Status == "retraite")
  1889. nbEretraite++;
  1890. if (nPersos[i].Status == "retranché")
  1891. nbEretranche++;
  1892. nbE++;
  1893. }
  1894. }
  1895. if (nbE !=0)
  1896. LeRapport += "<b>" + nbE + " étrangers au " + mDuche + " en visite</b> : (dont " + nbEmort + " morts et " + nbEretraite + " retraités)<br>" + z + "\n<br>";
  1897. RRpopup.addMessage(monPopup, "terminée.<br>");
  1898. RapportGuet.listeSuspects();
  1899. },
  1900. listeArrivee: function () {
  1901. var i = 0, j = 0, x = 0;
  1902. var r = "<br><b>Liste des arrivées</b><br>",rV = "",rE = "";
  1903. if (nHier.length > 0) {
  1904. for (i = 0; i < nPersos.length; i++) {
  1905. x = 0;
  1906. if (j >= nHier.length)
  1907. x = 1;
  1908. else if (nPersos[i].Pseudo < nHier[j].Pseudo)
  1909. x = 1;
  1910. else if (nPersos[i].Pseudo == nHier[j].Pseudo)
  1911. j++;
  1912. else {
  1913. while ((j < nHier.length) && (nPersos[i].Pseudo > nHier[j].Pseudo))
  1914. j++;
  1915. i--;
  1916. }
  1917. if (x) {
  1918. if (nPersos[i].PR > 15) {
  1919. }
  1920. //logit("Arrivées - nPersos[i].Status l.984: " + nPersos[i].Status );
  1921. if (nPersos[i].Comte == mDuche) { /* Voisins */
  1922. // logit("rV l.914: " + rV + " - nPersos[i].Pseudo : " + nPersos[i].Pseudo + " - " + "nPersos[i].Comte : " + nPersos[i].Comte + " - ");
  1923. if (rV == "" ) rV = "<b><i>" + mDuche + "</i></b><br>";
  1924. // logit("rV l.916: " + rV );
  1925. rV += "- " + Perso.lienHTML(nPersos[i].Pseudo) + ", " + nPersos[i].Village;// + " (" + nPersos[i].Comte + ") ";
  1926. // "<font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  1927. if (nPersos[i].Status != "actif")
  1928. rV += " <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  1929. rV += "<br>";
  1930. }
  1931. if (nPersos[i].Comte != mDuche) { /* Etrangers */
  1932. // logit("rE l.924: " + rE);
  1933. if (rE == "" ) rE = "<b><i>Hors " + mDuche + "</i></b><br>";
  1934. rE += "- " + Perso.lienHTML(nPersos[i].Pseudo) + ", " + nPersos[i].Village + " <i>(" + nPersos[i].Comte + ")</i> ";
  1935. if (nPersos[i].Status != "actif")
  1936. rE += " <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  1937. rE += "<br>";
  1938. }
  1939. }
  1940. }
  1941. }
  1942. /* logit("rV l.934: " + rV);
  1943. logit("rE l.935: " + rE);*/
  1944. if ((rV != "") && (rV != "<br>")) r+= rV + "<br>";
  1945. if ((rE != "") && (rE != "<br>")) r+= rE + "<br>";
  1946. // r += rV + "<br>" + rE + "<br>";// + "<br>";
  1947. return(r);
  1948. },
  1949. listeDepart: function () {
  1950. var i = 0, j = 0, x = 0; //logit("1015 listeDepart");
  1951. var r = "<br><b>Liste des départs</b><br>", rV = "", rE = "";
  1952. if (nHier.length > 0) {
  1953. for (i = 0; i < nHier.length; i++) {
  1954. x = 0;
  1955. if (j >= nPersos.length)
  1956. x = 1;
  1957. else if (nHier[i].Pseudo < nPersos[j].Pseudo)
  1958. x = 1;
  1959. else if (nHier[i].Pseudo == nPersos[j].Pseudo)
  1960. j++;
  1961. else {
  1962. while ((j < nPersos.length) && (nHier[i].Pseudo > nPersos[j].Pseudo))
  1963. j++;
  1964. i--;
  1965. }
  1966. if (x) {
  1967. if (nHier[i].Comte == mDuche) { /* Voisins */
  1968. // logit("rV l.951: " + rV);
  1969. if (rV == "" ) rV = "<b><i>" + mDuche + "</i></b><br>";
  1970. rV += "- " + Perso.lienHTML(nHier[i].Pseudo) + ", " + nHier[i].Village;// + " (" + nHier[i].Comte + ") ";
  1971. //logit("listeDeparts l.1036 Status : '" + nHier[i].Pseudo + "-" + nHier[i].Status + "'");
  1972. if ((nHier[i].Status == "mort") && (nHier[i].Status != 0)) {
  1973. rV += " - <font color=#ff0000><b>retranchement</b></font >";
  1974. } else {
  1975. if ((nHier[i].Status != "actif") && (nHier[i].Status != 0))
  1976. rV += " - <font color=#ff0000><b>" + nHier[i].Status + "</b></font >";
  1977. }
  1978. rV += "<br>";
  1979. }
  1980. if (nHier[i].Comte != mDuche) { /* Etrangers */
  1981. // logit("rE l.964: " + rE);
  1982. if (rE =="" ) rE = "<b><i>Hors " + mDuche + "</i></b><br>";
  1983. rE += "- " + Perso.lienHTML(nHier[i].Pseudo) + ", " + nHier[i].Village + " <i>(" + nHier[i].Comte + ")</i> ";
  1984. //logit("listeDeparts l.1049 Status : '" + nHier[i].Pseudo + "-" + nHier[i].Status + "'");
  1985. if ((nHier[i].Status == "mort") && (nHier[i].Status != 0)) {
  1986. rE += " - <font color=#ff0000><b>retranchement</b></font >";
  1987. } else {
  1988. if ((nHier[i].Status != "actif") && (nHier[i].Status != 0))
  1989. rE += " - <font color=#ff0000><b>" + nHier[i].Status + "</b></font >";
  1990. }
  1991. rE += "<br>";
  1992. }
  1993. }
  1994. }
  1995. }
  1996. /* logit("rV l.987: " + rV);
  1997. logit("rE l.988: " + rE);*/
  1998. if ((rV != "") && (rV != "<br>")) r+= rV + "<br>";
  1999. if ((rE != "") && (rE != "<br>")) r+= rE + "<br>";
  2000. // r += rV + "<br>" + rE + "<br>";// + "<br>";
  2001. return(r);
  2002. },
  2003. listeSuspects: function () {
  2004. var tdStatSusp = '',
  2005. tdNom = '',
  2006. tdMotif = '',
  2007. tdStatus = ' ',
  2008. ftd = ' - ';
  2009. //tStat = Array( 'Surv.' ,'Assign.' ,'PNG' ,'Brig.' ,'Membre' ,'TOP' ,'MoV');
  2010. //tStath = Array('660000' ,'0000ff' ,'008888' ,'660000' ,'ff0000' ,'ff3333' ,'ff3333');
  2011. RRpopup.addMessage(monPopup, "<br>Élaboration de la liste des suspects... ");
  2012. var i = 0, z = "", s = -1, zSusp = "", zSurv = "";
  2013. for (i = 0; i < nPersos.length; i++) {
  2014. s = RapportGuet.siSuspect(nPersos[i].Pseudo);
  2015. if (s != -1) {
  2016. // z += tdNom + Perso.lienHTML(nPersos[i].Pseudo) + ftd + tdMotif + nSuspects[s].Motif + tdStatus;
  2017. if (nSuspects[s].Stat == 0) {
  2018. nbSurv++;
  2019. zSurv += tdNom + Perso.lienHTML(nPersos[i].Pseudo) + ftd + tdMotif + nSuspects[s].Motif + tdStatus;
  2020. if (nPersos[i].Status == "en prison"){
  2021. zSurv += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2022. nbSprison++;
  2023. }
  2024. if (nPersos[i].Status == "mort"){
  2025. zSurv += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2026. nbSmort++;
  2027. }
  2028. if (nPersos[i].Status == "retraite"){
  2029. zSurv += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2030. nbSretraite++;
  2031. }
  2032. if (nPersos[i].Status == "retranché"){
  2033. zSurv += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2034. nbSretranche++;
  2035. }
  2036. zSurv += " <i>(" + tStat[nSuspects[s].Stat] + ")</i><br>";
  2037. } else {
  2038. nbS++;
  2039. zSusp += tdNom + Perso.lienHTML(nPersos[i].Pseudo) + ftd + tdMotif + nSuspects[s].Motif + tdStatus;
  2040. if (nPersos[i].Status == "en prison"){
  2041. zSusp += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2042. nbSprison++;
  2043. }
  2044. if (nPersos[i].Status == "mort"){
  2045. zSusp += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2046. nbSmort++;
  2047. }
  2048. if (nPersos[i].Status == "retraite"){
  2049. zSusp += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2050. nbSretraite++;
  2051. }
  2052. if (nPersos[i].Status == "retranché"){
  2053. zSusp += " - <font color=#ff0000><b>" + nPersos[i].Status + "</b></font >";
  2054. nbSretranche++;
  2055. }
  2056. zSusp += " <i>(" + tStat[nSuspects[s].Stat] + ")</i><br>";//"<br>";
  2057. }
  2058. }
  2059. }
  2060. /* [u][b]Suspects présents : [/b][/u]<br>\n
  2061. [u][b]Présents en surveillance : [/b][/u]<br>\n
  2062. [u][b]Furtif: [/b][/u]<br>\n
  2063. */
  2064. LeRapportS = "<b>" + nbSurv + pluriel(nbSurv, " présent") + " sous surveillance et " + nbS + pluriel(nbS, " suspect") + pluriel(nbS, " présent") + " :</b> (dont " + nbSmort + pluriel(nbSmort, " mort") + ", " + nbSretraite + pluriel(nbSretraite, " retraité") + " et " + nbSprison + pluriel(nbSprison, " prisonnier") + ")<br>";
  2065. if (nbS != 0 )
  2066. LeRapportS += "<u><b><i>Suspects présents : </i></b></u><br>" + zSusp + "<br>";
  2067. if (nbSurv != 0 )
  2068. LeRapportS += "<u><b><i>Présents en surveillance : </i></b></u><br>" + zSurv + "<br>";
  2069. RRpopup.addMessage(monPopup, "terminée.<br>");
  2070. RapportGuet.fin();
  2071. },
  2072. fin: function () {
  2073. /*
  2074. Étrangers hors duché (étrangers-(morts*0,6)-(retraite*0,3))
  2075. + Étrangers du duché ((étrangersV-(morts*0,6)-(retraite*0,3))*0,4)
  2076. + Présents ((présents)*0,1)-(morts*0,3)-(retraite*0,1)
  2077. + suspects (suspects*1,2)
  2078. Ou bien selon les valeurs saisies en Préférences
  2079. Selon le flag PrefsAlerts : 0=formules / 1=valeurs
  2080. */
  2081. var v1, v2, r0, r1, r2, r3, rx, nF;
  2082. rx = 0;
  2083.  
  2084. //Recherche des furtifs
  2085. var z = "", zz = "";//logit ("l 1052 RapportGuet.fin rx = " + rx);
  2086. if (nFurtifs.length)
  2087. nFurtifs.splice(0, nFurtifs.length);//logit ("RapportGuet.fin Furtifs.nPersos.length : " + nPersos.length);
  2088. if (nPersos.length < 1)
  2089. Fichier.charger();
  2090. var v = -1, i, nbF = 0;
  2091. var a = getData(document.getElementsByTagName("body")[0].innerHTML, "<br>Liste des villageois<br>", "</table>");
  2092. a = str_replace(a, "</tr>", "\n");// logit("liste villageois l.1098 : '" + a + "'");
  2093. var b = a.split("\n");
  2094. var i, r = "";
  2095. nPresents.splice(0, nPresents.length);
  2096. for (i = 0; i < b.length; i++) {
  2097. if (b[i] != "")
  2098. nPresents.push(new Present(getData(b[i], "login=", "\\"), 0, 0, 0, 0));
  2099. }
  2100. nPointeur = 0;
  2101. errorCnt = 0;
  2102. for (i = 0; i < nPresents.length; i++) {
  2103. v = Furtifs.findArray(nPersos, nPresents[i].Pseudo); // l. 1758
  2104. if (v == 0) {
  2105. nFurtifs.push(new Present(nPresents[i].Pseudo, 0, 0, 0, 0));
  2106. }
  2107. }
  2108. var t = "";
  2109. for (i = 0; i < nFurtifs.length; i++){
  2110. t += Perso.lienHTML(nFurtifs[i].Pseudo);
  2111. if (i < (nFurtifs.length)-1)
  2112. t += ", ";
  2113. }
  2114. nbF = nFurtifs.length;
  2115.  
  2116. if (PrefsAlerts =="0") {
  2117. nF = 0, rx = 0;
  2118. logit("RapportGuet.fin l.1236 : Prefs d'alerte par calcul ");
  2119. /* nbP = nPersos.length - (nbE + nbV);
  2120. logit("nbEmort : " + nbEmort);
  2121. logit("nbEretraite : " + nbEretraite);
  2122. logit("nbE : " + nbE);
  2123. logit("nbVmort : " + nbVmort);
  2124. logit("nbVretraite : " + nbVretraite);
  2125. logit("nbV : " + nbV);
  2126. logit("nbPmort : " + nbPmort);
  2127. logit("nbPretraite : " + nbPretraite);
  2128. logit("nbP : " + nbP);
  2129. logit("nbS : " + nbS);*/
  2130. v1 = nbEmort * 0.6;
  2131. v2 = nbEretraite * 0.3;
  2132. r0 = nbE - (v1 + v2);
  2133. v1 = nbVmort * 0.6;
  2134. v2 = nbVretraite * 0.3;
  2135. r1 = (nbV - (v1 + v2)) * 0.4;
  2136. v1 = nbPmort * 0.3;
  2137. v2 = nbPretraite * 0.1;
  2138. r2 = (nbP * 0.1) - (v1 + v2);
  2139. r3 = nbS * 1.2;
  2140. r0 = r0 + r1 + r2 + r3;
  2141. if (r0 > 40)
  2142. rx = 4;
  2143. else if (r0 > 30)
  2144. rx = 3;
  2145. else if (r0 > 25)
  2146. rx = 2;
  2147. else if (r0 > 20)
  2148. rx = 1;
  2149. } else {
  2150. //logit("RapportGuet.fin l.1703 : Prefs d'alerte par valeurs ");
  2151. x = PersoAlerts.split("|"), rx = 0;
  2152. //logit("RapportGuet.fin l.1706 : nbS = '" + nbS + "' - nbF = '" + nbF + "' - (nbS > x[0]) = " + (nbS > x[0]) + " - x[0] = '" + x[0] + "'");
  2153. //logit (" x[0] = " + x[0] + " - x[1] = " + x[1] + " - x[2] = " + x[2] + " - x[3] = " + x[3] + " - x[4] = " + x[4] + " - x[5] = " + x[5] + " - x[6] = " + x[6] + " - x[7] = " + x[7] + " - x[8] = " + x[8] + " - x[9] = " + x[9])
  2154. if ((nbS > x[0]) || (nbF > x[1]))
  2155. rx = 4;
  2156. else if (((nbS > x[2]) && (nbS < x[3])) || (nbF > x[4]))
  2157. rx = 3;
  2158. else if (((nbS > x[5]) && (nbS < x[6])) || (nbF > x[7]))
  2159. rx = 2;
  2160. else if ((nbS > x[8]) && (nbS < x[9]))
  2161. rx = 1;
  2162. }
  2163.  
  2164. zz = LeRapport;
  2165. z += "<b><u>" + mVille +" - Rapport de Douane du " + lDate + "</u></b><br><br>";
  2166. z += "<br><b><font color="+ aColor[rx] +">Alerte "+ sColor[rx] +"</font ></b><br>";
  2167. z += "<b>" + nbS + pluriel(nbS, " suspect") + " / " + nbSurv + pluriel(nbSurv, " surveillance") + " / " + nbF + pluriel(nbF, " furtif") + "</b><br>";
  2168. z += "<b>" + nbV + pluriel(nbV, " voisin") + " du " + mDuche+ " / " + nbE + pluriel(nbE, " étranger") + " hors " + mDuche + " </b></font><br><br>";
  2169. z += "Niveau de risque " + rx + " (de 0 à 4)<br><br>";
  2170. LeRapport = z + LeRapportS;
  2171. if (nbF !=0)
  2172. LeRapport+= "<b><u>Furtifs :</u></b><br><font color=olive>" + t + "</font><br><br>";
  2173. LeRapport += RapportGuet.listeArrivee();
  2174. LeRapport += RapportGuet.listeDepart();
  2175. LeRapport += "<br><u><b>Étrangers Présents</b></u><br>" + zz + "<br><br>";
  2176. LeRapport += Village.analyseFaire();
  2177.  
  2178. /* nPersos.push(new Personnage(zPseudo, zVillage, zComte, zPays, zStatus, zPR, zEcu, zNiveau, zMetier, zChamp1, zChamp2, zDate));nbP++;//Fofinha d'Enragier VI 255PR*/
  2179. LeRapport+= "<br><br><b><u>Liste des villageois :</u></b><br>";
  2180. for (i = 0; i < nPersos.length; i++){
  2181. LeRapport += Perso.lienHTML(nPersos[i].Pseudo) + " " + nPersos[i].Niveau + " " + nPersos[i].PR + "PR<br>";
  2182. }
  2183.  
  2184. RRpopup.setMessage(monPopup, LeRapport);
  2185. if (RRoperation == "RapportGuet") {
  2186. ClipboardCopyTo(BBc.fromHTML(LeRapport));
  2187. RRpopup.addMessage(monPopup, "<br><br> <b>Rapport disponible dans le presse-papier.</b><p>");
  2188. RRoperation = "";
  2189. RRpopup.fermeture(monPopup);
  2190. }
  2191. },
  2192. siSuspect: function (x) {
  2193. var i;
  2194. for (i = 0; i < nSuspects.length; i++) {
  2195. if (nSuspects[i].Pseudo == x)
  2196. return(i);
  2197. }
  2198. return(-1);
  2199. }
  2200. }
  2201. var RapportSoldat = {
  2202. debut: function () {
  2203. if (RRoperation == "") {
  2204. RRoperation = "RapportSoldat";
  2205. LeRapport = "[b][u]" + mVille + "[/u][/b] le " + lDate + "\n\n";
  2206. }
  2207. if (mVille == "Sur les chemins") {
  2208. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=8', RapportSoldat.chemin);
  2209. } else {
  2210. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=3', RapportSoldat.mv);
  2211. }
  2212. },
  2213. chemin: function (Src) {
  2214. var x = HtmlToString(getData(Src, "elementsTextuelsNavigation[0]['Nom'] = 'Carte';", "elementsTextuelsNavigation[1]"));
  2215. var l = x.split("\n"), i = 0, noeud = "", z = "", t = "";
  2216. for (i = 0; i < l.length; i++) {
  2217. if (l[i].indexOf("['Nom']") != -1) {
  2218. noeud = getData(l[i], "[0][", "]");
  2219. z = "<" + getData(l[i], "= '", "';") + ">";
  2220. z = str_replace(z, "à l'", "au ")
  2221. t = getData(z, "au ", ">");
  2222. t = str_replace(t, "sud", "Nord");
  2223. t = str_replace(t, "nord", "Sud");
  2224. t = str_replace(t, "ouest", "Est");
  2225. t = str_replace(t, "est", "Ouest");
  2226. t = t + " de " + getData(z, "<", ",");
  2227. break;
  2228. }
  2229. }
  2230. LeRapport += "[b]Localisation : [/b]" + t + "\n\n";
  2231. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=3', RapportSoldat.mv);
  2232. },
  2233. mv: function (Src) {
  2234. var z = "";
  2235. var begin = Src.indexOf("<td><h2>M&eacute;moire et vision</h2>");
  2236. var end = Src.indexOf("</td>", begin);
  2237. var xt = Src.substring(begin, end);//logit("RapportSoldat.mv l. 1143 - xt = '" + xt + "'");
  2238. if (xt != null)
  2239. z = RapportMV.execMouvements(xt) + "\n\n";
  2240. LeRapport += "[b]Mouvements observés :[/b]\n" + z;
  2241. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=8&a=2', RapportSoldat.groupes);
  2242. },
  2243. groupes: function (Src) {
  2244. RapportGroupes.faire(Src);
  2245. LeRapport += "\n";
  2246. RapportSoldat.fin();
  2247. },
  2248. fin: function () {
  2249. if (RRoperation == "RapportSoldat") {
  2250. ClipboardCopyTo(HtmlToString(LeRapport));
  2251. RRoperation = "";
  2252. alert("Rapport disponible dans le presse-papiers");
  2253. }
  2254. }
  2255. }
  2256. function RapportMV_debut() {
  2257. RapportMV.debut();
  2258. }
  2259.  
  2260. var RapportMV = {
  2261. debut: function () {
  2262. var xt = "";
  2263. if (RRoperation == "") {
  2264. RRoperation = "RapportMV";
  2265. LeRapport += "[b][u]" + mVille + "[/u][/b] le " + mDate + "\n\n";
  2266. }
  2267. LeRapport += "[b]Événements :[/b]\n";
  2268. xt = document.getElementsByClassName("texte texteEvenement texteEvenement1")[0];
  2269. if (xt != null) {
  2270. LeRapport += BBc.fromHTML(RapportMV.execEvenements(xt));
  2271. } else
  2272. LeRapport = "néant";
  2273. LeRapport += "\n";
  2274. LeRapport += "[b]Mouvements observés :[/b]\n";
  2275. xt = document.getElementsByClassName("texte texteEvenement texteEvenement2")[0].innerHTML;
  2276. xt1 = document.getElementsByClassName("texte texteEvenement texteEvenement2")[1].innerHTML;
  2277. if (xt != null) {
  2278. LeRapport += RapportMV.execMouvements(xt);
  2279. }
  2280. if (xt1 != null) {
  2281. LeRapport += RapportMV.execMouvements(xt1);
  2282. }
  2283. RapportMV.fin();
  2284. },
  2285. execEvenements: function (Src) {
  2286. var i, z, d, t = "", x = "", dx = "";
  2287. dx = mDate;
  2288. for (i = 0; i < 20; i++) {
  2289. z = Src.getElementsByClassName("evenementLigne")[i];
  2290. if (z == -1)
  2291. break;
  2292. d = z.getElementsByClassName("date_evenement")[0].innerHTML;
  2293. d = d.substring(0, d.indexOf(" "));
  2294. if (d == dx) {
  2295. x = getData(z.innerHTML, "</span>", "<br>");
  2296. if (x != "")
  2297. t += d + x + "\n";
  2298. }
  2299. }
  2300. return((t != "" ? t : "R.A.S.\n"));
  2301. },
  2302. execMouvements: function (x) {
  2303. var xt = x;
  2304. if (xt.indexOf("</h2>") == -1)
  2305. return("Erreur de traitement");
  2306. xt = xt.substring(xt.indexOf("</h2>") + 5);
  2307. if (xt.indexOf("Rien de sp&eacute;cial") != -1)
  2308. return("Rien de spécial");
  2309. if (xt.indexOf("Rien de spécial") != -1)
  2310. return("Rien de spécial");
  2311. xt = str_replace(xt, "</tr>", "\n");
  2312. xt = str_replace(xt, "<br>", "\n");
  2313. xt = str_replace(xt, "<a class=\"lien_default lienPerso\" href=\"javascript:popupPerso('FichePersonnage.php?login", "[url=http://www.lesroyaumes.com/FichePersonnage.php?login");
  2314. xt = str_replace(xt, "')\">", "]");
  2315. xt = str_replace(xt, "</a>", "[/url]");
  2316. if (xt.indexOf("Il y a trois jours") != -1)
  2317. xt = xt.substring(0, xt.indexOf("Il y a trois jours"));
  2318. if (xt.indexOf("Il y a quelque temps") != -1)
  2319. xt = xt.substring(0, xt.indexOf("Il y a quelque temps"));
  2320. if (xt.indexOf("Hier, en chemin") != -1)
  2321. xt = xt.substring(0, xt.indexOf("Hier, en chemin"));
  2322. if (xt.indexOf("Avant-hier, en chemin") != -1)
  2323. xt = xt.substring(0, xt.indexOf("Avant-hier, en chemin"));
  2324. /* Modif 20150717 pour Mémoires */
  2325. if (xt.indexOf("&eacute;") != -1)
  2326. xt = str_replace(xt, "&eacute;", "é");//logit("l.1235 RapportMV.execMouvements - xt : '" + xt + "'");
  2327. /* fin modif */
  2328. if (xt.length == 0)
  2329. xt = "Néant";
  2330. else
  2331. var pp1 = 0, pp2 = 0; resu = ""; nx = 0;
  2332. pp1 = xt.indexOf("login=", pp2);
  2333. pp2 = xt.indexOf("]", pp1);
  2334. while ((pp1 != -1) && (pp2 != -1)) {
  2335. if (nx > 0) {
  2336. resu += ",";
  2337. }
  2338. resu += xt.substring(pp1 + 6, pp2);
  2339. pp1 = xt.indexOf("login=", pp2);
  2340. if (pp1 != -1)
  2341. pp2 = xt.indexOf("]", pp1);
  2342. nx++;
  2343. }
  2344. var pMV = resu.split(","), sMV = new Array(), sMVname = new Array();
  2345. for (i = 0; i < pMV.length; i++) {
  2346. s = Perso.siSuspect(pMV[i]);
  2347. if (s != -1) {
  2348. sMV.push("[color=#" + Perso.couleurSuspect(s) + "]" + pMV[i] + "[/color]");
  2349. sMVname.push(pMV[i]);
  2350. }
  2351. }
  2352. for (z = 0 ; z < sMV.length ; z++) {
  2353. xt = str_replace(xt, "]" + sMVname[z] + "[", "]" + sMV[z] + "[");
  2354. }
  2355. /* fin modif*/
  2356. xt = cvCar(xt);
  2357. return(xt);
  2358. },
  2359. compact: function (xt) {
  2360. var x = 1, e = xt.split('\n'), i = 0, j = 0, z = "";
  2361. for (i = 0; i < e.length; i++) {
  2362. if (e[i].substring(0, 1) == " ")
  2363. e[i] = "-" + e[i];
  2364. if (e[i] == "- ")
  2365. e[i] = "";
  2366. }
  2367. for (i = 0; i < e.length; i++) {
  2368. if (e[i] != "")
  2369. for (j = i + 1; j < e.length; j++) {
  2370. if (e[i] == e[j]) {
  2371. e[j] = "";
  2372. }
  2373. }
  2374. }
  2375. z = "";
  2376. for (i = 0; i < e.length; i++) {
  2377. if (e[i] != "") {
  2378. z += "- " + e[i] + ".\n"; logit ("l 1302 : z = '" + z + "'");
  2379. }
  2380. }
  2381. z = str_replace(z, "- - ", "- ");
  2382. return(z);
  2383. },
  2384. fin: function () {
  2385. if (RRoperation == "RapportMV") {
  2386. ClipboardCopyTo(HtmlToString(LeRapport));
  2387. alert("Rapport disponible dans le presse-papiers");
  2388. RRoperation = "";
  2389. }
  2390. if (RRoperation == "RapportSoldat") {
  2391. RapportSoldat.groupes();
  2392. }
  2393. }
  2394. }
  2395. var FnRR = {
  2396. setPersoJour: function (x) {
  2397. PersoJour = x;//logit("FnRR setPersoJour-PersoJour (l.1278) : "+ x);
  2398. },
  2399. setRecensement: function () {
  2400. hPersos = mDate;//logit("fnRR setRecencement- hPersos (l.1283) : "+ hPersos);
  2401. },
  2402. setProfileAnnuler: function () {
  2403. FnRR.setProfileFin();
  2404. },
  2405. setProfileOK: function () {
  2406. // logit("fnRR setProfileOK (l.1287)");
  2407. zzAlertPerso = "";
  2408. if (document.formulaire.garnison.value == "") {
  2409. if (confirm("L'information Garnison est vide.\nConfirmez-vous la suppression des informations?") == true) {
  2410. PersoGarnison = "";
  2411. PersoGrade = "";
  2412. PersoEscouade = "";
  2413. PersoMission = "0";
  2414. Perso_minS_bk = 0; Perso_minF_bk = 0;
  2415. Perso_minS_rd = 0; Perso_maxS_rd = 0; Perso_minF_rd = 0;
  2416. Perso_minS_or = 0; Perso_maxS_or = 0; Perso_minF_or = 0;
  2417. Perso_minS_grR = 0; Perso_maxS_grR = 0; Perso_maxS_gr = 0;
  2418. PrefsAlerts = 1;
  2419. } else {
  2420. return;
  2421. }
  2422. } else {
  2423. PersoGarnison = document.formulaire.garnison.value;
  2424. PersoGrade = document.formulaire.grade.value;
  2425. PersoEscouade = document.formulaire.escouade.value;
  2426. PersoMission = document.formulaire.mission.value;
  2427. zzAlertPerso = document.formulaire.minS_bk.value + "|" + document.formulaire.minF_bk.value + "|";
  2428. zzAlertPerso += document.formulaire.minS_rd.value + "|" + document.formulaire.maxS_rd.value + "|";
  2429. zzAlertPerso += document.formulaire.minF_rd.value + "|" + document.formulaire.minS_or.value + "|";
  2430. zzAlertPerso += document.formulaire.maxS_or.value + "|" + document.formulaire.minF_or.value + "|";
  2431. zzAlertPerso += document.formulaire.minS_grR.value + "|" + document.formulaire.maxS_grR.value + "|";
  2432. zzAlertPerso += document.formulaire.maxS_gr.value;
  2433. PersoAlerts = zzAlertPerso;
  2434. }
  2435. var element = document.formulaire.bCompute;
  2436. for (var i=0; i < element.length; i++) {
  2437. if (element[i].checked) {
  2438. PrefsAlerts = element[i].value;
  2439. break;
  2440. }
  2441. }
  2442. //logit("fnRR setProfileOK- PrefsAlerts (l.1318) : "+ PrefsAlerts);
  2443. RRmenu.setUserPrefs();
  2444. FnRR.setProfileFin();
  2445. },
  2446. setProfileFin: function () {
  2447. var el = document.getElementById("zoneTexte0");
  2448. el.innerHTML = SaveIG;
  2449. },
  2450.  
  2451. testScript: function(SrC) {
  2452. var el = getData(SrC, "var InfosPaysRR", "</script>");
  2453. var InfosPaysRR = "<script>var InfosPaysRR" + el + "</script>";
  2454. return;
  2455. FnRR.setProfile2();
  2456. },
  2457.  
  2458. setProfile: function () {
  2459. FnRR.load();
  2460. if (QuelOnglet() != "La mairie") {
  2461. m= SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=8&a=3', FnRR.testScript);
  2462. }
  2463. FnRR.setProfile2();
  2464. },
  2465. setProfile2: function () {
  2466. var x = PersoAlerts.split("|"); //logit("PersoAlerts[0] (l.1440) : '"+ PersoAlerts[0] +"'");
  2467. var el = document.getElementById("zoneTexte0");
  2468. SaveIG = el.innerHTML;
  2469. var m = '<h1>Profile RReasy</h1>' + '<form name="formulaire">';
  2470. m+= '<b>Vous êtes soldat ou maréchal ?</b><br>';
  2471. m+= '<table width="252" border="0"><tr>';
  2472. m+= '<td>Ville :</td>';
  2473. m+= '<td><input value="' + PersoGarnison + '" id="garnison" name="garnison" /></td>';
  2474. m+= '</tr><tr>';
  2475. m+= '<td>Grade :</td>';
  2476. m+= '<td><select id="grade" name="grade">';
  2477. for (var i = 0; i < libGrade.length; i += 2) {
  2478. m += '<option value="' + libGrade[i] + '"';
  2479. if (libGrade[i] == PersoGrade)
  2480. m += " selected";
  2481. m += '>' + libGrade[i] + '</option>';
  2482. }
  2483. m+= '</select></td>';
  2484. m+= '</tr><tr>';
  2485. m+= '<td>Escouade :</td>';
  2486. m+= '<td><input value="' + PersoEscouade + '" id="escouade" name="escouade" />';
  2487. m+= '<br /></td>';
  2488. m+= '</tr><tr>';
  2489. m+= '<td>Missions :</td>';
  2490. m+= '<td><input style="width: 40px;" value="' + PersoMission + '" id="mission" name="mission" />&nbsp;';
  2491. m+= 'jours</td>';
  2492. m+= '</tr><tr>';
  2493. m+= '<td>Alertes :</td>';
  2494. m+= '<td><input name="bCompute" type="radio" value="0"';logit("PrefsAlerts : " + PrefsAlerts);
  2495. if (PrefsAlerts == '0') m+= ' checked'
  2496. m+= '/>Par calcul* (voir plus bas)<br>';
  2497. m+= '<input name="bCompute" type="radio" value="1"';
  2498. if (PrefsAlerts == '1') m+= ' checked'
  2499. m+='/>Par niveaux choisis</td>';
  2500. m+= '</tr></table>';
  2501. m+= '<hr>';
  2502. m+= '<b>Niveaux d\'alerte : </b><br />';
  2503. m+= '<table width="500" border="0"><tr>';
  2504. m+= '<th width="130" align="right" scope="row"><b>Alerte Noire</b></th>';
  2505. m+= '<td width="70" align="right">+ de</td>';
  2506. m+= '<td width="150" align="center"><input style="width: 40px;" size="4" maxlength="4" value="' + x[0] + '" id="minS_bk" name="minS_bk" />';
  2507. m+= 'suspects/étrangers</td>';
  2508. m+= '<td width="150" align="left">ou + de';
  2509. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[1] + '" id="minF_bk" name="minF_bk" />';
  2510. m+= 'furtifs</td>';
  2511. m+= '</tr><tr>';
  2512. m+= '<th align="right" scope="row"><b><font color="red">Alerte Rouge</font></b></th>';
  2513. m+= '<td align="right">de';
  2514. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[2] + '" id="minS_rd" name="minS_rd" />';
  2515. m+= 'à</td>';
  2516. m+= '<td align="center"><input style="width: 40px;" size="4" maxlength="4" value="' + x[3] + '" id="maxS_rd" name="maxS_rd" />';
  2517. m+= 'suspects/étrangers</td>';
  2518. m+= '<td align="left">et/ou';
  2519. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[4] + '" id="minF_rd" name="minF_rd" />';
  2520. m+= 'furtifs</td>';
  2521. m+= '</tr><tr>';
  2522. m+= '<th align="right" scope="row"><b><font color="orange">Alerte Orange</font></b></th>';
  2523. m+= '<td align="right">de';
  2524. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[5] + '" id="minS_or" name="minS_or" />';
  2525. m+= 'à</td>';
  2526. m+= '<td align="center"><input style="width: 40px;" size="4" maxlength="4" value="' + x[6] + '" id="maxS_or" name="maxF_or" />';
  2527. m+= 'suspects/étrangers</td>';
  2528. m+= '<td align="left">et/ou';
  2529. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[7] + '" id="minF_or" name="minF_or" />';
  2530. m+= 'furtifs</td>';
  2531. m+= '</tr><tr>';
  2532. m+= '<th align="right" scope="row"><b><font color="green">Alerte Verte Renforcée</font></b></th>';
  2533. m+= '<td align="right">de';
  2534. m+= '<input style="width: 40px;" size="4" maxlength="4" value="' + x[8] + '" id="minS_grR" name="minS_grR" />';
  2535. m+= 'à </td>';
  2536. m+= '<td align="center"><input style="width: 40px;" size="4" maxlength="4" value="' + x[9] + '" id="maxS_grR" name="maxS_grR" />';
  2537. m+= 'suspects/étrangers</td>';
  2538. m+= '<td align="left">&nbsp;</td></tr><tr>';
  2539. m+= '<th align="right" scope="row"><b><font color="green">Alerte Verte</font></b></th>';
  2540. m+= '<td align="right">de 0 à</td>';
  2541. m+= '<td align="center"><input style="width: 40px;" size="4" maxlength="4" value="' + x[10] + '" id="maxS_gr" name="maxS_gr" />';
  2542. m+= 'suspects/étrangers</td><td align="left">&nbsp;</td>';
  2543. m+= '</tr></table>';
  2544. m+= '<hr>';
  2545. m+= '<b>*Calculs :</b> <br>';
  2546. m+="<font size=1>";
  2547. m+=" Étrangers hors duché (étrangers-(morts*0,6)-(retraite*0,3))<br>";
  2548. m+=" + Étrangers du duché ((étrangersV-(morts*0,6)-(retraite*0,3))*0,4)<br>";
  2549. m+=" + Présents ((présents)*0,1)-(morts*0,3)-(retraite*0,1)<br>";
  2550. m+=" + suspects (suspects*1,2)<br>";
  2551. m+=" = Niveau d'alerte : > 40 = noire<br>";
  2552. m+=" > 30 = rouge<br>";
  2553. m+=" > 25 = orange<br>";
  2554. m+=" > 20 = jaune<br>";
  2555. m+=" sinon verte</font>";
  2556. /* m+= '<strong>Etat de guerre</strong><br />';
  2557. m+= '<table width="602" border="0"><tr>';
  2558. m+= '<td align="center"><em><strong>Royaume</strong></em></td>';
  2559. m+= '<td align="center"><em><strong>Ennemi</strong></em></td><td align="left"><strong><em>Couleur</em></strong></td>';
  2560. m+= '</tr><tr>';
  2561. m+= '<td align="center"><a id="zoneChoixPays">';
  2562. m+= '<select name="paysChoisi" id="paysChoisi">';
  2563. var sSelect = "";
  2564. var sPays = 0;
  2565. for (var i = 0; i < InfosPaysRR.length; i ++) {
  2566. if (typeof InfosPaysRR[i] == "undefined")
  2567. while (typeof InfosPaysRR[i] == "undefined") {
  2568. i++;
  2569. }
  2570. sSelect += '<option value="'+i+'"';
  2571. if (i == 0)
  2572. sSelect += ' selected';
  2573. sSelect += '>'+InfosPaysRR[i]['Nom']+'</option>';
  2574. }
  2575. m+= sSelect;
  2576. m+= '</select></a></td><td></td><td></td><tr/>';
  2577. m+= '<tr><td align="center"><a id="zoneChoixComte">';
  2578. m+= '<select name="comteChoisi" id="comteChoisi">';
  2579. var sSelect = "";
  2580. for (var i in InfosPaysRR[sPays]['Comtes']) {
  2581. if (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined")
  2582. while (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined") {
  2583. i++;
  2584. }
  2585. sSelect += '<option value="'+i+'"';
  2586. if (i == 0)
  2587. sSelect += ' selected';
  2588. sSelect += '>'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'</option>';
  2589. }
  2590. m+= sSelect;
  2591. m+= '</select></a></td>';
  2592. m+= '<td align="center"><input name="InFight" type="checkbox" value="" />&nbsp;</td>';
  2593. m+= '<td align="left">';
  2594. m += '<select name="zoneChoixCouleur">';
  2595. m += '<option value="#444444" style="color:black">Défaut</option>';
  2596. m += '<option value="darkred" style="color:darkred";>Rouge foncé</option>';
  2597. m += '<option value="red" style="color:red">Rouge</option>';
  2598. m += '<option value="orange" style="color:orange">Orange</option>';
  2599. m += '<option value="brown" style="color:brown">Marron</option>';
  2600. m += '<option value="yellow" style="color:yellow">Jaune</option>';
  2601. m += '<option value="green" style="color:green">Vert</option>';
  2602. m += '<option value="olive" style="color:olive">Olive</option>';
  2603. m += '<option value="cyan" style="color:cyan">Cyan</option>';
  2604. m += '<option value="blue" style="color:blue">Bleu</option>';
  2605. m += '<option value="darkblue" style="color:darkblue">Bleu foncé</option>';
  2606. m += '<option value="indigo" style="color:indigo">Indigo</option>';
  2607. m += '<option value="violet" style="color:violet">Violet</option>';
  2608. m += '<option value="white" style="color:white">Blanc</option>';
  2609. m += '<option value="black" style="color:black">Noir</option>';
  2610. m += '</select>';
  2611. m+= '</td></tr>';
  2612. m+= '</table>';
  2613. m+= '</form>' + '<br>';*/
  2614. // id="paysChoisi" onchange="changeInfosPays();"
  2615. /*window.document.getElementById("paysChoisi").onchange = function () {
  2616. Village.changeInfosPays();
  2617. return false;
  2618. };*/
  2619.  
  2620. el.innerHTML = m;
  2621. RRmenu.addSubfunction(el, FnRR.setProfileOK, "Valider");
  2622. RRmenu.addSubfunction(el, FnRR.setProfileAnnuler, "Annuler");
  2623. },
  2624. getStorage: function(){
  2625. var el = document.getElementById("zoneTexte0");
  2626. SaveIG = el.innerHTML;
  2627. Fichier.chargerHier();
  2628. Fichier.charger();
  2629. Suspects.lire();
  2630. var zSuspects = "", zToday = lastRapport + "ø", zHier=hHier + "ø";
  2631. for (i=0;i< nSuspects.length;i++){
  2632. zSuspects += nSuspects[i].Pseudo + "|";
  2633. zSuspects += nSuspects[i].Motif + "|";
  2634. zSuspects += nSuspects[i].Date + "|";
  2635. zSuspects += nSuspects[i].Stat + "ø";
  2636. }
  2637. for (i=0;i< nHier.length;i++){
  2638. zHier += nHier[i].Pseudo;
  2639. zHier += "|" + nHier[i].Village;
  2640. zHier += "|" + nHier[i].Comte;
  2641. zHier += "|" + nHier[i].Pays;
  2642. zHier += "|" + nHier[i].Status + "ø";
  2643. }
  2644. for (i=0;i< nPersos.length;i++){
  2645. zToday += nPersos[i].Pseudo;
  2646. zToday += "|" + nPersos[i].Village;
  2647. zToday += "|" + nPersos[i].Comte;
  2648. zToday += "|" + nPersos[i].Pays;
  2649. zToday += "|" + nPersos[i].Status;
  2650. zToday += "|" + nPersos[i].PR;
  2651. zToday += "|" + nPersos[i].Ecu;
  2652. zToday += "|" + nPersos[i].Niveau;
  2653. zToday += "|" + nPersos[i].Metier;
  2654. zToday += "|" + nPersos[i].Champ1;
  2655. zToday += "|" + nPersos[i].Champ2;
  2656. zToday += "|" + nPersos[i].date + "ø";
  2657. }
  2658. RRmenu.getUserPrefs();
  2659. var zPersoPrefs = hPersos + '|' + hHier + '|' + lastHier + '|' + lastRapport + '#';
  2660. zPersoPrefs += PersoJour + '|' + PersoGrade + '|' + PersoGarnison + '|' + PersoEscouade + '|' + PersoMission + '#';
  2661. zPersoPrefs += PrefsAlerts + '#' + PersoAlerts + '#' + MarcheSeuil + '#' + MandatVu + '#' + MandatOH + '#' + MandatH;
  2662. var m = "<form id=Recap name=Recap><table width=500 border=0><tr><th colspan=2>Controle des stockages</th></tr>";
  2663. m += "<tr><th colspan=2><font color=red>ATTENTION : Toute modification est irréversible !</font></th></tr>";
  2664. m += "<tr><td colspan=2>Joueur : <b>" + PersoPrefs + "</b> - Village : <b>" + mVille + "</b> - Comté/Duché : <b>" + mDuche + "</b></td></tr>";
  2665. m += "<tr><th width=146 align=right valign=top><h5>Prefs joueur<br /></h5>";
  2666. m +="<br /><font size=1>DateRapport | Hier | lastHier | lastRapport #<br />";
  2667. m +="Date du jour | Grade | Garnison | Escouade | Mission #<br />";
  2668. m +="PrefsAlerts # PersoAlerts # MarcheSeuil ø<br />";
  2669. m +="Présence mandat # anc. Heure vu # Heure vu <br /> </font></th>";
  2670. m += "<td width=344><textarea name=Prefs id=Prefs cols=53 rows=5>" + zPersoPrefs + "</textarea></td></tr>";
  2671. m += "<tr><th align=right valign=top><h5>Villageois du jour<br />" + hPersos + " (" + nPersos.length + ")<br /></h5>";
  2672. m+= "<font size=1>Nom | Village | Comte | Pays | Status | Réputation | Ecus | Niveau | Metier | Champ1 | Champ2, Date connexion ø</font>";
  2673. m += "</th><td><textarea name=Villageois id=Villageois cols=53 rows=5>" + zToday + "</textarea></td></tr>";
  2674. m += "<tr><th align=right valign=top><h5>Villageois de la veille<br />" + lastHier + " (" + nHier.length + ")<br /></h5>";
  2675. m += "<font size=1>Nom | Village | Comte | Pays | Status ø</font>";
  2676. m += "</th><td><textarea name=VillageoisHier id=VillageoisHier cols=53 rows=5>" + zHier + "</textarea></td></tr>";
  2677. m += "<tr><th align=right valign=top><h5>Suspects du Comté/Duché<br /> (" + nSuspects.length + ")<br /></h5>";
  2678. m += "<font size=1>Nom | Raison | Date d'ajout | Classement ø<br><i>0-Sous surveillance<br>1-A Assigner à résidence<br>2-Persona non grata<br>3-Brigandage<br>4-Membre (Fatum, Hydre...)<br>5-TOP<br>6-Mort ou vif</i></font>";
  2679. m += "</th><td><textarea name=Suspects id=Suspects cols=53 rows=5>" + zSuspects + "</textarea></td></tr>";
  2680. m += "</table></form>";
  2681. el.innerHTML = m;
  2682. RRmenu.addSubfunction(el, FnRR.setFilesOK, "Valider");
  2683. RRmenu.addSubfunction(el, FnRR.setProfileAnnuler, "Annuler");
  2684. // RRmenu.addSubfunction(el, FnRR.setFilesAnnuler, "Annuler");
  2685. var mStorN = "<br><hr><br><form id=toDel name=toDel><table width=500 border=0><tr><th colspan=2>Suppression des stockages</th></tr>", mStorV = "";
  2686. mStorN += "<tr><th colspan=2><font color=red>ATTENTION : Toute SUPPRESSION est irréversible !</font></th></tr>";
  2687. for(var i=0; i < localStorage.length; i++){
  2688. var propertyName = localStorage.key(i);
  2689. mStorN += "<tr><td width=146 align=right valign=top><b>" + propertyName + "</b><br>Supprimer&nbsp;<input type=checkbox id=delIt name=delIt value=" + propertyName + "></td>";
  2690. mStorN += "<td width=344><textarea name=Prefs id=Prefs cols=53 rows=2>" + localStorage.getItem(propertyName) + "</textarea></td></tr>";
  2691. }
  2692. mStorN += "</table></form>";
  2693. el.innerHTML += mStorN;
  2694. RRmenu.addSubfunction(el, FnRR.setFilesDelete, "Supprimer la sélection");
  2695. RRmenu.addSubfunction(el, FnRR.setProfileAnnuler, "Annuler");
  2696. },
  2697. setFilesOK: function() {
  2698. alert("Non implémenté.");
  2699. },
  2700. setFilesAnnuler: function() {
  2701. var el = document.getElementById("zoneTexte0");
  2702. el.innerHTML = SaveIG;
  2703. },
  2704. setFilesDelete: function () {
  2705. var MyDel = new Array(), element = document.toDel.delIt; logit("setFilesDelete.document.toDel.delIt.length : " + document.toDel.delIt.length);
  2706. for (var i=0; i < element.length; i++) {
  2707. if (element[i].checked) {
  2708. MyDel.push(element[i].value);logit("setFilesDelete.element[i] : " + element[i] + " - element[i].value : " + element[i].value);
  2709. localStorage.removeItem(element[i].value);
  2710. }
  2711. }
  2712. FnRR.getStorage();
  2713. },
  2714. changeInfosPays: function () {
  2715. var elComte = window.document.getElementById("zoneChoixComte");
  2716. var sPays = window.document.getElementById("paysChoisi").selectedIndex;
  2717. SaveIG = elComte.innerHTML;
  2718. var sSelect = "", m="";
  2719. m+= '<select name="comteChoisi" id="comteChoisi">';
  2720. for (var i in InfosPaysRR[sPays]['Comtes']) {
  2721. if (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined")
  2722. while (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined") {
  2723. i++;
  2724. }
  2725. sSelect += '<option value="'+i+'"';
  2726. if (i == 0)
  2727. sSelect += ' selected';
  2728. sSelect += '>'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'</option>';
  2729. }
  2730. m+= sSelect;
  2731. m+= '</select>';
  2732. elComte.innerHTML = m;
  2733. },
  2734. load: function () {
  2735. RRmenu.getUserPrefs();
  2736. var x = PersoAlerts.split("|"); //logit("PersoAlerts[0] (l.1440) : '"+ PersoAlerts[0] +"'");
  2737. // logit("FnRR load-PersoAlerts (l.1878) : "+PersoAlerts);
  2738. },
  2739. }
  2740. var Furtifs = {
  2741. debut: function () {
  2742. RRoperation = "Furtifs"; logit("Furtifs.debut l.1884");
  2743. if (QuelOnglet() != "La mairie") {
  2744. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipal.php', 'l=3&a=0', Furtifs.faire);
  2745. return;
  2746. }
  2747. Furtifs.faire(document.body.innerHTML); //=>l. 2036
  2748. },
  2749. affichage: function () {
  2750. logit("Furtifs.affichage l.1892");
  2751. var i, m = "", c = "", cf = "";
  2752. for (i = 0; i < nFurtifs.length; i++) {
  2753. if (nFurtifs[i].Pseudo != "") {
  2754. m += "<tr>";
  2755. c = Presence.couleurSuspect(nFurtifs[i].Pseudo);
  2756. if (c != "")
  2757. cf = "</font>";
  2758. m += Presence.tdNom + c + Perso.lienHTML(nFurtifs[i].Pseudo) + cf + Presence.ftd;
  2759. m += Presence.tdVillage + nFurtifs[i].Village + Presence.ftd;
  2760. m += Presence.tdComte + nFurtifs[i].Comte + Presence.ftd;
  2761. m += Presence.tdEcu + (nFurtifs[i].Ecu != undefined ? nFurtifs[i].Ecu : " ") + Presence.ftd;
  2762. m += Presence.tdStatus + (nFurtifs[i].Status != "0" ? nFurtifs[i].Status : " ") + Presence.ftd;
  2763. m += "</tr>";
  2764. }
  2765. }
  2766. return(m);
  2767. },
  2768. longueVue: function () {
  2769. logit("Furtifs.longueVue - l. 1910");
  2770. var m = "";
  2771. m += "Liste des retranchés (" + nFurtifs.length + ")";
  2772. m += "<table border=\"1\" cellspacing=\"0\">";
  2773. m += "<tr>";
  2774. m += Presence.tdNom + "Nom" + Presence.ftd;
  2775. m += Presence.tdVillage + "Ville" + Presence.ftd;
  2776. m += Presence.tdComte + "Comté/Duché" + Presence.ftd;
  2777. m += Presence.tdEcu + "Écus" + Presence.ftd;
  2778. m += Presence.tdStatus + "État" + Presence.ftd;
  2779. m += "</tr>";
  2780. m += Furtifs.affichage();
  2781. m += "</table>"
  2782. monPopup = RRpopup.init("Liste des retranchés", 0);
  2783. RRpopup.setMessage(monPopup, m + "<p>");
  2784. RRpopup.fermeture(monPopup);
  2785. },
  2786. furtifs: function () {
  2787. // logit("Furtifs.furtifs (Fouine)- l. 1930");
  2788. if (nFurtifs.length)
  2789. nFurtifs.splice(0, nFurtifs.length);
  2790. if (nPersos.length < 1)
  2791. Fichier.charger();
  2792. //pseudo recensement de quête
  2793. //logit ("Fouine l.1386 nPresents.length : '"+ nPresents.length +"'");
  2794. if (nPresents.length)
  2795. nPresents.splice(0, nPresents.length);
  2796. var src = getData(document.body.innerHTML, "textePage[0][7][6]['Texte'] = '", "textePage[");
  2797. src = HtmlToString(src);
  2798. src = str_replace(src, "<p>", "\n");
  2799. src = str_replace(src, "</p>", "");
  2800. src = str_replace(src, "\\n", "\n");
  2801. src = str_replace(src, '<a class="lien_default lienPerso" ', "\n");
  2802. var t = src.split("\n");
  2803. src = "";
  2804. var i;
  2805. for (i = 0; i < t.length; i++) {
  2806. if (t[i].substring(0, "href".length) == "href") {
  2807. nPresents.push(new Present(getData(t[i], ">", "<"), 0, 0, 0, 0));
  2808. }
  2809. }
  2810. var v = -1;
  2811. for (i = 0; i < nPresents.length; i++) {
  2812. v = Furtifs.findArray(nPersos, nPresents[i].Pseudo);
  2813. if (v == 0) {
  2814. nFurtifs.push(new Present(nPresents[i].Pseudo, 0, 0, 0, 0));
  2815. }
  2816. }
  2817. monPopup = RRpopup.init("RReasy", 1);
  2818. RRpopup.setMessage(monPopup, "Recensement");
  2819. npFurtif = 0;
  2820. LeRapport = "";
  2821. Furtifs.furtifsPerso();
  2822. },
  2823. furtifsPerso: function () {
  2824. logit("Furtifs.furtifsPerso l.1969");
  2825. if (npFurtif < nFurtifs.length) {
  2826. RRpopup.progression(monPopup, "en cours " + Math.floor(npFurtif + 1) + "/" + nFurtifs.length + " (" + nFurtifs[npFurtif].Pseudo + ")",
  2827. (Math.floor(npFurtif + 1) / nFurtifs.length) * 100);
  2828. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (nFurtifs[npFurtif].Pseudo), Furtifs.furtifsInfo);
  2829. } else {
  2830. Furtifs.furtifsFin();
  2831. }
  2832. },
  2833. furtifsInfo: function (Src) {
  2834. logit("Furtifs.furtifsInfo l.1979");
  2835. MessageErreur = "";
  2836. if (Src.indexOf("Connexion perdue<") != 0) {
  2837. if (Src.indexOf("Informations sur") != -1) {
  2838. nFurtifs[npFurtif].Status = Perso.getStatus(Src);
  2839. nFurtifs[npFurtif].Village = Perso.getVillage(Src);
  2840. nFurtifs[npFurtif].Comte = Perso.getComte(Src);
  2841. nFurtifs[npFurtif].Pays = Perso.getPays(Src);
  2842. nFurtifs[npFurtif].Ecu = Perso.getEcu(Src);
  2843. npFurtif++;
  2844. Furtifs.furtifsPerso();
  2845. }
  2846. else if (Src.indexOf("<br><br>Ce personnage n") == 0) {
  2847. npFurtif++;
  2848. Furtifs.furtifsPerso();
  2849. }
  2850. else {
  2851. errorCnt++;
  2852. if (errorCnt <= 3)
  2853. setTimeout(Furtifs.furtifsPerso, 1500);
  2854. else {
  2855. errorPersoCnt++;
  2856. if (errorPersoCnt <= 3) {
  2857. nPointeur++;
  2858. errorCnt = 0;
  2859. Furtifs.furtifsPerso();
  2860. }
  2861. else {
  2862. MessageErreur = "<b>Erreur pendant le recensement.</b>";
  2863. }
  2864. }
  2865. }
  2866. }
  2867. else {
  2868. MessageErreur = "<b>Erreur connexion perdue.</b>";
  2869. }
  2870. },
  2871. furtifsFin: function () {
  2872. logit("Furtifs.furtifsFin l.2017");
  2873. var src = "", r = 0;
  2874. for (var i = 0; i < nFurtifs.length; i++) {
  2875. if (nFurtifs[i].Status == "retranché")
  2876. r++
  2877. else
  2878. src += Perso.lienHTML(nFurtifs[i].Pseudo) + " de " + nFurtifs[i].Village + " (" + nFurtifs[i].Comte + ")<br>";
  2879. }
  2880. if (src.length > 0)
  2881. src = "Détection des furtifs : <p>" + src;
  2882. else
  2883. src = "Détection des furtifs : aucun furtif trouvé.";
  2884. src += "<p>(" + nPresents.length + " présents sur le noeud, " + r + " retranchés)";
  2885. RRpopup.setMessage(monPopup, src);
  2886. RRpopup.fermeture(monPopup);
  2887. RRoperation = "";
  2888. RRpopup.progression(monPopup, "", -1);
  2889. ClipboardCopyTo(BBc.fromHTML(src));
  2890. },
  2891. faire: function (Src) {
  2892. logit("Furtifs.faire l.2037");
  2893. Recensement.getPresent(Src); // => l.708
  2894. if (nFurtifs.length)
  2895. nFurtifs.splice(0, nFurtifs.length);
  2896. if (nPersos.length < 1)
  2897. Fichier.charger();
  2898. Furtifs.faireSuite();
  2899. },
  2900. faireSuite: function () {
  2901. logit("Furtifs.faireSuite l.2046");
  2902. logit("nFurtifs.length l.2047 : " + nFurtifs.length);
  2903. logit("nPersos.length l.2048 : " + nPersos.length);
  2904. if (nFurtifs.length)
  2905. nFurtifs.splice(0, nFurtifs.length);
  2906. if (nPersos.length < 1)
  2907. Fichier.charger();
  2908. var v = -1, i;
  2909. //furtifs qui se révèlent
  2910. for (i = 0; i < nPresents.length; i++) {
  2911. v = Furtifs.findArray(nPersos, nPresents[i].Pseudo);
  2912. if (v == 0) {
  2913. nFurtifs.push(new Present(nPresents[i].Pseudo, 0, 0, 0, 0));
  2914. }
  2915. }
  2916. //furtifs qui se cachent
  2917. for (i = 0; i < nPersos.length; i++) {
  2918. v = Furtifs.findArray(nPresents, nPersos[i].Pseudo);
  2919. if (v == 0) {
  2920. nFurtifs.push(new Present(nPersos[i].Pseudo, 0, 0, 0, 0));
  2921. }
  2922. }
  2923. if (nFurtifs.length !=0) {
  2924. var t = nFurtifs.length + " furtif(s) sur " + nPresents.length + " présents (" + nPersos.length + " recensés)\n";
  2925. for (i = 0; i < nFurtifs.length; i++)
  2926. t += nFurtifs[i].Pseudo + ", ";
  2927. }
  2928. return(t);
  2929. },
  2930. findArray: function (e, x) {
  2931. if (x == "")
  2932. return(1);
  2933. for (var i = 0; i < e.length; i++) {
  2934. if (x == e[i].Pseudo)
  2935. return 1;
  2936. }
  2937. return 0;
  2938. },
  2939. suite: function (Src) {
  2940. logit("Furtifs.suite l.2091");
  2941. var v = -1, i;
  2942. //furtifs qui se révèlent
  2943. for (i = 0; i < nPresents.length; i++) {
  2944. v = Furtifs.findArray(nPersos, nPresents[i].Pseudo);
  2945. if (v == 0) {
  2946. nFurtifs.push(new Present(nPresents[i].Pseudo, 0, 0, 0, 0));
  2947. }
  2948. }
  2949. //furtifs qui se cachent
  2950. for (i = 0; i < nPersos.length; i++) {
  2951. v = Furtifs.findArray(nPresents, nPersos[i].Pseudo);
  2952. if (v == 0) {
  2953. nFurtifs.push(new Present(nPersos[i].Pseudo, 0, 0, 0, 0));
  2954. }
  2955. }
  2956. var t = nFurtifs.length + " furtif(s) sur " + nPresents.length + " présents (" + nPersos.length + " recensés)\n";
  2957. for (i = 0; i < nFurtifs.length; i++)
  2958. t += nFurtifs[i].Pseudo + ", ";
  2959. if (nFurtifs.length !=0) {
  2960. ClipboardCopyTo(t);
  2961. alert(t + "\n\n Furtifs disponibles dans le presse-papiers");
  2962. } else {
  2963. alert(t);
  2964. }
  2965. Furtifs.fin(t); //Furtifs.fin(Src);
  2966. },
  2967. fin: function (Src) {
  2968. //logit("Furtifs.fin l.1551");
  2969. RRoperation = "";
  2970. }
  2971. }
  2972. var Perso = {
  2973. getAction: function () {
  2974. var zone = document.getElementsByTagName("body")[0].innerHTML;
  2975.  
  2976. var x = getData(zone, 'var chaineActiviteJoueur = "', '";'); logit("getAction l.1571 - x : '" + x + "'")
  2977. x = str_replace(x, "<br>", " ");
  2978. x = str_replace(x, "Activité : ", "");
  2979. x = str_replace(x, " votre ", " ma ");
  2980. x = str_replace(x, "<div class=\"styleErreurInterligneSimple\">", "");
  2981. x = str_replace(x, "[div class=\"styleErreurInterligneSimple\]", "");
  2982. x = str_replace(x, "<div class=\"styleErreurInterligneSimple\">Activit&eacute; :", "");
  2983. x = str_replace(x, "</div>", "");
  2984. x = str_replace(x, "<br>", " ");
  2985. return(BBc.fromHTML(x));
  2986. },
  2987. getBaton: function (Src) {
  2988. if (Src.indexOf("Vous utilisez un baton") != -1)
  2989. return("oui");
  2990. return("non");
  2991. },
  2992. getBouclier: function (Src) {
  2993. if ((Src.indexOf("Vous utilisez un bouclier") != -1) || (Src.indexOf("Vous utilisez un Bouclier") != -1))
  2994. return("oui");
  2995. return("non");
  2996. },
  2997. getHache: function (Src) {
  2998. if (Src.indexOf("Vous utilisez une hache") != -1)
  2999. return("oui");
  3000. return("non");
  3001. },
  3002. getPioche: function (Src) {
  3003. if (Src.indexOf("Vous utilisez une pioche") != -1)
  3004. return("oui");
  3005. return("non");
  3006. },
  3007. getChamp1: function (Src) {
  3008. var str_field = Array('du bl', 'du ma', 'potager', ' vaches', ' cochons', ' moutons', ' ch&egrave;vres', '\'olivier', ' vigne', '\'orge');
  3009. var z = HtmlToString(Src);
  3010. var x = getData(cvCar(z), " possède ", ".");
  3011. if (x == "")
  3012. return(0);
  3013. var f = x.indexOf(" et ");
  3014. if (f != -1)
  3015. x = x.substring(0, f);
  3016. for (var i = 0; i < str_field.length; i++) {
  3017. if (x.indexOf(str_field[i]) != -1) {
  3018. return(i + 1);
  3019. }
  3020. }
  3021. return(0);
  3022. },
  3023. getChamp2: function (Src) {
  3024. var str_field = Array('du bl', 'du ma', 'potager', ' vaches', ' cochons', ' moutons', ' ch&egrave;vres', '\'olivier', ' vigne', '\'orge');
  3025. var z = HtmlToString(Src);
  3026. var x = getData(cvCar(z), " possède ", ".");
  3027. if (x == "")
  3028. return(0);
  3029. var f = x.indexOf(" et ");
  3030. if (f != -1) {
  3031. x = x.substring(f + 4);
  3032. for (var i = 0; i < str_field.length; i++) {
  3033. if (x.indexOf(str_field[i]) != -1) {
  3034. return(i + 1);
  3035. }
  3036. }
  3037. }
  3038. return(0);
  3039. },
  3040. getCharisme: function (Src) {
  3041. var x = Src.substring(Src.indexOf("Charisme</td>") + "Charisme</td>".length + 1);
  3042. x = x.substring(x.indexOf(">") + 1, x.indexOf("</td>"));
  3043. return(x);
  3044. },
  3045. getCharrette: function (Src) {
  3046. if (Src.indexOf("Charrette") != -1)
  3047. return("oui");
  3048. return("non");
  3049. },
  3050. getEncombrement: function (Src) {
  3051. var x = getData(Src, "<p>Encombrement : <span style=\"\">", "<br");
  3052. x = str_replace(x, "</span>", "");
  3053. x = str_replace(x, " / ", "/");
  3054. x = "Encombrement : [b]" + x + "[/b]";
  3055. return(x);
  3056. },
  3057. getEncombrementGroupe: function (Src) {
  3058. var x = Src;
  3059. if (x.indexOf("Encombrement du groupe ") > 0) {
  3060. x = x.substring(x.indexOf("Encombrement du groupe "));
  3061. x = x.substring(0, x.indexOf("<br"));
  3062. x = str_replace(x, "<span style=\"\">", "");
  3063. x = str_replace(x, "</span>", "");
  3064. x = str_replace(x, " / ", "/");
  3065. x = str_replace(x, ": ", ": [b]") + "[/b]";
  3066. } else
  3067. x = "";
  3068. return(x);
  3069. },
  3070. getEpee: function (Src) {
  3071. if (Src.indexOf("Vous utilisez une épée") != -1)
  3072. return("oui");
  3073. if (Src.indexOf("Vous utilisez une &eacute;p&eacute;e") != -1)
  3074. return("oui");
  3075. return("non");
  3076. },
  3077. getEtat: function (Src) {
  3078. var t = "Forme :</span> ";
  3079. var n = Src.indexOf(t);
  3080. var x = Src.substring(n + t.length);
  3081. x = x.substring(0, x.indexOf("<"));
  3082. return(x);
  3083. },
  3084. getSante: function (Src) {
  3085. var t = "Sant&eacute; : </span> ";
  3086. var n = Src.indexOf(t);
  3087. var x = Src.substring(n + t.length);
  3088. x = x.substring(0, x.indexOf("<"));
  3089. return(x);
  3090. },
  3091. getEtude: function (Src) {
  3092. var x = getData(document.body.innerHTML, "textePage[2][4]['Texte'] = '", "';");//logit("getEtudes l. 1891 : " + x );
  3093. return(x);
  3094. },
  3095. getEcu: function (Src) {
  3096. var x = getData(HtmlToString(Src), "Argent :", "<");
  3097. if (x == "")
  3098. x = getData(HtmlToString(Src), "Argent :</span> ", " é");
  3099. x = str_replace(x, " ", "");
  3100. return(x);
  3101. },
  3102. getForce: function (Src) {
  3103. var x = Src.substring(Src.indexOf("Force</td>") + "Force</td>".length + 1);
  3104. x = x.substring(x.indexOf(">") + 1, x.indexOf("</td>"));
  3105. return(x);
  3106. },
  3107. getGrade: function (x) {
  3108. var cf = "";
  3109. var c = "";
  3110. switch (x) {
  3111. case "Sénéchal":
  3112. c = "f65908";
  3113. break;
  3114. case "Major":
  3115. c = "FA7504";
  3116. break;
  3117. case "Conseiller militaire":
  3118. c = "4686B8";
  3119. break;
  3120. case "Cartographe":
  3121. c = "036234";
  3122. break;
  3123. case "Adjudant":
  3124. c = "78293E";
  3125. break;
  3126. case "Sergent chef":
  3127. c = "2305f9";
  3128. break;
  3129. case "Sergent":
  3130. c = "02C0FC";
  3131. break;
  3132. case "Sergent intérimaire":
  3133. c = "699672";
  3134. break;
  3135. case "Brigadier chef":
  3136. c = "ECC012";
  3137. break;
  3138. case "Brigadier":
  3139. c = "ECC012";
  3140. break;
  3141. case "Soldat de 1ère classe":
  3142. c = "97F905";
  3143. break;
  3144. case "Soldat":
  3145. c = "F0FA04";
  3146. break;
  3147. case "Volontaire":
  3148. c = "A14401";
  3149. break;
  3150. }
  3151. if (c != "")
  3152. cf = "[color=#" + c + "]" + x + "[/color]";
  3153. else
  3154. cf = x;
  3155. return("[b]" + cf + "[/b]");
  3156. },
  3157. getIntelligence: function (Src) {
  3158. var x = Src.substring(Src.indexOf("Intelligence</td>") + "Intelligence</td>".length + 1);
  3159. x = x.substring(x.indexOf(">") + 1, x.indexOf("</td>"));
  3160. return(x);
  3161. },
  3162. getMetier: function (Src) {
  3163. for (var i = 0; i < libMetier.length; i++) {
  3164. if (Src.indexOf(libMetier[i]) != -1)
  3165. return(i + 1);
  3166. }
  3167. return(0);
  3168. },
  3169. getNiveau: function (Src) {
  3170. var x = getData(Src, "Niveau :</span> ", "<");
  3171. if (x == "")
  3172. x = getData(Src, "Niveau ", "<");
  3173. if (x == "Vagabond")
  3174. return(x);
  3175. return(x);
  3176. },
  3177. getPC: function (Src) {
  3178. var x = Src.substring(Src.indexOf("Force</td>") + "Force</td>".length + 1);
  3179. x = x.substring(x.indexOf(">") + 1, x.indexOf("</td>"));
  3180. var xn = parseInt(x);
  3181. if (xn < 50)
  3182. xn = 1;
  3183. else if (xn < 100)
  3184. xn = 2;
  3185. else if (xn < 150)
  3186. xn = 3;
  3187. else if (xn < 200)
  3188. xn = 4;
  3189. else if (xn < 256)
  3190. xn = 5;
  3191. if (Src.indexOf("Vous utilisez un baton") > 0)
  3192. xn++;
  3193. else if (Src.indexOf("Vous utilisez une pioche") > 0)
  3194. xn++;
  3195. else if (Src.indexOf("Vous utilisez une hache") > 0)
  3196. xn++;
  3197. else if (Src.indexOf("Vous utilisez une épée") > 0)
  3198. xn += 3;
  3199. else if (Src.indexOf("Vous utilisez un fléau") > 0)
  3200. xn += 3;
  3201. else if (Src.indexOf("Vous utilisez une lance") > 0)
  3202. xn += 3;
  3203. else if (Src.indexOf("Vous utilisez une xiphos") > 0)
  3204. xn += 3;
  3205. //logit("getPC l. 1986 - xn : " + xn);
  3206. return(xn);
  3207. },
  3208. getPR: function (Src) {
  3209. var x = Src.substring(Src.indexOf("Points de réputation</td>") + "Points de réputation</td>".length + 1);
  3210. x = x.substring(x.indexOf(">") + 1, x.indexOf("</td>"));
  3211. return(x);
  3212. },
  3213. getPR2: function (Src) {
  3214. var z = "Points de réputation :</span> ";
  3215. var x = getData(HtmlToString(Src), z, "</p>");
  3216. return(x);
  3217. },
  3218. getPseudo: function () {
  3219. var zone = document.getElementsByTagName("title")[0];
  3220. var x = zone.innerHTML;
  3221. x = getData(x, "Bienvenue à toi ", ",");
  3222. return(x);
  3223. },
  3224. getStatus: function (Src) {
  3225. var x = "actif"; //logit("getStatus : " + Src);
  3226. x = (Src.indexOf("est MORT") != -1 ? "mort" : x);
  3227. x = (Src.indexOf("lement en retranchement") != -1 ? "retranché" : x);
  3228. x = (Src.indexOf("lement une retraite spirituelle") != -1 ? "retraite" : x);
  3229. x = (Src.indexOf("lement en prison") != -1 ? "en prison" : x);
  3230. return(x);
  3231. },
  3232. getStatusDate: function (Src) {
  3233. var w = getData(Src, 'connexion le ', "<");
  3234. var z = stringToDate(w);
  3235. var d = z.split('/');
  3236. var x = d[0] + "/" + d[1] + "/" + (Number(d[2]) - 2000 + (1461 - 13));
  3237. return(x);
  3238. },
  3239. getPays: function (Src) {
  3240. return(cvCar(getData(Src, "Pays :</span> ", "<")));
  3241. },
  3242. getVillage: function (Src) {
  3243. return(cvCar(getData(Src, "Village :</span> ", "<")));
  3244. },
  3245. getComte: function (Src) {
  3246. return(cvCar(getData(Src, "; :</span> ", "</p>")));
  3247. },
  3248. quelChamp: function (n) {
  3249. if ((n > 0) && (n < libChamp.length + 1))
  3250. return(libChamp[n - 1]);
  3251. else
  3252. return " -- ";
  3253. },
  3254. quelMetier: function (n) {
  3255. if ((n > 0) && (n < libMetier.length + 1))
  3256. return(libMetier[n - 1]);
  3257. else
  3258. return " -- ";
  3259. },
  3260. quelNiveau: function (n) {
  3261. var x;
  3262. if (n == "NaN")
  3263. x = parseInt(n);
  3264. else
  3265. x = n;
  3266. if (x == 0)
  3267. return(x);
  3268. if (x == 1)
  3269. return("vag.");
  3270. return(x - 1);
  3271. },
  3272. couleurSuspect: function (s) {
  3273. if (nSuspects[s].Stat != -1){
  3274. return (tStath[nSuspects[s].Stat]);
  3275. } else {
  3276. return("660000");
  3277. }
  3278. },
  3279. lienHTML: function (x) {
  3280. var cd = "", cf = "", z = str_replace(x, "\\", "");
  3281. var s = Perso.siSuspect(z);
  3282. if (s != -1) {
  3283. cd = '<font color=#' + Perso.couleurSuspect(s) + '>';
  3284. cf = "</font >";
  3285. }
  3286. return('<a href="http://www.lesroyaumes.com/FichePersonnage.php?login=' + z + '" target="_blank">' + cd + z + cf + '</a>');
  3287. },
  3288. lienBBcode: function (x) {
  3289. var cd = "", cf = "", z = str_replace(x, "\\", "");
  3290. var pv1, pv2;
  3291. var s = Perso.siSuspect(z);
  3292. if (s != -1) {
  3293. cd = "[color=#" + Perso.couleurSuspect(s) + "]";
  3294. cf = "[/color]";
  3295. }
  3296. return('[url=http://www.lesroyaumes.com/FichePersonnage.php?login=' + z + "]" + cd + z + cf + '[/url]');
  3297. },
  3298. siSuspect: function (x) {
  3299. for (var i = 0; i < nSuspects.length; i++) {
  3300. if (nSuspects[i].Pseudo == x)
  3301. return(i);
  3302. }
  3303. return(-1);
  3304. },
  3305. getStat: function () {
  3306. var i = 0;
  3307. nbP = 0, nbPmort = 0, nbPretraite = 0, nbPretranche = 0;
  3308. for (i = 0; i < nPersos.length; i++) {
  3309. if (nPersos[i].Status == "mort")
  3310. nbPmort++;
  3311. if (nPersos[i].Status == "retraite")
  3312. nbPretraite++;
  3313. if (nPersos[i].Status == "retranché")
  3314. nbPretranche++;
  3315. }
  3316. }
  3317. }
  3318. var Presence = {
  3319. tdNom: '<td width="15%"><font size="1">',
  3320. tdVillage: '<td width="15%"><font size="1">',
  3321. tdComte: '<td width="20%"><font size="1">',
  3322. tdPays: '<td width="20%"><font size="1">',
  3323. tdEcu: '<td width="5%"><font size="1">',
  3324. tdStatus: '<td width="5%"><font size="1">',
  3325. ftd: '</font></td>',
  3326. debut: function () {
  3327. RRmenu.enVille();
  3328. FnRR.load();
  3329. if (Perso.getAction() == "Aucune") {
  3330. alert("Présence impossible à faire!!!\nVous n'avez pas fait votre action du jour.");
  3331. return;
  3332. }
  3333. //lecture de la page personnage
  3334. if (QuelOnglet() != "Mon personnage") {
  3335. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', Presence.faire);
  3336. return;
  3337. }
  3338. Presence.faire(document.getElementsByTagName("body")[0].innerHTML);
  3339. },
  3340. faire: function (Src) {
  3341. LeRapport = "[b][u]Présence du " + mDate + "[/u][/b]\n\n";//logit("Presence.faire(l.1920)");
  3342. LeRapport += Perso.getGrade(PersoGrade) + " [b]" + Perso.lienBBcode(PersoPrefs) + "[/b]\n";
  3343. LeRapport += "PC : [b]" + Perso.getPC(Src) + "[/b]\n";
  3344. LeRapport += Perso.getEncombrement(Src) + "\n";
  3345. var x = Perso.getEncombrementGroupe(Src);
  3346. if (x != "")
  3347. LeRapport += x + "\n";
  3348. LeRapport += "État : [b]" + Perso.getEtat(Src) + "[/b]\n";
  3349. LeRapport += "Santé : [b]" + Perso.getSante(Src) + "[/b]\n";
  3350. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=8&a=4', Presence.fin);
  3351. },
  3352. fin: function (Src) {
  3353. var x = Src.substring(Src.indexOf("textePage[4]['Texte']"));
  3354. Escou = "Affectation : [b]" + (PersoEscouade == undefined ? " " : PersoEscouade) + (GetListeEscouade(x) == "" ? " " : " ( " + GetListeEscouade(x) + " )") + "[/b]\n";
  3355. LeRapport += Escou;
  3356. LeRapport += "Niveau d'alerte : [b]" + GetNiveauAlerte() + "[/b]\n";
  3357. var m = GetOrdreDuJour();
  3358. LeRapport += "Ordre du jour : [b]" + m + "[/b]\n";
  3359. x = Perso.getAction();
  3360. LeRapport += "Activité : [b]" + x + "[/b]\n";
  3361. if ((m == "Patrouille/Escorte") || (m == "Défense du pouvoir") || (m == "Défense de la ville"))
  3362. AjouterMission();
  3363. LeRapport += "Récapitulatif du mois : \n";
  3364. LeRapport += "- solde : " + PersoMission + " jour(s)\n";
  3365. ClipboardCopyTo(HtmlToString(LeRapport));
  3366. FnRR.setPersoJour(mDate);
  3367. alert("Fiche de présence disponible dans le presse-papiers.");
  3368. },
  3369. couleurSuspect: function (p) {
  3370. var cc = ["à surveiller", "assigné à résidence", "non grata", "brigand à signaler","Fatum", "Hydre", "top", "mov"];
  3371. var cv = ["660000", "0000ff", "880000", "660000", "ff0000", "ff0000", "008888", "ff0000"];
  3372. var c = "";
  3373. for (var i = 0; i < nSuspects.length; i++) {
  3374. if (p == nSuspects[i].Pseudo) {
  3375. if (nSuspects[i].Stat != -1) {
  3376. c = "<font color=#" + tStath[nSuspects[i].Stat] + ">";
  3377. break;
  3378. }
  3379. break;
  3380. }
  3381. }
  3382. return(c);
  3383. },
  3384. affichage: function () {
  3385. var i, m = "", c = "", cf = "";
  3386. for (i = 0; i < nPersos.length; i++) {
  3387. if (nPersos[i].Pseudo != "") {
  3388. m += "<tr>";
  3389. c = Presence.couleurSuspect(nPersos[i].Pseudo);
  3390. if (c != "")
  3391. cf = "</font>";
  3392. m += Presence.tdNom + c + Perso.lienHTML(nPersos[i].Pseudo) + cf + Presence.ftd;
  3393. m += Presence.tdVillage + nPersos[i].Village + Presence.ftd;
  3394. m += Presence.tdComte + nPersos[i].Comte + Presence.ftd;
  3395. m += Presence.tdPays + nPersos[i].Pays + Presence.ftd;
  3396. m += Presence.tdEcu + (nPersos[i].Ecu != undefined ? nPersos[i].Ecu : " ") + Presence.ftd;
  3397. m += Presence.tdStatus + (nPersos[i].Status != "0" ? nPersos[i].Status : " ") + Presence.ftd;
  3398. m += "</tr>";
  3399. }
  3400. }
  3401. return(m);
  3402. },
  3403. liste: function () {
  3404. Fichier.charger();
  3405. var m = "";
  3406. m += "Liste des présents (" + nPersos.length + " recensés le " + lastRapport + ")";
  3407. m += "<table border=\"1\" cellspacing=\"0\">";
  3408. m += "<tr>";
  3409. m += Presence.tdNom + "<b>Nom</b>" + Presence.ftd;
  3410. m += Presence.tdVillage + "<b>Ville</b>" + Presence.ftd;
  3411. m += Presence.tdComte + "<b>Comté/Duché</b>" + Presence.ftd;
  3412. m += Presence.tdPays + "<b>Pays</b>" + Presence.ftd;
  3413. m += Presence.tdEcu + "<b>Écus</b>" + Presence.ftd;
  3414. m += Presence.tdStatus + "<b>État</b>" + Presence.ftd;
  3415. m += "</tr>";
  3416. m += Presence.affichage();
  3417. m += "</table>"
  3418. monPopup = RRpopup.init("Liste des présents", 0);
  3419. RRpopup.setMessage(monPopup, m + "<p>");
  3420. RRpopup.fermeture(monPopup);
  3421. },
  3422. listeProducteurs: function () {
  3423. alert("liste des producteurs");
  3424. }
  3425. }
  3426. var Portrait = {
  3427. // faire un portrait robot d'un personnage
  3428. debut: function () {
  3429. var x = window.prompt("Nom du personnage");
  3430. if (x != "") {
  3431. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + x, Portrait.faire)
  3432. }
  3433. },
  3434. faire: function (y) {
  3435. if (y.indexOf("<br><br>Ce personnage n") == 0) {
  3436. alert("Personnage inconnu!");
  3437. Portrait.fin();
  3438. return;
  3439. }
  3440. var Src = getData(y, '<div id="ImagePersonnage" style="position:relative;">', "</div></div>");
  3441. var x, s;
  3442. var t = "";
  3443. if (Src.indexOf("hommes") != -1) {
  3444. t += "Homme ";
  3445. s = 1;
  3446. }
  3447. else {
  3448. t += "Femme ";
  3449. s = 2;
  3450. }
  3451. x = getData(Src, "corps/tete", ".png");
  3452. if (x == "01")
  3453. t += "au visage plutôt carré, ";
  3454. else if (x == "02")
  3455. t += "au visage plutôt ovale, ";
  3456. else
  3457. t += "au visage plutôt pointu, ";
  3458. if (Src.indexOf("Cheveux") != -1){
  3459. xx = getData(Src, "id=\"Cheveux\"", ");display");
  3460. x = getData(xx, "corps/cheveu", ".png");
  3461. var c = x.substring(0, 1);
  3462. t += "cheveux ";
  3463. switch (c) {
  3464. case "0":
  3465. t += "blonds";
  3466. break;
  3467. case "1":
  3468. t += "châtains";
  3469. break;
  3470. case "2":
  3471. t += "bruns";
  3472. break;
  3473. case "3":
  3474. t += "noirs";
  3475. break;
  3476. case "4":
  3477. t += "roux";
  3478. break;
  3479. }
  3480. t += ".\n";
  3481. }
  3482. if (Src.indexOf("barbe") != -1){
  3483. t += "Il porte ";
  3484. x = getData(Src, "corps/barbe0", ".png");
  3485. var c = x.substring(0, 1);
  3486. switch (c) {
  3487. case "1":
  3488. t += "une moustache";
  3489. break;
  3490. case "2":
  3491. t += "moustache et bouc";
  3492. break;
  3493. case "3":
  3494. t += "moustache et bouc";
  3495. break;
  3496. default:
  3497. t += "une barbe";
  3498. break;
  3499. }
  3500. t += ".\n";
  3501. }
  3502. t += "Cette personne est vêtue "
  3503. var v = "";
  3504. v = Portrait.getCol(Src);
  3505. if (v != "")
  3506. t += v + ", "; logit ("l. 2510 - t='" + t + "'");
  3507. if (Src.indexOf("Mantel") != -1){
  3508. if (Src.indexOf("Metal") != -1)
  3509. t += "d'une armure, ";
  3510. else {
  3511. var r = "", x = getData(Src, "habits/houppelande", ".png");
  3512. if (x != "")
  3513. r = "d'une houppelande " + Portrait.getCouleur(x) + ", ";
  3514. else t += "d'un mantel, ";
  3515. t += r;
  3516. }
  3517. } else {
  3518. v = Portrait.getChemise(Src);
  3519. if (v != "")
  3520. t += v + ", ";
  3521. v = Portrait.getBustier(Src);
  3522. if (v != "")
  3523. t += v + ", ";
  3524. v = Portrait.getJupe(Src);
  3525. if (v != ""){
  3526. t += v + ", ";
  3527. } else {
  3528. v = Portrait.getBraies(Src);
  3529. if (v != "")
  3530. t += v + ", ";
  3531. }
  3532. }
  3533. if (Src.indexOf("Gilet") != -1)
  3534. t += "d'un gilet, ";
  3535. if (Src.indexOf("Cape") != -1)
  3536. t += "d'une pélerine, ";
  3537. if (Src.indexOf("Tablier") != -1)
  3538. t += "d'un tablier, ";
  3539. if (Src.indexOf("Chapeau") != -1)
  3540. t += "d'un chapeau, ";
  3541. if (Src.indexOf("Metal") == -1){
  3542. v = "";
  3543. if ((Src.indexOf("bottes") != -1) || (Src.indexOf("Bottes") != -1)){
  3544. v = "bottes";}
  3545. else if (Src.indexOf("poulaines") != -1){
  3546. v = "poulaines";}
  3547. else if (Src.indexOf("chausses") != -1){
  3548. v = "chausses";}
  3549. if (v != "")
  3550. t += " et chaussée de " + v;
  3551. else
  3552. t += "et va nu-pied";
  3553. }
  3554. t += ".\n";
  3555.  
  3556. if ((Src.indexOf("epee") != -1) || (Src.indexOf("bouclier") != -1) || (Src.indexOf("hache") != -1) || (Src.indexOf("pioche") != -1) || (Src.indexOf("baton") != -1) || (Src.indexOf("pelle") != -1)) {
  3557. t += "Elle est aussi armée";
  3558. v = "";
  3559. if (Src.indexOf("epee") != -1)
  3560. v += " d'une épée";
  3561. if (Src.indexOf("pioche") != -1)
  3562. v += " d'une pioche";
  3563. if (Src.indexOf("hache") != -1)
  3564. v += " d'une hache";
  3565. if (Src.indexOf("baton") != -1)
  3566. v += " d'un bâton";
  3567. if (Src.indexOf("pelle") != -1)
  3568. v += " d'une pelle";
  3569. if (Src.indexOf("bouclier") != -1)
  3570. v += " et d'un bouclier";
  3571. if (v != "")
  3572. t += v + ".\n";
  3573. // t += ".\n";
  3574. }
  3575. if (Src.indexOf("roimage") != -1)
  3576. t += " Elle porte aussi un bâton de mâge.\n";
  3577. ClipboardCopyTo(t);
  3578. alert("Portrait terminé :\n\n" + t + "\nPortrait disponible dans le presse-papier.");
  3579. },
  3580. getChemise: function (Src) {
  3581. var r = "", x = getData(Src, "habits/chemise", ".png"), xx = getData(Src, "maille", ".png");
  3582. if (x != ""){
  3583. if (x.indexOf("Soie") != -1)
  3584. r = "d'une chemise en Soie";
  3585. else r = "d'une chemise " + Portrait.getCouleur(x);
  3586. } else if (xx != ""){
  3587. r = "d'une cotte de mailles";
  3588. } else
  3589. r = "de haillons";
  3590.  
  3591. return(r);
  3592. },
  3593. getBraies: function (Src) {
  3594. var r = "", x = getData(Src, "habits/braies", ".png");
  3595. if (x != "")
  3596. r = "de braies " + Portrait.getCouleur(x);
  3597. return(r);
  3598. },
  3599. getBustier: function (Src) {
  3600. var r = "", x = getData(Src, "habits/bustier", ".png");
  3601. if (x != "")
  3602. r = "d'un bustier " + Portrait.getCouleur(x);
  3603. return(r);
  3604. },
  3605. getCape: function (Src) {
  3606. var r = "", x = getData(Src, "habits/pelerine", ".png");
  3607. logit ("getCape l.2614 : x='" + x + "'");
  3608. if (x != "")
  3609. r = "d'une pelerine";
  3610. return(r);
  3611. },
  3612. getJupe: function (Src) {
  3613. var r = "", x = getData(Src, "habits/jupe", ".png");
  3614. if (x != "")
  3615. r = "d'une jupe " + Portrait.getCouleur(x);
  3616. return(r);
  3617. },
  3618. getCol: function (Src) {
  3619. var r = "", x = getData(Src, "habits/col", ".png");
  3620. logit ("getCol l.2614 : x='" + x + "'");
  3621. if (x != "")
  3622. if (x.indexOf("Aventurier") != -1)
  3623. r = "d'un col d'Aventurier";
  3624. else r = "d'un col " + Portrait.getCouleur(x);
  3625. return(r);
  3626. },
  3627. getCouleur: function (x) {
  3628. var r = "???";
  3629. switch (x) {
  3630. case "00":
  3631. r = "noir";
  3632. break;
  3633. case "01":
  3634. r = "beige";
  3635. break;
  3636. case "02":
  3637. r = "bleu";
  3638. break;
  3639. case "03":
  3640. r = "rouge";
  3641. break;
  3642. case "04":
  3643. r = "vert";
  3644. break;
  3645. case "05":
  3646. r = "marron";
  3647. break;
  3648. case "06":
  3649. r = "cyan";
  3650. break;
  3651. case "07":
  3652. r = "jaune";
  3653. break;
  3654. case "08":
  3655. r = "mauve";
  3656. break;
  3657. case "09":
  3658. r = "blanc";
  3659. break;
  3660. case "10":
  3661. r = "gris";
  3662. break;
  3663. }
  3664. return(r);
  3665. },
  3666. fin: function () {
  3667.  
  3668. }
  3669. }
  3670. function GetUnSuspect() {
  3671.  
  3672. }
  3673.  
  3674. var Suspects = {
  3675. tdType: '<td width="10%"><font size="1">',
  3676. tdNom: '<td width="20%"><font size="1">',
  3677. tdMotif: '<td width="50%"><font size="1">',
  3678. tdDate: '<td width="10%"><font size="1">',
  3679. tdMaj: '<td width="10%"><font size="1">',
  3680. ftd: '</font></td>',
  3681. addTable: function (el) {
  3682. var xe1 = document.createElement("table");
  3683. xe1.setAttribute('border', '1');
  3684. xe1.setAttribute('cellspacing', '0');
  3685. el.appendChild(xe1);
  3686. return(xe1);
  3687. },
  3688. addTR: function (t, i) {
  3689. var xTR = document.createElement("tr");
  3690. if (i == -1) {
  3691. Suspects.addTD(xTR, "10%", "Stat.");
  3692. Suspects.addTD(xTR, "20%", "Nom");
  3693. Suspects.addTD(xTR, "50%", "Motif");
  3694. Suspects.addTD(xTR, "10%", "Date Ajout");
  3695. Suspects.addTD(xTR, "10%", "Mod.");
  3696. } else {
  3697. if (nSuspects[i].Date == "à supprimer")
  3698. xTR.setAttribute('style', 'background-color: #CCCCCC');
  3699. Suspects.addTD(xTR, "10%", "<i><font size=1 color=#"+ tStath[nSuspects[i].Stat] + ">" + tStat[nSuspects[i].Stat] + "</font></i>");
  3700. Suspects.addTD(xTR, "20%", "<b>" +Perso.lienHTML(nSuspects[i].Pseudo)) + "</b>";
  3701. Suspects.addTD(xTR, "50%", nSuspects[i].Motif);
  3702. Suspects.addTD(xTR, "10%", nSuspects[i].Date);
  3703. Suspects.addTDn(xTR, i);
  3704. }
  3705. t.appendChild(xTR);
  3706. },
  3707. addTD: function (xTR, s, x) {
  3708. var xe1 = document.createElement("td");
  3709. xe1.setAttribute('width', s);
  3710. xe1.innerHTML = x;
  3711. xTR.appendChild(xe1);
  3712. },
  3713. addTDn: function (xTR, i) {
  3714. var xTD = document.createElement("td");
  3715. xTD.setAttribute('width', '10%');
  3716. if (i < 0)
  3717. xTD.innerHTML = "Mod.";
  3718. else {
  3719. var xe2 = document.createElement("a");
  3720. xe2.setAttribute('href', '#');
  3721. xe2.setAttribute("class", 'lien_default');
  3722. xe2.onclick = function () {
  3723. Suspects.modifier(i);
  3724. return false;
  3725. };
  3726. xe2.innerHTML = "Mod.";
  3727. xTD.appendChild(xe2);
  3728. }
  3729. xTR.appendChild(xTD);
  3730. },
  3731. exporter: function () {
  3732. var t = '[table cellspacing="0" border="1"]\n';
  3733. for (var i = 0; i < nSuspects.length; i++) {
  3734. t += "[tr]";
  3735. t += "[td]" + nSuspects[i].Pseudo + "[/td]";
  3736. t += "[td]" + nSuspects[i].Motif + "[/td]";
  3737. t += "[td]" + nSuspects[i].Date + "[/td]";
  3738. t += "[td]" + nSuspects[i].Stat + "[/td]";
  3739. t += "[/tr]\n";
  3740. }
  3741. t += '[/table]';
  3742. ClipboardCopyTo(t);
  3743. alert("Export terminé, message disponible dans le presse-papier.");
  3744. },
  3745. importer: function () {
  3746. if (!siOnglet("Le tribunal", "Vous devez vous rendre au tribunal"))
  3747. return;
  3748. var el = document.getElementById("zoneTexte1");
  3749. SaveIG = el.innerHTML;
  3750. el.innerHTML = 'Veuillez coller ici la liste à importer selon le format :<br><br>' +
  3751. ' <b>Nom</b> <i>[Tab]</i> <b>Motif</b> <i>[Tab]</i> <b>Date</b> <i>[Tab]</i> <b>Statut</b><i>[CR]</i><br><br>' +
  3752. ' le statut étant : <br>"<b>0</b>" = <i>Sous surveillance</i>, ' +
  3753. '"<b>1</b>" = <i>A assigner</i>, ' +
  3754. '"<b>2</b>" = <i>Non grata</i><br>' +
  3755. '"<b>3</b>" = <i>Brigandage</i>, ' +
  3756. '"<b>4</b>" = <i>Membre d\'un groupe de brigands connu</i><br>' +
  3757. '"<b>5</b>" = <i>Trouble ordre public</i>,' +
  3758. '"<b>6</b>" = <i>Mort ou Vif</i><br><br>' +
  3759. '<form name="formulaire">' +
  3760. '<textarea name="saisie" id="saisie" cols="40" rows="10">' +
  3761. '</textarea><br>' +
  3762. '</form>' +
  3763. '<br>';
  3764. RRmenu.addSubfunction(el, Suspects.importerTerminer, "Valider");
  3765. RRmenu.addSubfunction(el, Suspects.importerAnnuler, "Annuler");
  3766. },
  3767. importerAnnuler: function () {
  3768. Suspects.importerFin();
  3769. },
  3770.  
  3771. //cleanArray removes all duplicated elements
  3772. cleanArray : function (z) {
  3773. var i, j, len = z.length, out = [], obj = [];
  3774. for (i = 0; i < len; i++) {
  3775. obj[z[i]] = 0;
  3776. }
  3777. for (j in obj) {
  3778. out.push(j);
  3779. }
  3780. return out;
  3781. },
  3782. importerTerminer: function () {
  3783. var t = document.formulaire.saisie.value;
  3784. var e = t.split("\n");
  3785. for (var i = 0; i < e.length; i++) {
  3786. var f = e[i].split(String.fromCharCode(9));
  3787. if (f[0] != "")
  3788. nSuspects.push(new Brigand(f[0], f[1], f[2], f[3]));
  3789. }
  3790. nSuspects = nSuspects.sort();
  3791. // logit("Suspects.importerTerminer - Nettayage doublons");
  3792. // var newNbr = Suspects.cleanArray(nSuspects);
  3793. // if (newNbr.length > 0) {
  3794. // logit("Suspects.importerTerminer - newNbr.length : " + newNbr.length);
  3795. // for (var i = 0; i < e.length; i++) {
  3796. // logit("Suspects.importerTerminer - newNbr.i : " + newNbr[i]);
  3797. // }
  3798. // } else {
  3799. Suspects.enregistrer();
  3800. alert("La liste prise en compte comporte " + nSuspects.length + " suspects.");
  3801. Suspects.lire();
  3802. Suspects.importerFin();
  3803. // }
  3804. Suspects.lister();
  3805. },
  3806. importerFin: function () {
  3807. var el = document.getElementById("zoneTexte1");
  3808. el.innerHTML = SaveIG;
  3809. },
  3810. Reinit: function(){
  3811. if (localStorage) {
  3812. var x = "";SuspDuche = "RRSuspects_" + mDuche;
  3813. localStorage[SuspDuche] = x;
  3814. } else {
  3815. alert("localStorage indisponible");
  3816. }
  3817. },
  3818. enregistrer: function () {
  3819. if (localStorage) {
  3820. var x = ""; SuspDuche = "RRSuspects_" + mDuche;
  3821. nSuspects = nSuspects.sort();
  3822. for (var i = 0; i < nSuspects.length; i++) {
  3823. x += nSuspects[i].Pseudo + "|";
  3824. x += nSuspects[i].Motif + "|";
  3825. x += nSuspects[i].Date + "|";
  3826. x += nSuspects[i].Stat + "ø";
  3827. }
  3828. localStorage[SuspDuche] = x;
  3829. } else {
  3830. alert("localStorage indisponible");
  3831. }
  3832. },
  3833. lire: function () {
  3834. if (nSuspects.length != undefined)
  3835. nSuspects.splice(0, nSuspects.length);
  3836. var z = "", i = 0; SuspDuche = "RRSuspects_" + mDuche;
  3837. if (localStorage) {
  3838. try {
  3839. z = localStorage[SuspDuche].split('ø');
  3840. } catch (e) {
  3841. return;
  3842. }
  3843. for (i = 0; i < z.length; i++) {
  3844. if (z[i] == null)
  3845. break;
  3846. var y = z[i].split("|");
  3847. if (y[0] != "")
  3848. nSuspects.push(new Brigand(y[0], y[1], y[2], y[3]));
  3849. }
  3850. } else {
  3851. alert("localStorage indisponible");
  3852. }
  3853. },
  3854. lister: function () {
  3855. if (!siOnglet("Le tribunal", "Vous devez vous rendre au tribunal"))
  3856. return;
  3857. var m = "";
  3858. Suspects.lire();
  3859. m += "Liste des suspects (" + nSuspects.length + ") ";
  3860. var el = document.getElementById("zoneTexte1");
  3861. SaveIG = el.innerHTML;
  3862. el.innerHTML = m;
  3863. RRmenu.addSubfunction(el, Suspects.ajouter, "Ajouter");
  3864. var t = Suspects.addTable(el);
  3865. Suspects.addTR(t, -1);
  3866. Suspects.listerListe(t);
  3867. RRmenu.addSubfunction(el, Suspects.listerTerminer, "Terminer");
  3868. RRmenu.addSubfunction(el, Suspects.ajouter, "Ajouter");
  3869. },
  3870. listerListe: function (t) {
  3871. var i, m = "";
  3872. for (i = 0; i < nSuspects.length; i++) {
  3873. Suspects.addTR(t, i);
  3874. }
  3875. return(m);
  3876. },
  3877. listerTerminer: function () {
  3878. var el = document.getElementById("zoneTexte1");
  3879. el.innerHTML = SaveIG;
  3880. },
  3881. verifier: function () {
  3882. if (siOnglet("Le tribunal", "Vous devez vous rendre au tribunal") == 0)
  3883. return;
  3884. Bar.debut("<b>Vérification de la liste des suspects</b>", "zoneTexte1");
  3885. var el = document.getElementById("zoneTexte1");
  3886. el.innerHTML += "<br>";
  3887. nPS = 0;
  3888. errorCnt = 0;
  3889. errorPersoCnt = 0;
  3890. LeRapport = "";
  3891. Suspects.verifierSuspects();
  3892. },
  3893. verifierSuspects: function () {
  3894. if (nPS < nSuspects.length) {
  3895. Bar.progression(Math.floor(nPS + 1) + "/" + nSuspects.length + ">>>" + nSuspects[nPS].Pseudo,
  3896. (Math.floor(nPS + 1) / nFurtifs.length) * 100);
  3897. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (nSuspects[nPS].Pseudo), Suspects.verifierInfo);
  3898. } else {
  3899. Bar.addMessage("<br>Vérification terminée ");
  3900. Suspects.verifierTerminer();
  3901. }
  3902. },
  3903. verifierInfo: function (Src) {
  3904. if (Src.indexOf("Connexion perdue<") != 0) {
  3905. if (Src.indexOf("Derni&egrave;re connexion") != -1) {
  3906. nPS++;
  3907. Suspects.verifierSuspects();
  3908. }
  3909. else if (Src.indexOf("Ce personnage n'existe pas, ou plus, ou pas encore.") != -1) {
  3910. if (LeRapport == "")
  3911. Bar.setTexte("Personnages qui n'existent plus:<br>");
  3912. LeRapport = nSuspects[nPS].Pseudo + "\n";
  3913. Bar.addMessage(nSuspects[nPS].Pseudo + "<br>");
  3914. nSuspects[nPS].Date = "<b>à supprimer</b>";
  3915. nPS++;
  3916. Suspects.verifierSuspects();
  3917. }
  3918. }
  3919. else
  3920. MessageErreur = "<b>Erreur pendant le contrôle.</b>";
  3921. },
  3922. num: -1,
  3923. modifier: function (n) {
  3924. Suspects.num = n;
  3925. var el = document.getElementById("zoneTexte1");
  3926. if (nSuspects[n].Date == "undefined") nSuspects[n].Date= mDate;
  3927. if (nSuspects[n].Stat == "undefined") nSuspects[n].Stat= "Surv";
  3928. logit("nSuspects[n].Stat (l.2496) : "+ nSuspects[n].Stat);
  3929. el.innerHTML = '<h1>' + nSuspects[n].Pseudo + "</h1>" +
  3930. '<form name="formulaire">' +
  3931. '<input name="pseudo" id="pseudo" value="' + nSuspects[n].Pseudo + '"><br><br>' +
  3932. '<input value="0" name="Stat" id="Surv." type="radio" ' + (nSuspects[n].Stat ==0 ? 'CHECKED' : '') + '>Sous surveillance &nbsp;' +
  3933. '<input value="1" name="Stat" id="Assign." type="radio" ' + (nSuspects[n].Stat ==1 ? 'CHECKED' : '') + '>A assigner &nbsp; ' +
  3934. '<input value="2" name="Stat" id="PNG" type="radio" ' + (nSuspects[n].Stat ==2 ? 'CHECKED' : '') + '>Non grata<br>' +
  3935. '<input value="3" name="Stat" id="Brig." type="radio" ' + (nSuspects[n].Stat ==3 ? 'CHECKED' : '') + '>Brigandage &nbsp; ' +
  3936. '<input value="4" name="Stat" id="Membre" type="radio" ' + (nSuspects[n].Stat ==4 ? 'CHECKED' : '') + '>Membre &nbsp;' +
  3937. '<input value="5" name="Stat" id="TOP" type="radio" ' + (nSuspects[n].Stat ==5 ? 'CHECKED' : '') + '>Trouble ordre public &nbsp;' +
  3938. '<input value="6" name="Stat" id="MoV" type="radio" ' + (nSuspects[n].Stat ==6 ? 'CHECKED' : '') + '>Mort ou Vif<br><br>' +
  3939. "Motif <br>" +
  3940. '<textarea name="motif" id="motif" cols="40" rows="10">' +
  3941. nSuspects[n].Motif +
  3942. '</textarea><br>' +
  3943. "Date inscription (jj/mm/aaaa)" + "<br>" +
  3944. '<input name="date" id="date" value="' + nSuspects[n].Date + '">' +
  3945. '<input name="n" id="n" value="' + n + '" disabled></form>' +
  3946. '<br>';
  3947. RRmenu.addSubfunction(el, Suspects.modifierOK, "Valider");
  3948. RRmenu.addSubfunction(el, Suspects.importerAnnuler, "Annuler");
  3949. RRmenu.addSubfunction(el, Suspects.modifierSupprimer, "Supprimer");
  3950. },
  3951. supprimer: function (n) {
  3952. alert("supprimer : " + nSuspects[n].Pseudo);
  3953. },
  3954. modifierOK: function () {
  3955. var n = Suspects.num;
  3956. var nom = document.formulaire.pseudo.value;
  3957. if (nom == "") {
  3958. alert("Le nom du suspect doit être renseigné!");
  3959. return;
  3960. }
  3961. var motif = document.formulaire.motif.value;
  3962. if (motif == "") {
  3963. alert("Le motif est obligatoire!");
  3964. return;
  3965. }
  3966. nSuspects[n].Pseudo = nom;
  3967. nSuspects[n].Motif = motif;
  3968. t = document.formulaire.date.value;
  3969. nSuspects[n].Date = t;
  3970. for (i=0; i<document.formulaire.Stat.length; i++) {
  3971. if (document.formulaire.Stat[i].checked) {
  3972. t = document.formulaire.Stat[i].value;
  3973. i = document.formulaire.Stat.length;
  3974. }
  3975. }
  3976. nSuspects[n].Stat = t;
  3977. Suspects.enregistrer();
  3978. Suspects.importerAnnuler();
  3979. Suspects.num = -1;
  3980. Suspects.lister();
  3981. },
  3982. modifierSupprimer: function () {
  3983. if (confirm("Voulez-vous vraiment supprimer " + nSuspects[Suspects.num].Pseudo) == true) {
  3984. nSuspects.splice(Suspects.num, 1);
  3985. Suspects.enregistrer();
  3986. }
  3987. Suspects.importerAnnuler();
  3988. Suspects.num = -1;
  3989. },
  3990. ajouter: function () {
  3991. Suspects.num = -2;
  3992. var el = document.getElementById("zoneTexte1");
  3993. el.innerHTML = '<h1>' + "Ajouter un suspect" + "</h1>" +
  3994. '<form name="formulaire">' +
  3995. 'Nom : <input name="pseudo" id="pseudo" value=""><br><br>' +
  3996. '<input value="0" name="Stat" type="radio" CHECKED>Sous surveillance &nbsp;' +
  3997. '<input value="1" name="Stat" type="radio" >A assigner &nbsp; ' +
  3998. '<input value="2" name="Stat" type="radio" >Non grata<br>' +
  3999. '<input value="3" name="Stat" type="radio" >Brigandage &nbsp; ' +
  4000. '<input value="4" name="Stat" type="radio" >Membre... &nbsp; ' +
  4001. '<input value="5" name="Stat" type="radio" >Trouble ordre public &nbsp;' +
  4002. '<input value="6" name="Stat" type="radio" >Mort ou Vif<br><br>' +
  4003. "<br>Motif <br>" +
  4004. '<textarea name="motif" id="motif" cols="40" rows="10">' +
  4005. "" +
  4006. '</textarea><br>' +
  4007. "Date inscription (jj/mm/aaaa)" + "<br>" +
  4008. '<input name="date" id="date" value="' + mDate + '">' +
  4009. '</form>' +
  4010. '<br>';
  4011. RRmenu.addSubfunction(el, Suspects.ajouterOK, "Ajouter");
  4012. RRmenu.addSubfunction(el, Suspects.importerAnnuler, "Annuler");
  4013. },
  4014. ajouterOK: function () {
  4015. var nom = document.formulaire.pseudo.value;
  4016. if (nom == "") {
  4017. alert("Le nom du suspect doit être renseigné!");
  4018. return;
  4019. }
  4020. var motif = document.formulaire.motif.value;
  4021. if (motif == "") {
  4022. alert("Le motif est obligatoire!");
  4023. return;
  4024. }
  4025. var date = document.formulaire.date.value;
  4026. if (date == "") {
  4027. alert("La date est obligatoire!");
  4028. return;
  4029. }
  4030.  
  4031. Stat = 0 ;
  4032. for (i=0; i<document.formulaire.Stat.length; i++) {
  4033. if (document.formulaire.Stat[i].checked) {
  4034. Stat = document.formulaire.Stat[i].value;
  4035. i = document.formulaire.Stat.length;
  4036. }
  4037. }
  4038.  
  4039. nSuspects.push(new Brigand(nom, motif, date, Stat));
  4040. nSuspects.sort(triPseudo);
  4041. Suspects.enregistrer();
  4042. Suspects.importerAnnuler();
  4043. Suspects.num = -1;
  4044. },
  4045. verifierTerminer: function () {
  4046. ClipboardCopyTo(BBc.fromHTML(document.getElementById("messageGuet").innerHTML));
  4047. Bar.addMessage(nSuspects.length + " suspects contrôlés<br>(la liste est dans le presse-papier)<br>");
  4048. Bar.progression(" ", -1);
  4049. RRmenu.addSubfunction(document.getElementById("zoneTexte1"), Bar.fin, "Fermer");
  4050. },
  4051. controle: function () {
  4052. if (nPersos.length < 1)
  4053. Fichier.charger();
  4054. var i, j, t = "";//logit("Suspects.controle (l.2573) nPersos.length : "+ nPersos.length);
  4055. for (i = 0; i < nPersos.length; i++) {
  4056. for (j = 0; j < nSuspects.length; j++) {
  4057. if (nPersos[i].Pseudo == nSuspects[j].Pseudo) {
  4058. t += nSuspects[j].Pseudo + " : " + nSuspects[j].Motif + "\n";
  4059. }
  4060. }
  4061. }
  4062. if (t != "")
  4063. alert("Suspects présents:\n" + t);
  4064. else
  4065. alert("Aucun suspect détecté.")
  4066. return(t);
  4067. },
  4068. identifier: function () {
  4069. var t = window.prompt("Collez ici la liste à identifier");
  4070. if ((t == null) || (t == ""))
  4071. return;
  4072. var x = t.indexOf("Aujourd'hui., en chemin, vous avez croisé ");
  4073. if (x != -1)
  4074. t = t.substring("Aujourd'hui., en chemin, vous avez croisé ".length);
  4075. if (t.substring(t.length - 1) == '.')
  4076. t = t.substring(0, t.length - 1);
  4077. var e = t.split(' '), n = -1, r = "";
  4078. for (var i = 0; i < e.length; i++) {
  4079. if ((e[i] == "et") || (e[i] == "de") || (e[i] == " ") || (e[i] == "") ||
  4080. (e[i] == "un") || (e[i] == "groupe") || (e[i] == "composé"))
  4081. continue;
  4082. if (e[i].indexOf(',') != -1) {
  4083. var f = e[i].split(',');
  4084. for (var j = 0; j < f.length; j++) {
  4085. if ((f[j] == "et") || (f[j] == "de") || (f[j] == " ") || (f[j] == ""))
  4086. continue;
  4087. r += Suspects.identifierUn(f[j]);
  4088. }
  4089. } else {
  4090. r += Suspects.identifierUn(e[i]);
  4091. }
  4092. }
  4093. if (r != "")
  4094. alert("Identification:\n" + r);
  4095. },
  4096. identifierUn: function (x) {
  4097. var n = Perso.siSuspect(x), r = "";
  4098. if (n != -1)
  4099. r += x + " : " + nSuspects[n].Motif + " (" + nSuspects[n].Stat + ")\n";
  4100. else
  4101. r += x + " : R.A.S.\n";
  4102. return(r);
  4103. }
  4104. }
  4105.  
  4106.  
  4107. var Test = {
  4108. debut: function () {
  4109. alert("test");
  4110. }
  4111. }
  4112. var Fichier = {
  4113. charger: function () {
  4114. if (nPersos.length != undefined)
  4115. nPersos.splice(0, nPersos.length);
  4116. var z = "", y, i = 0, zzz = "";
  4117. if ((mVille != "Sur les chemins") && (mVille != "\n\t\t\t\t\t\t\t<div>")){//"RRvillageois_\n<div>"
  4118. VilName= "RRvillageois_" + mVille;
  4119. if (localStorage) {
  4120. try {
  4121. z = localStorage[VilName].split('ø');
  4122. } catch (e) {
  4123. hPersos = ""; localStorage[VilName] = "|||||0|0|I|0|0|0|00/00/0000ø";
  4124. return;
  4125. }
  4126. // logit("Fichier charger.z.length (l.3340) : " + z.length + "'");
  4127. if (z.length > 2){
  4128. lastRapport = z[0]; //logit("Fichier.charger.lastRapport (l.3342) : " + lastRapport);
  4129. z.splice(0, 1);
  4130. for (i = 0; i < z.length; i++) {
  4131. if ((z[i] != null) && (z[i] != "")) {
  4132. y = z[i].split("|");
  4133. if (y.length > 11)
  4134. nPersos.push(new Personnage(y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], y[8], y[9], y[10], y[11]));
  4135. }
  4136. }
  4137. } else {
  4138. lastRapport = "00/00/0000";
  4139. }
  4140. } else {
  4141. alert("localStorage indisponible");
  4142. }
  4143. }
  4144. },
  4145. enregistrer: function () {
  4146. /* la première ligne est la date du recensement */
  4147. var x = mDate + "ø", xp = nPersos;
  4148. for (var i = 0; i < xp.length; i++) {
  4149. x += xp[i].Pseudo;
  4150. x += "|" + xp[i].Village;
  4151. x += "|" + xp[i].Comte;
  4152. x += "|" + xp[i].Pays;
  4153. x += "|" + xp[i].Status;
  4154. x += "|" + xp[i].PR;
  4155. x += "|" + xp[i].Ecu;
  4156. x += "|" + xp[i].Niveau;
  4157. x += "|" + xp[i].Metier;
  4158. x += "|" + xp[i].Champ1;
  4159. x += "|" + xp[i].Champ2;
  4160. x += "|" + xp[i].date;
  4161. x += "ø";
  4162. }
  4163. if ((mVille != "Sur les chemins") && (mVille != "\n\t\t\t\t\t\t\t<div>")){//"RRvillageois_\n<div>"
  4164. // if (mVille != "Sur les chemins"){
  4165. VilName= "RRvillageois_" + mVille;
  4166. if (localStorage) {
  4167. try {
  4168. //logit("Fichier enregistrer (l.3381) VilName : '" + VilName + "'");
  4169. localStorage[VilName] = x;
  4170. } catch (e) {
  4171. logit("Fichier.enregistrer (l.3385) ERREUR ENREGISTREMENT ('" + VilName + "') : '" + e + "'");
  4172. return;
  4173. }
  4174. hPersos = mDate;
  4175. lastRapport = mDate;
  4176. } else {
  4177. alert("localStorage indisponible");
  4178. }
  4179. }
  4180. },
  4181. chargerHier: function () {
  4182. if (nHier.length != undefined)
  4183. nHier.splice(0, nHier.length);
  4184. var z = "", y, i = 0 , zzz = "";
  4185. if ((mVille != "Sur les chemins") && (mVille != "\n\t\t\t\t\t\t\t<div>")){//"RRvillageois_\n<div>"
  4186. VilName= "RRvillageoisHier_" + mVille; //logit("Fichier.chargerHier (l.3412) VilName : '" + VilName + "'");
  4187. if (localStorage) {
  4188. try {
  4189. z = localStorage[VilName].split('ø');
  4190. } catch (e) {
  4191. localStorage[VilName] = "||||0ø";
  4192. return;
  4193. }
  4194. /*le premier élément de la liste est la date d'hier */
  4195. // logit("Fichier chargerHier.z.length (l.3421) : " + z.length + "'");
  4196. if (z.length>2){
  4197. lastHier = z[0]; //logit("Fichier chargerHier.z[0] (l.3423) : " + z[0] + "' lastHier : '" + lastHier + "'");
  4198. z.splice(0, 1);
  4199. for (i = 0; i < z.length; i++) {
  4200. if ((z[i] != null) && (z[i] != "")) {
  4201. y = z[i].split("|");
  4202. if (y.length > 4)
  4203. nHier.push(new Present(y[0], y[1], y[2], y[3], y[4]));//logit("Fichier chargerHier-Present (l.2698) : '" + y[0] +"' '"+ y[1] +"' '"+ y[2] +"' '"+ y[3] +"' '"+ y[4] +"'");
  4204. }
  4205. }
  4206. } else {
  4207. lastHier = "00/00/0000";
  4208. }
  4209. } else {
  4210. alert("localStorage indisponible");
  4211. }
  4212. }
  4213. },
  4214. enregistrerHier: function () {
  4215. /*le premier élément de la liste est la date d'hier */
  4216. /* Récupère la liste de la veille pour sauvegarde */
  4217. var z = "", y, i = 0, zzz = "";
  4218. if ((mVille != "Sur les chemins") && (mVille != "\n\t\t\t\t\t\t\t<div>")){//"RRvillageois_\n<div>"
  4219. VilName= "RRvillageois_" + mVille;
  4220. if (localStorage) {
  4221. try {
  4222. z = localStorage[VilName].split('ø');
  4223. } catch (e) {
  4224. logit("Fichier.charger/enregistrerHier (l.3443) ERREUR CHARGEMENT ('" + VilName + "') : '" + e + "'");
  4225. return;
  4226. }
  4227. if ((nHier.length != undefined) && (nHier.length > 0))
  4228. nHier.splice(0, nHier.length);
  4229. var x = z[0] + "ø";
  4230. z.splice(0, 1);
  4231. for (i = 0; i < z.length; i++) {
  4232. if ((z[i] != null) && (z[i] != "")) {
  4233. y = z[i].split("|");
  4234. if (y.length > 11)
  4235. nHier.push(new Present(y[0], y[1], y[2], y[3], y[4], y[6]));//logit("enregistrerHier (l.3454) : nHier.length : '" + nHier.length + "' y[0], y[1], y[2], y[3], y[4], y[6] = " + y[0] + " , " + y[1] + " , " + y[2] + " , " + y[3] + " , " + y[4] + " , " + y[6]);
  4236. x += nHier[i].Pseudo;
  4237. x += "|" + nHier[i].Village;
  4238. x += "|" + nHier[i].Comte;
  4239. x += "|" + nHier[i].Pays;
  4240. x += "|" + nHier[i].Status;
  4241. x += "|" + nHier[i].Ecu;
  4242. x += "ø";
  4243. }
  4244. }
  4245. VilName= "RRvillageoisHier_" + mVille;
  4246. if (localStorage) {
  4247. try {
  4248. localStorage[VilName] = x;
  4249. } catch (e) {
  4250. logit("Fichier.enregistrerHier (l.3476) ERREUR ENREGISTREMENT ('" + VilName + "') : '" + e + "'");
  4251. return;
  4252. }
  4253. lastHier = lastRapport;
  4254. } else {
  4255. alert("localStorage indisponible");
  4256. }
  4257. } else {
  4258. lastHier = lastRapport;
  4259. }
  4260. }
  4261. }
  4262. /* FIN Récupère la liste de la veille pour sauvegarde */
  4263. }
  4264.  
  4265. var Village = {
  4266. analyse: function () {
  4267. var re = "";
  4268. r = "<b>Statistiques :</b><br>";
  4269. r += Village.analyseFaire();
  4270. r += "<br><b>Activité économique :</b><br>";
  4271. var v = 0, vt = 0;
  4272. for (i = 0; i < libChamp.length; i++) {
  4273. v = Village.champs(i);
  4274. if (v > 0) {
  4275. r += libChamp[i] + " : " + v + "<br>";
  4276. vt += v;
  4277. }
  4278. }
  4279. for (i = 0; i < libMetier.length; i++) {
  4280. v = Village.echoppes(i);
  4281. if (v > 0) {
  4282. r += libMetier[i] + " : " + v + "<br>";
  4283. vt += v;
  4284. }
  4285. }
  4286. r += "Total des unités économiques : " + vt + "<br>";
  4287. r += "<br>";
  4288. monPopup = RRpopup.init("Statistiques", 0);
  4289. RRpopup.setMessage(monPopup, r);
  4290. RRpopup.progression(monPopup, " ", -1);
  4291. RRpopup.fermeture(monPopup);
  4292. },
  4293. analyseFaire: function () {
  4294. var r = "", i;
  4295. if (nPersos.length > 0) {
  4296. var nbP = 0, nbPmort = 0, nbPretraite = 0,
  4297. nbH = 0, nbHmort = 0, nbHretraite = 0,
  4298. nbV = 0, nbVmort = 0, nbVretraite = 0,
  4299. nbE = 0, nbEmort = 0, nbEretraite = 0, sPersosExt = "", nbActifs = 0;
  4300. nbP = nPersos.length;
  4301. // logit("Village.analyseFaire.nbP : " + nbP);
  4302. for (i = 0; i < nbP; i++) {
  4303. if (nPersos[i].Status == "mort")
  4304. nbPmort++;
  4305. if (nPersos[i].Status == "retraite")
  4306. nbPretraite++;
  4307. if (nPersos[i].Village != mVille) {
  4308. if (nPersos[i].Comte != mDuche) {
  4309. nbE++;
  4310. if (nPersos[i].Status == "mort")
  4311. nbEmort++;
  4312. if (nPersos[i].Status == "retraite")
  4313. nbEretraite++;
  4314. } else {
  4315. nbV++;
  4316. if (nPersos[i].Status == "mort")
  4317. nbVmort++;
  4318. if (nPersos[i].Status == "retraite")
  4319. nbVretraite++;
  4320. }
  4321. } else {
  4322. nbH++;
  4323. if (nPersos[i].Status == "actif") {
  4324. nbActifs++;
  4325. sPersosExt += Perso.lienHTML(nPersos[i].Pseudo) + '<br>'; // logit("Village.analyseFaire.sPersosExt" + sPersosExt);
  4326. }
  4327. if (nPersos[i].Status == "mort")
  4328. nbHmort++;
  4329. if (nPersos[i].Status == "retraite")
  4330. nbHretraite++;
  4331. }
  4332. }
  4333. logit("Village.analyseFaire.r : " + r);
  4334. r +="<i><b> Synthèse pour " + mVille + " (" + mDuche + ")</b><br>";
  4335. r += Village.unStat("Présent", nbP, nbPmort, nbPretraite);
  4336. r += Village.unStat("Résident", nbH, nbHmort, nbHretraite);
  4337. r += Village.unStat("Étranger", nbE, nbEmort, nbEretraite);
  4338. r += Village.unStat("Voisin", nbV, nbVmort, nbVretraite);
  4339. r += '</i><p>' + "<b>Liste des " + nbActifs + " résidents actifs </b><br>" + sPersosExt + '</p>';
  4340. }
  4341. return(r);
  4342. },
  4343. champs: function (c) {
  4344. var n = 0;
  4345. for (var i = 0; i < nPersos.length; i++) {
  4346. if ((nPersos[i].Status == "actif") && (nPersos[i].Champ1 == c + 1))
  4347. n++;
  4348. if ((nPersos[i].Status == "actif") && (nPersos[i].Champ2 == c + 1))
  4349. n++;
  4350. }
  4351. return(n);
  4352. },
  4353. echoppes: function (c) {
  4354. var n = 0;
  4355. for (var i = 0; i < nPersos.length; i++) {
  4356. if ((nPersos[i].Status == "actif") && (nPersos[i].Metier == c + 1))
  4357. n++;
  4358. }
  4359. return(n);
  4360. },
  4361. unStat: function (t, a, b, c) {
  4362. var r = pluriel(a, t) + " : " + a;
  4363. r += " (" + b + pluriel(b, " mort");
  4364. r += ", " + c + pluriel(c, " retraité");
  4365. r += ")<br>";
  4366. return(r);
  4367. },
  4368. registre: function () {
  4369. if (nPersos.length < 1)
  4370. return;
  4371. monPopup = RRpopup.init("Registre", 0);
  4372. RRpopup.progression(monPopup, " ", -1);
  4373. RRpopup.fermeture(monPopup);
  4374. RRpopup.addBouton(monPopup, "Message(s)", MailRR.liste);
  4375. Village.selectionAffichage();
  4376. },
  4377. selectionAffichage: function () {
  4378. var i, r = "<b>Registre du village</b><br>", b1, b2, b3;
  4379. r += '<table border="1" cellspacing="0">';
  4380. r += Village.unRegistre(-1);
  4381. for (i = 0; i < nPersos.length; i++) {
  4382. b1 = 0, b2 = 0, b3 = 0, b4 = 0, b5 = 0;
  4383. if ((eVille == "Ville") ||
  4384. ((eVille == mVille) && (nPersos[i].Village == mVille)) ||
  4385. ((eVille == "Étranger") && (nPersos[i].Village != mVille)))
  4386. b1 = 1;
  4387. if ((eComte == "Comté/Duché") ||
  4388. ((eComte == mDuche) && (nPersos[i].Comte == mDuche)) ||
  4389. ((eComte == "Étranger") && (nPersos[i].Comte != mDuche)))
  4390. b2 = 1;
  4391. if (eActif == "Actif") {
  4392. if (nPersos[i].Status == "actif")
  4393. b3 = 1;
  4394. } else
  4395. b3 = 1;
  4396. if (eChamp != -1) {
  4397. if ((eChamp == nPersos[i].Champ1) || (eChamp == nPersos[i].Champ2))
  4398. b4 = 1;
  4399. } else
  4400. b4 = 1;
  4401. if (eMetier != -1) {
  4402. if (eMetier == nPersos[i].Metier)
  4403. b5 = 1;
  4404. } else
  4405. b5 = 1;
  4406. if (b1 && b2 && b3 && b4 && b5) {
  4407. r += Village.unRegistre(i);
  4408. }
  4409. }
  4410. r += "</table>";
  4411. RRpopup.setMessage(monPopup, r);
  4412. var xzone;
  4413. xzone = monPopup.document.getElementById("selEtat");
  4414. RRmenu.addSubfunction3(xzone, Village.selectionEtat, eActif);
  4415. xzone = monPopup.document.getElementById("selVille");
  4416. RRmenu.addSubfunction3(xzone, Village.selectionVille, eVille);
  4417. xzone = monPopup.document.getElementById("selComte");
  4418. RRmenu.addSubfunction3(xzone, Village.selectionComte, eComte);
  4419. xzone = monPopup.document.getElementById("selChamp");
  4420. var xx = '<form id="fChamp"><select id="sChamp">';
  4421. xx += "<option>" + "Champs" + "</option>";
  4422. for (i = 0; i < libChamp.length; i++) {
  4423. if (i == eChamp - 1)
  4424. xx += "<option selected>"
  4425. else
  4426. xx += "<option>"
  4427. xx += libChamp[i] + "</option>";
  4428. }
  4429. xx += "</select></form>";
  4430. xzone.innerHTML = xx;
  4431. monPopup.document.getElementById("selChamp").onchange = function () {
  4432. Village.selectionChamp();
  4433. return false;
  4434. };
  4435.  
  4436. xzone = monPopup.document.getElementById("selMetier");
  4437. xx = '<form id="fMetier"><select id="sMetier">';
  4438. xx += "<option>" + "Métier" + "</option>";
  4439. for (i = 0; i < libMetier.length; i++) {
  4440. if (i == eMetier - 1)
  4441. xx += "<option selected>"
  4442. else
  4443. xx += "<option>"
  4444. xx += libMetier[i] + "</option>";
  4445. }
  4446. xx += "</select></form>";
  4447. xzone.innerHTML = xx;
  4448. monPopup.document.getElementById("sMetier").onchange = function () {
  4449. Village.selectionMetier();
  4450. return false;
  4451. };
  4452. // logit("nPersos.length : " + nPersos.length);
  4453. for (i=0;i<nPersos.length;i++) {
  4454. Village.lienMail(monPopup,nPersos[i].Pseudo);
  4455. }
  4456. },
  4457. selectionVille: function () {
  4458. if (eVille == mVille)
  4459. eVille = "Étranger";
  4460. else if (eVille == "Étranger")
  4461. eVille = "Ville";
  4462. else
  4463. eVille = mVille;
  4464. Village.selectionAffichage();
  4465. },
  4466. selectionComte: function () {
  4467. if (eComte == mDuche)
  4468. eComte = "Étranger";
  4469. else if (eComte == "Étranger")
  4470. eComte = "Comté/Duché";
  4471. else
  4472. eComte = mDuche;
  4473. Village.selectionAffichage();
  4474. },
  4475. selectionEtat: function () {
  4476. eActif = (eActif == "État" ? "Actif" : "État");
  4477. Village.selectionAffichage();
  4478. },
  4479. selectionChamp: function () {
  4480. var r = monPopup.document.getElementById("sChamp").selectedIndex;
  4481. if (r == 0)
  4482. eChamp = -1;
  4483. else
  4484. eChamp = r;
  4485. Village.selectionAffichage();
  4486. },
  4487. selectionMetier: function () {
  4488. var r = monPopup.document.getElementById("sMetier").selectedIndex;
  4489. if (r == 0)
  4490. eMetier = -1;
  4491. else
  4492. eMetier = r;
  4493. Village.selectionAffichage();
  4494. },
  4495. unRegistre: function (i) {
  4496. var r = "";
  4497. var dtd = '<td>', ftd = "</td>";
  4498. r += '<tr style="font-size:10px">';
  4499. if (i == -1) {
  4500. r += dtd + '<b>Nom</b>' + ftd;
  4501. r += dtd + '<b><span id="selVille"></span></b>' + ftd;
  4502. r += dtd + '<b><span id="selComte"></span></b>' + ftd;
  4503. r += dtd + '<b>Lvl</b>' + ftd;
  4504. r += dtd + '<b>Ecus</b>' + ftd;
  4505. r += dtd + '<b><span id="selEtat"></span></b>' + ftd;
  4506. r += dtd + "<b>PR</b>" + ftd;
  4507. r += dtd + '<b><span id="selChamp"></span></b>' + ftd;
  4508. r += dtd + '<span id="selMetier"></span></b>' + ftd;
  4509. r += dtd + '&nbsp;' + ftd;
  4510. } else {
  4511. r += dtd + Perso.lienHTML(nPersos[i].Pseudo) + ftd;
  4512. r += dtd + cvCar(nPersos[i].Village) + ftd;
  4513. r += dtd + cvCar(nPersos[i].Comte) + ftd;
  4514. r += dtd + nPersos[i].Niveau + ftd;
  4515. r += dtd + nPersos[i].Ecu + ftd;
  4516. r += dtd + nPersos[i].Status + ftd;
  4517. r += dtd + nPersos[i].PR + ftd;
  4518. r += dtd + (nPersos[i].Champ1 > 0 ? Perso.quelChamp(nPersos[i].Champ1) : "&nbsp;");
  4519. if (nPersos[i].Champ2 > 0)
  4520. r += " + " + Perso.quelChamp(nPersos[i].Champ2);
  4521. r += ftd;
  4522. r += dtd + (nPersos[i].Metier > 0 ? Perso.quelMetier(nPersos[i].Metier) : "&nbsp;") + ftd;
  4523. r += dtd + '<input type="checkbox" name="mp' + nPersos[i].Pseudo + '" id="mp' + nPersos[i].Pseudo + '" value="1"></input>' + ftd;
  4524. /* r += dtd + '<input type="image" id="mail' + nPersos[i].Pseudo + '" src="http://statics.lesroyaumes.com/images/newRRCaracArgent.png" style="width:12px; height:12px;"/>'
  4525. // logit("unRegistre (l.2761) recap : "+nPersos[i].Pseudo+","+nPersos[i].Village+","+nPersos[i].Comte+","+nPersos[i].Niveau+","+nPersos[i].Ecu+","+nPersos[i].Status+","+nPersos[i].PR+","+nPersos[i].Champ1+","+nPersos[i].Champ2+","+nPersos[i].Metier);
  4526. // r += "</input type="image" src=">\n";*/
  4527. }
  4528. return(r);
  4529. },
  4530. lienMail: function (z, x) {
  4531. //var mesC = z.document.innerHTML;logit("mesC : " + mesC);
  4532. var ez=z.document.getElementById('mail'+x);//logit("ez + x + (ez==undefined): " + ez + " - " + x + " - " + (ez==undefined));
  4533. if (ez==undefined) return;
  4534. var xe=ez.createElement("a");
  4535. /* monPopup.document.getElementById("sMetier").onchange = function () {
  4536. Village.selectionMetier();
  4537. return false;
  4538. };*/
  4539.  
  4540. xe.onclick = function() {
  4541. MailRR.envoi("'"+x+"'");
  4542. return false;
  4543. };
  4544. xe.innerHTML='<img src=http://statics.lesroyaumes.com/images/newRRCaracArgent.png style="width:12px; height:12px;" >';
  4545. ez.appendChild(xe);
  4546. }
  4547. }
  4548.  
  4549. var Mairie = {
  4550. achats: function () {
  4551. var zsrc = Mairie.achatsFaire("Ventes", "<br><p>Embauches</p>");
  4552. zsrc += Mairie.achatsFaire("Achats", "<br><p>Achats automatiques</p>");
  4553. zsrc += Mairie.achatsFaire("Achats automatiques", "<br></div>");
  4554. zsrc+= "\nLégende : V = ventes - A = achats - U = achats automatiques\n";
  4555. ClipboardCopyTo(zsrc);
  4556. alert("Rapport des achats/ventes disponible dans le presse-papiers.");
  4557. },
  4558. achatsFaire: function (t1, t2) {
  4559. var x = "<p>" + t1 + "</p>";
  4560. var n = document.body.innerHTML.indexOf(x);
  4561. if (n == -1) {
  4562. alert("Informations inaccessibles!!!");
  4563. return(undefined);
  4564. }
  4565. var src = HtmlToString(getData(document.body.innerHTML, x, t2));
  4566. if (t1 == "Ventes")
  4567. src = str_replace(src, " : Vous avez vendu ", "\t");
  4568. else if (t1 == "Achats")
  4569. src = str_replace(src, " : Vous avez acheté ", "\t");
  4570. else
  4571. src = str_replace(src, " : Vous avez acheté automatiquement ", "\t");
  4572. var l = src.split('\n');
  4573. var i = 0, y, a;
  4574. src = "";
  4575. for (i = 0; i < l.length; i++) {
  4576. y = l[i].split('\t');
  4577. if (y[1] != undefined) {
  4578. a = y[1].indexOf(" ");
  4579. y[1] = y[1].substring(0, a) + "\t" + y[1].substring(a, y[1].indexOf(" écus"));
  4580. src += y[0] + '\t' + y[1] + "\t" + (t1 == "Achats automatiques" ? "U" : t1.substring(0, 1)) + "\n";
  4581. }
  4582. }
  4583. src = str_replace(src, " pour ", "\t");
  4584. //calcul du prix unitaire pour les achats automatiques
  4585. if (t1 == "Achats automatiques") {
  4586. l = src.split('\n');
  4587. src = "";
  4588. for (i = 0; i < l.length - 1; i++) {
  4589. y = l[i].split("\t");
  4590. y[3] = str_replace(y[3], ",", ".");
  4591. var b = parseFloat(y[1]);
  4592. var c = parseFloat(y[3]) / b;
  4593. x = "" + c.toFixed(2);
  4594. x = str_replace(x, ".", ",");
  4595. src += y[0] + '\t' + y[1] + '\t' + y[2] + '\t' + x + '\t' + y[4] + '\t' + "\n";
  4596. }
  4597. }
  4598. return(src);
  4599. },
  4600. inventaire: function () {
  4601. var x = "textePage[4][4]['Texte'] = '";
  4602. var n = document.body.innerHTML.indexOf(x);
  4603. if (n == -1) {
  4604. alert("Informations inaccessibles!!!");
  4605. return;
  4606. }
  4607. var src = HtmlToString(getData(document.body.innerHTML, x, "textePage"));
  4608. src = src.substring(0, src.length - 3);
  4609. src = str_replace(src, "<p>Encombrement : 1912</p>", "")
  4610. src = str_replace(src, '<div class="inventaire_contenu_01">', "\n**");
  4611. src = str_replace(src, '<div class="inventaire_contenu_01_item">', " ");
  4612. src = str_replace(src, '<div class="inventaire_contenu_01_argent">', "");
  4613. src = str_replace(src, '<img src="http://statics.lesroyaumes.com/images/items/itemArgent.png" width="48px" height="24px"></div>', "");
  4614. src = str_replace(src, '<div class="inventaire_contenu_01_descriptif" title="', "(");
  4615. src = str_replace(src, '.">', ') ');
  4616. src = str_replace(src, '. ">', ') ');
  4617. src = str_replace(src, '<div class="inventaire_contenu_01_descriptif">', "");
  4618. src = str_replace(src, '<div class="inventaire_contenu_01_poids">', " ");
  4619. src = str_replace(src, '<div class="inventaire_utiliser_disabled">', "");
  4620. src = str_replace(src, '</div>', "|");
  4621. src = str_replace(src, '|<div class="inventaire_contenu_01_nbre">', "");
  4622. var s = src.split('\n');
  4623. var i;
  4624. src = getData(s[2], "**", "|") + "\n";
  4625. for (i = 2; i < s.length; i++) {
  4626. src += getData(s[i], ">", "| ") + "\n";
  4627. }
  4628. src = str_replace(src, "\n\n", "\n");
  4629. src = str_replace(src, '|', '\t');
  4630. src = "[b][u]Stock de la mairie[/u][/b]\n" + src;
  4631. src = src + "\n" + Mairie.ordresAchatVente();
  4632. src = src + Mairie.pointsEtat();
  4633. ClipboardCopyTo(src);
  4634. alert("Rapport d'inventaire disponible dans le presse-papiers.");
  4635. },
  4636. pointsEtat: function () {
  4637. var x = getData(document.body.innerHTML, "textePage[4][14]['Texte'] = '", "';");
  4638. x = HtmlToString(x);
  4639. x = str_replace(x, '<h1>', "[b][u]");
  4640. x = str_replace(x, '</h1>', "[/u][/b]");
  4641. x = str_replace(x, '\ndans le domaine', " dans le domaine");
  4642. x = str_replace(x, '<p>', "");
  4643. x = str_replace(x, '<form', "\n<form");
  4644. var t = x.split("\n");
  4645. x = "";
  4646. for (var i = 0; i < t.length; i++) {
  4647. if (t[i].indexOf("La ville poss") != -1)
  4648. x += t[i] + "\n";
  4649. if (t[i].indexOf("changeables") != -1)
  4650. x += t[i] + "\n";
  4651. }
  4652. return("[b][u]Fonctionnaires et fonctionnement de la commune[/u][/b]\n" + x);
  4653. },
  4654. ordresAchatVente: function () {
  4655. var x = getData(document.body.innerHTML, "textePage[4][5]['Texte'] = '", "';");
  4656. x = HtmlToString(x);
  4657. x = str_replace(x, '<h1>', "[b][u]");
  4658. x = str_replace(x, '</h1>', "[/u][/b]\n");
  4659. x = str_replace(x, '<div align="left">', "");
  4660. x = str_replace(x, '</div>', "");
  4661. var t = x.split("\n");
  4662. x = "";
  4663. for (var i = 0; i < t.length; i++) {
  4664. if (t[i] != "") {
  4665. if (t[i].indexOf('<') != -1)
  4666. t[i] = t[i].substring(0, t[i].indexOf('<'));
  4667. }
  4668. x += t[i] + "\n";
  4669. }
  4670. return(x);
  4671. },
  4672. fraudeFiscale: function () {
  4673. //récupération liste des fraudeurs (pas du détail)
  4674. //la liste est dans textePage[4][20]['Texte']
  4675. var n = document.body.innerHTML.indexOf("textePage[4][20]['Texte'] = '");// logit("fraude.Fiscale.n : " + n);
  4676. if (n == -1) {
  4677. alert("Informations inaccessibles!!!");
  4678. }
  4679. if (Fraudeur.length > 0) {
  4680. //si changement de jour sauvegarde ancienne liste pour détection des mouvements
  4681. Fraudeur.splice(0, Fraudeur.length);
  4682. }
  4683. var y = document.body.innerHTML.indexOf("textePage[4][24]");
  4684. var src = document.body.innerHTML.substring(n, y);
  4685. src = str_replace(src, "<br />", "\n")
  4686. // var t = src.split("\n")
  4687. var t = src.split(","), tx = "", z = "", zx = "", zv = 0, z1 = "", i = 0, zMoney = "", zPena = "", zPenDate="";
  4688. t.splice(0, 2);
  4689. var vtx = new Array;
  4690. // var ttt = t.split("\n");logit("fraude.Fiscale.ttt l.4185 : " + ttt + "fraude.Fiscale.ttt.length : " +ttt.length);
  4691. // var vtx = t.split("\n");
  4692. //<a class="lien_default lienPerso" href="javascript:popupPerso(\'FichePersonnage.php?login=Yann58390\')">Yann58390</a> : 13,50 écus (+20,92 écus de pénalité) avant le 21/01/1464
  4693. logit("fraude.Fiscale.t l.4185 : " + t + "fraude.Fiscale.t.length : " +t.length);
  4694. for (i = 2; i < t.length - 1; i++) {
  4695. // var p1 = Src.indexOf(d);
  4696. // if (p1 == -1)
  4697. // return("");
  4698. // p1 += d.length;
  4699. // var p2 = Src.indexOf(f, p1);
  4700. // if (p2 == -1)
  4701. // return("");
  4702. //return(Src.substring(p1, p2));
  4703. z = getData(t[i], "login=", "\\')");
  4704. logit ("t[i] : " + t[i]);
  4705. zMoney += getData(t[i], "</a> : ", " écus (+')") + "\n"; logit("fraude.Fiscale.zMoney l.4190 : " + zMoney);
  4706. zPena += getData(t[i], "(+", " écus de')") + "\n"; logit("fraude.Fiscale.zPena l.4191 : " + zPena);
  4707. zPenDate += getData(t[i], "avant le ", "\n") + "\n"; logit("fraude.Fiscale.zPenDate l.4192 : " + zPenDate);
  4708. logit("fraude.Fiscale.zMoney l.4193 : " + zMoney + " - zPena : " + zPena + " - zPenDate : " + zPenDate);
  4709. if ((z != z1) && (z != "")) {
  4710. if (tx != "") {
  4711. tx += "<br>"; logit("fraude.Fiscale.tx l.4191 : " + tx);
  4712. } else {
  4713. }
  4714. tx += z;
  4715. z1 = z;
  4716. Fraudeur.push(new aFraudeurs(z, "", "", "")); logit("fraude.Fiscale.Fraudeur[Fraudeur.length-1] l.4195: " + Fraudeur[Fraudeur.length-1] + " - z1 : " + z1 );
  4717. //function Fraudeurs(nPseudo, nEcu, nStatus, fDate) }
  4718. }
  4719. logit("fraude.Fiscale.Fraudeur[Fraudeur.length-1] : " + Fraudeur[Fraudeur.length-1]);
  4720. logit("fraude.Fiscale.Fraudeur[Fraudeur.length - 1].Nom : " + Fraudeur[Fraudeur.length - 1].Nom + " - Ecus to compute : " +str_replace(getData(t[i], " : ", " "), ",", ".") + " - Fraudeur[Fraudeur.length - 1].Status : " + Fraudeur[Fraudeur.length - 1].Status);
  4721. Fraudeur[Fraudeur.length - 1].Ecu += Number(str_replace(getData(t[i], " : ", " "), ",", "."));
  4722. }
  4723. //vérifier chaque nom
  4724. nFraudeur = 0;
  4725. Bar.debut("<b>Liste des fraudeurs</b>", "zoneTexte0");
  4726. Mairie.fraudeFiscaleSuite();
  4727. },
  4728. fraudeFiscaleSuite: function () {
  4729. if (nFraudeur < Fraudeur.length) {
  4730. Bar.progression(Math.floor(nFraudeur + 1) + "/" + Fraudeur.length + ">>>" + Fraudeur[nFraudeur].Pseudo,
  4731. (Math.floor(nFraudeur + 1) / nFraudeur.length) * 100);
  4732. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (Fraudeur[nFraudeur].Pseudo), Mairie.fraudeFiscaleUn);
  4733. } else {
  4734. Bar.addMessage("<br>Recherche terminée ");
  4735. Mairie.fraudeFiscaleFin();
  4736. }
  4737. },
  4738. fraudeFiscaleUn: function (Src) {
  4739. if (Src.indexOf("Connexion perdue<") != 0) {
  4740. if (Src.indexOf("Derni&egrave;re connexion") != -1) {
  4741. Fraudeur[nFraudeur].Status = "actif";
  4742. if (Src.indexOf("actuellement en prison") != -1)
  4743. Fraudeur[nFraudeur].Status = "en prison";
  4744. if (Src.indexOf("lement en retranchement") != -1) {
  4745. Fraudeur[nFraudeur].Status = "retranché du " + Perso.getStatusDate(Src);
  4746. }
  4747. if (Src.indexOf("est MORT") != -1) {
  4748. Fraudeur[nFraudeur].Status = "mort le " + Perso.getStatusDate(Src);
  4749. }
  4750. if (Src.indexOf("lement une retraite spirituelle") != -1) {
  4751. Fraudeur[nFraudeur].Status = "retraite du " + Perso.getStatusDate(Src);
  4752. }
  4753. nFraudeur++;
  4754. Mairie.fraudeFiscaleSuite();
  4755. }
  4756. else if (Src.indexOf("Ce personnage n'existe pas, ou plus, ou pas encore.") != -1) {
  4757. Fraudeur[nFraudeur].Status = "disparu";
  4758. nFraudeur++;
  4759. Mairie.fraudeFiscaleSuite();
  4760. }
  4761. }
  4762. else
  4763. MessageErreur = "<b>Erreur pendant le contrôle.</b>";
  4764. },
  4765. fraudeFiscaleFin: function () {
  4766. var tx = "", i = 0;
  4767. //--> si retranchement mettre dans la liste de retranchés
  4768. //--> si retraite de plus de 3 mois mettre dans la liste de retraites
  4769. tx = "<table>";
  4770. tx += "<tr>";
  4771. tx += "<td width=25%>" + "Nom" + "</td>";
  4772. tx += "<td width=15%>" + "Dû" + "</td>";
  4773. tx += "<td width=40%>" + "Status" + "</td>";
  4774. tx += "<td width=40%>" + "Date" + "</td>";
  4775. tx += "</tr>";
  4776. for (i = 0; i < Fraudeur.length; i++) {
  4777. tx += "<tr>";
  4778. tx += "<td>" + Perso.lienHTML(Fraudeur[i].Pseudo) + "</td>";
  4779. tx += "<td>" + str_replace(Fraudeur[i].Ecu.toFixed(2), ".", ",") + "</td>";
  4780. tx += "<td>" + Fraudeur[i].Status + "</td>";
  4781. tx += "<td>" + Fraudeur[i].fDate + "</td>";
  4782. tx += "</tr>";
  4783. }
  4784. tx += "</table>";
  4785. document.getElementById("zoneTexte0").innerHTML = "<h1>Liste des fraudeurs</h1><p>" + tx + "</p>";
  4786. },
  4787. assietteImpots: function () {
  4788. var f = Mairie.taxeFonciere();
  4789. if (f == undefined) {
  4790. alert("Récupération de la table des taxes foncières immpossible\n" +
  4791. "La simulation de recette ne sera pas possible.");
  4792. }
  4793. // récupération des taxes
  4794. var tf = f.split("\n");
  4795. var txf = new Array(), trf = new Array();logit("assietteImpots.tf.length = " + tf.length);
  4796. for (i = 0; i < tf.length; i++) {
  4797. if (tf[i] != "") {
  4798. txf = tf[i].split("\t");
  4799. trf.push(txf);
  4800. trf[trf.length - 1].push(0);
  4801. }
  4802. }
  4803. var ztrf = -1;
  4804. // fin de la récup
  4805. var z = 0, njr = window.prompt("Seuil de retraite/retranchement (en jours)?", 15);
  4806. var nc = 0, ne = 0, nh = 0, na = 0, nt = 0, ntr = 0, nr = 0, etrangers = 0, i, nprison = 0;
  4807. var r = 0; logit("assietteImpots.nPersos.length = " + nPersos.length);
  4808. for (i = 0; i < nPersos.length; i++) {
  4809. if (nPersos[i].Village == mVille) {
  4810. z = 0;
  4811. nh++;
  4812. if (nPersos[i].Status == "actif") {
  4813. z = 1;
  4814. na++;
  4815. }
  4816. //si en prison
  4817. else if (nPersos[i].Status == "en prison") {
  4818. z = 1;
  4819. nprison++;
  4820. }
  4821. //si denière connexion moins de 1 mois
  4822. else if (nPersos[i].Status == "retraite") {
  4823. if (difDate(mDate, nPersos[i].date) < njr) {
  4824. z = 1;
  4825. nt++;
  4826. } else
  4827. ntr++;
  4828. }
  4829. else if (nPersos[i].Status == "retranché")
  4830. nr++;
  4831. if (z == 1) {
  4832. if (nPersos[i].Champ1 != 0) {
  4833. nc++;
  4834. r += Mairie.quelleRecette(Perso.quelChamp(nPersos[i].Champ1), f);
  4835. ztrf = Mairie.quelleChamp(Perso.quelChamp(nPersos[i].Champ1));
  4836. if (ztrf != -1) {
  4837. if (trf[ztrf] != undefined)
  4838. trf[ztrf][2]++;
  4839. }
  4840. }
  4841. if (nPersos[i].Champ2 != 0) {
  4842. nc++;
  4843. r += Mairie.quelleRecette(Perso.quelChamp(nPersos[i].Champ2), f);
  4844. ztrf = Mairie.quelleChamp(Perso.quelChamp(nPersos[i].Champ2));
  4845. if (ztrf != -1) {
  4846. if (trf[ztrf] != undefined)
  4847. trf[ztrf][2]++;
  4848. }
  4849. }
  4850. logit("assietteImpots.nPersos[i].Metier = " + nPersos[i].Pseudo + " - " + nPersos[i].Metier);
  4851. if (nPersos[i].Metier != 0) {
  4852. ne++;
  4853. r += Mairie.quelleRecette(Perso.quelMetier(nPersos[i].Metier), f);
  4854. ztrf = Mairie.quelleChamp(Perso.quelMetier(nPersos[i].Metier));
  4855. if (ztrf != -1) {
  4856. if (trf[ztrf] != undefined)
  4857. trf[ztrf][2]++;
  4858. }
  4859. }
  4860. }
  4861. }
  4862. else
  4863. etrangers++;
  4864. }
  4865. var rx = (r / 100).toFixed(2);
  4866. var rz = str_replace(rx, ".", ",");
  4867. var ri = (rx / (nc + ne)).toFixed(2);
  4868. ri = str_replace(ri, ".", ",");
  4869. var xtrf = "", zxtrf = 0;
  4870. xtrf = "<table border=1 cellspacing=\"0\">";
  4871. xtrf += "<tr>";
  4872. xtrf += "<td>" + "Unité" + "</td>";
  4873. xtrf += "<td>" + "nombre" + "</td>";
  4874. xtrf += "<td>" + "taux" + "</td>";
  4875. xtrf += "<td>" + "produit" + "</td>";
  4876. xtrf += "<tr>";
  4877. for (i = 0; i < trf.length; i++) {
  4878. xtrf += "<tr>";
  4879. xtrf += "<td>" + trf[i][0] + "</td>";logit("assietteImpots.trf[i][0] Métier = " + trf[i][0]);
  4880. xtrf += "<td>" + trf[i][2] + "</td>";logit("assietteImpots.trf[i][0] = " + trf[i][2]);
  4881. xtrf += "<td>" + (Number(trf[i][1]) / 100).toFixed(2) + "</td>";
  4882. xtrf += "<td>" + (Number(trf[i][2]) * (Number(trf[i][1]) / 100)) + "</td>";
  4883. zxtrf += ((Number(trf[i][1]) * (trf[i][2]) / 100));
  4884. xtrf += "<tr>";
  4885. }
  4886. xtrf += "</table><p></p>";
  4887. //xtrf+="Total estimé = "+zxtrf;
  4888. xtrf = str_replace(xtrf, ".", ",");
  4889. //alert(xtrf);
  4890. var vtrf = "Nombre d'étrangers présents ce jour : " + etrangers + "<br>" +
  4891. "Nombre de résidents de " + mVille + " présents: " + nh + "<br>" +
  4892. "- " + na + " actifs" + "<br>" +
  4893. "- " + nprison + " en prison" + "<br>" +
  4894. "- " + nt + " retraités de moins de " + njr + " jours" + "<br>" +
  4895. "- " + ntr + " retraités de plus de " + njr + " jours" + "<br>" +
  4896. "- " + nr + " retranchés" + "<br>" +
  4897. "Soit une assiette d'imposition de " + nc + " parcelles et " + ne + " échoppes." + "<br>" +
  4898. "Total des unités cadastrales de " + (nc + ne) + "." + "<br>" +
  4899. "Recette potentielle : " + rz + " écus par quinzaine." + "<br>" +
  4900. "Soit un impôt de " + ri + " écus en moyenne par unité fiscale."
  4901. //alert(vtrf);
  4902. document.getElementById("zoneTexte0").innerHTML = "<h1>Calcul d'assiette d'imposition</h1><p>" +
  4903. xtrf + "</p><p>" + vtrf + "</p>";
  4904. },
  4905. quelleRecette: function (x, f) {
  4906. if (f == undefined) {
  4907. alert("f undefined");
  4908. return(0);
  4909. }
  4910. var l = [
  4911. "blé", "maïs", "vache", "mouton", "cochon", "légumes",
  4912. "meunier", "boulanger", "boucher", "forgeron", "tisserand", "charpentier", 'sculpteur', 'botaniste'
  4913. ];
  4914. /* var l = [
  4915. 'blé', 'maïs', 'légumes', 'vaches', 'cochons', 'moutons', 'chèvres', 'oliviers', 'vigne', 'orge',
  4916. 'meunier', 'boulanger', 'boucher', 'forgeron', 'tisserand', 'charpentier', 'sculpteur', 'botaniste',
  4917. 'pressoir', 'whiskey', 'whisky', 'fromagerie', 'cave à vin', 'ferme à cidre'
  4918.  
  4919. ];*/
  4920. var i;
  4921. for (i = 0; i < l.length; i++) {
  4922. if (x.indexOf(l[i]) != -1) {
  4923. var t = f.split('\n');
  4924. if (t[i] == undefined)
  4925. return(0);
  4926. var z = t[i].split("\t");
  4927. return(Number(z[1]));
  4928. }
  4929. }
  4930. return(0);
  4931. },
  4932. quelleChamp: function (x) {
  4933. /* var l = [
  4934. 'blé', 'maïs', 'légumes', 'vaches', 'cochons', 'moutons', 'chèvres', 'oliviers', 'vigne', 'orge',
  4935. 'meunier', 'boulanger', 'boucher', 'forgeron', 'tisserand', 'charpentier', 'sculpteur', 'botaniste',
  4936. 'pressoir', 'whiskey', 'whisky', 'fromagerie', 'cave à vin', 'ferme à cidre'
  4937. ];*/
  4938. var l = [
  4939. "blé", "maïs", "vache", "mouton", "cochon", "légumes",
  4940. "meunier", "boulanger", "boucher", "forgeron", "tisserand", "charpentier", 'sculpteur', 'botaniste'
  4941. ];
  4942. var i;
  4943. for (i = 0; i < l.length; i++) {
  4944. if (x.indexOf(l[i]) != -1) {
  4945. return(i);
  4946. }
  4947. }
  4948. return(-1);
  4949. },
  4950. taxeFonciere: function () {
  4951. var i, t;
  4952. var n = document.body.innerHTML.indexOf("textePage[4][10]['Texte'] = '");
  4953. if (n == -1) {
  4954. alert("Informations inaccessibles!!!");
  4955. return(undefined);
  4956. }
  4957. var y = document.body.innerHTML.indexOf("textePage[4][11]");
  4958. var src = document.body.innerHTML.substring(n, y);
  4959. /* Les différents indices des select :
  4960. Blé : taxec1 - Maïs : taxec2 - Vaches : taxec3 - Moutons : taxec4 - Cochons : taxec5
  4961. Potager : taxec6 - Vigne : taxec8 -
  4962. Meunier : taxem1 - Boulanger : taxem2 - Boucher : taxem3 - Forgeron : taxem4
  4963. Tisserand : taxem5 - Charpentier : taxem6 -
  4964. Cave à vin : taxem16 -
  4965. Sculpteur : taxem21 - Botaniste : taxem22
  4966. */
  4967. src = HtmlToString(src);
  4968. src = src.substring(src.indexOf("<tr>"));
  4969. src = src.substring(src.indexOf("<tr>"));
  4970. src = src.substring(src.indexOf("<tr>"));
  4971. src = str_replace(src, '</tr>', "\n");
  4972. for (i = 0; i < 5050; i += 50) {
  4973. src = str_replace(src, '<option value="' + i + '">' + i + '</option>', "");
  4974. }
  4975. src = src.substring(0, src.indexOf("</table>"));
  4976. logit("taxeFonciere.src = " + src);
  4977. src = str_replace(src, "<tr> <td>Impot</td> <td>Montant par champ</td>", "");
  4978. src = str_replace(src, ' <tr> <td>Taxe foncière sur ', "");
  4979. src = str_replace(src, '</td> <td> <select name="taxec', "|");
  4980. src = str_replace(src, '</td> <td> <select name="taxem', "|");
  4981. src = str_replace(src, '"><option value="', "|");
  4982. src = str_replace(src, '" selected>', "|");
  4983. logit("taxeFonciere.src = " + src);
  4984. src = str_replace(src, 'Culture', "");
  4985. src = str_replace(src, 'Elevage', "");
  4986. src = str_replace(src, ' de ', "");
  4987. src = str_replace(src, ' du ', "");
  4988. src = str_replace(src, '"', "|");
  4989. src = str_replace(src, 'Potager', "légumes");
  4990. src = str_replace(src, 'M', "m");
  4991. src = str_replace(src, 'B', "b");
  4992. src = str_replace(src, 'F', "f");
  4993. src = str_replace(src, 'T', "t");
  4994. src = str_replace(src, 'C', "c");
  4995. src = str_replace(src, 'S', "s");
  4996. src = str_replace(src, 'V', "v");
  4997. var s = src.split('\n');
  4998. src = "";//logit("taxeFonciere.s.length = " + s.length);
  4999. for (i = 0; i < s.length; i++) {
  5000. //logit("taxeFonciere.s["+i+"] = " + s[i]);
  5001. if ((s[i] != "") && (s[i] != " ")) {
  5002. t = s[i].split("|");
  5003. src += t[0] + "\t" + t[2] + "\n";logit("taxeFonciere.src = " + src);
  5004. }
  5005. }
  5006. //la table est sous la forme champ/métier(tabulation)taxe
  5007. return(src);
  5008. },
  5009. tableauDeBord: function () {
  5010.  
  5011. },
  5012. mandats: function () {
  5013. var xx = "";
  5014. xx += Mairie.mandatsFaire("Mandats en cours :");
  5015. //xx+=Mairie.mandatsFaire("Mandats arrivés à terme : ");
  5016. var t = xx.split('\n');
  5017. xx = "";
  5018. for (var i = 1; i < t.length; i++) {
  5019. if (t[i] != "")
  5020. xx += Mairie.mandatsDetail(t[i]);
  5021. }
  5022. ClipboardCopyTo(t[0] + "\n" + xx);
  5023. alert((t.length - 2) + " mandats.\nRapport des mandats disponible dans le presse-papiers.");
  5024. },
  5025. mandatsDetail: function (src) {
  5026. var z = getData(src, "Mandat ", " ");
  5027. var x = "", i;
  5028. if (z != "") {
  5029. x = getData(document.body.innerHTML, "textePage[4][16][" + z + "]['Texte'] = '<h1>", "';");
  5030. x = HtmlToString(x);
  5031. x = str_replace(x, "</h1><p>", "\n");
  5032. x = str_replace(x, '<div align="left">', "");
  5033. x = str_replace(x, '</div>', "");
  5034. x = str_replace(x, "<p>", "");
  5035. x = str_replace(x, '\\n', "\n");
  5036. x = str_replace(x, '</p>', "\n");
  5037. x = str_replace(x, "<br>", "\n");
  5038. x = str_replace(x, "<br />", "\n");
  5039. x = str_replace(x, '<div class="ConteneurItem">', "");
  5040. x = str_replace(x, '<div class="inventaire_contenu_01 nonInteractif">', "");
  5041. x = str_replace(x, '<div class="inventaire_contenu_01_item">', "");
  5042. x = str_replace(x, "\n\n", "\n");
  5043. x = str_replace(x, '<div class="inventaire_contenu_01_nbre">', "\n- ");
  5044. x = str_replace(x, '<div class="inventaire_contenu_01_descriptif">', " : ");
  5045. x = str_replace(x, '<b> </b>\n', "");
  5046. var t = x.split("\n");
  5047. x = "";
  5048. for (i = 0; i < t.length; i++) {
  5049. if (t[i].substring(0, "- <b>#</b>".length) == "- <b>#</b>")
  5050. continue;
  5051. if (t[i].indexOf("<") != -1)
  5052. t[i] = t[i].substring(0, t[i].indexOf("<"));
  5053. x += t[i] + "\n";
  5054. }
  5055. if (x == "")
  5056. return("");
  5057. }
  5058. return(src + "\n[quote]" + x + "[/quote]\n\n");
  5059. },
  5060. mandatsFaire: function (tx) {
  5061. var x = document.body.innerHTML;
  5062. x = getData(HtmlToString(x), tx + '</h2>', '<h2>');
  5063. x = str_replace(x, "Mandat ", "\nMandat ")
  5064. x = str_replace(x, '<a class="lien_default lienPerso" href="javascript:popupPerso(\'', "[url=http://www.lesroyaumes.com/");
  5065. x = str_replace(x, '\')">', ']');
  5066. var t = x.split('\n');
  5067. var w = "", i = 0, nw = 0;
  5068. for (i = 0; t.length; i++) {
  5069. if (t[i] == undefined)
  5070. break;
  5071. if (t[i] != "") {
  5072. w += t[i].substring(0, t[i].indexOf("</a>")) + '[/url]\n';
  5073. nw++;
  5074. }
  5075. }
  5076. w = str_replace(w, '</a>', '[/url]');
  5077. var xx = "[b][u]" + tx + "[/u][/b] (" + nw + ')\n' + w;
  5078. return(xx);
  5079. },
  5080. milice: function () {
  5081. var x = document.body.innerHTML;
  5082. x = HtmlToString(getData(x, '<p>Embauches</p>', '<p>Achats</p>'));
  5083. x = str_replace(x, '<a class="lien_default lienPerso" href="javascript:popupPerso(\'', "[url=http://www.lesroyaumes.com/");
  5084. x = str_replace(x, '\')">', ']');
  5085. x = str_replace(x, '</a>', '[/url]');
  5086. var t = x.split('\n');
  5087. var z = mDate;
  5088. var y = z.split('/');
  5089. z = y[2] + "-" + y[1] + "-" + y[0];
  5090. var w = "", nw = 0;
  5091. for (var i = 0; i < t.length; i++) {
  5092. if (t[i].indexOf(z) != -1) {
  5093. w += t[i] + "\n";
  5094. nw++;
  5095. }
  5096. }
  5097. x = "[b][u]" + mVille + "[/u][/b] : " + nw + " milicien(s)\n" + w;
  5098. ClipboardCopyTo(x);
  5099. alert(nw + " miliciens.\nRapport de milice disponible dans le presse papiers.");
  5100. },
  5101. compta: function () {
  5102. var x = getData(document.body.innerHTML, "textePage[4][24]['Texte'] = '", "</table>';");
  5103. logit("compta.x1 = " + x);
  5104. x = HtmlToString(x);
  5105. //logit("compta.x2 = " + x);
  5106. x = str_replace(x, '<h2>', "[b][u]");
  5107. x = str_replace(x, '</h2>', "[/u][/b]\n");
  5108. x = str_replace(x, '<table>', '\n[table border="0" cellspacing="2"]\n');
  5109. x = str_replace(x, '</table>', '[/table]\n');
  5110. x = str_replace(x, '<th>', "[td][b]");
  5111. x = str_replace(x, '</th>', "[/b][/td]");
  5112. x = str_replace(x, '<td align="right">', '[td]')
  5113. x = str_replace(x, '<tr><td colspan="5">--------------------</td></tr>', "");
  5114. x = str_replace(x, '<tr>', '[tr]');
  5115. x = str_replace(x, '</tr>', '[/tr]\n');
  5116. x = str_replace(x, '<td>', '[td]');
  5117. x = str_replace(x, '</td>', '[/td]');
  5118. x = str_replace(x, '<b>', '[b]');
  5119. x = str_replace(x, '</b>', '[/b]');
  5120. x = str_replace(x, '<i>', '[i]');
  5121. x = str_replace(x, '</i>', '[/i]');
  5122. x = str_replace(x, '<br />', '\n');
  5123. x += '[/table]';
  5124. logit("compta.x3 = " + x);
  5125. ClipboardCopyTo(x);
  5126. alert("Rapport de comptabilité disponible dans le presse-papiers.");
  5127. }
  5128. }
  5129. var Marche = {
  5130. tdStrong: '<strong>',
  5131. tdIcone: '<td width="8%" ><strong>',
  5132. tdNom: '<td width="45%"><strong>',
  5133. tdDispo: '<td width="10%">',
  5134. ftd: '</strong></td>',
  5135. tr: '<tr>',
  5136. ftr: '</tr>',
  5137. classe_0: ' class="marche_cat_0"',
  5138. synthese: function () {
  5139. RRoperation = "synthèse";
  5140. Marche.syntheseFaire();
  5141. },
  5142. syntheseFaire: function () {
  5143. var src1 = HtmlToString(document.body.innerHTML);
  5144. var src = getData(src1, 'textePage[0] = new Array();', 'textePage[0][1]');
  5145. src = src.substring(src.indexOf("<table>")+"<table>".length,src.indexOf("</table>"));
  5146. src = str_replace(src, "</tr>", "\n");
  5147. var i, j, k;
  5148. var t = src.split('\n'), z;
  5149. src = "";
  5150. if (nProduits.length > 0) {
  5151. nProduits.splice(0, nProduits.length);
  5152. }
  5153. for (i = 0; i < t.length; i++) {
  5154. if ((t[i] != undefined) && (t[i] != "") && (t[i].indexOf("textePage") == -1) && (t[i].indexOf("<tr>") == -1)) {
  5155. t[i] = str_replace(t[i], '<tr class="marche_cat_', '');
  5156. t[i] = str_replace(t[i], '\"><td><img src="http://statics.lesroyaumes.com/images/items/item', '|');
  5157. t[i] = str_replace(t[i], '.png" width="24" height="24"></td><td>', '|');
  5158. t[i] = str_replace(t[i], '.png" width="24" height="24"></td><td title="Une potion portant le doux nom de : A l\'Anis. ">', '|');
  5159. t[i] = str_replace(t[i], '</td><td>', '|');
  5160. t[i] = t[i].substring(0, t[i].indexOf('|<img src="http://statics.lesroyaumes.com/images/indic'));
  5161. if (t[i].indexOf("Durabilité") != -1) {
  5162. t[i] = t[i].substring(0, t[i].indexOf(".png")) + '|' + t[i].substring(t[i].indexOf("Pelles"), t[i].length);
  5163. }
  5164. z = t[i].split('|');
  5165. if (z.length > 0) {
  5166. z[2] = Marche.siPoisson(z[2]);
  5167. z[2] = Marche.siPlante(z[2])
  5168. k = Marche.findProduit(z[2]);
  5169. if (k != -1)
  5170. nProduits[k].Dispo += Number(z[4]);
  5171. else
  5172. nProduits.push(new Produit(z[0], z[1], z[2], Number(z[4])));
  5173. }
  5174. }
  5175. }
  5176. if (RRoperation == "synthèse") {
  5177. Marche.miseEnForme();
  5178. }
  5179. },
  5180. findProduit: function (x) {
  5181. if (nProduits.length == 0)
  5182. return(-1);
  5183. for (var i = 0; i < nProduits.length; i++) {
  5184. if (x == nProduits[i].Nom)
  5185. return(i);
  5186. }
  5187. return(-1);
  5188. },
  5189. miseEnForme: function () {
  5190. var i = 0, z;
  5191. var x = '<div><table>';
  5192. x += '<tr>';
  5193. x += '<td width="8%" ><strong>&nbsp;</strong></td>';
  5194. x += '<td width="45%"><strong>Nom</strong></td>';
  5195. x += '<td width="10%" align="center"><strong>Disponibilité</strong></td>';
  5196. x += '<td width="17%"><strong>&nbsp;</strong></td>';
  5197. x += '</tr>\n';
  5198. for (i = 0; i < nProduits.length; i++) {
  5199. if (nProduits[i].Nom != undefined) {
  5200. x += '<tr class="marche_cat_' + nProduits[i].Cat + '">';
  5201. x += '<td width="8%" >' + '<img src="http://www.lesroyaumes.com/images/items/item' + nProduits[i].Image + '.png" width="24" height="24">' + '</td>';
  5202. x += '<td width="45%">' + nProduits[i].Nom + '</td>';
  5203. x += '<td width="10%" align="center">' + nProduits[i].Dispo + '</td>';
  5204. x += '<td width="17%" align="center" id="RRid' + nProduits[i].Image + '">';
  5205. x += '</td>';
  5206. x += '</tr>\n';
  5207. }
  5208. }
  5209. x += "</table></div>";
  5210. var xzone = document.getElementById("zoneTexte0");
  5211. xzone.innerHTML = x;
  5212. var xa;
  5213. //MS_V = MarcheSeuil;//"MarcheSeuil_" + mVille;
  5214. //Miches de pain|50øFruits|8øSacs de maïs|50øBouteilles de lait|5øMorceaux de viande|10øLégumes|8øCouteaux|2øChapeaux|2øChemises pour homme|2øChemises pour femme|2øGilets|1øBraies|2øBas pour homme|2øBas pour femme|2øPaires de chausses|2øPaires de bottes|1øCeintures|2øPoissons|5ø
  5215. for (i = 0; i < nProduits.length; i++) {
  5216. if (nProduits[i].Nom != undefined) {
  5217. z = Marche.siProduitOk(nProduits[i].Nom, nProduits[i].Dispo, MarcheSeuil);
  5218. if (z == 1)
  5219. x = '<img src="images/newRRCaracFaim.png" ';// pour OK
  5220. else if (z == 0)
  5221. x = '<img src="images/newRRCaracSante.png" ';// pour KO
  5222. else
  5223. x = '<img src="images/newRRCaracArgent.png" ';// pour KO
  5224. xa = document.createElement('a');
  5225. xa.onclick = function () {
  5226. Marche.surv(this.innerHTML);
  5227. }
  5228. xa.innerHTML = x + 'alt="' + nProduits[i].Image + '">';
  5229. document.getElementById('RRid' + nProduits[i].Image).appendChild(xa);
  5230. }
  5231. }
  5232. },
  5233. setSeuil: function (p, v) {
  5234. var z = MarcheSeuil, tu;
  5235. // logit("Marche.setSeuil.MarcheSeuil (l.4726) : "+z);
  5236. if (z =="|ø") z = "";
  5237. if ((z != undefined) && (z != "")) {
  5238. if (z.indexOf(p) != -1) {
  5239. var t = z.split("ø");
  5240. z = "";
  5241. if (t.length > 0)
  5242. for (var i = 0; i < t.length; i++) {
  5243. if (t[i].indexOf(p) != -1) {
  5244. if ((v != "") && (v != "-1"))
  5245. z += p + '|' + v + 'ø';
  5246. } else if (t[i] != "")
  5247. z += t[i] + 'ø';
  5248. }
  5249. } else
  5250. z += p + "|" + v + "ø";
  5251. } else
  5252. z = p + "|" + v + "ø";
  5253. z = str_replace(z, "øø", "ø");
  5254. MarcheSeuil = z;
  5255. RRmenu.setUserPrefs(); //Chapeaux|2øChemises pour homme|2øChemises pour femme|2øGilets|2øBraies|2øMantels|1øHouppelandes|1øBas pour homme|2øBas pour femme|2øPaires de chausses|2øPaires de bottes|1øCeintures|2øCapes|1øCols|1øJupes|2øRobes|1øTabliers|1øBustiers|1øFoulards|1øToques|1øCoiffes|1ø
  5256. },
  5257. getSeuil: function (p, tp) {
  5258. var x = "0";
  5259. if ((tp != undefined) && (tp != "")) {
  5260. var t = tp.split("ø");
  5261. for (var i = 0; i < t.length; i++) {
  5262. if ((t[i] != "") && (t[i] != "")) {
  5263. tu = t[i].split('|');
  5264. if (tu[0] == p) {
  5265. x = tu[1];
  5266. break;
  5267. }
  5268. }
  5269. }
  5270. }
  5271. return(Number(x));
  5272. },
  5273. surv: function (src) {
  5274. var z = getData(src, ' alt="', '"');
  5275. var i, x, v, y;
  5276. for (i = 0; i < nProduits.length; i++) {
  5277. if (nProduits[i].Image == z) {
  5278. y = Marche.getSeuil(nProduits[i].Nom, MarcheSeuil);
  5279. //logit("Marche.surv.MarcheSeuil (l.4108) : "+y);
  5280. v = window.prompt("Valeur de seuil pour " + nProduits[i].Nom, y);
  5281. if ((v != undefined) && (v != "")) {
  5282. Marche.setSeuil(nProduits[i].Nom, v);
  5283. Marche.synthese();
  5284. }
  5285. }
  5286. }
  5287. },
  5288. surveillance: function () {
  5289. var x = MarcheSeuil;
  5290. // logit("Marche.surveillance.MarcheSeuil (l.4780) : "+x); //MarcheSeuil="|ø";
  5291. if ((x == undefined) || (x == "|ø")) {
  5292. alert("Aucune surveillance");
  5293. return;
  5294. }
  5295. Marche.syntheseFaire();
  5296. var t = x.split("ø"), tu;
  5297. // logit("Marche.surveillance l.4741 t.length: " + t.length);
  5298. x = "";
  5299. var i, j;
  5300. for (i = 0; i < t.length; i++) {
  5301. if ((t[i] != undefined) && (t[i] != "")) {
  5302. tu = t[i].split("|");
  5303. if (tu[i] == "")
  5304. continue;
  5305. x += tu[0] + " : ";
  5306. for (j = 0; j < nProduits.length; j++) {
  5307. if (nProduits[j].Nom == tu[0]) {
  5308. x += nProduits[j].Dispo + "/" + tu[1];
  5309. if (Number(nProduits[j].Dispo) < Number(tu[1]))
  5310. x += " manquant";
  5311. else
  5312. x += " -> OK";
  5313. j = -1;
  5314. break;
  5315. }
  5316. }
  5317. if (j > t.length)
  5318. x += "0" + "/" + tu[1] + " manquant";
  5319. x += "\n";
  5320. }
  5321. logit("Marche.surveillance l.4765 x : " + x);
  5322. }
  5323. alert("Produit sous surveillance:\n\n" + x);
  5324. },
  5325. siProduitOk: function (p, v, tp) {
  5326. //retourne :
  5327. // 1 si nombre(v) du produit(p) est supérieur au seuil de surveillance (tp)
  5328. // 0 si inférieur
  5329. // -1 si non surveillé
  5330. if ((tp == undefined) || (tp == "") || (tp.indexOf(p) == -1))
  5331. return(-1);
  5332. if (Number(v) < Marche.getSeuil(p, tp))
  5333. return(0);
  5334. return(1);
  5335. },
  5336. siPoisson: function (x) {
  5337. var p = ["Carpes", "Truites", "Goujons", "Brochets", "Anguilles", "Ombres"];
  5338. var r = x;
  5339. for (var i = 0; i < p.length; i++) {
  5340. if (p[i] == x) {
  5341. r = "Poissons";
  5342. break;
  5343. }
  5344. }
  5345. return(r);
  5346. },
  5347. siPlante: function (x) {
  5348. if (x == undefined)
  5349. return(x);
  5350. var p = ["Brins", "Fleurs", "Feuilles", "Branches", "écorce", "Baies"];
  5351. var r = x;
  5352. for (var i = 0; i < p.length; i++) {
  5353. if (x.indexOf(p[i]) != -1) {
  5354. r = "Plantes médicinales";
  5355. break;
  5356. }
  5357. }
  5358. return(r);
  5359. },
  5360. alerte: function () {
  5361. alert("alerte si produit manquant");
  5362. }
  5363. }
  5364.  
  5365. var Exterieur = {
  5366. controler: function () {
  5367. var el = document.getElementById("zoneTexte0");//"zoneTexte2"
  5368. SaveIG = el.innerHTML;
  5369. if ( SaveIG.length < 50) {
  5370. var el = document.getElementById("zoneTexte2");//"zoneTexte2"
  5371. SaveIG = el.innerHTML;
  5372. }
  5373. // logit("Exterieur.controler.el : " + el.innerHTML + " - SaveIG.length : " + SaveIG.length);
  5374. ExtHier = "", ExtJour = "", ExtVille = "";
  5375. // var m = '<h1>Guet pour un village</h1>' + '<form name="formulaire">';
  5376. // m += '<table><tr><td style="width:50%">';
  5377. // m += 'Royaume : ' + '<select name="RoyaumeChoisi" id="comteChoisi">';
  5378. // var sSelect = '<option value="-1" selected>Royaume</option>';
  5379. // for (var i = 0; i < InfosPaysRR.length; i ++) {
  5380. // logit("InfosPaysRR[i]['Nom'] : " + i + ' - ' + InfosPaysRR[i]['Nom'] );
  5381. // if (typeof InfosPaysRR[i] == "undefined")
  5382. // while (typeof InfosPaysRR[i] == "undefined") {
  5383. // i++;
  5384. // }
  5385. // sSelect += '<option value="'+i+'"';
  5386. // if (i == 0)
  5387. // sSelect += ' selected';
  5388. // sSelect += '>'+InfosPaysRR[i]['Nom']+'</option>';
  5389. // }
  5390. // m+= sSelect;
  5391. // m+= '</select></a></td></tr>';
  5392. // m +='</td><td style="width:50%">';
  5393. // logit(" end of InfosPaysRR[i]['Nom'] : " + i + ' - ' + InfosPaysRR[i]['Nom'] );
  5394. // sPays = 0;
  5395. // m+= '<select name="comteChoisi" id="comteChoisi">';
  5396. // var sSelect = '<option value="-1" selected>Comté/Duché</option>';
  5397. // for (var i = 0; i < InfosPaysRR.length; i ++) {
  5398. //for (var i in InfosPaysRR[sPays]['Comtes']) {
  5399. // logit("InfosPaysRR[sPays]['Comtes'][i]['Nom'] : " + i + ' - ' + InfosPaysRR[sPays]['Comtes'][i]['Nom'] );
  5400. // if (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined")
  5401. // while (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined") {
  5402. // i++;
  5403. // }
  5404. // sSelect += '<option value="'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'"';
  5405. // sSelect += '>'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'</option>';
  5406. // }
  5407. // m+= sSelect;
  5408. // m+= '</select></a></td></tr>';
  5409. // m +='<tr><td style="width:50%">';
  5410. // sComte = 0;
  5411. // m+= '<select name="VilleChoisi" id="VilleChoisi">';
  5412. // var sSelect = '<option value="-1" selected>Ville</option>';
  5413. // for (var i = 0; i < InfosPaysRR[sPays][sComte].length; i ++) {
  5414. //for (var i in InfosPaysRR[sPays][sComte]) {
  5415. // logit("InfosPaysRR[sPays][sComte]['Villages'][i]['Nom'] : " + i + ' - ' +InfosPaysRR[sPays][sComte]['Villages'][i]['Nom'] );
  5416. // if (typeof InfosPaysRR[sPays][sComte]['Villages'][i]['Nom'] == "undefined")
  5417. // while (typeof InfosPaysRR[sPays][sComte]['Villages'][i]['Nom'] == "undefined") {
  5418. // i++;
  5419. // }
  5420. // sSelect += '<option value="'+InfosPaysRR[sPays][sComte]['Villages'][i]['Nom']+'"';
  5421. // sSelect += '>'+InfosPaysRR[sPays][sComte]['Villages'][i]['Nom']+'</option>';
  5422. // }
  5423. // m+= sSelect;
  5424. // m+= '</select></a></td></tr>';
  5425. // m += 'Ville : ' + '<input name="extVille" id="extVille" value="' + ExtVille + '"></td></tr>';//<td style="width:50%">';
  5426. var m = '<h1>Guet pour un village</h1>' + '<form name="formulaire">';
  5427. m += '<table><tr><td style="width:50%">';
  5428. m += 'Ville : ' + '<input name="extVille" id="extVille" value="' + ExtVille + '"></td><td style="width:50%">';
  5429.  
  5430. sPays = 0;
  5431. m+= '<select name="comteChoisi" id="comteChoisi">';
  5432. var sSelect = '<option value="-1" selected>Comté/Duché</option>';
  5433. for (var i in InfosPaysRR[sPays]['Comtes']) {
  5434. if (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined")
  5435. while (typeof InfosPaysRR[sPays]['Comtes'][i] == "undefined") {
  5436. i++;
  5437. }
  5438. sSelect += '<option value="'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'"';
  5439. sSelect += '>'+InfosPaysRR[sPays]['Comtes'][i]['Nom']+'</option>';
  5440. }
  5441. m+= sSelect;
  5442. m+= '</select></a></td></tr>';
  5443. m += '<tr><td style="width:50%">';// m += '<tr><td style="width:50%">';
  5444. m += 'Hier:<br>' + '<textarea name="extHier" id="extHier" cols="20" rows="5">' + ExtHier + '</textarea>';
  5445. m += '</td><td style="width:50%">';
  5446. m += 'Aujourd\'hui:' + '<textarea name="extJour" id="extJour" cols="20" rows="5">' + ExtJour + '</textarea>'
  5447. m += '</td></tr></table>';
  5448. m += '</form>' + '<br>';
  5449. m += "<div id='progressionGuet'></div>";
  5450. m += "<div id=\"progressbar\"><div id=\"indicator\"></div></div>";
  5451. el.innerHTML = m;
  5452. RRmenu.addSubfunction(el, Exterieur.controlerOK, "Controler");
  5453. RRmenu.addSubfunction(el, Exterieur.controlerAnnuler, "Annuler");
  5454. },
  5455. controlerAnnuler: function () {
  5456. Exterieur.controlerFin();
  5457. },
  5458. controlerOK: function () {
  5459. LeRapport = "";
  5460. ExtVille = document.formulaire.extVille.value;
  5461. ExtHier = document.formulaire.extHier.value;
  5462. ExtJour = document.formulaire.extJour.value;
  5463. ExtComte = document.formulaire.comteChoisi.value
  5464. if (document.formulaire.extVille.value == "") {
  5465. if (confirm("Le nom de la ville est vide.\nConfirmez-vous l'abandon du contrôle?") == true) {
  5466. Exterieur.controlerFin();
  5467. } else
  5468. return;
  5469. }
  5470. if ((ExtHier == undefined) || (ExtHier == "")) {
  5471. alert("La liste d'hier est vide.");
  5472. return;
  5473. }
  5474. if ((ExtJour == undefined) || (ExtJour == "")) {
  5475. alert("La liste du jour est vide.");
  5476. return;
  5477. }
  5478. if ((ExtComte == undefined) || (ExtComte == "-1")) {
  5479. alert("Le Comté/Duché n'est pas défini.");
  5480. return;
  5481. }
  5482. //faire la comparaison des deux listes
  5483. var lHier = Exterieur.supEspace(ExtHier);
  5484. var lJour = Exterieur.supEspace(ExtJour);
  5485.  
  5486. // Etablissement des listes Hier et Jour
  5487. if (nPresentsJour.length > 0)
  5488. nPresentsJour.splice(0, nPresentsJour.length);
  5489. for (i = 0; i < lJour.length; i++) {
  5490. if (lJour[i] != "")
  5491. nPresentsJour.push(new Present(lJour[i], 0, 0, 0, 0));
  5492. }
  5493. //liste des départs
  5494. var i;
  5495. if (ADeparts.length > 0)
  5496. ADeparts.splice(0, ADeparts.length);
  5497. for (i = 0; i < lHier.length; i++) {
  5498. if (ExtJour.indexOf(lHier[i]) == -1) {
  5499. ADeparts.push(new Present(lHier[i], "", "", 0, 0));
  5500. Exterieur.ajout(lHier[i]);
  5501. }
  5502. }
  5503. //liste des arrivées
  5504. if (AArrivees.length > 0)
  5505. AArrivees.splice(0, AArrivees.length);
  5506. for (i = 0; i < lJour.length; i++) {
  5507. if (ExtHier.indexOf(lJour[i]) == -1) {
  5508. AArrivees.push(new Present(lJour[i], "", "", 0, 0));
  5509. Exterieur.ajout(lJour[i]);
  5510. }
  5511. }
  5512. //faire la recherche de suspects
  5513. Suspects.lire(); //nSuspects
  5514. if (ASuspects.length > 0)
  5515. ASuspects.splice(0, ASuspects.length);
  5516. for (i = 0; i < lJour.length; i++) {
  5517. //logit("Exterieur.controlerOK.nSuspects.length : " + nSuspects.length + " - lJour[i] : " + lJour[i]);
  5518. if (Perso.siSuspect(lJour[i]) != -1) {
  5519. ASuspects.push(lJour[i]);
  5520. Exterieur.ajout(lJour[i]);
  5521. }
  5522. }
  5523. Xidx = 0; nPointeurExt = 0; errorCnt = 0, errorPersoCnt=0;
  5524. if (nPersosExt.length > 0)
  5525. nPersosExt.splice(0, nPersosExt.length);
  5526. Exterieur.getFichePerso();
  5527. },
  5528. getFichePerso: function () {
  5529. if (nPointeurExt < nPresentsJour.length) {
  5530. Exterieur.progression("Contrôle des présents en cours " + Math.floor(nPointeurExt + 1) + "/" + nPresentsJour.length + " (" + nPresentsJour[nPointeurExt].Pseudo + ")",
  5531. (Math.floor(nPointeurExt + 1) / nPresentsJour.length) * 100);
  5532. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (nPresentsJour[nPointeurExt].Pseudo), Exterieur.getPersoInfo)
  5533. } else {
  5534. Exterieur.getPerso();
  5535. }
  5536. },
  5537. getPersoInfo: function (Src) {
  5538. MessageErreur = "";
  5539. if (Src.indexOf("Connexion perdue<") != 0) {
  5540. if (Src.indexOf("Informations sur") != -1) {
  5541. Exterieur.setPersoInfo(nPresentsJour[nPointeurExt].Pseudo, Src);
  5542. nPointeurExt++;
  5543. Exterieur.getFichePerso();
  5544. }
  5545. else if ((Src.indexOf("Une erreur") == 0) || (Src.indexOf("<br><br>Ce personnage n") == 0)) {
  5546. nPointeurExt++;
  5547. Exterieur.getFichePerso();
  5548. }
  5549. else {
  5550. errorCnt++;
  5551. if (errorCnt <= 3)
  5552. setTimeout(Exterieur.getFichePerso, 1500);
  5553. else {
  5554. errorPersoCnt++;
  5555. if (errorPersoCnt <= 3) {
  5556. nPointeurExt++;
  5557. errorCnt = 0;
  5558. Exterieur.getFichePerso();
  5559. }
  5560. else {
  5561. MessageErreur = "<b>Erreur pendant le recensement.</b>";
  5562. }
  5563. }
  5564. }
  5565. }
  5566. else {
  5567. MessageErreur = "<b>Erreur connexion perdue.</b>";
  5568. }
  5569. },
  5570. setPersoInfo: function (zPseudo, Src) {
  5571. var zVillage = "", zComte = "", zPays = "", zStatus = "", zNiveau = "", zEcu = 0, zChamp1 = 0, zChamp2 = 0, zMetier = 0, zPR = 0, zDate = 0; //logit("setPersoInfo (l.4427)- zPseudo : "+zPseudo+" - Src : "+Src);
  5572. zVillage = Perso.getVillage(Src);
  5573. zComte = Perso.getComte(Src);
  5574. zPays = Perso.getPays(Src);
  5575. zStatus = Perso.getStatus(Src);
  5576. if (zStatus == "mort")
  5577. nbPmort++;
  5578. if (zStatus == "retraite")
  5579. nbPretraite++;
  5580. if (zStatus == "retranché")
  5581. nbPretranche++;
  5582. zDate = Perso.getStatusDate(Src);
  5583. //Victorien.,Thiers,Duché du Bourbonnais-Auvergne,,mort,1,0,00,I,0,0,0,18/11/1462
  5584. //Cersei...,Thiers,Duché du Bourbonnais-Auvergne,0,actif,41,37,83,V,2,1,0,27/11/1462
  5585. //logit("setPersoInfo (l.658) recap : "+zPseudo+","+zVillage+","+zComte+","+zPays+","+zStatus+","+zPR+","+zEcu+","+zNiveau+","+zMetier+","+zChamp1+","+zChamp2+","+zDate);
  5586. nPersosExt.push(new Personnage(zPseudo, zVillage, zComte, zPays, zStatus, zPR, zEcu, zNiveau, zMetier, zChamp1, zChamp2, zDate));
  5587. nbP++;
  5588. },
  5589. listeEtrangers: function () {
  5590. var i = 0, z = "", nbVmort = 0, nbVretraite = 0, nbV = 0, nbEmort = 0, nbEretraite = 0, nbE = 0;
  5591. z = Exterieur.unPseudoHtml(-1);
  5592. for (i = 0; i < nPersosExt.length; i++) {
  5593. if ((nPersosExt[i].Village != ExtVille) && (nPersosExt[i].Comte == ExtComte)) {
  5594. z += Exterieur.unPseudoHtml(i);
  5595. if (nPersosExt[i].Status == "mort")
  5596. nbVmort++;
  5597. else if (nPersosExt[i].Status == "retraite")
  5598. nbVretraite++;
  5599. nbV++;
  5600. }
  5601. }
  5602. if (nbV !=0)
  5603. LeRapport += "<b>" + nbV + " voisins du " + ExtComte + " en visite</b> : (dont " + nbVmort + " morts et " + nbVretraite + " retraités)<br>" + z + "\n";
  5604. z = Exterieur.unPseudoHtml(-1);
  5605. for (i = 0; i < nPersosExt.length; i++) {
  5606. if (nPersosExt[i].Comte != ExtComte) {
  5607. z += Exterieur.unPseudoHtml(i);
  5608. if (nPersosExt[i].Status == "mort")
  5609. nbEmort++;
  5610. else if (nPersosExt[i].Status == "retraite")
  5611. nbEretraite++;
  5612. nbE++;
  5613. }
  5614. }
  5615. if (nbE !=0)
  5616. LeRapport += "<br><b>" + nbE + " étrangers au " + ExtComte + " en visite</b> : (dont " + nbEmort + " morts et " + nbEretraite + " retraités)<br>" + z + "\n<br>";
  5617. return (LeRapport);
  5618. },
  5619. unPseudoHtml: function (i) {
  5620. var tdNom = '',
  5621. tdVillage = ' ',
  5622. tdComte = ' - ',
  5623. tdPays = ' - <i>',
  5624. tdStatus = '</i> ',
  5625. ftd = ' ';
  5626. if (i == -1)
  5627. return("");
  5628. var z = tdNom + Perso.lienHTML(nPersosExt[i].Pseudo) + ftd + tdVillage + nPersosExt[i].Village + ftd
  5629. if (nPersosExt[i].Comte != ExtComte)
  5630. z += tdComte + nPersosExt[i].Comte + tdPays + nPersosExt[i].Pays + tdStatus;
  5631. if (nPersosExt[i].Status != "actif")
  5632. z += "- <font color=#ff0000><b>" + nPersosExt[i].Status + "</b></font >";
  5633. else
  5634. z += "&nbsp;";
  5635. z += "<br>";
  5636. return(z);
  5637. },
  5638. ajout: function (x) {
  5639. var i;
  5640. for (i = 0; i < Xident; i++)
  5641. if (Xident[i].Pseudo == x)
  5642. return;
  5643. Xident.push(new Present(x, "", "", 0, 0));
  5644. },
  5645. getPerso: function () {
  5646. if (Xidx < Xident.length) {
  5647. Exterieur.progression("Mouvements en cours " + Math.floor(Xidx + 1) + "/" + Xident.length + " (" + Xident[Xidx].Pseudo + ")",
  5648. (Math.floor(Xidx + 1) / Xident.length) * 100);
  5649. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/FichePersonnage.php', 'login=' + (Xident[Xidx].Pseudo), Exterieur.getInfo);
  5650. } else {
  5651. Exterieur.getFin();
  5652. }
  5653. },
  5654. getInfo: function (Src) {
  5655. MessageErreur = "";
  5656. if (Src.indexOf("Connexion perdue<") != 0) {
  5657. if (Src.indexOf("Informations sur") != -1) {
  5658. Xident[Xidx].Status = Perso.getStatus(Src);
  5659. Xident[Xidx].Village = Perso.getVillage(Src);
  5660. Xident[Xidx].Comte = Perso.getComte(Src);
  5661. Xident[Xidx].Pays = Perso.getPays(Src);
  5662. Xident[Xidx].Ecu = parseInt(Perso.getEcu(Src));
  5663. Xidx++;
  5664. Exterieur.getPerso();
  5665. }
  5666. else if (Src.indexOf("<br><br>Ce personnage n") == 0) {
  5667. Xidx++;
  5668. Exterieur.getPerso();
  5669. }
  5670. else {
  5671. errorCnt++;
  5672. if (errorCnt <= 3)
  5673. setTimeout(Exterieur.getPerso, 1500);
  5674. else {
  5675. errorPersoCnt++;
  5676. if (errorPersoCnt <= 3) {
  5677. Xidx++;
  5678. errorCnt = 0;
  5679. Exterieur.getPerso();
  5680. }
  5681. else {
  5682. MessageErreur = "<b>Erreur pendant l'identification.</b>";
  5683. }
  5684. }
  5685. }
  5686. }
  5687. else {
  5688. MessageErreur = "<b>Erreur connexion perdue.</b>";
  5689. }
  5690. },
  5691. getFin: function () {
  5692. //remettre les infos de Xident dans les différentes listes
  5693. Exterieur.setInfo(AArrivees);
  5694. Exterieur.setInfo(ADeparts);
  5695. //puis on continue
  5696. Exterieur.controlerFaire();
  5697. },
  5698. setInfo: function (x) {
  5699. var i, j;
  5700. for (i = 0; i < x.length; i++) {
  5701. for (j = 0; j < Xident.length; j++) {
  5702. if (x[i].Pseudo == Xident[j].Pseudo) {
  5703. x[i].Status = Xident[j].Status;
  5704. x[i].Village = Xident[j].Village;
  5705. x[i].Comte = Xident[j].Comte;
  5706. x[i].Pays = Xident[j].Pays;
  5707. x[i].Ecu = Xident[j].Ecu;
  5708. }
  5709. }
  5710. }
  5711. },
  5712. supEspace: function (s) {
  5713. var r = s.split("\n"), i, x;
  5714. for (i = 0; i < r.length; i++) {
  5715. x = r[i].split(" ");
  5716. r[i] = x[0];
  5717. x = r[i].split("\t");
  5718. r[i] = x[0];
  5719. }
  5720. r.sort();
  5721. return(r);
  5722. },
  5723. controlerFaire: function () {
  5724. var i;
  5725. var el = document.getElementById("zoneTexte0");
  5726. var m = '<h1>Guet pour un village</h1>';
  5727. m += '<p>Ville : <b>' + ExtVille + ' (' + ExtComte + ')</b> le ' + lDate + '</p>';
  5728. m += '<p><b>Arrivées :</b>';
  5729. m += '<br>';
  5730. if (AArrivees.length < 1)
  5731. m += "Néant<br>";
  5732. else
  5733. for (i = 0; i < AArrivees.length; i++) {
  5734. m += Exterieur.addHTML(AArrivees[i]);
  5735. }
  5736. m += '</p>';
  5737. m += '<p><b>Départs :</b>';
  5738. m += '<br>';
  5739. if (ADeparts.length < 1)
  5740. m += "Néant<br>";
  5741. else
  5742. for (i = 0; i < ADeparts.length; i++) {
  5743. m += Exterieur.addHTML(ADeparts[i]);
  5744. }
  5745. m += '</p>';
  5746. var n;
  5747. m += '<p><b>Suspects:</b>';
  5748. m += '<br>';
  5749. if (ASuspects.length < 1)
  5750. m += "Néant<br>";
  5751. else
  5752. for (i = 0; i < ASuspects.length; i++) {
  5753. n = Perso.siSuspect(ASuspects[i]);
  5754. m += Perso.lienHTML(ASuspects[i]) + ' : ' + nSuspects[n].Motif + '<br>';
  5755. }
  5756. m += '<br>';
  5757. m += Exterieur.listeEtrangers();
  5758. m += '</p>';
  5759. m += Exterieur.analyseFaire();
  5760. m += '<div id="boutons">&nbsp;</div>';
  5761. el.innerHTML = m;
  5762. RRmenu.addSubfunction(el, Exterieur.controlerExport, "Exporter");
  5763. RRmenu.addSubfunction(el, Exterieur.controlerFin, "Terminer");
  5764. },
  5765. analyseFaire: function () {
  5766. var r = "", i;
  5767. if (nPersosExt.length > 0) {
  5768. var nbP = 0, nbPmort = 0, nbPretraite = 0,
  5769. nbH = 0, nbHmort = 0, nbHretraite = 0,
  5770. nbV = 0, nbVmort = 0, nbVretraite = 0,
  5771. nbE = 0, nbEmort = 0, nbEretraite = 0, sPersosExt = "<b>Liste des résidents actifs</b><br>";
  5772. nbP = nPersosExt.length;
  5773. for (i = 0; i < nbP; i++) {
  5774. if (nPersosExt[i].Status == "mort")
  5775. nbPmort++;
  5776. if (nPersosExt[i].Status == "retraite")
  5777. nbPretraite++;
  5778. if (nPersosExt[i].Village != ExtVille) {
  5779. if (nPersosExt[i].Comte != ExtComte) {
  5780. nbE++;
  5781. if (nPersosExt[i].Status == "mort")
  5782. nbEmort++;
  5783. if (nPersosExt[i].Status == "retraite")
  5784. nbEretraite++;
  5785. } else {
  5786. nbV++;
  5787. if (nPersosExt[i].Status == "mort")
  5788. nbVmort++;
  5789. if (nPersosExt[i].Status == "retraite")
  5790. nbVretraite++;
  5791. }
  5792. } else {
  5793. nbH++;
  5794. if (nPersosExt[i].Status == "actif")
  5795. sPersosExt += Perso.lienHTML(nPersosExt[i].Pseudo) + '<br>';
  5796. if (nPersosExt[i].Status == "mort")
  5797. nbHmort++;
  5798. if (nPersosExt[i].Status == "retraite")
  5799. nbHretraite++;
  5800. }
  5801. }
  5802. r +="<b> Synthèse pour " + ExtVille + " (" + ExtComte + ")</b><br>";
  5803. r += Village.unStat("Présent", nbP, nbPmort, nbPretraite);
  5804. r += Village.unStat("Résident", nbH, nbHmort, nbHretraite);
  5805. r += Village.unStat("Étranger", nbE, nbEmort, nbEretraite);
  5806. r += Village.unStat("Voisin", nbV, nbVmort, nbVretraite);
  5807. r += '<p>' + sPersosExt + '</p>';
  5808. }
  5809. LeRapport += r;
  5810. return(r);
  5811. },
  5812. addHTML: function (x) {
  5813. var m = "";
  5814. m += Perso.lienHTML(x.Pseudo);
  5815. m += " (" + x.Village + ", " + x.Comte + " - <i>" + x.Pays + "</i>)";
  5816. if (x.Status != "actif")
  5817. m += "- <font color=#ff0000><b>" + x.Status + "</b></font >";
  5818. m += '<br>';
  5819. return(m);
  5820. },
  5821. controlerExport: function () {
  5822. var i;
  5823. var m = '[size=24]Guet pour : [b]' + ExtVille + '[/b][/size]\n';
  5824. m += '\n[b]' + AArrivees.length + ' Arrivées:[/b]\n';
  5825. if (AArrivees.length < 1)
  5826. m += "Néant\n";
  5827. else
  5828. for (i = 0; i < AArrivees.length; i++) {
  5829. m += Exterieur.addBBcode(AArrivees[i]);
  5830. }
  5831. m += '\n[b]' + ADeparts.length + ' Départs:[/b]\n';
  5832. if (ADeparts.length < 1)
  5833. m += "Néant\n";
  5834. else
  5835. for (i = 0; i < ADeparts.length; i++) {
  5836. m += Exterieur.addBBcode(ADeparts[i]);
  5837. }
  5838. var n;
  5839. m += '\n[b]' + ASuspects.length + ' Suspects:[/b]\n';
  5840. if (ASuspects[0] == "R.A.S.")
  5841. m += "Néant\n";
  5842. else
  5843. for (i = 0; i < ASuspects.length; i++) {
  5844. n = Perso.siSuspect(ASuspects[i]);
  5845. m += Perso.lienBBcode(ASuspects[i]) + ' : ' + nSuspects[n].Motif + '\n';
  5846. }
  5847. m += '\n';
  5848. m += BBc.fromHTML(LeRapport)
  5849.  
  5850. logit("m : " + m);
  5851. ClipboardCopyTo(m);
  5852. alert("Rapport disponible dans le presse-papiers.");
  5853. return;
  5854. },
  5855. addBBcode: function (x) {
  5856. var m = "";
  5857. m += Perso.lienBBcode(x.Pseudo);
  5858. m += " (" + x.Village + ", " + x.Comte + " - [i]" + x.Pays + "[/i])";
  5859. if (x.Status != "actif")
  5860. m += " [color=#ff0000][b]" + x.Status + "[/b][/color]";
  5861. m += '\n';
  5862. return(m);
  5863. },
  5864. controlerFin: function () {
  5865. var el = document.getElementById("zoneTexte0");
  5866. el.innerHTML = SaveIG;
  5867. },
  5868. addBouton: function (titre, fn) {
  5869. document.getElementById("boutons").innerHTML += '&nbsp;<span id="' + titre + '">&nbsp;</span>';
  5870. var xa = document.createElement("input");
  5871. xa.setAttribute('type', 'button');
  5872. xa.setAttribute('id', titre);
  5873. xa.setAttribute('value', titre);
  5874. xa.onclick = function () {
  5875. fn();
  5876. return false;
  5877. }
  5878. document.getElementById("boutons").appendChild(xa);
  5879. },
  5880. progression: function (t, z) {
  5881. document.getElementById("progressionGuet").innerHTML = t;
  5882. var indicator = document.getElementById("indicator");
  5883. if (z == -1) {
  5884. document.getElementById("progressbar").style.display = 'none';
  5885. indicator.style.display = 'none';
  5886. }
  5887. else {
  5888. document.getElementById("progressbar").style.display = 'block';
  5889. indicator.style.display = 'block';
  5890. indicator.style.width = (z * 3) + "px";
  5891. }
  5892. },
  5893. lister: function () {
  5894. alert("Non actif. En cours...");
  5895. }
  5896. }
  5897. var mailFenetre, mailDest = "", mailObj = "", mailTexte = "", mailList = new Array, mailIdx = -1;
  5898. var MailRR = {
  5899. debut: function (d) {
  5900. },
  5901. liste: function () {
  5902. var z;
  5903. mailDest = "";
  5904. for (i = 0; i < nPersos.length; i++) {
  5905. z = monPopup.document.getElementById("mp" + nPersos[i].Pseudo);
  5906. if (z != null) {
  5907. if (z.checked == true)
  5908. mailDest += (mailDest.length > 0 ? ";" : "") + nPersos[i].Pseudo;
  5909. }
  5910. }
  5911. logit("MailRR.liste\n" + mailDest);
  5912. MailRR.prepMailOne(mailDest);
  5913. },
  5914. prepMailOne: function (d) {
  5915. mailDest = d;
  5916. if (mailList.length > 0)
  5917. mailList.splice(0, mailList.length);
  5918. mailList = mailDest.split(';');logit ("mailList.length : " + mailList.length);
  5919. mailObj = "";
  5920. mailTexte = "";
  5921. mailIdx = -1;
  5922. mailFenetre = RRpopup.init("Mailing", 0);
  5923. RRpopup.setMessage(mailFenetre, "<b><u>Mailing</u></b>");
  5924. RRpopup.setMessage(mailFenetre, "adressé à " + " présents dans le village.");
  5925. /*var captchaVal = "****";
  5926. //<form method="post" action="http://www.lesroyaumes.com/NouveauCourrier.php" target="djg_courrier"> Destinataire : <input type="text" name="destinataire1" value="" size=8 > Code de s&eacute;curit&eacute; : <input type="text" name="CodeSecurite" value="" size=4 > Sujet : <input type="text" name="titre3" value="" size=15 ><input type="submit" name="post" value="Envoyer" /><br /><textarea align="left" name="texte2" rows="8" cols="150" style="width:900px"></textarea></form>*/
  5927. var zzmailTxt = "<title>Nouveau Mailing</title>";
  5928. zzmailTxt += "<script type=text/javascript language=javascript>function change_code(){ var d=new Date();document.getElementById('ImgSecurite').src='http://www.lesroyaumes.com/codeSecurite.php?'+d.getTime();}</script>";
  5929. // zzmailTxt += "<form method=post action='http://www.lesroyaumes.com/NouveauCourrier.php'>";
  5930. zzmailTxt += " <div class=pop_up_courrier_zone_texte>";
  5931. zzmailTxt += " <div class=pop_up_courier_texte_cadre>";
  5932. zzmailTxt += " <div class=pop_up_courrier_texte_gauche>";
  5933. zzmailTxt += " <div class=zone_texte_haut_coin_gauche></div>";
  5934. zzmailTxt += " <div class=pop_up_courrier_texte_repeat_gauche></div>";
  5935. zzmailTxt += " <div class=zone_texte_bas_coin_gauche></div>";
  5936. zzmailTxt += " </div>";
  5937. zzmailTxt += " <div class=pop_up_courrier_texte_centrale>";
  5938. zzmailTxt += " <div class=pop_up_courrier_texte_centrale_top>";
  5939. zzmailTxt += " <div class=zone_texte_centrale_coin_haut></div>";
  5940. zzmailTxt += " </div>";
  5941. zzmailTxt += " <div class=pop_up_courrier_texte_centrale_middle>";
  5942. zzmailTxt += " <table border=0 bordercolor=none cellpadding=0 cellspacing=0>";
  5943. zzmailTxt += " <tbody>";
  5944. zzmailTxt += " <tr>";
  5945. zzmailTxt += " <td width=138>Titre</td>";
  5946. zzmailTxt += " <td width=342 colspan=2><input name=subject size=50 maxlength=50 id=fond_courrier type=text></td>";
  5947. zzmailTxt += " </tr>";
  5948. zzmailTxt += " <tr>";
  5949. zzmailTxt += " <td colspan=3><textarea name=message rows=15 cols=85 wrap=virtual id=fond_courrier align=left></textarea></td>";
  5950. zzmailTxt += " </tr>";
  5951. zzmailTxt += " <tr>";
  5952. zzmailTxt += " <td colspan=3>Recopiez le code de sécurité ci-dessous afin de pouvoir envoyer ce message.</td>";
  5953. zzmailTxt += " </tr>";
  5954. zzmailTxt += " <tr>";
  5955. zzmailTxt += " <td><img src='http://www.lesroyaumes.com/codeSecurite.php' id=ImgSecurite style=border:1px solid grey; width:128px; height:45px;></td>";
  5956. zzmailTxt += " <td colspan=2><input name=crypt onFocus=change_code(); maxlength=4 size=4 type=text>";
  5957. zzmailTxt += " <input name=Envoyer value=Envoyer type=submit></td>";
  5958. zzmailTxt += " </tr>";
  5959. zzmailTxt += " <tr>";
  5960. zzmailTxt += " <td valign=top>Destinataires</td>";
  5961. zzmailTxt += " <td colspan=2><textarea name=send_to cols=15 rows=3 readonly id=send_to value='' type=text></textarea></td>";
  5962. zzmailTxt += " </tr>";
  5963. zzmailTxt += " </tbody>";
  5964. zzmailTxt += " </table>";
  5965. zzmailTxt += "</div></div></div></div>";
  5966. // zzmailTxt += "</form>";
  5967. zzmailTxt += "</div>";
  5968. zzmailTxt += "Pour la suite vous devez cliquer sur le lien suivant:<br />";
  5969. zzmailTxt += "<a href='http://www.lesroyaumes.com/NouveauCourrier.php' target='djg_courrier'>Nouveau courrier</a><br>";
  5970. /* var zzmailTxt = "<title>Nouveau Mailing</title>";
  5971. zzmailTxt += "<script type='text/javascript' language='javascript'>function change_code(){ var d=new Date();document.getElementById('ImgSecurite').src=\"http://www.lesroyaumes.com/codeSecurite.php?\"+d.getTime();}</script>";
  5972. zzmailTxt += "<form method='post' action='http://www.lesroyaumes.com/NouveauCourrier.php'>";
  5973. zzmailTxt += " <div class='pop_up_courrier_zone_texte'>";
  5974. zzmailTxt += " <div class='pop_up_courier_texte_cadre'>";
  5975. zzmailTxt += " <div class='pop_up_courrier_texte_gauche'>";
  5976. zzmailTxt += " <div class='zone_texte_haut_coin_gauche'></div>";
  5977. zzmailTxt += " <div class='pop_up_courrier_texte_repeat_gauche'></div>";
  5978. zzmailTxt += " <div class='zone_texte_bas_coin_gauche'></div>";
  5979. zzmailTxt += " </div>";
  5980. zzmailTxt += " <div class='pop_up_courrier_texte_centrale'>";
  5981. zzmailTxt += " <div class='pop_up_courrier_texte_centrale_top'>";
  5982. zzmailTxt += " <div class='zone_texte_centrale_coin_haut'></div>";
  5983. zzmailTxt += " </div>";
  5984. zzmailTxt += " <div class='pop_up_courrier_texte_centrale_middle'>";
  5985. zzmailTxt += " <table border='1' bordercolor='none' cellpadding='0' cellspacing='0'>";
  5986. zzmailTxt += " <tbody>";
  5987. zzmailTxt += " <tr>";
  5988. zzmailTxt += " <td class='td_sans'>Titre</td>";
  5989. zzmailTxt += " <td class='td_sans' colspan='2'><input name='titre3' size='30' id='fond_courrier' type='text'></td>";//style='width:18em'
  5990. zzmailTxt += " </tr>";
  5991. zzmailTxt += " <tr>";
  5992. zzmailTxt += " <td class='td_sans' colspan='3'><textarea name='texte2' rows='15' cols='85' wrap='virtual' id='fond_courrier' align='left'></textarea></td>";
  5993. zzmailTxt += " </tr>";
  5994. zzmailTxt += " <tr>";
  5995. zzmailTxt += " <td class='td_sans' colspan='3'>Recopiez le code de sécurité ci-dessous afin de pouvoir envoyer ce message.</td>";
  5996. zzmailTxt += " </tr>";
  5997. zzmailTxt += " <tr>";
  5998. zzmailTxt += " <td class='td_sans'><img src='http://www.lesroyaumes.com/codeSecurite.php' id='ImgSecurite' style='border:1px solid grey; width:128px; height:45px;'></td>";
  5999. zzmailTxt += " <td class='td_sans' colspan='2'><input name='CodeSecurite' onfocus='change_code();' maxlength='4' size='4' type='text'>";
  6000. zzmailTxt += " <input name='Envoyer' value='Envoyer' type='submit'></td>";
  6001. zzmailTxt += " </tr>";
  6002. zzmailTxt += " <tr>";
  6003. zzmailTxt += " <td class='td_sans'>Destinataires</td>";
  6004. zzmailTxt += " <td class='td_sans' colspan='2'><textarea name='destinataire1' value='' rows='15' cols='15' id='fond_courrier' type='text'></textarea></td>";// style='width:18em'
  6005. zzmailTxt += " </tr>";
  6006. zzmailTxt += " </tbody>";
  6007. zzmailTxt += " </table>";
  6008. zzmailTxt += " </div>";
  6009. zzmailTxt += " </div>";
  6010. zzmailTxt += " </div>";
  6011. zzmailTxt += " </div>";
  6012. zzmailTxt += "</form>";
  6013. zzmailTxt += "</div>";*/
  6014.  
  6015. RRpopup.setMessage(mailFenetre, zzmailTxt);
  6016. mailFenetre.document.getElementById("Envoyer").onchange = function () {
  6017. MailRR.prepMailTwo();
  6018. return false;
  6019. };
  6020. RRpopup.fermeture(mailFenetre);
  6021. // mailFenetre = window.open('NouveauCourrier.php', 'mail', 'top=0px, left=0px, width=600px, height=600px, resizable=no, toolbar=no, scrollbars=no, status=no, menubar=no, titlebar=no, dependent=yes');
  6022. setTimeout(MailRR.faire, 1500);
  6023. },
  6024. prepMailTwo: function () {
  6025. var mailTitle = mailFenetre.document.getElementsByName('subject')[0].value;
  6026. var mailText = mailFenetre.document.getElementsByName('message')[0].value;
  6027. var zmailDest = mailFenetre.document.getElementsByName('send_to')[0].value;
  6028. mailDest = zmailDest.split(',');
  6029. var CodeSecurite = mailFenetre.document.getElementsByName('crypt')[0].value;
  6030. // mailDest : tableau des destinataires
  6031. for (i = 0; i < mailDest.length; i++) {
  6032. zzMailtxt = "<form method=post action=http://www.lesroyaumes.com/NouveauCourrier.php target=djg_courrier> Destinataire : <input type=text name=destinataire1 value='" + mailDest[i] + "' size=30 >&nbsp;";
  6033. zzMailtxt += "Code de s&eacute;curit&eacute; : <input type=text name=CodeSecurite value='" + CodeSecurite + "' size=4 >&nbsp;";
  6034. zzMailtxt += "Sujet : <input type=text name=titre3 value='" + mailTitle + "' size=14 >&nbsp;<input type=submit name=post value=Envoyer /><br>";
  6035. zzMailtxt += "<textarea align=left name=texte2 rows=8 cols=150 style=width:300px>" + mailText + "</textarea></form>";
  6036. }
  6037. RRpopup.setMessage(mailFenetre, zzmailTxt);
  6038. },
  6039. faire: function () {
  6040. logit("mailFenetre.document.getElementsByName('send_to')[0].value : " + mailFenetre.document.getElementsByName('send_to')[0].value);
  6041. mailFenetre.document.getElementsByName('send_to')[0].value = mailDest;//.split(';');
  6042. }
  6043. }
  6044.  
  6045. var Armee = {
  6046. commandant: function () {
  6047. alert("En cours de développement");
  6048. },
  6049. intendant: function () {
  6050. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipal.php', 'l=8', Armee.intendantDebut);
  6051. },
  6052. intendantDebut: function (Src) {
  6053. if (Src.indexOf("la logistique") == -1) {
  6054. alert("Vous n'êtes pas en charge de la logistique d'une armée.");
  6055. return;
  6056. }
  6057. LeRapport = "";
  6058. RRoperation = "Rapport intendant armée";
  6059. var x = HtmlToString(getData(Src, "textePage[4]['Texte'] = '", "textePage[4][1]"));
  6060. x = str_replace(x, "<p>", "\n");
  6061. x = str_replace(x, "</p>", "\n");
  6062. x = str_replace(x, "<br>", "\n");
  6063. var l = x.split("\n"), i, t = "", u = "";
  6064. for (i = 0; i < l.length; i++) {
  6065. if (l[i].indexOf("Encombrement") != -1)
  6066. t += l[i] + "\n";
  6067. if (l[i].indexOf("inventaire_contenu") != -1)
  6068. u += "\n" + l[i];
  6069. }
  6070. t = str_replace(t, "</p>", "\n");
  6071. u = str_replace(u, "<div", "\n<div");
  6072. l = u.split("\n");
  6073. u = "";
  6074. for (i = 0; i < l.length; i++) {
  6075. if (l[i].indexOf("_nbre") != -1)
  6076. u += getData(l[i], ">", "<");
  6077. else if (l[i].indexOf("_descriptif") != -1)
  6078. u += " " + getData(l[i], ">", "<") + "\n";
  6079. }
  6080. LeRapport = t + "\n[b]Inventaire:[/b] " + u;
  6081. ClipboardCopyTo(HtmlToString(LeRapport));
  6082. RRoperation = "";
  6083. alert("Rapport disponible dans le presse-papiers.");
  6084. },
  6085. tresorier: function () {
  6086. alert("En cours de développement");
  6087. }
  6088. }
  6089.  
  6090. var getMandat = {
  6091. debut: function() {
  6092. // if (QuelOnglet() != "Mon personnage") {
  6093. // SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', getMandat.faire); //Mon Personnage
  6094. // return;
  6095. // }
  6096. // getMandat.faire(document.getElementsByTagName("body")[0].innerHTML);
  6097. SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', getMandat.faire, false); //Mon Personnage
  6098. },
  6099. faire: function(Src) {
  6100. /*elementsTextuelsNavigation[0][4]['Nom'] = 'Vos charges et vos responsabilit&eacute;s';
  6101. elementsTextuelsNavigation[0][4][1]['Nom'] = 'Mandat de Duché du Bourbonnais-Auvergne'; */
  6102. logit("getMandat.faire avant : mandat présent - isMandat : " + isMandat);
  6103. isMandat = (Src.indexOf("[0][4][1]['Nom']") != -1);
  6104. logit("getMandat.faire après : mandat présent - isMandat : " + isMandat);
  6105. // if (Src.indexOf("[0][4][1]['Nom']") != -1) { // mandat présent
  6106. // x = "Vous avez un mandat en attente.";
  6107. // isMandat = true; logit("getMandat.faire après : mandat présent - isMandat : " + isMandat);
  6108. // }
  6109. //getMandat.fin();
  6110. },
  6111. fin: function () {
  6112. }
  6113. // faire: function(Src) {
  6114. // /*elementsTextuelsNavigation[0][4]['Nom'] = 'Vos charges et vos responsabilit&eacute;s';
  6115. // elementsTextuelsNavigation[0][4][1]['Nom'] = 'Mandat de Duché du Bourbonnais-Auvergne'; */
  6116. // var x = ""; var isMandat = false ;
  6117. // logit("getMandat.faire avant : mandat présent - isMandat : " + isMandat);
  6118. // if (Src.indexOf("[0][4][1]['Nom']") != -1) { // mandat présent
  6119. // x = "Vous avez un mandat en attente.";
  6120. // isMandat = true; logit("getMandat.faire après : mandat présent - isMandat : " + isMandat);
  6121. // }
  6122. // return(isMandat);
  6123. // }
  6124. }
  6125. var RRmenu = {
  6126. initStyle: function () {
  6127. var insertStyle = window.document.getElementById("bandeau_jeux");
  6128. var menuStyle = document.createElement("style");
  6129. var s = "";
  6130. s += "\
  6131. #nav1 {width: 100px;}\n\
  6132. #nav1 ul {padding: 0px; width: 100px; border:1px solid; margin:0px;}\n\
  6133. #nav1 li.smenu {margin-left:Opx;padding-left:0px;background: yellow;}\n\
  6134. #nav1 ul li {margin:Opx;position:relative; list-style: none; border-bottom:1px solid;}\n\
  6135. #nav1 ul ul {margin:Opx;position: absolute; top: 0; left: 100px; display:none}\n\
  6136. #nav1 li a {text-decoration: none;}\n\
  6137. #nav1 ul.n1 li.smenu:hover ul.n2 {margin:Opx;padding:0px;display:block;}\n\
  6138. #nav1 ul.n2 li.smenu:hover ul.n3 {margin:Opx;padding:0px;display:block;}\n";
  6139. menuStyle.innerHTML = s;
  6140. document.body.insertBefore(menuStyle, insertStyle);
  6141. },
  6142. init: function () {
  6143. /************ Détection des mandats ******************/
  6144. // logit("RRmenu.init.isMandat avant : " + isMandat);
  6145. // var isMandat = false;
  6146. // logit("RRmenu.init.isMandat avant2 : " + isMandat);
  6147. // isMandat =
  6148. // SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', getMandat.faire, false); //Mon Personnage
  6149. // getMandat.debut();
  6150. // logit("RRmenu.init.isMandat après : " + isMandat);
  6151. // pausecomp(3000);
  6152. // logit("RRmenu.init.isMandat après2 : " + isMandat);
  6153. // logit("RRmenu.init.isMandat avant4 : " + isMandat);
  6154. //elementsTextuelsNavigation[0][4]['Nom'] = 'Vos charges et vos responsabilit&eacute;s';
  6155. //elementsTextuelsNavigation[0][4][1]['Nom'] = 'Mandat de Duché du Bourbonnais-Auvergne';
  6156. /************ Fin Détection des mandats ******************/
  6157.  
  6158. var zz = document.URL; //logit("RRmenu.init(l.5463) zz : " + zz);
  6159. var rzz = zz.indexOf("Ajax.php", 0);
  6160. var pv1, pv2, zvs;
  6161. /* Init loginJoueur = "ulrica" */
  6162. var zva = parent.window.document.body.innerHTML;//logit("RRmenu.initzva : '" + zva + "'");
  6163. pv1 = zva.indexOf("loginJoueur = \"")+15;
  6164. pv2 = zva.indexOf("\"", pv1);
  6165. PersoLogin = zva.substring(pv1, pv2);
  6166. PersoPrefs = zva.substring(pv1, pv2);
  6167. //logit("RRmenu.init PersoLogin : '" + PersoLogin + "' PersoPrefs : " + PersoPrefs + "'");
  6168. zva = "";
  6169. /* Fin Init loginJoueur = "ulrica" */
  6170. var zv = parent.window.document.getElementsByClassName("horloge")[0], zvs;
  6171. if (zv == undefined) {
  6172. zv=window.document.body.innerHTML;
  6173. zvs = getData(zv, "horloge", "</div>");
  6174. }
  6175. else
  6176. var zvb = parent.window.document.body.innerHTML;
  6177. zvs = zv.innerHTML;
  6178. if (zvs.indexOf(" chemins") == -1) {
  6179. //Thiers (Duché du Bourbonnais-Auvergne)
  6180. //Reims, capitale du Duché de Champagne (Domaine Royal)
  6181. //Bordeaux, capitale du Duché de Guyenne
  6182. pv1 = zvs.indexOf("<div>") + 5, pv2 = zvs.indexOf(", ");
  6183. if (pv2 == -1) {
  6184. pv2 = zvs.indexOf(" (");
  6185. mVille = zvs.substring(pv1, pv2);
  6186. pv1 = zvs.indexOf(" (", pv2) + 2;
  6187. pv2 = zvs.indexOf(")", pv1);
  6188. mDuche = zvs.substring(pv1, pv2);
  6189. } else {
  6190. mVille = zvs.substring(pv1, pv2);
  6191. pv1 = zvs.indexOf(", ", pv2) + 14;
  6192. pv2 = zvs.indexOf("\n", pv1);
  6193. mDuche = zvs.substring(pv1, pv2);
  6194. }
  6195. } else {
  6196. mVille = "Sur les chemins";
  6197. mDuche = zvs.substring(0, zvs.indexOf("<span>"));
  6198. }
  6199. pv1 = zvs.indexOf("<span>", pv2) + 7;
  6200. pv2 = zvs.indexOf("</span>", pv1);
  6201. lDate = zvs.substring(pv1, pv2);
  6202. mDate = stringToDate(lDate);
  6203.  
  6204. /**************** Init prefs ******************/
  6205. this.getUserPrefs();
  6206. // logit("RRmenu.init.Fin Init prefs.lastHier : '" + lastHier + "' lastRapport: '" + lastRapport + "' PersoLogin : '" + PersoLogin + "' PersoPrefs : " + PersoPrefs + "' MandatVu : " + MandatVu + " - MandatOH : " + MandatOH + " - MandatH : " + MandatH );
  6207. /************ Fin Init prefs ******************/
  6208.  
  6209. // logit("RRmenu.init.isMandat l.5515 : " + isMandat);
  6210.  
  6211. /**************** Initialisation date veille ******************/
  6212. // var lgMois = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); 31/05/1464
  6213. var zD = 0;
  6214. dHier = Number (mDate.substring(0, 2)) -1;
  6215. if (dHier ===0) {
  6216. zD = 1;
  6217. var dumDate=getNbJours(Number(mDate.substring(3, 5)-2));
  6218. var zMonth = Number(mDate.substring(3, 5)-1);
  6219. var zMonth2 = zMonth.toString();
  6220. if (zMonth2.length === 1)
  6221. zMonth2 = "0" + zMonth2;
  6222. var zDate = dumDate + '/' + zMonth2 + '/' + mDate.substring(6, 10) ;
  6223. dHier = zDate;
  6224. }
  6225. if (zD)
  6226. hHier = dHier;
  6227. else
  6228. hHier = dHier + mDate.substring(2, mDate.length);
  6229. // logit("RRmenu.init.Fin Init prefs.hHier : '" + hHier + "' mDate: '" + mDate + "'");
  6230. /************ Fin Initialisation date veille ******************/
  6231. //"|undefined|27/06/1463|28/06/1463#|Maréchal|Reims#Ulrica|0#20|15|15|19|10|10 |14|5|6|9|5#Miches de pain|30øFruits|5øSacs de maïs|30øMorceaux de viande|5øSacs de blé|10øSacs de farine|5øBas pour femme|2ø#00/00/0000#0#0"
  6232.  
  6233. /**************** Mise à jour des dates en Prefs ******************/
  6234. hPersos=mDate;
  6235. PersoJour=mDate;
  6236.  
  6237. /************ Fin Mise à jour des dates en Prefs ******************/
  6238. // logit("RRmenu.init.avant chargement.lastHier : " + lastHier + " lastRapport: " + lastRapport );
  6239. // logit("RRmenu.init.isMandat l 5573 avant : " + isMandat);
  6240. // SendXMLHttpRequest('GET', 'http://www.lesroyaumes.com/EcranPrincipalAjax.php', 'l=2&a=0', getMandat.faire); //Mon Personnage
  6241. // getMandat.debut();
  6242. // logit("RRmenu.init.isMandat l 5575 après : " + isMandat);
  6243. Fichier.charger();
  6244. Fichier.chargerHier();
  6245. Suspects.lire();
  6246. if (PersoPrefs != "")
  6247. this.setUserPrefs();
  6248. if (zz.indexOf("Ajax.php", 0) == -1) {
  6249. this.initStyle();
  6250. var b = document.body.innerHTML;//logit ("RRmenu.init.b : " + b);
  6251. var x = '<table><tr><td><div id="bandeauRR"><br></div></td></tr>\n\
  6252. <tr><td valign="top" width="12%">\n\
  6253. <div style="background-color: #FFFFDF;font-size:12px;opacity: 0.7" class="nav1"><p align="center"><b>RReasy ' + version + '</b></p><ul id="menuRR" class="nav1" style="padding-left:5px;"></ul><br></div></td>\n\
  6254. <td><div id="igRR" width="88%"></div></td></tr></table>';
  6255. document.body.innerHTML = x;
  6256. document.getElementById("igRR").innerHTML = b;
  6257. this.setMenuRR();
  6258. } else {
  6259. this.addfnRR();
  6260. }
  6261. },
  6262. setUserPrefs: function () {
  6263. var zz = hPersos + '|' + hHier + '|' + lastHier + '|' + lastRapport + '#';
  6264. zz += PersoJour + '|' + PersoGrade + '|' + PersoGarnison + '|' + PersoEscouade + '|' + PersoMission + '#';
  6265. zz += PrefsAlerts + '#' + PersoAlerts + '#' + MarcheSeuil + '#' + MandatVu + '#' + MandatOH + '#' + MandatH;
  6266. // logit("setUserPrefs.zz : " + zz);
  6267. if (localStorage) {
  6268. localStorage["Prefs_" + PersoPrefs] = zz;
  6269. } else {
  6270. alert("localStorage indisponible");
  6271. }
  6272. },
  6273. getUserPrefs: function () {
  6274. var yy, zz, zv;
  6275. if (localStorage) {
  6276. zv=localStorage["Prefs_" + PersoPrefs];
  6277. } else {
  6278. alert("localStorage indisponible");
  6279. }
  6280. if ((zv != "") && (zv!=undefined)) {
  6281. var zz = zv.split('#');
  6282. yy = zz[0].split('|');
  6283. hPersos = yy[0];
  6284. hHier = yy[1];
  6285. lastHier = yy[2];
  6286. lastRapport = yy[3];
  6287. yy = zz[1].split('|');
  6288. PersoJour = yy[0];
  6289. PersoGrade = yy[1];
  6290. PersoGarnison = yy[2];
  6291. PersoEscouade = yy[3];
  6292. PersoMission = yy[4];
  6293. PrefsAlerts = zz[2];
  6294. PersoAlerts = zz[3];
  6295. MarcheSeuil = zz[4];
  6296. MandatVu = zz[5];
  6297. MandatOH = zz[6];
  6298. MandatH = zz[7];
  6299. } else {
  6300. MarcheSeuil="|ø";
  6301. var zz = hPersos + '|' + hHier + '|' + lastHier + '|' + lastRapport + '#';
  6302. zz += PersoJour + '|' + PersoGrade + '|' + PersoGarnison + '|' + PersoEscouade + '|' + PersoMission + '#';
  6303. zz += PrefsAlerts + '#' + PersoAlerts + '#' + MarcheSeuil + '#' + MandatVu + '#' + MandatOH + '#' + MandatH;
  6304. RRmenu.setUserPrefs();
  6305. }
  6306. },
  6307. setMenuRR: function () {
  6308. // logit("setMenuRR.isMandat : " + isMandat);
  6309. var el = document.getElementById("menuRR");
  6310. // logit("setMenuRR.el : " + el);
  6311. if (el != null) {
  6312.  
  6313. this.addNiveau("menuRR", "n2", "?l=2", "Moi");
  6314. this.addMenuItem("Moi", "?l=2&a=0", "Personnage");
  6315. this.addMenuItem("Moi", "?l=2&a=1", "Inventaire");
  6316. this.addMenuItem("Moi", "?l=2&a=2", "Courrier");
  6317. this.addMenuItem("Moi", "?l=2&a=3", "Événements");
  6318. // m+="<li><a href='#' onClick='var perso = prompt(\"Entrez le nom du personnage à rechercher\", \"Nom du personnage\");popupPerso (\"FichePersonnage.php?login=\" + perso);'>Rechercher un ami</a></li>";
  6319. // if (isMandat)
  6320. // this.addMenuItem("Moi", "?l=2&a=0", "<font color=red><b>Mandats en attente</b></font>");
  6321. // <a class="lien_default" href="#" onclick="javascript:return navigationEnProfondeur(4);">Vos charges et vos responsabilit&eacute;s</a>
  6322. // this.addMenuItem("Moi", "?l=2&a=0", "<font color=red>Mes mandats</font>");
  6323. this.addNiveau("Moi", "n3", "?l=1&a=1", "Propriété");
  6324. this.addMenuItem("Propriété", "?l=1&a=2", "Champ 1");
  6325. this.addMenuItem("Propriété", "?l=1&a=3", "Champ 2");
  6326. this.addMenuItem("Propriété", "?l=1&a=4", "Atelier");
  6327. this.addFinNiveau2("Moi");
  6328. this.addFinNiveau("Moi");
  6329. this.addNiveau("menuRR", "n2", "?l=8", "Hors la ville");
  6330. this.addMenuItem("Hors la ville", "?l=8&a=0", "Carte");
  6331. this.addMenuItem("Hors la ville", "?l=8&a=1", "Travaux");
  6332. this.addMenuItem("Hors la ville", "?l=8&a=2", "Groupes et armées");
  6333. this.addMenuItem("Hors la ville", "?l=8&a=3", "Informations");
  6334. this.addMenuItem("Hors la ville", "?l=8&a=4", "Mon groupe");
  6335. this.addFinNiveau("Hors la ville");
  6336. if (this.enVille() == "Village") {
  6337. this.addNiveau("menuRR", "n2", "?l=0", "Village");
  6338. this.addNiveau("Village", "n3", "?l=3", "Mairie");
  6339. this.addMenuItem("Mairie", "?l=3&a=0", "Informations");
  6340. this.addMenuItem("Mairie", "?l=3&a=1", "Elections");
  6341. this.addMenuItem("Mairie", "?l=3&a=2", "Offres d'emploi");
  6342. this.addMenuItem("Mairie", "?l=3&a=3", "Marché foncier");
  6343. this.addMenuItem("Mairie", "?l=3&a=4", "Bureau du maire");
  6344. this.addMenuItem2("Mairie", Presence.liste, 'Liste des présents');
  6345. this.addFinNiveau2("Mairie");
  6346. this.addMenuItem("Village", "?l=5", "Taverne");
  6347. this.addMenuItem("Village", "?l=6", "Marché");
  6348. this.addMenuItem("Village", "?l=9", "Ressource");
  6349. this.addMenuItem("Village", "?l=31", "Fouilles");
  6350. this.addMenuItem("Village", "?l=15", "Lice");
  6351. this.addNiveau("Village", "n3", "?l=0", "Église");
  6352. this.addMenuItem("Église", "?l=4&a=0", "Paroisse");
  6353. this.addMenuItem("Église", "?l=4&a=2", "Retraite");
  6354. this.addFinNiveau2("Église");
  6355. this.addFinNiveau("Village");
  6356. } else {
  6357. this.addMenuItem("Hors la ville", "?l=5", "Feux de camp");
  6358. }
  6359. this.addNiveau("menuRR", "n2", "?l=7&a=0", "Sénéchaussée");
  6360. this.addMenuItem("Sénéchaussée", "?l=7&a=0", "Chateau");
  6361. this.addMenuItem("Sénéchaussée", "?l=7&a=1", "Tribunal");
  6362. this.addMenuItem("Sénéchaussée", "?l=7&a=2", "Université");
  6363. this.addFinNiveau("Sénéchaussée");
  6364. this.addNiveau("menuRR", "n2", "?l=0", "Soldat");
  6365. this.addMenuItem2("Soldat", Presence.debut, 'Présence');
  6366. this.addMenuItem2("Soldat", RapportSoldat.debut, 'Rapport');
  6367. this.addMenuItem2("Soldat", Dossier.debut, 'Dossier');
  6368. this.addNiveau("Soldat", "n3", "?l=8", "Armée");
  6369. this.addMenuItem2("Armée", Armee.commandant, 'Commandant');
  6370. this.addMenuItem2("Armée", Armee.intendant, 'Intendant');
  6371. this.addMenuItem2("Armée", Armee.tresorier, 'Trésorier');
  6372. this.addFinNiveau2("Armée");
  6373. this.addFinNiveau2("Soldat");
  6374. this.addMenuItem2("menuRR", Apropos, 'A propos...');
  6375. this.addFinNiveau("RReasy");
  6376. }
  6377. },
  6378. addNiveau: function (niveau1, classe, adresse, nom) {
  6379. var e = window.document.getElementById(niveau1);
  6380. var xli = document.createElement("li");
  6381. xli.setAttribute('style', 'padding-left:5px;');
  6382. if (adresse != null) {
  6383. var xe = document.createElement("a");
  6384. xe.setAttribute('href', adresse);
  6385. xe.innerHTML = nom;//+(classe!=null?' =>':'');
  6386. xli.appendChild(xe);
  6387. } else {
  6388. xli.innerHTML = nom + (classe != null ? ' =>' : '');
  6389. }
  6390. if (classe != null) {
  6391. xli.setAttribute("class", "smenu");
  6392. var xlb = document.createElement("ul");
  6393. xlb.setAttribute('class', classe);
  6394. xlb.setAttribute('style', 'padding-left:5px;');
  6395. xlb.setAttribute('id', nom);
  6396. xli.appendChild(xlb);
  6397. }
  6398. e.appendChild(xli);
  6399. },
  6400. addMenuItem: function (menu, lien, nom) {
  6401. var e = window.document.getElementById(menu);
  6402. var xli = document.createElement("li");
  6403. xli.setAttribute('style', 'margin-left:10px;')
  6404. if (lien != null) {
  6405. var xe = document.createElement("a");
  6406. xe.setAttribute('href', lien);
  6407. xe.innerHTML = nom;
  6408. xli.appendChild(xe);
  6409. } else {
  6410. xli.innerHTML = nom;
  6411. }
  6412. e.appendChild(xli);
  6413. },
  6414. addMenuItem2: function (menu, procedure, nom) {
  6415. var e = window.document.getElementById(menu);
  6416. var xli = document.createElement("li");
  6417. xli.setAttribute('style', 'margin-left:10px;')
  6418. if (procedure != null) {
  6419. var xe = document.createElement("a");
  6420. xe.setAttribute('href', '#');
  6421. xe.onclick =
  6422. function () {
  6423. procedure();
  6424. return false;
  6425. };
  6426. xe.innerHTML = nom;
  6427. xli.appendChild(xe);
  6428. } else {
  6429. xli.innerHTML = nom;
  6430. }
  6431. e.appendChild(xli);
  6432. },
  6433. addFinNiveau: function (n) {
  6434. var e = document.getElementById(n);
  6435. //e.innerHTML+='<br>';
  6436. return;
  6437. },
  6438. addFinNiveau2: function (n) {
  6439. var e = document.getElementById(n);
  6440. //e.innerHTML+='<br>';
  6441. return;
  6442. },
  6443. enVille: function () {
  6444. // repérage si dans un village ou sur les chemin
  6445. var zv = document.getElementsByClassName("horloge")[0], zvs;
  6446. if (zv == undefined) {
  6447. zv=parent.document.getElementsByClassName("horloge")[0];
  6448. zvs=zv.innerHTML;
  6449. }
  6450. else
  6451. zvs = zv.innerHTML;
  6452. //récupération de la ville, du duché et de la date
  6453. if (zvs.indexOf(" chemins") == -1) { //if (zvs.indexOf(" (") != -1) {
  6454. //Thiers (Duché du Bourbonnais-Auvergne)
  6455. //Reims, capitale du Duché de Champagne (Domaine Royal)
  6456. //Bordeaux, capitale du Duché de Guyenne
  6457. var pv1 = zvs.indexOf("<div>") + 5, pv2 = zvs.indexOf(", ");
  6458. if (pv2 == -1) {
  6459. pv2 = zvs.indexOf(" (");
  6460. mVille = zvs.substring(pv1, pv2);
  6461. pv1 = zvs.indexOf(" (", pv2) + 2;
  6462. pv2 = zvs.indexOf(")", pv1);
  6463. mDuche = zvs.substring(pv1, pv2);
  6464. } else {
  6465. mVille = zvs.substring(pv1, pv2);
  6466. pv1 = zvs.indexOf(", ", pv2) + 14;
  6467. pv2 = zvs.indexOf("\n", pv1);
  6468. mDuche = zvs.substring(pv1, pv2);
  6469. }
  6470. } else {
  6471. mVille = "Sur les chemins";
  6472. mDuche = zvs.substring(0, zvs.indexOf("<span>"));
  6473. }
  6474. var elTowns = document.getElementsByClassName("btns btnVillage")[0];
  6475. var mVillage = "";
  6476. if (elTowns != null) {
  6477. mVillage = elTowns.getElementsByClassName("btnsMenu_Texte")[0].innerHTML;
  6478. }
  6479. return(mVillage);
  6480. },
  6481. addfnRR: function () {
  6482. var xBarre;
  6483. if (document.getElementById("chaineNavigation") === null)
  6484. return;
  6485. xBarre = document.getElementById("chaineNavigation").innerHTML;//onglet actif
  6486. if (xBarre != null) {
  6487. if (xBarre == "Groupes et armées")
  6488. this.addFonctionGroupes();
  6489. if (xBarre == "Mes événements")
  6490. this.addFonctionEvenements();
  6491. if (xBarre == "Le tribunal")
  6492. this.addFonctionTribunal();
  6493. if (xBarre == "Prochain duel")
  6494. this.addFonctionDuel();
  6495. }
  6496. xBarre = document.getElementsByClassName("texteOnglet")[0].innerHTML;//premier onglet
  6497. if (xBarre != null) {
  6498. if (xBarre == "Mon personnage")
  6499. this.addFonctionPerso();
  6500. if (xBarre == "La mairie")
  6501. this.addFonctionMairie();
  6502. if (xBarre == "Le marché")
  6503. this.addFonctionMarche();
  6504. //if (xBarre == "Ma paroisse") this.addFonctionEglise();
  6505. if (xBarre == "Mon profil")
  6506. this.addFonctionProfil();
  6507. }
  6508. },
  6509. addFonctionMairie: function () {
  6510. var xzone = null;
  6511. if (document.getElementById("zoneTexte0").innerHTML != null) {
  6512. xzone = document.getElementsByClassName("illustrationImage")[0];
  6513. var xz1 = xzone.getElementsByTagName("img")[0];
  6514. var xe1 = document.createElement("a");
  6515. xe1.setAttribute('href', '#');
  6516. xe1.onclick =
  6517. function () {
  6518. Recensement.debut();
  6519. return false;
  6520. }
  6521. ;
  6522. xe1.innerHTML = "<img alt=\"%Villageois%\" src=\"images/mairie.jpg\">";
  6523. xz1.parentNode.replaceChild(xe1, xz1);
  6524. //fonctions IG
  6525. xzone = document.getElementById("onglet0Panel").getElementsByClassName("element elementRepeat")[0];
  6526. var x1 = document.createElement("div");
  6527. x1.setAttribute('id', 'LeGuet');
  6528. x1.innerHTML += "&nbsp;&nbsp;&nbsp;La Douane : ";
  6529. this.addSubfunction(x1, RapportGuet.debut, "Rapport");
  6530. this.addSubfunction(x1, Recensement.debut, "Recensement");
  6531. this.addSubfunction(x1, Furtifs.debut, "Furtifs");
  6532. this.addSubfunction(x1, Village.analyse, "Statistiques");
  6533. this.addSubfunction(x1, Village.registre, "Registre");
  6534. xzone.appendChild(x1);
  6535. if (document.body.innerHTML.indexOf('Mon bureau de maire') != -1) {
  6536. var x2 = document.createElement("div");
  6537. x2.setAttribute('id', 'BureauMaire');
  6538. x2.setAttribute('class', 'zone_ss_onglets_texte');
  6539. x2.innerHTML += "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
  6540. this.addSubfunction(x2, Mairie.inventaire, "Inventaire<br>");
  6541. this.addSubfunction(x2, Mairie.assietteImpots, "Assiette impots<br>");
  6542. this.addSubfunction(x2, Mairie.fraudeFiscale, "Fraudeurs<br>");
  6543. this.addSubfunction(x2, Mairie.mandats, "Mandats<br>");
  6544. this.addSubfunction(x2, Mairie.milice, "Milice<br>");
  6545. this.addSubfunction(x2, Mairie.compta, "Comptabilité<br>");
  6546. this.addSubfunction(x2, Mairie.achats, "Transactions<br>");
  6547. var xzone11 = document.getElementsByClassName("illustrationImage")[0];
  6548. xzone11.appendChild(x2);
  6549. }
  6550. var x3 = document.createElement("div");
  6551. x3.setAttribute('id', 'GuetAutre');
  6552. x3.innerHTML += "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><b>Guet autre village : </b><br>";
  6553. this.addSubfunction(x3, Exterieur.controler, "<i>Contrôler</i><br>");
  6554. var xzone11 = document.getElementsByClassName("illustrationImage")[0];
  6555. xzone11.appendChild(x3);
  6556. }
  6557. },
  6558. addFonctionMarche: function () {
  6559. var xzone = document.getElementById("onglet0Panel");
  6560. xzone = xzone.getElementsByClassName("element elementRepeat")[0];
  6561. xzone.innerHTML += "&nbsp;&nbsp;&nbsp;Agent commercial : ";
  6562. this.addSubfunction(xzone, Marche.synthese, "Synthèse");
  6563. this.addSubfunction(xzone, Marche.surveillance, "Surveillance");
  6564. },
  6565. addSubfunction: function (xzone, fn, titre) {
  6566. var xa = document.createElement("a");
  6567. xa.setAttribute('href', '#');
  6568. xa.setAttribute("class", 'lien_default');
  6569. xa.onclick = function () {
  6570. fn();
  6571. return false;
  6572. };
  6573. xa.innerHTML = titre;
  6574. var xspan = document.createElement("span");
  6575. xspan.innerHTML = "&nbsp;&nbsp;&nbsp;";
  6576. xspan.appendChild(xa);
  6577. xzone.appendChild(xspan);
  6578. },
  6579. addSubfunction3: function (xzone, fn, titre) {
  6580. var xa = document.createElement("a");
  6581. xa.setAttribute("class", 'lien_default');
  6582. xa.onclick = function () {
  6583. fn();
  6584. return false;
  6585. };
  6586. xa.innerHTML = titre;
  6587. var xspan = document.createElement("span");
  6588. xspan.appendChild(xa);
  6589. xzone.appendChild(xspan);
  6590. },
  6591. addFonctionGroupes: function () {
  6592. var xtx = document.getElementById("onglet2Panel");
  6593. if (xtx.innerHTML != "") {
  6594. var xzonex = xtx.getElementsByClassName("illustrationImage")[0];
  6595. var xz1x = xzonex.getElementsByTagName("img")[0];
  6596. var xe1x = document.createElement("a");
  6597. xe1x.setAttribute('href', '#');
  6598. xe1x.onclick =
  6599. function () {
  6600. RapportGroupes.debut();
  6601. return false;
  6602. }
  6603. ;
  6604. xe1x.innerHTML = "<img alt=\"%PanneauImageAlt%\" src=\"images/deplacement_gpes_armees.jpg\">";
  6605. xz1x.parentNode.replaceChild(xe1x, xz1x);
  6606. //fonctions IG
  6607. xzone = document.getElementById("onglet2Panel").getElementsByClassName("element elementRepeat")[0];
  6608. var x1 = document.createElement("div");
  6609. x1.setAttribute('id', 'LeGuet');
  6610. x1.innerHTML += "&nbsp;&nbsp;&nbsp;La Douane : ";
  6611. this.addSubfunction(x1, Exterieur.controler, "Rapport extérieur");
  6612. xzone.appendChild(x1);
  6613. }
  6614. // xtx = document.getElementById("zoneTexte3");
  6615. // this.addFonctionDuel();
  6616. // this.addSubFunction2(xtx, Test.debut, "Test");
  6617.  
  6618. },
  6619. addSubFunction2: function (xzone, fn, titre) {
  6620. var xa = document.createElement("a");
  6621. xa.setAttribute('href', '#');
  6622. xa.setAttribute("class", 'lien_default');
  6623. xa.onclick = function () {
  6624. fn();
  6625. return false;
  6626. };
  6627. xa.innerHTML = titre;
  6628. var xspan = document.createElement("span");
  6629. xspan.innerHTML = "&nbsp;&nbsp;";
  6630. xspan.appendChild(xa);
  6631. xzone.parentNode.appendChild(xspan);
  6632. },
  6633. addFonctionEvenements: function () {
  6634. var xty = document.getElementsByClassName("texte texteEvenement texteEvenement2")[0];
  6635. if (xty.innerHTML != "") {
  6636. var xzoney = xty;
  6637. var xz1y = xzoney.getElementsByTagName("h2")[0];
  6638. var xe1y = document.createElement("a");
  6639. xe1y.setAttribute('href', '#');
  6640. xe1y.onclick =
  6641. function () {
  6642. RapportMV.debut();
  6643. return false;
  6644. }
  6645. ;
  6646. xe1y.innerHTML = "<h2><a href=\"javascript:RapportMV_debut();\">Mémoires et vision</a></h2>";
  6647. xz1y.parentNode.replaceChild(xe1y, xz1y);
  6648. }
  6649. },
  6650. addFonctionTribunal: function () {
  6651. var xtx = document.getElementById("onglet1Panel");
  6652. if (xtx.innerHTML != "") {
  6653. var xzonex = xtx.getElementsByClassName("illustrationImage")[0];
  6654. var xz1x = xzonex.getElementsByTagName("img")[0];
  6655. var xe1x = document.createElement("a");
  6656. xe1x.setAttribute('href', '#');
  6657. xe1x.onclick =
  6658. function () {
  6659. Suspects.controle();
  6660. return false;
  6661. }
  6662. ;
  6663. xe1x.innerHTML = "<img alt=\"%PanneauImageAlt%\" src=\"images/prefecture_tribunal.jpg\">";
  6664. xe1x.innerHTML+= "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=#660000>0-Sous surveillance</font><br><font color=#0000ff>1-A Assigner à résidence</font><br><font color=#008888>2-Persona non grata</font><br><font color=#660000>3-Brigandage</font><br><font color=#ff0000>4-Membre de Fatum, Hydre...</font><br><font color=#ff3333>5-TOP<br>6-A prendre Mort ou vif</font>" ;
  6665. xz1x.parentNode.replaceChild(xe1x, xz1x);
  6666. }
  6667. var xzone = document.getElementById("onglet1Panel");
  6668. xzone = xzone.getElementsByClassName("element elementRepeat")[0];
  6669. xzone.innerHTML += "&nbsp;&nbsp;&nbsp;Les suspects : ";
  6670. this.addSubfunction(xzone, Suspects.identifier, "Identifier");
  6671. this.addSubfunction(xzone, Suspects.importer, "Importer");
  6672. this.addSubfunction(xzone, Suspects.lister, "Lister");
  6673. this.addSubfunction(xzone, Suspects.verifier, "Vérifier");
  6674. this.addSubfunction(xzone, Suspects.exporter, "Exporter");
  6675. this.addSubfunction(xzone, Portrait.debut, "Portrait");
  6676. this.addSubfunction(xzone, Suspects.controle, "Controle");
  6677. this.addSubfunction(xzone, Suspects.Reinit, "RAZ");
  6678. },
  6679. addFonctionDuel: function () {
  6680. var xzone = document.getElementById("onglet0Panel");
  6681. xzone = xzone.getElementsByClassName("element elementRepeat")[0];
  6682. xzone.innerHTML += "&nbsp;&nbsp;&nbsp;Guet autre village : ";
  6683. this.addSubfunction(xzone, Exterieur.controler, "Contrôler");
  6684. },
  6685. addFonctionPerso: function () {
  6686. var xz = document.getElementById("onglet0Panel").getElementsByClassName("element elementRepeat")[0];
  6687. xz.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;";
  6688. this.addSubfunction(xz, FnRR.setProfile, "Profil RReasy");
  6689. this.addSubfunction(xz, Dossier.debut, "Dossier personnel");
  6690. this.addSubfunction(xz, Presence.debut, "Fiche de présence");
  6691. this.addSubfunction(xz, RapportSoldat.debut, "Rapport de garde");
  6692. this.addSubfunction(xz, FnRR.getStorage, "<font color=red><i>Données enregistrées</i></font>");
  6693. /* if (document.body.innerHTML.indexOf("textePage[0][7][6]['Texte'] = '") != -1) {
  6694. this.addSubfunction(xz, Furtifs.furtifs, "Fouine");
  6695. this.addSubfunction(xz, Furtifs.longueVue, "Longue-vue");
  6696. } */
  6697. },
  6698. addFonctionProfil: function () {
  6699. //var xz = document.getElementById("onglet0Panel").getElementsByClassName("element elementRepeat")[0];
  6700. //xz.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;";
  6701. //this.addSubfunction(xz, FnRR.setProfile, "Profil RReasy");
  6702. },
  6703. addBouton: function (ezMenux, ezElement, ezTexte, ezProc) {
  6704. var ezMenu1 = ezMenux.getElementsByClassName(ezElement)[0];
  6705. var xe = document.createElement("a");
  6706. xe.setAttribute('href', '#');
  6707. xe.setAttribute('class', 'btns');
  6708. xe.onclick =
  6709. function () {
  6710. ezProc();
  6711. return false;
  6712. }
  6713. ;
  6714. xe.innerHTML = ezTexte;
  6715. ezMenu1.appendChild(xe);
  6716. }
  6717. }
  6718.  
  6719. RRmenu.init();