Merge pull request #1553 from madsboddum/fix/quests/quest-received-%tt

Fixed %TT in "quest received" system message
This commit is contained in:
Josh
2024-06-10 20:51:56 -05:00
committed by GitHub
4 changed files with 160 additions and 176 deletions
@@ -93,6 +93,7 @@ class QuestLoader : DataLoader() {
class QuestListInfo(set: SdbResultSet) {
val journalEntryTitle: String = set.getText("journal_entry_title")
val journalEntryDescription: String = set.getText("journal_entry_description")
val category: String = set.getText("category")
val isCompleteWhenTasksComplete: Boolean = set.getBoolean("complete_when_tasks_complete")
val isRepeatable: Boolean = set.getBoolean("allow_repeats")
}
@@ -112,7 +112,7 @@ class QuestService(private val destroyMultiAndLootDie: Die = RandomDie(), privat
retrievedItemRepository.clearPreviousAttempts(questName, playerObject) // In case this quest is being repeated
playerObject.addQuest(questName)
StandardLog.onPlayerTrace(this, player, "received quest %s", questName)
val prose = ProsePackage(StringId("quest/ground/system_message", "quest_received"), "TO", questListInfo.journalEntryTitle)
val prose = ProsePackage(StringId("quest/ground/system_message", "quest_received"), "TT", questListInfo.category, "TO", questListInfo.journalEntryTitle)
SystemMessageIntent.broadcastPersonal(player, prose, ChatSystemMessage.SystemChatType.QUEST)
activateTask(player, questName, questLoader.getTaskListInfos(questName)[0])
}
@@ -1,175 +0,0 @@
/***********************************************************************************
* Copyright (c) 2024 /// 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;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
public class TestQuestLoader {
@Nested
public class TestQuestInfo {
private static QuestLoader.QuestListInfo questInfo;
@BeforeEach
public void setup() throws IOException {
questInfo = ServerData.INSTANCE.getQuestLoader().getQuestListInfo("quest/c_newbie_quest4");
}
@Test
public void canLoadQuestListInfo() {
assertNotNull(questInfo);
}
@Test
public void canLoadJournalEntryTitle() {
assertEquals("@quest/ground/c_newbie_quest4:journal_entry_title", questInfo.getJournalEntryTitle());
}
@Test
public void canLoadJournalEntryDescription() {
assertEquals("@quest/ground/c_newbie_quest4:journal_entry_description", questInfo.getJournalEntryDescription());
}
@Test
public void canloadCompleteWhenTasksCompleteFlag() {
assertTrue(questInfo.isCompleteWhenTasksComplete());
}
@Test
public void canLoadRepeatableFlag() {
assertTrue(questInfo.isRepeatable());
}
}
@Nested
public class TestQuestTask {
private static List<QuestLoader.QuestTaskInfo> taskListInfos;
@BeforeEach
public void setup() throws IOException {
taskListInfos = ServerData.INSTANCE.getQuestLoader().getTaskListInfos("quest/c_syren5");
}
@Test
public void canLoadRightAmountOfTasks() {
assertEquals(8, taskListInfos.size());
}
@Test
public void canLoadMinTime() {
assertEquals(0, taskListInfos.get(5).getMinTime());
}
@Test
public void canLoadMaxTime() {
assertEquals(0, taskListInfos.get(5).getMaxTime());
}
@Test
public void canLoadIndex() {
assertEquals(5, taskListInfos.get(5).getIndex());
}
@Test
public void canLoadType() {
assertEquals("quest.task.ground.destroy_multi_and_loot", taskListInfos.get(1).getType());
}
@Test
public void canLoadName() {
assertEquals("encounterWithCalHandro", taskListInfos.get(3).getName());
}
@Test
public void canLoadTargetServerTemplate() {
List<QuestLoader.QuestTaskInfo> taskListInfos = ServerData.INSTANCE.getQuestLoader().getTaskListInfos("quest/yavin_fallenstar_pt_2");
assertEquals("imperial_major", taskListInfos.get(1).getTargetServerTemplate());
}
@Test
public void canLoadMessageBoxTitle() {
List<QuestLoader.QuestTaskInfo> taskListInfos = ServerData.INSTANCE.getQuestLoader().getTaskListInfos("quest/c_newbie_start");
assertEquals("@quest/ground/c_newbie_start:task00_message_box_title", taskListInfos.getFirst().getMessageBoxTitle());
}
@Test
public void canLoadMessageBoxText() {
List<QuestLoader.QuestTaskInfo> taskListInfos = ServerData.INSTANCE.getQuestLoader().getTaskListInfos("quest/c_newbie_start");
assertEquals("@quest/ground/c_newbie_start:task00_message_box_text", taskListInfos.getFirst().getMessageBoxText());
}
@Test
public void canLoadNpcAppearanceServerTemplate() {
assertEquals("object/mobile/boba_fett.iff", taskListInfos.get(5).getNpcAppearanceServerTemplate());
}
@Test
public void canLoadCommMessageText() {
assertEquals("@quest/ground/c_syren5:task05_comm_message_text", taskListInfos.get(5).getCommMessageText());
}
@Test
public void canLoadCount() {
assertEquals(1, taskListInfos.get(4).getCount());
}
@Test
public void canLoadNextTasksOnCompleteMultipleTasks() {
Collection<Integer> nextTasksOnComplete = taskListInfos.get(3).getNextTasksOnComplete();
Collection<Integer> expected = List.of(4, 5, 6);
assertIterableEquals(expected, nextTasksOnComplete);
}
@Test
public void canLoadNextTasksOnCompleteSingleTask() {
Collection<Integer> nextTasksOnComplete = taskListInfos.get(1).getNextTasksOnComplete();
Collection<Integer> expected = List.of(2);
assertIterableEquals(expected, nextTasksOnComplete);
}
@Test
public void canLoadNextTasksOnCompleteEmpty() {
Collection<Integer> nextTasksOnComplete = taskListInfos.get(6).getNextTasksOnComplete();
Collection<Integer> expected = List.of();
assertIterableEquals(expected, nextTasksOnComplete);
}
}
}
@@ -0,0 +1,158 @@
/***********************************************************************************
* Copyright (c) 2024 /// 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
import com.projectswg.holocore.resources.support.data.server_info.loader.ServerData.questLoader
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
class TestQuestLoader {
@Nested
inner class TestQuestListInfo {
private val questListInfo = questLoader.getQuestListInfo("quest/c_newbie_quest4") ?: throw IllegalStateException("Quest info not found")
@Test
fun canLoadJournalEntryTitle() {
assertEquals("@quest/ground/c_newbie_quest4:journal_entry_title", questListInfo.journalEntryTitle)
}
@Test
fun canLoadJournalEntryDescription() {
assertEquals("@quest/ground/c_newbie_quest4:journal_entry_description", questListInfo.journalEntryDescription)
}
@Test
fun canLoadCategory() {
assertEquals("@quest/ground/c_newbie_quest4:category", questListInfo.category)
}
@Test
fun canloadCompleteWhenTasksCompleteFlag() {
assertTrue(questListInfo.isCompleteWhenTasksComplete)
}
@Test
fun canLoadRepeatableFlag() {
assertTrue(questListInfo.isRepeatable)
}
}
@Nested
inner class TestQuestTaskInfo {
private val taskListInfos = questLoader.getTaskListInfos("quest/c_syren5")
@Test
fun canLoadRightAmountOfTasks() {
assertEquals(8, taskListInfos.size)
}
@Test
fun canLoadMinTime() {
assertEquals(0, taskListInfos[5].minTime)
}
@Test
fun canLoadMaxTime() {
assertEquals(0, taskListInfos[5].maxTime)
}
@Test
fun canLoadIndex() {
assertEquals(5, taskListInfos[5].index)
}
@Test
fun canLoadType() {
assertEquals("quest.task.ground.destroy_multi_and_loot", taskListInfos[1].type)
}
@Test
fun canLoadName() {
assertEquals("encounterWithCalHandro", taskListInfos[3].name)
}
@Test
fun canLoadTargetServerTemplate() {
val taskListInfos = questLoader.getTaskListInfos("quest/yavin_fallenstar_pt_2")
assertEquals("imperial_major", taskListInfos[1].targetServerTemplate)
}
@Test
fun canLoadMessageBoxTitle() {
val taskListInfos = questLoader.getTaskListInfos("quest/c_newbie_start")
assertEquals("@quest/ground/c_newbie_start:task00_message_box_title", taskListInfos.first().messageBoxTitle)
}
@Test
fun canLoadMessageBoxText() {
val taskListInfos = questLoader.getTaskListInfos("quest/c_newbie_start")
assertEquals("@quest/ground/c_newbie_start:task00_message_box_text", taskListInfos.first().messageBoxText)
}
@Test
fun canLoadNpcAppearanceServerTemplate() {
assertEquals("object/mobile/boba_fett.iff", taskListInfos[5].npcAppearanceServerTemplate)
}
@Test
fun canLoadCommMessageText() {
assertEquals("@quest/ground/c_syren5:task05_comm_message_text", taskListInfos[5].commMessageText)
}
@Test
fun canLoadCount() {
assertEquals(1, taskListInfos[4].count)
}
@Test
fun canLoadNextTasksOnCompleteMultipleTasks() {
val nextTasksOnComplete = taskListInfos[3].nextTasksOnComplete
val expected = listOf(4, 5, 6)
assertIterableEquals(expected, nextTasksOnComplete)
}
@Test
fun canLoadNextTasksOnCompleteSingleTask() {
val nextTasksOnComplete = taskListInfos[1].nextTasksOnComplete
val expected = listOf(2)
assertIterableEquals(expected, nextTasksOnComplete)
}
@Test
fun canLoadNextTasksOnCompleteEmpty() {
val nextTasksOnComplete = taskListInfos[6].nextTasksOnComplete
val expected = emptyList<Int>()
assertIterableEquals(expected, nextTasksOnComplete)
}
}
}