Fixed cast time not being reduced for SC__LAZINESS - Fixes bugreport:7795

Script commands 'sit' and 'stand' now work only when character is in required state. (Euphy)

~ Hercules Merges ~
* Added extra support to GM unload NPC via right-click [credits: Ind]
* Implemented real-time server stats (in and out data and ram usage). [credits: Ai4rei, mkbu95]
* Fixed chatrooms disappearing after using @disguise. [credits: MatiasSW]
* Implemented 'notomb' mapflag for Bossnia maps. [credits: CairoLee]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17404 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
akinari1087 2013-07-07 03:08:24 +00:00
parent b5eb9a8fc2
commit de7b41c4f9
17 changed files with 141 additions and 21 deletions

View File

@ -374,6 +374,7 @@ mf_noitemconsumption 55
mf_sumstartmiracle 56
mf_nomineeffect 57
mf_nolockon 58
mf_notomb 59
cell_walkable 0
cell_shootable 1

View File

@ -3,7 +3,7 @@
//===== By: ==================================================
//= rAthena Dev Team
//===== Current Version: =====================================
//= 20130527
//= 20130706
//===== Description: =========================================
//= List of available mapflags and their functions.
//============================================================
@ -355,3 +355,9 @@ This only applies if map channels are enabled and 'map_local_channel_autojoin' i
in '/conf/channels.conf'.
---------------------------------------
*notomb
Disables MVP tombs from appearing on a map.
---------------------------------------

View File

@ -5169,7 +5169,7 @@ everything not equippable by the new job class anyway.
*sit {"<character name>"};
*stand {"<character name>"};
These commands will make a character sit if standing and stand if sitting.
These commands will make a character sit or stand.
If no character is specified, the command will run for the invoking character.
---------------------------------------

19
npc/mapflag/notomb.txt Normal file
View File

@ -0,0 +1,19 @@
//===== rAthena Script =======================================
//= Mapflag: Disable MVP Tomb.
//===== By: ==================================================
//= rAthena Dev Team
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Disables MVP tomb on a map.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//============================================================
// Bossnia ====================
bossnia_01 mapflag notomb
bossnia_02 mapflag notomb
bossnia_03 mapflag notomb
bossnia_04 mapflag notomb

View File

@ -11,6 +11,7 @@ npc: npc/mapflag/nomemo.txt
npc: npc/mapflag/nopenalty.txt
npc: npc/mapflag/nosave.txt
npc: npc/mapflag/noteleport.txt
npc: npc/mapflag/notomb.txt
npc: npc/mapflag/noreturn.txt
npc: npc/mapflag/noskill.txt
npc: npc/mapflag/nowarp.txt

View File

