gengx
This commit is contained in:
@@ -1,68 +1,2 @@
|
||||
"use strict";
|
||||
const tongji_utils_treeLevels = require("./treeLevels.js");
|
||||
const TREE_SPECIES_LIST = [
|
||||
{
|
||||
id: "classic",
|
||||
name: "稳糖灵树",
|
||||
tagline: "经典路线,从种子到圆满",
|
||||
stages: tongji_utils_treeLevels.TREE_LEVELS.map((l) => l.emoji)
|
||||
},
|
||||
{
|
||||
id: "bonsai",
|
||||
name: "雅韵盆景",
|
||||
tagline: "小巧精致,书桌旁的温柔陪伴",
|
||||
stages: ["🫘", "🌱", "🪴", "🎋", "🪴", "🌳", "🎍", "🌸", "🏵️", "🏆"]
|
||||
},
|
||||
{
|
||||
id: "pine",
|
||||
name: "苍劲青松",
|
||||
tagline: "挺拔向上,越记越稳",
|
||||
stages: ["🫘", "🌱", "🌿", "🌲", "🌲", "🌲", "⛰️", "🌲", "🏔️", "🏆"]
|
||||
},
|
||||
{
|
||||
id: "sakura",
|
||||
name: "樱花小树",
|
||||
tagline: "坚持打卡,枝头渐开",
|
||||
stages: ["🫘", "🌱", "🌿", "🌳", "🌸", "🌸", "🌸", "🌸", "🌺", "🏆"]
|
||||
},
|
||||
{
|
||||
id: "ginkgo",
|
||||
name: "金秋银杏",
|
||||
tagline: "叶色渐变,见证每一天",
|
||||
stages: ["🫘", "🌱", "🍃", "🌳", "🍂", "🍂", "🌳", "🍁", "🌟", "🏆"]
|
||||
}
|
||||
];
|
||||
const DAILY_MAX_TASK_POINTS = 40;
|
||||
function getTreeSpecies(id) {
|
||||
return TREE_SPECIES_LIST.find((s) => s.id === id) || TREE_SPECIES_LIST[0];
|
||||
}
|
||||
function speciesEmojiAtLevel(speciesId, level) {
|
||||
const sp = getTreeSpecies(speciesId);
|
||||
const lv = Math.min(tongji_utils_treeLevels.TREE_MAX_LEVEL, Math.max(0, Number(level) || 0));
|
||||
return sp.stages[lv] || sp.stages[0] || "🌱";
|
||||
}
|
||||
function speciesGrowthRoadmap(speciesId) {
|
||||
const sp = getTreeSpecies(speciesId);
|
||||
return tongji_utils_treeLevels.TREE_LEVELS.map((meta, i) => {
|
||||
const xpTotal = i * tongji_utils_treeLevels.TREE_XP_PER_LEVEL;
|
||||
const daysHint = i === 0 ? 0 : Math.max(1, Math.ceil(xpTotal / DAILY_MAX_TASK_POINTS));
|
||||
return {
|
||||
level: i,
|
||||
name: meta.name,
|
||||
emoji: sp.stages[i] || meta.emoji,
|
||||
desc: meta.desc,
|
||||
xpTotal,
|
||||
daysHint
|
||||
};
|
||||
});
|
||||
}
|
||||
function estimateDaysToMaxLevel() {
|
||||
const totalXp = tongji_utils_treeLevels.TREE_MAX_LEVEL * tongji_utils_treeLevels.TREE_XP_PER_LEVEL;
|
||||
return Math.max(1, Math.ceil(totalXp / DAILY_MAX_TASK_POINTS));
|
||||
}
|
||||
exports.TREE_SPECIES_LIST = TREE_SPECIES_LIST;
|
||||
exports.estimateDaysToMaxLevel = estimateDaysToMaxLevel;
|
||||
exports.getTreeSpecies = getTreeSpecies;
|
||||
exports.speciesEmojiAtLevel = speciesEmojiAtLevel;
|
||||
exports.speciesGrowthRoadmap = speciesGrowthRoadmap;
|
||||
"use strict";const a=require("./treeLevels.js"),i=[{id:"classic",name:"稳糖灵树",tagline:"经典路线,从种子到圆满",stages:a.TREE_LEVELS.map(e=>e.emoji)},{id:"bonsai",name:"雅韵盆景",tagline:"小巧精致,书桌旁的温柔陪伴",stages:["🫘","🌱","🪴","🎋","🪴","🌳","🎍","🌸","🏵️","🏆"]},{id:"pine",name:"苍劲青松",tagline:"挺拔向上,越记越稳",stages:["🫘","🌱","🌿","🌲","🌲","🌲","⛰️","🌲","🏔️","🏆"]},{id:"sakura",name:"樱花小树",tagline:"坚持打卡,枝头渐开",stages:["🫘","🌱","🌿","🌳","🌸","🌸","🌸","🌸","🌺","🏆"]},{id:"ginkgo",name:"金秋银杏",tagline:"叶色渐变,见证每一天",stages:["🫘","🌱","🍃","🌳","🍂","🍂","🌳","🍁","🌟","🏆"]}],c=40;function E(e){return i.find(n=>n.id===e)||i[0]}function _(e,n){const t=E(e),s=Math.min(a.TREE_MAX_LEVEL,Math.max(0,Number(n)||0));return t.stages[s]||t.stages[0]||"🌱"}function r(e){const n=E(e);return a.TREE_LEVELS.map((t,s)=>{const o=s*a.TREE_XP_PER_LEVEL,m=s===0?0:Math.max(1,Math.ceil(o/c));return{level:s,name:t.name,emoji:n.stages[s]||t.emoji,desc:t.desc,xpTotal:o,daysHint:m}})}function L(){const e=a.TREE_MAX_LEVEL*a.TREE_XP_PER_LEVEL;return Math.max(1,Math.ceil(e/c))}exports.TREE_SPECIES_LIST=i;exports.estimateDaysToMaxLevel=L;exports.getTreeSpecies=E;exports.speciesEmojiAtLevel=_;exports.speciesGrowthRoadmap=r;
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/tongji/utils/treeSpecies.js.map
|
||||
|
||||
Reference in New Issue
Block a user