Crossfire JXClient, Trunk
ClassRaceInfo.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff
19  * Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20  * Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21  */
22 
23 package com.realtime.crossfire.jxclient.character;
24 
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Collections;
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31 import org.jetbrains.annotations.NotNull;
32 
37 public class ClassRaceInfo {
38 
42  @NotNull
43  private final String archName;
44 
48  @NotNull
49  private final String name;
50 
54  @NotNull
55  private final String msg;
56 
60  @NotNull
61  private final List<Choice> choices = new ArrayList<>();
62 
66  @NotNull
67  private final Map<Integer, Long> stats = new HashMap<>();
68 
77  public ClassRaceInfo(@NotNull final String archName, @NotNull final String name, @NotNull final String msg, @NotNull final Map<Integer, Long> stats, @NotNull final Collection<Choice> choices) {
78  this.archName = archName;
79  this.name = name;
80  this.msg = msg;
81  this.stats.putAll(stats);
82  this.choices.addAll(choices);
83  }
84 
89  @NotNull
90  public String getArchName() {
91  return archName;
92  }
93 
98  @NotNull
99  public String getName() {
100  return name;
101  }
102 
107  @NotNull
108  public String getMsg() {
109  return msg;
110  }
111 
117  public long getStatAdjustment(final int statNo) {
118  try {
119  return stats.get(statNo);
120  } catch (final NullPointerException ignored) {
121  return 0;
122  }
123  }
124 
129  @NotNull
130  public List<Choice> getChoices() {
131  return Collections.unmodifiableList(choices);
132  }
133 
134  @NotNull
135  @Override
136  public String toString() {
137  return "arch="+archName+", name="+name+", stats="+stats+", choices="+choices;
138  }
139 
140 }
com.realtime.crossfire.jxclient.character.ClassRaceInfo.getMsg
String getMsg()
Definition: ClassRaceInfo.java:108
com.realtime.crossfire.jxclient.character.ClassRaceInfo.toString
String toString()
Definition: ClassRaceInfo.java:136
com.realtime.crossfire.jxclient.character.ClassRaceInfo.getChoices
List< Choice > getChoices()
Definition: ClassRaceInfo.java:130
com.realtime.crossfire.jxclient.character.ClassRaceInfo.getArchName
String getArchName()
Definition: ClassRaceInfo.java:90
com.realtime.crossfire.jxclient.character.ClassRaceInfo
Definition: ClassRaceInfo.java:37
com.realtime.crossfire.jxclient.character.ClassRaceInfo.ClassRaceInfo
ClassRaceInfo(@NotNull final String archName, @NotNull final String name, @NotNull final String msg, @NotNull final Map< Integer, Long > stats, @NotNull final Collection< Choice > choices)
Definition: ClassRaceInfo.java:77
com.realtime.crossfire.jxclient.character.ClassRaceInfo.getStatAdjustment
long getStatAdjustment(final int statNo)
Definition: ClassRaceInfo.java:117
com.realtime.crossfire.jxclient.character.ClassRaceInfo.getName
String getName()
Definition: ClassRaceInfo.java:99
com.realtime.crossfire.jxclient.character.ClassRaceInfo.name
final String name
Definition: ClassRaceInfo.java:49
com.realtime.crossfire.jxclient.character.ClassRaceInfo.stats
final Map< Integer, Long > stats
Definition: ClassRaceInfo.java:67
com.realtime.crossfire.jxclient.character.ClassRaceInfo.msg
final String msg
Definition: ClassRaceInfo.java:55
com.realtime.crossfire.jxclient.character.ClassRaceInfo.archName
final String archName
Definition: ClassRaceInfo.java:43
com.realtime.crossfire.jxclient.character.ClassRaceInfo.choices
final List< Choice > choices
Definition: ClassRaceInfo.java:61