summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-14 15:28:58 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-14 15:28:58 -0300
commita5534e046656f14a951ba3c5f86023389fd97986 (patch)
treecb4dc769a7fffb20bc29d63b518f3c17071afdd7
parent1323574b95c92aa7d4c4096d95535d428bee6b16 (diff)
downloadserverdata-a5534e046656f14a951ba3c5f86023389fd97986.tar.gz
serverdata-a5534e046656f14a951ba3c5f86023389fd97986.tar.bz2
serverdata-a5534e046656f14a951ba3c5f86023389fd97986.tar.xz
serverdata-a5534e046656f14a951ba3c5f86023389fd97986.zip
Scholarship Titulation (manual mode)
-rw-r--r--db/constants.conf9
-rw-r--r--npc/027-0/enrique.txt22
-rw-r--r--npc/commands/titulate.txt110
-rw-r--r--npc/functions/util.txt1
-rw-r--r--npc/scripts.conf1
5 files changed, 142 insertions, 1 deletions
diff --git a/db/constants.conf b/db/constants.conf
index b30d8e20c..e689821c8 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -2339,5 +2339,14 @@ constants_db: {
CLASS_SCHOLARSHIP: 5
CLASS_THIEVES: 6
+ ACADEMIC_LAYMAN: 1
+ ACADEMIC_STUDENT: 1
+ ACADEMIC_TECHNIC: 2
+ ACADEMIC_BACHELOR: 3
+ ACADEMIC_MASTER: 4
+ ACADEMIC_DOCTOR: 5
+ ACADEMIC_PHD: 6
+ ACADEMIC_SAGE: 7
+
@include "conf/import/constants.conf"
}
diff --git a/npc/027-0/enrique.txt b/npc/027-0/enrique.txt
index 2f638fd65..d41f74f26 100644
--- a/npc/027-0/enrique.txt
+++ b/npc/027-0/enrique.txt
@@ -20,7 +20,8 @@
l("What are Magic Skill Points?"),
l("What are Research Points"),
l("What is the Scholar Rank?"),
- l("Who are the most famous scholars?");
+ l("Who are the most famous scholars?"),
+ rif(!ACADEMIC_RANK, l("I would like to enroll!"));
// TODO: Give TMW2_STUDY for MSP. Need X skills learnt or 1M GP.
mes "";
switch (@menu) {
@@ -70,6 +71,25 @@
case 6:
HallOfAcademic();
break;
+ case 7:
+ mesn;
+ mesq l("That is not how things are done here.");
+ next;
+ mesn;
+ mesq l("First, you need to contribute to the common knowledge of this world. Like, write a %s or something.", "[@@https://wiki.moubootaurlegends.org/|"+l("Wiki article")+"@@]");
+ next;
+ mesn;
+ mesq l("Then someone of a scholarship rank above your must approve it, and say that your work is enough to the next scholar rank.");
+ next;
+ mesn;
+ mesq l("For the higher titles, you'll need vouch of multiple people. You can vouch for anyone below your rank with %s but never for someone of same or higher rank.", b("@titulate"));
+ next;
+ mesn;
+ mesq l("Do note that abuse will cause both you and the person you vouched for to be kicked from the Academy! So be mindful with to whom you give titles.");
+ next;
+ mesn;
+ mesq l("Abuse can be determined by your peers or by the grandmasters, so be careful.");
+ break;
}
} while (@menu != 1);
close;
diff --git a/npc/commands/titulate.txt b/npc/commands/titulate.txt
new file mode 100644
index 000000000..ee3031837
--- /dev/null
+++ b/npc/commands/titulate.txt
@@ -0,0 +1,110 @@
+// TMW2 Script
+//
+// @grantpower <username>
+// Grants a legendary weapon to <username>. Cannot be undone.
+// Only way to bypass restrictions on legendary weapons.
+
+- script @titulate 32767,{
+ end;
+
+OnCall:
+ .@request$ = "";
+ .@request$ += implode(.@atcmd_parameters$, " ");
+
+ // No argument supplied
+ if (.@request$ == "") {
+ Exception("Usage: @titulate <target charname>", RB_ISFATAL|RB_DISPBOTTOM);
+ }
+
+ // Player is not attached
+ .@ori = getcharid(3);
+ .@id = getcharid(3, .@request$);
+ if (.@id < 1 || .@ori < 1) {
+ Exception("Player not found.", RB_ISFATAL|RB_DISPBOTTOM);
+ }
+
+ // Obtain your own title
+ .@mine=ACADEMIC_RANK;
+ .@them=getvariableofpc(ACADEMIC_RANK, .@id, 99);
+
+ mes ".:: " + l("Titulation") + " ::.";
+ if (.@mine <= .@them) {
+ mesc l("You can only concede or vouch a title for people of academic rank smaller or equal to your own.");
+ close;
+ }
+
+ mesc l("You're about to concede an academic title to \"@@\".", .@request$), 1;
+ mesc l("If this is found out to be a fraudulent titulation, both you as target will have their titles cased by the Academic Council, or by the Alliance High Council."), 1;
+ mesc l("This action CANNOT BE UNDONE."), 1;
+ mes l("Are you sure?");
+ if (askyesno() == ASK_NO)
+ close;
+
+ // Grant the title
+ if (attachrid(.@id)) {
+ switch (ACADEMIC_RANK) {
+ case ACADEMIC_LAYMAN:
+ case ACADEMIC_STUDENT:
+ case ACADEMIC_TECHNIC:
+ // Instant promotion
+ ACADEMIC_RANK+=1;
+ .@upgrade=true;
+ break;
+ case ACADEMIC_BACHELOR:
+ case ACADEMIC_MASTER:
+ // Two-Man rule
+ if (array_find(ACADEMIC_VOUCH, .@ori)) {
+ end;
+ }
+ array_push(ACADEMIC_VOUCH, .@ori);
+ if (array_entries(ACADEMIC_VOUCH) >= 2) {
+ ACADEMIC_RANK+=1;
+ deletearray(ACADEMIC_VOUCH);
+ .@upgrade=true;
+ }
+ break;
+ case ACADEMIC_DOCTOR:
+ case ACADEMIC_PHD:
+ // Three-Man rule
+ if (array_find(ACADEMIC_VOUCH, .@ori)) {
+ end;
+ }
+ array_push(ACADEMIC_VOUCH, .@ori);
+ if (array_entries(ACADEMIC_VOUCH) >= 3) {
+ ACADEMIC_RANK+=1;
+ deletearray(ACADEMIC_VOUCH);
+ .@upgrade=true;
+ }
+ break;
+ // Invalid
+ case ACADEMIC_SAGE:
+ Exception("The Grand Master title can only be issued by the president of the Alliance High Council.", RB_ISFATAL|RB_SPEECH);
+ default:
+ Exception("Invalid titulation rank: "+ACADEMIC_RANK, RB_ISFATAL|RB_SPEECH);
+ }
+
+ // Message
+ if (.@upgrade) {
+ dispbottom l("You received the %s title from %s.",
+ academicrank(), strcharinfo(0, "someone", .@ori));
+ } else {
+ dispbottom l("You were vouced to the %s title by %s. You still need %d more vouches to be promoted.",
+ academicrank(ACADEMIC_RANK+1), strcharinfo(0, "someone", .@ori),
+ (ACADEMIC_RANK >= ACADEMIC_DOCTOR ? 3 : 2) - array_entries(ACADEMIC_VOUCH));
+ }
+
+ // Oops, player disconnected
+ } else {
+ Exception("Player not found.", RB_ISFATAL|RB_SPEECH);
+ }
+
+ // Inform everyone
+ kamibroadcast(sprintf("%s has vouched %s for the title of %s.",
+ strcharinfo(0), .@request$, academicrank(.@them+1)));
+
+ close;
+
+OnInit:
+ bindatcmd "titulate", "@titulate::OnCall", 0, 100, 1;
+}
+
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index e612bf5a3..ce7bf3c71 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -888,6 +888,7 @@ function script mercrank {
}
function script academicrank {
switch (getarg(0, ACADEMIC_RANK)) {
+ case 8: return l("Grand Master"); // Reserved for GM Team
case 7: return l("Sage");
case 6: return l("Ph.D");
case 5: return l("Doctor");
diff --git a/npc/scripts.conf b/npc/scripts.conf
index ac6fea326..417407631 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -115,6 +115,7 @@
"npc/commands/scheduled-broadcasts.txt",
"npc/commands/shroom.txt",
"npc/commands/super-menu.txt",
+"npc/commands/titulate.txt",
"npc/commands/warp.txt",
"npc/commands/welcome.txt",
"npc/commands/wgm.txt",