Greasy Fork is available in English.

Empire Overview

Script for Ikariam 8.x.x, Overview tables for resources, buildings and military inspired by Ikariam Empire Board

< 脚本Empire Overview的反馈

评价:好评 - 脚本一切正常

§
发表于:2023-07-05

Объем складов вроде в норму пришел. Еще осталось уровень жизни подправить. Спасибо тебе, добрый человек, что продолжаешь развивать скрипт

§
发表于:2023-11-25

Взял идею e41, поменял в скрипте на вот такие значения:
1426 r.museum.level = Constant.BuildingData[Constant.Buildings.MUSEUM].lf[this.getBuildingFromName(Constant.Buildings.MUSEUM).getLevel];
=================================================
1434 r.tavern.level = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse2[this.getBuildingFromName(Constant.Buildings.TAVERN).getLevel];

1438 r.tavern.wineConsumption = 70 * i;

Криво, но работает - значок уровня жизни зеленый и население в минус не уходит. Может кому пригодится

mrfix作者
§
发表于:2023-11-26
编辑于:2023-11-26

Я поправил. Но изменений не заметил. Посмотри, может быть я тебя не так понял.

§
发表于:2023-11-26

Google Translator
Немного поэкспериментировав, я получил такое значение. Это верно почти для всех городов. Наиболее далеко это значение для моего нового города, где музеев и таверн еще не так много, как в "старых" городах.

After experimenting a little, I have this value. This is correct for almost all cities. This value is furthest away for my new city, where the museums and taverns are not yet as high as in the "old" cities.

r.tavern.wineConsumption = 72 * i;

По-видимому, это значение не поддается математическому определению, поскольку оно очень динамично. Поэтому для других людей это число может быть иным.

The value does not seem to be mathematically determined because it is very dynamic. So the number can be different for others.

mrfix作者
§
发表于:2023-11-26

Надо изучать этот вопрос и думать как сделать универсальным.
Если у кого есть идеи - пишите и мы вместе найдем решение.

§
发表于:2023-11-26

Мои навыки программирования близки к 0.
Но Tiny на немецком форуме создал много таблиц Ecxel с формулами. Может быть, там что-то есть.
My programming skills are close to 0.
But Tiny in the German forum has created many Ecxel tables with formulae. Maybe there is something there.

Вы можете найти их здесь
You can find them here

https://forum.ikariam.gameforge.com/forum/thread/92191-baumeister-produktionsrechner-und-vieles-mehr-f%C3%BCr-alle-server/?postID=1172070#post1172070

* Inklusive eines Zufriedenheitsrechner

mrfix作者
§
发表于:2023-11-26
You can find them here

Спасибо. Интересный ресурс. Наверное действительно с той информацией можно будет много чего актуализировать и исправить.
Буду смотреть и изучать. Но сначала надо будет там перевести с немецкого.

§
发表于:2023-11-26

возможно ли это?

https://www.deepl.com/translator/files

mrfix作者
§
发表于:2023-11-26

Нет. Формат файлов не поддерживается. Да и автоматом нельзя - так как там формулы. Надо руками и аккуратно.
Я использую Google Translate для перевода.
Это займет какое-то время для перевода и изучения таблиц.

У Вас есть заполненная таблица , что бы посмотреть на результат - как это должно работать ? (Если есть - то лучше мне в личку пришлите)

§
发表于:2023-11-26

Не изменил r.museum.level на
r.museum.level = Constant.BuildingData[Constant.Buildings.MUSEUM].lf[this.getBuildingFromName(Constant.Buildings.MUSEUM).getLevel];

Тогда позеленеет

mrfix作者
§
发表于:2023-11-26
编辑于:2023-11-26

Я почему-то подумал что музеи уже и так исправлены и не заменил их.
Сейчас исправил.
Ситуация стала получше - но не соответствует все равно тому что есть.

Сейчас пытаюсь русифицировать таблицу с формулами, на которую дал ссылку Plagwirzer - возможно там есть информация которая поможет заполнить нам данные в скрипте.
Немецкий я гораздо хуже читаю чем английский, хотя и английский вызывает проблемы.

