Page 1 of 1

Morale

PostPosted: Fri May 30, 2008 10:09 am
by johndoe
Adds morale to the world map, so you can see how sad your men will be if you charge this puny village.

Code: Select all
   plugins.worldmorale = { // calculates traveltimes on the map

   'enhance_game_map': function() {
      $("#info_content #info_extra_info").after("<tr><td>Morale</td><td id=\"info_morale\"></td></tr>");
      var old_map_popup = unsafeWindow.map_popup;
      setFunc("map_popup", function map_popup(title, bonus_image, bonus_text, points, owner, ally, village_groups, moral, village_id, source_id) {

      old_map_popup(title, bonus_image, bonus_text, points, owner, ally, village_groups, moral, village_id, source_id);

      window.setTimeout(function() {
         if (owner == null) {
            $("#info_morale").html("100%");
         } else {
            var MyPoints = (xpathGetFirst("/html/body/table[1]/tbody/tr/td[6]").innerHTML).replace('<span class="grey">.</span>',"").match(/\|(\d+) P\)/)[1];
            var HisPoints = owner.match(/\(([\d.]+) Points\)/)[1].replace(".","");
            var Target_Coords = title.match(/\((-?\d+)\|(-?\d+)\)/);
            $("#info_morale").html(((t = ((t = Math.round(30+(300/(MyPoints/HisPoints)))) > 100 ? 100 : t)) < 30 ? 30 : t) + "%");
         }
      }, 0);

   });
   },

   'info' : {
      'mandatory' : false,
      'name' : "Morale",
      'desc' : "Adds morale to the world map",
      'version' : "0.1",
      'dev' : "JohnDoe"
     }
   };

PostPosted: Fri May 30, 2008 11:28 am
by AeroFury
You rock, mister!

Could anyone make a 'Sticky' and describe how exactly these plugins can be installed? I think I know how, but I'm guessing some people dont.

PostPosted: Fri May 30, 2008 1:51 pm
by peca
Seems not work on cs6.divokekmeny.cz
Still shows 100%, even I have over 6000 pts and tagget village has less then 100 pts. If some test data needed, pls PM me. I'll be on line et evening at about 21:00 (Central Europe Summer Time = UTC +2 (I hope))

PostPosted: Fri Sep 05, 2008 6:35 am
by el-barto
Doesn't work on the Swedish server :(

It just says 100% all the time, just like it does for peca

PostPosted: Fri Dec 19, 2008 9:15 am
by Skorpishor
Same for romanian servers :twisted:

PostPosted: Fri Dec 26, 2008 9:11 pm
by Hooch180
I have got always 100%

PostPosted: Sun Jan 04, 2009 2:18 pm
by enduo
yes the dev of this quit i think