mirror of
				https://github.com/arcan1s/ffxivbis.git
				synced 2025-10-31 05:33:41 +00:00 
			
		
		
		
	full view impl
This commit is contained in:
		| @ -42,7 +42,7 @@ class BiSEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit ti | |||||||
|     tags = Array("best in slot"), |     tags = Array("best in slot"), | ||||||
|   ) |   ) | ||||||
|   def createBiS: Route = |   def createBiS: Route = | ||||||
|     path("party" / Segment / "bis") { partyId: String => |     path("party" / Segment / "bis") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => | ||||||
|           put { |           put { | ||||||
| @ -77,7 +77,7 @@ class BiSEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit ti | |||||||
|     tags = Array("best in slot"), |     tags = Array("best in slot"), | ||||||
|   ) |   ) | ||||||
|   def getBiS: Route = |   def getBiS: Route = | ||||||
|     path("party" / Segment / "bis") { partyId: String => |     path("party" / Segment / "bis") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|           get { |           get { | ||||||
| @ -110,7 +110,7 @@ class BiSEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit ti | |||||||
|     tags = Array("best in slot"), |     tags = Array("best in slot"), | ||||||
|   ) |   ) | ||||||
|   def modifyBiS: Route = |   def modifyBiS: Route = | ||||||
|     path("party" / Segment / "bis") { partyId: String => |     path("party" / Segment / "bis") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => | ||||||
|           post { |           post { | ||||||
|  | |||||||
| @ -44,7 +44,7 @@ class LootEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("loot"), |     tags = Array("loot"), | ||||||
|   ) |   ) | ||||||
|   def getLoot: Route = |   def getLoot: Route = | ||||||
|     path("party" / Segment / "loot") { partyId: String => |     path("party" / Segment / "loot") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|           get { |           get { | ||||||
| @ -77,7 +77,7 @@ class LootEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("loot"), |     tags = Array("loot"), | ||||||
|   ) |   ) | ||||||
|   def modifyLoot: Route = |   def modifyLoot: Route = | ||||||
|     path("party" / Segment / "loot") { partyId: String => |     path("party" / Segment / "loot") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => | ||||||
|           post { |           post { | ||||||
| @ -120,7 +120,7 @@ class LootEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("loot"), |     tags = Array("loot"), | ||||||
|   ) |   ) | ||||||
|   def suggestLoot: Route = |   def suggestLoot: Route = | ||||||
|     path("party" / Segment / "loot") { partyId: String => |     path("party" / Segment / "loot") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|           put { |           put { | ||||||
|  | |||||||
| @ -44,7 +44,7 @@ class PlayerEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit | |||||||
|     tags = Array("party"), |     tags = Array("party"), | ||||||
|   ) |   ) | ||||||
|   def getParty: Route = |   def getParty: Route = | ||||||
|     path("party" / Segment) { partyId: String => |     path("party" / Segment) { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|           get { |           get { | ||||||
| @ -77,7 +77,7 @@ class PlayerEndpoint(override val storage: ActorRef, ariyala: ActorRef)(implicit | |||||||
|     tags = Array("party"), |     tags = Array("party"), | ||||||
|   ) |   ) | ||||||
|   def modifyParty: Route = |   def modifyParty: Route = | ||||||
|     path("party" / Segment) { partyId: String => |     path("party" / Segment) { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => | ||||||
|           entity(as[PlayerActionResponse]) { action => |           entity(as[PlayerActionResponse]) { action => | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ class UserEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("party"), |     tags = Array("party"), | ||||||
|   ) |   ) | ||||||
|   def createParty: Route = |   def createParty: Route = | ||||||
|     path("party" / Segment / "create") { partyId: String => |     path("party" / Segment / "create") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         put { |         put { | ||||||
|           entity(as[UserResponse]) { user => |           entity(as[UserResponse]) { user => | ||||||
| @ -73,7 +73,7 @@ class UserEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("users"), |     tags = Array("users"), | ||||||
|   ) |   ) | ||||||
|   def createUser: Route = |   def createUser: Route = | ||||||
|     path("party" / Segment / "users") { partyId: String => |     path("party" / Segment / "users") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => | ||||||
|           post { |           post { | ||||||
| @ -105,7 +105,7 @@ class UserEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("users"), |     tags = Array("users"), | ||||||
|   ) |   ) | ||||||
|   def deleteUser: Route = |   def deleteUser: Route = | ||||||
|     path("party" / Segment / "users" / Segment) { (partyId: String, username: String) => |     path("party" / Segment / "users" / Segment) { (partyId, username) => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => | ||||||
|           delete { |           delete { | ||||||
| @ -137,7 +137,7 @@ class UserEndpoint(override val storage: ActorRef)(implicit timeout: Timeout) | |||||||
|     tags = Array("users"), |     tags = Array("users"), | ||||||
|   ) |   ) | ||||||
|   def getUsers: Route = |   def getUsers: Route = | ||||||
|     path("party" / Segment / "users") { partyId: String => |     path("party" / Segment / "users") { partyId => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authAdmin(partyId)) { _ => | ||||||
|           get { |           get { | ||||||
|  | |||||||
| @ -0,0 +1,55 @@ | |||||||
|  | package me.arcanis.ffxivbis.http.view | ||||||
|  |  | ||||||
|  | import akka.actor.ActorRef | ||||||
|  | import akka.http.scaladsl.model.StatusCodes | ||||||
|  | import akka.http.scaladsl.server.Directives._ | ||||||
|  | import akka.http.scaladsl.server._ | ||||||
|  | import akka.util.Timeout | ||||||
|  | import me.arcanis.ffxivbis.http.Authorization | ||||||
|  |  | ||||||
|  | class BasePartyView(override val storage: ActorRef)(implicit timeout: Timeout) | ||||||
|  |   extends Authorization { | ||||||
|  |  | ||||||
|  |   def route: Route = getIndex | ||||||
|  |  | ||||||
|  |   def getIndex: Route = | ||||||
|  |     path("party" / Segment) { partyId => | ||||||
|  |       extractExecutionContext { implicit executionContext => | ||||||
|  |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|  |           get { | ||||||
|  |             complete { | ||||||
|  |               (StatusCodes.OK, RootView.toHtml(BasePartyView.template(partyId))) | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | object BasePartyView { | ||||||
|  |   import scalatags.Text | ||||||
|  |   import scalatags.Text.all._ | ||||||
|  |  | ||||||
|  |   def root(partyId: String): Text.TypedTag[String] = | ||||||
|  |     a(href:=s"/party/$partyId", title:="root")("root") | ||||||
|  |  | ||||||
|  |   def template(partyId: String): String = | ||||||
|  |     "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" + | ||||||
|  |       html(lang:="en", | ||||||
|  |         head( | ||||||
|  |           title:=s"Party $partyId", | ||||||
|  |           link(rel:="stylesheet", `type`:="text/css", href:="/static/styles.css") | ||||||
|  |         ), | ||||||
|  |  | ||||||
|  |         body( | ||||||
|  |           h2(s"Party $partyId"), | ||||||
|  |           br, | ||||||
|  |           h2(a(href:=s"/party/$partyId/players", title:="party")("party")), | ||||||
|  |           h2(a(href:=s"/party/$partyId/bis", title:="bis management")("best in slot")), | ||||||
|  |           h2(a(href:=s"/party/$partyId/loot", title:="loot management")("loot")), | ||||||
|  |           h2(a(href:=s"/party/$partyId/suggest", title:="suggest loot")("suggest")), | ||||||
|  |           hr, | ||||||
|  |           h2(a(href:=s"/party/$partyId/users", title:="user management")("users")) | ||||||
|  |         ) | ||||||
|  |       ) | ||||||
|  | } | ||||||
| @ -136,6 +136,7 @@ object BiSView { | |||||||
|           ), |           ), | ||||||
|  |  | ||||||
|           ExportToCSVView.template, |           ExportToCSVView.template, | ||||||
|  |           BasePartyView.root(partyId), | ||||||
|           script(src:="/static/table_search.js", `type`:="text/javascript") |           script(src:="/static/table_search.js", `type`:="text/javascript") | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  | |||||||
							
								
								
									
										71
									
								
								src/main/scala/me/arcanis/ffxivbis/http/view/IndexView.scala
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								src/main/scala/me/arcanis/ffxivbis/http/view/IndexView.scala
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,71 @@ | |||||||
|  | package me.arcanis.ffxivbis.http.view | ||||||
|  |  | ||||||
|  | import akka.actor.ActorRef | ||||||
|  | import akka.http.scaladsl.model.StatusCodes | ||||||
|  | import akka.http.scaladsl.server.Directives._ | ||||||
|  | import akka.http.scaladsl.server._ | ||||||
|  | import akka.util.Timeout | ||||||
|  | import me.arcanis.ffxivbis.http.UserHelper | ||||||
|  | import me.arcanis.ffxivbis.models.{Permission, User} | ||||||
|  | import me.arcanis.ffxivbis.service.Party | ||||||
|  |  | ||||||
|  | class IndexView(storage: ActorRef)(implicit timeout: Timeout) | ||||||
|  |   extends UserHelper(storage) { | ||||||
|  |  | ||||||
|  |   def route: Route = createParty ~ getIndex | ||||||
|  |  | ||||||
|  |   def createParty: Route = | ||||||
|  |     path("party" / Segment / "create") { partyId => | ||||||
|  |       extractExecutionContext { implicit executionContext => | ||||||
|  |         post { | ||||||
|  |           formFields("username".as[String], "password".as[String]) { (username, password) => | ||||||
|  |             val user = User(partyId, username, password, Permission.admin) | ||||||
|  |             onComplete(addUser(user, isHashedPassword = false)) { | ||||||
|  |               case _ => redirect(s"/party/$partyId", StatusCodes.Found) | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   def getIndex: Route = | ||||||
|  |     pathEndOrSingleSlash { | ||||||
|  |       get { | ||||||
|  |         parameters("partyId".as[String].?) { | ||||||
|  |           case Some(partyId) => redirect(s"/party/$partyId", StatusCodes.Found) | ||||||
|  |           case _ => complete((StatusCodes.OK, RootView.toHtml(IndexView.template))) | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | object IndexView { | ||||||
|  |   import scalatags.Text.all._ | ||||||
|  |  | ||||||
|  |   def template: String = | ||||||
|  |     "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" + | ||||||
|  |       html( | ||||||
|  |         head( | ||||||
|  |           title:="FFXIV loot helper", | ||||||
|  |           link(rel:="stylesheet", `type`:="text/css", href:="/static/styles.css") | ||||||
|  |         ), | ||||||
|  |  | ||||||
|  |         body( | ||||||
|  |           form(action:=s"party/${Party.randomPartyId}/create", method:="post")( | ||||||
|  |             label("create a new party"), | ||||||
|  |             input(name:="username", id:="username", placeholder:="username", title:="username", `type`:="text"), | ||||||
|  |             input(name:="password", id:="password", placeholder:="password", title:="password", `type`:="password"), | ||||||
|  |             input(name:="add", id:="add", `type`:="submit", value:="add") | ||||||
|  |           ), | ||||||
|  |  | ||||||
|  |           br, | ||||||
|  |  | ||||||
|  |           form(action:="/", method:="get")( | ||||||
|  |             label("already have party?"), | ||||||
|  |             input(name:="partyId", id:="partyId", placeholder:="party id", title:="party id", `type`:="text"), | ||||||
|  |             input(name:="go", id:="go", `type`:="submit", value:="go") | ||||||
|  |           ) | ||||||
|  |         ) | ||||||
|  |       ) | ||||||
|  | } | ||||||
|  |  | ||||||
| @ -114,6 +114,7 @@ object LootSuggestView { | |||||||
|           ), |           ), | ||||||
|  |  | ||||||
|           ExportToCSVView.template, |           ExportToCSVView.template, | ||||||
|  |           BasePartyView.root(partyId), | ||||||
|           script(src:="/static/table_search.js", `type`:="text/javascript") |           script(src:="/static/table_search.js", `type`:="text/javascript") | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  | |||||||
| @ -121,6 +121,7 @@ object LootView { | |||||||
|           ), |           ), | ||||||
|  |  | ||||||
|           ExportToCSVView.template, |           ExportToCSVView.template, | ||||||
|  |           BasePartyView.root(partyId), | ||||||
|           script(src:="/static/table_search.js", `type`:="text/javascript") |           script(src:="/static/table_search.js", `type`:="text/javascript") | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ class PlayerView(override val storage: ActorRef, ariyala: ActorRef)(implicit tim | |||||||
|   def route: Route = getParty ~ modifyParty |   def route: Route = getParty ~ modifyParty | ||||||
|  |  | ||||||
|   def getParty: Route = |   def getParty: Route = | ||||||
|     path("party" / Segment) { partyId: String => |     path("party" / Segment / "players") { partyId: String => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authGet(partyId)) { _ => | ||||||
|           get { |           get { | ||||||
| @ -33,14 +33,14 @@ class PlayerView(override val storage: ActorRef, ariyala: ActorRef)(implicit tim | |||||||
|     } |     } | ||||||
|  |  | ||||||
|   def modifyParty: Route = |   def modifyParty: Route = | ||||||
|     path("party" / Segment) { partyId: String => |     path("party" / Segment / "players") { partyId: String => | ||||||
|       extractExecutionContext { implicit executionContext => |       extractExecutionContext { implicit executionContext => | ||||||
|         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => |         authenticateBasicBCrypt(s"party $partyId", authPost(partyId)) { _ => | ||||||
|           post { |           post { | ||||||
|             formFields("nick".as[String], "job".as[String], "priority".as[Int].?, "link".as[String].?, "action".as[String]) { |             formFields("nick".as[String], "job".as[String], "priority".as[Int].?, "link".as[String].?, "action".as[String]) { | ||||||
|               (nick, job, maybePriority, maybeLink, action) => |               (nick, job, maybePriority, maybeLink, action) => | ||||||
|                 onComplete(modifyPartyCall(partyId, nick, job, maybePriority, maybeLink, action)) { |                 onComplete(modifyPartyCall(partyId, nick, job, maybePriority, maybeLink, action)) { | ||||||
|                   case _ => redirect(s"/party/$partyId", StatusCodes.Found) |                   case _ => redirect(s"/party/$partyId/players", StatusCodes.Found) | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
| @ -81,7 +81,7 @@ object PlayerView { | |||||||
|           ErrorView.template(error), |           ErrorView.template(error), | ||||||
|           SearchLineView.template, |           SearchLineView.template, | ||||||
|  |  | ||||||
|           form(action:=s"/party/$partyId", method:="post")( |           form(action:=s"/party/$partyId/players", method:="post")( | ||||||
|             input(name:="nick", id:="nick", placeholder:="nick", title:="nick", `type`:="nick"), |             input(name:="nick", id:="nick", placeholder:="nick", title:="nick", `type`:="nick"), | ||||||
|             select(name:="job", id:="job", title:="job") |             select(name:="job", id:="job", title:="job") | ||||||
|                   (for (job <- Job.groupAll) yield option(job.toString)), |                   (for (job <- Job.groupAll) yield option(job.toString)), | ||||||
| @ -107,7 +107,7 @@ object PlayerView { | |||||||
|               td(player.lootCountTotal), |               td(player.lootCountTotal), | ||||||
|               td(player.priority), |               td(player.priority), | ||||||
|               td( |               td( | ||||||
|                 form(action:=s"/party/$partyId", method:="post")( |                 form(action:=s"/party/$partyId/players", method:="post")( | ||||||
|                   input(name:="nick", id:="nick", `type`:="hidden", value:=player.nick), |                   input(name:="nick", id:="nick", `type`:="hidden", value:=player.nick), | ||||||
|                   input(name:="job", id:="job", `type`:="hidden", value:=player.job.toString), |                   input(name:="job", id:="job", `type`:="hidden", value:=player.job.toString), | ||||||
|                   input(name:="action", id:="action", `type`:="hidden", value:="remove"), |                   input(name:="action", id:="action", `type`:="hidden", value:="remove"), | ||||||
| @ -118,6 +118,7 @@ object PlayerView { | |||||||
|           ), |           ), | ||||||
|  |  | ||||||
|           ExportToCSVView.template, |           ExportToCSVView.template, | ||||||
|  |           BasePartyView.root(partyId), | ||||||
|           script(src:="/static/table_search.js", `type`:="text/javascript") |           script(src:="/static/table_search.js", `type`:="text/javascript") | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  | |||||||
| @ -8,6 +8,9 @@ import akka.util.Timeout | |||||||
|  |  | ||||||
| class RootView(storage: ActorRef, ariyala: ActorRef)(implicit timeout: Timeout) { | class RootView(storage: ActorRef, ariyala: ActorRef)(implicit timeout: Timeout) { | ||||||
|  |  | ||||||
|  |   private val basePartyView = new BasePartyView(storage) | ||||||
|  |   private val indexView = new IndexView(storage) | ||||||
|  |  | ||||||
|   private val biSView = new BiSView(storage, ariyala) |   private val biSView = new BiSView(storage, ariyala) | ||||||
|   private val lootView = new LootView(storage) |   private val lootView = new LootView(storage) | ||||||
|   private val lootSuggestView = new LootSuggestView(storage) |   private val lootSuggestView = new LootSuggestView(storage) | ||||||
| @ -15,6 +18,7 @@ class RootView(storage: ActorRef, ariyala: ActorRef)(implicit timeout: Timeout) | |||||||
|   private val userView = new UserView(storage) |   private val userView = new UserView(storage) | ||||||
|  |  | ||||||
|   def route: Route = |   def route: Route = | ||||||
|  |     basePartyView.route ~ indexView.route ~ | ||||||
|     biSView.route ~ lootView.route ~ lootSuggestView.route ~ playerView.route ~ userView.route |     biSView.route ~ lootView.route ~ lootSuggestView.route ~ playerView.route ~ userView.route | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -112,6 +112,7 @@ object UserView { | |||||||
|           ), |           ), | ||||||
|  |  | ||||||
|           ExportToCSVView.template, |           ExportToCSVView.template, | ||||||
|  |           BasePartyView.root(partyId), | ||||||
|           script(src:="/static/table_search.js", `type`:="text/javascript") |           script(src:="/static/table_search.js", `type`:="text/javascript") | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ case class Party(partyId: String, config: Config, players: Map[PlayerId, Player] | |||||||
|  |  | ||||||
| object Party { | object Party { | ||||||
|   def apply(partyId: Option[String], config: Config): Party = |   def apply(partyId: Option[String], config: Config): Party = | ||||||
|     new Party(partyId.getOrElse(Random.alphanumeric.take(20).mkString), config, Map.empty) |     new Party(partyId.getOrElse(randomPartyId), config, Map.empty) | ||||||
|  |  | ||||||
|   def apply(partyId: String, config: Config, |   def apply(partyId: String, config: Config, | ||||||
|             players: Map[Long, Player], bis: Seq[Loot], loot: Seq[Loot]): Party = { |             players: Map[Long, Player], bis: Seq[Loot], loot: Seq[Loot]): Party = { | ||||||
| @ -45,4 +45,6 @@ object Party { | |||||||
|     } |     } | ||||||
|     Party(partyId, config, playersWithItems) |     Party(partyId, config, playersWithItems) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   def randomPartyId: String = Random.alphanumeric.take(20).mkString | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user