From 60a1a09e65b1d0454cc6abdd4d4ef4966a6d283d Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 5 Aug 2020 15:03:15 -0300 Subject: Placeholder to send referrer rewards. The rewards themselves have dependencies. So skipped for MR 243. /wip --- npc/functions/global_event_handler.txt | 1 + npc/functions/referral.txt | 54 ++++++++++++++++++++++++++++++++++ npc/items/gift.txt | 3 ++ npc/scripts.conf | 1 + 4 files changed, 59 insertions(+) create mode 100644 npc/functions/referral.txt diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt index a6d634ed..bc469645 100644 --- a/npc/functions/global_event_handler.txt +++ b/npc/functions/global_event_handler.txt @@ -44,6 +44,7 @@ OnPCDieEvent: OnPCBaseLvUpEvent: //callfunc("newquestwarning"); + callfunc("ReferralSendLvReward"); end; OnNPCKillEvent: diff --git a/npc/functions/referral.txt b/npc/functions/referral.txt new file mode 100644 index 00000000..48231992 --- /dev/null +++ b/npc/functions/referral.txt @@ -0,0 +1,54 @@ +// The Mana World scripts. +// Author: +// Moubootaur Legends Team +// Jesusalva +// Description: +// Referral System - rewards +// Note: Does not support multi-levelup + +function script ReferralSendLvReward { + .@referv=getvaultvar(REFERRAL_PROG); + if (.@referv < 1) + return; + + .@cid="playerCache"::account2char(.@aid); + .@status=getvaultvar(REFERRAL_CTRL); + switch (BaseLevel) { + case 25: + if (.@status > 1) + break; + + // FIXME PLACEHOLDER !! + rodex_sendmail(.@cid, "TMW Team", "Recruited Player got Lv 25!", strcharinfo(0)+" just got level 25!\nAs they get stronger, more rewards will be sent to you!", 0, Acorn, 1); + .@status+=1; + break; + case 50: + if (.@status > 2) + break; + + // FIXME PLACEHOLDER !! + rodex_sendmail(.@cid, "TMW Team", "Recruited Player got Lv 25!", strcharinfo(0)+" just got level 25!\nAs they get stronger, more rewards will be sent to you!", 0, Acorn, 1); + .@status+=1; + break; + case 75: + if (.@status > 3) + break; + + // FIXME PLACEHOLDER !! + rodex_sendmail(.@cid, "TMW Team", "Recruited Player got Lv 25!", strcharinfo(0)+" just got level 25!\nAs they get stronger, more rewards will be sent to you!", 0, Acorn, 1); + .@status+=1; + break; + case 100: + if (.@status > 4) + break; + + // FIXME PLACEHOLDER !! + rodex_sendmail(.@cid, "TMW Team", "Recruited Player got Lv 25!", strcharinfo(0)+" just got level 25!\nAs they get stronger, more rewards will be sent to you!", 0, Acorn, 1); + .@status+=1; + break; + } + setvaultvar(REFERRAL_CTRL, .@status); + return; +} + + diff --git a/npc/items/gift.txt b/npc/items/gift.txt index 9f5296f3..68e94595 100644 --- a/npc/items/gift.txt +++ b/npc/items/gift.txt @@ -8,7 +8,10 @@ function script OpenFriendGift { dispbottom l("You must reach level 5 to open this gift."); getitembound FriendGift, 1, 1; } else { + // FIXME PLACEHOLDER !! + getitem Acorn, 1; //getitem EventCoin, rand(1,3); + .@aid=getvaultvar(REFERRAL_PROG); .@vid="playerCache"::account2vault(.@aid); .@cid="playerCache"::account2char(.@aid); diff --git a/npc/scripts.conf b/npc/scripts.conf index d060ccb7..7bc709ad 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -62,6 +62,7 @@ "npc/functions/skills.txt", "npc/functions/lockpicks.txt", "npc/functions/crafting.txt", +"npc/functions/referral.txt", // quest debug "npc/functions/quest-debug/functions.txt", -- cgit v1.2.3-70-g09d2