diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-11 18:40:14 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-11 18:40:14 +0000 |
commit | 5abc71c7c7628c4e7691d2b629e5aa70cc528c76 (patch) | |
tree | 9648514e7316060c6a871e0e4e7ec28ccf899f9b /src/map/atcommand.c | |
parent | 74fe52db48a34b056bbe3f1806c9ffd237f67a44 (diff) | |
download | hercules-5abc71c7c7628c4e7691d2b629e5aa70cc528c76.tar.gz hercules-5abc71c7c7628c4e7691d2b629e5aa70cc528c76.tar.bz2 hercules-5abc71c7c7628c4e7691d2b629e5aa70cc528c76.tar.xz hercules-5abc71c7c7628c4e7691d2b629e5aa70cc528c76.zip |
- simplified the code for @autoloot
- made @hominfo display the six basic stats.
- Simplified the MD_DETECTOR checks, since now all insects/demons have it set, and it's no longer needed to check for the race.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9464 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 80 |
1 files changed, 24 insertions, 56 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9e7e398a6..2ee456a58 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8115,69 +8115,31 @@ atcommand_partyoption( */ int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* command, const char* message) { - // autoloot command with value int rate; - + double drate; nullpo_retr(-1, sd); - // autoloot command without value if(!message || !*message) { - // autoloot on -> off - if(sd->state.autoloot) - { - clif_displaymessage(fd, "Autoloot is now off."); - sd->state.autoloot = 0; - return 0; - // autoloot off -> on - } else { - clif_displaymessage(fd, "Autoloot is now on."); - sd->state.autoloot = 10000; - return 0; - } - } - - // get maximum droprate limit - rate = (int)(atof(message) * 100.); - - // check for invalid value - if(rate > 10000) - { - clif_displaymessage(fd, "Invalid value. Choose value between 0 and 100."); - return 0; - } - - // autoloot value is 0, turn autoloot off - if(rate == 0) - { - if(sd->state.autoloot == 0) - clif_displaymessage(fd, "Autoloot is already off."); - else { - clif_displaymessage(fd, "Autoloot is now off."); - sd->state.autoloot = 0; - } - return 0; - } - - // autoloot value is 100, turn autoloot on - if(rate == 10000) - { - if(sd->state.autoloot == 10000) - clif_displaymessage(fd, "Autoloot is already on."); - else { - clif_displaymessage(fd, "Autoloot is now on."); - sd->state.autoloot = 10000; - } - return 0; + if (sd->state.autoloot) + rate = 0; + else + rate = 10000; + } else { + drate = atof(message); + rate = (int)(drate*100); } - - // autoloot value is between 0 and 100 - snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.", rate/100.); - clif_displaymessage(fd, atcmd_output); + if (rate < 0) rate = 0; + if (rate > 10000) rate = 10000; + sd->state.autoloot = rate; - - return 0; -} + if (sd->state.autoloot) { + snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.",((double)sd->state.autoloot)/100.); + clif_displaymessage(fd, atcmd_output); + }else + clif_displaymessage(fd, "Autoloot is now off."); + return 0; +} /*========================================== @@ -9969,6 +9931,12 @@ int atcommand_hominfo( hd->homunculus.hunger, hd->homunculus.intimacy/100); clif_displaymessage(fd, atcmd_output); + snprintf(atcmd_output, sizeof(atcmd_output) , + "Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d", + status->str, status->agi, status->vit, + status->int_, status->dex, status->luk); + clif_displaymessage(fd, atcmd_output); + return 0; } |