|
@@ -9,6 +9,7 @@
|
|
#include "../common/showmsg.h"
|
|
#include "../common/showmsg.h"
|
|
|
|
|
|
#include "party.h"
|
|
#include "party.h"
|
|
|
|
+#include "atcommand.h" //msg_txt()
|
|
#include "pc.h"
|
|
#include "pc.h"
|
|
#include "map.h"
|
|
#include "map.h"
|
|
#include "battle.h"
|
|
#include "battle.h"
|
|
@@ -259,15 +260,28 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
|
|
int i,flag=0;
|
|
int i,flag=0;
|
|
|
|
|
|
nullpo_retr(0, sd);
|
|
nullpo_retr(0, sd);
|
|
|
|
+ if (p==NULL)
|
|
|
|
+ return 0;
|
|
|
|
|
|
- if(tsd==NULL || p==NULL)
|
|
|
|
|
|
+ if(tsd==NULL) { //TODO: Find the correct reply packet.
|
|
|
|
+ clif_displaymessage(sd->fd, msg_txt(3));
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ //Only leader can invite.
|
|
|
|
+ ARR_FIND(0, MAX_PARTY, i, i < MAX_PARTY && p->data[i].sd != sd);
|
|
|
|
+ if (i == MAX_PARTY || !p->party.member[i].leader)
|
|
|
|
+ { //TODO: Find the correct reply packet.
|
|
|
|
+ clif_displaymessage(sd->fd, msg_txt(282));
|
|
return 0;
|
|
return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(!battle_config.invite_request_check) {
|
|
if(!battle_config.invite_request_check) {
|
|
if (tsd->guild_invite>0 || tsd->trade_partner) {
|
|
if (tsd->guild_invite>0 || tsd->trade_partner) {
|
|
clif_party_inviteack(sd,tsd->status.name,0);
|
|
clif_party_inviteack(sd,tsd->status.name,0);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
if (!tsd->fd) { //You can't invite someone who has already disconnected.
|
|
if (!tsd->fd) { //You can't invite someone who has already disconnected.
|
|
clif_party_inviteack(sd,tsd->status.name,1);
|
|
clif_party_inviteack(sd,tsd->status.name,1);
|
|
return 0;
|
|
return 0;
|