From 5ba69b775b1c364c4ba7d8ecd67a03267914bc27 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 6 May 2022 23:06:56 -0300 Subject: Fix the first part of Scrying --- npc/014-2-2/valia.txt | 1 + npc/items/books.txt | 103 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 68 insertions(+), 36 deletions(-) diff --git a/npc/014-2-2/valia.txt b/npc/014-2-2/valia.txt index 6fc933d6b..8bdb4e890 100644 --- a/npc/014-2-2/valia.txt +++ b/npc/014-2-2/valia.txt @@ -106,6 +106,7 @@ function script GeminiKill { // ...But you lack a party if (getcharid(1) <= 0) { mesq l("You don't have a party. You're useless to me."); + tutmes l("You can make a party of 1 if you want to do it alone. This, however, is NOT ADVISED."), "Protip", false; close; } // ...But you are not the leader diff --git a/npc/items/books.txt b/npc/items/books.txt index 0fae0a04f..7dd99a736 100644 --- a/npc/items/books.txt +++ b/npc/items/books.txt @@ -282,31 +282,71 @@ function myself { // For scrying, myself(false, .@me) // While still using attachrid .@all = getarg(0, true); - mes ".:: " + strcharinfo(0) + " ::."; - if (is_staff()) - mesc l("%s is currently a staff member.", strcharinfo(0)), 3; - else if (is_sponsor()) - mesc l("%s is currently sponsoring the High Alliance.", strcharinfo(0)), 3; + .@who = getarg(1, getcharid(3)); + .@why = getcharid(3); + + /* Basic Data */ + detachrid(); + attachrid(.@who); + // No scrying + if (GSET_NOSCRY && .@who != .@why) { + detachrid(); + attachrid(.@why); + return 1; + } + // Basic data + .@name$ = strcharinfo(0, "error", .@who); + .@staff = is_staff(); + .@sponsor = is_sponsor(); + .@party$ = (getcharid(1) ? strcharinfo(1) : ""); + .@guild$ = (getcharid(2) ? strcharinfo(2) : ""); + .@clan$ = (getcharid(5) ? strcharinfo(4) : ""); + .@married = getpartnerid(); + .@legend = islegendary(); + if (getpetinfo(0)) { + .@pet = true; + .@pet_name$ = getpetinfo(2); + .@pet_type$ = getpetinfo(1); + } else { + .@pet = false; + } + if (gethominfo(0)) { + .@homun = true; + .@hc_name$ = gethominfo(2); + } else { + .@homun = false; + } + .@born = #REG_DATE; + detachrid(); + attachrid(.@why); + + mes ".:: " + .@name$ + " ::."; + if (.@staff) + mesc l("%s is currently a staff member.", .@name$), 3; + else if (.@sponsor) + mesc l("%s is currently sponsoring the High Alliance.", .@name$), 3; mes ""; - if (getcharid(1)) - mesc l("Party Name: @@", strcharinfo(1)); - if (getcharid(2)) - mesc l("Guild Name: @@", strcharinfo(2)); - if (getcharid(5)) - mesc l("Clan Name: @@", strcharinfo(4)); - if (getpartnerid()) + if (.@party$ != "") + mesc l("Party Name: @@", .@party$); + if (.@guild$ != "") + mesc l("Guild Name: @@", .@guild$); + if (.@clan$ != "") + mesc l("Clan Name: @@", .@clan$); + if (.@married) mesc l("Civil status: Married"); else mesc l("Civil status: Single"); - if (islegendary()) - mesc l("You are a legendary hero."); - if (getpetinfo(0)) - mesc l("Proud owner of %s the %s.", getpetinfo(2), getpetinfo(1)); - if (gethominfo(0)) - mesc l("Proud owner of %s the Homunculus.", gethominfo(2)); - mesc l("Born %s ago", FuzzyTime(#REG_DATE)); + if (.@legend) + mesc l("%s is a legendary hero.", .@name$), 2; + if (.@pet) + mesc l("Proud owner of %s the %s.", .@pet_name$, .@pet_type$); + if (.@homun) + mesc l("Proud owner of %s the Homunculus.", .@hc_name$); + mesc l("Born %s ago", FuzzyTime(.@born)); dnext; + // FIXME + if (.@who != .@why) return 0; mes ".:: " + l("Magic Status") + " ::."; mesc l("Current magic rank: %d", MAGIC_LVL); @@ -405,35 +445,26 @@ function myself { // TODO: Most used skill // TODO: Remember the position attained on previous events //mes ".:: " + l("Achievements") + " ::."; - return; + return 0; } OnScry: - if (!countitem(JesusalvaGrimorium) && !is_staff()) + if (!countitem(JesusalvaGrimorium)) end; .@w$ = implode(.@atcmd_parameters$, " "); - if (.@w$ == "") + if (.@w$ == "" || .@w$ == "NULL") .@w$ = strcharinfo(0); .@me = getcharid(3); .@id = getcharid(3, .@w$); if (!.@id) { - mesc l("The requested char is not online or does not exist."), 1; - close; - } - /* attachrid() + mes() is a no-go for this */ - if (!is_staff()) { - mesc l("Scrying others has been temporarily restricted to staff only due to bugs."), 1; + mesc l("The requested char \"%s\" is not online or does not exist.", .@w$), 1; close; } /* attachrid() + mes() is a no-go for this */ setnpcdialogtitle sprintf("@scry %s", .@w$); - attachrid(.@id); - if (!GSET_NOSCRY) - myself(false); - else - mesc l("%s has protected themselves from prying eyes. Your scry attempt failed.", strcharinfo(0)), 1; - detachrid(); - attachrid(.@me); + if (myself(false, .@id)) { + mesc l("%s has protected themselves from prying eyes. Your scry attempt failed.", .@w$), 1; + } close; function read_book { @@ -592,7 +623,7 @@ OnInit: .book_name$ = getitemname(JesusalvaGrimorium); .sex = G_OTHER; .distance = 1; - bindatcmd "scry", "#Book-JGrimorium::OnScry", 0, 99, 0; + bindatcmd "scry", "#Book-JGrimorium::OnScry", 0, 0, 0; end; } -- cgit v1.2.3-60-g2f50