Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
I
idle rpg irc
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
ElTata
idle rpg irc
Validations
de8c2de8
Valider
de8c2de8
rédigé
Il y a 5 ans
par
ElTata
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
auto_login hash only in Main
parent
344a9408
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
Irpg/Main.pm
+25
-27
25 ajouts, 27 suppressions
Irpg/Main.pm
irpg_bot.pl
+1
-1
1 ajout, 1 suppression
irpg_bot.pl
avec
26 ajouts
et
28 suppressions
Irpg/Main.pm
+
25
−
27
Voir le fichier @
de8c2de8
...
@@ -29,6 +29,7 @@ my $lastreg = 0; # holds the time of the last reg. cleared every second.
...
@@ -29,6 +29,7 @@ my $lastreg = 0; # holds the time of the last reg. cleared every second.
my
$lasttime_ref
;
my
$lasttime_ref
;
my
%split
;
# holds nick!user@hosts for clients that have been netsplit
my
%split
;
# holds nick!user@hosts for clients that have been netsplit
my
%onchan
;
# users on game channel
my
%onchan
;
# users on game channel
my
%auto_login
;
my
$pausemode
=
0
;
# pausemode on/off flag
my
$pausemode
=
0
;
# pausemode on/off flag
my
$silentmode
=
0
;
# silent mode 0/1/2/3, see head of file
my
$silentmode
=
0
;
# silent mode 0/1/2/3, see head of file
...
@@ -37,7 +38,6 @@ my $primnick;
...
@@ -37,7 +38,6 @@ my $primnick;
my
$opts
;
my
$opts
;
my
$rps
;
my
$rps
;
my
$prev_online
;
my
$prev_online
;
my
$auto_login
;
=head1 FUNCTION init_pkg
=head1 FUNCTION init_pkg
This function sets the references to
This function sets the references to
options and players hashes.
options and players hashes.
...
@@ -45,10 +45,9 @@ my $auto_login;
...
@@ -45,10 +45,9 @@ my $auto_login;
=item SCALAR (ref) - reference to the options hash
=item SCALAR (ref) - reference to the options hash
=item SCALAR (ref) - reference to the players hash
=item SCALAR (ref) - reference to the players hash
=item SCALAR (ref) - reference to the prev_online hash
=item SCALAR (ref) - reference to the prev_online hash
=item SCALAR (ref) - reference to the auto_login hash
=cut
=cut
sub
init_pkg
{
sub
init_pkg
{
(
$opts
,
$rps
,
$lasttime_ref
,
$prev_online
,
$auto_login
)
=
@_
;
(
$opts
,
$rps
,
$lasttime_ref
,
$prev_online
)
=
@_
;
$primnick
=
$opts
->
{
botnick
};
# for regain or register checks
$primnick
=
$opts
->
{
botnick
};
# for regain or register checks
Irpg::Irc::
init_pkg
(
\
$silentmode
);
Irpg::Irc::
init_pkg
(
\
$silentmode
);
Irpg::Quest::
init_pkg
(
$opts
,
$rps
);
Irpg::Quest::
init_pkg
(
$opts
,
$rps
);
...
@@ -138,7 +137,6 @@ sub penalize {
...
@@ -138,7 +137,6 @@ sub penalize {
my
$pen_key
;
my
$pen_key
;
if
(
$type
eq
"
quit
")
{
if
(
$type
eq
"
quit
")
{
$pen
=
int
(
20
*
(
$opts
->
{
rppenstep
}
**$rps
->
{
$username
}{
level
}));
$pen
=
int
(
20
*
(
$opts
->
{
rppenstep
}
**$rps
->
{
$username
}{
level
}));
$rps
->
{
$username
}{
online
}
=
0
;
$reason
=
undef
;
$reason
=
undef
;
$pen_key
=
'
pen_quit
';
$pen_key
=
'
pen_quit
';
}
}
...
@@ -270,9 +268,6 @@ sub rpcheck { # check levels, update database
...
@@ -270,9 +268,6 @@ sub rpcheck { # check levels, update database
foreach
(
qw(Quest Action Event)
)
{
foreach
(
qw(Quest Action Event)
)
{
eval
'
Irpg::
'
.
$_
.
'
::rpcheck($rpreport, $online
';
eval
'
Irpg::
'
.
$_
.
'
::rpcheck($rpreport, $online
';
}
}
# Irpg::Quest::rpcheck($rpreport, $online); ### QUEST BUSINESS ###
# Irpg::Action::rpcheck($rpreport, $online); ### FIGHT BUSINESS ###
# Irpg::Event::rpcheck($rpreport, $online); ### EVENT BUSINESS ###
### TOP PLAYERS REPORT ###
### TOP PLAYERS REPORT ###
if
(
$rpreport
&&
$rpreport
%
36000
==
0
)
{
# 10 hours
if
(
$rpreport
&&
$rpreport
%
36000
==
0
)
{
# 10 hours
...
@@ -373,10 +368,10 @@ sub parse {
...
@@ -373,10 +368,10 @@ sub parse {
if
(
lc
(
$arg
[
0
])
eq
'
ping
')
{
Irpg::Irc::
sts
("
PONG
$arg
[1]
",
1
);
}
if
(
lc
(
$arg
[
0
])
eq
'
ping
')
{
Irpg::Irc::
sts
("
PONG
$arg
[1]
",
1
);
}
elsif
(
lc
(
$arg
[
0
])
eq
'
error
')
{
elsif
(
lc
(
$arg
[
0
])
eq
'
error
')
{
# uh oh, we've been disconnected from the server, possibly before we've
# uh oh, we've been disconnected from the server, possibly before we've
# logged in the users in %
$
auto_login. so, we'll set those users' online
# logged in the users in %auto_login. so, we'll set those users' online
# flags to 1, rewrite db, and attempt to reconnect (if that's wanted of
# flags to 1, rewrite db, and attempt to reconnect (if that's wanted of
# us)
# us)
$rps
->
{
$_
}{
online
}
=
1
for
keys
(
%
$
auto_login
);
$rps
->
{
$_
}{
online
}
=
1
for
keys
(
%auto_login
);
writedb
(
$rps
);
writedb
(
$rps
);
return
;
return
;
}
}
...
@@ -386,7 +381,7 @@ sub parse {
...
@@ -386,7 +381,7 @@ sub parse {
Irpg::Irc::
sts
("
NICK
$opts
->{botnick}
");
Irpg::Irc::
sts
("
NICK
$opts
->{botnick}
");
}
}
elsif
(
$arg
[
1
]
eq
'
join
')
{
elsif
(
$arg
[
1
]
eq
'
join
')
{
# %onchan holds time user joined channel. used
for the advertisement ban
# %onchan holds time user joined channel. used
just to now who is there
$onchan
{
$usernick
}
=
time
()
if
(
$opts
->
{
botchan
}
eq
substr
(
$arg
[
2
],
1
));
$onchan
{
$usernick
}
=
time
()
if
(
$opts
->
{
botchan
}
eq
substr
(
$arg
[
2
],
1
));
if
(
$opts
->
{'
detectsplits
'}
&&
exists
(
$split
{
substr
(
$arg
[
0
],
1
)}))
{
if
(
$opts
->
{'
detectsplits
'}
&&
exists
(
$split
{
substr
(
$arg
[
0
],
1
)}))
{
delete
(
$split
{
substr
(
$arg
[
0
],
1
)});
delete
(
$split
{
substr
(
$arg
[
0
],
1
)});
...
@@ -408,7 +403,8 @@ sub parse {
...
@@ -408,7 +403,8 @@ sub parse {
$split
{
substr
(
$arg
[
0
],
1
)}{
account
}
=
$username
;
$split
{
substr
(
$arg
[
0
],
1
)}{
account
}
=
$username
;
}
}
}
}
else
{
elsif
(
defined
(
$username
))
{
$rps
->
{
$username
}{
online
}
=
0
;
penalize
(
$username
,"
quit
");
penalize
(
$username
,"
quit
");
}
}
delete
(
$onchan
{
$usernick
});
delete
(
$onchan
{
$usernick
});
...
@@ -422,24 +418,26 @@ sub parse {
...
@@ -422,24 +418,26 @@ sub parse {
# us who just lost it
# us who just lost it
elsif
(
$usernick
eq
$primnick
)
{
Irpg::Irc::
sts
("
NICK
$primnick
",
1
);
}
elsif
(
$usernick
eq
$primnick
)
{
Irpg::Irc::
sts
("
NICK
$primnick
",
1
);
}
else
{
else
{
if
(
defined
(
$username
))
{
$rps
->
{
$username
}{
nick
}
=
substr
(
$arg
[
2
],
1
);
$rps
->
{
$username
}{
nick
}
=
substr
(
$arg
[
2
],
1
);
substr
(
$rps
->
{
$username
}{
userhost
},
0
,
length
(
$rps
->
{
$username
}{
nick
}))
=
substr
(
$rps
->
{
$username
}{
userhost
},
0
,
length
(
$rps
->
{
$username
}{
nick
}))
=
substr
(
$arg
[
2
],
1
);
substr
(
$arg
[
2
],
1
);
penalize
(
$username
,"
nick
");
penalize
(
$username
,"
nick
");
}
if
(
exists
(
$onchan
{
$usernick
}))
{
if
(
exists
(
$onchan
{
$usernick
}))
{
$onchan
{
substr
(
$arg
[
2
],
1
)}
=
delete
(
$onchan
{
$usernick
});
$onchan
{
substr
(
$arg
[
2
],
1
)}
=
delete
(
$onchan
{
$usernick
});
}
}
}
}
}
}
elsif
(
$arg
[
1
]
eq
'
part
')
{
elsif
(
$arg
[
1
]
eq
'
part
')
{
$rps
->
{
$username
}{
online
}
=
0
;
$rps
->
{
$username
}{
online
}
=
0
if
(
defined
(
$username
))
;
penalize
(
$username
,"
part
");
penalize
(
$username
,"
part
");
delete
(
$onchan
{
$usernick
})
if
(
$opts
->
{
botchan
}
eq
substr
(
$arg
[
2
],
1
));
delete
(
$onchan
{
$usernick
})
if
(
$opts
->
{
botchan
}
eq
substr
(
$arg
[
2
],
1
));
}
}
elsif
(
$arg
[
1
]
eq
'
kick
')
{
elsif
(
$arg
[
1
]
eq
'
kick
')
{
$usernick
=
$arg
[
3
];
$usernick
=
$arg
[
3
];
$username
=
finduser
(
$usernick
);
$username
=
finduser
(
$usernick
);
$rps
->
{
$usern
ick
}{
online
}
=
0
;
$rps
->
{
$usern
ame
}{
online
}
=
0
;
penalize
(
$username
,"
kick
");
penalize
(
$username
,"
kick
");
delete
(
$onchan
{
$usernick
})
if
(
$opts
->
{
botchan
}
eq
$arg
[
2
]);
delete
(
$onchan
{
$usernick
})
if
(
$opts
->
{
botchan
}
eq
$arg
[
2
]);
}
}
...
@@ -460,20 +458,20 @@ sub parse {
...
@@ -460,20 +458,20 @@ sub parse {
elsif
(
$arg
[
1
]
eq
'
315
')
{
elsif
(
$arg
[
1
]
eq
'
315
')
{
# 315 is /WHO end. report who we automagically signed online iff it will
# 315 is /WHO end. report who we automagically signed online iff it will
# print < 1k of text
# print < 1k of text
if
(
keys
(
%
$
auto_login
))
{
if
(
keys
(
%auto_login
))
{
# not a true measure of size, but easy
# not a true measure of size, but easy
if
(
length
("
%
$
auto_login
")
<
1024
&&
$opts
->
{
senduserlist
})
{
if
(
length
("
%auto_login
")
<
1024
&&
$opts
->
{
senduserlist
})
{
Irpg::Irc::
chanmsg
(
scalar
(
keys
(
%
$
auto_login
))
.
"
users matching
"
.
Irpg::Irc::
chanmsg
(
scalar
(
keys
(
%auto_login
))
.
"
users matching
"
.
scalar
(
keys
(
%$prev_online
))
.
"
hosts automatically
"
.
scalar
(
keys
(
%$prev_online
))
.
"
hosts automatically
"
.
"
logged in; accounts:
"
.
join
("
,
",
keys
(
%
$
auto_login
)));
"
logged in; accounts:
"
.
join
("
,
",
keys
(
%auto_login
)));
}
}
else
{
else
{
Irpg::Irc::
chanmsg
(
scalar
(
keys
(
%
$
auto_login
))
.
"
users matching
"
.
Irpg::Irc::
chanmsg
(
scalar
(
keys
(
%auto_login
))
.
"
users matching
"
.
scalar
(
keys
(
%$prev_online
))
.
"
hosts automatically
"
.
scalar
(
keys
(
%$prev_online
))
.
"
hosts automatically
"
.
"
logged in.
");
"
logged in.
");
}
}
if
(
$opts
->
{
voiceonlogin
})
{
if
(
$opts
->
{
voiceonlogin
})
{
my
@vnicks
=
map
{
$rps
->
{
$_
}{
nick
}
}
keys
(
%
$
auto_login
);
my
@vnicks
=
map
{
$rps
->
{
$_
}{
nick
}
}
keys
(
%auto_login
);
while
(
@vnicks
)
{
while
(
@vnicks
)
{
Irpg::Irc::
sts
("
MODE
$opts
->{botchan} +
"
.
Irpg::Irc::
sts
("
MODE
$opts
->{botchan} +
"
.
('
v
'
x
$opts
->
{
modesperline
})
.
"
"
.
('
v
'
x
$opts
->
{
modesperline
})
.
"
"
.
...
@@ -484,7 +482,7 @@ sub parse {
...
@@ -484,7 +482,7 @@ sub parse {
}
}
else
{
Irpg::Irc::
chanmsg
("
0 users qualified for auto login.
");
}
else
{
Irpg::Irc::
chanmsg
("
0 users qualified for auto login.
");
}
undef
(
$prev_online
);
undef
(
$prev_online
);
undef
(
$
auto_login
);
undef
(
%
auto_login
);
}
}
elsif
(
$arg
[
1
]
eq
'
005
')
{
elsif
(
$arg
[
1
]
eq
'
005
')
{
if
("
@arg
"
=~
/MODES=(\d+)/
)
{
$opts
->
{
modesperline
}
=
$
1
;
}
if
("
@arg
"
=~
/MODES=(\d+)/
)
{
$opts
->
{
modesperline
}
=
$
1
;
}
...
@@ -496,7 +494,7 @@ sub parse {
...
@@ -496,7 +494,7 @@ sub parse {
$onchan
{
$arg
[
7
]}
=
time
()
if
(
$opts
->
{
botchan
}
eq
$arg
[
3
]);
$onchan
{
$arg
[
7
]}
=
time
()
if
(
$opts
->
{
botchan
}
eq
$arg
[
3
]);
if
(
exists
(
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}))
{
if
(
exists
(
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}))
{
$rps
->
{
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}}{
online
}
=
1
;
$rps
->
{
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}}{
online
}
=
1
;
$auto_login
->
{
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}}
=
1
;
$auto_login
{
$prev_online
->
{
$arg
[
7
]
.
"
!
"
.
$arg
[
4
]
.
"
\@
"
.
$arg
[
5
]}}
=
1
;
}
}
}
}
elsif
(
$arg
[
1
]
eq
'
privmsg
')
{
elsif
(
$arg
[
1
]
eq
'
privmsg
')
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
irpg_bot.pl
+
1
−
1
Voir le fichier @
de8c2de8
...
@@ -151,7 +151,7 @@ $prev_online = loaddb($rps, 1);
...
@@ -151,7 +151,7 @@ $prev_online = loaddb($rps, 1);
irc_connect
(
$opts
);
irc_connect
(
$opts
);
Irpg::Main::
init_pkg
(
$opts
,
$rps
,
\
$lasttime
,
$prev_online
,
$auto_login
);
Irpg::Main::
init_pkg
(
$opts
,
$rps
,
\
$lasttime
,
$prev_online
);
#-----------------#
#-----------------#
# MAIN LOOP #
# MAIN LOOP #
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter