LUL and getKillNotificationEachKillsCount
This commit is contained in:
		
							
								
								
									
										7
									
								
								bot.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								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 | ||||
|  | ||||
| @ -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 | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user