Возможно там удастся найти как значения для расчета получаются. Вроде формулы там нормально читаются - только надо понять что и как взаимосвязано

§
发表于:2023-11-26

Зеленые значки ну и убыли народа не показывает. Конечно, очень приблизительно. Брал из подсказки e41, автор много чего скодил, да вот не суждено было понять. Метод тыка наше все )) Подсказки e41 есть в отзывах

mrfix作者
§
发表于:2023-11-26

e41 сам здесь. Иногда он подсказывает что подправить.

e41
§
发表于:2023-12-03

If anyone wants suggestions, please right in English.
This is a multilingual script/game where everyone should everybody.
:-)

§
发表于:2023-12-23

I think I found the solution:
on line 1438 r.tavern.wineConsumption = 70 * i;
replace with r.tavern.wineConsumption = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse3[i];
I'm in the Beta PT-BR world with 10 cities and it seems to be working well. I don't have an account on other servers to test.

e41
§
发表于:2023-12-24

I think I found the solution:
on line 1438 r.tavern.wineConsumption = 70 * i;
replace with r.tavern.wineConsumption = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse3[i];
I'm in the Beta PT-BR world with 10 cities and it seems to be working well. I don't have an account on other servers to test.

Confirmed!
:-)

e41
§
发表于:2023-12-24

I have changed this code:
if (this.getBuildingFromName(Constant.Buildings.TAVERN)) {
var wineUse;
wineUse = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse;
if (ikariam.Server() == 's202')
wineUse = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse2;
//r.tavern.level = this.getBuildingFromName(Constant.Buildings.TAVERN).getLevel * 12;
r.tavern.level = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse2[this.getBuildingFromName(Constant.Buildings.TAVERN).getLevel];
var consumption = Math.floor(this.getResource(Constant.Resources.WINE).getConsumption * (100 / (100 - (this.getBuildingFromName(Constant.Buildings.VINEYARD) ? this.getBuildingFromName(Constant.Buildings.VINEYARD).getLevel : 0))));
for (var i = 0; i < wineUse.length; i++) {
if (Math.abs(wineUse[i] - consumption) <= 1) {
// r.tavern.wineConsumption = 60 * i;
r.tavern.wineConsumption = 70 * i;
break;
}
}
}

with this:

if(this.getBuildingFromName(Constant.Buildings.TAVERN))
{
r.tavern.level = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse2[this.getBuildingFromName(Constant.Buildings.TAVERN).getLevel];
r.tavern.wineConsumption = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse3[this.getResource(Constant.Resources.WINE).getCurrLevel];
}

for me it looks that it works the same.

mrfix作者
§
发表于:2024-01-20
I think I found the solution:

for me it looks that it works the same.

Thanx friends.
script updated

mrfix作者
§
发表于:2024-01-20

Error citizen

mrfix作者
§
发表于:2024-01-20

And Gold in table show error

mrfix作者
§
发表于:2024-01-20

Help fixed

mrfix作者
§
发表于:2024-01-20
if(this.getBuildingFromName(Constant.Buildings.TAVERN))
{
r.tavern.level = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse2[this.getBuildingFromName(Constant.Buildings.TAVERN).getLevel];
r.tavern.wineConsumption = Constant.BuildingData[Constant.Buildings.TAVERN].wineUse3[this.getResource(Constant.Resources.WINE).getCurrLevel];
}

for me it looks that it works the same.

Remove it fix citizen and gold

mrfix作者
§
发表于:2024-01-20

Error

mrfix作者
§
发表于:2024-01-20
编辑于:2024-01-20

Max citizen error in table

e41
§
发表于:2024-01-20
编辑于:2024-01-20

The formula that generates the housing space for each level is:
maxPap = Math.floor(10*Math.pow(i,1.5))*2+40
but this formula gives the correct population only up to Level 40 in the TownHall
For Levels 41+ the extra values that have to be added to the calculation are:
[3,13,28,48,75,109,147,195,249,313,383,464,552,650,761,880,1010,1152,1307,1474,1654,1850,2058,2283,2522,2779]
or the exact population:
[5293,5495,5706,5924,6151,6387,6631,6885,7149,7423,7707,8002,8308,8626,8957,9300,9656,10026,10409,10808,11222,11652,12098,12561,13042,13541]
If anyone can find the formula that generates the above array or the exact population for Levels 41 to 66, feel free to contribute.
:-)

e41
§
发表于:2024-01-21

I have managed to figure out the formula that generates the population for Levels 41+ and it is:
maxPop = Math.round(5099.12*Math.pow(1.038283,i-40)-1.7)
where i the level of the Town Hall.
On the result of this formula, add 1 to Levels 58 and 62.

mrfix作者
§
发表于:2024-01-21
maxPop = Math.round(5099.12*Math.pow(1.038283,i-40)-1.7)

Need this replace for Townhall definition ?
replace
townHall:
{
...
maxPop:[60,96,142,200,262,332,410,492,580,672,768,870,976,1086,1200,1320,1440,1566,1696,1828,1964,2102,2246,2390,2540,2690,2844,3002,3162,3326,3492,3660,3830,4004,4180,4360,4540,4724,4910,5098,5293,5495,5706,5924,6151,6387,6631,6885,7149,7423,7707,8002,8308,8626,8957,9300,9656,10026,10409,10808,11222,11652,12098,12561,13042,13541],
...
)

to
townHall:
{
...
i = this.getBuildingFromName(Constant.Buildings.TOWN_HALL).getLevel;
maxPop = Math.round(5099.12*Math.pow(1.038283,i-40)-1.7)
if (i == 58 || 1 == 62) {
maxPop +=1;
}
....
}

right ?

mrfix作者
§
发表于:2024-01-21

I have managed to figure out the formula that generates the population for Levels 41+ and it is:
maxPop = Math.round(5099.12*Math.pow(1.038283,i-40)-1.7)
where i the level of the Town Hall.
On the result of this formula, add 1 to Levels 58 and 62.

fix code:
maxPop :(()=>{var i = this.getBuildingFromName(Constant.Buildings.TOWN_HALL).getLevel; var mpop=Math.round(5099.12*Math.pow(1.038283,i-40)-1.7); if (i == 58 || 1 == 62) { mpop +=1; }; return mpop}),

right ?

mrfix作者
§
发表于:2024-01-21

Dont fixed MxxPop in table

the maximum number of residents in the table shows 20 less. Manually increase the value by 20?

get _getMaxPopulation() {

add
mPop += 20;

?

e41
§
发表于:2024-01-21
编辑于:2024-01-21

Just replace maxPop in townhall with this:

get maxPop(){var p=[];var e={58:1,62:1};for(var i=0;i<this.maxLevel;i++){p.push(i<41?Math.floor(10*Math.pow(i,1.5))*2+40:Math.round(5099.12*Math.pow(1.038283,i-40)-1.7)+(e[i]!=undefined?e[i]:0));}return p;},

wherever you use maxPop, the above code generates an array with 67 items with index starting from 0.

mrfix作者
§
发表于:2024-01-21
Just replace maxPop in townhall with this:

Thanx
Replaced.
I still have maxPop 20 units less in the table than in Townhall.
The screenshots are the same as above in the message.
The table shows 5070, and in the Townhall building it shows 5090.
For all cities the difference is 20 units.
My town halls are levels 34,37,38. and everywhere in the table it is 20 less than in the building itself.
Maybe these 20 depend on something else?
can be in a function:
get_getMaxPopulation()
something ?


i for test replace in
get_getMaxPopulation()
"
mPop += database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.ECONOMIC_FUTURE) * 20;
return mPop;"
to
"mPop += database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.ECONOMIC_FUTURE) * 20;
"mPop += 20;
return mPop;
"
And result on (on my game)
table = TownHall

this correct for all or only me ?

