Skip to content

Commit

Permalink
Commit 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
GneHeHe committed Nov 4, 2020
1 parent e2b42b3 commit 492f701
Show file tree
Hide file tree
Showing 191 changed files with 13,198 additions and 4,370 deletions.
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,36 @@ Finally, a **built-in tutorial** is also included in **SRBG**

![SRBG](dbd/data/tuto_files/tuto_help.jpg)

# Comment about SRBG with respect to DbD/OS

**SRBG** does not interact at all with **DbD game** and/or files, so it is **100% safe regarding EAC anti-cheat**!

Some OS and/or antivirus programs may raise security warnings because **SRBG executable is not signed**.
This is a personal project, so SRBG will never be signed with certificate like commercial software.
However, **I guarantee SRBG is virus/trojan-free**.

**If you want to compile yourself the binaries, you can do it with the sources available here**

# How to download and run SRBG ?

1) Download the last **pre-compiled JAR/EXE files** [here](https://github.com/GneHeHe/SmartRandomBuildGeneratorDbD/releases/download/2.4/SRBG.zip) (also available in '**releases**' tab)
1) Download the last **pre-compiled JAR/EXE files** [here](https://github.com/GneHeHe/SmartRandomBuildGeneratorDbD/releases/download/2.5/SRBG.zip) (also available in '**releases**' tab)

2) Unzip the downloaded ZIP file
2) Unzip the downloaded **ZIP file**

3) To run **SRBG**: double click either on the EXE file **'SRBG.exe'** or on the JAR file **'SRBG.jar'**
3) **SRBG** can be launched using different ways, with order of priority:

**System Requirements**:
* double click on **SRBG.jar** file to run the native **Java program**
* double click on **SRBG.bat** file to run the native **Java program** using the alternative way
* if both previous methods did not work, double click on **SRBG.exe** file to run the **wrapped program** (may rise security warnings, see above)

**SRBG** may take 5 seconds to launch, depending on your hardware capacity.

# System Requirements

* Recent **Java** Version (1.8 required) [Link](https://java.com/en/download)
* Library **Gson** (included in pre-compiled JAR or EXE files)


* Library **Gson** (included in pre-compiled files)

# Conclusion

Expand Down
19 changes: 19 additions & 0 deletions dbd/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,24 @@ public String show_other() {
return s;
}

/**
* Display Build as String (Raw)
*
* @return
*/
public String show_raw() {
String s = side + " " + character + " ";
int nb = 1;
for (Perk p : l_perks) {
s = s + p.getName();
if (nb < getNbPerks()) {
s = s + " ";
}
nb++;
}
return s;
}

/**
* toString() Method
*
Expand All @@ -251,6 +269,7 @@ public String toString() {

/**
* Check if two Builds are Identical
* Warning: not used anymore in database for efficiency purpose
*
* @param b
* @param sort
Expand Down
121 changes: 60 additions & 61 deletions dbd/Character.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class Character implements Comparable<Character> {
// Generic Characters
public final static String GENERIC_SURVIVOR = "GenSurv";
public final static String GENERIC_KILLER = "GenKiller";
// Generic Character Icons
public final static String GENERIC_SURVIVOR_ICON = "iconHelpLoading_survivor";
public final static String GENERIC_KILLER_ICON = "iconHelpLoading_killer";

/**
* Constructor
Expand All @@ -44,14 +47,12 @@ public class Character implements Comparable<Character> {
*/
public Character(String name, String side, String icon) {
setName(name);
setIconString(icon);
setSide(side);
lab_img_small = new JLabel("", SwingConstants.CENTER);
lab_img_large = new JLabel("", SwingConstants.CENTER);
lab_img_widget = new JLabel("", SwingConstants.CENTER);
try {
setIconPicture(icon);
setIconPicture();
} catch (IOException ex) {
System.err.println("\n# ERROR while creating Character " + name +"\n");
System.err.println("\n# ERROR while creating Character " + name + "\n");
System.err.println(ex.getMessage());
System.exit(0);
}
Expand All @@ -63,27 +64,22 @@ public Character(String name, String side, String icon) {
* @param side
*/
public Character(String side) {
if (side.equals(SURVIVOR)) {
setName(Character.GENERIC_SURVIVOR);
} else if (side.equals(KILLER)) {
setName(Character.GENERIC_KILLER);
} else {
System.err.println("\n# ERROR while creating generic Character\n");
System.exit(0);
switch (side) {
case SURVIVOR:
setName(GENERIC_SURVIVOR);
setIconString(GENERIC_SURVIVOR_ICON);
break;
case KILLER:
setName(GENERIC_KILLER);
setIconString(GENERIC_KILLER_ICON);
break;
default:
System.err.println("\n# ERROR while creating generic Character\n");
System.exit(0);
}
setSide(side);
lab_img_small = new JLabel("", SwingConstants.CENTER);
lab_img_large = new JLabel("", SwingConstants.CENTER);
lab_img_widget = new JLabel("", SwingConstants.CENTER);
// Set Default Icon
String icon = "";
if (side.equals(SURVIVOR)) {
icon = "iconHelpLoading_survivor";
} else if (side.equals(KILLER)) {
icon = "iconHelpLoading_killer";
}
try {
setIconPicture(icon);
setIconPicture();
} catch (IOException ex) {
System.err.println("\n# ERROR while creating generic Character\n");
System.err.println(ex.getMessage());
Expand All @@ -109,6 +105,24 @@ public final void setName(String name) {
this.name = name;
}

/**
* Get Character Icon as String
*
* @return
*/
public String getIconString() {
return icon_string;
}

/**
* Set Character Icon as String
*
* @param icon_string
*/
public final void setIconString(String icon_string) {
this.icon_string = icon_string;
}

/**
* Get Character Side
*
Expand Down Expand Up @@ -152,55 +166,40 @@ public JLabel getIconImage(int size) {
}
}

/**
* Get Character Icon as String
*
* @return
*/
public String getIconString() {
return icon_string;
}

/**
* Set Character Icon
*
* @param s_icon
* @throws java.io.IOException
*/
private void setIconPicture(String s_icon) throws IOException {
// Try to set given Icon Picture
icon_string = s_icon;
String path = "icons_char/" + s_icon + ".png";
private void setIconPicture() throws IOException {
// Define JLabels
lab_img_small = new JLabel("", SwingConstants.CENTER);
lab_img_large = new JLabel("", SwingConstants.CENTER);
lab_img_widget = new JLabel("", SwingConstants.CENTER);
// Try using given Icon Picture
String path = "icons_char/" + icon_string + ".png";
if (getClass().getResourceAsStream(path) == null) {
// Try using default Icon Picture
if (side.equals(SURVIVOR)) {
path = "icons_char/" + GENERIC_SURVIVOR_ICON + ".png";
} else if (side.equals(KILLER)) {
path = "icons_char/" + GENERIC_KILLER_ICON + ".png";
}
System.err.println("\n# WARNING: Using default Icon Files for Character '" + name + "'");
}
// Load Icon Picture
if (getClass().getResourceAsStream(path) != null) {
// Set Icons in JLabel
lab_img_small.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_SMALL, Character.SIZE_SMALL)));
lab_img_large.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_LARGE, Character.SIZE_LARGE)));
lab_img_widget.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_WIDGET, Character.SIZE_WIDGET)));
// Set Icon in JLabel
lab_img_small.setIcon(new ImageIcon(Tools.resizePicture(path, SIZE_SMALL, SIZE_SMALL)));
lab_img_large.setIcon(new ImageIcon(Tools.resizePicture(path, SIZE_LARGE, SIZE_LARGE)));
lab_img_widget.setIcon(new ImageIcon(Tools.resizePicture(path, SIZE_WIDGET, SIZE_WIDGET)));
// Set Name for Tooltip
lab_img_small.setName(name);
lab_img_large.setName(name);
lab_img_widget.setName(name);
} else {
// Try to use default Icon Picture
if (side.equals(SURVIVOR)) {
s_icon = "iconHelpLoading_survivor";
} else if (side.equals(KILLER)) {
s_icon = "iconHelpLoading_killer";
}
path = "icons_char/" + s_icon + ".png";
if (getClass().getResourceAsStream(path) != null) {
// Set Default Icon in JLabel
lab_img_small.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_SMALL, Character.SIZE_SMALL)));
lab_img_large.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_LARGE, Character.SIZE_LARGE)));
lab_img_widget.setIcon(new ImageIcon(Tools.resizePicture(path, Character.SIZE_WIDGET, Character.SIZE_WIDGET)));
// Set Name for Tooltip
lab_img_small.setName(name);
lab_img_large.setName(name);
lab_img_widget.setName(name);
} else {
System.err.println("\n# ERROR: Both expected and default Icon Files were not found for Character '" + name + "' => Exit\n");
System.exit(0);
}
System.err.println("\n# ERROR: Icon Files were not found for Character '" + name + "' => Exit\n");
System.exit(0);
}
}

Expand Down

0 comments on commit 492f701

Please sign in to comment.