Coder Social home page Coder Social logo

Comments (1)

DeviousHearts avatar DeviousHearts commented on August 20, 2024

I found an issue with this as well. A freind of mine (A genius coder by the name of Ethaks) had to write a world script. the issue was the ownership was not officially recognized by the system, I believe he said.

I installed the World Scripter module and put this macro in the World Scripter compendium and it solved the issue for me.

// Fix Toughness Roll Buttons
async function runStuff() {
	const commons = await import("/systems/mutants-and-masterminds-3e/module/helpers/common.mjs");

	Hooks.on("renderChatMessage", async (message, html, data) => {
		html.find("button.btnRoll").click(async (ev) => {
			ev.stopPropagation();
			const target = $(ev.currentTarget);
			const tgt = target.data("target");
			const savetype = target.data("savetype");
			const vs = target.data("vs");
			const dataAtk = target.data("datk");
			const dataStr = target.data("dstr");
			const typeAtk = target.data("type");
			const hasAlt = ev.altKey;

			const token = canvas.scene.tokens.find((token) => token.id === tgt);

			if (token.actor.ownership[game.user.id] === 3 || token.actor.ownership.default === 3) return;
			if (!token.actor.isOwner)
				return ui.notifications.error(`You do not have owner permissions for ${token.actor.name}`);

			const tokenData = token.actor.system;
			const saveScore = tokenData.defense[savetype].total;
			const name = `${game.i18n.localize(CONFIG.MM3.defenses[savetype])}`;

			commons.rollVs(
				token.actor,
				name,
				saveScore,
				vs,
				{ typeAtk: typeAtk, atk: dataAtk, str: dataStr, tkn: token },
				{ alt: hasAlt },
			);
		});
	});
}
runStuff();

from foundry-mm3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.