Skip to content
Snippets Groups Projects
Commit cad033e5 authored by Leonard Haddad's avatar Leonard Haddad :rocket:
Browse files

Merge branch 'model' into 'master'

Model

See merge request reswp-2020/galaxytrucker!33
parents af3bde94 b22b963f
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package com.galaxytrucker.galaxytruckerreloaded.Model.Map;
import com.j256.ormlite.field.DatabaseField;
import lombok.Data;
import lombok.NonNull;
import java.io.Serializable;
......@@ -9,9 +10,14 @@ import java.util.HashMap;
public class Overworld implements Serializable {
/** ID */
@NonNull
@DatabaseField(id = true,columnName = "ID")
private int id;
/** Username used as ID */
@NonNull
@DatabaseField(columnName = "user",id = true)
@DatabaseField(columnName = "user")
private String associatedUser;
/** Stores planet and their location on the map */
......
......@@ -21,8 +21,8 @@ public class Trader extends Planet implements Serializable {
private int id;
/** Associated user */
@DatabaseField
private String associatedUser;
@DatabaseField(foreign = true)
private Planet planet;
/** Weapons for sale */
@DatabaseField(foreign = true)
......
......@@ -18,11 +18,16 @@ import java.io.Serializable;
@DatabaseTable(tableName = "ship")
public class Ship implements Serializable {
/** ID */
@DatabaseField(id = true,columnName = "ID")
@NonNull
private int id;
/**
* The user this ship belongs to
* (uses the user's username)
*/
@DatabaseField(columnName = "ID", id = true)
@DatabaseField(columnName = "associatedUser")
@NonNull
private String associatedUser;
......
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import java.util.UUID;
/** Handles picking a ship, creating the game map and so on */
public class HangarService {
/** Generate a map
* @param username - the user who to generate a map for
* @param seed - seed for map generation */
public void generateMap(String username,int seed){}
/** */
}
......@@ -51,4 +51,6 @@ public class PlanetEventService {
/** Disable systems when in nebula
* @param s - the ship which's systems to disable */
public void disableSystemsInNebula(Ship s, int duration){}
/** Start battle */
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Planet;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicatePlanetException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.PlanetNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.PlanetDAO;
public class PlanetService {
/**
* Planet DAO
*/
private PlanetDAO planetDAO;
/**
* Add a new planet
*
* @param p - the planet to add
* @throws DuplicatePlanetException if the planet already exists
*/
public void addPlanet(Planet p) throws DuplicatePlanetException {
}
/**
* Edit an existing planet
*
* @param p - the planet to edit
* @throws PlanetNotFoundException if the planet cannot be found
*/
public void editPlanet(Planet p) throws PlanetNotFoundException {
}
/**
* Remove an existing planet
*
* @param p - the planet to remove
* @throws PlanetNotFoundException if the planet cannot be found
*/
public void removePlanet(Planet p) throws PlanetNotFoundException {
}
}
......@@ -23,11 +23,15 @@ public class TraderService extends PlanetEventService {
@NonNull
private TraderDAO traderDAO;
/** WeaponDAO */
/**
* WeaponDAO
*/
@NonNull
private WeaponDAO weaponDAO;
/** CrewDAO */
/**
* CrewDAO
*/
@NonNull
private CrewDAO crewDAO;
......@@ -94,4 +98,26 @@ public class TraderService extends PlanetEventService {
public void purchaseHP(Ship ship, Trader trader, int amount) {
}
/**
* Sell weapons
*
* @param ship - the ship that wants to sell weapons
* @param trader - the trader to sell the weapons to
* @param weapon - the weapon to sell
*/
public void sellWeapon(Ship ship, Trader trader, Weapon weapon) {
}
/**
* Sell rockets
*
* @param ship - the ship that wants to sell rockets
* @param trader - the trader to sell the rockets to
* @param amount - the amount of rockets to sell
*/
public void sellRockets(Ship ship, Trader trader, int amount) {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment