diff options
-rw-r--r-- | doc/constants.md | 15 | ||||
-rw-r--r-- | doc/global_configuration.md | 65 | ||||
-rw-r--r-- | doc/global_configuration.txt | 69 | ||||
-rw-r--r-- | doc/sample/getiteminfo.txt | 9 | ||||
-rw-r--r-- | doc/script_commands.txt | 1 | ||||
-rw-r--r-- | npc/other/Global_Functions.txt | 37 | ||||
-rw-r--r-- | src/map/achievement.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 21 | ||||
-rw-r--r-- | src/map/script.h | 1 |
9 files changed, 150 insertions, 72 deletions
diff --git a/doc/constants.md b/doc/constants.md index 451f2a5fe..1074eb6bc 100644 --- a/doc/constants.md +++ b/doc/constants.md @@ -4278,6 +4278,7 @@ - `ITEMINFO_VIEWID`: 14 - `ITEMINFO_MATK`: 15 - `ITEMINFO_VIEWSPRITE`: 16 +- `ITEMINFO_TRADE`: 17 ### monster skill states @@ -4375,6 +4376,20 @@ - `FUNCTION_IS_LOCAL`: 3 - `FUNCTION_IS_LABEL`: 4 +### item trade restrictions + +- `ITR_NONE`: 0 +- `ITR_NODROP`: 1 +- `ITR_NOTRADE`: 2 +- `ITR_PARTNEROVERRIDE`: 4 +- `ITR_NOSELLTONPC`: 8 +- `ITR_NOCART`: 16 +- `ITR_NOSTORAGE`: 32 +- `ITR_NOGSTORAGE`: 64 +- `ITR_NOMAIL`: 128 +- `ITR_NOAUCTION`: 256 +- `ITR_ALL`: 511 + ### Renewal - `RENEWAL`: 1 diff --git a/doc/global_configuration.md b/doc/global_configuration.md new file mode 100644 index 000000000..b0e99e698 --- /dev/null +++ b/doc/global_configuration.md @@ -0,0 +1,65 @@ +# Global configuration reference + +## What is global configuration? + +Global configuration is an import system that allows configuration files to be +shared between servers (login, char, map), but can also be used independently +in each server. + + +## How does it work? + +It works by using the `@include` directive from libconfig: + +> "A configuration file may "include" the contents of another file using an +> include directive. This directive has the effect of inlining the contents of +> the named file at the point of inclusion. + +An include directive must appear on its own line and takes this form: + +``` + @include "filename" +``` + +Any backslashes or double quotes in the filename must be escaped as `\\` and +`\"`, respectively. + + +## How do I stop using global configurations? + +To stop using global configuration, all you have to do is copy the contents of +the file being imported and paste it _exactly_ where the include directive was. + +### Example + +If you want map server and char server to have their own separate SQL connection +settings, you would search in `conf/map/map-server.conf` and +`conf/char/char-server.conf` for this line: + +``` + @include "conf/global/sql_connection.conf" +``` + +And replace it with: + +``` + sql_connection: { + // [INTER] You can specify the codepage to use in your mySQL tables here. + // (Note that this feature requires MySQL 4.1+) + //default_codepage: "" + + // [LOGIN] Is `userid` in account_db case sensitive? + //case_sensitive: false + + // For IPs, ideally under linux, you want to use localhost instead of 127.0.0.1. + // Under windows, you want to use 127.0.0.1. If you see a message like + // "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" + // and you have localhost, switch it to 127.0.0.1 + db_hostname: "127.0.0.1" + db_port: 3306 + db_username: "ragnarok" + db_password: "ragnarok" + db_database: "ragnarok" + //codepage:"" + } +``` diff --git a/doc/global_configuration.txt b/doc/global_configuration.txt deleted file mode 100644 index a000a4572..000000000 --- a/doc/global_configuration.txt +++ /dev/null @@ -1,69 +0,0 @@ -//===== Hercules Documentation =============================== -//= Global configuration reference -//===== By: ================================================== -//= Panikon (Hercules Dev. Team) -//===== Current Version: ===================================== -//= 20140616 -//===== Description: ========================================= -//= Global configurations found in conf/global/ -//============================================================ - -- What are global configurations? - -Global configurations are configurations that can be shared between servers, -but can also be set independently in each server. - -- How do they work? - -They work by using an include system that is available with libconfig: - - "A configuration file may "include" the contents of another file using an - include directive. This directive has the effect of inlining the contents of - the named file at the point of inclusion. - - An include directive must appear on its own line in the input. It has the - form: - - @include "filename" - - Any backslashes or double quotes in the filename must be escaped as '\\' and - '\"', respectively." - From libconfig's documentation - -So each file that is included is actually inside each one of the main -configuration files and thus a change in the first will be a change in the -latter. -Note: the @include directive is read by the server executable, so any path -should be from were it is and NOT from where the main configuration file is! - -- How do I stop using global configurations? - -To stop using global configurations is very simple, all you have to do is copy -the contents that are inside the global configuration file and put them -_exactly_ where the include directive were in the main configuration file. - -E.g. - Find in any file: - @include "conf/global/sql_connection.conf" - Replace it with: - sql_connection: { - // [INTER] You can specify the codepage to use in your mySQL tables here. - // (Note that this feature requires MySQL 4.1+) - //default_codepage: "" - - // [LOGIN] Is `userid` in account_db case sensitive? - //case_sensitive: false - - // For IPs, ideally under linux, you want to use localhost instead of 127.0.0.1 - // Under windows, you want to use 127.0.0.1. If you see a message like - // "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" - // and you have localhost, switch it to 127.0.0.1 - db_hostname: "127.0.0.1" - db_port: 3306 - db_username: "ragnarok" - db_password: "ragnarok" - db_database: "ragnarok" - //codepage:"" - } - If the main configuration file belongs to the map server, for instance, you - don't need to include default_codepage and case_sensitive. diff --git a/doc/sample/getiteminfo.txt b/doc/sample/getiteminfo.txt index 57407c072..9d5121635 100644 --- a/doc/sample/getiteminfo.txt +++ b/doc/sample/getiteminfo.txt @@ -9,12 +9,12 @@ //============================================================ prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{ - mes "Please enter an item ID."; - input .@value; + mes("Please enter an item ID."); + input(.@value); // This line uses an INTERNAL function of your client to show item name by its ID! // ^nItemID^XXXX -> Item Name - mes "Item ID: "+.@value+" ^nItemID^"+.@value; + mesf("Item ID: %d ^nItemID^%d", .@value, .@value); mes("Current item info:"); mesf("Buy Price: %d", getiteminfo(.@value, ITEMINFO_BUYPRICE)); @@ -34,5 +34,8 @@ prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{ mesf("View ID: %d", getiteminfo(.@value, ITEMINFO_VIEWID)); mesf("MATK: %d", getiteminfo(.@value, ITEMINFO_MATK)); mesf("View Sprite: %d", getiteminfo(.@value, ITEMINFO_VIEWSPRITE)); + + .@trade$ = callfunc("F_GetTradeRestriction", .@value); + mesf("Trade Restriction: %s", .@trade$); close; } diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 42235ce33..1d691774a 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -3239,6 +3239,7 @@ Valid types are: ITEMINFO_VIEWID - View ID ("Sprite" field in the Item DB) ITEMINFO_MATK - MATK (only relevant if RENEWAL is set) ITEMINFO_VIEWSPRITE - View Sprite ("ViewSprite" field in the Item DB) + ITEMINFO_TRADE - Trade Restriction (see "doc/constant.md": item trade restriction) Check sample in doc/sample/getiteminfo.txt diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 9882e9d71..904ed7165 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -438,3 +438,40 @@ function script F_ShuffleNumbers { function script F_MesColor { return sprintf("^%06X", min(getarg(0), 0xFFFFFF)); } + +//== Function F_GetTradeRestriction ======================== +// Function to get item trade restriction +// Examples: +// mes "Red Potion Restriction: "+ callfunc("F_GetTradeRestriction", Red_Potion); +function script F_GetTradeRestriction { + .@trade = getiteminfo(getarg(0), ITEMINFO_TRADE); + + if (.@trade == 0) { + return "None"; + } + .@trade$ = ""; + if (.@trade & ITR_NODROP) { + .@trade$ += "NoDrop|"; + } + if (.@trade & ITR_NOTRADE) { + .@trade$ += "NoTrade|"; + } + if (.@trade & ITR_PARTNEROVERRIDE) { + .@trade$ += "PartnerOverride|"; + } + if (.@trade & ITR_NOSELLTONPC) { + .@trade$ += "NoSellToNpc|"; + } + if (.@trade & ITR_NOSTORAGE) { + .@trade$ += "NoStorage|"; + } + if (.@trade & ITR_NOGSTORAGE) { + .@trade$ += "NoGuildStorage|"; + } + if (.@trade & ITR_NOMAIL) { + .@trade$ += "NoMail|"; + } + if (.@trade & ITR_NOAUCTION) { + .@trade$ += "NoAuction|"; + } +} diff --git a/src/map/achievement.c b/src/map/achievement.c index 68fc8a983..7148acae8 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -772,6 +772,10 @@ static void achievement_validate_refine(struct map_session_data *sd, unsigned in criteria.goal = sd->status.inventory[idx].refine; + // achievement should not trigger if refine is 0 + if (criteria.goal == 0) + return; + /* Universal */ achievement->validate_type(sd, success ? ACH_EQUIP_REFINE_SUCCESS : ACH_EQUIP_REFINE_FAILURE, diff --git a/src/map/script.c b/src/map/script.c index 5eed58977..fbf842f18 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14415,6 +14415,9 @@ static BUILDIN(getiteminfo) case ITEMINFO_VIEWSPRITE: script_pushint(st, it->view_sprite); break; + case ITEMINFO_TRADE: + script_pushint(st, it->flag.trade_restriction); + break; default: ShowError("buildin_getiteminfo: Invalid item type %d.\n", n); script_pushint(st,-1); @@ -14681,6 +14684,9 @@ static BUILDIN(setiteminfo) case ITEMINFO_VIEWSPRITE: it->view_sprite = value; break; + case ITEMINFO_TRADE: + it->flag.trade_restriction = value; + break; default: ShowError("buildin_setiteminfo: invalid type %d.\n", n); script_pushint(st,-1); @@ -25859,6 +25865,7 @@ static void script_hardcoded_constants(void) script->set_constant("ITEMINFO_VIEWID", ITEMINFO_VIEWID, false, false); script->set_constant("ITEMINFO_MATK", ITEMINFO_MATK, false, false); script->set_constant("ITEMINFO_VIEWSPRITE", ITEMINFO_VIEWSPRITE, false, false); + script->set_constant("ITEMINFO_TRADE", ITEMINFO_TRADE, false, false); script->constdb_comment("monster skill states"); script->set_constant("MSS_ANY", MSS_ANY, false, false); @@ -25949,6 +25956,20 @@ static void script_hardcoded_constants(void) script->set_constant("FUNCTION_IS_LOCAL", FUNCTION_IS_LOCAL, false, false); script->set_constant("FUNCTION_IS_LABEL", FUNCTION_IS_LABEL, false, false); + script->constdb_comment("item trade restrictions"); + script->set_constant("ITR_NONE", ITR_NONE, false, false); + script->set_constant("ITR_NODROP", ITR_NODROP, false, false); + script->set_constant("ITR_NOTRADE", ITR_NOTRADE, false, false); + script->set_constant("ITR_PARTNEROVERRIDE", ITR_PARTNEROVERRIDE, false, false); + script->set_constant("ITR_NOSELLTONPC", ITR_NOSELLTONPC, false, false); + script->set_constant("ITR_NOCART", ITR_NOCART, false, false); + script->set_constant("ITR_NOSTORAGE", ITR_NOSTORAGE, false, false); + script->set_constant("ITR_NOGSTORAGE", ITR_NOGSTORAGE, false, false); + script->set_constant("ITR_NOMAIL", ITR_NOMAIL, false, false); + script->set_constant("ITR_NOAUCTION", ITR_NOAUCTION, false, false); + script->set_constant("ITR_ALL", ITR_ALL, false, false); + + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 9c72b793c..72210b05b 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -450,6 +450,7 @@ enum script_iteminfo_types { ITEMINFO_VIEWID, ITEMINFO_MATK, ITEMINFO_VIEWSPRITE, + ITEMINFO_TRADE, ITEMINFO_MAX }; |