summaryrefslogblamecommitdiff
path: root/.tools/beta.patch2
blob: 80ee2077ba6c39a60cd6c0d262ba16651ef48706 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
                                                
                                 

                      








                                                                                                   















































































































                                                                                                            


















                                                          
                                                
                                 

                      
                                              







                                                                                            
                                                
                                 

                      
                                                                                                        
























                                                                               
diff --git a/src/map/battle.c b/src/map/battle.c
index 37fc03bca..155d8cdd2 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -372,7 +372,7 @@ static int64 battle_attr_fix(struct block_list *src, struct block_list *target,
 		return damage;
 	}
 
-	ratio = battle->attr_fix_table[def_lv-1][atk_elem][def_type];
+	ratio = battle->attr_fix_table[def_lv-1][def_type][atk_elem];
 	if (sc && sc->count) {
 		if(sc->data[SC_VOLCANO] && atk_elem == ELE_FIRE)
 			ratio += skill->enchant_eff[sc->data[SC_VOLCANO]->val1-1];
@@ -4664,7 +4664,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 		skill_id == SN_SHARPSHOOTING || skill_id == MA_SHARPSHOOTING ||
 		skill_id == NJ_KIRIKAGE))
 	{
-		short cri = sstatus->cri;
+		int cri = sstatus->cri;
 		if (sd != NULL) {
 			// if show_katar_crit_bonus is enabled, it already done the calculation in status.c
 			if (!battle_config.show_katar_crit_bonus && sd->weapontype == W_KATAR) {
@@ -4684,7 +4684,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 		//Therefore, we use the old value 3 on cases when an sd gets attacked by a mob
 		cri -= tstatus->luk*(!sd&&tsd?3:2);
 #else
-		cri -= status->get_lv(target) / 15 + 2 * status_get_luk(target);
+		cri -= status->get_lv(target) / 5 + (3 * status_get_luk(target))/2;
 #endif
 
 		if( tsc && tsc->data[SC_SLEEP] ) {
diff --git a/src/map/npc.c b/src/map/npc.c
index fea82c873..84d292415 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2070,9 +2070,6 @@ static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list)
 		w += itemdb_weight(entry->id) * entry->amount;
 	}
 
-	if (nd->master_nd != NULL) //Script-based shops.
-		return npc->buylist_sub(sd, item_list, nd->master_nd);
-
 	if (z > sd->status.zeny)
 		return 1; // Not enough Zeny
 	if( w + sd->weight > sd->max_weight )
@@ -2109,6 +2106,9 @@ static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list)
 		}
 	}
 
+	if (nd->master_nd != NULL) // TMW2 Script-based shops.
+		return npc->buylist_sub(sd, item_list, nd->master_nd);
+
 	return 0;
 }
 
@@ -2179,6 +2179,9 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
 				return 1;
 		}
 
+        // Apply player discout cupon (TMW2 Custom)
+		value = pc->modifybuyvalue(sd,value);
+
 		z += (int64)value * entry->amount;
 		w += itemdb_weight(entry->id) * entry->amount;
 	}
@@ -2218,6 +2221,9 @@ static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item
 		}
 	}
 
+	if (nd->master_nd != NULL) // TMW2 Script-based shops.
+		return npc->buylist_sub(sd, item_list, nd->master_nd);
+
 	return 0;
 }
 
@@ -2463,7 +2469,7 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
 
 	z = 0;
 
-	if (sd->status.zeny >= MAX_ZENY && nd->master_nd == NULL)
+	if (sd->status.zeny >= MAX_ZENY)
 		return 1;
 
 	// verify the sell list
@@ -2487,20 +2493,11 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
 			return 1;
 		}
 
-		if (nd->master_nd) {
-			// Script-controlled shops decide by themselves, what can be sold and at what price.
-			continue;
-		}
-
 		value = pc->modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
 
 		z += (int64)value * entry->amount;
 	}
 
-	if( nd->master_nd ) { // Script-controlled shops
-		return npc->selllist_sub(sd, item_list, nd->master_nd);
-	}
-
 	// delete items
 	for (i = 0; i < VECTOR_LENGTH(*item_list); i++) {
 		struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
@@ -2519,7 +2516,7 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
 
 	}
 
-	if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL)
+	if (z + sd->status.zeny > MAX_ZENY)
 		return 1;
 
 	if (z > MAX_ZENY)
@@ -2540,6 +2537,10 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
 		}
 	}
 
+	if( nd->master_nd ) { // Script-controlled shops
+		return npc->selllist_sub(sd, item_list, nd->master_nd);
+	}
+
 	return 0;
 }
 
diff --git a/src/map/rodex.c b/src/map/rodex.c
index 766fdc5ea..996576fd3 100644
--- a/src/map/rodex.c
+++ b/src/map/rodex.c
@@ -34,11 +34,11 @@
 
 // NOTE : These values are hardcoded into the client
 // Cost of each Attached Item
-#define ATTACHITEM_COST 2500
+#define ATTACHITEM_COST 500
 // Percent of Attached Zeny that will be paid as Tax
-#define ATTACHZENY_TAX 2
+#define ATTACHZENY_TAX 0
 // Maximun number of messages that can be sent in one day
-#define DAILY_MAX_MAILS 100
+#define DAILY_MAX_MAILS 3
 
 static struct rodex_interface rodex_s;
 struct rodex_interface *rodex;
diff --git a/src/map/script.c b/src/map/script.c
index f515d4403..3747abd6e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16552,6 +16552,8 @@ static BUILDIN(summon)
 		clif->specialeffect(&md->bl,344,AREA);
 		sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
 	}
+	//mob_id = mob->once_spawn(sd, m, x, y, str, class_, amount, event, size, ai);
+	script_pushint(st, (md) ? md->bl.id : 0);
 	return true;
 }
 
diff --git a/src/map/status.c b/src/map/status.c
index 63e71c9dc..b0fb430f7 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4469,17 +4469,23 @@ static int status_base_atk(const struct block_list *bl, const struct status_data
 		case W_SHOTGUN:
 		case W_GRENADE:
 			flag = 1;
+			break;
+		case W_STAFF:
+			flag = 2;
 		}
 	}
-	if ( flag ) {
+	if ( flag == 1 ) {
 		str = st->dex;
 		dex = st->str;
+	} else if ( flag == 2 ) {
+		str = st->int_;
+		dex = st->dex;
 	} else {
 		str = st->str;
 		dex = st->dex;
 	}
 #ifdef RENEWAL
-		dstr = str;
+		dstr = str*15/10;
 #endif
 	//Normally only players have base-atk, but homunc have a different batk
 	// equation, hinting that perhaps non-players should use this for batk.