mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-13 17:07:45 +00:00
Add command, actor control to unlock instanced content
This commit is contained in:
parent
45ee95318c
commit
c86a5f70a6
6 changed files with 38 additions and 0 deletions
1
USAGE.md
1
USAGE.md
|
@ -118,6 +118,7 @@ These special debug commands start with `!` and are custom to Kawari.
|
||||||
* `!item <name>`: Gives you an item matching by name.
|
* `!item <name>`: Gives you an item matching by name.
|
||||||
* `!inspect`: Prints info about the player.
|
* `!inspect`: Prints info about the player.
|
||||||
* `!completeallquests`: Completes every quest in the game, useful for accessing stuff gated behind quest completion.
|
* `!completeallquests`: Completes every quest in the game, useful for accessing stuff gated behind quest completion.
|
||||||
|
* `!unlockcontent <id>`: Unlocks the specified instanced content.
|
||||||
|
|
||||||
### GM commands
|
### GM commands
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,6 @@ registerCommand("ost", DBG_DIR.."OnScreenTest.lua")
|
||||||
registerCommand("permtest", DBG_DIR.."PermissionTest.lua")
|
registerCommand("permtest", DBG_DIR.."PermissionTest.lua")
|
||||||
registerCommand("setpos", DBG_DIR.."SetPos.lua")
|
registerCommand("setpos", DBG_DIR.."SetPos.lua")
|
||||||
registerCommand("unlock", DBG_DIR.."Unlock.lua")
|
registerCommand("unlock", DBG_DIR.."Unlock.lua")
|
||||||
|
registerCommand("unlockcontent", DBG_DIR.."UnlockContent.lua")
|
||||||
registerCommand("completeallquests", DBG_DIR.."CompleteAllQuests.lua")
|
registerCommand("completeallquests", DBG_DIR.."CompleteAllQuests.lua")
|
||||||
|
|
||||||
|
|
8
resources/scripts/commands/debug/UnlockContent.lua
Normal file
8
resources/scripts/commands/debug/UnlockContent.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
required_rank = GM_RANK_DEBUG
|
||||||
|
command_sender = "[unlockcontent] "
|
||||||
|
|
||||||
|
function onCommand(args, player)
|
||||||
|
local id = args[1]
|
||||||
|
player:unlock_content(id)
|
||||||
|
printf(player, "Content %s unlocked!", id)
|
||||||
|
end
|
|
@ -119,6 +119,15 @@ pub enum ActorControlCategory {
|
||||||
#[brw(pad_before = 2)] // padding
|
#[brw(pad_before = 2)] // padding
|
||||||
unk1: u32,
|
unk1: u32,
|
||||||
},
|
},
|
||||||
|
#[brw(magic = 0x83u16)]
|
||||||
|
UnlockInstanceContent {
|
||||||
|
#[brw(pad_before = 2)] // padding
|
||||||
|
/// Index into InstanceContent Excel sheet
|
||||||
|
id: u32,
|
||||||
|
#[br(map = read_bool_from::<u32>)]
|
||||||
|
#[bw(map = write_bool_as::<u32>)]
|
||||||
|
unlocked: bool,
|
||||||
|
},
|
||||||
Unknown {
|
Unknown {
|
||||||
category: u16,
|
category: u16,
|
||||||
#[brw(pad_before = 2)] // padding
|
#[brw(pad_before = 2)] // padding
|
||||||
|
|
|
@ -821,6 +821,15 @@ impl ZoneConnection {
|
||||||
self.player_data.completed_quests = vec![0xFF; COMPLETED_QUEST_BITMASK_SIZE];
|
self.player_data.completed_quests = vec![0xFF; COMPLETED_QUEST_BITMASK_SIZE];
|
||||||
self.send_quest_information().await;
|
self.send_quest_information().await;
|
||||||
}
|
}
|
||||||
|
Task::UnlockContent { id } => {
|
||||||
|
self.actor_control_self(ActorControlSelf {
|
||||||
|
category: ActorControlCategory::UnlockInstanceContent {
|
||||||
|
id: *id as u32,
|
||||||
|
unlocked: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.queued_tasks.clear();
|
player.queued_tasks.clear();
|
||||||
|
|
|
@ -37,6 +37,7 @@ pub enum Task {
|
||||||
UnlockOrchestrion { id: u16, on: bool },
|
UnlockOrchestrion { id: u16, on: bool },
|
||||||
AddItem { id: u32 },
|
AddItem { id: u32 },
|
||||||
CompleteAllQuests {},
|
CompleteAllQuests {},
|
||||||
|
UnlockContent { id: u16 },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
|
@ -269,6 +270,10 @@ impl LuaPlayer {
|
||||||
fn complete_all_quests(&mut self) {
|
fn complete_all_quests(&mut self) {
|
||||||
self.queued_tasks.push(Task::CompleteAllQuests {});
|
self.queued_tasks.push(Task::CompleteAllQuests {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn unlock_content(&mut self, id: u16) {
|
||||||
|
self.queued_tasks.push(Task::UnlockContent { id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UserData for LuaPlayer {
|
impl UserData for LuaPlayer {
|
||||||
|
@ -400,6 +405,10 @@ impl UserData for LuaPlayer {
|
||||||
this.complete_all_quests();
|
this.complete_all_quests();
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
methods.add_method_mut("unlock_content", |_, this, id: u16| {
|
||||||
|
this.unlock_content(id);
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_fields<F: UserDataFields<Self>>(fields: &mut F) {
|
fn add_fields<F: UserDataFields<Self>>(fields: &mut F) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue