summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-08 22:53:15 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-08 22:53:15 +0000
commit5c0f510e8e7b0fb9cdf269f0408d1686c7f405d9 (patch)
tree1c87958830c0a501e0bf1e138a9d8f61b22a0d74 /src/map/intif.c
parent119ff0550b0f4d5e09b9cba41c2f56723c58ca5d (diff)
downloadhercules-5c0f510e8e7b0fb9cdf269f0408d1686c7f405d9.tar.gz
hercules-5c0f510e8e7b0fb9cdf269f0408d1686c7f405d9.tar.bz2
hercules-5c0f510e8e7b0fb9cdf269f0408d1686c7f405d9.tar.xz
hercules-5c0f510e8e7b0fb9cdf269f0408d1686c7f405d9.zip
file props
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@516 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index fc79e5148..66428d13d 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -54,10 +54,16 @@ extern int char_fd; // inter serverのfdはchar_fdを使う
//-----------------------------------------------------------------
// inter serverへの送信
+int CheckForCharServer() {
+ return ((char_fd == -1) || session[char_fd] == NULL || session[char_fd]->wdata == NULL);
+}
+
// pet
int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3080;
WFIFOL(inter_fd,2) = account_id;
WFIFOL(inter_fd,6) = char_id;
@@ -77,6 +83,8 @@ int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,sho
int intif_request_petdata(int account_id,int char_id,int pet_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3081;
WFIFOL(inter_fd,2) = account_id;
WFIFOL(inter_fd,6) = char_id;
@@ -88,6 +96,8 @@ int intif_request_petdata(int account_id,int char_id,int pet_id)
int intif_save_petdata(int account_id,struct s_pet *p)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3082;
WFIFOW(inter_fd,2) = sizeof(struct s_pet) + 8;
WFIFOL(inter_fd,4) = account_id;
@@ -99,6 +109,8 @@ int intif_save_petdata(int account_id,struct s_pet *p)
int intif_delete_petdata(int pet_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3083;
WFIFOL(inter_fd,2) = pet_id;
WFIFOSET(inter_fd,6);
@@ -110,6 +122,8 @@ int intif_delete_petdata(int pet_id)
int intif_GMmessage(char* mes,int len,int flag)
{
int lp = (flag&0x10) ? 8 : 4;
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3000;
WFIFOW(inter_fd,2) = lp + len;
WFIFOL(inter_fd,4) = 0x65756c62;
@@ -122,6 +136,8 @@ int intif_GMmessage(char* mes,int len,int flag)
// The transmission of Wisp/Page to inter-server (player not found on this server)
int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int mes_len) {
nullpo_retr(0, sd);
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3001;
WFIFOW(inter_fd,2) = mes_len + 52;
@@ -138,6 +154,8 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int me
// The reply of Wisp/page
int intif_wis_replay(int id, int flag) {
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3002;
WFIFOL(inter_fd,2) = id;
WFIFOB(inter_fd,6) = flag; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
@@ -151,6 +169,8 @@ int intif_wis_replay(int id, int flag) {
// The transmission of GM only Wisp/Page from server to inter-server
int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes, int mes_len) {
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3003;
WFIFOW(inter_fd,2) = mes_len + 30;
memcpy(WFIFOP(inter_fd,4), Wisp_name, 24);
@@ -167,6 +187,8 @@ int intif_wis_message_to_gm(char *Wisp_name, int min_gm_level, char *mes, int me
// アカウント変数送信
int intif_saveaccountreg(struct map_session_data *sd) {
int j,p;
+ if (CheckForCharServer())
+ return 0;
nullpo_retr(0, sd);
@@ -184,6 +206,8 @@ int intif_saveaccountreg(struct map_session_data *sd) {
int intif_request_accountreg(struct map_session_data *sd)
{
nullpo_retr(0, sd);
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3005;
WFIFOL(inter_fd,2) = sd->bl.id;
@@ -194,6 +218,8 @@ int intif_request_accountreg(struct map_session_data *sd)
// 倉庫データ要求
int intif_request_storage(int account_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3010;
WFIFOL(inter_fd,2) = account_id;
WFIFOSET(inter_fd,6);
@@ -202,6 +228,8 @@ int intif_request_storage(int account_id)
// 倉庫データ送信
int intif_send_storage(struct storage *stor)
{
+ if (CheckForCharServer())
+ return 0;
nullpo_retr(0, stor);
WFIFOW(inter_fd,0) = 0x3011;
WFIFOW(inter_fd,2) = sizeof(struct storage)+8;
@@ -213,6 +241,8 @@ int intif_send_storage(struct storage *stor)
int intif_request_guild_storage(int account_id,int guild_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3018;
WFIFOL(inter_fd,2) = account_id;
WFIFOL(inter_fd,6) = guild_id;
@@ -221,6 +251,8 @@ int intif_request_guild_storage(int account_id,int guild_id)
}
int intif_send_guild_storage(int account_id,struct guild_storage *gstor)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3019;
WFIFOW(inter_fd,2) = sizeof(struct guild_storage)+12;
WFIFOL(inter_fd,4) = account_id;
@@ -233,6 +265,8 @@ int intif_send_guild_storage(int account_id,struct guild_storage *gstor)
// パーティ作成要求
int intif_create_party(struct map_session_data *sd,char *name)
{
+ if (CheckForCharServer())
+ return 0;
nullpo_retr(0, sd);
WFIFOW(inter_fd,0) = 0x3020;
@@ -249,6 +283,8 @@ int intif_create_party(struct map_session_data *sd,char *name)
// パーティ情報要求
int intif_request_partyinfo(int party_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3021;
WFIFOL(inter_fd,2) = party_id;
WFIFOSET(inter_fd,6);
@@ -260,6 +296,8 @@ int intif_request_partyinfo(int party_id)
int intif_party_addmember(int party_id,int account_id)
{
struct map_session_data *sd;
+ if (CheckForCharServer())
+ return 0;
sd=map_id2sd(account_id);
// if(battle_config.etc_log)
// printf("intif: party add member %d %d\n",party_id,account_id);
@@ -277,6 +315,8 @@ int intif_party_addmember(int party_id,int account_id)
// パーティ設定変更
int intif_party_changeoption(int party_id,int account_id,int exp,int item)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3023;
WFIFOL(inter_fd,2)=party_id;
WFIFOL(inter_fd,6)=account_id;
@@ -288,6 +328,8 @@ int intif_party_changeoption(int party_id,int account_id,int exp,int item)
// パーティ脱退要求
int intif_party_leave(int party_id,int account_id)
{
+ if (CheckForCharServer())
+ return 0;
// if(battle_config.etc_log)
// printf("intif: party leave %d %d\n",party_id,account_id);
WFIFOW(inter_fd,0)=0x3024;
@@ -299,6 +341,8 @@ int intif_party_leave(int party_id,int account_id)
// パーティ移動要求
int intif_party_changemap(struct map_session_data *sd,int online)
{
+ if (CheckForCharServer())
+ return 0;
if(sd!=NULL){
WFIFOW(inter_fd,0)=0x3025;
WFIFOL(inter_fd,2)=sd->status.party_id;
@@ -315,6 +359,8 @@ int intif_party_changemap(struct map_session_data *sd,int online)
// パーティー解散要求
int intif_break_party(int party_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3026;
WFIFOL(inter_fd,2)=party_id;
WFIFOSET(inter_fd,6);
@@ -323,6 +369,8 @@ int intif_break_party(int party_id)
// パーティ会話送信
int intif_party_message(int party_id,int account_id,char *mes,int len)
{
+ if (CheckForCharServer())
+ return 0;
// if(battle_config.etc_log)
// printf("intif_party_message: %s\n",mes);
WFIFOW(inter_fd,0)=0x3027;
@@ -336,6 +384,8 @@ int intif_party_message(int party_id,int account_id,char *mes,int len)
// パーティ競合チェック要求
int intif_party_checkconflict(int party_id,int account_id,char *nick)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3028;
WFIFOL(inter_fd,2)=party_id;
WFIFOL(inter_fd,6)=account_id;
@@ -347,6 +397,8 @@ int intif_party_checkconflict(int party_id,int account_id,char *nick)
// ギルド作成要求
int intif_guild_create(const char *name,const struct guild_member *master)
{
+ if (CheckForCharServer())
+ return 0;
nullpo_retr(0, master);
WFIFOW(inter_fd,0)=0x3030;
@@ -360,6 +412,8 @@ int intif_guild_create(const char *name,const struct guild_member *master)
// ギルド情報要求
int intif_guild_request_info(int guild_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3031;
WFIFOL(inter_fd,2) = guild_id;
WFIFOSET(inter_fd,6);
@@ -368,6 +422,8 @@ int intif_guild_request_info(int guild_id)
// ギルドメンバ追加要求
int intif_guild_addmember(int guild_id,struct guild_member *m)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0) = 0x3032;
WFIFOW(inter_fd,2) = sizeof(struct guild_member)+8;
WFIFOL(inter_fd,4) = guild_id;
@@ -378,6 +434,8 @@ int intif_guild_addmember(int guild_id,struct guild_member *m)
// ギルドメンバ脱退/追放要求
int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const char *mes)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0) = 0x3034;
WFIFOL(inter_fd, 2) = guild_id;
WFIFOL(inter_fd, 6) = account_id;
@@ -391,6 +449,8 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha
int intif_guild_memberinfoshort(int guild_id,
int account_id,int char_id,int online,int lv,int class)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0) = 0x3035;
WFIFOL(inter_fd, 2) = guild_id;
WFIFOL(inter_fd, 6) = account_id;
@@ -404,6 +464,8 @@ int intif_guild_memberinfoshort(int guild_id,
// ギルド解散通知
int intif_guild_break(int guild_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0) = 0x3036;
WFIFOL(inter_fd, 2) = guild_id;
WFIFOSET(inter_fd,6);
@@ -412,6 +474,8 @@ int intif_guild_break(int guild_id)
// ギルド会話送信
int intif_guild_message(int guild_id,int account_id,char *mes,int len)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3037;
WFIFOW(inter_fd,2)=len+12;
WFIFOL(inter_fd,4)=guild_id;
@@ -423,6 +487,8 @@ int intif_guild_message(int guild_id,int account_id,char *mes,int len)
// ギルド競合チェック要求
int intif_guild_checkconflict(int guild_id,int account_id,int char_id)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0)=0x3038;
WFIFOL(inter_fd, 2)=guild_id;
WFIFOL(inter_fd, 6)=account_id;
@@ -433,6 +499,8 @@ int intif_guild_checkconflict(int guild_id,int account_id,int char_id)
// ギルド基本情報変更要求
int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3039;
WFIFOW(inter_fd,2)=len+10;
WFIFOL(inter_fd,4)=guild_id;
@@ -445,6 +513,8 @@ int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len)
int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id,
int type,const void *data,int len)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0)=0x303a;
WFIFOW(inter_fd, 2)=len+18;
WFIFOL(inter_fd, 4)=guild_id;
@@ -458,6 +528,8 @@ int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id,
// ギルド役職変更要求
int intif_guild_position(int guild_id,int idx,struct guild_position *p)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x303b;
WFIFOW(inter_fd,2)=sizeof(struct guild_position)+12;
WFIFOL(inter_fd,4)=guild_id;
@@ -469,6 +541,8 @@ int intif_guild_position(int guild_id,int idx,struct guild_position *p)
// ギルドスキルアップ要求
int intif_guild_skillup(int guild_id,int skill_num,int account_id,int flag)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0)=0x303c;
WFIFOL(inter_fd, 2)=guild_id;
WFIFOL(inter_fd, 6)=skill_num;
@@ -480,6 +554,8 @@ int intif_guild_skillup(int guild_id,int skill_num,int account_id,int flag)
// ギルド同盟/敵対要求
int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd, 0)=0x303d;
WFIFOL(inter_fd, 2)=guild_id1;
WFIFOL(inter_fd, 6)=guild_id2;
@@ -492,6 +568,8 @@ int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account
// ギルド告知変更要求
int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x303e;
WFIFOL(inter_fd,2)=guild_id;
memcpy(WFIFOP(inter_fd,6),mes1,60);
@@ -502,6 +580,8 @@ int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
// ギルドエンブレム変更要求
int intif_guild_emblem(int guild_id,int len,const char *data)
{
+ if (CheckForCharServer())
+ return 0;
if(guild_id<=0 || len<0 || len>2000)
return 0;
WFIFOW(inter_fd,0)=0x303f;
@@ -515,6 +595,8 @@ int intif_guild_emblem(int guild_id,int len,const char *data)
//現在のギルド城占領ギルドを調べる
int intif_guild_castle_dataload(int castle_id,int index)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3040;
WFIFOW(inter_fd,2)=castle_id;
WFIFOB(inter_fd,4)=index;
@@ -525,6 +607,8 @@ int intif_guild_castle_dataload(int castle_id,int index)
//ギルド城占領ギルド変更要求
int intif_guild_castle_datasave(int castle_id,int index, int value)
{
+ if (CheckForCharServer())
+ return 0;
WFIFOW(inter_fd,0)=0x3041;
WFIFOW(inter_fd,2)=castle_id;
WFIFOB(inter_fd,4)=index;