|
@@ -4393,28 +4393,17 @@ char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type
|
|
|
/**
|
|
|
* Attempts to remove Cash Points from player
|
|
|
* @param sd: Player
|
|
|
- * @param price: Points player has to pay
|
|
|
- * @param points: Points player has
|
|
|
+ * @param price: Total points (cash + kafra) the player has to pay
|
|
|
+ * @param points: Kafra points the player has to pay
|
|
|
* @param type: Log type
|
|
|
- * @return -2: Paying negative points, -1: Not enough points, otherwise success (cash+points)
|
|
|
+ * @return -1: Not enough points, otherwise success (cash+points)
|
|
|
*/
|
|
|
int pc_paycash(struct map_session_data *sd, int price, int points, e_log_pick_type type)
|
|
|
{
|
|
|
int cash;
|
|
|
nullpo_retr(-1,sd);
|
|
|
|
|
|
- points = cap_value(points,-MAX_ZENY,MAX_ZENY); //prevent command UB
|
|
|
- if( price < 0 || points < 0 )
|
|
|
- {
|
|
|
- ShowError("pc_paycash: Paying negative points (price=%d, points=%d, account_id=%d, char_id=%d).\n", price, points, sd->status.account_id, sd->status.char_id);
|
|
|
- return -2;
|
|
|
- }
|
|
|
-
|
|
|
- if( points > price )
|
|
|
- {
|
|
|
- ShowWarning("pc_paycash: More kafra points provided than needed (price=%d, points=%d, account_id=%d, char_id=%d).\n", price, points, sd->status.account_id, sd->status.char_id);
|
|
|
- points = price;
|
|
|
- }
|
|
|
+ points = cap_value(points, 0, MAX_ZENY); //prevent command UB
|
|
|
|
|
|
cash = price-points;
|
|
|
|
|
@@ -4449,10 +4438,10 @@ int pc_paycash(struct map_session_data *sd, int price, int points, e_log_pick_ty
|
|
|
/**
|
|
|
* Attempts to give Cash Points to player
|
|
|
* @param sd: Player
|
|
|
- * @param cash: Cash player gets
|
|
|
- * @param points: Points player has
|
|
|
+ * @param cash: Cash points the player gets
|
|
|
+ * @param points: Kafra points the player gets
|
|
|
* @param type: Log type
|
|
|
- * @return -2: Error, -1: Giving negative cash/points, otherwise success (cash or points)
|
|
|
+ * @return -1: Error, otherwise success (cash or points)
|
|
|
*/
|
|
|
int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_type type)
|
|
|
{
|
|
@@ -4460,8 +4449,8 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ
|
|
|
|
|
|
nullpo_retr(-1,sd);
|
|
|
|
|
|
- cash = cap_value(cash,-MAX_ZENY,MAX_ZENY); //prevent command UB
|
|
|
- points = cap_value(points,-MAX_ZENY,MAX_ZENY); //prevent command UB
|
|
|
+ cash = cap_value(cash, 0, MAX_ZENY); //prevent command UB
|
|
|
+ points = cap_value(points, 0, MAX_ZENY); //prevent command UB
|
|
|
if( cash > 0 )
|
|
|
{
|
|
|
if( cash > MAX_ZENY-sd->cashPoints )
|
|
@@ -4481,11 +4470,6 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ
|
|
|
}
|
|
|
return cash;
|
|
|
}
|
|
|
- else if( cash < 0 )
|
|
|
- {
|
|
|
- ShowError("pc_getcash: Obtaining negative cash points (cash=%d, account_id=%d, char_id=%d).\n", cash, sd->status.account_id, sd->status.char_id);
|
|
|
- return -1;
|
|
|
- }
|
|
|
|
|
|
if( points > 0 )
|
|
|
{
|
|
@@ -4506,12 +4490,8 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ
|
|
|
}
|
|
|
return points;
|
|
|
}
|
|
|
- else if( points < 0 )
|
|
|
- {
|
|
|
- ShowError("pc_getcash: Obtaining negative kafra points (points=%d, account_id=%d, char_id=%d).\n", points, sd->status.account_id, sd->status.char_id);
|
|
|
- return -1;
|
|
|
- }
|
|
|
- return -2; //shouldn't happen but just in case
|
|
|
+
|
|
|
+ return -1; //shouldn't happen but just in case
|
|
|
}
|
|
|
|
|
|
/**
|