Merge branch 'Upstream/master'

This commit is contained in:
nanakiwurtz 2013-12-21 15:51:15 +07:00
commit 5b75c045cc
28 changed files with 10824 additions and 10535 deletions

View File

@ -23,7 +23,7 @@ get_status(){
ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1)
PSRUN=$(echo "$ISRUN" | awk '{ print substr( $0, 0, 7) }')
fi
return $PSRUN
#return ${PSRUN} #seem to cause issue for some os
}
#cheking if already started, launch and mark in log

View File

@ -88,9 +88,8 @@ max_connect_user: -1
// See: conf/groups.conf
gm_allow_group: 99
// How often should the server save all files? (In seconds)
// Note: Applies to all data files on TXT servers.
// On SQL servers, it applies to guilds (character save interval is defined on the map config)
// How often should the server save guild infos? (In seconds)
// (character save interval is defined on the map config (autosave_time))
autosave_time: 60
// Display information on the console whenever characters/guilds/parties/pets are loaded/saved?

View File

@ -14,18 +14,18 @@
//585,Wurst,Brusti,11,2,,40,,,,,0xFFFFFFFF,7,2,,,,,,{ itemheal rand(15,20),0; itemskill "PR_MAGNIFICAT",3; },{},{}
//679,Gold_Pill,Pilule,0,5000,,300,,,,,0xFFFFFFFF,7,2,,,,,,{ percentheal 50,50; },{},{}
//2681,Republic_Ring,Republic Anniversary Ring,5,20,,100,,0,,0,0xFFFFFFFF,7,2,136,,0,0,0,{ bonus bAllStats,3; },{},{}
//2681,Republic_Ring,Republic Anniversary Ring,4,20,,100,,0,,0,0xFFFFFFFF,7,2,136,,0,0,0,{ bonus bAllStats,3; },{},{}
//5134,Pumpkin_Hat,Pumpkin-Head,5,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus2 bSubRace,RC_Demon,5; },{},{}
//5136,Santa's_Hat_,Louise's Santa Hat,5,20,,100,,3,,0,0xFFFFFFFF,7,2,256,,0,1,20,{ bonus bMdef,1; bonus bLuk,1; bonus3 bAutoSpellWhenHit,"AL_HEAL",3,50; bonus3 bAutoSpellWhenHit,"AL_BLESSING",10,50; },{},{}
//5145,Carnival_Joker_Jester,Carnival Jester,5,10,,100,,0,,0,0xFFFFFFFF,7,2,256,,0,1,89,{ bonus bAllStats,3; },{},{}
//5147,Baseball_Cap,Baseball Cap,5,0,,200,,3,,0,0xFFFFFFFF,7,2,256,,0,1,216,{ bonus2 bExpAddRace,RC_Boss,50; bonus2 bExpAddRace,RC_NonBoss,50; },{},{}
//5201,Party_Hat_B,2nd Anniversary Party Hat,5,20,,300,,3,,0,0xFFFFFFFF,7,2,256,,0,1,144,{ bonus bAllStats,3; },{},{}
//5202,Pumpkin_Hat_,Pumpkin Hat,5,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bAllStats,2; bonus2 bSubRace,RC_Demon,5; bonus3 bAddMonsterDropItem,529,RC_DemiHuman,1500; },{},{}
//5204,Event_Pierrot_Nose,Rudolf's Red Nose,5,20,,100,,0,,0,0xFFFFFFFF,7,2,1,,0,0,49,{ bonus2 bResEff,Eff_Blind,3000; bonus2 bAddMonsterDropItem,12130,30; },{},{}
//5264,Aussie_Flag_Hat,Australian Flag Hat,5,20,,500,,4,,0,0xFFFFFFFF,7,2,256,,0,1,304,{ bonus bAllStats,2; },{},{}
//5356,Pumpkin_Hat_H,Pumpkin Hat,5,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bAllStats,2; bonus2 bSubRace,RC_Demon,5; bonus2 bMagicAddRace,RC_Demon,5; },{},{}
//5811,Santa_Beard,Santa Beard,5,20,,100,,5,,0,0xFFFFFFFF,7,2,1,,0,0,25,{ bonus2 bSubRace,RC_Brute,5; },{},{}
//5134,Pumpkin_Hat,Pumpkin-Head,4,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus2 bSubRace,RC_Demon,5; },{},{}
//5136,Santa's_Hat_,Louise's Santa Hat,4,20,,100,,3,,0,0xFFFFFFFF,7,2,256,,0,1,20,{ bonus bMdef,1; bonus bLuk,1; bonus3 bAutoSpellWhenHit,"AL_HEAL",3,50; bonus3 bAutoSpellWhenHit,"AL_BLESSING",10,50; },{},{}
//5145,Carnival_Joker_Jester,Carnival Jester,4,10,,100,,0,,0,0xFFFFFFFF,7,2,256,,0,1,89,{ bonus bAllStats,3; },{},{}
//5147,Baseball_Cap,Baseball Cap,4,0,,200,,3,,0,0xFFFFFFFF,7,2,256,,0,1,216,{ bonus2 bExpAddRace,RC_Boss,50; bonus2 bExpAddRace,RC_NonBoss,50; },{},{}
//5201,Party_Hat_B,2nd Anniversary Party Hat,4,20,,300,,3,,0,0xFFFFFFFF,7,2,256,,0,1,144,{ bonus bAllStats,3; },{},{}
//5202,Pumpkin_Hat_,Pumpkin Hat,4,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bAllStats,2; bonus2 bSubRace,RC_Demon,5; bonus3 bAddMonsterDropItem,529,RC_DemiHuman,1500; },{},{}
//5204,Event_Pierrot_Nose,Rudolf's Red Nose,4,20,,100,,0,,0,0xFFFFFFFF,7,2,1,,0,0,49,{ bonus2 bResEff,Eff_Blind,3000; bonus2 bAddMonsterDropItem,12130,30; },{},{}
//5264,Aussie_Flag_Hat,Australian Flag Hat,4,20,,500,,4,,0,0xFFFFFFFF,7,2,256,,0,1,304,{ bonus bAllStats,2; },{},{}
//5356,Pumpkin_Hat_H,Pumpkin Hat,4,20,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bAllStats,2; bonus2 bSubRace,RC_Demon,5; bonus2 bMagicAddRace,RC_Demon,5; },{},{}
//5811,Santa_Beard,Santa Beard,4,20,,100,,5,,0,0xFFFFFFFF,7,2,1,,0,0,25,{ bonus2 bSubRace,RC_Brute,5; },{},{}
//11702,Moon_Cookie,Moon Cookie,11,0,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_end SC_Poison; sc_end SC_Silence; sc_end SC_Blind; sc_end SC_Confusion; sc_end SC_Curse; sc_end SC_Hallucination; itemskill "AL_BLESSING",7; },{},{}
//12131,Lucky_Potion,Lucky Potion,0,2,,100,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_LUKFood,180000,15; },{},{}
@ -49,15 +49,15 @@
//7946,Gold_Ring_Of_Valentine,Gold Ring Of Valentine,3,10,,0,,,,,,,,,,,,,{},{},{}
//7947,Silver_Ring_Of_Valentine,Silver Ring Of Valentine,3,10,,0,,,,,,,,,,,,,{},{},{}
//7948,Box,Box,3,10,,10,,,,,,,,,,,,,{},{},{}
//5817,Valentine's_Emblem,Valentine's Emblem,5,10,,0,,3,,0,0xFFFFFFFF,7,2,136,,0,0,0,{ bonus bAtkRate,3; bonus bMatkRate,3; bonus bAllStats,2; bonus bFlee,10; bonus bAspd,1; bonus bMdef,3; bonus2 bSkillAtk,"AL_HEAL",10; bonus2 bSkillHeal,"AL_HEAL",10; bonus2 bSkillHeal,"AM_POTIONPITCHER",10; bonus2 bAddItemHealRate,IG_Potion,10; },{},{}
//5817,Valentine's_Emblem,Valentine's Emblem,4,10,,0,,3,,0,0xFFFFFFFF,7,2,136,,0,0,0,{ bonus bAtkRate,3; bonus bMatkRate,3; bonus bAllStats,2; bonus bFlee,10; bonus bAspd,1; bonus bMdef,3; bonus2 bSkillAtk,"AL_HEAL",10; bonus2 bSkillHeal,"AL_HEAL",10; bonus2 bSkillHeal,"AM_POTIONPITCHER",10; bonus2 bAddItemHealRate,IG_Potion,10; },{},{}
// iRO Halloween Event 2009
//=============================================================
//5668,Weird_Pumpkin_Hat,Weird Pumpkin Hat,5,20,,0,,5,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bMdef,5; bonus2 bAddMonsterDropItem,12192,2500; },{},{}
//5668,Weird_Pumpkin_Hat,Weird Pumpkin Hat,4,20,,0,,5,,0,0xFFFFFFFF,7,2,256,,0,1,206,{ bonus bMdef,5; bonus2 bAddMonsterDropItem,12192,2500; },{},{}
//6298,Crushed_Pumpkin,Crushed Pumpkin,3,0,,0,,,,,,,,,,,,,{},{},{}
//6299,Worn_Fabric,Worn Fabric,3,0,,0,,,,,,,,,,,,,{},{},{}
// Old Tuxedo and Wedding Dress, will display the outfit when worn.
//==================================================================
//2338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,0xFFFFFFFE,7,0,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }
//7170,Tuxedo,Tuxedo,5,43000,,10,,0,,0,0xFFFFFFFE,7,1,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }
//2338,Wedding_Dress,Wedding Dress,4,43000,,500,,0,,0,0xFFFFFFFE,7,0,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }
//7170,Tuxedo,Tuxedo,4,43000,,10,,0,,0,0xFFFFFFFE,7,1,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }

