summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c47
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/itemdb.c26
-rw-r--r--src/map/itemdb.h8
-rw-r--r--src/map/packets.h1
-rw-r--r--src/map/pc.c4
6 files changed, 73 insertions, 14 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 160de3adc..fcd63b2eb 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6687,7 +6687,8 @@ void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int
if(!sd && (flag&0xf0)==0)
{
int i;
- for(i=0;i<MAX_PARTY && !p->data[i].sd;i++);
+ for(i=0;i<MAX_PARTY && !p->data[i].sd;i++)
+ ;
if (i < MAX_PARTY)
sd = p->data[i].sd;
}
@@ -12421,30 +12422,47 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd)
guild_change_notice(sd, guild_id, msg1, msg2);
}
+// Helper function for guild invite functions
+int
+clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) {
+ if (t_sd == NULL) {// not online or does not exist
+ return 1;
+ }
+
+ if (map[sd->bl.m].flag.guildlock) { //Guild locked.
+ clif->message(fd, msg_txt(228));
+ return 1;
+ }
+
+ if (t_sd && t_sd->state.noask) {// @noask [LuzZza]
+ clif->noask_sub(sd, t_sd, 2);
+ return 1;
+ }
+
+ guild_invite(sd,t_sd);
+ return 0;
+}
/// Guild invite request (CZ_REQ_JOIN_GUILD).
/// 0168 <account id>.L <inviter account id>.L <inviter char id>.L
void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
{
- struct map_session_data *t_sd;
+ struct map_session_data *t_sd = map_id2sd(RFIFOL(fd,2));
- if(map[sd->bl.m].flag.guildlock) { //Guild locked.
- clif->message(fd, msg_txt(228));
+ if (clif_sub_guild_invite(fd, sd, t_sd))
return;
- }
-
- t_sd = map_id2sd(RFIFOL(fd,2));
+}
- // @noask [LuzZza]
- if(t_sd && t_sd->state.noask) {
- clif->noask_sub(sd, t_sd, 2);
+/// Guild invite request (/guildinvite) (CZ_REQ_JOIN_GUILD2).
+/// 0916 <char name>.24B
+void clif_parse_GuildInvite2(int fd, struct map_session_data *sd)
+{
+ struct map_session_data *t_sd = map_nick2sd((char *)RFIFOP(fd, 2));
+
+ if (clif_sub_guild_invite(fd, sd, t_sd))
return;
- }
-
- guild_invite(sd,t_sd);
}
-
/// Answer to guild invitation (CZ_JOIN_GUILD).
/// 016b <guild id>.L <answer>.L
/// answer:
@@ -17697,6 +17715,7 @@ void clif_defaults(void) {
clif->pCashShopBuy = clif_parse_CashShopBuy;
/* */
clif->pPartyTick = clif_parse_PartyTick;
+ clif->pGuildInvite2 = clif_parse_GuildInvite2;
/* dull */
clif->pDull = clif_parse_dull;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index ae3fb9cd4..9dfa83e00 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1079,6 +1079,7 @@ struct clif_interface {
void (*pCashShopSchedule) (int fd, struct map_session_data *sd);
void (*pCashShopBuy) (int fd, struct map_session_data *sd);
void (*pPartyTick) (int fd, struct map_session_data *sd);
+ void (*pGuildInvite2) (int fd, struct map_session_data *sd);
} clif_s;
struct clif_interface *clif;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 386f38c5a..0b4419e0c 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -727,6 +727,31 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current)
return true;
}
+
+/*******************************************
+** Item usage restriction (item_nouse.txt)
+********************************************/
+static bool itemdb_read_nouse(char* fields[], int columns, int current)
+{// <nameid>,<flag>,<override>
+ int nameid, flag, override;
+ struct item_data* id;
+
+ nameid = atoi(fields[0]);
+
+ if( ( id = itemdb_exists(nameid) ) == NULL ) {
+ ShowWarning("itemdb_read_nouse: Invalid item id %d.\n", nameid);
+ return false;
+ }
+
+ flag = atoi(fields[1]);
+ override = atoi(fields[2]);
+
+ id->item_usage.flag = flag;
+ id->item_usage.override = override;
+
+ return true;
+}
+
/**
* @return: amount of retrieved entries.
**/
@@ -1304,6 +1329,7 @@ static void itemdb_read(void) {
sv_readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay);
sv_readdb(db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack);
sv_readdb(db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
+ sv_readdb(db_path, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse);
itemdb_uid_load();
}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 362b42cff..c441de26a 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -68,6 +68,10 @@ enum {
ITEMID_SPECIAL_COOLER,
} mecha_item_list;
+enum {
+ NOUSE_SITTING = 0x01,
+} item_nouse_list;
+
//The only item group required by the code to be known. See const.txt for the full list.
#define IG_FINDINGORE 6
#define IG_POTION 37
@@ -136,6 +140,10 @@ struct item_data {
unsigned int storage:1;
unsigned int guildstorage:1;
} stack;
+ struct {// used by item_nouse.txt
+ unsigned int flag;
+ unsigned short override;
+ } item_usage;
short gm_lv_trade_override; //GM-level to override trade_restriction
/* bugreport:309 */
struct item_combo **combos;
diff --git a/src/map/packets.h b/src/map/packets.h
index c91028c13..edfa40c37 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1994,6 +1994,7 @@ packet(0x020d,-1);
packet(0x0368,6,clif->pSolveCharName,2);
packet(0x08E5,41,clif->pPartyBookingRegisterReq,2,4);
packet(0x08d2,10);
+ packet(0x0916,26,clif->pGuildInvite2,2);
#endif
//2012-06-18aRagexeRE
diff --git a/src/map/pc.c b/src/map/pc.c
index afc92594b..892c27e87 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4086,6 +4086,10 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( !item->script ) //if it has no script, you can't really consume it!
return 0;
+ if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (pc_get_group_level(sd) < item->item_usage.override) ) {
+ return 0; // You cannot use this item while sitting.
+ }
+
switch( nameid ) //@TODO, lot oh harcoded nameid here
{
case 605: // Anodyne