From 77aa977897beffb9ca55c6b76fa744aacb411d81 Mon Sep 17 00:00:00 2001 From: smsteel Date: Mon, 11 Feb 2019 09:45:10 +0300 Subject: [PATCH] LUL and getKillNotificationEachKillsCount --- bot.js | 7 ++--- ru.js => data.js | 73 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 13 deletions(-) rename ru.js => data.js (74%) diff --git a/bot.js b/bot.js index d7fa5f1..ac4bb9e 100644 --- a/bot.js +++ b/bot.js @@ -8,7 +8,7 @@ import { EVENT_TYPE_PLAYER_KILLED_ENTITY } from './types' import { currentTime } from './utility' -import { getEntityDeathMessage, getEntityName } from './ru' +import { getEntityDeathMessage, getEntityName, getKillNotificationEachKillsCount } from './data' import stringTable from 'string-table' const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM') @@ -41,7 +41,6 @@ const sendMessageToAll = text => getChats() const JOIN_NOTIFICATION_TIME_DELTA = 60 * 60 // 1h const LEVEL_NOFIFICATION_EACH_LEVELS = 5 -const KILL_NOTIFICATION_EACH_KILLS = 50 export const sendEvent = ({ type, displayName, ...payload }) => { switch (type) { @@ -79,8 +78,8 @@ export const sendEvent = ({ type, displayName, ...payload }) => { .then(killCount => { const newKillCount = killCount + 1 saveKillCount(displayName, payload.entityName, newKillCount) - if (newKillCount % KILL_NOTIFICATION_EACH_KILLS === 0) { - sendMessageToAll(`👻 *${getEntityName(payload)}* повержен(а) 👤 *${displayName}*. Убито ещё ${KILL_NOTIFICATION_EACH_KILLS}! Всего 💀: ${newKillCount} 👍`) + if (newKillCount % getKillNotificationEachKillsCount(payload) === 0) { + sendMessageToAll(`👤 *${displayName}* 👻 VS 👻 *${getEntityName(payload)}*. Убито ещё ${getKillNotificationEachKillsCount(payload)}! Всего: ${newKillCount} 👍`) } }) break diff --git a/ru.js b/data.js similarity index 74% rename from ru.js rename to data.js index ffb8e7d..c41aabb 100644 --- a/ru.js +++ b/data.js @@ -12,7 +12,7 @@ export const getEntityDeathMessage = payload => { case DEATH_TYPE_CONTACT: return 'умер от соприкосновения' case DEATH_TYPE_BLOCK_EXPLOSION: - return 'взорвался' + return 'взорвался 💥' case DEATH_TYPE_ENTITY_ATTACK: return 'умер от существа' case DEATH_TYPE_ENTITY_SWEEP_ATTACK: @@ -34,7 +34,7 @@ export const getEntityDeathMessage = payload => { case DEATH_TYPE_DROWNING: return 'утонул' case DEATH_TYPE_ENTITY_EXPLOSION: - return 'взорван вместе с существом' + return 'взорван вместе с существом 💥' case DEATH_TYPE_VOID: return 'упал в бездну' case DEATH_TYPE_LIGHTNING: @@ -69,7 +69,7 @@ export const getEntityDeathMessage = payload => { export const getEntityName = payload => { switch (payload.entityName) { case 'Cow': - return 'Корова' + return '🐮' case 'Zombie Villager': return 'Зомби житель' // case 'Skeleton Horse': @@ -85,13 +85,13 @@ export const getEntityName = payload => { // case 'Creeper': // return '' case 'Skeleton': - return 'Скелет' + return '💀' // case 'Spider': // return '' // case 'Giant Zombie': // return '' case 'Zombie': - return 'Зомби' + return '🧟‍♂️' case 'Slime': return 'Слайм' // case 'Ghast': @@ -109,14 +109,69 @@ export const getEntityName = payload => { // case 'Witch': // return '' case 'Pig': - return 'Свинья' + return '🐖' case 'Sheep': - return 'Овца' + return '🐑' case 'Chicken': - return 'Курица' + return '🐔' case 'Squid': - return 'Медуза' + return '🦑' default: return payload.entityName } } + +export const getKillNotificationEachKillsCount = payload => { + switch (payload.entityName) { + case 'Cow': + return 50 + case 'Zombie Villager': + return 5 + case 'Skeleton Horse': + return 5 + case 'Zombie Horse': + return 5 + case 'Donkey': + return 5 + case 'Mule': + return 5 + case 'Evocation Fangs': + return 1 + case 'Creeper': + return 25 + case 'Skeleton': + return 100 + case 'Spider': + return 25 + case 'Giant Zombie': + return 5 + case 'Zombie': + return 25 + case 'Slime': + return 10 + case 'Ghast': + return 5 + case 'Enderman': + return 10 + case 'Cave Spider': + return 10 + case 'Silverfish': + return 5 + case 'Blaze': + return 10 + case 'Magma Cube': + return 10 + case 'Witch': + return 5 + case 'Pig': + return 25 + case 'Sheep': + return 25 + case 'Chicken': + return 100 + case 'Squid': + return 15 + default: + return 1 + } +}