- Fixed two instances in the login-sql server where the ip in the log-login table was being stored backwards.

- Now when a skill's range is 0 and the skill is NOT casted on self, it will take the basic weapon's range (without Vulture/Snake Eye bonus).
- Now when a duration is not specified, sc_start/sc_start2/sc_start4 will try to guess the duration by extracting it from the skill_db (it uses skill_get_time on whatever skill is associated to the status-change using val1 as skill-level)
- Corrected that extra comma at the end of the Kaensin layout setup.
- Some cleanups on trade_tradeaccept to prevent packets being resent when they shouldn't.
- Corrected that ALLOW NULL thingie on main.sql


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8229 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-08-10 14:25:32 +00:00
parent c0f0a50c79
commit 6f3c9a6dc7
7 changed files with 79 additions and 28 deletions

View File

@ -4,6 +4,17 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/10 2006/08/10
* Fixed two instances in the login-sql server where the ip in the log-login
table was being stored backwards. [Skotlex]
* Now when a skill's range is 0 and the skill is NOT casted on self, it
will take the basic weapon's range (without Vulture/Snake Eye bonus).
[Skotlex]
* Now when a duration is not specified, sc_start/sc_start2/sc_start4 will
try to guess the duration by extracting it from the skill_db (it uses
skill_get_time on whatever skill is associated to the status-change using
val1 as skill-level) [Skotlex]
* Some cleanups on trade_tradeaccept to prevent packets being resent when
they shouldn't. [Skotlex]
* Fixed syntax error in 'guild' create table statement [Toms] * Fixed syntax error in 'guild' create table statement [Toms]
2006/08/09 2006/08/09
* Fixed Asura not wasting all SP away when it fails on cast-end. [Skotlex] * Fixed Asura not wasting all SP away when it fails on cast-end. [Skotlex]

View File

@ -1,10 +1,13 @@
//id,range,hit,inf,pl,nk,splash,max,list_num,castcancel,cast_defence_rate,inf2,maxcount,skill_type,blow_count //id,range,hit,inf,pl,nk,splash,max,list_num,castcancel,cast_defence_rate,inf2,maxcount,skill_type,blow_count
// 01 ID // 01 ID
// 02 range (combo skills do not check for range when used) // 02 range (combo skills do not check for range when used, if 0 and skill is
// not inf = 4, use base weapon's range)
// 03 hit (8- repeated hitting, 6- single-hit) // 03 hit (8- repeated hitting, 6- single-hit)
// 04 inf (0- passive, 1- enemy, 2- place, 4- self, 16- friend, 32- trap) // 04 inf (0- passive, 1- enemy, 2- place, 4- self, 16- friend, 32- trap)
// 05 pl attributes (0- nothing, 1- water, 2- earth, 3- fire, 4- wind, 5- poison, 6- saint, 7- darkness, 8- sense, 9- immortality) // 05 pl attributes (0- nothing, 1- water, 2- earth, 3- fire, 4- wind,
// 06 nk (0- normal skill, 1-no damage skill, 2-splash damage skill, 3-no damage area skill, 4-splash and split damage skill) // 5- poison, 6- saint, 7- darkness, 8- sense, 9- immortality)
// 06 nk (0- normal skill, 1-no damage skill, 2-splash damage skill,
// 3-no damage area skill, 4-splash and split damage skill)
// 07 splash/effect range (-1 for screen-wide) // 07 splash/effect range (-1 for screen-wide)
// 08 MaxLv // 08 MaxLv
// 09 Number of hits (when positive, damage is increased by hits, // 09 Number of hits (when positive, damage is increased by hits,

View File

