- Added new settings for autotrade on battle/misc.conf (you can read descriptions there).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12243 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
7ff4f10106
commit
3868080ead
@ -3,6 +3,8 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2008/02/26
|
||||||
|
* Added new settings for Autotrade. [Zephyrus]
|
||||||
2008/02/23
|
2008/02/23
|
||||||
* Now the server will print an error message if an invalid mapflag is
|
* Now the server will print an error message if an invalid mapflag is
|
||||||
found during script loading (see bugreport:980 for the motivation)
|
found during script loading (see bugreport:980 for the motivation)
|
||||||
|
@ -107,3 +107,11 @@ duel_only_on_same_map: no
|
|||||||
// NOTE: For this setting to make effect you have to use a server compiled with
|
// NOTE: For this setting to make effect you have to use a server compiled with
|
||||||
// Cell Stack Limit support (see src/map/map.h)
|
// Cell Stack Limit support (see src/map/map.h)
|
||||||
cell_stack_limit: 1
|
cell_stack_limit: 1
|
||||||
|
|
||||||
|
// Allow autrade only in map with autotrade flag?
|
||||||
|
// Set this to "no" will allow autotrade where no "autotrade" mapflag is set
|
||||||
|
// Set this to "yes" to only allow autotrade on maps with "autotrade" mapflag
|
||||||
|
at_mapflag: no
|
||||||
|
|
||||||
|
// Set this to the amount of minutes autotrade chars will be kicked from the server.
|
||||||
|
at_timeout: 0
|
||||||
|
@ -2583,7 +2583,7 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap)
|
|||||||
if (flag)
|
if (flag)
|
||||||
status_zap(bl,md->status.hp, 0);
|
status_zap(bl,md->status.hp, 0);
|
||||||
else
|
else
|
||||||
status_kill(bl);
|
status_kill(bl);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2971,7 +2971,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma
|
|||||||
|
|
||||||
for (i = 0; param[i] != NULL; i++)
|
for (i = 0; param[i] != NULL; i++)
|
||||||
if (strcmpi(command, param[i]) == 0)
|
if (strcmpi(command, param[i]) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (param[i] == NULL || i > MAX_STATUS_TYPE) { // normally impossible...
|
if (param[i] == NULL || i > MAX_STATUS_TYPE) { // normally impossible...
|
||||||
sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustment>).");
|
sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustment>).");
|
||||||
@ -3886,7 +3886,7 @@ int atcommand_idsearch(const int fd, struct map_session_data* sd, const char* co
|
|||||||
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, match);
|
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, match);
|
||||||
clif_displaymessage(fd, atcmd_output);
|
clif_displaymessage(fd, atcmd_output);
|
||||||
match = MAX_SEARCH;
|
match = MAX_SEARCH;
|
||||||
}
|
}
|
||||||
for(i = 0; i < match; i++) {
|
for(i = 0; i < match; i++) {
|
||||||
sprintf(atcmd_output, msg_txt(78), item_array[i]->jname, item_array[i]->nameid); // %s: %d
|
sprintf(atcmd_output, msg_txt(78), item_array[i]->jname, item_array[i]->nameid); // %s: %d
|
||||||
clif_displaymessage(fd, atcmd_output);
|
clif_displaymessage(fd, atcmd_output);
|
||||||
@ -4940,7 +4940,7 @@ int atcommand_jail(const int fd, struct map_session_data* sd, const char* comman
|
|||||||
x = 24;
|
x = 24;
|
||||||
y = 75;
|
y = 75;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_index = mapindex_name2id(MAP_JAIL);
|
m_index = mapindex_name2id(MAP_JAIL);
|
||||||
x = 49;
|
x = 49;
|
||||||
y = 75;
|
y = 75;
|
||||||
@ -4948,7 +4948,7 @@ int atcommand_jail(const int fd, struct map_session_data* sd, const char* comman
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Duration of INT_MAX to specify infinity.
|
//Duration of INT_MAX to specify infinity.
|
||||||
sc_start4(&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
|
sc_start4(&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
|
||||||
clif_displaymessage(pl_sd->fd, msg_txt(117)); // GM has send you in jails.
|
clif_displaymessage(pl_sd->fd, msg_txt(117)); // GM has send you in jails.
|
||||||
clif_displaymessage(fd, msg_txt(118)); // Player warped in jails.
|
clif_displaymessage(fd, msg_txt(118)); // Player warped in jails.
|
||||||
return 0;
|
return 0;
|
||||||
@ -5075,9 +5075,9 @@ int atcommand_jailfor(const int fd, struct map_session_data* sd, const char* com
|
|||||||
} else {
|
} else {
|
||||||
get_jail_time(jailtime,&year,&month,&day,&hour,&minute);
|
get_jail_time(jailtime,&year,&month,&day,&hour,&minute);
|
||||||
sprintf(atcmd_output,msg_txt(402),"You are now",year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes
|
sprintf(atcmd_output,msg_txt(402),"You are now",year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes
|
||||||
clif_displaymessage(pl_sd->fd, atcmd_output);
|
clif_displaymessage(pl_sd->fd, atcmd_output);
|
||||||
sprintf(atcmd_output,msg_txt(402),"This player is now",year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes
|
sprintf(atcmd_output,msg_txt(402),"This player is now",year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes
|
||||||
clif_displaymessage(fd, atcmd_output);
|
clif_displaymessage(fd, atcmd_output);
|
||||||
}
|
}
|
||||||
} else if (jailtime < 0) {
|
} else if (jailtime < 0) {
|
||||||
clif_displaymessage(fd, "Invalid time for jail command.");
|
clif_displaymessage(fd, "Invalid time for jail command.");
|
||||||
@ -5508,14 +5508,14 @@ int atcommand_follow(const int fd, struct map_session_data* sd, const char* comm
|
|||||||
struct map_session_data *pl_sd = NULL;
|
struct map_session_data *pl_sd = NULL;
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
|
|
||||||
if (!message || !*message) {
|
if (!message || !*message) {
|
||||||
if (sd->followtarget == -1)
|
if (sd->followtarget == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
pc_stop_following (sd);
|
pc_stop_following (sd);
|
||||||
clif_displaymessage(fd, "Follow mode OFF.");
|
clif_displaymessage(fd, "Follow mode OFF.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
|
if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
|
||||||
{
|
{
|
||||||
@ -5816,7 +5816,7 @@ int atcommand_marry(const int fd, struct map_session_data* sd, const char* comma
|
|||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* @divorce by [MouseJstr], fixed by [Lupus]
|
* @divorce by [MouseJstr], fixed by [Lupus]
|
||||||
* divorce two players
|
* divorce two players
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int atcommand_divorce(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int atcommand_divorce(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
@ -5879,19 +5879,26 @@ int atcommand_changelook(const int fd, struct map_session_data* sd, const char*
|
|||||||
int atcommand_autotrade(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int atcommand_autotrade(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
if (sd->vender_id) //check if player's vending
|
if( sd->vender_id ) //check if player's vending
|
||||||
{
|
{
|
||||||
sd->state.autotrade = 1;
|
if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag )
|
||||||
clif_authfail_fd(fd, 15);
|
{
|
||||||
}
|
sd->state.autotrade = 1;
|
||||||
else
|
if( battle_config.at_timeout )
|
||||||
{
|
{
|
||||||
//"You should be vending to use @Autotrade."
|
int timeout = atoi(message);
|
||||||
clif_displaymessage(fd, msg_txt(549));
|
status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
clif_authfail_fd(fd, 15);
|
||||||
|
} else
|
||||||
|
clif_displaymessage(fd, "Autotrade is not allowed on this map.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
clif_displaymessage(fd, msg_txt(549)); // You should be vending to use @Autotrade.
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* @changegm by durf (changed by Lupus)
|
* @changegm by durf (changed by Lupus)
|
||||||
@ -5920,8 +5927,8 @@ int atcommand_changegm(const int fd, struct map_session_data* sd, const char* co
|
|||||||
}
|
}
|
||||||
|
|
||||||
guild_gm_change(sd->status.guild_id, pl_sd);
|
guild_gm_change(sd->status.guild_id, pl_sd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* @changeleader by Skotlex
|
* @changeleader by Skotlex
|
||||||
@ -5978,9 +5985,9 @@ int atcommand_changeleader(const int fd, struct map_session_data* sd, const char
|
|||||||
intif_party_leaderchange(p->party.party_id,p->party.member[pl_mi].account_id,p->party.member[pl_mi].char_id);
|
intif_party_leaderchange(p->party.party_id,p->party.member[pl_mi].account_id,p->party.member[pl_mi].char_id);
|
||||||
//Update info.
|
//Update info.
|
||||||
clif_party_info(p,NULL);
|
clif_party_info(p,NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* @partyoption by Skotlex
|
* @partyoption by Skotlex
|
||||||
@ -6023,8 +6030,8 @@ int atcommand_partyoption(const int fd, struct map_session_data* sd, const char*
|
|||||||
else
|
else
|
||||||
clif_displaymessage(fd, msg_txt(286));
|
clif_displaymessage(fd, msg_txt(286));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* @autoloot by Upa-Kun
|
* @autoloot by Upa-Kun
|
||||||
@ -6048,12 +6055,12 @@ int atcommand_autoloot(const int fd, struct map_session_data* sd, const char* co
|
|||||||
}
|
}
|
||||||
if (rate < 0) rate = 0;
|
if (rate < 0) rate = 0;
|
||||||
if (rate > 10000) rate = 10000;
|
if (rate > 10000) rate = 10000;
|
||||||
|
|
||||||
sd->state.autoloot = rate;
|
sd->state.autoloot = rate;
|
||||||
if (sd->state.autoloot) {
|
if (sd->state.autoloot) {
|
||||||
snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.",((double)sd->state.autoloot)/100.);
|
snprintf(atcmd_output, sizeof atcmd_output, "Autolooting items with drop rates of %0.02f%% and below.",((double)sd->state.autoloot)/100.);
|
||||||
clif_displaymessage(fd, atcmd_output);
|
clif_displaymessage(fd, atcmd_output);
|
||||||
}else
|
}else
|
||||||
clif_displaymessage(fd, "Autoloot is now off.");
|
clif_displaymessage(fd, "Autoloot is now off.");
|
||||||
|
|
||||||
if (sd->state.autoloot && sd->state.autolootid) {
|
if (sd->state.autoloot && sd->state.autolootid) {
|
||||||
@ -7134,7 +7141,7 @@ int atcommand_makehomun(const int fd, struct map_session_data* sd, const char* c
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
homunid = atoi(message);
|
homunid = atoi(message);
|
||||||
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
|
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
|
||||||
{
|
{
|
||||||
clif_displaymessage(fd, "Invalid Homunculus id.");
|
clif_displaymessage(fd, "Invalid Homunculus id.");
|
||||||
@ -7718,7 +7725,7 @@ int atcommand_monsterignore(const int fd, struct map_session_data* sd, const cha
|
|||||||
* => Gives your character a fake name. [Valaris]
|
* => Gives your character a fake name. [Valaris]
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int atcommand_fakename(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int atcommand_fakename(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
char name[NAME_LENGTH];
|
char name[NAME_LENGTH];
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
|
|
||||||
|
@ -3652,6 +3652,8 @@ static const struct _battle_data {
|
|||||||
{ "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration, 3600000, 0, INT_MAX, },
|
{ "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration, 3600000, 0, INT_MAX, },
|
||||||
{ "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate, 45000, 0, 100000, },
|
{ "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate, 45000, 0, 100000, },
|
||||||
{ "quest_exp_rate", &battle_config.quest_exp_rate, 100, 0, INT_MAX, },
|
{ "quest_exp_rate", &battle_config.quest_exp_rate, 100, 0, INT_MAX, },
|
||||||
|
{ "at_mapflag", &battle_config.autotrade_mapflag, 0, 0, 1, },
|
||||||
|
{ "at_timeout", &battle_config.at_timeout, 0, 0, INT_MAX, },
|
||||||
{ "homunculus_autoloot", &battle_config.homunculus_autoloot, 0, 0, 1, },
|
{ "homunculus_autoloot", &battle_config.homunculus_autoloot, 0, 0, 1, },
|
||||||
{ "idle_no_autoloot", &battle_config.idle_no_autoloot, 0, 0, INT_MAX, },
|
{ "idle_no_autoloot", &battle_config.idle_no_autoloot, 0, 0, INT_MAX, },
|
||||||
{ "max_guild_alliance", &battle_config.max_guild_alliance, 3, 1, 3, },
|
{ "max_guild_alliance", &battle_config.max_guild_alliance, 3, 1, 3, },
|
||||||
|
@ -438,6 +438,8 @@ extern struct Battle_Config
|
|||||||
int homunculus_show_growth ; //[orn]
|
int homunculus_show_growth ; //[orn]
|
||||||
int homunculus_friendly_rate;
|
int homunculus_friendly_rate;
|
||||||
int quest_exp_rate;
|
int quest_exp_rate;
|
||||||
|
int autotrade_mapflag;
|
||||||
|
int at_timeout;
|
||||||
int homunculus_autoloot;
|
int homunculus_autoloot;
|
||||||
int idle_no_autoloot;
|
int idle_no_autoloot;
|
||||||
int max_guild_alliance;
|
int max_guild_alliance;
|
||||||
|
@ -1564,6 +1564,8 @@ int map_quit(struct map_session_data *sd)
|
|||||||
//(changing map-servers invokes unit_free but bypasses map_quit)
|
//(changing map-servers invokes unit_free but bypasses map_quit)
|
||||||
if(sd->sc.count) {
|
if(sd->sc.count) {
|
||||||
//Status that are not saved...
|
//Status that are not saved...
|
||||||
|
if(sd->sc.data[SC_AUTOTRADE])
|
||||||
|
status_change_end(&sd->bl,SC_AUTOTRADE,-1);
|
||||||
if(sd->sc.data[SC_SPURT])
|
if(sd->sc.data[SC_SPURT])
|
||||||
status_change_end(&sd->bl,SC_SPURT,-1);
|
status_change_end(&sd->bl,SC_SPURT,-1);
|
||||||
if(sd->sc.data[SC_BERSERK])
|
if(sd->sc.data[SC_BERSERK])
|
||||||
|
@ -1168,6 +1168,7 @@ struct map_data {
|
|||||||
int npc_num;
|
int npc_num;
|
||||||
int users;
|
int users;
|
||||||
struct map_flag {
|
struct map_flag {
|
||||||
|
unsigned autotrade : 1;
|
||||||
unsigned allowks : 1; // [Kill Steal Protection]
|
unsigned allowks : 1; // [Kill Steal Protection]
|
||||||
unsigned nomemo : 1;
|
unsigned nomemo : 1;
|
||||||
unsigned noteleport : 1;
|
unsigned noteleport : 1;
|
||||||
|
@ -2318,6 +2318,8 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
|||||||
}
|
}
|
||||||
map[m].flag.nosave = state;
|
map[m].flag.nosave = state;
|
||||||
}
|
}
|
||||||
|
else if (!strcmpi(w3,"autotrade"))
|
||||||
|
map[m].flag.autotrade=state;
|
||||||
else if (!strcmpi(w3,"allowks"))
|
else if (!strcmpi(w3,"allowks"))
|
||||||
map[m].flag.allowks=state; // [Kill Steal Protection]
|
map[m].flag.allowks=state; // [Kill Steal Protection]
|
||||||
else if (!strcmpi(w3,"nomemo"))
|
else if (!strcmpi(w3,"nomemo"))
|
||||||
|
@ -4206,7 +4206,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
|
|||||||
case SC_INCHITRATE: case SC_INCATKRATE: case SC_NEN:
|
case SC_INCHITRATE: case SC_INCATKRATE: case SC_NEN:
|
||||||
case SC_READYSTORM: case SC_READYDOWN: case SC_READYTURN:
|
case SC_READYSTORM: case SC_READYDOWN: case SC_READYTURN:
|
||||||
case SC_READYCOUNTER:case SC_DODGE: case SC_WARM:
|
case SC_READYCOUNTER:case SC_DODGE: case SC_WARM:
|
||||||
case SC_SPEEDUP1:
|
case SC_SPEEDUP1: case SC_AUTOTRADE:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
|
if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "script.h"
|
#include "script.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "mercenary.h"
|
#include "mercenary.h"
|
||||||
|
#include "vending.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -6489,6 +6490,15 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
|
|||||||
status_set_hp(bl, 10, 0);
|
status_set_hp(bl, 10, 0);
|
||||||
status_set_sp(bl, 10, 0);
|
status_set_sp(bl, 10, 0);
|
||||||
break;
|
break;
|
||||||
|
case SC_AUTOTRADE:
|
||||||
|
if (tid == -1)
|
||||||
|
break;
|
||||||
|
vending_closevending(sd);
|
||||||
|
map_quit(sd);
|
||||||
|
// Because map_quit calls status_change_end with tid -1
|
||||||
|
// from here it's not neccesary to continue
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_flag = 1;
|
opt_flag = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user