@ -220,6 +220,13 @@ int naddr_ = 0; // # of ip addresses
// Larger packets cause a buffer overflow and stack corruption.
static size_t socket_max_client_packet = 24576;
#ifdef SHOW_SERVER_STATS
// Data I/O statistics
static size_t socket_data_i = 0, socket_data_ci = 0, socket_data_qi = 0;
static size_t socket_data_o = 0, socket_data_co = 0, socket_data_qo = 0;
static time_t socket_data_last_tick = 0;
#endif
// initial recv buffer size (this will also be the max. size)
// biggest known packet: S 0153 <len>.w <emblem data>.?B -> 24x24 256 color .bmp (0153 + len.w + 1618/1654/1756 bytes)
#define RFIFO_SIZE (2*1024)
@ -358,6 +365,14 @@ int recv_to_fifo(int fd)
session[fd]->rdata_size += len;
session[fd]->rdata_tick = last_tick;
#ifdef SHOW_SERVER_STATS
socket_data_i += len;
socket_data_qi += len;
if (!session[fd]->flag.server)
{
socket_data_ci += len;
}
#endif
return 0;
}
@ -377,6 +392,9 @@ int send_from_fifo(int fd)
{//An exception has occured
if( sErrno != S_EWOULDBLOCK ) {
//ShowDebug("send_from_fifo: %s, ending connection #%d\n", error_msg(), fd);
#ifdef SHOW_SERVER_STATS
socket_data_qo -= session[fd]->wdata_size;
#endif
session[fd]->wdata_size = 0; //Clear the send queue as we can't send anymore. [Skotlex]
set_eof(fd);
}
@ -391,6 +409,14 @@ int send_from_fifo(int fd)
memmove(session[fd]->wdata, session[fd]->wdata + len, session[fd]->wdata_size - len);
session[fd]->wdata_size -= len;
#ifdef SHOW_SERVER_STATS
socket_data_o += len;
socket_data_qo -= len;
if (!session[fd]->flag.server)
{
socket_data_co += len;
}
#endif
}
return 0;
@ -582,6 +608,10 @@ static void delete_session(int fd)
{
if( session_isValid(fd) )
{
#ifdef SHOW_SERVER_STATS
socket_data_qi -= session[fd]->rdata_size - session[fd]->rdata_pos;
socket_data_qo -= session[fd]->wdata_size;
#endif
aFree(session[fd]->rdata);
aFree(session[fd]->wdata);
aFree(session[fd]->session_data);
@ -650,6 +680,9 @@ int RFIFOSKIP(int fd, size_t len)
}
s->rdata_pos = s->rdata_pos + len;
#ifdef SHOW_SERVER_STATS
socket_data_qi -= len;
#endif
return 0;
}
@ -703,6 +736,9 @@ int WFIFOSET(int fd, size_t len)
}
s->wdata_size += len;
#ifdef SHOW_SERVER_STATS
socket_data_qo += len;
#endif
//If the interserver has 200% of its normal size full, flush the data.
if( s->flag.server && s->wdata_size >= 2*FIFOSIZE_SERVERLINK )
flush_fifo(fd);
@ -829,6 +865,23 @@ int do_sockets(int next)
RFIFOFLUSH(i);
}
#ifdef SHOW_SERVER_STATS
if (last_tick != socket_data_last_tick)
{
char buf[1024];
sprintf(buf, "In: %.03f kB/s (%.03f kB/s, Q: %.03f kB) | Out: %.03f kB/s (%.03f kB/s, Q: %.03f kB) | RAM: %.03f MB", socket_data_i/1024., socket_data_ci/1024., socket_data_qi/1024., socket_data_o/1024., socket_data_co/1024., socket_data_qo/1024., malloc_usage()/1024.);
#ifdef _WIN32
SetConsoleTitle(buf);
#else
ShowMessage("\033[s\033[1;1H\033[2K%s\033[u", buf);
#endif
socket_data_last_tick = last_tick;
socket_data_i = socket_data_ci = 0;
socket_data_o = socket_data_co = 0;
}
#endif
return 0;
}

View File

@ -5,6 +5,7 @@
#define _SOCKET_H_
#include "../common/cbasetypes.h"
#include "../config/core.h"
#ifdef WIN32
#include "../common/winapi.h"

View File

@ -56,6 +56,9 @@
/// By default, we recover/remove Guild/Party Bound items automatically
#define BOUND_ITEMS
/// Uncomment to enable real-time server stats (in and out data and ram usage).
//#define SHOW_SERVER_STATS
/**
* No settings past this point
**/

View File

