summaryrefslogtreecommitdiff
path: root/npc/items
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-05-06 23:06:56 -0300
committerJesusaves <cpntb1@ymail.com>2022-05-06 23:06:56 -0300
commit5ba69b775b1c364c4ba7d8ecd67a03267914bc27 (patch)
treef2d9d38079de6b49a98dca89bf2a4684ba7a0582 /npc/items
parent6f2873829fcf8306f87d1f1a982a4f0455e540a3 (diff)
downloadserverdata-5ba69b775b1c364c4ba7d8ecd67a03267914bc27.tar.gz
serverdata-5ba69b775b1c364c4ba7d8ecd67a03267914bc27.tar.bz2
serverdata-5ba69b775b1c364c4ba7d8ecd67a03267914bc27.tar.xz
serverdata-5ba69b775b1c364c4ba7d8ecd67a03267914bc27.zip
Fix the first part of Scrying
Diffstat (limited to 'npc/items')
-rw-r--r--npc/items/books.txt103
1 files changed, 67 insertions, 36 deletions
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;
}