Planets.nu improved hover text

Adds Dark Sense and Super Spy info to plaent hover text. Also adds additional info for ships and bases.

当前为 2014-06-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Planets.nu improved hover text
  3. // @description Adds Dark Sense and Super Spy info to plaent hover text. Also adds additional info for ships and bases.
  4. // @include http://planets.nu/home
  5. // @include http://planets.nu/games/*
  6. // @include http://play.planets.nu/*
  7. // @include http://*.planets.nu/*
  8. // @include http://planets.nu/*
  9. // @homepage http://planets.nu/discussion/utility-script-integrates-dark-sense-and-super-spy-to-planet-hover-text
  10. // @version 11111.14
  11. // @namespace https://greasyfork.org/users/2874
  12. // ==/UserScript==
  13.  
  14. /*------------------------------------------------------------------------------
  15. 1. Shows total mineral info if available from darksene or superspy
  16. 2. Adds FC to planet info (could make to only show if not "???" but currently
  17. always shows
  18. 3. If there's a base, shows fighters as well.
  19. 4. Moved the code to show planet owner outside of infoturn==0 test. When player
  20. knew ownership from a "share intel", infoturn was still 0,
  21. so the owner was not shown in the hover text
  22. 5. (ver 0.4) Added FC to ships too
  23. 6. (ver 0.5) Shorten form to 3 lines for owned ships (controlled by
  24. vgap.terseInfo). Add damage and cloak state if applicable.
  25. 7. (ver 0.6) Add Warp for owned ships. Also, add ship hull being built to
  26. starbase.
  27. 8. (ver 0.7) Add Map Tools Control "Switch Info View" to switch views.
  28. 9. (ver 0.7) Add ship owner in short form for allies
  29. 10.(ver 0.9) Add persistent settings, remove switch view map tool
  30. 11.(ver 0.10) Add setting to display ship mission for player's ships
  31. 12.(ver 0.11) More information for allies displayed if ally update script is
  32. in use.
  33. 13.(ver 0.11) Replaces showHover and shipTransferView to show more info when
  34. available
  35. 14.(ver 0.13) Fixes show race for allied ships
  36. 15.(ver 0.14) Update for new site
  37.  
  38. ------------------------------------------------------------------------------*/
  39.  
  40.  
  41. function wrapper () { // wrapper for injection
  42.  
  43. vgaPlanets.prototype.setupAddOn = function (addOnName) {
  44. if (vgaPlanets.prototype.addOns == null) vgaPlanets.prototype.addOns = {};
  45. vgaPlanets.prototype.addOns[addOnName] = {};
  46. var settings = localStorage.getItem(addOnName + ".settings");
  47. if (settings != null)
  48. vgaPlanets.prototype.addOns[addOnName].settings = JSON.parse(settings);
  49. else
  50. vgaPlanets.prototype.addOns[addOnName].settings = {};
  51. vgaPlanets.prototype.addOns[addOnName].saveSettings = function () {
  52. localStorage.setItem(addOnName + ".settings", JSON.stringify(vgaPlanets.prototype.addOns[addOnName].settings));
  53. }
  54. };
  55. vgaPlanets.prototype.setupAddOn("vgapImprovedHover");
  56.  
  57. /*
  58. if (vgaPlanets.prototype.addOns == null) vgaPlanets.prototype.addOns = {};
  59. vgaPlanets.prototype.addOns.vgapImprovedHover = {};
  60. var settings = localStorage.getItem("vgapImprovedHover.settings");
  61. if (settings != null)
  62. vgaPlanets.prototype.addOns.vgapImprovedHover.settings = JSON.parse(settings);
  63. else
  64. vgaPlanets.prototype.addOns.vgapImprovedHover.settings = {}; //{terseInfo: false};
  65. vgaPlanets.prototype.addOns.vgapImprovedHover.saveSettings = function () {
  66. localStorage.setItem("vgapImprovedHover.settings", JSON.stringify(vgaPlanets.prototype.addOns.vgapImprovedHover.settings));
  67. };
  68. */
  69.  
  70. vgapMap.prototype.hitTextBox = function (hit) {
  71. var settings = vgap.addOns.vgapImprovedHover.settings;
  72. var txt = "";
  73. if (hit.isPlanet) {//planet
  74. txt += "<div class='ItemSelectionBox minCorrection'>";
  75. txt += "<span>" + hit.id + ": " + hit.name;
  76. if (hit.temp != -1)
  77. txt += "<span style='float:right;'>Temp: " + hit.temp + "</span>";
  78. txt += "</span>";
  79. txt += "<table class='CleanTable'>";
  80. if (hit.infoturn == 0) {
  81. //unknown planet
  82. //txt += this.hitText(hit, hit.isPlanet).replace("&nbsp", "");
  83. }
  84. else {
  85. if (hit.nativeclans > 0) {
  86. if (vgap.terseInfo)
  87. txt += "<tr><td colspan='8'>" + addCommas(hit.nativeclans * 100) + " " + hit.nativeracename + " - " + hit.nativegovernmentname + "</td></tr>";
  88. else
  89. txt += "<tr><td colspan='4'>" + addCommas(hit.nativeclans * 100) + " " + hit.nativeracename + " - " + hit.nativegovernmentname + "</td></tr>";
  90. }
  91. var nText = gsv(hit.neutronium) + " / " + gsv(hit.groundneutronium);
  92. var dText = gsv(hit.duranium) + " / " + gsv(hit.groundduranium);
  93. var tText = gsv(hit.tritanium) + " / " + gsv(hit.groundtritanium);
  94. var mText = gsv(hit.molybdenum) + " / " + gsv(hit.groundmolybdenum);
  95. if (hit.totalneutronium > 0 && hit.groundneutronium < 0) { //"total" info available, surface/ground is not, enables display of dark sense and superspy info in hover text
  96. nText = hit.totalneutronium;
  97. dText = hit.totalduranium;
  98. tText = hit.totaltritanium;
  99. mText = hit.totalmolybdenum;
  100. }
  101. if (false /*vgap.terseInfo*/) {
  102. txt +=
  103. "<tr> <td>Neu: </td><td>&nbsp;" + nText + "&nbsp;</td>" + "<td>Col: </td><td>&nbsp;" + addCommas(gsv(hit.clans * 100)) + "</td></tr>" +
  104. "<tr> <td>Dur: </td><td>&nbsp;" + dText + "&nbsp;</td>" + "<td>Sup: </td><td>&nbsp;" + gsv(hit.supplies) + "</td></tr>" +
  105. "<tr> <td>Tri: </td><td>&nbsp;" + tText + "&nbsp;</td>" + "<td>MC: </td><td>&nbsp;" + gsv(hit.megacredits) + "</td></tr>" +
  106. "<tr> <td>Mol: </td><td>&nbsp;" + mText + "&nbsp;</td>" + "<td>FC: </td><td>&nbsp;" + hit.friendlycode + "</td></tr>";
  107. }
  108. else {
  109. txt +=
  110. "<tr> <td>Neutronium: </td><td>&nbsp;" + nText + "&nbsp;</td>" + "<td>Colonists: </td><td>&nbsp;" + addCommas(gsv(hit.clans * 100)) + "</td></tr>" +
  111. "<tr> <td>Duranium: </td><td>&nbsp;" + dText + "&nbsp;</td>" + "<td>Supplies: </td><td>&nbsp;" + gsv(hit.supplies) + "</td></tr>" +
  112. "<tr> <td>Tritanium: </td><td>&nbsp;" + tText + "&nbsp;</td>" + "<td>Megacredits: </td><td>&nbsp;" + gsv(hit.megacredits) + "</td></tr>" +
  113. "<tr> <td>Molybdenum: </td><td>&nbsp;" + mText + "&nbsp;</td>" + "<td>Friendly Code: </td><td>&nbsp;" + hit.friendlycode + "</td></tr>";
  114. }
  115. /// Population in popup text
  116. //////////////////////
  117. var planetOwner = null;
  118. var maxPop = 0;
  119. var minPop = 0;
  120.  
  121. // Do we have a temp scan?
  122. if (hit.temp >= 0 && hit.temp <= 100) {
  123. // Use your race if plnet unowned
  124. if (hit.ownerid == 0)
  125. planetOwner = vgap.getPlayer(vgap.player.id);
  126. else
  127. planetOwner = vgap.getPlayer(hit.ownerid);
  128. // Find max pop
  129. // xtal
  130. if (planetOwner.raceid == 7) {
  131. maxPop = 1000 * hit.temp;
  132. } else {
  133. maxPop = Math.round(Math.sin(3.14 * (100 - hit.temp) / 100) * 100000);
  134. if (hit.temp > 84) maxPop = Math.floor((20099.9 - (200 * hit.temp)) / 10);
  135. if (hit.temp < 15) maxPop = Math.floor((299.9 + (200 * hit.temp)) / 10);
  136. // Cols, Rebles, Fascists, Bots
  137. if (hit.temp > 80 && (planetOwner.raceid == 4 || planetOwner.raceid == 9 || planetOwner.raceid == 10 || planetOwner.raceid == 11)) maxPop = 60;
  138. // Rebels
  139. if (hit.temp <= 19 && planetOwner.raceid == 10) maxPop = 90000;
  140. }
  141. if (hit.debrisdisk > 0) {
  142. maxPop = 0;
  143. if (vgap.getStarbase(maxPop.id) != null) {
  144. maxPop = 500;
  145. }
  146. }
  147. // Find min growth pop
  148. var targetGrowth = 1;
  149. // Worms!
  150. if (hit.nativetype == 5) targetGrowth = 6;
  151. // xtal
  152. if (planetOwner.raceid == 7) {
  153. minPop = Math.floor(targetGrowth * 11 / (hit.temp / 100));
  154. if (vgap.advActive(47)) {
  155. minPop = Math.floor(targetGrowth * 11 / hit.temp * hit.temp / 4000);
  156. }
  157. if (hit.temp < 15) minPop = 0;
  158. } else {
  159. // This should just be a formula like: minPop = Math.floor(targetGrowth * 11 / Math.sin(3.14*(100-hit.temp)/100)));
  160. // But that is off but a bit. This seems more acurate, but is still slightly off the chart I was going off. Which may be wrong too!
  161. // ...
  162. for(minPop = 10; minPop < 300; minPop++) {
  163. var growth = Math.round(Math.sin(3.14*((100-hit.temp)/100))*minPop/20);
  164. if (growth >= targetGrowth)
  165. break;
  166. }
  167. if (hit.temp < 15 || hit.temp > 84) minPop = 0;
  168. if (minPop >= 299) minPop = 0;
  169. }
  170. if (hit.debrisdisk > 0) {
  171. minPop = 0;
  172. }
  173. txt += "<tr><td>GrowPop: </td><td>&nbsp;" + (minPop == 0 ? "n/a" : minPop) + "</td><td>Max: </td><td>&nbsp;" + maxPop + "</td></tr>";
  174. }
  175. //////////////////////
  176. var starbase = vgap.getStarbase(hit.id);
  177. if (starbase != null && (hit.ownerid == vgap.player.id || hit.allyupdate)) {
  178. txt += "<tr> <td>" + (false /*settings.terseInfo*/ ? "Ftr: " : "Fighters: " ) + "</td><td>&nbsp;" + starbase.fighters + "</td></tr>";
  179. /// Add tech levels for SB
  180. ///////////////////////
  181. txt += "<tr><td>Hull: </td><td>&nbsp;" + starbase.hulltechlevel + "</td><td>Engine: </td><td>&nbsp;" + starbase.enginetechlevel + "</td></tr>";
  182. txt += "<tr><td>Beam: </td><td>&nbsp;" + starbase.beamtechlevel + "</td><td>Torp: </td><td>&nbsp;" + starbase.torptechlevel + "</td></tr>";
  183. ///////////////////////
  184. if (starbase.isbuilding) {
  185. txt += "<tr> <td colspan='4'>Build: " + vgap.getHull(starbase.buildhullid).name + "</td></tr>";
  186. }
  187. }
  188. //txt += this.hitText(hit, hit.isPlanet).replace("&nbsp", "");
  189. }
  190. //known planet
  191. if (hit.ownerid != vgap.player.id && hit.ownerid != 0) {
  192. var player = vgap.getPlayer(hit.ownerid);
  193. var race = vgap.getRace(player.raceid);
  194. txt += "<tr><td colspan='4'>" + race.name + " (" + player.username + ")</td></tr>";
  195. }
  196. txt += this.hitText(hit, hit.isPlanet).replace("&nbsp", "");
  197. txt += "</table></div>";
  198. } else {//ship
  199. var ship = hit;
  200. var hull = vgap.getHull(ship.hullid);
  201. var totalCargo = ship.ammo + ship.duranium + ship.tritanium + ship.molybdenum + ship.supplies + ship.clans;
  202. var html = "<div class='ItemSelectionBox minCorrection'>";
  203. if (ship.ownerid == vgap.player.id || vgap.fullallied(ship.ownerid)) {
  204. var player = vgap.getPlayer(ship.ownerid);
  205. var race = vgap.getRace(player.raceid);
  206. //html += "<span>" + ship.id + ": " + ship.name + "</span>";
  207. html += "<table class='CleanTable' style='width: 100%'>";
  208. if (settings.terseInfo) {
  209. html += "<tr><td colspan='8'>" + ship.id + ": " + ship.name + "</td></tr>";
  210. if ( (settings.showHullForAllies && vgap.fullallied(ship.ownerid)) || (settings.showHullForMine && ship.ownerid == vgap.player.id) )
  211. html += "<tr><td colspan='8'>" + hull.name + "</td></tr>";
  212. html += "<tr><td>Neu:</td><td>&nbsp;" + gsv(ship.neutronium) + " / " + hull.fueltank + " </td><td>&nbsp;&nbsp;&nbsp;Dur:</td><td>&nbsp;" + gsv(ship.duranium) + "</td><td>&nbsp;&nbsp;&nbsp;Tri:</td><td>&nbsp;" + gsv(ship.tritanium) + "</td><td>&nbsp;&nbsp;&nbsp;Mol:</td><td>&nbsp;" + gsv(ship.molybdenum) + "</td></tr>";
  213. html += "<tr><td>MC:</td><td>&nbsp;" + gsv(ship.megacredits) + "</td><td>&nbsp;&nbsp;&nbspCln:</td><td>&nbsp;" + gsv(ship.clans) + "</td><td>&nbsp;&nbsp;&nbspSup:</td><td>&nbsp;" + gsv(ship.supplies) + "</td>";
  214.  
  215. if (ship.torps > 0 || ship.bays > 0) {
  216. var ammoText = "&nbsp&nbsp&nbsp;Ftr";
  217. if (ship.torps > 0)
  218. ammoText = "&nbsp&nbsp&nbsp;Tor";
  219. html += "<td>" + ammoText + ":</td><td>&nbsp;" + gsv(ship.ammo) + "</td></tr>";
  220. }
  221. if (ship.ownerid == vgap.player.id || ship.allyupdate) {
  222. html += "<tr>";
  223. if (settings.showShipMission)
  224. html += "<td colspan='2'>" + vgap.getShipMission(ship) + ( (ship.mission == 6 || ship.mission == 7) && ship.mission1target > 0 ? " " + ship.mission1target : "") + "</td>";
  225. else
  226. html += "<td/><td/>";
  227. if (ship.damage > 0)
  228. html += "<td>&nbsp;&nbsp;&nbsp;Dmg:</td><td class='BadText'>&nbsp;" + ship.damage + "</td>";
  229. else if (ship.iscloaked)
  230. html += "<td colspan='2' class='GoodText'>&nbsp;&nbsp;&nbsp;Cloaked</td>";
  231. else
  232. html += "<td/><td/>";
  233. html += "<td colspan='2'>&nbsp;&nbsp;&nbsp;Warp " + ship.warp + "</td>"
  234. html += "<td>&nbsp;&nbsp;&nbsp;FC:</td><td>&nbsp;" + ship.friendlycode + "</td></tr>";
  235. }
  236. if (settings.showPlayerForAllies && vgap.fullallied(ship.ownerid)) {
  237. html += "<tr><td colspan='8'>" + race.name + " (" + player.username + ")" + "</td></tr>";
  238. }
  239. }
  240. else {
  241. html += "<tr><td colspan='4'>" + ship.id + ": " + ship.name + "</td></tr>";
  242. if ( (settings.showHullForAllies && vgap.fullallied(ship.ownerid)) || (settings.showHullForMine && ship.ownerid == vgap.player.id) )
  243. html += "<tr><td colspan='4'>" + hull.name + "</td></tr>";
  244. html += "<tr><td>Neutronium:</td><td>&nbsp;" + gsv(ship.neutronium) + "/" + hull.fueltank + " </td><td>&nbsp;Clans:</td><td>&nbsp;" + gsv(ship.clans) + "</td></tr>";
  245. html += "<tr><td>Duranium:</td><td>&nbsp;" + gsv(ship.duranium) + "</td><td>&nbsp;Supplies:</td><td>&nbsp;" + gsv(ship.supplies) + "</td></tr>";
  246. html += "<tr><td>Tritanium:</td><td>&nbsp;" + gsv(ship.tritanium) + "</td><td>&nbsp;Megacredits:</td><td>&nbsp;" + gsv(ship.megacredits) + "</td></tr>";
  247. html += "<tr><td>Molybdenum:</td><td>&nbsp;" + gsv(ship.molybdenum) + "</td>";
  248. if (ship.torps > 0 || ship.bays > 0) {
  249. var ammoText = "&nbsp;Fighters";
  250. if (ship.torps > 0)
  251. ammoText = "&nbsp;Torpedos";
  252. html += "<td>" + ammoText + ":</td><td>&nbsp;" + gsv(ship.ammo) + "</td></tr>";
  253. }
  254. if (ship.ownerid == vgap.player.id || ship.allyupdate) {
  255. html += "<tr><td>Friendly Code:</td><td>&nbsp;" + ship.friendlycode + "</td></tr>";
  256. /*
  257. if (settings.showShipMission)
  258. html += "<tr><td colspan='8'>" + vgap.getShipMission(ship) + ( (ship.mission == 6 || ship.mission == 7) && ship.mission1target > 0 ? " " + ship.mission1target : "") + "</td></tr>";
  259. */
  260. }
  261. if (settings.showPlayerForAllies && vgap.fullallied(ship.ownerid)) {
  262. html += "<tr><td colspan='4'>" + race.name + " (" + player.username + ")" + "</td></tr>";
  263. }
  264. }
  265. html += this.hitText(hit, hit.isPlanet).replace("&nbsp", "");
  266. html += "</table>";
  267. } else {//enemy
  268. var player = vgap.getPlayer(ship.ownerid);
  269. var hull = vgap.getHull(ship.hullid);
  270. var race = vgap.getRace(player.raceid);
  271. html += "<div class='enemyShipStyle'>";
  272. html += "<table class='CleanTable'>";
  273. html += "<tr><td colspan='2'>" + ship.id + ": " + ship.name + "</td></tr>";
  274. html += "<tr><td colspan='2'>" + hull.name + "</td></tr>";
  275. html += "<tr><td>Heading:</td><td>&nbsp;" + gsv(ship.heading) + " at Warp: " + gsv(ship.warp) + "</td></tr>";
  276. html += "<tr><td>Mass: </td><td>&nbsp;" + gsv(ship.mass) + "</td></tr>";
  277. html += "<tr><td colspan='2'>" + race.name + " (" + player.username + ")" + "</td></tr>";
  278. //html += "<tr><td>Neutronium:</td><td>?/" + hull.fueltank + " </td><td>&nbsp;Total Cargo:</td><td>?/" + hull.cargo + "</td></tr>";
  279. html += this.hitText(hit, hit.isPlanet).replace("&nbsp", "");
  280. html += "</table>";
  281. html += "</div>";
  282. }
  283. html += "</div>";
  284. txt = html;
  285. }
  286. // vgap.action added for the assistant (Alex):
  287. // vgap.action();
  288.  
  289.  
  290. return txt;
  291. };
  292. vgaPlanets.prototype.shipTransferView = function (ship, onclick) {
  293. var hull = vgap.getHull(ship.hullid);
  294. var totalCargo = ship.ammo + ship.duranium + ship.tritanium + ship.molybdenum + ship.supplies + ship.clans;
  295. var html = "<div class='ItemSelection' onclick='" + onclick + "'>";
  296. html += "<img src='" + hullImg(ship.hullid) + "'/>";
  297. if (ship.ownerid == vgap.player.id || vgap.fullallied(ship.ownerid)) {
  298. html += "<div " + (vgap.fullallied(ship.ownerid) ? "class='AllyText'" : "") + ">";
  299. if (ship.ownerid != vgap.player.id) html += vgap.raceName(ship.ownerid);
  300. html += "<span>" + ship.id + ": " + ship.name + "</span>";
  301. html += "<table class='CleanTable'>";
  302. html += "<tr><td>Neutronium:</td><td>" + gsv(ship.neutronium) + "/" + hull.fueltank + " </td><td>Total Cargo:</td><td>" + gsv(totalCargo) + "/" + hull.cargo + "</td></tr>";
  303. html += "<tr><td>Duranium:</td><td>" + gsv(ship.duranium) + "</td><td>Supplies:</td><td>" + gsv(ship.supplies) + "</td></tr>";
  304. html += "<tr><td>Tritanium:</td><td>" + gsv(ship.tritanium) + "</td><td>Megacredits:</td><td>" + gsv(ship.megacredits) + "</td></tr>";
  305. html += "<tr><td>Molybdenum:</td><td>" + gsv(ship.molybdenum) + "</td><td>Clans:</td><td>" + gsv(ship.clans) + "</td></tr>";
  306. if (ship.torps > 0 || ship.bays > 0) {
  307. var ammoText = "Fighters";
  308. if (ship.torps > 0)
  309. ammoText = "Torpedos";
  310. html += "<tr><td>" + ammoText + ":</td><td>" + gsv(ship.ammo) + "</td></tr>";
  311. } else
  312. html += "<tr><td/><td/></tr>";
  313. html += "</table></div>";
  314. }
  315. else {
  316. html += "<span class='BadText'>" + ship.id + ": " + ship.name + "</span>";
  317. html += "<div class='BadText'>" + vgap.raceName(ship.ownerid);
  318. html += "<table class='CleanTable'>";
  319. html += "<tr><td>Neutronium:</td><td>?/" + hull.fueltank + " </td><td>Total Cargo:</td><td>?/" + hull.cargo + "</td></tr>";
  320. html += "</table></div>";
  321. }
  322. html += "</div>";
  323.  
  324. // vgap.action added for the assistant (Alex):
  325. // vgap.action();
  326.  
  327. return html;
  328. };
  329.  
  330.  
  331. vgaPlanets.prototype.shipFullInfoView = function (ship, onclick) {
  332. var view = this.shipTransferView(ship, onclick);
  333. console.log(view);
  334. var html = ""; //"<table class='CleanTable'>";
  335. //html += "<tr>";
  336. html += "<td>Friendly Code:</td><td>" + ship.friendlycode + "</td></tr>";
  337. html += "<tr><td colspan='2'>Warp " + ship.warp + "</td>"
  338. html += "<td colspan='2'>" + vgap.getShipMission(ship) + ( (ship.mission == 6 || ship.mission == 7) && ship.mission1target > 0 ? " " + ship.mission1target : "") + "</td></tr>";
  339. html += "<tr>";
  340. if (ship.damage > 0)
  341. html += "<td>Damage:</td><td class='BadText'>" + ship.damage + "</td>";
  342. else if (ship.iscloaked)
  343. html += "<td colspan='2' class='GoodText'>Cloaked</td>";
  344. else html += "<td/><td/>";
  345. html += "</tr></table>";
  346. //html += "</table>"
  347.  
  348. // vgap.action added for the assistant (Alex):
  349. // vgap.action();
  350.  
  351. view = view.split("</tr></table>").join(html);
  352. return view;
  353. };
  354.  
  355. vgaPlanets.prototype.showHover = function (shipId) {
  356. var ship = vgap.getShip(shipId);
  357. var newheight = 100;
  358. if (ship.ownerid == vgap.player.id || ship.allyupdate) {
  359. this.hc.html(this.shipFullInfoView(ship, ""));
  360. newheight = 120;
  361. if (ship.allyupdate) newheight += 10;
  362. }
  363. else if (vgap.fullallied(ship.ownerid)) {
  364. this.hc.html(this.shipTransferView(ship, ""));
  365. newheight = 110
  366. }
  367. else
  368. this.hc.html(this.shipScan(ship, ""));
  369. this.hc.show();
  370. this.hc.height(newheight);
  371.  
  372. // vgap.action added for the assistant (Alex):
  373. // vgap.action();
  374.  
  375. };
  376. //*/
  377. vgaPlanets.prototype.getShipMission = function (ship) {
  378. var missions = new Array();
  379. var mdesc = new Array();
  380. var raceid = vgap.getPlayer(ship.ownerid).raceid;
  381. missions.push("Exploration");
  382. mdesc.push("Return information about planets you visit.");
  383. missions.push("Mine Sweep");
  384. mdesc.push("Sweep or detect enemy minefields.");
  385. if (ship.torps > 0) {
  386. missions.push("Lay Mines");
  387. mdesc.push("Convert your torpedos to deep space mines.");
  388. }
  389. else {
  390. missions.push("");
  391. mdesc.push("");
  392. }
  393. missions.push("Kill!!");
  394. mdesc.push("Attack any enemy ship or planet you encounter.");
  395. if (ship.hullid == 84 || ship.hullid == 96 || ship.hullid == 9) {
  396. missions.push("Bio Scan");
  397. mdesc.push("Search for native life on nearby planets.");
  398. }
  399. else {
  400. missions.push("Sensor Sweep");
  401. mdesc.push("Search for enemy colonies on nearby planets.");
  402. }
  403. missions.push("Land and Disassemble");
  404. mdesc.push("Dismantle this ship on an owned or unowned planet.");
  405. //if (ships.length > 1 && this.hull.engines > 1) {
  406. missions.push("Try to Tow");
  407. mdesc.push("Try to tow another ship at this location.");
  408. /*
  409. }
  410. else {
  411. missions.push("");
  412. mdesc.push("");
  413. }
  414. */
  415. missions.push("Try to Intercept");
  416. mdesc.push("Try to intercept the ship you have selected.");
  417. if (raceid == 1) {
  418. missions.push("Super Refit");
  419. mdesc.push("Upgrade this ship to the best available parts. Must be at a starbase to work.");
  420. }
  421. else if (raceid == 2) {
  422. if (ship.beams > 0) {
  423. missions.push("Hisssss!");
  424. mdesc.push("Increase the happiness on the planet you orbit.");
  425. }
  426. else {
  427. missions.push("");
  428. mdesc.push("");
  429. }
  430. }
  431. else if (raceid == 3) {
  432. missions.push("Super Spy");
  433. mdesc.push("Spy on an enemy planet for info or to change its friendly code.");
  434. }
  435. else if (raceid == 4) {
  436. if (ship.beams > 0) {
  437. missions.push("Pillage Planet");
  438. mdesc.push("Pillage a planet for supplies and money.");
  439. }
  440. else {
  441. missions.push("");
  442. mdesc.push("");
  443. }
  444. }
  445. else if (raceid == 5) {
  446. missions.push("Rob Ship");
  447. mdesc.push("Rob an enemy ship of its fuel or cargo.");
  448. }
  449. else if (raceid == 6) {
  450. missions.push("Self Repair");
  451. mdesc.push("Repair this ship by 10% / turn.");
  452. }
  453. else if (raceid == 7) {
  454. if (ship.torps > 0) {
  455. missions.push("Lay Web Mines");
  456. mdesc.push("Convert your torpedos to special fuel sucking mines.");
  457. }
  458. else {
  459. missions.push("");
  460. mdesc.push("");
  461. }
  462. }
  463. else if (raceid == 8) {
  464. missions.push("Dark Sense");
  465. mdesc.push("Sense enemy colonies and starbases on nearby planets.");
  466. }
  467. else if (raceid == 9 || raceid == 11) {
  468. if (ship.bays > 0) {
  469. missions.push("Build Fighters");
  470. mdesc.push("Build fighters on your ship for 3 tritanium, 2 molybdenum and 5 supplies each.");
  471. }
  472. else {
  473. missions.push("");
  474. mdesc.push("");
  475. }
  476. }
  477. else if (raceid == 10) {
  478. missions.push("Rebel Ground Attack");
  479. mdesc.push("Sabotage the planet to destroy buildings and kill colonists.");
  480. }
  481.  
  482. if (vgap.getHull(ship.hullid).cancloak) {
  483. missions.push("Cloak");
  484. mdesc.push("Make this ship invisible to enemies.");
  485. }
  486. else {
  487. missions.push("");
  488. mdesc.push("");
  489. }
  490. /*
  491. if (this.planet != null) {
  492. missions.push("Beam up Neutronium Fuel from " + this.planet.name);
  493. mdesc.push("");
  494. missions.push("Beam up Duranium from " + this.planet.name);
  495. mdesc.push("");
  496. missions.push("Beam up Tritanium from " + this.planet.name);
  497. mdesc.push("");
  498. missions.push("Beam up Molybdenum from " + this.planet.name);
  499. mdesc.push("");
  500. missions.push("Beam up Supplies from " + this.planet.name);
  501. mdesc.push("");
  502. } else {
  503. */
  504. missions.push("Beam up Fuel");
  505. mdesc.push("");
  506. missions.push("Beam up Duranium");
  507. mdesc.push("");
  508. missions.push("Beam up Tritanium");
  509. mdesc.push("");
  510. missions.push("Beam up Molybdenum");
  511. mdesc.push("");
  512. missions.push("Beam up Supplies");
  513. mdesc.push("");
  514. //}
  515. return missions[ship.mission];
  516. };
  517. var old_showSettings = vgapDashboard.prototype.showSettings;
  518. vgapDashboard.prototype.showSettings = function () {
  519.  
  520. old_showSettings.apply(this, arguments);
  521. var settings = vgaPlanets.prototype.addOns.vgapImprovedHover.settings;
  522. var html = "";
  523. html += "<div id='vgapImprovedHoverSettings'><table>";
  524. html += "<tr><th colspan='4'>Add-On Settings: Planets.nu improved hover text</th></tr>";
  525. html += "<tr>";
  526. html += "<td>Use short format</td><td><input type='checkbox'" + (settings.terseInfo ? "checked='true'" : "") + "onChange='vgaPlanets.prototype.addOns.vgapImprovedHover.settings.terseInfo = !vgaPlanets.prototype.addOns.vgapImprovedHover.settings.terseInfo; vgap.addOns.vgapImprovedHover.saveSettings();'/></td>";
  527. html += "<td>Show player for allied ships</td><td><input type='checkbox'" + (settings.showPlayerForAllies ? "checked='true'" : "") + "onChange='vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showPlayerForAllies = !vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showPlayerForAllies; vgap.addOns.vgapImprovedHover.saveSettings();'/></td>";
  528. html += "</tr><tr>";
  529. html += "<td>Show hull type for allied ships</td><td><input type='checkbox'" + (settings.showHullForAllies ? "checked='true'" : "") + "onChange='vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showHullForAllies = !vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showHullForAllies; vgap.addOns.vgapImprovedHover.saveSettings();'/></td>";
  530. html += "<td>Show hull type for my ships</td><td><input type='checkbox'" + (settings.showHullForMine ? "checked='true'" : "") + "onChange='vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showHullForMine = !vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showHullForMine; vgap.addOns.vgapImprovedHover.saveSettings();'/></td>";
  531. html += "</tr><tr>";
  532. html += "<td>Show mission for ships</td><td><input type='checkbox'" + (settings.showShipMission ? "checked='true'" : "") + "onChange='vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showShipMission = !vgaPlanets.prototype.addOns.vgapImprovedHover.settings.showShipMission; vgap.addOns.vgapImprovedHover.saveSettings();'/></td>";
  533. html += "</tr>";
  534. html += "</table></div>";
  535. $("#SoundSettings").after(html);
  536. this.pane.jScrollPane();
  537. };
  538. /* //REPLACED MAP TOOL WITH PERSISTENT SETTING
  539. var old_loadControls = vgapMap.prototype.loadControls;
  540. vgapMap.prototype.loadControls = function () {
  541.  
  542. old_loadControls.apply(this, arguments);
  543. var additem = "<li onclick='vgap.addOns.vgapImprovedHover.settings.terseInfo = !vgap.addOns.vgapImprovedHover.settings.terseInfo;'>Switch Info View</li>";
  544. //$("#MapTools").append(additem);
  545. $("#MapTools > li:contains('Connections (q)')").after(additem);
  546.  
  547. var height = this.controls.height() - this.toolsMenu.height();
  548. this.controls.css("marginTop", "-" + this.controls.height() + "px");
  549.  
  550. };
  551. */
  552. }
  553.  
  554. var script = document.createElement("script");
  555. script.type = "application/javascript";
  556. script.textContent = "(" + wrapper + ")();";
  557.  
  558. document.body.appendChild(script);