mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 15:04:39 +00:00
fix item swap
This commit is contained in:
parent
60989f488a
commit
aa0ae5f731
3 changed files with 17 additions and 2 deletions
|
|
@ -102,7 +102,7 @@ class SessionTerminalHandlers(
|
||||||
lastTerminalOrderFulfillment = true
|
lastTerminalOrderFulfillment = true
|
||||||
|
|
||||||
case Terminal.BuyVehicle(vehicle, _, _)
|
case Terminal.BuyVehicle(vehicle, _, _)
|
||||||
if tplayer.avatar.purchaseCooldown(vehicle.Definition).nonEmpty =>
|
if tplayer.avatar.purchaseCooldown(vehicle.Definition).nonEmpty || tplayer.spectator =>
|
||||||
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Buy, success = false))
|
sendResponse(ItemTransactionResultMessage(msg.terminal_guid, TransactionType.Buy, success = false))
|
||||||
lastTerminalOrderFulfillment = true
|
lastTerminalOrderFulfillment = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
player.Name,
|
player.Name,
|
||||||
AvatarAction.ObjectHeld(player.GUID, before, -1)
|
AvatarAction.ObjectHeld(player.GUID, before, -1)
|
||||||
)
|
)
|
||||||
} else if (!resistance && before != slot && (player.DrawnSlot = slot) != before) {
|
} else if ((!resistance && before != slot && (player.DrawnSlot = slot) != before) && ItemSwapSlot != before) {
|
||||||
val mySlot = if (updateMyHolsterArm) slot else -1 //use as a short-circuit
|
val mySlot = if (updateMyHolsterArm) slot else -1 //use as a short-circuit
|
||||||
events ! AvatarServiceMessage(
|
events ! AvatarServiceMessage(
|
||||||
player.Continent,
|
player.Continent,
|
||||||
|
|
@ -352,6 +352,9 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
log.info(s"${player.Name} lowers ${player.Sex.possessive} hand")
|
log.info(s"${player.Name} lowers ${player.Sex.possessive} hand")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UpdateItemSwapSlot
|
||||||
|
} else if (ItemSwapSlot == before) {
|
||||||
|
UpdateItemSwapSlot
|
||||||
}
|
}
|
||||||
|
|
||||||
case Terminal.TerminalMessage(_, msg, order) =>
|
case Terminal.TerminalMessage(_, msg, order) =>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ trait ContainableBehavior {
|
||||||
* The destination is set back to normal - flag to `0` - when both of the attempts short-circuit due to timeout.
|
* The destination is set back to normal - flag to `0` - when both of the attempts short-circuit due to timeout.
|
||||||
*/
|
*/
|
||||||
private var waitOnMoveItemOps: Int = 0
|
private var waitOnMoveItemOps: Int = 0
|
||||||
|
private var itemSwapSlot: Int = 10 // Just a number higher than any inventory item slots
|
||||||
|
|
||||||
final val containerBehavior: Receive = {
|
final val containerBehavior: Receive = {
|
||||||
/* messages that modify delivery order */
|
/* messages that modify delivery order */
|
||||||
|
|
@ -136,6 +137,15 @@ trait ContainableBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Functions (item transfer) */
|
/* Functions (item transfer) */
|
||||||
|
// For issue 1108
|
||||||
|
def UpdateItemSwapSlot: Int = {
|
||||||
|
itemSwapSlot = 10
|
||||||
|
itemSwapSlot
|
||||||
|
}
|
||||||
|
// For issue 1108
|
||||||
|
def ItemSwapSlot: Int = {
|
||||||
|
itemSwapSlot
|
||||||
|
}
|
||||||
|
|
||||||
protected def ContainableMoveItem(
|
protected def ContainableMoveItem(
|
||||||
destination: PlanetSideServerObject with Container,
|
destination: PlanetSideServerObject with Container,
|
||||||
|
|
@ -154,6 +164,7 @@ trait ContainableBehavior {
|
||||||
LocalPutItemInSlot(item, dest) match {
|
LocalPutItemInSlot(item, dest) match {
|
||||||
case Containable.ItemPutInSlot(_, _, _, None) => ; //success
|
case Containable.ItemPutInSlot(_, _, _, None) => ; //success
|
||||||
case Containable.ItemPutInSlot(_, _, _, Some(swapItem)) => //success, but with swap item
|
case Containable.ItemPutInSlot(_, _, _, Some(swapItem)) => //success, but with swap item
|
||||||
|
itemSwapSlot = dest
|
||||||
LocalPutItemInSlotOnlyOrAway(swapItem, slot) match {
|
LocalPutItemInSlotOnlyOrAway(swapItem, slot) match {
|
||||||
case Containable.ItemPutInSlot(_, _, _, None) => ;
|
case Containable.ItemPutInSlot(_, _, _, None) => ;
|
||||||
case _ =>
|
case _ =>
|
||||||
|
|
@ -174,6 +185,7 @@ trait ContainableBehavior {
|
||||||
case Success(Containable.ItemPutInSlot(_, _, _, None)) => ; //successful
|
case Success(Containable.ItemPutInSlot(_, _, _, None)) => ; //successful
|
||||||
|
|
||||||
case Success(Containable.ItemPutInSlot(_, _, _, Some(swapItem))) => //successful, but with swap item
|
case Success(Containable.ItemPutInSlot(_, _, _, Some(swapItem))) => //successful, but with swap item
|
||||||
|
itemSwapSlot = dest
|
||||||
PutItBackOrDropIt(source, swapItem, slot, destination.Actor)
|
PutItBackOrDropIt(source, swapItem, slot, destination.Actor)
|
||||||
|
|
||||||
case Success(_: Containable.CanNotPutItemInSlot) => //failure case ; try restore original item placement
|
case Success(_: Containable.CanNotPutItemInSlot) => //failure case ; try restore original item placement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue