Add support for unsetting bit flag in item_noequip (Closes #1319).

* Unset the flag by passing in negative value.
* Thanks to @Everade
This commit is contained in:
Jittapan Pluemsumran 2016-05-28 00:20:08 +07:00
parent 38155a625e
commit 5287f82a0e
No known key found for this signature in database
GPG Key ID: CE430096446F41D9
4 changed files with 15 additions and 1 deletions

View File

@ -18,10 +18,13 @@
// 1024 - restricted in zone 6
// 2048 - restricted in zone 7
//
// Passing negative value as flag will unset the flag instead.
//
// Examples:
// 1201,1 // Knife can't be worn on normal maps
// 608,4 // Yggdrasil Seed can't be consumed in both GvG and WoE Castles
// 4174,6 // Deviling Card has no effect in every PVP or GVG map, and during WoE
// 501,32 // Red Potion can't be consumed on maps marked as 'restricted zone 1'
// 519,322 // Milk can't be consumed in PVP and maps marked as 'restricted zone 2' or 'restricted zone 4' (256+64+2)
// 519,-2 // Unset `restricted in PVP` flag from Milk. Making it usable in PVP again.

View File

@ -18,12 +18,15 @@
// 1024 - restricted in zone 6
// 2048 - restricted in zone 7
//
// Passing negative value as flag will unset the flag instead.
//
// Examples:
// 1201,1 // Knife can't be worn on normal maps
// 608,4 // Yggdrasil Seed can't be consumed in both GvG and WoE Castles
// 4174,6 // Deviling Card has no effect in every PVP or GVG map, and during WoE
// 501,32 // Red Potion can't be consumed on maps marked as 'restricted zone 1'
// 519,322 // Milk can't be consumed in PVP and maps marked as 'restricted zone 2' or 'restricted zone 4' (256+64+2)
// 519,-2 // Unset `restricted in PVP` flag from Milk. Making it usable in PVP again.
//----------------------------------------------------------------------------
// Normal maps

View File

@ -18,12 +18,15 @@
// 1024 - restricted in zone 6
// 2048 - restricted in zone 7
//
// Passing negative value as flag will unset the flag instead.
//
// Examples:
// 1201,1 // Knife can't be worn on normal maps
// 608,4 // Yggdrasil Seed can't be consumed in both GvG and WoE Castles
// 4174,6 // Deviling Card has no effect in every PVP or GVG map, and during WoE
// 501,32 // Red Potion can't be consumed on maps marked as 'restricted zone 1'
// 519,322 // Milk can't be consumed in PVP and maps marked as 'restricted zone 2' or 'restricted zone 4' (256+64+2)
// 519,-2 // Unset `restricted in PVP` flag from Milk. Making it usable in PVP again.
//----------------------------------------------------------------------------
// Normal maps

View File

@ -707,9 +707,11 @@ static void itemdb_read_itemgroup(const char* basedir, bool silent) {
*/
static bool itemdb_read_noequip(char* str[], int columns, int current) {
unsigned short nameid;
int flag;
struct item_data *id;
nameid = atoi(str[0]);
flag = atoi(str[1]);
if( ( id = itemdb_exists(nameid) ) == NULL )
{
@ -717,7 +719,10 @@ static bool itemdb_read_noequip(char* str[], int columns, int current) {
return false;
}
id->flag.no_equip |= atoi(str[1]);
if (flag >= 0)
id->flag.no_equip |= flag;
else
id->flag.no_equip &= ~abs(flag);
return true;
}