Skip to content

Commit e7903b8

Browse files
authored
Merge pull request #65 from grcrt/development
Development
2 parents 90b3403 + d438aaa commit e7903b8

File tree

6 files changed

+241
-108
lines changed

6 files changed

+241
-108
lines changed

common/RepConvTool.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,4 +867,15 @@ function _RepConvTool() {
867867
$('<script/>',{'type':"text/template", 'id':"tpl_grcrt_button"})
868868
.text('<div class="left"></div><div class="right"></div><div class="caption js-caption"><% if (icon && icon_position === \'left\') { %><div class="icon"></div><% } %><img src="https://cdn.grcrt.net/img/octopus.png" style="width: 20px;float:left;margin: 0px 5px 0px -6px"><%= caption %><% if (icon && icon_position === \'right\') { %><div class="icon"></div><% } %><div class="effect js-effect"></div></div>')
869869
);
870+
this.getPlayerId4Name = function(pName){
871+
var _ret = undefined;
872+
try{
873+
$.each(RepConv.cachePlayers, function(pId,pData){
874+
if (pData.name == pName)
875+
_ret = pData.id;
876+
})
877+
return _ret;
878+
} catch(e){}
879+
return null;
880+
}
870881
}

langs/RepConvV2EN.full.user.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ RepConvLangArray.en = {
141141
HASRESEARCH:'DO',
142142
NORESEARCH:'DO NOT',
143143
SETTINGSAVED:'Settings for [city] have been saved',
144+
BTNRESET:'reset',
144145
},
145146
RESWND:{
146147
RESLEFT:'resources left to send',

langs/RepConvV2PL.full.user.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ RepConvLangArray.pl = {
157157
HASRESEARCH:'MASZ',
158158
NORESEARCH:'NIE MASZ',
159159
SETTINGSAVED:'Ustawienia dla miasta [city] zostały zapisane',
160+
BTNRESET:'usuń ustawienia',
160161
},
161162
RESWND:{
162163
RESLEFT:'pozostało do wysłania',

modules/GRCRTConverterCtrl.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,44 @@ function _GRCRTConverterCtrl(wnd) {
489489
})
490490
genImage(report.resources, 30, GRCRTtpl.rct.genImgM+5, 7.5)
491491
}
492+
function __getReportResourcesSpy(){
493+
RepConv.Debug && console.log("__getReportResources2");
494+
var _UA = {};
495+
report.resources = __initResources(),
496+
report.resources.title = _content.find($('#right_side>h4')).eq(1).html()||' ',
497+
$.each(_content.find($('#right_side>div.spy_success_left_align')).eq(1).find($('li>div.res_background32')), function(indR, elemR){
498+
switch($(elemR).children()[0].className){
499+
case "resources_small wood":
500+
_UA = {
501+
i : 'S1',
502+
b : $(elemR).nextAll().text()
503+
},
504+
report.resources.ua.push(_UA),
505+
report.resources.wood = $(elemR).nextAll().text();
506+
//report.resources.count += RepConvTool.Unit(report.resources.wood, "000") + GRCRTtpl.rct.separator;
507+
break;
508+
case "resources_small stone":
509+
_UA = {
510+
i : 'S2',
511+
b : $(elemR).nextAll().text()
512+
},
513+
report.resources.ua.push(_UA),
514+
report.resources.stone = $(elemR).nextAll().text();
515+
//report.resources.count += RepConvTool.Unit(report.resources.stone, "000") + GRCRTtpl.rct.separator;
516+
break;
517+
case "resources_small iron":
518+
_UA = {
519+
i : 'S3',
520+
b : $(elemR).nextAll().text()
521+
},
522+
report.resources.ua.push(_UA),
523+
report.resources.iron = $(elemR).nextAll().text();
524+
//report.resources.count += RepConvTool.Unit(report.resources.iron, "000") + GRCRTtpl.rct.separator;
525+
break;
526+
}
527+
})
528+
genImage(report.resources, 30, GRCRTtpl.rct.genImgM+5, 7.5)
529+
}
492530
function __getReportBunt(){
493531
RepConv.Debug && console.log("__getReportBunt");
494532
report.bunt = '';
@@ -663,6 +701,7 @@ function _GRCRTConverterCtrl(wnd) {
663701
}
664702
report[site].full.ua.push(_UA),
665703
report[site].splits[rowNumber].ua.push(_UA)
704+
// console.log(report);
666705
colCount++;
667706
}),
668707
genImage(report[site].full),
@@ -1964,14 +2003,14 @@ function _GRCRTConverterCtrl(wnd) {
19642003
|| (_content.find($('div#right_side>.spy_success_left_align')) && _content.find($('div#right_side>.spy_success_left_align')).eq(0).text().trim())
19652004
|| _content.find($('div#right_side>p'))[0].innerHTML.replace(/.*:([0-9]*)/, '$1').trim()
19662005
: '',
1967-
(newForm ? __getReportResources2() : (__getReportResources(), report.resources.title = _content.find($('#right_side>#resources')).prev().html()))
2006+
(newForm ? __getReportResourcesSpy() : (__getReportResources(), report.resources.title = _content.find($('#right_side>#resources')).prev().html()))
19682007
if (report.iron.count != '') {
19692008
report.iron.count = RepConvTool.AddSize(report.iron.count,8);
19702009
}
19712010
try {
19722011
report.god = {
1973-
title : (newForm ? _content.find($('#right_side>h4')).eq(2).html() : ""),
1974-
img_url : (newForm ? RepConvTool.Adds((RepConv.grcrt_cdn+"ui/3/{0}.png").RCFormat((_content.find($('div#right_side>.spy_success_left_align')).eq(2).find($('.god_display .god_mini')).attr('class').split(/\s+/)[1] || 'nogod')), "img") : "")
2012+
title : (newForm ? _content.find($('#right_side>h4')).eq(2).html() + "("+_content.find($('div#right_side>.spy_success_left_align')).eq(2).find($('.god_display .god_micro')).attr('title')+")" : ""),
2013+
img_url : (newForm ? RepConvTool.Adds((RepConv.grcrt_cdn+"ui/3/{0}.png").RCFormat((_content.find($('div#right_side>.spy_success_left_align')).eq(2).find($('.god_display .god_micro')).attr('class').split(/\s+/)[1] || 'nogod')), "img") : "")
19752014
}
19762015
} catch (__err){
19772016
report.god = {

modules/RepConvABH.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ function _RepConvABH(){
6464
.append(
6565
'.grcrt_abh_unit_wrapper {'+
6666
'position: absolute;'+
67-
'top: 135px;'+
68-
'left: 120px;'+
67+
'top: 190px;'+
68+
'left: 35px;'+
6969
'cursor:pointer;'+
7070
'}'
7171
)
@@ -330,6 +330,24 @@ function _RepConvABH(){
330330
)
331331
.appendTo("#GRCRT_abh_settings .GRCRT_abh_buttons")
332332
.css("margin", "auto"),
333+
$(RepConvForm.button(RepConvTool.GetLabel('ABH.WND.BTNRESET')))
334+
.click(
335+
function(){
336+
var storeArr = RepConvABH.savedArr || {},
337+
thisTown = Game.townId;
338+
delete storeArr[thisTown]
339+
RepConvABH.savedArr = storeArr,
340+
RepConvTool.setItem(RepConv.CookieUnitsABH,JSON.stringify(RepConvABH.savedArr));
341+
if (RepConv.Debug) console.log(JSON.stringify(storeArr));
342+
//GRCRTabhWnd.close();
343+
(GRCRTabhWnd.getJQElement()).find($('.tech_tree_box span.research_icon')).addClass('inactive is_researched grcrt_set')
344+
setTimeout(function(){
345+
HumanMessage.success(RepConvTool.GetLabel('ABH.WND.SETTINGSAVED').replace('[city]',Game.townName))
346+
},0)
347+
}
348+
)
349+
.appendTo("#GRCRT_abh_settings .GRCRT_abh_buttons")
350+
.css("margin", "auto"),
333351
fillForm(abhUnit);
334352
}
335353
function onClick(that){

0 commit comments

Comments
 (0)