summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/battle.c5
-rw-r--r--src/map/clif.c76
-rw-r--r--src/map/clif.h5
-rw-r--r--src/map/homunculus.h15
-rw-r--r--src/map/itemdb.c7
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/map.h4
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/mob.h2
-rw-r--r--src/map/npc.c2
-rw-r--r--src/map/packets.h11
-rw-r--r--src/map/packets_struct.h6
-rw-r--r--src/map/pet.c2
-rw-r--r--src/map/pet.h2
-rw-r--r--src/map/script.c269
-rw-r--r--src/map/script.h4
-rw-r--r--src/map/skill.c17
-rw-r--r--src/map/status.c104
-rw-r--r--src/map/status.h14
-rw-r--r--src/map/unit.c2
21 files changed, 334 insertions, 223 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9d03dd057..e223f698c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3917,7 +3917,7 @@ ACMD(mapinfo)
strcat(atcmd_output, msg_fd(fd,1096)); // PartyLock |
if (map->list[m_id].flag.guildlock)
strcat(atcmd_output, msg_fd(fd,1097)); // GuildLock |
- if (map->list[m_id].flag.noviewid)
+ if (map->list[m_id].flag.noviewid != EQP_NONE)
strcat(atcmd_output, msg_fd(fd,1079)); // NoViewID |
clif->message(fd, atcmd_output);
diff --git a/src/map/battle.c b/src/map/battle.c
index 3b3ea2047..44adef051 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4118,7 +4118,8 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
#else
short totaldef = tstatus->def2 + (short)status->get_def(target);
#endif
- if ( sd ) wd.damage += sd->bonus.arrow_atk;
+ if (sd != NULL)
+ wd.damage += sd->bonus.arrow_atk;
md.damage = (int)(3 * (1 + wd.damage) * (5 + skill_lv) / 5.0f);
md.damage -= totaldef;
@@ -4583,7 +4584,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skill_id == NJ_KIRIKAGE))
{
short cri = sstatus->cri;
- if (sd) {
+ if (sd != NULL) {
// if show_katar_crit_bonus is enabled, it already done the calculation in status.c
if (!battle_config.show_katar_crit_bonus && sd->status.weapon == W_KATAR) {
cri <<= 1;
diff --git a/src/map/clif.c b/src/map/clif.c
index 827f57c45..1cd18b68d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1010,7 +1010,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
#endif
#if PACKETVER >= 20131223
p.AID = bl->id;
- p.GID = (sd) ? sd->status.char_id : 0; // CCODE
+ p.GID = (sd) ? sd->status.char_id : 0; // CCODE
#else
p.GID = bl->id;
#endif
@@ -1151,7 +1151,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
#endif
#if PACKETVER >= 20131223
p.AID = bl->id;
- p.GID = (sd) ? sd->status.char_id : 0; // CCODE
+ p.GID = (sd) ? sd->status.char_id : 0; // CCODE
#else
p.GID = bl->id;
#endif
@@ -1246,7 +1246,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
#endif
#if PACKETVER >= 20131223
p.AID = bl->id;
- p.GID = (tsd) ? tsd->status.char_id : 0; // CCODE
+ p.GID = (tsd) ? tsd->status.char_id : 0; // CCODE
#else
p.GID = bl->id;
#endif
@@ -2333,9 +2333,9 @@ void clif_add_random_options(unsigned char* buf, struct item* item)
int i;
nullpo_retv(buf);
for (i = 0; i < 5; i++){
- WBUFW(buf,i*5+0) = 0; // OptIndex
- WBUFW(buf,i*5+2) = 0; // Value
- WBUFB(buf,i*5+4) = 0; // Param1
+ WBUFW(buf,i*5+0) = 0; // OptIndex
+ WBUFW(buf,i*5+2) = 0; // Value
+ WBUFB(buf,i*5+4) = 0; // Param1
}
}
@@ -4330,7 +4330,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int
p.leftDamage = damage2;
}
#if PACKETVER >= 20131223
- p.is_sp_damaged = 0; // [ToDo] IsSPDamage - Displays blue digits.
+ p.is_sp_damaged = 0; // TODO: IsSPDamage - Displays blue digits.
#endif
if(disguised(dst)) {
@@ -5078,7 +5078,7 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick
// type 6 (ACTION_SKILL) skills. So we have to do a small
// hack to set all type 6 to be sent as type 8 ACTION_ATTACK_MULTIPLE
#if PACKETVER < 20131223
- WBUFB(buf, 32) = type;
+ WBUFB(buf, 32) = type;
#else
WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type;
#endif
@@ -10874,6 +10874,25 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
pc->setcart(sd,type);
}
+/// Request to select cart's visual look for new cart design (CZ_SELECTCART).
+/// 0980 <identity>.L <type>.B
+void clif_parse_SelectCart(int fd, struct map_session_data *sd)
+{
+#if PACKETVER >= 20150805 // RagexeRE
+ int type;
+
+ if (!sd || !pc->checkskill(sd, MC_CARTDECORATE) || RFIFOL(fd, 2) != sd->status.account_id)
+ return;
+
+ type = (int)RFIFOB(fd, 6);
+
+ if (type <= MAX_BASE_CARTS || type > MAX_CARTS)
+ return;
+
+ pc->setcart(sd, type);
+#endif
+}
+
void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2)));
/// Request to increase status (CZ_STATUS_CHANGE).
/// 00bb <status id>.W <amount>.B
@@ -17547,18 +17566,18 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) {
p.PacketType = maptypeproperty2Type;
p.type = 0x28;
- p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; //PARTY
- p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; // GUILD
- p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1: 0; // SIEGE
- p.flag.mineffect = map_flag_gvg(bl->m) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); // USE_SIMPLE_EFFECT - Forcing /mineffect in castles during WoE (probably redundant? I'm not sure)
+ p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; //PARTY
+ p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; // GUILD
+ p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1: 0; // SIEGE
+ p.flag.mineffect = map_flag_gvg(bl->m) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); // USE_SIMPLE_EFFECT - Forcing /mineffect in castles during WoE (probably redundant? I'm not sure)
p.flag.nolockon = 0; // DISABLE_LOCKON - TODO
- p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; // COUNT_PK
- p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; // NO_PARTY_FORMATION
- p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; // BATTLEFIELD
+ p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; // COUNT_PK
+ p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; // NO_PARTY_FORMATION
+ p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; // BATTLEFIELD
p.flag.nocostume = (map->list[bl->m].flag.noviewid & EQP_COSTUME) ? 1 : 0; // DISABLE_COSTUMEITEM - Disables Costume Sprite
p.flag.usecart = 1; // USECART - TODO
p.flag.summonstarmiracle = 0; // SUNMOONSTAR_MIRACLE - TODO
- p.flag.SpareBits = 0; // UNUSED
+ p.flag.SpareBits = 0; // UNUSED
clif->send(&p,sizeof(p),bl,t);
#endif
@@ -18607,6 +18626,28 @@ void clif_dressroom_open(struct map_session_data *sd, int view)
WFIFOSET(fd,packet_len(0xa02));
}
+/// Request to select cart's visual look for new cart design (ZC_SELECTCART).
+/// 097f <Length>.W <identity>.L <type>.B
+void clif_selectcart(struct map_session_data *sd)
+{
+#if PACKETVER >= 20150805
+ int i = 0, fd;
+
+ fd = sd->fd;
+
+ WFIFOHEAD(fd, 8 + MAX_CARTDECORATION_CARTS);
+ WFIFOW(fd, 0) = 0x97f;
+ WFIFOW(fd, 2) = 8 + MAX_CARTDECORATION_CARTS;
+ WFIFOL(fd, 4) = sd->status.account_id;
+
+ for (i = 0; i < MAX_CARTDECORATION_CARTS; i++) {
+ WFIFOB(fd, 8 + i) = MAX_BASE_CARTS + 1 + i;
+ }
+
+ WFIFOSET(fd, 8 + MAX_CARTDECORATION_CARTS);
+#endif
+}
+
/* */
unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) {
if( sd ) {
@@ -19419,6 +19460,8 @@ void clif_defaults(void) {
clif->cancelmergeitem = clif_cancelmergeitem;
clif->comparemergeitem = clif_comparemergeitem;
clif->ackmergeitems = clif_ackmergeitems;
+ /* Cart Deco */
+ clif->selectcart = clif_selectcart;
/*------------------------
*- Parse Incoming Packet
@@ -19467,6 +19510,7 @@ void clif_defaults(void) {
clif->pGetItemFromCart = clif_parse_GetItemFromCart;
clif->pRemoveOption = clif_parse_RemoveOption;
clif->pChangeCart = clif_parse_ChangeCart;
+ clif->pSelectCart = clif_parse_SelectCart;
clif->pStatusUp = clif_parse_StatusUp;
clif->pSkillUp = clif_parse_SkillUp;
clif->pUseSkillToId = clif_parse_UseSkillToId;
diff --git a/src/map/clif.h b/src/map/clif.h
index 5a6b01d31..250689e90 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -63,7 +63,7 @@ struct view_data;
#define clif_disp_onlyself(sd,mes,len) clif->disp_message( &(sd)->bl, (mes), (len), SELF )
#define MAX_ROULETTE_LEVEL 7 /** client-defined value **/
#define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/
-#define RGB2BGR(c) ((c & 0x0000FF) << 16 | (c & 0x00FF00) | (c & 0xFF0000) >> 16)
+#define RGB2BGR(c) (((c) & 0x0000FF) << 16 | ((c) & 0x00FF00) | ((c) & 0xFF0000) >> 16)
#define COLOR_RED 0xff0000U
#define COLOR_GREEN 0x00ff00U
@@ -1338,6 +1338,9 @@ struct clif_interface {
void (*add_random_options) (unsigned char* buf, struct item* item);
void (*pHotkeyRowShift) (int fd, struct map_session_data *sd);
void (*dressroom_open) (struct map_session_data *sd, int view);
+ /* Cart Deco */
+ void(*selectcart) (struct map_session_data *sd);
+ void(*pSelectCart) (int fd, struct map_session_data *sd);
};
#ifdef HERCULES_CORE
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index 1712c98a9..c2ce042ec 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -63,14 +63,15 @@ enum homun_id {
#define homun_alive(x) ((x) && (x)->homunculus.vaporize == HOM_ST_ACTIVE && (x)->battle_status.hp > 0)
#ifdef RENEWAL
-#define HOMUN_LEVEL_STATWEIGHT_VALUE 0
-#define APPLY_HOMUN_LEVEL_STATWEIGHT()( \
- hom->str_value = hom->agi_value = \
- hom->vit_value = hom->int_value = \
- hom->dex_value = hom->luk_value = hom->level / 10 - HOMUN_LEVEL_STATWEIGHT_VALUE \
- )
+#define HOMUN_LEVEL_STATWEIGHT_VALUE 0
+#define APPLY_HOMUN_LEVEL_STATWEIGHT() \
+ do { \
+ hom->str_value = hom->agi_value = \
+ hom->vit_value = hom->int_value = \
+ hom->dex_value = hom->luk_value = hom->level / 10 - HOMUN_LEVEL_STATWEIGHT_VALUE; \
+ } while (false)
#else
-#define APPLY_HOMUN_LEVEL_STATWEIGHT()
+#define APPLY_HOMUN_LEVEL_STATWEIGHT() (void)0
#endif
struct h_stats {
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 048efd636..6428bade5 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1188,7 +1188,7 @@ void itemdb_read_chains(void) {
int c = 0;
config_setting_t *entry = NULL;
- script->set_constant2(name,i-1,0);
+ script->set_constant2(name, i-1, false, false);
itemdb->chains[count].qty = (unsigned short)libconfig->setting_length(itc);
CREATE(itemdb->chains[count].items, struct item_chain_entry, libconfig->setting_length(itc));
@@ -1254,7 +1254,8 @@ int itemdb_combo_split_atoi (char *str, int *val) {
/**
* <combo{:combo{:combo:{..}}}>,<{ script }>
**/
-void itemdb_read_combos() {
+void itemdb_read_combos(void)
+{
uint32 lines = 0, count = 0;
char line[1024];
char filepath[256];
@@ -2148,7 +2149,7 @@ void itemdb_name_constants(void) {
script->parser_current_file = "Item Database (Likely an invalid or conflicting AegisName)";
#endif // ENABLE_CASE_CHECK
for( data = dbi_first(iter); dbi_exists(iter); data = dbi_next(iter) )
- script->set_constant2(data->name,data->nameid,0);
+ script->set_constant2(data->name, data->nameid, false, false);
#ifdef ENABLE_CASE_CHECK
script->parser_current_file = NULL;
#endif // ENABLE_CASE_CHECK
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index d751451c6..cde73f3b4 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -626,7 +626,7 @@ struct itemdb_interface {
int (*isidentified) (int nameid);
int (*isidentified2) (struct item_data *data);
int (*combo_split_atoi) (char *str, int *val);
- void (*read_combos) ();
+ void (*read_combos) (void);
int (*gendercheck) (struct item_data *id);
int (*validate_entry) (struct item_data *entry, int n, const char *source);
void (*readdb_additional_fields) (int itemid, config_setting_t *it, int n, const char *source);
diff --git a/src/map/map.h b/src/map/map.h
index 4c74d352c..ff7ca2d38 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -716,7 +716,7 @@ struct map_data {
unsigned noknockback : 1;
unsigned notomb : 1;
unsigned nocashshop : 1;
- unsigned noviewid : 22;
+ uint32 noviewid; ///< noviewid (bitmask - @see enum equip_pos)
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
@@ -866,6 +866,7 @@ typedef struct elemental_data TBL_ELEM;
* object is passed to BL_UCAST. It's declared as static inline to let the
* compiler optimize out the function call overhead.
*/
+static inline struct block_list *BL_UCAST_(struct block_list *bl) __attribute__((unused));
static inline struct block_list *BL_UCAST_(struct block_list *bl)
{
return bl;
@@ -894,6 +895,7 @@ static inline struct block_list *BL_UCAST_(struct block_list *bl)
* object is passed to BL_UCAST. It's declared as static inline to let the
* compiler optimize out the function call overhead.
*/
+static inline const struct block_list *BL_UCCAST_(const struct block_list *bl) __attribute__((unused));
static inline const struct block_list *BL_UCCAST_(const struct block_list *bl)
{
return bl;
diff --git a/src/map/mob.c b/src/map/mob.c
index 37da81a15..f93a7fef3 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2064,7 +2064,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
if (battle_config.show_mob_info&3)
clif->charnameack (0, &md->bl);
-
+
#if PACKETVER >= 20131223
// Resend ZC_NOTIFY_MOVEENTRY to Update the HP
if (battle_config.show_monster_hp_bar)
@@ -4316,7 +4316,7 @@ void mob_name_constants(void) {
#endif // ENABLE_CASE_CHECK
for (i = 0; i < MAX_MOB_DB; i++) {
if (mob->db_data[i] && !mob->is_clone(i))
- script->set_constant2(mob->db_data[i]->sprite, i, 0);
+ script->set_constant2(mob->db_data[i]->sprite, i, false, false);
}
#ifdef ENABLE_CASE_CHECK
script->parser_current_file = NULL;
@@ -4922,7 +4922,7 @@ void mob_reload(void) {
/**
* Clears spawn related information for a script reload.
*/
-void mob_clear_spawninfo()
+void mob_clear_spawninfo(void)
{
int i;
for (i = 0; i < MAX_MOB_DB; i++)
diff --git a/src/map/mob.h b/src/map/mob.h
index 5485b2a91..77218bf4a 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -528,7 +528,7 @@ struct mob_interface {
bool (*readdb_race2) (char *fields[], int columns, int current);
bool (*readdb_itemratio) (char *str[], int columns, int current);
void (*load) (bool minimal);
- void (*clear_spawninfo) ();
+ void (*clear_spawninfo) (void);
void (*destroy_mob_db) (int index);
};
diff --git a/src/map/npc.c b/src/map/npc.c
index 411e52c29..acecff6d0 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2551,7 +2551,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
// Support for using Constants in place of NPC View IDs.
int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) {
int val = FAKE_NPC, i = 0;
- char viewid[1024]; // Max size of name from const.txt, see script->read_constdb.
+ char viewid[1024]; // Max size of name from constants.conf, see script->read_constdb.
// Extract view ID / constant
while (w4[i] != '\0') {
diff --git a/src/map/packets.h b/src/map/packets.h
index 9b9c7945f..6174d76d2 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2910,9 +2910,14 @@ packet(0x96e,-1,clif->ackmergeitems);
packet(0x08A8,26,clif->pFriendsListAdd,2);
packet(0x0817,5,clif->pHomMenu,2,4);
packet(0x0923,36,clif->pStoragePassword,0);
- packet(0x09e8,11,clif->pDull); // CZ_OPEN_MAILBOX
- packet(0x0a2e,6,clif->pDull); // TITLE
- packet(0x0a02,4); // ZC_DRESSROOM_OPEN
+ packet(0x09e8,11,clif->pDull); // CZ_OPEN_MAILBOX
+ packet(0x0a2e,6,clif->pDull); // TITLE
+ packet(0x0a02,4); // ZC_DRESSROOM_OPEN
+#endif
+
+#if PACKETVER >= 20150805 // RagexeRE
+ packet(0x097f,-1); // ZC_SELECTCART
+ packet(0x0980,7,clif->pSelectCart); // CZ_SELECTCART
#endif
/* PacketKeys: http://herc.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 43ff0737f..cc8389a6b 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -1157,9 +1157,9 @@ struct packet_hotkey {
char Rotate;
#endif
struct {
- char isSkill; // 0: Item, 1:Skill
- unsigned int ID; // Item/Skill ID
- short count; // Item Quantity/Skill Level
+ char isSkill; // 0: Item, 1:Skill
+ unsigned int ID; // Item/Skill ID
+ short count; // Item Quantity/Skill Level
} hotkey[MAX_HOTKEYS];
#else // not HOTKEY_SAVING
UNAVAILABLE_STRUCT;
diff --git a/src/map/pet.c b/src/map/pet.c
index db8d0d1f1..c6f7e8cca 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1178,7 +1178,7 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
/**
* Loads (or reloads) the pet database.
*/
-int read_petdb()
+int read_petdb(void)
{
const char *filename[] = {
DBPATH"pet_db.txt",
diff --git a/src/map/pet.h b/src/map/pet.h
index 2442a381f..83e39a887 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -166,7 +166,7 @@ struct pet_interface {
int (*skill_bonus_timer) (int tid, int64 tick, int id, intptr_t data);
int (*recovery_timer) (int tid, int64 tick, int id, intptr_t data);
int (*skill_support_timer) (int tid, int64 tick, int id, intptr_t data);
- int (*read_db) ();
+ int (*read_db) (void);
};
#ifdef HERCULES_CORE
diff --git a/src/map/script.c b/src/map/script.c
index befb85304..35a71868a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1379,6 +1379,10 @@ const char* parse_simpleexpr(const char *p)
return pv;
}
+ if (script->str_data[l].type == C_INT && script->str_data[l].deprecated) {
+ disp_warning_message("This constant is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", p);
+ }
+
p=script->skip_word(p);
if( *p == '[' ) {
// array(name[i] => getelementofarray(name,i) )
@@ -2231,25 +2235,31 @@ bool script_get_constant(const char* name, int* value)
return false;
}
value[0] = script->str_data[n].val;
+ if (script->str_data[n].deprecated) {
+ ShowWarning("The constant '%s' is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", name);
+ }
return true;
}
/// Creates new constant or parameter with given value.
-void script_set_constant(const char* name, int value, bool isparameter) {
+void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated)
+{
int n = script->add_str(name);
if( script->str_data[n].type == C_NOP ) {// new
- script->str_data[n].type = isparameter ? C_PARAM : C_INT;
+ script->str_data[n].type = is_parameter ? C_PARAM : C_INT;
script->str_data[n].val = value;
+ script->str_data[n].deprecated = is_deprecated ? 1 : 0;
} else if( script->str_data[n].type == C_PARAM || script->str_data[n].type == C_INT ) {// existing parameter or constant
ShowError("script_set_constant: Attempted to overwrite existing %s '%s' (old value=%d, new value=%d).\n", ( script->str_data[n].type == C_PARAM ) ? "parameter" : "constant", name, script->str_data[n].val, value);
} else {// existing name
- ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", isparameter ? "parameter" : "constant", name, script->op2name(script->str_data[n].type));
+ ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", is_parameter ? "parameter" : "constant", name, script->op2name(script->str_data[n].type));
}
}
/* adds data to a existent constant in the database, inserted normally via parse */
-void script_set_constant2(const char *name, int value, bool isparameter) {
+void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated)
+{
int n = script->add_str(name);
if( script->str_data[n].type == C_PARAM ) {
@@ -2273,36 +2283,66 @@ void script_set_constant2(const char *name, int value, bool isparameter) {
script->str_data[n].label = -1;
}
- script->str_data[n].type = isparameter ? C_PARAM : C_INT;
+ script->str_data[n].type = is_parameter ? C_PARAM : C_INT;
script->str_data[n].val = value;
-
+ script->str_data[n].deprecated = is_deprecated ? 1 : 0;
}
-/*==========================================
- * Reading constant databases
- * const.txt
- *------------------------------------------*/
-void read_constdb(void) {
- FILE *fp;
- char line[1024],name[1024],val[1024];
- int type;
- sprintf(line, "%s/const.txt", map->db_path);
- fp=fopen(line, "r");
- if(fp==NULL) {
- ShowError("can't read %s\n", line);
- return ;
+/**
+ * Loads the constants database from constants.conf
+ */
+void read_constdb(void)
+{
+ config_t constants_conf;
+ char filepath[256];
+ config_setting_t *cdb;
+ config_setting_t *t;
+ int i = 0;
+
+ sprintf(filepath, "%s/constants.conf", map->db_path);
+
+ if (libconfig->read_file(&constants_conf, filepath) || !(cdb = libconfig->setting_get_member(constants_conf.root, "constants_db"))) {
+ ShowError("can't read %s\n", filepath);
+ return;
}
- while (fgets(line, sizeof(line), fp)) {
- if (line[0] == '/' && line[1] == '/')
+
+ while ((t = libconfig->setting_get_elem(cdb, i++))) {
+ bool is_parameter = false;
+ bool is_deprecated = false;
+ int value = 0;
+ const char *name = config_setting_name(t);
+ const char *p = name;
+
+ while (*p != '\0') {
+ if (!ISALNUM(*p) && *p != '_')
+ break;
+ p++;
+ }
+ if (*p != '\0') {
+ ShowWarning("read_constdb: Invalid constant name %s. Skipping.\n", name);
continue;
- type = 0;
- if (sscanf(line, "%1023[A-Za-z0-9_],%1023[-0-9xXA-Fa-f],%d", name, val, &type) >=2
- || sscanf(line, "%1023[A-Za-z0-9_] %1023[-0-9xXA-Fa-f] %d", name, val, &type) >=2
- ) {
- script->set_constant(name, (int)strtol(val, NULL, 0), (bool)type);
}
+ if (config_setting_is_aggregate(t)) {
+ int i32;
+ if (!libconfig->setting_lookup_int(t, "Value", &i32)) {
+ ShowWarning("read_constdb: Invalid entry for %s. Skipping.\n", name);
+ continue;
+ }
+ value = i32;
+ if (libconfig->setting_lookup_bool(t, "Parameter", &i32)) {
+ if (i32 != 0)
+ is_parameter = true;
+ }
+ if (libconfig->setting_lookup_bool(t, "Deprecated", &i32)) {
+ if (i32 != 0)
+ is_deprecated = true;
+ }
+ } else {
+ value = libconfig->setting_get_int(t);
+ }
+ script->set_constant(name, value, is_parameter, is_deprecated);
}
- fclose(fp);
+ libconfig->destroy(&constants_conf);
}
// Standard UNIX tab size is 8
@@ -11684,7 +11724,7 @@ BUILDIN(getmapflag)
case MF_RESET: script_pushint(st,map->list[m].flag.reset); break;
case MF_NOTOMB: script_pushint(st,map->list[m].flag.notomb); break;
case MF_NOCASHSHOP: script_pushint(st,map->list[m].flag.nocashshop); break;
- case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break;
+ case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break;
}
}
@@ -11808,7 +11848,7 @@ BUILDIN(setmapflag) {
case MF_RESET: map->list[m].flag.reset = 1; break;
case MF_NOTOMB: map->list[m].flag.notomb = 1; break;
case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 1; break;
- case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? 0 : val; break;
+ case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? EQP_NONE : val; break;
}
}
@@ -11895,7 +11935,7 @@ BUILDIN(removemapflag) {
case MF_RESET: map->list[m].flag.reset = 0; break;
case MF_NOTOMB: map->list[m].flag.notomb = 0; break;
case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 0; break;
- case MF_NOVIEWID: map->list[m].flag.noviewid = 0; break;
+ case MF_NOVIEWID: map->list[m].flag.noviewid = EQP_NONE; break;
}
}
@@ -20778,118 +20818,121 @@ void script_label_add(int key, int pos) {
/**
* Sets source-end constants for scripts to play with
**/
-void script_hardcoded_constants(void) {
+void script_hardcoded_constants(void)
+{
+ script->set_constant("true", 1, false, false);
+ script->set_constant("false", 0, false, false);
/* server defines */
- script->set_constant("PACKETVER",PACKETVER,false);
- script->set_constant("MAX_LEVEL",MAX_LEVEL,false);
- script->set_constant("MAX_STORAGE",MAX_STORAGE,false);
- script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false);
- script->set_constant("MAX_CART",MAX_INVENTORY,false);
- script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false);
- script->set_constant("MAX_ZENY",MAX_ZENY,false);
- script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false);
- script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false);
- script->set_constant("MAX_REFINE",MAX_REFINE,false);
+ script->set_constant("PACKETVER",PACKETVER,false, false);
+ script->set_constant("MAX_LEVEL",MAX_LEVEL,false, false);
+ script->set_constant("MAX_STORAGE",MAX_STORAGE,false, false);
+ script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false, false);
+ script->set_constant("MAX_CART",MAX_INVENTORY,false, false);
+ script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false, false);
+ script->set_constant("MAX_ZENY",MAX_ZENY,false, false);
+ script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false);
+ script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false, false);
+ script->set_constant("MAX_REFINE",MAX_REFINE,false, false);
/* status options */
- script->set_constant("Option_Nothing",OPTION_NOTHING,false);
- script->set_constant("Option_Sight",OPTION_SIGHT,false);
- script->set_constant("Option_Hide",OPTION_HIDE,false);
- script->set_constant("Option_Cloak",OPTION_CLOAK,false);
- script->set_constant("Option_Falcon",OPTION_FALCON,false);
- script->set_constant("Option_Riding",OPTION_RIDING,false);
- script->set_constant("Option_Invisible",OPTION_INVISIBLE,false);
- script->set_constant("Option_Orcish",OPTION_ORCISH,false);
- script->set_constant("Option_Wedding",OPTION_WEDDING,false);
- script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false);
- script->set_constant("Option_Flying",OPTION_FLYING,false);
- script->set_constant("Option_Xmas",OPTION_XMAS,false);
- script->set_constant("Option_Transform",OPTION_TRANSFORM,false);
- script->set_constant("Option_Summer",OPTION_SUMMER,false);
- script->set_constant("Option_Dragon1",OPTION_DRAGON1,false);
- script->set_constant("Option_Wug",OPTION_WUG,false);
- script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false);
- script->set_constant("Option_Madogear",OPTION_MADOGEAR,false);
- script->set_constant("Option_Dragon2",OPTION_DRAGON2,false);
- script->set_constant("Option_Dragon3",OPTION_DRAGON3,false);
- script->set_constant("Option_Dragon4",OPTION_DRAGON4,false);
- script->set_constant("Option_Dragon5",OPTION_DRAGON5,false);
- script->set_constant("Option_Hanbok",OPTION_HANBOK,false);
- script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false);
+ script->set_constant("Option_Nothing",OPTION_NOTHING,false, false);
+ script->set_constant("Option_Sight",OPTION_SIGHT,false, false);
+ script->set_constant("Option_Hide",OPTION_HIDE,false, false);
+ script->set_constant("Option_Cloak",OPTION_CLOAK,false, false);
+ script->set_constant("Option_Falcon",OPTION_FALCON,false, false);
+ script->set_constant("Option_Riding",OPTION_RIDING,false, false);
+ script->set_constant("Option_Invisible",OPTION_INVISIBLE,false, false);
+ script->set_constant("Option_Orcish",OPTION_ORCISH,false, false);
+ script->set_constant("Option_Wedding",OPTION_WEDDING,false, false);
+ script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false, false);
+ script->set_constant("Option_Flying",OPTION_FLYING,false, false);
+ script->set_constant("Option_Xmas",OPTION_XMAS,false, false);
+ script->set_constant("Option_Transform",OPTION_TRANSFORM,false, false);
+ script->set_constant("Option_Summer",OPTION_SUMMER,false, false);
+ script->set_constant("Option_Dragon1",OPTION_DRAGON1,false, false);
+ script->set_constant("Option_Wug",OPTION_WUG,false, false);
+ script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false, false);
+ script->set_constant("Option_Madogear",OPTION_MADOGEAR,false, false);
+ script->set_constant("Option_Dragon2",OPTION_DRAGON2,false, false);
+ script->set_constant("Option_Dragon3",OPTION_DRAGON3,false, false);
+ script->set_constant("Option_Dragon4",OPTION_DRAGON4,false, false);
+ script->set_constant("Option_Dragon5",OPTION_DRAGON5,false, false);
+ script->set_constant("Option_Hanbok",OPTION_HANBOK,false, false);
+ script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false, false);
/* status option compounds */
- script->set_constant("Option_Dragon",OPTION_DRAGON,false);
- script->set_constant("Option_Costume",OPTION_COSTUME,false);
+ script->set_constant("Option_Dragon",OPTION_DRAGON,false, false);
+ script->set_constant("Option_Costume",OPTION_COSTUME,false, false);
/* send_target */
- script->set_constant("ALL_CLIENT",ALL_CLIENT,false);
- script->set_constant("ALL_SAMEMAP",ALL_SAMEMAP,false);
- script->set_constant("AREA",AREA,false);
- script->set_constant("AREA_WOS",AREA_WOS,false);
- script->set_constant("AREA_WOC",AREA_WOC,false);
- script->set_constant("AREA_WOSC",AREA_WOSC,false);
- script->set_constant("AREA_CHAT_WOC",AREA_CHAT_WOC,false);
- script->set_constant("CHAT",CHAT,false);
- script->set_constant("CHAT_WOS",CHAT_WOS,false);
- script->set_constant("PARTY",PARTY,false);
- script->set_constant("PARTY_WOS",PARTY_WOS,false);
- script->set_constant("PARTY_SAMEMAP",PARTY_SAMEMAP,false);
- script->set_constant("PARTY_SAMEMAP_WOS",PARTY_SAMEMAP_WOS,false);
- script->set_constant("PARTY_AREA",PARTY_AREA,false);
- script->set_constant("PARTY_AREA_WOS",PARTY_AREA_WOS,false);
- script->set_constant("GUILD",GUILD,false);
- script->set_constant("GUILD_WOS",GUILD_WOS,false);
- script->set_constant("GUILD_SAMEMAP",GUILD_SAMEMAP,false);
- script->set_constant("GUILD_SAMEMAP_WOS",GUILD_SAMEMAP_WOS,false);
- script->set_constant("GUILD_AREA",GUILD_AREA,false);
- script->set_constant("GUILD_AREA_WOS",GUILD_AREA_WOS,false);
- script->set_constant("GUILD_NOBG",GUILD_NOBG,false);
- script->set_constant("DUEL",DUEL,false);
- script->set_constant("DUEL_WOS",DUEL_WOS,false);
- script->set_constant("SELF",SELF,false);
- script->set_constant("BG",BG,false);
- script->set_constant("BG_WOS",BG_WOS,false);
- script->set_constant("BG_SAMEMAP",BG_SAMEMAP,false);
- script->set_constant("BG_SAMEMAP_WOS",BG_SAMEMAP_WOS,false);
- script->set_constant("BG_AREA",BG_AREA,false);
- script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false);
- script->set_constant("BG_QUEUE",BG_QUEUE,false);
+ script->set_constant("ALL_CLIENT",ALL_CLIENT,false, false);
+ script->set_constant("ALL_SAMEMAP",ALL_SAMEMAP,false, false);
+ script->set_constant("AREA",AREA,false, false);
+ script->set_constant("AREA_WOS",AREA_WOS,false, false);
+ script->set_constant("AREA_WOC",AREA_WOC,false, false);
+ script->set_constant("AREA_WOSC",AREA_WOSC,false, false);
+ script->set_constant("AREA_CHAT_WOC",AREA_CHAT_WOC,false, false);
+ script->set_constant("CHAT",CHAT,false, false);
+ script->set_constant("CHAT_WOS",CHAT_WOS,false, false);
+ script->set_constant("PARTY",PARTY,false, false);
+ script->set_constant("PARTY_WOS",PARTY_WOS,false, false);
+ script->set_constant("PARTY_SAMEMAP",PARTY_SAMEMAP,false, false);
+ script->set_constant("PARTY_SAMEMAP_WOS",PARTY_SAMEMAP_WOS,false, false);
+ script->set_constant("PARTY_AREA",PARTY_AREA,false, false);
+ script->set_constant("PARTY_AREA_WOS",PARTY_AREA_WOS,false, false);
+ script->set_constant("GUILD",GUILD,false, false);
+ script->set_constant("GUILD_WOS",GUILD_WOS,false, false);
+ script->set_constant("GUILD_SAMEMAP",GUILD_SAMEMAP,false, false);
+ script->set_constant("GUILD_SAMEMAP_WOS",GUILD_SAMEMAP_WOS,false, false);
+ script->set_constant("GUILD_AREA",GUILD_AREA,false, false);
+ script->set_constant("GUILD_AREA_WOS",GUILD_AREA_WOS,false, false);
+ script->set_constant("GUILD_NOBG",GUILD_NOBG,false, false);
+ script->set_constant("DUEL",DUEL,false, false);
+ script->set_constant("DUEL_WOS",DUEL_WOS,false, false);
+ script->set_constant("SELF",SELF,false, false);
+ script->set_constant("BG",BG,false, false);
+ script->set_constant("BG_WOS",BG_WOS,false, false);
+ script->set_constant("BG_SAMEMAP",BG_SAMEMAP,false, false);
+ script->set_constant("BG_SAMEMAP_WOS",BG_SAMEMAP_WOS,false, false);
+ script->set_constant("BG_AREA",BG_AREA,false, false);
+ script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false, false);
+ script->set_constant("BG_QUEUE",BG_QUEUE,false, false);
/* Renewal */
#ifdef RENEWAL
- script->set_constant("RENEWAL", 1, false);
+ script->set_constant("RENEWAL", 1, false, false);
#else
- script->set_constant("RENEWAL", 0, false);
+ script->set_constant("RENEWAL", 0, false, false);
#endif
#ifdef RENEWAL_CAST
- script->set_constant("RENEWAL_CAST", 1, false);
+ script->set_constant("RENEWAL_CAST", 1, false, false);
#else
- script->set_constant("RENEWAL_CAST", 0, false);
+ script->set_constant("RENEWAL_CAST", 0, false, false);
#endif
#ifdef RENEWAL_DROP
- script->set_constant("RENEWAL_DROP", 1, false);
+ script->set_constant("RENEWAL_DROP", 1, false, false);
#else
- script->set_constant("RENEWAL_DROP", 0, false);
+ script->set_constant("RENEWAL_DROP", 0, false, false);
#endif
#ifdef RENEWAL_EXP
- script->set_constant("RENEWAL_EXP", 1, false);
+ script->set_constant("RENEWAL_EXP", 1, false, false);
#else
- script->set_constant("RENEWAL_EXP", 0, false);
+ script->set_constant("RENEWAL_EXP", 0, false, false);
#endif
#ifdef RENEWAL_LVDMG
- script->set_constant("RENEWAL_LVDMG", 1, false);
+ script->set_constant("RENEWAL_LVDMG", 1, false, false);
#else
- script->set_constant("RENEWAL_LVDMG", 0, false);
+ script->set_constant("RENEWAL_LVDMG", 0, false, false);
#endif
#ifdef RENEWAL_EDP
- script->set_constant("RENEWAL_EDP", 1, false);
+ script->set_constant("RENEWAL_EDP", 1, false, false);
#else
- script->set_constant("RENEWAL_EDP", 0, false);
+ script->set_constant("RENEWAL_EDP", 0, false, false);
#endif
#ifdef RENEWAL_ASPD
- script->set_constant("RENEWAL_ASPD", 1, false);
+ script->set_constant("RENEWAL_ASPD", 1, false, false);
#else
- script->set_constant("RENEWAL_ASPD", 0, false);
+ script->set_constant("RENEWAL_ASPD", 0, false, false);
#endif
}
diff --git a/src/map/script.h b/src/map/script.h
index 5f71662c6..dbb0f8a03 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -666,8 +666,8 @@ struct script_interface {
struct script_data* (*push_str) (struct script_stack* stack, enum c_op type, char* str);
struct script_data* (*push_copy) (struct script_stack* stack, int pos);
void (*pop_stack) (struct script_state* st, int start, int end);
- void (*set_constant) (const char* name, int value, bool isparameter);
- void (*set_constant2) (const char *name, int value, bool isparameter);
+ void (*set_constant) (const char *name, int value, bool is_parameter, bool is_deprecated);
+ void (*set_constant2) (const char *name, int value, bool is_parameter, bool is_deprecated);
bool (*get_constant) (const char* name, int* value);
void (*label_add)(int key, int pos);
void (*run) (struct script_code *rootscript, int pos, int rid, int oid);
diff --git a/src/map/skill.c b/src/map/skill.c
index b3c264e43..be899d0dc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4374,7 +4374,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
clif->slide(src, x, y);
clif->fixpos(src); // the official server send these two packets.
skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag);
- if ( rnd() % 100 < 4 * skill_lv && skill_id == GC_DARKILLUSION )
+ if (rnd() % 100 < 4 * skill_lv && skill_id == GC_DARKILLUSION)
skill->castend_damage_id(src, bl, GC_CROSSIMPACT, skill_lv, tick, flag);
}
}
@@ -6047,7 +6047,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
case MC_CHANGECART:
- clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
+ clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
+ break;
+
+ case MC_CARTDECORATE:
+ if (sd) {
+ clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
+ clif->selectcart(sd);
+ }
break;
case TK_MISSION:
@@ -14836,7 +14843,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
}
if (sc->data[SC_MYSTICSCROLL])
VARCAST_REDUCTION(sc->data[SC_MYSTICSCROLL]->val1);
-
+
// Fixed cast reduction bonuses
if( sc->data[SC__LAZINESS] )
fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
@@ -18076,7 +18083,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
return 0;
else {
int cursor;
- /** somehow, the timer vanished. (bugreport:8367) **/
+ /* somehow, the timer vanished. (bugreport:8367) */
ers_free(skill->cd_entry_ers, cd->entry[i]);
cd->entry[i] = NULL;
@@ -18788,7 +18795,7 @@ bool skill_parse_row_skilldb(char* split[], int columns, int current) {
safestrncpy(skill->dbs->db[idx].name, trim(split[15]), sizeof(skill->dbs->db[idx].name));
safestrncpy(skill->dbs->db[idx].desc, trim(split[16]), sizeof(skill->dbs->db[idx].desc));
strdb_iput(skill->name2id_db, skill->dbs->db[idx].name, skill_id);
- script->set_constant2(skill->dbs->db[idx].name,(int)skill_id,0);
+ script->set_constant2(skill->dbs->db[idx].name, (int)skill_id, false, false);
return true;
}
diff --git a/src/map/status.c b/src/map/status.c
index d374f742c..00050e3ed 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -862,38 +862,38 @@ void initChangeTables(void) {
status->dbs->IconChangeTable[SC_M_LIFEPOTION] = SI_M_LIFEPOTION;
status->dbs->IconChangeTable[SC_G_LIFEPOTION] = SI_G_LIFEPOTION;
status->dbs->IconChangeTable[SC_MYSTICPOWDER] = SI_MYSTICPOWDER;
-
+
// Eden Crystal Synthesis
status->dbs->IconChangeTable[SC_QUEST_BUFF1] = SI_QUEST_BUFF1;
status->dbs->IconChangeTable[SC_QUEST_BUFF2] = SI_QUEST_BUFF2;
status->dbs->IconChangeTable[SC_QUEST_BUFF3] = SI_QUEST_BUFF3;
-
+
// Geffen Magic Tournament
status->dbs->IconChangeTable[SC_GEFFEN_MAGIC1] = SI_GEFFEN_MAGIC1;
status->dbs->IconChangeTable[SC_GEFFEN_MAGIC2] = SI_GEFFEN_MAGIC2;
status->dbs->IconChangeTable[SC_GEFFEN_MAGIC3] = SI_GEFFEN_MAGIC3;
status->dbs->IconChangeTable[SC_FENRIR_CARD] = SI_FENRIR_CARD;
-
+
// MVP Scrolls
status->dbs->IconChangeTable[SC_MVPCARD_TAOGUNKA] = SI_MVPCARD_TAOGUNKA;
status->dbs->IconChangeTable[SC_MVPCARD_MISTRESS] = SI_MVPCARD_MISTRESS;
status->dbs->IconChangeTable[SC_MVPCARD_ORCHERO] = SI_MVPCARD_ORCHERO;
status->dbs->IconChangeTable[SC_MVPCARD_ORCLORD] = SI_MVPCARD_ORCLORD;
-
+
// Mercenary Bonus Effects
status->dbs->IconChangeTable[SC_MER_FLEE] = SI_MER_FLEE;
status->dbs->IconChangeTable[SC_MER_ATK] = SI_MER_ATK;
status->dbs->IconChangeTable[SC_MER_HP] = SI_MER_HP;
status->dbs->IconChangeTable[SC_MER_SP] = SI_MER_SP;
status->dbs->IconChangeTable[SC_MER_HIT] = SI_MER_HIT;
-
+
// Warlock Spheres
status->dbs->IconChangeTable[SC_SUMMON1] = SI_SPHERE_1;
status->dbs->IconChangeTable[SC_SUMMON2] = SI_SPHERE_2;
status->dbs->IconChangeTable[SC_SUMMON3] = SI_SPHERE_3;
status->dbs->IconChangeTable[SC_SUMMON4] = SI_SPHERE_4;
status->dbs->IconChangeTable[SC_SUMMON5] = SI_SPHERE_5;
-
+
// Warlock Preserved spells
status->dbs->IconChangeTable[SC_SPELLBOOK1] = SI_SPELLBOOK1;
status->dbs->IconChangeTable[SC_SPELLBOOK2] = SI_SPELLBOOK2;
@@ -977,7 +977,7 @@ void initChangeTables(void) {
status->dbs->IconChangeTable[SC_REBOUND] = SI_REBOUND;
status->dbs->IconChangeTable[SC_ALL_RIDING] = SI_ALL_RIDING;
status->dbs->IconChangeTable[SC_MONSTER_TRANSFORM] = SI_MONSTER_TRANSFORM;
-
+
// Costumes
status->dbs->IconChangeTable[SC_MOONSTAR] = SI_MOONSTAR;
status->dbs->IconChangeTable[SC_SUPER_STAR] = SI_SUPER_STAR;
@@ -993,7 +993,7 @@ void initChangeTables(void) {
status->dbs->IconChangeTable[SC_TIME_ACCESSORY] = SI_TIME_ACCESSORY;
status->dbs->IconChangeTable[SC_MAGICAL_FEATHER] = SI_MAGICAL_FEATHER;
status->dbs->IconChangeTable[SC_BLOSSOM_FLUTTERING] = SI_BLOSSOM_FLUTTERING;
-
+
// Other SC which are not necessarily associated to skills.
status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION1] |= SCB_ASPD;
status->dbs->ChangeFlagTable[SC_ATTHASTE_POTION2] |= SCB_ASPD;
@@ -1061,7 +1061,7 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_PHI_DEMON] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_MAGIC_CANDY] |= SCB_MATK | SCB_ALL;
status->dbs->ChangeFlagTable[SC_MYSTICPOWDER] |= SCB_FLEE | SCB_LUK;
-
+
// Cash Items
status->dbs->ChangeFlagTable[SC_FOOD_STR_CASH] |= SCB_STR;
status->dbs->ChangeFlagTable[SC_FOOD_AGI_CASH] |= SCB_AGI;
@@ -1069,14 +1069,14 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_FOOD_DEX_CASH] |= SCB_DEX;
status->dbs->ChangeFlagTable[SC_FOOD_INT_CASH] |= SCB_INT;
status->dbs->ChangeFlagTable[SC_FOOD_LUK_CASH] |= SCB_LUK;
-
+
// Mercenary Bonus Effects
status->dbs->ChangeFlagTable[SC_MER_FLEE] |= SCB_FLEE;
status->dbs->ChangeFlagTable[SC_MER_ATK] |= SCB_WATK;
status->dbs->ChangeFlagTable[SC_MER_HP] |= SCB_MAXHP;
status->dbs->ChangeFlagTable[SC_MER_SP] |= SCB_MAXSP;
status->dbs->ChangeFlagTable[SC_MER_HIT] |= SCB_HIT;
-
+
// Guillotine Cross Poison Effects
status->dbs->ChangeFlagTable[SC_PARALYSE] |= SCB_FLEE | SCB_SPEED | SCB_ASPD;
status->dbs->ChangeFlagTable[SC_VENOMBLEED] |= SCB_MAXHP;
@@ -1084,11 +1084,11 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_DEATHHURT] |= SCB_REGEN;
status->dbs->ChangeFlagTable[SC_PYREXIA] |= SCB_HIT | SCB_FLEE;
status->dbs->ChangeFlagTable[SC_OBLIVIONCURSE] |= SCB_REGEN;
-
+
// Royal Guard status
status->dbs->ChangeFlagTable[SC_SHIELDSPELL_DEF] |= SCB_WATK;
status->dbs->ChangeFlagTable[SC_SHIELDSPELL_REF] |= SCB_DEF;
-
+
// Mechanic status
status->dbs->ChangeFlagTable[SC_STEALTHFIELD_MASTER] |= SCB_SPEED;
@@ -1116,7 +1116,7 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_STOMACHACHE] |= SCB_STR | SCB_AGI | SCB_VIT | SCB_INT | SCB_DEX | SCB_LUK | SCB_SPEED;
status->dbs->ChangeFlagTable[SC_PROMOTE_HEALTH_RESERCH] |= SCB_MAXHP | SCB_ALL;
status->dbs->ChangeFlagTable[SC_ENERGY_DRINK_RESERCH] |= SCB_MAXSP | SCB_ALL;
-
+
// Geffen Scrolls
status->dbs->ChangeFlagTable[SC_SKELSCROLL] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_DISTRUCTIONSCROLL] |= SCB_ALL;
@@ -1135,24 +1135,24 @@ void initChangeTables(void) {
status->dbs->ChangeFlagTable[SC_MTF_HITFLEE] |= SCB_HIT | SCB_FLEE;
status->dbs->ChangeFlagTable[SC_MTF_MHP] |= SCB_MAXHP;
status->dbs->ChangeFlagTable[SC_MTF_MSP] |= SCB_MAXSP;
-
+
// Eden Crystal Synthesis
status->dbs->ChangeFlagTable[SC_QUEST_BUFF1] |= SCB_BATK | SCB_MATK;
status->dbs->ChangeFlagTable[SC_QUEST_BUFF2] |= SCB_BATK | SCB_MATK;
status->dbs->ChangeFlagTable[SC_QUEST_BUFF3] |= SCB_BATK | SCB_MATK;
-
+
// Geffen Magic Tournament
status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC1] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC2] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC3] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_FENRIR_CARD] |= SCB_MATK | SCB_ALL;
-
+
// MVP Scrolls
status->dbs->ChangeFlagTable[SC_MVPCARD_TAOGUNKA] |= SCB_MAXHP | SCB_DEF | SCB_MDEF;
status->dbs->ChangeFlagTable[SC_MVPCARD_MISTRESS] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_MVPCARD_ORCHERO] |= SCB_ALL;
status->dbs->ChangeFlagTable[SC_MVPCARD_ORCLORD] |= SCB_ALL;
-
+
// Costumes
status->dbs->ChangeFlagTable[SC_MOONSTAR] |= SCB_NONE;
status->dbs->ChangeFlagTable[SC_SUPER_STAR] |= SCB_NONE;
@@ -1192,7 +1192,7 @@ void initChangeTables(void) {
status->dbs->DisplayType[SC_BLOOD_SUCKER] = true;
status->dbs->DisplayType[SC__SHADOWFORM] = true;
status->dbs->DisplayType[SC_MONSTER_TRANSFORM] = true;
-
+
// Costumes
status->dbs->DisplayType[SC_MOONSTAR] = true;
status->dbs->DisplayType[SC_SUPER_STAR] = true;
@@ -2500,7 +2500,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
}
else if(sd->inventory_data[index]->type == IT_ARMOR) {
int r = sd->status.inventory[index].refine;
-
+
if ( (!battle_config.costume_refine_def && itemdb_is_costumeequip(sd->inventory_data[index]->equip)) ||
(!battle_config.shadow_refine_def && itemdb_is_shadowequip(sd->inventory_data[index]->equip))
)
@@ -3110,7 +3110,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
sd->magic_addele[ELE_WIND] += 25;
if (sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 3)
sd->magic_addele[ELE_EARTH] += 25;
-
+
// Geffen Scrolls
if (sc->data[SC_SKELSCROLL]) {
#ifdef RENEWAL
@@ -3136,11 +3136,11 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
}
if (sc->data[SC_IMMUNITYSCROLL])
sd->subele[ELE_NEUTRAL] += sc->data[SC_IMMUNITYSCROLL]->val1;
-
+
// Geffen Magic Tournament
if (sc->data[SC_GEFFEN_MAGIC1]) {
sd->right_weapon.addrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC1]->val1;
- sd->left_weapon.addrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC1]->val1;
+ sd->left_weapon.addrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC1]->val1;
}
if (sc->data[SC_GEFFEN_MAGIC2])
sd->magic_addrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC2]->val1;
@@ -4190,10 +4190,14 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
if ( sd->status.shield )
amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE];
switch ( sd->status.weapon ) {
- case W_BOW: case W_MUSICAL:
- case W_WHIP: case W_REVOLVER:
- case W_RIFLE: case W_GATLING:
- case W_SHOTGUN: case W_GRENADE:
+ case W_BOW:
+ case W_MUSICAL:
+ case W_WHIP:
+ case W_REVOLVER:
+ case W_RIFLE:
+ case W_GATLING:
+ case W_SHOTGUN:
+ case W_GRENADE:
temp = st->dex * st->dex / 7.0f + st->agi * st->agi * 0.5f;
break;
default:
@@ -4271,12 +4275,14 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
str = (int)(dstr + (float)dex / 5 + (float)st->luk / 3 + (float)BL_UCCAST(BL_PC, bl)->status.base_level / 4);
else if (bl->type == BL_MOB)
str = dstr + BL_UCCAST(BL_MOB, bl)->level;
- //else if (bl->type == BL_MER) // FIXME: What should go here?
- // str = dstr + BL_UCCAST(BL_MER, bl)->level;
-#else
+#if 0
+ else if (bl->type == BL_MER) // FIXME: What should go here?
+ str = dstr + BL_UCCAST(BL_MER, bl)->level;
+#endif // 0
+#else // ! RENEWAL
if (bl->type == BL_PC)
str += dex / 5 + st->luk / 5;
-#endif
+#endif // RENEWAL
return cap_value(str, 0, USHRT_MAX);
}
@@ -4813,7 +4819,7 @@ unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc,
batk += 100 * sc->data[SC_SATURDAY_NIGHT_FEVER]->val1;
if (sc->data[SC_BATTLESCROLL])
batk += batk * sc->data[SC_BATTLESCROLL]->val1 / 100;
-
+
// Eden Crystal Synthesis
if (sc->data[SC_QUEST_BUFF1])
batk += sc->data[SC_QUEST_BUFF1]->val1;
@@ -4998,7 +5004,7 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc,
matk += sc->data[SC_MTF_MATK]->val1;
if (sc->data[SC_MYSTICSCROLL])
matk += matk * sc->data[SC_MYSTICSCROLL]->val1 / 100;
-
+
// Eden Crystal Synthesis
if (sc->data[SC_QUEST_BUFF1])
matk += sc->data[SC_QUEST_BUFF1]->val1;
@@ -5006,7 +5012,7 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc,
matk += sc->data[SC_QUEST_BUFF2]->val1;
if (sc->data[SC_QUEST_BUFF3])
matk += sc->data[SC_QUEST_BUFF3]->val1;
-
+
// Geffen Magic Tournament
if (sc->data[SC_FENRIR_CARD])
matk += sc->data[SC_FENRIR_CARD]->val1;
@@ -5115,7 +5121,7 @@ signed short status_calc_hit(struct block_list *bl, struct status_change *sc, in
hit += sc->data[SC_ACARAJE]->val1;
if (sc->data[SC_BUCHEDENOEL])
hit += sc->data[SC_BUCHEDENOEL]->val3;
-
+
return (short)cap_value(hit, 1, SHRT_MAX);
}
@@ -5616,10 +5622,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
val = max( val, sc->data[SC_MELON_BOMB]->val1 );
if (sc->data[SC_STOMACHACHE])
val = max(val, sc->data[SC_STOMACHACHE]->val2);
-
- if( sc->data[SC_MARSHOFABYSS] ) // It stacks to other statuses so always put this at the end.
- val = max( 50, val + 10 * sc->data[SC_MARSHOFABYSS]->val1 );
-
+ if (sc->data[SC_MARSHOFABYSS]) // It stacks to other statuses so always put this at the end.
+ val = max(50, val + 10 * sc->data[SC_MARSHOFABYSS]->val1);
if (sc->data[SC_MOVHASTE_POTION]) { // Doesn't affect the movement speed by Quagmire, Decrease Agi, Slow Grace [Frost]
if (sc->data[SC_DEC_AGI] || sc->data[SC_QUAGMIRE] || sc->data[SC_DONTFORGETME])
return 0;
@@ -12814,13 +12818,13 @@ bool status_readdb_sizefix(char* fields[], int columns, int current)
/**
* Processes a refine_db.conf entry.
*
- * @param *r Libconfig setting entry. It is expected to be valid and it
- * won't be freed (it is care of the caller to do so if
- * necessary)
- * @param n Ordinal number of the entry, to be displayed in case of
- * validation errors.
- * @param *source Source of the entry (file name), to be displayed in case of
- * validation errors.
+ * @param r Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param n Ordinal number of the entry, to be displayed in case of
+ * validation errors.
+ * @param source Source of the entry (file name), to be displayed in case of
+ * validation errors.
* @return # of the validated entry, or 0 in case of failure.
*/
int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source)
@@ -12831,7 +12835,7 @@ int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, co
nullpo_ret(r);
nullpo_ret(name);
nullpo_ret(source);
-
+
if (strncmp(name, "Armors", 6) == 0) {
type = REFINE_TYPE_ARMOR;
} else if (strncmp(name, "WeaponLevel", 11) != 0 || !strspn(&name[strlen(name)-1], "0123456789") || (type = atoi(strncpy(lv, name+11, 2))) == REFINE_TYPE_ARMOR) {
@@ -12920,14 +12924,14 @@ int status_readdb_refine_libconfig(const char *filename) {
config_setting_t *r;
char filepath[256];
int i = 0, count = 0,type = 0;
-
+
sprintf(filepath, "%s/%s", map->db_path, filename);
memset(&duplicate,0,sizeof(duplicate));
if( libconfig->read_file(&refine_db_conf, filepath) ) {
ShowError("can't read %s\n", filepath);
return 0;
}
-
+
while((r = libconfig->setting_get_elem(refine_db_conf.root,i++))) {
char *name = config_setting_name(r);
if((type=status->readdb_refine_libconfig_sub(r, name, filename))) {
@@ -12939,7 +12943,7 @@ int status_readdb_refine_libconfig(const char *filename) {
}
libconfig->destroy(&refine_db_conf);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
-
+
return count;
}
diff --git a/src/map/status.h b/src/map/status.h
index 51ca1e78b..be6d4c209 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -758,13 +758,13 @@ typedef enum sc_type {
SC_MTF_MSP,
SC_MTF_PUMPKIN,
SC_MTF_HITFLEE,
-
+
SC_LJOSALFAR,
SC_MERMAID_LONGING,
-
+
SC_ACARAJE, // 590
SC_TARGET_ASPD,
-
+
// Geffen Scrolls
SC_SKELSCROLL,
SC_DISTRUCTIONSCROLL,
@@ -775,25 +775,25 @@ typedef enum sc_type {
SC_ARMORSCROLL,
SC_FREYJASCROLL,
SC_SOULSCROLL, // 600
-
+
// Eden Crystal Synthesis
SC_QUEST_BUFF1,
SC_QUEST_BUFF2,
SC_QUEST_BUFF3,
-
+
// Geffen Magic Tournament
SC_GEFFEN_MAGIC1,
SC_GEFFEN_MAGIC2,
SC_GEFFEN_MAGIC3,
SC_FENRIR_CARD,
-
+
SC_ATKER_ASPD,
SC_ATKER_MOVESPEED,
SC_FOOD_CRITICALSUCCESSVALUE, // 610
SC_CUP_OF_BOZA,
SC_OVERLAPEXPUP,
SC_MORA_BUFF,
-
+
// MVP Scrolls
SC_MVPCARD_TAOGUNKA,
SC_MVPCARD_MISTRESS,
diff --git a/src/map/unit.c b/src/map/unit.c
index 03334f7f3..26104e4e0 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -121,7 +121,7 @@ int unit_walktoxy_sub(struct block_list *bl)
#ifdef OFFICIAL_WALKPATH
if( !path->search_long(NULL, bl, bl->m, bl->x, bl->y, ud->to_x, ud->to_y, CELL_CHKNOPASS) // Check if there is an obstacle between
- && wpd.path_len > 14 // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
+ && wpd.path_len > 14 // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
&& (bl->type != BL_NPC) ) // If type is a NPC, please disregard.
return 0;
#endif