Skip to content

Commit

Permalink
Merge branch 'release-0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Oct 6, 2014
2 parents ab25ce0 + cd18b44 commit 49dca66
Show file tree
Hide file tree
Showing 153 changed files with 4,173 additions and 1,594 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ nbactions.xml

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

/*.iml
*.iml

## Directory-based project format:
.idea/
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ deploy:
api-key:
secure: "CJyVgIoL/G0a233WuqPi14eOAk8JlWdErxqbJZYawGmCt5CBJW9l5+4CO4mJqho+EKHmpr+OgGVFq5HV4zQVqVJNFhL86yEucY52v3uQqqT26UmyJwLEtNOpHzVw0pXKvE5LbBOQdl+/8nNhakd6VwGE3qs05F+0ZYyu9LXaal4="
file:
- "target/cardshifter-fx-0.2.jar"
- "target/cardshifter-server-0.2.jar"
- "target/cardshifter-fx-0.3.jar"
- "target/cardshifter-server-0.3.jar"
skip_cleanup: true
on:
tags: true
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,23 @@ We would like everyone to follow the following guidelines:
Platform
--------

Currently we plan to support version Java 8u20 and above.
Currently we plan to support version Java 8u20 and above.

Playing the game
----------------

To play the game, [download the latest release](https://github.com/Cardshifter/Cardshifter/releases). Start the client jar using `java -jar cardshifter-fx-<version>.jar`.

There is a server running at `dwarftowers.com` port `4242` that you may connect to.

Develop another client
----------------------

If you want to help develop another client, [download the latest server release](https://github.com/Cardshifter/Cardshifter/releases). Start the server using `java -jar cardshifter-server-<version>.jar`.

All messages sent between client and server are using JSON format. The available messages can be found [here](https://github.com/Cardshifter/Cardshifter/tree/client-server/cardshifter-api/src/main/java/com/cardshifter/api).

For example, to send a [`LoginMessage`](https://github.com/Cardshifter/Cardshifter/blob/client-server/cardshifter-api/src/main/java/com/cardshifter/api/incoming/LoginMessage.java) pass the following JSON: `{ "command": "login", "username": "example" }`.

To send a request for starting a game, use [`StartGameRequest`](https://github.com/Cardshifter/Cardshifter/blob/client-server/cardshifter-api/src/main/java/com/cardshifter/api/incoming/StartGameRequest.java) which can be sent as JSON like this: `{ "command": "startgame", "opponent": 1, "gameType": "VANILLA" }` (currently "VANILLA" is the only supported game type).

11 changes: 10 additions & 1 deletion cardshifter-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.cardshifter</groupId>
<artifactId>cardshifter</artifactId>
<version>0.2</version>
<version>0.3</version>
</parent>

<artifactId>cardshifter-api</artifactId>
Expand All @@ -23,6 +23,15 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.cardshifter.api;

public class CardshifterConstants {

public static final String VANILLA = "VANILLA";

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.cardshifter.server.abstr;
package com.cardshifter.api.abstr;



Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cardshifter.server.abstr;
package com.cardshifter.api.abstr;

import com.cardshifter.server.messages.Message;
import com.cardshifter.api.messages.Message;


public abstract class RequestMessage extends Message {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.cardshifter.api.both;

import com.cardshifter.api.messages.Message;
import com.fasterxml.jackson.annotation.JsonCreator;


public class ChatMessage extends Message {

private final int chatId;
private final String message;
private final String from;

@JsonCreator
ChatMessage() {
this(0, "", "");
}

public ChatMessage(int chatId, String from, String message) {
super("chat");
this.chatId = chatId;
this.from = from;
this.message = message;
}

public int getChatId() {
return chatId;
}

public String getFrom() {
return from;
}

public String getMessage() {
return message;
}

@Override
public String toString() {
return "ChatMessage [chatId=" + chatId + ", message=" + message
+ ", from=" + from + "]";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.cardshifter.api.both;

import com.cardshifter.api.messages.Message;

public class InviteRequest extends Message {

private final int id;
private final String name;

InviteRequest() {
this(0, "");
}
public InviteRequest(int id, String name) {
super("inviteRequest");
this.id = id;
this.name = name;
}

public int getId() {
return id;
}

public String getName() {
return name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.cardshifter.api.both;

import com.cardshifter.api.messages.Message;

public class InviteResponse extends Message {

private final int inviteId;
private final boolean accepted;

InviteResponse() {
this(0, false);
}

public InviteResponse(int inviteId, boolean accepted) {
super("inviteResponse");
this.inviteId = inviteId;
this.accepted = accepted;
}

public int getInviteId() {
return inviteId;
}

public boolean isAccepted() {
return accepted;
}

}
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
package com.cardshifter.server.incoming;
package com.cardshifter.api.incoming;

import com.cardshifter.server.messages.Message;
import com.cardshifter.api.messages.Message;

public class LoginMessage extends Message {

private String username;
private final String username;

LoginMessage() {
super("login");
this("");
}

public LoginMessage(String username) {
this();
super("login");
this.username = username;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cardshifter.server.incoming;
package com.cardshifter.api.incoming;

import com.cardshifter.server.messages.Message;
import com.cardshifter.api.messages.Message;
import com.fasterxml.jackson.annotation.JsonProperty;

public class RequestTargetsMessage extends Message {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.cardshifter.api.incoming;

import com.cardshifter.api.messages.Message;

public class ServerQueryMessage extends Message {

public enum Request {
USERS;
}

private final Request request;

ServerQueryMessage() {
this(Request.USERS);
}
public ServerQueryMessage(Request request) {
super("query");
this.request = request;
}

public Request getRequest() {
return request;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.cardshifter.api.incoming;

import com.cardshifter.api.messages.Message;
import com.fasterxml.jackson.annotation.JsonCreator;

public class StartGameRequest extends Message {

private final int opponent;
private final String gameType;

@JsonCreator
StartGameRequest() {
this(-1, "");
}

public StartGameRequest(int opponent, String gameType) {
super("startgame");
this.opponent = opponent;
this.gameType = gameType;
}

public int getOpponent() {
return opponent;
}

public String getGameType() {
return gameType;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.cardshifter.api.incoming;

import java.util.Arrays;

import com.cardshifter.api.abstr.CardMessage;
import com.fasterxml.jackson.annotation.JsonCreator;


public class UseAbilityMessage extends CardMessage {

private final int id;
private final String action;
private final int gameId;
private final int[] targets;

@JsonCreator
UseAbilityMessage() {
this(0, 0, "", new int[]{});
}
public UseAbilityMessage(int gameId, int id, String action, int[] targets) {
super("use");
this.id = id;
this.action = action;
this.gameId = gameId;
this.targets = Arrays.copyOf(targets, targets.length);
}

public UseAbilityMessage(int gameid, int entity, String action, int target) {
this(gameid, entity, action, new int[]{ target });
}

public String getAction() {
return action;
}

public int getId() {
return id;
}

public int getGameId() {
return gameId;
}

public int[] getTargets() {
return Arrays.copyOf(targets, targets.length);
}

@Override
public String toString() {
return "UseAbilityMessage [id=" + id + ", action=" + action
+ ", gameId=" + gameId + ", targets=" + Arrays.toString(targets) + "]";
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.cardshifter.server.messages;
package com.cardshifter.api.messages;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
Expand Down

0 comments on commit 49dca66

Please sign in to comment.