Script for Ikariam 8.x.x, Overview tables for resources, buildings and military inspired by Ikariam Empire Board
< Rückmeldungen aufEmpire Overview
From your screenshot, it looks as if your units require 2h 34m to finish training.
So, I think, it is normal for the blue numbers to appear under the number of the respective units.
The numbers inside the Barracks are not under the control of the script.
Hello, the issue is the army tab figures aren't correct anymore, available troops are shown correctly, the builded ones aren't.
They are now added to the available one (double counted), which was not the case before.
The issue is in reading the build order list in the barracks & shipyards.
Correct me if I'm wrong but, it use to be: The city's troop screen used to only update the black numbers and remove the +blue figures The barracks & shipyard only update the +blue figures and the black one are updated when the unit are built.
one reproduction steps example, while having no archer: -> build an archer, the army tab will show 1 black & +1 blue, no ETA (previous behavior: +1 blue, ETA) -> open the city's troop screen, the army tab will show nothing (like previous behavior) -> open the barrack, the army tab will show 1 black & +1 blue, no ETA (before +1 blue, ETA)
your archer is now built: -> build an archer, the army tab will show 2 black & +1 blue (previous behavior: 1 black +1 blue) -> open the city's troop screen, the army tab will show 1 black (like previous behavior) -> open the barrack, then army tab will show 2 black & +1 blue (before 1 black & +1 blue) -> open the barrack again , then army tab will show 3 black & +1 blue (before 1 black & +1 blue) -> and again , then army tab will show 4 black & +1 blue (before 4 black & +1 blue) 5 6 ...
Multiple build orders in the barrack show a mix of waht I just said with the previous behavior, ETA of the second and third order are correct.
I think the issue is due to the ETA (estimate Time to Arrival), the script is unable to calculate it for the first build list item, thus, assume it is finished and add it to the available troops/ships
Unfortunately, I haven't had to produce new units for years and I don't remember how the script used to react.
I just started to create new units. The blue numbers appeared instantly with no tooltip and the black numbers were updated as the new units are already there.
This is not the right way to handle the training of new units.
I will try to figure out what the problem is, but I cannot promise anything.
If I find a solution, I will let you know.
:-)
I think I might have figured out how to fix it...
Change the setTraining function in Military.prototype with the following:
setTraining: function(trainingQueue) { var armyTrain = this.armyTraining; if(!trainingQueue.length) return false; this._stopTrainingTimer(); var type = trainingQueue[0].type; var changes = this._clearTrainingForType(type); $.each(trainingQueue,function(index,training) { armyTrain.push(training); $.each(training.units,function(unitId,count) { changes.push(unitId); }); }.bind(this)); armyTrain.sort((a,b)=>a.completionTime-b.completionTime); this._startTrainingTimer(); this.armyTraining = armyTrain; return $.exclusive(changes); },
in my case this change has fixed the issue.
How it will do the same to you.
:-)
This:
var armyTrain = this.armyTraining;
has to change to:
var armyTrain = [];
Otherwise, each time you visit the Barracks, they will add the training units again and again.
:-)
thanks for your help, it is not fixed, looking into it myself as I have time, thank you for pointing me to the correct place
I think I found it
line 4489 completionTime: parseTime($('#buildCountDown').text()),
#buildCountDown should be #unitBuildCountDown
could someone confirm ?
The change you suggested is correct.
However, the way the actual duration is calculated is not as accurate as it should, I mean with second precision.
In order to do this, you have to dig a bit deeper in the code like this:
var params = city.getBuildingFromName(view).getUrlParams; params.backgroundView = 'city'; params.currentCityId = params.cityId; params.actionRequest = unsafeWindow.ikariam.model.actionRequest; params.ajax = 1; var getenddate = []; $.ajaxSetup({async:false}); $.getJSON('?'+$.map(params,(a,b)=>b+'='+a).join('&'),function(d) { getenddate[0] = $(d[1][1][1]).text().match(/showUnitCountdown\((.*?)\)/)[1].split(',').map(Number)[2]*1000; }); $.ajaxSetup({async:true}); if(!city.military.armyTraining.some(task=>task.units===units&&task.completionTime===getenddate[0]&&task.type===type)) { tasks.push({units:units,completionTime:getenddate[0],type:type}); }
:-)
Otherwise, each time you visit the Barracks, they will add the training units again and again.
:-)
Accept this in 1.935
sorry to argue, but:
First the var armyTrain
change proposed by e41 is wrong as it will remove the ships building list while updating the army one and vice versa, as you can see in this._clearTrainingForType(type)
. It should be reverted.
Second, #unitBuildCountDown
fix is not added, I don't know how Ikariam works before but #buildCountDown
is now the next building completion time you can see in the browser tab, which has nothing to do with the armies building list, thus creating all those double counted armies and fleets due to timing mismatches.
sorry to argue, but:
First thevar armyTrain
change proposed by e41 is wrong as it will remove the ships building list while updating the army one and vice versa, as you can see inthis._clearTrainingForType(type)
. It should be reverted.
Second,#unitBuildCountDown
fix is not added. I don't know how Ikariam worked before, but#buildCountDown
is now the next building completion time you can see in the browser tab, which has nothing to do with the armies building list, thus creating all those double counted armies and fleets due to timing mismatches.
The code I have suggested works for me because I have tested it in all the worlds I play, so it is not wrong globally.
Anything that is written here, you apply it at your own risk.
Besides, the developer should test it before publish it, and this is NOT my responsibility.
:-)
I haven’t been building an army or navy for a long time. Therefore, I don’t really understand the problem.
I rely on your experience and knowledge.
I don’t understand, should I keep the current changes in the army, correct them, or return the old version?
Well, you have to reproduce the problem @Trunkate said, use the changes he or I have suggested, and then apply them to the script.
The responsibility for the script, you have it not us, so I don't think that there is another way, as long as the conclusions (@Trunkate and I) have come up are not the same.
As far as I can remember, this problem with the ArmyTable exists since the implementation of the filters in the Military Advisor.
:-)
hello,
first, i wish to reiterate my thanks and appreciation for your work, to both of you!var armyTrain = this.armyTraining
isn't wrong as it isn't doing anything different as before!
I didn't dive into the duration calculation fix, so I don't know.#buildCountDown
should be #unitBuildCountDown
at line 4489 completionTime: parseTime($('#buildCountDown').text()),
I have no idea why it works on the gr servers, but on the fr servers at least #buildCountDown
is the next building completion time, the one you can see in the web browser tab when a building is under construction, maybe it is not the case when there is no building under construction, I will check.
confirmed, no building under construction -> #unitBuildCountDown
In case you have a problem with the transport tip, use this code:database.getGlobalData.localStrings = $.extend({},unsafeWindow.LocalizationStrings.timeunits.short);
as first line after the parseViewData and refresh the game once.
When you do, delete the above-mentioned code and everything will come back on track.
The second option is to reset the script.
My above-mentioned suggestions are not implemented just in gr servers but in about a dozen other countries.
:-)
The script's army screen doesn't work with ikariam 9.02 anymore, current and builded troops/ships are completely mixed up.
I also want to thank you for the script!!!