summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt11
-rw-r--r--db/skill_db.txt9
-rw-r--r--sql-files/main.sql2
-rw-r--r--src/login_sql/login.c9
-rw-r--r--src/map/script.c26
-rw-r--r--src/map/skill.c18
-rw-r--r--src/map/trade.c32
7 files changed, 79 insertions, 28 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index e51d38760..81653f12d 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -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.
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]
2006/08/09
* Fixed Asura not wasting all SP away when it fails on cast-end. [Skotlex]
diff --git a/db/skill_db.txt b/db/skill_db.txt
index 3df736ec4..c8129c4d4 100644
--- a/db/skill_db.txt
+++ b/db/skill_db.txt
@@ -1,10 +1,13 @@
//id,range,hit,inf,pl,nk,splash,max,list_num,castcancel,cast_defence_rate,inf2,maxcount,skill_type,blow_count
// 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)
// 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)
-// 06 nk (0- normal skill, 1-no damage skill, 2-splash damage skill, 3-no damage area skill, 4-splash and split damage skill)
+// 05 pl attributes (0- nothing, 1- water, 2- earth, 3- fire, 4- wind,
+// 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)
// 08 MaxLv
// 09 Number of hits (when positive, damage is increased by hits,
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 4d9b13869..ecf8fd01b 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -153,7 +153,7 @@ CREATE TABLE `guild` (
`mes2` varchar(120) NOT NULL default '',
`emblem_len` 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`),
UNIQUE KEY `guild_id` (`guild_id`),
KEY `char_id` (`char_id`),
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 4c9393bc8..7cc240dcf 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -906,6 +906,7 @@ int parse_fromchar(int fd){
MYSQL_ROW sql_row = NULL;
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];
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:
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)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
@@ -1452,7 +1453,7 @@ int lan_subnetcheck(long p) {
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_ROW sql_row;
@@ -1483,7 +1484,7 @@ int login_ip_ban_check(unsigned char *p)
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
if(mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
@@ -1547,7 +1548,7 @@ int parse_login(int fd) {
packet_len = RFIFOREST(fd);
//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);
session[fd]->eof = 1;
diff --git a/src/map/script.c b/src/map/script.c
index 73b3b6e89..377785fe4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7571,6 +7571,14 @@ int buildin_sc_start(struct script_state *st)
tick/=2; //Thrown potions only last half.
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)
status_change_start(bl,type,10000,val1,0,0,val4,tick,11);
return 0;
@@ -7593,6 +7601,15 @@ int buildin_sc_start2(struct script_state *st)
else
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) {
bl = map_id2bl(potion_target);
tick/=2;
@@ -7625,6 +7642,15 @@ int buildin_sc_start4(struct script_state *st)
else
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) {
bl = map_id2bl(potion_target);
tick/=2;
diff --git a/src/map/skill.c b/src/map/skill.c
index 3d7435dbe..8691aaff0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -760,6 +760,20 @@ int skill_get_range2 (struct block_list *bl, int id, int lv)
return status_get_range(bl);
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
switch (id) {
case AC_SHOWER:
@@ -10876,8 +10890,8 @@ void skill_init_unit_layout (void)
}
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 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 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};
skill_unit_layout[pos].count = 24;
memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
diff --git a/src/map/trade.c b/src/map/trade.c
index 3bbf4385b..93f8490d4 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -86,7 +86,10 @@ void trade_tradeack(struct map_session_data *sd, int type) {
sd->trade_partner=0;
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.
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) ||
@@ -97,14 +100,15 @@ void trade_tradeack(struct map_session_data *sd, int type) {
clif_tradestart(sd, 0); // too far
return;
}
-
- clif_tradestart(target_sd, type);
- clif_tradestart(sd, type);
+
+ //TODO: Type 4/3? What would 1/2 and the rest do?
if (type == 4) { // Cancel
sd->state.deal_locked = 0;
sd->trade_partner = 0;
target_sd->state.deal_locked = 0;
target_sd->trade_partner = 0;
+ clif_tradestart(target_sd, type);
+ clif_tradestart(sd, type);
}
if (type == 3) { //Initiate trade
@@ -112,21 +116,13 @@ void trade_tradeack(struct map_session_data *sd, int type) {
target_sd->state.trading = 1;
memset(&sd->deal, 0, sizeof(sd->deal));
memset(&target_sd->deal, 0, sizeof(target_sd->deal));
+ clif_tradestart(target_sd, type);
+ clif_tradestart(sd, type);
+ if (sd->npc_id)
+ npc_event_dequeue(sd);
+ if (target_sd->npc_id)
+ npc_event_dequeue(target_sd);
}
-
- if (sd->npc_id)
- npc_event_dequeue(sd);
- if (target_sd->npc_id)
- 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);
- */
}
/*==========================================