summaryrefslogtreecommitdiff
path: root/localserver/beta.patch2
blob: 4a310bbd6b67d9c57e738d18f5ba15a5ebe48620 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
diff --git a/src/map/npc.c b/src/map/npc.c
index 4b79a9fed..b4d125581 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2069,9 +2069,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 )
@@ -2108,6 +2105,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;
 }
 
@@ -2178,6 +2178,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;
 	}
@@ -2217,6 +2220,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;
 }
 
@@ -2462,7 +2468,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
@@ -2486,20 +2492,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);
@@ -2518,7 +2515,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)
@@ -2539,6 +2536,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 5211e2cd4..9880ed65b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16436,6 +16436,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 f06bb0330..1cd69ff18 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3552,7 +3552,7 @@ static void status_calc_regen(struct block_list *bl, struct status_data *st, str
 
 	regen->hp = cap_value(val, reg_flag, SHRT_MAX);
 
-	val = 1 + (st->int_/6) + (st->max_sp/100);
+	val = 1 + (st->int_/5) + (st->max_sp/100);
 	if( st->int_ >= 120 )
 		val += ((st->int_-120)>>1) + 4;
 
@@ -4468,17 +4468,23 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct
 		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.