summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/npc.c10
-rw-r--r--src/map/pc.c93
-rw-r--r--src/map/skill.c6
6 files changed, 64 insertions, 55 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 8edeb9efb..252bb3aaf 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -872,7 +872,7 @@ int chrif_changedsex(int fd)
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
// remove specifical skills of Bard classes
for(i = 315; i <= 322; i++) {
- if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) {
+ if (sd->status.skill[i].id > 0 && sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) {
sd->status.skill_point += sd->status.skill[i].lv;
sd->status.skill[i].id = 0;
sd->status.skill[i].lv = 0;
@@ -880,7 +880,7 @@ int chrif_changedsex(int fd)
}
// remove specifical skills of Dancer classes
for(i = 323; i <= 330; i++) {
- if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) {
+ if (sd->status.skill[i].id > 0 && sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) {
sd->status.skill_point += sd->status.skill[i].lv;
sd->status.skill[i].id = 0;
sd->status.skill[i].lv = 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 61bc46402..8a667bb72 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4198,7 +4198,7 @@ int clif_skillinfoblock(struct map_session_data *sd)
WFIFOW(fd,len+8) = skill_get_sp(id,sd->status.skill[i].lv);
WFIFOW(fd,len+10)= skill_get_range2(&sd->bl, id,sd->status.skill[i].lv);
safestrncpy((char*)WFIFOP(fd,len+12), skill_get_name(id), NAME_LENGTH);
- if(sd->status.skill[i].flag == 0)
+ if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT)
WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill_tree_get_max(id, sd->status.class_))? 1:0;
else
WFIFOB(fd,len+36) = 0;
@@ -4235,7 +4235,7 @@ int clif_addskill(struct map_session_data *sd, int id )
WFIFOW(fd,10) = skill_get_sp(id,sd->status.skill[id].lv);
WFIFOW(fd,12)= skill_get_range2(&sd->bl, id,sd->status.skill[id].lv);
safestrncpy((char*)WFIFOP(fd,14), skill_get_name(id), NAME_LENGTH);
- if( sd->status.skill[id].flag == 0 )
+ if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT )
WFIFOB(fd,38) = (sd->status.skill[id].lv < skill_tree_get_max(id, sd->status.class_))? 1:0;
else
WFIFOB(fd,38) = 0;
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 7bfb6081d..02db4ab5c 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -196,7 +196,7 @@ void merc_hom_skillup(struct homun_data *hd,int skillnum)
i = skillnum - HM_SKILLBASE;
if(hd->homunculus.skillpts > 0 &&
hd->homunculus.hskill[i].id &&
- hd->homunculus.hskill[i].flag == 0 && //Don't allow raising while you have granted skills. [Skotlex]
+ hd->homunculus.hskill[i].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex]
hd->homunculus.hskill[i].lv < merc_skill_tree_get_max(skillnum, hd->homunculus.class_)
)
{
diff --git a/src/map/npc.c b/src/map/npc.c
index 8bedeb669..0781cb44c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1369,8 +1369,9 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
// custom merchant shop exp bonus
if( battle_config.shop_exp > 0 && z > 0 && (skill = pc_checkskill(sd,MC_DISCOUNT)) > 0 )
{
- if( sd->status.skill[MC_DISCOUNT].flag != 0 )
- skill = sd->status.skill[MC_DISCOUNT].flag - 2;
+ if( sd->status.skill[MC_DISCOUNT].flag >= SKILL_FLAG_REPLACED_LV_0 )
+ skill = sd->status.skill[MC_DISCOUNT].flag - SKILL_FLAG_REPLACED_LV_0;
+
if( skill > 0 )
{
z = z * (double)skill * (double)battle_config.shop_exp/10000.;
@@ -1505,8 +1506,9 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
// custom merchant shop exp bonus
if( battle_config.shop_exp > 0 && z > 0 && ( skill = pc_checkskill(sd,MC_OVERCHARGE) ) > 0)
{
- if( sd->status.skill[MC_OVERCHARGE].flag != 0 )
- skill = sd->status.skill[MC_OVERCHARGE].flag - 2;
+ if( sd->status.skill[MC_OVERCHARGE].flag >= SKILL_FLAG_REPLACED_LV_0 )
+ skill = sd->status.skill[MC_OVERCHARGE].flag - SKILL_FLAG_REPLACED_LV_0;
+
if( skill > 0 )
{
z = z * (double)skill * (double)battle_config.shop_exp/10000.;
diff --git a/src/map/pc.c b/src/map/pc.c
index cb6405b22..0584b3c0d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1061,9 +1061,9 @@ int pc_reg_received(struct map_session_data *sd)
if (sd->cloneskill_id > 0) {
sd->status.skill[sd->cloneskill_id].id = sd->cloneskill_id;
sd->status.skill[sd->cloneskill_id].lv = pc_readglobalreg(sd,"CLONE_SKILL_LV");
- if (i < sd->status.skill[sd->cloneskill_id].lv)
+ if (sd->status.skill[sd->cloneskill_id].lv > i)
sd->status.skill[sd->cloneskill_id].lv = i;
- sd->status.skill[sd->cloneskill_id].flag = 13; //cloneskill flag
+ sd->status.skill[sd->cloneskill_id].flag = SKILL_FLAG_PLAGIARIZED;
}
}
@@ -1124,11 +1124,11 @@ static int pc_calc_skillpoint(struct map_session_data* sd)
if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) &&
!(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) //Do not count wedding/link skills. [Skotlex]
) {
- if(!sd->status.skill[i].flag)
+ if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT)
skill_point += skill;
- else if(sd->status.skill[i].flag > 2 && sd->status.skill[i].flag != 13) {
- skill_point += (sd->status.skill[i].flag - 2);
- }
+ else
+ if(sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0)
+ skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0);
}
}
}
@@ -1157,16 +1157,16 @@ int pc_calc_skilltree(struct map_session_data *sd)
for( i = 0; i < MAX_SKILL; i++ )
{
- if( sd->status.skill[i].flag != 13 ) //Don't touch plagiarized skills
+ if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) //Don't touch plagiarized skills
sd->status.skill[i].id = 0; //First clear skills.
}
for( i = 0; i < MAX_SKILL; i++ )
{
- if( sd->status.skill[i].flag && sd->status.skill[i].flag != 13 )
+ if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED )
{ // Restore original level of skills after deleting earned skills.
- sd->status.skill[i].lv = (sd->status.skill[i].flag == 1)?0:sd->status.skill[i].flag-2;
- sd->status.skill[i].flag = 0;
+ sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0;
+ sd->status.skill[i].flag = SKILL_FLAG_PERMANENT;
}
if( sd->sc.count && sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_BARDDANCER && i >= DC_HUMMING && i<= DC_SERVICEFORYOU )
@@ -1177,7 +1177,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
continue;
sd->status.skill[i].id = i;
sd->status.skill[i].lv = sd->status.skill[i-8].lv; // Set the level to the same as the linking skill
- sd->status.skill[i].flag = 1; // Tag it as a non-savable, non-uppable, bonus skill
+ sd->status.skill[i].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill
}
else
{ //Link bard skills to dancer.
@@ -1185,7 +1185,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
continue;
sd->status.skill[i-8].id = i - 8;
sd->status.skill[i-8].lv = sd->status.skill[i].lv; // Set the level to the same as the linking skill
- sd->status.skill[i-8].flag = 1; // Tag it as a non-savable, non-uppable, bonus skill
+ sd->status.skill[i-8].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill
}
}
}
@@ -1216,10 +1216,11 @@ int pc_calc_skilltree(struct map_session_data *sd)
for(j = 0; j < MAX_PC_SKILL_REQUIRE; j++) {
if((k=skill_tree[c][i].need[j].id))
{
- if (!sd->status.skill[k].id || sd->status.skill[k].flag == 13)
+ if (sd->status.skill[k].id == 0 || sd->status.skill[k].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[k].flag == SKILL_FLAG_PLAGIARIZED)
k = 0; //Not learned.
- else if (sd->status.skill[k].flag) //Real lerned level
- k = sd->status.skill[skill_tree[c][i].need[j].id].flag-2;
+ else
+ if (sd->status.skill[k].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
+ k = sd->status.skill[skill_tree[c][i].need[j].id].flag - SKILL_FLAG_REPLACED_LV_0;
else
k = pc_checkskill(sd,k);
if (k < skill_tree[c][i].need[j].lv)
@@ -1249,7 +1250,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
if(inf2&INF2_SPIRIT_SKILL)
{ //Spirit skills cannot be learned, they will only show up on your tree when you get buffed.
sd->status.skill[id].lv = 1; // need to manually specify a skill level
- sd->status.skill[id].flag = 1; //So it is not saved, and tagged as a "bonus" skill.
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY; //So it is not saved, and tagged as a "bonus" skill.
}
flag = 1; // skill list has changed, perform another pass
}
@@ -1273,10 +1274,12 @@ int pc_calc_skilltree(struct map_session_data *sd)
if( sd->status.skill[id].id == 0 )
{
sd->status.skill[id].id = id;
- sd->status.skill[id].flag = 1; // So it is not saved, and tagged as a "bonus" skill.
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY; // So it is not saved, and tagged as a "bonus" skill.
}
else
- sd->status.skill[id].flag = sd->status.skill[id].lv+2;
+ {
+ sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv; // Remember original level
+ }
sd->status.skill[id].lv = skill_tree_get_max(id, sd->status.class_);
}
@@ -1314,10 +1317,11 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill)
{
if( (k = skill_tree[c][i].need[j].id) )
{
- if( !sd->status.skill[k].id || sd->status.skill[k].flag == 13 )
+ if( sd->status.skill[k].id == 0 || sd->status.skill[k].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[k].flag == SKILL_FLAG_PLAGIARIZED )
k = 0; //Not learned.
- else if( sd->status.skill[k].flag ) //Real lerned level
- k = sd->status.skill[skill_tree[c][i].need[j].id].flag - 2;
+ else
+ if( sd->status.skill[k].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
+ k = sd->status.skill[skill_tree[c][i].need[j].id].flag - SKILL_FLAG_REPLACED_LV_0;
else
k = pc_checkskill(sd,k);
if( k < skill_tree[c][i].need[j].lv )
@@ -1352,13 +1356,15 @@ int pc_clean_skilltree(struct map_session_data *sd)
{
int i;
for (i = 0; i < MAX_SKILL; i++){
- if (sd->status.skill[i].flag == 13 || sd->status.skill[i].flag == 1)
+ if (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED)
{
sd->status.skill[i].id = 0;
sd->status.skill[i].lv = 0;
sd->status.skill[i].flag = 0;
- } else if (sd->status.skill[i].flag){
- sd->status.skill[i].lv = sd->status.skill[i].flag-2;
+ }
+ else
+ if (sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0){
+ sd->status.skill[i].lv = sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0;
sd->status.skill[i].flag = 0;
}
}
@@ -3060,8 +3066,8 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
case 0: //Set skill data overwriting whatever was there before.
sd->status.skill[id].id = id;
sd->status.skill[id].lv = level;
- sd->status.skill[id].flag = 0;
- if( !level ) //Remove skill.
+ sd->status.skill[id].flag = SKILL_FLAG_PERMANENT;
+ if( level == 0 ) //Remove skill.
{
sd->status.skill[id].id = 0;
clif_deleteskill(sd,id);
@@ -3075,21 +3081,21 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
if( sd->status.skill[id].id == id ){
if( sd->status.skill[id].lv >= level )
return 0;
- if( !sd->status.skill[id].flag ) //Non-granted skill, store it's level.
- sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
+ if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT ) //Non-granted skill, store it's level.
+ sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv;
} else {
sd->status.skill[id].id = id;
- sd->status.skill[id].flag = 1;
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY;
}
sd->status.skill[id].lv = level;
break;
case 2: //Add skill bonus on top of what you had.
if( sd->status.skill[id].id == id ){
- if( !sd->status.skill[id].flag ) // Store previous level.
- sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
+ if( sd->status.skill[id].flag == SKILL_FLAG_PERMANENT )
+ sd->status.skill[id].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[id].lv; // Store previous level.
} else {
sd->status.skill[id].id = id;
- sd->status.skill[id].flag = 1; //Set that this is a bonus skill.
+ sd->status.skill[id].flag = SKILL_FLAG_TEMPORARY; //Set that this is a bonus skill.
}
sd->status.skill[id].lv += level;
break;
@@ -5269,7 +5275,7 @@ int pc_skillup(struct map_session_data *sd,int skill_num)
if( sd->status.skill_point > 0 &&
sd->status.skill[skill_num].id &&
- sd->status.skill[skill_num].flag == 0 && //Don't allow raising while you have granted skills. [Skotlex]
+ sd->status.skill[skill_num].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex]
sd->status.skill[skill_num].lv < skill_tree_get_max(skill_num, sd->status.class_) )
{
sd->status.skill[skill_num].lv++;
@@ -5299,11 +5305,11 @@ int pc_allskillup(struct map_session_data *sd)
nullpo_ret(sd);
for(i=0;i<MAX_SKILL;i++){
- if (sd->status.skill[i].flag && sd->status.skill[i].flag != 13){
- sd->status.skill[i].lv=(sd->status.skill[i].flag==1)?0:sd->status.skill[i].flag-2;
- sd->status.skill[i].flag=0;
- if (!sd->status.skill[i].lv)
- sd->status.skill[i].id=0;
+ if (sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED) {
+ sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0;
+ sd->status.skill[i].flag = SKILL_FLAG_PERMANENT;
+ if (sd->status.skill[i].lv == 0)
+ sd->status.skill[i].id = 0;
}
}
@@ -5533,7 +5539,7 @@ int pc_resetskill(struct map_session_data* sd, int flag)
if( i == NV_BASIC && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE && (sd->class_&MAPID_UPPERMASK) != MAPID_BABY )
{ // Official server does not include Basic Skill to be resetted. [Jobbie]
sd->status.skill[i].lv = 9;
- sd->status.skill[i].flag = 0;
+ sd->status.skill[i].flag = SKILL_FLAG_PERMANENT;
continue;
}
@@ -5546,13 +5552,14 @@ int pc_resetskill(struct map_session_data* sd, int flag)
}
continue;
}
- if( !sd->status.skill[i].flag )
+ if( sd->status.skill[i].flag == SKILL_FLAG_PERMANENT )
skill_point += lv;
- else if( sd->status.skill[i].flag > 2 && sd->status.skill[i].flag != 13 )
- skill_point += (sd->status.skill[i].flag - 2);
+ else
+ if( sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0 )
+ skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0);
if( !(flag&2) )
- {
+ {// reset
sd->status.skill[i].lv = 0;
sd->status.skill[i].flag = 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 1eeb5f4ec..e16c8573c 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1820,11 +1820,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
&& (!sc || !sc->data[SC_PRESERVE])
&& damage < tsd->battle_status.hp)
{ //Updated to not be able to copy skills if the blow will kill you. [Skotlex]
- if ((!tsd->status.skill[skillid].id || tsd->status.skill[skillid].flag >= 13) &&
+ if ((tsd->status.skill[skillid].id == 0 || tsd->status.skill[skillid].flag == SKILL_FLAG_PLAGIARIZED) &&
can_copy(tsd,skillid,bl)) // Split all the check into their own function [Aru]
{
int lv = skilllv;
- if (tsd->cloneskill_id && tsd->status.skill[tsd->cloneskill_id].flag == 13){
+ if (tsd->cloneskill_id && tsd->status.skill[tsd->cloneskill_id].flag == SKILL_FLAG_PLAGIARIZED){
tsd->status.skill[tsd->cloneskill_id].id = 0;
tsd->status.skill[tsd->cloneskill_id].lv = 0;
tsd->status.skill[tsd->cloneskill_id].flag = 0;
@@ -1840,7 +1840,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
tsd->status.skill[skillid].id = skillid;
tsd->status.skill[skillid].lv = lv;
- tsd->status.skill[skillid].flag = 13;//cloneskill flag
+ tsd->status.skill[skillid].flag = SKILL_FLAG_PLAGIARIZED;
clif_addskill(tsd,skillid);
}
}