@ -7655,7 +7655,7 @@ ACMD_FUNC(mapflag) {
checkflag(nogo); checkflag(nobaseexp);
checkflag(nojobexp); checkflag(nomobloot); checkflag(nomvploot); checkflag(nightenabled);
checkflag(restricted); checkflag(nodrop); checkflag(novending); checkflag(loadevent);
checkflag(nochat); checkflag(partylock); checkflag(guildlock);
checkflag(nochat); checkflag(partylock); checkflag(guildlock); checkflag(notomb);
clif_displaymessage(sd->fd," ");
clif_displaymessage(sd->fd,msg_txt(sd,1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif_displaymessage(sd->fd,msg_txt(sd,1313)); // Type "@mapflag available" to list the available mapflags.
@ -7675,7 +7675,7 @@ ACMD_FUNC(mapflag) {
setflag(nogo); setflag(nobaseexp);
setflag(nojobexp); setflag(nomobloot); setflag(nomvploot); setflag(nightenabled);
setflag(restricted); setflag(nodrop); setflag(novending); setflag(loadevent);
setflag(nochat); setflag(partylock); setflag(guildlock);
setflag(nochat); setflag(partylock); setflag(guildlock); setflag(notomb);
clif_displaymessage(sd->fd,msg_txt(sd,1314)); // Invalid flag name or flag.
clif_displaymessage(sd->fd,msg_txt(sd,1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
@ -7687,7 +7687,7 @@ ACMD_FUNC(mapflag) {
clif_displaymessage(sd->fd,"nozenypenalty, notrade, noskill, nowarp, nowarpto, noicewall, snow, clouds, clouds2,");
clif_displaymessage(sd->fd,"fog, fireworks, sakura, leaves, nogo, nobaseexp, nojobexp, nomobloot,");
clif_displaymessage(sd->fd,"nomvploot, nightenabled, restricted, nodrop, novending, loadevent, nochat, partylock,");
clif_displaymessage(sd->fd,"guildlock");
clif_displaymessage(sd->fd,"guildlock, notomb");
#undef checkflag
#undef setflag

View File

@ -12538,9 +12538,12 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
case BL_NPC:
{
char command[NAME_LENGTH+11];
sprintf(command, "%cunloadnpc %s", atcommand_symbol, status_get_name(target));
is_atcommand(fd, sd, command, 1);
struct npc_data* nd = (struct npc_data *)target;
if( pc_can_use_command(sd, "unloadnpc", COMMAND_ATCOMMAND)) {
npc_unload_duplicates(nd);
npc_unload(nd,true);
npc_read_event_script();
}
}
break;

View File

@ -582,6 +582,7 @@ struct map_data {
unsigned nosumstarmiracle : 1; //allow SG miracle to happen ?
unsigned nomineeffect : 1; //allow /mineeffect
unsigned nolockon : 1;
unsigned notomb : 1;
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];

View File

@ -2633,7 +2633,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
return 5; // Note: Actually, it's 4. Oh well...
// MvP tomb [GreenBox]
if (battle_config.mvp_tomb_enabled && md->spawn->state.boss)
if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && map[md->bl.m].flag.notomb != 1)
mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL));
if( !rebirth )

View File

@ -3448,6 +3448,8 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
map[m].flag.nomineeffect = state;
else if (!strcmpi(w3,"nolockon"))
map[m].flag.nolockon = state;
else if (!strcmpi(w3,"notomb"))
map[m].flag.notomb = state;
else
ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer));

View File

@ -17,6 +17,7 @@
#include "battle.h" // battle_config
#include "battleground.h"
#include "channel.h"
#include "chat.h"
#include "chrif.h"
#include "clif.h"
#include "date.h" // is_day_of_*()
@ -1713,6 +1714,13 @@ int pc_disguise(struct map_session_data *sd, int class_)
clif_cartlist(sd);
clif_updatestatus(sd,SP_CARTINFO);
}
if (sd->chatID) {
struct chat_data* cd;
nullpo_retr(1, sd);
cd = (struct chat_data*)map_id2bl(sd->chatID);
if( cd != NULL || (struct block_list*)sd == cd->owner )
clif_dispchat(cd,0);
}
}
return 1;
}

View File

