Переглянути джерело

* Added bAddItemHealRate
* Fixed a crash if adding an offline player to a party
* Fixed a crash with Warp

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1169 54d463be-8e91-2dee-dedb-b68131a5f0ec

celest 20 роки тому
батько
коміт
d24746468b
8 змінених файлів з 79 додано та 40 видалено
  1. 4 0
      Changelog-SVN.txt
  2. 1 0
      db/const.txt
  3. 12 12
      db/skill_unit_db.txt
  4. 7 1
      doc/item_bonus.txt
  5. 3 1
      src/map/map.h
  6. 7 5
      src/map/party.c
  7. 33 13
      src/map/pc.c
  8. 12 8
      src/map/skill.c

+ 4 - 0
Changelog-SVN.txt

@@ -1,6 +1,10 @@
 Date	Added
 
 02/23
+        * Added bAddItemHealRate [celest]
+        * Fixed a crash if adding an offline player to a party, thanks to Alex14
+          [celest]
+        * Fixed a crash with Warp [celest]
 	* New Cards: Some fixes, revisions, additions [Lupus]
         * Fixed char server crash when sending wisp with a "'" in the names [celest]
         * Fixed Backstab not checking for and consuming arrows [celest]

+ 1 - 0
db/const.txt

@@ -249,6 +249,7 @@ bAddRace2	2024
 bHPGainValue	2025
 bSubSize	2026
 bDamageWhenUnequip	2027
+bAddItemHealRate	2028
 
 
 Eff_Stone	0

+ 12 - 12
db/skill_unit_db.txt

@@ -19,26 +19,26 @@
  18,0x7f,    , -1, 0,   1,enemy, 0x000	//MG_FIREWALL#ファイアーウォール
  21,0x86,    ,  0, 1,1000,enemy, 0x008	//MG_THUNDERSTORM#サンダーストーム
  25,0x85,    ,  1, 0,  -1,all,   0x003	//AL_PNEUMA#ニューマ
- 27,0x81,0x80,  0, 0,  -1,all,   0x002	//AL_WARP#ワープポータル
+ 27,0x81,0x80,  0, 0,  -1,all,   0x006	//AL_WARP#ワープポータル
  70,0x83,    , -1, 1,1000,all,   0x000	//PR_SANCTUARY#サンクチュアリ
  79,0x84,    , -1, 1,3000,enemy, 0x000	//PR_MAGNUS#マグヌスエクソシズム
  80,0x87,0x88,  0, 1,2000,enemy, 0x002	//WZ_FIREPILLAR#ファイアーピラー
  83,0x86,    ,  0, 3,1000,enemy, 0x000	//WZ_METEOR#メテオストーム
  85,0x86,    ,  0, 6,1000,enemy, 0x008	//WZ_VERMILION#ロードオブヴァーミリオン
- 87,0x8d,    , -1, 0,  -1,all,   0x000	//WZ_ICEWALL#アイスウォール
+ 87,0x8d,    , -1, 0,  -1,all,   0x004	//WZ_ICEWALL#アイスウォール
  88,0x86,    ,  0, 2,1000,enemy, 0x000	//WZ_FROSTNOVA#フロストノヴァ
  89,0x86,    ,  0, 5, 450,enemy, 0x000	//WZ_STORMGUST#ストームガスト
  91,0x86,    ,  0, 2,1000,enemy, 0x000	//WZ_HEAVENDRIVE#ヘヴンズドライブ
  92,0x8e,    ,  2, 0,  -1,enemy, 0x000	//WZ_QUAGMIRE#クァグマイア
