任务:宝石相关任务系统达成条件修改
This commit is contained in:
@@ -354,7 +354,7 @@ export class EquipHandler {
|
||||
if(canChange) canSentMineToOrigin = true;
|
||||
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 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 };
|
||||
}
|
||||
@@ -367,7 +367,7 @@ export class EquipHandler {
|
||||
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
|
||||
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 checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
|
||||
await checkTaskInPutJewel(serverId, roleId, sid, hid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
|
||||
|
||||
let curHero = {
|
||||
hid,
|
||||
@@ -395,7 +395,7 @@ export class EquipHandler {
|
||||
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 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 checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel);
|
||||
await checkTaskInPutJewel(serverId, roleId, sid, hid, oldEplace, newEplace, ePlaceId, null, curJewel);
|
||||
|
||||
let curHero = {
|
||||
hid,
|
||||
@@ -448,7 +448,7 @@ export class EquipHandler {
|
||||
consumes: updateConsumes,
|
||||
}
|
||||
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 = {
|
||||
hid,
|
||||
|
||||
@@ -487,7 +487,8 @@ export function checkRouteParam(route: string, msg: any) {
|
||||
case "battle.comBattleHandler.sendTeamMsg":
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -142,10 +142,10 @@ export function getEquipById(oldEplace: EPlace[], newEplace: EPlace[], eplaceId:
|
||||
return { oldEquip, newEquip }
|
||||
}
|
||||
|
||||
export function getJewelByEquip(oldEquip: EPlace, newEquip: EPlace, jewels: JewelType[]) {
|
||||
let oldJewel = jewels.find(cur => cur && cur.seqId == oldEquip.jewel);
|
||||
let newJewel = jewels.find(cur => cur && cur.seqId == newEquip.jewel);
|
||||
return { oldJewel, newJewel }
|
||||
export function getJewelByEquip(equip: EPlace, jewels: JewelType[]) {
|
||||
if(!equip) return null
|
||||
let jewel = jewels.find(cur => cur && cur.seqId == equip.jewel);
|
||||
return jewel
|
||||
}
|
||||
|
||||
export function isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) {
|
||||
|
||||
@@ -569,11 +569,11 @@ export class CheckSingleTask {
|
||||
}
|
||||
case TASK_TYPE.ROLE_SCHOOL_PUT_HERO: // 18. 百家学宫放置x个武将
|
||||
{
|
||||
let { hid, preHid } = param;
|
||||
if (hid > 0 && preHid <= 0) { // 放置
|
||||
result = { inc: 1 };
|
||||
} else if (hid <= 0 && preHid > 0) { // 卸下
|
||||
result = { inc: -1 };
|
||||
let records = await getRecord();
|
||||
let { hid } = param;
|
||||
if(records.indexOf(`${hid}`) == -1) {
|
||||
records.push(`${hid}`)
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -987,28 +987,34 @@ export class CheckSingleTask {
|
||||
}
|
||||
case TASK_TYPE.EQUIP_PUT_JEWEL: // 88. x件装备镶嵌X阶天晶石
|
||||
{
|
||||
let { oldEquip, newEquip, jewels } = param;
|
||||
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels);
|
||||
let oldLv = gameData.jewel.get(oldJewel?.id)?.lv || 0;
|
||||
let lv = gameData.jewel.get(newJewel?.id)?.lv || 0;
|
||||
if(lv >= dicTaskParam[1] && oldLv < dicTaskParam[1]) {
|
||||
result = { inc: 1 };
|
||||
} else if (lv < dicTaskParam[1] && oldLv >= dicTaskParam[1]) {
|
||||
result = { inc: -1 };
|
||||
let { hid, newEquip, jewels } = param;
|
||||
if(!newEquip) break;
|
||||
|
||||
let jewel = getJewelByEquip(newEquip, jewels);
|
||||
let lv = gameData.jewel.get(jewel?.id)?.lv || 0;
|
||||
if(lv < dicTaskParam[1]) break;
|
||||
|
||||
let records = await getRecord();
|
||||
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
|
||||
records.push(`${hid}_${newEquip.id}`)
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TASK_TYPE.EQUIP_PUT_STONE: // 89. x件装备镶嵌X个地玉石
|
||||
{
|
||||
let { oldEquip, newEquip } = param;
|
||||
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length;
|
||||
let { hid, newEquip } = param;
|
||||
if(!newEquip) break;
|
||||
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
|
||||
|
||||
if(oldStoneCnt < dicTaskParam[1] && newStoneCnt >= dicTaskParam[1]) {
|
||||
result = { inc: 1 };
|
||||
} else if (oldStoneCnt >= dicTaskParam[1] && newStoneCnt < dicTaskParam[1]) {
|
||||
result = { inc: -1 };
|
||||
if(newStoneCnt < dicTaskParam[1]) break;
|
||||
|
||||
let records = await getRecord();
|
||||
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
|
||||
records.push(`${hid}_${newEquip.id}`);
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
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件装备镶嵌天晶
|
||||
{
|
||||
let { oldEquip, newEquip } = param;
|
||||
if(oldEquip.jewel && !newEquip.jewel) {
|
||||
result = { inc: -1 };
|
||||
} else if (!oldEquip.jewel && newEquip.jewel) {
|
||||
result = { inc: 1 };
|
||||
let { newEquip } = param;
|
||||
if(!newEquip || !newEquip.jewel) break;
|
||||
let records = await getRecord();
|
||||
if(records.indexOf(`${newEquip.jewel}`) == -1) {
|
||||
records.push(`${newEquip.jewel}`);
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TASK_TYPE.EQUIP_PUT_STONE_CNT: // 100. X件装备镶嵌地玉
|
||||
{
|
||||
let { oldEquip, newEquip } = param;
|
||||
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length;
|
||||
let { hid, newEquip } = param;
|
||||
if(newEquip) break;
|
||||
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
|
||||
if(oldStoneCnt > 0 && newStoneCnt == 0) {
|
||||
result = { inc: -1 };
|
||||
} else if (oldStoneCnt == 0 && newStoneCnt > 0) {
|
||||
result = { inc: 1 };
|
||||
if(newStoneCnt <= 0) break;
|
||||
let records = await getRecord();
|
||||
|
||||
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
|
||||
records.push(`${hid}_${newEquip.id}`);
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1147,43 +1156,38 @@ export class CheckSingleTask {
|
||||
}
|
||||
case TASK_TYPE.EQUIP_STONE_CNT_LV: // 102. X件装备镶嵌X个大于等于X阶地玉
|
||||
{
|
||||
let { oldEquip, newEquip } = param;
|
||||
let oldStoneLvs = oldEquip.stones.map(cur => {
|
||||
let dicStone = gameData.stone.get(cur.stone);
|
||||
return dicStone?dicStone.lv: 0;
|
||||
});
|
||||
let { hid, newEquip } = param;
|
||||
if(!newEquip) break;
|
||||
let newStoneLvs = newEquip.stones.map(cur => {
|
||||
let dicStone = gameData.stone.get(cur.stone);
|
||||
return dicStone?dicStone.lv: 0;
|
||||
});
|
||||
let oldCount = oldStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
|
||||
let newCount = newStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
|
||||
if(oldCount < dicTaskParam[1] && newCount >= dicTaskParam[1]) {
|
||||
result = { inc: 1 };
|
||||
} else if (oldCount >= dicTaskParam[1] && newCount < dicTaskParam[1]) {
|
||||
result = { inc: -1 }
|
||||
if(newCount < dicTaskParam[1]) break;
|
||||
|
||||
let records = await getRecord();
|
||||
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
|
||||
records.push(`${hid}_${newEquip.id}`);
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT: // 103.X个天晶的Y条特性词条被激活
|
||||
{
|
||||
let { oldEquip, newEquip, jewels } = param;
|
||||
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels);
|
||||
|
||||
let oldRandSe = oldJewel?.randSe||[];
|
||||
let oldUnlockSeCnt = oldRandSe.filter(se => {
|
||||
return isRandSeUnLock(oldJewel.id, se.id, oldEquip.stones);
|
||||
}).length;
|
||||
let { newEquip, jewels } = param;
|
||||
let newJewel = getJewelByEquip(newEquip, jewels);
|
||||
if(!newJewel) break;
|
||||
|
||||
let newRandSe = newJewel?.randSe||[];
|
||||
let newUnlockSeCnt = newRandSe.filter(se => {
|
||||
return isRandSeUnLock(newJewel.id, se.id, newEquip.stones);
|
||||
}).length;
|
||||
|
||||
if(oldUnlockSeCnt < dicTaskParam[1] && newUnlockSeCnt >= dicTaskParam[1]) {
|
||||
result = { inc: 1 };
|
||||
} else if (oldUnlockSeCnt >= dicTaskParam[1] && newUnlockSeCnt < dicTaskParam[1]) {
|
||||
result = { inc: -1 };
|
||||
if(newUnlockSeCnt < dicTaskParam[1]) break;
|
||||
let records = await getRecord();
|
||||
if(records.indexOf(`${newJewel.seqId}`)) {
|
||||
records.push(`${newJewel.seqId}`);
|
||||
result = { records, inc: 1 };
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -250,23 +250,23 @@ export async function checkTaskInEquipLvUp(serverId: number, roleId: string, 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 task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL, { oldEquip, newEquip, jewels: [originJewel, curJewel ] });
|
||||
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL_CNT, { oldEquip, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { 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, { newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { newEquip, jewels: [originJewel, curJewel ] });
|
||||
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 task = new CheckTask(serverId, roleId);
|
||||
task.setParam(TASK_TYPE.EQUIP_PUT_STONE, { oldEquip, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_PUT_STONE_CNT, { oldEquip, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_PUT_STONE, { hid, 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_LV, { oldEquip, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEquip, jewels: [jewel ] });
|
||||
task.setParam(TASK_TYPE.EQUIP_STONE_CNT_LV, { hid, newEquip });
|
||||
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { newEquip, jewels: [jewel ] });
|
||||
await task.saveAndPush(sid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user