summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c11
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/unit.c7
3 files changed, 24 insertions, 6 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 017944942..378c44ab5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7231,6 +7231,17 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
sd->class_ = (unsigned short)b_class;
sd->status.job_level=1;
sd->status.job_exp=0;
+
+ if (sd->status.base_level > pc_maxbaselv(sd)) {
+ sd->status.base_level = pc_maxbaselv(sd);
+ sd->status.base_exp=0;
+ pc_resetstate(sd);
+ clif_updatestatus(sd,SP_STATUSPOINT);
+ clif_updatestatus(sd,SP_BASELEVEL);
+ clif_updatestatus(sd,SP_BASEEXP);
+ clif_updatestatus(sd,SP_NEXTBASEEXP);
+ }
+
clif_updatestatus(sd,SP_JOBLEVEL);
clif_updatestatus(sd,SP_JOBEXP);
clif_updatestatus(sd,SP_NEXTJOBEXP);
diff --git a/src/map/script.c b/src/map/script.c
index 55f6d0283..9c89943c8 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17268,9 +17268,9 @@ BUILDIN_FUNC(cleanmap)
return 0;
}
/* Cast a skill on the attached player.
- * useskilltopc <skill_id>, <skill_level>, <stat_point>, <npc_level>;
- * useskilltopc "<skill_name>", <skill_level>, <stat_point>, <npc_level>; */
-BUILDIN_FUNC(useskilltopc)
+ * npcskill <skill id>, <skill lvl>, <stat point>, <NPC level>;
+ * npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */
+BUILDIN_FUNC(npcskill)
{
unsigned int skill_id;
unsigned short skill_level;
@@ -17287,11 +17287,11 @@ BUILDIN_FUNC(useskilltopc)
nd = (struct npc_data *)map_id2bl(sd->npc_id);
if (stat_point > battle_config.max_third_parameter) {
- ShowError("useskilltopc: stat point exceeded maximum of %d.\n",battle_config.max_third_parameter );
+ ShowError("npcskill: stat point exceeded maximum of %d.\n",battle_config.max_third_parameter );
return 1;
}
if (npc_level > MAX_LEVEL) {
- ShowError("useskilltopc: level exceeded maximum of %d.\n", MAX_LEVEL);
+ ShowError("npcskill: level exceeded maximum of %d.\n", MAX_LEVEL);
return 1;
}
if (sd == NULL || nd == NULL) { //ain't possible, but I don't trust people.
@@ -17758,7 +17758,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getrandgroupitem,"ii"),
BUILDIN_DEF(cleanmap,"s"),
BUILDIN_DEF2(cleanmap,"cleanarea","siiii"),
- BUILDIN_DEF(useskilltopc,"viii"),
+ BUILDIN_DEF(npcskill,"viii"),
/**
* @commands (script based)
**/
diff --git a/src/map/unit.c b/src/map/unit.c
index 07b728f47..e1e9d9690 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1276,6 +1276,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv);
#endif
+ if (src->type == BL_NPC) { // NPC-objects do not have cast time
+ casttime = 0;
+ }
+
if(!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026
unit_stop_walking(src,1);// eventhough this is not how official works but this will do the trick. bugreport:6829
// in official this is triggered even if no cast time.
@@ -1439,6 +1443,9 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv );
#endif
+ if (src->type == BL_NPC) { // NPC-objects do not have cast time
+ casttime = 0;
+ }
ud->state.skillcastcancel = castcancel&&casttime>0?1:0;
if( !sd || sd->skillitem != skill_num || skill_get_cast(skill_num,skill_lv) )