mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-07 22:13:40 -04:00
Merged combat intents into a single kotlin file
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2019 /// 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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
|
||||
@file:Suppress("NOTHING_TO_INLINE")
|
||||
|
||||
package com.projectswg.holocore.intents.gameplay.combat
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject
|
||||
import me.joshlarson.jlcommon.control.Intent
|
||||
|
||||
/*
|
||||
* Combat events after the fact
|
||||
*/
|
||||
data class CreatureIncapacitatedIntent(val incapper: CreatureObject, val incappee: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(incapper: CreatureObject, incapee: CreatureObject) = CreatureIncapacitatedIntent(incapper, incapee).broadcast()
|
||||
}
|
||||
}
|
||||
data class CreatureKilledIntent(val killer: CreatureObject, val corpse: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(killer: CreatureObject, corpse: CreatureObject) = CreatureKilledIntent(killer, corpse).broadcast()
|
||||
}
|
||||
}
|
||||
data class CreatureRevivedIntent(val creature: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(creature: CreatureObject) = CreatureRevivedIntent(creature).broadcast()
|
||||
}
|
||||
}
|
||||
data class EnterCombatIntent(val source: CreatureObject, val target: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(source: CreatureObject, target: CreatureObject) = EnterCombatIntent(source, target).broadcast()
|
||||
}
|
||||
}
|
||||
data class ExitCombatIntent(val source: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(source: CreatureObject) = ExitCombatIntent(source).broadcast()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Combat event requests
|
||||
*/
|
||||
data class IncapacitateCreatureIntent(val incapper: CreatureObject, val incappee: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(incapper: CreatureObject, incapee: CreatureObject) = IncapacitateCreatureIntent(incapper, incapee).broadcast()
|
||||
}
|
||||
}
|
||||
data class KillCreatureIntent(val killer: CreatureObject, val corpse: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(killer: CreatureObject, corpse: CreatureObject) = KillCreatureIntent(killer, corpse).broadcast()
|
||||
}
|
||||
}
|
||||
data class DeathblowIntent(val killer: CreatureObject, val corpse: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(killer: CreatureObject, corpse: CreatureObject) = DeathblowIntent(killer, corpse).broadcast()
|
||||
}
|
||||
}
|
||||
data class RequestCreatureDeathIntent(val killer: CreatureObject, val corpse: CreatureObject): Intent() {
|
||||
companion object {
|
||||
@JvmStatic inline fun broadcast(killer: CreatureObject, corpse: CreatureObject) = RequestCreatureDeathIntent(killer, corpse).broadcast()
|
||||
}
|
||||
}
|
||||
-51
@@ -1,51 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
|
||||
public class CreatureIncapacitatedIntent extends Intent {
|
||||
|
||||
private final CreatureObject incapper;
|
||||
private final CreatureObject incappee;
|
||||
|
||||
public CreatureIncapacitatedIntent(CreatureObject incapper, CreatureObject incappee) {
|
||||
this.incapper = incapper;
|
||||
this.incappee = incappee;
|
||||
}
|
||||
|
||||
public CreatureObject getIncapper() {
|
||||
return incapper;
|
||||
}
|
||||
|
||||
public CreatureObject getIncappee() {
|
||||
return incappee;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-50
@@ -1,50 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
|
||||
public class CreatureKilledIntent extends Intent {
|
||||
|
||||
private final CreatureObject killer;
|
||||
private final CreatureObject corpse;
|
||||
|
||||
public CreatureKilledIntent(CreatureObject killer, CreatureObject corpse) {
|
||||
this.killer = killer;
|
||||
this.corpse = corpse;
|
||||
}
|
||||
|
||||
public CreatureObject getKiller() {
|
||||
return killer;
|
||||
}
|
||||
|
||||
public CreatureObject getCorpse() {
|
||||
return corpse;
|
||||
}
|
||||
|
||||
}
|
||||
-50
@@ -1,50 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CreatureRevivedIntent extends Intent {
|
||||
|
||||
private final CreatureObject creature;
|
||||
|
||||
public CreatureRevivedIntent(@NotNull CreatureObject creature) {
|
||||
this.creature = creature;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getCreature() {
|
||||
return creature;
|
||||
}
|
||||
|
||||
public static void broadcast(@NotNull CreatureObject creature) {
|
||||
new CreatureRevivedIntent(creature).broadcast();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
|
||||
public class DeathblowIntent extends Intent {
|
||||
|
||||
private final CreatureObject killer;
|
||||
private final CreatureObject corpse;
|
||||
|
||||
/**
|
||||
* @param killer {@code CreatureObject} that's deathblowing
|
||||
* @param corpse {@code CreatureObject} that's being deathblown
|
||||
*/
|
||||
public DeathblowIntent(CreatureObject killer, CreatureObject corpse) {
|
||||
this.killer = killer;
|
||||
this.corpse = corpse;
|
||||
}
|
||||
|
||||
public CreatureObject getKiller() {
|
||||
return killer;
|
||||
}
|
||||
|
||||
public CreatureObject getCorpse() {
|
||||
return corpse;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EnterCombatIntent extends Intent {
|
||||
|
||||
private final CreatureObject source;
|
||||
private final CreatureObject target;
|
||||
|
||||
public EnterCombatIntent(@NotNull CreatureObject source, @NotNull CreatureObject target) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public static void broadcast(@NotNull CreatureObject source, @NotNull CreatureObject target) {
|
||||
new EnterCombatIntent(source, target).broadcast();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ExitCombatIntent extends Intent {
|
||||
|
||||
private final CreatureObject source;
|
||||
|
||||
public ExitCombatIntent(@NotNull CreatureObject source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public static void broadcast(@NotNull CreatureObject source) {
|
||||
new ExitCombatIntent(source).broadcast();
|
||||
}
|
||||
|
||||
}
|
||||
-51
@@ -1,51 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
|
||||
public class IncapacitateCreatureIntent extends Intent {
|
||||
|
||||
private final CreatureObject incapper;
|
||||
private final CreatureObject incappee;
|
||||
|
||||
public IncapacitateCreatureIntent(CreatureObject incapper, CreatureObject incappee) {
|
||||
this.incapper = incapper;
|
||||
this.incappee = incappee;
|
||||
}
|
||||
|
||||
public CreatureObject getIncapper() {
|
||||
return incapper;
|
||||
}
|
||||
|
||||
public CreatureObject getIncappee() {
|
||||
return incappee;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,50 +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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
|
||||
public class KillCreatureIntent extends Intent {
|
||||
|
||||
private final CreatureObject killer;
|
||||
private final CreatureObject corpse;
|
||||
|
||||
public KillCreatureIntent(CreatureObject killer, CreatureObject corpse) {
|
||||
this.killer = killer;
|
||||
this.corpse = corpse;
|
||||
}
|
||||
|
||||
public CreatureObject getKiller() {
|
||||
return killer;
|
||||
}
|
||||
|
||||
public CreatureObject getCorpse() {
|
||||
return corpse;
|
||||
}
|
||||
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package com.projectswg.holocore.intents.gameplay.combat;
|
||||
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RequestCreatureDeathIntent extends Intent {
|
||||
|
||||
private final CreatureObject corpse;
|
||||
private final CreatureObject killer;
|
||||
|
||||
public RequestCreatureDeathIntent(@NotNull CreatureObject corpse, @NotNull CreatureObject killer) {
|
||||
this.corpse = corpse;
|
||||
this.killer = killer;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getCorpse() {
|
||||
return corpse;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CreatureObject getKiller() {
|
||||
return killer;
|
||||
}
|
||||
|
||||
public static void broadcast(@NotNull CreatureObject corpse, @NotNull CreatureObject killer) {
|
||||
new RequestCreatureDeathIntent(corpse, killer).broadcast();
|
||||
}
|
||||
|
||||
}
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2019 /// 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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************************/
|
||||
|
||||
package com.projectswg.holocore.resources.support.data.server_info.loader.npc;
|
||||
|
||||
import com.projectswg.holocore.resources.support.data.server_info.SdbLoader;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.SdbLoader.SdbResultSet;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.DataLoader;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureDifficulty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
|
||||
public final class NpcCombatProfileLoader extends DataLoader {
|
||||
|
||||
private final Map<String, List<CombatProfile>> profiles;
|
||||
|
||||
public NpcCombatProfileLoader() {
|
||||
this.profiles = new HashMap<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<String> getAbilities(@Nullable String id, @NotNull CreatureDifficulty difficulty, int level) {
|
||||
List<CombatProfile> subprofiles = Objects.requireNonNull(profiles.get(id), "unknown profile id");
|
||||
Set<String> abilities = new HashSet<>();
|
||||
for (CombatProfile profile : subprofiles) {
|
||||
if (profile.getDifficulty().equals(difficulty) && level >= profile.getMinLevel() && level <= profile.getMaxLevel())
|
||||
abilities.addAll(profile.getAbilities());
|
||||
}
|
||||
return abilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() throws IOException {
|
||||
try (SdbResultSet set = SdbLoader.load(new File("serverdata/spawn/static.msdb"))) {
|
||||
profiles.putAll(set.stream(CombatProfile::new).collect(groupingBy(CombatProfile::getId)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class CombatProfile {
|
||||
|
||||
private final String id;
|
||||
private final CreatureDifficulty difficulty;
|
||||
private final int minLevel;
|
||||
private final int maxLevel;
|
||||
private final Set<String> abilities;
|
||||
|
||||
public CombatProfile(SdbResultSet set) {
|
||||
this.id = set.getText("profile_id");
|
||||
this.difficulty = CreatureDifficulty.valueOf(set.getText("difficulty"));
|
||||
this.minLevel = (int) set.getInt("min_cl");
|
||||
this.maxLevel = (int) set.getInt("max_cl");
|
||||
this.abilities = Set.of(set.getText("action").split(";"));
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CreatureDifficulty getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public int getMinLevel() {
|
||||
return minLevel;
|
||||
}
|
||||
|
||||
public int getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
public Set<String> getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2019 /// 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 Holocore. *
|
||||
* *
|
||||
* --------------------------------------------------------------------------------*
|
||||
* *
|
||||
* Holocore 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. *
|
||||
* *
|
||||
* Holocore 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 Holocore. If not, see <http:></http:>//www.gnu.org/licenses/>. *
|
||||
*/
|
||||
|
||||
package com.projectswg.holocore.resources.support.data.server_info.loader.npc
|
||||
|
||||
import com.projectswg.holocore.resources.support.data.server_info.SdbLoader
|
||||
import com.projectswg.holocore.resources.support.data.server_info.SdbLoader.SdbResultSet
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.DataLoader
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureDifficulty
|
||||
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
import java.util.stream.Collectors.groupingBy
|
||||
|
||||
class NpcCombatProfileLoader : DataLoader() {
|
||||
|
||||
private val profiles: MutableMap<String, List<CombatProfile>>
|
||||
|
||||
init {
|
||||
this.profiles = HashMap()
|
||||
}
|
||||
|
||||
fun getAbilities(id: String?, difficulty: CreatureDifficulty, level: Int): Set<String> {
|
||||
val subprofiles = Objects.requireNonNull<List<CombatProfile>>(profiles[id], "unknown profile id")
|
||||
val abilities = HashSet<String>()
|
||||
for (profile in subprofiles) {
|
||||
if (profile.difficulty == difficulty && level >= profile.minLevel && level <= profile.maxLevel)
|
||||
abilities.addAll(profile.abilities)
|
||||
}
|
||||
return abilities
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
public override fun load() {
|
||||
SdbLoader.load(File("serverdata/spawn/static.msdb")).use { set -> profiles.putAll(set.stream<CombatProfile>(Function<SdbResultSet, CombatProfile> { CombatProfile(it) }).collect<Map<String, List<CombatProfile>>, Any>(groupingBy(Function<CombatProfile, String> { it.getId() }))) }
|
||||
}
|
||||
|
||||
private class CombatProfile(set: SdbResultSet) {
|
||||
|
||||
val id: String
|
||||
val difficulty: CreatureDifficulty
|
||||
val minLevel: Int
|
||||
val maxLevel: Int
|
||||
val abilities: Set<String>
|
||||
|
||||
init {
|
||||
this.id = set.getText("profile_id")
|
||||
this.difficulty = CreatureDifficulty.valueOf(set.getText("difficulty"))
|
||||
this.minLevel = set.getInt("min_cl").toInt()
|
||||
this.maxLevel = set.getInt("max_cl").toInt()
|
||||
this.abilities = Set.of<String>(*set.getText("action").split(";".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -152,7 +152,7 @@ enum CombatCommandAttack implements CombatCommandHitType {
|
||||
|
||||
if (incapacitate) {
|
||||
finalDamage = targetHealth; // Target took more damage than they had health left. Final damage becomes the amount of remaining health.
|
||||
RequestCreatureDeathIntent.broadcast(target, source);
|
||||
RequestCreatureDeathIntent.broadcast(source, target);
|
||||
} else {
|
||||
target.modifyHealth(-finalDamage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user