I need help with edit addon (chrome)

So, i have ONE addon, but TWO version of it. 1. old version, with few different functions, which the NEW version doesnt have.
Because i dont understand javascript, i did only one change successfully, so one feature from old version is now in new version.
But after a month of trying, i just cant make other features working.

Can someone help me with it? For someone who know what he do, it will be just about few looks on code. For me it is like chinese font :confused:

That addon is simple, nothing hard i bet, nothing illegal.

2 Likes

if you show us the code we might be able to help you :>

Well, yeh, my bad, but i dont know how to upload whole addon, or what exactly you need from both of them

Bruh, just get your mouse and select the whole-code section/block you want to share to be inspected/checked here and copy it here with a code goes here <-in this format which is select the code/text and click the </> button here on (is number 6) top of the text-box to reply/post.

1 Like

My first thought about “how to do it” was like "ok i dont need to see “medal rewards” so i can use “body” from it, to implement just the “snipe” code from older version. But my attemps wasnt successfully.

Also, in new version, there is switch in names, but code looks same, as in old version, but in new version is “SaveRankCost” , in old version is name “SnipeRankCost”

let ForderStates = [],
			SaveStates = [],

vs

let ForderStates = [],
			SnipeStates = [],
1 Like

Bruh, do you have any sort of documentation we can look in regards to these add-ons for chrome, so we can look at ? I mean what is it that you trying to do, what’s wrong with it?

I can upload both full version of addon, if it helps?
it is “foe helper” addon
In the folder are many files, like:
_locales
content
css
images
jss (inside is: web(inside is: _api, _helper, _i18n,_languages, _main, _menu, calculator) , background.js, inject.js, popup.js,text-pop.js)
vendor
manifes.json

calculator folder is the one, which should be modificate, but it must be connected with other folders i think, and that is another problem, because i dont have idea which

1 Like

okay but what does this addon does? Can I get it to test it out? You see Im trying to help here bruh. :L

here is link for oficial version (latest one).
Same addon was half year before with “snipe” function in calculator, but it was removed. I want it just back.
What does snipe function? In game there are building, you can put inside forgepoints to contribute reward. Snipe function calculate the minimum safety contribution of forge points.

there is link for code page for whole addon.

or simplier in this link are both version of addon.

What i need is, if someone can put “calculator” from old version (2.4.) and put it in the new version (2.5.) and make it function in new version.
Just change calculator (js->web->calculator) in new version, to the calculator in old version. (copy paste folder calculator, and change code in other connected folders to accept old version in new version code)

also if you can do this, maybe you will know, how to add also “read buildings” feature (js->web->read buildings) (it is in old version, but missing in new version)

you can download it by click on “turttle icon”
2.4. is old version
2.5. is latest version

Edit: i cant post more than 7 posts a days, so i must edit.

Well on github is only the latest version(2.5) of addon, so also calculator. But i would like to have old calculator (2.4) in the latest version (2.5)

I saw in the github repo the calculator script, is that the v. 2.4?

1 Like

Well on github is only the latest version(2.5) of addon, so also calculator. But i would like to have old calculator (2.4) in the latest version (2.5)

I can write only 7 post a day, so i must use edit :slight_smile:

Well what about you substitute the calculator folders, from 2.4 to 2.5 ?

I already tried it, copy paste folders. But as i wrote, it doesnt work. I think, that there must be change also something in folders like “api, main”. But because i dont have idea , how this “chinese font” function, i cant see “well this part of code refer to folder “_main” in 447 line, so i need to edit also here”.
That is why i asking on this forum, you guys didnt saw this kind of “chinese font” for first time like me :smiley: You can see all connection bettween lines, i simply cant.

