Crossfire JXClient, Trunk  R20561
ClassRaceInfoBuilder.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-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.server.crossfire;
23 
26 import java.util.ArrayList;
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30 import org.jetbrains.annotations.NotNull;
31 
37 public class ClassRaceInfoBuilder {
38 
42  @NotNull
43  private final String archName;
44 
48  @NotNull
49  private String name = "";
50 
54  @NotNull
55  private String msg = "";
56 
60  @NotNull
61  private final Map<Integer, Long> stats = new HashMap<>();
62 
66  @NotNull
67  private final List<Choice> choices = new ArrayList<>();
68 
73  public ClassRaceInfoBuilder(@NotNull final String archName) {
74  this.archName = archName;
75  }
76 
82  @NotNull
83  public ClassRaceInfo finish() {
84  return new ClassRaceInfo(archName, name, msg, stats, choices);
85  }
86 
91  public void setName(@NotNull final String name) {
92  this.name = name;
93  }
94 
99  public void setMsg(@NotNull final String msg) {
100  this.msg = msg;
101  }
102 
108  public void setStatAdjustment(final int statNo, final long adjustment) {
109  stats.put(statNo, adjustment);
110  }
111 
116  public void addChoice(@NotNull final Choice choice) {
117  choices.add(choice);
118  }
119 
120 }
void setStatAdjustment(final int statNo, final long adjustment)
Sets a stat adjustment.
ClassRaceInfo finish()
Finishes parsing an entry an returns the ClassRaceInfo for the entry.
ClassRaceInfoBuilder(@NotNull final String archName)
Creates a new instance.
void setName(@NotNull final String name)
Sets the human readable stat name.
Builder for ClassRaceInfo instances while parsing an "replyinfo race_info" packet.
void setMsg(@NotNull final String msg)
Sets the long description.
A choice for character creation.
Definition: Choice.java:33
One possible class or race for character creation.