summaryrefslogtreecommitdiff
path: root/npc/other
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-05-05 20:40:00 +0200
committerGitHub <noreply@github.com>2019-05-05 20:40:00 +0200
commit892ed5f372f995786facfa8ce833711936754795 (patch)
treed6c3c5d6af0fd19331f4955f276272330605faa7 /npc/other
parent4afb21ec8299e0e3dd79adc1b7b7a73870b93cdc (diff)
parent7b48fee4ffd90913e2beac51e0bed958129dd3e7 (diff)
downloadhercules-892ed5f372f995786facfa8ce833711936754795.tar.gz
hercules-892ed5f372f995786facfa8ce833711936754795.tar.bz2
hercules-892ed5f372f995786facfa8ce833711936754795.tar.xz
hercules-892ed5f372f995786facfa8ce833711936754795.zip
Merge pull request #2068 from AnnieRuru/37-F_MesItemInfo
Add F_MesItemInfo function to show item name with description link
Diffstat (limited to 'npc/other')
-rw-r--r--npc/other/Global_Functions.txt23
1 files changed, 22 insertions, 1 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
index 86332e931..e3741b495 100644
--- a/npc/other/Global_Functions.txt
+++ b/npc/other/Global_Functions.txt
@@ -434,7 +434,7 @@ function script F_ShuffleNumbers {
//== Function F_MesColor ===================================
// Function to colorize npc dialog without having to memorize the color code
// Examples:
-// mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
+// mesf("%sThis message is now in BLUE.", F_MesColor(C_BLUE));
function script F_MesColor {
return sprintf("^%06X", min(getarg(0), 0xFFFFFF));
}
@@ -467,3 +467,24 @@ function script F_GetTradeRestriction {
.@trade$ += "NoAuction|";
return .@trade$;
}
+
+//== Function F_MesItemInfo ===================================
+// Show the item name and a clickable link for the item description
+// Only works with mes and mesf, does not work in menu/select
+function script F_MesItemInfo {
+ .@item = getarg(0);
+ .@itemname$ = getitemname(.@item);
+ if (.@itemname$ != "null") {
+ .@itemslot = getitemslots(.@item);
+ if (.@itemslot)
+ .@itemname$ = sprintf("%s [%d]", .@itemname$, .@itemslot);
+ }
+ else
+ .@itemname$ = "Unknown Item";
+ if (PACKETVER >= 20150729)
+ return sprintf("<ITEM>%s<INFO>%d</INFO></ITEM>", .@itemname$, .@item);
+ else if (PACKETVER >= 20130130)
+ return sprintf("<ITEMLINK>%s<INFO>%d</INFO></ITEMLINK>", .@itemname$, .@item);
+ else
+ return .@itemname$;
+}