@@ -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 ( / . * ( 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' ) ;
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 ( / .* < 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')) {
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 ) { }
0 commit comments