summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c3
-rw-r--r--src/map/chrif.c6
-rw-r--r--src/map/clif.c33
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/packets.h7
-rw-r--r--src/map/pc.c16
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c77
-rw-r--r--src/map/script.h1
-rw-r--r--src/map/status.c8
-rw-r--r--src/map/unit.c16
13 files changed, 148 insertions, 26 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e2c9f1720..bc539837d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8418,6 +8418,7 @@ ACMD(charcommands)
atcommand->commands_sub(sd, fd, COMMAND_CHARCOMMAND);
return true;
}
+
/* for new mounts */
ACMD(cashmount)
{
@@ -8429,7 +8430,7 @@ ACMD(cashmount)
clif->message(sd->fd,msg_fd(fd,1362)); // NOTICE: If you crash with mount your LUA is outdated.
if (!sd->sc.data[SC_ALL_RIDING]) {
clif->message(sd->fd,msg_fd(fd,1363)); // You have mounted.
- sc_start(NULL,&sd->bl,SC_ALL_RIDING,100,0,-1);
+ sc_start(NULL,&sd->bl,SC_ALL_RIDING,100,25,-1);
} else {
clif->message(sd->fd,msg_fd(fd,1364)); // You have released your mount.
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 1f7fbe96e..258d550d4 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1394,16 +1394,16 @@ int chrif_parse(int fd) {
}
while (RFIFOREST(fd) >= 2) {
+ cmd = RFIFOW(fd,0);
+
if (VECTOR_LENGTH(HPM->packets[hpChrif_Parse]) > 0) {
- int result = HPM->parse_packets(fd,hpChrif_Parse);
+ int result = HPM->parse_packets(fd,cmd,hpChrif_Parse);
if (result == 1)
continue;
if (result == 2)
return 0;
}
- cmd = RFIFOW(fd,0);
-
if (cmd < 0x2af8 || cmd >= 0x2af8 + ARRAYLENGTH(chrif->packet_len_table) || chrif->packet_len_table[cmd-0x2af8] == 0) {
int result = intif->parse(fd); // Passed on to the intif
diff --git a/src/map/clif.c b/src/map/clif.c
index 1cd18b68d..817579e23 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11484,6 +11484,22 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd)
clif_menuskill_clear(sd);
}
+/// Identifying item with right-click (CZ_REQ_ONECLICK_ITEMIDENTIFY).
+/// 0A35 <index>.W
+void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd)
+{
+ int cmd = RFIFOW(fd,0);
+ short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2;
+ int n;
+
+ if (idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0)
+ return;
+
+ if ((n = pc->have_magnifier(sd) ) != INDEX_NOT_FOUND &&
+ pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_OTHER) == 0)
+ skill->identify(sd, idx);
+}
+
void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2)));
/// Answer to arrow crafting item selection dialog (CZ_REQ_MAKINGARROW).
/// 01ae <name id>.W
@@ -18729,21 +18745,21 @@ int clif_parse(int fd) {
if (RFIFOREST(fd) < 2)
return 0;
+ if (sd)
+ parse_cmd_func = sd->parse_cmd_func;
+ else
+ parse_cmd_func = clif->parse_cmd;
+
+ cmd = parse_cmd_func(fd,sd);
+
if (VECTOR_LENGTH(HPM->packets[hpClif_Parse]) > 0) {
- int result = HPM->parse_packets(fd,hpClif_Parse);
+ int result = HPM->parse_packets(fd,cmd,hpClif_Parse);
if (result == 1)
continue;
if (result == 2)
return 0;
}
- if( sd )
- parse_cmd_func = sd->parse_cmd_func;
- else
- parse_cmd_func = clif->parse_cmd;
-
- cmd = parse_cmd_func(fd,sd);
-
// filter out invalid / unsupported packets
if (cmd > MAX_PACKET_DB || cmd < MIN_PACKET_DB || packet_db[cmd].len == 0) {
ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %"PRIuS" bytes received), disconnecting session #%d.\n",
@@ -19707,4 +19723,5 @@ void clif_defaults(void) {
clif->add_random_options = clif_add_random_options;
clif->pHotkeyRowShift = clif_parse_HotkeyRowShift;
clif->dressroom_open = clif_dressroom_open;
+ clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 250689e90..3d43b064c 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1338,6 +1338,7 @@ 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);
+ void (*pOneClick_ItemIdentify) (int fd,struct map_session_data *sd);
/* Cart Deco */
void(*selectcart) (struct map_session_data *sd);
void(*pSelectCart) (int fd, struct map_session_data *sd);
diff --git a/src/map/guild.c b/src/map/guild.c
index cba05638f..f4f0c0528 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1117,7 +1117,7 @@ int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char
nullpo_ret(name);
exp_mode = cap_value(exp_mode, 0, battle_config.guild_exp_limit);
- p.mode=mode&GPERM_BOTH; // Invite and Expel
+ p.mode=mode&GPERM_MASK;
p.exp_mode=exp_mode;
safestrncpy(p.name,name,NAME_LENGTH);
return intif->guild_position(guild_id,idx,&p);
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index cde73f3b4..8a0ec389d 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -64,6 +64,7 @@ enum item_itemid {
ITEMID_BRANCH_OF_DEAD_TREE = 604,
ITEMID_ANODYNE = 605,
ITEMID_ALOEBERA = 606,
+ ITEMID_MAGNIFIER = 611,
ITEMID_POISON_BOTTLE = 678,
ITEMID_EMPTY_BOTTLE = 713,
ITEMID_EMPERIUM = 714,
@@ -136,6 +137,7 @@ enum item_itemid {
ITEMID_MAGIC_CASTLE = 12308,
ITEMID_BULGING_HEAD = 12309,
ITEMID_THICK_MANUAL50 = 12312,
+ ITEMID_NOVICE_MAGNIFIER = 12325,
ITEMID_ANCILLA = 12333,
ITEMID_REPAIR_A = 12392,
ITEMID_REPAIR_B = 12393,
diff --git a/src/map/packets.h b/src/map/packets.h
index 6174d76d2..0badd94f5 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2910,9 +2910,10 @@ 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
+ packet(0x0A35,4,clif->pOneClick_ItemIdentify,2);
#endif
#if PACKETVER >= 20150805 // RagexeRE
diff --git a/src/map/pc.c b/src/map/pc.c
index 2dfd9519b..491584385 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -11479,6 +11479,20 @@ bool pc_db_checkid(unsigned int class_)
|| (class_ >= JOB_REBELLION && class_ < JOB_MAX );
}
+/**
+ * checks if player have any kind of magnifier in inventory
+ * @param sd map_session_data of Player
+ * @return index of magnifer, INDEX_NOT_FOUND if it is not found
+ */
+int pc_have_magnifier(struct map_session_data *sd)
+{
+ int n;
+ n = pc->search_inventory(sd, ITEMID_MAGNIFIER);
+ if (n == INDEX_NOT_FOUND)
+ n = pc->search_inventory(sd, ITEMID_NOVICE_MAGNIFIER);
+ return n;
+}
+
void do_final_pc(void) {
db_destroy(pc->itemcd_db);
pc->at_db->destroy(pc->at_db,pc->autotrade_final);
@@ -11846,4 +11860,6 @@ void pc_defaults(void) {
pc->check_job_name = pc_check_job_name;
pc->update_idle_time = pc_update_idle_time;
+
+ pc->have_magnifier = pc_have_magnifier;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 23b46a631..06bc5e5ae 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1088,6 +1088,8 @@ END_ZEROED_BLOCK; /* End */
int (*check_job_name) (const char *name);
void (*update_idle_time) (struct map_session_data* sd, enum e_battle_config_idletime type);
+
+ int (*have_magnifier) (struct map_session_data *sd);
};
#ifdef HERCULES_CORE
diff --git a/src/map/script.c b/src/map/script.c
index 35a71868a..ca53b6f6d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2322,6 +2322,15 @@ void read_constdb(void)
ShowWarning("read_constdb: Invalid constant name %s. Skipping.\n", name);
continue;
}
+ if (strcmp(name, "comment__") == 0) {
+ const char *comment = libconfig->setting_get_string(t);
+ if (comment == NULL)
+ continue;
+ if (*comment == '\0')
+ comment = NULL;
+ script->constdb_comment(comment);
+ continue;
+ }
if (config_setting_is_aggregate(t)) {
int i32;
if (!libconfig->setting_lookup_int(t, "Value", &i32)) {
@@ -2342,9 +2351,22 @@ void read_constdb(void)
}
script->set_constant(name, value, is_parameter, is_deprecated);
}
+ script->constdb_comment(NULL);
libconfig->destroy(&constants_conf);
}
+/**
+ * Sets the current constdb comment.
+ *
+ * This function does nothing (used by plugins only)
+ *
+ * @param comment The comment to set (NULL to unset)
+ */
+void script_constdb_comment(const char *comment)
+{
+ (void)comment;
+}
+
// Standard UNIX tab size is 8
#define TAB_SIZE 8
#define update_tabstop(tabstop,chars) \
@@ -18490,7 +18512,7 @@ BUILDIN(setcashmount)
if (sd->sc.data[SC_ALL_RIDING])
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
else
- sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 0, -1);
+ sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 25, -1);
script_pushint(st,1);//in both cases, return 1.
}
return true;
@@ -20820,9 +20842,11 @@ void script_label_add(int key, int pos) {
**/
void script_hardcoded_constants(void)
{
+ script->constdb_comment("Boolean");
script->set_constant("true", 1, false, false);
script->set_constant("false", 0, false, false);
- /* server defines */
+
+ script->constdb_comment("Server defines");
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);
@@ -20834,7 +20858,7 @@ void script_hardcoded_constants(void)
script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false, false);
script->set_constant("MAX_REFINE",MAX_REFINE,false, false);
- /* status options */
+ script->constdb_comment("status options");
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);
@@ -20860,11 +20884,11 @@ void script_hardcoded_constants(void)
script->set_constant("Option_Hanbok",OPTION_HANBOK,false, false);
script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false, false);
- /* status option compounds */
+ script->constdb_comment("status option compounds");
script->set_constant("Option_Dragon",OPTION_DRAGON,false, false);
script->set_constant("Option_Costume",OPTION_COSTUME,false, false);
- /* send_target */
+ script->constdb_comment("send_target");
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);
@@ -20898,7 +20922,46 @@ void script_hardcoded_constants(void)
script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false, false);
script->set_constant("BG_QUEUE",BG_QUEUE,false, false);
- /* Renewal */
+ script->constdb_comment("LOOK_ constants, use in setlook/changelook script commands");
+ script->set_constant("LOOK_BASE", LOOK_BASE, false, false);
+ script->set_constant("LOOK_HAIR", LOOK_HAIR, false, false);
+ script->set_constant("LOOK_WEAPON", LOOK_WEAPON, false, false);
+ script->set_constant("LOOK_HEAD_BOTTOM", LOOK_HEAD_BOTTOM, false, false);
+ script->set_constant("LOOK_HEAD_TOP", LOOK_HEAD_TOP, false, false);
+ script->set_constant("LOOK_HEAD_MID", LOOK_HEAD_MID, false, false);
+ script->set_constant("LOOK_HAIR_COLOR", LOOK_HAIR_COLOR, false, false);
+ script->set_constant("LOOK_CLOTHES_COLOR", LOOK_CLOTHES_COLOR, false, false);
+ script->set_constant("LOOK_SHIELD", LOOK_SHIELD, false, false);
+ script->set_constant("LOOK_SHOES", LOOK_SHOES, false, false);
+ script->set_constant("LOOK_BODY", LOOK_BODY, false, false);
+ script->set_constant("LOOK_FLOOR", LOOK_FLOOR, false, false);
+ script->set_constant("LOOK_ROBE", LOOK_ROBE, false, false);
+ script->set_constant("LOOK_BODY2", LOOK_BODY2, false, false);
+
+ script->constdb_comment("Equip Position in Bits, use with *getiteminfo type 5, or @inventorylist_equip");
+ script->set_constant("EQP_HEAD_LOW", EQP_HEAD_LOW, false, false);
+ script->set_constant("EQP_HEAD_MID", EQP_HEAD_MID, false, false);
+ script->set_constant("EQP_HEAD_TOP", EQP_HEAD_TOP, false, false);
+ script->set_constant("EQP_HAND_R", EQP_HAND_R, false, false);
+ script->set_constant("EQP_HAND_L", EQP_HAND_L, false, false);
+ script->set_constant("EQP_ARMOR", EQP_ARMOR, false, false);
+ script->set_constant("EQP_SHOES", EQP_SHOES, false, false);
+ script->set_constant("EQP_GARMENT", EQP_GARMENT, false, false);
+ script->set_constant("EQP_ACC_L", EQP_ACC_L, false, false);
+ script->set_constant("EQP_ACC_R", EQP_ACC_R, false, false);
+ script->set_constant("EQP_COSTUME_HEAD_TOP", EQP_COSTUME_HEAD_TOP, false, false);
+ script->set_constant("EQP_COSTUME_HEAD_MID", EQP_COSTUME_HEAD_MID, false, false);
+ script->set_constant("EQP_COSTUME_HEAD_LOW", EQP_COSTUME_HEAD_LOW, false, false);
+ script->set_constant("EQP_COSTUME_GARMENT", EQP_COSTUME_GARMENT, false, false);
+ script->set_constant("EQP_AMMO", EQP_AMMO, false, false);
+ script->set_constant("EQP_SHADOW_ARMOR", EQP_SHADOW_ARMOR, false, false);
+ script->set_constant("EQP_SHADOW_WEAPON", EQP_SHADOW_WEAPON, false, false);
+ script->set_constant("EQP_SHADOW_SHIELD", EQP_SHADOW_SHIELD, false, false);
+ script->set_constant("EQP_SHADOW_SHOES", EQP_SHADOW_SHOES, false, false);
+ script->set_constant("EQP_SHADOW_ACC_R", EQP_SHADOW_ACC_R, false, false);
+ script->set_constant("EQP_SHADOW_ACC_L", EQP_SHADOW_ACC_L, false, false);
+
+ script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);
#else
@@ -20934,6 +20997,7 @@ void script_hardcoded_constants(void)
#else
script->set_constant("RENEWAL_ASPD", 0, false, false);
#endif
+ script->constdb_comment(NULL);
}
/**
@@ -21111,6 +21175,7 @@ void script_defaults(void) {
script->parse_expr = parse_expr;
script->parse_line = parse_line;
script->read_constdb = read_constdb;
+ script->constdb_comment = script_constdb_comment;
script->print_line = script_print_line;
script->errorwarning_sub = script_errorwarning_sub;
script->set_reg = set_reg;
diff --git a/src/map/script.h b/src/map/script.h
index dbb0f8a03..e6164092e 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -726,6 +726,7 @@ struct script_interface {
const char* (*parse_expr) (const char *p);
const char* (*parse_line) (const char *p);
void (*read_constdb) (void);
+ void (*constdb_comment) (const char *comment);
const char* (*print_line) (StringBuf *buf, const char *p, const char *mark, int line);
void (*errorwarning_sub) (StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos);
int (*set_reg) (struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref);
diff --git a/src/map/status.c b/src/map/status.c
index db8c0d6c5..879f10efb 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -5542,8 +5542,10 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
if(sc->data[SC_FUSION]) {
val = 25;
} else if (sd) {
- if (pc_isridingpeco(sd) || pc_isridingdragon(sd) || sd->sc.data[SC_ALL_RIDING])
+ if (pc_isridingpeco(sd) || pc_isridingdragon(sd))
val = 25;//Same bonus
+ else if (sd->sc.data[SC_ALL_RIDING])
+ val = sd->sc.data[SC_ALL_RIDING]->val1;
else if (pc_isridingwug(sd))
val = 15 + 5 * pc->checkskill(sd, RA_WUGRIDER);
else if (pc_ismadogear(sd)) {
@@ -8981,8 +8983,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
tick_time = 3000; // [GodLesZ] tick time
break;
case SC_CLOAKINGEXCEED:
- val2 = ( val1 + 1 ) / 2; // Hits
- val3 = 90 + val1 * 10; // Walk speed
+ val2 = (val1 + 1) / 2; // Hits
+ val3 = (val1 - 1) * 10; // Walk speed
if (bl->type == BL_PC)
val4 |= battle_config.pc_cloak_check_type&7;
else
diff --git a/src/map/unit.c b/src/map/unit.c
index 26104e4e0..bea0913d2 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1976,6 +1976,7 @@ bool unit_can_reach_pos(struct block_list *bl,int x,int y, int easy)
bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y)
{
short dx,dy;
+ struct walkpath_data wpd;
nullpo_retr(false, bl);
nullpo_retr(false, tbl);
@@ -2005,7 +2006,20 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
if (x) *x = tbl->x-dx;
if (y) *y = tbl->y-dy;
- return path->search(NULL,bl,bl->m,bl->x,bl->y,tbl->x-dx,tbl->y-dy,easy,CELL_CHKNOREACH);
+
+ if (!path->search(&wpd,bl,bl->m,bl->x,bl->y,tbl->x-dx,tbl->y-dy,easy,CELL_CHKNOREACH))
+ return false;
+
+#ifdef OFFICIAL_WALKPATH
+ if( !path->search_long(NULL, bl, bl->m, bl->x, bl->y, tbl->x-dx, tbl->y-dy, 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]
+ && (bl->type != BL_NPC) ) // If type is a NPC, please disregard.
+ return false;
+#endif
+
+ return true;
+
+
}
/*==========================================
* Calculates position of Pet/Mercenary/Homunculus/Elemental