diff options
author | gumi <mekolat@users.noreply.github.com> | 2016-12-06 14:23:19 -0500 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2016-12-07 17:05:02 +0100 |
commit | 135f7b4555e851fe00f24ba4157d3bb177c7b52e (patch) | |
tree | 801ae730d9900e5071d91f893cd9ca7b8d64e9ac /npc | |
parent | 7ebc17f8b4ba8cb03a6251084bd896ac5a6fdc06 (diff) | |
download | serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.gz serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.bz2 serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.xz serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.zip |
simplify inventoryplace
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/inventoryplace.txt | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/npc/functions/inventoryplace.txt b/npc/functions/inventoryplace.txt index 02c28b1c..e92ec579 100644 --- a/npc/functions/inventoryplace.txt +++ b/npc/functions/inventoryplace.txt @@ -9,42 +9,29 @@ function script inventoryplace { - function inventoryplace_warn { - narrator - l("It looks like you can't carry anything else for now."), - l("You should come back when you have some free space."); - - bye; - } - .@argc = getargcount(); - if (.@argc < 2) + if (.@argc % 2 != 0) { - debugmes "Wrong argument count."; + debugmes "inventoryplace: Wrong argument count."; + close; } - else if (.@argc == 2) + + for (.@i = .@j = 0; .@i < .@argc; .@i += 2) { - if (!checkweight(getarg(0), getarg(1))) - { - inventoryplace_warn(); - } + setarray .@item[.@j], getarg(.@i); + setarray .@amount[.@j], getarg(.@i + 1); + ++.@j; } - else - { - for (.@i = .@j = 0; .@i < .@argc; .@i += 2) - { - setarray .@item[.@j], getarg(.@i); - setarray .@amount[.@j], getarg(.@i + 1); - .@j++; - } + if (!checkweight2(.@item, .@amount)) + { + narrator 1, + l("It looks like you can't carry anything else for now."), + l("You should come back when you have some free space."); - if (!checkweight2(.@item, .@amount)) - { - inventoryplace_warn(); - } + close; } - return; + return true; } |