mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-26 22:35:23 +00:00
Overwrite shortcut slots 2/3/4 with installed implants, and allow active implants to be reactivated
This commit is contained in:
parent
4b25205c32
commit
9d3a163545
3 changed files with 32 additions and 2 deletions
|
|
@ -44,9 +44,12 @@ class PlayerControl(player : Player) extends Actor
|
||||||
implantSlot.Active = false
|
implantSlot.Active = false
|
||||||
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.PlanetsideAttribute(player.GUID, 28, player.Implant(slot).id * 2)) // Deactivation sound / effect
|
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.PlanetsideAttribute(player.GUID, 28, player.Implant(slot).id * 2)) // Deactivation sound / effect
|
||||||
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.DeactivateImplantSlot(player.GUID, slot))
|
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.DeactivateImplantSlot(player.GUID, slot))
|
||||||
} else if (status == 1 && implantSlot.Initialized && !implantSlot.Active && !player.Fatigued) {
|
} else if (status == 1 && implantSlot.Initialized && !player.Fatigued) {
|
||||||
implantSlot.Installed match {
|
implantSlot.Installed match {
|
||||||
case Some(implant: ImplantDefinition) =>
|
case Some(implant: ImplantDefinition) =>
|
||||||
|
if(implantSlot.Active) {
|
||||||
|
log.warn(s"Implant ${slot} is already active, but activating again")
|
||||||
|
}
|
||||||
implantSlot.Active = true
|
implantSlot.Active = true
|
||||||
|
|
||||||
if (implant.ActivationStaminaCost >= 0) {
|
if (implant.ActivationStaminaCost >= 0) {
|
||||||
|
|
@ -61,6 +64,9 @@ class PlayerControl(player : Player) extends Actor
|
||||||
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.ActivateImplantSlot(player.GUID, slot))
|
player.Zone.AvatarEvents ! AvatarServiceMessage(player.Zone.Id, AvatarAction.ActivateImplantSlot(player.GUID, slot))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log.warn(s"Can't handle ImplantActivation: Player GUID: ${player.GUID} Slot ${slot} Status: ${status} Initialized: ${implantSlot.Initialized} Active: ${implantSlot.Active} Fatigued: ${player.Fatigued}")
|
||||||
|
}
|
||||||
|
|
||||||
case Player.UninitializeImplant(slot: Int) => {
|
case Player.UninitializeImplant(slot: Int) => {
|
||||||
PlayerControl.UninitializeImplant(player, slot)
|
PlayerControl.UninitializeImplant(player, slot)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
package net.psforever.packet.game
|
package net.psforever.packet.game
|
||||||
|
|
||||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
||||||
import net.psforever.types.PlanetSideGUID
|
import net.psforever.types.{ImplantType, PlanetSideGUID}
|
||||||
import scodec.Codec
|
import scodec.Codec
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
|
|
||||||
|
|
@ -85,6 +85,23 @@ final case class CreateShortcutMessage(player_guid : PlanetSideGUID,
|
||||||
|
|
||||||
object Shortcut extends Marshallable[Shortcut] {
|
object Shortcut extends Marshallable[Shortcut] {
|
||||||
// Convenient predefined Shortcuts for the Medkit and Implants
|
// Convenient predefined Shortcuts for the Medkit and Implants
|
||||||
|
|
||||||
|
/**
|
||||||
|
A map to convert between ImplantTypes and Implant Shortcuts
|
||||||
|
*/
|
||||||
|
final lazy val ImplantsMap = Map(
|
||||||
|
ImplantType.AdvancedRegen->REGENERATION,
|
||||||
|
ImplantType.Targeting->ENHANCED_TARGETING,
|
||||||
|
ImplantType.AudioAmplifier->AUDIO_AMPLIFIER,
|
||||||
|
ImplantType.DarklightVision->DARKLIGHT_VISION,
|
||||||
|
ImplantType.MeleeBooster->MELEE_BOOSTER,
|
||||||
|
ImplantType.PersonalShield->PERSONAL_SHIELD,
|
||||||
|
ImplantType.RangeMagnifier->RANGE_MAGNIFIER,
|
||||||
|
ImplantType.SecondWind->SECOND_WIND,
|
||||||
|
ImplantType.SilentRun->SENSOR_SHIELD,
|
||||||
|
ImplantType.Surge->SURGE
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preset for the Audio Amplifier implant. */
|
* Preset for the Audio Amplifier implant. */
|
||||||
final val AUDIO_AMPLIFIER : Some[Shortcut] = Some(Shortcut(2, "audio_amplifier"))
|
final val AUDIO_AMPLIFIER : Some[Shortcut] = Some(Shortcut(2, "audio_amplifier"))
|
||||||
|
|
|
||||||
|
|
@ -3374,7 +3374,14 @@ class WorldSessionActor extends Actor
|
||||||
player.Actor ! Player.ImplantInitializationStart(slot)
|
player.Actor ! Player.ImplantInitializationStart(slot)
|
||||||
}
|
}
|
||||||
//TODO if this implant is Installed but does not have shortcut, add to a free slot or write over slot 61/62/63
|
//TODO if this implant is Installed but does not have shortcut, add to a free slot or write over slot 61/62/63
|
||||||
|
// for now, just write into slots 2, 3 and 4
|
||||||
|
Shortcut.ImplantsMap(implantSlot.Implant) match {
|
||||||
|
case Some(shortcut : Shortcut) =>
|
||||||
|
sendResponse(CreateShortcutMessage(guid, slot + 2, 0, addShortcut = true, Some(shortcut)))
|
||||||
|
case _ => log.warn(s"Could not find shortcut for implant ${implantSlot.Implant.toString()}")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
sendResponse(PlanetsideAttributeMessage(PlanetSideGUID(0), 82, 0))
|
sendResponse(PlanetsideAttributeMessage(PlanetSideGUID(0), 82, 0))
|
||||||
//TODO if Medkit does not have shortcut, add to a free slot or write over slot 64
|
//TODO if Medkit does not have shortcut, add to a free slot or write over slot 64
|
||||||
sendResponse(CreateShortcutMessage(guid, 1, 0, true, Shortcut.MEDKIT))
|
sendResponse(CreateShortcutMessage(guid, 1, 0, true, Shortcut.MEDKIT))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue