任务:宝石相关任务系统达成条件修改

This commit is contained in:
luying
2022-10-08 16:03:21 +08:00
parent d1766a33a5
commit c064341bc1
5 changed files with 75 additions and 70 deletions
@@ -354,7 +354,7 @@ export class EquipHandler {
if(canChange) canSentMineToOrigin = true; if(canChange) canSentMineToOrigin = true;
let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 }); let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null, skinId: originHero.skinId }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null, skinId: originHero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null); await checkTaskInPutJewel(serverId, roleId, sid, jewel.hid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null);
originHeroResult = { hid: originHero.hid, ePlace: updatedEplace }; originHeroResult = { hid: originHero.hid, ePlace: updatedEplace };
} }
@@ -367,7 +367,7 @@ export class EquipHandler {
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId); let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel, skinId: hero.skinId }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel, skinId: hero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, hid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
let curHero = { let curHero = {
hid, hid,
@@ -395,7 +395,7 @@ export class EquipHandler {
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0); let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null, skinId: hero.skinId }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null, skinId: hero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, hid, oldEplace, newEplace, ePlaceId, null, curJewel);
let curHero = { let curHero = {
hid, hid,
@@ -448,7 +448,7 @@ export class EquipHandler {
consumes: updateConsumes, consumes: updateConsumes,
} }
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel, skinId: hero.skinId, stonesId }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel, skinId: hero.skinId, stonesId });
await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel); await checkTaskInPutStone(serverId, roleId, sid, hid, oldEplace, newEplace, ePlaceId, jewel);
let curHero = { let curHero = {
hid, hid,
+2 -1
View File
@@ -487,7 +487,8 @@ export function checkRouteParam(route: string, msg: any) {
case "battle.comBattleHandler.sendTeamMsg": case "battle.comBattleHandler.sendTeamMsg":
{ {
let { teamCode, type, content, targetRoleId, targetMsgCode } = msg; let { teamCode, type, content, targetRoleId, targetMsgCode } = msg;
if(!checkNaturalStrings(teamCode, content, targetRoleId, targetMsgCode)) return false; if(!checkNaturalStrings(teamCode, content)) return false;
if(!checkStringIfExist(targetRoleId, targetMsgCode)) return false;
if(!checkNaturalNumbers(type)) return false; if(!checkNaturalNumbers(type)) return false;
break; break;
} }
+4 -4
View File
@@ -142,10 +142,10 @@ export function getEquipById(oldEplace: EPlace[], newEplace: EPlace[], eplaceId:
return { oldEquip, newEquip } return { oldEquip, newEquip }
} }
export function getJewelByEquip(oldEquip: EPlace, newEquip: EPlace, jewels: JewelType[]) { export function getJewelByEquip(equip: EPlace, jewels: JewelType[]) {
let oldJewel = jewels.find(cur => cur && cur.seqId == oldEquip.jewel); if(!equip) return null
let newJewel = jewels.find(cur => cur && cur.seqId == newEquip.jewel); let jewel = jewels.find(cur => cur && cur.seqId == equip.jewel);
return { oldJewel, newJewel } return jewel
} }
export function isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) { export function isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) {
+56 -52
View File
@@ -569,11 +569,11 @@ export class CheckSingleTask {
} }
case TASK_TYPE.ROLE_SCHOOL_PUT_HERO: // 18. 百家学宫放置x个武将 case TASK_TYPE.ROLE_SCHOOL_PUT_HERO: // 18. 百家学宫放置x个武将
{ {
let { hid, preHid } = param; let records = await getRecord();
if (hid > 0 && preHid <= 0) { // 放置 let { hid } = param;
result = { inc: 1 }; if(records.indexOf(`${hid}`) == -1) {
} else if (hid <= 0 && preHid > 0) { // 卸下 records.push(`${hid}`)
result = { inc: -1 }; result = { records, inc: 1 };
} }
break; break;
} }
@@ -987,28 +987,34 @@ export class CheckSingleTask {
} }
case TASK_TYPE.EQUIP_PUT_JEWEL: // 88. x件装备镶嵌X阶天晶石 case TASK_TYPE.EQUIP_PUT_JEWEL: // 88. x件装备镶嵌X阶天晶石
{ {
let { oldEquip, newEquip, jewels } = param; let { hid, newEquip, jewels } = param;
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels); if(!newEquip) break;
let oldLv = gameData.jewel.get(oldJewel?.id)?.lv || 0;
let lv = gameData.jewel.get(newJewel?.id)?.lv || 0; let jewel = getJewelByEquip(newEquip, jewels);
if(lv >= dicTaskParam[1] && oldLv < dicTaskParam[1]) { let lv = gameData.jewel.get(jewel?.id)?.lv || 0;
result = { inc: 1 }; if(lv < dicTaskParam[1]) break;
} else if (lv < dicTaskParam[1] && oldLv >= dicTaskParam[1]) {
result = { inc: -1 }; let records = await getRecord();
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`)
result = { records, inc: 1 };
} }
break; break;
} }
case TASK_TYPE.EQUIP_PUT_STONE: // 89. x件装备镶嵌X个地玉石 case TASK_TYPE.EQUIP_PUT_STONE: // 89. x件装备镶嵌X个地玉石
{ {
let { oldEquip, newEquip } = param; let { hid, newEquip } = param;
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length; if(!newEquip) break;
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length; let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
if(newStoneCnt < dicTaskParam[1]) break;
if(oldStoneCnt < dicTaskParam[1] && newStoneCnt >= dicTaskParam[1]) {
result = { inc: 1 }; let records = await getRecord();
} else if (oldStoneCnt >= dicTaskParam[1] && newStoneCnt < dicTaskParam[1]) { if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
result = { inc: -1 }; records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
} }
break; break;
} }
case TASK_TYPE.EQUIP_STAR_UP_TO: // 90. x件装备升至X星 case TASK_TYPE.EQUIP_STAR_UP_TO: // 90. x件装备升至X星
@@ -1117,23 +1123,26 @@ export class CheckSingleTask {
} }
case TASK_TYPE.EQUIP_PUT_JEWEL_CNT: // 99. X件装备镶嵌天晶 case TASK_TYPE.EQUIP_PUT_JEWEL_CNT: // 99. X件装备镶嵌天晶
{ {
let { oldEquip, newEquip } = param; let { newEquip } = param;
if(oldEquip.jewel && !newEquip.jewel) { if(!newEquip || !newEquip.jewel) break;
result = { inc: -1 }; let records = await getRecord();
} else if (!oldEquip.jewel && newEquip.jewel) { if(records.indexOf(`${newEquip.jewel}`) == -1) {
result = { inc: 1 }; records.push(`${newEquip.jewel}`);
result = { records, inc: 1 };
} }
break; break;
} }
case TASK_TYPE.EQUIP_PUT_STONE_CNT: // 100. X件装备镶嵌地玉 case TASK_TYPE.EQUIP_PUT_STONE_CNT: // 100. X件装备镶嵌地玉
{ {
let { oldEquip, newEquip } = param; let { hid, newEquip } = param;
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length; if(newEquip) break;
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length; let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
if(oldStoneCnt > 0 && newStoneCnt == 0) { if(newStoneCnt <= 0) break;
result = { inc: -1 }; let records = await getRecord();
} else if (oldStoneCnt == 0 && newStoneCnt > 0) {
result = { inc: 1 }; if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
} }
break; break;
} }
@@ -1147,43 +1156,38 @@ export class CheckSingleTask {
} }
case TASK_TYPE.EQUIP_STONE_CNT_LV: // 102. X件装备镶嵌X个大于等于X阶地玉 case TASK_TYPE.EQUIP_STONE_CNT_LV: // 102. X件装备镶嵌X个大于等于X阶地玉
{ {
let { oldEquip, newEquip } = param; let { hid, newEquip } = param;
let oldStoneLvs = oldEquip.stones.map(cur => { if(!newEquip) break;
let dicStone = gameData.stone.get(cur.stone);
return dicStone?dicStone.lv: 0;
});
let newStoneLvs = newEquip.stones.map(cur => { let newStoneLvs = newEquip.stones.map(cur => {
let dicStone = gameData.stone.get(cur.stone); let dicStone = gameData.stone.get(cur.stone);
return dicStone?dicStone.lv: 0; return dicStone?dicStone.lv: 0;
}); });
let oldCount = oldStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
let newCount = newStoneLvs.filter(lv => lv >= dicTaskParam[2]).length; let newCount = newStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
if(oldCount < dicTaskParam[1] && newCount >= dicTaskParam[1]) { if(newCount < dicTaskParam[1]) break;
result = { inc: 1 };
} else if (oldCount >= dicTaskParam[1] && newCount < dicTaskParam[1]) { let records = await getRecord();
result = { inc: -1 } if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
} }
break; break;
} }
case TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT: // 103.X个天晶的Y条特性词条被激活 case TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT: // 103.X个天晶的Y条特性词条被激活
{ {
let { oldEquip, newEquip, jewels } = param; let { newEquip, jewels } = param;
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels); let newJewel = getJewelByEquip(newEquip, jewels);
if(!newJewel) break;
let oldRandSe = oldJewel?.randSe||[];
let oldUnlockSeCnt = oldRandSe.filter(se => {
return isRandSeUnLock(oldJewel.id, se.id, oldEquip.stones);
}).length;
let newRandSe = newJewel?.randSe||[]; let newRandSe = newJewel?.randSe||[];
let newUnlockSeCnt = newRandSe.filter(se => { let newUnlockSeCnt = newRandSe.filter(se => {
return isRandSeUnLock(newJewel.id, se.id, newEquip.stones); return isRandSeUnLock(newJewel.id, se.id, newEquip.stones);
}).length; }).length;
if(oldUnlockSeCnt < dicTaskParam[1] && newUnlockSeCnt >= dicTaskParam[1]) { if(newUnlockSeCnt < dicTaskParam[1]) break;
result = { inc: 1 }; let records = await getRecord();
} else if (oldUnlockSeCnt >= dicTaskParam[1] && newUnlockSeCnt < dicTaskParam[1]) { if(records.indexOf(`${newJewel.seqId}`)) {
result = { inc: -1 }; records.push(`${newJewel.seqId}`);
result = { records, inc: 1 };
} }
break; break;
} }
+9 -9
View File
@@ -250,23 +250,23 @@ export async function checkTaskInEquipLvUp(serverId: number, roleId: string, sid
await task.saveAndPush(sid); await task.saveAndPush(sid);
} }
export async function checkTaskInPutJewel(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, originJewel: JewelType, curJewel: JewelType) { export async function checkTaskInPutJewel(serverId: number, roleId: string, sid: string, hid: number, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, originJewel: JewelType, curJewel: JewelType) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId); let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
let task = new CheckTask(serverId, roleId); let task = new CheckTask(serverId, roleId);
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL, { oldEquip, newEquip, jewels: [originJewel, curJewel ] }); task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL, { hid, newEquip, jewels: [originJewel, curJewel ] });
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL_CNT, { newEquip });
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEquip, jewels: [originJewel, curJewel ] }); task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { newEquip, jewels: [originJewel, curJewel ] });
await task.saveAndPush(sid); await task.saveAndPush(sid);
} }
export async function checkTaskInPutStone(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, jewel: JewelType) { export async function checkTaskInPutStone(serverId: number, roleId: string, sid: string, hid: number, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, jewel: JewelType) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId); let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
let task = new CheckTask(serverId, roleId); let task = new CheckTask(serverId, roleId);
task.setParam(TASK_TYPE.EQUIP_PUT_STONE, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_PUT_STONE, { hid, newEquip });
task.setParam(TASK_TYPE.EQUIP_PUT_STONE_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_PUT_STONE_CNT, { hid, newEquip });
task.setParam(TASK_TYPE.EQUIP_STONE_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_STONE_CNT, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_STONE_CNT_LV, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_STONE_CNT_LV, { hid, newEquip });
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEquip, jewels: [jewel ] }); task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { newEquip, jewels: [jewel ] });
await task.saveAndPush(sid); await task.saveAndPush(sid);
} }