Преглед изворни кода

1 fixed drops log
2 made possible to disable consumable items (potions, berries, etc) during GvG, PvP

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

(no author) пре 20 година
родитељ
комит
1822bfc343
4 измењених фајлова са 29 додато и 22 уклоњено
  1. 3 0
      SVN-Changelog.txt
  2. 5 2
      db/item_noequip.txt
  3. 14 16
      src/map/mob.c
  4. 7 4
      src/map/pc.c

+ 3 - 0
SVN-Changelog.txt

@@ -1,6 +1,9 @@
 Date	Added
 
 02/11
+        * mob.c fixed doubling entries in DROPS LOG, optimized [Lupus]
+        * item_noequip.txt now you can disable named consumable items
+	  during GvG / PvP, too by Maya, optimized and checked [Lupus]
 	NOTE: Get rid of old cards on your server!!! IDs: 4149-4332
 	  before using of this item_db.txt (some cards have changed their IDs)
 	  and it could cause ALIEN cards in your players equipment 8))

+ 5 - 2
db/item_noequip.txt

@@ -1,4 +1,7 @@
-// The equipment restriction file 
+// The equipment/items restriction file 
 // here equipment at PvP and GvG 
-// where it is possible to restrict, the prescribed form: < ItemID> < Mode> 
+// where it is possible to restrict, the prescribed form: <item id>,<mode>
 // mode = 1- So with PvP restriction, 2- GvG restriction, 3- PvP and GvG which restriction 
+
+//1201,1 you can't use KNIFE(ID 1201) on PvP
+//608,3 you can't use Yggdrasil Seed(ID 608) on both PvP & GvG

+ 14 - 16
src/map/mob.c

@@ -2532,6 +2532,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 	// item drop
 	if(!(type&1)) {
 		int log_item[8] = {0};
+		int drop_ore = -1,drop_items=0; //slot N for DROP LOG, number of dropped items
 		for(i=0;i<8;i++){
 			struct delay_item_drop *ditem;
 			int drop_rate;
@@ -2547,8 +2548,11 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 				drop_rate = 1;
 			if(battle_config.drops_by_luk>0 && sd && md) drop_rate+=(sd->status.luk*battle_config.drops_by_luk)/100;	// drops affected by luk [Valaris]
 			if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class_].lv - sd->status.base_level >= 20)) drop_rate*=1.25; // pk_mode increase drops if 20 level difference [Valaris]
-			if(drop_rate <= rand()%10000)
+			if(drop_rate <= rand()%10000) {
+				drop_ore = i; //we rmember an empty slot to put there ORE DISCOVERY drop later.
 				continue;
+			}
+			drop_items++;
 
 			ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop));
 			ditem->nameid = mob_db[md->class_].dropitem[i].nameid;
@@ -2563,18 +2567,14 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 			add_timer(tick+500+i,mob_delay_item_drop,(int)ditem,0);
 		}
 
-		#ifndef TXT_ONLY
-		if(log_config.drop > 0)
-			log_drop(mvp_sd, md->class_, log_item);
-		#endif
-
 		// Ore Discovery [Celest]
 		if (pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) {
 			struct delay_item_drop *ditem;
 			int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 };
 			ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop));
-			ditem->nameid = itemid[rand()%17];
-			// log_item[i] = ditem->nameid;
+			ditem->nameid = itemid[rand()%17]; //should return from 0 to 16
+			if (drop_ore<0) i=7; //we have only 8 slots in LOG, there's a check to not overflow
+			log_item[i] = ditem->nameid; //it's for logging only
 			ditem->amount = 1;
 			ditem->m = md->bl.m;
 			ditem->x = md->bl.x;
@@ -2585,10 +2585,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 			add_timer(tick+500+i,mob_delay_item_drop,(int)ditem,0);
 		}
 
-		#ifndef TXT_ONLY
-		if(log_config.drop > 0)
-			log_drop(mvp_sd, md->class_, log_item);
-		#endif
+		//this drop log contains ALL dropped items + ORE (if there was ORE Recovery) [Lupus]
+		if(log_config.drop > 0 && drop_items) //we check were there any drops.. and if not - don't write the log
+			log_drop(sd, md->class_, log_item); //mvp_sd
 
 		if(sd && sd->state.attack_type == BF_WEAPON) {
 			for(i=0;i<sd->monster_drop_item_count;i++) {
@@ -2672,10 +2671,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 			}
 			break;
 		}
-		#ifndef TXT_ONLY
-			if(log_config.mvpdrop > 0)
-				log_mvpdrop(mvp_sd, md->class_, log_mvp);
-		#endif
+
+		if(log_config.mvpdrop > 0)
+			log_mvpdrop(mvp_sd, md->class_, log_mvp);
 	}
 
         } // [MouseJstr]

+ 7 - 4
src/map/pc.c

@@ -560,9 +560,9 @@ int pc_isequip(struct map_session_data *sd,int n)
 		return 0;
 //	if(((1<<sd->status.class_)&item->class_) == 0)
 //		return 0;
-	if(map[sd->bl.m].flag.pvp && (item->flag.no_equip==1 || item->flag.no_equip==3))
+	if(map[sd->bl.m].flag.pvp && (item->flag.no_equip&1)) //optimized by Lupus
 		return 0;
-	if(map[sd->bl.m].flag.gvg && (item->flag.no_equip==2 || item->flag.no_equip==3))
+	if(map[sd->bl.m].flag.gvg && (item->flag.no_equip>1)) //optimized by Lupus
 		return 0;
 	if(item->equip & 0x0002 && sc_data && sc_data[SC_STRIPWEAPON].timer != -1)
 		return 0;
@@ -2295,6 +2295,9 @@ int pc_useitem(struct map_session_data *sd,int n)
 			sd->status.inventory[n].amount <= 0 ||
 			sd->sc_data[SC_BERSERK].timer!=-1 ||
 			sd->sc_data[SC_MARIONETTE].timer!=-1 ||
+			//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
 			!pc_isUseitem(sd,n) ) {
 			clif_useitemack(sd,n,0,0);
 			return 1;
@@ -6028,10 +6031,10 @@ int pc_checkitem(struct map_session_data *sd)
 			calc_flag = 1;
 		}
 		//?備制限チェック
-		if(sd->status.inventory[i].equip && map[sd->bl.m].flag.pvp && (it->flag.no_equip==1 || it->flag.no_equip==3)){//PvP制限
+		if(sd->status.inventory[i].equip && map[sd->bl.m].flag.pvp && (it->flag.no_equip&1)){//PVP check for forbiden items. optimized by [Lupus]
 			sd->status.inventory[i].equip=0;
 			calc_flag = 1;
-		}else if(sd->status.inventory[i].equip && map[sd->bl.m].flag.gvg && (it->flag.no_equip==2 || it->flag.no_equip==3)){//GvG制限
+		}else if(sd->status.inventory[i].equip && map[sd->bl.m].flag.gvg && (it->flag.no_equip>1)){//GvG optimized by [Lupus]
 			sd->status.inventory[i].equip=0;
 			calc_flag = 1;
 		}