Multiplayer minigames started
This commit is contained in:
parent
efce5e9c11
commit
334e098dba
@ -5,6 +5,9 @@ import com.alterdekim.game.component.game.friends.OneFR;
|
|||||||
import com.alterdekim.game.component.game.friends.UserFriend;
|
import com.alterdekim.game.component.game.friends.UserFriend;
|
||||||
import com.alterdekim.game.component.game.inventory.BuyGoodResult;
|
import com.alterdekim.game.component.game.inventory.BuyGoodResult;
|
||||||
import com.alterdekim.game.component.game.inventory.BuyGoodResultGood;
|
import com.alterdekim.game.component.game.inventory.BuyGoodResultGood;
|
||||||
|
import com.alterdekim.game.component.game.minigame.MiniGameAction;
|
||||||
|
import com.alterdekim.game.component.game.minigame.MultiplayerMinigameLaunch;
|
||||||
|
import com.alterdekim.game.component.game.minigame.MultiplayerMinigameWaiting;
|
||||||
import com.alterdekim.game.component.game.response.init.GetUserInfo;
|
import com.alterdekim.game.component.game.response.init.GetUserInfo;
|
||||||
import com.alterdekim.game.component.game.response.location.AddUserToLocation;
|
import com.alterdekim.game.component.game.response.location.AddUserToLocation;
|
||||||
import com.alterdekim.game.component.rtmp.ConnectedProcessor;
|
import com.alterdekim.game.component.rtmp.ConnectedProcessor;
|
||||||
@ -274,6 +277,26 @@ public class GameServer {
|
|||||||
case SendGameClose, GameStatistics -> {
|
case SendGameClose, GameStatistics -> {
|
||||||
this.sendResult(playerId, message.getTransactionId(), "0");
|
this.sendResult(playerId, message.getTransactionId(), "0");
|
||||||
}
|
}
|
||||||
|
case RegisterGameWaiting -> {
|
||||||
|
Map<String, List<MultiplayerMinigameWaiting.Players>> m = new HashMap<>();
|
||||||
|
List<MultiplayerMinigameWaiting.Players> players1 = new ArrayList<>();
|
||||||
|
players1.add(new MultiplayerMinigameWaiting.Players(2, "jerk"));
|
||||||
|
m.put("0", players1);
|
||||||
|
this.call(playerId, CommandType.UpdateRoomTeam, new MultiplayerMinigameWaiting(m, 1, false));
|
||||||
|
players1.add(new MultiplayerMinigameWaiting.Players(3, "dullard"));
|
||||||
|
m.put("0", players1);
|
||||||
|
this.call(playerId, CommandType.UpdateRoomTeam, new MultiplayerMinigameWaiting(m, 1, false));
|
||||||
|
|
||||||
|
this.call(playerId, CommandType.LaunchRoomSession, new MultiplayerMinigameLaunch(m, "222"));
|
||||||
|
|
||||||
|
this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("onAddUser", 1, "3"));
|
||||||
|
this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("DisplayAvatar", 1, "3"));
|
||||||
|
this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("onAddUser", 1, "2"));
|
||||||
|
this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("DisplayAvatar", 1, "2"));
|
||||||
|
log.info("Players: {}", players);
|
||||||
|
//this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("OnReady", 0, "2"));
|
||||||
|
//this.call(playerId, CommandType.MiniGameAction, new MiniGameAction("OnReady", 0, "3"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +306,7 @@ public class GameServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getGame(int playerId, long gameId, double transactionId) throws JsonProcessingException {
|
private void getGame(int playerId, long gameId, double transactionId) throws JsonProcessingException {
|
||||||
this.sendResult(playerId, transactionId, xmlMapper.writeValueAsString(miniGameService.findGameById(gameId).get()));
|
this.sendResult(playerId, transactionId, xmlMapper.writeValueAsString(miniGameService.findGameById(gameId).get()).replace("<", "<"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockSomething(int playerId, int what2Lock, Boolean state, UserMessage message) {
|
private void lockSomething(int playerId, int what2Lock, Boolean state, UserMessage message) {
|
||||||
|
@ -196,23 +196,23 @@ public class StartUpListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pushMiniGames() {
|
private void pushMiniGames() {
|
||||||
miniGameService.save(new MiniGame(0L, "Рентген", 0, 0, 4250, 1d, 2, true, true, false, 0L, 0L, "1", ""));
|
miniGameService.save(new MiniGame(0L, "Рентген", 0, 0, 4250, 1d, 2, true, true, false, 0L, 0L, "1", "", ""));
|
||||||
miniGameService.save(new MiniGame(1L, "Дары леса", 10120, 1291, 1749, 10d, 1, true, false, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(1L, "Дары леса", 10120, 1291, 1749, 10d, 1, true, false, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(2L, "Катер", 10089, 516, 4265, 100d, 1, true, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(2L, "Катер", 10089, 516, 4265, 100d, 1, true, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(3L, "Волейбол", 10087, 513, 301, 100d, 1, true, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(3L, "Волейбол", 10087, 513, 301, 100d, 1, true, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(4L, "Кафе", 10088, 515, 310, 1d, 0, true, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(4L, "Кафе", 10088, 515, 310, 1d, 0, true, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(5L, "Труба", 10084, 1104, 11763, 1d, 0, false, true, true, 0L, 0L, "1", ""));
|
miniGameService.save(new MiniGame(5L, "Труба", 10084, 1104, 11763, 1d, 0, false, true, true, 0L, 0L, "1", "", ""));
|
||||||
miniGameService.save(new MiniGame(6L, "Секретики", 10097, 806, 763, 1d, 0, true, false, true, 1000L, 10000L, "1", ""));
|
miniGameService.save(new MiniGame(6L, "Секретики", 10097, 806, 763, 1d, 0, true, false, true, 1000L, 10000L, "1", "", "<Groups><item ID=\"0\" MaxUsersCount=\"2\" MinUsersCount=\"2\" /></Groups>"));
|
||||||
miniGameService.save(new MiniGame(7L, "Смешарики", 10086, 510, 3126, 1d, 1, true, true, true, 1000L, 10000L, "0", ""));
|
miniGameService.save(new MiniGame(7L, "Смешарики", 10086, 510, 3126, 1d, 1, true, true, true, 1000L, 10000L, "0", "", "<Groups><item ID=\"0\" MaxUsersCount=\"2\" MinUsersCount=\"2\" /></Groups>"));
|
||||||
miniGameService.save(new MiniGame(8L, "Модельер", 10101, 948, 4300, 5d, 0, false, false, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(8L, "Модельер", 10101, 948, 4300, 5d, 0, false, false, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(9L, "Горки", 10095, 557, 341, 40d, 1, true, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(9L, "Горки", 10095, 557, 341, 40d, 1, true, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(10L, "Скачки", 10093, 518, 319, 1d, 0, true, true, true, 1000L, 10000L, "0", ""));
|
miniGameService.save(new MiniGame(10L, "Скачки", 10093, 518, 319, 1d, 0, true, true, true, 1000L, 10000L, "0", "", "<Groups><item ID=\"0\" MaxUsersCount=\"2\" MinUsersCount=\"2\" /></Groups>"));
|
||||||
miniGameService.save(new MiniGame(11L, "Футбол", 10112, 1212, 4247, 1d, 3, true, true, true, 1000L, 30000L, "0", ""));
|
miniGameService.save(new MiniGame(11L, "Футбол", 10112, 1212, 4247, 1d, 3, true, true, true, 1000L, 30000L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(12L, "Няня", 10083, 505, 4241, 30d, 0, false, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(12L, "Няня", 10083, 505, 4241, 30d, 0, false, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(13L, "Двигатель", 10094, 519, 322, 5d, 0, false, true, true, 0L, 0L, "0", ""));
|
miniGameService.save(new MiniGame(13L, "Двигатель", 10094, 519, 322, 5d, 0, false, true, true, 0L, 0L, "0", "", ""));
|
||||||
miniGameService.save(new MiniGame(14L, "Шарабудка", 8054, 3218, 1127, 1d, 0, false, true, true, 0L, 0L, "1", ""));
|
miniGameService.save(new MiniGame(14L, "Шарабудка", 8054, 3218, 1127, 1d, 0, false, true, true, 0L, 0L, "1", "", ""));
|
||||||
miniGameService.save(new MiniGame(92L, "Трасса", 0, 0, 4267, 1d, 1, false, false, true, 0L, 0L, "1", ""));
|
miniGameService.save(new MiniGame(92L, "Трасса", 0, 0, 4267, 1d, 1, false, false, true, 0L, 0L, "1", "", ""));
|
||||||
miniGameService.save(new MiniGame(206L, "Муравей", 2148, 2148, 3170, 1d, 0, true, false, true, 0L, 0L, "1", ""));
|
miniGameService.save(new MiniGame(206L, "Муравей", 2148, 2148, 3170, 1d, 0, true, false, true, 0L, 0L, "1", "", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushPhoneSkins() {
|
private void pushPhoneSkins() {
|
||||||
|
@ -21,6 +21,9 @@ public enum CommandType {
|
|||||||
AddNewPhoneMessage("_MP"),
|
AddNewPhoneMessage("_MP"),
|
||||||
CardMessage("_MC"),
|
CardMessage("_MC"),
|
||||||
UpdateTickets("_NNT"),
|
UpdateTickets("_NNT"),
|
||||||
|
UpdateRoomTeam("_GU"),
|
||||||
|
LaunchRoomSession("_GL"),
|
||||||
|
MiniGameAction("_G"),
|
||||||
Unknown("");
|
Unknown("");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
@ -43,6 +43,7 @@ public enum UserCommandType {
|
|||||||
GameScore("_GS"),
|
GameScore("_GS"),
|
||||||
SendGameClose("_GC"),
|
SendGameClose("_GC"),
|
||||||
GameStatistics("_GT"),
|
GameStatistics("_GT"),
|
||||||
|
RegisterGameWaiting("_GR"),
|
||||||
Unknown("");
|
Unknown("");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.alterdekim.game.component.game.minigame;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MiniGameAction {
|
||||||
|
private String actionName;
|
||||||
|
private Integer number;
|
||||||
|
private String id;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.alterdekim.game.component.game.minigame;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MultiplayerMinigameLaunch {
|
||||||
|
private Map<String, List<MultiplayerMinigameWaiting.Players>> players;
|
||||||
|
private String sessionDescriptor;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.alterdekim.game.component.game.minigame;
|
||||||
|
|
||||||
|
import com.alterdekim.game.message.amf.AMFKey;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MultiplayerMinigameWaiting {
|
||||||
|
private Map<String, List<Players>> players;
|
||||||
|
private Integer number;
|
||||||
|
private Boolean flag;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class Players {
|
||||||
|
@AMFKey(name = "ID")
|
||||||
|
private Integer id;
|
||||||
|
@AMFKey(name = "Name")
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Data
|
@Data
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ServerConfig {
|
public class ServerConfig {
|
||||||
|
@Value("${srv.oldMode}") private Boolean oldMode;
|
||||||
@Value("${srv.publicDomain}") private String publicDomain;
|
@Value("${srv.publicDomain}") private String publicDomain;
|
||||||
@Value("${srv.rtmpPort}") private Integer gameServerPort;
|
@Value("${srv.rtmpPort}") private Integer gameServerPort;
|
||||||
@Value("${srv.resPathSWF}") private String defaultResourcesPath;
|
@Value("${srv.resPathSWF}") private String defaultResourcesPath;
|
||||||
|
@ -22,30 +22,39 @@ public class LocationObjectInstance implements ApiResult {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "AObjectTypeId")
|
@JacksonXmlProperty(isAttribute = true, localName = "AObjectTypeId")
|
||||||
|
@Column(nullable = false)
|
||||||
private Integer objectTypeId;
|
private Integer objectTypeId;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "AObjectId")
|
@JacksonXmlProperty(isAttribute = true, localName = "AObjectId")
|
||||||
|
@Column(nullable = false)
|
||||||
private Integer objectId;
|
private Integer objectId;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "AObjectRefId")
|
@JacksonXmlProperty(isAttribute = true, localName = "AObjectRefId")
|
||||||
|
@Column(nullable = false)
|
||||||
private Integer objectReferenceId;
|
private Integer objectReferenceId;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "MediaResourceID")
|
@JacksonXmlProperty(isAttribute = true, localName = "MediaResourceID")
|
||||||
|
@Column(nullable = false)
|
||||||
private Long mediaResourceId;
|
private Long mediaResourceId;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@Column(nullable = false)
|
||||||
private Long locationId;
|
private Long locationId;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "x")
|
@JacksonXmlProperty(isAttribute = true, localName = "x")
|
||||||
|
@Column(nullable = false)
|
||||||
private Double x;
|
private Double x;
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "y")
|
@JacksonXmlProperty(isAttribute = true, localName = "y")
|
||||||
|
@Column(nullable = false)
|
||||||
private Double y;
|
private Double y;
|
||||||
|
|
||||||
@JacksonXmlText
|
@JacksonXmlText
|
||||||
|
@Column(nullable = false)
|
||||||
private String options;
|
private String options;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@Column(nullable = false)
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,6 +5,7 @@ import com.alterdekim.flash.decompiler.mapper.FlashValueType;
|
|||||||
import com.alterdekim.game.xml.NumericBooleanSerializer;
|
import com.alterdekim.game.xml.NumericBooleanSerializer;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
@ -77,4 +78,8 @@ public class MiniGame {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "Token")
|
@JacksonXmlProperty(isAttribute = true, localName = "Token")
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
@JacksonXmlText
|
||||||
|
private String groups_list;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user