-115,0x90,    ,  0, 1,1000,enemy, 0x002	//HT_SKIDTRAP#スキッドトラップ
-116,0x93,    ,  0, 1,1000,enemy, 0x002	//HT_LANDMINE#ランドマイン
-117,0x91,    ,  0, 1,1000,enemy, 0x002	//HT_ANKLESNARE#アンクルスネア
-118,0x94,    ,  0, 1,1000,enemy, 0x002	//HT_SHOCKWAVE#ショックウェーブトラップ
-119,0x95,    ,  0, 2,1000,enemy, 0x002	//HT_SANDMAN#サンドマン
-120,0x96,    ,  0, 1,1000,enemy, 0x002	//HT_FLASHER#フラッシャー
-121,0x97,    ,  0, 1,1000,enemy, 0x002	//HT_FREEZINGTRAP#フリージングトラップ
-122,0x8f,    ,  0, 1,1000,enemy, 0x002	//HT_BLASTMINE#ブラストマイン
-123,0x98,    ,  0, 2,1000,enemy, 0x002	//HT_CLAYMORETRAP#クレイモアトラップ
+115,0x90,    ,  0, 1,1000,enemy, 0x006	//HT_SKIDTRAP#スキッドトラップ
+116,0x93,    ,  0, 1,1000,enemy, 0x006	//HT_LANDMINE#ランドマイン
+117,0x91,    ,  0, 1,1000,enemy, 0x006	//HT_ANKLESNARE#アンクルスネア
+118,0x94,    ,  0, 1,1000,enemy, 0x006	//HT_SHOCKWAVE#ショックウェーブトラップ
+119,0x95,    ,  0, 2,1000,enemy, 0x006	//HT_SANDMAN#サンドマン
+120,0x96,    ,  0, 1,1000,enemy, 0x006	//HT_FLASHER#フラッシャー
+121,0x97,    ,  0, 1,1000,enemy, 0x006	//HT_FREEZINGTRAP#フリージングトラップ
+122,0x8f,    ,  0, 1,1000,enemy, 0x006	//HT_BLASTMINE#ブラストマイン
+123,0x98,    ,  0, 2,1000,enemy, 0x006	//HT_CLAYMORETRAP#クレイモアトラップ
 125,0x99,    ,  0, 1,1000,all,   0x002	//HT_TALKIEBOX#トーキーボックス
 140,0x92,    , -1, 0,1000,enemy, 0x000	//AS_VENOMDUST#ベナムダスト
 220,0xb0,    ,  0, 0,  -1,all,   0x002	//RG_GRAFFITI#グラフィティ
@@ -71,7 +71,7 @@
 362,0xb4,    ,  0, 3, 300,all,   0x000,0	//HP_BASILICA#バジリカ
 369,0xb3,    ,  3, 0,  -1,all,   0x000,0	//PA_GOSPEL#ゴスペル
 404,0xb6,    , -1, 0,  -1,all,   0x000,0	//PF_FOGWALL#フォグウォール
-405,0xb7,    ,  0, 1,1000,enemy, 0x002,0	//PF_SPIDERWEB#スパイダーウェッブ
+405,0xb7,    ,  0, 1,1000,enemy, 0x006,0	//PF_SPIDERWEB#スパイダーウェッブ
 10006,0xc1,  ,  0, 2,  -1,all,   0x000,0	//GD_LEADERSHIP
 10007,0xc2,  ,  0, 2,  -1,all,   0x000,0	//GD_GLORYWOUNDS
 10008,0xc3,  ,  0, 2,  -1,all,   0x000,0	//GD_SOULCOLD

+ 7 - 1
doc/item_bonus.txt

@@ -185,4 +185,10 @@ bonus3 bSPDrainValue,n,x,y;		When attacking there is a n% chance to either
 
 bonus4 bAutoSpellWhenHit,x,y,n,i;	n% chance to cast skill x of level y when
                                         being hit by physical close range damage
-                                        i:0=cast on self  1=cast on enemy
+                                        i:0=cast on self  1=cast on enemy
+
+//---- 2/22 new card effects ----
+
+bonus2 bAddItemHealRate,n,x;		Increases HP recovered by n type items by x%
+                                        n:1=potions 2=herbs 3=fruits 4=meat 5=candy
+                                          6=juice 7=sashimi

+ 3 - 1
src/map/map.h

@@ -293,6 +293,8 @@ struct map_session_data {
 	int addrace2[6],addrace2_[6];
 	int subsize[3];
 	short unequip_damage;
+	int itemid;
+	int itemhealrate[6];
 
 	short spiritball, spiritball_old;
 	int spirit_timer[MAX_SKILL_LEVEL];
@@ -640,7 +642,7 @@ enum {
 	SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017
 	SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020
 	SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025
-	SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP	// 2026
+	SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE	// 2026-2028
 };
 
 enum {

+ 7 - 5
src/map/party.c

@@ -250,11 +250,13 @@ int party_reply_invite(struct map_session_data *sd,int account_id,int flag)
 // パーティが追加された
 int party_member_added(int party_id,int account_id,int flag)
 {
-	struct map_session_data *sd= map_id2sd(account_id),*sd2;
-	if(sd==NULL && flag==0){
-		if(battle_config.error_log)
-			printf("party: member added error %d is not online\n",account_id);
-		intif_party_leave(party_id,account_id); // キャラ側に登録できなかったため脱退要求を出す
+	struct map_session_data *sd = map_id2sd(account_id),*sd2;
+	if(sd == NULL){
+		if (flag == 0) {
+			if(battle_config.error_log)
+				printf("party: member added error %d is not online\n",account_id);
+			intif_party_leave(party_id,account_id); // キャラ側に登録できなかったため脱退要求を出す
+		}
 		return 0;
 	}
 	sd2=map_id2sd(sd->party_invite_account);

+ 33 - 13
src/map/pc.c

@@ -1855,6 +1855,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
 		if(sd->state.lr_flag != 2)
 			sd->subsize[type2]+=val;
 		break;
+	case SP_ADD_ITEM_HEAL_RATE:
+		if(sd->state.lr_flag != 2)
+			sd->itemhealrate[type2 - 1] += val;
+		break;
 
 	default:
 		if(battle_config.error_log)
@@ -2421,17 +2425,18 @@ int pc_isUseitem(struct map_session_data *sd,int n)
  */
 int pc_useitem(struct map_session_data *sd,int n)
 {
-	int nameid,amount;
+	int amount;
 
 	nullpo_retr(1, sd);
 
 	if(n >=0 && n < MAX_INVENTORY) {
-		nameid = sd->status.inventory[n].nameid;
+		sd->itemid = sd->status.inventory[n].nameid;
 		amount = sd->status.inventory[n].amount;
 		if(sd->status.inventory[n].nameid <= 0 ||
 			sd->status.inventory[n].amount <= 0 ||
 			sd->sc_data[SC_BERSERK].timer!=-1 ||
 			sd->sc_data[SC_MARIONETTE].timer!=-1 ||
+			(pc_issit(sd) && (sd->itemid == 605 || sd->itemid == 606)) ||
 			//added item_noequip.txt items check by Maya&[Lupus]
 			(map[sd->bl.m].flag.pvp && (sd->inventory_data[n]->flag.no_equip&1) ) || // PVP
 			(map[sd->bl.m].flag.gvg && (sd->inventory_data[n]->flag.no_equip>1) ) || // GVG
@@ -2439,6 +2444,7 @@ int pc_useitem(struct map_session_data *sd,int n)
 			clif_useitemack(sd,n,0,0);
 			return 1;
 		}
+		
 		if(sd->inventory_data[n])
 			run_script(sd->inventory_data[n]->use_script,0,sd->bl.id,0);
 
@@ -2902,7 +2908,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt
 		status_change_end(&sd->bl, SC_HIDING, -1);
 	if(sd->status.option&4)
 		status_change_end(&sd->bl, SC_CLOAKING, -1);
-	if(sd->status.option&16386)
+	if(sd->status.option&16384)
 		status_change_end(&sd->bl, SC_CHASEWALK, -1);
 
 	if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) {
@@ -4588,7 +4594,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
 		status_change_end(&sd->bl, SC_HIDING, -1);
 	if(sd->status.option&4)
 		status_change_end(&sd->bl, SC_CLOAKING, -1);
-	if(sd->status.option&16386)
+	if(sd->status.option&16384)
 		status_change_end(&sd->bl, SC_CHASEWALK, -1);
 
 	if(sd->status.hp>0){
@@ -5124,7 +5130,7 @@ int pc_heal(struct map_session_data *sd,int hp,int sp)
  */
 int pc_itemheal(struct map_session_data *sd,int hp,int sp)
 {
-	int bonus;
+	int bonus, type = 0;
 //	if(battle_config.battle_log)
 //		printf("heal %d %d\n",hp,sp);
 
@@ -5147,19 +5153,33 @@ int pc_itemheal(struct map_session_data *sd,int hp,int sp)
 		if(sp > 0)
 			sp = 0;
 	}
+
+	if (sd->itemid >= 501 && sd->itemid <= 505)
+		type = 1;	// potions
+	else if (sd->itemid >= 507 && sd->itemid <= 510)
+		type = 2;	// herbs
+	else if (sd->itemid >= 512 && sd->itemid <= 516)
+		type = 3;	// fruits
+	else if (sd->itemid == 517 || sd->itemid == 528)
+		type = 4;	// meat
+	else if (sd->itemid == 529 || sd->itemid == 530)
+		type = 5;	// candy
+	else if (sd->itemid >= 531 && sd->itemid <= 534)
+		type = 6;	// juice
+	else if (sd->itemid == 544 || sd->itemid == 551)
+		type = 7;	// sashimi
+
 	if(hp > 0) {
-		bonus = (sd->paramc[2]<<1) + 100 + pc_checkskill(sd,SM_RECOVERY)*10;
-		if(bonus != 100)
-			hp = hp * bonus / 100;
-		bonus = 100 + pc_checkskill(sd,AM_LEARNINGPOTION)*5;
+		bonus = (sd->paramc[2]<<1) + 100 + pc_checkskill(sd,SM_RECOVERY)*10
+			+ pc_checkskill(sd,AM_LEARNINGPOTION)*5;
+		if (type > 0)
+			bonus += sd->itemhealrate[type - 1];
 		if(bonus != 100)
 			hp = hp * bonus / 100;
 	}
 	if(sp > 0) {
-		bonus = (sd->paramc[3]<<1) + 100 + pc_checkskill(sd,MG_SRECOVERY)*10;
-		if(bonus != 100)
-			sp = sp * bonus / 100;
-		bonus = 100 + pc_checkskill(sd,AM_LEARNINGPOTION)*5;
+		bonus = (sd->paramc[3]<<1) + 100 + pc_checkskill(sd,MG_SRECOVERY)*10
+			+ pc_checkskill(sd,AM_LEARNINGPOTION)*5;
 		if(bonus != 100)
 			sp = sp * bonus / 100;
 	}

+ 12 - 8
src/map/skill.c

@@ -5030,6 +5030,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
 	int target,interval,range,unit_flag;
 	struct skill_unit_layout *layout;
 	struct status_change *sc_data;
+	int active_flag=1;
 
 	nullpo_retr(0, src);
 
@@ -5060,6 +5061,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
 		val1=skilllv+6;
 		if(flag==0)
 			limit=2000;
+		active_flag=0;
 		break;
 
 	case PR_SANCTUARY:			/* サンクチュアリ */
@@ -5264,7 +5266,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
 					break;
 				}
 			}
-			if (range==0)
+			if (range==0 && active_flag)
 				map_foreachinarea(skill_unit_effect,unit->bl.m
 					,unit->bl.x,unit->bl.y,unit->bl.x,unit->bl.y
 					,0,&unit->bl,gettick(),1);
@@ -8059,19 +8061,22 @@ int skill_encchant_eremental_end(struct block_list *bl,int type)
 /* クロ?キング?査(周りに移動不可能地?があるか) */
 int skill_check_cloaking(struct block_list *bl)
 {
+	struct map_session_data *sd = NULL;
 	static int dx[]={ 0, 1, 0, -1, -1,  1, 1, -1}; //optimized by Lupus
 	static int dy[]={-1, 0, 1,  0, -1, -1, 1,  1};
 	int end=1,i;
 
-	//missing sd [Found by Celest, commited by Aria]
-	struct map_session_data *sd=(struct map_session_data *)bl;
-
 	nullpo_retr(0, bl);
 
 	if(bl->type == BL_PC && !battle_config.pc_cloak_check_type) // If it's No it shouldn't be checked
 		return 0;
 	else if(bl->type == BL_MOB && !battle_config.monster_cloak_check_type)
 		return 0;
+
+	//missing sd [Found by Celest, commited by Aria]
+	if (bl->type == BL_PC)
+		sd=(struct map_session_data *)bl;
+
 	for(i=0;i<sizeof(dx)/sizeof(dx[0]);i++){
 		if(map_getcell(bl->m,bl->x+dx[i],bl->y+dy[i],CELL_CHKNOPASS)) {
 			end=0;
@@ -8079,17 +8084,16 @@ int skill_check_cloaking(struct block_list *bl)
 		}
 	}
 	if(end){
-		if ((bl->type == BL_PC && pc_checkskill(sd,AS_CLOAKING)<3) || bl->type == BL_MOB) {
+		if ((sd && pc_checkskill(sd,AS_CLOAKING)<3) || bl->type == BL_MOB) {
 			status_change_end(bl, SC_CLOAKING, -1);
-			*status_get_option(bl)&=~4;	/* 念のための?理 */
 		}
-		else if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 130) {
+		else if (sd && sd->sc_data[SC_CLOAKING].val3 != 130) {
 			sd->sc_data[SC_CLOAKING].val3 = 130;
 			status_calc_speed (sd);
 		}
 	}
 	else {
-		if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 103) {
+		if (sd && sd->sc_data[SC_CLOAKING].val3 != 103) {
 			sd->sc_data[SC_CLOAKING].val3 = 103;
 			status_calc_speed (sd);
 		}