From c6daa925f97739bc5af58a843fee2f5310155e2b Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 09:35:30 +0100 Subject: [PATCH 1/8] SkillModIntent can now only affect a single creature --- src/intents/SkillModIntent.java | 10 ++++----- src/services/commands/SkillModService.java | 24 ++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/intents/SkillModIntent.java b/src/intents/SkillModIntent.java index 5146ad827..2d7097f7f 100644 --- a/src/intents/SkillModIntent.java +++ b/src/intents/SkillModIntent.java @@ -10,14 +10,14 @@ public class SkillModIntent extends Intent { private final String skillModName; private final int adjustBase; private final int adjustModifier; - private final CreatureObject[] affectedCreatures; + private final CreatureObject creature; - public SkillModIntent(String skillModName, int adjustBase, int adjustModifier, CreatureObject... affectedCreatures) { + public SkillModIntent(String skillModName, int adjustBase, int adjustModifier, CreatureObject creature) { super(TYPE); this.skillModName = skillModName; this.adjustBase = adjustBase; this.adjustModifier = adjustModifier; - this.affectedCreatures = affectedCreatures; + this.creature = creature; } public int getAdjustModifier() { @@ -32,8 +32,8 @@ public class SkillModIntent extends Intent { return skillModName; } - public CreatureObject[] getAffectedCreatures() { - return affectedCreatures; + public CreatureObject getCreature() { + return creature; } } diff --git a/src/services/commands/SkillModService.java b/src/services/commands/SkillModService.java index a4f112c23..97c03638d 100644 --- a/src/services/commands/SkillModService.java +++ b/src/services/commands/SkillModService.java @@ -7,17 +7,15 @@ import resources.objects.creature.CreatureObject; public class SkillModService extends Service { - public SkillModService() { - registerForIntent(SkillModIntent.TYPE); - } - - @Override - public void onIntentReceived(Intent i) { - SkillModIntent smi = (SkillModIntent) i; - - for(CreatureObject creature : smi.getAffectedCreatures()) { - creature.adjustSkillmod(smi.getSkillModName(), smi.getAdjustBase(), smi.getAdjustModifier()); - } - } - + public SkillModService() { + registerForIntent(SkillModIntent.TYPE); + } + + @Override + public void onIntentReceived(Intent i) { + SkillModIntent smi = (SkillModIntent) i; + CreatureObject creature = smi.getCreature(); + creature.adjustSkillmod(smi.getSkillModName(), smi.getAdjustBase(), smi.getAdjustModifier()); + } + } From 2892f63dabc00607fb9b951f5f82cfeeaf046346 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 09:36:44 +0100 Subject: [PATCH 2/8] Revert "SkillModIntent can now only affect a single creature" This reverts commit c6daa925f97739bc5af58a843fee2f5310155e2b. --- src/intents/SkillModIntent.java | 10 ++++----- src/services/commands/SkillModService.java | 24 ++++++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/intents/SkillModIntent.java b/src/intents/SkillModIntent.java index 2d7097f7f..5146ad827 100644 --- a/src/intents/SkillModIntent.java +++ b/src/intents/SkillModIntent.java @@ -10,14 +10,14 @@ public class SkillModIntent extends Intent { private final String skillModName; private final int adjustBase; private final int adjustModifier; - private final CreatureObject creature; + private final CreatureObject[] affectedCreatures; - public SkillModIntent(String skillModName, int adjustBase, int adjustModifier, CreatureObject creature) { + public SkillModIntent(String skillModName, int adjustBase, int adjustModifier, CreatureObject... affectedCreatures) { super(TYPE); this.skillModName = skillModName; this.adjustBase = adjustBase; this.adjustModifier = adjustModifier; - this.creature = creature; + this.affectedCreatures = affectedCreatures; } public int getAdjustModifier() { @@ -32,8 +32,8 @@ public class SkillModIntent extends Intent { return skillModName; } - public CreatureObject getCreature() { - return creature; + public CreatureObject[] getAffectedCreatures() { + return affectedCreatures; } } diff --git a/src/services/commands/SkillModService.java b/src/services/commands/SkillModService.java index 97c03638d..a4f112c23 100644 --- a/src/services/commands/SkillModService.java +++ b/src/services/commands/SkillModService.java @@ -7,15 +7,17 @@ import resources.objects.creature.CreatureObject; public class SkillModService extends Service { - public SkillModService() { - registerForIntent(SkillModIntent.TYPE); - } - - @Override - public void onIntentReceived(Intent i) { - SkillModIntent smi = (SkillModIntent) i; - CreatureObject creature = smi.getCreature(); - creature.adjustSkillmod(smi.getSkillModName(), smi.getAdjustBase(), smi.getAdjustModifier()); - } - + public SkillModService() { + registerForIntent(SkillModIntent.TYPE); + } + + @Override + public void onIntentReceived(Intent i) { + SkillModIntent smi = (SkillModIntent) i; + + for(CreatureObject creature : smi.getAffectedCreatures()) { + creature.adjustSkillmod(smi.getSkillModName(), smi.getAdjustBase(), smi.getAdjustModifier()); + } + } + } From d384041ffcc7e1814289b64a2a655d279d1658ef Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 10:16:30 +0100 Subject: [PATCH 3/8] Added SkillModService to GameManager --- src/services/galaxy/GameManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/galaxy/GameManager.java b/src/services/galaxy/GameManager.java index a863e3d04..24fde7d2a 100644 --- a/src/services/galaxy/GameManager.java +++ b/src/services/galaxy/GameManager.java @@ -29,6 +29,7 @@ package services.galaxy; import resources.control.Manager; import services.commands.CommandService; +import services.commands.SkillModService; import services.faction.FactionService; import services.galaxy.terminals.TerminalService; import services.sui.SuiService; @@ -44,6 +45,7 @@ public class GameManager extends Manager { private final TerminalService terminalManager; private final FactionService factionService; // private final GroupService groupService; + private final SkillModService skillModService; public GameManager() { traderManager = new TraderManager(); @@ -54,6 +56,7 @@ public class GameManager extends Manager { terminalManager = new TerminalService(); factionService = new FactionService(); // groupService = new GroupService(); + skillModService = new SkillModService(); addChildService(traderManager); addChildService(commandService); @@ -63,5 +66,6 @@ public class GameManager extends Manager { addChildService(terminalManager); addChildService(factionService); // addChildService(groupService); + addChildService(skillModService); } } From c41a052b7e886f3e613bc805e10bb38d48b9602e Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 11:55:24 +0100 Subject: [PATCH 4/8] Moved SkillModService into services.galaxy package --- src/services/commands/SkillModService.java | 23 --------- src/services/galaxy/GameManager.java | 1 - src/services/galaxy/SkillModService.java | 54 ++++++++++++++++++++++ 3 files changed, 54 insertions(+), 24 deletions(-) delete mode 100644 src/services/commands/SkillModService.java create mode 100644 src/services/galaxy/SkillModService.java diff --git a/src/services/commands/SkillModService.java b/src/services/commands/SkillModService.java deleted file mode 100644 index a4f112c23..000000000 --- a/src/services/commands/SkillModService.java +++ /dev/null @@ -1,23 +0,0 @@ -package services.commands; - -import intents.SkillModIntent; -import resources.control.Intent; -import resources.control.Service; -import resources.objects.creature.CreatureObject; - -public class SkillModService extends Service { - - public SkillModService() { - registerForIntent(SkillModIntent.TYPE); - } - - @Override - public void onIntentReceived(Intent i) { - SkillModIntent smi = (SkillModIntent) i; - - for(CreatureObject creature : smi.getAffectedCreatures()) { - creature.adjustSkillmod(smi.getSkillModName(), smi.getAdjustBase(), smi.getAdjustModifier()); - } - } - -} diff --git a/src/services/galaxy/GameManager.java b/src/services/galaxy/GameManager.java index 24fde7d2a..5be007ec6 100644 --- a/src/services/galaxy/GameManager.java +++ b/src/services/galaxy/GameManager.java @@ -29,7 +29,6 @@ package services.galaxy; import resources.control.Manager; import services.commands.CommandService; -import services.commands.SkillModService; import services.faction.FactionService; import services.galaxy.terminals.TerminalService; import services.sui.SuiService; diff --git a/src/services/galaxy/SkillModService.java b/src/services/galaxy/SkillModService.java new file mode 100644 index 000000000..b476a486e --- /dev/null +++ b/src/services/galaxy/SkillModService.java @@ -0,0 +1,54 @@ +/*********************************************************************************** +* Copyright (c) 2015 /// 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 . * +* * +***********************************************************************************/ +package services.galaxy; + +import intents.SkillModIntent; +import resources.control.Intent; +import resources.control.Service; +import resources.objects.creature.CreatureObject; + +public class SkillModService extends Service { + + public SkillModService() { + registerForIntent(SkillModIntent.TYPE); + } + + @Override + public void onIntentReceived(Intent i) { + SkillModIntent smi = (SkillModIntent) i; + + for (CreatureObject creature : smi.getAffectedCreatures()) { + int adjustBase = smi.getAdjustBase(); + int adjustModifier = smi.getAdjustModifier(); + String skillModName = smi.getSkillModName(); + + creature.adjustSkillmod(skillModName, adjustBase, adjustModifier); + } + } + +} From a47e1cf59e852f0bc07478f165da6bfb3e77d3ab Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 12:03:19 +0100 Subject: [PATCH 5/8] Fixed an issue where skillmod adjustments were always made to the base --- src/resources/objects/creature/CreatureObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index b74f74f77..c5eb01fed 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -643,7 +643,7 @@ public class CreatureObject extends TangibleObject { // They already had this skillmod. // All we need to do is adjust the base and the modifier and send an update from the SWGMap skillMod.adjustBase(base); - skillMod.adjustBase(modifier); + skillMod.adjustModifier(modifier); skillMods.update(skillModName, this); } } From dd5af2d3942a6ff4eb36e4bad4c838e7cabb0e6f Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Tue, 12 Jan 2016 12:05:47 +0100 Subject: [PATCH 6/8] Added missing license header to SkillModIntent --- src/intents/SkillModIntent.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/intents/SkillModIntent.java b/src/intents/SkillModIntent.java index 5146ad827..f8b147df9 100644 --- a/src/intents/SkillModIntent.java +++ b/src/intents/SkillModIntent.java @@ -1,3 +1,30 @@ +/*********************************************************************************** +* Copyright (c) 2015 /// 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 . * +* * +***********************************************************************************/ package intents; import resources.control.Intent; From c8f4c9bbd3d9e89ddac92f9c0bd1fd7eaa7d94e5 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Wed, 20 Jan 2016 11:39:04 +0100 Subject: [PATCH 7/8] Added missing license to resources.SkillMod --- src/resources/SkillMod.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/resources/SkillMod.java b/src/resources/SkillMod.java index 7292348ef..f9bf50920 100644 --- a/src/resources/SkillMod.java +++ b/src/resources/SkillMod.java @@ -1,3 +1,30 @@ +/*********************************************************************************** +* Copyright (c) 2015 /// 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 . * +* * +***********************************************************************************/ package resources; import java.io.Serializable; From dd47e22ee20c2a2e3165aa44b4eab3f3f1201238 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Wed, 20 Jan 2016 11:42:38 +0100 Subject: [PATCH 8/8] Added instance check for SkillModIntent in SkillModService --- src/services/galaxy/SkillModService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/galaxy/SkillModService.java b/src/services/galaxy/SkillModService.java index b476a486e..0e570cab5 100644 --- a/src/services/galaxy/SkillModService.java +++ b/src/services/galaxy/SkillModService.java @@ -40,8 +40,12 @@ public class SkillModService extends Service { @Override public void onIntentReceived(Intent i) { - SkillModIntent smi = (SkillModIntent) i; + switch(i.getType()) { + case SkillModIntent.TYPE: handleSkillModIntent((SkillModIntent) i); break; + } + } + private void handleSkillModIntent(SkillModIntent smi) { for (CreatureObject creature : smi.getAffectedCreatures()) { int adjustBase = smi.getAdjustBase(); int adjustModifier = smi.getAdjustModifier();