LUL and getKillNotificationEachKillsCount

This commit is contained in:
smsteel 2019-02-11 09:45:10 +03:00
parent 8e8661298a
commit 77aa977897
2 changed files with 67 additions and 13 deletions

7
bot.js
View File

@ -8,7 +8,7 @@ import {
EVENT_TYPE_PLAYER_KILLED_ENTITY EVENT_TYPE_PLAYER_KILLED_ENTITY
} from './types' } from './types'
import { currentTime } from './utility' import { currentTime } from './utility'
import { getEntityDeathMessage, getEntityName } from './ru' import { getEntityDeathMessage, getEntityName, getKillNotificationEachKillsCount } from './data'
import stringTable from 'string-table' import stringTable from 'string-table'
const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM') const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM')
@ -41,7 +41,6 @@ const sendMessageToAll = text => getChats()
const JOIN_NOTIFICATION_TIME_DELTA = 60 * 60 // 1h const JOIN_NOTIFICATION_TIME_DELTA = 60 * 60 // 1h
const LEVEL_NOFIFICATION_EACH_LEVELS = 5 const LEVEL_NOFIFICATION_EACH_LEVELS = 5
const KILL_NOTIFICATION_EACH_KILLS = 50
export const sendEvent = ({ type, displayName, ...payload }) => { export const sendEvent = ({ type, displayName, ...payload }) => {
switch (type) { switch (type) {
@ -79,8 +78,8 @@ export const sendEvent = ({ type, displayName, ...payload }) => {
.then(killCount => { .then(killCount => {
const newKillCount = killCount + 1 const newKillCount = killCount + 1
saveKillCount(displayName, payload.entityName, newKillCount) saveKillCount(displayName, payload.entityName, newKillCount)
if (newKillCount % KILL_NOTIFICATION_EACH_KILLS === 0) { if (newKillCount % getKillNotificationEachKillsCount(payload) === 0) {
sendMessageToAll(`👻 *${getEntityName(payload)}* повержен(а) 👤 *${displayName}*. Убито ещё ${KILL_NOTIFICATION_EACH_KILLS}! Всего 💀: ${newKillCount} 👍`) sendMessageToAll(`👤 *${displayName}* 👻 VS 👻 *${getEntityName(payload)}*. Убито ещё ${getKillNotificationEachKillsCount(payload)}! Всего: ${newKillCount} 👍`)
} }
}) })
break break

View File

@ -12,7 +12,7 @@ export const getEntityDeathMessage = payload => {
case DEATH_TYPE_CONTACT: case DEATH_TYPE_CONTACT:
return 'умер от соприкосновения' return 'умер от соприкосновения'
case DEATH_TYPE_BLOCK_EXPLOSION: case DEATH_TYPE_BLOCK_EXPLOSION:
return 'взорвался' return 'взорвался 💥'
case DEATH_TYPE_ENTITY_ATTACK: case DEATH_TYPE_ENTITY_ATTACK:
return 'умер от существа' return 'умер от существа'
case DEATH_TYPE_ENTITY_SWEEP_ATTACK: case DEATH_TYPE_ENTITY_SWEEP_ATTACK:
@ -34,7 +34,7 @@ export const getEntityDeathMessage = payload => {
case DEATH_TYPE_DROWNING: case DEATH_TYPE_DROWNING:
return 'утонул' return 'утонул'
case DEATH_TYPE_ENTITY_EXPLOSION: case DEATH_TYPE_ENTITY_EXPLOSION:
return 'взорван вместе с существом' return 'взорван вместе с существом 💥'
case DEATH_TYPE_VOID: case DEATH_TYPE_VOID:
return 'упал в бездну' return 'упал в бездну'
case DEATH_TYPE_LIGHTNING: case DEATH_TYPE_LIGHTNING:
@ -69,7 +69,7 @@ export const getEntityDeathMessage = payload => {
export const getEntityName = payload => { export const getEntityName = payload => {
switch (payload.entityName) { switch (payload.entityName) {
case 'Cow': case 'Cow':
return 'Корова' return '🐮'
case 'Zombie Villager': case 'Zombie Villager':
return 'Зомби житель' return 'Зомби житель'
// case 'Skeleton Horse': // case 'Skeleton Horse':
@ -85,13 +85,13 @@ export const getEntityName = payload => {
// case 'Creeper': // case 'Creeper':
// return '' // return ''
case 'Skeleton': case 'Skeleton':
return 'Скелет' return '💀'
// case 'Spider': // case 'Spider':
// return '' // return ''
// case 'Giant Zombie': // case 'Giant Zombie':
// return '' // return ''
case 'Zombie': case 'Zombie':
return 'Зомби' return '🧟‍♂️'
case 'Slime': case 'Slime':
return 'Слайм' return 'Слайм'
// case 'Ghast': // case 'Ghast':
@ -109,14 +109,69 @@ export const getEntityName = payload => {
// case 'Witch': // case 'Witch':
// return '' // return ''
case 'Pig': case 'Pig':
return 'Свинья' return '🐖'
case 'Sheep': case 'Sheep':
return 'Овца' return '🐑'
case 'Chicken': case 'Chicken':
return 'Курица' return '🐔'
case 'Squid': case 'Squid':
return 'Медуза' return '🦑'
default: default:
return payload.entityName 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
}
}