Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Quest: Romeo & Juliet #283

Draft
wants to merge 41 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
df37ec6
initial romeo and juliet implementation
hallowatcher Mar 26, 2021
6486b40
Merge branch 'fix-plugin-imports' into romeo-and-juliet
hallowatcher Apr 7, 2021
3284166
add staircases plugin, add missing spawns
hallowatcher Apr 7, 2021
ab1a40a
add stage 2
hallowatcher Apr 8, 2021
b1a1de7
fix quest requirement when providing stages variable
hallowatcher Apr 8, 2021
e27b974
fix wrapText function, fetch widths from filestore
hallowatcher Apr 8, 2021
3376a08
fix empty remaining lines, lint
hallowatcher Apr 8, 2021
d6156a1
fix standard colors
hallowatcher Apr 9, 2021
0f6761d
add quest item object
hallowatcher Apr 9, 2021
33fca6e
Merge branch 'develop' into romeo-and-juliet
hallowatcher Apr 9, 2021
9664d53
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 12, 2021
ae36e1f
refactor quest file, add draul leptoc dialogue
hallowatcher Apr 12, 2021
63158b9
add Father Lawrence spawn and first dialogue
hallowatcher Apr 12, 2021
729c031
add index of for stages array
Apr 13, 2021
28923dd
add packet to disable the minimap, disable minimap during cutscene
Apr 13, 2021
3f71045
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 13, 2021
ef09427
bonkers commit, i might revert this one. dunno what im doing
hallowatcher Apr 14, 2021
c2dec7f
refactor romeo's dialogue
hallowatcher Apr 14, 2021
d7046c9
rename permanent dialogue packet
hallowatcher Apr 14, 2021
346f1a6
finish romeo and juliet last cutscene
hallowatcher Apr 15, 2021
97eb534
refactor dialogue handlers
Apr 15, 2021
3cd446d
fix setting face direction after npc spawn
Apr 15, 2021
b0e6f4f
fix dialogues
Apr 15, 2021
54da115
add cutscene options
Apr 15, 2021
c2dcd5f
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 15, 2021
f40643d
add proper parent npc spawn for juliet
hallowatcher Apr 16, 2021
9b3f9d7
merge
hallowatcher Apr 16, 2021
8c79550
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 16, 2021
c1fcf75
calculate juliet's visibility based on player settings
hallowatcher Apr 16, 2021
295bae9
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 17, 2021
3b5a458
fix some dialogues
hallowatcher Apr 17, 2021
8476473
add apothecary initial dialogue
hallowatcher Apr 18, 2021
9cc71fd
add resident sleeper npcs in the church
hallowatcher Apr 18, 2021
8f0193e
add stage 2 - 3
hallowatcher Apr 18, 2021
5cd0e39
set player as busy during a cutscene, add partial father lawrence cut…
hallowatcher Apr 18, 2021
650c99a
rename juliet parent/child
hallowatcher Apr 19, 2021
d0d3ab0
add generic way to change npc name in dialogues
hallowatcher Apr 19, 2021
d91858e
fix emotes
hallowatcher Apr 19, 2021
2fe9edc
Merge branch 'fix-map-loading' into romeo-and-juliet
hallowatcher Apr 20, 2021
192e0fe
Merge remote-tracking branch 'rune-js/develop' into romeo-and-juliet
hallowatcher Apr 21, 2021
f9a71e4
Merge branch 'develop' into romeo-and-juliet
hallowatcher Jun 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions data/config/items/quests/romeo-and-juliet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rs:juliet_letter": {
"game_id": 755,
"tradable": false,
"examine": "A message from Juliet to Romeo.",
"weight": 0.02
}
}
52 changes: 52 additions & 0 deletions data/config/npc-spawns/varrock/varrock-general.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,58 @@
"spawn_y": 3424,
"movement_radius": 4
},
{
"npc": "rs:draul_leptoc",
"spawn_x": 3162,
"spawn_y": 3435,
"movement_radius": 4
},
{
"npc": "rs:father_lawrence",
"spawn_x": 3254,
"spawn_y": 3485,
"movement_radius": 2
},
{
"npc": "rs:martina_scorsby",
"spawn_x": 3256,
"spawn_y": 3481,
"movement_radius": 0,
"face": "NORTH"
},
{
"npc": "rs:jeremy_clerksin",
"spawn_x": 3253,
"spawn_y": 3477,
"movement_radius": 0,
"face": "NORTH"
},
{
"npc": "rs:apothecary",
"spawn_x": 3196,
"spawn_y": 3404,
"movement_radius": 3
},
{
"npc": "rs:man",
"spawn_x": 3153,
"spawn_y": 3429,
"movement_radius": 4
},
{
"npc": "rs:phillipa",
"spawn_x": 3163,
"spawn_y": 3430,
"spawn_level": 1,
"movement_radius": 5
},
{
"npc": "rs:juliet",
"spawn_x": 3158,
"spawn_y": 3425,
"spawn_level": 1,
"movement_radius": 1
},
{
"npc": "rs:varrock_shop_keeper",
"spawn_x": 3214,
Expand Down
27 changes: 27 additions & 0 deletions data/config/npcs/varrock.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,33 @@
"rs:romeo": {
"game_id": 639
},
"rs:draul_leptoc": {
"game_id": 3324
},
"rs:phillipa": {
"game_id": 3325
},
"rs:juliet": {
"game_id": 3323,
"variations": [
{
"suffix": "visible",
"game_id": 637
}
]
},
"rs:apothecary": {
"game_id": 638
},
"rs:father_lawrence": {
"game_id": 640
},
"rs:martina_scorsby": {
"game_id": 3326
},
"rs:jeremy_clerksin": {
"game_id": 3327
},
"rs:varrock_shop_keeper": {
"game_id": 520
},
Expand Down
3 changes: 2 additions & 1 deletion data/config/widgets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@
christmas: 23,
killcount: 24
},
whatWouldYouLikeToSpin: 459
whatWouldYouLikeToSpin: 459,
fade: 115
}
2 changes: 1 addition & 1 deletion src/game-engine/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export let skillGuides: SkillGuide[] = [];
export let xteaRegions: { [key: number]: XteaRegion };

