mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-05-21 11:50:06 -05:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8558dcc3a8 | |||
| f8a8b61726 | |||
| 067a1de49e | |||
| 65ef3bfeca | |||
| af04657856 | |||
| 259f7ef588 | |||
| 106a0c9ed8 | |||
| 74ba5c0b27 | |||
| bb54a6532d | |||
| 3c36c59bb3 | |||
| 2308961de6 | |||
| 2d71a902f1 |
+1
-1
Submodule habitica-images updated: 9982925604...0c48d4c818
@@ -0,0 +1,79 @@
|
||||
/* eslint-disable no-console */
|
||||
const MIGRATION_NAME = '20230718_summer_splash_orcas';
|
||||
|
||||
import { model as User } from '../../../website/server/models/user';
|
||||
|
||||
const progressCount = 1000;
|
||||
let count = 0;
|
||||
|
||||
async function updateUser (user) {
|
||||
count++;
|
||||
|
||||
const set = { migration: MIGRATION_NAME };
|
||||
const push = {};
|
||||
|
||||
if (user && user.items && user.items.pets && typeof user.items.pets['Orca-Base'] !== 'undefined') {
|
||||
return;
|
||||
} else if (user && user.items && user.items.mounts && typeof user.items.mounts['Orca-Base'] !== 'undefined') {
|
||||
set['items.pets.Orca-Base'] = 5;
|
||||
push.notifications = {
|
||||
type: 'ITEM_RECEIVED',
|
||||
data: {
|
||||
icon: 'notif_orca_pet',
|
||||
title: 'Orcas for Summer Splash!',
|
||||
text: 'To celebrate Summer Splash, we\'ve given you an Orca Pet!',
|
||||
destination: 'stable',
|
||||
},
|
||||
seen: false,
|
||||
};
|
||||
} else {
|
||||
set['items.mounts.Orca-Base'] = true;
|
||||
push.notifications = {
|
||||
type: 'ITEM_RECEIVED',
|
||||
data: {
|
||||
icon: 'notif_orca_mount',
|
||||
title: 'Orcas for Summer Splash!',
|
||||
text: 'To celebrate Summer Splash, we\'ve given you an Orca Mount!',
|
||||
destination: 'stable',
|
||||
},
|
||||
seen: false,
|
||||
};
|
||||
}
|
||||
|
||||
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
|
||||
|
||||
return await user.updateOne({ $set: set, $push: push }).exec();
|
||||
}
|
||||
|
||||
export default async function processUsers () {
|
||||
let query = {
|
||||
migration: {$ne: MIGRATION_NAME},
|
||||
'auth.timestamps.loggedin': {$gt: new Date('2023-06-18')},
|
||||
};
|
||||
|
||||
const fields = {
|
||||
_id: 1,
|
||||
items: 1,
|
||||
};
|
||||
|
||||
while (true) { // eslint-disable-line no-constant-condition
|
||||
const users = await User // eslint-disable-line no-await-in-loop
|
||||
.find(query)
|
||||
.limit(250)
|
||||
.sort({_id: 1})
|
||||
.select(fields)
|
||||
.exec();
|
||||
|
||||
if (users.length === 0) {
|
||||
console.warn('All appropriate users found and modified.');
|
||||
console.warn(`\n${count} users processed\n`);
|
||||
break;
|
||||
} else {
|
||||
query._id = {
|
||||
$gt: users[users.length - 1],
|
||||
};
|
||||
}
|
||||
|
||||
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
|
||||
}
|
||||
};
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "habitica",
|
||||
"version": "4.276.1",
|
||||
"version": "4.276.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "habitica",
|
||||
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
|
||||
"version": "4.276.1",
|
||||
"version": "4.276.2",
|
||||
"main": "./website/server/index.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
|
||||
@@ -35848,6 +35848,16 @@
|
||||
width: 20px;
|
||||
height: 24px;
|
||||
}
|
||||
.notif_orca_mount {
|
||||
background-image: url('https://habitica-assets.s3.amazonaws.com/mobileApp/images/notif_orca_mount.png');
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
.notif_orca_pet {
|
||||
background-image: url('https://habitica-assets.s3.amazonaws.com/mobileApp/images/notif_orca_pet.png');
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
.npc_bailey {
|
||||
background-image: url('https://habitica-assets.s3.amazonaws.com/mobileApp/images/npc_bailey.png');
|
||||
width: 60px;
|
||||
|
||||
@@ -150,6 +150,8 @@
|
||||
"youCastParty": "You cast <%= spell %> for the party.",
|
||||
"chatCastSpellParty": "<%= username %> casts <%= spell %> for the party.",
|
||||
"chatCastSpellUser": "<%= username %> casts <%= spell %> on <%= target %>.",
|
||||
"chatCastSpellPartyTimes": "<%= username %> casts <%= spell %> for the party <%= times %> times.",
|
||||
"chatCastSpellUserTimes": "<%= username %> casts <%= spell %> on <%= target %> <%= times %> times.",
|
||||
"critBonus": "Critical Hit! Bonus: ",
|
||||
"gainedGold": "You gained some Gold",
|
||||
"gainedMana": "You gained some Mana",
|
||||
|
||||
@@ -85,6 +85,19 @@ export function translateMessage (lang, info) {
|
||||
msg = shared.i18n.t('chatCastSpellUser', { username: info.user, spell: spells[info.class][info.spell].text(lang), target: info.target }, lang);
|
||||
break;
|
||||
|
||||
case 'spell_cast_party_multi':
|
||||
msg = shared.i18n.t('chatCastSpellPartyTimes', { username: info.user, spell: spells[info.class][info.spell].text(lang), times: info.times }, lang);
|
||||
break;
|
||||
|
||||
case 'spell_cast_user_multi':
|
||||
msg = shared.i18n.t('chatCastSpellUserTimes', {
|
||||
username: info.user,
|
||||
spell: spells[info.class][info.spell].text(lang),
|
||||
target: info.target,
|
||||
times: info.times,
|
||||
}, lang);
|
||||
break;
|
||||
|
||||
case 'quest_cancel':
|
||||
msg = shared.i18n.t('chatQuestCancelled', { username: info.user, questName: questScrolls[info.quest].text(lang) }, lang);
|
||||
break;
|
||||
@@ -112,6 +125,9 @@ export function translateMessage (lang, info) {
|
||||
case 'claim_task':
|
||||
msg = shared.i18n.t('userIsClamingTask', { username: info.user, task: info.task }, lang);
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = 'Error translating party chat. Unknown message type.';
|
||||
}
|
||||
|
||||
if (!msg.includes('`')) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { model as User } from '../models/user';
|
||||
import { chatModel as Chat } from '../models/message';
|
||||
import * as Tasks from '../models/task';
|
||||
import {
|
||||
NotFound,
|
||||
@@ -241,7 +242,49 @@ async function castSpell (req, res, { isV3 = false }) {
|
||||
});
|
||||
|
||||
if (party && !spell.silent) {
|
||||
if (targetType === 'user') {
|
||||
const lastMessage = await Chat.findOne({ groupId: party._id })
|
||||
.sort('-timestamp')
|
||||
.exec();
|
||||
if (lastMessage && lastMessage.info.spell === spellId
|
||||
&& lastMessage.info.user === user.profile.name) {
|
||||
if (targetType === 'user') {
|
||||
const newChatMessage = party.sendChat({
|
||||
message: `\`${common.i18n.t('chatCastSpellUserTimes', {
|
||||
username: user.profile.name,
|
||||
spell: spell.text(),
|
||||
target: partyMembers.profile.name,
|
||||
times: lastMessage.info.times + 1,
|
||||
}, 'en')}\``,
|
||||
info: {
|
||||
type: 'spell_cast_user_multi',
|
||||
user: user.profile.name,
|
||||
class: klass,
|
||||
spell: spellId,
|
||||
target: partyMembers.profile.name,
|
||||
times: lastMessage.info.times + 1,
|
||||
},
|
||||
});
|
||||
await newChatMessage.save();
|
||||
await lastMessage.remove();
|
||||
} else {
|
||||
const newChatMessage = party.sendChat({
|
||||
message: `\`${common.i18n.t('chatCastSpellPartyTimes', {
|
||||
username: user.profile.name,
|
||||
spell: spell.text(),
|
||||
times: lastMessage.info.times + 1,
|
||||
}, 'en')}\``,
|
||||
info: {
|
||||
type: 'spell_cast_party_multi',
|
||||
user: user.profile.name,
|
||||
class: klass,
|
||||
spell: spellId,
|
||||
times: lastMessage.info.times + 1,
|
||||
},
|
||||
});
|
||||
await newChatMessage.save();
|
||||
await lastMessage.remove();
|
||||
}
|
||||
} else if (targetType === 'user') {
|
||||
const newChatMessage = party.sendChat({
|
||||
message: `\`${common.i18n.t('chatCastSpellUser', { username: user.profile.name, spell: spell.text(), target: partyMembers.profile.name }, 'en')}\``,
|
||||
info: {
|
||||
@@ -250,6 +293,7 @@ async function castSpell (req, res, { isV3 = false }) {
|
||||
class: klass,
|
||||
spell: spellId,
|
||||
target: partyMembers.profile.name,
|
||||
times: 1,
|
||||
},
|
||||
});
|
||||
await newChatMessage.save();
|
||||
@@ -261,6 +305,7 @@ async function castSpell (req, res, { isV3 = false }) {
|
||||
user: user.profile.name,
|
||||
class: klass,
|
||||
spell: spellId,
|
||||
times: 1,
|
||||
},
|
||||
});
|
||||
await newChatMessage.save();
|
||||
|
||||
Reference in New Issue
Block a user