Просмотр исходного кода

- Fixed SC_STRIPWEAPON failing on two-handed weapons.
- Minor changes.


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

skotlex 18 лет назад
Родитель
Сommit
e445c551c2
3 измененных файлов с 19 добавлено и 6 удалено
  1. 0 2
      Makefile
  2. 8 0
      src/map/script.c
  3. 11 4
      src/map/status.c

+ 0 - 2
Makefile

@@ -111,8 +111,6 @@ endif
 .PHONY: txt sql common login login_sql char char_sql map map_sql ladmin converters \
 	addons plugins tools webserver clean zlib depend
 
-all: txt
-
 txt : Makefile.cache conf common login char map ladmin
 
 ifdef SQLFLAG

+ 8 - 0
src/map/script.c

@@ -7204,6 +7204,14 @@ int buildin_getnpctimer(struct script_state *st)
 		nd=npc_name2id(conv_str(st,& (st->stack->stack_data[st->start+3])));
 	else
 		nd=(struct npc_data *)map_id2bl(st->oid);
+	
+	if (!nd || nd->bl.type != BL_NPC)
+	{
+		push_val(st->stack,C_INT,0);
+		if (battle_config.error_log)
+			ShowError("getnpctimer: Invalid NPC\n");
+		return 1;
+	}
 
 	switch(type){
 	case 0: val=npc_gettimerevent_tick(nd); break;

+ 11 - 4
src/map/status.c

@@ -4931,18 +4931,25 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 		case SC_STRIPWEAPON:
 			if (sd) {
 				int i;
+				opt_flag = 0; //Reuse to check success condition.
 				if(sd->unstripable_equip&EQP_WEAPON)
 					return 0;
 				i = sd->equip_index[EQI_HAND_L];
 				if (i>=0 && sd->inventory_data[i] &&
 					sd->inventory_data[i]->type == IT_WEAPON)
+				{
+					opt_flag|=1;
 					pc_unequipitem(sd,i,3); //L-hand weapon
+				}
 
 				i = sd->equip_index[EQI_HAND_R];
-				if (i<0 || !sd->inventory_data[i] ||
-					sd->inventory_data[i]->type != IT_WEAPON)
-					return 0;
-				pc_unequipitem(sd,i,3);
+				if (i>=0 && sd->inventory_data[i] &&
+					sd->inventory_data[i]->type == IT_WEAPON)
+				{
+					opt_flag|=2;
+					pc_unequipitem(sd,i,3);
+				}
+				if (!opt_flag) return 0;
 			} else //Watk reduction
 				val2 = 5*val1;
 			break;