ObjectCreateMessage Alterations, Class Object Adjustments (#243)

* power outage failure resulting in the destruction of the original ocm-fixes branch; the git branch refs were corrupted during commit, but the up-to-date changed files remained intact

* eliminating the need for CommonFieldData2 and CommonFieldData2WithPlacement

* in the middle of integrating CommonFieldData into DetailedLockerContainerData (but not standard LockerContainerData); added field for final boolean in WeaponData

* adding faction affinity to Equipment (to match functionality; not becuase I know what ends ...)

* in the middle of integrating CommonFieldData into DetailedCommandDetonaterData

* applying faction affinity to objects at time of terminal production (but to what ends?); required BoomerTrigger and AmmoBox to always report as NEUTRAL internally

* completed the transition from using the old class-based order terminal system to the page-based order terminal system; unused terminal classes have been eliminated

* more closely aligned TelepadDeployableData and InternalTelepadDeployableData

* modifying TelepadDeployableData make it generic and eliminate the need for InternalTelepadDeployableData after fixing a packet converter to utilize DroppedItemData

* modified Terminal operation to branch further outwards from Terminal.Request to the TerminalDefinition's Request method; modified tests to reflect update

* loosening up matrix terminal definition limitations

* modified ProximityTerminal to support a custom defintition class

* rendered the message passing system for Terminals general (Any) in the full scale so it can be specific in instance cases

* refactored and moved both EquipmentSlot and ExoSuitDefinition

* (re)load Favorites each time player (re)spawns
This commit is contained in:
Fate-JH 2019-03-03 08:23:30 -05:00 committed by GitHub
parent 5fc9e191fe
commit 337cfbe5d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
174 changed files with 6281 additions and 5477 deletions

View file

@ -3,9 +3,10 @@ package objects
import net.psforever.objects.GlobalDefinitions._
import net.psforever.objects._
import net.psforever.objects.definition.{ImplantDefinition, SimpleItemDefinition}
import net.psforever.objects.definition.{ImplantDefinition, SimpleItemDefinition, SpecialExoSuitDefinition}
import net.psforever.objects.equipment.EquipmentSize
import net.psforever.packet.game.PlanetSideGUID
import net.psforever.packet.game.objectcreate.{Cosmetics, PersonalStyle}
import net.psforever.types._
import org.specs2.mutable._
@ -521,6 +522,115 @@ class PlayerTest extends Specification {
obj.UsingSpecial != test mustEqual true
}
"start with a nonexistent cosmetic state" in {
TestPlayer("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5).PersonalStyleFeatures.isEmpty mustEqual true
}
"will not gain cosmetic state if player does not have a certain amount of BEP" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
obj.PersonalStyleFeatures.isEmpty mustEqual true
val (a1, b1) = obj.AddToPersonalStyle(PersonalStyle.Beret)
a1.isEmpty mustEqual true
b1.isEmpty mustEqual true
obj.PersonalStyleFeatures.isEmpty mustEqual true
avatar.BEP = 2286231 //BR24
val (a2, b2) = obj.AddToPersonalStyle(PersonalStyle.Beret)
a2.isEmpty mustEqual true
b2 match {
case Some(c : Cosmetics) =>
c.Styles mustEqual Set(PersonalStyle.Beret)
case _ =>
ko
}
obj.PersonalStyleFeatures.isEmpty mustEqual false
}
"will lose cosmetic state" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
avatar.BEP = 2286231 //BR24
obj.AddToPersonalStyle(PersonalStyle.Beret)
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Beret))) mustEqual true
val (a2, b2) = obj.RemoveFromPersonalStyle(PersonalStyle.Beret)
a2 match {
case Some(c : Cosmetics) =>
c.Styles mustEqual Set(PersonalStyle.Beret)
case _ =>
ko
}
b2 match {
case Some(c : Cosmetics) =>
c.Styles mustEqual Set.empty
case _ =>
ko
}
}
"will not lose cosmetic state if the player doesn't have any cosmetic state to begin with" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
obj.PersonalStyleFeatures.isEmpty mustEqual true
val (a1, b1) = obj.RemoveFromPersonalStyle(PersonalStyle.Beret)
a1.isEmpty mustEqual true
b1.isEmpty mustEqual true
}
"toggle helmet" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
avatar.BEP = 2286231
obj.PersonalStyleFeatures.isEmpty mustEqual true
obj.ToggleHelmet
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.NoHelmet))) mustEqual true
obj.ToggleHelmet
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
obj.ToggleHelmet
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.NoHelmet))) mustEqual true
}
"toggle suglasses" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
avatar.BEP = 2286231
obj.PersonalStyleFeatures.isEmpty mustEqual true
obj.ToggleShades
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Sunglasses))) mustEqual true
obj.ToggleShades
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
obj.ToggleShades
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Sunglasses))) mustEqual true
}
"toggle earpiece" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
avatar.BEP = 2286231
obj.PersonalStyleFeatures.isEmpty mustEqual true
obj.ToggleEarpiece
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Earpiece))) mustEqual true
obj.ToggleEarpiece
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
obj.ToggleEarpiece
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Earpiece))) mustEqual true
}
"toggle between brimmed cap and beret" in {
val avatar = Avatar("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
val obj = Player(avatar)
avatar.BEP = 2286231
obj.PersonalStyleFeatures.isEmpty mustEqual true
obj.ToggleHat
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.BrimmedCap))) mustEqual true
obj.ToggleHat
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.Beret))) mustEqual true
obj.ToggleHat
obj.PersonalStyleFeatures.contains(Cosmetics()) mustEqual true
obj.ToggleHat
obj.PersonalStyleFeatures.contains(Cosmetics(Set(PersonalStyle.BrimmedCap))) mustEqual true
}
"toString" in {
val obj = TestPlayer("Chord", PlanetSideEmpire.TR, CharacterGender.Male, 0, CharacterVoice.Voice5)
obj.toString mustEqual "TR Chord 0/100 0/50"