Skip to content

Commit

Permalink
Renaming, added some new classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
c0dezer019 committed Sep 15, 2022
1 parent 5d01b2a commit 7ad54f2
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 90 deletions.
49 changes: 33 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,20 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.codeinspace</groupId>
<artifactId>tabletopcitizen</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>tabletopcitizen</name>
<description>Demo project for Spring Boot</description>
<artifactId>interactivetabletop</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>InteractiveTabletop</name>
<description>A Boot project for InteractiveTabletop Builder</description>
<properties>
<java.version>18</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.17.6</version>
<groupId>com.newrelic.agent.java</groupId>
<artifactId>newrelic-java</artifactId>
<version>7.9.0</version>
<scope>provided</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -38,7 +32,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -62,6 +55,30 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>unpack-newrelic</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.newrelic.agent.java</includeGroupIds>
<includeArtifactIds>newrelic-java</includeArtifactIds>
<!-- you can optionally exclude files -->
<!-- <excludes>**/newrelic.yml</excludes> -->
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<outputDirectory>/opt/newrelic</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.codeinspace.tabletopcitizen;
package com.codeinspace.interactivetabletop;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TabletopcitizenApplication {
public class InteractiveTabletopApplication {

public static void main(String[] args) {

SpringApplication.run(TabletopcitizenApplication.class, args);
SpringApplication.run(InteractiveTabletopApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codeinspace.tabletopcitizen.lib.abstracts;
package com.codeinspace.interactivetabletop.lib.abstracts;

import com.codeinspace.tabletopcitizen.lib.exceptions.SameNameValue;
import com.codeinspace.interactivetabletop.lib.exceptions.SameNameValue;

public abstract class CharacterBase {
private String pFirstName;
Expand Down Expand Up @@ -82,7 +82,7 @@ public String getDesc() {
/**
* @author Brian Blankenship
* @since 1.0.0
* @param description the description to set
* @param desc the description to set
*/
public void setDesc(String desc) {
this.pDesc = desc;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.codeinspace.interactivetabletop.lib.abstracts;

import com.codeinspace.interactivetabletop.lib.enums.Type;

import java.util.Map;
import java.util.UUID;

public abstract class EntityBase {
private String cDesc;
private String cName;
private Type cType;
private final UUID cUID;

protected EntityBase(String name, Type type, String desc) {
this.cDesc = desc;
this.cName = name;
this.cType = type;
this.cUID = UUID.randomUUID();
}

protected String getUID() { return cUID.toString(); }

protected String getName() {
return cName;
}

protected void setName(String name) {
this.cName = name;
}

protected Type getType() {
return cType;
}

protected void setType(Type type) {
this.cType = type;
}

protected String getDesc() {
return cDesc;
}

protected void setDesc(String desc) {
this.cDesc = desc;
}

public abstract Map<String, String> details();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.codeinspace.interactivetabletop.lib.abstracts;

import com.codeinspace.interactivetabletop.lib.enums.Type;

public abstract class ItemBase extends EntityBase {
/*
* Items stats:
* health
* class
* dimensions
* weight
* volume
* category
* type (equipment, container, consumable, clothing, wearable)
* */
private int health;
private String itemClass;

public ItemBase(String name, Type type, String desc, String itemClass, int health) {
super(name, type, desc);

this.itemClass = itemClass;
this.health = health;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.codeinspace.interactivetabletop.lib.abstracts;

public class LocationBase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.codeinspace.interactivetabletop.lib.constants;

import com.codeinspace.interactivetabletop.lib.enums.Type;

public record ItemType(Type type) {
public ItemType(Type type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codeinspace.interactivetabletop.lib.enums;

/**
* Represents an item type.
* @author Brian Blankenship
* @since 1.0.0
* @version 1.0.0
*/
public enum Type {
WEARABLE,
CLOTHING,
EQUIPMENT,
VEHICLE,
CONSUMEABLE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.codeinspace.interactivetabletop.lib.exceptions;

/**
* This error is produced when a user tries to to use the same name as the previous when altering
* character name.
* @author Brian Blankenship
* @since 1.0.0
* @version 1.0.0
*/
public class SameNameValue extends Exception {
private static final long serialVersionUID = 5918001787282243528L;

SameNameValue() {}

public SameNameValue(String err) {
super(err);
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,53 @@
package com.codeinspace.tabletopcitizen.lib.models;
package com.codeinspace.interactivetabletop.lib.models;

import com.codeinspace.tabletopcitizen.lib.abstracts.EntityBase;
import com.codeinspace.interactivetabletop.lib.abstracts.EntityBase;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.codeinspace.interactivetabletop.lib.enums.Type;
import com.codeinspace.interactivetabletop.utils.Notify;

/**
* Represents an entity. All game objects, such as characters, ships, and
* other items would be considered an Entity.
*
* @author Brian Blankenship
* @since 1.0.0
* @see com.codeinspace.tabletopcitizen.lib.models.PlayerCharacter
* @see PlayerCharacter
*/
public class Entity extends EntityBase{
private String cType;
public class Entity extends EntityBase {
private final UUID cUID;
private Type cType;
private String cName;
private String cDesc;

private static final Logger logger = LogManager.getLogger("EntityLogger");

public Entity(String name, String type) {
super(name, type);
public Entity(String name, Type type, String desc) {
super(name, type, desc);

this.cUID = UUID.randomUUID();
this.cType = type;
this.cName = name;
this.cDesc = desc;

Notify.info("New Entity created:\n");
Notify.fine("Entity created.", this);
}

@Override
protected String getUID() {
return cUID.toString();
}

@Override
protected String getType() {
protected Type getType() {
return cType;
}

@Override
protected void setType(String type) {
protected void setType(Type type) {
this.cType = type;
}

Expand All @@ -49,11 +60,16 @@ protected String getName() {
protected void setName(String name) {
this.cName = name;
}

@Override
protected String getDesc() { return cDesc; }

@Override
protected void setDesc(String desc) { this.cDesc = desc; }

/**
* Returns all relevant data to the Entity. In order to get a specific value, Map.get()
* method must be utilized, for ex:
*
* {@code map.get(value);}
* @author Brian Blankenship
* @since 1.0.0
Expand All @@ -68,10 +84,9 @@ public Map<String, String> details() {
lDetails.put(field.getName(), field.get(this).toString());
}
catch (IllegalAccessException err) {
logger.error(err);
Notify.warn("Encountered an error while fetching Entity details.");
}
}

return lDetails;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.codeinspace.tabletopcitizen.lib.models;
package com.codeinspace.interactivetabletop.lib.models;

import com.codeinspace.tabletopcitizen.lib.abstracts.CharacterBase;
import com.codeinspace.tabletopcitizen.lib.exceptions.SameNameValue;
import com.codeinspace.interactivetabletop.lib.exceptions.SameNameValue;
import com.codeinspace.interactivetabletop.lib.abstracts.CharacterBase;

/**
* Represents a character played by a player.
*
* @author Brian Blankenship
* @since 1.0.0
* @see com.codeinspace.tabletopcitizen.lib.models.Entity
* @see Entity
*/
public class PlayerCharacter extends CharacterBase {
private String pFirstName;
Expand All @@ -34,7 +34,7 @@ public void setBio(String bio) {
this.pBio = bio;
}

@Override
@Override
public String getFirstName() {
return pFirstName;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.codeinspace.interactivetabletop.utils;

/**
* Global inventory system as a binary tree.
* @author Brian Blankenship
* @since 1.0.0
*/
public final class Inventory {
}
Loading

0 comments on commit 7ad54f2

Please sign in to comment.