From 5abc71c7c7628c4e7691d2b629e5aa70cc528c76 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 11 Dec 2006 18:40:14 +0000 Subject: - 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 --- src/map/atcommand.c | 80 ++++++++++++++++------------------------------------- src/map/skill.c | 2 +- src/map/status.c | 48 ++++++++++---------------------- 3 files changed, 40 insertions(+), 90 deletions(-) (limited to 'src') 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; } diff --git a/src/map/skill.c b/src/map/skill.c index 3c13187d6..c623edd7f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5691,7 +5691,6 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data) if (md->db->skill[md->skillidx].emotion >= 0) clif_emotion(src, md->db->skill[md->skillidx].emotion); } - } if(src != target && battle_config.skill_add_range && @@ -6286,6 +6285,7 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s if (sd && !(flag&1) && sd->state.arrow_atk) //Consume arrow if a ground skill was not invoked. [Skotlex] battle_consume_ammo(sd, skillid, skilllv); + return 0; } diff --git a/src/map/status.c b/src/map/status.c index dee934c8f..81837bef1 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1087,12 +1087,8 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int struct map_session_data *sd = (TBL_PC*) target; if (pc_isinvisible(sd)) return 0; - if (tsc->option&hide_flag && !(status->mode&MD_BOSS) - && (sd->special_state.perfect_hiding || !( - status->race == RC_INSECT || - status->race == RC_DEMON || - status->mode&MD_DETECTOR - ))) + if (tsc->option&hide_flag && !(status->mode&MD_BOSS) && + (sd->special_state.perfect_hiding || !(status->mode&MD_DETECTOR))) return 0; } break; @@ -1110,15 +1106,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 0; default: //Check for chase-walk/hiding/cloaking opponents. - if (tsc && !(status->mode&MD_BOSS)) - { - if (tsc->option&hide_flag && !( - status->race == RC_INSECT || - status->race == RC_DEMON || - status->mode&MD_DETECTOR - )) - return 0; - } + if (tsc && tsc->option&hide_flag && !(status->mode&MD_BOSS) && + !(status->mode&MD_DETECTOR)) + return 0; } return 1; } @@ -1144,32 +1134,24 @@ int status_check_visibility(struct block_list *src, struct block_list *target) return 0; switch (target->type) - { + { //Check for chase-walk/hiding/cloaking opponents. case BL_PC: { - if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) - && !(status->mode&MD_BOSS) && ( - ((TBL_PC*)target)->special_state.perfect_hiding || !( - status->race == RC_INSECT || - status->race == RC_DEMON || - status->mode&MD_DETECTOR - ))) + if(tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) && + !(status->mode&MD_BOSS) && + ( + ((TBL_PC*)target)->special_state.perfect_hiding || + !(status->mode&MD_DETECTOR) + )) return 0; } break; default: - //Check for chase-walk/hiding/cloaking opponents. - if (tsc && !(status->mode&MD_BOSS)) - { - if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) - && !( - status->race == RC_INSECT || - status->race == RC_DEMON || - status->mode&MD_DETECTOR - )) + if (tsc && tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) && + !(status->mode&MD_BOSS) && !(status->mode&MD_DETECTOR)) return 0; - } } + return 1; } -- cgit v1.2.3-70-g09d2