mirror of
https://bitbucket.org/projectswg/holocore.git
synced 2026-01-16 23:04:20 -05:00
Merge branch 'quality_assurance' of bitbucket.org:projectswg/holocore into quality_assurance
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/***********************************************************************************
|
||||
* 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.support.global.chat;
|
||||
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SystemChatRoomMessageIntent extends Intent {
|
||||
|
||||
private final String roomPath;
|
||||
private final String message;
|
||||
|
||||
public SystemChatRoomMessageIntent(@NotNull String roomPath, @NotNull String message) {
|
||||
this.roomPath = roomPath;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getRoomPath() {
|
||||
return roomPath;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public static void broadcast(@NotNull String roomPath, @NotNull String message) {
|
||||
new SystemChatRoomMessageIntent(roomPath, message).broadcast();
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import com.projectswg.holocore.resources.support.data.server_info.CachedObjectDa
|
||||
import com.projectswg.holocore.resources.support.data.server_info.ObjectDatabase;
|
||||
import com.projectswg.holocore.resources.support.global.player.AccessLevel;
|
||||
import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import com.projectswg.holocore.services.support.global.chat.ChatRoomService;
|
||||
import com.projectswg.holocore.services.support.global.zone.CharacterLookupService.PlayerLookup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -85,6 +86,10 @@ public class ChatRoomHandler {
|
||||
for (String channel : player.getPlayerObject().getJoinedChannels()) {
|
||||
enterChatChannel(player, channel, false);
|
||||
}
|
||||
|
||||
if (player.getAccessLevel() != AccessLevel.PLAYER) {
|
||||
enterChatChannel(player, ChatRoomService.LOG_ROOM_PATH, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +237,14 @@ public class ChatRoomHandler {
|
||||
sendMessage(room, avatar, message, oobPackage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendMessageToRoomFromSystem(String path, String message, OutOfBandPackage oobPackage) {
|
||||
ChatAvatar systemAvatar = ChatAvatar.getSystemAvatar();
|
||||
ChatRoom room = rooms.getRoomByPath(path);
|
||||
|
||||
sendMessage(room, systemAvatar, message, oobPackage);
|
||||
}
|
||||
|
||||
public boolean notifyDestroyRoom(ChatAvatar destroyer, String roomPath, int sequence) {
|
||||
ChatRoom room;
|
||||
|
||||
@@ -272,6 +284,7 @@ public class ChatRoomHandler {
|
||||
rooms.handleRows((r) -> createRoom(systemAvatar, true, false, basePath + rooms.getCell(r, 0), (String) rooms.getCell(r, 1), false));
|
||||
|
||||
createPlanetChannels(systemAvatar, basePath);
|
||||
createAdminChannels(systemAvatar, basePath);
|
||||
|
||||
/*
|
||||
* Battlefield Room path examples: SWG.Bria.corellia.battlefield SWG.Bria.corellia.battlefield.corellia_mountain_fortress.allFactions SWG.Bria.corellia.battlefield.corellia_pvp.allFactions / Imperial / Rebel SWG.Bria.corellia.battlefield.corellia_rebel_riverside_fort.allFactions
|
||||
@@ -287,6 +300,10 @@ public class ChatRoomHandler {
|
||||
createRoom(systemAvatar, true, false, path + "Chat", "public chat for this planet, can create rooms here", false);
|
||||
});
|
||||
}
|
||||
|
||||
private void createAdminChannels(ChatAvatar systemAvatar, String basePath) {
|
||||
createRoom(systemAvatar, false, false, ChatRoomService.LOG_ROOM_PATH, "server log", false);
|
||||
}
|
||||
|
||||
public ChatRoom getRoomById(int roomId) {
|
||||
return rooms.getRoomById(roomId);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
package com.projectswg.holocore.services.gameplay.combat.command;
|
||||
|
||||
import com.projectswg.common.data.combat.*;
|
||||
import com.projectswg.common.network.packets.swg.zone.object_controller.Animation;
|
||||
import com.projectswg.common.network.packets.swg.zone.object_controller.combat.CombatAction;
|
||||
import com.projectswg.common.network.packets.swg.zone.object_controller.combat.CombatAction.Defender;
|
||||
import com.projectswg.holocore.intents.gameplay.combat.EnterCombatIntent;
|
||||
@@ -40,6 +41,7 @@ import com.projectswg.holocore.resources.support.objects.swg.weapon.WeaponObject
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.projectswg.holocore.services.gameplay.combat.command.CombatCommandCommon.*;
|
||||
@@ -84,6 +86,12 @@ enum CombatCommandAttack implements CombatCommandHitType {
|
||||
|
||||
private static void doCombatSingle(CreatureObject source, SWGObject target, AttackInfo info, WeaponObject weapon, CombatCommand command) {
|
||||
// TODO single target only defence rolls against target
|
||||
if (target instanceof CreatureObject && isAttackDodged(source, (CreatureObject) target)) {
|
||||
info.setDodge(true);
|
||||
info.setSuccess(false); // This means that the attack did no damage to the target at all
|
||||
target.sendObservers(new Animation(target.getObjectId(), "dodge"));
|
||||
}
|
||||
|
||||
// TODO single target only offence rolls for source
|
||||
|
||||
// TODO below logic should be in CommandService when target checks are implemented in there
|
||||
@@ -133,7 +141,8 @@ enum CombatCommandAttack implements CombatCommandHitType {
|
||||
|
||||
if (!info.isSuccess()) { // Single target negate, like dodge or parry!
|
||||
target.sendObservers(createCombatSpam(source, target, weapon, info, command));
|
||||
return;
|
||||
action.addDefender(new Defender(target.getObjectId(), target.getPosture(), false, (byte) 0, HitLocation.HIT_LOCATION_BODY, (short) 0));
|
||||
continue; // This target negated the attack completely - move on to the next target
|
||||
}
|
||||
|
||||
addBuff(source, target, command.getBuffNameTarget()); // Add target buff
|
||||
@@ -233,4 +242,11 @@ enum CombatCommandAttack implements CombatCommandHitType {
|
||||
|
||||
}
|
||||
|
||||
private static boolean isAttackDodged(CreatureObject source, CreatureObject target) {
|
||||
double dodgeChance = (target.getSkillModValue("display_only_dodge") - source.getSkillModValue("display_only_opp_dodge_reduction")) / 100;
|
||||
double roll = ThreadLocalRandom.current().nextDouble(100); // Generate number between 0 and 100
|
||||
|
||||
return roll <= dodgeChance; // If dodge chance is 25%, then the roll should be between 0 and 25 (both inclusive)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,17 +78,6 @@ class ProtectionService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
@IntentHandler
|
||||
private fun handleSkillModIntent(intent: SkillModIntent) {
|
||||
// Modify protection values if an innate armor skillmod is being granted
|
||||
val skillModName = intent.skillModName
|
||||
|
||||
if ("expertise_innate_protection_all" == skillModName) {
|
||||
for (skillMod in attributeLookup.keys)
|
||||
SkillModIntent(skillMod, intent.adjustBase, intent.adjustModifier, *intent.affectedCreatures).broadcast()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleTransfer(item: SWGObject, creature: CreatureObject, arrangement: List<String>, equip: Boolean) {
|
||||
val jedi = creature.playerObject?.profession == Profession.FORCE_SENSITIVE
|
||||
val robe = item.gameObjectType == GameObjectType.GOT_CLOTHING_CLOAK
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
***********************************************************************************/
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills;
|
||||
|
||||
import com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.SkillModService;
|
||||
import me.joshlarson.jlcommon.control.Manager;
|
||||
import me.joshlarson.jlcommon.control.ManagerStructure;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* 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.services.gameplay.player.experience.skills;
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod;
|
||||
|
||||
import com.projectswg.common.data.encodables.tangible.Race;
|
||||
import com.projectswg.common.data.info.RelationalServerData;
|
||||
@@ -38,6 +38,7 @@ import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.player.PlayerObject;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.player.Profession;
|
||||
import com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust.*;
|
||||
import com.projectswg.holocore.utilities.IntentFactory;
|
||||
import me.joshlarson.jlcommon.control.IntentHandler;
|
||||
import me.joshlarson.jlcommon.control.Service;
|
||||
@@ -46,8 +47,8 @@ import me.joshlarson.jlcommon.log.Log;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SkillModService extends Service {
|
||||
|
||||
@@ -62,6 +63,9 @@ public class SkillModService extends Service {
|
||||
private final RelationalServerData racialStatsDatabase;
|
||||
private final PreparedStatement getPlayerLevelStatement;
|
||||
private final PreparedStatement getRacialStatsStatement;
|
||||
|
||||
private final Map<String, Function<SkillModAdjust, Collection<SkillModAdjust>>> skillModAdjusters;
|
||||
|
||||
public SkillModService() {
|
||||
|
||||
playerLevelDatabase = RelationalServerFactory.getServerData("player/player_levels.db", "player_levels");
|
||||
@@ -74,7 +78,18 @@ public class SkillModService extends Service {
|
||||
if (racialStatsDatabase == null)
|
||||
throw new ProjectSWG.CoreException("Unable to load racial_stats.sdb file for SkillTemplateService");
|
||||
|
||||
getRacialStatsStatement = racialStatsDatabase.prepareStatement(GET_RACIAL_STATS_SQL);
|
||||
getRacialStatsStatement = racialStatsDatabase.prepareStatement(GET_RACIAL_STATS_SQL);
|
||||
|
||||
skillModAdjusters = Map.of(
|
||||
"agility_modified", new AgilityAdjustFunction(),
|
||||
"luck_modified", new LuckAdjustFunction(),
|
||||
"precision_modified", new PrecisionAdjustFunction(),
|
||||
"strength_modified", new StrengthAdjustFunction(),
|
||||
"expertise_dodge", new SingleModAdjustFunction("display_only_dodge", 100),
|
||||
"expertise_innate_protection_all", new InnateArmorAdjustFunction(),
|
||||
"expertise_innate_protection_kinetic", new SingleModAdjustFunction("kinetic"),
|
||||
"expertise_innate_protection_energy", new SingleModAdjustFunction("energy")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,6 +136,7 @@ public class SkillModService extends Service {
|
||||
|
||||
updateLevelHAMValues(creature, newLevel, profession);
|
||||
updateLevelSkillModValues(creature, newLevel, profession, race);
|
||||
grantBaseCombatChances(creature);
|
||||
}
|
||||
|
||||
@IntentHandler
|
||||
@@ -140,8 +156,30 @@ public class SkillModService extends Service {
|
||||
for (CreatureObject creature : smi.getAffectedCreatures()) {
|
||||
String skillModName = smi.getSkillModName();
|
||||
|
||||
creature.adjustSkillmod(skillModName, smi.getAdjustBase(), smi.getAdjustModifier());
|
||||
updateSkillModHamValues(creature, skillModName, smi.getAdjustBase() + smi.getAdjustModifier());
|
||||
int adjustBase = smi.getAdjustBase();
|
||||
int adjustModifier = smi.getAdjustModifier();
|
||||
|
||||
adjustSkillmod(creature, skillModName, adjustBase, adjustModifier);
|
||||
updateSkillModHamValues(creature, skillModName, adjustBase + adjustModifier);
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustSkillmod(CreatureObject creature, String skillModName, int adjustBase, int adjustModifier) {
|
||||
creature.adjustSkillmod(skillModName, adjustBase, adjustModifier);
|
||||
|
||||
if (skillModAdjusters.containsKey(skillModName)) {
|
||||
Function<SkillModAdjust, Collection<SkillModAdjust>> modIntentConsumer = skillModAdjusters.get(skillModName);
|
||||
SkillModAdjust inputAdjust = new SkillModAdjust(skillModName, adjustBase, adjustModifier);
|
||||
|
||||
Collection<SkillModAdjust> outputAdjusts = modIntentConsumer.apply(inputAdjust);
|
||||
|
||||
for (SkillModAdjust outputAdjust : outputAdjusts) {
|
||||
int outputBase = outputAdjust.getBase();
|
||||
int outputModifier = outputAdjust.getModifier();
|
||||
String outputName = outputAdjust.getName();
|
||||
|
||||
adjustSkillmod(creature, outputName, outputBase, outputModifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +241,8 @@ public class SkillModService extends Service {
|
||||
oldSkillModValue = creature.getSkillModValue(type.toString().toLowerCase(Locale.US));
|
||||
|
||||
if (skillModValue > oldSkillModValue){
|
||||
creature.adjustSkillmod(type.toString().toLowerCase(Locale.US), 0, -creature.getSkillModValue(type.toString().toLowerCase(Locale.US)));
|
||||
creature.adjustSkillmod(type.toString().toLowerCase(Locale.US), 0, skillModValue);
|
||||
adjustSkillmod(creature, type.toString().toLowerCase(Locale.US), 0, -creature.getSkillModValue(type.toString().toLowerCase(Locale.US)));
|
||||
adjustSkillmod(creature, type.toString().toLowerCase(Locale.US), 0, skillModValue);
|
||||
|
||||
if (type == SkillModTypes.CONSTITUTION_MODIFIED || type == SkillModTypes.STAMINA_MODIFIED)
|
||||
updateSkillModHamValues(creature, type.toString().toLowerCase(Locale.US),skillModValue - oldSkillModValue);
|
||||
@@ -215,6 +253,15 @@ public class SkillModService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private void grantBaseCombatChances(CreatureObject creatureObject) {
|
||||
creatureObject.adjustSkillmod("display_only_block", 500, 0);
|
||||
creatureObject.adjustSkillmod("display_only_dodge", 500, 0);
|
||||
creatureObject.adjustSkillmod("display_only_evasion", 500, 0);
|
||||
creatureObject.adjustSkillmod("display_only_parry", 500, 0);
|
||||
creatureObject.adjustSkillmod("display_only_critical", 500, 0);
|
||||
creatureObject.adjustSkillmod("display_only_strikethrough", 500, 0);
|
||||
}
|
||||
|
||||
private int getLevelSkillModValue(int level, String professionModName, String raceModName){
|
||||
int skillModValue = 0;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class AgilityAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
int adjustBase = skillModAdjust.getBase();
|
||||
int adjustModifier = skillModAdjust.getModifier();
|
||||
|
||||
int adjustBaseTwoToOne = (int) Math.ceil(adjustBase / 2f);
|
||||
int adjustModifierTwoToOne = (int) Math.ceil(adjustModifier / 2f);
|
||||
|
||||
return Arrays.asList(
|
||||
new SkillModAdjust("display_only_dodge", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("display_only_parry", adjustBaseTwoToOne, adjustModifierTwoToOne),
|
||||
new SkillModAdjust("display_only_evasion", adjustBase, adjustModifier)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class InnateArmorAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
int adjustBase = skillModAdjust.getBase();
|
||||
int adjustModifier = skillModAdjust.getModifier();
|
||||
|
||||
return Arrays.asList(
|
||||
new SkillModAdjust("kinetic", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("energy", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("heat", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("cold", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("acid", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("electricity", adjustBase, adjustModifier)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class LuckAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
int adjustBase = skillModAdjust.getBase();
|
||||
int adjustModifier = skillModAdjust.getModifier();
|
||||
|
||||
int adjustBaseThreeToOne = (int) Math.ceil(adjustBase / 3f);
|
||||
int adjustModifierThreeToOne = (int) Math.ceil(adjustModifier / 3f);
|
||||
|
||||
int adjustBaseTwoToOne = (int) Math.ceil(adjustBase / 2f);
|
||||
int adjustModifierTwoToOne = (int) Math.ceil(adjustModifier / 2f);
|
||||
|
||||
return Arrays.asList(
|
||||
new SkillModAdjust("display_only_dodge", adjustBaseThreeToOne, adjustModifierThreeToOne),
|
||||
new SkillModAdjust("display_only_evasion", adjustBaseThreeToOne, adjustModifierThreeToOne),
|
||||
new SkillModAdjust("display_only_critical", adjustBaseThreeToOne, adjustModifierThreeToOne),
|
||||
new SkillModAdjust("display_only_strikethrough", adjustBaseTwoToOne, adjustModifierTwoToOne)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PrecisionAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
int adjustBase = skillModAdjust.getBase();
|
||||
int adjustModifier = skillModAdjust.getModifier();
|
||||
|
||||
int adjustBaseTwoToOne = (int) Math.ceil(adjustBase / 2f);
|
||||
int adjustModifierTwoToOne = (int) Math.ceil(adjustModifier / 2f);
|
||||
|
||||
return Arrays.asList(
|
||||
new SkillModAdjust("display_only_parry", adjustBaseTwoToOne, adjustModifierTwoToOne),
|
||||
new SkillModAdjust("display_only_block", adjustBaseTwoToOne, adjustModifierTwoToOne),
|
||||
new SkillModAdjust("display_only_critical", adjustBase, adjustModifier),
|
||||
new SkillModAdjust("display_only_strikethrough", adjustBaseTwoToOne, adjustModifierTwoToOne)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SingleModAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
|
||||
private final String skillModName;
|
||||
private final int multiplier;
|
||||
|
||||
public SingleModAdjustFunction(String skillModName, int multiplier) {
|
||||
this.skillModName = skillModName;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public SingleModAdjustFunction(String skillModName) {
|
||||
this(skillModName, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
return Collections.singleton(new SkillModAdjust(skillModName, skillModAdjust.getBase() * multiplier, skillModAdjust.getModifier() * multiplier));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
public class SkillModAdjust {
|
||||
private final String name;
|
||||
private final int base;
|
||||
private final int modifier;
|
||||
|
||||
public SkillModAdjust(String name, int base, int modifier) {
|
||||
this.name = name;
|
||||
this.base = base;
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.projectswg.holocore.services.gameplay.player.experience.skills.skillmod.adjust;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class StrengthAdjustFunction implements Function<SkillModAdjust, Collection<SkillModAdjust>> {
|
||||
@Override
|
||||
public Collection<SkillModAdjust> apply(SkillModAdjust skillModAdjust) {
|
||||
int adjustBase = skillModAdjust.getBase();
|
||||
int adjustModifier = skillModAdjust.getModifier();
|
||||
|
||||
int adjustBaseTwoToOne = (int) Math.ceil(adjustBase / 2f);
|
||||
int adjustModifierTwoToOne = (int) Math.ceil(adjustModifier / 2f);
|
||||
|
||||
return Collections.singleton(new SkillModAdjust("display_only_block", adjustBaseTwoToOne, adjustModifierTwoToOne));
|
||||
}
|
||||
}
|
||||
@@ -34,20 +34,26 @@ import com.projectswg.common.data.encodables.oob.OutOfBandPackage;
|
||||
import com.projectswg.common.network.packets.SWGPacket;
|
||||
import com.projectswg.common.network.packets.swg.zone.chat.*;
|
||||
import com.projectswg.common.network.packets.swg.zone.insertion.ChatRoomList;
|
||||
import com.projectswg.holocore.ProjectSWG;
|
||||
import com.projectswg.holocore.intents.support.global.chat.ChatRoomMessageIntent;
|
||||
import com.projectswg.holocore.intents.support.global.chat.ChatRoomUpdateIntent;
|
||||
import com.projectswg.holocore.intents.support.global.chat.SystemChatRoomMessageIntent;
|
||||
import com.projectswg.holocore.intents.support.global.network.InboundPacketIntent;
|
||||
import com.projectswg.holocore.intents.support.global.zone.PlayerEventIntent;
|
||||
import com.projectswg.holocore.resources.support.global.chat.ChatRoomHandler;
|
||||
import com.projectswg.holocore.resources.support.global.player.AccessLevel;
|
||||
import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import com.projectswg.holocore.services.support.global.zone.CharacterLookupService.PlayerLookup;
|
||||
import com.projectswg.holocore.utilities.ChatRoomLogWrapper;
|
||||
import me.joshlarson.jlcommon.control.IntentHandler;
|
||||
import me.joshlarson.jlcommon.control.Service;
|
||||
import me.joshlarson.jlcommon.log.Log;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatRoomService extends Service {
|
||||
|
||||
|
||||
public static final String LOG_ROOM_PATH = "SWG." + ProjectSWG.getGalaxy().getName() + ".admin.ServerLog";
|
||||
|
||||
private final ChatRoomHandler chatRoomHandler;
|
||||
|
||||
public ChatRoomService() {
|
||||
@@ -58,7 +64,14 @@ public class ChatRoomService extends Service {
|
||||
public boolean initialize() {
|
||||
return super.initialize() && chatRoomHandler.initialize();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
Log.addWrapper(new ChatRoomLogWrapper(ChatRoomService.LOG_ROOM_PATH));
|
||||
|
||||
return super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean terminate() {
|
||||
return chatRoomHandler.terminate() && super.terminate();
|
||||
@@ -152,6 +165,11 @@ public class ChatRoomService extends Service {
|
||||
private void handleChatRoomMessageIntent(ChatRoomMessageIntent crmi) {
|
||||
chatRoomHandler.sendMessageToRoom(crmi.getPlayer(), crmi.getRoomPath(), 0, crmi.getMessage(), new OutOfBandPackage());
|
||||
}
|
||||
|
||||
@IntentHandler
|
||||
private void handleSystemChatRoomMessageIntent(SystemChatRoomMessageIntent intent) {
|
||||
chatRoomHandler.sendMessageToRoomFromSystem(intent.getRoomPath(), intent.getMessage(), new OutOfBandPackage());
|
||||
}
|
||||
|
||||
/* Chat Rooms */
|
||||
|
||||
|
||||
@@ -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 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.utilities;
|
||||
|
||||
import com.projectswg.holocore.intents.support.global.chat.SystemChatRoomMessageIntent;
|
||||
import me.joshlarson.jlcommon.log.Log;
|
||||
import me.joshlarson.jlcommon.log.LogWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatRoomLogWrapper implements LogWrapper {
|
||||
|
||||
private final String roomPath;
|
||||
|
||||
public ChatRoomLogWrapper(String roomPath) {
|
||||
this.roomPath = roomPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLog(Log.@NotNull LogLevel level, @NotNull String str) {
|
||||
SystemChatRoomMessageIntent.broadcast(roomPath, str);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user