* Follow up to r13485. (bugreport:2741)
- @spiritball creates spiritballs without timer (limited to the array size instead of 500) git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13509 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
913165e7c4
commit
29183f62d5
@ -3,6 +3,9 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2009/02/06
|
||||||
|
* Follow up to r13485. (bugreport:2741) [FlavioJS]
|
||||||
|
- @spiritball creates spiritballs without timer (limited to the array size instead of 500)
|
||||||
2009/01/25
|
2009/01/25
|
||||||
* Changes to the configure script: [FlavioJS]
|
* Changes to the configure script: [FlavioJS]
|
||||||
- added option --enable-profiler (supports gprof)
|
- added option --enable-profiler (supports gprof)
|
||||||
|
@ -3713,20 +3713,19 @@ int atcommand_lostskill(const int fd, struct map_session_data* sd, const char* c
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int atcommand_spiritball(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int atcommand_spiritball(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
|
int max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
|
||||||
int number;
|
int number;
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
|
|
||||||
if (!message || !*message || (number = atoi(message)) < 0) {
|
if (!message || !*message || (number = atoi(message)) < 0 || number >= max_spiritballs) {
|
||||||
clif_displaymessage(fd, "Please, enter a spirit ball number (usage: @spiritball <number: 0-1000>).");
|
char msg[256];
|
||||||
|
safesnprintf(msg, sizeof(msg), "Please, enter a spirit ball number (usage: @spiritball <number: 0-%d>).", max_spiritballs);
|
||||||
|
clif_displaymessage(fd, msg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set max number to avoid server/client crash (500 create big balls of several balls: no visial difference with more)
|
if (number >= 0 && number <= max_spiritballs) {
|
||||||
if (number > 500)
|
if (sd->spiritball != number) {
|
||||||
number = 500;
|
|
||||||
|
|
||||||
if (number >= 0 && number <= 0x7FFF) {
|
|
||||||
if (sd->spiritball != number || number > 499) {
|
|
||||||
if (sd->spiritball > 0)
|
if (sd->spiritball > 0)
|
||||||
pc_delspiritball(sd, sd->spiritball, 1);
|
pc_delspiritball(sd, sd->spiritball, 1);
|
||||||
sd->spiritball = number;
|
sd->spiritball = number;
|
||||||
|
@ -178,7 +178,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tid = add_timer(gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
|
tid = add_timer(gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
|
||||||
ARR_FIND(0, sd->spiritball, i, DIFF_TICK(get_timer(tid)->tick, get_timer(sd->spirit_timer[i])->tick) < 0);
|
ARR_FIND(0, sd->spiritball, i, sd->spirit_timer[i] == INVALID_TIMER || DIFF_TICK(get_timer(tid)->tick, get_timer(sd->spirit_timer[i])->tick) < 0);
|
||||||
if( i != sd->spiritball )
|
if( i != sd->spiritball )
|
||||||
memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int));
|
memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int));
|
||||||
sd->spirit_timer[i] = tid;
|
sd->spirit_timer[i] = tid;
|
||||||
@ -199,6 +199,8 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count <= 0)
|
||||||
|
return 0;
|
||||||
if(count > sd->spiritball)
|
if(count > sd->spiritball)
|
||||||
count = sd->spiritball;
|
count = sd->spiritball;
|
||||||
sd->spiritball -= count;
|
sd->spiritball -= count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user