mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-11 22:44:37 +00:00
added OCM UniformStyle selection and command rank selection for AvatarConverter; more helpers for GlobalDefinitions
This commit is contained in:
parent
a0252e8d9a
commit
5962227ad2
2 changed files with 84 additions and 4 deletions
|
|
@ -6,7 +6,6 @@ import net.psforever.objects.definition.converter.{CommandDetonaterConverter, Lo
|
||||||
import net.psforever.objects.equipment.CItem.DeployedItem
|
import net.psforever.objects.equipment.CItem.DeployedItem
|
||||||
import net.psforever.objects.equipment._
|
import net.psforever.objects.equipment._
|
||||||
import net.psforever.objects.inventory.InventoryTile
|
import net.psforever.objects.inventory.InventoryTile
|
||||||
import net.psforever.packet.game.objectcreate.ObjectClass
|
|
||||||
import net.psforever.types.PlanetSideEmpire
|
import net.psforever.types.PlanetSideEmpire
|
||||||
|
|
||||||
object GlobalDefinitions {
|
object GlobalDefinitions {
|
||||||
|
|
@ -161,6 +160,36 @@ object GlobalDefinitions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Using the definition for a piece of `Equipment` determine if it is a grenade-type weapon.
|
||||||
|
* Only the normal grenades count; the grenade packs are excluded.
|
||||||
|
* @param edef the `EquipmentDefinition` of the item
|
||||||
|
* @return `true`, if it is a grenade-type weapon; `false`, otherwise
|
||||||
|
*/
|
||||||
|
def isGrenade(edef : EquipmentDefinition) : Boolean = {
|
||||||
|
edef match {
|
||||||
|
case `frag_grenade` | `jammer_grenade` | `plasma_grenade` =>
|
||||||
|
true
|
||||||
|
case _ =>
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Using the definition for a piece of `Equipment` determine if it is a grenade-type weapon.
|
||||||
|
* Only the grenade packs count; the normal grenades are excluded.
|
||||||
|
* @param edef the `EquipmentDefinition` of the item
|
||||||
|
* @return `true`, if it is a grenade-type weapon; `false`, otherwise
|
||||||
|
*/
|
||||||
|
def isGrenadePack(edef : EquipmentDefinition) : Boolean = {
|
||||||
|
edef match {
|
||||||
|
case `frag_cartridge` | `jammer_cartridge` | `plasma_cartridge` =>
|
||||||
|
true
|
||||||
|
case _ =>
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Using the definition for a piece of `Equipment` determine with which faction it aligns if it is a weapon.
|
* Using the definition for a piece of `Equipment` determine with which faction it aligns if it is a weapon.
|
||||||
* Only checks `Tool` objects.
|
* Only checks `Tool` objects.
|
||||||
|
|
@ -241,6 +270,7 @@ object GlobalDefinitions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import net.psforever.packet.game.objectcreate.ObjectClass
|
||||||
val
|
val
|
||||||
locker_container = new EquipmentDefinition(456) {
|
locker_container = new EquipmentDefinition(456) {
|
||||||
Name = "locker container"
|
Name = "locker container"
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ class AvatarConverter extends ObjectCreateConverter[Player]() {
|
||||||
MakeAppearanceData(obj),
|
MakeAppearanceData(obj),
|
||||||
obj.Health / obj.MaxHealth * 255, //TODO not precise
|
obj.Health / obj.MaxHealth * 255, //TODO not precise
|
||||||
obj.Armor / obj.MaxArmor * 255, //TODO not precise
|
obj.Armor / obj.MaxArmor * 255, //TODO not precise
|
||||||
UniformStyle.Normal,
|
DressBattleRank(obj),
|
||||||
0,
|
DressCommandRank(obj),
|
||||||
None, //TODO cosmetics
|
None, //TODO cosmetics
|
||||||
None, //TODO implant effects
|
None, //TODO implant effects
|
||||||
InventoryData(MakeHolsters(obj, BuildEquipment).sortBy(_.parentSlot)),
|
InventoryData(MakeHolsters(obj, BuildEquipment).sortBy(_.parentSlot)),
|
||||||
|
|
@ -38,7 +38,7 @@ class AvatarConverter extends ObjectCreateConverter[Player]() {
|
||||||
obj.Armor,
|
obj.Armor,
|
||||||
obj.MaxStamina,
|
obj.MaxStamina,
|
||||||
obj.Stamina,
|
obj.Stamina,
|
||||||
obj.Certifications.toList.sortBy(_.id),
|
obj.Certifications.toList.sortBy(_.id), //TODO is sorting necessary?
|
||||||
MakeImplantEntries(obj),
|
MakeImplantEntries(obj),
|
||||||
List.empty[String], //TODO fte list
|
List.empty[String], //TODO fte list
|
||||||
List.empty[String], //TODO tutorial list
|
List.empty[String], //TODO tutorial list
|
||||||
|
|
@ -75,6 +75,56 @@ class AvatarConverter extends ObjectCreateConverter[Player]() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the appropriate `UniformStyle` design for a player's accumulated battle experience points.
|
||||||
|
* At certain battle ranks, all exo-suits undergo some form of coloration change.
|
||||||
|
* @param obj the `Player` game object
|
||||||
|
* @return the resulting uniform upgrade level
|
||||||
|
*/
|
||||||
|
private def DressBattleRank(obj : Player) : UniformStyle.Value = {
|
||||||
|
val bep : Long = obj.BEP
|
||||||
|
if(bep > 2583440) { //BR25+
|
||||||
|
UniformStyle.ThirdUpgrade
|
||||||
|
}
|
||||||
|
else if(bep > 308989) { //BR14+
|
||||||
|
UniformStyle.SecondUpgrade
|
||||||
|
}
|
||||||
|
else if(bep > 44999) { //BR7+
|
||||||
|
UniformStyle.FirstUpgrade
|
||||||
|
}
|
||||||
|
else { //BR1+
|
||||||
|
UniformStyle.Normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the appropriate design for a player's accumulated command experience points.
|
||||||
|
* Visual cues for command rank include armlets, anklets, and, finally, a backpack, awarded at different ranks.
|
||||||
|
* @param obj the `Player` game object
|
||||||
|
* @return the resulting uniform upgrade level
|
||||||
|
*/
|
||||||
|
private def DressCommandRank(obj : Player) : Int = {
|
||||||
|
val cep = obj.CEP
|
||||||
|
if(cep > 599999) {
|
||||||
|
5
|
||||||
|
}
|
||||||
|
else if(cep > 299999) {
|
||||||
|
4
|
||||||
|
}
|
||||||
|
else if(cep > 149999) {
|
||||||
|
3
|
||||||
|
}
|
||||||
|
else if(cep > 49999) {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
else if(cep > 9999) {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an `Array` of `Implant` objects into a `List` of `ImplantEntry` objects suitable as packet data.
|
* Transform an `Array` of `Implant` objects into a `List` of `ImplantEntry` objects suitable as packet data.
|
||||||
* @param obj the `Player` game object
|
* @param obj the `Player` game object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue