mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-16 06:13:45 -04:00
Added quest signal scrpts, Added Pall conversation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
from resources.common import ConversationOption
|
||||
from resources.common import OutOfBand
|
||||
from resources.common import ProsePackage
|
||||
from java.util import Vector
|
||||
import sys
|
||||
|
||||
def startConversation(core, actor, npc):
|
||||
convSvc = core.conversationService
|
||||
player = actor.getPlayerObject()
|
||||
|
||||
print ('conversation')
|
||||
if player is None:
|
||||
return
|
||||
|
||||
quest = player.getQuest('find_majolnir')
|
||||
|
||||
if quest is None:
|
||||
endConversation(core, actor, npc)
|
||||
return
|
||||
|
||||
if quest.isComplete():
|
||||
core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_majolnir', 's_24')
|
||||
return
|
||||
|
||||
if quest.getActiveTask() == 3:
|
||||
core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_majolnir', 's_18')
|
||||
core.questService.handleActivateSignal(actor, npc, quest, 3)
|
||||
return
|
||||
|
||||
endConversation(core, actor, npc)
|
||||
return
|
||||
|
||||
def endConversation(core, actor, npc):
|
||||
core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_majolnir', 's_65')
|
||||
return
|
||||
@@ -0,0 +1,33 @@
|
||||
import sys
|
||||
from services.spawn import MobileTemplate
|
||||
from services.spawn import WeaponTemplate
|
||||
from resources.datatables import WeaponType
|
||||
from resources.datatables import Difficulty
|
||||
from resources.datatables import Options
|
||||
from java.util import Vector
|
||||
|
||||
|
||||
def addTemplate(core):
|
||||
mobileTemplate = MobileTemplate()
|
||||
|
||||
mobileTemplate.setCreatureName('majolnir')
|
||||
mobileTemplate.setLevel(1)
|
||||
mobileTemplate.setDifficulty(Difficulty.NORMAL)
|
||||
mobileTemplate.setSocialGroup("township")
|
||||
mobileTemplate.setOptionsBitmask(Options.INVULNERABLE | Options.CONVERSABLE)
|
||||
|
||||
templates = Vector()
|
||||
templates.add('object/mobile/shared_majolnir.iff')
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/melee/unarmed/shared_unarmed_default.iff', WeaponType.UNARMED, 1.0, 6, 'kinetic')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('creatureMeleeAttack')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('majolnir', mobileTemplate)
|
||||
return
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
object.setAttachment('conversationFile', 'majolnir')
|
||||
return
|
||||
@@ -0,0 +1,11 @@
|
||||
def setup(core):
|
||||
return
|
||||
|
||||
def wait(core, actor):
|
||||
print ('waiting')
|
||||
return
|
||||
|
||||
def activate(core, actor, quest):
|
||||
print ('Activate!!')
|
||||
core.questService.completeActiveTask(actor, quest)
|
||||
return
|
||||
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
# Project SWG: MosEisley Quest: Static Spawns
|
||||
# (C)2014 ProjectSWG
|
||||
|
||||
from resources.datatables import Options
|
||||
from resources.datatables import State
|
||||
|
||||
# This script is intended for any quest conversation mobiles, or single attackable npcs for a quest, within Mos Eisley
|
||||
def addPlanetSpawns(core, planet):
|
||||
|
||||
|
||||
stcSvc = core.staticService
|
||||
objSvc = core.objectService
|
||||
|
||||
# Pall - Talk to Pall
|
||||
pall = stcSvc.spawnObject('majolnir', 'tatooine', long(0), float(3526), float(5), float(-4619), float(0), float(0), float(0), float(0), 1)
|
||||
|
||||
return
|
||||
@@ -575,6 +575,8 @@ public class NGECore {
|
||||
playerCityService.loadCityRankCaps();
|
||||
playerCityService.loadCities();
|
||||
|
||||
questService.loadEvents();
|
||||
|
||||
retroService.run();
|
||||
|
||||
browserService = new BrowserService(this);
|
||||
|
||||
@@ -216,6 +216,11 @@ public class QuestService implements INetworkDispatch {
|
||||
quest.setTimer(taskTimer);
|
||||
break;
|
||||
|
||||
// quest.task.ground.wait_for_signal
|
||||
case "wait_for_signal":
|
||||
core.scriptService.callScript("scripts/quests/events/signals/", task.getSignalName(), "wait", core, quester);
|
||||
break;
|
||||
|
||||
// quest.task.ground.show_message_box
|
||||
case "show_message_box":
|
||||
break;
|
||||
@@ -438,6 +443,26 @@ public class QuestService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
public void handleActivateSignal(CreatureObject actor, TangibleObject npc, Quest quest, int taskId) {
|
||||
QuestTask task = getQuestData(quest.getName()).getTasks().get(taskId);
|
||||
if (task == null)
|
||||
return;
|
||||
|
||||
if (core.scriptService.getMethod("scripts/quests/events/signals/", task.getSignalName(), "activate") != null) {
|
||||
core.scriptService.callScript("scripts/quests/events/signals/", task.getSignalName(), "activate", core, actor, quest);
|
||||
return;
|
||||
}
|
||||
|
||||
completeActiveTask(actor, quest);
|
||||
}
|
||||
|
||||
public void handleAddConversationScript(TangibleObject object, String script) {
|
||||
if (object == null)
|
||||
return;
|
||||
|
||||
object.setAttachment("conversationFile", script);
|
||||
}
|
||||
|
||||
public WaypointObject createWaypoint(String name, Point3D location, String planet) {
|
||||
WaypointObject waypoint = (WaypointObject) core.objectService.createObject("object/waypoint/shared_waypoint.iff", core.terrainService.getPlanetByName(planet));
|
||||
if (waypoint == null)
|
||||
@@ -561,6 +586,7 @@ public class QuestService implements INetworkDispatch {
|
||||
if (visitor.getObjectByColumnNameAndIndex("MIN_TIME", r) != null) task.setMinTime((int) visitor.getObjectByColumnNameAndIndex("MIN_TIME", r));
|
||||
if (visitor.getObjectByColumnNameAndIndex("MAX_TIME", r) != null) task.setMaxTime((int) visitor.getObjectByColumnNameAndIndex("MAX_TIME", r));
|
||||
if (visitor.getObjectByColumnNameAndIndex("RADIUS", r) != null && visitor.getObjectByColumnNameAndIndex("RADIUS", r) != "") task.setRadius(Float.parseFloat((String) visitor.getObjectByColumnNameAndIndex("RADIUS", r)));
|
||||
if (visitor.getObjectByColumnNameAndIndex("SIGNAL_NAME", r) != null) task.setSignalName((String) visitor.getObjectByColumnNameAndIndex("SIGNAL_NAME", r));
|
||||
//if (visitor.getObjectByColumnNameAndIndex("", r))
|
||||
|
||||
if (task.getType().equals("quest.task.ground.go_to_location")) {
|
||||
@@ -650,6 +676,19 @@ public class QuestService implements INetworkDispatch {
|
||||
return template.replace(file, "shared_" + file);
|
||||
}
|
||||
|
||||
public void loadEvents() {
|
||||
FileVisitor<Path> fv = new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
|
||||
{
|
||||
core.scriptService.callScript("scripts/quests/events/signals/", file.getFileName().toString().replace(".py", ""), "setup", core);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
};
|
||||
try { Files.walkFileTree(Paths.get("scripts/quests/events/signals/"), fv); }
|
||||
catch (IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user