summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/mmo.h2
-rw-r--r--src/map/atcommand.c18
-rw-r--r--src/map/itemdb.c7
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/status.c28
5 files changed, 33 insertions, 24 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 5f75f35da..349912a39 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -107,7 +107,7 @@
//Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
#define MAX_REG_NUM 256
#define DEFAULT_WALK_SPEED 150
-#define MIN_WALK_SPEED 0
+#define MIN_WALK_SPEED 20 /* below 20 clips animation */
#define MAX_WALK_SPEED 1000
#define MAX_STORAGE 600
#define MAX_GUILD_STORAGE 600
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 146159c63..758ebb0db 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -766,15 +766,21 @@ ACMD(speed)
return false;
}
- if (speed < 0) {
+ sd->state.permanent_speed = 0;
+
+ if (speed < 0)
sd->base_status.speed = DEFAULT_WALK_SPEED;
- sd->state.permanent_speed = 0; // Remove lock when set back to default speed.
- } else {
+ else
sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
- sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
- }
+
status_calc_bl(&sd->bl, SCB_SPEED);
- clif->message(fd, msg_txt(8)); // Speed changed.
+
+ if( sd->base_status.speed != DEFAULT_WALK_SPEED ) {
+ sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
+ clif->message(fd, msg_txt(8)); // Speed changed.
+ } else
+ clif->message(fd, msg_txt(172)); //Speed returned to normal.
+
return true;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index feb17ddc8..3fc8d526b 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1027,7 +1027,10 @@ void itemdb_read_packages(void) {
if( itemdb->packages[count].random_qty ) {
CREATE(itemdb->packages[count].random_groups, struct item_package_rand_group, itemdb->packages[count].random_qty);
for( c = 0; c < itemdb->packages[count].random_qty; c++ ) {
- CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
+ if( !rgroups[ i - 1 ][c] )
+ ShowError("itemdb_read_packages: package '%s' missing 'Random' field %d! there must not be gaps!\n",config_setting_name(itg),c+1);
+ else
+ CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
itemdb->packages[count].random_groups[c].random_qty = 0;
}
}
@@ -1090,7 +1093,7 @@ void itemdb_read_packages(void) {
itemdb->packages[count].random_groups[gidx].random_list[r].id = data ? data->nameid : 0;
itemdb->packages[count].random_groups[gidx].random_list[r].qty = icount;
if( (itemdb->packages[count].random_groups[gidx].random_list[r].rate = rate) == 10000 ) {
- ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
+ ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100%% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
}
itemdb->packages[count].random_groups[gidx].random_list[r].hours = expire;
itemdb->packages[count].random_groups[gidx].random_list[r].announce = announce == true ? 1 : 0;
diff --git a/src/map/map.c b/src/map/map.c
index b50297ca6..2a2f98bdc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1722,8 +1722,6 @@ int map_quit(struct map_session_data *sd) {
if( sd->state.storage_flag == 1 ) sd->state.storage_flag = 0; // No need to Double Save Storage on Quit.
- if (sd->state.permanent_speed == 1) sd->state.permanent_speed = 0; // Remove lock so speed is set back to normal at login.
-
if( sd->ed ) {
elemental->clean_effect(sd->ed);
unit->remove_map(&sd->ed->bl,CLR_TELEPORT,ALC_MARK);
diff --git a/src/map/status.c b/src/map/status.c
index 9e98b2801..0ff30595d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2389,11 +2389,17 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {
clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_CLAIRVOYANCE);
memset(&sd->special_state,0,sizeof(sd->special_state));
- memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
-
- //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
- if (!sd->state.permanent_speed)
+
+ if (!sd->state.permanent_speed) {
+ memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
bstatus->speed = DEFAULT_WALK_SPEED;
+ } else {
+ int pSpeed = bstatus->speed;
+ memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp)));
+ bstatus->speed = pSpeed;
+ }
+
+ //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex]
//Give them all modes except these (useful for clones)
bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
@@ -3670,6 +3676,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_SPEED) {
struct unit_data *ud = unit->bl2ud(bl);
+
st->speed = status->calc_speed(bl, sc, bst->speed);
//Re-walk to adjust speed (we do not check if walktimer != INVALID_TIMER
@@ -3678,13 +3685,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if (ud)
ud->state.change_walk_target = ud->state.speed_changed = 1;
- if( bl->type&BL_PC && st->speed < battle_config.max_walk_speed )
+ if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < battle_config.max_walk_speed )
st->speed = battle_config.max_walk_speed;
if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master)
st->speed = status->get_speed(&((TBL_HOM*)bl)->master->bl);
-
-
}
if(flag&SCB_CRI && bst->cri) {
@@ -5045,11 +5050,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
TBL_PC* sd = BL_CAST(BL_PC, bl);
int speed_rate;
- if( sc == NULL )
- return cap_value(speed,10,USHRT_MAX);
-
- if (sd && sd->state.permanent_speed)
- return (short)cap_value(speed,10,USHRT_MAX);
+ if( sc == NULL || ( sd && sd->state.permanent_speed ) )
+ return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED);
if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
{
@@ -5222,7 +5224,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
}
- return (short)cap_value(speed,10,USHRT_MAX);
+ return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED);
}
// flag&1 - fixed value [malufett]