Skip to content

Commit

Permalink
ho-dev#1288 new column HTMS in player overview
Browse files Browse the repository at this point in the history
  • Loading branch information
wsbrenk committed Dec 25, 2022
1 parent 505b051 commit e167ef7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/core/gui/model/PlayerOverviewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public boolean userCanDisableColumns() {
*/
private void initialize() {
UserColumn[] basic = UserColumnFactory.createPlayerBasicArray();
columns = new UserColumn[60];
columns = new UserColumn[61];
columns[0] = basic[0];
columns[48] = basic[1];

Expand Down Expand Up @@ -82,6 +82,7 @@ private void initialize() {
columns[56] = additionalArray[19];
columns[57] = additionalArray[20];
columns[59] = additionalArray[21];
columns[60] = additionalArray[22];
}

public Player getPlayer(int id) {
Expand Down
20 changes: 18 additions & 2 deletions src/main/java/core/gui/model/UserColumnFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public IHOTableEntry getTableEntry(PlayerMatchCBItem spielerCBItem) {
* @return PlayerColumn[]
*/
public static PlayerColumn[] createPlayerAdditionalArray() {
final PlayerColumn[] playerAdditionalArray = new PlayerColumn[22];
final PlayerColumn[] playerAdditionalArray = new PlayerColumn[23];

playerAdditionalArray[0] = new PlayerColumn(10, "ls.player.shirtnumber.short", "ls.player.shirtnumber", 25) {
@Override
Expand Down Expand Up @@ -912,7 +912,23 @@ public IHOTableEntry getTableEntry(Player player, Player playerCompare) {
t = "";
m = 0;
}
return new ColorLabelEntry(m, t, ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.LEFT);
return new ColorLabelEntry(m, t, ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.RIGHT);
}
};

playerAdditionalArray[22] = new PlayerColumn(896, "ls.player.htms", 50) {
@Override
public IHOTableEntry getTableEntry(Player player, Player playerCompare) {
var m = player.getHtms();
String t;
if ( m!= null){
t = m.toString();
}
else {
t = "";
m = 0;
}
return new ColorLabelEntry(m, t, ColorLabelEntry.FG_STANDARD, ColorLabelEntry.BG_STANDARD, SwingConstants.RIGHT);
}
};

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/core/model/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ public class Player extends AbstractTable.Storable {
private String motherclubName;
private Integer matchesCurrentTeam;
private int hrf_id;

private Integer htms = null;
private Integer htms28 = null;
public int getGameStartingTime() {
return GameStartingTime;
}
Expand All @@ -338,7 +339,6 @@ public void setGameStartingTime(int gameStartingTime) {
GameStartingTime = gameStartingTime;
}

private Integer htms28 = null;

//~ Constructors -------------------------------------------------------------------------------

Expand Down Expand Up @@ -1722,6 +1722,13 @@ public Integer getHtms28() {
return htms28;
}

public Integer getHtms(){
if (htms == null){
htms= Htms.htms(getSkills());
}
return htms;
}

private Map<Integer, Integer> getSkills() {

var ret = new HashMap<Integer, Integer>();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/sprache/English.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,7 @@ ls.update_status.complete=Complete

ls.player_details.desc1=A {0} who is {1} and {2}.
ls.player_details.desc2=Has {0} experience and {1} leadership. Has {2} loyalty.
ls.player.htms=HTMS
ls.player.htms28=HTMS-28

ls.training.week=Training week
Expand Down

0 comments on commit e167ef7

Please sign in to comment.