Skip to content

Commit adad22c

Browse files
Merge pull request #299 from UchuServer/enhancement/skip-block-yard
Automatically skip Block Yard missions
2 parents d27a976 + 0147c55 commit adad22c

File tree

4 files changed

+73
-1
lines changed

4 files changed

+73
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System.Linq;
2+
using System.Threading.Tasks;
3+
using Uchu.Core.Resources;
4+
using Uchu.World;
5+
using Uchu.World.Scripting.Native;
6+
using Uchu.World.Social;
7+
8+
namespace Uchu.StandardScripts.AvantGardens
9+
{
10+
[ZoneSpecific(1100)]
11+
public class SkipBlockYardMissions : NativeScript
12+
{
13+
public override Task LoadAsync()
14+
{
15+
var crashHelmut = Zone.GameObjects.First(g => g.Lot == Lot.CrashHelmutNpc);
16+
Listen(crashHelmut.GetComponent<MissionGiverComponent>().OnMissionOk, async tuple =>
17+
{
18+
var (missionId, _, _, player) = tuple;
19+
20+
// 'go to block yard' mission
21+
if (missionId != (int) MissionId.BackupBulwark)
22+
return;
23+
24+
// small delay to make sure the mission has been added to the player's mission inventory and started
25+
await Task.Delay(1000);
26+
27+
// complete 'go to block yard' mission
28+
var missionInventory = player.GetComponent<MissionInventoryComponent>();
29+
var bulwarkMission = missionInventory.GetMission(MissionId.BackupBulwark);
30+
await bulwarkMission.CompleteAsync();
31+
32+
// complete 'smash spider queen' mission
33+
var arachnophobiaMission = await missionInventory.AddMissionAsync((int) MissionId.Arachnophobia, player);
34+
await arachnophobiaMission.StartAsync();
35+
await arachnophobiaMission.CompleteAsync();
36+
37+
// start 'talk to sky lane' mission
38+
var skyLaneMission = await missionInventory.AddMissionAsync((int) MissionId.CheckInwithSkyLane, player);
39+
await skyLaneMission.StartAsync();
40+
41+
// show pop-up to player
42+
await UiHelper.AnnouncementAsync((Player) player, "Completed Missions",
43+
"Block Yard is currently not implemented. The missions have been completed for you.");
44+
});
45+
46+
return Task.CompletedTask;
47+
}
48+
}
49+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Threading.Tasks;
2+
using Uchu.World.Scripting.Native;
3+
using Uchu.World.Social;
4+
5+
namespace Uchu.StandardScripts.BlockYard
6+
{
7+
[ZoneSpecific(1150)]
8+
public class BlockYardWarning : NativeScript
9+
{
10+
public override Task LoadAsync()
11+
{
12+
Listen(Zone.OnPlayerLoad, async player =>
13+
{
14+
await UiHelper.AnnouncementAsync(player, "Not yet implemented",
15+
"Block Yard is currently not implemented. You can return to Avant Gardens by sending <font color=\"#FF7F00\">/testmap 1100</font> in the chat.");
16+
});
17+
18+
return Task.CompletedTask;
19+
}
20+
}
21+
}

Uchu.World/Objects/Components/Player/MissionInventoryComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public MissionInstance GetMission(int id)
312312
/// <param name="missionId">The missionId to create a mission for</param>
313313
/// <param name="gameObject">The game object to assign the mission to</param>
314314
/// <returns>The newly created mission instance</returns>
315-
private async Task<MissionInstance> AddMissionAsync(int missionId, GameObject gameObject)
315+
public async Task<MissionInstance> AddMissionAsync(int missionId, GameObject gameObject)
316316
{
317317
var mission = new MissionInstance(missionId, (Player)GameObject);
318318
await mission.LoadAsync();

Uchu.World/Structs/Lot.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public int[] GetComponentIds(int componentType)
155155
public const int MonumentRaceCancelTrigger = 3297;
156156
public const int MonumentFinishLine = 4967;
157157

158+
public const int CrashHelmutNpc = 6374;
159+
158160
#endregion
159161
}
160162
}

0 commit comments

Comments
 (0)