summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/mmo.h8
-rw-r--r--src/map/atcommand.c56
-rw-r--r--src/map/clif.c142
-rw-r--r--src/map/clif.h12
-rw-r--r--src/map/guild.c54
-rw-r--r--src/map/guild.h1
-rw-r--r--src/map/itemdb.c360
-rw-r--r--src/map/itemdb.h18
-rw-r--r--src/map/map.c48
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/npc.c13
-rw-r--r--src/map/packets.h5
-rw-r--r--src/map/packets_struct.h43
-rw-r--r--src/map/pc.c83
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c69
-rw-r--r--src/map/script.h12
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc32
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc48
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc282
-rw-r--r--src/plugins/constdb2doc.c18
23 files changed, 956 insertions, 371 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 1fa6fadc8..66736bff0 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -907,6 +907,14 @@ struct guild_castle {
int mapindex;
char castle_name[NAME_LENGTH];
char castle_event[NAME_LENGTH];
+ int siege_type;
+ bool enable_client_warp;
+ struct {
+ int x;
+ int y;
+ int zeny;
+ int zeny_siege;
+ } client_warp;
int guild_id;
int economy;
int defense;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b472694c4..145a5c95d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -511,7 +511,7 @@ ACMD(where)
return false;
}
- pl_sd = map->nick2sd(atcmd_player_name);
+ pl_sd = map->nick2sd(atcmd_player_name, true);
if (pl_sd == NULL ||
strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 ||
(pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > pc_get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
@@ -548,7 +548,7 @@ ACMD(jumpto)
return false;
}
- if ((pl_sd=map->nick2sd(message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd(message, true)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -2904,7 +2904,7 @@ ACMD(recall)
return false;
}
- if ((pl_sd=map->nick2sd(message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd(message, true)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3229,7 +3229,7 @@ ACMD(kick)
return false;
}
- if ((pl_sd=map->nick2sd(message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd(message, true)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3559,7 +3559,7 @@ ACMD(idsearch)
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,77), item_name); // Search results for '%s' (name: id):
clif->message(fd, atcmd_output);
- match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, 0);
+ match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, IT_SEARCH_NAME_PARTIAL);
if (match > MAX_SEARCH) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,269), MAX_SEARCH, match);
clif->message(fd, atcmd_output);
@@ -4364,7 +4364,7 @@ ACMD(nuke)
return false;
}
- if ((pl_sd = map->nick2sd(atcmd_player_name)) != NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name, true)) != NULL) {
if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level
skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, timer->gettick(), 0);
clif->message(fd, msg_fd(fd,109)); // Player has been nuked!
@@ -4684,7 +4684,7 @@ ACMD(jail)
return false;
}
- if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -4736,7 +4736,7 @@ ACMD(unjail)
return false;
}
- if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -4815,7 +4815,7 @@ ACMD(jailfor)
return false;
}
- if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5346,7 +5346,7 @@ ACMD(follow)
return true;
}
- if ((pl_sd = map->nick2sd(message)) == NULL) {
+ if ((pl_sd = map->nick2sd(message, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5596,7 +5596,7 @@ ACMD(useskill)
if (!strcmp(target,"self"))
pl_sd = sd; //quick keyword
- else if ((pl_sd = map->nick2sd(target)) == NULL) {
+ else if ((pl_sd = map->nick2sd(target, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5664,7 +5664,7 @@ ACMD(skilltree)
return false;
}
- if ( (pl_sd = map->nick2sd(target)) == NULL ) {
+ if ( (pl_sd = map->nick2sd(target, true)) == NULL ) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5734,7 +5734,7 @@ ACMD(marry)
return false;
}
- if ((pl_sd = map->nick2sd(player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(player_name, true)) == NULL) {
clif->message(fd, msg_fd(fd,3));
return false;
}
@@ -5864,7 +5864,7 @@ ACMD(changegm)
return false;
}
- if ((pl_sd=map->nick2sd(message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if ((pl_sd=map->nick2sd(message, true)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_fd(fd,1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5885,7 +5885,7 @@ ACMD(changeleader)
return false;
}
- if (party->changeleader(sd, map->nick2sd(message)))
+ if (party->changeleader(sd, map->nick2sd(message, true)))
return true;
return false;
}
@@ -6349,7 +6349,7 @@ ACMD(mobsearch)
}
if (mob_id == atoi(mob_name)) {
strcpy(mob_name,mob->db(mob_id)->jname); // DEFAULT_MOB_JNAME
- //strcpy(mob_name,mob_db(mob_id)->name); // DEFAULT_MOB_NAME
+ //strcpy(mob_name,mob->db(mob_id)->name); // DEFAULT_MOB_NAME
}
snprintf(atcmd_output, sizeof atcmd_output, msg_fd(fd,1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s
@@ -6651,7 +6651,7 @@ ACMD(trade)
return false;
}
- if ((pl_sd = map->nick2sd(message)) == NULL) {
+ if ((pl_sd = map->nick2sd(message, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -6695,7 +6695,7 @@ ACMD(unmute)
return false;
}
- if ((pl_sd = map->nick2sd(message)) == NULL) {
+ if ((pl_sd = map->nick2sd(message, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -6775,7 +6775,7 @@ ACMD(mute)
return false;
}
- if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name, true)) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -7072,7 +7072,7 @@ ACMD(showmobs)
if (mob_id == atoi(mob_name)) {
strcpy(mob_name,mob->db(mob_id)->jname); // DEFAULT_MOB_JNAME
- //strcpy(mob_name,mob_db(mob_id)->name); // DEFAULT_MOB_NAME
+ //strcpy(mob_name,mob->db(mob_id)->name); // DEFAULT_MOB_NAME
}
snprintf(atcmd_output, sizeof atcmd_output, msg_fd(fd,1252), // Mob Search... %s %s
@@ -7453,7 +7453,7 @@ ACMD(iteminfo)
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
- count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
+ count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL);
if (!count) {
clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name.
@@ -7504,7 +7504,7 @@ ACMD(whodrops)
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
- count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
+ count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL);
if (!count) {
clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name.
@@ -7985,7 +7985,7 @@ ACMD(showdelay)
ACMD(invite)
{
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map->nick2sd(message);
+ struct map_session_data *target_sd = map->nick2sd(message, true);
if (did == 0)
{
@@ -8058,7 +8058,7 @@ ACMD(duel)
}
duel->create(sd, maxpl);
} else {
- struct map_session_data *target_sd = map->nick2sd(message);
+ struct map_session_data *target_sd = map->nick2sd(message, true);
if (target_sd != NULL) {
unsigned int newduel;
if ((newduel = duel->create(sd, 2)) != -1) {
@@ -8203,7 +8203,7 @@ ACMD(clone)
return false;
}
- if ((pl_sd=map->nick2sd(message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd(message, true)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -9321,7 +9321,7 @@ ACMD(channel)
return false;
}
- if (sub4[0] == '\0' || (pl_sd = map->nick2sd(sub4)) == NULL) {
+ if (sub4[0] == '\0' || (pl_sd = map->nick2sd(sub4, true)) == NULL) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1434), sub4);// Player '%s' was not found
clif->message(fd, atcmd_output);
return false;
@@ -9368,7 +9368,7 @@ ACMD(channel)
clif->message(fd, atcmd_output);
return false;
}
- if (sub4[0] == '\0' || (pl_sd = map->nick2sd(sub4)) == NULL) {
+ if (sub4[0] == '\0' || (pl_sd = map->nick2sd(sub4, true)) == NULL) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1434), sub4);// Player '%s' was not found
clif->message(fd, atcmd_output);
return false;
@@ -10463,7 +10463,7 @@ static bool atcommand_exec(const int fd, struct map_session_data *sd, const char
return true;
}
- ssd = map->nick2sd(charname);
+ ssd = map->nick2sd(charname, true);
if (ssd == NULL) {
sprintf(output, msg_fd(fd,1389), command); // %s failed. Player not found.
clif->message(fd, output);
diff --git a/src/map/clif.c b/src/map/clif.c
index c7f81a471..1ed5e1d9f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6458,7 +6458,7 @@ static void clif_wis_message(int fd, const char *nick, const char *mes, int mes_
safestrncpy(WFIFOP(fd,28), mes, mes_len + 1);
WFIFOSET(fd,WFIFOW(fd,2));
#else
- ssd = map->nick2sd(nick);
+ ssd = map->nick2sd(nick, false);
WFIFOHEAD(fd, mes_len + NAME_LENGTH + 9);
WFIFOW(fd,0) = 0x97;
@@ -8106,6 +8106,54 @@ static void clif_guild_allianceinfo(struct map_session_data *sd)
WFIFOSET(fd,WFIFOW(fd,2));
}
+static void clif_guild_castlelist(struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+ nullpo_retv(sd);
+
+ struct guild *g = sd->guild;
+ if (g == NULL)
+ return;
+
+ int castle_count = guild->checkcastles(g);
+ if (castle_count > 0) {
+ int len = sizeof(struct PACKET_ZC_GUILD_CASTLE_LIST) + castle_count;
+ struct PACKET_ZC_GUILD_CASTLE_LIST *p = aMalloc(len);
+ p->packetType = HEADER_ZC_GUILD_CASTLE_LIST;
+ p->packetLength = len;
+
+ int i = 0;
+ struct DBIterator *iter = db_iterator(guild->castle_db);
+ for (struct guild_castle *gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter)) {
+ if (gc->guild_id == g->guild_id) {
+ p->castle_list[i] = gc->castle_id;
+ ++i;
+ }
+ }
+ dbi_destroy(iter);
+
+ clif->send(p, len, &sd->bl, SELF);
+ aFree(p);
+ }
+#endif
+}
+
+static void clif_guild_castleinfo(struct map_session_data *sd, struct guild_castle *gc)
+{
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+
+ nullpo_retv(sd);
+ nullpo_retv(gc);
+
+ struct PACKET_ZC_CASTLE_INFO p = { 0 };
+ p.packetType = HEADER_ZC_CASTLE_INFO;
+ p.castle_id = gc->castle_id;
+ p.economy = gc->economy;
+ p.defense = gc->defense;
+ clif->send(&p, sizeof(p), &sd->bl, SELF);
+#endif
+}
+
/// Guild member manager information (ZC_MEMBERMGR_INFO).
/// 0154 <packet len>.W { <account>.L <char id>.L <hair style>.W <hair color>.W <gender>.W <class>.W <level>.W <contrib exp>.L <state>.L <position>.L <memo>.50B <name>.24B }*
/// state:
@@ -11596,9 +11644,9 @@ static void clif_parse_WisMessage(int fd, struct map_session_data *sd)
}
// searching destination character
- dstsd = map->nick2sd(target);
+ dstsd = map->nick2sd(target, false);
- if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) {
+ if (dstsd == NULL) {
// Character not found (or found through partial match).
clif->wis_end(sd->fd, 1);
return;
@@ -13444,7 +13492,7 @@ static void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
return;
}
- t_sd = map->nick2sd(name);
+ t_sd = map->nick2sd(name, true);
if(t_sd && t_sd->state.noask) { // @noask [LuzZza]
clif->noask_sub(sd, t_sd, 1);
@@ -14407,6 +14455,7 @@ static void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd)
case 0: // Basic Information Guild, hostile alliance information
clif->guild_basicinfo(sd);
clif->guild_allianceinfo(sd);
+ clif->guild_castlelist(sd);
break;
case 1: // Members list, list job title
clif->guild_positionnamelist(sd);
@@ -14717,7 +14766,7 @@ static void clif_parse_GuildInvite2(int fd, struct map_session_data *sd)
struct map_session_data *t_sd = NULL;
safestrncpy(nick, RFIFOP(fd, 2), NAME_LENGTH);
- t_sd = map->nick2sd(nick);
+ t_sd = map->nick2sd(nick, true);
clif_sub_guild_invite(fd, sd, t_sd);
}
@@ -15274,7 +15323,7 @@ static void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
safestrncpy(item_monster_name, p->str, sizeof(item_monster_name));
- if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) {
+ if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, IT_SEARCH_NAME_EXACT)) > 0 ) {
for(i = 0; i < count; i++) {
if( !item_array[i] )
continue;
@@ -15758,7 +15807,7 @@ static void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
safestrncpy(nick, RFIFOP(fd,2), NAME_LENGTH);
- f_sd = map->nick2sd(nick);
+ f_sd = map->nick2sd(nick, true);
// ensure that the request player's friend list is not full
ARR_FIND(0, MAX_FRIENDS, i, sd->status.friends[i].char_id == 0);
@@ -16490,7 +16539,7 @@ static void clif_parse_Check(int fd, struct map_session_data *sd)
safestrncpy(charname, RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname));
- if( ( pl_sd = map->nick2sd(charname) ) == NULL || pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) {
+ if ((pl_sd = map->nick2sd(charname, true)) == NULL || pc_get_group_level(sd) < pc_get_group_level(pl_sd)) {
return;
}
@@ -23211,6 +23260,78 @@ static void clif_announce_refine_status(struct map_session_data *sd, int item_id
#endif
}
+static void clif_parse_GuildCastleTeleportRequest(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+static void clif_parse_GuildCastleTeleportRequest(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
+ const struct PACKET_CZ_CASTLE_TELEPORT_REQUEST *p = RFIFO2PTR(fd);
+ struct guild *g = sd->guild;
+
+ if (g == NULL)
+ return;
+
+ struct guild_castle *gc = guild->castle_search(p->castle_id);
+ if (gc == NULL)
+ return;
+ if (gc->enable_client_warp == false)
+ return;
+ if (gc->guild_id != g->guild_id)
+ return;
+
+ if (map->list[sd->bl.m].flag.gvg_castle == 1)
+ return;
+
+ int zeny = gc->client_warp.zeny;
+ if (gc->siege_type == SIEGE_TYPE_FE && map->agit_flag == 1) {
+ zeny = gc->client_warp.zeny_siege;
+ } else if (gc->siege_type == SIEGE_TYPE_SE && map->agit2_flag == 1) {
+ zeny = gc->client_warp.zeny_siege;
+ } else if (gc->siege_type == SIEGE_TYPE_TE) {
+ clif->guild_castleteleport_res(sd, SIEGE_TP_INVALID_MODE);
+ return;
+ }
+
+ if (sd->status.zeny < zeny) {
+ clif->guild_castleteleport_res(sd, SIEGE_TP_NOT_ENOUGH_ZENY);
+ return;
+ }
+ sd->status.zeny -= zeny;
+ clif->updatestatus(sd, SP_ZENY);
+ pc->setpos(sd, gc->mapindex, gc->client_warp.x, gc->client_warp.y, CLR_OUTSIGHT);
+#endif
+}
+
+static void clif_guild_castleteleport_res(struct map_session_data *sd, enum siege_teleport_result result)
+{
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+
+ nullpo_retv(sd);
+
+ struct PACKET_ZC_CASTLE_TELEPORT_RESPONSE p = { 0 };
+ p.packetType = HEADER_ZC_CASTLE_TELEPORT_RESPONSE;
+ p.result = (int16)result;
+ clif->send(&p, sizeof(p), &sd->bl, SELF);
+#endif
+}
+static void clif_parse_GuildCastleInfoRequest(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+static void clif_parse_GuildCastleInfoRequest(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
+ const struct PACKET_CZ_CASTLE_INFO_REQUEST *p = RFIFO2PTR(fd);
+ struct guild *g = sd->guild;
+
+ if (g == NULL)
+ return;
+
+ struct guild_castle *gc = guild->castle_search(p->castle_id);
+ if (gc == NULL)
+ return;
+ if (gc->guild_id != g->guild_id)
+ return;
+ clif->guild_castleinfo(sd, gc);
+#endif
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -23895,6 +24016,8 @@ void clif_defaults(void)
clif->guild_masterormember = clif_guild_masterormember;
clif->guild_basicinfo = clif_guild_basicinfo;
clif->guild_allianceinfo = clif_guild_allianceinfo;
+ clif->guild_castlelist = clif_guild_castlelist;
+ clif->guild_castleinfo = clif_guild_castleinfo;
clif->guild_memberlist = clif_guild_memberlist;
clif->guild_skillinfo = clif_guild_skillinfo;
clif->guild_send_onlineinfo = clif_guild_send_onlineinfo;
@@ -24436,4 +24559,7 @@ void clif_defaults(void)
clif->pRefineryUIClose = clif_parse_RefineryUIClose;
clif->pRefineryUIRefine = clif_parse_RefineryUIRefine;
clif->announce_refine_status = clif_announce_refine_status;
+ clif->pGuildCastleTeleportRequest = clif_parse_GuildCastleTeleportRequest;
+ clif->pGuildCastleInfoRequest = clif_parse_GuildCastleInfoRequest;
+ clif->guild_castleteleport_res = clif_guild_castleteleport_res;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index f3d7c78eb..245352b9c 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -633,6 +633,13 @@ enum inventory_type {
INVTYPE_GUILD_STORAGE = 3,
};
+/** Guild Teleport Results */
+enum siege_teleport_result {
+ SIEGE_TP_SUCCESS = 0x0,
+ SIEGE_TP_NOT_ENOUGH_ZENY = 0x1,
+ SIEGE_TP_INVALID_MODE = 0x2
+};
+
/**
* Structures
**/
@@ -1114,6 +1121,8 @@ struct clif_interface {
void (*guild_masterormember) (struct map_session_data *sd);
void (*guild_basicinfo) (struct map_session_data *sd);
void (*guild_allianceinfo) (struct map_session_data *sd);
+ void (*guild_castlelist) (struct map_session_data *sd);
+ void (*guild_castleinfo) (struct map_session_data *sd, struct guild_castle *gc);
void (*guild_memberlist) (struct map_session_data *sd);
void (*guild_skillinfo) (struct map_session_data* sd);
void (*guild_send_onlineinfo) (struct map_session_data *sd); //[LuzZza]
@@ -1647,6 +1656,9 @@ struct clif_interface {
void (*pRefineryUIClose) (int fd, struct map_session_data *sd);
void (*pRefineryUIRefine) (int fd, struct map_session_data *sd);
void (*announce_refine_status) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target);
+ void (*pGuildCastleTeleportRequest) (int fd, struct map_session_data *sd);
+ void (*pGuildCastleInfoRequest) (int fd, struct map_session_data *sd);
+ void (*guild_castleteleport_res) (struct map_session_data *sd, enum siege_teleport_result result);
};
#ifdef HERCULES_CORE
diff --git a/src/map/guild.c b/src/map/guild.c
index 415a46db5..2faf60e2b 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -169,7 +169,7 @@ static bool guild_read_castledb_libconfig(void)
}
libconfig->destroy(&castle_conf);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename);
+ ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(guild->castle_db), config_filename);
return true;
}
@@ -217,10 +217,59 @@ static bool guild_read_castledb_libconfig_sub(struct config_setting_t *it, int i
}
safestrncpy(gc->castle_event, name, sizeof(gc->castle_event));
+ if (itemdb->lookup_const(it, "SiegeType", &i32) && (i32 >= SIEGE_TYPE_MAX || i32 < 0)) {
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid SiegeType in \"%s\", entry #%d, defaulting to SIEGE_TYPE_FE.\n", source, idx);
+ gc->siege_type = SIEGE_TYPE_FE;
+ } else {
+ gc->siege_type = i32;
+ }
+
+ libconfig->setting_lookup_bool_real(it, "EnableClientWarp", &gc->enable_client_warp);
+ if (gc->enable_client_warp == true) {
+ struct config_setting_t *wd = libconfig->setting_get_member(it, "ClientWarp");
+ guild->read_castledb_libconfig_sub_warp(wd, source, gc);
+ }
idb_put(guild->castle_db, gc->castle_id, gc);
return true;
}
+static bool guild_read_castledb_libconfig_sub_warp(struct config_setting_t *wd, const char *source, struct guild_castle *gc)
+{
+ nullpo_retr(false, wd);
+ nullpo_retr(false, gc);
+ nullpo_retr(false, source);
+
+ int64 i64 = 0;
+ struct config_setting_t *it = libconfig->setting_get_member(wd, "Position");
+ if (config_setting_is_list(it)) {
+ int m = map->mapindex2mapid(gc->mapindex);
+
+ gc->client_warp.x = libconfig->setting_get_int_elem(it, 0);
+ gc->client_warp.y = libconfig->setting_get_int_elem(it, 1);
+ if (gc->client_warp.x < 0 || gc->client_warp.x >= map->list[m].xs || gc->client_warp.y < 0 || gc->client_warp.y >= map->list[m].ys) {
+ ShowWarning("guild_read_castledb_libconfig_sub_warp: Invalid Position in \"%s\", for castle (%d).\n", source, gc->castle_id);
+ return false;
+ }
+ } else {
+ ShowWarning("guild_read_castledb_libconfig_sub_warp: Invalid format for Position in \"%s\", for castle (%d).\n", source, gc->castle_id);
+ return false;
+ }
+
+ if (libconfig->setting_lookup_int64(wd, "ZenyCost", &i64)) {
+ if (i64 > MAX_ZENY) {
+ ShowWarning("guild_read_castledb_libconfig_sub_warp: ZenyCost is too big in \"%s\", for castle (%d), capping to MAX_ZENY.\n", source, gc->castle_id);
+ }
+ gc->client_warp.zeny = cap_value((int)i64, 0, MAX_ZENY);
+ }
+ if (libconfig->setting_lookup_int64(wd, "ZenyCostSiegeTime", &i64)) {
+ if (i64 > MAX_ZENY) {
+ ShowWarning("guild_read_castledb_libconfig_sub_warp: ZenyCostSiegeTime is too big in \"%s\", for castle (%d), capping to MAX_ZENY.\n", source, gc->castle_id);
+ }
+ gc->client_warp.zeny_siege = cap_value((int)i64, 0, MAX_ZENY);
+ }
+ return true;
+}
+
/// lookup: guild id -> guild*
static struct guild *guild_search(int guild_id)
{
@@ -605,7 +654,7 @@ static int guild_recv_info(const struct guild *sg)
before=*sg;
//Perform the check on the user because the first load
guild->check_member(sg);
- if ((sd = map->nick2sd(sg->master)) != NULL) {
+ if ((sd = map->nick2sd(sg->master, false)) != NULL) {
//If the guild master is online the first time the guild_info is received,
//that means he was the first to join, so apply guild skill blocking here.
if( battle_config.guild_skill_relog_delay == 1)
@@ -2497,6 +2546,7 @@ void guild_defaults(void)
guild->read_guildskill_tree_db = guild_read_guildskill_tree_db;
guild->read_castledb_libconfig = guild_read_castledb_libconfig;
guild->read_castledb_libconfig_sub = guild_read_castledb_libconfig_sub;
+ guild->read_castledb_libconfig_sub_warp = guild_read_castledb_libconfig_sub_warp;
guild->payexp_timer_sub = guild_payexp_timer_sub;
guild->send_xy_timer_sub = guild_send_xy_timer_sub;
guild->send_xy_timer = guild_send_xy_timer;
diff --git a/src/map/guild.h b/src/map/guild.h
index d0374103f..41f52711d 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -166,6 +166,7 @@ struct guild_interface {
bool (*read_guildskill_tree_db) (char* split[], int columns, int current);
bool (*read_castledb_libconfig) (void);
bool (*read_castledb_libconfig_sub) (struct config_setting_t *it, int idx, const char *source);
+ bool (*read_castledb_libconfig_sub_warp) (struct config_setting_t *wd, const char *source, struct guild_castle *gc);
int (*payexp_timer_sub) (union DBKey key, struct DBData *data, va_list ap);
int (*send_xy_timer_sub) (union DBKey key, struct DBData *data, va_list ap);
int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index bb2732b17..e5e7b9478 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -117,73 +117,105 @@ static struct item_data *itemdb_name2id(const char *str)
*/
static int itemdb_searchname_array_sub(union DBKey key, struct DBData data, va_list ap)
{
- struct item_data *item = DB->data2ptr(&data);
- char *str;
- str=va_arg(ap,char *);
+ struct item_data *itd = DB->data2ptr(&data);
+ const char *str = va_arg(ap, const char *);
+ enum item_name_search_flag flag = va_arg(ap, enum item_name_search_flag);
+
nullpo_ret(str);
- if (item == &itemdb->dummy)
+
+ if (itd == &itemdb->dummy)
return 1; //Invalid item.
- if(stristr(item->jname,str))
- return 0;
- if(battle_config.case_sensitive_aegisnames && strstr(item->name,str))
- return 0;
- if(!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
+
+ if (
+ (flag == IT_SEARCH_NAME_PARTIAL
+ && (stristr(itd->jname, str) != NULL
+ || (battle_config.case_sensitive_aegisnames && strstr(itd->name, str))
+ || (!battle_config.case_sensitive_aegisnames && stristr(itd->name, str))
+ ))
+ || (flag == IT_SEARCH_NAME_EXACT
+ && (strcmp(itd->jname, str) == 0
+ || (battle_config.case_sensitive_aegisnames && strcmp(itd->name, str) == 0)
+ || (!battle_config.case_sensitive_aegisnames && strcasecmp(itd->name, str) == 0)
+ ))
+ ) {
+
return 0;
- return strcmpi(item->jname,str);
+ } else {
+ return 1;
+ }
}
-/*==========================================
- * Founds up to N matches. Returns number of matches [Skotlex]
- * search flag :
- * 0 - approximate match
- * 1 - exact match
- *------------------------------------------*/
-static int itemdb_searchname_array(struct item_data **data, int size, const char *str, int flag)
+/**
+ * Finds up to passed size matches
+ * @param data array of struct item_data for returning the results in
+ * @param size size of the array
+ * @param str string used in this search
+ * @param flag search mode refer to enum item_name_search_flag for possible values
+ * @return returns all found matches in the database which could be bigger than size
+ **/
+static int itemdb_searchname_array(struct item_data **data, const int size, const char *str, enum item_name_search_flag flag)
{
- struct item_data* item;
- int i;
- int count=0;
-
nullpo_ret(data);
nullpo_ret(str);
- // Search in the array
- for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i )
- {
- item = itemdb->array[i];
- if( item == NULL )
+ Assert_ret(flag >= IT_SEARCH_NAME_PARTIAL && flag < IT_SEARCH_NAME_MAX);
+ Assert_ret(size > 0);
+
+ int
+ results_count = 0,
+ length = 0;
+
+ // Search in array
+ for (int i = 0; i < ARRAYLENGTH(itemdb->array); ++i) {
+ struct item_data *itd = itemdb->array[i];
+
+ if (itd == NULL)
continue;
- if(
- (!flag
- && (stristr(item->jname,str)
- || (battle_config.case_sensitive_aegisnames && strstr(item->name,str))
- || (!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
- ))
- || (flag
- && (strcmp(item->jname,str) == 0
- || (battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0)
- || (!battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0)
- ))
- ) {
- if( count < size )
- data[count] = item;
- ++count;
+ if (
+ (flag == IT_SEARCH_NAME_PARTIAL
+ && (stristr(itd->jname, str) != NULL
+ || (battle_config.case_sensitive_aegisnames && strstr(itd->name, str))
+ || (!battle_config.case_sensitive_aegisnames && stristr(itd->name, str))
+ ))
+ || (flag == IT_SEARCH_NAME_EXACT
+ && (strcmp(itd->jname, str) == 0
+ || (battle_config.case_sensitive_aegisnames && strcmp(itd->name, str) == 0)
+ || (!battle_config.case_sensitive_aegisnames && strcasecmp(itd->name, str) == 0)
+ ))
+ ) {
+ if (length < size) {
+ data[length] = itd;
+ ++length;
+ }
+
+ ++results_count;
}
}
- // search in the db
- if( count < size )
- {
- struct DBData *db_data[MAX_SEARCH];
- int db_count = 0;
- size -= count;
- db_count = itemdb->other->getall(itemdb->other, (struct DBData**)&db_data, size, itemdb->searchname_array_sub, str);
- for (i = 0; i < db_count; i++)
- data[count++] = DB->data2ptr(db_data[i]);
- count += db_count;
+ // Search in dbmap
+ int dbmap_size = size - length;
+ if (dbmap_size > 0) {
+ struct DBData **dbmap_data = NULL;
+ int dbmap_count = 0;
+ CREATE(dbmap_data, struct DBData *, dbmap_size);
+
+ dbmap_count = itemdb->other->getall(itemdb->other, dbmap_data, dbmap_size, itemdb->searchname_array_sub, str, flag);
+ dbmap_size = min(dbmap_count, dbmap_size);
+
+ for (int i = 0; i < dbmap_size; ++i) {
+ data[length] = DB->data2ptr(dbmap_data[i]);
+ ++length;
+ }
+
+ results_count += dbmap_count;
+ aFree(dbmap_data);
+ } else { // We got all matches we can return, so we only need to count now.
+ results_count += itemdb->other->getall(itemdb->other, NULL, 0, itemdb->searchname_array_sub, str, flag);
}
- return count;
+
+ return results_count;
}
+
/* [Ind/Hercules] */
static int itemdb_chain_item(unsigned short chain_id, int *rate)
{
@@ -1531,138 +1563,99 @@ static void itemdb_read_chains(void)
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, config_filename);
}
-/**
- * @return: amount of retrieved entries.
- **/
-static int itemdb_combo_split_atoi(char *str, int *val)
+static bool itemdb_read_combodb_libconfig(void)
{
- int i;
-
- nullpo_ret(val);
+ struct config_t combo_conf;
+ char filepath[256];
+ safesnprintf(filepath, sizeof(filepath), "%s/%s/%s", map->db_path, DBPATH, "item_combo_db.conf");
- for (i=0; i<MAX_ITEMS_PER_COMBO; i++) {
- if (!str) break;
+ if (libconfig->load_file(&combo_conf, filepath) == CONFIG_FALSE) {
+ ShowError("itemdb_read_combodb_libconfig: can't read %s\n", filepath);
+ return false;
+ }
- val[i] = atoi(str);
- str = strchr(str,':');
- if (str)
- *str++=0;
+ struct config_setting_t *combo_db = NULL;
+ if ((combo_db = libconfig->setting_get_member(combo_conf.root, "combo_db")) == NULL) {
+ ShowError("itemdb_read_combodb_libconfig: can't read %s\n", filepath);
+ return false;
}
- if( i == 0 ) //No data found.
- return 0;
+ int i = 0;
+ int count = 0;
+ struct config_setting_t *it = NULL;
- return i;
+ while ((it = libconfig->setting_get_elem(combo_db, i++)) != NULL) {
+ if (itemdb->read_combodb_libconfig_sub(it, i - 1, filepath))
+ ++count;
+ }
+
+ libconfig->destroy(&combo_conf);
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filepath);
+ return true;
}
-/**
- * <combo{:combo{:combo:{..}}}>,<{ script }>
- **/
-static void itemdb_read_combos(void)
+
+static bool itemdb_read_combodb_libconfig_sub(struct config_setting_t *it, int idx, const char *source)
{
- uint32 lines = 0, count = 0;
- char line[1024];
- char filepath[256];
- FILE* fp;
+ nullpo_retr(false, it);
+ nullpo_retr(false, source);
- safesnprintf(filepath, 256, "%s/%s", map->db_path, DBPATH"item_combo_db.txt");
+ struct config_setting_t *t = NULL;
- if ((fp = fopen(filepath, "r")) == NULL) {
- ShowError("itemdb_read_combos: File not found \"%s\".\n", filepath);
- return;
+ if ((t = libconfig->setting_get_member(it, "Items")) == NULL) {
+ ShowWarning("itemdb_read_combodb_libconfig_sub: invalid item list for combo (%d), in (%s), skipping..\n", idx, source);
+ return false;
}
- // process rows one by one
- while(fgets(line, sizeof(line), fp)) {
- char *str[2], *p;
-
- lines++;
-
- if (line[0] == '/' && line[1] == '/')
- continue;
-
- memset(str, 0, sizeof(str));
+ if (!config_setting_is_array(t)) {
+ ShowWarning("itemdb_read_combodb_libconfig_sub: the combo (%d) item list must be an array, in (%s), skipping..\n", idx, source);
+ return false;
+ }
- p = line;
- p = trim(p);
- if (*p == '\0')
- continue;// empty line
+ int len = libconfig->setting_length(t);
+ if (len > MAX_ITEMS_PER_COMBO) {
+ ShowWarning("itemdb_read_combodb_libconfig_sub: the size of combo (%d) item list is too big (%d, max = %d), in (%s), skipping..\n", idx, len, MAX_ITEMS_PER_COMBO, source);
+ return false;
+ }
- if (!strchr(p,',')) {
- /* is there even a single column? */
- ShowError("itemdb_read_combos: Insufficient columns in line %u of \"%s\", skipping.\n", lines, filepath);
- continue;
- }
+ struct item_combo *combo = NULL;
+ RECREATE(itemdb->combos, struct item_combo *, ++itemdb->combo_count);
+ CREATE(combo, struct item_combo, 1);
- str[0] = p;
- p = strchr(p,',');
- *p = '\0';
- p++;
+ combo->id = itemdb->combo_count - 1;
+ combo->count = len;
- str[1] = p;
- p = strchr(p,',');
- p++;
+ for (int i = 0; i < len; i++) {
+ struct item_data *item = NULL;
+ const char *name = libconfig->setting_get_string_elem(t, i);
- if (str[1][0] != '{') {
- ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath);
- continue;
+ if ((item = itemdb->name2id(name)) == NULL) {
+ ShowWarning("itemdb_read_combodb_libconfig_sub: unknown item '%s', in (%s), skipping..\n", name, source);
+ --itemdb->combo_count;
+ aFree(combo);
+ return false;
}
+ combo->nameid[i] = item->nameid;
+ }
- /* no ending key anywhere (missing \}\) */
- if ( str[1][strlen(str[1])-1] != '}' ) {
- ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath);
- continue;
- } else {
- int items[MAX_ITEMS_PER_COMBO];
- int v = 0, retcount = 0;
- struct item_combo *combo = NULL;
-
- if((retcount = itemdb->combo_split_atoi(str[0], items)) < 2) {
- ShowError("itemdb_read_combos: line %u of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath);
- continue;
- }
-
- /* validate */
- for(v = 0; v < retcount; v++) {
- if( !itemdb->exists(items[v]) ) {
- ShowError("itemdb_read_combos: line %u of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath, items[v]);
- break;
- }
- }
- /* failed at some item */
- if( v < retcount )
- continue;
-
- RECREATE(itemdb->combos, struct item_combo*, ++itemdb->combo_count);
-
- CREATE(combo, struct item_combo, 1);
-
- combo->count = retcount;
- combo->script = script->parse(str[1], filepath, lines, 0, NULL);
- combo->id = itemdb->combo_count - 1;
- /* populate ->nameid field */
- for( v = 0; v < retcount; v++ ) {
- combo->nameid[v] = items[v];
- }
-
- itemdb->combos[itemdb->combo_count - 1] = combo;
+ const char *str = NULL;
+ if (libconfig->setting_lookup_string(it, "Script", &str) == CONFIG_TRUE) {
+ combo->script = *str ? script->parse(str, source, -idx, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+ } else {
+ ShowWarning("itemdb_read_combodb_libconfig_sub: invalid script for combo (%d) in (%s), skipping..\n", idx, source);
+ --itemdb->combo_count;
+ aFree(combo);
+ return false;
+ }
- /* populate the items to refer to this combo */
- for( v = 0; v < retcount; v++ ) {
- struct item_data * it;
- int index;
+ itemdb->combos[combo->id] = combo;
- it = itemdb->exists(items[v]);
- index = it->combos_count;
- RECREATE(it->combos, struct item_combo*, ++it->combos_count);
- it->combos[index] = combo;
- }
- }
- count++;
+ /* populate the items to refer to this combo */
+ for (int i = 0; i < len; i++) {
+ struct item_data *item = itemdb->exists(combo->nameid[i]);
+ RECREATE(item->combos, struct item_combo *, ++item->combos_count);
+ item->combos[item->combos_count - 1] = combo;
}
- fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%"PRIu32""CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, DBPATH"item_combo_db.txt");
-
- return;
+ return true;
}
/*======================================
@@ -1726,6 +1719,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(entry->unequip_script);
entry->unequip_script = NULL;
}
+ if (entry->rental_start_script != NULL) {
+ script->free_code(entry->rental_start_script);
+ entry->rental_start_script = NULL;
+ }
+ if (entry->rental_end_script != NULL) {
+ script->free_code(entry->rental_end_script);
+ entry->rental_end_script = NULL;
+ }
return 0;
#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
}
@@ -1756,6 +1757,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(entry->unequip_script);
entry->unequip_script = NULL;
}
+ if (entry->rental_start_script != NULL) {
+ script->free_code(entry->rental_start_script);
+ entry->rental_start_script = NULL;
+ }
+ if (entry->rental_end_script != NULL) {
+ script->free_code(entry->rental_end_script);
+ entry->rental_end_script = NULL;
+ }
return 0;
}
}
@@ -1883,7 +1892,14 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou
script->free_code(item->unequip_script);
item->unequip_script = NULL;
}
-
+ if (item->rental_start_script != NULL && item->rental_start_script != entry->rental_start_script) { // Don't free if it's inheriting the same script
+ script->free_code(item->rental_start_script);
+ item->rental_start_script = NULL;
+ }
+ if (item->rental_end_script != NULL && item->rental_end_script != entry->rental_end_script) { // Don't free if it's inheriting the same script
+ script->free_code(item->rental_end_script);
+ item->rental_end_script = NULL;
+ }
*item = *entry;
return item->nameid;
}
@@ -1999,6 +2015,8 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const
* ">
* OnEquipScript: <" OnEquip Script ">
* OnUnequipScript: <" OnUnequip Script ">
+ * OnRentalStartScript: <" on renting script ">
+ * OnRentalEndScript: <" on renting end script ">
* Inherit: inherit or override
*/
if( !itemdb->lookup_const(it, "Id", &i32) ) {
@@ -2276,6 +2294,12 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const
if( libconfig->setting_lookup_string(it, "OnUnequipScript", &str) )
id.unequip_script = *str ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+ if (libconfig->setting_lookup_string(it, "OnRentalStartScript", &str) != CONFIG_FALSE)
+ id.rental_start_script = (*str != '\0') ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+
+ if (libconfig->setting_lookup_string(it, "OnRentalEndScript", &str) != CONFIG_FALSE)
+ id.rental_end_script = (*str != '\0') ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+
return itemdb->validate_entry(&id, n, source);
}
@@ -2461,7 +2485,7 @@ static void itemdb_read(bool minimal)
itemdb->name_constants();
- itemdb->read_combos();
+ itemdb->read_combodb_libconfig();
itemdb->read_groups();
itemdb->read_chains();
itemdb->read_packages();
@@ -2519,6 +2543,10 @@ static void destroy_item_data(struct item_data *self, int free_self)
script->free_code(self->equip_script);
if( self->unequip_script )
script->free_code(self->unequip_script);
+ if (self->rental_start_script != NULL)
+ script->free_code(self->rental_start_script);
+ if (self->rental_end_script != NULL)
+ script->free_code(self->rental_end_script);
if( self->combos )
aFree(self->combos);
HPM->data_store_destroy(&self->hdata);
@@ -2805,8 +2833,8 @@ void itemdb_defaults(void)
itemdb->isrestricted = itemdb_isrestricted;
itemdb->isidentified = itemdb_isidentified;
itemdb->isidentified2 = itemdb_isidentified2;
- itemdb->combo_split_atoi = itemdb_combo_split_atoi;
- itemdb->read_combos = itemdb_read_combos;
+ itemdb->read_combodb_libconfig = itemdb_read_combodb_libconfig;
+ itemdb->read_combodb_libconfig_sub = itemdb_read_combodb_libconfig_sub;
itemdb->gendercheck = itemdb_gendercheck;
itemdb->validate_entry = itemdb_validate_entry;
itemdb->readdb_options_additional_fields = itemdb_readdb_options_additional_fields;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 7da7609f1..e3264d7d8 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -412,6 +412,16 @@ enum ItemOptionTypes {
IT_OPT_MAX
};
+/**
+ * Item name search flags
+ **/
+
+enum item_name_search_flag {
+ IT_SEARCH_NAME_PARTIAL,
+ IT_SEARCH_NAME_EXACT,
+ IT_SEARCH_NAME_MAX,
+};
+
/** Convenience item list (entry) used in various functions */
struct itemlist_entry {
int id; ///< Item ID or (inventory) index
@@ -516,6 +526,8 @@ struct item_data {
struct script_code *script; ///< Default script for everything.
struct script_code *equip_script; ///< Script executed once when equipping.
struct script_code *unequip_script; ///< Script executed once when unequipping.
+ struct script_code *rental_start_script; ///< Script executed once this item get rented
+ struct script_code *rental_end_script; ///< Script executed once this item rent ends
struct {
unsigned available : 1;
unsigned no_refine : 1; // [celest]
@@ -633,7 +645,7 @@ struct itemdb_interface {
/* */
struct item_data* (*name2id) (const char *str);
struct item_data* (*search_name) (const char *name);
- int (*search_name_array) (struct item_data** data, int size, const char *str, int flag);
+ int (*search_name_array) (struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
struct item_data* (*load)(int nameid);
struct item_data* (*search)(int nameid);
struct item_data* (*exists) (int nameid);
@@ -666,8 +678,8 @@ struct itemdb_interface {
int (*isrestricted) (struct item *item, int gmlv, int gmlv2, int(*func)(struct item_data *, int, int));
int (*isidentified) (int nameid);
int (*isidentified2) (struct item_data *data);
- int (*combo_split_atoi) (char *str, int *val);
- void (*read_combos) (void);
+ bool (*read_combodb_libconfig) (void);
+ bool (*read_combodb_libconfig_sub) (struct config_setting_t *it, int idx, const char *source);
int (*gendercheck) (struct item_data *id);
int (*validate_entry) (struct item_data *entry, int n, const char *source);
void (*readdb_options_additional_fields) (struct itemdb_option *ito, struct config_setting_t *t, const char *source);
diff --git a/src/map/map.c b/src/map/map.c
index f92be52e9..332bbe75f 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2268,30 +2268,25 @@ static struct map_session_data *map_charid2sd(int charid)
* (without sensitive case if necessary)
* return map_session_data pointer or NULL
*------------------------------------------*/
-static struct map_session_data *map_nick2sd(const char *nick)
+static struct map_session_data *map_nick2sd(const char *nick, bool allow_partial)
{
- struct map_session_data* sd;
- struct map_session_data* found_sd;
- struct s_mapiterator* iter;
- size_t nicklen;
- int qty = 0;
-
- if( nick == NULL )
+ if (nick == NULL)
return NULL;
- nicklen = strlen(nick);
- iter = mapit_getallusers();
+ struct s_mapiterator *iter = mapit_getallusers();
+ struct map_session_data *found_sd = NULL;
+
+ if (battle_config.partial_name_scan && allow_partial) {
+ int nicklen = (int)strlen(nick);
+ int qty = 0;
- found_sd = NULL;
- for (sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
- if( battle_config.partial_name_scan )
- {// partial name search
- if( strnicmp(sd->status.name, nick, nicklen) == 0 )
- {
+ // partial name search
+ for (struct map_session_data *sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
+ if (strnicmp(sd->status.name, nick, nicklen) == 0) {
found_sd = sd;
- if( strcmp(sd->status.name, nick) == 0 )
- {// Perfect Match
+ if (strcmp(sd->status.name, nick) == 0) {
+ // Perfect Match
qty = 1;
break;
}
@@ -2299,17 +2294,20 @@ static struct map_session_data *map_nick2sd(const char *nick)
qty++;
}
}
- else if( strcasecmp(sd->status.name, nick) == 0 )
- {// exact search only
- found_sd = sd;
- break;
+
+ if (qty != 1)
+ found_sd = NULL;
+ } else {
+ // exact search only
+ for (struct map_session_data *sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
+ if (strcasecmp(sd->status.name, nick) == 0) {
+ found_sd = sd;
+ break;
+ }
}
}
mapit->free(iter);
- if( battle_config.partial_name_scan && qty != 1 )
- found_sd = NULL;
-
return found_sd;
}
diff --git a/src/map/map.h b/src/map/map.h
index 39eb07e4c..6b360e1bc 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1208,7 +1208,7 @@ END_ZEROED_BLOCK;
void (*addiddb) (struct block_list *bl);
void (*deliddb) (struct block_list *bl);
/* */
- struct map_session_data * (*nick2sd) (const char *nick);
+ struct map_session_data * (*nick2sd) (const char *nick, bool allow_partial);
struct mob_data * (*getmob_boss) (int16 m);
struct mob_data * (*id2boss) (int id);
uint32 (*race_id2mask) (int race);
diff --git a/src/map/mob.c b/src/map/mob.c
index bad3f7eb8..e04d6944e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -239,6 +239,14 @@ static void mvptomb_destroy(struct mob_data *md)
m = nd->bl.m;
+ struct s_mapiterator *iter = mapit_geteachpc();
+ for (struct map_session_data *sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); sd = BL_UCAST(BL_PC, mapit->next(iter))) {
+ if (sd->npc_id == nd->bl.id) {
+ sd->state.npc_unloaded = 1;
+ }
+ }
+ mapit->free(iter);
+
clif->clearunit_area(&nd->bl,CLR_OUTSIGHT);
map->delblock(&nd->bl);
diff --git a/src/map/npc.c b/src/map/npc.c
index c3dff5870..868b8711a 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1258,6 +1258,9 @@ static void run_tomb(struct map_session_data *sd, struct npc_data *nd)
char time[10];
nullpo_retv(nd);
+
+ sd->npc_id = nd->bl.id;
+
strftime(time, sizeof(time), "%H:%M", localtime(&nd->u.tomb.kill_time));
// TODO: Find exact color?
@@ -1349,8 +1352,10 @@ static int npc_scriptcont(struct map_session_data *sd, int id, bool closing)
return 1;
}
- if(id != npc->fake_nd->bl.id) { // Not item script
- if ((npc->checknear(sd,target)) == NULL){
+ if (id != npc->fake_nd->bl.id) { // Not item script
+ if (sd->state.npc_unloaded != 0) {
+ sd->state.npc_unloaded = 0;
+ } else if ((npc->checknear(sd,target)) == NULL) {
ShowWarning("npc_scriptcont: failed npc->checknear test.\n");
return 1;
}
@@ -1371,8 +1376,10 @@ static int npc_scriptcont(struct map_session_data *sd, int id, bool closing)
if( sd->progressbar.npc_id && DIFF_TICK(sd->progressbar.timeout,timer->gettick()) > 0 )
return 1;
- if( !sd->st )
+ if( !sd->st ) {
+ sd->npc_id = 0;
return 1;
+ }
if( closing && sd->st->state == CLOSE )
sd->st->state = END;
diff --git a/src/map/packets.h b/src/map/packets.h
index 83a9d0322..e91421cfc 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1954,4 +1954,9 @@ packet(0x96e,clif->ackmergeitems);
packet(0x0b22,clif->pHotkeyRowShift2); // CZ_SHORTCUTKEYBAR_ROTATE
#endif
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
+ packet(0x0b28,clif->pGuildCastleTeleportRequest);
+ packet(0x0b2c,clif->pGuildCastleInfoRequest);
+#endif
+
#endif /* MAP_PACKETS_H */
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 93b4abcca..24bb718da 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3626,6 +3626,49 @@ struct PACKET_ZC_TALKBOX_CHATCONTENTS {
} __attribute__((packed));
DEFINE_PACKET_HEADER(ZC_TALKBOX_CHATCONTENTS, 0x0191);
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+struct PACKET_ZC_GUILD_CASTLE_LIST {
+ int16 packetType;
+ int16 packetLength;
+ int8 castle_list[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_GUILD_CASTLE_LIST, 0x0b27);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
+struct PACKET_CZ_CASTLE_TELEPORT_REQUEST {
+ int16 packetType;
+ int8 castle_id;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_CASTLE_TELEPORT_REQUEST, 0x0b28);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+struct PACKET_ZC_CASTLE_TELEPORT_RESPONSE {
+ int16 packetType;
+ int16 result;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_CASTLE_TELEPORT_RESPONSE, 0x0b2e);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
+struct PACKET_ZC_CASTLE_INFO {
+ int16 packetType;
+ int8 castle_id;
+ int32 economy;
+ int32 defense;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_CASTLE_INFO, 0x0b2d);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
+struct PACKET_CZ_CASTLE_INFO_REQUEST {
+ int16 packetType;
+ int8 castle_id;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_CASTLE_INFO_REQUEST, 0x0b2c);
+#endif
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris
diff --git a/src/map/pc.c b/src/map/pc.c
index 8ac820d79..2cefa7674 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -565,72 +565,8 @@ static int pc_inventory_rental_clear(struct map_session_data *sd)
/* assumes i is valid (from default areas where it is called, it is) */
static void pc_rental_expire(struct map_session_data *sd, int i)
{
- int nameid;
-
nullpo_retv(sd);
Assert_retv(i >= 0 && i < sd->status.inventorySize);
- nameid = sd->status.inventory[i].nameid;
-
- /* Soon to be dropped, we got plans to integrate it with item db */
- switch( nameid ) {
- case ITEMID_BOARDING_HALTER:
- status_change_end(&sd->bl,SC_ALL_RIDING,INVALID_TIMER);
- break;
- case ITEMID_LOVE_ANGEL:
- if( sd->status.font == 1 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_SQUIRREL:
- if( sd->status.font == 2 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_GOGO:
- if( sd->status.font == 3 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_PICTURE_DIARY:
- if( sd->status.font == 4 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_MINI_HEART:
- if( sd->status.font == 5 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_NEWCOMER:
- if( sd->status.font == 6 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_KID:
- if( sd->status.font == 7 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_MAGIC_CASTLE:
- if( sd->status.font == 8 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- case ITEMID_BULGING_HEAD:
- if( sd->status.font == 9 ) {
- sd->status.font = 0;
- clif->font(sd);
- }
- break;
- }
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_RENTAL);
@@ -4789,13 +4725,15 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data,
pc->equipitem(sd, i, data->equip);
/* rental item check */
- if( item_data->expire_time ) {
- if( time(NULL) > item_data->expire_time ) {
- pc->rental_expire(sd,i);
+ if (item_data->expire_time > 0) {
+ if (time(NULL) > item_data->expire_time) {
+ pc->rental_expire(sd, i);
} else {
- int seconds = (int)( item_data->expire_time - time(NULL) );
+ int seconds = (int)(item_data->expire_time - time(NULL));
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, seconds);
pc->inventory_rental_add(sd, seconds);
+ if (data->rental_start_script != NULL)
+ script->run_item_rental_start_script(sd, data, 0);
}
}
quest->questinfo_refresh(sd);
@@ -4826,12 +4764,21 @@ static int pc_delitem(struct map_session_data *sd, int n, int amount, int type,
sd->status.inventory[n].amount -= amount;
sd->weight -= sd->inventory_data[n]->weight*amount ;
+
+ // It's here because the data would most likely get zeroed in following if [Hemagx]
+ struct item_data *itd = sd->inventory_data[n];
+ bool is_rental = (sd->status.inventory[n].expire_time > 0) ? true : false;
+
if( sd->status.inventory[n].amount <= 0 ){
if(sd->status.inventory[n].equip)
pc->unequipitem(sd, n, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
sd->inventory_data[n] = NULL;
}
+
+ if (is_rental && itd->rental_end_script != NULL)
+ script->run_item_rental_end_script(sd, itd, 0);
+
if(!(type&1))
clif->delitem(sd,n,amount,reason);
if(!(type&2))
diff --git a/src/map/pc.h b/src/map/pc.h
index 49edea61b..2d21dabf6 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -238,6 +238,7 @@ struct map_session_data {
unsigned int loggingout : 1;
unsigned int warp_clean : 1;
unsigned int refine_ui : 1;
+ unsigned int npc_unloaded : 1; ///< The player is talking with an unloaded NPCs (respawned tombstones)
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
diff --git a/src/map/script.c b/src/map/script.c
index c712eb01d..df6e0d329 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2813,7 +2813,7 @@ static struct map_session_data *script_charid2sd(struct script_state *st, int ch
static struct map_session_data *script_nick2sd(struct script_state *st, const char *name)
{
struct map_session_data *sd;
- if ((sd = map->nick2sd(name)) == NULL) {
+ if ((sd = map->nick2sd(name, false)) == NULL) {
ShowWarning("script_nick2sd: Player name '%s' not found!\n", name);
script->reportfunc(st);
script->reportsrc(st);
@@ -8780,7 +8780,7 @@ static BUILDIN(getcharid)
struct map_session_data *sd;
if (script_hasdata(st, 3))
- sd = map->nick2sd(script_getstr(st, 3));
+ sd = map->nick2sd(script_getstr(st, 3), false);
else
sd = script->rid2sd(st);
@@ -16488,7 +16488,7 @@ static BUILDIN(getmapxy)
case 0: //Get Character Position
if (script_hasdata(st,6)) {
if (script_isstringtype(st,6))
- sd = map->nick2sd(script_getstr(st,6));
+ sd = map->nick2sd(script_getstr(st,6), false);
else
sd = map->id2sd(script_getnum(st,6));
} else {
@@ -16515,7 +16515,7 @@ static BUILDIN(getmapxy)
case 2: //Get Pet Position
if (script_hasdata(st,6)) {
if (script_isstringtype(st,6))
- sd = map->nick2sd(script_getstr(st,6));
+ sd = map->nick2sd(script_getstr(st,6), false);
else {
bl = map->id2bl(script_getnum(st,6));
break;
@@ -16537,7 +16537,7 @@ static BUILDIN(getmapxy)
case 4: //Get Homun Position
if (script_hasdata(st,6)) {
if (script_isstringtype(st,6)) {
- sd = map->nick2sd(script_getstr(st,6));
+ sd = map->nick2sd(script_getstr(st,6), false);
} else {
bl = map->id2bl(script_getnum(st,6));
break;
@@ -16552,7 +16552,7 @@ static BUILDIN(getmapxy)
case 5: //Get Mercenary Position
if (script_hasdata(st,6)) {
if (script_isstringtype(st,6)) {
- sd = map->nick2sd(script_getstr(st,6));
+ sd = map->nick2sd(script_getstr(st,6), false);
} else {
bl = map->id2bl(script_getnum(st,6));
break;
@@ -16567,7 +16567,7 @@ static BUILDIN(getmapxy)
case 6: //Get Elemental Position
if (script_hasdata(st,6)) {
if (script_isstringtype(st,6)) {
- sd = map->nick2sd(script_getstr(st,6));
+ sd = map->nick2sd(script_getstr(st,6), false);
} else {
bl = map->id2bl(script_getnum(st,6));
break;
@@ -18804,7 +18804,7 @@ static BUILDIN(searchitem)
if ((items[0] = itemdb->exists(atoi(itemname)))) {
count = 1;
} else {
- count = itemdb->search_name_array(items, ARRAYLENGTH(items), itemname, 0);
+ count = itemdb->search_name_array(items, ARRAYLENGTH(items), itemname, IT_SEARCH_NAME_PARTIAL);
if (count > MAX_SEARCH) count = MAX_SEARCH;
}
@@ -22744,6 +22744,19 @@ static BUILDIN(setfont)
return true;
}
+static BUILDIN(getfont)
+{
+ struct map_session_data *sd = script->rid2sd(st);
+
+ if (sd == NULL) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ script_pushint(st, sd->status.font);
+ return true;
+}
+
static int buildin_mobuseskill_sub(struct block_list *bl, va_list ap)
{
struct mob_data *md = NULL;
@@ -23070,7 +23083,7 @@ static BUILDIN(getcharip)
/* check if a character name is specified */
if (script_hasdata(st, 2)) {
if (script_isstringtype(st, 2)) {
- sd = map->nick2sd(script_getstr(st, 2));
+ sd = map->nick2sd(script_getstr(st, 2), false);
} else {
int id = script_getnum(st, 2);
sd = (map->id2sd(id) ? map->id2sd(id) : map->charid2sd(id));
@@ -25891,6 +25904,36 @@ static void script_run_item_unequip_script(struct map_session_data *sd, struct i
script->current_item_id = 0;
}
+static void script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull(1, 2)));
+
+/**
+ * Run item rental start script
+ * @param sd player session data. Must be correct and checked before.
+ * @param data rental item data. Must be correct and checked before.
+ * @param oid npc id. Can be also 0 or fake npc id.
+ **/
+static void script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid)
+{
+ script->current_item_id = data->nameid;
+ script->run(data->rental_start_script, 0, sd->bl.id, oid);
+ script->current_item_id = 0;
+}
+
+static void script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull(1, 2)));
+
+/**
+* Run item rental end script
+* @param sd player session data. Must be correct and checked before.
+* @param data rental item data. Must be correct and checked before.
+* @param oid npc id. Can be also 0 or fake npc id.
+**/
+static void script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid)
+{
+ script->current_item_id = data->nameid;
+ script->run(data->rental_end_script, 0, sd->bl.id, oid);
+ script->current_item_id = 0;
+}
+
#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, false }
#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, false }
#define BUILDIN_DEF_DEPRECATED(x,args) { buildin_ ## x , #x , args, true }
@@ -26326,6 +26369,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF(mercenary_set_faith,"ii"),
BUILDIN_DEF(readbook,"ii"),
BUILDIN_DEF(setfont,"i"),
+ BUILDIN_DEF(getfont, ""),
BUILDIN_DEF(areamobuseskill,"siiiiviiiii"),
BUILDIN_DEF(progressbar,"si"),
BUILDIN_DEF(progressbar_unit,"si?"),
@@ -27078,6 +27122,11 @@ static void script_hardcoded_constants(void)
script->set_constant("GUILD_ONLINE_VENDOR", GUILD_ONLINE_VENDOR, false, false);
script->set_constant("GUILD_ONLINE_NO_VENDOR", GUILD_ONLINE_NO_VENDOR, false, false);
+ script->constdb_comment("Siege Types");
+ script->set_constant("SIEGE_TYPE_FE", SIEGE_TYPE_FE, false, false);
+ script->set_constant("SIEGE_TYPE_SE", SIEGE_TYPE_SE, false, false);
+ script->set_constant("SIEGE_TYPE_TE", SIEGE_TYPE_TE, false, false);
+
script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);
@@ -27438,4 +27487,6 @@ void script_defaults(void)
script->run_use_script = script_run_use_script;
script->run_item_equip_script = script_run_item_equip_script;
script->run_item_unequip_script = script_run_item_unequip_script;
+ script->run_item_rental_start_script = script_run_item_rental_start_script;
+ script->run_item_rental_end_script = script_run_item_rental_end_script;
}
diff --git a/src/map/script.h b/src/map/script.h
index 5dc480a15..a75b948ab 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -542,6 +542,16 @@ enum pcblock_action_flag {
};
/**
+ * Types of Siege (WoE)
+ */
+enum siege_type {
+ SIEGE_TYPE_FE,
+ SIEGE_TYPE_SE,
+ SIEGE_TYPE_TE,
+ SIEGE_TYPE_MAX
+};
+
+/**
* Structures
**/
@@ -1039,6 +1049,8 @@ struct script_interface {
void (*run_use_script) (struct map_session_data *sd, struct item_data *data, int oid);
void (*run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid);
void (*run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid);
+ void (*run_item_rental_end_script) (struct map_session_data *sd, struct item_data *data, int oid);
+ void (*run_item_rental_start_script) (struct map_session_data *sd, struct item_data *data, int oid);
};
#ifdef HERCULES_CORE
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 8560d2eff..7e81d48de 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -1756,6 +1756,10 @@ typedef void (*HPMHOOK_pre_clif_guild_basicinfo) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_clif_guild_basicinfo) (struct map_session_data *sd);
typedef void (*HPMHOOK_pre_clif_guild_allianceinfo) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_clif_guild_allianceinfo) (struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_guild_castlelist) (struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_guild_castlelist) (struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_guild_castleinfo) (struct map_session_data **sd, struct guild_castle **gc);
+typedef void (*HPMHOOK_post_clif_guild_castleinfo) (struct map_session_data *sd, struct guild_castle *gc);
typedef void (*HPMHOOK_pre_clif_guild_memberlist) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_clif_guild_memberlist) (struct map_session_data *sd);
typedef void (*HPMHOOK_pre_clif_guild_skillinfo) (struct map_session_data **sd);
@@ -2726,6 +2730,12 @@ typedef void (*HPMHOOK_pre_clif_pRefineryUIRefine) (int *fd, struct map_session_
typedef void (*HPMHOOK_post_clif_pRefineryUIRefine) (int fd, struct map_session_data *sd);
typedef void (*HPMHOOK_pre_clif_announce_refine_status) (struct map_session_data **sd, int *item_id, int *refine_level, bool *success, enum send_target *target);
typedef void (*HPMHOOK_post_clif_announce_refine_status) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target);
+typedef void (*HPMHOOK_pre_clif_pGuildCastleTeleportRequest) (int *fd, struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_pGuildCastleTeleportRequest) (int fd, struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_pGuildCastleInfoRequest) (int *fd, struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_pGuildCastleInfoRequest) (int fd, struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_guild_castleteleport_res) (struct map_session_data **sd, enum siege_teleport_result *result);
+typedef void (*HPMHOOK_post_clif_guild_castleteleport_res) (struct map_session_data *sd, enum siege_teleport_result result);
#endif // MAP_CLIF_H
#ifdef COMMON_CORE_H /* cmdline */
typedef void (*HPMHOOK_pre_cmdline_init) (void);
@@ -3058,6 +3068,8 @@ typedef bool (*HPMHOOK_pre_guild_read_castledb_libconfig) (void);
typedef bool (*HPMHOOK_post_guild_read_castledb_libconfig) (bool retVal___);
typedef bool (*HPMHOOK_pre_guild_read_castledb_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source);
typedef bool (*HPMHOOK_post_guild_read_castledb_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source);
+typedef bool (*HPMHOOK_pre_guild_read_castledb_libconfig_sub_warp) (struct config_setting_t **wd, const char **source, struct guild_castle **gc);
+typedef bool (*HPMHOOK_post_guild_read_castledb_libconfig_sub_warp) (bool retVal___, struct config_setting_t *wd, const char *source, struct guild_castle *gc);
typedef int (*HPMHOOK_pre_guild_payexp_timer_sub) (union DBKey *key, struct DBData **data, va_list ap);
typedef int (*HPMHOOK_post_guild_payexp_timer_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap);
typedef int (*HPMHOOK_pre_guild_send_xy_timer_sub) (union DBKey *key, struct DBData **data, va_list ap);
@@ -3978,8 +3990,8 @@ typedef struct item_data* (*HPMHOOK_pre_itemdb_name2id) (const char **str);
typedef struct item_data* (*HPMHOOK_post_itemdb_name2id) (struct item_data* retVal___, const char *str);
typedef struct item_data* (*HPMHOOK_pre_itemdb_search_name) (const char **name);
typedef struct item_data* (*HPMHOOK_post_itemdb_search_name) (struct item_data* retVal___, const char *name);
-typedef int (*HPMHOOK_pre_itemdb_search_name_array) (struct item_data ***data, int *size, const char **str, int *flag);
-typedef int (*HPMHOOK_post_itemdb_search_name_array) (int retVal___, struct item_data **data, int size, const char *str, int flag);
+typedef int (*HPMHOOK_pre_itemdb_search_name_array) (struct item_data ***data, const int *size, const char **str, enum item_name_search_flag *flag);
+typedef int (*HPMHOOK_post_itemdb_search_name_array) (int retVal___, struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
typedef struct item_data* (*HPMHOOK_pre_itemdb_load) (int *nameid);
typedef struct item_data* (*HPMHOOK_post_itemdb_load) (struct item_data* retVal___, int nameid);
typedef struct item_data* (*HPMHOOK_pre_itemdb_search) (int *nameid);
@@ -4044,10 +4056,10 @@ typedef int (*HPMHOOK_pre_itemdb_isidentified) (int *nameid);
typedef int (*HPMHOOK_post_itemdb_isidentified) (int retVal___, int nameid);
typedef int (*HPMHOOK_pre_itemdb_isidentified2) (struct item_data **data);
typedef int (*HPMHOOK_post_itemdb_isidentified2) (int retVal___, struct item_data *data);
-typedef int (*HPMHOOK_pre_itemdb_combo_split_atoi) (char **str, int **val);
-typedef int (*HPMHOOK_post_itemdb_combo_split_atoi) (int retVal___, char *str, int *val);
-typedef void (*HPMHOOK_pre_itemdb_read_combos) (void);
-typedef void (*HPMHOOK_post_itemdb_read_combos) (void);
+typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig) (void);
+typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig) (bool retVal___);
+typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source);
+typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source);
typedef int (*HPMHOOK_pre_itemdb_gendercheck) (struct item_data **id);
typedef int (*HPMHOOK_post_itemdb_gendercheck) (int retVal___, struct item_data *id);
typedef int (*HPMHOOK_pre_itemdb_validate_entry) (struct item_data **entry, int *n, const char **source);
@@ -4670,8 +4682,8 @@ typedef void (*HPMHOOK_pre_map_addiddb) (struct block_list **bl);
typedef void (*HPMHOOK_post_map_addiddb) (struct block_list *bl);
typedef void (*HPMHOOK_pre_map_deliddb) (struct block_list **bl);
typedef void (*HPMHOOK_post_map_deliddb) (struct block_list *bl);
-typedef struct map_session_data* (*HPMHOOK_pre_map_nick2sd) (const char **nick);
-typedef struct map_session_data* (*HPMHOOK_post_map_nick2sd) (struct map_session_data* retVal___, const char *nick);
+typedef struct map_session_data* (*HPMHOOK_pre_map_nick2sd) (const char **nick, bool *allow_partial);
+typedef struct map_session_data* (*HPMHOOK_post_map_nick2sd) (struct map_session_data* retVal___, const char *nick, bool allow_partial);
typedef struct mob_data* (*HPMHOOK_pre_map_getmob_boss) (int16 *m);
typedef struct mob_data* (*HPMHOOK_post_map_getmob_boss) (struct mob_data* retVal___, int16 m);
typedef struct mob_data* (*HPMHOOK_pre_map_id2boss) (int *id);
@@ -7050,6 +7062,10 @@ typedef void (*HPMHOOK_pre_script_run_item_equip_script) (struct map_session_dat
typedef void (*HPMHOOK_post_script_run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid);
typedef void (*HPMHOOK_pre_script_run_item_unequip_script) (struct map_session_data **sd, struct item_data **data, int *oid);
typedef void (*HPMHOOK_post_script_run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid);
+typedef void (*HPMHOOK_pre_script_run_item_rental_end_script) (struct map_session_data **sd, struct item_data **data, int *oid);
+typedef void (*HPMHOOK_post_script_run_item_rental_end_script) (struct map_session_data *sd, struct item_data *data, int oid);
+typedef void (*HPMHOOK_pre_script_run_item_rental_start_script) (struct map_session_data **sd, struct item_data **data, int *oid);
+typedef void (*HPMHOOK_post_script_run_item_rental_start_script) (struct map_session_data *sd, struct item_data *data, int oid);
#endif // MAP_SCRIPT_H
#ifdef MAP_SEARCHSTORE_H /* searchstore */
typedef bool (*HPMHOOK_pre_searchstore_open) (struct map_session_data **sd, unsigned int *uses, unsigned short *effect);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 1bf974d28..37c42d8c2 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -1346,6 +1346,10 @@ struct {
struct HPMHookPoint *HP_clif_guild_basicinfo_post;
struct HPMHookPoint *HP_clif_guild_allianceinfo_pre;
struct HPMHookPoint *HP_clif_guild_allianceinfo_post;
+ struct HPMHookPoint *HP_clif_guild_castlelist_pre;
+ struct HPMHookPoint *HP_clif_guild_castlelist_post;
+ struct HPMHookPoint *HP_clif_guild_castleinfo_pre;
+ struct HPMHookPoint *HP_clif_guild_castleinfo_post;
struct HPMHookPoint *HP_clif_guild_memberlist_pre;
struct HPMHookPoint *HP_clif_guild_memberlist_post;
struct HPMHookPoint *HP_clif_guild_skillinfo_pre;
@@ -2316,6 +2320,12 @@ struct {
struct HPMHookPoint *HP_clif_pRefineryUIRefine_post;
struct HPMHookPoint *HP_clif_announce_refine_status_pre;
struct HPMHookPoint *HP_clif_announce_refine_status_post;
+ struct HPMHookPoint *HP_clif_pGuildCastleTeleportRequest_pre;
+ struct HPMHookPoint *HP_clif_pGuildCastleTeleportRequest_post;
+ struct HPMHookPoint *HP_clif_pGuildCastleInfoRequest_pre;
+ struct HPMHookPoint *HP_clif_pGuildCastleInfoRequest_post;
+ struct HPMHookPoint *HP_clif_guild_castleteleport_res_pre;
+ struct HPMHookPoint *HP_clif_guild_castleteleport_res_post;
struct HPMHookPoint *HP_cmdline_init_pre;
struct HPMHookPoint *HP_cmdline_init_post;
struct HPMHookPoint *HP_cmdline_final_pre;
@@ -2622,6 +2632,8 @@ struct {
struct HPMHookPoint *HP_guild_read_castledb_libconfig_post;
struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_pre;
struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_post;
+ struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_warp_pre;
+ struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_warp_post;
struct HPMHookPoint *HP_guild_payexp_timer_sub_pre;
struct HPMHookPoint *HP_guild_payexp_timer_sub_post;
struct HPMHookPoint *HP_guild_send_xy_timer_sub_pre;
@@ -3220,10 +3232,10 @@ struct {
struct HPMHookPoint *HP_itemdb_isidentified_post;
struct HPMHookPoint *HP_itemdb_isidentified2_pre;
struct HPMHookPoint *HP_itemdb_isidentified2_post;
- struct HPMHookPoint *HP_itemdb_combo_split_atoi_pre;
- struct HPMHookPoint *HP_itemdb_combo_split_atoi_post;
- struct HPMHookPoint *HP_itemdb_read_combos_pre;
- struct HPMHookPoint *HP_itemdb_read_combos_post;
+ struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_pre;
+ struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_post;
+ struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_pre;
+ struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_post;
struct HPMHookPoint *HP_itemdb_gendercheck_pre;
struct HPMHookPoint *HP_itemdb_gendercheck_post;
struct HPMHookPoint *HP_itemdb_validate_entry_pre;
@@ -5584,6 +5596,10 @@ struct {
struct HPMHookPoint *HP_script_run_item_equip_script_post;
struct HPMHookPoint *HP_script_run_item_unequip_script_pre;
struct HPMHookPoint *HP_script_run_item_unequip_script_post;
+ struct HPMHookPoint *HP_script_run_item_rental_end_script_pre;
+ struct HPMHookPoint *HP_script_run_item_rental_end_script_post;
+ struct HPMHookPoint *HP_script_run_item_rental_start_script_pre;
+ struct HPMHookPoint *HP_script_run_item_rental_start_script_post;
struct HPMHookPoint *HP_searchstore_open_pre;
struct HPMHookPoint *HP_searchstore_open_post;
struct HPMHookPoint *HP_searchstore_query_pre;
@@ -8127,6 +8143,10 @@ struct {
int HP_clif_guild_basicinfo_post;
int HP_clif_guild_allianceinfo_pre;
int HP_clif_guild_allianceinfo_post;
+ int HP_clif_guild_castlelist_pre;
+ int HP_clif_guild_castlelist_post;
+ int HP_clif_guild_castleinfo_pre;
+ int HP_clif_guild_castleinfo_post;
int HP_clif_guild_memberlist_pre;
int HP_clif_guild_memberlist_post;
int HP_clif_guild_skillinfo_pre;
@@ -9097,6 +9117,12 @@ struct {
int HP_clif_pRefineryUIRefine_post;
int HP_clif_announce_refine_status_pre;
int HP_clif_announce_refine_status_post;
+ int HP_clif_pGuildCastleTeleportRequest_pre;
+ int HP_clif_pGuildCastleTeleportRequest_post;
+ int HP_clif_pGuildCastleInfoRequest_pre;
+ int HP_clif_pGuildCastleInfoRequest_post;
+ int HP_clif_guild_castleteleport_res_pre;
+ int HP_clif_guild_castleteleport_res_post;
int HP_cmdline_init_pre;
int HP_cmdline_init_post;
int HP_cmdline_final_pre;
@@ -9403,6 +9429,8 @@ struct {
int HP_guild_read_castledb_libconfig_post;
int HP_guild_read_castledb_libconfig_sub_pre;
int HP_guild_read_castledb_libconfig_sub_post;
+ int HP_guild_read_castledb_libconfig_sub_warp_pre;
+ int HP_guild_read_castledb_libconfig_sub_warp_post;
int HP_guild_payexp_timer_sub_pre;
int HP_guild_payexp_timer_sub_post;
int HP_guild_send_xy_timer_sub_pre;
@@ -10001,10 +10029,10 @@ struct {
int HP_itemdb_isidentified_post;
int HP_itemdb_isidentified2_pre;
int HP_itemdb_isidentified2_post;
- int HP_itemdb_combo_split_atoi_pre;
- int HP_itemdb_combo_split_atoi_post;
- int HP_itemdb_read_combos_pre;
- int HP_itemdb_read_combos_post;
+ int HP_itemdb_read_combodb_libconfig_pre;
+ int HP_itemdb_read_combodb_libconfig_post;
+ int HP_itemdb_read_combodb_libconfig_sub_pre;
+ int HP_itemdb_read_combodb_libconfig_sub_post;
int HP_itemdb_gendercheck_pre;
int HP_itemdb_gendercheck_post;
int HP_itemdb_validate_entry_pre;
@@ -12365,6 +12393,10 @@ struct {
int HP_script_run_item_equip_script_post;
int HP_script_run_item_unequip_script_pre;
int HP_script_run_item_unequip_script_post;
+ int HP_script_run_item_rental_end_script_pre;
+ int HP_script_run_item_rental_end_script_post;
+ int HP_script_run_item_rental_start_script_pre;
+ int HP_script_run_item_rental_start_script_post;
int HP_searchstore_open_pre;
int HP_searchstore_open_post;
int HP_searchstore_query_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 290c27961..748db6123 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -697,6 +697,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(clif->guild_masterormember, HP_clif_guild_masterormember) },
{ HP_POP(clif->guild_basicinfo, HP_clif_guild_basicinfo) },
{ HP_POP(clif->guild_allianceinfo, HP_clif_guild_allianceinfo) },
+ { HP_POP(clif->guild_castlelist, HP_clif_guild_castlelist) },
+ { HP_POP(clif->guild_castleinfo, HP_clif_guild_castleinfo) },
{ HP_POP(clif->guild_memberlist, HP_clif_guild_memberlist) },
{ HP_POP(clif->guild_skillinfo, HP_clif_guild_skillinfo) },
{ HP_POP(clif->guild_send_onlineinfo, HP_clif_guild_send_onlineinfo) },
@@ -1182,6 +1184,9 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(clif->pRefineryUIClose, HP_clif_pRefineryUIClose) },
{ HP_POP(clif->pRefineryUIRefine, HP_clif_pRefineryUIRefine) },
{ HP_POP(clif->announce_refine_status, HP_clif_announce_refine_status) },
+ { HP_POP(clif->pGuildCastleTeleportRequest, HP_clif_pGuildCastleTeleportRequest) },
+ { HP_POP(clif->pGuildCastleInfoRequest, HP_clif_pGuildCastleInfoRequest) },
+ { HP_POP(clif->guild_castleteleport_res, HP_clif_guild_castleteleport_res) },
/* cmdline_interface */
{ HP_POP(cmdline->init, HP_cmdline_init) },
{ HP_POP(cmdline->final, HP_cmdline_final) },
@@ -1344,6 +1349,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(guild->read_guildskill_tree_db, HP_guild_read_guildskill_tree_db) },
{ HP_POP(guild->read_castledb_libconfig, HP_guild_read_castledb_libconfig) },
{ HP_POP(guild->read_castledb_libconfig_sub, HP_guild_read_castledb_libconfig_sub) },
+ { HP_POP(guild->read_castledb_libconfig_sub_warp, HP_guild_read_castledb_libconfig_sub_warp) },
{ HP_POP(guild->payexp_timer_sub, HP_guild_payexp_timer_sub) },
{ HP_POP(guild->send_xy_timer_sub, HP_guild_send_xy_timer_sub) },
{ HP_POP(guild->send_xy_timer, HP_guild_send_xy_timer) },
@@ -1649,8 +1655,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(itemdb->isrestricted, HP_itemdb_isrestricted) },
{ HP_POP(itemdb->isidentified, HP_itemdb_isidentified) },
{ HP_POP(itemdb->isidentified2, HP_itemdb_isidentified2) },
- { HP_POP(itemdb->combo_split_atoi, HP_itemdb_combo_split_atoi) },
- { HP_POP(itemdb->read_combos, HP_itemdb_read_combos) },
+ { HP_POP(itemdb->read_combodb_libconfig, HP_itemdb_read_combodb_libconfig) },
+ { HP_POP(itemdb->read_combodb_libconfig_sub, HP_itemdb_read_combodb_libconfig_sub) },
{ HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) },
{ HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) },
{ HP_POP(itemdb->readdb_options_additional_fields, HP_itemdb_readdb_options_additional_fields) },
@@ -2858,6 +2864,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->run_use_script, HP_script_run_use_script) },
{ HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) },
{ HP_POP(script->run_item_unequip_script, HP_script_run_item_unequip_script) },
+ { HP_POP(script->run_item_rental_end_script, HP_script_run_item_rental_end_script) },
+ { HP_POP(script->run_item_rental_start_script, HP_script_run_item_rental_start_script) },
/* searchstore_interface */
{ HP_POP(searchstore->open, HP_searchstore_open) },
{ HP_POP(searchstore->query, HP_searchstore_query) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 325d7407d..1817b0660 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -17552,6 +17552,58 @@ void HP_clif_guild_allianceinfo(struct map_session_data *sd) {
}
return;
}
+void HP_clif_guild_castlelist(struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_guild_castlelist_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castlelist_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_guild_castlelist_pre[hIndex].func;
+ preHookFunc(&sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.guild_castlelist(sd);
+ }
+ if (HPMHooks.count.HP_clif_guild_castlelist_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castlelist_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_guild_castlelist_post[hIndex].func;
+ postHookFunc(sd);
+ }
+ }
+ return;
+}
+void HP_clif_guild_castleinfo(struct map_session_data *sd, struct guild_castle *gc) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_guild_castleinfo_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, struct guild_castle **gc);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castleinfo_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_guild_castleinfo_pre[hIndex].func;
+ preHookFunc(&sd, &gc);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.guild_castleinfo(sd, gc);
+ }
+ if (HPMHooks.count.HP_clif_guild_castleinfo_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, struct guild_castle *gc);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castleinfo_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_guild_castleinfo_post[hIndex].func;
+ postHookFunc(sd, gc);
+ }
+ }
+ return;
+}
void HP_clif_guild_memberlist(struct map_session_data *sd) {
int hIndex = 0;
if (HPMHooks.count.HP_clif_guild_memberlist_pre > 0) {
@@ -30193,6 +30245,84 @@ void HP_clif_announce_refine_status(struct map_session_data *sd, int item_id, in
}
return;
}
+void HP_clif_pGuildCastleTeleportRequest(int fd, struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_pGuildCastleTeleportRequest_pre > 0) {
+ void (*preHookFunc) (int *fd, struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGuildCastleTeleportRequest_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_pGuildCastleTeleportRequest_pre[hIndex].func;
+ preHookFunc(&fd, &sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.pGuildCastleTeleportRequest(fd, sd);
+ }
+ if (HPMHooks.count.HP_clif_pGuildCastleTeleportRequest_post > 0) {
+ void (*postHookFunc) (int fd, struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGuildCastleTeleportRequest_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_pGuildCastleTeleportRequest_post[hIndex].func;
+ postHookFunc(fd, sd);
+ }
+ }
+ return;
+}
+void HP_clif_pGuildCastleInfoRequest(int fd, struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_pGuildCastleInfoRequest_pre > 0) {
+ void (*preHookFunc) (int *fd, struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGuildCastleInfoRequest_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_pGuildCastleInfoRequest_pre[hIndex].func;
+ preHookFunc(&fd, &sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.pGuildCastleInfoRequest(fd, sd);
+ }
+ if (HPMHooks.count.HP_clif_pGuildCastleInfoRequest_post > 0) {
+ void (*postHookFunc) (int fd, struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGuildCastleInfoRequest_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_pGuildCastleInfoRequest_post[hIndex].func;
+ postHookFunc(fd, sd);
+ }
+ }
+ return;
+}
+void HP_clif_guild_castleteleport_res(struct map_session_data *sd, enum siege_teleport_result result) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_guild_castleteleport_res_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, enum siege_teleport_result *result);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castleteleport_res_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_guild_castleteleport_res_pre[hIndex].func;
+ preHookFunc(&sd, &result);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.guild_castleteleport_res(sd, result);
+ }
+ if (HPMHooks.count.HP_clif_guild_castleteleport_res_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, enum siege_teleport_result result);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_guild_castleteleport_res_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_guild_castleteleport_res_post[hIndex].func;
+ postHookFunc(sd, result);
+ }
+ }
+ return;
+}
/* cmdline_interface */
void HP_cmdline_init(void) {
int hIndex = 0;
@@ -34304,6 +34434,33 @@ bool HP_guild_read_castledb_libconfig_sub(struct config_setting_t *it, int idx,
}
return retVal___;
}
+bool HP_guild_read_castledb_libconfig_sub_warp(struct config_setting_t *wd, const char *source, struct guild_castle *gc) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_guild_read_castledb_libconfig_sub_warp_pre > 0) {
+ bool (*preHookFunc) (struct config_setting_t **wd, const char **source, struct guild_castle **gc);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_libconfig_sub_warp_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_sub_warp_pre[hIndex].func;
+ retVal___ = preHookFunc(&wd, &source, &gc);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.guild.read_castledb_libconfig_sub_warp(wd, source, gc);
+ }
+ if (HPMHooks.count.HP_guild_read_castledb_libconfig_sub_warp_post > 0) {
+ bool (*postHookFunc) (bool retVal___, struct config_setting_t *wd, const char *source, struct guild_castle *gc);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_libconfig_sub_warp_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_sub_warp_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, wd, source, gc);
+ }
+ }
+ return retVal___;
+}
int HP_guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap) {
int hIndex = 0;
int retVal___ = 0;
@@ -41438,11 +41595,11 @@ struct item_data* HP_itemdb_search_name(const char *name) {
}
return retVal___;
}
-int HP_itemdb_search_name_array(struct item_data **data, int size, const char *str, int flag) {
+int HP_itemdb_search_name_array(struct item_data **data, const int size, const char *str, enum item_name_search_flag flag) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_itemdb_search_name_array_pre > 0) {
- int (*preHookFunc) (struct item_data ***data, int *size, const char **str, int *flag);
+ int (*preHookFunc) (struct item_data ***data, const int *size, const char **str, enum item_name_search_flag *flag);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_search_name_array_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_itemdb_search_name_array_pre[hIndex].func;
@@ -41457,7 +41614,7 @@ int HP_itemdb_search_name_array(struct item_data **data, int size, const char *s
retVal___ = HPMHooks.source.itemdb.search_name_array(data, size, str, flag);
}
if (HPMHooks.count.HP_itemdb_search_name_array_post > 0) {
- int (*postHookFunc) (int retVal___, struct item_data **data, int size, const char *str, int flag);
+ int (*postHookFunc) (int retVal___, struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_search_name_array_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_itemdb_search_name_array_post[hIndex].func;
retVal___ = postHookFunc(retVal___, data, size, str, flag);
@@ -42337,15 +42494,15 @@ int HP_itemdb_isidentified2(struct item_data *data) {
}
return retVal___;
}
-int HP_itemdb_combo_split_atoi(char *str, int *val) {
+bool HP_itemdb_read_combodb_libconfig(void) {
int hIndex = 0;
- int retVal___ = 0;
- if (HPMHooks.count.HP_itemdb_combo_split_atoi_pre > 0) {
- int (*preHookFunc) (char **str, int **val);
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre > 0) {
+ bool (*preHookFunc) (void);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_pre[hIndex].func;
- retVal___ = preHookFunc(&str, &val);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_pre[hIndex].func;
+ retVal___ = preHookFunc();
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -42353,42 +42510,43 @@ int HP_itemdb_combo_split_atoi(char *str, int *val) {
}
}
{
- retVal___ = HPMHooks.source.itemdb.combo_split_atoi(str, val);
+ retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig();
}
- if (HPMHooks.count.HP_itemdb_combo_split_atoi_post > 0) {
- int (*postHookFunc) (int retVal___, char *str, int *val);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, str, val);
+ if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
}
}
return retVal___;
}
-void HP_itemdb_read_combos(void) {
+bool HP_itemdb_read_combodb_libconfig_sub(struct config_setting_t *it, int idx, const char *source) {
int hIndex = 0;
- if (HPMHooks.count.HP_itemdb_read_combos_pre > 0) {
- void (*preHookFunc) (void);
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre > 0) {
+ bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_itemdb_read_combos_pre[hIndex].func;
- preHookFunc();
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&it, &idx, &source);
}
if (*HPMforce_return) {
*HPMforce_return = false;
- return;
+ return retVal___;
}
}
{
- HPMHooks.source.itemdb.read_combos();
+ retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig_sub(it, idx, source);
}
- if (HPMHooks.count.HP_itemdb_read_combos_post > 0) {
- void (*postHookFunc) (void);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_itemdb_read_combos_post[hIndex].func;
- postHookFunc();
+ if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post > 0) {
+ bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, it, idx, source);
}
}
- return;
+ return retVal___;
}
int HP_itemdb_gendercheck(struct item_data *id) {
int hIndex = 0;
@@ -47493,15 +47651,15 @@ void HP_map_deliddb(struct block_list *bl) {
}
return;
}
-struct map_session_data* HP_map_nick2sd(const char *nick) {
+struct map_session_data* HP_map_nick2sd(const char *nick, bool allow_partial) {
int hIndex = 0;
struct map_session_data* retVal___ = NULL;
if (HPMHooks.count.HP_map_nick2sd_pre > 0) {
- struct map_session_data* (*preHookFunc) (const char **nick);
+ struct map_session_data* (*preHookFunc) (const char **nick, bool *allow_partial);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_nick2sd_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_map_nick2sd_pre[hIndex].func;
- retVal___ = preHookFunc(&nick);
+ retVal___ = preHookFunc(&nick, &allow_partial);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -47509,13 +47667,13 @@ struct map_session_data* HP_map_nick2sd(const char *nick) {
}
}
{
- retVal___ = HPMHooks.source.map.nick2sd(nick);
+ retVal___ = HPMHooks.source.map.nick2sd(nick, allow_partial);
}
if (HPMHooks.count.HP_map_nick2sd_post > 0) {
- struct map_session_data* (*postHookFunc) (struct map_session_data* retVal___, const char *nick);
+ struct map_session_data* (*postHookFunc) (struct map_session_data* retVal___, const char *nick, bool allow_partial);
for (hIndex = 0; hIndex < HPMHooks.count.HP_map_nick2sd_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_map_nick2sd_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, nick);
+ retVal___ = postHookFunc(retVal___, nick, allow_partial);
}
}
return retVal___;
@@ -74515,6 +74673,58 @@ void HP_script_run_item_unequip_script(struct map_session_data *sd, struct item_
}
return;
}
+void HP_script_run_item_rental_end_script(struct map_session_data *sd, struct item_data *data, int oid) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_script_run_item_rental_end_script_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, struct item_data **data, int *oid);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_end_script_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_run_item_rental_end_script_pre[hIndex].func;
+ preHookFunc(&sd, &data, &oid);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.run_item_rental_end_script(sd, data, oid);
+ }
+ if (HPMHooks.count.HP_script_run_item_rental_end_script_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int oid);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_end_script_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_run_item_rental_end_script_post[hIndex].func;
+ postHookFunc(sd, data, oid);
+ }
+ }
+ return;
+}
+void HP_script_run_item_rental_start_script(struct map_session_data *sd, struct item_data *data, int oid) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_script_run_item_rental_start_script_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, struct item_data **data, int *oid);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_start_script_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_run_item_rental_start_script_pre[hIndex].func;
+ preHookFunc(&sd, &data, &oid);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.script.run_item_rental_start_script(sd, data, oid);
+ }
+ if (HPMHooks.count.HP_script_run_item_rental_start_script_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int oid);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_rental_start_script_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_run_item_rental_start_script_post[hIndex].func;
+ postHookFunc(sd, data, oid);
+ }
+ }
+ return;
+}
/* searchstore_interface */
bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) {
int hIndex = 0;
diff --git a/src/plugins/constdb2doc.c b/src/plugins/constdb2doc.c
index 3f681ea1a..ebaf7a833 100644
--- a/src/plugins/constdb2doc.c
+++ b/src/plugins/constdb2doc.c
@@ -22,7 +22,8 @@
/// db/constants.conf -> doc/constants.md generator plugin
#include "common/hercules.h"
-//#include "common/memmgr.h"
+#include "common/db.h"
+#include "common/memmgr.h"
#include "common/nullpo.h"
#include "common/strlib.h"
#include "map/itemdb.h"
@@ -143,17 +144,26 @@ struct item_data *constdb2doc_itemdb_search(int nameid)
void constdb2doc_itemdb(void)
{
- int i;
-
nullpo_retv(out_fp);
fprintf(out_fp, "## Items (db/"DBPATH"item_db.conf)\n");
- for (i = 0; i < ARRAYLENGTH(itemdb->array); i++) {
+ for (int i = 0; i < ARRAYLENGTH(itemdb->array); i++) {
struct item_data *id = constdb2doc_itemdb_search(i);
if (id == NULL || id->name[0] == '\0')
continue;
fprintf(out_fp, "- `%s`: %d\n", id->name, id->nameid);
}
+
+ if (db_size(itemdb->other) > 0) {
+ struct DBIterator *iter = db_iterator(itemdb->other);
+ for (struct item_data *itd = dbi_first(iter); dbi_exists(iter); itd = dbi_next(iter)) {
+ if (itd == &itemdb->dummy)
+ continue;
+ fprintf(out_fp, "- `%s`: %d\n", itd->name, itd->nameid);
+ }
+ dbi_destroy(iter);
+ }
+
fprintf(out_fp, "\n");
}