diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-14 22:05:34 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-08-05 03:25:43 -0300 |
commit | 8406751c8db2c7fcfc75a55e88f2f0ab4c7efa3b (patch) | |
tree | e9a3ad6e2e6b4e7d0e569b16db7ec9f3c17a7e2d | |
parent | c625bf37ce9da9ce81760c2cf63dccba915c1546 (diff) | |
download | serverdata-8406751c8db2c7fcfc75a55e88f2f0ab4c7efa3b.tar.gz serverdata-8406751c8db2c7fcfc75a55e88f2f0ab4c7efa3b.tar.bz2 serverdata-8406751c8db2c7fcfc75a55e88f2f0ab4c7efa3b.tar.xz serverdata-8406751c8db2c7fcfc75a55e88f2f0ab4c7efa3b.zip |
Referral System (BETA) from Moubootaur Legends.
Near-exact copy.
-rw-r--r-- | npc/000-0-1/narrator.txt | 61 | ||||
-rw-r--r-- | npc/functions/main.txt | 8 |
2 files changed, 69 insertions, 0 deletions
diff --git a/npc/000-0-1/narrator.txt b/npc/000-0-1/narrator.txt index b0bbcc5a..27748b81 100644 --- a/npc/000-0-1/narrator.txt +++ b/npc/000-0-1/narrator.txt @@ -169,7 +169,68 @@ OnInit: .sex = G_OTHER; end; +// referralSystem() is a Moubootaur Legends function function referralSystem { + mesc l("But before we get there, I've been itching to know..."); + next; + mesc l("Do we know someone on this world?"); + next; + mesc l("Do we know someone on this world?"), 1; + // Opt-out + if (askyesno() == ASK_NO) { + mesc l("Yes. We truly don't remember anyone."); + next; + return; + } + // Opt-in + mesc l("Yes... We remember a fellow adventurer... How was their name again?"); + next; + .@ref$=""; + do + { + mesc l("(Which player invited you to this world?)"), 1; + input .@ref$; + mes ""; + if (.@ref$ != "") { + .@ref=gf_accid(strip(.@ref$)); + // Anti-spam Forced cooldowns + sleep2(100); + if (.@ref > 0) { + // Case 1: Yourself + if (.@ref == getcharid(3)) { + mesc l("Hahah, silly, that's ourselves!"); + mesc l("Try again!"); + next; + .@ref$=""; + // Anti-spam Forced cooldowns + sleep2(500); + // Case 2: Valid Invite + } else { + setv("REFERRAL_PROG", .@ref); + //getitembound FriendGift, 1, 1; + mesc l("Ah yes, our trusty friend, %s.", .@ref$); + mesc l("They probably miss me. I mean, I probably have been away for a long time..."); + next; + mesc l("Maybe they sent me a letter, or a gift? I'll see once I get in Artis."); + next; + } + } else { + // Case 3: Invalid Invite + mesc l("Oops, there is nobody known as %s on this word.", .@ref$); + mesc l("Maybe I don't remember their name, after all."); + next; + .@ref$=""; + // Anti-spam Forced cooldowns + sleep2(500); + } + } else { + // Case 4: Player gave up + .@ref$="None"; + mesc l("Actually, nevermind. My memory is still too foggy to remember this."); + next; + } + } while (.@ref$ == ""); + // Return to script return; } diff --git a/npc/functions/main.txt b/npc/functions/main.txt index 9331e201..2b7e2647 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -292,6 +292,14 @@ function script setv { return setd("$VAULT_"+.@v$+"["+.@id+"]", .@val); } +// Get some acc id from char name, even if offline. +// This is a highly sensitive function; Use with caution. +// gf_accid( Name ) +function script gf_accid { + .@nb = query_sql("SELECT account_id FROM `char` WHERE name='"+escape_sql(getarg(0))+"' LIMIT 2", .@value); + return .@value[0]; +} + function script getquestlink { return "[@@q" + getarg(0) + "|@@]"; } |