diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-22 14:14:41 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-22 14:14:41 +0000 |
commit | 77e8fe5ff4dfcfb999904a610e66fb959f650658 (patch) | |
tree | bbff8e1cfc12d45b2318d2cc4a89a5a30f080d13 /src/map/atcommand.c | |
parent | 1db8c4a322c26f54801304014ea8b6d88fe3f14c (diff) | |
download | hercules-77e8fe5ff4dfcfb999904a610e66fb959f650658.tar.gz hercules-77e8fe5ff4dfcfb999904a610e66fb959f650658.tar.bz2 hercules-77e8fe5ff4dfcfb999904a610e66fb959f650658.tar.xz hercules-77e8fe5ff4dfcfb999904a610e66fb959f650658.zip |
- Corrected autoloot so that you can specify rate with decimal precision ("@autoloot 0.01" should work)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7294 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 13e2ccee5..943676876 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7716,7 +7716,7 @@ atcommand_changeleader( int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
// autoloot command with value
- unsigned int rate;
+ int rate;
nullpo_retr(-1, sd);
@@ -7737,11 +7737,8 @@ int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* co }
}
- // autoloot command with value
- //unsigned int rate; // Moved to top due to decleration error after executional block. [Zido]
-
// get maximum droprate limit
- rate = atoi(message) * 100;
+ rate = (int)(atof(message) * 100);
// check for invalid value
if(rate > 10000)
@@ -7754,32 +7751,28 @@ int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* co if(rate == 0)
{
if(sd->state.autoloot == 0)
- {
clif_displaymessage(fd, "Autoloot is already off.");
- return 0;
- } else {
+ else {
clif_displaymessage(fd, "Autoloot is now off.");
sd->state.autoloot = 0;
- return 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.");
- return 0;
- } else {
+ else {
clif_displaymessage(fd, "Autoloot is now on.");
sd->state.autoloot = 10000;
- return 0;
}
+ return 0;
}
// autoloot value is between 0 and 100
- snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %d percent and below.", (rate / 100));
+ snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.", rate/100.);
clif_displaymessage(fd, atcmd_output);
sd->state.autoloot = rate;
|