mrfix作者
§
发表于:2024-01-21
to
"mPop += database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.ECONOMIC_FUTURE) * 20;
"mPop += 20;
return mPop;
"

I haven't included this in the published version yet. Corrected it using my local script for test.

Correct screnshoot with local changed

e41
§
发表于:2024-01-21

The getMaxPopulation I have it like this:

get _getMaxPopulation() { return (this.getBuildingFromName(Constant.Buildings.TOWN_HALL) ? Math.floor((10*Math.pow(this.getBuildingFromName(Constant.Buildings.TOWN_HALL).getLevel,1.5)))*2+40 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Science.WELL_CONSTRUCTION) && (this.getBuildingFromName(Constant.Buildings.PALACE) || database.getCityCount == 1) ? 50 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.UTOPIA) && this.getBuildingFromName(Constant.Buildings.PALACE) ? 200 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.HOLIDAY) ? 50 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.ECONOMIC_FUTURE)*20); },
<\pre>
mrfix作者
§
发表于:2024-01-21
The getMaxPopulation I have it like this:

Now in the published version it is, but it’s written simpler. not in one line, but in a simpler design.
For me, this formula returns 20 less than what it shows in the town hall.
Do other script users have such discrepancies?

§
发表于:2024-01-21

I always have a discrepancy of 10
Town Hall 37 Script 27
Town hall level 40 Tavern 47 Museum 22
Town Hall 13 Script 3
Town Hall Level 40 Tavern 47 Museum 21
Town Hall 11 Script 1
Town Hall Level 40 Tavern 43 Museum 20

e41
§
发表于:2024-01-21

I forgot to fix the getMaxPopulation with the last calculation...

get _getMaxPopulation() { return (this.getBuildingFromName(Constant.Buildings.TOWN_HALL) ? Constant.BuildingData[Constant.Buildings.TOWN_HALL].maxPop[this.getBuildingFromName(Constant.Buildings.TOWN_HALL).getLevel] : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Science.WELL_CONSTRUCTION) && (this.getBuildingFromName(Constant.Buildings.PALACE) || database.getCityCount == 1) ? 50 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.UTOPIA) && this.getBuildingFromName(Constant.Buildings.PALACE) ? 200 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.HOLIDAY) ? 50 : 0)+(database.getGlobalData.getResearchTopicLevel(Constant.Research.Economy.ECONOMIC_FUTURE)*20); },

Differencies of 10 or 20 have to do with research.
:-)

§
发表于:2024-01-22
Differencies of 10 or 20 have to do with research.

Just for your information
All research completed.

e41
§
发表于:2024-01-22

it does not matter what you have finished.
It matters how the code handles this information.

mrfix作者
§
发表于:2024-01-22
I forgot to fix the getMaxPopulation with the last calculation...

include in 1.1933

mrfix作者
§
发表于:2024-01-22
编辑于:2024-01-22
It matters how the code handles this information.

It can be fixed ?
Is there no information about this in the Excel file Tiny ?

My researcch on screen
Almost everything.
Only 5 levels of the future army left.

e41
§
发表于:2024-01-23
编辑于:2024-01-23

From what I can understand, there is a problem with the getPopulationTip
and especially with the populationData.maxPop.
This is retrieved by city,populationData which is a batch of collected information about your population.
You have to check each number that city.populationData has and compare it with what the game gives.
Then the number or the numbers of the city.populationData that are not corrected calculated have to be checked in the functions projectPopData and _getMaxPopulation.
For the last one, we have already talked about.
:-)

e41
§
发表于:2024-01-23

This is an example of populationData for one of my cities.
Check out which of these numbers, in your case, make the difference of 10 or 20 citizens.
Then we will know where to look in order to fix the error.

§
发表于:2024-01-25

How can I call up the "PopulationData" to compare the numbers?

e41
§
发表于:2024-01-25

Just after the line:

