280
0
1

根据任务杀敌获取白鸡

Admin VIP
11月前 1129

傻瓜版:

1、statsService.ts文件替换掉服务端\src\services文件夹下的同名文件。

2、statTypes.ts文件替换掉服务端\src\types文件夹下的同名文件。

3、updateInventory.pluto文件放在客户端OpenWF\Scripts\samples文件夹下,并在http://localhost:6155/网站启用插件(启用插件需要再游戏开启后才可以进行)。

4、开游戏肝白鸡

进阶版:

1、在statsService.ts文件的末尾添加代码:

const applyPlatinumReward = async (payload: IStatsUpdate, accountOwnerId: string): Promise<void> =>
{
    const add = payload.add ?? {};
    
    const kills = Object.values(add.KILL_ENEMY || {}).reduce((a, b) => Number(a) + Number(b), 0);
    const eximusKills = Object.values(add.KILL_EXIMUS || {}).reduce((a, b) => Number(a) + Number(b), 0);
    const executions = Object.values(add.EXECUTE_ENEMY || {}).reduce((a, b) => Number(a) + Number(b), 0);
    const headshots = Object.values(add.HEADSHOT || {}).reduce((a, b) => Number(a) + Number(b), 0);
    const damageReceived = Object.values(add.TAKE_DAMAGE || {}).reduce((a, b) => Number(a) + Number(b), 0);
    const gsSuccess = (add.MISSION_COMPLETE?.GS_SUCCESS ?? 0);

    if(gsSuccess !== 1){logger.warn(`MISSION FAILED`); return;}
    
    const killValue = 0.10;
    const eximusKillBase = 0.40;
    const eximusKillBonus = 0.05;
    const executeValue = 0.2;
    const headshotValue = 0.30;
    const damagePenalty = 0.054;
    const maxDamagePenalty = 10;
    const scalingFactor = 1.1;
    
    const killScore = kills * killValue;
    const eximusKillScore = eximusKills * eximusKillBase + eximusKills * eximusKills * eximusKillBonus;
    const executeScore = executions * executeValue;
    const headshotScore = headshots * headshotValue;
    
    const rawPenalty = Math.sqrt(damageReceived) * damagePenalty;
    const nonLinearDamagePenaltyScore = rawPenalty < 1 ? 0 : Math.min(rawPenalty, maxDamagePenalty);
    
    const totalScore = ( killScore + eximusKillScore + executeScore + headshotScore - nonLinearDamagePenaltyScore ) * scalingFactor;
    
    const platinumReward = Math.max(0, Math.round(totalScore));
    
    const inventory = await getInventory(accountOwnerId);
    inventory.PremiumCredits += platinumReward;
    await inventory.save();
    logger.warn(`You earned ${platinumReward} platinums`);
};

2、同名文件

const playerStats = await getStats(accountOwnerId);

的下一行中添加代码:

await applyPlatinumReward(payload, accountOwnerId); 

3、statTypes.ts文件中,在114行KILL_ENEMY?: IUploadEntry;的下一行中添加代码:

KILL_EXIMUS?: IUploadEntry;

4、updateInventory.pluto文件放在客户端OpenWF\Scripts\samples文件夹下,并在http://localhost:6155/网站启用插件(启用插件需要再游戏开启后才可以进行)。

5、开游戏肝白鸡

图文教程
本帖中包含附件 附件为回复后可见,请先回复!
最新回复 (280)

请先登录后发表评论!

返回