Some of these changes are actually included in the previous partial commits.
* Added title system
- First title you unlock is automatically selected
- Q command "title" lists available titles and lets you change preference
- After April 1 is over all titles are automatically removed
* Added timekeeping system
- Nothing works until April 1
- On April 1, all achievements and titles are enabled for everyone
- After April 1, titles are disabled. Achievements are only enabled for
users with +c set. Channel announcements are only enabled for channels
with +h set (couldn't use same flag sadly).
- These flags cannot be set before April 1.
- All commands are flagged appropriately and will automatically disable
and enable according to the above conditions.
* Added channel announcements
- Announcements in all channels that all account users are known in.
- Announcements only happen for achievements worth 30 or more points.
- After April 1 +h must be set in chanflags to see announcements.
- #achievements is exempt from most of these restrictions - any user in
#achievements will have their achievements announced if they are worth
30 or more points.
* Updated external achievements. Achievements added for triviabot and snailbot.
* Added scheduled saving of achievements database. Also saves old file
before saving.
--HG--
branch : achievements
* CMDHELP: command must be used instead.
* CMDHELP: +g AUTOVOICE Automatically voices any user who has voice access when they join
* CMDHELP: the channel. Same effect as giving all voices the +g chanlev flag.
- * CMDHELP: +h ACH'MENTS Display achievement announcements in channel.
+ * DISHELP: +h ACH'MENTS Display achievement announcements in channel.
* CMDHELP: +j JOINED Causes Q to remain on the channel. Cannot be removed.
* CMDHELP: +k KNOWNONLY Any user who joins the channel who is not known (+k) will be kicked.
* CMDHELP: Unless channel mode +i is set they will be banned as well.
oldflags=rcp->flags;
changemask=QCFLAG_USERCONTROL;
+
+ /* Disable achievements flag before April 1 */
+ if (time(NULL) < ACHIEVEMENTS_START)
+ changemask &= ~QCFLAG_ACHIEVEMENTS;
+
+ /* Developer override! */
if (UIsDev(rup)) {
changemask=QCFLAG_ALL;
}
/* Achievements: Nothing before ACHIEVEMENTS_START
* opt-in only after ACHIEVEMENTS_END
* Titles are valid only between ACHIEVEMENTS_START and ACHIEVEMENTS_END */
-#define ACHIEVEMENTS_START 1270076400
-#define ACHIEVEMENTS_END 1270162800
+
+//#define ACH_TEST_APRIL1
+
+#ifdef ACH_TEST_APRIL1
+
+#define ACHIEVEMENTS_START 1269702917
+#define ACHIEVEMENTS_END 1270162800
+
+#elif defined(ACH_TEST_POSTAPRIL1)
+
+#define ACHIEVEMENTS_START 0
+#define ACHIEVEMENTS_END 1269702917
+
+#else
+
+#define ACHIEVEMENTS_START 1270076400
+#define ACHIEVEMENTS_END 1270162800
+
+#endif
/* Mini-hash of known users on channels to make lookups faster;
* how big do we make it? */
QCFLAG_PROTECT|QCFLAG_TOPICSAVE|QCFLAG_VOICEALL| \
QCFLAG_WELCOME|QCFLAG_KNOWNONLY|QCFLAG_ACHIEVEMENTS )
-#define QCFLAG_ALL 0x7fff
+#define QCFLAG_ALL 0xffff
/* Channel user ("chanlev") flags */
{ 'e', QCFLAG_ENFORCE },
{ 'f', QCFLAG_FORCETOPIC },
{ 'g', QCFLAG_AUTOVOICE },
+ { 'h', QCFLAG_ACHIEVEMENTS },
{ 'i', QCFLAG_INFO },
{ 'j', QCFLAG_JOINED },
{ 'k', QCFLAG_KNOWNONLY },
const flag ruflags[] = {
{ 'a', QUFLAG_ADMIN },
+ { 'c', QUFLAG_ACHIEVEMENTS },
{ 'd', QUFLAG_DEV },
{ 'D', QUFLAG_CLEANUPEXEMPT },
{ 'g', QUFLAG_GLINE },
msg(QM_ACHIEVEMENTCOMPARERESULT,"End of list. User $0 is ahead by $1 points!", "sd"),
msg(QM_FEATOFSTRENGTHUNLOCKED,"FEAT OF STRENGTH: $0", "s"),
msg(QM_ACHCHANNELHEADER,"Achievement points for users on $0:\n # Nick Username Points","s"),
+ msg(QM_TITLEUNLOCKED,"TITLE UNLOCKED: $0", "s"),
+ msg(QM_NOTITLES,"You have not unlocked any titles.",""),
+ msg(QM_TITLEHEADER,"Available titles:\n # Title",""),
+ msg(QM_INVALIDTITLE,"Invalid title ID.",""),
+ msg(QM_TITLETOOFAST,"You have already changed your title recently. Please wait a while and try again.",""),
}
EndMessages()
#endif
if (time(NULL) < ACHIEVEMENTS_START)
continue;
- if ((time(NULL) > 1270162800) &&
+ if ((time(NULL) > ACHIEVEMENTS_END) &&
!UIsAchievements(rup))
continue;
}
* CMDHELP: Changes your current user flags, where:
* CMDHELP: flags - changes to apply, in the usual flag letters preceded by +/- format.
* CMDHELP: Valid user flags are:
- * CMDHELP: +c ACH'MENTS - enables achievements system - allows use of achievement commands
- * CMDHELP: and sends achievement messages.
+ * DISHELP: +c ACH'MENTS - enables achievements system - allows use of achievement commands
+ * DISHELP: and sends achievement messages.
* CMDHELP: +n NOTICE - causes the bot to sent you NOTICEs. If this flag is not set the
* CMDHELP: bot will communicate using PRIVMSG.
*/
int csu_douserflags(void *source, int cargc, char **cargv) {
nick *sender=source;
reguser *rup=getreguserfromnick(sender), *target;
- authname *anp;
int arg=0, wasorisoper;
flag_t flagmask, changemask, oldflags;
char flagbuf[30];
if (UIsDev(rup))
changemask=QUFLAG_ALL;
+ if (time(NULL) > ACHIEVEMENTS_START) {
+ changemask |= QUFLAG_ACHIEVEMENTS;
+ }
+
wasorisoper = UHasOperPriv(target);
setflags(&target->flags, changemask, cargv[arg], ruflags, REJECT_NONE);
wasorisoper |= UHasOperPriv(target);
cs_log(sender,"USERFLAGS #%s %s (%s -> %s)",target->username,cargv[arg],flagbuf,printflags(target->flags, ruflags));
/* only warn about interesting changes */
- if((target->flags ^ oldflags) & ~(QUFLAG_NOTICE | QUFLAG_INFO | QUFLAG_TRUST)) {
+ if((target->flags ^ oldflags) & ~(QUFLAG_NOTICE | QUFLAG_INFO | QUFLAG_TRUST | QUFLAG_ACHIEVEMENTS)) {
chanservwallmessage("%s (%s) just used USERFLAGS on %s %s (%s -> %s)",sender->nick,rup->username,target->username,cargv[arg],flagbuf,printflags(target->flags,ruflags));
#ifdef AUTHGATE_WARNINGS
if (cs_privcheck(QPRIV_VIEWUSERFLAGS, sender))
flagmask=QUFLAG_ALL;
else
- flagmask=QUFLAG_INFO | QUFLAG_NOTICE | QUFLAG_OPER | QUFLAG_HELPER | QUFLAG_DEV | QUFLAG_ADMIN | QUFLAG_STAFF;
+ flagmask=QUFLAG_INFO | QUFLAG_NOTICE | QUFLAG_OPER | QUFLAG_HELPER | QUFLAG_DEV | QUFLAG_ADMIN | QUFLAG_STAFF | QUFLAG_ACHIEVEMENTS;
chanservstdmessage(sender, QM_CURUSERFLAGS, target->username, printflagsornone(target->flags & flagmask, ruflags));