فهرست منبع

* Fixed addspiritball script command
* Fixed delspiritball script command
* Add some documentaion for pc_addspiritball and pc_delspiritball

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 11 سال پیش
والد
کامیت
b40da76736
4فایلهای تغییر یافته به همراه36 افزوده شده و 13 حذف شده
  1. 3 3
      doc/script_commands.txt
  2. 14 0
      src/map/pc.c
  3. 2 2
      src/map/pc.h
  4. 17 8
      src/map/script.c

+ 3 - 3
doc/script_commands.txt

@@ -2371,9 +2371,9 @@ NOTE: This command is only available if the VIP System is enabled.
 
 ---------------------------------------
 
-*addspiritball <amount>{,<char_id>};
+*addspiritball <amount>,<duration>{,<char_id>};
 
-Adds spirit ball(s) to player.
+Adds a spirit ball to player for 'duration' in second.
 
 ---------------------------------------
 
@@ -2385,7 +2385,7 @@ Deletes the spirit ball(s) from player.
 
 *delspiritball {,<char_id>};
 
-Counts the spirit ball that player has
+Counts the spirit ball that player has.
 
 ---------------------------------------
 \\

+ 14 - 0
src/map/pc.c

@@ -178,6 +178,13 @@ static int pc_spiritball_timer(int tid, unsigned int tick, int id, intptr_t data
 	return 0;
 }
 
+/**
+* Adds a spiritball to player for 'interval' ms
+* @param sd
+* @param interval
+* @param max
+* @return 0
+*/
 int pc_addspiritball(struct map_session_data *sd,int interval,int max)
 {
 	int tid, i;
@@ -213,6 +220,13 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
 	return 0;
 }
 
+/**
+* Removes number of spiritball from player
+* @param sd
+* @param count
+* @param type 1 = gives client effect
+* @return 0
+*/
 int pc_delspiritball(struct map_session_data *sd,int count,int type)
 {
 	int i;

+ 2 - 2
src/map/pc.h

@@ -984,8 +984,8 @@ extern const struct sg_data sg_info[MAX_PC_FEELHATE];
 void pc_setinvincibletimer(struct map_session_data* sd, int val);
 void pc_delinvincibletimer(struct map_session_data* sd);
 
-int pc_addspiritball(struct map_session_data *sd,int,int);
-int pc_delspiritball(struct map_session_data *sd,int,int);
+int pc_addspiritball(struct map_session_data *sd,int interval,int max);
+int pc_delspiritball(struct map_session_data *sd,int count,int type);
 void pc_addfame(struct map_session_data *sd,int count);
 unsigned char pc_famerank(int char_id, int job);
 int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);

+ 17 - 8
src/map/script.c

@@ -18171,20 +18171,26 @@ BUILDIN_FUNC(bonus_script) {
 	return SCRIPT_CMD_SUCCESS;
 }
 
-/** Adds spirit ball(s) to player
-* addspiritball <amount>{,<char_id>};
+/** Adds a spirit ball to player for 'duration' in second
+* addspiritball <amount>,<duration>{,<char_id>};
 */
 BUILDIN_FUNC(addspiritball) {
-	uint8 amount = script_getnum(st,2);
+	uint8 i, amount = script_getnum(st,2);
+	uint16 tick = script_getnum(st,3);
 	struct map_session_data *sd;
 
-	if (script_getnum(st,3))
-		sd = map_charid2sd(script_getnum(st,3));
+	if (script_getnum(st,4))
+		sd = map_charid2sd(script_getnum(st,4));
 	else
 		sd = script_rid2sd(st);
 	if (!sd)
 		return SCRIPT_CMD_FAILURE;
-	pc_addspiritball(sd,max(amount,1),10);
+
+	if (amount == 0)
+		return SCRIPT_CMD_SUCCESS;
+
+	for (i = 0; i < amount; i++)
+		pc_addspiritball(sd,tick*1000,10);
 	return SCRIPT_CMD_SUCCESS;
 }
 
@@ -18201,7 +18207,10 @@ BUILDIN_FUNC(delspiritball) {
 		sd = script_rid2sd(st);
 	if (!sd)
 		return SCRIPT_CMD_FAILURE;
-	pc_delspiritball(sd,max(amount,1),10);
+
+	if (amount == 0)
+		return SCRIPT_CMD_SUCCESS;
+	pc_delspiritball(sd,max(amount,1),1);
 	return SCRIPT_CMD_SUCCESS;
 }
 
@@ -18704,7 +18713,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(vip_time,"i?"),
 #endif
 	BUILDIN_DEF(bonus_script,"si???"),
-	BUILDIN_DEF(addspiritball,"i?"),
+	BUILDIN_DEF(addspiritball,"ii?"),
 	BUILDIN_DEF(delspiritball,"i?"),
 	BUILDIN_DEF(countspiritball,"?"),