summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 09:03:06 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-17 09:03:06 +0000
commit26ab8da349bfd32e8bcd632f94bd33beff9fc4a9 (patch)
treeeef9d05343a344364346b9e6ad49008947a5577f /src
parent19387aa1fc17e1f37d99fe49268c826e93def73c (diff)
downloadhercules-26ab8da349bfd32e8bcd632f94bd33beff9fc4a9.tar.gz
hercules-26ab8da349bfd32e8bcd632f94bd33beff9fc4a9.tar.bz2
hercules-26ab8da349bfd32e8bcd632f94bd33beff9fc4a9.tar.xz
hercules-26ab8da349bfd32e8bcd632f94bd33beff9fc4a9.zip
* Fixed more typos in /cities/payon.txt
* Added 2 char-server packets to support Freya's login server * Rewrite on Full Strip git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1243 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c87
-rw-r--r--src/char_sql/char.c87
-rw-r--r--src/map/skill.c58
3 files changed, 220 insertions, 12 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 9457ce89f..1a2b61389 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1703,6 +1703,35 @@ int parse_tologin(int fd) {
RFIFOSKIP(fd,2);
break;
+ // Receiving authentification from Freya-type login server (to avoid char->login->char)
+ case 0x2719:
+ if (RFIFOREST(fd) < 18)
+ return 0;
+ // to conserv a maximum of authentification, search if account is already authentified and replace it
+ // that will reduce multiple connection too
+ for(i = 0; i < AUTH_FIFO_SIZE; i++)
+ if (auth_fifo[i].account_id == RFIFOL(fd,2))
+ break;
+ // if not found, use next value
+ if (i == AUTH_FIFO_SIZE) {
+ if (auth_fifo_pos >= AUTH_FIFO_SIZE)
+ auth_fifo_pos = 0;
+ i = auth_fifo_pos;
+ auth_fifo_pos++;
+ }
+ //printf("auth_fifo set (auth #%d) - account: %d, secure: %08x-%08x\n", i, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10));
+ auth_fifo[i].account_id = RFIFOL(fd,2);
+ auth_fifo[i].char_id = 0;
+ auth_fifo[i].login_id1 = RFIFOL(fd,6);
+ auth_fifo[i].login_id2 = RFIFOL(fd,10);
+ auth_fifo[i].delflag = 2; // 0: auth_fifo canceled/void, 2: auth_fifo received from login/map server in memory, 1: connection authentified
+ auth_fifo[i].char_pos = 0;
+ auth_fifo[i].connect_until_time = 0; // unlimited/unknown time by default (not display in map-server)
+ auth_fifo[i].ip = RFIFOL(fd,14);
+ //auth_fifo[i].map_auth = 0;
+ RFIFOSKIP(fd,18);
+ break;
+
case 0x2721: // gm reply
if (RFIFOREST(fd) < 10)
return 0;
@@ -1965,6 +1994,64 @@ int parse_tologin(int fd) {
RFIFOSKIP(fd,RFIFOW(fd,2));
break;
+ // Receive GM accounts [Freya login server packet by Yor]
+ case 0x2733:
+ // add test here to remember that the login-server is Freya-type
+ // sprintf (login_server_type, "Freya");
+ if (RFIFOREST(fd) < 7)
+ return 0;
+ {
+ unsigned char buf[32000];
+ int new_level = 0;
+ for(i = 0; i < GM_num; i++)
+ if (gm_account[i].account_id == RFIFOL(fd,2)) {
+ if (gm_account[i].level != (int)RFIFOB(fd,6)) {
+ gm_account[i].level = (int)RFIFOB(fd,6);
+ new_level = 1;
+ }
+ break;
+ }
+ // if not found, add it
+ if (i == GM_num) {
+ // limited to 4000, because we send information to char-servers (more than 4000 GM accounts???)
+ // int (id) + int (level) = 8 bytes * 4000 = 32k (limit of packets in windows)
+ if (((int)RFIFOB(fd,6)) > 0 && GM_num < 4000) {
+ if (GM_num == 0) {
+ gm_account = (struct gm_account*)aMalloc(sizeof(struct gm_account));
+ } else {
+ gm_account = (struct gm_account*)aRealloc(gm_account, sizeof(struct gm_account) * (GM_num + 1));
+ }
+ gm_account[GM_num].account_id = RFIFOL(fd,2);
+ gm_account[GM_num].level = (int)RFIFOB(fd,6);
+ new_level = 1;
+ GM_num++;
+ if (GM_num >= 4000) {
+ printf("***WARNING: 4000 GM accounts found. Next GM accounts are not readed.\n");
+ char_log("***WARNING: 4000 GM accounts found. Next GM accounts are not readed." RETCODE);
+ }
+ }
+ }
+ if (new_level == 1) {
+ int len;
+ printf("From login-server: receiving a GM account information (%d: level %d).\n", RFIFOL(fd,2), (int)RFIFOB(fd,6));
+ char_log("From login-server: receiving a GM account information (%d: level %d)." RETCODE, RFIFOL(fd,2), (int)RFIFOB(fd,6));
+ //create_online_files(); // not change online file for only 1 player (in next timer, that will be done
+ // send gm acccounts level to map-servers
+ len = 4;
+ WBUFW(buf,0) = 0x2b15;
+
+ for(i = 0; i < GM_num; i++) {
+ WBUFL(buf, len) = gm_account[i].account_id;
+ WBUFB(buf, len+4) = (unsigned char)gm_account[i].level;
+ len += 5;
+ }
+ WBUFW(buf, 2) = len;
+ mapif_sendall(buf, len);
+ }
+ }
+ RFIFOSKIP(fd,7);
+ break;
+
default:
printf("parse_tologin: unknown packet %x! \n", RFIFOW(fd,0));
session[fd]->eof = 1;
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index b920e8eb3..a56aedf3c 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1555,6 +1555,35 @@ int parse_tologin(int fd) {
RFIFOSKIP(fd,2);
break;
+ // Receiving authentification from Freya-type login server (to avoid char->login->char)
+ case 0x2719:
+ if (RFIFOREST(fd) < 18)
+ return 0;
+ // to conserv a maximum of authentification, search if account is already authentified and replace it
+ // that will reduce multiple connection too
+ for(i = 0; i < AUTH_FIFO_SIZE; i++)
+ if (auth_fifo[i].account_id == RFIFOL(fd,2))
+ break;
+ // if not found, use next value
+ if (i == AUTH_FIFO_SIZE) {
+ if (auth_fifo_pos >= AUTH_FIFO_SIZE)
+ auth_fifo_pos = 0;
+ i = auth_fifo_pos;
+ auth_fifo_pos++;
+ }
+ //printf("auth_fifo set (auth #%d) - account: %d, secure: %08x-%08x\n", i, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10));
+ auth_fifo[i].account_id = RFIFOL(fd,2);
+ auth_fifo[i].char_id = 0;
+ auth_fifo[i].login_id1 = RFIFOL(fd,6);
+ auth_fifo[i].login_id2 = RFIFOL(fd,10);
+ auth_fifo[i].delflag = 2; // 0: auth_fifo canceled/void, 2: auth_fifo received from login/map server in memory, 1: connection authentified
+ auth_fifo[i].char_pos = 0;
+ auth_fifo[i].connect_until_time = 0; // unlimited/unknown time by default (not display in map-server)
+ auth_fifo[i].ip = RFIFOL(fd,14);
+ //auth_fifo[i].map_auth = 0;
+ RFIFOSKIP(fd,18);
+ break;
+
/* case 0x2721: // gm reply. I don't want to support this function.
printf("0x2721:GM reply\n");
{
@@ -1707,6 +1736,64 @@ int parse_tologin(int fd) {
RFIFOSKIP(fd,11);
break;
+ // Receive GM accounts [Freya login server packet by Yor]
+ case 0x2733:
+ // add test here to remember that the login-server is Freya-type
+ // sprintf (login_server_type, "Freya");
+ if (RFIFOREST(fd) < 7)
+ return 0;
+ {
+ unsigned char buf[32000];
+ int new_level = 0;
+ for(i = 0; i < GM_num; i++)
+ if (gm_account[i].account_id == RFIFOL(fd,2)) {
+ if (gm_account[i].level != (int)RFIFOB(fd,6)) {
+ gm_account[i].level = (int)RFIFOB(fd,6);
+ new_level = 1;
+ }
+ break;
+ }
+ // if not found, add it
+ if (i == GM_num) {
+ // limited to 4000, because we send information to char-servers (more than 4000 GM accounts???)
+ // int (id) + int (level) = 8 bytes * 4000 = 32k (limit of packets in windows)
+ if (((int)RFIFOB(fd,6)) > 0 && GM_num < 4000) {
+ if (GM_num == 0) {
+ gm_account = (struct gm_account*)aMalloc(sizeof(struct gm_account));
+ } else {
+ gm_account = (struct gm_account*)aRealloc(gm_account, sizeof(struct gm_account) * (GM_num + 1));
+ }
+ gm_account[GM_num].account_id = RFIFOL(fd,2);
+ gm_account[GM_num].level = (int)RFIFOB(fd,6);
+ new_level = 1;
+ GM_num++;
+ if (GM_num >= 4000) {
+ printf("***WARNING: 4000 GM accounts found. Next GM accounts are not readed.\n");
+ char_log("***WARNING: 4000 GM accounts found. Next GM accounts are not readed." RETCODE);
+ }
+ }
+ }
+ if (new_level == 1) {
+ int len;
+ printf("From login-server: receiving a GM account information (%d: level %d).\n", RFIFOL(fd,2), (int)RFIFOB(fd,6));
+ char_log("From login-server: receiving a GM account information (%d: level %d)." RETCODE, RFIFOL(fd,2), (int)RFIFOB(fd,6));
+ //create_online_files(); // not change online file for only 1 player (in next timer, that will be done
+ // send gm acccounts level to map-servers
+ len = 4;
+ WBUFW(buf,0) = 0x2b15;
+
+ for(i = 0; i < GM_num; i++) {
+ WBUFL(buf, len) = gm_account[i].account_id;
+ WBUFB(buf, len+4) = (unsigned char)gm_account[i].level;
+ len += 5;
+ }
+ WBUFW(buf, 2) = len;
+ mapif_sendall(buf, len);
+ }
+ }
+ RFIFOSKIP(fd,7);
+ break;
+
default:
printf("set eof.\n");
session[fd]->eof = 1;
diff --git a/src/map/skill.c b/src/map/skill.c
index f75ffdd6a..5310618b3 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1247,7 +1247,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
return 0;
if(src->type == BL_PC && pc_isdead((struct map_session_data *)src)) //術者?がPCですでに死んでいたら何もしない
return 0;
- if(dsrc->type == BL_PC && pc_isdead((struct map_session_data *)dsrc)) //術者?がPCですでに死んでいたら何もしない
+ if(src != dsrc && dsrc->type == BL_PC && pc_isdead((struct map_session_data *)dsrc)) //術者?がPCですでに死んでいたら何もしない
return 0;
if(bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)) //?象がPCですでに死んでいたら何もしない
return 0;
@@ -2751,7 +2751,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
struct mob_data *md=NULL;
struct mob_data *dstmd=NULL;
int i,abra_skillid=0,abra_skilllv;
- int sc_def_vit,sc_def_mdef,strip_time,strip_per;
+ int sc_def_vit,sc_def_mdef;
int sc_dex,sc_luk;
//クラスチェンジ用ボスモンスタ?ID
int changeclass[]={1038,1039,1046,1059,1086,1087,1112,1115
@@ -3777,10 +3777,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
case RG_STRIPSHIELD: /* ストリップシールド */
case RG_STRIPARMOR: /* ストリップアーマー */
case RG_STRIPHELM: /* ストリップヘルム */
- case ST_FULLSTRIP: // Celest
{
- struct status_change *tsc_data = status_get_sc_data(bl);
- int scid, cp_scid = 0, equip, strip_fix, strip_num = 0;
+ struct status_change *tsc_data;
+ int strip_time, strip_per, strip_fix;
+ int scid, cp_scid = 0, equip;
+
+ tsc_data = status_get_sc_data(bl);
scid = SkillStatusChangeTable[skillid];
switch (skillid) {
case RG_STRIPWEAPON:
@@ -3799,17 +3801,13 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
equip = EQP_HELM;
cp_scid = SC_CP_HELM;
break;
- case ST_FULLSTRIP:
- equip = EQP_WEAPON | EQP_SHIELD | EQP_ARMOR | EQP_HELM;
- strip_num = 3;
- break;
default:
map_freeblock_unlock();
return 1;
}
if (tsc_data && (tsc_data[scid].timer != -1 || tsc_data[cp_scid].timer != -1))
- break;
+ break;
if (dstsd && dstsd->unstripable_equip & equip)
break;
@@ -3824,8 +3822,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
for (i=0;i<MAX_INVENTORY;i++) {
if (dstsd->status.inventory[i].equip && (dstsd->status.inventory[i].equip & equip)){
pc_unequipitem(dstsd,i,3);
- if ((--strip_num) <= 0)
- break;
+ break;
}
}
if (i == MAX_INVENTORY)
@@ -3836,6 +3833,43 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
status_change_start(bl,scid,skilllv,0,0,0,strip_time,0 );
break;
}
+ case ST_FULLSTRIP: // Celest
+ {
+ struct status_change *tsc_data;
+ int i, j, strip_time, strip_per, strip_fix;
+ int equip[4] = { EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM };
+ int scid[4] = { SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM };
+ int cp_scid[4] = { SC_CP_WEAPON, SC_CP_SHIELD, SC_CP_ARMOR, SC_CP_HELM };
+
+ tsc_data = status_get_sc_data(bl);
+ strip_fix = status_get_dex(src) - status_get_dex(bl);
+ if(strip_fix < 0)
+ strip_fix = 0;
+ strip_per = 5+2*skilllv+strip_fix/5;
+ if (rand()%100 >= strip_per)
+ break;
+ strip_time = skill_get_time(skillid,skilllv)+strip_fix/2;
+
+ for (i=0; i<4; i++) {
+ if (dstsd) {
+ if (tsc_data && (tsc_data[scid[i]].timer != -1 || tsc_data[cp_scid[i]].timer != -1))
+ continue;
+ if (dstsd->unstripable_equip & equip[i])
+ continue;
+ for (j=0; j<MAX_INVENTORY; j++) {
+ if (dstsd->status.inventory[j].equip && (dstsd->status.inventory[j].equip & equip[i])){
+ pc_unequipitem(dstsd,j,3);
+ break;
+ }
+ }
+ if (j == MAX_INVENTORY)
+ continue;
+ }
+ status_change_start(bl,scid[i],skilllv,0,0,0,strip_time,0 );
+ }
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ break;
+ }
/* PotionPitcher */
case AM_POTIONPITCHER: /* ポ?ションピッチャ? */