mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 02:24:45 +00:00
Implied Swap Item (#530)
* by deleting a swap item for the entirety of a zone, avert the end of the world * drop the item you are holding when you die
This commit is contained in:
parent
3bdc681c9d
commit
d46110874e
|
|
@ -1892,6 +1892,12 @@ class SessionActor extends Actor with MDCContextAware {
|
|||
|
||||
case AvatarResponse.Killed(mount) =>
|
||||
val respawnTimer = 300.seconds
|
||||
//drop free hand item
|
||||
player.FreeHand.Equipment match {
|
||||
case Some(item) =>
|
||||
DropEquipmentFromInventory(player)(item)
|
||||
case None => ;
|
||||
}
|
||||
ToggleMaxSpecialState(enable = false)
|
||||
keepAliveFunc = NormalKeepAlive
|
||||
zoningStatus = Zoning.Status.None
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class LockerContainerControl(locker: LockerContainer, toChannel: String) extends
|
|||
)
|
||||
}
|
||||
|
||||
def SwapItemCallback(item: Equipment): Unit = {
|
||||
def SwapItemCallback(item: Equipment, fromSlot: Int): Unit = {
|
||||
val zone = locker.Zone
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
toChannel,
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class CorpseControl(player: Player) extends Actor with ContainableBehavior {
|
|||
)
|
||||
}
|
||||
|
||||
def SwapItemCallback(item: Equipment): Unit = {
|
||||
def SwapItemCallback(item: Equipment, fromSlot: Int): Unit = {
|
||||
val obj = ContainerObject
|
||||
val zone = obj.Zone
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
|
|
|
|||
|
|
@ -861,12 +861,13 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
|||
}
|
||||
}
|
||||
|
||||
def SwapItemCallback(item: Equipment): Unit = {
|
||||
def SwapItemCallback(item: Equipment, fromSlot: Int): Unit = {
|
||||
val obj = ContainerObject
|
||||
val zone = obj.Zone
|
||||
val toChannel = if (obj.VisibleSlots.contains(fromSlot)) zone.id else player.Name
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
player.Name,
|
||||
AvatarAction.SendResponse(Service.defaultPlayerGUID, ObjectDetachMessage(obj.GUID, item.GUID, Vector3.Zero, 0f))
|
||||
toChannel,
|
||||
AvatarAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ trait ContainableBehavior {
|
|||
ContainableBehavior.TryPutItemInSlot(destination, item, dest) match {
|
||||
case (true, swapItem) =>
|
||||
swapItem match {
|
||||
case Some(thing) => SwapItemCallback(thing)
|
||||
case Some(thing) => SwapItemCallback(thing, dest)
|
||||
case None => ;
|
||||
}
|
||||
PutItemInSlotCallback(item, dest)
|
||||
|
|
@ -249,7 +249,7 @@ trait ContainableBehavior {
|
|||
ContainableBehavior.TryPutItemInSlotOrAway(destination, item, dest) match {
|
||||
case (Some(slot), swapItem) =>
|
||||
swapItem match {
|
||||
case Some(thing) => SwapItemCallback(thing)
|
||||
case Some(thing) => SwapItemCallback(thing, slot)
|
||||
case None => ;
|
||||
}
|
||||
PutItemInSlotCallback(item, slot)
|
||||
|
|
@ -330,8 +330,9 @@ trait ContainableBehavior {
|
|||
* Reaction to the existence of a swap item being produced from a container into the environment.
|
||||
* To be implemented.
|
||||
* @param item the item that was removed
|
||||
* @param fromSlot the slot from where the item was removed (where it previous was)
|
||||
*/
|
||||
def SwapItemCallback(item: Equipment): Unit
|
||||
def SwapItemCallback(item: Equipment, fromSlot: Int): Unit
|
||||
}
|
||||
|
||||
object ContainableBehavior {
|
||||
|
|
@ -626,7 +627,7 @@ object Containable {
|
|||
/**
|
||||
* A response for the `RemoveItemFromSlot` message.
|
||||
* It serves the dual purpose of reporting a missing item (by not reporting any slot information)
|
||||
* and reporting no item ata given position (by not reporting any item information).
|
||||
* and reporting no item at a given position (by not reporting any item information).
|
||||
* @param obj the container
|
||||
* @param item the equipment that was removed
|
||||
* @param slot the index position from which any item was removed
|
||||
|
|
|
|||
|
|
@ -450,12 +450,13 @@ class VehicleControl(vehicle: Vehicle)
|
|||
}
|
||||
}
|
||||
|
||||
def SwapItemCallback(item: Equipment): Unit = {
|
||||
def SwapItemCallback(item: Equipment, fromSlot: Int): Unit = {
|
||||
val obj = ContainerObject
|
||||
val zone = obj.Zone
|
||||
val toChannel = if (obj.VisibleSlots.contains(fromSlot)) zone.id else self.toString
|
||||
zone.VehicleEvents ! VehicleServiceMessage(
|
||||
self.toString,
|
||||
VehicleAction.SendResponse(Service.defaultPlayerGUID, ObjectDetachMessage(obj.GUID, item.GUID, Vector3.Zero, 0f))
|
||||
toChannel,
|
||||
VehicleAction.ObjectDelete(Service.defaultPlayerGUID, item.GUID)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue