mirror of
https://github.com/cekis/swg-api
synced 2026-07-14 15:01:32 -04:00
Properties management nearly complete.
This commit is contained in:
@@ -47,6 +47,16 @@
|
||||
<artifactId>ojdbc10</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
<version>2.11.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>6.0.16.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,10 +2,13 @@ package swg;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import swg.entity.SwgConfiguration;
|
||||
|
||||
@SpringBootApplication
|
||||
@RestController
|
||||
@EnableConfigurationProperties(SwgConfiguration.class)
|
||||
public class SwgRestApiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SwgRestApiApplication.class, args);
|
||||
|
||||
@@ -8,7 +8,7 @@ import swg.service.AccountService;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/account")
|
||||
@RequestMapping("/api/account")
|
||||
public class AccountController {
|
||||
@Autowired
|
||||
AccountService accountService;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package swg.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import swg.entity.CityObject;
|
||||
import swg.service.CityObjectService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/city")
|
||||
public class CityObjectController {
|
||||
@Autowired
|
||||
CityObjectService cityObjectService;
|
||||
|
||||
@ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "City could not be found.")
|
||||
public static class CityNotFoundException extends RuntimeException {}
|
||||
|
||||
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
||||
public List<CityObject> getAllPropertyLists() {
|
||||
return cityObjectService.getAllCityObjects();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||
public CityObject getCityByCityName(@RequestParam("name") String name) {
|
||||
CityObject co = cityObjectService.getCityObjectByCityName(name);
|
||||
if(co == null) throw new CityNotFoundException();
|
||||
return co;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail/{objectId}", method = RequestMethod.GET)
|
||||
public CityObject getCityObjectsByObjectId(@PathVariable("objectId") Long objectId) {
|
||||
return cityObjectService.getCityObjectByObjectId(objectId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package swg.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import swg.entity.MetricsModel;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/metrics")
|
||||
public class MetricsController {
|
||||
MetricsModel currentMetrics;
|
||||
|
||||
@PostMapping(consumes = "application/json")
|
||||
public boolean setMetrics(@RequestBody MetricsModel metrics) {
|
||||
this.currentMetrics = metrics;
|
||||
return true;
|
||||
}
|
||||
|
||||
@GetMapping(produces = "application/json")
|
||||
public MetricsModel retrieveMetrics() {
|
||||
return currentMetrics;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package swg.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import swg.entity.Player;
|
||||
import swg.service.PlayerService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/player")
|
||||
public class PlayerController {
|
||||
@Autowired
|
||||
PlayerService playerService;
|
||||
|
||||
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
||||
public List<Player> getAllPlayers() {
|
||||
return playerService.getAllPlayers();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/station/{stationId}", method = RequestMethod.GET)
|
||||
public List<Player> getAllByStationId(@PathVariable("stationId") Long stationId) {
|
||||
return playerService.getAllPlayersByStationId(stationId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{objectId}", method = RequestMethod.GET)
|
||||
public Player getByObjectId(@PathVariable("objectId") Long objectId) {
|
||||
return playerService.getPlayerByObjectId(objectId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package swg.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import swg.entity.ActiveResource;
|
||||
import swg.entity.ResourceType;
|
||||
import swg.service.ResourceTypeService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/resource")
|
||||
public class ResourceTypeController {
|
||||
@Autowired
|
||||
ResourceTypeService resourceTypeService;
|
||||
|
||||
@RequestMapping(value = "/historical/all", method = RequestMethod.GET)
|
||||
public List<ResourceType> getAllResources() {
|
||||
return resourceTypeService.getAllResources();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/current", method = RequestMethod.GET)
|
||||
public List<ActiveResource> getSpawnedResources() {
|
||||
return resourceTypeService.getSpawnedResources();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package swg.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import swg.entity.SwgConfiguration;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/api/settings")
|
||||
public class SettingsController {
|
||||
@Autowired
|
||||
SwgConfiguration swgConfiguration;
|
||||
|
||||
@Value(value = "${swg.log.config.path}customOptions.cfg")
|
||||
String swgConfigFile;
|
||||
|
||||
@RequestMapping(value = "/server", method = RequestMethod.GET)
|
||||
public SwgConfiguration getAllSettings() {
|
||||
return swgConfiguration;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/server", method = RequestMethod.POST)
|
||||
public void saveSwgConfiguration(@RequestBody SwgConfiguration swgConfiguration) throws IOException {
|
||||
this.swgConfiguration = swgConfiguration;
|
||||
ObjectMapper mapper = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
|
||||
mapper.writeValue(new File("./swg-local.yml"), swgConfiguration);
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(this.swgConfigFile));
|
||||
writer.write(swgConfiguration.toString());
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import swg.entity.Account;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface AccountDao extends JpaRepository<Account, Integer> {
|
||||
public Account findByStationId(Long stationId);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package swg.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import swg.entity.CityObject;
|
||||
import swg.entity.PropertyList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface CityObjectDao extends JpaRepository<CityObject, Integer> {
|
||||
public CityObject findByObjectId(Long objectId);
|
||||
@Query(value = "SELECT * FROM CITY_OBJECTS WHERE object_id = (SELECT object_id from PROPERTY_LISTS WHERE LIST_ID = 12 AND VALUE LIKE '%::%')", nativeQuery = true)
|
||||
public CityObject findByName(String name);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package swg.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import swg.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface PlayerDao extends JpaRepository<Player, Integer> {
|
||||
public List<Player> findByStationId(Long stationId);
|
||||
public Player findByObjectId(Long objectId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package swg.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import swg.entity.Player;
|
||||
import swg.entity.PropertyList;
|
||||
import swg.entity.ResourceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface PropertyListDao extends JpaRepository<PropertyList, Integer> {
|
||||
public List<PropertyList> findByObjectId(Long objectId);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package swg.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import swg.entity.ActiveResource;
|
||||
import swg.entity.ResourceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ResourceTypeDao extends JpaRepository<ResourceType, Integer> {
|
||||
@Query(value = "SELECT * FROM active_resources_data", nativeQuery = true)
|
||||
public List<ActiveResource> findAllSpawned();
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package swg.entity;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@NamedQuery(name = "Account.findByStationId", query = "SELECT a FROM Account a WHERE a.stationId = ?1")
|
||||
@Table(name = "ACCOUNTS")
|
||||
public class Account {
|
||||
@Column(name = "STATION_ID")
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package swg.entity;
|
||||
|
||||
public interface ActiveResource {
|
||||
Long getResource_id();
|
||||
String getResource_name();
|
||||
String getResource_class();
|
||||
String getAttribute_name();
|
||||
String getAttribute_value();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package swg.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CITY_OBJECTS")
|
||||
public class CityObject {
|
||||
@Column(name = "OBJECT_ID")
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long objectId;
|
||||
|
||||
@OneToMany(mappedBy = "objectId")
|
||||
private List<PropertyList> propertyLists;
|
||||
|
||||
protected CityObject() {
|
||||
}
|
||||
|
||||
public Long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(Long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public List<PropertyList> getPropertyLists() {
|
||||
return propertyLists;
|
||||
}
|
||||
|
||||
public void setPropertyLists(List<PropertyList> propertyLists) {
|
||||
this.propertyLists = propertyLists;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package swg.entity;
|
||||
|
||||
public class MetricsModel {
|
||||
private String clusterName;
|
||||
private int totalPlayerCount;
|
||||
private int totalGameServers;
|
||||
private int totalPlanetServers;
|
||||
private int totalTutorialSceneCount;
|
||||
private long lastLoadingStateTime;
|
||||
private long clusterStartupTime;
|
||||
private long timeClusterWentIntoLoadingState;
|
||||
private int webUpdateIntervalSeconds;
|
||||
private long lastUpdateTime;
|
||||
private String secretKey;
|
||||
|
||||
public MetricsModel() {
|
||||
this.lastUpdateTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public int getTotalPlayerCount() {
|
||||
return totalPlayerCount;
|
||||
}
|
||||
|
||||
public void setTotalPlayerCount(int totalPlayerCount) {
|
||||
this.totalPlayerCount = totalPlayerCount;
|
||||
}
|
||||
|
||||
public int getTotalGameServers() {
|
||||
return totalGameServers;
|
||||
}
|
||||
|
||||
public void setTotalGameServers(int totalGameServers) {
|
||||
this.totalGameServers = totalGameServers;
|
||||
}
|
||||
|
||||
public int getTotalPlanetServers() {
|
||||
return totalPlanetServers;
|
||||
}
|
||||
|
||||
public void setTotalPlanetServers(int totalPlanetServers) {
|
||||
this.totalPlanetServers = totalPlanetServers;
|
||||
}
|
||||
|
||||
public int getTotalTutorialSceneCount() {
|
||||
return totalTutorialSceneCount;
|
||||
}
|
||||
|
||||
public void setTotalTutorialSceneCount(int totalTutorialSceneCount) {
|
||||
this.totalTutorialSceneCount = totalTutorialSceneCount;
|
||||
}
|
||||
|
||||
public long getLastLoadingStateTime() {
|
||||
return lastLoadingStateTime;
|
||||
}
|
||||
|
||||
public void setLastLoadingStateTime(long lastLoadingStateTime) {
|
||||
this.lastLoadingStateTime = lastLoadingStateTime;
|
||||
}
|
||||
|
||||
public long getClusterStartupTime() {
|
||||
return clusterStartupTime;
|
||||
}
|
||||
|
||||
public void setClusterStartupTime(long clusterStartupTime) {
|
||||
this.clusterStartupTime = clusterStartupTime;
|
||||
}
|
||||
|
||||
public long getTimeClusterWentIntoLoadingState() {
|
||||
return timeClusterWentIntoLoadingState;
|
||||
}
|
||||
|
||||
public void setTimeClusterWentIntoLoadingState(long timeClusterWentIntoLoadingState) {
|
||||
this.timeClusterWentIntoLoadingState = timeClusterWentIntoLoadingState;
|
||||
}
|
||||
|
||||
public int getWebUpdateIntervalSeconds() {
|
||||
return webUpdateIntervalSeconds;
|
||||
}
|
||||
|
||||
public void setWebUpdateIntervalSeconds(int webUpdateIntervalSeconds) {
|
||||
this.webUpdateIntervalSeconds = webUpdateIntervalSeconds;
|
||||
}
|
||||
|
||||
public long getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
public void setLastUpdateTime(long lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
|
||||
public String getSecretKey() {
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
public void setSecretKey(String secretKey) {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package swg.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "PLAYERS")
|
||||
public class Player {
|
||||
@Column(name = "CHARACTER_OBJECT")
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long objectId;
|
||||
|
||||
@Column(name = "STATION_ID", nullable = true, length =38)
|
||||
private Long stationId;
|
||||
|
||||
@Column(name = "UC_CHARACTER_NAME", nullable = true, length = 127)
|
||||
private String characterName;
|
||||
|
||||
@Column(name = "CHARACTER_FULL_NAME", nullable = true, length = 127)
|
||||
private String characterFullName;
|
||||
|
||||
@Column(name = "CREATE_TIME", nullable = true)
|
||||
private Date createTime;
|
||||
|
||||
@Column(name = "LAST_LOGIN_TIME", nullable = true)
|
||||
private Date lastLoginTime;
|
||||
|
||||
@OneToMany(mappedBy = "objectId")
|
||||
private List<PropertyList> propertyLists;
|
||||
|
||||
protected Player() {
|
||||
}
|
||||
|
||||
public Long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(Long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public Long getStationId() {
|
||||
return stationId;
|
||||
}
|
||||
|
||||
public void setStationId(Long stationId) {
|
||||
this.stationId = stationId;
|
||||
}
|
||||
|
||||
public String getCharacterName() {
|
||||
return characterName;
|
||||
}
|
||||
|
||||
public void setCharacterName(String characterName) {
|
||||
this.characterName = characterName;
|
||||
}
|
||||
|
||||
public String getCharacterFullName() {
|
||||
return characterFullName;
|
||||
}
|
||||
|
||||
public void setCharacterFullName(String characterFullName) {
|
||||
this.characterFullName = characterFullName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getLastLoginTime() {
|
||||
return lastLoginTime;
|
||||
}
|
||||
|
||||
public void setLastLoginTime(Date lastLoginTime) {
|
||||
this.lastLoginTime = lastLoginTime;
|
||||
}
|
||||
|
||||
public List<PropertyList> getPropertyList() {
|
||||
return propertyLists;
|
||||
}
|
||||
|
||||
public void setPropertyList(List<PropertyList> propertyLists) {
|
||||
this.propertyLists = propertyLists;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package swg.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
class PropertyListCompositeKey implements Serializable {
|
||||
private Long objectId;
|
||||
private Long listId;
|
||||
private String value;
|
||||
}
|
||||
|
||||
@Entity
|
||||
@Table(name = "PROPERTY_LISTS")
|
||||
@IdClass(PropertyListCompositeKey.class)
|
||||
public class PropertyList {
|
||||
@Id
|
||||
@Column(name = "OBJECT_ID", nullable = false, length = 20)
|
||||
private Long objectId;
|
||||
|
||||
@Id
|
||||
@Column(name = "LIST_ID", nullable = false, length = 38)
|
||||
private Long listId;
|
||||
|
||||
@Id
|
||||
@Column(name = "VALUE", nullable = false, length = 500)
|
||||
private String value;
|
||||
|
||||
protected PropertyList() {
|
||||
}
|
||||
|
||||
public Long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(Long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public Long getListId() {
|
||||
return listId;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following are valid List ID's:
|
||||
*
|
||||
* LI_Commands=0,
|
||||
* LI_DraftSchematics=1,
|
||||
* // removed: LI_PvpEnemies=2,
|
||||
* LI_Allowed=3,
|
||||
* LI_Banned=4,
|
||||
* LI_GuildNames=5,
|
||||
* LI_GuildAbbrevs=6,
|
||||
* LI_GuildMembers=7,
|
||||
* LI_GuildEnemies=8,
|
||||
* LI_GuildLeaders=10,
|
||||
* LI_Skills=11,
|
||||
* LI_Cities=12,
|
||||
* LI_Citizens=13,
|
||||
* LI_CityStructures=14
|
||||
*
|
||||
*/
|
||||
public void setListId(Long listId) {
|
||||
this.listId = listId;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package swg.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "RESOURCE_TYPES")
|
||||
public class ResourceType {
|
||||
@Column(name = "RESOURCE_ID")
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long resourceId;
|
||||
|
||||
@Column(name = "RESOURCE_NAME", nullable = true, length = 100)
|
||||
private String resourceName;
|
||||
|
||||
@Column(name = "RESOURCE_CLASS", nullable = true, length = 100)
|
||||
private String resourceClass;
|
||||
|
||||
@Column(name = "ATTRIBUTES", nullable = true, length = 1024)
|
||||
private String attributes;
|
||||
|
||||
@Column(name = "FRACTAL_SEEDS", nullable = true, length = 1024)
|
||||
private String fractalSeeds;
|
||||
|
||||
@Column(name = "DEPLETED_TIMESTAMP", nullable = true, length = 38)
|
||||
private Long depletedTimestamp;
|
||||
|
||||
protected ResourceType() {
|
||||
}
|
||||
|
||||
public Long getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(Long resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getResourceClass() {
|
||||
return resourceClass;
|
||||
}
|
||||
|
||||
public void setResourceClass(String resourceClass) {
|
||||
this.resourceClass = resourceClass;
|
||||
}
|
||||
|
||||
public String getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
public void setAttributes(String attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public String getFractalSeeds() {
|
||||
return fractalSeeds;
|
||||
}
|
||||
|
||||
public void setFractalSeeds(String fractalSeeds) {
|
||||
this.fractalSeeds = fractalSeeds;
|
||||
}
|
||||
|
||||
public Long getDepletedTimestamp() {
|
||||
return depletedTimestamp;
|
||||
}
|
||||
|
||||
public void setDepletedTimestamp(Long depletedTimestamp) {
|
||||
this.depletedTimestamp = depletedTimestamp;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
package swg.service;
|
||||
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import swg.dao.CityObjectDao;
|
||||
import swg.dao.PropertyListDao;
|
||||
import swg.entity.CityObject;
|
||||
import swg.entity.PropertyList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class CityObjectService {
|
||||
@Autowired
|
||||
CityObjectDao cityObjectDao;
|
||||
|
||||
public List<CityObject> getAllCityObjects() { return this.cityObjectDao.findAll(); }
|
||||
public CityObject getCityObjectByObjectId(Long objectId) {
|
||||
return this.cityObjectDao.findByObjectId(objectId);
|
||||
}
|
||||
public CityObject getCityObjectByCityName(String name) {
|
||||
List<CityObject> cobs = getAllCityObjects();
|
||||
for (CityObject cob : cobs) {
|
||||
Optional<PropertyList> pl = cob.getPropertyLists().stream().filter(p -> p.getListId() == 12).findAny();
|
||||
if(pl.isPresent()) {
|
||||
PropertyList p = pl.get();
|
||||
if(p.getValue().split(":")[2].equals(name)) {
|
||||
return cob;
|
||||
}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package swg.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import swg.dao.PlayerDao;
|
||||
import swg.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PlayerService {
|
||||
@Autowired
|
||||
PlayerDao playerDao;
|
||||
|
||||
public List<Player> getAllPlayers() {
|
||||
return this.playerDao.findAll();
|
||||
}
|
||||
|
||||
public List<Player> getAllPlayersByStationId(Long stationId) {
|
||||
return this.playerDao.findByStationId(stationId);
|
||||
}
|
||||
|
||||
public Player getPlayerByObjectId(Long objectId) {
|
||||
return this.playerDao.findByObjectId(objectId);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package swg.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import swg.dao.PropertyListDao;
|
||||
import swg.dao.ResourceTypeDao;
|
||||
import swg.entity.PropertyList;
|
||||
import swg.entity.ResourceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PropertyListService {
|
||||
@Autowired
|
||||
PropertyListDao propertyListDao;
|
||||
|
||||
public List<PropertyList> getAllPropertyLists() { return this.propertyListDao.findAll(); }
|
||||
public List<PropertyList> getPropertyListsByObjectId(Long objectId) {
|
||||
return this.propertyListDao.findByObjectId(objectId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package swg.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import swg.entity.ActiveResource;
|
||||
import swg.dao.ResourceTypeDao;
|
||||
import swg.entity.ResourceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ResourceTypeService {
|
||||
@Autowired
|
||||
ResourceTypeDao resourceTypeDao;
|
||||
|
||||
public List<ResourceType> getAllResources() {
|
||||
return this.resourceTypeDao.findAll();
|
||||
}
|
||||
public List<ActiveResource> getSpawnedResources() {
|
||||
return this.resourceTypeDao.findAllSpawned();
|
||||
}
|
||||
}
|
||||
@@ -8,3 +8,6 @@ spring.datasource.password=swg
|
||||
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
|
||||
## this shows the sql actions in the terminal logs
|
||||
spring.jpa.show-sql=true
|
||||
spring.application.name=swg-api
|
||||
spring.config.import=optional:swg-defaults.yml,optional:file:./swg-local.yml
|
||||
swg.log.config.path=./exe/linux/
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
centralServer:
|
||||
auctionEnabled: true
|
||||
developmentMode: true
|
||||
clusterName: swg
|
||||
loggingEnabled: false
|
||||
metricsDataURL: http://localhost:8080/api/metrics
|
||||
newbieTutorialEnabled: true
|
||||
webUpdateIntervalSeconds: 10
|
||||
startPlanet:
|
||||
- name: corellia
|
||||
active: true
|
||||
- name: dantooine
|
||||
active: true
|
||||
- name: dathomir
|
||||
active: true
|
||||
- name: endor
|
||||
active: true
|
||||
- name: lok
|
||||
active: true
|
||||
- name: kashyyyk_dead_forest
|
||||
active: true
|
||||
- name: kashyyyk_hunting
|
||||
active: true
|
||||
- name: kashyyyk_main
|
||||
active: true
|
||||
- name: kashyyyk_north_dungeons
|
||||
active: true
|
||||
- name: kashyyyk_pob_dungeons
|
||||
active: true
|
||||
- name: kashyyyk_rryatt_trail
|
||||
active: true
|
||||
- name: kashyyyk_south_dungeons
|
||||
active: true
|
||||
- name: mustafar
|
||||
active: true
|
||||
- name: naboo
|
||||
active: true
|
||||
- name: rori
|
||||
active: true
|
||||
- name: talus
|
||||
active: true
|
||||
- name: tatooine
|
||||
active: true
|
||||
- name: yavin4
|
||||
active: true
|
||||
- name: space_heavy1
|
||||
active: true
|
||||
- name: space_light1
|
||||
active: true
|
||||
- name: tutorial
|
||||
active: true
|
||||
- name: dungeon1
|
||||
active: true
|
||||
- name: adventure1
|
||||
active: true
|
||||
- name: adventure2
|
||||
active: true
|
||||
- name: space_npe_falcon
|
||||
active: true
|
||||
- name: space_npe_falcon_2
|
||||
active: true
|
||||
- name: space_npe_falcon_3
|
||||
active: true
|
||||
- name: space_ord_mantell
|
||||
active: true
|
||||
- name: space_corellia
|
||||
active: true
|
||||
- name: space_naboo
|
||||
active: true
|
||||
- name: space_tatooine
|
||||
active: true
|
||||
- name: space_lok
|
||||
active: true
|
||||
- name: space_dantooine
|
||||
active: true
|
||||
- name: space_dathomir
|
||||
active: true
|
||||
- name: space_yavin4
|
||||
active: true
|
||||
- name: space_endor
|
||||
active: true
|
||||
- name: space_nova_orion
|
||||
active: true
|
||||
- name: space_kashyyyk
|
||||
active: true
|
||||
serverMetrics:
|
||||
metricsServerPort: 0
|
||||
chatServer:
|
||||
centralServerAddress: 127.0.0.1
|
||||
clusterName: swg
|
||||
gatewayServerIP: 127.0.0.1
|
||||
gatewayServerPort: 5001
|
||||
loggingEnabled: true
|
||||
registrarHost: 127.0.0.1
|
||||
registrarPort: 5000
|
||||
commodityServer:
|
||||
developmentMode: true
|
||||
maxAuctionsPerPlayer: 25
|
||||
minutesActiveToUnaccessed: 43200
|
||||
minutesBazaarAuctionTimer: 10080
|
||||
minutesBazaarItemTimer: 10080
|
||||
minutesEmptyToEndangered: 21600
|
||||
minutesUnaccessedToEndangered: 7200
|
||||
minutesEndangeredToRemoved: 21600
|
||||
minutesVendorAuctionTimer: 43200
|
||||
minutesVendorItemTimer: 43200
|
||||
planetServer:
|
||||
loadWholePlanet: true
|
||||
loadWholePlanetMultiserver: false
|
||||
numTutorialServers: 1
|
||||
connectionServer:
|
||||
adminAccountDataTable: datatables/admin/stella_admin.iff
|
||||
pingPort: 44462
|
||||
customerServiceBindInterface: eth0
|
||||
chatServiceBindInterface: eth0
|
||||
disableWorldSnapshot: false
|
||||
validateClientVersion: false
|
||||
validateStationKey: false
|
||||
clientOverflowLimit: 5242880
|
||||
loginServer:
|
||||
validateClientVersion: true
|
||||
validateStationKey: false
|
||||
easyExternalAccess: false
|
||||
scriptFlags:
|
||||
liveSpaceServer: true
|
||||
spawnersOn: true
|
||||
npeSequencersActive: true
|
||||
quest:
|
||||
craftingContract: true
|
||||
crowdPleaser: true
|
||||
communityCraftingLimit: 200
|
||||
bestineEvents:
|
||||
politicianEventDuration: 2592000
|
||||
museumEventDuration: 1209600
|
||||
sharedLog:
|
||||
logTarget: net:127.0.0.1:44467
|
||||
sharedNetwork:
|
||||
oldestUnacknowledgedTimeout: 0
|
||||
noDataTimeout: 1000000
|
||||
sharedFoundation:
|
||||
frameRateLimit: 10.0
|
||||
fatalCallStackDepth: 10
|
||||
warningCallStackDepth: -1
|
||||
dungeon:
|
||||
deathWatch: true
|
||||
corellianCorvetteNeutral: true
|
||||
corellianCorvetteImperial: true
|
||||
corellianCorvetteRebel: true
|
||||
serverSwitch: true
|
||||
geonosian: true
|
||||
eventTeam:
|
||||
gcwRaid: true
|
||||
forceFoolsDay: false
|
||||
anniversary: true
|
||||
restussEvent: false
|
||||
restussPhase: 2
|
||||
restussProgressionOn: true
|
||||
gameServer:
|
||||
adminAccountDataTable: "datatables/admin/stella_admin.iff"
|
||||
adminGodToAll: true
|
||||
adminGodToAllGodLevel: 50
|
||||
adminPersistAllCreates: false
|
||||
aiAssistRadius: 12.0
|
||||
aiBaseAggroRadius: 24.0
|
||||
aiClientDebugEnabled: false
|
||||
aiLeashRadius: 256.0
|
||||
aiMaxAggroRadius: 96.0
|
||||
armorDamageReduction: 80.0
|
||||
buddyPointTimeBonus: 7.5
|
||||
buildoutAreaEditingEnabled: false
|
||||
cityCitizenshipInactivePackupInactiveTimeSeconds: 7776000
|
||||
commoditiesShowAllDebugInfo: false
|
||||
craftingXpChance: 50
|
||||
deactivateHarvesterIfDamaged: true
|
||||
defaultActionRegen: 20.0
|
||||
defaultAutoExpireTargetDuration: 6
|
||||
defaultHealthRegen: 40.0
|
||||
disableMissions: false
|
||||
disableTravel: false
|
||||
enableNewVeteranRewards: true
|
||||
enableOneYearAnniversary: true
|
||||
gcwDaysRequiredForGcwRegionDefenderBonus: 3
|
||||
gcwFactionalPresenceAlignedCityAgeBonusPct: 5
|
||||
gcwFactionalPresenceAlignedCityBonusPct: 100
|
||||
gcwFactionalPresenceAlignedCityRankBonusPct: 10
|
||||
gcwFactionalPresenceGcwRankBonusPct: 10
|
||||
gcwFactionalPresenceLevelPct: 10
|
||||
gcwFactionalPresenceMountedPct: 20
|
||||
gcwGuildMinMembersForGcwRegionDefender: 10
|
||||
gcwRecalcTimeDayOfWeek: 4
|
||||
gcwRecalcTimeHour: 19
|
||||
gcwRecalcTimeMinute: 0
|
||||
gcwRecalcTimeSecond: 0
|
||||
gcwRegionDefenderTotalBonusPct: 20
|
||||
gcwScoreDecayTimeDayOfWeek: 1
|
||||
gcwScoreDecayTimeHour: 19
|
||||
gcwScoreDecayTimeMinute: 0
|
||||
gcwScoreDecayTimeSecond: 0
|
||||
gcwXpBonus: 15.0
|
||||
houseItemLimitMultiplier: 100
|
||||
maxCombatRange: 96.0
|
||||
maxGalacticReserveDepositBillion: 3
|
||||
maxHouseItemLimit: 500
|
||||
maxLotsPerAccount: 165
|
||||
maxMoney: 1000000000
|
||||
maxMoneyTransfer: 100000000
|
||||
maxReimburseAmount: 0
|
||||
pvpDisableCombat: false
|
||||
pvpGuildWarCoolDownPeriodTimeMs: 60000
|
||||
reportAiWarnings: false
|
||||
resourceTimeScale: 86400
|
||||
secondsPerResourceTick: 60
|
||||
shipsEnabled: true
|
||||
unclaimedAuctionItemDestroyTimeSec: 2592000
|
||||
veteranRewardTradeInWaitPeriodSeconds: 2592000
|
||||
weatherUpdateSeconds: 900
|
||||
debugMode: 1
|
||||
serverLoadLevel: heavy
|
||||
idleLogoutTimeSec: 300
|
||||
suiListLimit: 50
|
||||
createZoneObjects: true
|
||||
centralServerAddress: localhost
|
||||
javaConsoleDebugMessages: false
|
||||
javaEngineProfiling: false
|
||||
javaVMName: sun
|
||||
javaOptions:
|
||||
- -Xoss4096k
|
||||
- -Xss4096k
|
||||
maxGoldNetworkId: 10000000
|
||||
nameValidationAcceptAll: true
|
||||
scriptWatcherWarnTime: 5000
|
||||
scriptWatcherInterruptTime: 0
|
||||
commoditiesMarketEnabled: true
|
||||
createAppearances: true
|
||||
fatalOnGoldPobChange: false
|
||||
# allowMasterObjectCreation: false
|
||||
reservedObjectIds: 1000000
|
||||
enablePreload: false
|
||||
allowPlayersToPackVendors: true
|
||||
manufactureTimeOverride: 0.0
|
||||
disableResources: false
|
||||
spawnAllResources: true
|
||||
grantGift: true
|
||||
maxSocketSkillModBonus: 999
|
||||
maxObjectSkillModBonus: 999
|
||||
maxItemAttribBonus: 500
|
||||
maxTotalAttribBonus: 2000
|
||||
aiLoggingEnabled: false
|
||||
serverSpawnLimit: 60000
|
||||
disableAreaSpawners: false
|
||||
disablePatrolSpawners: false
|
||||
harvesterExtractionRateMultiplier: 5.0
|
||||
enableVeteranRewards: true
|
||||
veteranDebugTriggerAll: true
|
||||
veteranDebugEnableOverrideAccountAge: false
|
||||
flashSpeederReward: true
|
||||
combatUpgradeReward: 2
|
||||
lifeday: false
|
||||
loveday: false
|
||||
deleteEventProps: false
|
||||
halloween: false
|
||||
foolsDay: false
|
||||
empireday_ceremony: false
|
||||
enableCovertImperialMercenary: true
|
||||
enableOvertImperialMercenary: true
|
||||
enableCovertRebelMercenary: true
|
||||
enableOvertRebelMercenary: true
|
||||
hibernateDistance: 65.0
|
||||
hibernateEnabled: true
|
||||
hibernateProxies: true
|
||||
gcwCityKeren: true
|
||||
gcwCityBestine: true
|
||||
gcwCityDearic: true
|
||||
gcwInvasionCityMaximumRunning: 1
|
||||
gcwInvasionCycleTime: 1
|
||||
mountsEnabled: true
|
||||
sendBreadcrumbs: true
|
||||
sendPlayerTransform: true
|
||||
xpMultiplier: 3
|
||||
chroniclesXpModifier: 1.0
|
||||
chroniclesQuestorGoldTokenChanceOverride: 15
|
||||
chroniclesChroniclerGoldTokenChanceOverride: 15
|
||||
chroniclesChroniclerSilverTokenNumModifier: 2.0
|
||||
chroniclesQuestorSilverTokenNumModifier: 2.0
|
||||
gcwPointBonus: 5.0
|
||||
gcwTokenBonus: 5.0
|
||||
triggerVolumeSystem: 2
|
||||
characterBuilder:
|
||||
builderEnabled: true
|
||||
devEnabled: true
|
||||
weaponsEnabled: true
|
||||
armorEnabled: true
|
||||
skillsEnabled: true
|
||||
commandsEnabled: true
|
||||
resourcesEnabled: true
|
||||
creditsEnabled: true
|
||||
factionEnabled: true
|
||||
vehiclesEnabled: true
|
||||
shipsEnabled: true
|
||||
craftingEnabled: true
|
||||
deedsEnabled: true
|
||||
pahallEnabled: true
|
||||
miscitemEnabled: true
|
||||
jediEnabled: true
|
||||
BestResourcesEnabled: true
|
||||
HeroicFlagEnabled: true
|
||||
DraftSchematicsEnabled: true
|
||||
buffsEnabled: true
|
||||
warpsEnabled: true
|
||||
questEnabled: true
|
||||
petsEnabled: true
|
||||
itvMinUsageLevel: 0
|
||||
custom:
|
||||
reverseEngineeringBonusMultiplier: 1.0
|
||||
dailyMissionXpLimit: 10
|
||||
grantElderBuff: 1
|
||||
Reference in New Issue
Block a user