View File

@ -463,6 +463,7 @@ packet_ver: 5
//0x020b,-1
//0x020c,-1
0x020d,-1
0x8d6,6,ZC_CLEAR_DIALOG,2
//2004-07-05aSakexe
packet_ver: 6

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2309,14 +2309,14 @@ int mapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint8 isvip, uint32 gro
* @param mapfd: link to mapserv for ack
* @return 0 if succes
*/
int loginif_reqviddata(uint32 aid, uint8 type, int add_vip_time, int mapfd) {
int loginif_reqviddata(uint32 aid, uint8 type, int32 timediff, int mapfd) {
loginif_check(-1);
#ifdef VIP_ENABLE
WFIFOHEAD(login_fd,15);
WFIFOW(login_fd,0) = 0x2742;
WFIFOL(login_fd,2) = aid; //aid
WFIFOB(login_fd,6) = type; //type
WFIFOL(login_fd,7) = add_vip_time; //req_inc_duration
WFIFOL(login_fd,7) = timediff; //req_inc_duration
WFIFOL(login_fd,11) = mapfd; //req_inc_duration
WFIFOSET(login_fd,15);
#endif
@ -3091,7 +3091,7 @@ int mapif_parse_req_alter_acc(int fd){
int aid = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request)
const char* name = (char*)RFIFOP(fd,6); // name of the target character
int operation = RFIFOW(fd,30); // type of operation: 1-block, 2-ban, 3-unblock, 4-unban, 5 changesex, 6 vip, 7 bank
int timediff = RFIFOL(fd,32);
int32 timediff = RFIFOL(fd,32);
int val1 = RFIFOL(fd,36);
int val2 = RFIFOL(fd,40);
RFIFOSKIP(fd,44);
@ -3157,7 +3157,7 @@ int mapif_parse_req_alter_acc(int fd){
break;
case 6:
anwser=(val1&4); // vip_req val1=type, &1 login send return, &2 upd timestamp &4 map send awnser
loginif_reqviddata(aid, val1, timediff, fd);
loginif_reqviddata(account_id, val1, timediff, fd);
break;
case 7:
anwser=(val1&1); //val&1 request anwser, val1&2 save data

View File

@ -514,7 +514,7 @@ int chrif_parse_reqvipdata(int fd) {
struct mmo_account acc;
int aid = RFIFOL(fd,2);
int8 type = RFIFOB(fd,6);
int req_duration = RFIFOL(fd,7);
int32 timediff = RFIFOL(fd,7);
int mapfd = RFIFOL(fd,11);
RFIFOSKIP(fd,15);
@ -523,14 +523,17 @@ int chrif_parse_reqvipdata(int fd) {
time_t vip_time = acc.vip_time;
bool isvip = false;
if( type&2 ) vip_time = now + req_duration; // set new duration
if( now < vip_time ) { //isvip
if( type&2 ){
if(!vip_time) vip_time = now; //new entry
vip_time += timediff; // set new duration
}
if( now < vip_time) { //isvip
if(acc.group_id != login_config.vip_sys.group) //only upd this if we're not vip already
acc.old_group = acc.group_id;
acc.group_id = login_config.vip_sys.group;
acc.char_slots = login_config.char_per_account + login_config.vip_sys.char_increase;
isvip = true;
} else if (vip_time) { //expired or @vip -xx
} else { //expired or @vip -xx
vip_time = 0;
if(acc.group_id == login_config.vip_sys.group) //prevent alteration in case we wasn't registered vip yet
acc.group_id = acc.old_group;
@ -1233,10 +1236,6 @@ int mmo_auth(struct login_session_data* sd, bool isServer) {
timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S");
safestrncpy(acc.last_ip, ip, sizeof(acc.last_ip));
acc.unban_time = 0;
#ifdef VIP_ENABLE
acc.vip_time = 0;
acc.old_group = 0;
#endif
acc.logincount++;
accounts->save(accounts, &acc);

View File

@ -2788,7 +2788,7 @@ ACMD_FUNC(char_block)
ACMD_FUNC(char_ban)
{
char * modif_p;
int timediff=0;
int32 timediff=0; //don't set this as uint as we may want to decrease banned time
int bantype=2; //2=account block, 6=char specific
char output[256];
@ -2807,7 +2807,7 @@ ACMD_FUNC(char_ban)
modif_p = atcmd_output;
timediff = (int)solve_time(modif_p); //discard seconds
timediff = (int32)solve_time(modif_p); //discard seconds
if (timediff == 0) { //allow negative ?
char output[256];
@ -9160,7 +9160,7 @@ ACMD_FUNC(langtype)
ACMD_FUNC(vip) {
struct map_session_data *pl_sd = NULL;
char * modif_p;
int vipdifftime = 0;
int32 vipdifftime = 0;
time_t now=time(NULL);
nullpo_retr(-1, sd);
@ -9175,7 +9175,7 @@ ACMD_FUNC(vip) {
atcmd_output[sizeof(atcmd_output)-1] = '\0';
modif_p = atcmd_output;
vipdifftime = (int)solve_time(modif_p);
vipdifftime = (int32)solve_time(modif_p);
if (vipdifftime == 0) {
clif_displaymessage(fd, msg_txt(sd,701)); // Invalid time for vip command.
clif_displaymessage(fd, msg_txt(sd,702)); // Time parameter format is +/-<value> to alter. y/a = Year, m = Month, d/j = Day, h = Hour, n/mn = Minute, s = Second.

View File

@ -167,7 +167,10 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
/*==========================================
* leave a chatroom
* Make player *sd leave a chatroom
* @param *sd : player pointer
* @param kicked : for clif notification, kicked=1 or regular leave
* @return 0:sucess, 1:failed
*------------------------------------------*/
int chat_leavechat(struct map_session_data* sd, bool kicked)
{
@ -229,8 +232,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
map_delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
map_addblock( &cd->bl );
if(map_addblock( &cd->bl ))
return 1;
clif_dispchat(cd,0);
}
else
@ -241,6 +244,9 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
/*==========================================
* change a chatroom's owner
* @param *sd : player pointer
* @param *nextownername : string of new owner (name should be in chatroom)
* @return 0:sucess, 1:failure
*------------------------------------------*/
int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
{
@ -274,7 +280,8 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
map_delblock( &cd->bl );
cd->bl.x = cd->owner->x;
cd->bl.y = cd->owner->y;
map_addblock( &cd->bl );
if(map_addblock( &cd->bl ))
return 1;
// and display again
clif_dispchat(cd,0);

View File

@ -823,7 +823,7 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email) {
* @val1 : extra data value to transfer for operation
* @val2 : extra data value to transfer for operation
*/
int chrif_req_login_operation(int aid, const char* character_name, unsigned short operation_type, int timediff, int val1, int val2) {
int chrif_req_login_operation(int aid, const char* character_name, unsigned short operation_type, int32 timediff, int val1, int val2) {
chrif_check(-1);
WFIFOHEAD(char_fd,44);
@ -1071,7 +1071,7 @@ int chrif_ban(int fd) {
return 0;
}
int chrif_req_charban(int aid, const char* character_name, int timediff){
int chrif_req_charban(int aid, const char* character_name, int32 timediff){
chrif_check(-1);
WFIFOHEAD(char_fd,10+NAME_LENGTH);
@ -1520,20 +1520,25 @@ void chrif_keepalive_ack(int fd) {
session[fd]->flag.ping = 0;/* reset ping state, we received a packet */
}
/**
* Received vip-data from char-serv, fill map-serv data
* @param fd : char-serv file descriptor (link to char-serv)
*/
void chrif_parse_ack_vipActive(int fd) {
#ifdef VIP_ENABLE
int aid = RFIFOL(char_fd,2);
uint32 vip_time = RFIFOL(char_fd,6);
bool isvip = RFIFOB(char_fd,10);
uint32 groupid = RFIFOL(char_fd,11);
int aid = RFIFOL(fd,2);
uint32 vip_time = RFIFOL(fd,6);
bool isvip = RFIFOB(fd,10);
uint32 groupid = RFIFOL(fd,11);
TBL_PC *sd = map_id2sd(aid);
if (sd && isvip) {
if(sd == NULL) return ;
sd->group_id = groupid;
pc_group_pc_load(sd);
if(isvip) {
sd->vip.enabled = 1;
sd->vip.time = vip_time;
sd->group_id = groupid;
pc_group_pc_load(sd);
// Increase storage size for VIP.
sd->storage_size = battle_config.vip_storage_increase + MIN_STORAGE;
if (sd->storage_size > MAX_STORAGE) {
@ -1541,9 +1546,16 @@ void chrif_parse_ack_vipActive(int fd) {
sd->storage_size = MAX_STORAGE;
}
// Magic Stone requirement avoidance for VIP.
if (battle_config.vip_gemstone && pc_isvip(sd))
if (battle_config.vip_gemstone)
sd->special_state.no_gemstone = 2; // need to be done after status_calc_bl(bl,first);
}
else if (sd->vip.enabled){
sd->vip.enabled = 0;
sd->vip.time = 0;
sd->storage_size = MIN_STORAGE;
sd->special_state.no_gemstone = 0;
clif_displaymessage(sd->fd,"You're no longer a VIP_Member");
}
#endif
}

View File

@ -1919,20 +1919,30 @@ void clif_scriptclose(struct map_session_data *sd, int npcid)
WFIFOSET(fd,packet_len(0xb6));
}
/// [Ind/Hercules]
/// Close script when player is idle
/// 08d6 <npc id>.L
/**
* Close script when player is idle
* 08d6 <npc id>.L (ZC_CLEAR_DIALOG)
* @author [Ind/Hercules]
* @param sd : player pointer
* @param npcid : npc gid to close
*/
void clif_scriptclear(struct map_session_data *sd, int npcid)
{
int fd;
struct s_packet_db* info;
int16 len;
int cmd = 0;
nullpo_retv(sd);
fd=sd->fd;
WFIFOHEAD(fd, packet_len(0x8d6));
cmd = packet_db_ack[sd->packet_ver][ZC_CLEAR_DIALOG];
if(!cmd) cmd = 0x8d6; //default
info = &packet_db[sd->packet_ver][cmd];
len = info->len;
WFIFOHEAD(fd, len);
WFIFOW(fd,0)=0x8d6;
WFIFOL(fd,2)=npcid;
WFIFOSET(fd,packet_len(0x8d6));
WFIFOL(fd,info->pos[0])=npcid;
WFIFOSET(fd,len);
}
/*==========================================
@ -2567,7 +2577,7 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
WBUFW(bufn,0)=0x995;
memset((char*)WBUFP(buf,4),0,24); //storename
#endif
WBUFW(bufn,2)=4+nn*s;
WBUFW(bufn,2)=sidx+nn*s;
clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
}
for (i = 0; i < ne;) // Loop through equipable items
@ -2583,7 +2593,7 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
WBUFW(bufn,0)=0x996;
memset((char*)WBUFP(bufn,4),0,24); //storename
#endif
WBUFW(bufn,2)=4+nn*se;
WBUFW(bufn,2)=sidxe+nn*se;
clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
}
@ -6196,8 +6206,8 @@ void clif_cart_additem_ack(struct map_session_data *sd, uint8 flag)
void clif_bank_open(struct map_session_data *sd){
int fd;
nullpo_retv(sd);
fd = sd->fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,4);
WFIFOW(fd,0) = 0x09b7;
@ -6212,7 +6222,7 @@ void clif_bank_open(struct map_session_data *sd){
void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
//TODO check if preventing trade or stuff like that
//also mark something in case char ain't available for saving, should we check now ?
nullpo_retv(sd);
nullpo_retv(sd);
if( !battle_config.feature_banking ) {
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
return;
@ -6220,13 +6230,13 @@ void clif_parse_BankOpen(int fd, struct map_session_data* sd) {
else {
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
if(sd->status.account_id == aid){
if(sd->status.account_id == aid){
sd->state.banking = 1;
//request save ?
//chrif_bankdata_request(sd->status.account_id, sd->status.char_id);
//on succes open bank ?
clif_bank_open(sd);
}
//request save ?
//chrif_bankdata_request(sd->status.account_id, sd->status.char_id);
//on succes open bank ?
clif_bank_open(sd);
}
}
}
@ -6236,7 +6246,7 @@ void clif_bank_close(struct map_session_data *sd){
int fd;
nullpo_retv(sd);
fd = sd->fd;
fd = sd->fd;
WFIFOHEAD(fd,4);
WFIFOW(fd,0) = 0x09B9;
@ -6252,15 +6262,15 @@ void clif_parse_BankClose(int fd, struct map_session_data* sd) {
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
int aid = RFIFOL(fd,info->pos[0]); //unused should we check vs fd ?
nullpo_retv(sd);
nullpo_retv(sd);
if( !battle_config.feature_banking ) {
clif_colormes(sd,color_table[COLOR_RED],msg_txt(sd,1496)); //Banking is disabled
//still allow to go trough to not stuck player if we have disable it while they was in
}
if(sd->status.account_id == aid){
sd->state.banking = 0;
clif_bank_close(sd);
}
if(sd->status.account_id == aid){
sd->state.banking = 0;
clif_bank_close(sd);
}
}
/*
@ -6280,7 +6290,7 @@ void clif_Bank_Check(struct map_session_data* sd) {
info = &packet_db[sd->packet_ver][cmd];
len = info->len;
if(!len) return; //version as packet disable
// sd->state.banking = 1; //mark opening and closing
// sd->state.banking = 1; //mark opening and closing
WBUFW(buf,0) = cmd;
WBUFQ(buf,info->pos[0]) = sd->status.bank_vault; //testig value
@ -9482,7 +9492,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// reset the callshop flag if the player changes map
sd->state.callshop = 0;
map_addblock(&sd->bl);
if(map_addblock(&sd->bl))
return;
clif_spawn(&sd->bl);
// Party
@ -9524,7 +9535,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_displaymessage(sd->fd, msg_txt(sd,666));
pet_menu(sd, 3); //Option 3 is return to egg.
} else {
map_addblock(&sd->pd->bl);
if(map_addblock(&sd->pd->bl))
return;
clif_spawn(&sd->pd->bl);
clif_send_petdata(sd,sd->pd,0,0);
clif_send_petstatus(sd);
@ -9534,7 +9546,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
//homunculus [blackhole89]
if( merc_is_hom_active(sd->hd) ) {
map_addblock(&sd->hd->bl);
if(map_addblock(&sd->hd->bl))
return;
clif_spawn(&sd->hd->bl);
clif_send_homdata(sd,SP_ACK,0);
clif_hominfo(sd,sd->hd,1);
@ -9547,7 +9560,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
}
if( sd->md ) {
map_addblock(&sd->md->bl);
if(map_addblock(&sd->md->bl))
return;
clif_spawn(&sd->md->bl);
clif_mercenary_info(sd);
clif_mercenary_skillblock(sd);
@ -17809,6 +17823,7 @@ void packetdb_readdb(void)
{ "ZC_BANKING_CHECK", ZC_BANKING_CHECK},
{ "ZC_PERSONAL_INFOMATION", ZC_PERSONAL_INFOMATION},
{ "ZC_PERSONAL_INFOMATION_CHN", ZC_PERSONAL_INFOMATION_CHN},
{ "ZC_CLEAR_DIALOG", ZC_CLEAR_DIALOG},
};
// initialize packet_db[SERVER] from hardcoded packet_len_table[] values

View File

@ -46,6 +46,7 @@ enum e_packet_ack {
ZC_BANKING_CHECK,
ZC_PERSONAL_INFOMATION,
ZC_PERSONAL_INFOMATION_CHN,
ZC_CLEAR_DIALOG,
//add otehr here
MAX_ACK_FUNC //auto upd len
};

View File

@ -222,6 +222,12 @@ void elemental_summon_init(struct elemental_data *ed) {
ed->regen.state.block = 0;
}
/**
* Inter-serv has sent us the elemental data from sql, fill it in map-serv memory
* @param ele : The elemental data received from char-serv
* @param flag : 0:not created, 1:was saved/loaded
* @return 0:failed, 1:sucess
*/
int elemental_data_received(struct s_elemental *ele, bool flag) {
struct map_session_data *sd;
struct elemental_data *ed;
@ -271,7 +277,8 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
sd->status.ele_id = ele->elemental_id;
if( ed->bl.prev == NULL && sd->bl.prev != NULL ) {
map_addblock(&ed->bl);
if(map_addblock(&ed->bl))
return 0;
clif_spawn(&ed->bl);
clif_elemental_info(sd);
clif_elemental_updatestatus(sd,SP_HP);

View File

@ -406,6 +406,11 @@ int merc_hom_change_class(struct homun_data *hd, short class_)
return 1;
}
/**
* Make an homonculus evolve, (changing in evolution class and apply bonus)
* @param hd : homonculus datas
* @return 0:failure, 1:success
*/
int merc_hom_evolution(struct homun_data *hd)
{
struct s_homunculus *hom;
@ -442,7 +447,8 @@ int merc_hom_evolution(struct homun_data *hd)
hom->intimacy = 500;
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
map_addblock(&hd->bl);
if(map_addblock(&hd->bl))
return 0;
clif_spawn(&hd->bl);
clif_emotion(&sd->bl, E_NO1);
@ -459,6 +465,12 @@ int merc_hom_evolution(struct homun_data *hd)
return 1 ;
}
/**
* Make an homonculus mutate in renewal homon
* @param hd : homonculus datas
* @param homun_id : id to make it transform into (must be a valid homon class)
* @return 0:failure, 1:sucess
*/
int hom_mutate(struct homun_data *hd, int homun_id)
{
struct s_homunculus *hom;
@ -486,7 +498,8 @@ int hom_mutate(struct homun_data *hd, int homun_id)
}
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
map_addblock(&hd->bl);
if(map_addblock(&hd->bl))
return 0;
clif_spawn(&hd->bl);
clif_emotion(&sd->bl, E_NO1);
@ -827,6 +840,11 @@ void merc_hom_init_timers(struct homun_data * hd)
hd->masterteleport_timer = INVALID_TIMER;
}
/**
* Make a player spawn a homonculus (call)
* @param sd
* @return 0:failure, 1:sucess
*/
int merc_call_homunculus(struct map_session_data *sd)
{
struct homun_data *hd;
@ -853,7 +871,8 @@ int merc_call_homunculus(struct map_session_data *sd)
hd->bl.x = sd->bl.x;
hd->bl.y = sd->bl.y;
hd->bl.m = sd->bl.m;
map_addblock(&hd->bl);
if(map_addblock(&hd->bl))
return 0;
clif_spawn(&hd->bl);
clif_send_homdata(sd,SP_ACK,0);
clif_hominfo(sd,hd,1);
@ -868,7 +887,13 @@ int merc_call_homunculus(struct map_session_data *sd)
return 1;
}
// Recv homunculus data from char server
/**
* Receive homunculus data from char server
* @param account_id : owner account_id of the homon
* @param sh : homonculus data from char-serv
* @param flag : does the creation in inter-serv was a success (0:no,1:yes)
* @return 0:failure, 1:sucess
*/
int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
{
struct map_session_data *sd;
@ -899,7 +924,8 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
hd = sd->hd;
if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL)
{
map_addblock(&hd->bl);
if(map_addblock(&hd->bl))
return 0;
clif_spawn(&hd->bl);
clif_send_homdata(sd,SP_ACK,0);
clif_hominfo(sd,hd,1);
@ -947,6 +973,14 @@ int merc_create_homunculus_request(struct map_session_data *sd, int class_)
return 1;
}
/**
* Make a player resurect an homon (player must have one)
* @param sd : player pointer
* @param per : hp percentage to revive homon
* @param x : x map coordinate
* @param y : Y map coordinate
* @return 0:failure, 1:success
*/
int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, short x, short y)
{
struct homun_data* hd;
@ -960,7 +994,7 @@ int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, sh
hd = sd->hd;
if (hd->homunculus.vaporize == HOM_ST_REST)
if (hd->homunculus.vaporize == HOM_ST_REST)
return 0; // vaporized homunculi need to be 'called'
if (!status_isdead(&hd->bl))
@ -973,11 +1007,11 @@ int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, sh
hd->bl.m = sd->bl.m;
hd->bl.x = x;
hd->bl.y = y;
map_addblock(&hd->bl);
if(map_addblock(&hd->bl))
return 0;
clif_spawn(&hd->bl);
}
status_revive(&hd->bl, per, 0);
return 1;
return status_revive(&hd->bl, per, 0);
}
void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp)

View File

@ -89,14 +89,14 @@ char log_db_db[32] = "log";
Sql* logmysql_handle;
// DBMap declaartion
static DBMap* id_db=NULL; // int id -> struct block_list*
static DBMap* pc_db=NULL; // int id -> struct map_session_data*
static DBMap* mobid_db=NULL; // int id -> struct mob_data*
static DBMap* bossid_db=NULL; // int id -> struct mob_data* (MVP db)
static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
static DBMap* regen_db=NULL; // int id -> struct block_list* (status_natural_heal processing)
static DBMap* id_db=NULL; /// int id -> struct block_list*
static DBMap* pc_db=NULL; /// int id -> struct map_session_data*
static DBMap* mobid_db=NULL; /// int id -> struct mob_data*
static DBMap* bossid_db=NULL; /// int id -> struct mob_data* (MVP db)
static DBMap* map_db=NULL; /// unsigned int mapindex -> struct map_data*
static DBMap* nick_db=NULL; /// int char_id -> struct charid2nick* (requested names of offline characters)
static DBMap* charid_db=NULL; /// int char_id -> struct map_session_data*
static DBMap* regen_db=NULL; /// int id -> struct block_list* (status_natural_heal processing)
static DBMap* map_msg_db=NULL;
static int map_users=0;
@ -328,7 +328,7 @@ int map_delblock(struct block_list* bl)
int pos;
nullpo_ret(bl);
// blocklist (2ways chainlist)
// blocklist (2ways chainlist)
if (bl->prev == NULL) {
if (bl->next != NULL) {
// can't delete block (already at the begining of the chain)
@ -361,11 +361,16 @@ int map_delblock(struct block_list* bl)
return 0;
}
/*==========================================
/**
* Moves a block a x/y target position. [Skotlex]
* Pass flag as 1 to prevent doing skill_unit_move checks
* (which are executed by default on BL_CHAR types)
*------------------------------------------*/
* @param bl : block(object) to move
* @param x1 : new x position
* @param y1 : new y position
* @param tick : when this was scheduled
* @return 0:sucess, 1:fail
*/
int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
{
int x0 = bl->x, y0 = bl->y;
@ -404,7 +409,10 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
#endif
bl->x = x1;
bl->y = y1;
if (moveblock) map_addblock(bl);
if (moveblock) {
if(map_addblock(bl))
return 1;
}
#ifdef CELL_NOSTACK
else map_addblcell(bl);
#endif
@ -677,7 +685,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0
int blockcount = bl_list_count, i;
va_list ap;
if ( m < 0 )
if ( m < 0 || m >= map_num)
return 0;
if ( x1 < x0 )
@ -1417,13 +1425,18 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
}
/*==========================================
* Add an item to location (m,x,y)
* Parameters
* @item_data item attributes
* @amount quantity
* @m, @x, @y mapid,x,y
* @first_charid, @second_charid, @third_charid, looting priority
* @flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check.
* Add an item in floor to location (m,x,y) and add restriction for those who could pickup later
* NB : If charids are null their no restriction for pickup
* @param item_data : item attributes
* @param amount : items quantity
* @param m : mapid
* @param x : x coordinates
* @param y : y coordinates
* @param first_charid : 1st player that could loot the item (only charid that could loot for first_get_tick duration)
* @param second_charid : 2nd player that could loot the item (2nd charid that could loot for second_get_charid duration)
* @param third_charid : 3rd player that could loot the item (3rd charid that could loot for third_get_charid duration)
* @param flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check.
* @return 0:failure, x:item_gid [MIN_FLOORITEM;MAX_FLOORITEM]==[2;START_ACCOUNT_NUM]
*------------------------------------------*/
int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags)
{
@ -1465,7 +1478,8 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
fitem->cleartimer=add_timer(gettick()+battle_config.flooritem_lifetime,map_clearflooritem_timer,fitem->bl.id,0);
map_addiddb(&fitem->bl);
map_addblock(&fitem->bl);
if(map_addblock(&fitem->bl))
return 0;
clif_dropflooritem(fitem);
return fitem->bl.id;

View File

@ -280,6 +280,12 @@ void merc_contract_init(struct mercenary_data *md)
md->regen.state.block = 0;
}
/**
* Received mercenary data from char-serv
* @param merc : mercenary datas
* @param flag : if inter-serv request was sucessfull
* @return 0:failure, 1:sucess
*/
int merc_data_received(struct s_mercenary *merc, bool flag)
{
struct map_session_data *sd;
@ -336,7 +342,8 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
if( md && md->bl.prev == NULL && sd->bl.prev != NULL )
{
map_addblock(&md->bl);
if(map_addblock(&md->bl))
return 0;
clif_spawn(&md->bl);
clif_mercenary_info(sd);
clif_mercenary_skillblock(sd);

View File

@ -122,9 +122,13 @@ static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
return strcmpi(mob->jname,str);
}
/*==========================================
* MvP Tomb [GreenBox]
*------------------------------------------*/
/**
* Create and display a tombstone on the map
* @author [GreenBox]
* @param md : the mob to create a tombstone for
* @param killer : name of who has killed the mob
* @param time : time at wich the killed happen
*/
void mvptomb_create(struct mob_data *md, char *killer, time_t time)
{
struct npc_data *nd;
@ -157,7 +161,8 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
nd->u.tomb.killer_name[0] = '\0';
map_addnpc(nd->bl.m, nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl))
return;
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
@ -894,9 +899,11 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
return 1; //backward compatibility
}
/*==========================================
* Mob spawning. Initialization is also variously here.
*------------------------------------------*/
/**
* Mob spawning. Initialization is also variously here. (Spawn a mob in a map)
* @param md : mob data to spawn
* @return 0:spawned, 1:delayed, 2:error
*/
int mob_spawn (struct mob_data *md)
{
int i=0;
@ -981,7 +988,8 @@ int mob_spawn (struct mob_data *md)
if ( md->tomb_nid )
mvptomb_destroy(md);
map_addblock(&md->bl);
if(map_addblock(&md->bl))
return 2;
if( map[md->bl.m].users )
clif_spawn(&md->bl);
skill_unit_move(&md->bl,tick,1);
@ -2656,6 +2664,11 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
return 3; //Remove from map.
}
/**
* Resurect a mob with x hp (reset value and respawn on map)
* @param md : mob pointer
* @param hp : hp to resurect him with, @FIXME unused atm
*/
void mob_revive(struct mob_data *md, unsigned int hp)
{
unsigned int tick = gettick();
@ -2666,8 +2679,10 @@ void mob_revive(struct mob_data *md, unsigned int hp)
md->last_pcneartime = 0;
memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris]
md->tdmg = 0;
if (!md->bl.prev)
map_addblock(&md->bl);
if (!md->bl.prev){
if(map_addblock(&md->bl))
return;
}
clif_spawn(&md->bl);
skill_unit_move(&md->bl,tick,1);
mobskill_use(md, tick, MSC_SPAWN);

View File

@ -2158,7 +2158,19 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
}
}
//Add then display an npc warp on map
/**
* Add then display an npc warp on map
* @param name : warp unique name
* @param from_mapid : mapid to warp from
* @param from_x : x coordinate of warp
* @param from_y : y coordinate of warp
* @param xs : x lenght of warp (for trigger activation)
* @param ys : y lenght of warp (for trigger activation)
* @param to_mapindex : mapid to warp to
* @param to_x : x coordinate to warp to
* @param to_y : y coordinate to warp to
* @return NULL:failed creation, npc_data* new warp
*/
struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y)
{
int i, flag = 0;
@ -2197,7 +2209,8 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc_setcells(nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl))
return NULL;
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
@ -2208,7 +2221,18 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
return nd;
}
/// Parses a warp npc.
/**
* Parses a warp npc.
* Line definition <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
* @param w1 : word 1 before tab (<from map name>,<fromX>,<fromY>,<facing>)
* @param w2 : word 2 before tab (warp), keyword that sent us in this parsing
* @param w3 : word 3 before tab (<warp name>)
* @param w4 : word 4 before tab (<spanx>,<spany>,<to mapname>,<toX>,<toY>)
* @param start : index to start parsing
* @param buffer : lines to parses
* @param filepath : filename with path wich we are parsing
* @return new index for next parsing
*/
static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
{
int x, y, xs, ys, to_x, to_y, m;
@ -2262,7 +2286,8 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc_setcells(nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl)) //couldn't add on map
return strchr(start,'\n');
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
@ -2273,7 +2298,22 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
return strchr(start,'\n');// continue
}
/// Parses a shop/cashshop npc.
/**
* Parses a shop/cashshop npc.
* Line definition :
* <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
* <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
* <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
* @TODO missing cashshop line definition
* @param w1 : word 1 before tab (<from map name>,<x>,<y>,<facing>)
* @param w2 : word 2 before tab (shop|cashshop|itemshop|pointshop), keyword that sent us in this parsing
* @param w3 : word 3 before tab (<NPC Name>)
* @param w4 : word 4 before tab (<sprited id>,<shop definition...>)
* @param start : index to start parsing
* @param buffer : lines to parses
* @param filepath : filename with path wich we are parsing
* @return new index for next parsing
*/
static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
{
//TODO: could be rewritten to NOT need this temp array [ultramage]
@ -2419,7 +2459,8 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
if( m >= 0 )
{// normal shop npc
map_addnpc(m,nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl))
return strchr(start,'\n');
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
@ -2555,11 +2596,20 @@ static const char* npc_skip_script(const char* start, const char* buffer, const
return p+1;// return after the last '}'
}
/// Parses a npc script.
///
/// -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
/**
* Parses a npc script.
* Line definition :
* <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
* <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>} * @TODO missing cashshop line definition
* @param w1 : word 1 before tab (<from map name>,<x>,<y>,<facing>)
* @param w2 : word 2 before tab (script), keyword that sent us in this parsing
* @param w3 : word 3 before tab (<NPC Name>)
* @param w4 : word 4 before tab (<sprited id>,<code>)
* @param start : index to start parsing
* @param buffer : lines to parses
* @param filepath : filename with path wich we are parsing
* @return new index for next parsing
*/
static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, bool runOnInit) {
int x, y, dir = 0, m, xs = 0, ys = 0, class_ = 0; // [Valaris] thanks to fov
char mapname[32];
@ -2648,7 +2698,8 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
unit_dataset(&nd->bl);
nd->ud.dir = dir;
npc_setcells(nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl))
return NULL;
if( class_ >= 0 )
{
status_set_viewdata(&nd->bl, nd->class_);
@ -2808,7 +2859,8 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
unit_dataset(&nd->bl);
nd->ud.dir = dir;
npc_setcells(nd);
map_addblock(&nd->bl);
if(map_addblock(&nd->bl))
return end;
if( class_ >= 0 ) {
status_set_viewdata(&nd->bl, nd->class_);
if( map[nd->bl.m].users )
@ -2892,7 +2944,8 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
wnd->bl.type = BL_NPC;
wnd->subtype = WARP;
npc_setcells(wnd);
map_addblock(&wnd->bl);
if(map_addblock(&wnd->bl))
return 1;
status_set_viewdata(&wnd->bl, wnd->class_);
status_change_init(&wnd->bl);
unit_dataset(&wnd->bl);

View File

@ -9415,7 +9415,10 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
//Save char.
last_save_id = sd->bl.id;
save_flag = 2;
#ifdef VIP_ENABLE
if(sd->vip.enabled) //check if we're still vip
chrif_req_login_operation(1, sd->status.name, 6, 0, 1, 0);
#endif
chrif_save(sd,0);
break;
}

View File

@ -123,10 +123,17 @@ struct s_autobonus {
};
struct skill_cooldown_entry {
unsigned short skill_id;
int timer;
unsigned short skill_id;
int timer;
};
#ifdef VIP_ENABLE
struct vip_info {
unsigned int enabled : 1;
time_t time;
};
#endif
enum npc_timeout_type {
NPCT_INPUT = 0,
NPCT_MENU = 1,
@ -553,12 +560,8 @@ struct map_session_data {
int storage_size; // Holds player storage size (VIP system).
#ifdef VIP_ENABLE
struct {
unsigned int enabled : 1;
time_t time;
} vip;
struct vip_info vip;
#endif
//Timed bonus 'bonus_script' struct [Cydh]
struct s_script {
struct script_code *script;

View File

@ -411,7 +411,8 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
if(sd->bl.prev != NULL) {
map_addblock(&sd->pd->bl);
if(map_addblock(&sd->pd->bl))
return 1;
clif_spawn(&sd->pd->bl);
clif_send_petdata(sd,sd->pd, 0,0);
clif_send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
@ -452,7 +453,8 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
} else {
pet_data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
map_addblock(&sd->pd->bl);
if(map_addblock(&sd->pd->bl))
return 1;
clif_spawn(&sd->pd->bl);
clif_send_petdata(sd,sd->pd,0,0);
clif_send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);

View File

@ -6124,7 +6124,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill_get_splash(skill_id, skill_lv), splash_target(src),
src, skill_id, skill_lv, tick, flag|i,
skill_castend_damage_id);
map_addblock(src);
if(map_addblock(src))
return 1;
status_damage(src, src, sstatus->max_hp,0,0,1);
break;
@ -6480,11 +6481,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MC_IDENTIFY:
if(sd) {
clif_item_identify_list(sd);
if( sd->menuskill_id != MC_IDENTIFY ) {/* failed, dont consume anything, return */
if( sd->menuskill_id != MC_IDENTIFY ) {// failed, dont consume anything
map_freeblock_unlock();
return 1;
}
status_zap(src,0,skill_get_sp(skill_id,skill_lv)); // consume sp only if succeeded
else { // consume sp only if succeeded
struct skill_condition req = skill_get_requirement(sd,skill_id,skill_lv);
status_zap(src,0,req.sp);
}
}
break;
@ -11526,12 +11530,12 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 += pc_checkskill(sd,BA_MUSICALLESSON);
break;
case DC_SERVICEFORYOU:
val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed
val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction
if(sd){
val1 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
val2 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
}
//val1: MaxSP percent increase
val1 = 15+skill_lv+(status->int_/10); //Bonus rate by Dancer's INT
//val2: SP cost reduction
val2 = 20+3*skill_lv;
if(sd) val2 += (pc_checkskill(sd,DC_DANCINGLESSON)+1)/2; //Bonus rate by DC_DANCINGLESSON
val2 += status->int_/10; //Bonus rate by Dancer's INT
break;
case BA_ASSASSINCROSS:
val1 = 100+(10*skill_lv)+status->agi; // ASPD increase
@ -14326,6 +14330,13 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
return 1;
}
/**
* Get skill requirements and return the value after some additional/reduction condition (such item bonus and status change)
* @param sd Player's that will be checked
* @param skill_id Skill that's being used
* @param skill_lv Skill level of used skill
* @return skill_condition Struct 'skill_condition' that store the modified skill requirements
*/
struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv)
{
struct skill_condition req;
@ -15985,7 +15996,8 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
idb_put(skillunit_db, unit->bl.id, unit);
map_addiddb(&unit->bl);
map_addblock(&unit->bl);
if(map_addblock(&unit->bl))
return NULL;
// perform oninit actions
switch (group->skill_id) {

View File

@ -199,7 +199,8 @@ int unit_check_start_teleport_timer(struct block_list *sbl)
case BL_PET : max_dist = AREA_SIZE; break;
case BL_MER : max_dist = MAX_MER_DISTANCE; break;
}
if(msd && max_dist){ // If there is a master and it's a valid type
// If there is a master and it's a valid type
if(msd && (msd->bl.type&BL_PC) && max_dist){ ///TODO the bl.type is an hotfix please dig it to remove it
int *msd_tid = unit_get_masterteleport_timer(sbl);
if(msd_tid == NULL) return 0;
if (!check_distance_bl(&msd->bl, sbl, max_dist)) {
@ -941,7 +942,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
* @param x: Destination cell X
* @param y: Destination cell Y
* @param type: Clear type used in clif_clearunit_area()
* @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3)
* @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3); map_addblock Failed(4)
**/
int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
{
@ -1001,7 +1002,8 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
bl->y=ud->to_y=y;
bl->m=m;
map_addblock(bl);
if(map_addblock(bl))
return 4; //error on adding bl to map
clif_spawn(bl);
skill_unit_move(bl,gettick(),1);

103
tools/convert_itemtype.pl Normal file
View File

@ -0,0 +1,103 @@
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use File::Basename;
use Scalar::Util qw(looks_like_number);
my $sFileins;
my @aFilein = ("../db/re/item_db.txt","../db/pre-re/item_db.txt","../db/item_db2.txt");
my $sFileouts;
my @aFileout = ("../db/re/item_db.txt","../db/pre-re/item_db.txt","../db/item_db2.txt");
my $sHelp = 0;
Main();
sub GetArgs {
GetOptions(
'i=s' => \$sFileins, #Output file name.
'o=s' => \$sFileouts, #Input file name.
'help!' => \$sHelp,
) or $sHelp=1; #Display help if invalid options are supplied.
if( $sHelp ) {
print "Incorrect option specified. Available options:\n"
."\t --o=filename => Output file name. (file must be separate by coma if multiple) \n"
."\t --i=filenames => Input files name. (file must be separate by coma if multiple) \n";
exit;
}
if($sFileins){
chomp($sFileins);
@aFilein = split(",",$sFileins);
}
if($sFileouts){
chomp($sFileouts);
@aFileout = split(",",$sFileouts);
}
unless(scalar(@aFileout)==scalar(@aFilein)){
print "ERROR: number of filein doesn't match number of fileout, you must speficy each fileout for each filein:\n"
."afilein = [ @aFilein ] \n"
."afileout = [ @aFileout ] \n";
exit;
}
}
sub Main {
my $sI=0;
my($filename, $dir, $suffix) = fileparse($0);
chdir $dir; #put ourself like was called in tool folder
GetArgs();
print "Welcome to rA itemtype converter\n";
print "Were going to convert those files : @aFilein into @aFileout \n";
foreach my $sFile (@aFilein){
my $sReplace=0; #should we replace file when finished
my $sFileouttmp=$aFileout[$sI];
if($sFile eq $sFileouttmp){
$sReplace=1;
$sFileouttmp = $sFileouttmp.".out";
print "Asking to replace file tmp fileout= $sFileouttmp \n";
}
unless(open FHIN,"$sFile"){
print "Error, can't read or locate $sFile.\n";
next;
}
unless(open FHOUT,">$sFileouttmp"){
print "ERROR: Can't write or locate $aFileout[$sI].\n";
next;
}
$sI++;
while (<FHIN>){
if( $_ =~ /^\s*$/) { #ignore empty line
print FHOUT $_;
next;
}
my @champ = split(",",$_);
my $sDoconvertion=0; #should this comment be converted
if( $_ =~ /^\/\// ) { # // line
if(scalar(@champ)>3){
$champ[0] =~ s!\/\/!!g;
$sDoconvertion=looks_like_number($champ[0]);
$champ[0] = "//".$champ[0]; #recomment it
}
if($sDoconvertion==0) {
print FHOUT $_;
next;
}
}
if(scalar(@champ>3)){
if($champ[3] == 4) { $champ[3]=5; }
elsif($champ[3] == 5) { $champ[3]=4; }
my $newline = join(",",@champ);
print FHOUT $newline;
}
else { print FHOUT $_; }
}
close FHOUT;
close FHIN;
if($sReplace){
unlink $sFile;
rename $sFileouttmp, $sFile;
}
}
}