Преглед на файлове

added rewards for #1319

tags/v0.4.2^2
Big Bad Waffle преди 4 години
родител
ревизия
e94fe22c31
променени са 5 файла, в които са добавени 96 реда и са изтрити 32 реда
  1. +9
    -3
      src/client/ui/templates/login/styles.less
  2. +1
    -1
      src/server/config/eventPhases/phaseGiveRewards.js
  3. +63
    -21
      src/server/config/maps/sewer/events/plagueOfRats.js
  4. +21
    -5
      src/server/events/events.js
  5. +2
    -2
      src/server/misc/rewardGenerator.js

+ 9
- 3
src/client/ui/templates/login/styles.less Целия файл

@@ -17,7 +17,7 @@
.uiLogin {
display: none;
width: 562px;
height: @totalHeight;
height: 475px;
margin-top: -80px;
display: flex;
flex-direction: column;
@@ -31,6 +31,12 @@
width: 562px;
height: @logoHeight;
margin-bottom: (@boxPadding * 3);

filter:
drop-shadow(0px -4px 0px @blackD)
drop-shadow(0px 4px 0px @blackD)
drop-shadow(4px 0px 0px @blackD)
drop-shadow(-4px 0px 0px @blackD);
}

.right {
@@ -146,7 +152,7 @@
padding-left: 10px;
padding-right: 10px;
margin-left: 10px;
background-color: @redD;
background-color: @orangeD;
color: @white;

&:first-child {
@@ -154,7 +160,7 @@
}

&:hover {
background-color: @redC;
background-color: @orangeC;
}
}
}


+ 1
- 1
src/server/config/eventPhases/phaseGiveRewards.js Целия файл

@@ -11,7 +11,7 @@ module.exports = {
const pRewards = rewards[p.name];
rList.push(...pRewards);
if (rList.length > 1)
rList[1].msg = 'Fishing tournament reward:';
rList[1].msg = `${config.name} reward:`;

eventManager.instance.mail.sendMail(p.name, rList);
});


+ 63
- 21
src/server/config/maps/sewer/events/plagueOfRats.js Целия файл

@@ -1,9 +1,46 @@
const { mobs: { rat: { level, faction, grantRep, regular: { drops } } } } = require('../zone');
const rewardGenerator = require('../../../../misc/rewardGenerator');

/*
Todo:
* Decide on and set rewards
*/
const rewardConfig = {
regularKill: [{
name: 'Iron Bar',
sprite: [0, 0],
quality: 0,
quantity: 5,
chance: 10
}, {
name: 'Cloth Scrap',
sprite: [0, 1],
quality: 0,
quantity: 5,
chance: 10
}, {
name: 'Leather Scrap',
sprite: [0, 7],
quality: 0,
quantity: 5,
chance: 10
}, {
name: 'Muddy Runestone',
material: true,
quality: 0,
sprite: [6, 0],
spritesheet: 'images/materials.png',
chance: 1
}, {
name: 'Epic Essence',
material: true,
sprite: [0, 5],
quality: 3,
chance: 1
}, {
name: 'Rat Claw',
material: true,
sprite: [3, 0],
spritesheet: 'images/materials.png',
chance: 3
}]
};

const descriptionStrings = {
leadup: 'A bandit alchemist has been spotted in the sewer tunnels.',
@@ -13,9 +50,16 @@ const descriptionStrings = {
escapeCounter: 'Escapees: $ratEscapees$'
};

const idFirstSpawnPhase = 6;
const idFailPhase = 19;
const maxEscapees = 5;
const config = {
cron: '0/3 * * * *',
//cron: '* * * * *',
idFirstSpawnPhase: 6,
idFailPhase: 19,
maxEscapees: 5,
repeats: [5, 5, 3],
//repeats: [1, 1, 1],
rewardItemsPerKill: 3
};

const ratTargetPos = {
x: 97,
@@ -106,10 +150,10 @@ const rat = {
this.obj.destroyed = true;

const totalEscapees = this.obj.event.variables.ratEscapees;
if (totalEscapees >= maxEscapees) {
if (totalEscapees >= config.maxEscapees) {
const event = this.obj.event;
event.currentPhase.end = true;
event.nextPhase = idFailPhase;
event.nextPhase = config.idFailPhase;
}
},

@@ -117,12 +161,10 @@ const rat = {
const eventManager = this.obj.instance.events;
const eventName = this.obj.event.config.name;

eventManager.addParticipantRewards(eventName, name, { name: 'Angler\'s Mark',
sprite: [12, 9],
noDrop: true,
noDestroy: true,
quantity: 1,
noSalvage: true });
const itemCount = config.rewardItemsPerKill;
const rewards = rewardGenerator(itemCount, rewardConfig.regularKill);

eventManager.addParticipantRewards(eventName, name, rewards);
}
}
};
@@ -206,8 +248,8 @@ module.exports = {
ttl: 15
}, {
type: 'goto',
gotoPhaseIndex: idFirstSpawnPhase,
repeats: 5
gotoPhaseIndex: config.idFirstSpawnPhase,
repeats: config.repeats[0]
}, {
type: 'spawnMob',
mobs: [rat],
@@ -217,8 +259,8 @@ module.exports = {
ttl: 7
}, {
type: 'goto',
gotoPhaseIndex: idFirstSpawnPhase + 3,
repeats: 5
gotoPhaseIndex: config.idFirstSpawnPhase + 3,
repeats: config.repeats[1]
}, {
type: 'spawnMob',
mobs: [rat],
@@ -228,8 +270,8 @@ module.exports = {
ttl: 3
}, {
type: 'goto',
gotoPhaseIndex: idFirstSpawnPhase + 6,
repeats: 3
gotoPhaseIndex: config.idFirstSpawnPhase + 6,
repeats: config.repeats[2]
}, {
type: 'killAllMobs'
}, {


+ 21
- 5
src/server/events/events.js Целия файл

@@ -74,6 +74,12 @@ module.exports = {
event.age = event.config.duration - 2;
},

setParticipantRewards: function (eventName, participantName, newRewards) {
const { event: { rewards } } = this.getEvent(eventName);

rewards[participantName] = newRewards;
},

addParticipantRewards: function (eventName, participantName, addRewards) {
const { event: { rewards } } = this.getEvent(eventName);

@@ -83,10 +89,20 @@ module.exports = {
rewards[participantName] = pRewards;
}

if (rewards.push)
pRewards.push(...addRewards);
else
pRewards.push(addRewards);
if (!addRewards.push)
addRewards = [ addRewards ];

addRewards.forEach(r => {
const { name, quantity = 1 } = r;

const exists = pRewards.find(f => f.name === name);
if (exists)
exists.quantity = (exists.quantity || 1) + quantity;
else
pRewards.push(r);
});

console.log(pRewards);
},

setWinText: function (name, text) {
@@ -182,7 +198,7 @@ module.exports = {
if ((rewards) && (rewards[p.name])) {
rewards[p.name].forEach(r => rList.push(r));
if (rList.length > 1)
rList[1].msg = 'Fishing tournament reward:';
rList[1].msg = `${event.config.name} reward:`;
}

this.instance.mail.sendMail(p.name, rList);


+ 2
- 2
src/server/misc/rewardGenerator.js Целия файл

@@ -65,10 +65,10 @@ module.exports = (itemCount, useConfig) => {
material: true,
quality: pick.quality,
sprite: pick.sprite,
quantity: 1
quantity: pick.quantity || 1
});
} else
item.quantity++;
item.quantity += (pick.quantity || 1);
}

return items;


Зареждане…
Отказ
Запис