@@ -335,7 +335,7 @@ function _GRCRTConverterCtrl(wnd) {
335
335
$ . each ( __repconvValueArray , function ( ind , repconvValue ) {
336
336
var _res = $ ( '<div/>' ) ;
337
337
var params = { message : repconvValue } ;
338
- RepConv . Debug && console . log ( value . length ) ;
338
+ RepConv . Debug && console . log ( repconvValue . length ) ;
339
339
gpAjax . _ajax (
340
340
'message' ,
341
341
'preview' ,
@@ -659,7 +659,7 @@ function _GRCRTConverterCtrl(wnd) {
659
659
}
660
660
_UA = {
661
661
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 ( )
663
663
}
664
664
report [ site ] . full . ua . push ( _UA ) ,
665
665
report [ site ] . splits [ rowNumber ] . ua . push ( _UA )
@@ -717,8 +717,8 @@ function _GRCRTConverterCtrl(wnd) {
717
717
// );
718
718
result . town = _getTown ( item ) ;
719
719
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 ) ;
722
722
result . townName = _getTownName ( item ) ;
723
723
result . playerName = _getPlayerName ( item ) ;
724
724
// result.island = _getIsland(item);
@@ -1691,13 +1691,13 @@ function _GRCRTConverterCtrl(wnd) {
1691
1691
// przybywające ataki,wsparcia
1692
1692
report . unit_movements = { 'support' :0 , 'attack' :0 }
1693
1693
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 ( ) ;
1695
1695
// $.each(MM.getCollections().Support[0].getIncomingSupportsForTown(Game.townId), function(ind, command){
1696
1696
// report.unit_movements.support += ((command.getIncoming()==1) ? 1 : 0)
1697
1697
// })
1698
1698
}
1699
1699
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 ( ) ;
1701
1701
// $.each(MM.getCollections().Attack[0].getIncomingAttacksForTown(Game.townId), function(ind, command){
1702
1702
// report.unit_movements.attack += ((command.getIncoming()==1) ? 1 : 0)
1703
1703
// })
@@ -2191,7 +2191,8 @@ function _GRCRTConverterCtrl(wnd) {
2191
2191
2192
2192
function _olympus ( ) {
2193
2193
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 ( ) ;
2195
2196
report . type = '' ;
2196
2197
report . time = '' ;
2197
2198
report . power = '' ;
@@ -2202,56 +2203,63 @@ function _GRCRTConverterCtrl(wnd) {
2202
2203
report . attacker = { } ;
2203
2204
report . defender = { } ;
2204
2205
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
+
2215
2209
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 : ''
2218
2217
2219
2218
} ;
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
+ } )
2220
2229
2221
2230
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]" ;
2224
2236
} else {
2225
- report . linia = { } ;
2226
- $ . each ( _content . find ( $ ( 'ul#unit_movements>li' ) ) , function ( ind , elem ) {
2237
+ $ . each ( ti . getMovements ( ) , function ( ind , elem ) {
2227
2238
report . linia [ ind ] = { } ;
2228
- report . linia [ ind ] . inout = RepConvTool . Adds ( RepConv . Const . staticImg + ( ( $ ( elem ) . attr ( 'class' ) . replace ( / . * ( i n c o m i n g ) . * / , '$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' ) ;
2230
2241
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)
2234
2245
report . linia [ ind ] . time = _time ;
2235
- //report.linia[ind].time = $(elem).find('div>span.eta').html();
2236
2246
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 = '' ;
2240
2250
report . linia [ ind ] . text = '' ;
2241
- $ . each ( $ ( $ ( $ ( elem ) . find ( 'div' ) [ 2 ] ) . html ( ) . replace ( / .* < s p a n .* s p a n > ( .* ) / , '$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')) {
2245
2253
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++;
2255
2263
} ) ;
2256
2264
}
2257
2265
@@ -2688,10 +2696,10 @@ function _GRCRTConverterCtrl(wnd) {
2688
2696
_formbody . append ( ramka ) ;
2689
2697
}
2690
2698
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 );
2695
2703
var tag = $ ( '<div/>' )
2696
2704
. append ( olympOwner )
2697
2705
. append ( olympDesc )
@@ -2914,7 +2922,7 @@ function _GRCRTConverterCtrl(wnd) {
2914
2922
olympOwner = genCheckBox ( 'OLYMPOWNER' , true ) ,
2915
2923
olympTroop = genCheckBox ( 'OLYMPTROOP' , true ) ,
2916
2924
olympAcCom = genCheckBox ( 'OLYMPACCOM' , true ) ,
2917
- olympDesc = genCheckBox ( 'OLYMPDESC' , false ) ;
2925
+ olympDesc = genCheckBox ( 'OLYMPDESC' , true ) ;
2918
2926
try {
2919
2927
( WM . getWindowByType ( "grcrt_convert" ) [ 0 ] ) . close ( )
2920
2928
} catch ( e ) { }
0 commit comments