2017-11-08 21:00:46 -05:00
|
|
|
// Copyright (c) 2017 PSForever
|
|
|
|
|
package objects.terminal
|
|
|
|
|
|
|
|
|
|
import akka.actor.ActorRef
|
2018-03-24 00:28:02 -04:00
|
|
|
import net.psforever.objects.serverobject.structures.{Building, StructureType}
|
2018-03-19 20:13:39 -04:00
|
|
|
import net.psforever.objects.{Avatar, GlobalDefinitions, Player}
|
2017-11-08 21:00:46 -05:00
|
|
|
import net.psforever.objects.serverobject.terminals.Terminal
|
2018-01-26 15:32:08 -05:00
|
|
|
import net.psforever.objects.zones.Zone
|
2017-11-08 21:00:46 -05:00
|
|
|
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
2018-06-08 21:07:47 -04:00
|
|
|
import net.psforever.types.{CharacterGender, CharacterVoice, PlanetSideEmpire, TransactionType}
|
2017-11-08 21:00:46 -05:00
|
|
|
import org.specs2.mutable.Specification
|
|
|
|
|
|
|
|
|
|
class GroundVehicleTerminalTest extends Specification {
|
|
|
|
|
"Ground_Vehicle_Terminal" should {
|
2018-06-08 21:07:47 -04:00
|
|
|
val player = Player(Avatar("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Mute))
|
2018-01-26 15:32:08 -05:00
|
|
|
val terminal = Terminal(GlobalDefinitions.ground_vehicle_terminal)
|
2018-03-24 00:28:02 -04:00
|
|
|
terminal.Owner = new Building(0, Zone.Nowhere, StructureType.Building)
|
2018-01-26 15:32:08 -05:00
|
|
|
terminal.Owner.Faction = PlanetSideEmpire.TR
|
2017-11-08 21:00:46 -05:00
|
|
|
|
|
|
|
|
"construct" in {
|
|
|
|
|
val terminal = Terminal(GlobalDefinitions.ground_vehicle_terminal)
|
|
|
|
|
terminal.Actor mustEqual ActorRef.noSender
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"player can buy a harasser ('two_man_assault_buggy')" in {
|
|
|
|
|
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
2018-01-26 15:32:08 -05:00
|
|
|
|
2017-11-08 21:00:46 -05:00
|
|
|
val reply = terminal.Request(player, msg)
|
|
|
|
|
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
|
|
|
|
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
|
|
|
|
reply2.vehicle.Definition mustEqual GlobalDefinitions.two_man_assault_buggy
|
2017-12-11 18:17:05 -05:00
|
|
|
reply2.weapons mustEqual Nil
|
|
|
|
|
reply2.inventory.length mustEqual 6
|
|
|
|
|
reply2.inventory.head.obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
|
|
|
|
reply2.inventory(1).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
|
|
|
|
reply2.inventory(2).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
|
|
|
|
reply2.inventory(3).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
|
|
|
|
reply2.inventory(4).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
|
|
|
|
reply2.inventory(5).obj.Definition mustEqual GlobalDefinitions.bullet_12mm
|
2017-11-08 21:00:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"player can not buy a fake vehicle ('harasser')" in {
|
|
|
|
|
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "harasser", 0, PlanetSideGUID(0))
|
|
|
|
|
|
|
|
|
|
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|