summaryrefslogtreecommitdiff
path: root/npc/other/Global_Functions.txt
diff options
context:
space:
mode:
authorKenpachi2k13 <3476227+Kenpachi2k13@users.noreply.github.com>2020-05-03 09:14:56 +0200
committerGitHub <noreply@github.com>2020-05-03 09:14:56 +0200
commitcd593de68b02d77766fcb3b7b2a869096ceb7183 (patch)
tree2245738ce70d50031b927fed560815458658c7c2 /npc/other/Global_Functions.txt
parentf70a887b188dbd88c45c9992cd18a33b6886005f (diff)
parentf40cc839413cc82aed445d39cc3aa204dce87780 (diff)
downloadhercules-cd593de68b02d77766fcb3b7b2a869096ceb7183.tar.gz
hercules-cd593de68b02d77766fcb3b7b2a869096ceb7183.tar.bz2
hercules-cd593de68b02d77766fcb3b7b2a869096ceb7183.tar.xz
hercules-cd593de68b02d77766fcb3b7b2a869096ceb7183.zip
Merge branch 'master' into cell_noskill
Diffstat (limited to 'npc/other/Global_Functions.txt')
-rw-r--r--npc/other/Global_Functions.txt67
1 files changed, 40 insertions, 27 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
index 904ed7165..81e511ac2 100644
--- a/npc/other/Global_Functions.txt
+++ b/npc/other/Global_Functions.txt
@@ -9,15 +9,15 @@
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
-//= Copyright (C) 2012-2015 Hercules Dev Team
-//= Copyright (C) AnnieRuru
-//= Copyright (C) Emistry
-//= Copyright (C) Euphy
-//= Copyright (C) Paradox924X
-//= Copyright (C) L0ne_W0lf
-//= Copyright (C) Evera
-//= Copyright (C) kobra_k88
-//= Copyright (C) Lupus
+//= Copyright (C) 2012-2020 Hercules Dev Team
+//= Copyright (C) AnnieRuru
+//= Copyright (C) Emistry
+//= Copyright (C) Euphy
+//= Copyright (C) Paradox924X
+//= Copyright (C) L0ne_W0lf
+//= Copyright (C) Evera
+//= Copyright (C) kobra_k88
+//= Copyright (C) Lupus
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
@@ -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));
}
@@ -446,32 +446,45 @@ function script F_MesColor {
function script F_GetTradeRestriction {
.@trade = getiteminfo(getarg(0), ITEMINFO_TRADE);
- if (.@trade == 0) {
+ if (.@trade == 0)
return "None";
- }
.@trade$ = "";
- if (.@trade & ITR_NODROP) {
+ if (.@trade & ITR_NODROP)
.@trade$ += "NoDrop|";
- }
- if (.@trade & ITR_NOTRADE) {
+ if (.@trade & ITR_NOTRADE)
.@trade$ += "NoTrade|";
- }
- if (.@trade & ITR_PARTNEROVERRIDE) {
+ if (.@trade & ITR_PARTNEROVERRIDE)
.@trade$ += "PartnerOverride|";
- }
- if (.@trade & ITR_NOSELLTONPC) {
+ if (.@trade & ITR_NOSELLTONPC)
.@trade$ += "NoSellToNpc|";
- }
- if (.@trade & ITR_NOSTORAGE) {
+ if (.@trade & ITR_NOSTORAGE)
.@trade$ += "NoStorage|";
- }
- if (.@trade & ITR_NOGSTORAGE) {
+ if (.@trade & ITR_NOGSTORAGE)
.@trade$ += "NoGuildStorage|";
- }
- if (.@trade & ITR_NOMAIL) {
+ if (.@trade & ITR_NOMAIL)
.@trade$ += "NoMail|";
- }
- if (.@trade & ITR_NOAUCTION) {
+ if (.@trade & ITR_NOAUCTION)
.@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$;
}