diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-05 01:23:07 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-03-05 01:23:07 -0300 |
commit | 7e2c0f9b57850d441c28bcdad9c0bb682a36ca2d (patch) | |
tree | cf7d756f4e8fb1d8ed3f9f6b0b6834e0dcd631d0 | |
parent | b2c76ecee4b7e25235787f7936317d80a0420d65 (diff) | |
download | serverdata-7e2c0f9b57850d441c28bcdad9c0bb682a36ca2d.tar.gz serverdata-7e2c0f9b57850d441c28bcdad9c0bb682a36ca2d.tar.bz2 serverdata-7e2c0f9b57850d441c28bcdad9c0bb682a36ca2d.tar.xz serverdata-7e2c0f9b57850d441c28bcdad9c0bb682a36ca2d.zip |
Even more helper functions so the code is easily recycable
-rw-r--r-- | npc/012-8/doorbell.txt | 2 | ||||
-rw-r--r-- | npc/functions/estate.txt | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/npc/012-8/doorbell.txt b/npc/012-8/doorbell.txt index 45722fb3f..d2e97aaff 100644 --- a/npc/012-8/doorbell.txt +++ b/npc/012-8/doorbell.txt @@ -159,7 +159,7 @@ L_Furniture: // in other words, .@id handles everything now .@id=@valid_ids[@menu-1]; - if ($ESTATE_MOBILIA_2[.id] & .objid[.@id]) { + if (realestate_hasmobilia(.id, .layer[.@id], .objid[.@id])) { // If you have the mobilia, you're selling it for Mobiliary Credits .@price=realestate_sellprice(.id,.price[.@i]); realestate_togglemobilia(.id, .layer[.@id], .objid[.@id]); diff --git a/npc/functions/estate.txt b/npc/functions/estate.txt index 6e040d376..5eb508e1b 100644 --- a/npc/functions/estate.txt +++ b/npc/functions/estate.txt @@ -65,3 +65,27 @@ function script realestate_togglemobilia { return; } + +// Like the previous function, but returns true if player have said mobilia +// realestate_hasmobilia ( estate_id, layer_id, object_id ) +function script realestate_hasmobilia { + switch (getarg(1)) { + case 1: + return $ESTATE_MOBILIA_128[getarg(0)] & getarg(2); + case 2: + return $ESTATE_MOBILIA_4[getarg(0)] & getarg(2); + case 3: + return $ESTATE_MOBILIA_8[getarg(0)] & getarg(2); + case 4: + return $ESTATE_MOBILIA_32[getarg(0)] & getarg(2); + case 5: + return $ESTATE_MOBILIA_64[getarg(0)] & getarg(2); + case 6: + return $ESTATE_MOBILIA_2[getarg(0)] & getarg(2); + default: + debugmes("[ERROR] [CRITICAL] [REAL ESTATE]: Object %d have Invalid Collision Type: %d (must range 1~6)", getarg(2), getarg(1)); + return false; + } + return false; +} + |