Added quest completion window, Changed sui service to not need conversation npcs to need conversation radial attached, Changed goToLocation event to check all of players quests instead of active one

This commit is contained in:
Waverunner
2014-08-25 17:44:22 -04:00
parent 1190e7b1fe
commit 298fb1f59a
12 changed files with 120 additions and 19 deletions

View File

@@ -0,0 +1,25 @@
import sys
def setup():
return
def run(core, actor, target, commandString):
if actor is None:
return
player = actor.getPlayerObject()
if player is None:
return
quest = player.getQuest(int(commandString))
if quest is None:
return
if (quest.getActiveTask() != (core.questService.getQuestData(quest.getName()).getTasks().size() - 1)):
return
core.questService.completeQuest(player, quest)
return

View File

@@ -7,8 +7,7 @@ import sys
def startConversation(core, actor, npc):
convSvc = core.conversationService
player = actor.getPlayerObject()
print ('conversation')
if player is None:
return
@@ -18,7 +17,7 @@ def startConversation(core, actor, npc):
endConversation(core, actor, npc)
return
if quest.isComplete():
if quest.isCompleted():
core.conversationService.sendStopConversation(actor, npc, 'conversation/tatooine_eisley_majolnir', 's_24')
return

View File

@@ -1,5 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('conversationFile', 'majolnir')
object.setAttachment('conversationFile', 'quests/tatooine/majolnir')
return

View File

@@ -7,10 +7,10 @@ def run(core, activator, collidable):
player = activator.getPlayerObject()
if player.getActiveQuestName() != collidable.getAttachedQuest():
if player.getQuest(collidable.getAttachedQuest()) == None:
return
quest = player.getQuest(player.getActiveQuest())
quest = player.getQuest(collidable.getAttachedQuest())
if quest.isCompleted():
return

View File

@@ -2,10 +2,8 @@ def setup(core):
return
def wait(core, actor):
print ('waiting')
return
def activate(core, actor, quest):
print ('Activate!!')
core.questService.completeActiveTask(actor, quest)
return

View File

@@ -0,0 +1,4 @@
import sys
def run():
return "object/tangible/item/shared_vehicle_customization.iff"

View File

@@ -81,6 +81,7 @@ public class ObjControllerMessage extends SWGMessage {
public static final int QUEST_TASK_COUNTER = 0x0441;
public static final int QUEST_TASK_TIMER = 0x0444;
public static final int FORCE_ACTIVATE_QUEST = 0x04BE;
public static final int SHOW_QUEST_COMPLETION_WINDOW = 0x04B8;
public ObjControllerMessage() {

View File

@@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import engine.resources.objects.Baseline;
public class ShowQuestCompletionWindow extends ObjControllerObject {
private long objectId;
private int questCrc;
public ShowQuestCompletionWindow(long objectId, int questCrc) {
this.objectId = objectId;
this.questCrc = questCrc;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = Baseline.createBuffer(20);
buffer.putInt(ObjControllerMessage.SHOW_QUEST_COMPLETION_WINDOW);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.putInt(questCrc);
return buffer.flip();
}
}

View File

@@ -133,6 +133,11 @@ public class Quest extends Delta implements Serializable {
//System.out.println("Active step was "+ (activeStep - 1) + " and is now " + activeStep );
}
public void complete() {
completedStepBitmask.set(activeStep);
activeStepBitmask.clear();
}
public ScheduledFuture<?> getTimer() {
return timer;
}

View File

@@ -60,6 +60,7 @@ public class ConversationService implements INetworkDispatch {
core.simulationService.faceTarget(npc, player);
player.setConversingNpc(npc);
// TODO: Come up with a way for not needing to send the StartConversation packet, some only sent the end conversation packet to show the chat bubble
sendStartConversation(player, npc);
core.scriptService.callScript("scripts/conversation/", (String) npc.getAttachment("conversationFile"), "startConversation", core, player, npc);
}

View File

@@ -49,11 +49,11 @@ import protocol.swg.objectControllerObjects.ForceActivateQuest;
import protocol.swg.objectControllerObjects.QuestTaskCounterMessage;
import protocol.swg.objectControllerObjects.QuestTaskTimerMessage;
import protocol.swg.objectControllerObjects.ShowLootBox;
import protocol.swg.objectControllerObjects.ShowQuestCompletionWindow;
import resources.common.Console;
import resources.common.ObjControllerOpcodes;
import resources.common.OutOfBand;
import resources.common.ProsePackage;
import resources.common.collidables.CollidableCircle;
import resources.common.collidables.QuestCollidable;
import resources.datatables.DisplayType;
import resources.objects.SWGMap;
@@ -262,16 +262,19 @@ public class QuestService implements INetworkDispatch {
quest.getTimer().cancel(true);
if (activeStep + 1 >= qData.getTasks().size()) {
QuestList listItem = questRewardMap.get(quest.getName());
//QuestList listItem = questRewardMap.get(quest.getName());
if (listItem.isCompleteWhenTasksComplete())
quest.setCompleted(true);
if (!task.isGrantQuestOnCompleteShowSystemMessage()) {
completeQuest(player, quest); // Force complete packet sent if the quest isn't auto completed (window shows up, typical for exclusive reward items)
/*else
sendQuestCompleteWindow(quester, quest.getName());*/
player.getContainer().getClient().getSession().write(player.getBaseline(8).createDelta(7));
} else
sendQuestCompleteWindow(quester, quest.getCrc());
if (task.getGrantQuestOnComplete() != null && !task.getGrantQuestOnComplete().equals(""))
activateQuest(quester, task.getGrantQuestOnComplete());
return;
}
@@ -318,9 +321,8 @@ public class QuestService implements INetworkDispatch {
CreatureObject creo = (CreatureObject) player.getContainer();
if (!quest.isCompleted()) {
if (!quest.isCompleted())
quest.setCompleted(true);
}
QuestList info = getQuestList(quest.getName());
@@ -402,8 +404,9 @@ public class QuestService implements INetworkDispatch {
}
public void sendQuestCompleteWindow(CreatureObject reciever, String questName) {
public void sendQuestCompleteWindow(CreatureObject reciever, int questCrc) {
ObjControllerMessage objController = new ObjControllerMessage(0x0B, new ShowQuestCompletionWindow(reciever.getObjectID(), questCrc));
reciever.getClient().getSession().write(objController.serialize());
}
public String getQuestItemRadialName(CreatureObject quester, String template) {

View File

@@ -150,12 +150,17 @@ public class SUIService implements INetworkDispatch {
return;
}
if (target.getAttachment("conversationFile") != null) {
core.scriptService.callScript("scripts/radial/", "object/conversation", "createRadial", core, owner, target, request.getRadialOptions());
sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount());
return;
}
core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "createRadial", core, owner, target, request.getRadialOptions());
if(getRadialFilename(target).equals("default"))
return;
sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount());
}
});
@@ -191,6 +196,10 @@ public class SUIService implements INetworkDispatch {
return;
}
if (target.getAttachment("conversationFile") != null) {
core.scriptService.callScript("scripts/radial/", "object/conversation", "handleSelection", core, owner, target, objMenuSelect.getSelection());
return;
}
core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "handleSelection", core, owner, target, objMenuSelect.getSelection());
}