Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MindustrIRC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Miniontoby
MindustrIRC
Commits
61bfa0dc
Commit
61bfa0dc
authored
3 years ago
by
Miniontoby
Browse files
Options
Downloads
Patches
Plain Diff
FIxed something... hopefully
parent
783139e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mod.hjson
+1
-1
1 addition, 1 deletion
mod.hjson
scripts/irc.js
+99
-0
99 additions, 0 deletions
scripts/irc.js
scripts/main.js
+1
-103
1 addition, 103 deletions
scripts/main.js
with
101 additions
and
104 deletions
mod.hjson
+
1
−
1
View file @
61bfa0dc
...
...
@@ -3,6 +3,6 @@ displayName: "MindustrIRC"
author: Miniontoby
description: "IRC Mod for Mindustry"
version: "1.0"
minGameVersion:
"135"
minGameVersion:
122
dependencies: [ ]
hidden: false
This diff is collapsed.
Click to expand it.
scripts/irc.js
0 → 100644
+
99
−
0
View file @
61bfa0dc
const
myDialog
=
new
BaseDialog
(
"
Dialog Title
"
);
myDialog
.
addCloseButton
();
myDialog
.
cont
.
add
(
"
Goodbye.
"
);
myDialog
.
show
();
let
ws
=
null
;
var
options
=
{
server
:
"
wss://miniontoby.coconut.ircnow.org:8188/webirc/websocket/
"
,
nick
:
"
MindustrIRC
"
,
channel
:
"
#ircforever
"
};
function
connectToIRC
(){
print
"
Starting up!
\n
"
;
ws
=
new
WebSocket
(
options
.
server
,
"
base64
"
);
ws
.
onopen
=
function
()
{
retries
=
0
;
send
(
'
NICK
'
+
options
.
nick
+
'
\n
'
);
send
(
'
USER
'
+
options
.
nick
+
'
* * :MindustrIRC Mod
\n
'
);
inlogcheck
=
false
;
};
ws
.
onmessage
=
function
(
content
)
{
var
messageOutput6
=
strToUTF8Arr
(
content
.
data
);
var
messageOutput7
=
base64EncArr
(
messageOutput6
);
var
messageoutput
=
content
.
data
;
var
array
=
messageoutput
.
split
(
"
"
);
var
server
=
array
[
0
];
var
nickname
=
array
[
0
].
split
(
"
!
"
)[
0
].
replace
(
"
:
"
,
""
);
var
action
=
array
[
1
];
var
userchannel
=
array
[
2
];
if
(
array
[
3
]
!=
undefined
)
{
var
param
=
array
[
3
].
substr
(
1
,
array
[
3
].
length
)
+
"
"
;
for
(
var
i
=
4
;
i
<
array
.
length
;
i
++
)
{
param
+=
array
[
i
]
+
"
"
;
}
}
var
e
=
window
.
atob
(
messageOutput7
);
if
(
e
.
match
(
/^PING
(\S
*
)
/i
)
)
{
send
(
'
PONG
'
+
RegExp
.
$1
+
'
\n
'
);
}
if
(
e
.
indexOf
(
"
Found your hostname
"
)
!=
-
1
||
e
.
indexOf
(
"
No Ident response
"
)
!=
-
1
)
{
if
(
inlogcheck
)
{
send
(
'
NICK
'
+
options
.
nick
+
'
\n
'
);
send
(
'
USER
'
+
options
.
nick
+
'
* * :MindustrIRC Mod
\n
'
);
inlogcheck
=
false
;
}
}
if
(
param
!=
undefined
&&
param
.
indexOf
(
"
MODE
"
+
options
.
nick
+
"
:+i
"
)
!=
-
1
)
{
send
(
'
JOIN
'
+
options
.
channel
+
'
\n
'
);
}
if
(
action
==
"
JOIN
"
&&
nickname
==
options
.
nick
)
{
mejoin
(
e
);
}
else
if
(
action
==
"
JOIN
"
&&
nickname
!=
options
.
nick
)
{
status
(
nickname
+
"
joined
"
+
options
.
channel
,
false
);
}
if
(
action
==
"
PART
"
&&
nickname
!=
options
.
nick
)
{
if
(
param
!=
undefined
)
{
status
(
nickname
+
"
lefted
"
+
options
.
channel
+
"
:
"
+
param
,
false
);
}
else
{
status
(
nickname
+
"
lefted
"
+
options
.
channel
,
false
);
}
}
if
(
action
==
"
PRIVMSG
"
)
{
privmsg
(
nickname
,
param
);
}
if
(
e
.
indexOf
(
"
is your displayed hostname now
"
)
!=
-
1
){
send
(
'
JOIN
'
+
options
.
channel
+
'
\n
'
);
}
};
ws
.
onclose
=
function
()
{
retryOpeningWebSocket
();
};
if
(
timer
)
clearTimeout
(
timer
);
timer
=
setInterval
(
ping
,
100000
);
}
function
send
(
data
)
{
ws
.
send
(
data
);
}
connectToIRC
();
Events
.
on
(
GameOverEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
LoseEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerChatEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerLeaveEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerJoinEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
WinEvent
,
event
=>
{
console
.
log
(
event
);
})
This diff is collapsed.
Click to expand it.
scripts/main.js
+
1
−
103
View file @
61bfa0dc
const
myDialog
=
new
BaseDialog
(
"
Dialog Title
"
);
// Add "go back" button
myDialog
.
addCloseButton
();
// Add text to the main content
myDialog
.
cont
.
add
(
"
Goodbye.
"
);
// Show dialog
myDialog
.
show
();
let
ws
=
null
;
var
options
=
{
server
:
"
wss://miniontoby.coconut.ircnow.org:8188/webirc/websocket/
"
,
nick
:
"
MindustrIRC
"
,
channel
:
"
#ircforever
"
};
function
connectToIRC
(){
print
"
Starting up!
\n
"
;
ws
=
new
WebSocket
(
options
.
server
,
"
base64
"
);
ws
.
onopen
=
function
()
{
retries
=
0
;
send
(
'
NICK
'
+
options
.
nick
+
'
\n
'
);
send
(
'
USER
'
+
options
.
nick
+
'
* * :MindustrIRC Mod
\n
'
);
inlogcheck
=
false
;
};
ws
.
onmessage
=
function
(
content
)
{
var
messageOutput6
=
strToUTF8Arr
(
content
.
data
);
var
messageOutput7
=
base64EncArr
(
messageOutput6
);
var
messageoutput
=
content
.
data
;
var
array
=
messageoutput
.
split
(
"
"
);
var
server
=
array
[
0
];
var
nickname
=
array
[
0
].
split
(
"
!
"
)[
0
].
replace
(
"
:
"
,
""
);
var
action
=
array
[
1
];
var
userchannel
=
array
[
2
];
if
(
array
[
3
]
!=
undefined
)
{
var
param
=
array
[
3
].
substr
(
1
,
array
[
3
].
length
)
+
"
"
;
for
(
var
i
=
4
;
i
<
array
.
length
;
i
++
)
{
param
+=
array
[
i
]
+
"
"
;
}
}
var
e
=
window
.
atob
(
messageOutput7
);
if
(
e
.
match
(
/^PING
(\S
*
)
/i
)
)
{
send
(
'
PONG
'
+
RegExp
.
$1
+
'
\n
'
);
}
if
(
e
.
indexOf
(
"
Found your hostname
"
)
!=
-
1
||
e
.
indexOf
(
"
No Ident response
"
)
!=
-
1
)
{
if
(
inlogcheck
)
{
send
(
'
NICK
'
+
options
.
nick
+
'
\n
'
);
send
(
'
USER
'
+
options
.
nick
+
'
* * :MindustrIRC Mod
\n
'
);
inlogcheck
=
false
;
}
}
if
(
param
!=
undefined
&&
param
.
indexOf
(
"
MODE
"
+
options
.
nick
+
"
:+i
"
)
!=
-
1
)
{
send
(
'
JOIN
'
+
options
.
channel
+
'
\n
'
);
}
if
(
action
==
"
JOIN
"
&&
nickname
==
options
.
nick
)
{
mejoin
(
e
);
}
else
if
(
action
==
"
JOIN
"
&&
nickname
!=
options
.
nick
)
{
status
(
nickname
+
"
joined
"
+
options
.
channel
,
false
);
}
if
(
action
==
"
PART
"
&&
nickname
!=
options
.
nick
)
{
if
(
param
!=
undefined
)
{
status
(
nickname
+
"
lefted
"
+
options
.
channel
+
"
:
"
+
param
,
false
);
}
else
{
status
(
nickname
+
"
lefted
"
+
options
.
channel
,
false
);
}
}
if
(
action
==
"
PRIVMSG
"
)
{
privmsg
(
nickname
,
param
);
}
if
(
e
.
indexOf
(
"
is your displayed hostname now
"
)
!=
-
1
){
send
(
'
JOIN
'
+
options
.
channel
+
'
\n
'
);
}
};
ws
.
onclose
=
function
()
{
retryOpeningWebSocket
();
};
if
(
timer
)
clearTimeout
(
timer
);
timer
=
setInterval
(
ping
,
100000
);
}
function
send
(
data
)
{
ws
.
send
(
data
);
}
connectToIRC
();
Events
.
on
(
GameOverEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
LoseEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerChatEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerLeaveEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
PlayerJoinEvent
,
event
=>
{
console
.
log
(
event
);
})
Events
.
on
(
WinEvent
,
event
=>
{
console
.
log
(
event
);
})
require
(
"
irc
"
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment