mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00
Add the //gm item command back
I never actually finished the Lua version, oops.
This commit is contained in:
parent
99a165e405
commit
f1b9461eb2
3 changed files with 25 additions and 0 deletions
9
resources/scripts/commands/gm/GiveItem.lua
Normal file
9
resources/scripts/commands/gm/GiveItem.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
required_rank = GM_RANK_DEBUG
|
||||||
|
command_sender = "[item] "
|
||||||
|
|
||||||
|
function onCommand(args, player)
|
||||||
|
local id = args[1]
|
||||||
|
|
||||||
|
player:add_item(id)
|
||||||
|
printf(player, "Added %s to your inventory.", id)
|
||||||
|
end
|
|
@ -780,6 +780,13 @@ impl ZoneConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Task::AddItem { id } => {
|
||||||
|
self.player_data.inventory.add_in_next_free_slot(Item {
|
||||||
|
id: *id,
|
||||||
|
quantity: 1,
|
||||||
|
});
|
||||||
|
self.send_inventory(false).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.queued_tasks.clear();
|
player.queued_tasks.clear();
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub enum Task {
|
||||||
ChangeWeather { id: u16 },
|
ChangeWeather { id: u16 },
|
||||||
AddGil { amount: u32 },
|
AddGil { amount: u32 },
|
||||||
UnlockOrchestrion { id: u16, on: bool },
|
UnlockOrchestrion { id: u16, on: bool },
|
||||||
|
AddItem { id: u32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
|
@ -248,6 +249,10 @@ impl LuaPlayer {
|
||||||
on: unlocked == 1,
|
on: unlocked == 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_item(&mut self, id: u32) {
|
||||||
|
self.queued_tasks.push(Task::AddItem { id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UserData for LuaPlayer {
|
impl UserData for LuaPlayer {
|
||||||
|
@ -379,6 +384,10 @@ impl UserData for LuaPlayer {
|
||||||
this.unlock_orchestrion(unlock, id);
|
this.unlock_orchestrion(unlock, id);
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
methods.add_method_mut("add_item", |_, this, id: u32| {
|
||||||
|
this.add_item(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