summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-09-17 16:19:26 -0300
committerJesusaves <cpntb1@ymail.com>2018-09-17 16:19:26 -0300
commit3cc8a03902b34e0bff2429ead34bf7c7f76a7457 (patch)
tree82e22b72593fd86224fbc53a596a5a675575f8db /npc
parentc24cbdc410afa40398f10f784795a9b23a6aa55f (diff)
downloadserverdata-3cc8a03902b34e0bff2429ead34bf7c7f76a7457.tar.gz
serverdata-3cc8a03902b34e0bff2429ead34bf7c7f76a7457.tar.bz2
serverdata-3cc8a03902b34e0bff2429ead34bf7c7f76a7457.tar.xz
serverdata-3cc8a03902b34e0bff2429ead34bf7c7f76a7457.zip
Rewrite Referral System
Diffstat (limited to 'npc')
-rw-r--r--npc/003-1/michel.txt41
-rw-r--r--npc/003-3/malindou.txt8
-rw-r--r--npc/functions/scoreboards.txt2
3 files changed, 48 insertions, 3 deletions
diff --git a/npc/003-1/michel.txt b/npc/003-1/michel.txt
index 4fe22308d..03893dfbe 100644
--- a/npc/003-1/michel.txt
+++ b/npc/003-1/michel.txt
@@ -12,13 +12,13 @@
HallOfCoins();
// Anyone with GM Level, staff or not, is allowed to latest GM logs
- if (!getgmlevel()) close;
+ if (!getgmlevel()) goto L_Main;
next;
HallOfGMLog();
// Only Admins are allowed to change the HoF Scoreboard
- if (!is_admin()) close;
+ if (!is_admin()) goto L_Main;
next;
mes "##BGM Information##b";
@@ -35,8 +35,45 @@
mes "##B Technical Notes ##b";
mes "In future we may start Fame field directly (but it is not displayed on client, thus, we decided to use Karma).";
//set Karma, Karma + 5;
+ if (is_admin()) goto L_GM;
close;
+L_Main:
+ if (!$REFERRAL_IDS[#REFERRAL_PROG])
+ close;
+ next;
+ mesn;
+ mesq l("Hey, I see you have appointed @@ players to this game. Good job!", $REFERRAL_IDS[#REFERRAL_PROG]);
+ close;
+
+L_GM:
+ .@nb = query_sql("SELECT SUM(value) FROM `mapreg` WHERE varname='$REFERRAL_IDS' LIMIT 2", .@value);
+ @total=.@value[0];
+ mesc "Referral Event status: " + ($REFERRAL_ENABLED ? "##2ACTIVE##0" : "##1INACTIVE##0");
+ mesc "Total refers count: "+@total;
+ mes "";
+ select
+ "Close",
+ "Toggle Referral Event",
+ "Scoreboard",
+ "CLEAR REFERRAL ID ARRAY",
+ "Close";
+ mes "";
+ switch (@menu) {
+ case 2:
+ $REFERRAL_ENABLED=!$REFERRAL_ENABLED; break;
+ case 3:
+ HallOfReferral(); break;
+ case 4:
+ mesc "Are you sure?", 1;
+ next;
+ if (askyesno() == ASK_YES)
+ deletearray($REFERRAL_IDS);
+ default: close;
+ }
+ next;
+ goto L_GM;
+
OnInit:
.sex = G_MALE;
.distance = 5;
diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt
index 338062eaa..6c0e46d8d 100644
--- a/npc/003-3/malindou.txt
+++ b/npc/003-3/malindou.txt
@@ -119,6 +119,14 @@ OnInit:
query_sql("UPDATE `quest` SET `count2` = `count1` WHERE `quest`.`quest_id`="+HalinarzoQuest_LifeDelight);
query_sql("UPDATE `quest` SET `count1` = '1' WHERE `quest`.`quest_id`="+HalinarzoQuest_LifeDelight+" AND `count1` > '1'");
}
+ // Current UPDATE value: Seg Set 17 16:02:27 -03 2018
+ if ($UPDATE < 1537210947) {
+ $UPDATE=1537210947;
+ debugmes "";
+ debugmes "* Referral Hack System";
+ debugmes "";
+ setarray $REFERRAL_IDS, 0;
+ }
diff --git a/npc/functions/scoreboards.txt b/npc/functions/scoreboards.txt
index e91645b84..3fb44e14a 100644
--- a/npc/functions/scoreboards.txt
+++ b/npc/functions/scoreboards.txt
@@ -115,7 +115,7 @@ function script HallOfGMLog {
function script HallOfReferral {
mes "";
- .@nb = query_sql("SELECT l.userid, COUNT(a.value) FROM `acc_reg_num_db` AS a, `login` AS l WHERE a.key='#REFERRAL_PROG' AND l.account_id=a.value ORDER BY COUNT(a.value) DESC LIMIT 20", .@name$, .@value);
+ .@nb = query_sql("SELECT l.userid, COUNT(a.value) FROM `mapreg` AS a, `login` AS l WHERE a.varname='$REFERRAL_IDS' AND l.account_id=a.index ORDER BY COUNT(a.value) DESC LIMIT 20", .@name$, .@value);
mes "Referral Program Report - pg. 1";
mes("1."+.@name$[0]+" ("+.@value[0]+")");
mes("2."+.@name$[1]+" ("+.@value[1]+")");