mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
All File Upto ExpGamingBot follow bolier print
This commit is contained in:
@@ -2,110 +2,122 @@
|
||||
-- @module ExpGamingBot.autoChat
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Ranking
|
||||
-- Module Require
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
local Ranking -- ExpGamingCore.Ranking@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
-- lots of these are jokes, but some have uses
|
||||
|
||||
-- white spaces removed and made into lower
|
||||
-- these messages are sent only to the player
|
||||
local messages = {
|
||||
['discord']={'chat-bot.discord'},
|
||||
['expgaming']={'chat-bot.website'},
|
||||
['website']={'chat-bot.website'},
|
||||
['command']={'chat-bot.custom-commands'},
|
||||
['commands']={'chat-bot.custom-commands'},
|
||||
['softmod']={'chat-bot.softmod'},
|
||||
['script']={'chat-bot.softmod'},
|
||||
['link']={'chat-bot.links'},
|
||||
['links']={'chat-bot.links'},
|
||||
['loop']={'chat-bot.loops'},
|
||||
['loops']={'chat-bot.loops'},
|
||||
['rhd']={'chat-bot.lhd'},
|
||||
['roundabout']={'chat-bot.loops'},
|
||||
['roundabouts']={'chat-bot.loops'},
|
||||
['redmew']={'chat-bot.redmew'},
|
||||
['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'chat-bot.afk',max.name,tick_to_display_format(max.afk_time)} end
|
||||
['discord']={'ExpGamingBot-autoChat.discord'},
|
||||
['expgaming']={'ExpGamingBot-autoChat.website'},
|
||||
['website']={'ExpGamingBot-autoChat.website'},
|
||||
['command']={'ExpGamingBot-autoChat.custom-commands'},
|
||||
['commands']={'ExpGamingBot-autoChat.custom-commands'},
|
||||
['softmod']={'ExpGamingBot-autoChat.softmod'},
|
||||
['script']={'ExpGamingBot-autoChat.softmod'},
|
||||
['link']={'ExpGamingBot-autoChat.links'},
|
||||
['links']={'ExpGamingBot-autoChat.links'},
|
||||
['loop']={'ExpGamingBot-autoChat.loops'},
|
||||
['loops']={'ExpGamingBot-autoChat.loops'},
|
||||
['rhd']={'ExpGamingBot-autoChat.lhd'},
|
||||
['roundabout']={'ExpGamingBot-autoChat.loops'},
|
||||
['roundabouts']={'ExpGamingBot-autoChat.loops'},
|
||||
['redmew']={'ExpGamingBot-autoChat.redmew'},
|
||||
['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'ExpGamingBot-autoChat.afk',max.name,tick_to_display_format(max.afk_time)} end
|
||||
}
|
||||
-- white spaces removed and made into lower
|
||||
-- these are global chat commands that can be used
|
||||
-- comands start with ! (all messages are also commands)
|
||||
local command_syntax = '!'
|
||||
local commands = {
|
||||
['online']=function(player) return {'chat-bot.players-online',#game.connected_players} end,
|
||||
['playtime']=function(player) return {'chat-bot.map-time',tick_to_display_format(game.tick)} end,
|
||||
['players']=function(player) return {'chat-bot.players',#game.players} end,
|
||||
['dev']={'chat-bot.not-real-dev'},
|
||||
['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'chat-bot.blame',names[math.random(#names)]} end,
|
||||
['readme']={'chat-bot.read-readme'},
|
||||
['magic']={'chat-bot.magic'},
|
||||
['aids']={'chat-bot.aids'},
|
||||
['riot']={'chat-bot.riot'},
|
||||
['lenny']={'chat-bot.lenny'},
|
||||
['wiki']={'chat-bot.wiki'},
|
||||
['evolution']=function(player) return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end,
|
||||
['online']=function(player) return {'ExpGamingBot-autoChat.players-online',#game.connected_players} end,
|
||||
['playtime']=function(player) return {'ExpGamingBot-autoChat.map-time',tick_to_display_format(game.tick)} end,
|
||||
['players']=function(player) return {'ExpGamingBot-autoChat.players',#game.players} end,
|
||||
['dev']={'ExpGamingBot-autoChat.not-real-dev'},
|
||||
['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'ExpGamingBot-autoChat.blame',names[math.random(#names)]} end,
|
||||
['readme']={'ExpGamingBot-autoChat.read-readme'},
|
||||
['magic']={'ExpGamingBot-autoChat.magic'},
|
||||
['aids']={'ExpGamingBot-autoChat.aids'},
|
||||
['riot']={'ExpGamingBot-autoChat.riot'},
|
||||
['lenny']={'ExpGamingBot-autoChat.lenny'},
|
||||
['wiki']={'ExpGamingBot-autoChat.wiki'},
|
||||
['evolution']=function(player) return {'ExpGamingBot-autoChat.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end,
|
||||
--Jokes about food and drink
|
||||
['whattoeat']={'chat-bot.food'},
|
||||
['whattoeat']={'ExpGamingBot-autoChat.food'},
|
||||
['makepopcorn']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data then game.print{'chat-bot.message',{'chat-bot.get-popcorn-2',self.data}} end
|
||||
end):open() return {'chat-bot.get-popcorn-1'} end,
|
||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end
|
||||
end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end,
|
||||
['orderpizza']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false
|
||||
if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false
|
||||
end
|
||||
self.data[2]=self.data[2]+1
|
||||
end):open() return {'chat-bot.order-pizza-1'} end,
|
||||
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
||||
['passsomesnaps']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-snaps-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-snaps-3',self.data[1]}} self.reopen = false
|
||||
if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-3',self.data[1]}} self.reopen = false
|
||||
end
|
||||
self.data[2]=self.data[2]+1
|
||||
end):open() return {'chat-bot.get-snaps-1'} end,
|
||||
end):open() return {'ExpGamingBot-autoChat.get-snaps-1'} end,
|
||||
['makecocktail']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-3',self.data[1]}} self.reopen = false
|
||||
if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-3',self.data[1]}} self.reopen = false
|
||||
end
|
||||
self.data[2]=self.data[2]+1
|
||||
end):open() return {'chat-bot.get-cocktail-1'} end,
|
||||
end):open() return {'ExpGamingBot-autoChat.get-cocktail-1'} end,
|
||||
['makecoffee']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data then game.print{'chat-bot.message',{'chat-bot.make-coffee-2',self.data}} end
|
||||
end):open() return {'chat-bot.make-coffee-1'} end,
|
||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-coffee-2',self.data}} end
|
||||
end):open() return {'ExpGamingBot-autoChat.make-coffee-1'} end,
|
||||
['orderpizza']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false
|
||||
if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}}
|
||||
elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false
|
||||
end
|
||||
self.data[2]=self.data[2] + 1
|
||||
end):open() return {'chat-bot.order-pizza-1'} end,
|
||||
end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end,
|
||||
['maketea']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data then game.print{'chat-bot.message',{'chat-bot.make-tea-2',self.data}} end
|
||||
end):open() return {'chat-bot.make-tea-1'} end,
|
||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-tea-2',self.data}} end
|
||||
end):open() return {'ExpGamingBot-autoChat.make-tea-1'} end,
|
||||
['meadplease']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data then game.print{'chat-bot.message',{'chat-bot.get-mead-2',self.data}} end
|
||||
end):open() return {'chat-bot.get-mead-1'} end,
|
||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-mead-2',self.data}} end
|
||||
end):open() return {'ExpGamingBot-autoChat.get-mead-1'} end,
|
||||
['passabeer']=function(player) Server.new_thread{
|
||||
timeout=math.floor(180*(math.random()+0.5)),data=player.name
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data then game.print{'chat-bot.message',{'chat-bot.get-beer-2',self.data}} end
|
||||
end):open() return {'chat-bot.get-beer-1'} end
|
||||
if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-beer-2',self.data}} end
|
||||
end):open() return {'ExpGamingBot-autoChat.get-beer-1'} end
|
||||
}
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function()
|
||||
if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then Ranking = require('ExpGamingCore.Ranking@^4.0.0') end
|
||||
end
|
||||
}
|
||||
|
||||
-- Event Handlers Define
|
||||
script.on_event(defines.events.on_console_chat,function(event)
|
||||
local player = Game.get_player(event)
|
||||
if not player then return end
|
||||
@@ -115,25 +127,22 @@ script.on_event(defines.events.on_console_chat,function(event)
|
||||
if player_message:match(command_syntax..to_find) then
|
||||
if allowed then
|
||||
if is_type(message,'function') then message=message(player) end
|
||||
game.print{'chat-bot.message',message}
|
||||
else player_return({'chat-bot.rank-error'},nil,player) end
|
||||
game.print{'ExpGamingBot-autoChat.message',message}
|
||||
else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end
|
||||
elseif player_message:match(to_find) then
|
||||
if is_type(message,'function') then message=message(player) end
|
||||
player_return({'chat-bot.message',message},nil,player)
|
||||
player_return({'ExpGamingBot-autoChat.message',message},nil,player)
|
||||
end
|
||||
end
|
||||
for to_find,message in pairs(commands) do
|
||||
if player_message:match(command_syntax..to_find) then
|
||||
if allowed then
|
||||
if is_type(message,'function') then message=message(player) end
|
||||
game.print{'chat-bot.message',message}
|
||||
else player_return({'chat-bot.rank-error'},nil,player) end
|
||||
game.print{'ExpGamingBot-autoChat.message',message}
|
||||
else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return {
|
||||
on_init = function(self)
|
||||
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
|
||||
end
|
||||
}
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You cant use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You can't use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You cant use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=You cant use global chat commands
|
||||
players-online=There are __1__ players online
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoChat]
|
||||
message=[Chat Bot]: __1__
|
||||
rank-error=Du kan inte utföra globala chat-kommandon.
|
||||
players-online=Det är __1__ spelare online
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
--- Sends messages in chat in resposce to other messages
|
||||
-- @module ExpGamingBot.autoChat
|
||||
--- Prints a message every 15 minutes to chat.
|
||||
-- @module ExpGamingBot.autoMessage
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Server = require('ExpGamingCore.Server')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Ranking
|
||||
local Sync
|
||||
local Ranking -- ExpGamingCore.Ranking@4.0.0
|
||||
local Sync -- ExpGamingCore.Sync@4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function()
|
||||
if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then Ranking = require('ExpGamingCore.Ranking@^4.0.0') end
|
||||
if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end
|
||||
end,
|
||||
on_post=function()
|
||||
--code
|
||||
end
|
||||
}
|
||||
|
||||
-- Event Handlers Define
|
||||
script.on_init(function(event)
|
||||
Server.new_thread{
|
||||
name='auto-message',
|
||||
@@ -17,19 +34,19 @@ script.on_init(function(event)
|
||||
high_rank= 'Owner',
|
||||
low_rank= 'Regular',
|
||||
low={
|
||||
{'chat-bot.join-us'},
|
||||
{'chat-bot.discord'},
|
||||
{'chat-bot.website'},
|
||||
{'chat-bot.custom-commands'},
|
||||
{'chat-bot.read-readme'}
|
||||
{'ExpGamingBot-autoMessage.join-us'},
|
||||
{'ExpGamingBot-autoMessage.discord'},
|
||||
{'ExpGamingBot-autoMessage.website'},
|
||||
{'ExpGamingBot-autoMessage.custom-commands'},
|
||||
{'ExpGamingBot-autoMessage.read-readme'}
|
||||
}
|
||||
}
|
||||
}:on_event('timeout',function(self)
|
||||
local data = self.data
|
||||
if not data.high_rank or not data.low_rank
|
||||
or not data.low then self.reopen = false return end
|
||||
game.print{'chat-bot.message',{'chat-bot.players-online',#game.connected_players}}
|
||||
game.print{'chat-bot.message',{'chat-bot.map-time',tick_to_display_format(game.tick)}}
|
||||
game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.players-online',#game.connected_players}}
|
||||
game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.map-time',tick_to_display_format(game.tick)}}
|
||||
self.reopen = true
|
||||
end):on_event(defines.events.on_player_joined_game,function(self,event)
|
||||
local player = Game.get_player(event)
|
||||
@@ -40,7 +57,7 @@ script.on_init(function(event)
|
||||
-- idk but this stoped working for no appent reason so i added more checks for nil values
|
||||
if Ranking and Ranking.get_rank(player).power <= Ranking.get_rank(data.low_rank).power or player.admin then return end
|
||||
for _,message in pairs(data.low) do
|
||||
player_return({'chat-bot.message',message},nil,player)
|
||||
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
||||
end
|
||||
end):on_event('error',function(self,err)
|
||||
if Sync then Sync.emit_embeded{
|
||||
@@ -54,9 +71,5 @@ script.on_init(function(event)
|
||||
end):open()
|
||||
end)
|
||||
|
||||
return {
|
||||
on_init = function(self)
|
||||
if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end
|
||||
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
|
||||
end
|
||||
}
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=There are __1__ players online
|
||||
map-time=This map has been on for __1__
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
[chat-bot]
|
||||
[ExpGamingBot-autoMessage]
|
||||
message=[Chat Bot]: __1__
|
||||
players-online=Det är __1__ spelare online
|
||||
map-time=Den här kartan har varit igång under __1__
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
--- Desction <get from json>
|
||||
--- Sends alerts to discord once there is a bot set up to read the alerts.
|
||||
-- @module ExpGamingBot.discordAlerts@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
local Sync = require('ExpGamingCore.Sync')
|
||||
local Color = require('FactorioStdLib.Color')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
-- Module Require
|
||||
local Sync = require('ExpGamingCore.Sync@^4.0.0')
|
||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
|
||||
Event.register(defines.events.on_console_command,function(event)
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Event Handlers Define
|
||||
script.on_event(defines.events.on_console_command,function(event)
|
||||
local command = event.command
|
||||
local args = {}
|
||||
if event.parameters then for word in event.parameters:gmatch('%S+') do table.insert(args,word) end end
|
||||
@@ -51,4 +57,7 @@ Event.register(defines.events.on_console_command,function(event)
|
||||
['Reason:']=data.reason
|
||||
}
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
Reference in New Issue
Block a user