From 7b48fee4ffd90913e2beac51e0bed958129dd3e7 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Sun, 27 Jan 2019 21:21:01 +0800 Subject: Add F_MesItemInfo function to show item name with description link also fix OldGlastHeim ITEMLINK display incorrectly --- npc/other/Global_Functions.txt | 23 ++++++++++++++++++++++- npc/re/instances/OldGlastHeim.txt | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'npc') diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 904ed7165..d45b3c3e7 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)); } @@ -475,3 +475,24 @@ function script F_GetTradeRestriction { .@trade$ += "NoAuction|"; } } + +//== 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("%s%d", .@itemname$, .@item); + else if (PACKETVER >= 20130130) + return sprintf("%s%d", .@itemname$, .@item); + else + return .@itemname$; +} diff --git a/npc/re/instances/OldGlastHeim.txt b/npc/re/instances/OldGlastHeim.txt index 44b5f1e61..ec0efeb53 100644 --- a/npc/re/instances/OldGlastHeim.txt +++ b/npc/re/instances/OldGlastHeim.txt @@ -2744,7 +2744,7 @@ glast_01,188,273,5 script White Knight#1a 4_WHITEKNIGHT,{ close(); } mes("I exchange you a White Knight Card for ^0000FF3000 Coagulated Spell^000000 or ^FF000070 Contaminated Magic^000000."); - mes("White Knight Card4608"); + mes(F_MesItemInfo(White_Knightage_Card)); next(); setarray(.@item[0], Coagulated_Spell, Corrupted_Charm); setarray(.@cost[0], 3000, 70); @@ -2777,7 +2777,7 @@ glast_01,192,273,3 script Khalitzburg Knight#1a 4_F_KHALITZBURG,{ close(); } mes("I exchange you a Khalitzburg Knight Card for ^0000FF5000 Coagulated Spell^000000 or ^FF0000100 Contaminated Magic^000000."); - mes("Khalitzburg Knight Card4609"); + mes(F_MesItemInfo(Khali_Knightage_Card)); next(); setarray(.@item[0], Coagulated_Spell, Corrupted_Charm); setarray(.@cost[0], 5000, 100); -- cgit v1.2.3-60-g2f50