mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-29 16:25:30 +00:00
added away from keyboard field to player and ways to flag it (#480)
This commit is contained in:
parent
634d57628a
commit
4da6f9d618
2 changed files with 90 additions and 66 deletions
|
|
@ -50,6 +50,7 @@ class Player(private val core : Avatar) extends PlanetSideServerObject
|
||||||
private var jumping : Boolean = false
|
private var jumping : Boolean = false
|
||||||
private var cloaked : Boolean = false
|
private var cloaked : Boolean = false
|
||||||
private var fatigued : Boolean = false // If stamina drops to 0, player is fatigued until regenerating at least 20 stamina
|
private var fatigued : Boolean = false // If stamina drops to 0, player is fatigued until regenerating at least 20 stamina
|
||||||
|
private var afk : Boolean = false
|
||||||
|
|
||||||
private var vehicleSeated : Option[PlanetSideGUID] = None
|
private var vehicleSeated : Option[PlanetSideGUID] = None
|
||||||
|
|
||||||
|
|
@ -402,11 +403,19 @@ class Player(private val core : Avatar) extends PlanetSideServerObject
|
||||||
}
|
}
|
||||||
|
|
||||||
def Fatigued : Boolean = fatigued
|
def Fatigued : Boolean = fatigued
|
||||||
|
|
||||||
def Fatigued_=(isFatigued : Boolean) : Boolean = {
|
def Fatigued_=(isFatigued : Boolean) : Boolean = {
|
||||||
fatigued = isFatigued
|
fatigued = isFatigued
|
||||||
Fatigued
|
Fatigued
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def AwayFromKeyboard : Boolean = afk
|
||||||
|
|
||||||
|
def AwayFromKeyboard_=(away : Boolean) : Boolean = {
|
||||||
|
afk = away
|
||||||
|
AwayFromKeyboard
|
||||||
|
}
|
||||||
|
|
||||||
def PersonalStyleFeatures : Option[Cosmetics] = core.PersonalStyleFeatures
|
def PersonalStyleFeatures : Option[Cosmetics] = core.PersonalStyleFeatures
|
||||||
|
|
||||||
def AddToPersonalStyle(value : PersonalStyle.Value) : (Option[Cosmetics], Option[Cosmetics]) = {
|
def AddToPersonalStyle(value : PersonalStyle.Value) : (Option[Cosmetics], Option[Cosmetics]) = {
|
||||||
|
|
|
||||||
|
|
@ -5968,89 +5968,104 @@ class WorldSessionActor extends Actor
|
||||||
|
|
||||||
case msg @ GenericActionMessage(action) =>
|
case msg @ GenericActionMessage(action) =>
|
||||||
log.info(s"GenericAction: $msg")
|
log.info(s"GenericAction: $msg")
|
||||||
val (toolOpt, definition) = player.Slot(0).Equipment match {
|
if(player == null) {
|
||||||
case Some(tool : Tool) =>
|
if(action == 29) {
|
||||||
(Some(tool), tool.Definition)
|
log.info("AFK state reported during login")
|
||||||
case _ =>
|
}
|
||||||
(None, GlobalDefinitions.bullet_9mm)
|
|
||||||
}
|
}
|
||||||
if(action == 15) { //max deployment
|
else {
|
||||||
log.info(s"GenericObject: $player is anchored")
|
val (toolOpt, definition) = player.Slot(0).Equipment match {
|
||||||
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
|
case Some(tool : Tool) =>
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 1))
|
(Some(tool), tool.Definition)
|
||||||
definition match {
|
|
||||||
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
|
||||||
val tool = toolOpt.get
|
|
||||||
tool.ToFireMode = 1
|
|
||||||
sendResponse(ChangeFireModeMessage(tool.GUID, 1))
|
|
||||||
case GlobalDefinitions.trhev_pounder =>
|
|
||||||
val tool = toolOpt.get
|
|
||||||
val convertFireModeIndex = if(tool.FireModeIndex == 0) { 1 } else { 4 }
|
|
||||||
tool.ToFireMode = convertFireModeIndex
|
|
||||||
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
|
||||||
case _ =>
|
case _ =>
|
||||||
log.warn(s"GenericObject: $player is MAX with an unexpected weapon - ${definition.Name}")
|
(None, GlobalDefinitions.bullet_9mm)
|
||||||
}
|
}
|
||||||
}
|
if(action == 29) {
|
||||||
else if(action == 16) { //max deployment
|
log.info(s"${player.Name} is AFK")
|
||||||
log.info(s"GenericObject: $player has released the anchors")
|
player.AwayFromKeyboard = true
|
||||||
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
|
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 0))
|
|
||||||
definition match {
|
|
||||||
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
|
||||||
val tool = toolOpt.get
|
|
||||||
tool.ToFireMode = 0
|
|
||||||
sendResponse(ChangeFireModeMessage(tool.GUID, 0))
|
|
||||||
case GlobalDefinitions.trhev_pounder =>
|
|
||||||
val tool = toolOpt.get
|
|
||||||
val convertFireModeIndex = if(tool.FireModeIndex == 1) { 0 } else { 3 }
|
|
||||||
tool.ToFireMode = convertFireModeIndex
|
|
||||||
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
|
||||||
case _ =>
|
|
||||||
log.warn(s"GenericObject: $player is MAX with an unexpected weapon - ${definition.Name}")
|
|
||||||
}
|
}
|
||||||
}
|
else if(action == 30) {
|
||||||
else if (action == 20) {
|
log.info(s"${player.Name} is back")
|
||||||
if(player.ExoSuit == ExoSuitType.MAX) {
|
player.AwayFromKeyboard = false
|
||||||
ToggleMaxSpecialState(enable = true)
|
|
||||||
} else {
|
|
||||||
log.warn("Got GenericActionMessage 20 but can't handle it")
|
|
||||||
}
|
}
|
||||||
}
|
if(action == 15) { //max deployment
|
||||||
else if (action == 21) {
|
log.info(s"GenericObject: $player is anchored")
|
||||||
if(player.ExoSuit == ExoSuitType.MAX) {
|
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
|
||||||
|
continent.AvatarEvents ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 1))
|
||||||
|
definition match {
|
||||||
|
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
tool.ToFireMode = 1
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, 1))
|
||||||
|
case GlobalDefinitions.trhev_pounder =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
val convertFireModeIndex = if(tool.FireModeIndex == 0) { 1 } else { 4 }
|
||||||
|
tool.ToFireMode = convertFireModeIndex
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
||||||
|
case _ =>
|
||||||
|
log.warn(s"GenericObject: $player is MAX with an unexpected weapon - ${definition.Name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(action == 16) { //max deployment
|
||||||
|
log.info(s"GenericObject: $player has released the anchors")
|
||||||
|
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Normal
|
||||||
|
continent.AvatarEvents ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player.GUID, 19, 0))
|
||||||
|
definition match {
|
||||||
|
case GlobalDefinitions.trhev_dualcycler | GlobalDefinitions.trhev_burster =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
tool.ToFireMode = 0
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, 0))
|
||||||
|
case GlobalDefinitions.trhev_pounder =>
|
||||||
|
val tool = toolOpt.get
|
||||||
|
val convertFireModeIndex = if(tool.FireModeIndex == 1) { 0 } else { 3 }
|
||||||
|
tool.ToFireMode = convertFireModeIndex
|
||||||
|
sendResponse(ChangeFireModeMessage(tool.GUID, convertFireModeIndex))
|
||||||
|
case _ =>
|
||||||
|
log.warn(s"GenericObject: $player is MAX with an unexpected weapon - ${definition.Name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action == 20) {
|
||||||
|
if(player.ExoSuit == ExoSuitType.MAX) {
|
||||||
|
ToggleMaxSpecialState(enable = true)
|
||||||
|
} else {
|
||||||
|
log.warn("Got GenericActionMessage 20 but can't handle it")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action == 21) {
|
||||||
|
if(player.ExoSuit == ExoSuitType.MAX) {
|
||||||
player.Faction match {
|
player.Faction match {
|
||||||
case PlanetSideEmpire.NC =>
|
case PlanetSideEmpire.NC =>
|
||||||
ToggleMaxSpecialState(enable = false)
|
ToggleMaxSpecialState(enable = false)
|
||||||
case _ => log.warn(s"Player ${player.Name} tried to cancel an uncancellable MAX special ability")
|
case _ => log.warn(s"Player ${player.Name} tried to cancel an uncancellable MAX special ability")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("Got GenericActionMessage 21 but can't handle it")
|
log.warn("Got GenericActionMessage 21 but can't handle it")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if(action == 36) { //Looking For Squad ON
|
||||||
else if(action == 36) { //Looking For Squad ON
|
if(squadUI.nonEmpty) {
|
||||||
if(squadUI.nonEmpty) {
|
if(!lfsm && squadUI(player.CharId).index == 0) {
|
||||||
if(!lfsm && squadUI(player.CharId).index == 0) {
|
lfsm = true
|
||||||
lfsm = true
|
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!avatar.LFS) {
|
||||||
|
avatar.LFS = true
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 1))
|
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!avatar.LFS) {
|
else if(action == 37) { //Looking For Squad OFF
|
||||||
avatar.LFS = true
|
if(squadUI.nonEmpty) {
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 1))
|
if(lfsm && squadUI(player.CharId).index == 0) {
|
||||||
}
|
lfsm = false
|
||||||
}
|
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 0))
|
||||||
else if(action == 37) { //Looking For Squad OFF
|
}
|
||||||
if(squadUI.nonEmpty) {
|
}
|
||||||
if(lfsm && squadUI(player.CharId).index == 0) {
|
else if(avatar.LFS) {
|
||||||
lfsm = false
|
avatar.LFS = false
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 0))
|
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(avatar.LFS) {
|
|
||||||
avatar.LFS = false
|
|
||||||
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 0))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case msg @ ItemTransactionMessage(terminal_guid, transaction_type, _, _, _, _) =>
|
case msg @ ItemTransactionMessage(terminal_guid, transaction_type, _, _, _, _) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue