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; 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; diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index d18674254..05859f48e 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -645,7 +645,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); } } 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 e01d472b4..7a5d6a16e 100644 --- a/src/services/galaxy/GameManager.java +++ b/src/services/galaxy/GameManager.java @@ -44,6 +44,7 @@ public class GameManager extends Manager { private final FactionService factionService; // private final GroupService groupService; private final BuffService buffService; + private final SkillModService skillModService; public GameManager() { commandService = new CommandService(); @@ -54,7 +55,8 @@ public class GameManager extends Manager { factionService = new FactionService(); // groupService = new GroupService(); buffService = new BuffService(); - + skillModService = new SkillModService(); + addChildService(commandService); addChildService(connectionService); addChildService(suiService); @@ -63,5 +65,6 @@ public class GameManager extends Manager { addChildService(factionService); // addChildService(groupService); addChildService(buffService); + addChildService(skillModService); } } diff --git a/src/services/galaxy/SkillModService.java b/src/services/galaxy/SkillModService.java new file mode 100644 index 000000000..0e570cab5 --- /dev/null +++ b/src/services/galaxy/SkillModService.java @@ -0,0 +1,58 @@ +/*********************************************************************************** +* 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) { + 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(); + String skillModName = smi.getSkillModName(); + + creature.adjustSkillmod(skillModName, adjustBase, adjustModifier); + } + } + +}