chore: fix name
This commit is contained in:
@ -7,9 +7,9 @@
|
||||
return loadTemplates([
|
||||
|
||||
// Actor partials.
|
||||
"systems/kids-on-brooms/templates/actor/parts/actor-features.html",
|
||||
"systems/kids-on-brooms/templates/actor/parts/actor-adversity.html",
|
||||
"systems/kids-on-brooms/templates/actor/parts/actor-stats.html",
|
||||
"systems/kids-on-brooms/templates/actor/parts/actor-npc-stats.html",
|
||||
"systems/kidsonbrooms/templates/actor/parts/actor-features.html",
|
||||
"systems/kidsonbrooms/templates/actor/parts/actor-adversity.html",
|
||||
"systems/kidsonbrooms/templates/actor/parts/actor-stats.html",
|
||||
"systems/kidsonbrooms/templates/actor/parts/actor-npc-stats.html",
|
||||
]);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ Hooks.once('init', async function() {
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet("kids-on-brooms", KidsOnBroomsActorSheet, { makeDefault: true });
|
||||
Actors.registerSheet("kidsonbrooms", KidsOnBroomsActorSheet, { makeDefault: true });
|
||||
|
||||
//If there is a new chat message that is a roll we add the adversity token controls
|
||||
Hooks.on("renderChatMessage", (message, html, messageData) => {
|
||||
@ -67,7 +67,7 @@ Hooks.once('init', async function() {
|
||||
}
|
||||
|
||||
// Check if the token has already been claimed -- Contigency if the button somehow activates again
|
||||
if (message.getFlag("kids-on-brooms", "tokenClaimed")) {
|
||||
if (message.getFlag("kidsonbrooms", "tokenClaimed")) {
|
||||
ui.notifications.warn("This adversity token has already been claimed.");
|
||||
return;
|
||||
}
|
||||
@ -85,10 +85,10 @@ Hooks.once('init', async function() {
|
||||
// Update the message content
|
||||
tokenControls.update({ content: updatedContent });
|
||||
// Set the flag on the chat message to indicate that the token has been claimed
|
||||
tokenControls.setFlag("kids-on-brooms", "tokenClaimed", true);
|
||||
tokenControls.setFlag("kidsonbrooms", "tokenClaimed", true);
|
||||
} else {
|
||||
// Emit a socket request to update the message to show that the token has been claimed
|
||||
game.socket.emit('system.kids-on-brooms', {
|
||||
game.socket.emit('system.kidsonbrooms', {
|
||||
action: "takeToken",
|
||||
messageID: message.id,
|
||||
actorID: actor.id,
|
||||
@ -118,7 +118,7 @@ Hooks.once('init', async function() {
|
||||
* if a player wants to claim a token we will update the message since they do not have the permissions
|
||||
*/
|
||||
Hooks.once('ready', function() {
|
||||
game.socket.on('system.kids-on-brooms', async (data) => {
|
||||
game.socket.on('system.kidsonbrooms', async (data) => {
|
||||
console.log("Socket data received:", data);
|
||||
|
||||
if (data.action === "spendTokens") {
|
||||
@ -190,7 +190,7 @@ Hooks.once('ready', function() {
|
||||
// Update the message content
|
||||
tokenControls.update({ content: updatedContent });
|
||||
// Set the flag on the chat message to indicate that the token has been claimed
|
||||
tokenControls.setFlag("kids-on-brooms", "tokenClaimed", true);
|
||||
tokenControls.setFlag("kidsonbrooms", "tokenClaimed", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -277,7 +277,7 @@ async function _onSpendAdversityTokens(e, rollMessageId) {
|
||||
console.log(`Requesting to spend ${tokensToSpend} tokens for ${rollActor.name} by ${spendingPlayerActor.name} (cost: ${tokenCost})`);
|
||||
|
||||
// Emit a socket request to spend tokens
|
||||
game.socket.emit('system.kids-on-brooms', {
|
||||
game.socket.emit('system.kidsonbrooms', {
|
||||
action: "spendTokens",
|
||||
rollActorId: rollActorId,
|
||||
spendingActorId: spendingPlayerActor.id, // Send the player's actor who is spending the tokens
|
||||
@ -300,8 +300,8 @@ async function _updateRollMessage(rollMessageId, tokensToSpend, isPlayerOfActor)
|
||||
}
|
||||
|
||||
// Retrieve current tokens spent from flags, or initialize to 0 if not found
|
||||
let cumulativeTokensSpent = message.getFlag("kids-on-brooms", "tokensSpent") || 0;
|
||||
let newTotal = message.getFlag("kids-on-brooms", "newRollTotal") || message.rolls[0].total;
|
||||
let cumulativeTokensSpent = message.getFlag("kidsonbrooms", "tokensSpent") || 0;
|
||||
let newTotal = message.getFlag("kidsonbrooms", "newRollTotal") || message.rolls[0].total;
|
||||
|
||||
/*if(isPlayerOfActor)
|
||||
{
|
||||
@ -312,10 +312,10 @@ async function _updateRollMessage(rollMessageId, tokensToSpend, isPlayerOfActor)
|
||||
}*/
|
||||
cumulativeTokensSpent += tokensToSpend;
|
||||
newTotal += tokensToSpend;
|
||||
await message.setFlag("kids-on-brooms", "newRollTotal", newTotal);
|
||||
await message.setFlag("kidsonbrooms", "newRollTotal", newTotal);
|
||||
|
||||
// Update the message's flags to store the cumulative tokens spent
|
||||
await message.setFlag("kids-on-brooms", "tokensSpent", cumulativeTokensSpent);
|
||||
await message.setFlag("kidsonbrooms", "tokensSpent", cumulativeTokensSpent);
|
||||
let newContent = "";
|
||||
if(cumulativeTokensSpent === 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user