-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 61c1c3a
Showing
228 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="lib" path="/Users/user/Documents/workspace/SPHIDM/bin"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>SPHIDM</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.scala-ide.sdt.core.scalabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.scala-ide.sdt.core.scalanature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Sat Feb 18 15:26:57 JST 2012 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+12.9 KB
bin/com/napthats/sphidm/PlayerCharacter$$anonfun$act$1$$anonfun$apply$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15 KB
bin/com/napthats/sphidm/PlayerCharacterManager$$anonfun$act$1$$anonfun$apply$1.class
Binary file not shown.
Binary file added
BIN
+1005 Bytes
bin/com/napthats/sphidm/PlayerCharacterManager$$anonfun$act$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+17.5 KB
bin/com/napthats/sphidm/UserManager$$anonfun$act$1$$anonfun$apply$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+12.7 KB
bin/com/napthats/sphidm/UserSocketActor$$anonfun$act$1$$anonfun$apply$1.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.88 KB
...napthats/sphidm/UserSocketActor$$anonfun$makeReceiveActor$1$$anonfun$apply$mcV$sp$1.class
Binary file not shown.
Binary file added
BIN
+1.66 KB
bin/com/napthats/sphidm/UserSocketActor$$anonfun$makeReceiveActor$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.napthats.sphidm | ||
|
||
import scala.actors.Actor | ||
import scala.actors.Actor._ | ||
|
||
|
||
object Phidm extends Actor { | ||
def act() { | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package com.napthats.sphidm | ||
|
||
|
||
sealed abstract class PhiProtocol | ||
|
||
case class PhiServerToClientProtocol extends PhiProtocol | ||
|
||
case class Close extends PhiServerToClientProtocol | ||
case class Tmp extends PhiServerToClientProtocol | ||
|
||
case class PhiClientToServerProtocol extends PhiProtocol | ||
|
||
case class NormalMessage(msg: String) extends PhiClientToServerProtocol | ||
|
||
//client protocol starting with # | ||
case class PhiClientSpecialProtocol extends PhiClientToServerProtocol | ||
case class Open(id: String) extends PhiClientSpecialProtocol | ||
case class EndLag extends PhiClientSpecialProtocol | ||
case class Reserve(id: String) extends PhiClientSpecialProtocol | ||
case class NoSrv extends PhiClientSpecialProtocol | ||
case class Trans(id: String) extends PhiClientSpecialProtocol | ||
case class ChSrvNo extends PhiClientSpecialProtocol | ||
case class ChSrvOk extends PhiClientSpecialProtocol | ||
case class CodeEuc extends PhiClientSpecialProtocol | ||
case class CodeUtf extends PhiClientSpecialProtocol | ||
case class CodeSjis extends PhiClientSpecialProtocol | ||
case class VersionClient(version: String) extends PhiClientSpecialProtocol | ||
case class LeaveWin extends PhiClientSpecialProtocol | ||
case class EnterWin extends PhiClientSpecialProtocol | ||
case class Map extends PhiClientSpecialProtocol | ||
case class MapIv(iv: Int) extends PhiClientSpecialProtocol | ||
case class Status extends PhiClientSpecialProtocol | ||
case class StatusIv(iv: Int) extends PhiClientSpecialProtocol | ||
case class Ulist extends PhiClientSpecialProtocol | ||
case class SpecialPriv(name: String, message: String) extends PhiClientSpecialProtocol | ||
case class X extends PhiClientSpecialProtocol | ||
case class UnknownSpecialProtocol(msg: String) extends PhiClientSpecialProtocol | ||
|
||
//client plaintext command | ||
case class PhiCommand extends PhiClientToServerProtocol | ||
case class Move(d: Direction) extends PhiCommand | ||
case class Turn(d: Direction) extends PhiCommand | ||
case class Read extends PhiCommand | ||
case class Board extends PhiCommand | ||
case class Use extends PhiCommand | ||
case class Erase extends PhiCommand | ||
case class FloorItem extends PhiCommand | ||
case class Guard extends PhiCommand | ||
case class Check extends PhiCommand | ||
case class Look extends PhiCommand | ||
case class Pay(amount: Int) extends PhiCommand | ||
case class Equip extends PhiCommand | ||
case class Spells extends PhiCommand | ||
case class Write extends PhiCommand | ||
case class Sort extends PhiCommand | ||
case class Unequip extends PhiCommand | ||
case class Put extends PhiCommand | ||
//case class Y extends PhiCommand | ||
case class Get extends PhiCommand | ||
case class Hit extends PhiCommand | ||
case class Cast extends PhiCommand | ||
case class Exit extends PhiCommand | ||
case class Chat extends PhiCommand | ||
case class Title extends PhiCommand | ||
case class Priv(name: String, message: String) extends PhiCommand | ||
case class Action extends PhiCommand | ||
case class Version extends PhiCommand | ||
case class See extends PhiCommand | ||
case class ExSwitch(key: String, value: String) extends PhiCommand | ||
case class ExMap(key: String, value: String) extends PhiCommand | ||
|
||
sealed abstract class Direction | ||
sealed abstract case class RelativeDirection extends Direction | ||
case class Forward extends RelativeDirection | ||
case class Backward extends RelativeDirection | ||
case class Right extends RelativeDirection | ||
case class Left extends RelativeDirection | ||
sealed abstract case class AbsoluteDirection extends Direction | ||
case class North extends AbsoluteDirection | ||
case class South extends AbsoluteDirection | ||
case class East extends AbsoluteDirection | ||
case class West extends AbsoluteDirection | ||
|
||
|
||
object PhidmProtocolParser { | ||
def protocolToCommand(msg:String): PhiProtocol = { | ||
val (protocolType, remainingString) = if(msg.indexOf(' ') >= 0) msg.splitAt(msg.indexOf(' ')) else msg.splitAt(msg.length) | ||
protocolType match { | ||
case "open" => | ||
Open(remainingString.drop(1)) | ||
case "exit" => | ||
Exit() | ||
case _ => | ||
NormalMessage(msg) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.napthats.sphidm | ||
|
||
import _root_.java.net.ServerSocket | ||
|
||
|
||
object PhidmServer { | ||
val PORT = 20017 | ||
Phidm.start() | ||
UserManager.start() | ||
PlayerCharacterManager.start() | ||
|
||
def main(args: Array[String]) { | ||
val serverSocket = new ServerSocket(PORT) | ||
while(true) { | ||
val clientSocket = serverSocket accept() | ||
UserManager ! AcceptNewUser(clientSocket) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.napthats.sphidm | ||
|
||
import scala.actors.Actor | ||
import scala.actors.Actor._ | ||
|
||
class PlayerCharacter(pcData: PlayerCharacterData, myPcId: PlayerCharacterId) extends Actor { | ||
|
||
def act() { | ||
loop { | ||
react { | ||
case UserMessage(_, _, Exit()) => | ||
PlayerCharacterManager ! CommandToUser(myPcId, Close()) | ||
|
||
case UserMessage(_, _, msg) => | ||
PlayerCharacterManager ! PlainMessageToUser(myPcId, "Your message: " + msg) | ||
|
||
case LogoutPlayerCharacter(_) => | ||
exit() | ||
|
||
case x => | ||
error("Unknown message to PlayerCharacter: " + x.toString()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
object PlayerCharacter { | ||
def apply(pcData: PlayerCharacterData, pcId: PlayerCharacterId) = new PlayerCharacter(pcData, pcId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.napthats.sphidm | ||
|
||
import scala.actors.Actor | ||
import scala.actors.Actor._ | ||
|
||
|
||
abstract case class MessageToUser(pcId: PlayerCharacterId) | ||
case class PlainMessageToUser(_pcId: PlayerCharacterId, msg: String) extends MessageToUser(_pcId) | ||
case class CommandToUser(_pcId: PlayerCharacterId, protocol: PhiServerToClientProtocol) extends MessageToUser(_pcId) | ||
|
||
case class PhircId(id: String) | ||
case class PlayerCharacterId(pcId: Int) | ||
|
||
case class UserMessage(clientId: ClientId, pcId: PlayerCharacterId, protocolMessage: PhiProtocol) | ||
|
||
case class PlayerCharacterStatus(hp: Int, mhp: Int, mp: Int, mmp: Int, karma: Int, money: Int, flevel: Int, wlevel: Int, mlevel: Int, clevel: Int, exp: Int, x: Int, y: Int, dir: Int) | ||
|
||
abstract case class PlayerCharacterState | ||
case class Logout extends PlayerCharacterState | ||
case class Login(pcId: PlayerCharacterId) extends PlayerCharacterState | ||
case class PlayerCharacterData(phircIdString: String, name: String, pcStatus: PlayerCharacterStatus) | ||
|
||
case class LoginPlayerCharacter(clientId: ClientId, phircId: PhircId) | ||
case class LogoutPlayerCharacter(pcId: PlayerCharacterId) | ||
|
||
abstract case class LoginPlayerCharacterResult(clientId: ClientId) | ||
case class LoginSucceeded(_clientId: ClientId, pcId: PlayerCharacterId) extends LoginPlayerCharacterResult(_clientId) | ||
case class NoSuchUser(_clientId: ClientId) extends LoginPlayerCharacterResult(_clientId) | ||
case class UserAlreadyLogined(_clientId: ClientId, pcId: PlayerCharacterId) extends LoginPlayerCharacterResult(_clientId) | ||
|
||
|
||
object PlayerCharacterManager extends Actor{ | ||
private[this] val playerCharacterDataContainer = scala.collection.mutable.Map[PhircId, PlayerCharacterData]() | ||
private[this] val loginedPlayerCharacterContainer = scala.collection.mutable.Map[PlayerCharacterId, PlayerCharacter]() | ||
private[this] val playerCharacterStateContainer = scala.collection.mutable.Map[PhircId, PlayerCharacterState]() | ||
private[this] val pcId2phircId = scala.collection.mutable.Map[PlayerCharacterId, PhircId]() | ||
private[this] var nextPlayerCharacterIdNum = 0 | ||
|
||
playerCharacterDataContainer(PhircId("test")) = PlayerCharacterData("test", "test chara", PlayerCharacterStatus(1000,2000,500,800,10,1000,1000,1000,1000,1000,100,0,0,0)) | ||
playerCharacterStateContainer(PhircId("test")) = Logout() | ||
|
||
def act() { | ||
loop { | ||
react { | ||
case x @ MessageToUser(_) => | ||
UserManager ! x | ||
|
||
case LoginPlayerCharacter(clientId, phircId) => | ||
playerCharacterStateContainer.get(phircId) match { | ||
case Some(Login(pcId)) => | ||
UserManager ! UserAlreadyLogined(clientId, pcId) | ||
case Some(Logout()) => | ||
val newPcId = makeNewPlayerCharacter(playerCharacterDataContainer(phircId)) | ||
playerCharacterStateContainer(phircId) = Login(newPcId) | ||
pcId2phircId(newPcId) = phircId | ||
UserManager ! LoginSucceeded(clientId, newPcId) | ||
case None => | ||
UserManager ! NoSuchUser(clientId) | ||
} | ||
|
||
case x @ LogoutPlayerCharacter(pcId) => | ||
val phircId = pcId2phircId(pcId) | ||
pcId2phircId.remove(pcId) | ||
playerCharacterStateContainer(phircId) = Logout() | ||
val pc = loginedPlayerCharacterContainer(pcId) | ||
loginedPlayerCharacterContainer.remove(pcId) | ||
pc ! x | ||
|
||
case UserMessage(clientId, pcId, msg) => | ||
loginedPlayerCharacterContainer(pcId) ! UserMessage(clientId, pcId, msg) | ||
|
||
case x => | ||
error("Unknown message to PlayerCharacterManager: " + x.toString()) | ||
} | ||
} | ||
} | ||
|
||
private[this] def makeNewPlayerCharacter(pcData: PlayerCharacterData): PlayerCharacterId = { | ||
val currentPlayerCharacterId = PlayerCharacterId(nextPlayerCharacterIdNum) | ||
val pc = PlayerCharacter(pcData, currentPlayerCharacterId) | ||
pc.start() | ||
nextPlayerCharacterIdNum += 1 | ||
loginedPlayerCharacterContainer(currentPlayerCharacterId) = pc | ||
currentPlayerCharacterId | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.napthats.sphidm | ||
|
||
import scala.actors.Actor | ||
import scala.actors.Actor._ | ||
import java.net.Socket | ||
|
||
|
||
case class AcceptNewUser(clientSocket: Socket) | ||
case class ClientId(id: Int) | ||
|
||
sealed abstract class UserState | ||
case class Initial extends UserState | ||
case class Opened(pcId: PlayerCharacterId) extends UserState | ||
|
||
private case class User(myClientId: ClientId, mySocketActor: UserSocketActor, myState: UserState) | ||
|
||
case class ExitPc(pcId: PlayerCharacterId) | ||
|
||
object UserManager extends Actor { | ||
private[this] val userContainer = scala.collection.mutable.Map[ClientId, User]() | ||
private[this] val pcId2ClientId = scala.collection.mutable.Map[PlayerCharacterId, ClientId]() | ||
private[this] var nextClientIdNum = 0 | ||
|
||
def act() { | ||
loop { | ||
react { | ||
//from PlayerCharacterManager | ||
case x @ MessageToUser(pcId) => | ||
val User(_, socketActor, _) = userContainer(pcId2ClientId(pcId)) | ||
x match { | ||
case PlainMessageToUser(_, msg) => | ||
socketActor ! MessageToClient(msg) | ||
case CommandToUser(_, command) => | ||
command match { | ||
case Close() => | ||
val clientId = pcId2ClientId(pcId) | ||
socketActor ! DisconnectClient() | ||
userContainer.remove(clientId) | ||
pcId2ClientId.remove(pcId) | ||
PlayerCharacterManager ! LogoutPlayerCharacter(pcId) | ||
} | ||
} | ||
|
||
case AcceptNewUser(clientSocket) => | ||
val newClientId = getNextClientId | ||
val userSocketActor = UserSocketActor(clientSocket, newClientId, this) | ||
userSocketActor.start() | ||
userContainer(newClientId) = User(newClientId, userSocketActor, Initial()) | ||
|
||
case x @ LoginPlayerCharacterResult(clientId) => | ||
val User(_, socketActor, _) = userContainer(clientId) | ||
x match { | ||
case LoginSucceeded(_, pcId) => | ||
userContainer(clientId) match { | ||
case User(_, _, Initial()) => | ||
userContainer(clientId) = User(clientId, socketActor, Opened(pcId)) | ||
pcId2ClientId(pcId) = clientId | ||
case User(_, _, Opened(_)) => | ||
error("Assertion error: User tried to login already logined.") | ||
} | ||
case NoSuchUser(_) => | ||
socketActor ! MessageToClient("No such user.") | ||
socketActor ! DisconnectClient() | ||
userContainer.remove(clientId) | ||
case UserAlreadyLogined(_, pcId) => | ||
socketActor ! MessageToClient("User already connected.") | ||
socketActor ! DisconnectClient() | ||
userContainer.remove(clientId) | ||
} | ||
|
||
case ClientMessage(msg, clientId) => | ||
PhidmProtocolParser.protocolToCommand(msg) match { | ||
case Open(id) => | ||
userContainer(clientId) match { | ||
case User(_, _, Opened(_)) => | ||
case User(_, mySocketActor, Initial()) => | ||
PlayerCharacterManager ! LoginPlayerCharacter(clientId, PhircId(id)) | ||
} | ||
case x => | ||
userContainer(clientId) match { | ||
case User(_, _, Opened(pcId)) => | ||
PlayerCharacterManager ! UserMessage(clientId, pcId, x) | ||
case User(_, _, Initial()) => | ||
} | ||
} | ||
|
||
case x => | ||
error("Unknown message to UserManager: " + x.toString()) | ||
} | ||
} | ||
} | ||
|
||
private[this] def getNextClientId: ClientId = { | ||
val currentClientId = nextClientIdNum | ||
nextClientIdNum += 1 | ||
ClientId(currentClientId) | ||
} | ||
} | ||
|
Oops, something went wrong.