Merge branch 'v1.5-fixes' into 'v1.5'
Petits fixes mineurs See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!288
This commit is contained in:
commit
15c2bc395b
@ -519,6 +519,7 @@ export class RdDActor extends Actor {
|
||||
await this.santeIncDec("vie", -1);
|
||||
}
|
||||
else {
|
||||
blessure.jours++;
|
||||
message.content += ` -- une blessure ${type} reste stable`;
|
||||
}
|
||||
}
|
||||
@ -2111,7 +2112,8 @@ export class RdDActor extends Actor {
|
||||
xp: carac.xp
|
||||
}
|
||||
if (display) {
|
||||
ChatUtility.createChatWithRollMode(this.name, {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
|
||||
});
|
||||
}
|
||||
@ -2142,7 +2144,8 @@ export class RdDActor extends Actor {
|
||||
archetypeWarning: newCompData.data.niveau > compData.data.niveau_archetype
|
||||
}
|
||||
if (display) {
|
||||
ChatUtility.createChatWithRollMode(this.name, {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, checkXp)
|
||||
});
|
||||
}
|
||||
@ -2156,11 +2159,10 @@ export class RdDActor extends Actor {
|
||||
if (!this.isPersonnage()) return;
|
||||
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
||||
if (xpData && display) {
|
||||
let message = {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
|
||||
}
|
||||
ChatMessage.create(message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2991,8 +2993,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCaracByName(caracName) {
|
||||
switch (Grammar.toLowerCaseNoAccent(caracName)) {
|
||||
getCaracByName(name) {
|
||||
switch (Grammar.toLowerCaseNoAccent(name)) {
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return {
|
||||
label: 'Rêve actuel',
|
||||
@ -3006,14 +3008,14 @@ export class RdDActor extends Actor {
|
||||
type: "number"
|
||||
};
|
||||
}
|
||||
return RdDActor._findCaracByName(Misc.templateData(this).carac, caracName);
|
||||
return RdDActor._findCaracByName(Misc.templateData(this).carac, name);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _findCaracByName(carac, name) {
|
||||
name = Grammar.toLowerCaseNoAccent(name);
|
||||
switch (name) {
|
||||
case 'reve-actuel': case 'rêve actuel':
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return carac.reve;
|
||||
case 'chance-actuelle': case 'chance actuelle':
|
||||
return carac.chance;
|
||||
@ -3587,7 +3589,7 @@ export class RdDActor extends Actor {
|
||||
if (acheteur) {
|
||||
let resteAcheteur = await acheteur.depenser(coutDeniers);
|
||||
if (resteAcheteur < 0) {
|
||||
ui.notifications.warn(`Vous n'avez pas assez d'argent pour payer ${vente.prixTotal} sols !`);
|
||||
ChatUtility.notifyUser(achat.userId, 'warn', `Vous n'avez pas assez d'argent pour payer ${Math.ceil(coutDeniers/100)} sols !`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3596,7 +3598,7 @@ export class RdDActor extends Actor {
|
||||
let itemVenduData = Misc.data(itemVendu);
|
||||
if ("quantite" in itemVenduData.data ? itemVenduData.data.quantite < achat.quantiteTotal : achat.choix.nombreLots != 1) {
|
||||
await acheteur?.ajouterDeniers(coutDeniers);
|
||||
ui.notifications.warn(`Le vendeur n'a plus assez de ${vente.item.name} !`);
|
||||
ChatUtility.notifyUser(achat.userId, 'warn', `Le vendeur n'a plus assez de ${vente.item.name} !`);
|
||||
return;
|
||||
}
|
||||
vendeur.ajouterDeniers(coutDeniers);
|
||||
@ -3628,6 +3630,7 @@ export class RdDActor extends Actor {
|
||||
const chatAchatItem = duplicate(vente);
|
||||
chatAchatItem.quantiteTotal = achat.quantiteTotal;
|
||||
ChatMessage.create({
|
||||
speaker: {alias: (acheteur ?? vendeur).name} ,
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem)
|
||||
});
|
||||
|
@ -9,6 +9,33 @@ export class ChatUtility {
|
||||
static onSocketMessage(sockmsg) {
|
||||
switch (sockmsg.msg) {
|
||||
case "msg_delete_chat_message": return ChatUtility.onRemoveMessages(sockmsg.data);
|
||||
case "msg_user_ui_notifications": return ChatUtility.onNotifyUser(sockmsg.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static notifyUser(userId, level = 'info', message) {
|
||||
const data = {
|
||||
userId: userId, level: level, message: message
|
||||
};
|
||||
if (game.user.id == userId) {
|
||||
ChatUtility.onNotifyUser(data);
|
||||
}
|
||||
else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
msg: "msg_user_ui_notifications", data: data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static onNotifyUser(data) {
|
||||
if (game.user.id == data.userId) {
|
||||
switch (data.level) {
|
||||
case 'warn': ui.notifications.warn(data.message); break;
|
||||
case 'error': ui.notifications.error(data.message); break;
|
||||
default: ui.notifications.info(data.message); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +52,19 @@ export class ChatUtility {
|
||||
}
|
||||
}
|
||||
|
||||
static onRemoveMessages(data) {
|
||||
if (Misc.isElectedUser()) {
|
||||
if (data.part) {
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes(data.part));
|
||||
toDelete.forEach(it => it.delete());
|
||||
}
|
||||
if (data.messageId) {
|
||||
game.messages.get(data.messageId)?.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static removeMessages(data) {
|
||||
if (Misc.isElectedUser()){
|
||||
ChatUtility.onRemoveMessages(data);
|
||||
|
@ -79,6 +79,7 @@ export class DialogItemAchat extends Dialog {
|
||||
async onAchat() {
|
||||
await $(".nombreLots").change();
|
||||
(this.vendeur ?? this.acheteur).achatVente({
|
||||
userId: game.user.id,
|
||||
vendeurId: this.vendeur?.id,
|
||||
acheteurId: this.acheteur?.id,
|
||||
prixTotal: this.venteData.prixTotal,
|
||||
|
@ -1134,7 +1134,10 @@ ul, li {
|
||||
border-image-width: 4px;
|
||||
border-image-outset: 0px;
|
||||
}
|
||||
|
||||
#controls .control-tools {
|
||||
max-height: calc(100vh - 156px);
|
||||
height: auto;
|
||||
}
|
||||
#controls .scene-control.active, #controls .control-tool.active, #controls .scene-control:hover, #controls .control-tool:hover {
|
||||
background: rgba(72, 46, 28, 1);
|
||||
background-origin: padding-box;
|
||||
|
Loading…
Reference in New Issue
Block a user