@ -153,7 +153,7 @@ CREATE TABLE `guild` (
`mes2` varchar(120) NOT NULL default '', `mes2` varchar(120) NOT NULL default '',
`emblem_len` int(11) unsigned NOT NULL default '0', `emblem_len` int(11) unsigned NOT NULL default '0',
`emblem_id` int(11) unsigned NOT NULL default '0', `emblem_id` int(11) unsigned NOT NULL default '0',
`emblem_data` blob NULL default NULL, `emblem_data` blob,
PRIMARY KEY (`guild_id`,`char_id`), PRIMARY KEY (`guild_id`,`char_id`),
UNIQUE KEY `guild_id` (`guild_id`), UNIQUE KEY `guild_id` (`guild_id`),
KEY `char_id` (`char_id`), KEY `char_id` (`char_id`),

View File

@ -906,6 +906,7 @@ int parse_fromchar(int fd){
MYSQL_ROW sql_row = NULL; MYSQL_ROW sql_row = NULL;
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr.s_addr; unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr.s_addr;
unsigned long ipl = session[fd]->client_addr.sin_addr.s_addr;
char ip[16]; char ip[16];
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
@ -941,7 +942,7 @@ int parse_fromchar(int fd){
case 0x2709: case 0x2709:
if (log_login) if (log_login)
{ {
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', '%s','%s', 'GM reload request')", loginlog_db, *((unsigned int*)p),server[id].name, RETCODE); sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', '%s','%s', 'GM reload request')", loginlog_db, (unsigned int)ntohl(ipl),server[id].name, RETCODE);
if (mysql_query(&mysql_handle, tmpsql)) { if (mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle)); ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
@ -1452,7 +1453,7 @@ int lan_subnetcheck(long p) {
return 0; return 0;
} }
int login_ip_ban_check(unsigned char *p) int login_ip_ban_check(unsigned char *p, unsigned long ipl)
{ {
MYSQL_RES* sql_res; MYSQL_RES* sql_res;
MYSQL_ROW sql_row; MYSQL_ROW sql_row;
@ -1483,7 +1484,7 @@ int login_ip_ban_check(unsigned char *p)
if (log_login) if (log_login)
{ {
sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', 'unknown','-3', 'ip banned')", loginlog_db, *((unsigned int *)p)); sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', 'unknown','-3', 'ip banned')", loginlog_db, (unsigned int)ntohl(ipl));
// query // query
if(mysql_query(&mysql_handle, tmpsql)) { if(mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle)); ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
@ -1547,7 +1548,7 @@ int parse_login(int fd) {
packet_len = RFIFOREST(fd); packet_len = RFIFOREST(fd);
//Perform ip-ban check ONLY on login packets //Perform ip-ban check ONLY on login packets
if (ipban > 0 && login_ip_ban_check(p)) if (ipban > 0 && login_ip_ban_check(p,ipl))
{ {
RFIFOSKIP(fd,packet_len); RFIFOSKIP(fd,packet_len);
session[fd]->eof = 1; session[fd]->eof = 1;

View File

@ -7571,6 +7571,14 @@ int buildin_sc_start(struct script_state *st)
tick/=2; //Thrown potions only last half. tick/=2; //Thrown potions only last half.
val4 = 1; //Mark that this was a thrown sc_effect val4 = 1; //Mark that this was a thrown sc_effect
} }
if (type >= 0 && type < SC_MAX && val1 && !tick)
{ //When there isn't a duration specified, try to get it from the skill_db
tick = StatusSkillChangeTable[type];
if (tick)
tick = skill_get_time(tick,val1);
else //Failed to retrieve duration, reset to what it was.
tick = 0;
}
if (bl) if (bl)
status_change_start(bl,type,10000,val1,0,0,val4,tick,11); status_change_start(bl,type,10000,val1,0,0,val4,tick,11);
return 0; return 0;
@ -7593,6 +7601,15 @@ int buildin_sc_start2(struct script_state *st)
else else
bl = map_id2bl(st->rid); bl = map_id2bl(st->rid);
if (type >= 0 && type < SC_MAX && val1 && !tick)
{ //When there isn't a duration specified, try to get it from the skill_db
tick = StatusSkillChangeTable[type];
if (tick)
tick = skill_get_time(tick,val1);
else //Failed to retrieve duration, reset to what it was.
tick = 0;
}
if (potion_flag==1 && potion_target) { if (potion_flag==1 && potion_target) {
bl = map_id2bl(potion_target); bl = map_id2bl(potion_target);
tick/=2; tick/=2;
@ -7625,6 +7642,15 @@ int buildin_sc_start4(struct script_state *st)
else else
bl = map_id2bl(st->rid); bl = map_id2bl(st->rid);
if (type >= 0 && type < SC_MAX && val1 && !tick)
{ //When there isn't a duration specified, try to get it from the skill_db
tick = StatusSkillChangeTable[type];
if (tick)
tick = skill_get_time(tick,val1);
else //Failed to retrieve duration, reset to what it was.
tick = 0;
}
if (potion_flag==1 && potion_target) { if (potion_flag==1 && potion_target) {
bl = map_id2bl(potion_target); bl = map_id2bl(potion_target);
tick/=2; tick/=2;

View File

@ -760,6 +760,20 @@ int skill_get_range2 (struct block_list *bl, int id, int lv)
return status_get_range(bl); return status_get_range(bl);
range *=-1; range *=-1;
} }
if(!range && !(skill_get_inf(id)&INF_SELF_SKILL))
{ //Use weapon's basic range.
if (bl->type==BL_PC) {
struct map_session_data *sd = (TBL_PC*)bl;
range = sd->equip_index[EQI_HAND_R];
if (range >= 0 && sd->inventory_data[range])
range = sd->inventory_data[range]->range;
else
range = 1; //Assume fist range.
} else
range = status_get_range(bl);
}
//TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE //TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE
switch (id) { switch (id) {
case AC_SHOWER: case AC_SHOWER:
@ -10876,8 +10890,8 @@ void skill_init_unit_layout (void)
} }
case NJ_KAENSIN: case NJ_KAENSIN:
{ {
static const int dx[] = {-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,}; static const int dx[] = {-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
static const int dy[] = { 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,}; static const int dy[] = { 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2};
skill_unit_layout[pos].count = 24; skill_unit_layout[pos].count = 24;
memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx)); memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy)); memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));

View File

@ -87,6 +87,9 @@ void trade_tradeack(struct map_session_data *sd, int type) {
return; return;
} }
if (target_sd->state.trading || target_sd->trade_partner != sd->bl.id)
return; //Already trading or wrong partner.
//Copied here as well since the original character could had warped. //Copied here as well since the original character could had warped.
if (type == 3 && pc_isGM(target_sd) < lowest_gm_level && (sd->bl.m != target_sd->bl.m || if (type == 3 && pc_isGM(target_sd) < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
(sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) || (sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) ||
@ -98,13 +101,14 @@ void trade_tradeack(struct map_session_data *sd, int type) {
return; return;
} }
clif_tradestart(target_sd, type); //TODO: Type 4/3? What would 1/2 and the rest do?
clif_tradestart(sd, type);
if (type == 4) { // Cancel if (type == 4) { // Cancel
sd->state.deal_locked = 0; sd->state.deal_locked = 0;
sd->trade_partner = 0; sd->trade_partner = 0;
target_sd->state.deal_locked = 0; target_sd->state.deal_locked = 0;
target_sd->trade_partner = 0; target_sd->trade_partner = 0;
clif_tradestart(target_sd, type);
clif_tradestart(sd, type);
} }
if (type == 3) { //Initiate trade if (type == 3) { //Initiate trade
@ -112,21 +116,13 @@ void trade_tradeack(struct map_session_data *sd, int type) {
target_sd->state.trading = 1; target_sd->state.trading = 1;
memset(&sd->deal, 0, sizeof(sd->deal)); memset(&sd->deal, 0, sizeof(sd->deal));
memset(&target_sd->deal, 0, sizeof(target_sd->deal)); memset(&target_sd->deal, 0, sizeof(target_sd->deal));
} clif_tradestart(target_sd, type);
clif_tradestart(sd, type);
if (sd->npc_id) if (sd->npc_id)
npc_event_dequeue(sd); npc_event_dequeue(sd);
if (target_sd->npc_id) if (target_sd->npc_id)
npc_event_dequeue(target_sd); npc_event_dequeue(target_sd);
}
/* Why? It should be allowed to bring items from storage to inventory for trading, but not the other way around
* (this is blocked on clif.c) [Skotlex]
//close STORAGE window if it's open. It protects from spooffing packets [Lupus]
if (sd->state.storage_flag == 1)
storage_storageclose(sd);
else if (sd->state.storage_flag == 2)
storage_guild_storageclose(sd);
*/
} }
/*========================================== /*==========================================