danBhentschel / CGSpunk

CG enhancement toolset
15 stars 7 forks source link

Modifications to make CG-Spunk work with latest CG Api #78

Closed SixK closed 6 years ago

SixK commented 6 years ago

Hi Dan,

Here are modifications to make CG-Spunk work again with latest CG Api.

Regards, SixK

danBhentschel commented 6 years ago

Looks great! I have tested it out, and I just have one single request. Please remove the console.log on line 292 of Injected.js. Not only is it not doing anything useful, but it is being flagged as an error by the linter:

C:\Users\DHentschel\Dropbox\CodinGame\Chrome Extensions\CGSpunk\app\scripts\Injected.js
  292:21  error  Strings must use singlequote  quotes

✖ 1 problem (1 error, 0 warnings)

Otherwise, I have done some minimal testing, and everything that I tried works just fine. Make this change and I will accept the pull request and publish the results.

Also, what is your CG username so that I can give you credit? :-)

SixK commented 6 years ago

OK, I was not sure wether this log was already in source code or not, so I didn't removed it. I will do it tonight.

My CG Username is BigUP.

Thank's, CG-Spunk is really a nice tool.

SixK commented 6 years ago

OK, latest log debug removed ;)

There is still a small problem with Firefox, as it complain it can't close a Window that is not opened by a script. I guess, this is just a small script to add in button to open window instead than opening window directly.

SixK

SixK commented 6 years ago

Hi Dan,

Here is a small fix for latest community contest that don't follow rules for timeout event. gameInformation is empty, so I get timeout in summary. File to modify Injected.js : function getMyStateFromGameManager(gameManager, me) { let myAgent = getMyAgentFromGameManager(gameManager, me); if (!myAgent) return 'normal'; let myFrames = gameManager.currentGameInfo.frames.filter( => .agentId == myAgent.index); let info = myFrames[myFrames.length-1].gameInformation; let summary = myFrames[myFrames.length-1].summary; if (info.includes('nvalid input')) return 'invalid'; if (info.includes('Timeout:')) return 'timeout'; if (summary.includes('timeout!')) return 'timeout'; return 'normal'; }

Regards, BigUP

----- Mail original ----- De: "Dan Hentschel" notifications@github.com À: "danBhentschel/CGSpunk" CGSpunk@noreply.github.com Cc: "SixK" dasixk@free.fr, "Author" author@noreply.github.com Envoyé: Lundi 26 Mars 2018 18:00:22 Objet: Re: [danBhentschel/CGSpunk] Modifications to make CG-Spunk work with latest CG Api (#78)

Merged #78 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .