@@ -7,6 +7,7 @@ function _RepConvGRC() {
7
7
var idleInterval = 1000 * 60 * 15 ;
8
8
var stopCount = 0 ;
9
9
var wonders = { } ;
10
+ var typUnits = { 1 : [ 'defAtt' , 'losAtt' ] , 2 : [ 'defDef' , 'losDef' ] } ;
10
11
11
12
function genCheckBox ( pName , pChecked , pLabel ) {
12
13
return $ ( '<div/>' , { 'class' :'checkbox_new' , 'style' :'margin-bottom: 10px; display: block;' } )
@@ -747,8 +748,9 @@ function _RepConvGRC() {
747
748
RepConv . Debug && console . log ( elemGr . getElementsByClassName ( 'wall_report_unit' ) . length ) ;
748
749
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
749
750
var
750
- unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ,
751
- unitKill = $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( ) ;
751
+ unitName = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'type' ) , //RepConvTool.getUnitName($(elemUn).find($('.wall_report_unit'))),
752
+ unitKill = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' ) ;
753
+ //$(elemUn).find($('.place_unit_black')).html();
752
754
cookie [ typUnits [ indLi ] [ indGr ] ] [ unitName ] = unitKill ;
753
755
} ) ;
754
756
} ) ;
@@ -759,8 +761,9 @@ function _RepConvGRC() {
759
761
RepConv . Debug && console . log ( elemGr . getElementsByClassName ( 'wall_report_unit' ) . length ) ;
760
762
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
761
763
var
762
- unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ,
763
- unitKill = $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( ) ;
764
+ unitName = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'type' ) , //RepConvTool.getUnitName($(elemUn).find($('.wall_report_unit'))),
765
+ unitKill = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' ) ;
766
+ //$(elemUn).find($('.place_unit_black')).html();
764
767
cookie [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] = unitKill ;
765
768
} ) ;
766
769
} ) ;
@@ -833,6 +836,7 @@ function _RepConvGRC() {
833
836
834
837
RepConv . Debug && console . log ( 'Load wall...' ) ;
835
838
var unitDiff ;
839
+ var hun = require ( "helpers/unit_numbers" ) ;
836
840
$ . each ( RCGP . getJQElement ( ) . find ( $ ( 'div#building_wall li.odd' ) ) , function ( indLi , elemLi ) {
837
841
if ( indLi > 0 ) {
838
842
// lewa strona
@@ -842,16 +846,17 @@ function _RepConvGRC() {
842
846
RepConv . Debug && console . log ( elemGr . getElementsByClassName ( 'wall_report_unit' ) . length ) ;
843
847
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
844
848
var
845
- unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ,
846
- unitKill = $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( ) ,
849
+ unitName = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'type' ) , //RepConvTool.getUnitName($(elemUn).find($('.wall_report_unit'))),
850
+ unitKill = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' ) ,
851
+ //$(elemUn).find($('.place_unit_black')).html(),
847
852
unitSave = units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ;
848
853
RepConv . Debug && console . log ( unitName + ' ' + unitSave + '/' + unitKill ) ;
849
854
unitDiff = unitKill ;
850
855
if ( unitSave != undefined ) {
851
856
unitDiff = unitKill - unitSave ;
852
857
}
853
858
RepConv . Debug && console . log ( 'unitDiff = ' + unitDiff ) ;
854
- $ ( elemUn ) . find ( $ ( '.grcrt_wall_diff' ) ) . html ( ( unitDiff != 0 ) ? unitDiff : '' ) ;
859
+ $ ( elemUn ) . find ( $ ( '.grcrt_wall_diff' ) ) . html ( ( unitDiff != 0 ) ? hun . shortenNumber ( unitDiff ) : '' ) ;
855
860
} ) ;
856
861
} ) ;
857
862
// prawa strona
@@ -861,16 +866,17 @@ function _RepConvGRC() {
861
866
RepConv . Debug && console . log ( elemGr . getElementsByClassName ( 'wall_report_unit' ) . length ) ;
862
867
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
863
868
var
864
- unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ,
865
- unitKill = $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( ) ,
869
+ unitName = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'type' ) , //RepConvTool.getUnitName($(elemUn).find($('.wall_report_unit'))),
870
+ unitKill = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' ) ,
871
+ //$(elemUn).find($('.place_unit_black')).html(),
866
872
unitSave = units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ;
867
873
RepConv . Debug && console . log ( unitName + ' ' + unitSave + '/' + unitKill ) ;
868
874
unitDiff = unitKill ;
869
875
if ( unitSave != undefined ) {
870
876
unitDiff = unitKill - unitSave ;
871
877
}
872
878
RepConv . Debug && console . log ( 'unitDiff = ' + unitDiff ) ;
873
- $ ( elemUn ) . find ( $ ( '.grcrt_wall_diff' ) ) . html ( ( unitDiff != 0 ) ? unitDiff : '' ) ;
879
+ $ ( elemUn ) . find ( $ ( '.grcrt_wall_diff' ) ) . html ( ( unitDiff != 0 ) ? hun . shortenNumber ( unitDiff ) : '' ) ;
874
880
} ) ;
875
881
} ) ;
876
882
}
@@ -888,6 +894,7 @@ function _RepConvGRC() {
888
894
var
889
895
units = RepConvTool . getItem ( RepConv . Cookie ) ,
890
896
_walls = RepConvTool . getItem ( RepConv . CookieWall ) || [ ] ;
897
+ // var typUnits = {1: ['defAtt', 'losAtt'], 2: ['defDef', 'losDef']};
891
898
if ( ( loadTimeStamp == _curTimestamp ) ) {
892
899
units = _currWallValues ;
893
900
} else {
@@ -897,6 +904,7 @@ function _RepConvGRC() {
897
904
}
898
905
} )
899
906
}
907
+ var hun = require ( "helpers/unit_numbers" ) ;
900
908
saveBtn . disable ( ! ( loadTimeStamp == _curTimestamp ) ) ;
901
909
$ . each ( RCGP . getJQElement ( ) . find ( $ ( 'div#building_wall li.odd' ) ) , function ( indLi , elemLi ) {
902
910
if ( indLi > 0 ) {
@@ -907,9 +915,13 @@ function _RepConvGRC() {
907
915
RepConv . Debug && console . log ( elemGr . getElementsByClassName ( 'wall_report_unit' ) . length ) ;
908
916
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
909
917
var
910
- unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ;
911
- $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) ,
912
- $ ( elemUn ) . find ( $ ( '.place_unit_white' ) ) . html ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) ;
918
+ unitName = $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'type' ) ;
919
+ // RepConvTool.getUnitName($(elemUn).find($('.wall_report_unit')));
920
+ if ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) {
921
+ $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' , units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) ,
922
+ $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( hun . shortenNumber ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) ) ,
923
+ $ ( elemUn ) . find ( $ ( '.place_unit_white' ) ) . html ( hun . shortenNumber ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) ) ;
924
+ }
913
925
} ) ;
914
926
} ) ;
915
927
// prawa strona
@@ -920,8 +932,11 @@ function _RepConvGRC() {
920
932
$ . each ( $ ( elemGr ) . find ( $ ( '.grcrt_wall_units' ) ) , function ( indUn , elemUn ) {
921
933
var
922
934
unitName = RepConvTool . getUnitName ( $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) ) ;
923
- $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ) ,
924
- $ ( elemUn ) . find ( $ ( '.place_unit_white' ) ) . html ( units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ) ;
935
+ if ( units [ typUnits [ indLi ] [ indGr ] ] [ unitName ] ) {
936
+ $ ( elemUn ) . find ( $ ( '.wall_report_unit' ) ) . data ( 'unit_count' , units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ) ,
937
+ $ ( elemUn ) . find ( $ ( '.place_unit_black' ) ) . html ( hun . shortenNumber ( units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ) ) ,
938
+ $ ( elemUn ) . find ( $ ( '.place_unit_white' ) ) . html ( hun . shortenNumber ( units [ typUnits [ indLi ] [ indGr + 1 ] ] [ unitName ] ) ) ;
939
+ }
925
940
} ) ;
926
941
} ) ;
927
942
}
@@ -2177,21 +2192,24 @@ function _RepConvGRC() {
2177
2192
2178
2193
function townPopup ( ) {
2179
2194
if ( RepConv . settings [ RepConv . Cookie + '_town_popup' ] ) {
2180
- var acc = { } , alliance_name = MM . checkAndPublishRawModel ( 'Player' , { id :Game . player_id } ) . getAllianceName ( )
2195
+ var acc = { } ,
2196
+ alliance_name = MM . checkAndPublishRawModel ( 'Player' , { id :Game . player_id } ) . getAllianceName ( )
2181
2197
$ . each ( ITowns . towns , function ( ind , town ) {
2182
2198
var cc = town ;
2183
- cc . points = cc . getPoints ( ) ;
2184
- cc . player_name = Game . player_name
2185
- cc . alliance_name = alliance_name
2186
- cc . tooltip = new MousePopup ( WMap . createTownTooltip ( 'town' , cc ) )
2199
+ cc . points = cc . getPoints ( ) ,
2200
+ cc . player_name = Game . player_name ,
2201
+ cc . alliance_name = alliance_name ,
2202
+ cc . tooltip = new MousePopup ( WMap . createTownTooltip ( 'town' , cc ) ) ,
2187
2203
acc [ ind ] = cc
2204
+
2188
2205
} )
2189
2206
$ . each ( $ ( '#town_groups_list .item.town_group_town:not(.grcrtPopup)' ) , function ( it , et ) {
2190
2207
var cc = acc [ $ ( et ) . data ( 'townid' ) ] ;
2191
2208
// $(et).find($('.town_name')).mousePopup(new MousePopup(WMap.createTownTooltip('town',cc)))
2192
2209
$ ( et ) . find ( $ ( '.town_name' ) ) . mousePopup ( cc . tooltip )
2193
2210
$ ( et ) . addClass ( 'grcrtPopup' )
2194
2211
} )
2212
+
2195
2213
}
2196
2214
}
2197
2215
0 commit comments