summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c91
-rw-r--r--src/map/battle.c88
-rw-r--r--src/map/battle.h14
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/clif.c20
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/elemental.h4
-rw-r--r--src/map/homunculus.h2
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/intif.h6
-rw-r--r--src/map/itemdb.h402
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/map.h18
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/mob.h11
-rw-r--r--src/map/path.h12
-rw-r--r--src/map/pc.c89
-rw-r--r--src/map/pc.h30
-rw-r--r--src/map/pet.h4
-rw-r--r--src/map/script.c21
-rw-r--r--src/map/script.h37
-rw-r--r--src/map/skill.c242
-rw-r--r--src/map/skill.h11
-rw-r--r--src/map/status.c109
-rw-r--r--src/map/status.h106
25 files changed, 786 insertions, 549 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a2bea32a8..3b06140d4 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -164,38 +164,32 @@ ACMD(send)
clif->message(fd, msg_txt(i));
return false;
}
-
-#define PARSE_ERROR(error,p) \
-{\
-clif->message(fd, (error));\
-sprintf(atcmd_output, ">%s", (p));\
-clif->message(fd, atcmd_output);\
-}
- //define PARSE_ERROR
-
-#define CHECK_EOS(p) \
-if(*(p) == 0){\
-clif->message(fd, "Unexpected end of string");\
-return false;\
-}
- //define CHECK_EOS
-
-#define SKIP_VALUE(p) \
-{\
-while(*(p) && !ISSPACE(*(p))) ++(p); /* non-space */\
-while(*(p) && ISSPACE(*(p))) ++(p); /* space */\
-}
- //define SKIP_VALUE
-
-#define GET_VALUE(p,num) \
-{\
-if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
-PARSE_ERROR("Invalid number in:",(p));\
-return false;\
-}\
-}
- //define GET_VALUE
-
+
+#define PARSE_ERROR(error,p) do {\
+ clif->message(fd, (error));\
+ sprintf(atcmd_output, ">%s", (p));\
+ clif->message(fd, atcmd_output);\
+} while(0) //define PARSE_ERROR
+
+#define CHECK_EOS(p) do { \
+ if(*(p) == 0){ \
+ clif->message(fd, "Unexpected end of string");\
+ return false;\
+ } \
+} while(0) //define CHECK_EOS
+
+#define SKIP_VALUE(p) do { \
+ while(*(p) && !ISSPACE(*(p))) ++(p); /* non-space */\
+ while(*(p) && ISSPACE(*(p))) ++(p); /* space */\
+} while(0) //define SKIP_VALUE
+
+#define GET_VALUE(p,num) do { \
+ if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
+ PARSE_ERROR("Invalid number in:",(p));\
+ return false;\
+ }\
+} while(0) //define GET_VALUE
+
if (type > 0 && type < MAX_PACKET_DB) {
if(len)
@@ -1931,11 +1925,11 @@ ACMD(monster)
number = battle_config.atc_spawn_quantity_limit;
if (strcmpi(info->command, "monstersmall") == 0)
- size = SZ_MEDIUM; // This is just gorgeous [mkbu95]
+ size = SZ_SMALL;
else if (strcmpi(info->command, "monsterbig") == 0)
size = SZ_BIG;
else
- size = SZ_SMALL;
+ size = SZ_MEDIUM;
if (battle_config.etc_log)
ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);
@@ -6255,7 +6249,7 @@ ACMD(summon)
return false;
}
- md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_MEDIUM, AI_NONE);
if(!md)
return false;
@@ -7311,15 +7305,15 @@ ACMD(size)
{
int size = 0;
- size = cap_value(atoi(message),SZ_SMALL,SZ_BIG);
+ size = cap_value(atoi(message),SZ_MEDIUM,SZ_BIG);
if(sd->state.size) {
- sd->state.size = SZ_SMALL;
+ sd->state.size = SZ_MEDIUM;
pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
sd->state.size = size;
- if( size == SZ_MEDIUM )
+ if( size == SZ_SMALL )
clif->specialeffect(&sd->bl,420,AREA);
else if( size == SZ_BIG )
clif->specialeffect(&sd->bl,422,AREA);
@@ -7341,12 +7335,12 @@ ACMD(sizeall)
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
if( pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
- pl_sd->state.size = SZ_SMALL;
+ pl_sd->state.size = SZ_MEDIUM;
pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
- if( size == SZ_MEDIUM )
+ if( size == SZ_SMALL )
clif->specialeffect(&pl_sd->bl,420,AREA);
else if( size == SZ_BIG )
clif->specialeffect(&pl_sd->bl,422,AREA);
@@ -7377,17 +7371,17 @@ ACMD(sizeguild)
return false;
}
- size = cap_value(size,SZ_SMALL,SZ_BIG);
+ size = cap_value(size,SZ_MEDIUM,SZ_BIG);
for( i = 0; i < g->max_member; i++ ) {
if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
- pl_sd->state.size = SZ_SMALL;
+ pl_sd->state.size = SZ_MEDIUM;
pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
- if( size == SZ_MEDIUM )
+ if( size == SZ_SMALL )
clif->specialeffect(&pl_sd->bl,420,AREA);
else if( size == SZ_BIG )
clif->specialeffect(&pl_sd->bl,422,AREA);
@@ -8585,10 +8579,11 @@ ACMD(unloadnpcfile) {
return true;
}
ACMD(cart) {
-#define MC_CART_MDFY(x,idx) \
-sd->status.skill[idx].id = x?MC_PUSHCART:0; \
-sd->status.skill[idx].lv = x?1:0; \
-sd->status.skill[idx].flag = x?1:0;
+#define MC_CART_MDFY(x,idx) do { \
+ sd->status.skill[idx].id = (x)?MC_PUSHCART:0; \
+ sd->status.skill[idx].lv = (x)?1:0; \
+ sd->status.skill[idx].flag = (x)?1:0; \
+} while(0)
int val = atoi(message);
bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true;
@@ -9616,6 +9611,8 @@ void atcommand_basecommands(void) {
return;
}
+#undef ACMD_DEF
+#undef ACMD_DEF2
bool atcommand_add(char *name,AtCommandFunc func, bool replace) {
AtCommandInfo* cmd;
diff --git a/src/map/battle.c b/src/map/battle.c
index 53544d66b..812301cd6 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -764,18 +764,18 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
if(sc->data[SC_IMPOSITIO])
damage += sc->data[SC_IMPOSITIO]->val2;
if(sc->data[SC_DRUMBATTLE]){
- if(tstatus->size == SZ_SMALL)
+ if(tstatus->size == SZ_MEDIUM)
damage += sc->data[SC_DRUMBATTLE]->val2;
- else if(tstatus->size == SZ_MEDIUM)
+ else if(tstatus->size == SZ_SMALL)
damage += 10 * sc->data[SC_DRUMBATTLE]->val1;
//else no bonus for large target
}
if(sc->data[SC_GS_MADNESSCANCEL])
damage += 100;
if(sc->data[SC_GS_GATLINGFEVER]){
- if(tstatus->size == SZ_SMALL)
+ if(tstatus->size == SZ_MEDIUM)
damage += 10 * sc->data[SC_GS_GATLINGFEVER]->val1;
- else if(tstatus->size == SZ_MEDIUM)
+ else if(tstatus->size == SZ_SMALL)
damage += -5 * sc->data[SC_GS_GATLINGFEVER]->val1;
else
damage += sc->data[SC_GS_GATLINGFEVER]->val1;
@@ -2200,8 +2200,8 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
break;
case NC_ARMSCANNON:
switch( tst->size ) {
- case SZ_SMALL: skillratio += 100 + 500 * skill_lv; break;// Small
- case SZ_MEDIUM: skillratio += 100 + 400 * skill_lv; break;// Medium
+ case SZ_MEDIUM: skillratio += 100 + 500 * skill_lv; break;// Medium
+ case SZ_SMALL: skillratio += 100 + 400 * skill_lv; break;// Small
case SZ_BIG: skillratio += 100 + 300 * skill_lv; break;// Large
}
RE_LVL_DMOD(100);
@@ -2414,21 +2414,21 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
case GN_SLINGITEM_RANGEMELEEATK:
if( sd ) {
switch( sd->itemid ) {
- case 13260: // Apple Bomob
- case 13261: // Coconut Bomb
- case 13262: // Melon Bomb
- case 13263: // Pinapple Bomb
- skillratio += 400; // Unconfirded
+ case ITEMID_APPLE_BOMB:
+ case ITEMID_COCONUT_BOMB:
+ case ITEMID_MELON_BOMB:
+ case ITEMID_PINEAPPLE_BOMB:
+ skillratio += 400; // Unconfirmed
break;
- case 13264: // Banana Bomb 2000%
+ case ITEMID_BANANA_BOMB: // 2000%
skillratio += 1900;
break;
- case 13265: skillratio -= 75; break; // Black Lump 25%
- case 13266: skillratio -= 25; break; // Hard Black Lump 75%
- case 13267: skillratio += 100; break; // Extremely Hard Black Lump 200%
+ case ITEMID_BLACK_LUMP: skillratio -= 75; break; // 25%
+ case ITEMID_BLACK_HARD_LUMP: skillratio -= 25; break; // 75%
+ case ITEMID_VERY_HARD_LUMP: skillratio += 100; break; // 200%
}
} else
- skillratio += 300; // Bombs
+ skillratio += 300; // Bombs
break;
case SO_VARETYR_SPEAR://ATK [{( Striking Level x 50 ) + ( Varetyr Spear Skill Level x 50 )} x Caster Base Level / 100 ] %
skillratio += -100 + 50 * skill_lv + ( sd ? pc->checkskill(sd, SO_STRIKING) * 50 : 0 );
@@ -3189,7 +3189,7 @@ int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) {
return 0;
}
//For quick div adjustment.
-#define damage_div_fix(dmg, div) { if (div > 1) (dmg)*=div; else if (div < 0) (div)*=-1; }
+#define damage_div_fix(dmg, div) do { if ((div) > 1) (dmg)*=(div); else if ((div) < 0) (div)*=-1; } while(0)
/*==========================================
* battle_calc_magic_attack [DracoRPG]
*------------------------------------------*/
@@ -3305,11 +3305,11 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
ad.damage = 0; //reinitialize..
#endif
//MATK_RATE scales the damage. 100 = no change. 50 is halved, 200 is doubled, etc
-#define MATK_RATE( a ) { ad.damage= ad.damage*(a)/100; }
+#define MATK_RATE( a ) ( ad.damage= ad.damage*(a)/100 )
//Adds dmg%. 100 = +100% (double) damage. 10 = +10% damage
-#define MATK_ADDRATE( a ) { ad.damage+= ad.damage*(a)/100; }
+#define MATK_ADDRATE( a ) ( ad.damage+= ad.damage*(a)/100 )
//Adds an absolute value to damage. 100 = +100 damage
-#define MATK_ADD( a ) { ad.damage+= a; }
+#define MATK_ADD( a ) ( ad.damage+= (a) )
switch (skill_id)
{ //Calc base damage according to skill
@@ -3499,6 +3499,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
}
return ad;
+#undef MATK_RATE
+#undef MATK_ADDRATE
+#undef MATK_ADD
}
/*==========================================
@@ -4359,19 +4362,19 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
//Assuming that 99% of the cases we will not need to check for the flag.rh... we don't.
//ATK_RATE scales the damage. 100 = no change. 50 is halved, 200 is doubled, etc
-#define ATK_RATE( a ) { wd.damage= wd.damage*(a)/100 ; if(flag.lh) wd.damage2= wd.damage2*(a)/100; }
-#define ATK_RATE2( a , b ) { wd.damage= wd.damage*(a)/100 ; if(flag.lh) wd.damage2= wd.damage2*(b)/100; }
-#define ATK_RATER(a){ wd.damage = wd.damage*(a)/100;}
-#define ATK_RATEL(a){ wd.damage2 = wd.damage2*(a)/100;}
+#define ATK_RATE( a ) do { int64 temp__ = (a); wd.damage= wd.damage*temp__/100 ; if(flag.lh) wd.damage2= wd.damage2*temp__/100; } while(0)
+#define ATK_RATE2( a , b ) do { wd.damage= wd.damage*(a)/100 ; if(flag.lh) wd.damage2= wd.damage2*(b)/100; } while(0)
+#define ATK_RATER(a) ( wd.damage = wd.damage*(a)/100 )
+#define ATK_RATEL(a) ( wd.damage2 = wd.damage2*(a)/100 )
//Adds dmg%. 100 = +100% (double) damage. 10 = +10% damage
-#define ATK_ADDRATE( a ) { wd.damage+= wd.damage*(a)/100 ; if(flag.lh) wd.damage2+= wd.damage2*(a)/100; }
-#define ATK_ADDRATE2( a , b ) { wd.damage+= wd.damage*(a)/100 ; if(flag.lh) wd.damage2+= wd.damage2*(b)/100; }
+#define ATK_ADDRATE( a ) do { int64 temp__ = (a); wd.damage+= wd.damage*temp__/100; if(flag.lh) wd.damage2+= wd.damage2*temp__/100; } while(0)
+#define ATK_ADDRATE2( a , b ) do { wd.damage+= wd.damage*(a)/100 ; if(flag.lh) wd.damage2+= wd.damage2*(b)/100; } while(0)
//Adds an absolute value to damage. 100 = +100 damage
-#define ATK_ADD( a ) { wd.damage+= a; if (flag.lh) wd.damage2+= a; }
-#define ATK_ADD2( a , b ) { wd.damage+= a; if (flag.lh) wd.damage2+= b; }
+#define ATK_ADD( a ) do { int64 temp__ = (a); wd.damage += temp__; if (flag.lh) wd.damage2 += temp__; } while(0)
+#define ATK_ADD2( a , b ) do { wd.damage += (a); if (flag.lh) wd.damage2 += (b); } while(0)
#ifdef RENEWAL
-#define GET_NORMAL_ATTACK( f ) { wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, f, wd.flag); }
-#define GET_NORMAL_ATTACK2( f ) { wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, f, wd.flag); }
+#define GET_NORMAL_ATTACK( f ) ( wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (f), wd.flag) )
+#define GET_NORMAL_ATTACK2( f ) ( wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (f), wd.flag) )
#endif
switch (skill_id)
{ //Calc base damage according to skill
@@ -4438,10 +4441,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
i*=i;
ATK_ADD(i); //Add str bonus.
switch (tstatus->size) { //Size-fix. Is this modified by weapon perfection?
- case SZ_SMALL: //Small: 125%
+ case SZ_MEDIUM: //Medium: 125%
ATK_RATE(125);
break;
- //case SZ_MEDIUM: //Medium: 100%
+ //case SZ_SMALL: //Medium: 100%
case SZ_BIG: //Large: 75%
ATK_RATE(75);
break;
@@ -4566,7 +4569,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
ATK_ADD(sd->inventory_data[index]->weight * 7 / 100);
switch (tstatus->size) {
- case SZ_SMALL: //Small: 115%
+ case SZ_MEDIUM: //Medium: 115%
ATK_RATE(115);
break;
case SZ_BIG: //Large: 85%
@@ -5070,7 +5073,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
)) &&
rnd()%100 < tsc->data[SC_SWORDREJECT]->val2
) {
- ATK_RATER(50)
+ ATK_RATER(50);
status_fix_damage(target,src,wd.damage,clif->damage(target,src,timer->gettick(),0,0,wd.damage,0,0,0));
clif->skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_SWORDREJECT]->val1,1);
if( --(tsc->data[SC_SWORDREJECT]->val3) <= 0 )
@@ -5147,9 +5150,9 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
sc = status->get_sc(bl);
#ifdef RENEWAL
-#define NORMALIZE_RDAMAGE(d){ trdamage += rdamage = max(1, min(max_reflect_damage, d)); }
+#define NORMALIZE_RDAMAGE(d) ( trdamage += rdamage = max(1, min(max_reflect_damage, (d))) )
#else
-#define NORMALIZE_RDAMAGE(d){ trdamage += rdamage = max(1, d); }
+#define NORMALIZE_RDAMAGE(d) ( trdamage += rdamage = max(1, (d)) )
#endif
if( sc && sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){
@@ -5214,6 +5217,7 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
}
return max(0, trdamage);
+#undef NORMALIZE_RDAMAGE
}
void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss)
@@ -5468,7 +5472,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if( sc && sc->count ) {
if (sc->data[SC_EXEEDBREAK]) {
- ATK_RATER(sc->data[SC_EXEEDBREAK]->val1)
+ ATK_RATER(sc->data[SC_EXEEDBREAK]->val1);
status_change_end(src, SC_EXEEDBREAK, INVALID_TIMER);
}
if( sc->data[SC_SPELLFIST] ) {
@@ -5670,6 +5674,16 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
map->freeblock_unlock();
return wd.dmg_lv;
}
+#undef ATK_RATE
+#undef ATK_RATE2
+#undef ATK_RATER
+#undef ATK_RATEL
+#undef ATK_ADDRATE
+#undef ATK_ADDRATE2
+#undef ATK_ADD
+#undef ATK_ADD2
+#undef GET_NORMAL_ATTACK
+#undef GET_NORMAL_ATTACK2
int battle_check_undead(int race,int element)
{
diff --git a/src/map/battle.h b/src/map/battle.h
index fd6699f4d..a8b291818 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -21,14 +21,14 @@ struct status_data;
/**
* Defines
**/
-#define MIN_HAIR_STYLE battle_config.min_hair_style
-#define MAX_HAIR_STYLE battle_config.max_hair_style
-#define MIN_HAIR_COLOR battle_config.min_hair_color
-#define MAX_HAIR_COLOR battle_config.max_hair_color
-#define MIN_CLOTH_COLOR battle_config.min_cloth_color
-#define MAX_CLOTH_COLOR battle_config.max_cloth_color
+#define MIN_HAIR_STYLE (battle_config.min_hair_style)
+#define MAX_HAIR_STYLE (battle_config.max_hair_style)
+#define MIN_HAIR_COLOR (battle_config.min_hair_color)
+#define MAX_HAIR_COLOR (battle_config.max_hair_color)
+#define MIN_CLOTH_COLOR (battle_config.min_cloth_color)
+#define MAX_CLOTH_COLOR (battle_config.max_cloth_color)
-#define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru]
+#define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru]
/**
* Enumerations
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 5927e31bf..e9c3bbabf 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -88,7 +88,7 @@ struct chrif_interface chrif_s;
//2b27: Incoming, chrif_authfail -> 'client authentication failed'
//This define should spare writing the check in every function. [Skotlex]
-#define chrif_check(a) { if(!chrif->isconnected()) return a; }
+#define chrif_check(a) do { if(!chrif->isconnected()) return a; } while(0)
/// Resets all the data.
void chrif_reset(void) {
diff --git a/src/map/clif.c b/src/map/clif.c
index 32f29b73c..913f55784 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1332,7 +1332,7 @@ int clif_spawn(struct block_list *bl)
clif->spiritball(&sd->bl);
if(sd->state.size==SZ_BIG) // tiny/big players [Valaris]
clif->specialeffect(bl,423,AREA);
- else if(sd->state.size==SZ_MEDIUM)
+ else if(sd->state.size==SZ_SMALL)
clif->specialeffect(bl,421,AREA);
if( sd->bg_id && map->list[sd->bl.m].flag.battleground )
clif->sendbgemblem_area(sd);
@@ -1352,7 +1352,7 @@ int clif_spawn(struct block_list *bl)
TBL_MOB *md = ((TBL_MOB*)bl);
if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
clif->specialeffect(&md->bl,423,AREA);
- else if(md->special_state.size==SZ_MEDIUM)
+ else if(md->special_state.size==SZ_SMALL)
clif->specialeffect(&md->bl,421,AREA);
}
break;
@@ -1361,7 +1361,7 @@ int clif_spawn(struct block_list *bl)
TBL_NPC *nd = ((TBL_NPC*)bl);
if( nd->size == SZ_BIG )
clif->specialeffect(&nd->bl,423,AREA);
- else if( nd->size == SZ_MEDIUM )
+ else if( nd->size == SZ_SMALL )
clif->specialeffect(&nd->bl,421,AREA);
}
break;
@@ -1560,7 +1560,7 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u
// clif_movepc(sd);
if(sd->state.size==SZ_BIG) // tiny/big players [Valaris]
clif->specialeffect(&sd->bl,423,AREA);
- else if(sd->state.size==SZ_MEDIUM)
+ else if(sd->state.size==SZ_SMALL)
clif->specialeffect(&sd->bl,421,AREA);
}
break;
@@ -1569,7 +1569,7 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u
TBL_MOB *md = ((TBL_MOB*)bl);
if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
clif->specialeffect(&md->bl,423,AREA);
- else if(md->special_state.size==SZ_MEDIUM)
+ else if(md->special_state.size==SZ_SMALL)
clif->specialeffect(&md->bl,421,AREA);
}
break;
@@ -4268,7 +4268,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
clif->getareachar_pc(sd, tsd);
if(tsd->state.size==SZ_BIG) // tiny/big players [Valaris]
clif->specialeffect_single(bl,423,sd->fd);
- else if(tsd->state.size==SZ_MEDIUM)
+ else if(tsd->state.size==SZ_SMALL)
clif->specialeffect_single(bl,421,sd->fd);
if( tsd->bg_id && map->list[tsd->bl.m].flag.battleground )
clif->sendbgemblem_single(sd->fd,tsd);
@@ -4287,7 +4287,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
clif->dispchat((struct chat_data*)map->id2bl(nd->chat_id),sd->fd);
if( nd->size == SZ_BIG )
clif->specialeffect_single(bl,423,sd->fd);
- else if( nd->size == SZ_MEDIUM )
+ else if( nd->size == SZ_SMALL )
clif->specialeffect_single(bl,421,sd->fd);
}
break;
@@ -4296,7 +4296,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
TBL_MOB* md = (TBL_MOB*)bl;
if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
clif->specialeffect_single(bl,423,sd->fd);
- else if(md->special_state.size==SZ_MEDIUM)
+ else if(md->special_state.size==SZ_SMALL)
clif->specialeffect_single(bl,421,sd->fd);
#if PACKETVER >= 20120404
if( !(md->status.mode&MD_BOSS) ){
@@ -18201,8 +18201,8 @@ void packetdb_loaddb(void) {
memset(packet_db,0,sizeof(packet_db));
- #define packet(id, size, ...) packetdb_addpacket(id, size, ##__VA_ARGS__, 0xFFFF)
- #define packetKeys(a,b,c) { clif->cryptKey[0] = a; clif->cryptKey[1] = b; clif->cryptKey[2] = c; }
+ #define packet(id, size, ...) packetdb_addpacket((id), (size), ##__VA_ARGS__, 0xFFFF)
+ #define packetKeys(a,b,c) do { clif->cryptKey[0] = (a); clif->cryptKey[1] = (b); clif->cryptKey[2] = (c); } while(0)
#include "packets.h" /* load structure data */
#undef packet
#undef packetKeys
diff --git a/src/map/clif.h b/src/map/clif.h
index 88f3383d1..76d52311f 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -45,7 +45,7 @@ struct skill_cd;
**/
#define packet_len(cmd) packet_db[cmd].len
#define P2PTR(fd) RFIFO2PTR(fd)
-#define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
+#define clif_menuskill_clear(sd) ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0)
#define HCHSYS_NAME_LENGTH 20
/**
diff --git a/src/map/elemental.h b/src/map/elemental.h
index 8ffffa5e3..830a6a577 100644
--- a/src/map/elemental.h
+++ b/src/map/elemental.h
@@ -21,8 +21,8 @@
#define EL_SKILLMODE_ASSIST 0x2
#define EL_SKILLMODE_AGGRESSIVE 0x4
-#define elemental_stop_walking(ed, type) unit->stop_walking(&(ed)->bl, type)
-#define elemental_stop_attack(ed) unit->stop_attack(&(ed)->bl)
+#define elemental_stop_walking(ed, type) (unit->stop_walking(&(ed)->bl, (type)))
+#define elemental_stop_attack(ed) (unit->stop_attack(&(ed)->bl))
/**
* Structures
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index b7906d4c8..117f9da8e 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -10,7 +10,7 @@
#include "pc.h"
#define MAX_HOM_SKILL_REQUIRE 5
-#define homdb_checkid(id) (id >= HM_CLASS_BASE && id <= HM_CLASS_MAX)
+#define homdb_checkid(id) ((id) >= HM_CLASS_BASE && (id) <= HM_CLASS_MAX)
#define homun_alive(x) ((x) && (x)->homunculus.vaporize == HOM_ST_ACTIVE && (x)->battle_status.hp > 0)
struct h_stats {
diff --git a/src/map/intif.c b/src/map/intif.c
index e6ff91af7..36ae753db 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -35,7 +35,7 @@
struct intif_interface intif_s;
-#define inter_fd chrif->fd // alias
+#define inter_fd (chrif->fd) // alias
//-----------------------------------------------------------------
// Send to inter server
diff --git a/src/map/intif.h b/src/map/intif.h
index 5e996b6fe..d0dfd25cd 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -22,9 +22,9 @@ struct auction_data;
/**
* Defines
**/
-#define intif_rename_pc(sd, name) intif->rename(sd, 0, name)
-#define intif_rename_pet(sd, name) intif->rename(sd, 1, name)
-#define intif_rename_hom(sd, name) intif->rename(sd, 2, name)
+#define intif_rename_pc(sd, name) (intif->rename((sd), 0, (name)))
+#define intif_rename_pet(sd, name) (intif->rename((sd), 1, (name)))
+#define intif_rename_hom(sd, name) (intif->rename((sd), 2, (name)))
#define INTIF_PACKET_LEN_TABLE_SIZE 161
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 3f31c79d4..1030035ea 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -28,75 +28,292 @@ struct item_package;
#define CARD0_PET ((short)0xFF00)
//Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
-#define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET)
+#define itemdb_isspecial(i) ((i) == CARD0_FORGE || (i) == CARD0_CREATE || (i) == CARD0_PET)
//Use apple for unknown items.
#define UNKNOWN_ITEM_ID 512
enum item_itemid {
- ITEMID_HOLY_WATER = 523,
- ITEMID_EMPERIUM = 714,
- ITEMID_YELLOW_GEMSTONE = 715,
- ITEMID_RED_GEMSTONE = 716,
- ITEMID_BLUE_GEMSTONE = 717,
- ITEMID_TRAP = 1065,
- ITEMID_STRANGE_EMBRYO = 6415,
- ITEMID_FACE_PAINT = 6120,
- ITEMID_STONE = 7049,
- ITEMID_SKULL_ = 7420,
- ITEMID_TOKEN_OF_SIEGFRIED = 7621,
- ITEMID_TRAP_ALLOY = 7940,
- ITEMID_ANCILLA = 12333,
- ITEMID_REINS_OF_MOUNT = 12622,
- ITEMID_LOVE_ANGEL = 12287,
- ITEMID_SQUIRREL = 12288,
- ITEMID_GOGO = 12289,
- ITEMID_PICTURE_DIARY = 12304,
- ITEMID_MINI_HEART = 12305,
- ITEMID_NEWCOMER = 12306,
- ITEMID_KID = 12307,
- ITEMID_MAGIC_CASTLE = 12308,
- ITEMID_BULGING_HEAD = 12309,
+ ITEMID_RED_POTION = 501,
+ ITEMID_YELLOW_POTION = 503,
+ ITEMID_WHITE_POTION = 504,
+ ITEMID_BLUE_POTION = 505,
+ ITEMID_HOLY_WATER = 523,
+ ITEMID_RED_SLIM_POTION = 545,
+ ITEMID_YELLOW_SLIM_POTION = 546,
+ ITEMID_WHITE_SLIM_POTION = 547,
+ ITEMID_WING_OF_FLY = 601,
+ ITEMID_WING_OF_BUTTERFLY = 602,
+ ITEMID_BRANCH_OF_DEAD_TREE = 604,
+ ITEMID_ANODYNE = 605,
+ ITEMID_ALOEBERA = 606,
+ ITEMID_EMPTY_BOTTLE = 713,
+ ITEMID_EMPERIUM = 714,
+ ITEMID_YELLOW_GEMSTONE = 715,
+ ITEMID_RED_GEMSTONE = 716,
+ ITEMID_BLUE_GEMSTONE = 717,
+ ITEMID_ORIDECON_STONE = 756,
+ ITEMID_ALCHOL = 970,
+ ITEMID_ORIDECON = 984,
+ ITEMID_BOODY_RED = 990,
+ ITEMID_CRYSTAL_BLUE = 991,
+ ITEMID_WIND_OF_VERDURE = 992,
+ ITEMID_YELLOW_LIVE = 993,
+ ITEMID_FLAME_HEART = 994,
+ ITEMID_MISTIC_FROZEN = 995,
+ ITEMID_ROUGH_WIND = 996,
+ ITEMID_GREAT_NATURE = 997,
+ ITEMID_IRON = 998,
+ ITEMID_STEEL = 999,
+ ITEMID_STAR_CRUMB = 1000,
+ ITEMID_IRON_ORE = 1002,
+ ITEMID_PHRACON = 1010,
+ ITEMID_EMVERETARCON = 1011,
+ ITEMID_TRAP = 1065,
+ ITEMID_STRANGE_EMBRYO = 6415,
+ ITEMID_FACE_PAINT = 6120,
+ ITEMID_STONE = 7049,
+ ITEMID_FIRE_BOTTLE = 7135,
+ ITEMID_ACID_BOTTLE = 7136,
+ ITEMID_MENEATER_PLANT_BOTTLE = 7137,
+ ITEMID_MINI_BOTTLE = 7138,
+ ITEMID_COATING_BOTTLE = 7139,
+ ITEMID_FRAGMENT_OF_CRYSTAL = 7321,
+ ITEMID_SKULL_ = 7420,
+ ITEMID_TOKEN_OF_SIEGFRIED = 7621,
+ ITEMID_TRAP_ALLOY = 7940,
+ ITEMID_RED_POUCH_OF_SURPRISE = 12024,
+ ITEMID_BLOODY_DEAD_BRANCH = 12103,
+ ITEMID_PORING_BOX = 12109,
+ ITEMID_MERCENARY_RED_POTION = 12184,
+ ITEMID_MERCENARY_BLUE_POTION = 12185,
+ ITEMID_BATTLE_MANUAL = 12208,
+ ITEMID_BUBBLE_GUM = 12210,
+ ITEMID_GIANT_FLY_WING = 12212,
+ ITEMID_NEURALIZER = 12213,
+ ITEMID_M_CENTER_POTION = 12241,
+ ITEMID_M_AWAKENING_POTION = 12242,
+ ITEMID_M_BERSERK_POTION = 12243,
+ ITEMID_COMP_BATTLE_MANUAL = 12263,
+ ITEMID_COMP_BUBBLE_GUM = 12264,
+ ITEMID_LOVE_ANGEL = 12287,
+ ITEMID_SQUIRREL = 12288,
+ ITEMID_GOGO = 12289,
+ ITEMID_PICTURE_DIARY = 12304,
+ ITEMID_MINI_HEART = 12305,
+ ITEMID_NEWCOMER = 12306,
+ ITEMID_KID = 12307,
+ ITEMID_MAGIC_CASTLE = 12308,
+ ITEMID_BULGING_HEAD = 12309,
+ ITEMID_THICK_MANUAL50 = 12312,
+ ITEMID_ANCILLA = 12333,
+ ITEMID_BLACK_THING = 12435,
+ ITEMID_REINS_OF_MOUNT = 12622,
+ ITEMID_NOBLE_NAMEPLATE = 12705,
+ ITEMID_DUN_TELE_SCROLL1 = 14527,
+ ITEMID_BATTLE_MANUAL25 = 14532,
+ ITEMIDBATTLE_MANUAL100 = 14533,
+ ITEMID_BATTLE_MANUAL_X3 = 14545,
+ ITEMID_DUN_TELE_SCROLL2 = 14581,
+ ITEMID_WOB_RUNE = 14582,
+ ITEMID_WOB_SCHWALTZ = 14583,
+ ITEMID_WOB_RACHEL = 14584,
+ ITEMID_WOB_LOCAL = 14585,
+ ITEMID_SIEGE_TELEPORT_SCROLL = 14591,
+ ITEMID_JOB_MANUAL50 = 14592,
+};
+
+enum cards_item_list {
+ ITEMID_GHOSTRING_CARD = 4047,
+ ITEMID_PHREEONI_CARD = 4121,
+ ITEMID_MISTRESS_CARD = 4132,
+ ITEMID_ORC_LOAD_CARD = 4135,
+ ITEMID_ORC_HERO_CARD = 4143,
+ ITEMID_TAO_GUNKA_CARD = 4302,
};
/**
- * Rune Knight
+ * Mechanic
**/
+enum mechanic_item_list {
+ ITEMID_ACCELERATOR = 2800,
+ ITEMID_HOVERING_BOOSTER, // 2801
+ ITEMID_SUICIDAL_DEVICE, // 2802
+ ITEMID_SHAPE_SHIFTER, // 2803
+ ITEMID_COOLING_DEVICE, // 2804
+ ITEMID_MAGNETIC_FIELD_GENERATOR, // 2805
+ ITEMID_BARRIER_BUILDER, // 2806
+ ITEMID_REPAIR_KIT, // 2807
+ ITEMID_CAMOUFLAGE_GENERATOR, // 2808
+ ITEMID_HIGH_QUALITY_COOLER, // 2809
+ ITEMID_SPECIAL_COOLER, // 2810
+ ITEMID_MONKEY_SPANNER = 6186,
+};
+
+/**
+ * Spell Books
+ */
+enum spell_book_item_list {
+ ITEMID_MAGIC_BOOK_FB = 6189,
+ ITEMID_MAGIC_BOOK_CB, // 6190
+ ITEMID_MAGIC_BOOK_LB, // 6191
+ ITEMID_MAGIC_BOOK_SG, // 6192
+ ITEMID_MAGIC_BOOK_LOV, // 6193
+ ITEMID_MAGIC_BOOK_MS, // 6194
+ ITEMID_MAGIC_BOOK_CM, // 6195
+ ITEMID_MAGIC_BOOK_TV, // 6196
+ ITEMID_MAGIC_BOOK_TS, // 6197
+ ITEMID_MAGIC_BOOK_JT, // 6198
+ ITEMID_MAGIC_BOOK_WB, // 6199
+ ITEMID_MAGIC_BOOK_HD, // 6200
+ ITEMID_MAGIC_BOOK_ES, // 6201
+ ITEMID_MAGIC_BOOK_ES_, // 6202
+ ITEMID_MAGIC_BOOK_CL, // 6203
+ ITEMID_MAGIC_BOOK_CR, // 6204
+ ITEMID_MAGIC_BOOK_DL, // 6205
+};
-enum {
- ITEMID_NAUTHIZ = 12725,
- ITEMID_RAIDO,
- ITEMID_BERKANA,
- ITEMID_ISA,
- ITEMID_OTHILA,
- ITEMID_URUZ,
- ITEMID_THURISAZ,
- ITEMID_WYRD,
- ITEMID_HAGALAZ,
- ITEMID_LUX_ANIMA = 22540,
-} rune_list;
+/**
+ * Mercenary Scrolls
+ */
+enum mercenary_scroll_item_list {
+ ITEMID_BOW_MERCENARY_SCROLL1 = 12153,
+ ITEMID_BOW_MERCENARY_SCROLL2, // 12154
+ ITEMID_BOW_MERCENARY_SCROLL3, // 12155
+ ITEMID_BOW_MERCENARY_SCROLL4, // 12156
+ ITEMID_BOW_MERCENARY_SCROLL5, // 12157
+ ITEMID_BOW_MERCENARY_SCROLL6, // 12158
+ ITEMID_BOW_MERCENARY_SCROLL7, // 12159
+ ITEMID_BOW_MERCENARY_SCROLL8, // 12160
+ ITEMID_BOW_MERCENARY_SCROLL9, // 12161
+ ITEMID_BOW_MERCENARY_SCROLL10, // 12162
+ ITEMID_SWORDMERCENARY_SCROLL1, // 12163
+ ITEMID_SWORDMERCENARY_SCROLL2, // 12164
+ ITEMID_SWORDMERCENARY_SCROLL3, // 12165
+ ITEMID_SWORDMERCENARY_SCROLL4, // 12166
+ ITEMID_SWORDMERCENARY_SCROLL5, // 12167
+ ITEMID_SWORDMERCENARY_SCROLL6, // 12168
+ ITEMID_SWORDMERCENARY_SCROLL7, // 12169
+ ITEMID_SWORDMERCENARY_SCROLL8, // 12170
+ ITEMID_SWORDMERCENARY_SCROLL9, // 12171
+ ITEMID_SWORDMERCENARY_SCROLL10, // 12172
+ ITEMID_SPEARMERCENARY_SCROLL1, // 12173
+ ITEMID_SPEARMERCENARY_SCROLL2, // 12174
+ ITEMID_SPEARMERCENARY_SCROLL3, // 12175
+ ITEMID_SPEARMERCENARY_SCROLL4, // 12176
+ ITEMID_SPEARMERCENARY_SCROLL5, // 12177
+ ITEMID_SPEARMERCENARY_SCROLL6, // 12178
+ ITEMID_SPEARMERCENARY_SCROLL7, // 12179
+ ITEMID_SPEARMERCENARY_SCROLL8, // 12180
+ ITEMID_SPEARMERCENARY_SCROLL9, // 12181
+ ITEMID_SPEARMERCENARY_SCROLL10, // 12182
+};
/**
- * Mechanic
+ * Cash Food
+ */
+enum cash_food_item_list {
+ ITEMID_STR_DISH10_ = 12202,
+ ITEMID_AGI_DISH10_, // 12203
+ ITEMID_INT_DISH10_, // 12204
+ ITEMID_DEX_DISH10_, // 12205
+ ITEMID_LUK_DISH10_, // 12206
+ ITEMID_VIT_DISH10_, // 12207
+};
+
+/**
+ * GC Poison
+ */
+enum poison_item_list {
+ ITEMID_POISON_PARALYSIS = 12717,
+ ITEMID_POISON_LEECH, // 12718
+ ITEMID_POISON_OBLIVION, // 12719
+ ITEMID_POISON_CONTAMINATION, // 12720
+ ITEMID_POISON_NUMB, // 12721
+ ITEMID_POISON_FEVER, // 12722
+ ITEMID_POISON_LAUGHING, // 12723
+ ITEMID_POISON_FATIGUE, // 12724
+};
+
+
+/**
+ * Rune Knight
**/
-enum {
- ITEMID_ACCELERATOR = 2800,
- ITEMID_HOVERING_BOOSTER,
- ITEMID_SUICIDAL_DEVICE,
- ITEMID_SHAPE_SHIFTER,
- ITEMID_COOLING_DEVICE,
- ITEMID_MAGNETIC_FIELD_GENERATOR,
- ITEMID_BARRIER_BUILDER,
- ITEMID_REPAIR_KIT,
- ITEMID_CAMOUFLAGE_GENERATOR,
- ITEMID_HIGH_QUALITY_COOLER,
- ITEMID_SPECIAL_COOLER,
- ITEMID_MONKEY_SPANNER = 6186,
-} mecha_item_list;
-
-enum {
+enum rune_item_list {
+ ITEMID_NAUTHIZ = 12725,
+ ITEMID_RAIDO, // 12726
+ ITEMID_BERKANA, // 12727
+ ITEMID_ISA, // 12728
+ ITEMID_OTHILA, // 12729
+ ITEMID_URUZ, // 12730
+ ITEMID_THURISAZ, // 12731
+ ITEMID_WYRD, // 12732
+ ITEMID_HAGALAZ, // 12733
+ ITEMID_LUX_ANIMA = 22540,
+};
+
+/**
+ * Geneticist
+ */
+enum geneticist_item_list {
+ /// Pharmacy / Cooking
+ ITEMID_SEED_OF_HORNY_PLANT = 6210,
+ ITEMID_BLOODSUCK_PLANT_SEED, // 6211
+ ITEMID_BOMB_MUSHROOM_SPORE, // 6212
+ ITEMID_HP_INCREASE_POTIONS = 12422,
+ ITEMID_HP_INCREASE_POTIONM, // 12423
+ ITEMID_HP_INCREASE_POTIONL, // 12424
+ ITEMID_SP_INCREASE_POTIONS, // 12425
+ ITEMID_SP_INCREASE_POTIONM, // 12426
+ ITEMID_SP_INCREASE_POTIONL, // 12427
+ ITEMID_ENRICH_WHITE_POTIONZ, // 12428
+ ITEMID_SAVAGE_BBQ, // 12429
+ ITEMID_WUG_BLOOD_COCKTAIL, // 12430
+ ITEMID_MINOR_BRISKET, // 12431
+ ITEMID_SIROMA_ICETEA, // 12432
+ ITEMID_DROCERA_HERB_STEW, // 12433
+ ITEMID_PETTI_TAIL_NOODLE, // 12434
+ ITEMID_VITATA500, // 12436
+ ITEMID_ENRICH_CELERMINE_JUICE, // 12437
+ ITEMID_CURE_FREE, // 12475
+ /// Bombs
+ ITEMID_APPLE_BOMB = 13260,
+ ITEMID_COCONUT_BOMB, // 13261
+ ITEMID_MELON_BOMB, // 13262
+ ITEMID_PINEAPPLE_BOMB, // 13263
+ ITEMID_BANANA_BOMB, // 13264
+ ITEMID_BLACK_LUMP, // 13265
+ ITEMID_BLACK_HARD_LUMP, // 13266
+ ITEMID_VERY_HARD_LUMP, // 13267
+ /// Throwables
+ ITEMID_MYSTERIOUS_POWDER, // 13268
+ ITEMID_BOOST500_TO_THROW, // 13269
+ ITEMID_FULL_SWINGK_TO_THROW, // 13270
+ ITEMID_MANA_PLUS_TO_THROW, // 13271
+ ITEMID_CURE_FREE_TO_THROW, // 13272
+ ITEMID_STAMINA_UP_M_TO_THROW, // 13273
+ ITEMID_DIGESTIVE_F_TO_THROW, // 13274
+ ITEMID_HP_INC_POTS_TO_THROW, // 13275
+ ITEMID_HP_INC_POTM_TO_THROW, // 13276
+ ITEMID_HP_INC_POTL_TO_THROW, // 13277
+ ITEMID_SP_INC_POTS_TO_THROW, // 13278
+ ITEMID_SP_INC_POTM_TO_THROW, // 13279
+ ITEMID_SP_INC_POTL_TO_THROW, // 13280
+ ITEMID_EN_WHITE_POTZ_TO_THROW, // 13281
+ ITEMID_VITATA500_TO_THROW, // 13282
+ ITEMID_EN_CEL_JUICE_TO_THROW, // 13283
+ ITEMID_SAVAGE_BBQ_TO_THROW, // 13284
+ ITEMID_WUG_COCKTAIL_TO_THROW, // 13285
+ ITEMID_M_BRISKET_TO_THROW, // 13286
+ ITEMID_SIROMA_ICETEA_TO_THROW, // 13287
+ ITEMID_DROCERA_STEW_TO_THROW, // 13288
+ ITEMID_PETTI_NOODLE_TO_THROW, // 13289
+ ITEMID_BLACK_THING_TO_THROW, // 13290
+};
+
+enum item_nouse_list {
NOUSE_SITTING = 0x01,
-} item_nouse_list;
+};
//
enum e_chain_cache {
@@ -236,44 +453,45 @@ struct item_package {
unsigned short must_qty;
};
-#define itemdb_name(n) itemdb->search(n)->name
-#define itemdb_jname(n) itemdb->search(n)->jname
-#define itemdb_type(n) itemdb->search(n)->type
-#define itemdb_atk(n) itemdb->search(n)->atk
-#define itemdb_def(n) itemdb->search(n)->def
-#define itemdb_look(n) itemdb->search(n)->look
-#define itemdb_weight(n) itemdb->search(n)->weight
-#define itemdb_equip(n) itemdb->search(n)->equip
-#define itemdb_usescript(n) itemdb->search(n)->script
-#define itemdb_equipscript(n) itemdb->search(n)->script
-#define itemdb_wlv(n) itemdb->search(n)->wlv
-#define itemdb_range(n) itemdb->search(n)->range
-#define itemdb_slot(n) itemdb->search(n)->slot
-#define itemdb_available(n) (itemdb->search(n)->flag.available)
-#define itemdb_viewid(n) (itemdb->search(n)->view_id)
-#define itemdb_autoequip(n) (itemdb->search(n)->flag.autoequip)
-#define itemdb_is_rune(n) ((n >= ITEMID_NAUTHIZ && n <= ITEMID_HAGALAZ) || n == ITEMID_LUX_ANIMA)
-#define itemdb_is_element(n) (n >= 990 && n <= 993)
-#define itemdb_is_spellbook(n) (n >= 6188 && n <= 6205)
-#define itemdb_is_poison(n) (n >= 12717 && n <= 12724)
-#define itemid_isgemstone(id) ( (id) >= ITEMID_YELLOW_GEMSTONE && (id) <= ITEMID_BLUE_GEMSTONE )
-#define itemdb_iscashfood(id) ( (id) >= 12202 && (id) <= 12207 )
-#define itemdb_is_GNbomb(n) (n >= 13260 && n <= 13267)
-#define itemdb_is_GNthrowable(n) (n >= 13268 && n <= 13290)
-
-#define itemdb_value_buy(n) itemdb->search(n)->value_buy
-#define itemdb_value_sell(n) itemdb->search(n)->value_sell
-#define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine)
+#define itemdb_name(n) (itemdb->search(n)->name)
+#define itemdb_jname(n) (itemdb->search(n)->jname)
+#define itemdb_type(n) (itemdb->search(n)->type)
+#define itemdb_atk(n) (itemdb->search(n)->atk)
+#define itemdb_def(n) (itemdb->search(n)->def)
+#define itemdb_look(n) (itemdb->search(n)->look)
+#define itemdb_weight(n) (itemdb->search(n)->weight)
+#define itemdb_equip(n) (itemdb->search(n)->equip)
+#define itemdb_usescript(n) (itemdb->search(n)->script)
+#define itemdb_equipscript(n) (itemdb->search(n)->script)
+#define itemdb_wlv(n) (itemdb->search(n)->wlv)
+#define itemdb_range(n) (itemdb->search(n)->range)
+#define itemdb_slot(n) (itemdb->search(n)->slot)
+#define itemdb_available(n) (itemdb->search(n)->flag.available)
+#define itemdb_viewid(n) (itemdb->search(n)->view_id)
+#define itemdb_autoequip(n) (itemdb->search(n)->flag.autoequip)
+#define itemdb_value_buy(n) (itemdb->search(n)->value_buy)
+#define itemdb_value_sell(n) (itemdb->search(n)->value_sell)
+#define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine)
+
+#define itemdb_is_rune(n) (((n) >= ITEMID_NAUTHIZ && (n) <= ITEMID_HAGALAZ) || (n) == ITEMID_LUX_ANIMA)
+#define itemdb_is_element(n) ((n) >= ITEMID_BOODY_RED && (n) <= ITEMID_YELLOW_LIVE)
+#define itemdb_is_spellbook(n) ((n) >= ITEMID_MAGIC_BOOK_FB && (n) <= ITEMID_MAGIC_BOOK_DL)
+#define itemdb_is_poison(n) ((n) >= ITEMID_POISON_PARALYSIS && (n) <= ITEMID_POISON_FATIGUE)
+#define itemid_isgemstone(n) ((n) >= ITEMID_YELLOW_GEMSTONE && (n) <= ITEMID_BLUE_GEMSTONE)
+#define itemdb_iscashfood(n) ((n) >= ITEMID_STR_DISH10_ && (n) <= ITEMID_VIT_DISH10_)
+#define itemdb_is_GNbomb(n) ((n) >= ITEMID_APPLE_BOMB && (n) <= ITEMID_VERY_HARD_LUMP)
+#define itemdb_is_GNthrowable(n) ((n) >= ITEMID_MYSTERIOUS_POWDER && (n) <= ITEMID_BLACK_THING_TO_THROW)
+
//Item trade restrictions [Skotlex]
-#define itemdb_isdropable(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->isdropable_sub)
-#define itemdb_cantrade(item, gmlv, gmlv2) itemdb->isrestricted(item, gmlv, gmlv2, itemdb->cantrade_sub)
-#define itemdb_canpartnertrade(item, gmlv, gmlv2) itemdb->isrestricted(item, gmlv, gmlv2, itemdb->canpartnertrade_sub)
-#define itemdb_cansell(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->cansell_sub)
-#define itemdb_cancartstore(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->cancartstore_sub)
-#define itemdb_canstore(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->canstore_sub)
-#define itemdb_canguildstore(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canguildstore_sub)
-#define itemdb_canmail(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canmail_sub)
-#define itemdb_canauction(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canauction_sub)
+#define itemdb_isdropable(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->isdropable_sub))
+#define itemdb_cantrade(item, gmlv, gmlv2) (itemdb->isrestricted((item), (gmlv), (gmlv2), itemdb->cantrade_sub))
+#define itemdb_canpartnertrade(item, gmlv, gmlv2) (itemdb->isrestricted((item), (gmlv), (gmlv2), itemdb->canpartnertrade_sub))
+#define itemdb_cansell(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->cansell_sub))
+#define itemdb_cancartstore(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->cancartstore_sub))
+#define itemdb_canstore(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->canstore_sub))
+#define itemdb_canguildstore(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->canguildstore_sub))
+#define itemdb_canmail(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->canmail_sub))
+#define itemdb_canauction(item, gmlv) (itemdb->isrestricted((item), (gmlv), 0, itemdb->canauction_sub))
struct itemdb_interface {
void (*init) (bool minimal);
diff --git a/src/map/map.c b/src/map/map.c
index 17648a661..099d2c6ea 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2095,9 +2095,7 @@ struct s_mapiterator
/// @param _bl_ block_list
/// @return true if it matches
#define MAPIT_MATCHES(_mapit_,_bl_) \
- ( \
- ( (_bl_)->type & (_mapit_)->types /* type matches */ ) \
- )
+ ( (_bl_)->type & (_mapit_)->types /* type matches */ )
/// Allocates a new iterator.
/// Returns the new iterator.
diff --git a/src/map/map.h b/src/map/map.h
index 4cb00f144..6580d7e50 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -26,7 +26,7 @@ enum E_MAPSERVER_ST {
};
#define MAX_NPC_PER_MAP 512
-#define AREA_SIZE battle_config.area_size
+#define AREA_SIZE (battle_config.area_size)
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
#define MAX_MOBSKILL 50
@@ -39,7 +39,7 @@ enum E_MAPSERVER_ST {
#define MAX_LEVEL 150
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
-#define MAX_MAP_SIZE 512*512 // Wasn't there something like this already? Can't find it.. [Shinryo]
+#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
#define BLOCK_SIZE 8
#define block_free_max 1048576
@@ -221,7 +221,7 @@ enum {
#define CHAT_SIZE_MAX (255 + 1)
// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
-#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
+#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000)
// Specifies maps where players may hit each other
#define map_flag_vs(m) (map->list[m].flag.pvp || map->list[m].flag.gvg_dungeon || map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) || map->list[m].flag.battleground)
// Specifies maps that have special GvG/WoE restrictions
@@ -724,7 +724,7 @@ struct map_data_other_server {
uint16 port;
};
-#define map_id2index(id) map->list[(id)].index
+#define map_id2index(id) (map->list[(id)].index)
/// Bitfield of flags for the iterator.
enum e_mapitflags {
@@ -747,11 +747,11 @@ struct mapit_interface {
struct mapit_interface *mapit;
-#define mapit_getallusers() mapit->alloc(MAPIT_NORMAL,BL_PC)
-#define mapit_geteachpc() mapit->alloc(MAPIT_NORMAL,BL_PC)
-#define mapit_geteachmob() mapit->alloc(MAPIT_NORMAL,BL_MOB)
-#define mapit_geteachnpc() mapit->alloc(MAPIT_NORMAL,BL_NPC)
-#define mapit_geteachiddb() mapit->alloc(MAPIT_NORMAL,BL_ALL)
+#define mapit_getallusers() (mapit->alloc(MAPIT_NORMAL,BL_PC))
+#define mapit_geteachpc() (mapit->alloc(MAPIT_NORMAL,BL_PC))
+#define mapit_geteachmob() (mapit->alloc(MAPIT_NORMAL,BL_MOB))
+#define mapit_geteachnpc() (mapit->alloc(MAPIT_NORMAL,BL_NPC))
+#define mapit_geteachiddb() (mapit->alloc(MAPIT_NORMAL,BL_ALL))
//Useful typedefs from jA [Skotlex]
typedef struct map_session_data TBL_PC;
diff --git a/src/map/mob.c b/src/map/mob.c
index c3c6fceee..b41dedac1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -52,7 +52,7 @@ struct mob_interface mob_s;
#define MOB_LAZYSKILLPERC 0 // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute)
// Move probability for mobs away from players (rate of 1000 minute)
// in Aegis, this is 100% for mobs that have been activated by players and none otherwise.
-#define MOB_LAZYMOVEPERC(md) (md->state.spotted?1000:0)
+#define MOB_LAZYMOVEPERC(md) ((md)->state.spotted?1000:0)
#define MOB_MAX_DELAY (24*3600*1000)
#define MAX_MINCHASE 30 //Max minimum chase value to use for mobs.
#define RUDE_ATTACKED_COUNT 2 //After how many rude-attacks should the skill be used?
@@ -2183,7 +2183,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
// change experience for different sized monsters [Valaris]
if (battle_config.mob_size_influence) {
switch( md->special_state.size ) {
- case SZ_MEDIUM:
+ case SZ_SMALL:
per /= 2.;
break;
case SZ_BIG:
@@ -2304,7 +2304,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
// change drops depending on monsters size [Valaris]
if (battle_config.mob_size_influence)
{
- if (md->special_state.size == SZ_MEDIUM && drop_rate >= 2)
+ if (md->special_state.size == SZ_SMALL && drop_rate >= 2)
drop_rate /= 2;
else if( md->special_state.size == SZ_BIG)
drop_rate *= 2;
@@ -3470,7 +3470,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
sd->fd = fd;
//Finally, spawn it.
- md = mob->once_spawn_sub(&sd->bl, m, x, y, "--en--", class_, event, SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(&sd->bl, m, x, y, "--en--", class_, event, SZ_MEDIUM, AI_NONE);
if (!md) return 0; //Failed?
md->special_state.clone = 1;
diff --git a/src/map/mob.h b/src/map/mob.h
index 61f718c30..48a9f078e 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -37,7 +37,7 @@
#define MOB_CLONE_END MAX_MOB_DB
//Used to determine default enemy type of mobs (for use in eachinrange calls)
-#define DEFAULT_ENEMY_TYPE(md) (md->special_state.ai?BL_CHAR:BL_MOB|BL_PC|BL_HOM|BL_MER)
+#define DEFAULT_ENEMY_TYPE(md) ((md)->special_state.ai?BL_CHAR:BL_MOB|BL_PC|BL_HOM|BL_MER)
#define MAX_MOB_CHAT 250 //Max Skill's messages
@@ -63,8 +63,8 @@ enum MobDamageLogFlag
};
enum size {
- SZ_SMALL = 0,
- SZ_MEDIUM,
+ SZ_MEDIUM = 0,
+ SZ_SMALL,
SZ_BIG,
};
@@ -243,8 +243,9 @@ struct item_drop_list {
};
-#define mob_stop_walking(md, type) unit->stop_walking(&(md)->bl, type)
-#define mob_stop_attack(md) unit->stop_attack(&(md)->bl)
+#define mob_stop_walking(md, type) (unit->stop_walking(&(md)->bl, (type)))
+#define mob_stop_attack(md) (unit->stop_attack(&(md)->bl))
+
#define mob_is_battleground(md) ( map->list[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST)) )
#define mob_is_gvg(md) (map->list[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2) )
#define mob_is_treasure(md) (((md)->class_ >= MOBID_TREAS01 && (md)->class_ <= MOBID_TREAS40) || ((md)->class_ >= MOBID_TREAS41 && (md)->class_ <= MOBID_TREAS49))
diff --git a/src/map/path.h b/src/map/path.h
index e872c8877..a889a6409 100644
--- a/src/map/path.h
+++ b/src/map/path.h
@@ -23,13 +23,13 @@ struct shootpath_data {
int y[MAX_WALKPATH];
};
-#define check_distance_bl(bl1, bl2, distance) path->check_distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y, distance)
-#define check_distance_blxy(bl, x1, y1, distance) path->check_distance((bl)->x-(x1), (bl)->y-(y1), distance)
-#define check_distance_xy(x0, y0, x1, y1, distance) path->check_distance((x0)-(x1), (y0)-(y1), distance)
+#define check_distance_bl(bl1, bl2, distance) (path->check_distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y, distance))
+#define check_distance_blxy(bl, x1, y1, distance) (path->check_distance((bl)->x - (x1), (bl)->y - (y1), distance))
+#define check_distance_xy(x0, y0, x1, y1, distance) (path->check_distance((x0) - (x1), (y0) - (y1), distance))
-#define distance_bl(bl1, bl2) path->distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y)
-#define distance_blxy(bl, x1, y1) path->distance((bl)->x-(x1), (bl)->y-(y1))
-#define distance_xy(x0, y0, x1, y1) path->distance((x0)-(x1), (y0)-(y1))
+#define distance_bl(bl1, bl2) (path->distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y))
+#define distance_blxy(bl, x1, y1) (path->distance((bl)->x - (x1), (bl)->y - (y1)))
+#define distance_xy(x0, y0, x1, y1) (path->distance((x0) - (x1), (y0) - (y1)))
struct path_interface {
// calculates destination cell for knockback
diff --git a/src/map/pc.c b/src/map/pc.c
index b930ffaad..02b4d0692 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -938,12 +938,10 @@ int pc_isequip(struct map_session_data *sd,int n)
clif->msg(sd, 0x6ED);
return 0;
}
-#ifdef RENEWAL
if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax){
clif->msg(sd, 0x6ED);
return 0;
}
-#endif
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
@@ -4209,89 +4207,87 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 0; // You cannot use this item while sitting.
}
- switch( nameid ) //@TODO, lot oh harcoded nameid here
- {
- case 605: // Anodyne
+ switch( nameid ) { // TODO: Is there no better way to handle this, other than hardcoding item IDs?
+ case ITEMID_ANODYNE:
if( map_flag_gvg2(sd->bl.m) )
return 0;
- case 606:
+ case ITEMID_ALOEBERA:
if( pc_issit(sd) )
return 0;
break;
- case 601: // Fly Wing
- case 12212: // Giant Fly Wing
+ case ITEMID_WING_OF_FLY:
+ case ITEMID_GIANT_FLY_WING:
if( map->list[sd->bl.m].flag.noteleport || map_flag_gvg2(sd->bl.m) ) {
clif->skill_mapinfomessage(sd,0);
return 0;
}
- case 602: // ButterFly Wing
- case 14527: // Dungeon Teleport Scroll
- case 14581: // Dungeon Teleport Scroll
- case 14582: // Yellow Butterfly Wing
- case 14583: // Green Butterfly Wing
- case 14584: // Red Butterfly Wing
- case 14585: // Blue Butterfly Wing
- case 14591: // Siege Teleport Scroll
+ case ITEMID_WING_OF_BUTTERFLY:
+ case ITEMID_DUN_TELE_SCROLL1:
+ case ITEMID_DUN_TELE_SCROLL2:
+ case ITEMID_WOB_RUNE: // Yellow Butterfly Wing
+ case ITEMID_WOB_SCHWALTZ: // Green Butterfly Wing
+ case ITEMID_WOB_RACHEL: // Red Butterfly Wing
+ case ITEMID_WOB_LOCAL: // Blue Butterfly Wing
+ case ITEMID_SIEGE_TELEPORT_SCROLL:
if( sd->duel_group && !battle_config.duel_allow_teleport )
{
clif->message(sd->fd, msg_txt(663));
return 0;
}
- if( nameid != 601 && nameid != 12212 && map->list[sd->bl.m].flag.noreturn )
+ if( nameid != ITEMID_WING_OF_FLY && nameid != ITEMID_GIANT_FLY_WING && map->list[sd->bl.m].flag.noreturn )
return 0;
break;
- case 604: // Dead Branch
- case 12024: // Red Pouch
- case 12103: // Bloody Branch
- case 12109: // Poring Box
+ case ITEMID_BRANCH_OF_DEAD_TREE:
+ case ITEMID_RED_POUCH_OF_SURPRISE:
+ case ITEMID_BLOODY_DEAD_BRANCH:
+ case ITEMID_PORING_BOX:
if( map->list[sd->bl.m].flag.nobranch || map_flag_gvg2(sd->bl.m) )
return 0;
break;
- case 12210: // Bubble Gum
- case 12264: // Comp Bubble Gum
+ case ITEMID_BUBBLE_GUM:
+ case ITEMID_COMP_BUBBLE_GUM:
if( sd->sc.data[SC_CASH_RECEIVEITEM] )
return 0;
break;
- case 12208: // Battle Manual
- case 12263: // Comp Battle Manual
- case 12312: // Thick Battle Manual
- case 12705: // Noble Nameplate
- case 14532: // Battle_Manual25
- case 14533: // Battle_Manual100
- case 14545: // Battle_Manual300
+ case ITEMID_BATTLE_MANUAL:
+ case ITEMID_COMP_BATTLE_MANUAL:
+ case ITEMID_THICK_MANUAL50:
+ case ITEMID_NOBLE_NAMEPLATE:
+ case ITEMID_BATTLE_MANUAL25:
+ case ITEMIDBATTLE_MANUAL100:
+ case ITEMID_BATTLE_MANUAL_X3:
if( sd->sc.data[SC_CASH_PLUSEXP] )
return 0;
break;
- case 14592: // JOB_Battle_Manual
+ case ITEMID_JOB_MANUAL50:
if( sd->sc.data[SC_CASH_PLUSONLYJOBEXP] )
return 0;
break;
// Mercenary Items
-
- case 12184: // Mercenary's Red Potion
- case 12185: // Mercenary's Blue Potion
- case 12241: // Mercenary's Concentration Potion
- case 12242: // Mercenary's Awakening Potion
- case 12243: // Mercenary's Berserk Potion
+ case ITEMID_MERCENARY_RED_POTION:
+ case ITEMID_MERCENARY_BLUE_POTION:
+ case ITEMID_M_CENTER_POTION:
+ case ITEMID_M_AWAKENING_POTION:
+ case ITEMID_M_BERSERK_POTION:
if( sd->md == NULL || sd->md->db == NULL )
return 0;
if (sd->md->sc.data[SC_BERSERK] || sd->md->sc.data[SC_SATURDAY_NIGHT_FEVER])
return 0;
- if( nameid == 12242 && sd->md->db->lv < 40 )
+ if( nameid == ITEMID_M_AWAKENING_POTION && sd->md->db->lv < 40 )
return 0;
- if( nameid == 12243 && sd->md->db->lv < 80 )
+ if( nameid == ITEMID_M_BERSERK_POTION && sd->md->db->lv < 80 )
return 0;
break;
- case 12213: //Neuralizer
+ case ITEMID_NEURALIZER:
if( !map->list[sd->bl.m].flag.reset )
return 0;
break;
}
- if( nameid >= 12153 && nameid <= 12182 && sd->md != NULL )
- return 0; // Mercenary Scrolls
+ if( nameid >= ITEMID_BOW_MERCENARY_SCROLL1 && nameid <= ITEMID_SPEARMERCENARY_SCROLL10 && sd->md != NULL ) // Mercenary Scrolls
+ return 0;
/**
* Only Rune Knights may use runes
@@ -4319,12 +4315,10 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 0;
}
-#ifdef RENEWAL
if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax){
clif->msg(sd, 0x6EE);
return 0;
}
-#endif
//Not equipable by class. [Skotlex]
if (!(
@@ -4356,8 +4350,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
}
//Dead Branch & Bloody Branch & Porings Box
- // FIXME: outdated, use constants or database
- if( nameid == 604 || nameid == 12103 || nameid == 12109 )
+ if( nameid == ITEMID_BRANCH_OF_DEAD_TREE || nameid == ITEMID_BLOODY_DEAD_BRANCH || nameid == ITEMID_PORING_BOX )
logs->branch(sd);
return 1;
@@ -5886,7 +5879,6 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
}
void pc_baselevelchanged(struct map_session_data *sd) {
-#ifdef RENEWAL
int i;
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[i] >= 0 ) {
@@ -5894,9 +5886,8 @@ void pc_baselevelchanged(struct map_session_data *sd) {
pc->unequipitem(sd, sd->equip_index[i], 3);
}
}
-#endif
-
}
+
int pc_checkjoblevelup(struct map_session_data *sd)
{
unsigned int next = pc->nextjobexp(sd);
diff --git a/src/map/pc.h b/src/map/pc.h
index 71c76b643..f10bd0f59 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -615,8 +615,8 @@ enum equip_pos {
// Rune Knight Dragon
#define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
-#define pc_stop_walking(sd, type) unit->stop_walking(&(sd)->bl, type)
-#define pc_stop_attack(sd) unit->stop_attack(&(sd)->bl)
+#define pc_stop_walking(sd, type) (unit->stop_walking(&(sd)->bl, (type)))
+#define pc_stop_attack(sd) (unit->stop_attack(&(sd)->bl))
//Weapon check considering dual wielding.
#define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
@@ -633,7 +633,7 @@ enum equip_pos {
|| ( (class_) >= JOB_KAGEROU && (class_) <= JOB_OBORO ) \
|| ( (class_) >= JOB_REBELLION && (class_) < JOB_MAX ) \
)
-#define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)class_)
+#define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)(class_))
// clientside display macros (values to the left/right of the "+")
#ifdef RENEWAL
@@ -671,18 +671,18 @@ enum equip_pos {
#define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
#define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
-#define pc_readglobalreg(sd,reg) pc->readregistry(sd,reg,3)
-#define pc_setglobalreg(sd,reg,val) pc->setregistry(sd,reg,val,3)
-#define pc_readglobalreg_str(sd,reg) pc->readregistry_str(sd,reg,3)
-#define pc_setglobalreg_str(sd,reg,val) pc->setregistry_str(sd,reg,val,3)
-#define pc_readaccountreg(sd,reg) pc->readregistry(sd,reg,2)
-#define pc_setaccountreg(sd,reg,val) pc->setregistry(sd,reg,val,2)
-#define pc_readaccountregstr(sd,reg) pc->readregistry_str(sd,reg,2)
-#define pc_setaccountregstr(sd,reg,val) pc->setregistry_str(sd,reg,val,2)
-#define pc_readaccountreg2(sd,reg) pc->readregistry(sd,reg,1)
-#define pc_setaccountreg2(sd,reg,val) pc->setregistry(sd,reg,val,1)
-#define pc_readaccountreg2str(sd,reg) pc->readregistry_str(sd,reg,1)
-#define pc_setaccountreg2str(sd,reg,val) pc->setregistry_str(sd,reg,val,1)
+#define pc_readglobalreg(sd,reg) (pc->readregistry((sd),(reg),3))
+#define pc_setglobalreg(sd,reg,val) (pc->setregistry((sd),(reg),(val),3))
+#define pc_readglobalreg_str(sd,reg) (pc->readregistry_str((sd),(reg),3))
+#define pc_setglobalreg_str(sd,reg,val) (pc->setregistry_str((sd),(reg),(val),3))
+#define pc_readaccountreg(sd,reg) (pc->readregistry((sd),(reg),2))
+#define pc_setaccountreg(sd,reg,val) (pc->setregistry((sd),(reg),(val),2))
+#define pc_readaccountregstr(sd,reg) (pc->readregistry_str((sd),(reg),2))
+#define pc_setaccountregstr(sd,reg,val) (pc->setregistry_str((sd),(reg),(val),2))
+#define pc_readaccountreg2(sd,reg) (pc->readregistry((sd),(reg),1))
+#define pc_setaccountreg2(sd,reg,val) (pc->setregistry((sd),(reg),(val),1))
+#define pc_readaccountreg2str(sd,reg) (pc->readregistry_str((sd),(reg),1))
+#define pc_setaccountreg2str(sd,reg,val) (pc->setregistry_str((sd),(reg),(val),1))
struct skill_tree_entry {
short id;
diff --git a/src/map/pet.h b/src/map/pet.h
index f9a756de2..f1a219700 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -98,8 +98,8 @@ struct pet_data {
struct map_session_data *msd;
};
-#define pet_stop_walking(pd, type) unit->stop_walking(&(pd)->bl, type)
-#define pet_stop_attack(pd) unit->stop_attack(&(pd)->bl)
+#define pet_stop_walking(pd, type) (unit->stop_walking(&(pd)->bl, (type)))
+#define pet_stop_attack(pd) (unit->stop_attack(&(pd)->bl))
struct pet_interface {
struct s_pet_db db[MAX_PET_DB];
diff --git a/src/map/script.c b/src/map/script.c
index 8d07ca0d1..777179507 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -278,7 +278,7 @@ void disp_error_message2(const char *mes,const char *pos,int report)
script->error_report = report;
longjmp( script->error_jump, 1 );
}
-#define disp_error_message(mes,pos) script->disp_error_message2(mes,pos,1)
+#define disp_error_message(mes,pos) (script->disp_error_message2((mes),(pos),1))
void disp_warning_message(const char *mes, const char *pos) {
script->warning(script->parser_current_src,script->parser_current_file,script->parser_current_line,mes,pos);
@@ -3986,9 +3986,6 @@ const char *script_getfuncname(struct script_state *st) {
// buildin functions
//
-#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args }
-#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args }
-
/////////////////////////////////////////////////////////////////////
// NPC interaction
//
@@ -8540,7 +8537,7 @@ BUILDIN(monster)
int class_ = script_getnum(st,6);
int amount = script_getnum(st,7);
const char* event = "";
- unsigned int size = SZ_SMALL;
+ unsigned int size = SZ_MEDIUM;
unsigned int ai = AI_NONE;
int mob_id;
@@ -8650,7 +8647,7 @@ BUILDIN(areamonster)
int class_ = script_getnum(st,8);
int amount = script_getnum(st,9);
const char* event = "";
- unsigned int size = SZ_SMALL;
+ unsigned int size = SZ_MEDIUM;
unsigned int ai = AI_NONE;
int mob_id;
@@ -12980,7 +12977,7 @@ BUILDIN(summon)
clif->skill_poseffect(&sd->bl,AM_CALLHOMUN,1,sd->bl.x,sd->bl.y,tick);
- md = mob->once_spawn_sub(&sd->bl, sd->bl.m, sd->bl.x, sd->bl.y, str, _class, event, SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(&sd->bl, sd->bl.m, sd->bl.x, sd->bl.y, str, _class, event, SZ_MEDIUM, AI_NONE);
if (md) {
md->master_id=sd->bl.id;
md->special_state.ai = AI_ATTACK;
@@ -13024,7 +13021,7 @@ BUILDIN(isequippedcnt)
}
for (i=0; id!=0; i++) {
- script_fetch(st,i+2, id) else id = 0;
+ script_fetch(st,i+2, id);
if (id <= 0)
continue;
@@ -13082,7 +13079,7 @@ BUILDIN(isequipped)
setitem_hash = sd->bonus.setitem_hash;
setitem_hash2 = sd->bonus.setitem_hash2;
for (i=0; id!=0; i++) {
- script_fetch(st,i+2, id) else id = 0;
+ script_fetch(st,i+2, id);
if (id <= 0)
continue;
flag = 0;
@@ -13156,7 +13153,7 @@ BUILDIN(cardscnt) {
sd = script->rid2sd(st);
for (i=0; id!=0; i++) {
- script_fetch(st,i+2, id) else id = 0;
+ script_fetch(st,i+2, id);
if (id <= 0)
continue;
@@ -17969,6 +17966,8 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)
return true;
}
+#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args }
+#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args }
void script_parse_builtin(void) {
struct script_function BUILDIN[] = {
// NPC interaction
@@ -18512,6 +18511,8 @@ void script_parse_builtin(void) {
}
}
}
+#undef BUILDIN_DEF
+#undef BUILDIN_DEF2
void script_label_add(int key, int pos) {
int idx = script->label_count;
diff --git a/src/map/script.h b/src/map/script.h
index 0bb92c433..32426e988 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -22,9 +22,9 @@ struct eri;
**/
// TODO: Remove temporary code
#define ENABLE_CASE_CHECK
-#define DeprecationWarning(func, bad, good, file, line) ShowWarning("%s: use of deprecated keyword '%s' (use '%s' instead) in file '%s', line '%d'. This will be a critical error in a near future.\n", func, bad, good, file, line);
-#define DeprecationWarning2(func, bad, good, where) ShowWarning("%s: detected possible use of wrong case in a script. Found '%s', probably meant to be '%s' (in '%s'). If it is a local (.@) variable, and you're absolutely sure you used the correct case, please disragard this message, otherwise please correct your scripts, as this will become fatal in a near future.\n", func, bad, good, where);
-#define disp_deprecation_message(func, good, p) disp_warning_message(func": use of deprecated keyword (use '"good"' instead). This will be a critical error in a near future.", p);
+#define DeprecationWarning(func, bad, good, file, line) ShowWarning("%s: use of deprecated keyword '%s' (use '%s' instead) in file '%s', line '%d'. This will be a critical error in a near future.\n", (func), (bad), (good), (file), (line));
+#define DeprecationWarning2(func, bad, good, where) ShowWarning("%s: detected possible use of wrong case in a script. Found '%s', probably meant to be '%s' (in '%s'). This will become fatal in a near future.\n", (func), (bad), (good), (where));
+#define disp_deprecation_message(func, good, p) disp_warning_message(func": use of deprecated keyword (use '"good"' instead). This will be a critical error in a near future.", (p));
#define NUM_WHISPER_VAR 10
@@ -71,24 +71,24 @@ struct eri;
/// Returns the index of the last data in the stack
#define script_lastdata(st) ( (st)->end - (st)->start - 1 )
/// Pushes an int into the stack
-#define script_pushint(st,val) script->push_val((st)->stack, C_INT, (val),NULL)
+#define script_pushint(st,val) (script->push_val((st)->stack, C_INT, (val),NULL))
/// Pushes a string into the stack (script engine frees it automatically)
-#define script_pushstr(st,val) script->push_str((st)->stack, C_STR, (val))
+#define script_pushstr(st,val) (script->push_str((st)->stack, C_STR, (val)))
/// Pushes a copy of a string into the stack
-#define script_pushstrcopy(st,val) script->push_str((st)->stack, C_STR, aStrdup(val))
+#define script_pushstrcopy(st,val) (script->push_str((st)->stack, C_STR, aStrdup(val)))
/// Pushes a constant string into the stack (must never change or be freed)
-#define script_pushconststr(st,val) script->push_str((st)->stack, C_CONSTSTR, (val))
+#define script_pushconststr(st,val) (script->push_str((st)->stack, C_CONSTSTR, (val)))
/// Pushes a nil into the stack
-#define script_pushnil(st) script->push_val((st)->stack, C_NOP, 0,NULL)
+#define script_pushnil(st) (script->push_val((st)->stack, C_NOP, 0,NULL))
/// Pushes a copy of the data in the target index
-#define script_pushcopy(st,i) script->push_copy((st)->stack, (st)->start + (i))
+#define script_pushcopy(st,i) (script->push_copy((st)->stack, (st)->start + (i)))
-#define script_isstring(st,i) data_isstring(script_getdata(st,i))
-#define script_isint(st,i) data_isint(script_getdata(st,i))
+#define script_isstring(st,i) data_isstring(script_getdata((st),(i)))
+#define script_isint(st,i) data_isint(script_getdata((st),(i)))
-#define script_getnum(st,val) script->conv_num(st, script_getdata(st,val))
-#define script_getstr(st,val) script->conv_str(st, script_getdata(st,val))
-#define script_getref(st,val) ( script_getdata(st,val)->ref )
+#define script_getnum(st,val) (script->conv_num((st), script_getdata((st),(val))))
+#define script_getstr(st,val) (script->conv_str((st), script_getdata((st),(val))))
+#define script_getref(st,val) ( script_getdata((st),(val))->ref )
// Note: "top" functions/defines use indexes relative to the top of the stack
// -1 is the index of the data at the top
@@ -147,9 +147,12 @@ struct eri;
#define BUILDIN(x) bool buildin_ ## x (struct script_state* st)
#define BUILDIN_A(x) buildin_ ## x
-#define script_fetch(st, n, t) \
- if( script_hasdata(st,n) ) \
- (t)=script_getnum(st,n);
+#define script_fetch(st, n, t) do { \
+ if( script_hasdata((st),(n)) ) \
+ (t)=script_getnum((st),(n)); \
+ else \
+ (t) = 0; \
+} while(0)
/**
diff --git a/src/map/skill.c b/src/map/skill.c
index f468b5364..dcb29701f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -47,13 +47,13 @@
// ranges reserved for mapping skill ids to skilldb offsets
#define HM_SKILLRANGEMIN 750
-#define HM_SKILLRANGEMAX HM_SKILLRANGEMIN + MAX_HOMUNSKILL
-#define MC_SKILLRANGEMIN HM_SKILLRANGEMAX + 1
-#define MC_SKILLRANGEMAX MC_SKILLRANGEMIN + MAX_MERCSKILL
-#define EL_SKILLRANGEMIN MC_SKILLRANGEMAX + 1
-#define EL_SKILLRANGEMAX EL_SKILLRANGEMIN + MAX_ELEMENTALSKILL
-#define GD_SKILLRANGEMIN EL_SKILLRANGEMAX + 1
-#define GD_SKILLRANGEMAX GD_SKILLRANGEMIN + MAX_GUILDSKILL
+#define HM_SKILLRANGEMAX (HM_SKILLRANGEMIN + MAX_HOMUNSKILL)
+#define MC_SKILLRANGEMIN (HM_SKILLRANGEMAX + 1)
+#define MC_SKILLRANGEMAX (MC_SKILLRANGEMIN + MAX_MERCSKILL)
+#define EL_SKILLRANGEMIN (MC_SKILLRANGEMAX + 1)
+#define EL_SKILLRANGEMAX (EL_SKILLRANGEMIN + MAX_ELEMENTALSKILL)
+#define GD_SKILLRANGEMIN (EL_SKILLRANGEMAX + 1)
+#define GD_SKILLRANGEMAX (GD_SKILLRANGEMIN + MAX_GUILDSKILL)
#if GD_SKILLRANGEMAX > 999
#error GD_SKILLRANGEMAX is greater than 999
@@ -131,17 +131,17 @@ void skill_chk(uint16* skill_id) {
*skill_id = skill->get_index(*skill_id); // checks/adjusts id
}
-#define skill_get(var,id) { skill->chk(&id); if(!id) return 0; return var; }
-#define skill_get2(var,id,lv) { \
- skill->chk(&id); \
- if(!id) return 0; \
- if( lv > MAX_SKILL_LEVEL && var > 1 ) { \
- int lv2 = lv; lv = skill->db[id].max; \
- return (var) + ((lv2-lv)/2);\
+#define skill_get(var,id) do { skill->chk(&(id)); if(!(id)) return 0; return (var); } while(0)
+#define skill_get2(var,id,lv) do { \
+ skill->chk(&(id)); \
+ if(!(id)) return 0; \
+ if( (lv) > MAX_SKILL_LEVEL && (var) > 1 ) { \
+ int lv2__ = (lv); (lv) = skill->db[(id)].max; \
+ return (var) + ((lv2__-(lv))/2);\
} \
- return var;\
-}
-#define skill_glv(lv) min(lv,MAX_SKILL_LEVEL-1)
+ return (var);\
+} while(0)
+#define skill_glv(lv) min((lv),MAX_SKILL_LEVEL-1)
// Skill DB
int skill_get_hit( uint16 skill_id ) { skill_get (skill->db[skill_id].hit, skill_id); }
int skill_get_inf( uint16 skill_id ) { skill_get (skill->db[skill_id].inf, skill_id); }
@@ -1296,14 +1296,14 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
case GN_SLINGITEM_RANGEMELEEATK:
if( sd ) {
switch( sd->itemid ) { // Starting SCs here instead of do it in skill->additional_effect to simplify the code.
- case 13261:
+ case ITEMID_COCONUT_BOMB:
sc_start(bl, SC_STUN, 100, skill_lv, skill->get_time2(GN_SLINGITEM, skill_lv));
sc_start2(bl, SC_BLOODING, 100, skill_lv, src->id, skill->get_time2(GN_SLINGITEM, skill_lv));
break;
- case 13262:
+ case ITEMID_MELON_BOMB:
sc_start(bl, SC_MELON_BOMB, 100, skill_lv, skill->get_time(GN_SLINGITEM, skill_lv)); // Reduces ASPD and moviment speed
break;
- case 13264:
+ case ITEMID_BANANA_BOMB:
sc_start(bl, SC_BANANA_BOMB, 100, skill_lv, skill->get_time(GN_SLINGITEM, skill_lv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE?
sc_start(bl, SC_BANANA_BOMB_SITDOWN_POSTDELAY, 75, skill_lv, skill->get_time(GN_SLINGITEM_RANGEMELEEATK,skill_lv)); // Sitdown for 3 seconds.
break;
@@ -2188,7 +2188,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
//Spirit of Wizard blocks Kaite's reflection
if( type == 2 && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_WIZARD )
{ //Consume one Fragment per hit of the casted skill? [Skotlex]
- type = tsd?pc->search_inventory (tsd, 7321):0;
+ type = tsd?pc->search_inventory(tsd, ITEMID_FRAGMENT_OF_CRYSTAL):0;
if (type >= 0) {
if ( tsd ) pc->delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
dmg.damage = dmg.damage2 = 0;
@@ -5249,7 +5249,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
case SA_SUMMONMONSTER:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if (sd) mob->once_spawn(sd, src->m, src->x, src->y," --ja--", -1, 1, "", SZ_SMALL, AI_NONE);
+ if (sd) mob->once_spawn(sd, src->m, src->x, src->y," --ja--", -1, 1, "", SZ_MEDIUM, AI_NONE);
break;
case SA_LEVELUP:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -6568,7 +6568,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
//Prepare 200 White Potions.
- if (!skill->produce_mix(sd, skill_id, 504, 0, 0, 0, 200))
+ if (!skill->produce_mix(sd, skill_id, ITEMID_WHITE_POTION, 0, 0, 0, 200))
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
}
break;
@@ -6576,28 +6576,28 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
//Prepare 200 Slim White Potions.
- if (!skill->produce_mix(sd, skill_id, 547, 0, 0, 0, 200))
+ if (!skill->produce_mix(sd, skill_id, ITEMID_WHITE_SLIM_POTION, 0, 0, 0, 200))
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
}
break;
case AM_TWILIGHT3:
if (sd) {
- int ebottle = pc->search_inventory(sd,713);
+ int ebottle = pc->search_inventory(sd,ITEMID_EMPTY_BOTTLE);
if( ebottle >= 0 )
ebottle = sd->status.inventory[ebottle].amount;
//check if you can produce all three, if not, then fail:
- if (!skill->can_produce_mix(sd,970,-1, 100) //100 Alcohol
- || !skill->can_produce_mix(sd,7136,-1, 50) //50 Acid Bottle
- || !skill->can_produce_mix(sd,7135,-1, 50) //50 Flame Bottle
+ if (!skill->can_produce_mix(sd,ITEMID_ALCHOL,-1, 100) //100 Alcohol
+ || !skill->can_produce_mix(sd,ITEMID_ACID_BOTTLE,-1, 50) //50 Acid Bottle
+ || !skill->can_produce_mix(sd,ITEMID_FIRE_BOTTLE,-1, 50) //50 Flame Bottle
|| ebottle < 200 //200 empty bottle are required at total.
) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
break;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- skill->produce_mix(sd, skill_id, 970, 0, 0, 0, 100);
- skill->produce_mix(sd, skill_id, 7136, 0, 0, 0, 50);
- skill->produce_mix(sd, skill_id, 7135, 0, 0, 0, 50);
+ skill->produce_mix(sd, skill_id, ITEMID_ALCHOL, 0, 0, 0, 100);
+ skill->produce_mix(sd, skill_id, ITEMID_ACID_BOTTLE, 0, 0, 0, 50);
+ skill->produce_mix(sd, skill_id, ITEMID_FIRE_BOTTLE, 0, 0, 0, 50);
}
break;
case SA_DISPELL:
@@ -8995,7 +8995,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sd->itemid = ammo_id;
if( itemdb_is_GNbomb(ammo_id) ) {
if(battle->check_target(src,bl,BCT_ENEMY) > 0) {// Only attack if the target is an enemy.
- if( ammo_id == 13263 )
+ if( ammo_id == ITEMID_PINEAPPLE_BOMB )
map->foreachincell(skill->area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag);
@@ -9114,7 +9114,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if(sd) {
struct mob_data *md;
- md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), 2308, "", SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), 2308, "", SZ_MEDIUM, AI_NONE);
if( md ) {
md->master_id = src->id;
md->special_state.ai = AI_ZANZOU;
@@ -9303,7 +9303,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
for(i=0; i<qty[skill_lv - 1]; i++){ //easy way
- md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK);
+ md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), summons[skill_lv - 1], "", SZ_MEDIUM, AI_ATTACK);
if (md) {
md->master_id = src->id;
if (md->deletetimer != INVALID_TIMER)
@@ -9523,7 +9523,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
nullpo_ret(sd);
//Simplify skill_failed code.
-#define skill_failed(sd) { sd->menuskill_id = sd->menuskill_val = 0; }
+#define skill_failed(sd) ( (sd)->menuskill_id = (sd)->menuskill_val = 0 )
if(skill_id != sd->menuskill_id)
return 0;
@@ -9962,7 +9962,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
struct mob_data *md;
// Correct info, don't change any of this! [celest]
- md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_MEDIUM, AI_NONE);
if (md) {
md->master_id = src->id;
md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA;
@@ -10059,7 +10059,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if (rnd()%100 < 50) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
} else {
- TBL_MOB* md = mob->once_spawn_sub(src, src->m, x, y, "--ja--",(skill_lv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"", SZ_SMALL, AI_NONE);
+ TBL_MOB* md = mob->once_spawn_sub(src, src->m, x, y, "--ja--",(skill_lv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"", SZ_MEDIUM, AI_NONE);
int i;
if (!md) break;
if ((i = skill->get_time(skill_id, skill_lv)) > 0)
@@ -10191,7 +10191,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int class_ = 2042;
struct mob_data *md;
- md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_MEDIUM, AI_NONE);
if( md ) {
md->master_id = src->id;
md->special_state.ai = AI_FLORA;
@@ -14237,7 +14237,12 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
*------------------------------------------*/
void skill_repairweapon (struct map_session_data *sd, int idx) {
int material;
- int materials[4] = { 1002, 998, 999, 756 };
+ int materials[4] = {
+ ITEMID_IRON_ORE,
+ ITEMID_IRON,
+ ITEMID_STEEL,
+ ITEMID_ORIDECON_STONE,
+ };
struct item *item;
struct map_session_data *target_sd;
@@ -14261,9 +14266,9 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
}
if ( target_sd->inventory_data[idx]->type == IT_WEAPON )
- material = materials [ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
+ material = materials[ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
else
- material = materials [2]; // Armors consume 1 Steel
+ material = materials[2]; // Armors consume 1 Steel
if ( pc->search_inventory(sd,material) < 0 ) {
clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
@@ -14311,7 +14316,13 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if (idx >= 0 && idx < MAX_INVENTORY)
{
int i = 0, ep = 0, per;
- int material[5] = { 0, 1010, 1011, 984, 984 };
+ int material[5] = {
+ 0,
+ ITEMID_PHRACON,
+ ITEMID_EMVERETARCON,
+ ITEMID_ORIDECON,
+ ITEMID_ORIDECON,
+ };
struct item *item;
struct item_data *ditem = sd->inventory_data[idx];
item = &sd->status.inventory[idx];
@@ -14326,8 +14337,8 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
clif->upgrademessage(sd->fd, 2, item->nameid);
return;
}
- if( (i = pc->search_inventory(sd, material [ditem->wlv])) < 0 ){
- clif->upgrademessage(sd->fd, 3, material [ditem->wlv]);
+ if( (i = pc->search_inventory(sd, material[ditem->wlv])) < 0 ){
+ clif->upgrademessage(sd->fd, 3, material[ditem->wlv]);
return;
}
@@ -16079,11 +16090,11 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
j = pc->search_inventory(sd,slot[i]);
if(j < 0)
continue;
- if(slot[i]==1000){ /* Star Crumb */
+ if( slot[i]==ITEMID_STAR_CRUMB ) {
pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
sc++;
}
- if(slot[i]>=994 && slot[i]<=997 && ele==0){ /* Flame Heart . . . Great Nature */
+ if( slot[i] >= ITEMID_FLAME_HEART && slot[i] <= ITEMID_GREAT_NATURE && ele == 0 ) {
static const int ele_table[4]={3,1,4,2};
pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
ele=ele_table[slot[i]-994];
@@ -16150,13 +16161,13 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
i = pc->checkskill(sd,skill_id);
make_per = sd->status.job_level*20 + st->dex*10 + st->luk*10; //Base chance
switch(nameid){
- case 998: // Iron
+ case ITEMID_IRON:
make_per += 4000+i*500; // Temper Iron bonus: +26/+32/+38/+44/+50
break;
- case 999: // Steel
+ case ITEMID_STEEL:
make_per += 3000+i*500; // Temper Steel bonus: +35/+40/+45/+50/+55
break;
- case 1000: //Star Crumb
+ case ITEMID_STAR_CRUMB:
make_per = 100000; // Star Crumbs are 100% success crafting rate? (made 1000% so it succeeds even after penalties) [Skotlex]
break;
default: // Enchanted Stones
@@ -16187,32 +16198,32 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
make_per += skill2_lv*100; //+1% bonus per level
}
switch(nameid){
- case 501: // Red Potion
- case 503: // Yellow Potion
- case 504: // White Potion
+ case ITEMID_RED_POTION:
+ case ITEMID_YELLOW_POTION:
+ case ITEMID_WHITE_POTION:
make_per += (1+rnd()%100)*10 + 2000;
break;
- case 970: // Alcohol
+ case ITEMID_ALCHOL:
make_per += (1+rnd()%100)*10 + 1000;
break;
- case 7135: // Bottle Grenade
- case 7136: // Acid Bottle
- case 7137: // Plant Bottle
- case 7138: // Marine Sphere Bottle
+ case ITEMID_FIRE_BOTTLE:
+ case ITEMID_ACID_BOTTLE:
+ case ITEMID_MENEATER_PLANT_BOTTLE:
+ case ITEMID_MINI_BOTTLE:
make_per += (1+rnd()%100)*10;
break;
- case 546: // Condensed Yellow Potion
+ case ITEMID_YELLOW_SLIM_POTION:
make_per -= (1+rnd()%50)*10;
break;
- case 547: // Condensed White Potion
- case 7139: // Glistening Coat
+ case ITEMID_WHITE_SLIM_POTION:
+ case ITEMID_COATING_BOTTLE:
make_per -= (1+rnd()%100)*10;
break;
//Common items, recieve no bonus or penalty, listed just because they are commonly produced
- case 505: // Blue Potion
- case 545: // Condensed Red Potion
- case 605: // Anodyne
- case 606: // Aloevera
+ case ITEMID_BLUE_POTION:
+ case ITEMID_RED_SLIM_POTION:
+ case ITEMID_ANODYNE:
+ case ITEMID_ALOEBERA:
default:
break;
}
@@ -16232,18 +16243,18 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune()
int D = 2500;
switch (nameid) { //rune rank it_diff 9 craftable rune
- case ITEMID_RAIDO:
- case ITEMID_THURISAZ:
- case ITEMID_HAGALAZ:
- case ITEMID_OTHILA:
+ case ITEMID_RAIDO:
+ case ITEMID_THURISAZ:
+ case ITEMID_HAGALAZ:
+ case ITEMID_OTHILA:
D -= 500; //Rank C
- case ITEMID_ISA:
- case ITEMID_WYRD:
+ case ITEMID_ISA:
+ case ITEMID_WYRD:
D -= 500; //Rank B
- case ITEMID_NAUTHIZ:
- case ITEMID_URUZ:
+ case ITEMID_NAUTHIZ:
+ case ITEMID_URUZ:
D -= 500; //Rank A
- case ITEMID_BERKANA:
+ case ITEMID_BERKANA:
case ITEMID_LUX_ANIMA:
D -= 500; //Rank S
}
@@ -16279,22 +16290,28 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
(sd->status.base_level-100) + pc->checkskill(sd, AM_LEARNINGPOTION) + pc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
switch(nameid){// difficulty factor
- case 12422: case 12425:
- case 12428:
+ case ITEMID_HP_INCREASE_POTIONS:
+ case ITEMID_SP_INCREASE_POTIONS:
+ case ITEMID_ENRICH_WHITE_POTIONZ:
difficulty += 10;
break;
- case 6212: case 12426:
+ case ITEMID_BOMB_MUSHROOM_SPORE:
+ case ITEMID_SP_INCREASE_POTIONM:
difficulty += 15;
break;
- case 13264: case 12423:
- case 12427: case 12436:
+ case ITEMID_BANANA_BOMB:
+ case ITEMID_HP_INCREASE_POTIONM:
+ case ITEMID_SP_INCREASE_POTIONL:
+ case ITEMID_VITATA500:
difficulty += 20;
break;
- case 6210: case 6211:
- case 12437:
+ case ITEMID_SEED_OF_HORNY_PLANT:
+ case ITEMID_BLOODSUCK_PLANT_SEED:
+ case ITEMID_ENRICH_CELERMINE_JUICE:
difficulty += 30;
break;
- case 12424: case 12475:
+ case ITEMID_HP_INCREASE_POTIONL:
+ case ITEMID_CURE_FREE:
difficulty += 40;
break;
}
@@ -16321,18 +16338,23 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
qty = ~(5 + rnd()%5) + 1;
switch(nameid){// difficulty factor
- case 13260:
+ case ITEMID_APPLE_BOMB:
difficulty += 5;
break;
- case 13261: case 13262:
+ case ITEMID_COCONUT_BOMB:
+ case ITEMID_MELON_BOMB:
difficulty += 10;
break;
- case 12429: case 12430: case 12431:
- case 12432: case 12433: case 12434:
- case 13263:
+ case ITEMID_SAVAGE_BBQ:
+ case ITEMID_WUG_BLOOD_COCKTAIL:
+ case ITEMID_MINOR_BRISKET:
+ case ITEMID_SIROMA_ICETEA:
+ case ITEMID_DROCERA_HERB_STEW:
+ case ITEMID_PETTI_TAIL_NOODLE:
+ case ITEMID_PINEAPPLE_BOMB:
difficulty += 15;
break;
- case 13264:
+ case ITEMID_BANANA_BOMB:
difficulty += 20;
break;
}
@@ -16466,7 +16488,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
}
if (rnd()%10000 < make_per || qty == 1) { //Success
tmp_item.amount++;
- if(nameid < 545 || nameid > 547)
+ if(nameid < ITEMID_RED_SLIM_POTION || nameid > ITEMID_WHITE_SLIM_POTION)
continue;
if( skill_id != AM_PHARMACY &&
skill_id != AM_TWILIGHT1 &&
@@ -16589,7 +16611,13 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
break;
case GN_MIX_COOKING: {
struct item tmp_item;
- const int compensation[5] = {13265, 13266, 13267, 12435, 13268};
+ const int compensation[5] = {
+ ITEMID_BLACK_LUMP,
+ ITEMID_BLACK_HARD_LUMP,
+ ITEMID_VERY_HARD_LUMP,
+ ITEMID_BLACK_THING,
+ ITEMID_MYSTERIOUS_POWDER,
+ };
int rate = rnd()%500;
memset(&tmp_item,0,sizeof(tmp_item));
if( rate < 50) i = 4;
@@ -16674,14 +16702,14 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
}
switch( nameid )
{ // t_lv used to take duration from skill->get_time2
- case PO_PARALYSE: type = SC_PARALYSE; break;
- case PO_PYREXIA: type = SC_PYREXIA; break;
- case PO_DEATHHURT: type = SC_DEATHHURT; break;
- case PO_LEECHESEND: type = SC_LEECHESEND; break;
- case PO_VENOMBLEED: type = SC_VENOMBLEED; break;
- case PO_TOXIN: type = SC_TOXIN; break;
- case PO_MAGICMUSHROOM: type = SC_MAGICMUSHROOM; break;
- case PO_OBLIVIONCURSE: type = SC_OBLIVIONCURSE; break;
+ case ITEMID_POISON_PARALYSIS: type = SC_PARALYSE; break;
+ case ITEMID_POISON_FEVER: type = SC_PYREXIA; break;
+ case ITEMID_POISON_CONTAMINATION: type = SC_DEATHHURT; break;
+ case ITEMID_POISON_LEECH: type = SC_LEECHESEND; break;
+ case ITEMID_POISON_FATIGUE: type = SC_VENOMBLEED; break;
+ case ITEMID_POISON_NUMB: type = SC_TOXIN; break;
+ case ITEMID_POISON_LAUGHING: type = SC_MAGICMUSHROOM; break;
+ case ITEMID_POISON_OBLIVION: type = SC_OBLIVIONCURSE; break;
default:
clif->skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -16737,10 +16765,10 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
sd->sc.comet_x = sd->sc.comet_y = 0;
sd->menuskill_val = 0;
- class_ = (nameid == 990 || nameid == 991) ? 2043 + nameid - 990 : (nameid == 992) ? 2046 : 2045;
+ class_ = (nameid == ITEMID_BOODY_RED || nameid == ITEMID_CRYSTAL_BLUE) ? 2043 + nameid - ITEMID_BOODY_RED : (nameid == ITEMID_WIND_OF_VERDURE) ? 2046 : 2045;
- md = mob->once_spawn_sub(&sd->bl, sd->bl.m, x, y, sd->status.name, class_, "", SZ_SMALL, AI_NONE);
+ md = mob->once_spawn_sub(&sd->bl, sd->bl.m, x, y, sd->status.name, class_, "", SZ_MEDIUM, AI_NONE);
if( md ) {
md->master_id = sd->bl.id;
md->special_state.ai = AI_FLORA;
@@ -16853,15 +16881,15 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
switch( nameid ) {
// Level 1
- case 994: product = 990; break; // Flame Heart -> Red Blood.
- case 995: product = 991; break; // Mystic Frozen -> Crystal Blue.
- case 996: product = 992; break; // Rough Wind -> Wind of Verdure.
- case 997: product = 993; break; // Great Nature -> Green Live.
+ case ITEMID_FLAME_HEART: product = ITEMID_BOODY_RED; break;
+ case ITEMID_MISTIC_FROZEN: product = ITEMID_CRYSTAL_BLUE; break;
+ case ITEMID_ROUGH_WIND: product = ITEMID_WIND_OF_VERDURE; break;
+ case ITEMID_GREAT_NATURE: product = ITEMID_YELLOW_LIVE; break;
// Level 2
- case 990: product = 994; break; // Red Blood -> Flame Heart.
- case 991: product = 995; break; // Crystal Blue -> Mystic Frozen.
- case 992: product = 996; break; // Wind of Verdure -> Rough Wind.
- case 993: product = 997; break; // Green Live -> Great Nature.
+ case ITEMID_BOODY_RED: product = ITEMID_FLAME_HEART; break;
+ case ITEMID_CRYSTAL_BLUE: product = ITEMID_MISTIC_FROZEN; break;
+ case ITEMID_WIND_OF_VERDURE: product = ITEMID_ROUGH_WIND; break;
+ case ITEMID_YELLOW_LIVE: product = ITEMID_GREAT_NATURE; break;
default:
clif->skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0);
return 1;
diff --git a/src/map/skill.h b/src/map/skill.h
index 918216e8a..1b6f1e24c 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1613,17 +1613,6 @@ enum {
UNT_MAX = 0x190
};
-enum gx_poison {
- PO_PARALYSE = 12717,
- PO_LEECHESEND,
- PO_OBLIVIONCURSE,
- PO_DEATHHURT,
- PO_TOXIN,
- PO_PYREXIA,
- PO_MAGICMUSHROOM,
- PO_VENOMBLEED
-};
-
/**
* Structures
**/
diff --git a/src/map/status.c b/src/map/status.c
index ef211e97e..d4e1d1b31 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -102,10 +102,6 @@ int status_type2relevant_bl_types(int type)
return status->RelevantBLTypes[type];
}
-#define add_sc(skill,sc) set_sc(skill,sc,SI_BLANK,SCB_NONE)
-// indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units
-#define set_sc_with_vfx(skill, sc, icon, flag) set_sc((skill), (sc), (icon), (flag)); if((icon) < SI_MAX) status->RelevantBLTypes[(icon)] |= BL_SCEFFECT
-
static void set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) {
uint16 idx;
if( (idx = skill->get_index(skill_id)) == 0 ) {
@@ -128,6 +124,10 @@ static void set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) {
}
void initChangeTables(void) {
+#define add_sc(skill,sc) set_sc((skill),(sc),SI_BLANK,SCB_NONE)
+// indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units
+#define set_sc_with_vfx(skill, sc, icon, flag) do { set_sc((skill), (sc), (icon), (flag)); if((icon) < SI_MAX) status->RelevantBLTypes[(icon)] |= BL_SCEFFECT; } while(0)
+
int i;
for (i = 0; i < SC_MAX; i++)
@@ -1034,6 +1034,8 @@ void initChangeTables(void) {
if( !battle_config.display_hallucination ) //Disable Hallucination.
status->IconChangeTable[SC_ILLUSION] = SI_BLANK;
+#undef add_sc
+#undef set_sc_with_vfx
}
void initDummyData(void)
@@ -2096,7 +2098,7 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) {
if (flag&2 && battle_config.mob_size_influence) {
// change for sized monsters [Valaris]
- if (md->special_state.size==SZ_MEDIUM) {
+ if (md->special_state.size==SZ_SMALL) {
mstatus->max_hp>>=1;
mstatus->max_sp>>=1;
if (!mstatus->max_hp) mstatus->max_hp = 1;
@@ -2402,13 +2404,13 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
//Give them all modes except these (useful for clones)
bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
- bstatus->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM;
+ bstatus->size = (sd->class_&JOBL_BABY)?SZ_MEDIUM:SZ_SMALL;
if (battle_config.character_size && (pc_isriding(sd) || pc_isridingdragon(sd)) ) { //[Lupus]
if (sd->class_&JOBL_BABY) {
if (battle_config.character_size&SZ_BIG)
bstatus->size++;
} else
- if(battle_config.character_size&SZ_MEDIUM)
+ if(battle_config.character_size&SZ_SMALL)
bstatus->size++;
}
bstatus->aspd_rate = 1000;
@@ -3432,50 +3434,43 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str
if (!sc || !sc->count)
return;
- if (
- (sc->data[SC_POISON] && !sc->data[SC_SLOWPOISON])
- || (sc->data[SC_DPOISON] && !sc->data[SC_SLOWPOISON])
- || sc->data[SC_BERSERK]
- || sc->data[SC_TRICKDEAD]
- || sc->data[SC_BLOODING]
- || sc->data[SC_MAGICMUSHROOM]
- || sc->data[SC_RAISINGDRAGON]
- || sc->data[SC_SATURDAY_NIGHT_FEVER]
+ if ((sc->data[SC_POISON] && !sc->data[SC_SLOWPOISON])
+ || (sc->data[SC_DPOISON] && !sc->data[SC_SLOWPOISON])
+ || sc->data[SC_BERSERK]
+ || sc->data[SC_TRICKDEAD]
+ || sc->data[SC_BLOODING]
+ || sc->data[SC_MAGICMUSHROOM]
+ || sc->data[SC_RAISINGDRAGON]
+ || sc->data[SC_SATURDAY_NIGHT_FEVER]
) //No regen
regen->flag = 0;
- if (
- sc->data[SC_DANCING] || sc->data[SC_OBLIVIONCURSE] || sc->data[SC_MAXIMIZEPOWER] || sc->data[SC_REBOUND]
- || (
- (bl->type == BL_PC && ((TBL_PC*)bl)->class_&MAPID_UPPERMASK) == MAPID_MONK &&
- (sc->data[SC_EXTREMITYFIST] || (sc->data[SC_EXPLOSIONSPIRITS] && (!sc->data[SC_SOULLINK] || sc->data[SC_SOULLINK]->val2 != SL_MONK)))
- )
- ) //No natural SP regen
- regen->flag &=~RGN_SP;
-
- if(
- sc->data[SC_TENSIONRELAX]
+ if ( sc->data[SC_DANCING] || sc->data[SC_OBLIVIONCURSE] || sc->data[SC_MAXIMIZEPOWER] || sc->data[SC_REBOUND]
+ || ( bl->type == BL_PC && (((TBL_PC*)bl)->class_&MAPID_UPPERMASK) == MAPID_MONK
+ && (sc->data[SC_EXTREMITYFIST] || (sc->data[SC_EXPLOSIONSPIRITS] && (!sc->data[SC_SOULLINK] || sc->data[SC_SOULLINK]->val2 != SL_MONK)))
+ )
) {
+ regen->flag &=~RGN_SP; //No natural SP regen
+ }
+
+ if (sc->data[SC_TENSIONRELAX]) {
regen->rate.hp += 2;
if (regen->sregen)
regen->sregen->rate.hp += 3;
}
- if (sc->data[SC_MAGNIFICAT])
- {
+ if (sc->data[SC_MAGNIFICAT]) {
regen->rate.hp += 1;
regen->rate.sp += 1;
}
- if (sc->data[SC_GDSKILL_REGENERATION])
- {
+ if (sc->data[SC_GDSKILL_REGENERATION]) {
const struct status_change_entry *sce = sc->data[SC_GDSKILL_REGENERATION];
- if (!sce->val4)
- {
+ if (!sce->val4) {
regen->rate.hp += sce->val2;
regen->rate.sp += sce->val3;
} else
regen->flag&=~sce->val4; //Remove regen as specified by val4
}
- if(sc->data[SC_GENTLETOUCH_REVITALIZE]){
+ if(sc->data[SC_GENTLETOUCH_REVITALIZE]) {
regen->hp = cap_value(regen->hp*sc->data[SC_GENTLETOUCH_REVITALIZE]->val3/100, 1, SHRT_MAX);
regen->state.walk= 1;
}
@@ -8559,12 +8554,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_GENSOU:
- #define PER( a ) do { \
- if( a <= 15 ) lv = 1; \
- else if( a <= 30 ) lv = 2; \
- else if( a <= 50 ) lv = 3; \
- else if( a <= 75 ) lv = 4; \
- } while(0)
+#define PER( a, lvl ) do { \
+ int temp__ = (a); \
+ if( temp__ <= 15 ) (lvl) = 1; \
+ else if( temp__ <= 30 ) (lvl) = 2; \
+ else if( temp__ <= 50 ) (lvl) = 3; \
+ else if( temp__ <= 75 ) (lvl) = 4; \
+ else (lvl) = 5; \
+} while(0)
{
int hp = status_get_hp(bl), sp = status_get_sp(bl), lv = 5;
@@ -8572,13 +8569,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( rand()%100 > (25 + 10 * val1) - status_get_int(bl) / 2)
return 0;
- PER( 100 / (status_get_max_hp(bl) / hp) );
+ PER( 100 / (status_get_max_hp(bl) / hp), lv );
status->heal(bl, (!(hp%2) ? (6-lv) *4 / 100 : -(lv*4) / 100), 0, 1);
- PER( 100 / (status_get_max_sp(bl) / sp) );
+ PER( 100 / (status_get_max_sp(bl) / sp), lv );
status->heal(bl, 0,(!(sp%2) ? (6-lv) *3 / 100 : -(lv*3) / 100), 1);
}
- #undef PER
+#undef PER
break;
case SC_ANGRIFFS_MODUS:
val2 = 50 + 20 * val1; //atk bonus
@@ -8876,18 +8873,18 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_ITEMSCRIPT:
if( sd ) {
switch( val1 ) {
- //case 4121://Phree
- //case 4047://Ghostring
- case 4302://Gunka
+ //case ITEMID_PHREEONI_CARD:
+ //case ITEMID_GHOSTRING_CARD:
+ case ITEMID_TAO_GUNKA_CARD:
clif->status_change(bl,SI_MVPCARD_TAOGUNKA,1,tick,0,0,0);
break;
- case 4132://Mistress
+ case ITEMID_MISTRESS_CARD:
clif->status_change(bl,SI_MVPCARD_MISTRESS,1,tick,0,0,0);
break;
- case 4143://Orc Hero
+ case ITEMID_ORC_HERO_CARD:
clif->status_change(bl,SI_MVPCARD_ORCHERO,1,tick,0,0,0);
break;
- case 4135://Orc Lord
+ case ITEMID_ORC_LOAD_CARD:
clif->status_change(bl,SI_MVPCARD_ORCLORD,1,tick,0,0,0);
break;
}
@@ -9732,18 +9729,18 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_ITEMSCRIPT:
if( sd ) {
switch( sce->val1 ) {
- //case 4121://Phree
- //case 4047://Ghostring
- case 4302://Gunka
+ //case ITEMID_PHREEONI_CARD:
+ //case ITEMID_GHOSTRING_CARD:
+ case ITEMID_TAO_GUNKA_CARD:
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_TAOGUNKA);
break;
- case 4132://Mistress
+ case ITEMID_MISTRESS_CARD:
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_MISTRESS);
break;
- case 4143://Orc Hero
+ case ITEMID_ORC_HERO_CARD:
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_ORCHERO);
break;
- case 4135://Orc Lord
+ case ITEMID_ORC_LOAD_CARD:
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_MVPCARD_ORCLORD);
break;
}
@@ -10022,7 +10019,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
// set the next timer of the sce (don't assume the status still exists)
#define sc_timer_next(t,f,i,d) do { \
if( (sce=sc->data[type]) ) \
- sce->timer = timer->add(t,f,i,d); \
+ sce->timer = timer->add((t),(f),(i),(d)); \
else \
ShowError("status_change_timer: Unexpected NULL status change id: %d data: %d\n", id, data); \
} while(0)
diff --git a/src/map/status.h b/src/map/status.h
index cdd5fa481..75582e9a4 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1764,67 +1764,67 @@ struct status_change {
//Define for standard HP damage attacks.
-#define status_fix_damage(src, target, hp, walkdelay) status->damage(src, target, hp, 0, walkdelay, 0)
+#define status_fix_damage(src, target, hp, walkdelay) (status->damage((src), (target), (hp), 0, (walkdelay), 0))
//Define for standard HP/SP damage triggers.
-#define status_zap(bl, hp, sp) status->damage(NULL, bl, hp, sp, 0, 1)
+#define status_zap(bl, hp, sp) (status->damage(NULL, (bl), (hp), (sp), 0, 1))
//Easier handling of status->percent_change
-#define status_percent_heal(bl, hp_rate, sp_rate) status->percent_change(NULL, bl, -(hp_rate), -(sp_rate), 0)
-#define status_percent_damage(src, target, hp_rate, sp_rate, kill) status->percent_change(src, target, hp_rate, sp_rate, (kill)?1:2)
+#define status_percent_heal(bl, hp_rate, sp_rate) (status->percent_change(NULL, (bl), -(hp_rate), -(sp_rate), 0))
+#define status_percent_damage(src, target, hp_rate, sp_rate, kill) (status->percent_change((src), (target), (hp_rate), (sp_rate), (kill)?1:2))
//Instant kill with no drops/exp/etc
-#define status_kill(bl) status_percent_damage(NULL, bl, 100, 0, true)
+#define status_kill(bl) status_percent_damage(NULL, (bl), 100, 0, true)
-#define status_get_range(bl) status->get_status_data(bl)->rhw.range
-#define status_get_hp(bl) status->get_status_data(bl)->hp
-#define status_get_max_hp(bl) status->get_status_data(bl)->max_hp
-#define status_get_sp(bl) status->get_status_data(bl)->sp
-#define status_get_max_sp(bl) status->get_status_data(bl)->max_sp
-#define status_get_str(bl) status->get_status_data(bl)->str
-#define status_get_agi(bl) status->get_status_data(bl)->agi
-#define status_get_vit(bl) status->get_status_data(bl)->vit
-#define status_get_int(bl) status->get_status_data(bl)->int_
-#define status_get_dex(bl) status->get_status_data(bl)->dex
-#define status_get_luk(bl) status->get_status_data(bl)->luk
-#define status_get_hit(bl) status->get_status_data(bl)->hit
-#define status_get_flee(bl) status->get_status_data(bl)->flee
-#define status_get_mdef(bl) status->get_status_data(bl)->mdef
-#define status_get_flee2(bl) status->get_status_data(bl)->flee2
-#define status_get_def2(bl) status->get_status_data(bl)->def2
-#define status_get_mdef2(bl) status->get_status_data(bl)->mdef2
-#define status_get_critical(bl) status->get_status_data(bl)->cri
-#define status_get_batk(bl) status->get_status_data(bl)->batk
-#define status_get_watk(bl) status->get_status_data(bl)->rhw.atk
-#define status_get_watk2(bl) status->get_status_data(bl)->rhw.atk2
-#define status_get_matk_max(bl) status->get_status_data(bl)->matk_max
-#define status_get_matk_min(bl) status->get_status_data(bl)->matk_min
-#define status_get_lwatk(bl) status->get_status_data(bl)->lhw.atk
-#define status_get_lwatk2(bl) status->get_status_data(bl)->lhw.atk2
-#define status_get_adelay(bl) status->get_status_data(bl)->adelay
-#define status_get_amotion(bl) status->get_status_data(bl)->amotion
-#define status_get_dmotion(bl) status->get_status_data(bl)->dmotion
-#define status_get_element(bl) status->get_status_data(bl)->def_ele
-#define status_get_element_level(bl) status->get_status_data(bl)->ele_lv
-#define status_get_attack_sc_element(bl, sc) status->calc_attack_element(bl, sc, 0)
-#define status_get_attack_element(bl) status->get_status_data(bl)->rhw.ele
-#define status_get_attack_lelement(bl) status->get_status_data(bl)->lhw.ele
-#define status_get_race(bl) status->get_status_data(bl)->race
-#define status_get_size(bl) status->get_status_data(bl)->size
-#define status_get_mode(bl) status->get_status_data(bl)->mode
+#define status_get_range(bl) (status->get_status_data(bl)->rhw.range)
+#define status_get_hp(bl) (status->get_status_data(bl)->hp)
+#define status_get_max_hp(bl) (status->get_status_data(bl)->max_hp)
+#define status_get_sp(bl) (status->get_status_data(bl)->sp)
+#define status_get_max_sp(bl) (status->get_status_data(bl)->max_sp)
+#define status_get_str(bl) (status->get_status_data(bl)->str)
+#define status_get_agi(bl) (status->get_status_data(bl)->agi)
+#define status_get_vit(bl) (status->get_status_data(bl)->vit)
+#define status_get_int(bl) (status->get_status_data(bl)->int_)
+#define status_get_dex(bl) (status->get_status_data(bl)->dex)
+#define status_get_luk(bl) (status->get_status_data(bl)->luk)
+#define status_get_hit(bl) (status->get_status_data(bl)->hit)
+#define status_get_flee(bl) (status->get_status_data(bl)->flee)
+#define status_get_mdef(bl) (status->get_status_data(bl)->mdef)
+#define status_get_flee2(bl) (status->get_status_data(bl)->flee2)
+#define status_get_def2(bl) (status->get_status_data(bl)->def2)
+#define status_get_mdef2(bl) (status->get_status_data(bl)->mdef2)
+#define status_get_critical(bl) (status->get_status_data(bl)->cri)
+#define status_get_batk(bl) (status->get_status_data(bl)->batk)
+#define status_get_watk(bl) (status->get_status_data(bl)->rhw.atk)
+#define status_get_watk2(bl) (status->get_status_data(bl)->rhw.atk2)
+#define status_get_matk_max(bl) (status->get_status_data(bl)->matk_max)
+#define status_get_matk_min(bl) (status->get_status_data(bl)->matk_min)
+#define status_get_lwatk(bl) (status->get_status_data(bl)->lhw.atk)
+#define status_get_lwatk2(bl) (status->get_status_data(bl)->lhw.atk2)
+#define status_get_adelay(bl) (status->get_status_data(bl)->adelay)
+#define status_get_amotion(bl) (status->get_status_data(bl)->amotion)
+#define status_get_dmotion(bl) (status->get_status_data(bl)->dmotion)
+#define status_get_element(bl) (status->get_status_data(bl)->def_ele)
+#define status_get_element_level(bl) (status->get_status_data(bl)->ele_lv)
+#define status_get_attack_sc_element(bl, sc) (status->calc_attack_element((bl), (sc), 0))
+#define status_get_attack_element(bl) (status->get_status_data(bl)->rhw.ele)
+#define status_get_attack_lelement(bl) (status->get_status_data(bl)->lhw.ele)
+#define status_get_race(bl) (status->get_status_data(bl)->race)
+#define status_get_size(bl) (status->get_status_data(bl)->size)
+#define status_get_mode(bl) (status->get_status_data(bl)->mode)
//Short version, receives rate in 1->100 range, and does not uses a flag setting.
-#define sc_start(bl, type, rate, val1, tick) status->change_start(bl,type,100*(rate),val1,0,0,0,tick,0)
-#define sc_start2(bl, type, rate, val1, val2, tick) status->change_start(bl,type,100*(rate),val1,val2,0,0,tick,0)
-#define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) status->change_start(bl,type,100*(rate),val1,val2,val3,val4,tick,0)
+#define sc_start(bl, type, rate, val1, tick) (status->change_start((bl),(type),100*(rate),(val1),0,0,0,(tick),0))
+#define sc_start2(bl, type, rate, val1, val2, tick) (status->change_start((bl),(type),100*(rate),(val1),(val2),0,0,(tick),0))
+#define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) (status->change_start((bl),(type),100*(rate),(val1),(val2),(val3),(val4),(tick),0))
-#define status_change_end(bl,type,tid) status->change_end_(bl,type,tid,__FILE__,__LINE__)
+#define status_change_end(bl,type,tid) (status->change_end_((bl),(type),(tid),__FILE__,__LINE__))
-#define status_calc_bl(bl, flag) status->calc_bl_(bl, (enum scb_flag)(flag), SCO_NONE)
-#define status_calc_mob(md, opt) status->calc_bl_(&(md)->bl, SCB_ALL, opt)
-#define status_calc_pet(pd, opt) status->calc_bl_(&(pd)->bl, SCB_ALL, opt)
-#define status_calc_pc(sd, opt) status->calc_bl_(&(sd)->bl, SCB_ALL, opt)
-#define status_calc_homunculus(hd, opt) status->calc_bl_(&(hd)->bl, SCB_ALL, opt)
-#define status_calc_mercenary(md, opt) status->calc_bl_(&(md)->bl, SCB_ALL, opt)
-#define status_calc_elemental(ed, opt) status->calc_bl_(&(ed)->bl, SCB_ALL, opt)
-#define status_calc_npc(nd, opt) status->calc_bl_(&(nd)->bl, SCB_ALL, opt)
+#define status_calc_bl(bl, flag) (status->calc_bl_((bl), (enum scb_flag)(flag), SCO_NONE))
+#define status_calc_mob(md, opt) (status->calc_bl_(&(md)->bl, SCB_ALL, (opt)))
+#define status_calc_pet(pd, opt) (status->calc_bl_(&(pd)->bl, SCB_ALL, (opt)))
+#define status_calc_pc(sd, opt) (status->calc_bl_(&(sd)->bl, SCB_ALL, (opt)))
+#define status_calc_homunculus(hd, opt) (status->calc_bl_(&(hd)->bl, SCB_ALL, (opt)))
+#define status_calc_mercenary(md, opt) (status->calc_bl_(&(md)->bl, SCB_ALL, (opt)))
+#define status_calc_elemental(ed, opt) (status->calc_bl_(&(ed)->bl, SCB_ALL, (opt)))
+#define status_calc_npc(nd, opt) (status->calc_bl_(&(nd)->bl, SCB_ALL, (opt)))
// bonus values and upgrade chances for refining equipment
struct s_refine_info {