@ -410,6 +410,7 @@ enum {
MF_SUMSTARTMIRACLE,
MF_NOMINEEFFECT,
MF_NOLOCKON,
MF_NOTOMB
};
const char* script_op2name(int op)
@ -10702,6 +10703,7 @@ BUILDIN_FUNC(getmapflag)
case MF_SUMSTARTMIRACLE: script_pushint(st,map[m].flag.nosumstarmiracle); break;
case MF_NOMINEEFFECT: script_pushint(st,map[m].flag.nomineeffect); break;
case MF_NOLOCKON: script_pushint(st,map[m].flag.nolockon); break;
case MF_NOTOMB: script_pushint(st,map[m].flag.notomb); break;
}
}
@ -10809,6 +10811,7 @@ BUILDIN_FUNC(setmapflag)
case MF_SUMSTARTMIRACLE: map[m].flag.nosumstarmiracle = 1 ; break;
case MF_NOMINEEFFECT: map[m].flag.nomineeffect = 1 ; break;
case MF_NOLOCKON: map[m].flag.nolockon = 1 ; break;
case MF_NOTOMB: map[m].flag.notomb = 1; break;
}
}
@ -10907,6 +10910,7 @@ BUILDIN_FUNC(removemapflag)
case MF_SUMSTARTMIRACLE: map[m].flag.nosumstarmiracle = 0 ; break;
case MF_NOMINEEFFECT: map[m].flag.nomineeffect = 0 ; break;
case MF_NOLOCKON: map[m].flag.nolockon = 0 ; break;
case MF_NOTOMB: map[m].flag.notomb = 0; break;
}
}
@ -17491,10 +17495,12 @@ BUILDIN_FUNC(consumeitem)
return 0;
}
/* Make a player sit/stand.
/*=======================================================
* Make a player sit/stand.
* sit {"<character name>"};
* stand {"<character name>"};
* Note: Use readparam(Sitting) which returns 1 or 0 (sitting or standing). */
* Note: Use readparam(Sitting) which returns 1 or 0 (sitting or standing).
*-------------------------------------------------------*/
BUILDIN_FUNC(sit)
{
TBL_PC *sd;
@ -17507,11 +17513,7 @@ BUILDIN_FUNC(sit)
if( sd == NULL)
return 0;
if( pc_issit(sd) ) {
pc_setstand(sd);
skill_sit(sd, 0);
clif_standing(&sd->bl);
} else {
if( !pc_issit(sd) ) {
unit_stop_walking(&sd->bl, 1|4);
pc_setsit(sd);
skill_sit(sd, 1);
@ -17520,6 +17522,27 @@ BUILDIN_FUNC(sit)
return 0;
}
BUILDIN_FUNC(stand)
{
TBL_PC *sd;
if( script_hasdata(st, 2) )
sd = map_nick2sd(script_getstr(st, 2));
else
sd = script_rid2sd(st);
if( sd == NULL)
return 0;
if( pc_issit(sd) ) {
pc_setstand(sd);
skill_sit(sd, 0);
clif_standing(&sd->bl);
}
return 0;
}
/*==========================================
* countbound {<type>};
@ -18000,7 +18023,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(consumeitem,"v"),
BUILDIN_DEF(delequip,"i"),
BUILDIN_DEF(sit,"?"),
BUILDIN_DEF2(sit,"stand","?"),
BUILDIN_DEF(stand,"?"),
/**
* @commands (script based)
**/

View File

@ -6247,7 +6247,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
clif_item_identify_list(sd);
if( sd->menuskill_id != MC_IDENTIFY ) {/* failed, dont consume anything, return */
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
map_freeblock_unlock();
return 1;
}
@ -14242,6 +14241,8 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
// All variable cast additive bonuses must come first
if (sc->data[SC_SLOWCAST])
VARCAST_REDUCTION(-sc->data[SC_SLOWCAST]->val2);
if( sc->data[SC__LAZINESS] )
VARCAST_REDUCTION(-sc->data[SC__LAZINESS]->val2);
// Variable cast reduction bonuses
if (sc->data[SC_SUFFRAGIUM]) {
@ -14260,8 +14261,6 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WATER))
VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells.
// Fixed cast reduction bonuses
if( sc->data[SC__LAZINESS] )
fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
if( sc->data[SC_SECRAMENT] )
fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2);
if( sd && ( skill_lv = pc_checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP )

View File

@ -8394,7 +8394,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
}
break;
case SC__LAZINESS:
val2 = 10 + 10 * val1; // Cast reduction
val2 = 10 + 10 * val1; // Cast Increase
val3 = 10 * val1; // Flee Reduction
val_flag |= 1|2|4;
break;