Skip to content

Commit 393cf8d

Browse files
authored
Merge pull request #56 from grcrt/master
maintenance
2 parents 9414af7 + 0d8c38f commit 393cf8d

File tree

8 files changed

+172
-78
lines changed

8 files changed

+172
-78
lines changed

.circleci/config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
defaults: &defaults
44
working_directory: ~/repo
55
docker:
6-
- image: cimg/node:lts-browsers
6+
- image: cimg/openjdk:8.0.265-node
77

88
jobs:
99
build:
@@ -18,9 +18,6 @@ jobs:
1818
- git-cache-{{ .Branch }}-{{ .Revision }}
1919
- git-cache-{{ .Branch }}-
2020
- git-cache-
21-
- run:
22-
name: Install JDK
23-
command: npm install jdk --save-dev
2421
- run:
2522
name: Install symantic-release
2623
command: |

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# [5.1.0](https://github.com/grcrt/grcrt-script/compare/v5.0.10...v5.1.0) (2020-11-06)
2+
3+
4+
### Features
5+
6+
* **reports:** add temple/Olympus conversion ([7bf648f](https://github.com/grcrt/grcrt-script/commit/7bf648fb8faca66bb6210329a5c32319ce341ea6))
7+
8+
## [5.0.10](https://github.com/grcrt/grcrt-script/compare/v5.0.9...v5.0.10) (2020-09-05)
9+
10+
11+
### Bug Fixes
12+
13+
* broken URL for mobile reports ([9414af7](https://github.com/grcrt/grcrt-script/commit/9414af7b273ce85fc664f68a1726793f0de2e5aa))
14+
* change readme, update buildscripts ([d4ad0dc](https://github.com/grcrt/grcrt-script/commit/d4ad0dc940e77fc73060482991cbcab08ab0575a))
15+
* various bugfixes and improvements ([ac7f18d](https://github.com/grcrt/grcrt-script/commit/ac7f18d46d12839d80516b5fded3f7c9a398c5dc)), closes [#48](https://github.com/grcrt/grcrt-script/issues/48)
16+
117
## [5.0.9](https://github.com/grcrt/grcrt-script/compare/v5.0.8...v5.0.9) (2019-11-14)
218

319

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
[![GitHub issues](https://img.shields.io/github/issues-raw/grcrt/grcrt-script.svg)](https://github.com/grcrt/grcrt-script/issues?q=is%3Aopen)
1414
[![GitHub contributors](https://img.shields.io/github/contributors/grcrt/grcrt-script.svg)](https://github.com/grcrt/grcrt-script/graphs/contributors)
1515
[![license](https://img.shields.io/github/license/grcrt/grcrt-script.svg)](https://github.com/grcrt/grcrt-script/blob/master/LICENSE)
16-
[![Gitter](https://img.shields.io/gitter/room/grcrt/grcrt-script.svg)](https://gitter.im/GRCRT/Lobby)
1716
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
1817

1918
---

modules/GRCRTConverterCtrl.js

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function _GRCRTConverterCtrl(wnd) {
335335
$.each(__repconvValueArray, function(ind,repconvValue){
336336
var _res = $('<div/>');
337337
var params = {message: repconvValue};
338-
RepConv.Debug && console.log(value.length);
338+
RepConv.Debug && console.log(repconvValue.length);
339339
gpAjax._ajax(
340340
'message',
341341
'preview',
@@ -659,7 +659,7 @@ function _GRCRTConverterCtrl(wnd) {
659659
}
660660
_UA = {
661661
i : RepConvTool.GetUnit(RCunit),
662-
b : $(elem).children('span').html()
662+
b : ($(elem).children('div.value').length >0 ? $(elem).children('div.value') : $(elem).children('span')).html()
663663
}
664664
report[site].full.ua.push(_UA),
665665
report[site].splits[rowNumber].ua.push(_UA)
@@ -717,8 +717,8 @@ function _GRCRTConverterCtrl(wnd) {
717717
// );
718718
result.town = _getTown(item);
719719
result.town_type = _getTownType(item);
720-
result.player = (result.town_type == "town") ? _getPlayer(item) : "";
721-
result.ally = (result.town_type == "town") ? _getAlly(item) : _getAllyFromOwner(item);
720+
result.player = (result.town_type == "town" || _reportType == "powers" ) ? _getPlayer(item) : "";
721+
result.ally = (result.town_type == "town" || _reportType == "powers") ? _getAlly(item) : _getAllyFromOwner(item);
722722
result.townName = _getTownName(item);
723723
result.playerName = _getPlayerName(item);
724724
// result.island = _getIsland(item);
@@ -1691,13 +1691,13 @@ function _GRCRTConverterCtrl(wnd) {
16911691
// przybywające ataki,wsparcia
16921692
report.unit_movements = { 'support':0, 'attack':0}
16931693
if(MM.getCollections().Support && MM.getCollections().Support[0] && MM.getCollections().Support[0].getIncomingSupportsForTown(Game.townId)){
1694-
report.unit_movements.support = MM.getCollections().Support[0].length;
1694+
report.unit_movements.support = MM.getCollections().Support[0].getIncomingSupportsForTown(Game.townId).getIncoming();
16951695
// $.each(MM.getCollections().Support[0].getIncomingSupportsForTown(Game.townId), function(ind, command){
16961696
// report.unit_movements.support += ((command.getIncoming()==1) ? 1 : 0)
16971697
// })
16981698
}
16991699
if(MM.getCollections().Attack && MM.getCollections().Attack[0] && MM.getCollections().Attack[0].getIncomingAttacksForTown(Game.townId)){
1700-
report.unit_movements.attack = MM.getCollections().Attack[0].length;
1700+
report.unit_movements.attack = MM.getCollections().Attack[0].getIncomingAttacksForTown(Game.townId).getIncoming();
17011701
// $.each(MM.getCollections().Attack[0].getIncomingAttacksForTown(Game.townId), function(ind, command){
17021702
// report.unit_movements.attack += ((command.getIncoming()==1) ? 1 : 0)
17031703
// })
@@ -2191,7 +2191,8 @@ function _GRCRTConverterCtrl(wnd) {
21912191

21922192
function _olympus(){
21932193
var temple = MM.getCollections().Temple[0].getTempleById(wnd.attributes.args.target_id);
2194-
report.title = RepConvTool.Adds((GRCRTtpl.rct.outside) ? temple.getName() : temple.getId(), GRCRTtpl.rct.temple);
2194+
RepConv.TEMPL = MM.getCollections().Temple[0].getTempleById(wnd.attributes.args.target_id);
2195+
report.title = wnd.getTitle();
21952196
report.type = '';
21962197
report.time = '';
21972198
report.power = '';
@@ -2202,56 +2203,63 @@ function _GRCRTConverterCtrl(wnd) {
22022203
report.attacker = {};
22032204
report.defender = {};
22042205
report.command = {};
2205-
// report.attacker.title = $(_content.find($('h4'))[0]).html();
2206-
// report.attacker.player = RepConvTool.Adds(_content.find($('a.gp_player_link')).html(), GRCRTtpl.rct.player);
2207-
// report.defender.town = RepConvTool.Adds(JSON.parse(RepConvTool.Atob(_content.find($('a.gp_town_link')).attr('href')))[GRCRTtpl.rct.getTown].toString(), GRCRTtpl.rct.town);
2208-
2209-
// report.attacker.units_title = _content.find($('div.clearfix div.bold')).html();
2210-
// if (cAttUnit.isChecked()) {
2211-
// __getUnitDetail1Way('attacker', 'div.report_unit', 11);
2212-
// }else{
2213-
// report.attacker.full = {'img_url' : RepConvTool.Adds(RepConvTool.GetLabel('HIDDEN'), 'i') };
2214-
// }
2206+
2207+
__getUnitDetail1Way('defender', 'div.troops_support>div.unit_slots>div.unit', 9);
2208+
22152209
report.temple = {
2216-
owner : RepConvTool.Adds(olympOwner.isChecked() ? temple.getAllianceName() : RepConvTool.GetLabel('HIDDEN'), GRCRTtpl.rct.ally),
2217-
god : RepConvTool.Adds((RepConv.grcrt_cdn+"ui/3/{0}.png").RCFormat((temple.getGod() || 'nogod')), "img")
2210+
owner : (temple.getAllianceName()) ? RepConvTool.Adds(olympOwner.isChecked() ? temple.getAllianceName() : RepConvTool.GetLabel('HIDDEN'), GRCRTtpl.rct.ally) : "",
2211+
god : {
2212+
img_url : RepConvTool.Adds((RepConv.grcrt_cdn+"ui/3/{0}.png").RCFormat((temple.getGod() || 'nogod')), "img"),
2213+
name : DM.getl10n('layout').powers_menu.gods[temple.getGod() || 'nogod']
2214+
},
2215+
name : RepConvTool.Adds(((GRCRTtpl.rct.outside || (rBbcode.getValue() == 'BBCODEI')) ? temple.getName() : temple.getId())+"", GRCRTtpl.rct.temple),
2216+
buff : ''
22182217

22192218
};
2219+
report.addInfo = _content.find($('div.state_text')).text();
2220+
report.movements_count = {
2221+
attack : _content.find($('.troops_movements_count>.incoming_attacks>.value')).html(),
2222+
support : _content.find($('.troops_movements_count>.incoming_support>.value')).html()
2223+
}
2224+
2225+
$.each(temple.getBuff(), function (ii,ee){
2226+
var tmp = GameDataPowers.getTooltipPowerData(GameData.powers[ii], ee, 0);
2227+
report.temple.buff += ((report.temple.buff != '') ? "\n" : "")+tmp.i_descr;
2228+
})
22202229

22212230
report.linia = {};
2222-
if (_content.find($('ul#unit_movements')).length == 0) {
2223-
report.command.title = "\n[i]" + (_content.find($('.conquest_info_wrapper>span')).html()||'') + "[/i]";
2231+
2232+
var ti = MM.getModels().TempleInfo[wnd.attributes.args.target_id];
2233+
2234+
if (ti.getMovements().length == 0) {
2235+
report.command.title = "\n[i]" + (_content.find($('.troops_movements>.content>.centered_text')).html()||'') + "[/i]";
22242236
} else {
2225-
report.linia = {};
2226-
$.each(_content.find($('ul#unit_movements>li')), function(ind, elem) {
2237+
$.each(ti.getMovements(), function(ind, elem) {
22272238
report.linia[ind] = {};
2228-
report.linia[ind].inout = RepConvTool.Adds(RepConv.Const.staticImg + (($(elem).attr('class').replace(/.*(incoming).*/, '$1').length == 0) ? 'out' : 'in') + '.png', 'img');
2229-
report.linia[ind].img = RepConvTool.Adds($(elem).find($('img.command_type')).attr('src'), 'img');
2239+
report.linia[ind].inout = RepConvTool.Adds(RepConv.Const.staticImg + 'in' + '.png', 'img');
2240+
report.linia[ind].img = RepConvTool.Adds('https://cdn.grcrt.net/ui/c/'+elem.type+'.png', 'img');
22302241
var
2231-
_tbtime = $(elem).find('div>span.eta').html().split(':'),
2232-
_sec = (parseInt(_tbtime[0])*60*60+parseInt(_tbtime[1])*60+parseInt(_tbtime[2])),
2233-
_time = readableUnixTimestamp(Timestamp.server()+parseInt(_sec), 'player_timezone', {with_seconds: true, extended_date : true})//formatDateTimeNice(Timestamp.server()+parseInt(_sec), true)
2242+
// _tbtime = $(elem).find('div>span.eta').html().split(':'),
2243+
// _sec = (parseInt(_tbtime[0])*60*60+parseInt(_tbtime[1])*60+parseInt(_tbtime[2])),
2244+
_time = readableUnixTimestamp(elem.arrival_at, 'player_timezone', {with_seconds: true, extended_date : true})//formatDateTimeNice(Timestamp.server()+parseInt(_sec), true)
22342245
report.linia[ind].time = _time;
2235-
//report.linia[ind].time = $(elem).find('div>span.eta').html();
22362246
var
2237-
_cmd_town = RepConvTool.Adds(JSON.parse(RepConvTool.Atob($($($(elem).find('div')[2]).html()).eq(3).attr('href')))[GRCRTtpl.rct.getTown].toString(), GRCRTtpl.rct.town),
2238-
_cmd_player = RepConvTool.Adds(JSON.parse(RepConvTool.Atob($($($(elem).find('div')[2]).html()).eq(5).attr('href'))).name, GRCRTtpl.rct.player),
2239-
_cmd_ally = '('+RepConvTool.Adds($($($(elem).find('div')[2]).html()).eq(7).html(), GRCRTtpl.rct.ally)+')' || '';
2247+
_cmd_town = RepConvTool.Adds( elem['origin_town_'+GRCRTtpl.rct.getTown].toString(), GRCRTtpl.rct.town),
2248+
_cmd_player = RepConvTool.Adds(elem.sender_name, GRCRTtpl.rct.player),
2249+
_cmd_ally = '';
22402250
report.linia[ind].text = '';
2241-
$.each($($($(elem).find('div')[2]).html().replace(/.*<span.*span>(.*)/, '$1')), function(icmd, ecmd){
2242-
//console.log(icmd)
2243-
//console.log($(ecmd).text())
2244-
if ($(ecmd).hasClass('gp_town_link')) {
2251+
// $.each($($($(elem).find('div')[2]).html().replace(/.*<span.*span>(.*)/, '$1')), function(icmd, ecmd){
2252+
// if ($(ecmd).hasClass('gp_town_link')) {
22452253
report.linia[ind].text += " "+_cmd_town;
2246-
} else if ($(ecmd).hasClass('gp_player_link')) {
2247-
report.linia[ind].text += "\n"+_cmd_player;
2248-
} else if ($(ecmd).attr('onclick') != undefined) {
2249-
report.linia[ind].text += " "+_cmd_ally;
2250-
} else if ($(ecmd).text().replace(/(\(|\))/,'').trim().length > 0) {
2251-
report.linia[ind].text += " "+$(ecmd).text().trim();
2252-
}
2253-
})
2254-
ind++;
2254+
// } else if ($(ecmd).hasClass('gp_player_link')) {
2255+
report.linia[ind].text += " ("+_cmd_player+")";
2256+
// } else if ($(ecmd).attr('onclick') != undefined) {
2257+
// report.linia[ind].text += " "+_cmd_ally;
2258+
// } else if ($(ecmd).text().replace(/(\(|\))/,'').trim().length > 0) {
2259+
// report.linia[ind].text += " "+$(ecmd).text().trim();
2260+
// }
2261+
// })
2262+
// ind++;
22552263
});
22562264
}
22572265

@@ -2688,10 +2696,10 @@ function _GRCRTConverterCtrl(wnd) {
26882696
_formbody.append(ramka);
26892697
}
26902698
function optionsOlymp() {
2691-
olympOwner = genCheckBox('OLYMPOWNER', true),
2692-
olympTroop = genCheckBox('OLYMPTROOP', true),
2693-
olympAcCom = genCheckBox('OLYMPACCOM', true),
2694-
olympDesc = genCheckBox('OLYMPDESC', false);
2699+
// olympOwner = genCheckBox('OLYMPOWNER', true),
2700+
// olympTroop = genCheckBox('OLYMPTROOP', true),
2701+
// olympAcCom = genCheckBox('OLYMPACCOM', false),
2702+
// olympDesc = genCheckBox('OLYMPDESC', true);
26952703
var tag = $('<div/>')
26962704
.append(olympOwner)
26972705
.append(olympDesc)
@@ -2914,7 +2922,7 @@ function _GRCRTConverterCtrl(wnd) {
29142922
olympOwner = genCheckBox('OLYMPOWNER', true),
29152923
olympTroop = genCheckBox('OLYMPTROOP', true),
29162924
olympAcCom = genCheckBox('OLYMPACCOM', true),
2917-
olympDesc = genCheckBox('OLYMPDESC', false);
2925+
olympDesc = genCheckBox('OLYMPDESC', true);
29182926
try {
29192927
(WM.getWindowByType("grcrt_convert")[0]).close()
29202928
} catch (e){}

modules/GRCRTInnoFix.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ function _GRCRTInnoFix() {
77
'max-width: none;\n'+
88
'}'
99
)
10-
// size units value
11-
.append('.olympus_temple_info .unit .value {\n'+
12-
'font-size: 10px;\n'+
13-
'}'
14-
)
10+
// // size units value
11+
// .append('.olympus_temple_info .unit .value {\n'+
12+
// 'font-size: 10px;\n'+
13+
// '}'
14+
// )
1515
)
1616
$.Observer(GameEvents.window.reload).subscribe("grcrt_trade", function(a, b) {
1717
$.each($('div[class*=trade_tab_target]'), function(ii, trade){

0 commit comments

Comments
 (0)