added away from keyboard field to player and ways to flag it (#480)

This commit is contained in:
Fate-JH 2020-05-30 12:02:46 -04:00 committed by GitHub
parent 634d57628a
commit 4da6f9d618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 66 deletions

View file

@ -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]) = {

View file

@ -5968,12 +5968,26 @@ class WorldSessionActor extends Actor
case msg @ GenericActionMessage(action) => case msg @ GenericActionMessage(action) =>
log.info(s"GenericAction: $msg") log.info(s"GenericAction: $msg")
if(player == null) {
if(action == 29) {
log.info("AFK state reported during login")
}
}
else {
val (toolOpt, definition) = player.Slot(0).Equipment match { val (toolOpt, definition) = player.Slot(0).Equipment match {
case Some(tool : Tool) => case Some(tool : Tool) =>
(Some(tool), tool.Definition) (Some(tool), tool.Definition)
case _ => case _ =>
(None, GlobalDefinitions.bullet_9mm) (None, GlobalDefinitions.bullet_9mm)
} }
if(action == 29) {
log.info(s"${player.Name} is AFK")
player.AwayFromKeyboard = true
}
else if(action == 30) {
log.info(s"${player.Name} is back")
player.AwayFromKeyboard = false
}
if(action == 15) { //max deployment if(action == 15) { //max deployment
log.info(s"GenericObject: $player is anchored") log.info(s"GenericObject: $player is anchored")
player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored player.UsingSpecial = SpecialExoSuitDefinition.Mode.Anchored
@ -6052,6 +6066,7 @@ class WorldSessionActor extends Actor
continent.AvatarEvents ! AvatarServiceMessage(s"${player.Faction}", AvatarAction.PlanetsideAttribute(player.GUID, 53, 0)) 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, _, _, _, _) =>
log.info("ItemTransaction: " + msg) log.info("ItemTransaction: " + msg)