parseViewData: function (view, html, tData) {

add this:

console.log(ikariam.getCurrentCity.populationData);

save the script, refresh the game and open the console (F12) to check it.

§
发表于:2024-01-25

Console output

---

currentPop
:
5648
growth
:
0.02
happiness
:
1
maxPop
:
5628
satisfaction
:
city
:
196
corruption
:
0
government
:
0
museum
:
cultural
:
1000
level
:
1086
[[Prototype]]
:
Object
priest
:
0
research
:
265
tavern
:
level
:
683
wineConsumption
:
2419
[[Prototype]]
:
Object
total
:
5649



And then corresponding images

I don't see the missing 10

e41
§
发表于:2024-01-25
编辑于:2024-01-25

When I gave you the previous code I was expecting to have a screenshot and not copying the text.
For next time, instead of this code:

console.log(ikariam.getCurrentCity.populationData);

use this code:

console.log(JSON.stringify(ikariam.getCurrentCity.populationData));

copy and paste the text that is generated in this website:
https://www.freeformatter.com/json-formatter.html
with Tab delimiter and then copy and paste the result here.
It this way, it will be readable, something like this:

{
	"currentPop":5648,
	"maxPop":5628,
	"satisfaction":
	{
		"city":196,
		"museum":
		{
			"cultural":1000,
			"level":1086
		},
		"government":0,
		"tavern":
		{
			"wineConsumption":2419,
			"level":683
		},
		"research":265,
		"priest":0,
		"total":5649,
		"corruption":0
	},
	"happiness":1
	"growth":0.02
}

Now, from what I can see the problem is targeted on the maxPop calculation.
If you calculate the population from the rest of the numbers, the result is 5648, as it should be.
From what I have in my code, I would change this line:

pop = (pop > maxPopulation) ? this._population > maxPopulation ? this._population : maxPopulation : pop;

with this:

pop = pop > maxPopulation ? maxPopulation : pop;

Also, don't forget to change the _getMaxPopulation as I said before.
I believe that this will do the trick.
:-)

§
发表于:2024-01-26
编辑于:2024-01-26

I have the 1.1933 and therefore the modified getMaxPopulation.
I have exchanged the line.
Now I have 10 citizens too many in the script.

Can I test something else to track down the error?

e41
§
发表于:2024-01-26

Well, I think that I managed to figure out where was the bug.
The problem occurred when you reach Level 25 of the Research Futures.
Just change this line:

var explored = level ? parseInt(level[1]) - 1 : (Data.liClass === 'explored' ? 1 : 0);

with this line:

var explored = level ? parseInt(level[1]) - !Data.liClass.includes('explored') : Data.liClass.includes('explored');

the problem was fixed in my case.
:-)

e41
§
发表于:2024-01-27

From what I have seen in the screenshots you provide, I noticed this:
After applying the code from the previous answer, revisit the Research Advisor to get to correct level of the Economic Future.
The difference of 10 comes from.

r.research = (database.getGlobalData.getResearchTopicLevel(2080) * 25) + (database.getGlobalData.getResearchTopicLevel(2999) * 10) + (this.getBuildingFromName(Constant.Buildings.PALACE) ? 50 * database.getGlobalData.getResearchTopicLevel(3010) : 0) + (this.getBuildingFromName(Constant.Buildings.PALACE) ? 200 * database.getGlobalData.getResearchTopicLevel(2120) : 0) + (database.getCityCount == 1 ? 50 * database.getGlobalData.getResearchTopicLevel(3010) : 0) - (this.getBuildingFromName(Constant.Buildings.PALACE) && database.getCityCount == 1 ? 50 * database.getGlobalData.getResearchTopicLevel(3010) : 0);

2999 is the ECONOMIC_FUTURE.
:-)

§
发表于:2024-01-28
编辑于:2024-01-28

I have replaced the last two lines to be changed.
Visited the research consultants.
Now the display is correct.

Thank you

e41
§
发表于:2024-01-29

Welcome.
:-)

mrfix作者
§
发表于:2024-02-15

Welcome.
:-)

Thanx
Fixed 1.934

发表回复

登录以发表回复。