diff --git a/src/main/java/com/projectswg/common/data/combat/AttackInfo.java b/src/main/java/com/projectswg/common/data/combat/AttackInfo.java
deleted file mode 100644
index a2324b2..0000000
--- a/src/main/java/com/projectswg/common/data/combat/AttackInfo.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
-
-public class AttackInfo {
-
- private boolean success = true;
- private long armor = 0;
- private int rawDamage = 0;
- private DamageType damageType = DamageType.KINETIC;
- private int elementalDamage = 0;
- private DamageType elementalDamageType = DamageType.KINETIC;
- private int bleedDamage = 0;
- private int criticalDamage = 0;
- private int blockedDamage = 0;
- private int finalDamage = 0;
- private HitLocation hitLocation = HitLocation.HIT_LOCATION_BODY;
- private boolean crushing = false;
- private boolean strikethrough = false;
- private double strikethroughAmount = 0;
- private boolean evadeResult = false;
- private double evadeAmount = 0;
- private boolean blockResult = false;
- private int block = 0;
- private boolean dodge = false;
- private boolean parry = false;
- private boolean critical = false;
- private boolean glancing = false;
- private boolean proc = false;
-
- public boolean isSuccess() {
- return success;
- }
-
- public long getArmor() {
- return armor;
- }
-
- public int getRawDamage() {
- return rawDamage;
- }
-
- public DamageType getDamageType() {
- return damageType;
- }
-
- public int getElementalDamage() {
- return elementalDamage;
- }
-
- public DamageType getElementalDamageType() {
- return elementalDamageType;
- }
-
- public int getBleedDamage() {
- return bleedDamage;
- }
-
- public int getCriticalDamage() {
- return criticalDamage;
- }
-
- public int getBlockedDamage() {
- return blockedDamage;
- }
-
- public int getFinalDamage() {
- return finalDamage;
- }
-
- public HitLocation getHitLocation() {
- return hitLocation;
- }
-
- public boolean isCrushing() {
- return crushing;
- }
-
- public boolean isStrikethrough() {
- return strikethrough;
- }
-
- public double getStrikethroughAmount() {
- return strikethroughAmount;
- }
-
- public boolean isEvadeResult() {
- return evadeResult;
- }
-
- public double getEvadeAmount() {
- return evadeAmount;
- }
-
- public boolean isBlockResult() {
- return blockResult;
- }
-
- public int getBlock() {
- return block;
- }
-
- public boolean isDodge() {
- return dodge;
- }
-
- public boolean isParry() {
- return parry;
- }
-
- public boolean isCritical() {
- return critical;
- }
-
- public boolean isGlancing() {
- return glancing;
- }
-
- public boolean isProc() {
- return proc;
- }
-
- public void setSuccess(boolean success) {
- this.success = success;
- }
-
- public void setArmor(long armor) {
- this.armor = armor;
- }
-
- public void setRawDamage(int rawDamage) {
- this.rawDamage = rawDamage;
- }
-
- public void setDamageType(DamageType damageType) {
- this.damageType = damageType;
- }
-
- public void setElementalDamage(int elementalDamage) {
- this.elementalDamage = elementalDamage;
- }
-
- public void setElementalDamageType(DamageType elementalDamageType) {
- this.elementalDamageType = elementalDamageType;
- }
-
- public void setBleedDamage(int bleedDamage) {
- this.bleedDamage = bleedDamage;
- }
-
- public void setCriticalDamage(int criticalDamage) {
- this.criticalDamage = criticalDamage;
- }
-
- public void setBlockedDamage(int blockedDamage) {
- this.blockedDamage = blockedDamage;
- }
-
- public void setFinalDamage(int finalDamage) {
- this.finalDamage = finalDamage;
- }
-
- public void setHitLocation(HitLocation hitLocation) {
- this.hitLocation = hitLocation;
- }
-
- public void setCrushing(boolean crushing) {
- this.crushing = crushing;
- }
-
- public void setStrikethrough(boolean strikethrough) {
- this.strikethrough = strikethrough;
- }
-
- public void setStrikethroughAmount(double strikethroughAmount) {
- this.strikethroughAmount = strikethroughAmount;
- }
-
- public void setEvadeResult(boolean evadeResult) {
- this.evadeResult = evadeResult;
- }
-
- public void setEvadeAmount(double evadeAmount) {
- this.evadeAmount = evadeAmount;
- }
-
- public void setBlockResult(boolean blockResult) {
- this.blockResult = blockResult;
- }
-
- public void setBlock(int block) {
- this.block = block;
- }
-
- public void setDodge(boolean dodge) {
- this.dodge = dodge;
- }
-
- public void setParry(boolean parry) {
- this.parry = parry;
- }
-
- public void setCritical(boolean critical) {
- this.critical = critical;
- }
-
- public void setGlancing(boolean glancing) {
- this.glancing = glancing;
- }
-
- public void setProc(boolean proc) {
- this.proc = proc;
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/AttackInfo.kt b/src/main/java/com/projectswg/common/data/combat/AttackInfo.kt
new file mode 100644
index 0000000..570651b
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/AttackInfo.kt
@@ -0,0 +1,53 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+class AttackInfo {
+ var isSuccess: Boolean = true
+ var armor: Long = 0
+ var rawDamage: Int = 0
+ var damageType: DamageType = DamageType.KINETIC
+ var elementalDamage: Int = 0
+ var elementalDamageType: DamageType = DamageType.KINETIC
+ var bleedDamage: Int = 0
+ var criticalDamage: Int = 0
+ var blockedDamage: Int = 0
+ var finalDamage: Int = 0
+ var hitLocation: HitLocation = HitLocation.HIT_LOCATION_BODY
+ var isCrushing: Boolean = false
+ var isStrikethrough: Boolean = false
+ var strikethroughAmount: Double = 0.0
+ var isEvadeResult: Boolean = false
+ var evadeAmount: Double = 0.0
+ var isBlockResult: Boolean = false
+ var block: Int = 0
+ var isDodge: Boolean = false
+ var isParry: Boolean = false
+ var isCritical: Boolean = false
+ var isGlancing: Boolean = false
+ var isProc: Boolean = false
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/AttackType.java b/src/main/java/com/projectswg/common/data/combat/AttackType.java
deleted file mode 100644
index 7af4a03..0000000
--- a/src/main/java/com/projectswg/common/data/combat/AttackType.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
-
-public enum AttackType {
- CONE (0),
- SINGLE_TARGET (1),
- AREA (2),
- TARGET_AREA (3),
- DUAL_WIELD (4),
- RAMPAGE (5),
- RANDOM_HATE_TARGET (6),
- RANDOM_HATE_TARGET_CONE (7),
- RANDOM_HATE_TARGET_CONE_TERMINUS (8),
- HATE_LIST (9),
- RANDOM_HATE_MULTI (10),
- AREA_PROGRESSIVE (11),
- SPLIT_DAMAGE_TARGET_AREA (12),
- DISTANCE_FARTHEST (13);
-
- private static final AttackType [] VALUES = values();
-
- private int num;
-
- AttackType(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static AttackType getAttackType(int num) {
- if (num < 0 || num >= VALUES.length)
- return AttackType.SINGLE_TARGET;
- return VALUES[num];
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.java b/src/main/java/com/projectswg/common/data/combat/AttackType.kt
similarity index 55%
rename from src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.java
rename to src/main/java/com/projectswg/common/data/combat/AttackType.kt
index baedb13..6a6b606 100644
--- a/src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.java
+++ b/src/main/java/com/projectswg/common/data/combat/AttackType.kt
@@ -1,51 +1,53 @@
/***********************************************************************************
* Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
+ * *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
* Our goal is to create an emulator which will provide a server for players to *
* continue playing a game similar to the one they used to play. We are basing *
* it on the final publish of the game prior to end-game events. *
- * *
+ * *
* This file is part of PSWGCommon. *
- * *
+ * *
* --------------------------------------------------------------------------------*
- * *
+ * *
* PSWGCommon is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
- * *
+ * *
* PSWGCommon is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
- * *
+ * *
* You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
-import com.projectswg.common.data.EnumLookup;
+enum class AttackType(val num: Int) {
+ CONE(0),
+ SINGLE_TARGET(1),
+ AREA(2),
+ TARGET_AREA(3),
+ DUAL_WIELD(4),
+ RAMPAGE(5),
+ RANDOM_HATE_TARGET(6),
+ RANDOM_HATE_TARGET_CONE(7),
+ RANDOM_HATE_TARGET_CONE_TERMINUS(8),
+ HATE_LIST(9),
+ RANDOM_HATE_MULTI(10),
+ AREA_PROGRESSIVE(11),
+ SPLIT_DAMAGE_TARGET_AREA(12),
+ DISTANCE_FARTHEST(13);
-public enum DelayAttackEggPosition {
- LOCATION (1),
- TARGET (2),
- SELF (3);
-
- private static final EnumLookup LOOKUP = new EnumLookup<>(DelayAttackEggPosition.class, DelayAttackEggPosition::getNum);
-
- private final int num;
-
- DelayAttackEggPosition(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static DelayAttackEggPosition getEggPosition(int num) {
- return LOOKUP.getEnum(num, SELF);
+ companion object {
+ private val VALUES = entries.toTypedArray()
+
+ fun getAttackType(num: Int): AttackType {
+ if (num < 0 || num >= VALUES.size) return SINGLE_TARGET
+ return VALUES[num]
+ }
}
}
diff --git a/src/main/java/com/projectswg/common/data/combat/CombatSpamType.java b/src/main/java/com/projectswg/common/data/combat/CombatSpamType.kt
similarity index 60%
rename from src/main/java/com/projectswg/common/data/combat/CombatSpamType.java
rename to src/main/java/com/projectswg/common/data/combat/CombatSpamType.kt
index 0a1ac13..940a662 100644
--- a/src/main/java/com/projectswg/common/data/combat/CombatSpamType.java
+++ b/src/main/java/com/projectswg/common/data/combat/CombatSpamType.kt
@@ -1,37 +1,37 @@
/***********************************************************************************
* Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
+ * *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
* Our goal is to create an emulator which will provide a server for players to *
* continue playing a game similar to the one they used to play. We are basing *
* it on the final publish of the game prior to end-game events. *
- * *
+ * *
* This file is part of PSWGCommon. *
- * *
+ * *
* --------------------------------------------------------------------------------*
- * *
+ * *
* PSWGCommon is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
- * *
+ * *
* PSWGCommon is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
- * *
+ * *
* You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
-import com.projectswg.common.data.EnumLookup;
+import com.projectswg.common.data.EnumLookup
/**
* Determines color for entries in the combat log client-side
*/
-public enum CombatSpamType {
+enum class CombatSpamType(val num: Int) {
MISS(0),
HIT(1),
BLOCK(2),
@@ -45,25 +45,16 @@ public enum CombatSpamType {
GENERIC(10),
OUT_OF_RANGE(11),
POSTURE_CHANGE(12),
- TETHERED(13), // AI was forced to return to original location
+ TETHERED(13), // AI was forced to return to original location
MEDICAL(14),
BUFF(15),
DEBUFF(16);
-
- private static final EnumLookup LOOKUP = new EnumLookup<>(CombatSpamType.class, CombatSpamType::getNum);
-
- private int num;
-
- CombatSpamType(int num) {
- this.num = num;
+
+ companion object {
+ private val LOOKUP = EnumLookup(CombatSpamType::class.java) { obj: CombatSpamType -> obj.num }
+
+ fun getCombatSpamType(num: Int): CombatSpamType {
+ return LOOKUP.getEnum(num, HIT)
+ }
}
-
- public int getNum() {
- return num;
- }
-
- public static CombatSpamType getCombatSpamType(int num) {
- return LOOKUP.getEnum(num, HIT);
- }
-
}
diff --git a/src/main/java/com/projectswg/common/data/combat/DamageType.java b/src/main/java/com/projectswg/common/data/combat/DamageType.java
deleted file mode 100644
index 4a865b4..0000000
--- a/src/main/java/com/projectswg/common/data/combat/DamageType.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-public enum DamageType {
- KINETIC (1),
- ENERGY (2),
- BLAST (4),
- STUN (8),
- RESTAINT (16),
- ELEMENTAL_HEAT (32),
- ELEMENTAL_COLD (64),
- ELEMENTAL_ACID (128),
- ELEMENTAL_ELECTRICAL (256);
-
- private static final DamageType [] VALUES = values();
-
- private int num;
-
- DamageType(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static DamageType getDamageType(int num) {
- for (DamageType type : VALUES) {
- if ((num & type.getNum()) != 0)
- return type;
- }
- return KINETIC;
- }
-
- public static Set getDamageTypes(int num) {
- Set types = EnumSet.noneOf(DamageType.class);
- for (DamageType type : VALUES) {
- if ((num & type.getNum()) != 0)
- types.add(type);
- }
- return types;
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/DamageType.kt b/src/main/java/com/projectswg/common/data/combat/DamageType.kt
new file mode 100644
index 0000000..02767a8
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/DamageType.kt
@@ -0,0 +1,60 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+import java.util.*
+
+enum class DamageType(val num: Int) {
+ KINETIC(1),
+ ENERGY(2),
+ BLAST(4),
+ STUN(8),
+ RESTAINT(16),
+ ELEMENTAL_HEAT(32),
+ ELEMENTAL_COLD(64),
+ ELEMENTAL_ACID(128),
+ ELEMENTAL_ELECTRICAL(256);
+
+ companion object {
+ private val VALUES = entries.toTypedArray()
+
+ fun getDamageType(num: Int): DamageType {
+ for (type in VALUES) {
+ if ((num and type.num) != 0) return type
+ }
+ return KINETIC
+ }
+
+ fun getDamageTypes(num: Int): Set {
+ val types: MutableSet = EnumSet.noneOf(DamageType::class.java)
+ for (type in VALUES) {
+ if ((num and type.num) != 0) types.add(type)
+ }
+ return types
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.kt b/src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.kt
new file mode 100644
index 0000000..6008564
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/DelayAttackEggPosition.kt
@@ -0,0 +1,43 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+import com.projectswg.common.data.EnumLookup
+
+enum class DelayAttackEggPosition(val num: Int) {
+ LOCATION(1),
+ TARGET(2),
+ SELF(3);
+
+ companion object {
+ private val LOOKUP = EnumLookup(DelayAttackEggPosition::class.java) { obj: DelayAttackEggPosition -> obj.num }
+
+ fun getEggPosition(num: Int): DelayAttackEggPosition {
+ return LOOKUP.getEnum(num, SELF)
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/HealAttrib.kt b/src/main/java/com/projectswg/common/data/combat/HealAttrib.kt
new file mode 100644
index 0000000..d45d209
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/HealAttrib.kt
@@ -0,0 +1,42 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+import com.projectswg.common.data.EnumLookup
+
+enum class HealAttrib(val num: Int) {
+ HEALTH(0),
+ ACTION(2);
+
+ companion object {
+ private val LOOKUP = EnumLookup(HealAttrib::class.java) { obj: HealAttrib -> obj.num }
+
+ fun getHealAttrib(num: Int): HealAttrib {
+ return LOOKUP.getEnum(num, HEALTH)
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/HitLocation.java b/src/main/java/com/projectswg/common/data/combat/HitLocation.java
deleted file mode 100644
index 30e9d35..0000000
--- a/src/main/java/com/projectswg/common/data/combat/HitLocation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
-
-public enum HitLocation {
- HIT_LOCATION_BODY (0),
- HIT_LOCATION_HEAD (1),
- HIT_LOCATION_R_ARM (2),
- HIT_LOCATION_L_ARM (3),
- HIT_LOCATION_R_LEG (4),
- HIT_LOCATION_L_LEG (5),
- HIT_LOCATION_NUM_LOCATIONS (6);
-
- private static final HitLocation [] VALUES = values();
-
- private int num;
-
- HitLocation(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static HitLocation getHitLocation(int num) {
- if (num < 0 || num >= VALUES.length)
- return HIT_LOCATION_BODY;
- return VALUES[num];
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/HitLocation.kt b/src/main/java/com/projectswg/common/data/combat/HitLocation.kt
new file mode 100644
index 0000000..5495413
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/HitLocation.kt
@@ -0,0 +1,46 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+enum class HitLocation(val num: Int) {
+ HIT_LOCATION_BODY(0),
+ HIT_LOCATION_HEAD(1),
+ HIT_LOCATION_R_ARM(2),
+ HIT_LOCATION_L_ARM(3),
+ HIT_LOCATION_R_LEG(4),
+ HIT_LOCATION_L_LEG(5),
+ HIT_LOCATION_NUM_LOCATIONS(6);
+
+ companion object {
+ private val VALUES = entries.toTypedArray()
+
+ fun getHitLocation(num: Int): HitLocation {
+ if (num < 0 || num >= VALUES.size) return HIT_LOCATION_BODY
+ return VALUES[num]
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/HitType.java b/src/main/java/com/projectswg/common/data/combat/HitType.java
deleted file mode 100644
index d8f24c9..0000000
--- a/src/main/java/com/projectswg/common/data/combat/HitType.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.combat;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum HitType {
- ATTACK (-1),
- BUFF (0),
- DEBUFF (4),
- HEAL (5),
- DELAY_ATTACK (6),
- REVIVE (7);
-
- private static final Map HIT_TYPES = new HashMap<>();
-
- static {
- for(HitType hitType : values()) {
- HIT_TYPES.put(hitType.getNum(), hitType);
- }
- }
-
- private final int num;
-
- HitType(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static HitType getHitType(int num) {
- return HIT_TYPES.getOrDefault(num, ATTACK);
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/HitType.kt b/src/main/java/com/projectswg/common/data/combat/HitType.kt
new file mode 100644
index 0000000..6944cbb
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/HitType.kt
@@ -0,0 +1,50 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+enum class HitType(val num: Int) {
+ ATTACK(-1),
+ BUFF(0),
+ DEBUFF(4),
+ HEAL(5),
+ DELAY_ATTACK(6),
+ REVIVE(7);
+
+ companion object {
+ private val HIT_TYPES: MutableMap = HashMap()
+
+ init {
+ for (hitType in entries) {
+ HIT_TYPES[hitType.num] = hitType
+ }
+ }
+
+ fun getHitType(num: Int): HitType {
+ return HIT_TYPES.getOrDefault(num, ATTACK)
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/HealAttrib.java b/src/main/java/com/projectswg/common/data/combat/TargetType.kt
similarity index 80%
rename from src/main/java/com/projectswg/common/data/combat/HealAttrib.java
rename to src/main/java/com/projectswg/common/data/combat/TargetType.kt
index 5f9b39a..49ef694 100644
--- a/src/main/java/com/projectswg/common/data/combat/HealAttrib.java
+++ b/src/main/java/com/projectswg/common/data/combat/TargetType.kt
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -24,27 +24,20 @@
* You should have received a copy of the GNU Affero General Public License *
* along with PSWGCommon. If not, see . *
***********************************************************************************/
-package com.projectswg.common.data.combat;
+package com.projectswg.common.data.combat
-import com.projectswg.common.data.EnumLookup;
+import com.projectswg.common.data.EnumLookup
-public enum HealAttrib {
- HEALTH(0),
- ACTION(2);
-
- private static final EnumLookup LOOKUP = new EnumLookup<>(HealAttrib.class, HealAttrib::getNum);
-
- private int num;
-
- HealAttrib(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static HealAttrib getHealAttrib(int num) {
- return LOOKUP.getEnum(num, HEALTH);
+enum class TargetType(val num: Int) {
+ NONE(0),
+ REQUIRED(1),
+ OPTIONAL(2);
+
+ companion object {
+ private val LOOKUP = EnumLookup(TargetType::class.java) { obj: TargetType -> obj.num }
+
+ fun getByNum(num: Int): TargetType {
+ return LOOKUP.getEnum(num, NONE)
+ }
}
}
diff --git a/src/main/java/com/projectswg/common/data/combat/TrailLocation.kt b/src/main/java/com/projectswg/common/data/combat/TrailLocation.kt
new file mode 100644
index 0000000..722f78d
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/combat/TrailLocation.kt
@@ -0,0 +1,56 @@
+/***********************************************************************************
+ * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see //www.gnu.org/licenses/>. *
+ */
+package com.projectswg.common.data.combat
+
+import java.util.*
+
+enum class TrailLocation(val num: Int) {
+ LEFT_FOOT(0x01),
+ RIGHT_FOOT(0x02),
+ LEFT_HAND(0x04),
+ RIGHT_HAND(0x08),
+ WEAPON(0x10);
+
+ companion object {
+ private val VALUES = entries.toTypedArray()
+
+ fun getTrailLocation(num: Int): TrailLocation {
+ for (type in VALUES) {
+ if ((num and type.num) != 0) return type
+ }
+ return WEAPON
+ }
+
+ fun getTrailLocations(num: Int): Set {
+ val types: MutableSet = EnumSet.noneOf(TrailLocation::class.java)
+ for (type in VALUES) {
+ if ((num and type.num) != 0) types.add(type)
+ }
+ return types
+ }
+ }
+}
diff --git a/src/main/java/com/projectswg/common/data/combat/ValidTarget.java b/src/main/java/com/projectswg/common/data/combat/ValidTarget.kt
similarity index 80%
rename from src/main/java/com/projectswg/common/data/combat/ValidTarget.java
rename to src/main/java/com/projectswg/common/data/combat/ValidTarget.kt
index 1921616..ce146d3 100644
--- a/src/main/java/com/projectswg/common/data/combat/ValidTarget.java
+++ b/src/main/java/com/projectswg/common/data/combat/ValidTarget.kt
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -24,37 +24,27 @@
* You should have received a copy of the GNU Affero General Public License *
* along with PSWGCommon. If not, see . *
***********************************************************************************/
-package com.projectswg.common.data.combat;
+package com.projectswg.common.data.combat
-public enum ValidTarget {
- NONE (-1),
+enum class ValidTarget(val num: Int) {
+ NONE(-1),
STANDARD(0),
- MOB (1),
+ MOB(1),
CREATURE(2),
- NPC (3),
- DROID (4),
- PVP (5),
- JEDI (6),
- DEAD (7),
- FRIEND (8);
-
- private static final ValidTarget [] VALUES = values();
-
- private int num;
-
- ValidTarget(int num) {
- this.num = num;
+ NPC(3),
+ DROID(4),
+ PVP(5),
+ JEDI(6),
+ DEAD(7),
+ FRIEND(8);
+
+ companion object {
+ private val VALUES = entries.toTypedArray()
+
+ fun getValidTarget(num: Int): ValidTarget {
+ val idx = num + 1
+ if (idx < 0 || idx >= VALUES.size) return STANDARD
+ return VALUES[idx]
+ }
}
-
- public int getNum() {
- return num;
- }
-
- public static ValidTarget getValidTarget(int num) {
- ++num;
- if (num < 0 || num >= VALUES.length)
- return STANDARD;
- return VALUES[num];
- }
-
}
diff --git a/src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.java b/src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.java
deleted file mode 100644
index 327819e..0000000
--- a/src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2023 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.encodables.chat;
-
-import java.util.Locale;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.projectswg.common.encoding.Encodable;
-import com.projectswg.common.network.NetBuffer;
-
-public class ChatAvatar implements Encodable {
-
- private static final AtomicReference GALAXY = new AtomicReference<>("");
- private static final ChatAvatar SYSTEM_AVATAR = new ChatAvatar("system");
-
- private String name;
-
- public ChatAvatar() {
- this(null);
- }
-
- public ChatAvatar(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public String getGalaxy() {
- return GALAXY.get();
- }
-
- @Override
- public int getLength() {
- return 9 + name.length() + GALAXY.get().length();
- }
-
- @Override
- public byte[] encode() {
- NetBuffer buffer = NetBuffer.allocate(getLength());
- buffer.addAscii("SWG");
- buffer.addAscii(GALAXY.get());
- buffer.addAscii(name);
- return buffer.array();
- }
-
- @Override
- public void decode(NetBuffer data) {
- data.getAscii(); // SWG
- data.getAscii();
- name = data.getAscii().toLowerCase(Locale.US);
- }
-
- @Override
- public String toString() {
- return String.format("ChatAvatar[name='%s']", name);
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof ChatAvatar))
- return false;
- return ((ChatAvatar) o).getName().equals(getName());
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- public static ChatAvatar getSystemAvatar() {
- return SYSTEM_AVATAR;
- }
-
- public static void setGalaxy(String galaxy) {
- GALAXY.set(galaxy);
- }
-
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/TrailLocation.java b/src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.kt
similarity index 63%
rename from src/main/java/com/projectswg/common/data/combat/TrailLocation.java
rename to src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.kt
index 131bc16..0dc96aa 100644
--- a/src/main/java/com/projectswg/common/data/combat/TrailLocation.java
+++ b/src/main/java/com/projectswg/common/data/encodables/chat/ChatAvatar.kt
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -24,45 +24,58 @@
* You should have received a copy of the GNU Affero General Public License *
* along with PSWGCommon. If not, see . *
***********************************************************************************/
-package com.projectswg.common.data.combat;
+package com.projectswg.common.data.encodables.chat
-import java.util.EnumSet;
-import java.util.Set;
+import com.projectswg.common.encoding.Encodable
+import com.projectswg.common.network.NetBuffer
+import java.util.concurrent.atomic.AtomicReference
-public enum TrailLocation {
- LEFT_FOOT (0x01),
- RIGHT_FOOT (0x02),
- LEFT_HAND (0x04),
- RIGHT_HAND (0x08),
- WEAPON (0x10);
-
- private static final TrailLocation [] VALUES = values();
-
- private int num;
-
- TrailLocation(int num) {
- this.num = num;
- }
-
- public int getNum() {
- return num;
- }
-
- public static TrailLocation getTrailLocation(int num) {
- for (TrailLocation type : VALUES) {
- if ((num & type.getNum()) != 0)
- return type;
+class ChatAvatar(name: String) : Encodable {
+ var name: String = name
+ get() {
+ assert(field.isNotEmpty())
+ return field
}
- return WEAPON;
+
+ val galaxy: String
+ get() = GALAXY.get()
+
+ override val length: Int
+ get() = 9 + name.length + GALAXY.get().length
+
+ override fun encode(): ByteArray {
+ val buffer = NetBuffer.allocate(length)
+ buffer.addAscii("SWG")
+ buffer.addAscii(GALAXY.get())
+ buffer.addAscii(name)
+ return buffer.array()
}
-
- public static Set getTrailLocations(int num) {
- Set types = EnumSet.noneOf(TrailLocation.class);
- for (TrailLocation type : VALUES) {
- if ((num & type.getNum()) != 0)
- types.add(type);
+
+ override fun decode(data: NetBuffer) {
+ data.ascii // SWG
+ data.ascii
+ name = data.ascii.lowercase()
+ }
+
+ override fun toString(): String {
+ return String.format("ChatAvatar[name='%s']", name)
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (other !is ChatAvatar) return false
+ return other.name == this.name
+ }
+
+ override fun hashCode(): Int {
+ return name.hashCode()
+ }
+
+ companion object {
+ private val GALAXY = AtomicReference("")
+ val systemAvatar: ChatAvatar = ChatAvatar("system")
+
+ fun setGalaxy(galaxy: String) {
+ GALAXY.set(galaxy)
}
- return types;
}
-
}
diff --git a/src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.java b/src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.java
deleted file mode 100644
index 55dad81..0000000
--- a/src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.encodables.chat;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Waverunner
- */
-public enum ChatResult {
- NONE (-1), // The client will just display an "unknown error code" if this is used.
- SUCCESS (0),
- TARGET_AVATAR_DOESNT_EXIST (4),
- ROOM_INVALID_ID (5),
- ROOM_INVALID_NAME (6),
- CUSTOM_FAILURE (9),
- ROOM_AVATAR_BANNED (12),
- ROOM_PRIVATE (13),
- ROOM_AVATAR_NO_PERMISSION (16),
- IGNORED (23),
- ROOM_ALREADY_EXISTS (24),
- ROOM_ALREADY_JOINED (36),
- CHAT_SERVER_UNAVAILABLE (1000000),
- ROOM_DIFFERENT_FACTION (1000001),
- ROOM_NOT_GCW_DEFENDER_FACTION (1000005);
-
- private static final Map RESULT_MAP = new HashMap<>();
-
- static {
- for (ChatResult result : values()) {
- RESULT_MAP.put(result.getCode(), result);
- }
- }
-
- private final int code;
-
- ChatResult(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
-
- public static ChatResult fromInteger(int code) {
- ChatResult result = RESULT_MAP.get(code);
- if (result == null)
- return NONE;
- return result;
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/combat/TargetType.java b/src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.kt
similarity index 72%
rename from src/main/java/com/projectswg/common/data/combat/TargetType.java
rename to src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.kt
index 5a35c25..42ec689 100644
--- a/src/main/java/com/projectswg/common/data/combat/TargetType.java
+++ b/src/main/java/com/projectswg/common/data/encodables/chat/ChatResult.kt
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -24,36 +24,32 @@
* You should have received a copy of the GNU Affero General Public License *
* along with PSWGCommon. If not, see . *
***********************************************************************************/
-package com.projectswg.common.data.combat;
+package com.projectswg.common.data.encodables.chat
-public enum TargetType {
- NONE ("none", 0),
- REQUIRED("required", 1),
- OPTIONAL("optional", 2);
-
- private static final TargetType [] VALUES = values();
-
- private final String name;
- private final int num;
-
- TargetType(String name, int num) {
- this.name = name;
- this.num = num;
- }
-
- public String getName() {
- return name;
- }
+import com.projectswg.common.data.EnumLookup
- public int getNum() {
- return num;
- }
+enum class ChatResult(val code: Int) {
+ NONE(-1), // The client will just display an "unknown error code" if this is used.
+ SUCCESS(0),
+ TARGET_AVATAR_DOESNT_EXIST(4),
+ ROOM_INVALID_ID(5),
+ ROOM_INVALID_NAME(6),
+ CUSTOM_FAILURE(9),
+ ROOM_AVATAR_BANNED(12),
+ ROOM_PRIVATE(13),
+ ROOM_AVATAR_NO_PERMISSION(16),
+ IGNORED(23),
+ ROOM_ALREADY_EXISTS(24),
+ ROOM_ALREADY_JOINED(36),
+ CHAT_SERVER_UNAVAILABLE(1000000),
+ ROOM_DIFFERENT_FACTION(1000001),
+ ROOM_NOT_GCW_DEFENDER_FACTION(1000005);
- public static TargetType getByNum(int num) {
- for (TargetType p : VALUES) {
- if (p.getNum() == num)
- return p;
+ companion object {
+ private val LOOKUP = EnumLookup(ChatResult::class.java) { obj: ChatResult -> obj.code }
+
+ fun fromInteger(code: Int): ChatResult {
+ return LOOKUP.getEnum(code, NONE)
}
- return NONE;
}
}
diff --git a/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.java b/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.java
deleted file mode 100644
index a556ba8..0000000
--- a/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/***********************************************************************************
- * Copyright (c) 2023 /// Project SWG /// www.projectswg.com *
- * *
- * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
- * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
- * Our goal is to create an emulator which will provide a server for players to *
- * continue playing a game similar to the one they used to play. We are basing *
- * it on the final publish of the game prior to end-game events. *
- * *
- * This file is part of PSWGCommon. *
- * *
- * --------------------------------------------------------------------------------*
- * *
- * PSWGCommon is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU Affero General Public License as *
- * published by the Free Software Foundation, either version 3 of the *
- * License, or (at your option) any later version. *
- * *
- * PSWGCommon is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Affero General Public License for more details. *
- * *
- * You should have received a copy of the GNU Affero General Public License *
- * along with PSWGCommon. If not, see . *
- ***********************************************************************************/
-package com.projectswg.common.data.encodables.chat;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.projectswg.common.encoding.CachedEncode;
-import com.projectswg.common.encoding.Encodable;
-import com.projectswg.common.network.NetBuffer;
-
-public class ChatRoom implements Encodable {
-
- private final CachedEncode cache;
- private final Set moderators;
- private final Set invited;
- private final Set banned;
- private final Set members;
-
- private int id;
- private int type;
- private String path;
- private ChatAvatar owner;
- private ChatAvatar creator;
- private String title;
- private boolean moderated; // No one but moderators can talk
-
- public ChatRoom() {
- this.cache = new CachedEncode(this::encodeImpl);
- this.moderators = ConcurrentHashMap.newKeySet();
- this.invited = ConcurrentHashMap.newKeySet();
- this.members = ConcurrentHashMap.newKeySet();
- this.banned = ConcurrentHashMap.newKeySet();
-
- this.id = 0;
- this.type = 0;
- this.path = null;
- this.owner = new ChatAvatar();
- this.creator = new ChatAvatar();
- this.title = null;
- this.moderated = false;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.cache.clearCached();
- this.id = id;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.cache.clearCached();
- this.type = type;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.cache.clearCached();
- this.path = path;
- }
-
- public ChatAvatar getOwner() {
- return owner;
- }
-
- public void setOwner(ChatAvatar owner) {
- this.cache.clearCached();
- this.owner = owner;
- }
-
- public ChatAvatar getCreator() {
- return creator;
- }
-
- public void setCreator(ChatAvatar creator) {
- this.cache.clearCached();
- this.creator = creator;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.cache.clearCached();
- this.title = title;
- }
-
- public List getModerators() {
- return new ArrayList<>(moderators);
- }
-
- public List getInvited() {
- return new ArrayList<>(invited);
- }
-
- public boolean isModerated() {
- return moderated;
- }
-
- public void setModerated(boolean moderated) {
- this.cache.clearCached();
- this.moderated = moderated;
- }
-
- public List getMembers() {
- return new ArrayList<>(members);
- }
-
- public boolean isPublic() {
- return type == 0;
- }
-
- public void setIsPublic(boolean isPublic) {
- this.cache.clearCached();
- this.type = (isPublic ? 0 : 1);
- }
-
- public List getBanned() {
- return new ArrayList<>(banned);
- }
-
- public ChatResult canJoinRoom(ChatAvatar avatar, boolean ignoreInvitation) {
- if (banned.contains(avatar))
- return ChatResult.ROOM_AVATAR_BANNED;
-
- if (members.contains(avatar))
- return ChatResult.ROOM_ALREADY_JOINED;
-
- if (isPublic() || ignoreInvitation || invited.contains(avatar) || moderators.contains(avatar))
- return ChatResult.SUCCESS;
-
- return ChatResult.ROOM_AVATAR_NO_PERMISSION;
- }
-
- public ChatResult canSendMessage(ChatAvatar avatar) {
- if (banned.contains(avatar))
- return ChatResult.ROOM_AVATAR_BANNED;
-
- if (moderated && !moderators.contains(avatar))
- return ChatResult.CUSTOM_FAILURE;
-
- return ChatResult.SUCCESS;
- }
-
- public boolean isModerator(ChatAvatar avatar) {
- return avatar.equals(owner) || moderators.contains(avatar);
- }
-
- public boolean isMember(ChatAvatar avatar) {
- return members.contains(avatar);
- }
-
- public boolean isBanned(ChatAvatar avatar) {
- return banned.contains(avatar);
- }
-
- public boolean isInvited(ChatAvatar avatar) {
- return invited.contains(avatar);
- }
-
- public boolean addMember(ChatAvatar avatar) {
- this.cache.clearCached();
- return members.add(avatar);
- }
-
- public boolean removeMember(ChatAvatar avatar) {
- this.cache.clearCached();
- return members.remove(avatar);
- }
-
- public boolean addModerator(ChatAvatar avatar) {
- this.cache.clearCached();
- return moderators.add(avatar);
- }
-
- public boolean removeModerator(ChatAvatar avatar) {
- this.cache.clearCached();
- return moderators.remove(avatar);
- }
-
- public boolean addInvited(ChatAvatar avatar) {
- this.cache.clearCached();
- return invited.add(avatar);
- }
-
- public boolean removeInvited(ChatAvatar avatar) {
- this.cache.clearCached();
- return invited.remove(avatar);
- }
-
- public boolean addBanned(ChatAvatar avatar) {
- this.cache.clearCached();
- return banned.add(avatar);
- }
-
- public boolean removeBanned(ChatAvatar avatar) {
- this.cache.clearCached();
- return banned.remove(avatar);
- }
-
- @Override
- public void decode(NetBuffer data) {
- id = data.getInt();
- type = data.getInt();
- moderated = data.getBoolean();
- path = data.getAscii();
- owner = data.getEncodable(ChatAvatar.class);
- creator = data.getEncodable(ChatAvatar.class);
- title = data.getUnicode();
- moderators.clear();
- moderators.addAll(data.getList(ChatAvatar.class));
- invited.clear();
- invited.addAll(data.getList(ChatAvatar.class));
- }
-
- @Override
- public byte[] encode() {
- return cache.encode();
- }
-
- private byte[] encodeImpl() {
- NetBuffer data = NetBuffer.allocate(getLength());
- data.addInt(id);
- data.addInt(type);
- data.addBoolean(moderated);
- data.addAscii(path);
- data.addEncodable(owner);
- data.addEncodable(creator);
- data.addUnicode(title);
- data.addList(moderators);
- data.addList(invited);
- return data.array();
- }
-
- @Override
- public int getLength() {
- int avatarIdSize = 0; // The encode method for ChatAvatar saves the encode result if the class was modified/null data
-
- for (ChatAvatar moderator : moderators) {
- avatarIdSize += moderator.getLength();
- }
- for (ChatAvatar invitee : invited) {
- avatarIdSize += invitee.getLength();
- }
-
- avatarIdSize += owner.getLength() + creator.getLength();
- return 23 + path.length() + (title.length() * 2) + avatarIdSize;
- }
-
- @Override
- public String toString() {
- return "ChatRoom[id=" + id + ", type=" + type + ", path='" + path + "', title='" + title + '\'' + ", creator=" + creator + ", moderated=" + moderated + ", isPublic=" + isPublic() + "]";
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- ChatRoom chatRoom = (ChatRoom) o;
- return id == chatRoom.id && type == chatRoom.type && moderated == chatRoom.moderated && Objects.equals(moderators, chatRoom.moderators) && Objects.equals(invited, chatRoom.invited) && Objects.equals(banned, chatRoom.banned) && Objects.equals(path, chatRoom.path) && Objects.equals(owner, chatRoom.owner) && Objects.equals(creator, chatRoom.creator) && Objects.equals(title, chatRoom.title);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(moderators, invited, banned, id, type, path, owner, creator, title, moderated);
- }
-}
diff --git a/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.kt b/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.kt
new file mode 100644
index 0000000..d82f5b7
--- /dev/null
+++ b/src/main/java/com/projectswg/common/data/encodables/chat/ChatRoom.kt
@@ -0,0 +1,236 @@
+/***********************************************************************************
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
+ * *
+ * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
+ * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
+ * Our goal is to create an emulator which will provide a server for players to *
+ * continue playing a game similar to the one they used to play. We are basing *
+ * it on the final publish of the game prior to end-game events. *
+ * *
+ * This file is part of PSWGCommon. *
+ * *
+ * --------------------------------------------------------------------------------*
+ * *
+ * PSWGCommon is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Affero General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * PSWGCommon is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Affero General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Affero General Public License *
+ * along with PSWGCommon. If not, see . *
+ ***********************************************************************************/
+package com.projectswg.common.data.encodables.chat
+
+import com.projectswg.common.encoding.CachedEncode
+import com.projectswg.common.encoding.Encodable
+import com.projectswg.common.network.NetBuffer
+import java.util.*
+import java.util.concurrent.ConcurrentHashMap
+
+class ChatRoom : Encodable {
+ private val cache = CachedEncode { this.encodeImpl() }
+ private val _moderators = ConcurrentHashMap.newKeySet()
+ private val _invited = ConcurrentHashMap.newKeySet()
+ private val _banned = ConcurrentHashMap.newKeySet()
+ private val _members = ConcurrentHashMap.newKeySet()
+
+ var id: Int = 0
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var type: Int = 0
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var path: String = ""
+ get() {
+ assert(field.isNotEmpty())
+ return field
+ }
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var owner: ChatAvatar = ChatAvatar("")
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var creator: ChatAvatar = ChatAvatar("")
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var title: String = ""
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var isModerated: Boolean = false // No one but moderators can talk
+ set(value) {
+ cache.clearCached()
+ field = value
+ }
+ var isPublic: Boolean
+ get() = type == 0
+ set(isPublic) {
+ cache.clearCached()
+ this.type = (if (isPublic) 0 else 1)
+ }
+
+ val moderators: List
+ get() { return ArrayList(_moderators) }
+
+ val invited: List
+ get() { return ArrayList(_invited) }
+
+ val members: List
+ get() { return ArrayList(_members) }
+
+ val banned: List
+ get() { return ArrayList(_banned) }
+
+ fun canJoinRoom(avatar: ChatAvatar, ignoreInvitation: Boolean): ChatResult {
+ if (_banned.contains(avatar)) return ChatResult.ROOM_AVATAR_BANNED
+
+ if (_members.contains(avatar)) return ChatResult.ROOM_ALREADY_JOINED
+
+ if (isPublic || ignoreInvitation || _invited.contains(avatar) || _moderators.contains(avatar)) return ChatResult.SUCCESS
+
+ return ChatResult.ROOM_AVATAR_NO_PERMISSION
+ }
+
+ fun canSendMessage(avatar: ChatAvatar): ChatResult {
+ if (_banned.contains(avatar)) return ChatResult.ROOM_AVATAR_BANNED
+
+ if (isModerated && !_moderators.contains(avatar)) return ChatResult.CUSTOM_FAILURE
+
+ return ChatResult.SUCCESS
+ }
+
+ fun isModerator(avatar: ChatAvatar): Boolean {
+ return avatar == owner || _moderators.contains(avatar)
+ }
+
+ fun isMember(avatar: ChatAvatar): Boolean {
+ return _members.contains(avatar)
+ }
+
+ fun isBanned(avatar: ChatAvatar): Boolean {
+ return _banned.contains(avatar)
+ }
+
+ fun isInvited(avatar: ChatAvatar): Boolean {
+ return _invited.contains(avatar)
+ }
+
+ fun addMember(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _members.add(avatar)
+ }
+
+ fun removeMember(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _members.remove(avatar)
+ }
+
+ fun addModerator(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _moderators.add(avatar)
+ }
+
+ fun removeModerator(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _moderators.remove(avatar)
+ }
+
+ fun addInvited(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _invited.add(avatar)
+ }
+
+ fun removeInvited(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _invited.remove(avatar)
+ }
+
+ fun addBanned(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _banned.add(avatar)
+ }
+
+ fun removeBanned(avatar: ChatAvatar): Boolean {
+ cache.clearCached()
+ return _banned.remove(avatar)
+ }
+
+ override fun decode(data: NetBuffer) {
+ id = data.int
+ type = data.int
+ isModerated = data.boolean
+ path = data.ascii
+ owner = data.getEncodable(ChatAvatar::class.java)
+ creator = data.getEncodable(ChatAvatar::class.java)
+ title = data.unicode
+ _moderators.clear()
+ _moderators.addAll(data.getList(ChatAvatar::class.java))
+ _invited.clear()
+ _invited.addAll(data.getList(ChatAvatar::class.java))
+ }
+
+ override fun encode(): ByteArray {
+ return cache.encode()
+ }
+
+ private fun encodeImpl(): ByteArray {
+ val data = NetBuffer.allocate(length)
+ data.addInt(id)
+ data.addInt(type)
+ data.addBoolean(isModerated)
+ data.addAscii(path)
+ data.addEncodable(owner)
+ data.addEncodable(creator)
+ data.addUnicode(title)
+ data.addList(_moderators)
+ data.addList(_invited)
+ return data.array()
+ }
+
+ override val length: Int
+ get() {
+ var avatarIdSize = 0 // The encode method for ChatAvatar saves the encode result if the class was modified/null data
+
+ for (moderator in _moderators) {
+ avatarIdSize += moderator.length
+ }
+ for (invitee in _invited) {
+ avatarIdSize += invitee.length
+ }
+
+ avatarIdSize += owner.length + creator.length
+ return 23 + path.length + (title.length * 2) + avatarIdSize
+ }
+
+ override fun toString(): String {
+ return "ChatRoom[id=$id, type=$type, path='$path', title='$title', creator=$creator, moderated=$isModerated, isPublic=$isPublic]"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || javaClass != other.javaClass) return false
+ val chatRoom = other as ChatRoom
+ return id == chatRoom.id && type == chatRoom.type && isModerated == chatRoom.isModerated && _moderators == chatRoom._moderators && _invited == chatRoom._invited && _banned == chatRoom._banned && path == chatRoom.path && owner == chatRoom.owner && creator == chatRoom.creator && title == chatRoom.title
+ }
+
+ override fun hashCode(): Int {
+ return Objects.hash(_moderators, _invited, _banned, id, type, path, owner, creator, title, isModerated)
+ }
+
+}
diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnEnteredRoom.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnEnteredRoom.java
index 7543854..29b06ce 100644
--- a/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnEnteredRoom.java
+++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnEnteredRoom.java
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -64,7 +64,7 @@ public class ChatOnEnteredRoom extends SWGPacket {
if (!super.checkDecode(data, CRC))
return;
avatar = data.getEncodable(ChatAvatar.class);
- result = ChatResult.fromInteger(data.getInt());
+ result = ChatResult.Companion.fromInteger(data.getInt());
chatRoomId = data.getInt();
sequence = data.getInt();
}
diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java
index fd41c4b..99332f0 100644
--- a/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java
+++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -45,7 +45,7 @@ public class ChatOnSendPersistentMessage extends SWGPacket {
public void decode(NetBuffer data) {
if (!super.checkDecode(data, CRC))
return;
- result = ChatResult.fromInteger(data.getInt());
+ result = ChatResult.Companion.fromInteger(data.getInt());
count = data.getInt();
}
diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatAction.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatAction.java
index 317015a..8ff6f07 100644
--- a/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatAction.java
+++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatAction.java
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -67,7 +67,7 @@ public class CombatAction extends ObjectController {
attackerId = data.getLong();
weaponId = data.getLong();
posture = Posture.getFromId(data.getByte());
- trail = TrailLocation.getTrailLocation(data.getByte());
+ trail = TrailLocation.Companion.getTrailLocation(data.getByte());
clientEffectId = data.getByte();
commandCrc = data.getInt();
int count = data.getShort();
@@ -77,7 +77,7 @@ public class CombatAction extends ObjectController {
d.setPosture(Posture.getFromId(data.getByte()));
d.setDefense(data.getBoolean());
d.setClientEffectId(data.getByte());
- d.setHitLocation(HitLocation.getHitLocation(data.getByte()));
+ d.setHitLocation(HitLocation.Companion.getHitLocation(data.getByte()));
d.setDamage(data.getShort());
defenders.add(d);
}
diff --git a/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatSpam.java b/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatSpam.java
index d2d2441..5b32e8e 100644
--- a/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatSpam.java
+++ b/src/main/java/com/projectswg/common/network/packets/swg/zone/object_controller/combat/CombatSpam.java
@@ -1,5 +1,5 @@
/***********************************************************************************
- * Copyright (c) 2018 /// Project SWG /// www.projectswg.com *
+ * Copyright (c) 2024 /// Project SWG /// www.projectswg.com *
* *
* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on *
* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. *
@@ -72,19 +72,19 @@ public class CombatSpam extends ObjectController {
if (info.isSuccess()) {
info.setArmor(data.getLong());
info.setRawDamage(data.getInt());
- info.setDamageType(DamageType.getDamageType(data.getInt()));
+ info.setDamageType(DamageType.Companion.getDamageType(data.getInt()));
info.setElementalDamage(data.getInt());
- info.setElementalDamageType(DamageType.getDamageType(data.getInt()));
+ info.setElementalDamageType(DamageType.Companion.getDamageType(data.getInt()));
info.setBleedDamage(data.getInt());
info.setCriticalDamage(data.getInt());
info.setBlockedDamage(data.getInt());
info.setFinalDamage(data.getInt());
- info.setHitLocation(HitLocation.getHitLocation(data.getInt()));
+ info.setHitLocation(HitLocation.Companion.getHitLocation(data.getInt()));
}
} else if (isMessageData(dataType)) {
spamMessage = data.getEncodable(OutOfBandPackage.class);
}
- spamType = CombatSpamType.getCombatSpamType(data.getInt());
+ spamType = CombatSpamType.Companion.getCombatSpamType(data.getInt());
}
@Override