Skip to content

Commit 47f81d8

Browse files
authored
Merge pull request #67 from grcrt/Hero
feat: adds hero icon to town list
2 parents c884aa2 + da8d091 commit 47f81d8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

modules/RepConvGRC.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2193,13 +2193,27 @@ function _RepConvGRC() {
21932193
function townPopup(){
21942194
if (RepConv.settings[RepConv.Cookie+'_town_popup']){
21952195
var acc = {},
2196-
alliance_name = MM.checkAndPublishRawModel('Player',{id:Game.player_id}).getAllianceName()
2196+
alliance_name = MM.checkAndPublishRawModel('Player',{id:Game.player_id}).getAllianceName(),
2197+
heroes = MM.getCollections()['PlayerHero'][0], heroArray = {},
2198+
i = DM.getl10n("heroes", "common")
2199+
$.each(heroes.getHeroes(), function(idh, hhero){
2200+
var o = GameData.heroes[hhero.getId()];
2201+
heroArray[hhero.getOriginTownId()] = {
2202+
id: hhero.getId(),
2203+
level: hhero.getLevel(),
2204+
name: hhero.getName(),
2205+
category: i.hero_of[o.category],
2206+
txt_lvl: i.level(hhero.getLevel())
2207+
}
2208+
2209+
})
21972210
$.each(ITowns.towns, function(ind,town){
21982211
var cc = town;
21992212
cc.points = cc.getPoints(),
22002213
cc.player_name = Game.player_name,
22012214
cc.alliance_name = alliance_name,
22022215
cc.tooltip = new MousePopup(WMap.createTownTooltip('town',cc)),
2216+
cc.grcrt_hero = heroArray[cc.getId()],
22032217
acc[ind]=cc
22042218

22052219
})
@@ -2208,6 +2222,10 @@ function _RepConvGRC() {
22082222
// $(et).find($('.town_name')).mousePopup(new MousePopup(WMap.createTownTooltip('town',cc)))
22092223
$(et).find($('.town_name')).mousePopup(cc.tooltip)
22102224
$(et).addClass('grcrtPopup')
2225+
if(cc.grcrt_hero){
2226+
$(et).prepend('<div class="grcrt_hero hero_icon hero25x25 '+cc.grcrt_hero.id+'"><div class="value">'+cc.grcrt_hero.level+'</div></div>')
2227+
$(et).find($('.grcrt_hero.hero_icon')).tooltip('<div class="ui_hero_tooltip_small"><div class="icon_border"><div class="icon hero50x50 ' + cc.grcrt_hero.id + '"></div></div><b>' + cc.grcrt_hero.name + '</b><br />' + cc.grcrt_hero.category + '<br /><br /><b>' + cc.grcrt_hero.txt_lvl + '</b><br /></div>')
2228+
}
22112229
})
22122230

22132231
}
@@ -3498,6 +3516,10 @@ function _RepConvGRC() {
34983516
'.grcrt_brackets:before { content: "("}\n'+
34993517
'.grcrt_brackets:after { content: ")"}'
35003518
)
3519+
.append(
3520+
'.grcrt_hero { float: left; margin: 0 2px;}\n'+
3521+
'.grcrt_hero.hero_icon .value { color: white; float: right; text-shadow: 1px 1px 0 #000; padding-top: 5px;}'
3522+
)
35013523
)
35023524
.append(
35033525
$('<style/>', {'id':'grcrt_ft'})

0 commit comments

Comments
 (0)