Merge branch 'master' into threading-rework-1
This commit is contained in:
commit
ad556e3553
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,3 +26,4 @@
|
|||||||
|
|
||||||
#docs backup files
|
#docs backup files
|
||||||
/docs/~$NetworkFlow.drawio.bkp
|
/docs/~$NetworkFlow.drawio.bkp
|
||||||
|
/docs/~$NetworkFlow.drawio.dtmp
|
||||||
|
|||||||
@ -57,7 +57,8 @@
|
|||||||
"TARGETABLE",
|
"TARGETABLE",
|
||||||
"CAN_EQUIP",
|
"CAN_EQUIP",
|
||||||
"INVENTORY",
|
"INVENTORY",
|
||||||
"OUTLINE"
|
"OUTLINE",
|
||||||
|
"PLAYABLE"
|
||||||
],
|
],
|
||||||
"visualAttributes" : [
|
"visualAttributes" : [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -66,6 +66,12 @@ public class Config {
|
|||||||
type.setAttackMoveResolver(new AttackMoveResolver(type.getAttackMoves()));
|
type.setAttackMoveResolver(new AttackMoveResolver(type.getAttackMoves()));
|
||||||
}
|
}
|
||||||
loader.putCreature(type.getCreatureId(), type);
|
loader.putCreature(type.getCreatureId(), type);
|
||||||
|
//loop through all creatures and add ones with PLAYABLE token to list of playable races
|
||||||
|
for(String token : type.getTokens()){
|
||||||
|
if(token.contains("PLAYABLE")){
|
||||||
|
loader.putPlayableRace(type.getCreatureId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,31 @@
|
|||||||
package electrosphere.game.data.creature.type;
|
package electrosphere.game.data.creature.type;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CreatureTypeLoader {
|
public class CreatureTypeLoader {
|
||||||
|
|
||||||
Map<String,CreatureType> creatureMap = new HashMap<String,CreatureType>();
|
Map<String,CreatureType> creatureMap = new HashMap<String,CreatureType>();
|
||||||
|
|
||||||
|
List<String> playableRaceNames = new LinkedList<String>();
|
||||||
|
|
||||||
public void putCreature(String name, CreatureType type){
|
public void putCreature(String name, CreatureType type){
|
||||||
creatureMap.put(name,type);
|
creatureMap.put(name,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void putPlayableRace(String name){
|
||||||
|
playableRaceNames.add(name);
|
||||||
|
}
|
||||||
|
|
||||||
public CreatureType getCreature(String name){
|
public CreatureType getCreature(String name){
|
||||||
return creatureMap.get(name);
|
return creatureMap.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getPlayableRaces(){
|
||||||
|
return playableRaceNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
package electrosphere.net.server.protocol;
|
package electrosphere.net.server.protocol;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import electrosphere.main.Globals;
|
||||||
import electrosphere.net.parser.net.message.LoreMessage;
|
import electrosphere.net.parser.net.message.LoreMessage;
|
||||||
import electrosphere.net.server.ServerConnectionHandler;
|
import electrosphere.net.server.ServerConnectionHandler;
|
||||||
|
import electrosphere.util.Utilities;
|
||||||
|
|
||||||
public class LoreProtocol {
|
public class LoreProtocol {
|
||||||
|
|
||||||
@ -14,7 +18,9 @@ public class LoreProtocol {
|
|||||||
//TODO
|
//TODO
|
||||||
break;
|
break;
|
||||||
case REQUESTRACES:
|
case REQUESTRACES:
|
||||||
//TODO
|
List<String> playableRaces = Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces();
|
||||||
|
String returnData = Utilities.stringify(playableRaces);
|
||||||
|
connectionHandler.addMessagetoOutgoingQueue(LoreMessage.constructResponseRacesMessage(returnData));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPONSEDATA:
|
case RESPONSEDATA:
|
||||||
|
|||||||
@ -37,7 +37,11 @@ import static org.lwjgl.opengl.GL30.glGenVertexArrays;
|
|||||||
*/
|
*/
|
||||||
public class Utilities {
|
public class Utilities {
|
||||||
|
|
||||||
|
static {
|
||||||
|
gson = new Gson();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Gson gson;
|
||||||
|
|
||||||
public static Matrix4f convertAIMatrix(AIMatrix4x4 mat){
|
public static Matrix4f convertAIMatrix(AIMatrix4x4 mat){
|
||||||
Matrix4f rVal = new Matrix4f();
|
Matrix4f rVal = new Matrix4f();
|
||||||
@ -120,4 +124,9 @@ public class Utilities {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String stringify(Object object){
|
||||||
|
return gson.toJson(object);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user