mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-01-15 23:05:45 -05:00
Added npc_animation and player_animation events to conversations #303
This commit is contained in:
@@ -22,5 +22,12 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"events": []
|
||||
"events": [
|
||||
{
|
||||
"type": "npc_animation",
|
||||
"args": {
|
||||
"animation": "greet"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2021 /// 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.gameplay.conversation.events;
|
||||
|
||||
import com.projectswg.common.network.packets.swg.zone.object_controller.Animation;
|
||||
import com.projectswg.holocore.resources.gameplay.conversation.model.Event;
|
||||
import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.custom.AIObject;
|
||||
|
||||
public class NpcAnimationEvent implements Event {
|
||||
|
||||
private final String animationName;
|
||||
|
||||
public NpcAnimationEvent(String animationName) {
|
||||
this.animationName = animationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger(Player player, AIObject npc) {
|
||||
npc.sendObservers(new Animation(npc.getObjectId(), animationName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2021 /// 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.gameplay.conversation.events;
|
||||
|
||||
import com.projectswg.common.network.packets.swg.zone.object_controller.Animation;
|
||||
import com.projectswg.holocore.resources.gameplay.conversation.model.Event;
|
||||
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.custom.AIObject;
|
||||
|
||||
public class PlayerAnimationEvent implements Event {
|
||||
|
||||
private final String animationName;
|
||||
|
||||
public PlayerAnimationEvent(String animationName) {
|
||||
this.animationName = animationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger(Player player, AIObject npc) {
|
||||
CreatureObject creatureObject = player.getCreatureObject();
|
||||
|
||||
creatureObject.sendObservers(new Animation(creatureObject.getObjectId(), animationName));
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,8 @@ import com.projectswg.holocore.resources.gameplay.conversation.model.Requirement
|
||||
import com.projectswg.holocore.resources.support.data.server_info.SdbLoader;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.DataLoader;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.events.ChangePlayerFactionEventParser;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.events.NpcAnimationEventParser;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.events.PlayerAnimationEventParser;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.requirements.FactionNameRequirementParser;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.requirements.FactionStatusRequirementParser;
|
||||
import me.joshlarson.jlcommon.log.Log;
|
||||
@@ -194,6 +196,8 @@ public class ConversationLoader extends DataLoader {
|
||||
|
||||
private void initEventParsers() {
|
||||
eventParserMap.put("faction_change", new ChangePlayerFactionEventParser());
|
||||
eventParserMap.put("player_animation", new PlayerAnimationEventParser());
|
||||
eventParserMap.put("npc_animation", new NpcAnimationEventParser());
|
||||
}
|
||||
|
||||
private void loadSpawnToConversations() throws IOException {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2021 /// 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.conversation.events;
|
||||
|
||||
import com.projectswg.holocore.resources.gameplay.conversation.events.NpcAnimationEvent;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.EventParser;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class NpcAnimationEventParser implements EventParser<NpcAnimationEvent> {
|
||||
|
||||
@Override
|
||||
public NpcAnimationEvent parse(Map<String, Object> args) {
|
||||
String animation = (String) args.get("animation");
|
||||
|
||||
return new NpcAnimationEvent(animation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/***********************************************************************************
|
||||
* Copyright (c) 2021 /// 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.conversation.events;
|
||||
|
||||
import com.projectswg.holocore.resources.gameplay.conversation.events.PlayerAnimationEvent;
|
||||
import com.projectswg.holocore.resources.support.data.server_info.loader.conversation.EventParser;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerAnimationEventParser implements EventParser<PlayerAnimationEvent> {
|
||||
|
||||
@Override
|
||||
public PlayerAnimationEvent parse(Map<String, Object> args) {
|
||||
String animation = (String) args.get("animation");
|
||||
|
||||
return new PlayerAnimationEvent(animation);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user