Added support for 64bit ticks (#3768)
Fixes #3017 Thanks to Hercules for the idea and their implementation of it. This deprecates Windows XP support. If you want to use it to run your server on it, you have to forcefully enable it now. Since 64bit ticks do not exist on XP, you might encounter some issues that are already fixed on other OS.
This commit is contained in:
parent
0d816975f7
commit
01f61cfa4f
@ -109,7 +109,7 @@ CREATE TABLE IF NOT EXISTS `db_roulette` (
|
||||
CREATE TABLE IF NOT EXISTS `bonus_script` (
|
||||
`char_id` INT(11) UNSIGNED NOT NULL,
|
||||
`script` TEXT NOT NULL,
|
||||
`tick` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`tick` BIGINT(20) NOT NULL DEFAULT '0',
|
||||
`flag` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`icon` SMALLINT(3) NOT NULL DEFAULT '-1'
|
||||
@ -375,7 +375,7 @@ CREATE TABLE IF NOT EXISTS `elemental` (
|
||||
`mdef` smallint(4) unsigned NOT NULL default '0',
|
||||
`flee` smallint(4) unsigned NOT NULL default '0',
|
||||
`hit` smallint(4) unsigned NOT NULL default '0',
|
||||
`life_time` int(11) NOT NULL default '0',
|
||||
`life_time` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`ele_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
@ -873,7 +873,7 @@ CREATE TABLE IF NOT EXISTS `mercenary` (
|
||||
`hp` int(11) unsigned NOT NULL default '0',
|
||||
`sp` int(11) unsigned NOT NULL default '0',
|
||||
`kill_counter` int(11) NOT NULL,
|
||||
`life_time` int(11) NOT NULL default '0',
|
||||
`life_time` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`mer_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
@ -913,7 +913,7 @@ CREATE TABLE IF NOT EXISTS `sc_data` (
|
||||
`account_id` int(11) unsigned NOT NULL,
|
||||
`char_id` int(11) unsigned NOT NULL,
|
||||
`type` smallint(11) unsigned NOT NULL,
|
||||
`tick` int(11) NOT NULL,
|
||||
`tick` bigint(20) NOT NULL,
|
||||
`val1` int(11) NOT NULL default '0',
|
||||
`val2` int(11) NOT NULL default '0',
|
||||
`val3` int(11) NOT NULL default '0',
|
||||
@ -930,7 +930,7 @@ CREATE TABLE IF NOT EXISTS `skillcooldown` (
|
||||
`account_id` int(11) unsigned NOT NULL,
|
||||
`char_id` int(11) unsigned NOT NULL,
|
||||
`skill` smallint(11) unsigned NOT NULL DEFAULT '0',
|
||||
`tick` int(11) NOT NULL,
|
||||
`tick` bigint(20) NOT NULL,
|
||||
KEY `account_id` (`account_id`),
|
||||
KEY `char_id` (`char_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
9
sql-files/upgrades/upgrade_20181220.sql
Normal file
9
sql-files/upgrades/upgrade_20181220.sql
Normal file
@ -0,0 +1,9 @@
|
||||
ALTER TABLE `bonus_script` MODIFY COLUMN `tick` bigint(20) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `elemental` MODIFY COLUMN `life_time` bigint(20) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `mercenary` MODIFY COLUMN `life_time` bigint(20) NOT NULL default '0';
|
||||
|
||||
ALTER TABLE `sc_data` MODIFY COLUMN `tick` bigint(20) NOT NULL;
|
||||
|
||||
ALTER TABLE `skillcooldown` MODIFY COLUMN `tick` bigint(20) NOT NULL;
|
@ -67,8 +67,6 @@ struct s_subnet {
|
||||
} subnet[16];
|
||||
int subnet_count = 0;
|
||||
|
||||
TIMER_FUNC(char_chardb_waiting_disconnect);
|
||||
|
||||
DBMap* auth_db; // uint32 account_id -> struct auth_node*
|
||||
DBMap* online_char_db; // uint32 account_id -> struct online_char_data*
|
||||
DBMap* char_db_; // uint32 char_id -> struct mmo_charstatus*
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../common/socket.hpp"
|
||||
#include "../common/sql.hpp"
|
||||
#include "../common/strlib.hpp"
|
||||
#include "../common/timer.hpp"
|
||||
|
||||
#include "char.hpp"
|
||||
#include "char_logif.hpp"
|
||||
@ -297,7 +298,7 @@ int chmapif_parse_askscdata(int fd){
|
||||
for( count = 0; count < 50 && SQL_SUCCESS == Sql_NextRow(sql_handle); ++count )
|
||||
{
|
||||
Sql_GetData(sql_handle, 0, &data, NULL); scdata.type = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); scdata.tick = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); scdata.tick = strtoll( data, nullptr, 10 );
|
||||
Sql_GetData(sql_handle, 2, &data, NULL); scdata.val1 = atoi(data);
|
||||
Sql_GetData(sql_handle, 3, &data, NULL); scdata.val2 = atoi(data);
|
||||
Sql_GetData(sql_handle, 4, &data, NULL); scdata.val3 = atoi(data);
|
||||
@ -512,7 +513,7 @@ int chmapif_parse_req_saveskillcooldown(int fd){
|
||||
memcpy(&data,RFIFOP(fd,14+i*sizeof(struct skill_cooldown_data)),sizeof(struct skill_cooldown_data));
|
||||
if( i > 0 )
|
||||
StringBuf_AppendStr(&buf, ", ");
|
||||
StringBuf_Printf(&buf, "('%d','%d','%d','%d')", aid, cid, data.skill_id, data.tick);
|
||||
StringBuf_Printf(&buf, "('%d','%d','%d','%" PRtf "')", aid, cid, data.skill_id, data.tick);
|
||||
}
|
||||
if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
@ -551,7 +552,7 @@ int chmapif_parse_req_skillcooldown(int fd){
|
||||
for( count = 0; count < MAX_SKILLCOOLDOWN && SQL_SUCCESS == Sql_NextRow(sql_handle); ++count )
|
||||
{
|
||||
Sql_GetData(sql_handle, 0, &data, NULL); scd.skill_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); scd.tick = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); scd.tick = strtoll( data, nullptr, 10 );
|
||||
memcpy(WFIFOP(fd,14+count*sizeof(struct skill_cooldown_data)), &scd, sizeof(struct skill_cooldown_data));
|
||||
}
|
||||
if( count >= MAX_SKILLCOOLDOWN )
|
||||
@ -967,7 +968,7 @@ int chmapif_parse_save_scdata(int fd){
|
||||
memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
|
||||
if( i > 0 )
|
||||
StringBuf_AppendStr(&buf, ", ");
|
||||
StringBuf_Printf(&buf, "('%d','%d','%hu','%d','%ld','%ld','%ld','%ld')", aid, cid,
|
||||
StringBuf_Printf(&buf, "('%d','%d','%hu','%" PRtf "','%ld','%ld','%ld','%ld')", aid, cid,
|
||||
data.type, data.tick, data.val1, data.val2, data.val3, data.val4);
|
||||
}
|
||||
if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
|
||||
@ -1295,7 +1296,7 @@ int chmapif_bonus_script_get(int fd) {
|
||||
schema_config.bonus_script_db, cid, MAX_PC_BONUS_SCRIPT) ||
|
||||
SQL_ERROR == SqlStmt_Execute(stmt) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &tmp_bsdata.script_str, sizeof(tmp_bsdata.script_str), NULL, NULL) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UINT32, &tmp_bsdata.tick, 0, NULL, NULL) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT64, &tmp_bsdata.tick, 0, NULL, NULL) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT16, &tmp_bsdata.flag, 0, NULL, NULL) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_UINT8, &tmp_bsdata.type, 0, NULL, NULL) ||
|
||||
SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT16, &tmp_bsdata.icon, 0, NULL, NULL)
|
||||
@ -1372,7 +1373,7 @@ int chmapif_bonus_script_save(int fd) {
|
||||
Sql_EscapeString(sql_handle, esc_script, bsdata.script_str);
|
||||
if (i > 0)
|
||||
StringBuf_AppendStr(&buf,", ");
|
||||
StringBuf_Printf(&buf, "('%d','%s','%d','%d','%d','%d')", cid, esc_script, bsdata.tick, bsdata.flag, bsdata.type, bsdata.icon);
|
||||
StringBuf_Printf(&buf, "('%d','%s','%" PRtf "','%d','%d','%d')", cid, esc_script, bsdata.tick, bsdata.flag, bsdata.type, bsdata.icon);
|
||||
}
|
||||
if (SQL_ERROR == Sql_QueryStr(sql_handle,StringBuf_Value(&buf)))
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
@ -120,7 +120,7 @@ unsigned int auction_create(struct auction_data *auction)
|
||||
else
|
||||
{
|
||||
struct auction_data *auction_;
|
||||
unsigned int tick = auction->hours * 3600000;
|
||||
t_tick tick = auction->hours * 3600000;
|
||||
|
||||
auction->item.amount = 1;
|
||||
auction->item.identify = 1;
|
||||
@ -128,7 +128,7 @@ unsigned int auction_create(struct auction_data *auction)
|
||||
|
||||
auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
|
||||
auction->auction_end_timer = add_timer( gettick() + tick , auction_end_timer, auction->auction_id, 0);
|
||||
ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
|
||||
ShowInfo("New Auction %u | time left %" PRtf " ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
|
||||
|
||||
CREATE(auction_, struct auction_data, 1);
|
||||
memcpy(auction_, auction, sizeof(struct auction_data));
|
||||
@ -191,7 +191,7 @@ void inter_auctions_fromsql(void)
|
||||
int i;
|
||||
char *data;
|
||||
StringBuf buf;
|
||||
unsigned int tick = gettick(), endtick;
|
||||
t_tick tick = gettick(), endtick;
|
||||
time_t now = time(NULL);
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
|
@ -21,7 +21,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
|
||||
if( ele->elemental_id == 0 ) { // Create new DB entry
|
||||
if( SQL_ERROR == Sql_Query(sql_handle,
|
||||
"INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
|
||||
"VALUES ('%d','%d','%d','%u','%u','%u','%u','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
|
||||
"VALUES ('%d','%d','%d','%u','%u','%u','%u','%d','%d','%d','%d','%d','%d','%d','%d','%" PRtf "')",
|
||||
schema_config.elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
|
||||
{
|
||||
Sql_ShowDebug(sql_handle);
|
||||
@ -32,7 +32,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
|
||||
} else if( SQL_ERROR == Sql_Query(sql_handle,
|
||||
"UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%u', `sp` = '%u',"
|
||||
"`max_hp` = '%u', `max_sp` = '%u', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
|
||||
"`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'", schema_config.elemental_db,
|
||||
"`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%" PRtf "' WHERE `ele_id` = '%d'", schema_config.elemental_db,
|
||||
ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
|
||||
ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
|
||||
{ // Update DB entry
|
||||
@ -75,7 +75,7 @@ bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele) {
|
||||
Sql_GetData(sql_handle, 11, &data, NULL); ele->mdef = atoi(data);
|
||||
Sql_GetData(sql_handle, 12, &data, NULL); ele->flee = atoi(data);
|
||||
Sql_GetData(sql_handle, 13, &data, NULL); ele->hit = atoi(data);
|
||||
Sql_GetData(sql_handle, 14, &data, NULL); ele->life_time = atoi(data);
|
||||
Sql_GetData(sql_handle, 14, &data, NULL); ele->life_time = strtoll( data, nullptr, 10 );
|
||||
Sql_FreeResult(sql_handle);
|
||||
if( charserv_config.save_log )
|
||||
ShowInfo("Elemental loaded (ID: %d / Class: %d / CID: %d).\n", ele->elemental_id, ele->class_, ele->char_id);
|
||||
|
@ -73,7 +73,7 @@ bool mapif_mercenary_save(struct s_mercenary* merc)
|
||||
if( merc->mercenary_id == 0 )
|
||||
{ // Create new DB entry
|
||||
if( SQL_ERROR == Sql_Query(sql_handle,
|
||||
"INSERT INTO `%s` (`char_id`,`class`,`hp`,`sp`,`kill_counter`,`life_time`) VALUES ('%d','%d','%u','%u','%u','%u')",
|
||||
"INSERT INTO `%s` (`char_id`,`class`,`hp`,`sp`,`kill_counter`,`life_time`) VALUES ('%d','%d','%u','%u','%u','%" PRtf "')",
|
||||
schema_config.mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time) )
|
||||
{
|
||||
Sql_ShowDebug(sql_handle);
|
||||
@ -83,7 +83,7 @@ bool mapif_mercenary_save(struct s_mercenary* merc)
|
||||
merc->mercenary_id = (int)Sql_LastInsertId(sql_handle);
|
||||
}
|
||||
else if( SQL_ERROR == Sql_Query(sql_handle,
|
||||
"UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `hp` = '%u', `sp` = '%u', `kill_counter` = '%u', `life_time` = '%u' WHERE `mer_id` = '%d'",
|
||||
"UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `hp` = '%u', `sp` = '%u', `kill_counter` = '%u', `life_time` = '%" PRtf "' WHERE `mer_id` = '%d'",
|
||||
schema_config.mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time, merc->mercenary_id) )
|
||||
{ // Update DB entry
|
||||
Sql_ShowDebug(sql_handle);
|
||||
@ -117,7 +117,7 @@ bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc)
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); merc->hp = atoi(data);
|
||||
Sql_GetData(sql_handle, 2, &data, NULL); merc->sp = atoi(data);
|
||||
Sql_GetData(sql_handle, 3, &data, NULL); merc->kill_count = atoi(data);
|
||||
Sql_GetData(sql_handle, 4, &data, NULL); merc->life_time = atoi(data);
|
||||
Sql_GetData(sql_handle, 4, &data, NULL); merc->life_time = strtoll( data, nullptr, 10 );
|
||||
Sql_FreeResult(sql_handle);
|
||||
if( charserv_config.save_log )
|
||||
ShowInfo("Mercenary loaded (ID: %d / Class: %d / CID: %d).\n", merc->mercenary_id, merc->class_, merc->char_id);
|
||||
|
@ -66,7 +66,7 @@ int inter_recv_packet_length[] = {
|
||||
|
||||
struct WisData {
|
||||
int id, fd, count, len, gmlvl;
|
||||
unsigned long tick;
|
||||
t_tick tick;
|
||||
char src[NAME_LENGTH], dst[NAME_LENGTH], msg[512];
|
||||
};
|
||||
static DBMap* wis_db = NULL; // int wis_id -> struct WisData*
|
||||
@ -1100,9 +1100,9 @@ int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason
|
||||
*/
|
||||
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
unsigned long tick;
|
||||
t_tick tick;
|
||||
struct WisData *wd = (struct WisData *)db_data2ptr(data);
|
||||
tick = va_arg(ap, unsigned long);
|
||||
tick = va_arg(ap, t_tick);
|
||||
|
||||
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
|
||||
wis_dellist[wis_delnum++] = wd->id;
|
||||
@ -1112,7 +1112,7 @@ int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
|
||||
|
||||
int check_ttl_wisdata(void)
|
||||
{
|
||||
unsigned long tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int i;
|
||||
|
||||
do {
|
||||
|
@ -364,7 +364,7 @@ int main (int argc, char **argv)
|
||||
|
||||
// Main runtime cycle
|
||||
while (runflag != CORE_ST_STOP) {
|
||||
int next = do_timer(gettick_nocache());
|
||||
t_tick next = do_timer(gettick_nocache());
|
||||
do_sockets(next);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "cbasetypes.hpp"
|
||||
#include "db.hpp"
|
||||
#include "timer.hpp" // t_tick
|
||||
|
||||
#ifndef PACKETVER
|
||||
#error Please define PACKETVER in src/config/packets.hpp
|
||||
@ -332,13 +333,14 @@ struct script_reg_str {
|
||||
//For saving status changes across sessions. [Skotlex]
|
||||
struct status_change_data {
|
||||
unsigned short type; //SC_type
|
||||
long val1, val2, val3, val4, tick; //Remaining duration.
|
||||
long val1, val2, val3, val4;
|
||||
t_tick tick; //Remaining duration.
|
||||
};
|
||||
|
||||
#define MAX_BONUS_SCRIPT_LENGTH 512
|
||||
struct bonus_script_data {
|
||||
char script_str[MAX_BONUS_SCRIPT_LENGTH]; //< Script string
|
||||
uint32 tick; ///< Tick
|
||||
t_tick tick; ///< Tick
|
||||
uint16 flag; ///< Flags @see enum e_bonus_script_flags
|
||||
int16 icon; ///< Icon SI
|
||||
uint8 type; ///< 0 - None, 1 - Buff, 2 - Debuff
|
||||
@ -346,7 +348,7 @@ struct bonus_script_data {
|
||||
|
||||
struct skill_cooldown_data {
|
||||
unsigned short skill_id;
|
||||
long tick;
|
||||
t_tick tick;
|
||||
};
|
||||
|
||||
enum storage_type {
|
||||
@ -445,7 +447,7 @@ struct s_mercenary {
|
||||
short class_;
|
||||
int hp, sp;
|
||||
unsigned int kill_count;
|
||||
unsigned int life_time;
|
||||
t_tick life_time;
|
||||
};
|
||||
|
||||
struct s_elemental {
|
||||
@ -455,7 +457,7 @@ struct s_elemental {
|
||||
enum e_mode mode;
|
||||
int hp, sp, max_hp, max_sp, matk, atk, atk2;
|
||||
short hit, flee, amotion, def, mdef;
|
||||
int life_time;
|
||||
t_tick life_time;
|
||||
};
|
||||
|
||||
struct s_friend {
|
||||
|
@ -819,7 +819,7 @@ int WFIFOSET(int fd, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_sockets(int next)
|
||||
int do_sockets(t_tick next)
|
||||
{
|
||||
fd_set rfd;
|
||||
struct timeval timeout;
|
||||
@ -841,8 +841,8 @@ int do_sockets(int next)
|
||||
#endif
|
||||
|
||||
// can timeout until the next tick
|
||||
timeout.tv_sec = next/1000;
|
||||
timeout.tv_usec = next%1000*1000;
|
||||
timeout.tv_sec = (long)(next/1000);
|
||||
timeout.tv_usec = (long)(next%1000*1000);
|
||||
|
||||
memcpy(&rfd, &readfds, sizeof(rfd));
|
||||
ret = sSelect(fd_max, &rfd, NULL, NULL, &timeout);
|
||||
@ -955,7 +955,7 @@ int do_sockets(int next)
|
||||
typedef struct _connect_history {
|
||||
struct _connect_history* next;
|
||||
uint32 ip;
|
||||
uint32 tick;
|
||||
t_tick tick;
|
||||
int count;
|
||||
unsigned ddos : 1;
|
||||
} ConnectHistory;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "cbasetypes.hpp"
|
||||
#include "timer.hpp" // t_tick
|
||||
|
||||
#define FIFOSIZE_SERVERLINK 256*1024
|
||||
|
||||
@ -124,7 +125,7 @@ int realloc_writefifo(int fd, size_t addition);
|
||||
int WFIFOSET(int fd, size_t len);
|
||||
int RFIFOSKIP(int fd, size_t len);
|
||||
|
||||
int do_sockets(int next);
|
||||
int do_sockets(t_tick next);
|
||||
void do_close(int fd);
|
||||
void socket_init(void);
|
||||
void socket_final(void);
|
||||
|
@ -22,8 +22,8 @@
|
||||
// or many connected clients, please increase TIMER_MIN_INTERVAL.
|
||||
// The official interval of 20ms is however strongly recommended,
|
||||
// as it is needed for perfect server-client syncing.
|
||||
#define TIMER_MIN_INTERVAL 20
|
||||
#define TIMER_MAX_INTERVAL 1000
|
||||
const t_tick TIMER_MIN_INTERVAL = 20;
|
||||
const t_tick TIMER_MAX_INTERVAL = 1000;
|
||||
|
||||
// timers (array)
|
||||
static struct TimerData* timer_data = NULL;
|
||||
@ -137,10 +137,14 @@ static void rdtsc_calibrate(){
|
||||
#endif
|
||||
|
||||
/// platform-abstracted tick retrieval
|
||||
static unsigned int tick(void)
|
||||
static t_tick tick(void)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
#ifdef DEPRECATED_WINDOWS_SUPPORT
|
||||
return GetTickCount();
|
||||
#else
|
||||
return GetTickCount64();
|
||||
#endif
|
||||
#elif defined(ENABLE_RDTSC)
|
||||
//
|
||||
return (unsigned int)((_rdtsc() - RDTSC_BEGINTICK) / RDTSC_CLOCK);
|
||||
@ -160,7 +164,7 @@ static unsigned int tick(void)
|
||||
#if defined(TICK_CACHE) && TICK_CACHE > 1
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// tick is cached for TICK_CACHE calls
|
||||
static unsigned int gettick_cache;
|
||||
static t_tick gettick_cache;
|
||||
static int gettick_count = 1;
|
||||
|
||||
unsigned int gettick_nocache(void)
|
||||
@ -170,7 +174,7 @@ unsigned int gettick_nocache(void)
|
||||
return gettick_cache;
|
||||
}
|
||||
|
||||
unsigned int gettick(void)
|
||||
t_tick gettick(void)
|
||||
{
|
||||
return ( --gettick_count == 0 ) ? gettick_nocache() : gettick_cache;
|
||||
}
|
||||
@ -178,12 +182,12 @@ unsigned int gettick(void)
|
||||
#else
|
||||
//////////////////////////////
|
||||
// tick doesn't get cached
|
||||
unsigned int gettick_nocache(void)
|
||||
t_tick gettick_nocache(void)
|
||||
{
|
||||
return tick();
|
||||
}
|
||||
|
||||
unsigned int gettick(void)
|
||||
t_tick gettick(void)
|
||||
{
|
||||
return tick();
|
||||
}
|
||||
@ -240,7 +244,7 @@ static int acquire_timer(void)
|
||||
|
||||
/// Starts a new timer that is deleted once it expires (single-use).
|
||||
/// Returns the timer's id.
|
||||
int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data)
|
||||
int add_timer(t_tick tick, TimerFunc func, int id, intptr_t data)
|
||||
{
|
||||
int tid;
|
||||
|
||||
@ -258,13 +262,13 @@ int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data)
|
||||
|
||||
/// Starts a new timer that automatically restarts itself (infinite loop until manually removed).
|
||||
/// Returns the timer's id, or INVALID_TIMER if it fails.
|
||||
int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr_t data, int interval)
|
||||
int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int interval)
|
||||
{
|
||||
int tid;
|
||||
|
||||
if( interval < 1 )
|
||||
{
|
||||
ShowError("add_timer_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, gettick()));
|
||||
ShowError("add_timer_interval: invalid interval (tick=%" PRtf " %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, gettick()));
|
||||
return INVALID_TIMER;
|
||||
}
|
||||
|
||||
@ -310,14 +314,14 @@ int delete_timer(int tid, TimerFunc func)
|
||||
|
||||
/// Adjusts a timer's expiration time.
|
||||
/// Returns the new tick value, or -1 if it fails.
|
||||
int addtick_timer(int tid, unsigned int tick)
|
||||
t_tick addt_tickimer(int tid, t_tick tick)
|
||||
{
|
||||
return settick_timer(tid, timer_data[tid].tick+tick);
|
||||
return sett_tickimer(tid, timer_data[tid].tick+tick);
|
||||
}
|
||||
|
||||
/// Modifies a timer's expiration time (an alternative to deleting a timer and starting a new one).
|
||||
/// Returns the new tick value, or -1 if it fails.
|
||||
int settick_timer(int tid, unsigned int tick)
|
||||
t_tick sett_tickimer(int tid, t_tick tick)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -325,28 +329,28 @@ int settick_timer(int tid, unsigned int tick)
|
||||
ARR_FIND(0, BHEAP_LENGTH(timer_heap), i, BHEAP_DATA(timer_heap)[i] == tid);
|
||||
if( i == BHEAP_LENGTH(timer_heap) )
|
||||
{
|
||||
ShowError("settick_timer: no such timer %d (%p(%s))\n", tid, timer_data[tid].func, search_timer_func_list(timer_data[tid].func));
|
||||
ShowError("sett_tickimer: no such timer %d (%p(%s))\n", tid, timer_data[tid].func, search_timer_func_list(timer_data[tid].func));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( (int)tick == -1 )
|
||||
if( tick == -1 )
|
||||
tick = 0;// add 1ms to avoid the error value -1
|
||||
|
||||
if( timer_data[tid].tick == tick )
|
||||
return (int)tick;// nothing to do, already in propper position
|
||||
return tick;// nothing to do, already in propper position
|
||||
|
||||
// pop and push adjusted timer
|
||||
BHEAP_POPINDEX(timer_heap, i, DIFFTICK_MINTOPCMP, SWAP);
|
||||
timer_data[tid].tick = tick;
|
||||
BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, SWAP);
|
||||
return (int)tick;
|
||||
return tick;
|
||||
}
|
||||
|
||||
/// Executes all expired timers.
|
||||
/// Returns the value of the smallest non-expired timer (or 1 second if there aren't any).
|
||||
int do_timer(unsigned int tick)
|
||||
t_tick do_timer(t_tick tick)
|
||||
{
|
||||
int diff = TIMER_MAX_INTERVAL; // return value
|
||||
t_tick diff = TIMER_MAX_INTERVAL; // return value
|
||||
|
||||
// process all timers one by one
|
||||
while( BHEAP_LENGTH(timer_heap) )
|
||||
|
@ -8,9 +8,17 @@
|
||||
|
||||
#include "cbasetypes.hpp"
|
||||
|
||||
#define DIFF_TICK(a,b) ((int)((a)-(b)))
|
||||
typedef int64 t_tick;
|
||||
#define PRtf PRId64
|
||||
|
||||
const int32 INFINITE_TICK = -1;
|
||||
static inline t_tick tick_diff( t_tick a, t_tick b ){
|
||||
return a - b;
|
||||
}
|
||||
|
||||
// Convenience for now
|
||||
#define DIFF_TICK(a,b) tick_diff(a,b)
|
||||
|
||||
const t_tick INFINITE_TICK = -1;
|
||||
|
||||
#define INVALID_TIMER -1
|
||||
#define CLIF_WALK_TIMER -2
|
||||
@ -22,13 +30,13 @@ enum {
|
||||
TIMER_REMOVE_HEAP = 0x10,
|
||||
};
|
||||
|
||||
#define TIMER_FUNC(x) int x ( int tid, unsigned int tick, int id, intptr_t data )
|
||||
#define TIMER_FUNC(x) int x ( int tid, t_tick tick, int id, intptr_t data )
|
||||
|
||||
// Struct declaration
|
||||
typedef TIMER_FUNC((*TimerFunc));
|
||||
|
||||
struct TimerData {
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
TimerFunc func;
|
||||
unsigned int type;
|
||||
int interval;
|
||||
@ -40,16 +48,16 @@ struct TimerData {
|
||||
|
||||
// Function prototype declaration
|
||||
|
||||
unsigned int gettick(void);
|
||||
unsigned int gettick_nocache(void);
|
||||
t_tick gettick(void);
|
||||
t_tick gettick_nocache(void);
|
||||
|
||||
int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data);
|
||||
int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
|
||||
int add_timer(t_tick tick, TimerFunc func, int id, intptr_t data);
|
||||
int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int interval);
|
||||
const struct TimerData* get_timer(int tid);
|
||||
int delete_timer(int tid, TimerFunc func);
|
||||
|
||||
int addtick_timer(int tid, unsigned int tick);
|
||||
int settick_timer(int tid, unsigned int tick);
|
||||
t_tick addt_tickimer(int tid, t_tick tick);
|
||||
t_tick sett_tickimer(int tid, t_tick tick);
|
||||
|
||||
int add_timer_func_list(TimerFunc func, const char* name);
|
||||
|
||||
@ -60,7 +68,7 @@ const char* timestamp2string(char* str, size_t size, time_t timestamp, const cha
|
||||
void split_time(int time, int* year, int* month, int* day, int* hour, int* minute, int* second);
|
||||
double solve_time(char* modif_p);
|
||||
|
||||
int do_timer(unsigned int tick);
|
||||
t_tick do_timer(t_tick tick);
|
||||
void timer_init(void);
|
||||
void timer_final(void);
|
||||
|
||||
|
@ -4,6 +4,9 @@
|
||||
#ifndef WINAPI_HPP
|
||||
#define WINAPI_HPP
|
||||
|
||||
#include "../config/core.hpp"
|
||||
|
||||
#ifdef DEPRECATED_WINDOWS_SUPPORT
|
||||
#ifndef NTDDI_VERSION
|
||||
#define NTDDI_VERSION 0x05000000 // Windows 2000
|
||||
#endif
|
||||
@ -19,6 +22,9 @@
|
||||
#ifndef _WIN32_WINNT_VISTA
|
||||
#define _WIN32_WINNT_VISTA 0x0600 // Windows Vista
|
||||
#endif
|
||||
#else
|
||||
#include <sdkddkver.h>
|
||||
#endif
|
||||
|
||||
#define STRICT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -68,6 +68,12 @@
|
||||
/// Comment to disable warnings for deprecated script constants
|
||||
#define SCRIPT_CONSTANT_DEPRECATION
|
||||
|
||||
// Uncomment to enable deprecated support for Windows XP and lower
|
||||
// Note:
|
||||
// Windows XP still has 32bit ticks. This means you need to restart your operating system before time
|
||||
// overflows, which is approximately every ~49 days.
|
||||
//#define DEPRECATED_WINDOWS_SUPPORT
|
||||
|
||||
/**
|
||||
* No settings past this point
|
||||
**/
|
||||
|
@ -215,8 +215,8 @@ static TIMER_FUNC(login_online_data_cleanup){
|
||||
*/
|
||||
int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
|
||||
static int num_regs = 0; // registration counter
|
||||
static unsigned int new_reg_tick = 0;
|
||||
unsigned int tick = gettick();
|
||||
static t_tick new_reg_tick = 0;
|
||||
t_tick tick = gettick();
|
||||
struct mmo_account acc;
|
||||
|
||||
//Account Registration Flood Protection by [Kevin]
|
||||
|
@ -4681,7 +4681,7 @@ ACMD_FUNC(reloadnpcfile) {
|
||||
/*==========================================
|
||||
* time in txt for time command (by [Yor])
|
||||
*------------------------------------------*/
|
||||
char* txt_time(unsigned int duration)
|
||||
char* txt_time(t_tick duration_)
|
||||
{
|
||||
int days, hours, minutes, seconds;
|
||||
char temp[CHAT_SIZE_MAX];
|
||||
@ -4690,6 +4690,9 @@ char* txt_time(unsigned int duration)
|
||||
memset(temp, '\0', sizeof(temp));
|
||||
memset(temp1, '\0', sizeof(temp1));
|
||||
|
||||
// Cap it
|
||||
int duration = (int)duration_;
|
||||
|
||||
days = duration / (60 * 60 * 24);
|
||||
duration = duration - (60 * 60 * 24 * days);
|
||||
hours = duration / (60 * 60);
|
||||
@ -5760,7 +5763,7 @@ ACMD_FUNC(useskill)
|
||||
ACMD_FUNC(displayskill)
|
||||
{
|
||||
struct status_data * status;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
uint16 skill_id;
|
||||
uint16 skill_lv = 1;
|
||||
nullpo_retr(-1, sd);
|
||||
@ -6779,7 +6782,7 @@ ACMD_FUNC(summon)
|
||||
int mob_id = 0;
|
||||
int duration = 0;
|
||||
struct mob_data *md;
|
||||
unsigned int tick=gettick();
|
||||
t_tick tick=gettick();
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
|
@ -264,7 +264,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
|
||||
* @param isspdamage: If the damage is done to SP
|
||||
* @param tick: Current tick
|
||||
*------------------------------------------*/
|
||||
void battle_damage(struct block_list *src, struct block_list *target, int64 damage, int delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, unsigned int tick, bool isspdamage) {
|
||||
void battle_damage(struct block_list *src, struct block_list *target, int64 damage, t_tick delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, t_tick tick, bool isspdamage) {
|
||||
map_freeblock_lock();
|
||||
if (isspdamage)
|
||||
status_fix_spdamage(src, target, damage, delay);
|
||||
@ -288,7 +288,7 @@ struct delay_damage {
|
||||
int src_id;
|
||||
int target_id;
|
||||
int64 damage;
|
||||
int delay;
|
||||
t_tick delay;
|
||||
unsigned short distance;
|
||||
uint16 skill_lv;
|
||||
uint16 skill_id;
|
||||
@ -339,7 +339,7 @@ TIMER_FUNC(battle_delay_damage_sub){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int battle_delay_damage(unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects, bool isspdamage)
|
||||
int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, t_tick ddelay, bool additional_effects, bool isspdamage)
|
||||
{
|
||||
struct delay_damage *dat;
|
||||
struct status_change *sc;
|
||||
@ -5026,7 +5026,7 @@ static void battle_calc_attack_gvg_bg(struct Damage* wd, struct block_list *src,
|
||||
int64 damage = wd->damage + wd->damage2, rdamage = 0;
|
||||
struct map_session_data *tsd = BL_CAST(BL_PC, target);
|
||||
struct status_data *sstatus = status_get_status_data(src);
|
||||
int tick = gettick(), rdelay = 0;
|
||||
t_tick tick = gettick(), rdelay = 0;
|
||||
|
||||
rdamage = battle_calc_return_damage(target, src, &damage, wd->flag, skill_id, false);
|
||||
if( rdamage > 0 ) { //Item reflect gets calculated before any mapflag reducing is applicated
|
||||
@ -5293,7 +5293,7 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
|
||||
struct status_change *tsc = status_get_sc(target);
|
||||
struct status_data *sstatus = status_get_status_data(src);
|
||||
struct unit_data *ud = unit_bl2ud(target);
|
||||
int tick = gettick(), rdelay = 0;
|
||||
t_tick tick = gettick(), rdelay = 0;
|
||||
|
||||
if (!tsc)
|
||||
return;
|
||||
@ -7086,7 +7086,7 @@ void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rda
|
||||
* Original coder pakpil
|
||||
*/
|
||||
int battle_damage_area(struct block_list *bl, va_list ap) {
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
int64 damage;
|
||||
int amotion, dmotion;
|
||||
struct block_list *src;
|
||||
@ -7119,7 +7119,7 @@ int battle_damage_area(struct block_list *bl, va_list ap) {
|
||||
/*==========================================
|
||||
* Do a basic physical attack (call through unit_attack_timer)
|
||||
*------------------------------------------*/
|
||||
enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag) {
|
||||
enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, t_tick tick, int flag) {
|
||||
struct map_session_data *sd = NULL, *tsd = NULL;
|
||||
struct status_data *sstatus, *tstatus;
|
||||
struct status_change *sc, *tsc;
|
||||
|
@ -102,13 +102,13 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
|
||||
int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,uint16 skill_id,int flag);
|
||||
int64 battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int64 damage,uint16 skill_id,int flag);
|
||||
|
||||
void battle_damage(struct block_list *src, struct block_list *target, int64 damage, int delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, unsigned int tick, bool spdamage);
|
||||
int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects, bool spdamage);
|
||||
void battle_damage(struct block_list *src, struct block_list *target, int64 damage, t_tick delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, t_tick tick, bool spdamage);
|
||||
int battle_delay_damage (t_tick tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, t_tick ddelay, bool additional_effects, bool spdamage);
|
||||
|
||||
int battle_calc_chorusbonus(struct map_session_data *sd);
|
||||
|
||||
// Summary normal attack treatment (basic attack)
|
||||
enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,unsigned int tick,int flag);
|
||||
enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,t_tick tick,int flag);
|
||||
|
||||
// Accessors
|
||||
struct block_list* battle_get_master(struct block_list *src);
|
||||
|
@ -219,7 +219,7 @@ int channel_join(struct Channel *channel, struct map_session_data *sd) {
|
||||
RECREATE(sd->channels, struct Channel *, ++sd->channel_count);
|
||||
sd->channels[ sd->channel_count - 1 ] = channel;
|
||||
idb_put(channel->users, sd->status.char_id, sd);
|
||||
RECREATE(sd->channel_tick, unsigned int, sd->channel_count);
|
||||
RECREATE(sd->channel_tick, t_tick, sd->channel_count);
|
||||
sd->channel_tick[sd->channel_count-1] = 0;
|
||||
|
||||
if( sd->stealth ) {
|
||||
|
@ -1305,7 +1305,7 @@ int chrif_updatefamelist_ack(int fd) {
|
||||
int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
|
||||
#ifdef ENABLE_SC_SAVING
|
||||
int i, count=0;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
struct status_change_data data;
|
||||
struct status_change *sc = &sd->sc;
|
||||
const struct TimerData *timer;
|
||||
@ -1351,7 +1351,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
|
||||
int chrif_skillcooldown_save(struct map_session_data *sd) {
|
||||
int i, count = 0;
|
||||
struct skill_cooldown_data data;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
const struct TimerData *timer;
|
||||
|
||||
chrif_check(-1);
|
||||
@ -1681,7 +1681,7 @@ int chrif_bsdata_save(struct map_session_data *sd, bool quit) {
|
||||
WFIFOL(char_fd, 4) = sd->status.char_id;
|
||||
|
||||
if (sd->bonus_script.count) {
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct linkdb_node *node = NULL;
|
||||
|
||||
for (node = sd->bonus_script.head; node && i < MAX_PC_BONUS_SCRIPT; node = node->next) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "../common/cbasetypes.hpp"
|
||||
#include "../common/timer.hpp" // t_tick
|
||||
#include "../common/socket.hpp" // enum chrif_req_op
|
||||
|
||||
//fwd declaration
|
||||
@ -30,7 +31,7 @@ struct auth_node {
|
||||
time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
|
||||
struct map_session_data *sd; //Data from logged on char.
|
||||
struct mmo_charstatus *char_dat; //Data from char server.
|
||||
unsigned int node_created; //timestamp for node timeouts
|
||||
t_tick node_created; //timestamp for node timeouts
|
||||
enum sd_state state; //To track whether player was login in/out or changing maps.
|
||||
};
|
||||
|
||||
|
@ -57,6 +57,10 @@
|
||||
#include "unit.hpp"
|
||||
#include "vending.hpp"
|
||||
|
||||
static inline uint32 client_tick( t_tick tick ){
|
||||
return (uint32)tick;
|
||||
}
|
||||
|
||||
/* for clif_clearunit_delayed */
|
||||
static struct eri *delay_clearunit_ers;
|
||||
|
||||
@ -667,7 +671,7 @@ void clif_authok(struct map_session_data *sd)
|
||||
|
||||
WFIFOHEAD(fd,packet_len(cmd));
|
||||
WFIFOW(fd, 0) = cmd;
|
||||
WFIFOL(fd, 2) = gettick();
|
||||
WFIFOL(fd, 2) = client_tick(gettick());
|
||||
WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y, sd->ud.dir);
|
||||
WFIFOB(fd, 9) = 5; // ignored
|
||||
WFIFOB(fd,10) = 5; // ignored
|
||||
@ -895,7 +899,7 @@ static TIMER_FUNC(clif_clearunit_delayed_sub){
|
||||
ers_free(delay_clearunit_ers,bl);
|
||||
return 0;
|
||||
}
|
||||
void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int tick)
|
||||
void clif_clearunit_delayed(struct block_list* bl, clr_type type, t_tick tick)
|
||||
{
|
||||
struct block_list *tbl = ers_alloc(delay_clearunit_ers, struct block_list);
|
||||
memcpy (tbl, bl, sizeof (struct block_list));
|
||||
@ -1246,12 +1250,12 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
|
||||
WBUFW(buf,18) = vd->weapon;
|
||||
#if PACKETVER < 4
|
||||
WBUFW(buf,20) = vd->head_bottom;
|
||||
WBUFL(buf,22) = gettick();
|
||||
WBUFL(buf,22) = client_tick(gettick());
|
||||
WBUFW(buf,26) = vd->shield;
|
||||
#else
|
||||
WBUFW(buf,20) = vd->shield;
|
||||
WBUFW(buf,22) = vd->head_bottom;
|
||||
WBUFL(buf,24) = gettick();
|
||||
WBUFL(buf,24) = client_tick(gettick());
|
||||
#endif
|
||||
WBUFW(buf,28) = vd->head_top;
|
||||
WBUFW(buf,30) = vd->head_mid;
|
||||
@ -1707,7 +1711,7 @@ void clif_walkok(struct map_session_data *sd)
|
||||
|
||||
WFIFOHEAD(fd, packet_len(0x87));
|
||||
WFIFOW(fd,0)=0x87;
|
||||
WFIFOL(fd,2)=gettick();
|
||||
WFIFOL(fd,2)=client_tick(gettick());
|
||||
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8);
|
||||
WFIFOSET(fd,packet_len(0x87));
|
||||
}
|
||||
@ -1783,7 +1787,7 @@ void clif_move(struct unit_data *ud)
|
||||
WBUFW(buf,0)=0x86;
|
||||
WBUFL(buf,2)=-bl->id;
|
||||
WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
|
||||
WBUFL(buf,12)=gettick();
|
||||
WBUFL(buf,12)=client_tick(gettick());
|
||||
clif_send(buf, packet_len(0x86), bl, SELF);
|
||||
}
|
||||
return;
|
||||
@ -1809,7 +1813,7 @@ void clif_move(struct unit_data *ud)
|
||||
WBUFW(buf,0)=0x86;
|
||||
WBUFL(buf,2)=bl->id;
|
||||
WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
|
||||
WBUFL(buf,12)=gettick();
|
||||
WBUFL(buf,12)=client_tick(gettick());
|
||||
clif_send(buf, packet_len(0x86), bl, AREA_WOS);
|
||||
if (disguised(bl)) {
|
||||
WBUFL(buf,2)=-bl->id;
|
||||
@ -4777,7 +4781,7 @@ static int clif_hallucination_damage()
|
||||
/// 10 = critical hit
|
||||
/// 11 = lucky dodge
|
||||
/// 12 = (touch skill?)
|
||||
int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage)
|
||||
int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage)
|
||||
{
|
||||
unsigned char buf[34];
|
||||
struct status_change *sc;
|
||||
@ -4809,7 +4813,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
|
||||
WBUFW(buf,0) = cmd;
|
||||
WBUFL(buf,2) = src->id;
|
||||
WBUFL(buf,6) = dst->id;
|
||||
WBUFL(buf,10) = tick;
|
||||
WBUFL(buf,10) = client_tick(tick);
|
||||
WBUFL(buf,14) = sdelay;
|
||||
WBUFL(buf,18) = ddelay;
|
||||
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
|
||||
@ -5515,7 +5519,7 @@ void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_f
|
||||
|
||||
/// Skill cooldown display icon (ZC_SKILL_POSTDELAY).
|
||||
/// 043d <skill ID>.W <tick>.L
|
||||
void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick)
|
||||
void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick)
|
||||
{
|
||||
#if PACKETVER>=20081112
|
||||
int fd;
|
||||
@ -5526,7 +5530,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
|
||||
WFIFOHEAD(fd,packet_len(0x43d));
|
||||
WFIFOW(fd,0) = 0x43d;
|
||||
WFIFOW(fd,2) = skill_id;
|
||||
WFIFOL(fd,4) = tick;
|
||||
WFIFOL(fd,4) = client_tick(tick);
|
||||
WFIFOSET(fd,packet_len(0x43d));
|
||||
#endif
|
||||
}
|
||||
@ -5534,7 +5538,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
|
||||
/// Skill attack effect and damage.
|
||||
/// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
|
||||
/// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2)
|
||||
int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type)
|
||||
int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type)
|
||||
{
|
||||
unsigned char buf[64];
|
||||
struct status_change *sc;
|
||||
@ -5555,7 +5559,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
|
||||
WBUFW(buf,2)=skill_id;
|
||||
WBUFL(buf,4)=src->id;
|
||||
WBUFL(buf,8)=dst->id;
|
||||
WBUFL(buf,12)=tick;
|
||||
WBUFL(buf,12)=client_tick(tick);
|
||||
WBUFL(buf,16)=sdelay;
|
||||
WBUFL(buf,20)=ddelay;
|
||||
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
|
||||
@ -5586,7 +5590,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
|
||||
WBUFW(buf,2)=skill_id;
|
||||
WBUFL(buf,4)=src->id;
|
||||
WBUFL(buf,8)=dst->id;
|
||||
WBUFL(buf,12)=tick;
|
||||
WBUFL(buf,12)=client_tick(tick);
|
||||
WBUFL(buf,16)=sdelay;
|
||||
WBUFL(buf,20)=ddelay;
|
||||
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
|
||||
@ -5630,7 +5634,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
|
||||
/// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION).
|
||||
/// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B
|
||||
/*
|
||||
int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type)
|
||||
int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type)
|
||||
{
|
||||
unsigned char buf[64];
|
||||
struct status_change *sc;
|
||||
@ -5651,7 +5655,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in
|
||||
WBUFW(buf,2)=skill_id;
|
||||
WBUFL(buf,4)=src->id;
|
||||
WBUFL(buf,8)=dst->id;
|
||||
WBUFL(buf,12)=tick;
|
||||
WBUFL(buf,12)=client_tick(tick);
|
||||
WBUFL(buf,16)=sdelay;
|
||||
WBUFL(buf,20)=ddelay;
|
||||
WBUFW(buf,24)=dst->x;
|
||||
@ -5689,7 +5693,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in
|
||||
/// Non-damaging skill effect
|
||||
/// 011a <skill id>.W <heal>.W <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL).
|
||||
/// 09cb <skill id>.W <heal>.L <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL2).
|
||||
int clif_skill_nodamage(struct block_list *src,struct block_list *dst, uint16 skill_id, int heal, int fail)
|
||||
bool clif_skill_nodamage(struct block_list *src,struct block_list *dst, uint16 skill_id, int heal, t_tick tick)
|
||||
{
|
||||
unsigned char buf[17];
|
||||
#if PACKETVER < 20130731
|
||||
@ -5698,6 +5702,7 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst, uint16 sk
|
||||
const int cmd = 0x9cb;
|
||||
#endif
|
||||
int offset = 0;
|
||||
bool success = ( tick != 0 );
|
||||
|
||||
nullpo_ret(dst);
|
||||
|
||||
@ -5711,7 +5716,7 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst, uint16 sk
|
||||
#endif
|
||||
WBUFL(buf,6+offset) = dst->id;
|
||||
WBUFL(buf,10+offset) = src ? src->id : 0;
|
||||
WBUFB(buf,14+offset) = fail;
|
||||
WBUFB(buf,14+offset) = success;
|
||||
|
||||
if (disguised(dst)) {
|
||||
clif_send(buf, packet_len(cmd), dst, AREA_WOS);
|
||||
@ -5727,13 +5732,13 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst, uint16 sk
|
||||
clif_send(buf, packet_len(cmd), src, SELF);
|
||||
}
|
||||
|
||||
return fail;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/// Non-damaging ground skill effect (ZC_NOTIFY_GROUNDSKILL).
|
||||
/// 0117 <skill id>.W <src id>.L <level>.W <x>.W <y>.W <tick>.L
|
||||
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,int tick)
|
||||
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,t_tick tick)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
@ -5745,7 +5750,7 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i
|
||||
WBUFW(buf,8)=val;
|
||||
WBUFW(buf,10)=x;
|
||||
WBUFW(buf,12)=y;
|
||||
WBUFL(buf,14)=tick;
|
||||
WBUFL(buf,14)=client_tick(tick);
|
||||
if(disguised(src)) {
|
||||
clif_send(buf,packet_len(0x117),src,AREA_WOS);
|
||||
WBUFL(buf,4)=-src->id;
|
||||
@ -5975,7 +5980,7 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id
|
||||
/// @param val1
|
||||
/// @param val2
|
||||
/// @param val3
|
||||
void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, int tick, int val1, int val2, int val3, enum send_target target_type)
|
||||
void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, t_tick tick, int val1, int val2, int val3, enum send_target target_type)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
@ -6005,8 +6010,8 @@ void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, i
|
||||
if (tick <= 0)
|
||||
tick = 9999; // this is indeed what official servers do
|
||||
|
||||
WBUFL(buf,9) = tick;/* at this stage remain and total are the same value I believe */
|
||||
WBUFL(buf,13) = tick;
|
||||
WBUFL(buf,9) = client_tick(tick);/* at this stage remain and total are the same value I believe */
|
||||
WBUFL(buf,13) = client_tick(tick);
|
||||
WBUFL(buf,17) = val1;
|
||||
WBUFL(buf,21) = val2;
|
||||
WBUFL(buf,25) = val3;
|
||||
@ -6016,7 +6021,7 @@ void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, i
|
||||
if (tick <= 0)
|
||||
tick = 9999; // this is indeed what official servers do
|
||||
|
||||
WBUFL(buf,9) = tick;
|
||||
WBUFL(buf,9) = client_tick(tick);
|
||||
WBUFL(buf,13) = val1;
|
||||
WBUFL(buf,17) = val2;
|
||||
WBUFL(buf,21) = val3;
|
||||
@ -6034,7 +6039,7 @@ void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, i
|
||||
* @param val2
|
||||
* @param val3
|
||||
*/
|
||||
void clif_status_change(struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3) {
|
||||
void clif_status_change(struct block_list *bl, int type, int flag, t_tick tick, int val1, int val2, int val3) {
|
||||
struct map_session_data *sd = NULL;
|
||||
|
||||
if (type == EFST_BLANK) //It shows nothing on the client...
|
||||
@ -6095,7 +6100,7 @@ void clif_efst_status_change_sub(struct block_list *tbl, struct block_list *bl,
|
||||
enum sc_type type = sc_display[i]->type;
|
||||
struct status_change *sc = status_get_sc(bl);
|
||||
const struct TimerData *td = (sc && sc->data[type] ? get_timer(sc->data[type]->timer) : NULL);
|
||||
int tick = 0;
|
||||
t_tick tick = 0;
|
||||
|
||||
if (td)
|
||||
tick = DIFF_TICK(td->tick, gettick());
|
||||
@ -6119,7 +6124,7 @@ void clif_efst_status_change_sub(struct block_list *tbl, struct block_list *bl,
|
||||
/// Notifies the client when a player enters the screen with an active EFST.
|
||||
/// 08ff <id>.L <index>.W <remain msec>.L { <val>.L }*3 (ZC_EFST_SET_ENTER) (PACKETVER >= 20111108)
|
||||
/// 0984 <id>.L <index>.W <total msec>.L <remain msec>.L { <val>.L }*3 (ZC_EFST_SET_ENTER2) (PACKETVER >= 20120618)
|
||||
void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, int tick, int val1, int val2, int val3) {
|
||||
void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, t_tick tick, int val1, int val2, int val3) {
|
||||
#if PACKETVER >= 20111108
|
||||
unsigned char buf[32];
|
||||
#if PACKETVER >= 20120618
|
||||
@ -6141,9 +6146,9 @@ void clif_efst_status_change(struct block_list *bl, int tid, enum send_target ta
|
||||
WBUFL(buf,offset + 2) = tid;
|
||||
WBUFW(buf,offset + 6) = type;
|
||||
#if PACKETVER >= 20111108
|
||||
WBUFL(buf,offset + 8) = tick; // Set remaining status duration [exneval]
|
||||
WBUFL(buf,offset + 8) = client_tick(tick); // Set remaining status duration [exneval]
|
||||
#if PACKETVER >= 20120618
|
||||
WBUFL(buf,offset + 12) = tick;
|
||||
WBUFL(buf,offset + 12) = client_tick(tick);
|
||||
offset += 4;
|
||||
#endif
|
||||
WBUFL(buf,offset + 12) = val1;
|
||||
@ -8118,7 +8123,7 @@ void clif_spiritball(struct block_list *bl) {
|
||||
|
||||
/// Notifies clients in area of a character's combo delay (ZC_COMBODELAY).
|
||||
/// 01d2 <account id>.L <delay>.L
|
||||
void clif_combo_delay(struct block_list *bl,int wait)
|
||||
void clif_combo_delay(struct block_list *bl,t_tick wait)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
@ -8126,7 +8131,7 @@ void clif_combo_delay(struct block_list *bl,int wait)
|
||||
|
||||
WBUFW(buf,0)=0x1d2;
|
||||
WBUFL(buf,2)=bl->id;
|
||||
WBUFL(buf,6)=wait;
|
||||
WBUFL(buf,6)=client_tick(wait);
|
||||
clif_send(buf,packet_len(0x1d2),bl,AREA);
|
||||
}
|
||||
|
||||
@ -10190,7 +10195,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd)
|
||||
struct block_list* bl;
|
||||
struct auth_node* node;
|
||||
int cmd, account_id, char_id, login_id1, sex, err;
|
||||
unsigned int client_tick; //The client tick is a tick, therefore it needs be unsigned. [Skotlex]
|
||||
t_tick client_tick; //The client tick is a tick, therefore it needs be unsigned. [Skotlex]
|
||||
|
||||
if (sd) {
|
||||
ShowError("clif_parse_WantToConnection : invalid request (character already logged in)\n");
|
||||
@ -10678,13 +10683,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
||||
|
||||
/// Server's tick (ZC_NOTIFY_TIME).
|
||||
/// 007f <time>.L
|
||||
void clif_notify_time(struct map_session_data* sd, unsigned long time)
|
||||
void clif_notify_time(struct map_session_data* sd, t_tick time)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
|
||||
WFIFOHEAD(fd,packet_len(0x7f));
|
||||
WFIFOW(fd,0) = 0x7f;
|
||||
WFIFOL(fd,2) = time;
|
||||
WFIFOL(fd,2) = client_tick(time);
|
||||
WFIFOSET(fd,packet_len(0x7f));
|
||||
}
|
||||
|
||||
@ -10793,7 +10798,8 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd)
|
||||
if( gettick() < sd->progressbar.timeout && sd->st )
|
||||
sd->st->state = END;
|
||||
|
||||
sd->progressbar.npc_id = sd->progressbar.timeout = 0;
|
||||
sd->progressbar.npc_id = 0;
|
||||
sd->progressbar.timeout = 0;
|
||||
sd->state.workinprogress = WIP_DISABLE_NONE;
|
||||
npc_scriptcont(sd, npc_id, false);
|
||||
}
|
||||
@ -10808,7 +10814,7 @@ void clif_progressbar_npc( struct npc_data *nd, struct map_session_data* sd ){
|
||||
WBUFW(buf,0) = 0x9d1;
|
||||
WBUFL(buf,2) = nd->bl.id;
|
||||
WBUFL(buf,6) = nd->progressbar.color;
|
||||
WBUFL(buf,10) = ( nd->progressbar.timeout - gettick() ) / 1000;
|
||||
WBUFL(buf,10) = client_tick( ( nd->progressbar.timeout - gettick() ) / 1000 );
|
||||
|
||||
if( sd ){
|
||||
clif_send(buf, packet_len(0x9d1), &sd->bl, SELF);
|
||||
@ -11108,7 +11114,7 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
|
||||
}
|
||||
|
||||
|
||||
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick)
|
||||
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, t_tick tick)
|
||||
{
|
||||
if (pc_isdead(sd)) {
|
||||
clif_clearunit_area(&sd->bl, CLR_DEAD);
|
||||
@ -12076,7 +12082,7 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd)
|
||||
pc_skillup(sd,RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]));
|
||||
}
|
||||
|
||||
static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
|
||||
static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, int target_id)
|
||||
{
|
||||
int lv;
|
||||
|
||||
@ -12104,7 +12110,7 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_sess
|
||||
unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv);
|
||||
}
|
||||
|
||||
static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
|
||||
static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
|
||||
{
|
||||
int lv;
|
||||
if( !hd )
|
||||
@ -12131,7 +12137,7 @@ static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_ses
|
||||
unit_skilluse_pos(&hd->bl, x, y, skill_id, skill_lv);
|
||||
}
|
||||
|
||||
static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
|
||||
static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, int target_id)
|
||||
{
|
||||
int lv;
|
||||
|
||||
@ -12155,7 +12161,7 @@ static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct
|
||||
unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv);
|
||||
}
|
||||
|
||||
static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
|
||||
static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, t_tick tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
|
||||
{
|
||||
int lv;
|
||||
if( !md )
|
||||
@ -12189,7 +12195,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
||||
{
|
||||
uint16 skill_id, skill_lv;
|
||||
int inf,target_id;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
|
||||
skill_lv = RFIFOW(fd,info->pos[0]);
|
||||
@ -12296,7 +12302,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
||||
*------------------------------------------*/
|
||||
static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo)
|
||||
{
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
|
||||
if( !(skill_get_inf(skill_id)&INF_GROUND_SKILL) )
|
||||
return; //Using a target skill on the ground? WRONG.
|
||||
@ -16599,7 +16605,7 @@ void clif_bossmapinfo(struct map_session_data *sd, struct mob_data *md, enum e_b
|
||||
unsigned int seconds;
|
||||
int hours, minutes;
|
||||
|
||||
seconds = DIFF_TICK(timer_data->tick, gettick()) / 1000 + 60;
|
||||
seconds = (unsigned int)(DIFF_TICK(timer_data->tick, gettick()) / 1000 + 60);
|
||||
hours = seconds / (60 * 60);
|
||||
seconds = seconds - (60 * 60 * hours);
|
||||
minutes = seconds / 60;
|
||||
@ -17106,7 +17112,7 @@ void clif_mercenary_info(struct map_session_data *sd)
|
||||
WFIFOL(fd,52) = status->max_hp;
|
||||
WFIFOL(fd,56) = status->sp;
|
||||
WFIFOL(fd,60) = status->max_sp;
|
||||
WFIFOL(fd,64) = (int)time(NULL) + (mercenary_get_lifetime(md) / 1000);
|
||||
WFIFOL(fd,64) = client_tick(time(NULL) + (mercenary_get_lifetime(md) / 1000));
|
||||
WFIFOW(fd,68) = mercenary_get_faith(md);
|
||||
WFIFOL(fd,70) = mercenary_get_calls(md);
|
||||
WFIFOL(fd,74) = md->mercenary.kill_count;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "../common/cbasetypes.hpp"
|
||||
#include "../common/db.hpp" //dbmap
|
||||
#include "../common/mmo.hpp"
|
||||
#include "../common/timer.hpp" // t_tick
|
||||
|
||||
struct Channel;
|
||||
struct clan;
|
||||
@ -569,7 +570,7 @@ void clif_clearflooritem(struct flooritem_data *fitem, int fd);
|
||||
|
||||
void clif_clearunit_single(int id, clr_type type, int fd);
|
||||
void clif_clearunit_area(struct block_list* bl, clr_type type);
|
||||
void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int tick);
|
||||
void clif_clearunit_delayed(struct block_list* bl, clr_type type, t_tick tick);
|
||||
int clif_spawn(struct block_list *bl); //area
|
||||
void clif_walkok(struct map_session_data *sd); // self
|
||||
void clif_move(struct unit_data *ud); //area
|
||||
@ -598,7 +599,7 @@ void clif_dropitem(struct map_session_data *sd,int n,int amount); //self
|
||||
void clif_delitem(struct map_session_data *sd,int n,int amount, short reason); //self
|
||||
void clif_updatestatus(struct map_session_data *sd,int type); //self
|
||||
void clif_changestatus(struct map_session_data* sd,int type,int val); //area
|
||||
int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage); // area
|
||||
int clif_damage(struct block_list* src, struct block_list* dst, t_tick tick, int sdelay, int ddelay, int64 sdamage, int div, enum e_damage_type type, int64 sdamage2, bool spdamage); // area
|
||||
void clif_takeitem(struct block_list* src, struct block_list* dst);
|
||||
void clif_sitting(struct block_list* bl);
|
||||
void clif_standing(struct block_list* bl);
|
||||
@ -637,7 +638,7 @@ void clif_callpartner(struct map_session_data *sd);
|
||||
void clif_playBGM(struct map_session_data* sd, const char* name);
|
||||
void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type);
|
||||
void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage);
|
||||
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick);
|
||||
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, t_tick tick);
|
||||
void clif_parse_LoadEndAck(int fd,struct map_session_data *sd);
|
||||
void clif_hotkeys_send(struct map_session_data *sd);
|
||||
|
||||
@ -674,11 +675,11 @@ void clif_deleteskill(struct map_session_data *sd, int skill_id);
|
||||
void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime);
|
||||
void clif_skillcastcancel(struct block_list* bl);
|
||||
void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype);
|
||||
void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick);
|
||||
int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
|
||||
//int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
|
||||
int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail);
|
||||
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,int tick);
|
||||
void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick);
|
||||
int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
|
||||
//int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
|
||||
bool clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,t_tick tick);
|
||||
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,t_tick tick);
|
||||
void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst);
|
||||
void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
|
||||
void clif_skill_memomessage(struct map_session_data* sd, int type);
|
||||
@ -695,13 +696,13 @@ void clif_skillunit_update(struct block_list* bl);
|
||||
void clif_autospell(struct map_session_data *sd,uint16 skill_lv);
|
||||
void clif_devotion(struct block_list *src, struct map_session_data *tsd);
|
||||
void clif_spiritball(struct block_list *bl);
|
||||
void clif_combo_delay(struct block_list *bl,int wait);
|
||||
void clif_combo_delay(struct block_list *bl,t_tick wait);
|
||||
void clif_bladestop(struct block_list *src, int dst_id, int active);
|
||||
void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target);
|
||||
|
||||
#define clif_status_load(bl, type, flag) clif_status_change((bl), (type), (flag), 0, 0, 0, 0)
|
||||
void clif_status_change(struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3);
|
||||
void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, int tick, int val1, int val2, int val3);
|
||||
void clif_status_change(struct block_list *bl, int type, int flag, t_tick tick, int val1, int val2, int val3);
|
||||
void clif_efst_status_change(struct block_list *bl, int tid, enum send_target target, int type, t_tick tick, int val1, int val2, int val3);
|
||||
void clif_efst_status_change_sub(struct block_list *tbl, struct block_list *bl, enum send_target target);
|
||||
|
||||
void clif_wis_message(struct map_session_data* sd, const char* nick, const char* mes, int mes_len, int gmlvl);
|
||||
|
@ -130,7 +130,7 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet
|
||||
return 1;
|
||||
}
|
||||
|
||||
int elemental_get_lifetime(struct elemental_data *ed) {
|
||||
t_tick elemental_get_lifetime(struct elemental_data *ed) {
|
||||
const struct TimerData * td;
|
||||
if( ed == NULL || ed->summon_timer == INVALID_TIMER )
|
||||
return 0;
|
||||
@ -385,7 +385,7 @@ int elemental_clean_effect(struct elemental_data *ed) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick) {
|
||||
int elemental_action(struct elemental_data *ed, struct block_list *bl, t_tick tick) {
|
||||
struct skill_condition req;
|
||||
uint16 skill_id, skill_lv;
|
||||
int i;
|
||||
@ -429,9 +429,9 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned
|
||||
ed->ud.skill_lv = skill_lv;
|
||||
|
||||
if( skill_get_inf(skill_id) & INF_GROUND_SKILL )
|
||||
ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_pos, ed->bl.id, 0 );
|
||||
ed->ud.skilltimer = add_timer( tick+(t_tick)status_get_speed(&ed->bl)*walk_dist, skill_castend_pos, ed->bl.id, 0 );
|
||||
else
|
||||
ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_id, ed->bl.id, 0 );
|
||||
ed->ud.skilltimer = add_timer( tick+(t_tick)status_get_speed(&ed->bl)*walk_dist, skill_castend_id, ed->bl.id, 0 );
|
||||
}
|
||||
return 1;
|
||||
|
||||
@ -633,7 +633,7 @@ static int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, unsigned int tick) {
|
||||
static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, t_tick tick) {
|
||||
struct block_list *target = NULL;
|
||||
int master_dist, view_range;
|
||||
enum e_mode mode;
|
||||
@ -744,7 +744,7 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_
|
||||
}
|
||||
|
||||
static int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) {
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,t_tick);
|
||||
if(sd->status.ele_id && sd->ed)
|
||||
elemental_ai_sub_timer(sd->ed,sd,tick);
|
||||
|
||||
|
@ -73,7 +73,7 @@ struct elemental_data {
|
||||
int summon_timer;
|
||||
int skill_timer;
|
||||
|
||||
unsigned last_thinktime, last_linktime, last_spdrain_time;
|
||||
t_tick last_thinktime, last_linktime, last_spdrain_time;
|
||||
short min_chase;
|
||||
int target_id, attacked_id;
|
||||
};
|
||||
@ -94,14 +94,14 @@ int elemental_dead(struct elemental_data *ed);
|
||||
int elemental_delete(struct elemental_data *ed);
|
||||
void elemental_summon_stop(struct elemental_data *ed);
|
||||
|
||||
int elemental_get_lifetime(struct elemental_data *ed);
|
||||
t_tick elemental_get_lifetime(struct elemental_data *ed);
|
||||
|
||||
int elemental_unlocktarget(struct elemental_data *ed);
|
||||
bool elemental_skillnotok(uint16 skill_id, struct elemental_data *ed);
|
||||
int elemental_set_target( struct map_session_data *sd, struct block_list *bl );
|
||||
int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id);
|
||||
int elemental_clean_effect(struct elemental_data *ed);
|
||||
int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick);
|
||||
int elemental_action(struct elemental_data *ed, struct block_list *bl, t_tick tick);
|
||||
struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv);
|
||||
|
||||
#define elemental_stop_walking(ed, type) unit_stop_walking(&(ed)->bl, type)
|
||||
|
@ -418,7 +418,7 @@ int map_delblock(struct block_list* bl)
|
||||
* @param tick : when this was scheduled
|
||||
* @return 0:success, 1:fail
|
||||
*/
|
||||
int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
|
||||
int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick)
|
||||
{
|
||||
int x0 = bl->x, y0 = bl->y;
|
||||
struct status_change *sc = NULL;
|
||||
|
@ -399,7 +399,7 @@ struct flooritem_data {
|
||||
unsigned char subx,suby;
|
||||
int cleartimer;
|
||||
int first_get_charid,second_get_charid,third_get_charid;
|
||||
unsigned int first_get_tick,second_get_tick,third_get_tick;
|
||||
t_tick first_get_tick,second_get_tick,third_get_tick;
|
||||
struct item item;
|
||||
unsigned short mob_id; ///< ID of monster who dropped it. 0 for non-monster who dropped it.
|
||||
};
|
||||
@ -1001,7 +1001,7 @@ int map_freeblock_unlock(void);
|
||||
// blocklist manipulation
|
||||
int map_addblock(struct block_list* bl);
|
||||
int map_delblock(struct block_list* bl);
|
||||
int map_moveblock(struct block_list *, int, int, unsigned int);
|
||||
int map_moveblock(struct block_list *, int, int, t_tick);
|
||||
int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
|
||||
int map_foreachinallrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
|
||||
int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
|
||||
|
@ -106,7 +106,7 @@ bool mercenary_create(struct map_session_data *sd, uint16 class_, unsigned int l
|
||||
* @param md The Mercenary
|
||||
* @return The Lifetime
|
||||
**/
|
||||
int mercenary_get_lifetime(struct mercenary_data *md) {
|
||||
t_tick mercenary_get_lifetime(struct mercenary_data *md) {
|
||||
const struct TimerData * td;
|
||||
if( md == NULL || md->contract_timer == INVALID_TIMER )
|
||||
return 0;
|
||||
|
@ -72,7 +72,7 @@ bool mercenary_dead(struct mercenary_data *md);
|
||||
int mercenary_delete(struct mercenary_data *md, int reply);
|
||||
void mercenary_contract_stop(struct mercenary_data *md);
|
||||
|
||||
int mercenary_get_lifetime(struct mercenary_data *md);
|
||||
t_tick mercenary_get_lifetime(struct mercenary_data *md);
|
||||
enum e_MercGuildType mercenary_get_guild(struct mercenary_data *md);
|
||||
int mercenary_get_faith(struct mercenary_data *md);
|
||||
void mercenary_set_faith(struct mercenary_data *md, int value);
|
||||
|
@ -537,7 +537,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
|
||||
*sd, // Source
|
||||
*t_sd; // Mob Target
|
||||
struct mob_data *md;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
|
||||
if( !battle_config.ksprotection )
|
||||
return false; // KS Protection Disabled
|
||||
@ -996,7 +996,7 @@ int mob_linksearch(struct block_list *bl,va_list ap)
|
||||
struct mob_data *md;
|
||||
int mob_id;
|
||||
struct block_list *target;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
|
||||
nullpo_ret(bl);
|
||||
md=(struct mob_data *)bl;
|
||||
@ -1097,8 +1097,7 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
|
||||
int mob_spawn (struct mob_data *md)
|
||||
{
|
||||
int i=0;
|
||||
unsigned int tick = gettick();
|
||||
int c =0;
|
||||
t_tick tick = gettick();
|
||||
|
||||
md->last_thinktime = tick;
|
||||
if (md->bl.prev != NULL)
|
||||
@ -1160,7 +1159,9 @@ int mob_spawn (struct mob_data *md)
|
||||
md->dmgtick = tick - 5000;
|
||||
md->last_pcneartime = 0;
|
||||
|
||||
for (i = 0, c = tick-MOB_MAX_DELAY; i < MAX_MOBSKILL; i++)
|
||||
t_tick c = tick - MOB_MAX_DELAY;
|
||||
|
||||
for (i = 0; i < MAX_MOBSKILL; i++)
|
||||
md->skilldelay[i] = c;
|
||||
for (i = 0; i < DAMAGELOG_SIZE; i++)
|
||||
md->spotted_log[i] = 0;
|
||||
@ -1416,7 +1417,7 @@ static int mob_warpchase_sub(struct block_list *bl,va_list ap) {
|
||||
/*==========================================
|
||||
* Processing of slave monsters
|
||||
*------------------------------------------*/
|
||||
static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
|
||||
static int mob_ai_sub_hard_slavemob(struct mob_data *md,t_tick tick)
|
||||
{
|
||||
struct block_list *bl;
|
||||
|
||||
@ -1502,7 +1503,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
|
||||
* when trying to pick new targets when the current chosen target is
|
||||
* unreachable.
|
||||
*------------------------------------------*/
|
||||
int mob_unlocktarget(struct mob_data *md, unsigned int tick)
|
||||
int mob_unlocktarget(struct mob_data *md, t_tick tick)
|
||||
{
|
||||
nullpo_ret(md);
|
||||
|
||||
@ -1551,7 +1552,7 @@ int mob_unlocktarget(struct mob_data *md, unsigned int tick)
|
||||
/*==========================================
|
||||
* Random walk
|
||||
*------------------------------------------*/
|
||||
int mob_randomwalk(struct mob_data *md,unsigned int tick)
|
||||
int mob_randomwalk(struct mob_data *md,t_tick tick)
|
||||
{
|
||||
const int d=7;
|
||||
int i,c,r,rdir,dx,dy,max;
|
||||
@ -1672,7 +1673,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
|
||||
/*==========================================
|
||||
* AI of MOB whose is near a Player
|
||||
*------------------------------------------*/
|
||||
static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
|
||||
static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick)
|
||||
{
|
||||
struct block_list *tbl = nullptr, *abl = nullptr;
|
||||
enum e_mode mode;
|
||||
@ -1967,7 +1968,7 @@ static int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
|
||||
{
|
||||
struct mob_data *md = (struct mob_data*)bl;
|
||||
uint32 char_id = va_arg(ap, uint32);
|
||||
unsigned int tick = va_arg(ap, unsigned int);
|
||||
t_tick tick = va_arg(ap, t_tick);
|
||||
if (mob_ai_sub_hard(md, tick))
|
||||
{ //Hard AI triggered.
|
||||
mob_add_spotted(md, char_id);
|
||||
@ -1981,8 +1982,7 @@ static int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
|
||||
*------------------------------------------*/
|
||||
static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
|
||||
{
|
||||
unsigned int tick;
|
||||
tick=va_arg(ap,unsigned int);
|
||||
t_tick tick=va_arg(ap,t_tick);
|
||||
map_foreachinallrange(mob_ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB, sd->status.char_id, tick);
|
||||
|
||||
return 0;
|
||||
@ -1993,14 +1993,12 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
|
||||
*------------------------------------------*/
|
||||
static int mob_ai_sub_lazy(struct mob_data *md, va_list args)
|
||||
{
|
||||
unsigned int tick;
|
||||
|
||||
nullpo_ret(md);
|
||||
|
||||
if(md->bl.prev == NULL)
|
||||
return 0;
|
||||
|
||||
tick = va_arg(args,unsigned int);
|
||||
t_tick tick = va_arg(args,t_tick);
|
||||
|
||||
if (battle_config.mob_ai&0x20 && map_getmapdata(md->bl.m)->users>0)
|
||||
return (int)mob_ai_sub_hard(md, tick);
|
||||
@ -2435,7 +2433,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
||||
} pt[DAMAGELOG_SIZE];
|
||||
int i, temp, count, m = md->bl.m;
|
||||
int dmgbltypes = 0; // bitfield of all bl types, that caused damage to the mob and are elligible for exp distribution
|
||||
unsigned int mvp_damage, tick = gettick();
|
||||
unsigned int mvp_damage;
|
||||
t_tick tick = gettick();
|
||||
bool rebirth, homkillonly;
|
||||
|
||||
status = &md->status;
|
||||
@ -3054,7 +3053,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
||||
*/
|
||||
void mob_revive(struct mob_data *md, unsigned int hp)
|
||||
{
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
md->state.skillstate = MSS_IDLE;
|
||||
md->last_thinktime = tick;
|
||||
md->next_walktime = tick+rnd()%1000+MIN_RANDOMWALKTIME;
|
||||
@ -3197,8 +3196,8 @@ void mob_add_spawn(uint16 mob_id, const struct spawn_info& new_spawn)
|
||||
*------------------------------------------*/
|
||||
int mob_class_change (struct mob_data *md, int mob_id)
|
||||
{
|
||||
unsigned int tick = gettick();
|
||||
int i, c, hp_rate;
|
||||
t_tick tick = gettick();
|
||||
int i, hp_rate;
|
||||
|
||||
nullpo_ret(md);
|
||||
|
||||
@ -3249,7 +3248,9 @@ int mob_class_change (struct mob_data *md, int mob_id)
|
||||
if(md->status.hp < 1) md->status.hp = 1;
|
||||
}
|
||||
|
||||
for(i=0,c=tick-MOB_MAX_DELAY;i<MAX_MOBSKILL;i++)
|
||||
t_tick c = tick - MOB_MAX_DELAY;
|
||||
|
||||
for(i=0;i<MAX_MOBSKILL;i++)
|
||||
md->skilldelay[i] = c;
|
||||
|
||||
if (md->lootitems == NULL && status_has_mode(&md->db->status,MD_LOOTER))
|
||||
@ -3540,7 +3541,7 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2)
|
||||
/*==========================================
|
||||
* Skill use judging
|
||||
*------------------------------------------*/
|
||||
int mobskill_use(struct mob_data *md, unsigned int tick, int event)
|
||||
int mobskill_use(struct mob_data *md, t_tick tick, int event)
|
||||
{
|
||||
struct mob_skill *ms;
|
||||
struct block_list *fbl = NULL; //Friend bl, which can either be a BL_PC or BL_MOB depending on the situation. [Skotlex]
|
||||
@ -3765,7 +3766,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
|
||||
/*==========================================
|
||||
* Skill use event processing
|
||||
*------------------------------------------*/
|
||||
int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tick, int flag)
|
||||
int mobskill_event(struct mob_data *md, struct block_list *src, t_tick tick, int flag)
|
||||
{
|
||||
int target_id, res = 0;
|
||||
|
||||
|
@ -220,7 +220,7 @@ struct mob_data {
|
||||
int areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
|
||||
unsigned int bg_id; // BattleGround System
|
||||
|
||||
unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime,dmgtick;
|
||||
t_tick next_walktime,last_thinktime,last_linktime,last_pcneartime,dmgtick;
|
||||
short move_fail_count;
|
||||
short lootitem_count;
|
||||
short min_chase;
|
||||
@ -230,7 +230,7 @@ struct mob_data {
|
||||
int master_id,master_dist;
|
||||
|
||||
int8 skill_idx; // Index of last used skill from db->skill[]
|
||||
unsigned int skilldelay[MAX_MOBSKILL];
|
||||
t_tick skilldelay[MAX_MOBSKILL];
|
||||
char npc_event[EVENT_NAME_LENGTH];
|
||||
/**
|
||||
* Did this monster summon something?
|
||||
@ -321,10 +321,10 @@ int mob_spawn_guardian(const char* mapname, int16 x, int16 y, const char* mobnam
|
||||
int mob_spawn_bg(const char* mapname, int16 x, int16 y, const char* mobname, int mob_id, const char* event, unsigned int bg_id);
|
||||
int mob_guardian_guildchange(struct mob_data *md); //Change Guardian's ownership. [Skotlex]
|
||||
|
||||
int mob_randomwalk(struct mob_data *md,unsigned int tick);
|
||||
int mob_randomwalk(struct mob_data *md,t_tick tick);
|
||||
int mob_warpchase(struct mob_data *md, struct block_list *target);
|
||||
int mob_target(struct mob_data *md,struct block_list *bl,int dist);
|
||||
int mob_unlocktarget(struct mob_data *md, unsigned int tick);
|
||||
int mob_unlocktarget(struct mob_data *md, t_tick tick);
|
||||
struct mob_data* mob_spawn_dataset(struct spawn_data *data);
|
||||
int mob_spawn(struct mob_data *md);
|
||||
TIMER_FUNC(mob_delayspawn);
|
||||
@ -353,8 +353,8 @@ int mob_class_change(struct mob_data *md,int mob_id);
|
||||
int mob_warpslave(struct block_list *bl, int range);
|
||||
int mob_linksearch(struct block_list *bl,va_list ap);
|
||||
|
||||
int mobskill_use(struct mob_data *md,unsigned int tick,int event);
|
||||
int mobskill_event(struct mob_data *md,struct block_list *src,unsigned int tick, int flag);
|
||||
int mobskill_use(struct mob_data *md,t_tick tick,int event);
|
||||
int mobskill_event(struct mob_data *md,struct block_list *src,t_tick tick, int flag);
|
||||
int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id);
|
||||
int mob_countslave(struct block_list *bl);
|
||||
int mob_count_sub(struct block_list *bl, va_list ap);
|
||||
|
@ -276,7 +276,7 @@ struct npc_data* npc_name2id(const char* name)
|
||||
TIMER_FUNC(npc_secure_timeout_timer){
|
||||
struct map_session_data* sd = NULL;
|
||||
unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
|
||||
int cur_tick = gettick(); //ensure we are on last tick
|
||||
t_tick cur_tick = gettick(); //ensure we are on last tick
|
||||
|
||||
if ((sd = map_id2sd(id)) == NULL || !sd->npc_id || sd->state.ignoretimeout) {
|
||||
if (sd)
|
||||
@ -581,8 +581,9 @@ struct timer_event_data {
|
||||
* triger 'OnTimerXXXX' events
|
||||
*------------------------------------------*/
|
||||
TIMER_FUNC(npc_timerevent){
|
||||
int old_rid, old_timer;
|
||||
unsigned int old_tick;
|
||||
int old_rid;
|
||||
t_tick old_timer;
|
||||
t_tick old_tick;
|
||||
struct npc_data* nd=(struct npc_data *)map_id2bl(id);
|
||||
struct npc_timerevent_list *te;
|
||||
struct timer_event_data *ted = (struct timer_event_data*)data;
|
||||
@ -654,7 +655,7 @@ TIMER_FUNC(npc_timerevent){
|
||||
int npc_timerevent_start(struct npc_data* nd, int rid)
|
||||
{
|
||||
int j;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct map_session_data *sd = NULL; //Player to whom script is attached.
|
||||
|
||||
nullpo_ret(nd);
|
||||
@ -679,7 +680,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
|
||||
|
||||
if (j < nd->u.scr.timeramount)
|
||||
{
|
||||
int next;
|
||||
t_tick next;
|
||||
struct timer_event_data *ted;
|
||||
// Arrange for the next event
|
||||
ted = ers_alloc(timer_event_ers, struct timer_event_data);
|
||||
@ -784,8 +785,9 @@ void npc_timerevent_quit(struct map_session_data* sd)
|
||||
}
|
||||
if( ev )
|
||||
{
|
||||
int old_rid,old_timer;
|
||||
unsigned int old_tick;
|
||||
int old_rid;
|
||||
t_tick old_timer;
|
||||
t_tick old_tick;
|
||||
|
||||
//Set timer related info.
|
||||
old_rid = (nd->u.scr.rid == sd->bl.id ? 0 : nd->u.scr.rid); // Detach rid if the last attached player logged off.
|
||||
@ -812,9 +814,9 @@ void npc_timerevent_quit(struct map_session_data* sd)
|
||||
* Get the tick value of an NPC timer
|
||||
* If it's stopped, return stopped time
|
||||
*------------------------------------------*/
|
||||
int npc_gettimerevent_tick(struct npc_data* nd)
|
||||
t_tick npc_gettimerevent_tick(struct npc_data* nd)
|
||||
{
|
||||
int tick;
|
||||
t_tick tick;
|
||||
nullpo_ret(nd);
|
||||
|
||||
// TODO: Get player attached timer's tick. Now we can just get it by using 'getnpctimer' inside OnTimer event.
|
||||
|
@ -69,8 +69,9 @@ struct npc_data {
|
||||
struct script_code *script;
|
||||
short xs,ys; // OnTouch area radius
|
||||
int guild_id;
|
||||
int timer,timerid,timeramount,rid;
|
||||
unsigned int timertick;
|
||||
t_tick timer;
|
||||
int timerid,timeramount,rid;
|
||||
t_tick timertick;
|
||||
struct npc_timerevent_list *timer_event;
|
||||
int label_list_num;
|
||||
struct npc_label_list *label_list;
|
||||
@ -99,7 +100,7 @@ struct npc_data {
|
||||
unsigned char sc_display_count;
|
||||
|
||||
struct {
|
||||
unsigned int timeout;
|
||||
t_tick timeout;
|
||||
unsigned long color;
|
||||
} progressbar;
|
||||
};
|
||||
@ -1220,7 +1221,7 @@ int npc_event_doall_id(const char* name, int rid);
|
||||
int npc_timerevent_start(struct npc_data* nd, int rid);
|
||||
int npc_timerevent_stop(struct npc_data* nd);
|
||||
void npc_timerevent_quit(struct map_session_data* sd);
|
||||
int npc_gettimerevent_tick(struct npc_data* nd);
|
||||
t_tick npc_gettimerevent_tick(struct npc_data* nd);
|
||||
int npc_settimerevent_tick(struct npc_data* nd, int newtimer);
|
||||
int npc_remove_map(struct npc_data* nd);
|
||||
void npc_unload_duplicates (struct npc_data* nd);
|
||||
|
@ -153,7 +153,7 @@ void pc_set_reg_load( bool val ){
|
||||
**/
|
||||
DBMap* itemcd_db = NULL; // char_id -> struct item_cd
|
||||
struct item_cd {
|
||||
unsigned int tick[MAX_ITEMDELAYS]; //tick
|
||||
t_tick tick[MAX_ITEMDELAYS]; //tick
|
||||
unsigned short nameid[MAX_ITEMDELAYS]; //item id
|
||||
};
|
||||
|
||||
@ -500,7 +500,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
|
||||
*/
|
||||
void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds)
|
||||
{
|
||||
unsigned int tick = seconds * 1000;
|
||||
t_tick tick = seconds * 1000;
|
||||
|
||||
if( sd == NULL )
|
||||
return;
|
||||
@ -514,7 +514,7 @@ void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds)
|
||||
sd->rental_timer = add_timer(gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
|
||||
}
|
||||
} else
|
||||
sd->rental_timer = add_timer(gettick() + umin(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
|
||||
sd->rental_timer = add_timer(gettick() + i64min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -644,7 +644,7 @@ void pc_makesavestatus(struct map_session_data *sd) {
|
||||
/*==========================================
|
||||
* Off init ? Connection?
|
||||
*------------------------------------------*/
|
||||
void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id, int login_id1, unsigned int client_tick, int sex, int fd) {
|
||||
void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id, int login_id1, t_tick client_tick, int sex, int fd) {
|
||||
nullpo_retv(sd);
|
||||
|
||||
sd->bl.id = account_id;
|
||||
@ -1138,7 +1138,7 @@ uint8 pc_isequip(struct map_session_data *sd,int n)
|
||||
bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers)
|
||||
{
|
||||
int i;
|
||||
unsigned long tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
uint32 ip = session[sd->fd]->client_addr;
|
||||
|
||||
sd->login_id2 = login_id2;
|
||||
@ -4711,7 +4711,7 @@ bool pc_dropitem(struct map_session_data *sd,int n,int amount)
|
||||
bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
|
||||
{
|
||||
int flag = 0;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct party_data *p = NULL;
|
||||
|
||||
nullpo_ret(sd);
|
||||
@ -4957,7 +4957,7 @@ bool pc_isUseitem(struct map_session_data *sd,int n)
|
||||
*------------------------------------------*/
|
||||
int pc_useitem(struct map_session_data *sd,int n)
|
||||
{
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int amount;
|
||||
unsigned short nameid;
|
||||
struct script_code *script;
|
||||
@ -7680,7 +7680,7 @@ void pc_close_npc(struct map_session_data *sd,int flag)
|
||||
int pc_dead(struct map_session_data *sd,struct block_list *src)
|
||||
{
|
||||
int i=0,k=0;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct map_data *mapdata = map_getmapdata(sd->bl.m);
|
||||
|
||||
// Activate Steel body if a super novice dies at 99+% exp [celest]
|
||||
@ -9509,7 +9509,7 @@ void pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick
|
||||
for(i=0;i<MAX_EVENTTIMER;i++)
|
||||
if( sd->eventtimer[i] != INVALID_TIMER && strcmp(
|
||||
(char *)(get_timer(sd->eventtimer[i])->data), name)==0 ){
|
||||
addtick_timer(sd->eventtimer[i],tick);
|
||||
addt_tickimer(sd->eventtimer[i],tick);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -10444,7 +10444,7 @@ struct map_session_data *pc_get_child (struct map_session_data *sd)
|
||||
/*==========================================
|
||||
* Set player sd to bleed. (losing hp and/or sp each diff_tick)
|
||||
*------------------------------------------*/
|
||||
void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick)
|
||||
void pc_bleeding (struct map_session_data *sd, t_tick diff_tick)
|
||||
{
|
||||
int hp = 0, sp = 0;
|
||||
|
||||
@ -10476,7 +10476,7 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick)
|
||||
//Character regen. Flag is used to know which types of regen can take place.
|
||||
//&1: HP regen
|
||||
//&2: SP regen
|
||||
void pc_regen (struct map_session_data *sd, unsigned int diff_tick)
|
||||
void pc_regen (struct map_session_data *sd, t_tick diff_tick)
|
||||
{
|
||||
int hp = 0, sp = 0;
|
||||
|
||||
@ -11598,7 +11598,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
|
||||
* @return 0: No delay, can consume item.
|
||||
* 1: Has delay, cancel consumption.
|
||||
**/
|
||||
uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, unsigned int tick, unsigned short n) {
|
||||
uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n) {
|
||||
int i;
|
||||
ARR_FIND(0, MAX_ITEMDELAYS, i, sd->item_delay[i].nameid == id->nameid );
|
||||
if( i == MAX_ITEMDELAYS ) /* item not found. try first empty now */
|
||||
@ -11606,7 +11606,7 @@ uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, unsigned
|
||||
if( i < MAX_ITEMDELAYS ) {
|
||||
if( sd->item_delay[i].nameid ) {// found
|
||||
if( DIFF_TICK(sd->item_delay[i].tick, tick) > 0 ) {
|
||||
int e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000;
|
||||
t_tick e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000;
|
||||
char e_msg[CHAT_SIZE_MAX];
|
||||
if( e_tick > 99 )
|
||||
sprintf(e_msg,msg_txt(sd,379), // Item Failed. [%s] is cooling down. Wait %.1f minutes.
|
||||
@ -11644,7 +11644,7 @@ uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, unsigned
|
||||
* @return 0: No delay, can consume item.
|
||||
* 1: Has delay, cancel consumption.
|
||||
**/
|
||||
uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, unsigned int tick, unsigned short n) {
|
||||
uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n) {
|
||||
struct status_change *sc = NULL;
|
||||
|
||||
nullpo_retr(0, sd);
|
||||
@ -11657,7 +11657,7 @@ uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, unsigne
|
||||
// Send reply of delay remains
|
||||
if (sc->data[id->delay_sc]) {
|
||||
const struct TimerData *timer = get_timer(sc->data[id->delay_sc]->timer);
|
||||
clif_msg_value(sd, ITEM_REUSE_LIMIT, timer ? DIFF_TICK(timer->tick, tick) / 1000 : 99);
|
||||
clif_msg_value(sd, ITEM_REUSE_LIMIT, (int)(timer ? DIFF_TICK(timer->tick, tick) / 1000 : 99));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -11952,7 +11952,7 @@ void pc_show_version(struct map_session_data *sd) {
|
||||
* @author [Cydh]
|
||||
**/
|
||||
void pc_bonus_script(struct map_session_data *sd) {
|
||||
int now = gettick();
|
||||
t_tick now = gettick();
|
||||
struct linkdb_node *node = NULL, *next = NULL;
|
||||
|
||||
if (!sd || !(node = sd->bonus_script.head))
|
||||
@ -11993,7 +11993,7 @@ void pc_bonus_script(struct map_session_data *sd) {
|
||||
* @return New created entry pointer or NULL if failed or NULL if duplicate fail
|
||||
* @author [Cydh]
|
||||
**/
|
||||
struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, const char *script_str, uint32 dur, enum efst_types icon, uint16 flag, uint8 type) {
|
||||
struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, const char *script_str, t_tick dur, enum efst_types icon, uint16 flag, uint8 type) {
|
||||
struct script_code *script = NULL;
|
||||
struct linkdb_node *node = NULL;
|
||||
struct s_bonus_script_entry *entry = NULL;
|
||||
@ -12011,9 +12011,9 @@ struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, co
|
||||
while (node) {
|
||||
entry = (struct s_bonus_script_entry *)node->data;
|
||||
if (strcmpi(script_str, StringBuf_Value(entry->script_buf)) == 0) {
|
||||
int newdur = gettick() + dur;
|
||||
t_tick newdur = gettick() + dur;
|
||||
if (flag&BSF_FORCE_REPLACE && entry->tick < newdur) { // Change duration
|
||||
settick_timer(entry->tid, newdur);
|
||||
sett_tickimer(entry->tid, newdur);
|
||||
script_free_code(script);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ struct s_autobonus {
|
||||
struct s_bonus_script_entry {
|
||||
struct script_code *script;
|
||||
StringBuf *script_buf; //Used for comparing and storing on table
|
||||
uint32 tick;
|
||||
t_tick tick;
|
||||
uint16 flag;
|
||||
enum efst_types icon;
|
||||
uint8 type; //0 - Ignore; 1 - Buff; 2 - Debuff
|
||||
@ -323,7 +323,7 @@ struct map_session_data {
|
||||
int fd;
|
||||
unsigned short mapindex;
|
||||
unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
|
||||
unsigned int client_tick;
|
||||
t_tick client_tick;
|
||||
int npc_id,areanpc_id,npc_shopid,touching_id; //for script follow scriptoid; ,npcid
|
||||
int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
|
||||
int npc_menu; // internal variable, used in npc menu handling
|
||||
@ -336,7 +336,7 @@ struct map_session_data {
|
||||
|
||||
struct s_progressbar {
|
||||
int npc_id;
|
||||
unsigned int timeout;
|
||||
t_tick timeout;
|
||||
} progressbar; //Progress Bar [Inkfish]
|
||||
|
||||
struct s_ignore {
|
||||
@ -359,18 +359,18 @@ struct map_session_data {
|
||||
int menuskill_id, menuskill_val, menuskill_val2;
|
||||
|
||||
int invincible_timer;
|
||||
unsigned int canlog_tick;
|
||||
unsigned int canuseitem_tick; // [Skotlex]
|
||||
unsigned int canusecashfood_tick;
|
||||
unsigned int canequip_tick; // [Inkfish]
|
||||
unsigned int cantalk_tick;
|
||||
unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files
|
||||
unsigned int cansendmail_tick; // [Mail System Flood Protection]
|
||||
unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
|
||||
t_tick canlog_tick;
|
||||
t_tick canuseitem_tick; // [Skotlex]
|
||||
t_tick canusecashfood_tick;
|
||||
t_tick canequip_tick; // [Inkfish]
|
||||
t_tick cantalk_tick;
|
||||
t_tick canskill_tick; // used to prevent abuse from no-delay ACT files
|
||||
t_tick cansendmail_tick; // [Mail System Flood Protection]
|
||||
t_tick ks_floodprotect_tick; // [Kill Steal Protection]
|
||||
|
||||
struct s_item_delay {
|
||||
unsigned short nameid;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
|
||||
|
||||
short weapontype1,weapontype2;
|
||||
@ -431,7 +431,7 @@ struct map_session_data {
|
||||
struct s_regen {
|
||||
short value;
|
||||
int rate;
|
||||
int tick;
|
||||
t_tick tick;
|
||||
} hp_loss, sp_loss, hp_regen, sp_regen, percent_hp_regen, percent_sp_regen;
|
||||
struct {
|
||||
short value;
|
||||
@ -638,7 +638,7 @@ struct map_session_data {
|
||||
* @info
|
||||
* - It is updated on every NPC iteration as mentioned above
|
||||
**/
|
||||
unsigned int npc_idle_tick;
|
||||
t_tick npc_idle_tick;
|
||||
/* */
|
||||
enum npc_timeout_type npc_idle_type;
|
||||
#endif
|
||||
@ -663,7 +663,7 @@ struct map_session_data {
|
||||
struct Channel *gcbind;
|
||||
bool stealth;
|
||||
unsigned char fontcolor;
|
||||
unsigned int *channel_tick;
|
||||
t_tick *channel_tick;
|
||||
|
||||
/* [Ind] */
|
||||
struct sc_display_entry **sc_display;
|
||||
@ -716,7 +716,7 @@ struct map_session_data {
|
||||
int8 prizeIdx;
|
||||
short prizeStage;
|
||||
bool claimPrize;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
} roulette;
|
||||
|
||||
unsigned short instance_id;
|
||||
@ -992,7 +992,7 @@ bool pc_should_log_commands(struct map_session_data *sd);
|
||||
void pc_setrestartvalue(struct map_session_data *sd, char type);
|
||||
void pc_makesavestatus(struct map_session_data *sd);
|
||||
void pc_respawn(struct map_session_data* sd, clr_type clrtype);
|
||||
void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id, int login_id1, unsigned int client_tick, int sex, int fd);
|
||||
void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id, int login_id1, t_tick client_tick, int sex, int fd);
|
||||
bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
|
||||
void pc_authfail(struct map_session_data *sd);
|
||||
void pc_reg_received(struct map_session_data *sd);
|
||||
@ -1193,8 +1193,8 @@ struct map_session_data *pc_get_father(struct map_session_data *sd);
|
||||
struct map_session_data *pc_get_mother(struct map_session_data *sd);
|
||||
struct map_session_data *pc_get_child(struct map_session_data *sd);
|
||||
|
||||
void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick);
|
||||
void pc_regen (struct map_session_data *sd, unsigned int diff_tick);
|
||||
void pc_bleeding (struct map_session_data *sd, t_tick diff_tick);
|
||||
void pc_regen (struct map_session_data *sd, t_tick diff_tick);
|
||||
|
||||
bool pc_setstand(struct map_session_data *sd, bool force);
|
||||
bool pc_candrop(struct map_session_data *sd,struct item *item);
|
||||
@ -1274,8 +1274,8 @@ bool pc_isautolooting(struct map_session_data *sd, unsigned short nameid);
|
||||
void pc_overheat(struct map_session_data *sd, int16 heat);
|
||||
|
||||
void pc_itemcd_do(struct map_session_data *sd, bool load);
|
||||
uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, unsigned int tick, unsigned short n);
|
||||
uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, unsigned int tick, unsigned short n);
|
||||
uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
|
||||
uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
|
||||
|
||||
int pc_load_combo(struct map_session_data *sd);
|
||||
|
||||
@ -1298,7 +1298,7 @@ void pc_show_version(struct map_session_data *sd);
|
||||
|
||||
TIMER_FUNC(pc_bonus_script_timer);
|
||||
void pc_bonus_script(struct map_session_data *sd);
|
||||
struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, const char *script_str, uint32 dur, enum efst_types icon, uint16 flag, uint8 type);
|
||||
struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, const char *script_str, t_tick dur, enum efst_types icon, uint16 flag, uint8 type);
|
||||
void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag);
|
||||
|
||||
void pc_cell_basilica(struct map_session_data *sd);
|
||||
|
@ -901,7 +901,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
|
||||
clif_pet_equip_area(pd);
|
||||
|
||||
if (battle_config.pet_equip_required) { // Skotlex: start support timers if need
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
|
||||
if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER) {
|
||||
if (pd->s_skill->id)
|
||||
@ -1038,7 +1038,7 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
|
||||
* @param tick : last walk time
|
||||
* @return 1:success, 0:failure
|
||||
*/
|
||||
static int pet_randomwalk(struct pet_data *pd,unsigned int tick)
|
||||
static int pet_randomwalk(struct pet_data *pd,t_tick tick)
|
||||
{
|
||||
nullpo_ret(pd);
|
||||
|
||||
@ -1097,7 +1097,7 @@ static int pet_randomwalk(struct pet_data *pd,unsigned int tick)
|
||||
* @param tick : last support time
|
||||
* @return 0
|
||||
*/
|
||||
static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned int tick)
|
||||
static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, t_tick tick)
|
||||
{
|
||||
struct block_list *target = NULL;
|
||||
|
||||
@ -1229,7 +1229,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
|
||||
*/
|
||||
static int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
|
||||
{
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,t_tick);
|
||||
|
||||
if(sd->status.pet_id && sd->pd)
|
||||
pet_ai_sub_hard(sd->pd,sd,tick);
|
||||
|
@ -114,7 +114,7 @@ struct pet_data {
|
||||
unsigned skillbonus : 1;
|
||||
} state;
|
||||
int move_fail_count;
|
||||
unsigned int next_walktime,last_thinktime;
|
||||
t_tick next_walktime,last_thinktime;
|
||||
unsigned short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
|
||||
|
||||
struct pet_recovery* recovery;
|
||||
|
@ -10773,7 +10773,7 @@ BUILDIN_FUNC(getnpctimer)
|
||||
struct npc_data *nd;
|
||||
TBL_PC *sd;
|
||||
int type = script_getnum(st,2);
|
||||
int val = 0;
|
||||
t_tick val = 0;
|
||||
|
||||
if( script_hasdata(st,3) )
|
||||
nd = npc_name2id(script_getstr(st,3));
|
||||
@ -11483,7 +11483,8 @@ BUILDIN_FUNC(sc_end_class)
|
||||
BUILDIN_FUNC(getscrate)
|
||||
{
|
||||
struct block_list *bl;
|
||||
int type,rate;
|
||||
int type;
|
||||
t_tick rate;
|
||||
|
||||
type=script_getnum(st,2);
|
||||
rate=script_getnum(st,3);
|
||||
@ -15174,7 +15175,7 @@ BUILDIN_FUNC(summon)
|
||||
const char *str,*event="";
|
||||
TBL_PC *sd;
|
||||
struct mob_data *md;
|
||||
int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
|
||||
if (!script_rid2sd(sd))
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
@ -320,9 +320,9 @@ int skill_graffitiremover(struct block_list *bl, va_list ap); // [Valaris]
|
||||
int skill_greed(struct block_list *bl, va_list ap);
|
||||
static int skill_cell_overlap(struct block_list *bl, va_list ap);
|
||||
static int skill_trap_splash(struct block_list *bl, va_list ap);
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl,struct skill_unit_group *sg,int tick);
|
||||
static int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int tick);
|
||||
int skill_unit_onleft(uint16 skill_id, struct block_list *bl,unsigned int tick);
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl,struct skill_unit_group *sg,t_tick tick);
|
||||
static int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,t_tick tick);
|
||||
int skill_unit_onleft(uint16 skill_id, struct block_list *bl,t_tick tick);
|
||||
static int skill_unit_effect(struct block_list *bl,va_list ap);
|
||||
static int skill_bind_trap(struct block_list *bl, va_list ap);
|
||||
|
||||
@ -1044,7 +1044,7 @@ static int skill_area_temp[8];
|
||||
/*==========================================
|
||||
* Add effect to skill when hit succesfully target
|
||||
*------------------------------------------*/
|
||||
int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, enum damage_lv dmg_lv, unsigned int tick)
|
||||
int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, enum damage_lv dmg_lv, t_tick tick)
|
||||
{
|
||||
struct map_session_data *sd, *dstsd;
|
||||
struct mob_data *md, *dstmd;
|
||||
@ -2196,7 +2196,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
|
||||
return 0;
|
||||
}
|
||||
|
||||
int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, unsigned int tick) {
|
||||
int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, t_tick tick) {
|
||||
struct block_list *tbl;
|
||||
|
||||
if( sd == NULL || !skill_id )
|
||||
@ -2294,7 +2294,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
|
||||
* type of skills, so not every instance of skill_additional_effect needs a call
|
||||
* to this one.
|
||||
*/
|
||||
int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, unsigned int tick)
|
||||
int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, t_tick tick)
|
||||
{
|
||||
int rate;
|
||||
struct map_session_data *sd=NULL;
|
||||
@ -2930,8 +2930,8 @@ void skill_combo_toggle_inf(struct block_list* bl, uint16 skill_id, int inf){
|
||||
}
|
||||
}
|
||||
|
||||
void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int tick){
|
||||
unsigned int duration = 0; //Set to duration the user can use a combo skill or 1 for aftercast delay of pre-skill
|
||||
void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick){
|
||||
t_tick duration = 0; //Set to duration the user can use a combo skill or 1 for aftercast delay of pre-skill
|
||||
int nodelay = 0; //Set to 1 for no walk/attack delay, set to 2 for no walk delay
|
||||
int target_id = bl->id; //Set to 0 if combo skill should not autotarget
|
||||
struct status_change_entry *sce;
|
||||
@ -3033,7 +3033,7 @@ void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_li
|
||||
|
||||
if (duration) { //Possible to chain
|
||||
if(sd && duration==1) duration = DIFF_TICK(sd->ud.canact_tick, tick); //Auto calc duration
|
||||
duration = umax(status_get_amotion(src),duration); //Never less than aMotion
|
||||
duration = i64max(status_get_amotion(src),duration); //Never less than aMotion
|
||||
sc_start4(src,src,SC_COMBO,100,skill_id,target_id,nodelay,0,duration);
|
||||
clif_combo_delay(src, duration);
|
||||
}
|
||||
@ -3127,7 +3127,7 @@ static void skill_do_copy(struct block_list* src,struct block_list *bl, uint16 s
|
||||
* @param tick
|
||||
* @param flag can hold a bunch of information:
|
||||
*/
|
||||
void skill_attack_blow(struct block_list *src, struct block_list *dsrc, struct block_list *target, uint8 blewcount, uint16 skill_id, uint16 skill_lv, int64 damage, unsigned int tick, int flag) {
|
||||
void skill_attack_blow(struct block_list *src, struct block_list *dsrc, struct block_list *target, uint8 blewcount, uint16 skill_id, uint16 skill_lv, int64 damage, t_tick tick, int flag) {
|
||||
int8 dir = -1; // Default direction
|
||||
//Only knockback if it's still alive, otherwise a "ghost" is left behind. [Skotlex]
|
||||
//Reflected spells do not bounce back (src == dsrc since it only happens for direct skills)
|
||||
@ -3213,7 +3213,7 @@ void skill_attack_blow(struct block_list *src, struct block_list *dsrc, struct b
|
||||
*
|
||||
* flag&0x1000000 - Return 0 if damage was reflected
|
||||
*-------------------------------------------------------------------------*/
|
||||
int64 skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
int64 skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag)
|
||||
{
|
||||
struct Damage dmg;
|
||||
struct status_data *sstatus, *tstatus;
|
||||
@ -3747,13 +3747,13 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
|
||||
* Checking bl battle flag and display damage
|
||||
* then call func with source,target,skill_id,skill_lv,tick,flag
|
||||
*------------------------------------------*/
|
||||
typedef int (*SkillFunc)(struct block_list *, struct block_list *, int, int, unsigned int, int);
|
||||
typedef int (*SkillFunc)(struct block_list *, struct block_list *, int, int, t_tick, int);
|
||||
int skill_area_sub(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct block_list *src;
|
||||
uint16 skill_id,skill_lv;
|
||||
int flag;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
SkillFunc func;
|
||||
|
||||
nullpo_ret(bl);
|
||||
@ -3761,7 +3761,7 @@ int skill_area_sub(struct block_list *bl, va_list ap)
|
||||
src = va_arg(ap,struct block_list *);
|
||||
skill_id = va_arg(ap,int);
|
||||
skill_lv = va_arg(ap,int);
|
||||
tick = va_arg(ap,unsigned int);
|
||||
tick = va_arg(ap,t_tick);
|
||||
flag = va_arg(ap,int);
|
||||
func = va_arg(ap,SkillFunc);
|
||||
|
||||
@ -4059,7 +4059,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, uint16 skill_i
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_area_sub_count (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
int skill_area_sub_count (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag)
|
||||
{
|
||||
switch (skill_id) {
|
||||
case RL_QD_SHOT:
|
||||
@ -4370,7 +4370,7 @@ static TIMER_FUNC(skill_timerskill){
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag)
|
||||
int skill_addtimerskill (struct block_list *src, t_tick tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag)
|
||||
{
|
||||
int i;
|
||||
struct unit_data *ud;
|
||||
@ -4487,7 +4487,7 @@ void skill_reveal_trap_inarea(struct block_list *src, int range, int x, int y) {
|
||||
* @param tick: Processing tick time
|
||||
* @return Card number
|
||||
*------------------------------------------*/
|
||||
static int skill_tarotcard(struct block_list* src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int tick)
|
||||
static int skill_tarotcard(struct block_list* src, struct block_list *target, uint16 skill_id, uint16 skill_lv, t_tick tick)
|
||||
{
|
||||
int card = 0;
|
||||
|
||||
@ -4622,7 +4622,7 @@ static int skill_tarotcard(struct block_list* src, struct block_list *target, ui
|
||||
*
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag)
|
||||
{
|
||||
struct map_session_data *sd = NULL;
|
||||
struct status_data *tstatus;
|
||||
@ -5705,7 +5705,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
|
||||
{
|
||||
int skele = WL_RELEASE - 5 + sc->data[spheres[i]]->val1 - WLS_FIRE; // Convert Ball Element into Skill ATK for balls
|
||||
// WL_SUMMON_ATK_FIRE, WL_SUMMON_ATK_WIND, WL_SUMMON_ATK_WATER, WL_SUMMON_ATK_GROUND
|
||||
skill_addtimerskill(src,tick+status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL);
|
||||
skill_addtimerskill(src,tick+(t_tick)status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL);
|
||||
status_change_end(src, static_cast<sc_type>(spheres[i]), INVALID_TIMER); // Eliminate ball
|
||||
}
|
||||
clif_skill_nodamage(src,bl,skill_id,0,1);
|
||||
@ -6140,7 +6140,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
|
||||
* @param tick
|
||||
* @param flag Various value, &1: Recursive effect
|
||||
**/
|
||||
int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag)
|
||||
{
|
||||
struct map_session_data *sd, *dstsd;
|
||||
struct mob_data *md, *dstmd;
|
||||
@ -11670,7 +11670,7 @@ static int skill_count_wos(struct block_list *bl,va_list ap) {
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag)
|
||||
{
|
||||
struct map_session_data* sd;
|
||||
struct status_change* sc;
|
||||
@ -12365,7 +12365,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
|
||||
if (ud->skillunit[i_su]->skill_id == GN_DEMONIC_FIRE && distance_xy(x, y, su->bl.x, su->bl.y) < 4) {
|
||||
switch (skill_lv) {
|
||||
case 1: {
|
||||
int duration = sg->limit - DIFF_TICK(tick, sg->tick);
|
||||
// TODO:
|
||||
int duration = (int)(sg->limit - DIFF_TICK(tick, sg->tick));
|
||||
|
||||
skill_delunit(su);
|
||||
skill_unitsetting(src, GN_DEMONIC_FIRE, 1, x, y, duration);
|
||||
@ -12761,7 +12762,8 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag)
|
||||
struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag)
|
||||
{
|
||||
struct skill_unit_group *group;
|
||||
int i, limit, val1 = 0, val2 = 0, val3 = 0;
|
||||
int i, val1 = 0, val2 = 0, val3 = 0;
|
||||
t_tick limit;
|
||||
int link_group_id = 0;
|
||||
int target, interval, range, unit_flag, req_item = 0;
|
||||
struct s_skill_unit_layout *layout;
|
||||
@ -13310,7 +13312,7 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, unsigned int tick)
|
||||
void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_tick tick)
|
||||
{
|
||||
skill_unit_onplace(unit, bl, tick);
|
||||
}
|
||||
@ -13323,7 +13325,7 @@ void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, unsi
|
||||
* @param bl Target
|
||||
* @param tick
|
||||
*/
|
||||
static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, unsigned int tick)
|
||||
static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_tick tick)
|
||||
{
|
||||
struct skill_unit_group *sg;
|
||||
struct block_list *ss; // Actual source that cast the skill unit
|
||||
@ -13370,7 +13372,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, un
|
||||
if (sc) {
|
||||
//Duration in PVM is: 1st - 8s, 2nd - 16s, 3rd - 8s
|
||||
//Duration in PVP is: 1st - 4s, 2nd - 8s, 3rd - 12s
|
||||
int sec = skill_get_time2(sg->skill_id, sg->skill_lv);
|
||||
t_tick sec = skill_get_time2(sg->skill_id, sg->skill_lv);
|
||||
const struct TimerData* td;
|
||||
struct map_data *mapdata = map_getmapdata(bl->m);
|
||||
|
||||
@ -13663,7 +13665,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, un
|
||||
* @param bl Valid 'target' above the unit, that has been check in skill_unit_timer_sub_onplace
|
||||
* @param tick
|
||||
*/
|
||||
int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, unsigned int tick)
|
||||
int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_tick tick)
|
||||
{
|
||||
struct skill_unit_group *sg;
|
||||
struct block_list *ss;
|
||||
@ -13673,7 +13675,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
struct skill_unit_group_tickset *ts;
|
||||
enum sc_type type;
|
||||
uint16 skill_id;
|
||||
int diff = 0;
|
||||
t_tick diff = 0;
|
||||
|
||||
nullpo_ret(unit);
|
||||
nullpo_ret(bl);
|
||||
@ -13718,7 +13720,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
ts->tick = tick+sg->interval;
|
||||
|
||||
if ((skill_id==CR_GRANDCROSS || skill_id==NPC_GRANDDARKNESS) && !battle_config.gx_allhit)
|
||||
ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR,0)-1);
|
||||
ts->tick += (t_tick)sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR,0)-1);
|
||||
}
|
||||
|
||||
// Wall of Thorn damaged by Fire element unit [Cydh]
|
||||
@ -13762,7 +13764,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
status_zap(bl, 0, 15); // sp damage to players
|
||||
else // mobs
|
||||
if( status_charge(ss, 0, 2) ) { // costs 2 SP per hit
|
||||
if( !skill_attack(BF_WEAPON,ss,&unit->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0) )
|
||||
if( !skill_attack(BF_WEAPON,ss,&unit->bl,bl,sg->skill_id,sg->skill_lv,tick+(t_tick)count*sg->interval,0) )
|
||||
status_charge(ss, 0, 8); //costs additional 8 SP if miss
|
||||
} else { //should end when out of sp.
|
||||
sg->limit = DIFF_TICK(tick,sg->tick);
|
||||
@ -13799,7 +13801,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
|
||||
//Take into account these hit more times than the timer interval can handle.
|
||||
do
|
||||
skill_attack(BF_MAGIC,ss,&unit->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0);
|
||||
skill_attack(BF_MAGIC,ss,&unit->bl,bl,sg->skill_id,sg->skill_lv,tick+(t_tick)count*sg->interval,0);
|
||||
while(sg->interval > 0 && --unit->val2 && x == bl->x && y == bl->y &&
|
||||
++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status_isdead(bl));
|
||||
|
||||
@ -13877,7 +13879,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
case UNT_ANKLESNARE:
|
||||
case UNT_MANHOLE:
|
||||
if( sg->val2 == 0 && tsc && ((sg->unit_id == UNT_ANKLESNARE && skill_id != SC_ESCAPE) || bl->id != sg->src_id) ) {
|
||||
int sec = skill_get_time2(sg->skill_id,sg->skill_lv);
|
||||
t_tick sec = skill_get_time2(sg->skill_id,sg->skill_lv);
|
||||
|
||||
if( status_change_start(ss, bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, SCSTART_NORATEDEF) ) {
|
||||
const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
|
||||
@ -14213,7 +14215,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
case UNT_THORNS_TRAP:
|
||||
if( tsc ) {
|
||||
if( !sg->val2 ) {
|
||||
int sec = skill_get_time2(sg->skill_id, sg->skill_lv);
|
||||
t_tick sec = skill_get_time2(sg->skill_id, sg->skill_lv);
|
||||
if( sc_start(ss, bl, type, 100, sg->skill_lv, sec) ) {
|
||||
const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
|
||||
if( td )
|
||||
@ -14377,7 +14379,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, uns
|
||||
* @param bl Char
|
||||
* @param tick
|
||||
*/
|
||||
int skill_unit_onout(struct skill_unit *src, struct block_list *bl, unsigned int tick)
|
||||
int skill_unit_onout(struct skill_unit *src, struct block_list *bl, t_tick tick)
|
||||
{
|
||||
struct skill_unit_group *sg;
|
||||
struct status_change *sc;
|
||||
@ -14445,7 +14447,7 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, unsigned int
|
||||
* @param bl A char
|
||||
* @param tick
|
||||
*/
|
||||
int skill_unit_onleft(uint16 skill_id, struct block_list *bl, unsigned int tick)
|
||||
int skill_unit_onleft(uint16 skill_id, struct block_list *bl, t_tick tick)
|
||||
{
|
||||
struct status_change *sc;
|
||||
struct status_change_entry *sce;
|
||||
@ -14585,7 +14587,7 @@ static int skill_unit_effect(struct block_list* bl, va_list ap)
|
||||
{
|
||||
struct skill_unit* unit = va_arg(ap,struct skill_unit*);
|
||||
struct skill_unit_group* group = unit->group;
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,t_tick);
|
||||
unsigned int flag = va_arg(ap,unsigned int);
|
||||
uint16 skill_id;
|
||||
bool dissonance = false;
|
||||
@ -17119,7 +17121,7 @@ int skill_frostjoke_scream(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct block_list *src;
|
||||
uint16 skill_id,skill_lv;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
|
||||
nullpo_ret(bl);
|
||||
nullpo_ret(src = va_arg(ap,struct block_list*));
|
||||
@ -17176,7 +17178,7 @@ int skill_attack_area(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct block_list *src,*dsrc;
|
||||
int atk_type,skill_id,skill_lv,flag,type;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
|
||||
if(status_isdead(bl))
|
||||
return 0;
|
||||
@ -18119,7 +18121,7 @@ static int skill_get_new_group_id(void)
|
||||
* @param interval Time interval
|
||||
* @return skill_unit_group
|
||||
*/
|
||||
struct skill_unit_group* skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval)
|
||||
struct skill_unit_group* skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, t_tick limit, int interval)
|
||||
{
|
||||
struct unit_data* ud = unit_bl2ud( src );
|
||||
struct skill_unit_group* group;
|
||||
@ -18136,9 +18138,9 @@ struct skill_unit_group* skill_initunitgroup(struct block_list* src, int count,
|
||||
if(i == MAX_SKILLUNITGROUP) {
|
||||
// Array is full, make room by discarding oldest group
|
||||
int j = 0;
|
||||
unsigned maxdiff = 0, tick = gettick();
|
||||
t_tick maxdiff = 0, tick = gettick();
|
||||
for(i = 0; i < MAX_SKILLUNITGROUP && ud->skillunit[i];i++){
|
||||
unsigned int x = DIFF_TICK(tick,ud->skillunit[i]->tick);
|
||||
t_tick x = DIFF_TICK(tick,ud->skillunit[i]->tick);
|
||||
if(x > maxdiff){
|
||||
maxdiff = x;
|
||||
j = i;
|
||||
@ -18378,7 +18380,7 @@ void skill_clear_unitgroup(struct block_list *src)
|
||||
* @param tick
|
||||
* @return skill_unit_group_tickset if found
|
||||
*/
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl, struct skill_unit_group *group, int tick)
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl, struct skill_unit_group *group, t_tick tick)
|
||||
{
|
||||
int i, j = -1, s, id;
|
||||
struct unit_data *ud;
|
||||
@ -18425,7 +18427,7 @@ int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap)
|
||||
{
|
||||
struct skill_unit* unit = va_arg(ap,struct skill_unit *);
|
||||
struct skill_unit_group* group = NULL;
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,unsigned int);
|
||||
|
||||
nullpo_ret(unit);
|
||||
|
||||
@ -18452,7 +18454,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct skill_unit* unit = (struct skill_unit*)db_data2ptr(data);
|
||||
struct skill_unit_group* group = NULL;
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,unsigned int);
|
||||
bool dissonance;
|
||||
struct block_list* bl = &unit->bl;
|
||||
|
||||
@ -18735,7 +18737,7 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap)
|
||||
struct skill_unit_group* group = NULL;
|
||||
|
||||
struct block_list* target = va_arg(ap,struct block_list*);
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,unsigned int);
|
||||
int flag = va_arg(ap,int);
|
||||
bool dissonance;
|
||||
uint16 skill_id;
|
||||
@ -18835,7 +18837,7 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap)
|
||||
* units to figure out when they have left a group.
|
||||
* flag&4: Force a onleft event (triggered when the bl is killed, for example)
|
||||
*------------------------------------------*/
|
||||
int skill_unit_move(struct block_list *bl, unsigned int tick, int flag)
|
||||
int skill_unit_move(struct block_list *bl, t_tick tick, int flag)
|
||||
{
|
||||
nullpo_ret(bl);
|
||||
|
||||
@ -18866,7 +18868,7 @@ int skill_unit_move(struct block_list *bl, unsigned int tick, int flag)
|
||||
* @param dy
|
||||
*------------------------------------------*/
|
||||
void skill_unit_move_unit(struct block_list *bl, int dx, int dy) {
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
struct skill_unit *su;
|
||||
|
||||
if (bl->type != BL_SKILL)
|
||||
@ -18901,7 +18903,7 @@ void skill_unit_move_unit(struct block_list *bl, int dx, int dy) {
|
||||
void skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int *m_flag;
|
||||
struct skill_unit *unit1;
|
||||
struct skill_unit *unit2;
|
||||
@ -20066,7 +20068,7 @@ static int skill_destroy_trap(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct skill_unit *su = (struct skill_unit *)bl;
|
||||
struct skill_unit_group *sg = NULL;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
|
||||
nullpo_ret(su);
|
||||
|
||||
@ -20136,7 +20138,7 @@ TIMER_FUNC(skill_blockpc_end){
|
||||
* @param load whether this assignment is being loaded upon player login
|
||||
* @return 0 if successful, -1 otherwise
|
||||
*/
|
||||
int skill_blockpc_start(struct map_session_data *sd, int skill_id, int tick) {
|
||||
int skill_blockpc_start(struct map_session_data *sd, int skill_id, t_tick tick) {
|
||||
int i;
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
|
@ -275,9 +275,9 @@ struct skill_unit_group {
|
||||
int map; /// Map
|
||||
int target_flag; /// Holds BCT_* flag for battle_check_target
|
||||
int bl_flag; /// Holds BL_* flag for map_foreachin* functions
|
||||
unsigned int tick; /// Tick when skill unit initialized
|
||||
int limit, /// Life time
|
||||
interval; /// Timer interval
|
||||
t_tick tick; /// Tick when skill unit initialized
|
||||
t_tick limit; /// Life time
|
||||
int interval; /// Timer interval
|
||||
uint16 skill_id, /// Skill ID
|
||||
skill_lv; /// Skill level
|
||||
int val1, val2, val3; /// Values
|
||||
@ -300,7 +300,7 @@ struct skill_unit_group {
|
||||
struct skill_unit {
|
||||
struct block_list bl;
|
||||
struct skill_unit_group *group; /// Skill group reference
|
||||
int limit;
|
||||
t_tick limit;
|
||||
int val1, val2;
|
||||
short range;
|
||||
unsigned alive : 1;
|
||||
@ -309,7 +309,7 @@ struct skill_unit {
|
||||
|
||||
#define MAX_SKILLUNITGROUPTICKSET 25
|
||||
struct skill_unit_group_tickset {
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
int id;
|
||||
};
|
||||
|
||||
@ -446,11 +446,11 @@ TIMER_FUNC(skill_castend_pos);
|
||||
int skill_castend_map( struct map_session_data *sd,uint16 skill_id, const char *map);
|
||||
|
||||
int skill_cleartimerskill(struct block_list *src);
|
||||
int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag);
|
||||
int skill_addtimerskill(struct block_list *src,t_tick tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag);
|
||||
|
||||
// Results? Added
|
||||
int skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,enum damage_lv dmg_lv,unsigned int tick);
|
||||
int skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,unsigned int tick);
|
||||
int skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,enum damage_lv dmg_lv,t_tick tick);
|
||||
int skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,t_tick tick);
|
||||
short skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag);
|
||||
int skill_break_equip(struct block_list *src,struct block_list *bl, unsigned short where, int rate, int flag);
|
||||
int skill_strip_equip(struct block_list *src,struct block_list *bl, unsigned short where, int rate, int lv, int time);
|
||||
@ -459,12 +459,12 @@ struct skill_unit_group *skill_id2group(int group_id);
|
||||
struct skill_unit_group *skill_unitsetting(struct block_list* src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag);
|
||||
struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2, bool hidden);
|
||||
int skill_delunit(struct skill_unit *unit);
|
||||
struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval);
|
||||
struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, t_tick limit, int interval);
|
||||
int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func);
|
||||
#define skill_delunitgroup(group) skill_delunitgroup_(group,__FILE__,__LINE__,__func__)
|
||||
void skill_clear_unitgroup(struct block_list *src);
|
||||
int skill_clear_group(struct block_list *bl, int flag);
|
||||
void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, unsigned int tick);
|
||||
void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_tick tick);
|
||||
int64 skill_unit_ondamaged(struct skill_unit *unit,int64 damage);
|
||||
|
||||
// Skill unit visibility [Cydh]
|
||||
@ -488,7 +488,7 @@ struct skill_condition skill_get_requirement(struct map_session_data *sd, uint16
|
||||
int skill_disable_check(struct status_change *sc, uint16 skill_id);
|
||||
|
||||
int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16 *skill_lv, int range, int cast_flag);
|
||||
int skill_unit_move(struct block_list *bl,unsigned int tick,int flag);
|
||||
int skill_unit_move(struct block_list *bl,t_tick tick,int flag);
|
||||
void skill_unit_move_unit_group( struct skill_unit_group *group, int16 m,int16 dx,int16 dy);
|
||||
void skill_unit_move_unit(struct block_list *bl, int dx, int dy);
|
||||
|
||||
@ -517,11 +517,11 @@ bool skill_produce_mix( struct map_session_data *sd, uint16 skill_id, unsigned s
|
||||
bool skill_arrow_create( struct map_session_data *sd, unsigned short nameid);
|
||||
|
||||
// skills for the mob
|
||||
int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
|
||||
int skill_castend_damage_id( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
|
||||
int skill_castend_pos2( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag);
|
||||
int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
|
||||
int skill_castend_damage_id( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
|
||||
int skill_castend_pos2( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag);
|
||||
|
||||
int skill_blockpc_start(struct map_session_data*, int, int);
|
||||
int skill_blockpc_start(struct map_session_data*, int, t_tick);
|
||||
int skill_blockpc_get(struct map_session_data *sd, int skillid);
|
||||
int skill_blockpc_clear(struct map_session_data *sd);
|
||||
TIMER_FUNC(skill_blockpc_end);
|
||||
@ -535,7 +535,7 @@ int skill_blockmerc_start (struct mercenary_data*,uint16 skill_id,int);
|
||||
((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE))
|
||||
|
||||
// Skill action, (return dmg,heal)
|
||||
int64 skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
|
||||
int64 skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
|
||||
|
||||
void skill_reload(void);
|
||||
|
||||
@ -2211,7 +2211,7 @@ int skill_banding_count(struct map_session_data *sd);
|
||||
|
||||
int skill_is_combo(uint16 skill_id);
|
||||
void skill_combo_toggle_inf(struct block_list* bl, uint16 skill_id, int inf);
|
||||
void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int tick);
|
||||
void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick);
|
||||
|
||||
void skill_reveal_trap_inarea(struct block_list *src, int range, int x, int y);
|
||||
int skill_get_time3(struct map_data *mapdata, uint16 skill_id, uint16 skill_lv);
|
||||
|
@ -1651,7 +1651,7 @@ int64 status_charge(struct block_list* bl, int64 hp, int64 sp)
|
||||
* Note: HP/SP are integer values, not percentages. Values should be
|
||||
* calculated either within function call or before
|
||||
*/
|
||||
int status_damage(struct block_list *src,struct block_list *target,int64 dhp, int64 dsp, int walkdelay, int flag)
|
||||
int status_damage(struct block_list *src,struct block_list *target,int64 dhp, int64 dsp, t_tick walkdelay, int flag)
|
||||
{
|
||||
struct status_data *status;
|
||||
struct status_change *sc;
|
||||
@ -8007,7 +8007,7 @@ static int status_get_sc_interval(enum sc_type type)
|
||||
* @param flag: Value which determines what parts to calculate. See e_status_change_start_flags
|
||||
* @return adjusted duration based on flag values
|
||||
*/
|
||||
int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, unsigned char flag)
|
||||
t_tick status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, t_tick tick, unsigned char flag)
|
||||
{
|
||||
/// Resistance rate: 10000 = 100%
|
||||
/// Example: 50% (5000) -> sc_def = 5000 -> 25%;
|
||||
@ -8308,7 +8308,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
|
||||
|
||||
// Duration cannot be reduced
|
||||
if (flag&SCSTART_NOTICKDEF)
|
||||
return max(tick, 1);
|
||||
return i64max(tick, 1);
|
||||
|
||||
tick -= tick*tick_def/10000;
|
||||
tick -= tick_def2;
|
||||
@ -8317,20 +8317,20 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ
|
||||
switch (type) {
|
||||
case SC_ANKLE:
|
||||
case SC_MARSHOFABYSS:
|
||||
tick = max(tick, 5000); // Minimum duration 5s
|
||||
tick = i64max(tick, 5000); // Minimum duration 5s
|
||||
break;
|
||||
case SC_FREEZING:
|
||||
tick = max(tick, 6000); // Minimum duration 6s
|
||||
tick = i64max(tick, 6000); // Minimum duration 6s
|
||||
// NEED AEGIS CHECK: might need to be 10s (http://ro.gnjoy.com/news/notice/View.asp?seq=5352)
|
||||
break;
|
||||
case SC_BURNING:
|
||||
case SC_STASIS:
|
||||
case SC_VOICEOFSIREN:
|
||||
tick = max(tick, 10000); // Minimum duration 10s
|
||||
tick = i64max(tick, 10000); // Minimum duration 10s
|
||||
break;
|
||||
default:
|
||||
// Skills need to trigger even if the duration is reduced below 1ms
|
||||
tick = max(tick, 1);
|
||||
tick = i64max(tick, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -8482,13 +8482,13 @@ void status_display_remove(struct block_list *bl, enum sc_type type) {
|
||||
* @param flag: Value which determines what parts to calculate. See e_status_change_start_flags
|
||||
* @return adjusted duration based on flag values
|
||||
*/
|
||||
int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,unsigned char flag) {
|
||||
int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,t_tick duration,unsigned char flag) {
|
||||
struct map_session_data *sd = NULL;
|
||||
struct status_change* sc;
|
||||
struct status_change_entry* sce;
|
||||
struct status_data *status;
|
||||
struct view_data *vd;
|
||||
int opt_flag, calc_flag, undead_flag, val_flag = 0, tick_time = 0;
|
||||
int opt_flag, calc_flag, undead_flag, val_flag = 0, t_tickime = 0;
|
||||
bool sc_isnew = true;
|
||||
|
||||
nullpo_ret(bl);
|
||||
@ -8578,11 +8578,13 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
|
||||
// Adjust tick according to status resistances
|
||||
if( !(flag&(SCSTART_NOAVOID|SCSTART_LOADED)) ) {
|
||||
tick = status_get_sc_def(src, bl, type, rate, tick, flag);
|
||||
if( !tick )
|
||||
duration = status_get_sc_def(src, bl, type, rate, duration, flag);
|
||||
if( !duration )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tick = (int)duration;
|
||||
|
||||
sd = BL_CAST(BL_PC, bl);
|
||||
vd = status_get_viewdata(bl);
|
||||
|
||||
@ -9558,7 +9560,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
clif_emotion(bl, ET_SWEAT);
|
||||
break;
|
||||
case SC_MAXIMIZEPOWER:
|
||||
tick_time = val2 = tick>0?tick:60000;
|
||||
t_tickime = val2 = tick>0?tick:60000;
|
||||
tick = INFINITE_TICK; // Duration sent to the client should be infinite
|
||||
break;
|
||||
case SC_EDP:
|
||||
@ -9736,7 +9738,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
clif_status_change(bl,EFST_MOON,1,tick,0, 0, 0);
|
||||
val1|= (val3<<16);
|
||||
val3 = tick/1000; // Tick duration
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_LONGING:
|
||||
val2 = 500-100*val1; // Aspd penalty.
|
||||
@ -9791,15 +9793,15 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_TOXIN:
|
||||
case SC_MAGICMUSHROOM:
|
||||
case SC_LEECHESEND:
|
||||
tick_time = status_get_sc_interval(type);
|
||||
val4 = tick-tick_time; // Remaining time
|
||||
t_tickime = status_get_sc_interval(type);
|
||||
val4 = tick-t_tickime; // Remaining time
|
||||
break;
|
||||
|
||||
case SC_PYREXIA:
|
||||
//Causes blind for duration of pyrexia, unreducable and unavoidable, but can be healed with e.g. green potion
|
||||
status_change_start(src,bl,SC_BLIND,10000,val1,0,0,0,tick,SCSTART_NOAVOID|SCSTART_NOTICKDEF|SCSTART_NORATEDEF);
|
||||
tick_time = status_get_sc_interval(type);
|
||||
val4 = tick-tick_time; // Remaining time
|
||||
t_tickime = status_get_sc_interval(type);
|
||||
val4 = tick-t_tickime; // Remaining time
|
||||
break;
|
||||
|
||||
case SC_CONFUSION:
|
||||
@ -9815,7 +9817,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
if( val2 < 1 ) val2 = 1;
|
||||
if( (val4 = tick/(val2 * 1000)) < 1 )
|
||||
val4 = 1;
|
||||
tick_time = val2 * 1000; // [GodLesZ] tick time
|
||||
t_tickime = val2 * 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_BOSSMAPINFO:
|
||||
if( sd != NULL ) {
|
||||
@ -9826,13 +9828,13 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
return 0;
|
||||
}
|
||||
val1 = boss_md->bl.id;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
val4 = tick / t_tickime;
|
||||
}
|
||||
break;
|
||||
case SC_HIDING:
|
||||
val2 = tick/1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
val3 = 0; // Unused, previously speed adjustment
|
||||
val4 = val1+3; // Seconds before SP substraction happen.
|
||||
break;
|
||||
@ -9847,7 +9849,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_CLOAKING:
|
||||
if (!sd) // Monsters should be able to walk with no penalties. [Skotlex]
|
||||
val1 = 10;
|
||||
tick_time = val2 = tick>0?tick:60000; // SP consumption rate.
|
||||
t_tickime = val2 = tick>0?tick:60000; // SP consumption rate.
|
||||
tick = INFINITE_TICK; // Duration sent to the client should be infinite
|
||||
val3 = 0; // Unused, previously walk speed adjustment
|
||||
// val4&1 signals the presence of a wall.
|
||||
@ -9863,7 +9865,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_SIGHTBLASTER:
|
||||
val3 = skill_get_splash(val2, val1); // Val2 should bring the skill-id.
|
||||
val2 = tick/20;
|
||||
tick_time = 20; // [GodLesZ] tick time
|
||||
t_tickime = 20; // [GodLesZ] tick time
|
||||
break;
|
||||
|
||||
case SC_AUTOGUARD:
|
||||
@ -9912,8 +9914,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
clif_sitting(&sd->bl);
|
||||
}
|
||||
val2 = 12; // SP cost
|
||||
tick_time = 10000; // Decrease at 10secs intervals.
|
||||
val3 = tick / tick_time;
|
||||
t_tickime = 10000; // Decrease at 10secs intervals.
|
||||
val3 = tick / t_tickime;
|
||||
tick = INFINITE_TICK; // Duration sent to the client should be infinite
|
||||
break;
|
||||
case SC_PARRYING:
|
||||
@ -9939,13 +9941,13 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
if (!val4) val4 = skill_get_time2(status_sc2skill(type),val1);
|
||||
if (!val4) val4 = 10000; // Val4 holds damage interval
|
||||
val3 = tick/val4; // val3 holds skill duration
|
||||
tick_time = val4; // [GodLesZ] tick time
|
||||
t_tickime = val4; // [GodLesZ] tick time
|
||||
break;
|
||||
|
||||
case SC_GOSPEL:
|
||||
if(val4 == BCT_SELF) { // Self effect
|
||||
val2 = tick/10000;
|
||||
tick_time = 10000; // [GodLesZ] tick time
|
||||
t_tickime = 10000; // [GodLesZ] tick time
|
||||
status_change_clear_buffs(bl, SCCB_BUFFS|SCCB_DEBUFFS|SCCB_CHEM_PROTECT); // Remove buffs/debuffs
|
||||
}
|
||||
break;
|
||||
@ -10114,9 +10116,15 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val2 = 11-val1; // Chance to consume: 11-skill_lv%
|
||||
break;
|
||||
case SC_RUN:
|
||||
val4 = gettick(); // Store time at which you started running.
|
||||
{
|
||||
//Store time at which you started running.
|
||||
t_tick currenttick = gettick();
|
||||
// Note: this int64 value is stored in two separate int32 variables (FIXME)
|
||||
val3 = (int)(currenttick & 0x00000000ffffffffLL);
|
||||
val4 = (int)((currenttick & 0xffffffff00000000LL) >> 32);
|
||||
tick = INFINITE_TICK;
|
||||
break;
|
||||
}
|
||||
case SC_KAAHI:
|
||||
val2 = 200*val1; // HP heal
|
||||
val3 = 5*val1; // SP cost
|
||||
@ -10401,7 +10409,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_ABUNDANCE:
|
||||
val4 = tick / 10000;
|
||||
tick_time = 10000; // [GodLesZ] tick time
|
||||
t_tickime = 10000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_GIANTGROWTH:
|
||||
val2 = 15; // Double damage success rate.
|
||||
@ -10410,7 +10418,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
/* Arch Bishop */
|
||||
case SC_RENOVATIO:
|
||||
val4 = tick / 5000;
|
||||
tick_time = 5000;
|
||||
t_tickime = 5000;
|
||||
break;
|
||||
case SC_SECRAMENT:
|
||||
val2 = 10 * val1;
|
||||
@ -10421,11 +10429,11 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_WEAPONBLOCKING:
|
||||
val2 = 10 + 2 * val1; // Chance
|
||||
val4 = tick / 5000;
|
||||
tick_time = 5000; // [GodLesZ] tick time
|
||||
t_tickime = 5000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_OBLIVIONCURSE:
|
||||
val4 = tick / 3000;
|
||||
tick_time = 3000; // [GodLesZ] tick time
|
||||
t_tickime = 3000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_CLOAKINGEXCEED:
|
||||
val2 = (val1 + 1) / 2; // Hits
|
||||
@ -10434,7 +10442,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val4 |= battle_config.pc_cloak_check_type&7;
|
||||
else
|
||||
val4 |= battle_config.monster_cloak_check_type&7;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_HALLUCINATIONWALK:
|
||||
val2 = 50 * val1; // Evasion rate of physical attacks. Flee
|
||||
@ -10449,7 +10457,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_FREEZE_SP:
|
||||
// val2 = sp drain per 10 seconds
|
||||
tick_time = 10000; // [GodLesZ] tick time
|
||||
t_tickime = 10000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SPHERE_1:
|
||||
case SC_SPHERE_2:
|
||||
@ -10461,7 +10469,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val4 = tick / 1000;
|
||||
if( val4 < 1 )
|
||||
val4 = 1;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SHAPESHIFT:
|
||||
switch( val1 ) {
|
||||
@ -10476,7 +10484,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val4 = tick / 1000;
|
||||
if( val4 < 1 )
|
||||
val4 = 1;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_MEIKYOUSISUI:
|
||||
val2 = val1 * 2; // % HP each sec
|
||||
@ -10484,23 +10492,29 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val4 = tick / 1000;
|
||||
if( val4 < 1 )
|
||||
val4 = 1;
|
||||
tick_time = 1000;
|
||||
t_tickime = 1000;
|
||||
break;
|
||||
case SC_CAMOUFLAGE:
|
||||
val4 = tick/1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_WUGDASH:
|
||||
val4 = gettick(); // Store time at which you started running.
|
||||
{
|
||||
//Store time at which you started running.
|
||||
t_tick currenttick = gettick();
|
||||
// Note: this int64 value is stored in two separate int32 variables (FIXME)
|
||||
val3 = (int)(currenttick&0x00000000ffffffffLL);
|
||||
val4 = (int)((currenttick&0xffffffff00000000LL)>>32);
|
||||
tick = INFINITE_TICK;
|
||||
break;
|
||||
}
|
||||
case SC__SHADOWFORM:
|
||||
{
|
||||
struct map_session_data * s_sd = map_id2sd(val2);
|
||||
if( s_sd )
|
||||
s_sd->shadowform_id = bl->id;
|
||||
val4 = tick / 1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
}
|
||||
break;
|
||||
case SC__STRIPACCESSORY:
|
||||
@ -10512,7 +10526,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val3 = 20 * val1; // CRITICAL
|
||||
val4 = tick / 1000;
|
||||
tick = INFINITE_TICK; // Duration sent to the client should be infinite
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC__ENERVATION:
|
||||
val2 = 20 + 10 * val1; // ATK Reduction
|
||||
@ -10572,16 +10586,16 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
// val2 = watk bonus already calc
|
||||
val3 = 6 - val1;// spcost = 6 - level (lvl1:5 ... lvl 5: 1)
|
||||
val4 = tick / 1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_WARMER:
|
||||
val4 = tick / 3000;
|
||||
tick = INFINITE_TICK; // Duration sent to the client should be infinite
|
||||
tick_time = 3000;
|
||||
t_tickime = 3000;
|
||||
break;
|
||||
case SC_BLOODSUCKER:
|
||||
val4 = tick / 1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SWINGDANCE:
|
||||
val3 = 5 * val1 + val2; // Walk speed and aspd reduction.
|
||||
@ -10601,28 +10615,28 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_VOICEOFSIREN:
|
||||
val4 = tick / 2000;
|
||||
tick_time = 2000; // [GodLesZ] tick time
|
||||
t_tickime = 2000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_DEEPSLEEP:
|
||||
val4 = tick / 2000;
|
||||
tick_time = 2000; // [GodLesZ] tick time
|
||||
t_tickime = 2000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SIRCLEOFNATURE:
|
||||
val2 = 40 * val1; // HP recovery
|
||||
val3 = 4 * val1; // SP consume
|
||||
val4 = tick / 1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SONGOFMANA:
|
||||
val3 = 10 + min(5 * val2, 35);
|
||||
val4 = tick/5000;
|
||||
tick_time = 5000; // [GodLesZ] tick time
|
||||
t_tickime = 5000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_SATURDAYNIGHTFEVER:
|
||||
if (!val4) val4 = skill_get_time2(status_sc2skill(type),val1);
|
||||
if (!val4) val4 = 3000;
|
||||
val3 = tick/val4;
|
||||
tick_time = val4; // [GodLesZ] tick time
|
||||
t_tickime = val4; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_GLOOMYDAY:
|
||||
val2 = 20 + 5 * val1; // Flee reduction.
|
||||
@ -10655,7 +10669,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_MELODYOFSINK:
|
||||
val3 = val1 * val2; // INT Reduction.
|
||||
val4 = tick/1000;
|
||||
tick_time = 1000;
|
||||
t_tickime = 1000;
|
||||
break;
|
||||
case SC_BEYONDOFWARCRY:
|
||||
val3 = val1 * val2; // STR and CRIT Reduction
|
||||
@ -10673,13 +10687,13 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val2 = 15 + 5 * val1; // Reflect amount
|
||||
val3 = val1*5 + 25; // Number of reflects
|
||||
val4 = tick/1000; // Number of SP cycles (duration)
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_FORCEOFVANGUARD:
|
||||
val2 = 8 + 12 * val1; // Chance
|
||||
val3 = 5 + 2 * val1; // Max rage counters
|
||||
tick = INFINITE_TICK; // Endless duration in the client
|
||||
tick_time = 10000; // [GodLesZ] tick time
|
||||
t_tickime = 10000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_EXEEDBREAK:
|
||||
val2 = 150 * val1;
|
||||
@ -10697,17 +10711,17 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_BANDING:
|
||||
val2 = (sd ? skill_banding_count(sd) : 1);
|
||||
tick_time = 5000; // [GodLesZ] tick time
|
||||
t_tickime = 5000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_MAGNETICFIELD:
|
||||
val3 = tick / 1000;
|
||||
tick_time = 1000; // [GodLesZ] tick time
|
||||
t_tickime = 1000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_INSPIRATION:
|
||||
val2 = (sd?sd->status.job_level:50);
|
||||
val3 = status_get_lv(bl) / 10 + val2 / 5; //All stat bonus
|
||||
val4 = tick / 5000;
|
||||
tick_time = 5000; // [GodLesZ] tick time
|
||||
t_tickime = 5000; // [GodLesZ] tick time
|
||||
status_change_clear_buffs(bl, SCCB_BUFFS|SCCB_DEBUFFS); // Remove buffs/debuffs
|
||||
break;
|
||||
case SC_CRESCENTELBOW:
|
||||
@ -10718,7 +10732,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_RAISINGDRAGON:
|
||||
val3 = tick / 5000;
|
||||
tick_time = 5000; // [GodLesZ] tick time
|
||||
t_tickime = 5000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_GT_ENERGYGAIN:
|
||||
val2 = 10 + 5 * val1; // Sphere gain chance.
|
||||
@ -10792,7 +10806,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val2 = 300;
|
||||
break;
|
||||
case SC_WATER_SCREEN_OPTION:
|
||||
tick_time = 10000;
|
||||
t_tickime = 10000;
|
||||
break;
|
||||
case SC_FIRE_CLOAK_OPTION:
|
||||
case SC_WATER_DROP_OPTION:
|
||||
@ -10826,7 +10840,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_SOLID_SKIN:
|
||||
val2 += 5;
|
||||
val3 += 1000;
|
||||
tick_time = val3; // [GodLesZ] tick time
|
||||
t_tickime = val3; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_WATER_BARRIER:
|
||||
val2 = 30; // Reductions. Atk2 and Flee1
|
||||
@ -10846,16 +10860,16 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_TEARGAS:
|
||||
val2 = status_get_max_hp(bl) * 5 / 100; // Drain 5% HP
|
||||
val4 = tick / 2000;
|
||||
tick_time = 2000;
|
||||
t_tickime = 2000;
|
||||
break;
|
||||
case SC_TEARGAS_SOB:
|
||||
val4 = tick / 3000;
|
||||
tick_time = 3000;
|
||||
t_tickime = 3000;
|
||||
break;
|
||||
case SC_STOMACHACHE:
|
||||
val2 = 8; // SP consume.
|
||||
val4 = tick / 10000;
|
||||
tick_time = 10000; // [GodLesZ] tick time
|
||||
t_tickime = 10000; // [GodLesZ] tick time
|
||||
break;
|
||||
case SC_PROMOTE_HEALTH_RESERCH:
|
||||
//val1: 1 = Regular Potion, 2 = Thrown Potion
|
||||
@ -10888,7 +10902,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_KAGEMUSYA:
|
||||
val2 = tick/1000;
|
||||
val3 = val1 * 2;
|
||||
tick_time = 1000;
|
||||
t_tickime = 1000;
|
||||
break;
|
||||
case SC_ZANGETSU:
|
||||
if( status_get_hp(bl) % 2 == 0 )
|
||||
@ -10924,7 +10938,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val2 = 50 + 20 * val1; // atk bonus
|
||||
val3 = 40 + 20 * val1; // Flee reduction.
|
||||
val4 = tick/1000; // hp/sp reduction timer
|
||||
tick_time = 1000;
|
||||
t_tickime = 1000;
|
||||
break;
|
||||
case SC_GOLDENE_FERSE:
|
||||
val2 = 10 + 10*val1; // flee bonus
|
||||
@ -10988,18 +11002,18 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_FULL_THROTTLE:
|
||||
val2 = ( val1 == 1 ? 6 : 6 - val1 );
|
||||
val3 = 20; //+% AllStats
|
||||
tick_time = 1000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 1000;
|
||||
val4 = tick / t_tickime;
|
||||
break;
|
||||
case SC_REBOUND:
|
||||
tick_time = 2000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 2000;
|
||||
val4 = tick / t_tickime;
|
||||
clif_emotion(bl, ET_SWEAT);
|
||||
break;
|
||||
case SC_KINGS_GRACE:
|
||||
val2 = 3 + val1; //HP Recover rate
|
||||
tick_time = 1000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 1000;
|
||||
val4 = tick / t_tickime;
|
||||
break;
|
||||
case SC_TELEKINESIS_INTENSE:
|
||||
val2 = 10 * val1; // sp consum / casttime reduc %
|
||||
@ -11012,8 +11026,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_FRIGG_SONG:
|
||||
val2 = 5 * val1; // maxhp bonus
|
||||
val3 = 80 + 20 * val1; // healing
|
||||
tick_time = 1000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 1000;
|
||||
val4 = tick / t_tickime;
|
||||
break;
|
||||
case SC_FLASHCOMBO:
|
||||
val2 = 20 * val1 + 20; // atk bonus
|
||||
@ -11049,19 +11063,19 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_OVERHEAT:
|
||||
case SC_OVERHEAT_LIMITPOINT:
|
||||
case SC_STEALTHFIELD:
|
||||
tick_time = tick;
|
||||
t_tickime = tick;
|
||||
tick = INFINITE_TICK;
|
||||
break;
|
||||
case SC_STEALTHFIELD_MASTER:
|
||||
tick_time = val3 = 2000 + 1000 * val1;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = val3 = 2000 + 1000 * val1;
|
||||
val4 = tick / t_tickime;
|
||||
break;
|
||||
case SC_VACUUM_EXTREME:
|
||||
// Suck target at n second, only if the n second is lower than the duration
|
||||
// Doesn't apply to BL_PC
|
||||
if (bl->type != BL_PC && val4 < tick && !unit_blown_immune(bl,0x1) && status_has_mode(status,MD_CANMOVE)) {
|
||||
tick_time = val4;
|
||||
val4 = tick - tick_time;
|
||||
t_tickime = val4;
|
||||
val4 = tick - t_tickime;
|
||||
}
|
||||
else
|
||||
val4 = 0;
|
||||
@ -11070,8 +11084,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_WATER_INSIGNIA:
|
||||
case SC_WIND_INSIGNIA:
|
||||
case SC_EARTH_INSIGNIA:
|
||||
tick_time = 5000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 5000;
|
||||
val4 = tick / t_tickime;
|
||||
break;
|
||||
case SC_NEUTRALBARRIER:
|
||||
val2 = 10 + val1 * 5; // Def/Mdef
|
||||
@ -11089,7 +11103,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
val3 = 10; // -10 flee
|
||||
//Start timer to send mark on mini map
|
||||
val4 = tick/1000;
|
||||
tick_time = 1000; // Sends every 1 seconds
|
||||
t_tickime = 1000; // Sends every 1 seconds
|
||||
break;
|
||||
case SC_H_MINE:
|
||||
val2 = src->id;
|
||||
@ -11133,8 +11147,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
const struct status_data *b_status = status_get_base_status(src); // Base Status
|
||||
|
||||
val2 = (status_get_max_hp(bl) * (val1 + (b_status->dex / 25))) / status_get_max_hp(bl); // MHP% damage
|
||||
tick_time = 1000;
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 1000;
|
||||
val4 = tick / t_tickime;
|
||||
}
|
||||
break;
|
||||
case SC_ARCLOUSEDASH:
|
||||
@ -11181,8 +11195,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
if (pc_checkskill(sd, SU_SPIRITOFSEA))
|
||||
val2 *= 2; // Doubles HP
|
||||
}
|
||||
tick_time = 10000 - ((val1 - 1) * 1000);
|
||||
val4 = tick / tick_time;
|
||||
t_tickime = 10000 - ((val1 - 1) * 1000);
|
||||
val4 = tick / t_tickime;
|
||||
}
|
||||
break;
|
||||
case SC_TUNAPARTY:
|
||||
@ -11211,8 +11225,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC_DORAM_BUF_01:
|
||||
case SC_DORAM_BUF_02:
|
||||
tick_time = 10000; // every 10 seconds
|
||||
if( (val4 = tick/tick_time) < 1 )
|
||||
t_tickime = 10000; // every 10 seconds
|
||||
if( (val4 = tick/t_tickime) < 1 )
|
||||
val4 = 1;
|
||||
break;
|
||||
|
||||
@ -11276,8 +11290,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
case SC_MAGICMUSHROOM:
|
||||
case SC_PYREXIA:
|
||||
case SC_LEECHESEND:
|
||||
tick_time = tick;
|
||||
tick = tick_time + max(val4,0);
|
||||
t_tickime = tick;
|
||||
tick = t_tickime + max(val4,0);
|
||||
break;
|
||||
case SC_SWORDCLAN:
|
||||
case SC_ARCWANDCLAN:
|
||||
@ -11682,8 +11696,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
clif_status_change(bl,StatusIconChangeTable[type],1,tick,(val_flag&1)?val1:1,(val_flag&2)?val2:0,(val_flag&4)?val3:0);
|
||||
|
||||
// Used as temporary storage for scs with interval ticks, so that the actual duration is sent to the client first.
|
||||
if( tick_time )
|
||||
tick = tick_time;
|
||||
if( t_tickime )
|
||||
tick = t_tickime;
|
||||
|
||||
// Don't trust the previous sce assignment, in case the SC ended somewhere between there and here.
|
||||
if((sce=sc->data[type])) { // reuse old sc
|
||||
@ -12065,7 +12079,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
|
||||
if (type == SC_SPIDERWEB) {
|
||||
//Delete the unit group first to expire found in the status change
|
||||
struct skill_unit_group *group = NULL, *group2 = NULL;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int pos = 1;
|
||||
if (sce->val2)
|
||||
if (!(group = skill_id2group(sce->val2)))
|
||||
@ -12149,6 +12163,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
|
||||
{
|
||||
struct unit_data *ud = unit_bl2ud(bl);
|
||||
bool begin_spurt = true;
|
||||
// Note: this int64 value is stored in two separate int32 variables (FIXME)
|
||||
t_tick starttick = (t_tick)sce->val3&0x00000000ffffffffLL;
|
||||
starttick |= ((t_tick)sce->val4<<32)&0xffffffff00000000LL;
|
||||
|
||||
if (ud) {
|
||||
if(!ud->state.running)
|
||||
begin_spurt = false;
|
||||
@ -12157,7 +12175,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
|
||||
unit_stop_walking(bl,1);
|
||||
}
|
||||
if (begin_spurt && sce->val1 >= 7 &&
|
||||
DIFF_TICK(gettick(), sce->val4) <= 1000 &&
|
||||
DIFF_TICK(gettick(), starttick) <= 1000 &&
|
||||
(!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
|
||||
)
|
||||
sc_start(bl,bl,SC_SPURT,100,sce->val1,skill_get_time2(status_sc2skill(type), sce->val1));
|
||||
@ -12842,7 +12860,7 @@ TIMER_FUNC(status_change_timer){
|
||||
|
||||
sd = BL_CAST(BL_PC, bl);
|
||||
|
||||
std::function<void (unsigned int)> sc_timer_next = [&sce, &bl, &data](unsigned int t) {
|
||||
std::function<void (t_tick)> sc_timer_next = [&sce, &bl, &data](t_tick t) {
|
||||
sce->timer = add_timer(t, status_change_timer, bl->id, data);
|
||||
};
|
||||
|
||||
@ -12860,7 +12878,7 @@ TIMER_FUNC(status_change_timer){
|
||||
|
||||
if (!sc->data[SC_CHASEWALK2]) {
|
||||
sc_start(bl,bl, SC_CHASEWALK2,100,1<<(sce->val1-1),
|
||||
(sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ROGUE?10:1) // SL bonus -> x10 duration
|
||||
(t_tick)(sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ROGUE?10:1) // SL bonus -> x10 duration
|
||||
*skill_get_time2(status_sc2skill(type),sce->val1));
|
||||
}
|
||||
sc_timer_next(sce->val2+tick);
|
||||
@ -13768,7 +13786,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
|
||||
struct block_list* src = va_arg(ap,struct block_list*);
|
||||
struct status_change_entry* sce = va_arg(ap,struct status_change_entry*);
|
||||
enum sc_type type = (sc_type)va_arg(ap,int); // gcc: enum args get promoted to int
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
t_tick tick = va_arg(ap,unsigned int);
|
||||
|
||||
if (status_isdead(bl))
|
||||
return 0;
|
||||
@ -14094,7 +14112,7 @@ int status_change_spread(struct block_list *src, struct block_list *bl, bool typ
|
||||
int i, flag = 0;
|
||||
struct status_change *sc = status_get_sc(src);
|
||||
const struct TimerData *timer = NULL;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
struct status_change_data data;
|
||||
|
||||
if( !sc || !sc->count )
|
||||
@ -14187,7 +14205,7 @@ int status_change_spread(struct block_list *src, struct block_list *bl, bool typ
|
||||
* @param args: va_list arguments
|
||||
* @return which regeneration bonuses have been applied (flag)
|
||||
*/
|
||||
static unsigned int natural_heal_prev_tick,natural_heal_diff_tick;
|
||||
static t_tick natural_heal_prev_tick,natural_heal_diff_tick;
|
||||
static int status_natural_heal(struct block_list* bl, va_list args)
|
||||
{
|
||||
struct regen_data *regen;
|
||||
|
@ -2340,7 +2340,7 @@ int status_sc2skill(sc_type sc);
|
||||
unsigned int status_sc2scb_flag(sc_type sc);
|
||||
int status_type2relevant_bl_types(int type);
|
||||
|
||||
int status_damage(struct block_list *src,struct block_list *target,int64 dhp,int64 dsp, int walkdelay, int flag);
|
||||
int status_damage(struct block_list *src,struct block_list *target,int64 dhp,int64 dsp, t_tick walkdelay, int flag);
|
||||
//Define for standard HP damage attacks.
|
||||
#define status_fix_damage(src, target, hp, walkdelay) status_damage(src, target, hp, 0, walkdelay, 0)
|
||||
//Define for standard SP damage attacks.
|
||||
@ -2433,13 +2433,13 @@ struct status_change *status_get_sc(struct block_list *bl);
|
||||
int status_isdead(struct block_list *bl);
|
||||
int status_isimmune(struct block_list *bl);
|
||||
|
||||
int status_get_sc_def(struct block_list *src,struct block_list *bl, enum sc_type type, int rate, int tick, unsigned char flag);
|
||||
t_tick status_get_sc_def(struct block_list *src,struct block_list *bl, enum sc_type type, int rate, t_tick tick, unsigned char flag);
|
||||
//Short version, receives rate in 1->100 range, and does not uses a flag setting.
|
||||
#define sc_start(src, bl, type, rate, val1, tick) status_change_start(src,bl,type,100*(rate),val1,0,0,0,tick,SCSTART_NONE)
|
||||
#define sc_start2(src, bl, type, rate, val1, val2, tick) status_change_start(src,bl,type,100*(rate),val1,val2,0,0,tick,SCSTART_NONE)
|
||||
#define sc_start4(src, bl, type, rate, val1, val2, val3, val4, tick) status_change_start(src,bl,type,100*(rate),val1,val2,val3,val4,tick,SCSTART_NONE)
|
||||
|
||||
int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,unsigned char flag);
|
||||
int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,t_tick duration,unsigned char flag);
|
||||
int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const char* file, int line);
|
||||
#define status_change_end(bl,type,tid) status_change_end_(bl,type,tid,__FILE__,__LINE__)
|
||||
TIMER_FUNC(status_change_timer);
|
||||
|
@ -1267,7 +1267,7 @@ int unit_stop_walking(struct block_list *bl,int type)
|
||||
{
|
||||
struct unit_data *ud;
|
||||
const struct TimerData* td = NULL;
|
||||
unsigned int tick;
|
||||
t_tick tick;
|
||||
|
||||
nullpo_ret(bl);
|
||||
|
||||
@ -1445,7 +1445,7 @@ TIMER_FUNC(unit_resume_running){
|
||||
* 1: Skill induced delay; Walk delay can only be increased, not decreased
|
||||
* @return Success(1); Fail(0);
|
||||
*/
|
||||
int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type)
|
||||
int unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int type)
|
||||
{
|
||||
struct unit_data *ud = unit_bl2ud(bl);
|
||||
|
||||
@ -1508,7 +1508,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
struct status_change *sc;
|
||||
struct map_session_data *sd = NULL;
|
||||
struct block_list * target = NULL;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int combo = 0, range;
|
||||
uint8 inf = 0;
|
||||
uint32 inf2 = 0;
|
||||
@ -1967,7 +1967,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
||||
struct unit_data *ud = NULL;
|
||||
struct status_change *sc;
|
||||
struct block_list bl;
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int range;
|
||||
|
||||
nullpo_ret(src);
|
||||
@ -2520,7 +2520,7 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir)
|
||||
* @param tick: Current tick
|
||||
* @return Attackable(1); Unattackable(0);
|
||||
*/
|
||||
static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
|
||||
static int unit_attack_timer_sub(struct block_list* src, int tid, t_tick tick)
|
||||
{
|
||||
struct block_list *target;
|
||||
struct unit_data *ud;
|
||||
@ -2709,7 +2709,7 @@ int unit_skillcastcancel(struct block_list *bl, char type)
|
||||
{
|
||||
struct map_session_data *sd = NULL;
|
||||
struct unit_data *ud = unit_bl2ud( bl);
|
||||
unsigned int tick = gettick();
|
||||
t_tick tick = gettick();
|
||||
int ret = 0, skill_id;
|
||||
|
||||
nullpo_ret(bl);
|
||||
|
@ -39,9 +39,9 @@ struct unit_data {
|
||||
bool stepaction; //Action should be executed on step [Playtester]
|
||||
int steptimer; //Timer that triggers the action [Playtester]
|
||||
uint16 stepskill_id, stepskill_lv; //Remembers skill that should be casted on step [Playtester]
|
||||
unsigned int attackabletime;
|
||||
unsigned int canact_tick;
|
||||
unsigned int canmove_tick;
|
||||
t_tick attackabletime;
|
||||
t_tick canact_tick;
|
||||
t_tick canmove_tick;
|
||||
bool immune_attack; ///< Whether the unit is immune to attacks
|
||||
uint8 dir;
|
||||
unsigned char walk_count;
|
||||
@ -117,7 +117,7 @@ TIMER_FUNC(unit_delay_walktobl_timer);
|
||||
int unit_stop_walking(struct block_list *bl,int type);
|
||||
int unit_can_move(struct block_list *bl);
|
||||
int unit_is_walking(struct block_list *bl);
|
||||
int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type);
|
||||
int unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int type);
|
||||
|
||||
int unit_escape(struct block_list *bl, struct block_list *target, short dist);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user