When i wanted to change(copy paste) code for calculation “medals reward” to “snipe” code. Because i wanted to use already set “body” for “medal reward” (because i dont have idea how to create own body for “snipe” or i even cant distinguish code from old version 2.4 “snipe body” , to just substitute code for it in new version.

What i find is, that in old version, it is called “snipe… SnipeRankCost etc…”
in new vrsion it is in code called “Save…SaveRankCost etc. …”
The think is, that in old version everything (medal, forge points, blueprints) are in code

So what exactly is different between “Math.round” vs “MainParser.round”?
I can try substitute every “MainParser.round” in new code, to “Math.round” from old code. Does it help? Or i will mix two different things?

When u say chinese font u don’t literally mean that, right? Because I know not Chinese…

Ofc, as i wrote in first post, for me is this code like “chinese font” :smiley:

Hi, i have a little bit problem with editting existing extension for google chrome. It is extension for web browser game, nothing illegal. Just there exist two version of extension. 1. old ver. 2.4 and second the latest.
My problem is, that in latest, author of extension changed style of “calculator”, so i want to change it to the old one, from version 2.4.
I have both version dowloaded (Nová složka.rar | Ulož.to (for download click on the turtlle icon))
So, i had an idea, that i will just copy and paste code from old calculator to the new calculator. jss. But it doesnt work ofc, because i dont have idea what to change in code, what is reffering to new code to accept old one calculator.

What i find is, that in old version, it is called “snipe… SnipeRankCost etc…”
in new vrsion it is in code called “Save…SaveRankCost etc. …”
The think is, that in old version everything (medal, forge points, blueprints) are in code

SnipeRankCosts[Rank] = Math.round((Calculator.Rankings[j]['forge_points'] + RestFP) / 2);
						break;

and in new version everything (medal, forge points, blueprints) are in code

SaveRankCosts[Rank] = MainParser.round((Calculator.Rankings[j]['forge_points'] + RestFP) / 2);
						break;

So what exactly is different between “Math.round” vs “MainParser.round”?
I can try substitute every “MainParser.round” in new code, to “Math.round” from old code. Does it help? Or i will mix two different things?

Because for me is all this coding like trying to read chinese font, so that is why i asking help here. You already see this type of problems and you know what to do with it, also when i will take a look on code, i simply cant see that “this link is connected to another one in different folder” :confused:

I don’t know what “MainParser” is, I assume it is a specific module to this project. Without seeing its code, we can’t tell what ll it does. Presumably it “rounds”, but there may be something else going on. The other problem is that the results here are being assigned to different variables, the first one to SnipeRankCosts[Rank] and the second to SaveRankCosts[Rank] - are you sure these are the same sections of code?

Yeah, you have to be careful about swapping things out like this. It would a lot depend on how close the code is. Swapping parts in a 2006 Prius and a 2007 Prius might work, but if it’s a 2007 Prius and a 1967 Mustang, it gets a lot more difficult.

Well, in another thread (i tought that extension is javascript) i copy and paste whole code for “calculator” in both version, you can take a look(I need help with edit addon (chrome) - #3 by abcklm), or just download both version which i included in first post.
So yeh, for me, code looks same, but with different names and this "math. round and mainparser

So, to answer your question

So what exactly is different between “Math.round” vs “MainParser.round”?

Looking in _main.js, that is where MainParser is defined. That specific method is defined as:

	/**
	 * Performs rounding taking into account floating point inaccuracy
	 *
	 * @param {number} value
	 * @returns {number}
	 */
	round: (value) => {
		let Epsilon = 0.000001;

		if (value >= 0) {
			return Math.round(value + Epsilon);
		}
		else {
			return Math.round(value - Epsilon);
		}
	},

So he’s building in some fudge factoring into his round functions. He’s defined a custom epsilon - I’m not sure why he didn’t use the system epsilon. If you don’t understand what I am talking about, google “0.1 + 0.2 javascript”.

So, it’s just an ever so slightly adjusted rounding method. My guess is that 99% of the time it will have no effect and when it does, only slightly. I would not expect it to have catastrophic results, but maybe there are other parts of the code that are dependent on that.

It looks to me like there are some non-trivial changes between these two versions. Without knowing a lot more about the code, I would not want to go swapping out things.

One thing to try, if you want to see if the new rounding is affecting things, would be to just go into _main.js and change that method to:

	round: (value) => Math.round(value),

It’s also possible that:

	round: Math.round,

would work.

These would revert to the “old” rounding anywhere this method is used.