export const musicRegionMap = new Map<number, number>();
export const widgets: { [key: string]: any } = require('../../../data/config/widgets.json5');
export const widgets = require('../../../data/config/widgets.json5');

export async function loadCoreConfigurations(): Promise<void> {
xteaRegions = await loadXteaRegionFiles('data/config/xteas');
Expand Down
4 changes: 4 additions & 0 deletions src/game-engine/config/minimap-state.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum MinimapState {
NORMAL = 0,
BLACK = 2
}
16 changes: 7 additions & 9 deletions src/game-engine/config/quest-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Player } from '@engine/world/actor/player/player';
import { Npc } from '@engine/world/actor/npc/npc';
import { npcInteractionActionHandler } from '@engine/world/action/npc-interaction.action';
import { logger } from '@runejs/core';
import { handleTutorial } from '@plugins/quests/goblin-diplomacy-tutorial/goblin-diplomacy-quest.plugin';


export type QuestKey = number | 'complete';
Expand All @@ -12,7 +11,7 @@ export type QuestStageHandler = {
};

export type QuestDialogueHandler = {
[key in QuestKey]?: (player: Player, npc: Npc) => void | Promise<void>;
[key in QuestKey]?: ((player: Player, npc: Npc) => void | Promise<void>) | number;
};

export type QuestJournalHandler = {
Expand Down Expand Up @@ -45,20 +44,19 @@ export class PlayerQuest {
export function questDialogueActionFactory(questId: string, npcDialogueHandler: QuestDialogueHandler): npcInteractionActionHandler {
return async({ player, npc }) => {
const quest = player.getQuest(questId);
if(!quest) {
return;
const progress = quest.progress;

let dialogueHandler = npcDialogueHandler[progress];
if (dialogueHandler != null && typeof dialogueHandler === 'number') {
dialogueHandler = npcDialogueHandler[dialogueHandler]
}

const progress = quest.progress;
const dialogueHandler = npcDialogueHandler[progress];
if(dialogueHandler) {
if (dialogueHandler != null && typeof dialogueHandler === 'function') {
try {
await dialogueHandler(player, npc);
} catch(e) {
logger.error(e);
}

await handleTutorial(player);
}
};
}
5 changes: 5 additions & 0 deletions src/game-engine/net/inbound-packets/walk-packet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const walkPacket = (player, packet) => {
const { buffer, packetSize, packetId } = packet;

// Don't add to the walking queue if busy. If this poses problems, feel free to move it somewhere else.
if (player.busy) {
return;
}

let size = packetSize;
if(packetId === 236) {
size -= 14;
Expand Down
42 changes: 28 additions & 14 deletions src/game-engine/net/outbound-packets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Npc } from '@engine/world/actor/npc/npc';
import { stringToLong } from '@engine/util/strings';
import { LandscapeObject } from '@runejs/filestore';
import { xteaRegions } from '@engine/config';
import { MinimapState } from '@engine/config/minimap-state';
import { world } from '@engine/game-server';
import { ConstructedChunk, ConstructedRegion } from '@engine/world/map/region';

Expand Down Expand Up @@ -51,6 +52,12 @@ export class OutboundPackets {
this.queue(packet);
}

public setMinimapState(minimapState: MinimapState): void {
const packet = new Packet(235);
packet.put(minimapState);
this.queue(packet);
}

public updateSocialSettings(): void {
const packet = new Packet(196);
packet.put(this.player.settings.publicChatMode || 0);
Expand Down Expand Up @@ -232,16 +239,6 @@ export class OutboundPackets {
this.queue(packet);
}

// Text dialogs = 356, 359, 363, 368, 374
// Item dialogs = 519
// Statements (no click to continue) = 210, 211, 212, 213, 214
public showChatboxWidget(widgetId: number): void {
const packet = new Packet(208);
packet.put(widgetId, 'SHORT');

this.queue(packet);
}

public setWidgetNpcHead(widgetId: number, childId: number, modelId: number): void {
const packet = new Packet(160);
packet.put(modelId, 'SHORT', 'LITTLE_ENDIAN');
Expand Down Expand Up @@ -298,11 +295,11 @@ export class OutboundPackets {
this.queue(packet);
}

public setWidgetModelRotationAndZoom(widgetId: number, childId: number, rotationX: number, rotationY: number, zoom: number): void {
public setWidgetModelRotationAndZoom(widgetId: number, childId: number, rotationY: number, rotationX: number, zoom: number): void {
const packet = new Packet(142);
packet.put(rotationX, 'SHORT');
packet.put(zoom, 'SHORT', 'LITTLE_ENDIAN');
packet.put(rotationY, 'SHORT');
packet.put(zoom, 'SHORT', 'LITTLE_ENDIAN');
packet.put(rotationX, 'SHORT');
packet.put(widgetId << 16 | childId, 'INT', 'LITTLE_ENDIAN');

this.queue(packet);
Expand Down Expand Up @@ -487,7 +484,24 @@ export class OutboundPackets {
this.queue(packet);
}

public showChatDialogue(widgetId: number): void {
/**
* Show or replace dialogue in the chatbox slot, resetting all the other slots client-side
* This widget will close when walking
* @param widgetId The widget ID
*/
public showChatboxWidget(widgetId: number): void {
const packet = new Packet(208);
packet.put(widgetId, 'SHORT');

this.queue(packet);
}

/**
* Show permanent widget in the dialogue slot that preserves all widgets, even previously opened chatbox widgets
* This widget will NOT close when walking
* @param widgetId The widget ID
*/
public showPermanentDialogueWidget(widgetId: number): void {
const packet = new Packet(185);
packet.put(widgetId, 'SHORT');
this.queue(packet);
Expand Down
Loading