- 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:
zephyrus 2008-02-26 22:14:05 +00:00
parent 7ff4f10106
commit 3868080ead
10 changed files with 76 additions and 40 deletions

View File

@ -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)

View File

@ -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

View File

@ -5879,20 +5879,27 @@ 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
{
if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag )
{ {
sd->state.autotrade = 1; sd->state.autotrade = 1;
if( battle_config.at_timeout )
{
int timeout = atoi(message);
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);
}
clif_authfail_fd(fd, 15); clif_authfail_fd(fd, 15);
} else
clif_displaymessage(fd, "Autotrade is not allowed on this map.");
} }
else else
{ clif_displaymessage(fd, msg_txt(549)); // You should be vending to use @Autotrade.
//"You should be vending to use @Autotrade."
clif_displaymessage(fd, msg_txt(549));
}
return 0; return 0;
} }
/*========================================== /*==========================================
* @changegm by durf (changed by Lupus) * @changegm by durf (changed by Lupus)
* Changes Master of your Guild to a specified guild member * Changes Master of your Guild to a specified guild member

View File

@ -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, },

View File

@ -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;

View File

@ -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])

View File

@ -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;

View File

@ -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"))

View File

@ -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.

View File

@ -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;