2 new map, fix map name 4+ players

This commit is contained in:
v.holodov 2022-10-05 23:22:08 +03:00
parent d3e90fb01e
commit 750ea483b6
10 changed files with 146 additions and 68 deletions

View File

@ -163,15 +163,6 @@ class LobbieActor(hostUser: LobbyUser, deciderName: String) extends Actor with L
}
users.foreach(_ ! RefreshLobbyInfo(getLobbyInfoResponse))
case ChangeIsNecronSelected(isSelected) =>
isNecrons = isSelected
if (isSelected) {
mapsLobby.foreach(map => if (map.map == "2p_meeting_of_minds" || map.map == "2p_shrine_of_excellion_[Rem]") map.isBanned = true)
} else {
mapsLobby.foreach(map => map.isBanned = false)
}
users.foreach(_ ! RefreshLobbyInfo(getLobbyInfoResponse))
case KickSecondPlayer =>
if (sender() == host.actorRef) {
secondPlayer.foreach(player => player.actorRef ! LobbyFatal("You were kicked from lobby!"))

View File

@ -13,10 +13,13 @@ import scala.concurrent.duration.DurationInt
import scala.util.{Failure, Success}
class UserActor(out: ActorRef,
userParentActor: ActorRef) extends Actor with LazyLogging {
userParentActor: ActorRef,
ip: String) extends Actor with LazyLogging {
implicit val timeout: Timeout = 3.seconds
val ipAddress: String = ip
var lobbieActor: Option[ActorRef] = None
implicit val mapJson: Writes[DeciderMap] = new Writes[DeciderMap] {
@ -42,7 +45,6 @@ class UserActor(out: ActorRef,
"status" -> lobby.status,
"playerTurn" -> lobby.playerTurn,
"selectedType" -> lobby.selectedType,
"isNecrons" -> lobby.isNecrons,
"maps" -> Json.toJson(lobby.maps)
)
}
@ -62,7 +64,6 @@ class UserActor(out: ActorRef,
"status" -> lobby.status,
"playerTurn" -> lobby.playerTurn,
"selectedType" -> lobby.selectedType,
"isNecrons" -> lobby.isNecrons,
"maps" -> Json.toJson(lobby.maps)
)))
}
@ -154,10 +155,6 @@ class UserActor(out: ActorRef,
val lobbyType = (json \ "lobbyType").as[String]
lobbieActor.foreach(lobby => lobby ! ChangeLobbyType(lobbyType))
case Some("changeIsNecronSelected") =>
val isNecronSelected = (json \ "isNecronSelected").as[Boolean]
lobbieActor.foreach(lobby => lobby ! ChangeIsNecronSelected(isNecronSelected))
case Some("kickSecondPlayer") =>
lobbieActor.foreach(lobby => lobby ! KickSecondPlayer)
@ -210,10 +207,11 @@ class UserParentActor(actorSystem: ActorSystem) extends Actor with ActorLogging
import UserParentActor._
override def receive: Receive = LoggingReceive {
case Create(id, out) =>
val child: ActorRef = actorSystem.actorOf(Props(classOf[UserActor], out, self), s"userActor-$id")
case Create(id, ipAddress, out) =>
val child: ActorRef = actorSystem.actorOf(Props(classOf[UserActor], out, self, ipAddress), s"userActor-$id")
sender() ! child
case GetAllUsers =>
System.out.print("12123" + context.children)
sender() ! context.children
}
}
@ -221,7 +219,7 @@ class UserParentActor(actorSystem: ActorSystem) extends Actor with ActorLogging
object UserParentActor {
case class Create(id: String, out: ActorRef)
case class Create(id: String, ipAddress: String, out: ActorRef)
case object GetAllUsers

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -272,7 +272,7 @@ function renderRaces() {
}
if(raceCount >= 3){
resHtml += "<div class='col-xs-4'><center><h2>Ban race</h2>";
resHtml += "<div class='col-xs-4'><center><h2>Third race</h2>";
for(var i = 1; i <= 9; i++){
var selected = "raceNotSelected";
var banned = "";
@ -281,7 +281,7 @@ function renderRaces() {
banned = "bannedRace";
selectedThirdRace = i;
}
resHtml += '<a href = "#" class="'+selected+' thirdRaceIcon" onclick="selectThirdRace(this, ' +i+')"><img class="raceIcon '+banned+'" src="'+getRaceImageByNumber(i)+'"></a> ';
resHtml += '<a href = "#" class="'+selected+' thirdRaceIcon" onclick="selectThirdRace(this, ' +i+')"><img class="raceIcon" src="'+getRaceImageByNumber(i)+'"></a> ';
}
resHtml += "</center></div>";
}
@ -327,12 +327,10 @@ function selectThirdRace(button, race){
$.cookie("race3", race, { expires: 1 });
_.each($(".thirdRaceIcon"), function (el){
$(el).removeClass("raceSelected");
$(el).children('img').removeClass("bannedRace");
$(el).addClass("raceNotSelected");
});
$(button).removeClass("raceNotSelected");
$(button).addClass("raceSelected");
$(button).children("img").addClass("bannedRace");
checkRaceSelectFinish();
}
@ -520,7 +518,7 @@ function renderPlayersAndStats(lobby) {
"<option "+last1Selected+" value = 'last1'>Play on last map</option>" +
"<option "+last3Selected+" value = 'last3'>Play on last 3 maps</option>" +
"<option "+last5Selected+" value = 'last5'>Play on last 5 maps</option>" +
/*"<option "+last7Selected+" value = 'last7'>Play on last 7 maps</option>" +*/
"<option "+last7Selected+" value = 'last7'>Play on last 7 maps</option>" +
"</select>";
if(lobby.user1Info.name !== userName && lobby.user2Info.name !== userName){

View File

@ -1,5 +1,6 @@
package controllers
import actors.UserParentActor.GetAllUsers
import actors._
import akka.NotUsed
import akka.actor._
@ -9,30 +10,37 @@ import akka.stream._
import akka.stream.scaladsl._
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import javax.inject._
import org.reactivestreams.Publisher
import play.api.libs.json._
import play.api.mvc._
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.{Await, ExecutionContext, Future}
/**
* This class creates the actions and the websocket needed.
*/
@Singleton
class AdminController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
class AdminController @Inject()(cc: ControllerComponents, homeController: HomeController) extends AbstractController(cc) {
implicit val actorSystem: ActorSystem = ActorSystem()
implicit val ec: ExecutionContext = defaultExecutionContext
implicit val timeout = Timeout(100.millis)
// Use a direct reference to SLF4J
private val logger = org.slf4j.LoggerFactory.getLogger("controllers.HomeController")
val userParentActor: ActorRef = homeController.userParentActor
// Home page that renders template
def viewAllLobbies() = Action { implicit request =>
def viewAllUsers() = Action { implicit request =>
logger.info(s"Received request from: ${request.remoteAddress}")
Ok(views.html.admin())
val allUsers = userParentActor ? GetAllUsers
val res = Await.result(allUsers, Duration.Inf)
Ok(res.toString)
}
def banLobby(lobbyActorName: String): Unit = {

View File

@ -112,7 +112,7 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
val (webSocketOut: ActorRef, webSocketIn: Publisher[JsValue]) = createWebSocketConnections()
// Create a user actor off the request id and attach it to the source
val userActorFuture = createUserActor(request.id.toString, webSocketOut)
val userActorFuture = createUserActor(request.id.toString, request.remoteAddress, webSocketOut)
// Once we have an actor available, create a flow...
userActorFuture.map { userActor =>
@ -190,11 +190,11 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
* @param webSocketOut the "write" side of the websocket, that the user actor sends JsValue to.
* @return a user actor for this ws connection.
*/
private def createUserActor(name: String, webSocketOut: ActorRef): Future[ActorRef] = {
private def createUserActor(name: String, remoteAddress: String, webSocketOut: ActorRef): Future[ActorRef] = {
// Use guice assisted injection to instantiate and configure the child actor.
val userActorFuture = {
implicit val timeout = Timeout(100.millis)
(userParentActor ? UserParentActor.Create(name, webSocketOut)).mapTo[ActorRef]
(userParentActor ? UserParentActor.Create(name, remoteAddress, webSocketOut)).mapTo[ActorRef]
}
userActorFuture
}

View File

@ -20,7 +20,7 @@
<script type='text/javascript' src='@routes.Assets.at("lib/underscore/underscore.js")'></script>
<script type='text/javascript' src='@routes.Assets.at("lib/backbonejs/backbone.js")'></script>
<script type="text/javascript" src="@routes.Assets.at("lib/jquery-cookie/jquery.cookie.js")"></script>
<script type='text/javascript' src='@routes.Assets.at("javascripts/index.js?030622")'></script>
<script type='text/javascript' src='@routes.Assets.at("javascripts/index.js?270822")'></script>
</head>
<body data-ws-url="@routes.HomeController.ws.webSocketURL()">
<div class="navbar navbar-inverse navbar-fixed-top">

View File

@ -64,27 +64,35 @@ deciders{
Во втором и последующем матчах проигравший выбирает карту из числа выбранных 3 (5) десайдеров."""
}
meatgrinder{
maps = ["2p_battle_marshes",
"2p_fallen_city_[Rem]",
"2p_fata_morgana_[Rem]",
"2p_meeting_of_minds",
"2p_outer_reaches",
"2p_quests_triumph",
"2p_shrine_of_excellion_[Rem]",
"2p_titan_fall_[Rem]",
"2p_tranquilitys_end_[Rem]",
"2p_fraziersdemise",
"2p_vortex_plateau",
"2p_sugaroasis",
"2p_blood_river_[Rem]"]
maps = [["2p_battle_marshes"],
["2p_fallen_city"],
["2p_deadly_fun_archeology"],
["2p_bloody_hell_[Ed]"],
["2p_outer_reaches"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_sugaroasis"],
["2p_blood_river_[Rem]"]]
name = "Meat grinder"
rules = """Выбор карт в БО3 и БО5 осуществляется без лузерпиков, с тремя и пятью десайдерами соответственно. Игроки вычеркивают по очереди карты из маппула, пока их не останется 3 (для БО3) или 5 (для БО5). На этих картах и проходят все матчи встречи. Затем игроки вычеркивают выбранные карты, пока не останется только одна, на которой и играется первый матч встречи. Тот, кто первым начал вычеркивать из всего маппула, уступает оппоненту право вычеркивания первой карты из оставшихся карт-десайдеров. Во втором и последующем матчах проигравший выбирает карту из числа выбранных 3 (5) десайдеров. В случае, если один из игроков играет за расу некронов, из маппула исключаются карты MoM и SoE, после чего оба игрока приступают к вычеркиванию карт стандартным образом из 11-картового маппула."""
raceCount = 1
rules = """Десайдеры выбираются методом вычеркивания до 3(5) карт, далее из оставшихся карт методом вычеркивания определяется первая карта. Игрок, начавший вычеркивание из основного пула уступает право начать вычеркивание из оставшихся карт."""
}
compatchcup{
maps = [["2p_fallen_city"],
["2p_deadly_fun_archeology"], ["2p_quests_triumph"], ["2p_battle_marshes"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_blood_river_[Rem]"]]
name = "Community patch cup"
raceCount = 1
rules = """см. в дискорде турнира"""}
medskillcup{
maps = ["2p_battle_marshes",
"2p_fallen_city_[Rem]",
"2p_fata_morgana_[Rem]",
"2p_meeting_of_minds",
"2p_bloody_hell_[Ed]",
"2p_outer_reaches",
"2p_quests_triumph",
"2p_shrine_of_excellion_[Rem]",
@ -101,7 +109,7 @@ deciders{
maps = [["2p_battle_marshes"],
["2p_fallen_city_[Rem]"],
["2p_fata_morgana_[Rem]"],
["2p_meeting_of_minds"],
["2p_blood_river_[Rem]"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
@ -148,23 +156,24 @@ deciders{
name = "Big boss of winter"
rules = """Выбор карт в БО3 и БО5 осуществляется без лузерпиков, с тремя и пятью десайдерами соответственно. Игроки вычеркивают по очереди карты из маппула, пока их не останется 3 (для БО3) или 5 (для БО5). На этих картах и проходят все матчи встречи. Затем игроки вычеркивают выбранные карты, пока не останется только одна, на которой и играется первый матч встречи. Тот, кто первым начал вычеркивать из всего маппула, уступает оппоненту право вычеркивания первой карты из оставшихся карт-десайдеров. Во втором и последующем матчах проигравший выбирает карту из числа выбранных 3 (5) десайдеров.В суперфинале турнира оба игрока вычеркивают по две карты. После этого из оставшихся 9 карт можно брать любые, выбирает их проигравший в предыдущем матче. Первый лузер-пик - за игроком из нижней сетки, который начинает с -1 очком. """
}
showmatch{
maps = ["2p_battle_marshes",
"2p_fallen_city_[Rem]",
"2p_fata_morgana_[Rem]",
"2p_quests_triumph",
"2p_shrine_of_excellion_[Rem]",
"2p_titan_fall_[Rem]",
"2p_tranquilitys_end_[Rem]",
"2p_fraziersdemise",
"2p_bloody_hell_[Ed]",
"2p_blood_river_[Rem]",
"2p_sugaroasis",
"2p_meeting_of_minds",
"2p_emerald_river",
"2p_velvet_duress",
"2p_deadly_fun_archeology"]
name = "Showmatch"
frenchtournament{
maps = [["2p_battle_marshes"],
["2p_fallen_city_[Rem]"],
["2p_fata_morgana_[Rem]"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_fraziersdemise"],
["2p_outer_reaches"],
["2p_blood_river_[Rem]"],
["2p_sugaroasis"],
["2p_meeting_of_minds"],
["2p_emerald_river"],
["2p_vortex_plateau"],
["2p_deadly_fun_archeology"]]
name = "French tournament"
raceCount = 1
rules = """ """
}
horusheresycup2{
@ -285,8 +294,82 @@ deciders{
name = "No Weakness cup"
rules = """Выбор карт в БО3 и БО5 осуществляется без лузерпиков, с тремя и пятью десайдерами соответственно. Игроки вычеркивают по очереди карты из маппула, пока их не останется 3 (для БО3) или 5 (для БО5). На этих картах и проходят все матчи встречи. Затем игроки вычеркивают выбранные карты, пока не останется только одна, на которой и играется первый матч встречи. Тот, кто первым начал вычеркивать из всего маппула, уступает оппоненту право вычеркивания первой карты из оставшихся карт-десайдеров. Во втором и последующем матчах проигравший выбирает карту из числа выбранных 3 (5) десайдеров. """
}
freneticmappool{
raceCount = 2
description = true
maps =[["2p_battle_marshes"],
["2p_fallen_city_[Rem]"],
["2p_fata_morgana_[Rem]"],
["2p_emerald_river"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_fraziersdemise"],
["2p_bloody_hell_[Ed]"],
["2p_blood_river_[Rem]"],
["2p_deadly_fun_archeology"],
["2p_sugaroasis"],
["2p_outer_reaches"],
["2p_meeting_of_minds"]]
name = "Frenetic map pool"
rules = """ """
}
freneticmappool2{
raceCount = 2
description = true
maps =[["2p_battle_marshes"],
["2p_fallen_city_[Rem]"],
["2p_fata_morgana_[Rem]"],
["2p_emerald_river"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_fraziersdemise"],
["2p_bloody_hell_[Ed]"],
["2p_blood_river_[Rem]"],
["2p_deadly_fun_archeology"],
["2p_meeting_of_minds"]]
name = "Frenetic map pool"
rules = """ """
}
freneticmappool2x2{
raceCount = 2
description = true
maps =[["4p_biffys_peril"],
["4p_chaos_platenau"],
["4p_cold_war"],
["4p_gorhael_crater"],
["4p_gurmuns_pass"],
["4p_imperial_area"],
["4p_marconia"],
["4p_panrea_lowlands"],
["4p_saints_square"],
["6p_snowblind"],
["4p_tartarus_center"],
["4p_skerries"],
["4p_doom_spiral"]]
name = "Frenetic map pool"
rules = """ """
}
deadgamecup{
raceCount = 2
description = true
maps =[["2p_battle_marshes"],
["2p_fallen_city", "Обратите внимание, не ремастер"],
["2p_quests_triumph"],
["2p_shrine_of_excellion_[Rem]"],
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_blood_river_[Rem]"],
["2p_sugaroasis"],
["2p_outer_reaches"]]
name = "Dead game cup"
rules = """ """
}
casinocup {
raceCount = 2
maps = [["2p_battle_marshes"],
["2p_fallen_city_[Rem]"],
["2p_fata_morgana_[Rem]"],
@ -295,7 +378,7 @@ deciders{
["2p_titan_fall_[Rem]"],
["2p_tranquilitys_end_[Rem]"],
["2p_fraziersdemise"],
["2p_bloody_hell"],
["2p_bloody_hell_[Ed]"],
["2p_blood_river_[Rem]"],
["2p_deadly_fun_archeology"],
["2p_outer_reaches"],

View File

@ -6,7 +6,7 @@ GET /decider/:name controllers.HomeController.index(name)
GET /ws controllers.HomeController.ws
GET /lobbyadmin controllers.AdminController.viewAllLobbies
GET /admin/users controllers.AdminController.viewAllUsers()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)