diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 33 | ||||
-rw-r--r-- | src/map/battle.c | 32 | ||||
-rw-r--r-- | src/map/battleground.c | 14 | ||||
-rw-r--r-- | src/map/battleground.h | 1 | ||||
-rw-r--r-- | src/map/chrif.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 57 | ||||
-rw-r--r-- | src/map/guild.c | 6 | ||||
-rw-r--r-- | src/map/intif.c | 6 | ||||
-rw-r--r-- | src/map/map.c | 21 | ||||
-rw-r--r-- | src/map/packets.h | 191 | ||||
-rw-r--r-- | src/map/pc.c | 302 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 19 | ||||
-rw-r--r-- | src/map/skill.c | 24 | ||||
-rw-r--r-- | src/map/skill.h | 3 | ||||
-rw-r--r-- | src/map/status.c | 7 | ||||
-rw-r--r-- | src/map/storage.c | 88 | ||||
-rw-r--r-- | src/map/storage.h | 69 | ||||
-rw-r--r-- | src/map/trade.h | 11 | ||||
-rw-r--r-- | src/map/unit.c | 4 |
20 files changed, 745 insertions, 149 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b6a9e42ee..3d0dfb6a7 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -816,8 +816,7 @@ ACMD(storage) if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) return false; - if (storage_storageopen(sd) == 1) - { //Already open. + if (storage->open(sd) == 1) { //Already open. clif->message(fd, msg_txt(250)); return false; } @@ -853,7 +852,7 @@ ACMD(guildstorage) return false; } - storage_guild_storageopen(sd); + gstorage->open(sd); clif->message(fd, msg_txt(920)); // Guild storage opened. return true; } @@ -5233,7 +5232,7 @@ ACMD(storeall) if (sd->state.storage_flag != 1) { //Open storage. - if( storage_storageopen(sd) == 1 ) { + if( storage->open(sd) == 1 ) { clif->message(fd, msg_txt(1161)); // You currently cannot open your storage. return false; } @@ -5243,10 +5242,14 @@ ACMD(storeall) if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) pc->unequipitem(sd, i, 3); +<<<<<<< HEAD storage_storageadd(sd, i, sd->status.inventory[i].amount); +======= + storage->add(sd, i, sd->status.inventory[i].amount); +>>>>>>> upstream/master } } - storage_storageclose(sd); + storage->close(sd); clif->message(fd, msg_txt(1162)); // All items stored. return true; @@ -5264,9 +5267,9 @@ ACMD(clearstorage) j = sd->status.storage.storage_amount; for (i = 0; i < j; ++i) { - storage_delitem(sd, i, sd->status.storage.items[i].amount); + storage->delitem(sd, i, sd->status.storage.items[i].amount); } - storage_storageclose(sd); + storage->close(sd); clif->message(fd, msg_txt(1394)); // Your storage was cleaned. return true; @@ -5276,7 +5279,7 @@ ACMD(cleargstorage) { int i, j; struct guild *g; - struct guild_storage *gstorage; + struct guild_storage *guild_storage; nullpo_retr(-1, sd); g = sd->guild; @@ -5296,18 +5299,18 @@ ACMD(cleargstorage) return false; } - gstorage = guild2storage2(sd->status.guild_id); - if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. + guild_storage = gstorage->id2storage2(sd->status.guild_id); + if (guild_storage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. return false; } - j = gstorage->storage_amount; - gstorage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member + j = guild_storage->storage_amount; + guild_storage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member for (i = 0; i < j; ++i) { - guild_storage_delitem(sd, gstorage, i, gstorage->items[i].amount); + gstorage->delitem(sd, guild_storage, i, guild_storage->items[i].amount); } - storage_guild_storageclose(sd); - gstorage->lock = 0; // Cleaning done, release lock + gstorage->close(sd); + guild_storage->lock = 0; // Cleaning done, release lock clif->message(fd, msg_txt(1395)); // Your guild storage was cleaned. return true; diff --git a/src/map/battle.c b/src/map/battle.c index 31fe502f6..f6695915b 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -753,8 +753,13 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src); if ( i == 2 ) ratio += status_get_str(src); //Star Anger if (skill < 4 ) +<<<<<<< HEAD ratio /= 12 - 3 * skill; damage += damage * ratio; +======= + ratio /= (12 - 3 * skill); + damage += damage * ratio / 100; +>>>>>>> upstream/master } if( sc ){ @@ -820,7 +825,11 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] damage = #ifndef RENEWAL +<<<<<<< HEAD battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0)) +======= + battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) +>>>>>>> upstream/master #else battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) #endif @@ -830,7 +839,11 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 if( left ){ damage = #ifndef RENEWAL +<<<<<<< HEAD battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0)) +======= + battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) +>>>>>>> upstream/master #else battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) #endif @@ -4345,6 +4358,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.damage = sstatus->max_hp* 9/100; wd.damage2 = 0; break; +<<<<<<< HEAD #ifdef RENEWAL case MO_EXTREMITYFIST: // [malufett] @@ -4354,6 +4368,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list flag.tdef = 1; break; case NJ_ISSEN: // [malufett] +======= + case NJ_ISSEN: // [malufett] +#ifndef RENEWAL + wd.damage = 40*sstatus->str +skill_lv*(sstatus->hp/10 + 35); + wd.damage2 = 0; +#else +>>>>>>> upstream/master { short totaldef = status_get_total_def(target); i = 0; @@ -4367,12 +4388,23 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_RATE(50); flag.idef = 1; } +<<<<<<< HEAD #else wd.damage = 40*sstatus->str +skill_lv*(sstatus->hp/10 + 35); wd.damage2 = 0; #endif break; +======= + break; + case MO_EXTREMITYFIST: // [malufett] + wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8, wd.flag); + // first value is still not confirm. + wd.damage = status_get_sp(src) + 10 * status_get_sp(src) * wd.damage / 100 + 8 * wd.damage; + flag.tdef = 1; +#endif + break; +>>>>>>> upstream/master #ifndef RENEWAL case LK_SPIRALPIERCE: case ML_SPIRALPIERCE: diff --git a/src/map/battleground.c b/src/map/battleground.c index 64bc25269..88cc323bf 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -420,9 +420,20 @@ int bg_id2pos ( int queue_id, int account_id ) { } return 0; } +void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bool response) { + if( arena->begin_timer == INVALID_TIMER || !sd->bg_queue.arena || sd->bg_queue.arena != arena ) { + bg->queue_pc_cleanup(sd); + return; + } + if( response ) { + sd->bg_queue.ready = 1; + /* check if all are ready then cancell timer, and start game */ + } else + bg->queue_pc_cleanup(sd); +} void bg_queue_player_cleanup(struct map_session_data *sd) { if ( sd->bg_queue.client_has_bg_data ) { - clif->bgqueue_notice_delete(sd,BGQND_CLOSEWINDOW, sd->bg_queue.arena->id); + clif->bgqueue_notice_delete(sd,BGQND_CLOSEWINDOW, sd->bg_queue.arena ? sd->bg_queue.arena->id : 0); } script->queue_remove(sd->bg_queue.arena->queue_id,sd->status.account_id); sd->bg_queue.arena = NULL; @@ -726,6 +737,7 @@ void battleground_defaults(void) { bg->begin_timer = bg_begin_timer; bg->queue_pregame = bg_queue_pregame; bg->fillup_timer = bg_fillup_timer; + bg->queue_ready_ack = bg_queue_ready_ack; /* */ bg->config_read = bg_config_read; } diff --git a/src/map/battleground.h b/src/map/battleground.h index 8fe9f3b77..030d13d90 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -96,6 +96,7 @@ struct battleground_interface { int (*begin_timer) (int tid, unsigned int tick, int id, intptr_t data); void (*queue_pregame) (struct bg_arena *arena); int (*fillup_timer) (int tid, unsigned int tick, int id, intptr_t data); + void (*queue_ready_ack) (struct bg_arena *arena, struct map_session_data *sd, bool response); /* */ void (*config_read) (void); } bg_s; diff --git a/src/map/chrif.c b/src/map/chrif.c index 6e076e6d8..a95193363 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -286,7 +286,7 @@ int chrif_save(struct map_session_data *sd, int flag) { //For data sync if (sd->state.storage_flag == 2) - storage_guild_storagesave(sd->status.account_id, sd->status.guild_id, flag); + gstorage->save(sd->status.account_id, sd->status.guild_id, flag); if (flag) sd->state.storage_flag = 0; //Force close it. @@ -526,7 +526,7 @@ void chrif_on_ready(void) { auth_db->foreach(auth_db,chrif_reconnect); //Re-save any storages that were modified in the disconnection time. [Skotlex] - do_reconnect_storage(); + storage->reconnect(); //Re-save any guild castles that were modified in the disconnection time. guild->castle_reconnect(-1, 0, 0); diff --git a/src/map/clif.c b/src/map/clif.c index e8de09d70..4ac123c5a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5964,12 +5964,18 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len) safestrncpy((char*)WFIFOP(fd,28), mes, mes_len); WFIFOSET(fd,WFIFOW(fd,2)); #else + struct map_session_data *ssd = iMap->nick2sd(nick); + WFIFOHEAD(fd, mes_len + NAME_LENGTH + 8); WFIFOW(fd,0) = 0x97; WFIFOW(fd,2) = mes_len + NAME_LENGTH + 8; safestrncpy((char*)WFIFOP(fd,4), nick, NAME_LENGTH); +<<<<<<< HEAD WFIFOL(fd,28) = 0; // isAdmin; if nonzero, also displays text above char // TODO: WFIFOL(fd,28) = pc->get_group_level(ssd); +======= + WFIFOL(fd,28) = (ssd && pc->get_group_level(ssd) == 99) ? 1 : 0; // isAdmin; if nonzero, also displays text above char +>>>>>>> upstream/master safestrncpy((char*)WFIFOP(fd,32), mes, mes_len); WFIFOSET(fd,WFIFOW(fd,2)); #endif @@ -9756,7 +9762,7 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd) if( iTimer->gettick() < sd->progressbar.timeout && sd->st ) sd->st->state = END; - sd->progressbar.npc_id = sd->progressbar.timeout = 0; + sd->state.workinprogress = sd->progressbar.npc_id = sd->progressbar.timeout = 0; npc_scriptcont(sd, npc_id, false); } @@ -9776,8 +9782,8 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) ; //You CAN walk on this OPT1 value. - else if( sd->progressbar.npc_id ) - clif->progressbar_abort(sd); + /*else if( sd->progressbar.npc_id ) + clif->progressbar_abort(sd);*/ else if (pc_cant_act(sd)) return; @@ -10572,7 +10578,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) break; - if ( pc_cant_act2(sd) ) + if ( pc_cant_act2(sd) || sd->state.vending ) break; if (sd->sc.count && ( @@ -10794,7 +10800,11 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) #endif return; } +<<<<<<< HEAD if ( pc_cant_act2(sd) || !(bl = iMap->id2bl(RFIFOL(fd,2))) ) +======= + if ( pc_cant_act2(sd) || !(bl = iMap->id2bl(RFIFOL(fd,2))) || sd->state.vending ) +>>>>>>> upstream/master return; switch (bl->type) { @@ -11848,10 +11858,9 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) return; if (sd->state.storage_flag == 1) - storage_storageadd(sd, item_index, item_amount); - else - if (sd->state.storage_flag == 2) - storage_guild_storageadd(sd, item_index, item_amount); + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == 2) + gstorage->add(sd, item_index, item_amount); } @@ -11867,9 +11876,9 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); if (sd->state.storage_flag == 1) - storage_storageget(sd, item_index, item_amount); + storage->get(sd, item_index, item_amount); else if(sd->state.storage_flag == 2) - storage_guild_storageget(sd, item_index, item_amount); + gstorage->get(sd, item_index, item_amount); } @@ -11883,10 +11892,9 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) return; if (sd->state.storage_flag == 1) - storage_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); - else - if (sd->state.storage_flag == 2) - storage_guild_storageaddfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == 2) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); } @@ -11900,10 +11908,9 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) return; if (sd->state.storage_flag == 1) - storage_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); - else - if (sd->state.storage_flag == 2) - storage_guild_storagegettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == 2) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); } @@ -11912,9 +11919,9 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) void clif_parse_CloseKafra(int fd, struct map_session_data *sd) { if( sd->state.storage_flag == 1 ) - storage_storageclose(sd); + storage->close(sd); else if( sd->state.storage_flag == 2 ) - storage_guild_storageclose(sd); + gstorage->close(sd); } @@ -17399,8 +17406,14 @@ void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) { } void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) { - //struct packet_bgqueue_battlebegin_ack *p = P2PTR(fd, bgqueue_checkstateType); - return; + struct packet_bgqueue_battlebegin_ack *p = P2PTR(fd, bgqueue_checkstateType); + struct bg_arena *arena; + if( !bg->queue_on ) return; /* temp, until feature is complete */ + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? true : false); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } //if ( p->result == 1 ) // bg->queue_pc_ready(sd); //else diff --git a/src/map/guild.c b/src/map/guild.c index b28c14db7..e093fdf92 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -921,7 +921,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c if(sd != NULL && sd->status.guild_id == guild_id) { // do stuff that needs the guild_id first, BEFORE we wipe it if (sd->state.storage_flag == 2) //Close the guild storage. - storage_guild_storageclose(sd); + gstorage->close(sd); guild->send_dot_remove(sd); if( hChSys.ally ) { clif->chsys_quitg(sd); @@ -1752,7 +1752,7 @@ int guild_broken(int guild_id,int flag) for(i=0;i<g->max_member;i++){ // Destroy all relationships if((sd=g->member[i].sd)!=NULL){ if(sd->state.storage_flag == 2) - storage_guild_storage_quit(sd,1); + gstorage->pc_quit(sd,1); sd->status.guild_id=0; sd->guild = NULL; clif->guild_broken(g->member[i].sd,0); @@ -1762,7 +1762,7 @@ int guild_broken(int guild_id,int flag) guild_db->foreach(guild_db,guild_broken_sub,guild_id); castle_db->foreach(castle_db,castle_guild_broken_sub,guild_id); - guild_storage_delete(guild_id); + gstorage->delete(guild_id); if( hChSys.ally ) { if( g->channel != NULL ) { clif->chsys_delete(( struct hChSysCh * )g->channel); diff --git a/src/map/intif.c b/src/map/intif.c index f3931e79e..e364f5c25 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -1011,7 +1011,7 @@ int intif_parse_LoadGuildStorage(int fd) ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); return 1; } - gstor=guild2storage(guild_id); + gstor=gstorage->id2storage(guild_id); if(!gstor) { ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); return 1; @@ -1031,14 +1031,14 @@ int intif_parse_LoadGuildStorage(int fd) } memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage)); - storage_guild_storageopen(sd); + gstorage->open(sd); return 0; } // ACK guild_storage saved int intif_parse_SaveGuildStorage(int fd) { - storage_guild_storagesaved(/*RFIFOL(fd,2), */RFIFOL(fd,6)); + gstorage->saved(/*RFIFOL(fd,2), */RFIFOL(fd,6)); return 0; } diff --git a/src/map/map.c b/src/map/map.c index d74263d1a..a030515d8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5031,7 +5031,7 @@ void do_final(void) do_final_npc(); script->final(); do_final_itemdb(); - do_final_storage(); + storage->final(); guild->final(); party->do_final_party(); pc->do_final_pc(); @@ -5235,7 +5235,13 @@ void map_hp_symbols(void) { HPM->share(buyingstore,"buyingstore"); HPM->share(clif,"clif"); HPM->share(guild,"guild"); +<<<<<<< HEAD HPM->share(homun,"homun"); +======= + HPM->share(gstorage,"gstorage"); + HPM->share(homun,"homun"); + HPM->share(iMap,"iMap"); +>>>>>>> upstream/master HPM->share(ircbot,"ircbot"); HPM->share(itemdb,"itemdb"); HPM->share(logs,"logs"); @@ -5246,7 +5252,12 @@ void map_hp_symbols(void) { HPM->share(vending,"vending"); HPM->share(pc,"pc"); HPM->share(party,"party"); +<<<<<<< HEAD HPM->share(iMap,"iMap"); +======= + HPM->share(storage,"storage"); + HPM->share(trade,"trade"); +>>>>>>> upstream/master /* partial */ HPM->share(mapit,"mapit"); /* sql link */ @@ -5265,6 +5276,7 @@ void load_defaults(void) { buyingstore_defaults(); clif_defaults(); guild_defaults(); + gstorage_defaults(); homunculus_defaults(); instance_defaults(); ircbot_defaults(); @@ -5278,6 +5290,11 @@ void load_defaults(void) { vending_defaults(); pc_defaults(); party_defaults(); +<<<<<<< HEAD +======= + storage_defaults(); + trade_defaults(); +>>>>>>> upstream/master } int do_init(int argc, char *argv[]) { @@ -5468,7 +5485,7 @@ int do_init(int argc, char *argv[]) do_init_status(); party->do_init_party(); guild->init(); - do_init_storage(); + storage->init(); do_init_pet(); homun->init(); do_init_mercenary(); diff --git a/src/map/packets.h b/src/map/packets.h index c467090dd..8e070dd05 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2035,6 +2035,12 @@ packet(0x020d,-1); #endif #endif +#ifndef PACKETVER_RE +#if PACKETVER >= 20120604 + packet(0x0861,18,clif->pPartyBookingRegisterReq,2,4,6); +#endif +#endif + //2012-06-18aRagexeRE #if PACKETVER >= 20120618 packet(0x0983,29); @@ -2249,8 +2255,193 @@ packet(0x020d,-1); packet(0x0883,36,clif->pStoragePassword,0); #endif +<<<<<<< HEAD #if PACKETVER >= 20130612 packetKeys(0x6D166F66, 0x3C000FCF, 0x295B0FCB); /* Thanks to Shakto */ #endif +======= +/* PacketKeys: http://hercules.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */ +#if PACKETVER >= 20110817 + packetKeys(0x053D5CED,0x3DED6DED,0x6DED6DED); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20110824 + packetKeys(0x35C91401,0x262A5556,0x28FA03AA); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20110831 + packetKeys(0x3AD67ED0,0x44703C69,0x6F876809); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20110906 + packetKeys(0x3AD67ED0,0x44703C69,0x6F876809); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111005 + packetKeys(0x291E6762,0x77CD391A,0x60AC2F16); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111012 + packetKeys(0x7F3C2D29,0x59B01DE6,0x1DBB44CA); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111021 + packetKeys(0x357D55DC,0x5A8D759F,0x245C30F5); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111025 + packetKeys(0x50AE1A63,0x3CE579B5,0x29C10406); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111102 + packetKeys(0x5324329D,0x5D545D52,0x06137269); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111109 + packetKeys(0x0B642BDA,0x6ECB1D1C,0x61C7454B); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111122 + packetKeys(0x3B550F07,0x1F666C7C,0x60304EF5); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111207 + packetKeys(0x2A610886,0x3E09165E,0x57C11888); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111214 + packetKeys(0x5151306B,0x7AE32886,0x53060628); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111220 + packetKeys(0x05D53871,0x7D0027B4,0x29975333); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20111228 + packetKeys(0x0FF87E93,0x6CFF7860,0x3A3D1DEC); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120104 + packetKeys(0x262034A1,0x674542A5,0x73A50BA5); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120111 + packetKeys(0x2B412AFC,0x4FF94487,0x6705339D); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120120 + packetKeys(0x504345D0,0x3D427B1B,0x794C2DCC); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120202 + packetKeys(0x2CFC0A71,0x2BA91D8D,0x087E39E0); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120207 + packetKeys(0x1D373F5D,0x5ACD604D,0x1C4D7C4D); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120214 + packetKeys(0x7A255EFA,0x30977276,0x2D4A0448); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120229 + packetKeys(0x520B4C64,0x2800407D,0x47651458); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120307 + packetKeys(0x382A6DEF,0x5CBE7202,0x61F46637); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120314 + packetKeys(0x689C1729,0x11812639,0x60F82967); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120321 + packetKeys(0x21F9683F,0x710C5CA5,0x1FD910E9); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120328 + packetKeys(0x75B8553B,0x37F20B12,0x385C2B40); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120404 + packetKeys(0x0036310C,0x2DCD0BED,0x1EE62A78); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120410 + packetKeys(0x01581359,0x452D6FFA,0x6AFB6E2E); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120418 + packetKeys(0x01540E48,0x13041224,0x31247924); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120424 + packetKeys(0x411D1DBB,0x4CBA4848,0x1A432FC4); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120509 + packetKeys(0x16CF3301,0x1F472B9B,0x0B4A3CD2); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120515 + packetKeys(0x4A715EF9,0x79103E4F,0x405C1238); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120525 + packetKeys(0x70EB4CCB,0x0487713C,0x398D4B08); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120605 + packetKeys(0x68CA3080,0x31B74BDD,0x505208F1); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120612 + packetKeys(0x32E45D64,0x35643564,0x35643564); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120618 + packetKeys(0x261F261F,0x261F261F,0x261F261F); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120702 + packetKeys(0x25733B31,0x53486CFD,0x398649BD); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20120716 + packetKeys(0x76052205,0x22052205,0x22052205); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130320 + packetKeys(0x3F094C49,0x55F86C1E,0x58AA359A); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130514 + packetKeys(0x75794A38,0x58A96BC1,0x296E6FB8); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130522 + packetKeys(0x6948050B,0x06511D9D,0x725D4DF1); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130529 + packetKeys(0x023A6C87,0x14BF1F1E,0x5CC70CC9); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130605 + packetKeys(0x646E08D9,0x5F153AB5,0x61B509B5); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130612 + packetKeys(0x6D166F66,0x3C000FCF,0x295B0FCB); /* Thanks to Shakto */ +#endif + +#if PACKETVER >= 20130618 + packetKeys(0x434115DE,0x34A10FE9,0x6791428E); /* Thanks to Shakto */ +#endif + + +>>>>>>> upstream/master #endif /* _PACKETS_H_ */ diff --git a/src/map/pc.c b/src/map/pc.c index ef70aad97..945925c86 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12,6 +12,7 @@ #include "../common/strlib.h" // safestrncpy() #include "../common/timer.h" #include "../common/utils.h" +#include "../common/conf.h" #include "../common/mmo.h" //NAME_LENGTH #include "atcommand.h" // get_atcommand_level() @@ -4255,7 +4256,7 @@ int pc_useitem(struct map_session_data *sd,int n) nullpo_ret(sd); - if( sd->npc_id ){ + if( sd->npc_id || sd->state.workinprogress&1 ){ /* TODO: add to clif->messages enum */ #ifdef RENEWAL clif->msg(sd, 0x783); // TODO look for the client date that has this message. @@ -4295,8 +4296,8 @@ int pc_useitem(struct map_session_data *sd,int n) return 0; /* Items with delayed consume are not meant to work while in mounts except reins of mount(12622) */ - if( sd->inventory_data[n]->flag.delay_consume ) { - if( nameid != ITEMID_REINS_OF_MOUNT && sd->sc.data[SC_ALL_RIDING] ) + if( sd->inventory_data[n]->flag.delay_consume && nameid != ITEMID_REINS_OF_MOUNT ) { + if( sd->sc.data[SC_ALL_RIDING] ) return 0; else if( pc_issit(sd) ) return 0; @@ -4323,7 +4324,8 @@ int pc_useitem(struct map_session_data *sd,int n) } else {// not yet used item (all slots are initially empty) sd->item_delay[i].nameid = nameid; } - sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay; + if( !(nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) ) + sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay; } else {// should not happen ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%d, char_id=%d)\n", nameid, sd->status.char_id); } @@ -9515,55 +9517,269 @@ int pc_split_atoui(char* str, unsigned int* val, char sep, int max) val[j] = 0; return i; } +/* [Ind/Hercules] */ +void pc_read_skill_tree(void) { + config_t skill_tree_conf; + config_setting_t *skt = NULL, *inherit = NULL, *skills = NULL, *sk = NULL; +#ifdef RENEWAL + const char *config_filename = "db/re/skill_tree.conf"; // FIXME hardcoded name +#else + const char *config_filename = "db/pre-re/skill_tree.conf"; // FIXME hardcoded name +#endif + int i = 0, jnamelen = 0; + struct { + const char *name; + int id; + } jnames[] = { + { "Novice", JOB_NOVICE }, + { "Swordsman", JOB_SWORDMAN }, + { "Magician", JOB_MAGE }, + { "Archer", JOB_ARCHER }, + { "Acolyte", JOB_ACOLYTE }, + { "Merchant", JOB_MERCHANT }, + { "Thief", JOB_THIEF }, + { "Knight", JOB_KNIGHT }, + { "Priest", JOB_PRIEST }, + { "Wizard", JOB_WIZARD }, + { "Blacksmith", JOB_BLACKSMITH }, + { "Hunter", JOB_HUNTER }, + { "Assassin", JOB_ASSASSIN }, + { "Crusader", JOB_CRUSADER }, + { "Monk", JOB_MONK }, + { "Sage", JOB_SAGE }, + { "Rogue", JOB_ROGUE }, + { "Alchemist", JOB_ALCHEMIST }, + { "Bard", JOB_BARD }, + { "Dancer", JOB_DANCER }, + { "Super_Novice", JOB_SUPER_NOVICE }, + { "Gunslinger", JOB_GUNSLINGER }, + { "Ninja", JOB_NINJA }, + { "Novice_High", JOB_NOVICE_HIGH }, + { "Swordsman_High", JOB_SWORDMAN_HIGH }, + { "Magician_High", JOB_MAGE_HIGH }, + { "Archer_High", JOB_ARCHER_HIGH }, + { "Acolyte_High", JOB_ACOLYTE_HIGH }, + { "Merchant_High", JOB_MERCHANT_HIGH }, + { "Thief_High", JOB_THIEF_HIGH }, + { "Lord_Knight", JOB_LORD_KNIGHT }, + { "High_Priest", JOB_HIGH_PRIEST }, + { "High_Wizard", JOB_HIGH_WIZARD }, + { "Whitesmith", JOB_WHITESMITH }, + { "Sniper", JOB_SNIPER }, + { "Assassin_Cross", JOB_ASSASSIN_CROSS }, + { "Paladin", JOB_PALADIN }, + { "Champion", JOB_CHAMPION }, + { "Professor", JOB_PROFESSOR }, + { "Stalker", JOB_STALKER }, + { "Creator", JOB_CREATOR }, + { "Clown", JOB_CLOWN }, + { "Gypsy", JOB_GYPSY }, + { "Baby_Novice", JOB_BABY }, + { "Baby_Swordsman", JOB_BABY_SWORDMAN }, + { "Baby_Magician", JOB_BABY_MAGE }, + { "Baby_Archer", JOB_BABY_ARCHER }, + { "Baby_Acolyte", JOB_BABY_ACOLYTE }, + { "Baby_Merchant", JOB_BABY_MERCHANT }, + { "Baby_Thief", JOB_BABY_THIEF }, + { "Baby_Knight", JOB_BABY_KNIGHT }, + { "Baby_Priest", JOB_BABY_PRIEST }, + { "Baby_Wizard", JOB_BABY_WIZARD }, + { "Baby_Blacksmith", JOB_BABY_BLACKSMITH }, + { "Baby_Hunter", JOB_BABY_HUNTER }, + { "Baby_Assassin", JOB_BABY_ASSASSIN }, + { "Baby_Crusader", JOB_BABY_CRUSADER }, + { "Baby_Monk", JOB_BABY_MONK }, + { "Baby_Sage", JOB_BABY_SAGE }, + { "Baby_Rogue", JOB_BABY_ROGUE }, + { "Baby_Alchemist", JOB_BABY_ALCHEMIST }, + { "Baby_Bard", JOB_BABY_BARD }, + { "Baby_Dancer", JOB_BABY_DANCER }, + { "Super_Baby", JOB_SUPER_BABY }, + { "Taekwon", JOB_TAEKWON }, + { "Star_Gladiator", JOB_STAR_GLADIATOR }, + { "Soul_Linker", JOB_SOUL_LINKER }, + { "Gangsi", JOB_GANGSI }, + { "Death_Knight", JOB_DEATH_KNIGHT }, + { "Dark_Collector", JOB_DARK_COLLECTOR }, + { "Rune_Knight", JOB_RUNE_KNIGHT }, + { "Warlock", JOB_WARLOCK }, + { "Ranger", JOB_RANGER }, + { "Arch_Bishop", JOB_ARCH_BISHOP }, + { "Mechanic", JOB_MECHANIC }, + { "Guillotine_Cross", JOB_GUILLOTINE_CROSS }, + { "Rune_Knight_Trans", JOB_RUNE_KNIGHT_T }, + { "Warlock_Trans", JOB_WARLOCK_T }, + { "Ranger_Trans", JOB_RANGER_T }, + { "Arch_Bishop_Trans", JOB_ARCH_BISHOP_T }, + { "Mechanic_Trans", JOB_MECHANIC_T }, + { "Guillotine_Cross_Trans", JOB_GUILLOTINE_CROSS_T }, + { "Royal_Guard", JOB_ROYAL_GUARD }, + { "Sorcerer", JOB_SORCERER }, + { "Minstrel", JOB_MINSTREL }, + { "Wanderer", JOB_WANDERER }, + { "Sura", JOB_SURA }, + { "Genetic", JOB_GENETIC }, + { "Shadow_Chaser", JOB_SHADOW_CHASER }, + { "Royal_Guard_Trans", JOB_ROYAL_GUARD_T }, + { "Sorcerer_Trans", JOB_SORCERER_T }, + { "Minstrel_Trans", JOB_MINSTREL_T }, + { "Wanderer_Trans", JOB_WANDERER_T }, + { "Sura_Trans", JOB_SURA_T }, + { "Genetic_Trans", JOB_GENETIC_T }, + { "Shadow_Chaser_Trans", JOB_SHADOW_CHASER_T }, + { "Baby_Rune_Knight", JOB_BABY_RUNE }, + { "Baby_Warlock", JOB_BABY_WARLOCK }, + { "Baby_Ranger", JOB_BABY_RANGER }, + { "Baby_Arch_Bishop", JOB_BABY_BISHOP }, + { "Baby_Mechanic", JOB_BABY_MECHANIC }, + { "Baby_Guillotine_Cross", JOB_BABY_CROSS }, + { "Baby_Royal_Guard", JOB_BABY_GUARD }, + { "Baby_Sorcerer", JOB_BABY_SORCERER }, + { "Baby_Minstrel", JOB_BABY_MINSTREL }, + { "Baby_Wanderer", JOB_BABY_WANDERER }, + { "Baby_Sura", JOB_BABY_SURA }, + { "Baby_Genetic", JOB_BABY_GENETIC }, + { "Baby_Shadow_Chaser", JOB_BABY_CHASER }, + { "Expanded_Super_Novice", JOB_SUPER_NOVICE_E }, + { "Expanded_Super_Baby", JOB_SUPER_BABY_E }, + { "Kagerou", JOB_KAGEROU }, + { "Oboro", JOB_OBORO }, + }; + + if (conf_read_file(&skill_tree_conf, config_filename)) { + ShowError("can't read %s\n", config_filename); + return; + } + + jnamelen = ARRAYLENGTH(jnames); + + while( (skt = config_setting_get_elem(skill_tree_conf.root,i++)) ) { + int k, idx; + const char *name = config_setting_name(skt); + + ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 ); + + if( k == jnamelen ) { + ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name); + continue; + } + + + if( ( skills = config_setting_get_member(skt,"skills") ) ) { + int c = 0; + + idx = pc->class2idx(jnames[k].id); + + while( ( sk = config_setting_get_elem(skills,c++) ) ) { + const char *sk_name = config_setting_name(sk); + int skill_id; + + if( ( skill_id = skill->name2id(sk_name) ) ) { + int skidx, offset = 0, h = 0, rlen = 0, rskid = 0; + + ARR_FIND( 0, MAX_SKILL_TREE, skidx, skill_tree[idx][skidx].id == 0 || skill_tree[idx][skidx].id == skill_id ); + if( skidx == MAX_SKILL_TREE ) { + ShowWarning("pc_read_skill_tree: Unable to load skill %hu (%s) into '%s's tree. Maximum number of skills per class has been reached.\n", skill_id, sk_name, name); + continue; + } else if(skill_tree[idx][skidx].id) { + ShowNotice("pc_read_skill_tree: Overwriting %hu for '%s' (%d)\n", skill_id, name, jnames[k].id); + } + + skill_tree[idx][skidx].id = skill_id; + skill_tree[idx][skidx].idx = skill->get_index(skill_id); + + if( config_setting_is_group(sk) ) { + int max = 0, jlevel = 0; + config_setting_lookup_int(sk, "MaxLevel", &max); + config_setting_lookup_int(sk, "MinJobLevel", &jlevel); + skill_tree[idx][skidx].max = (unsigned char)max; + skill_tree[idx][skidx].joblv = (unsigned char)jlevel; + rlen = config_setting_length(sk); + offset += jlevel ? 2 : 1; + } else { + skill_tree[idx][skidx].max = (unsigned char)config_setting_get_int(sk); + skill_tree[idx][skidx].joblv = 0; + } + + for( h = offset; h < rlen && h < MAX_PC_SKILL_REQUIRE; h++ ) { + config_setting_t *rsk = config_setting_get_elem(sk,h); + if( rsk && ( rskid = skill->name2id(config_setting_name(rsk)) ) ) { + skill_tree[idx][skidx].need[h].id = rskid; + skill_tree[idx][skidx].need[h].idx = skill->get_index(rskid); + skill_tree[idx][skidx].need[h].lv = (unsigned char)config_setting_get_int(rsk); + } else if( rsk ) { + ShowWarning("pc_read_skill_tree: unknown requirement '%s' for '%s' in '%s'\n",config_setting_name(rsk),sk_name,name); + } else { + ShowWarning("pc_read_skill_tree: error for '%s' in '%s'\n",sk_name,name); + } + } + + } else { + ShowWarning("pc_read_skill_tree: unknown skill '%s' in '%s'\n",sk_name,name); + } + } + } + } + + i = 0; + while( (skt = config_setting_get_elem(skill_tree_conf.root,i++)) ) { + int k, idx, v = 0; + const char *name = config_setting_name(skt); + const char *iname; -/*========================================== - * sub DB reading. - * Function used to read skill_tree.txt - *------------------------------------------*/ -static bool pc_readdb_skilltree(char* fields[], int columns, int current) -{ - unsigned char joblv = 0, skill_lv; - uint16 skill_id; - int idx, class_; - unsigned int i, offset = 3, skill_idx; + + ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 ); + + if( k == jnamelen ) { + ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name); + continue; + } + idx = pc->class2idx(jnames[k].id); - class_ = atoi(fields[0]); - skill_id = (uint16)atoi(fields[1]); - skill_lv = (unsigned char)atoi(fields[2]); + if( ( inherit = config_setting_get_member(skt,"inherit") ) ) { + while( ( iname = config_setting_get_string_elem(inherit, v++) ) ) { + int b = 0, a, d, f, fidx; - if(columns==4+MAX_PC_SKILL_REQUIRE*2) - {// job level requirement extra column - joblv = (unsigned char)atoi(fields[3]); - offset++; - } + ARR_FIND(0, jnamelen, b, strcmpi(jnames[b].name,iname) == 0 ); + + if( b == jnamelen ) { + ShowWarning("pc_read_skill_tree: '%s' trying to inherit unknown '%s'!\n",name,iname); + continue; + } + + fidx = pc->class2idx(jnames[b].id); + + ARR_FIND( 0, MAX_SKILL_TREE, d, skill_tree[fidx][d].id == 0 ); +<<<<<<< HEAD if(!pcdb_checkid(class_)) { ShowWarning("pc_readdb_skilltree: Invalid job class %d specified.\n", class_); return false; } idx = pc->class2idx(class_); - - //This is to avoid adding two lines for the same skill. [Skotlex] - ARR_FIND( 0, MAX_SKILL_TREE, skill_idx, skill_tree[idx][skill_idx].id == 0 || skill_tree[idx][skill_idx].id == skill_id ); - if( skill_idx == MAX_SKILL_TREE ) { - ShowWarning("pc_readdb_skilltree: Unable to load skill %hu into job %d's tree. Maximum number of skills per class has been reached.\n", skill_id, class_); - return false; - } else if(skill_tree[idx][skill_idx].id) { - ShowNotice("pc_readdb_skilltree: Overwriting skill %hu for job class %d.\n", skill_id, class_); +======= + for( f = 0; f < d; f++ ) { + + ARR_FIND( 0, MAX_SKILL_TREE, a, skill_tree[idx][a].id == 0 || skill_tree[idx][a].id == skill_tree[fidx][f].id ); +>>>>>>> upstream/master + + if( a == MAX_SKILL_TREE ) { + ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", name,iname); + break; + } else if ( skill_tree[idx][a].id || ( skill_tree[idx][a].id == NV_TRICKDEAD && ((pc->jobid2mapid(jnames[k].id)&MAPID_UPPERMASK)!=MAPID_NOVICE) ) ) /* we skip trickdead for non-novices */ + continue;/* skip */ + + memcpy(&skill_tree[idx][a],&skill_tree[fidx][f],sizeof(skill_tree[fidx][f])); + } + + } + } + } + + config_destroy(&skill_tree_conf); - skill_tree[idx][skill_idx].id = skill_id; - skill_tree[idx][skill_idx].idx = skill->get_index(skill_id); - skill_tree[idx][skill_idx].max = skill_lv; - skill_tree[idx][skill_idx].joblv = joblv; - - for(i = 0; i < MAX_PC_SKILL_REQUIRE; i++) { - skill_tree[idx][skill_idx].need[i].id = atoi(fields[i*2+offset]); - skill_tree[idx][skill_idx].need[i].idx = skill->get_index(atoi(fields[i*2+offset])); - skill_tree[idx][skill_idx].need[i].lv = atoi(fields[i*2+offset+1]); - } - return true; } #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) static bool pc_readdb_levelpenalty(char* fields[], int columns, int current) @@ -9695,8 +9911,12 @@ int pc_readdb(void) count = 0; // Reset and read skilltree memset(skill_tree,0,sizeof(skill_tree)); +<<<<<<< HEAD sv->readdb(iMap->db_path, DBPATH"skill_tree.txt", ',', 3+MAX_PC_SKILL_REQUIRE*2, 4+MAX_PC_SKILL_REQUIRE*2, -1, &pc_readdb_skilltree); +======= + pc_read_skill_tree(); +>>>>>>> upstream/master #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) sv->readdb(iMap->db_path, "re/level_penalty.txt", ',', 4, 4, -1, &pc_readdb_levelpenalty); for( k=1; k < 3; k++ ){ // fill in the blanks diff --git a/src/map/pc.h b/src/map/pc.h index 5c585af1c..43d5d40c7 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -603,7 +603,7 @@ enum equip_pos { #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) /* equals pc_cant_act except it doesn't check for chat rooms */ -#define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) +#define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) ) #define pc_setchatid(sd,n) ( (sd)->chatID = n ) diff --git a/src/map/script.c b/src/map/script.c index 15870aaa7..4876111ef 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8179,20 +8179,18 @@ BUILDIN(gettimestr) /*========================================== * Open player storage *------------------------------------------*/ -BUILDIN(openstorage) -{ +BUILDIN(openstorage) { TBL_PC* sd; sd = script_rid2sd(st); if( sd == NULL ) return true; - storage_storageopen(sd); + storage->open(sd); return true; } -BUILDIN(guildopenstorage) -{ +BUILDIN(guildopenstorage) { TBL_PC* sd; int ret; @@ -8200,7 +8198,7 @@ BUILDIN(guildopenstorage) if( sd == NULL ) return true; - ret = storage_guild_storageopen(sd); + ret = gstorage->open(sd); script_pushint(st,ret); return true; } @@ -16312,6 +16310,10 @@ BUILDIN(progressbar) sd->progressbar.npc_id = st->oid; sd->progressbar.timeout = iTimer->gettick() + second*1000; +<<<<<<< HEAD +======= + sd->state.workinprogress = 3; +>>>>>>> upstream/master clif->progressbar(sd, strtol(color, (char **)NULL, 0), second); return true; @@ -16520,9 +16522,10 @@ BUILDIN(setmounting) { TBL_PC* sd; if( (sd = script_rid2sd(st)) == NULL ) return true; - if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) + if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ){ + clif->msgtable(sd->fd, 0X78b); script_pushint(st,0);//can't mount with one of these - else { + }else { if( sd->sc.data[SC_ALL_RIDING] ) status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER); else diff --git a/src/map/skill.c b/src/map/skill.c index 5a10038d8..1753f435a 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2395,6 +2395,10 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds //Can't attack nor use items until skill's delay expires. [Skotlex] sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick; break; + case TK_DODGE: + if( pc->checkskill(sd, TK_JUMPKICK) > 0 ) + flag = 1; + break; case SR_DRAGONCOMBO: if( pc->checkskill(sd, SR_FALLENEMPIRE) > 0 ) flag = 1; @@ -3761,7 +3765,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint int sflag = skill_area_temp[0] & 0xFFF, heal; if( flag&SD_LEVEL ) sflag |= SD_LEVEL; // -1 will be used in packets instead of the skill level - if( skill_area_temp[1] != bl->id && !(skill->get_inf2(skill_id)&INF2_NPC_SKILL) ) + if( (skill_area_temp[1] != bl->id && !(skill->get_inf2(skill_id)&INF2_NPC_SKILL)) || flag&SD_ANIMATION ) sflag |= SD_ANIMATION; // original target gets no animation (as well as all NPC skills) heal = skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, sflag); @@ -3776,6 +3780,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case GN_CARTCANNON: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; + case SR_TIGERCANNON: + flag |= SD_ANIMATION; case LG_MOONSLASHER: clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); break; @@ -7965,12 +7971,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; for(i = 0; i < SC_MAX; i++) { +<<<<<<< HEAD if( SC_COMMON_MAX > i ){ if ( !tsc->data[i] || !status_get_sc_type(i) ) continue; if ( status_get_sc_type(i)&SC_NO_CLEARANCE ) continue; } +======= + if ( !tsc->data[i] ) + continue; + if( SC_COMMON_MAX > i ) + if ( status_get_sc_type(i)&SC_NO_CLEARANCE ) + continue; +>>>>>>> upstream/master switch (i) { case SC_ASSUMPTIO: if( bl->type == BL_MOB ) @@ -8551,7 +8565,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SR_FLASHCOMBO: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); for(i = SR_FLASHCOMBO_ATK_STEP1; i <= SR_FLASHCOMBO_ATK_STEP4; i++) +<<<<<<< HEAD skill->addtimerskill(src, tick + 600 * (i - SR_FLASHCOMBO_ATK_STEP1), bl->id, 0, 0, i, skill_lv, BF_WEAPON, flag|SD_LEVEL); +======= + skill->addtimerskill(src, tick + 500 * (i - SR_FLASHCOMBO_ATK_STEP1), bl->id, 0, 0, i, skill_lv, BF_WEAPON, flag|SD_LEVEL); +>>>>>>> upstream/master break; case WA_SWING_DANCE: case WA_MOONLIT_SERENADE: @@ -13101,12 +13119,14 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case TK_STORMKICK: case TK_DOWNKICK: case TK_COUNTER: + case TK_JUMPKICK: case HT_POWER: case GC_COUNTERSLASH: case GC_WEAPONCRUSH: case SR_FALLENEMPIRE: case SR_DRAGONCOMBO: case SR_TIGERCANNON: + case SR_GATEOFHELL: break; default: return 0; } @@ -17848,7 +17868,7 @@ void skill_reload (void) { * *------------------------------------------*/ int do_init_skill (void) { - skilldb_name2id = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, 0); + skilldb_name2id = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAX_SKILL_NAME_LENGTH); skill->read_db(); group_db = idb_alloc(DB_OPT_BASE); diff --git a/src/map/skill.h b/src/map/skill.h index cc9ac4bfc..921a682a2 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -37,6 +37,7 @@ struct square; #define MAX_SKILLUNITGROUP 25 #define MAX_SKILL_ITEM_REQUIRE 10 #define MAX_SKILLUNITGROUPTICKSET 25 +#define MAX_SKILL_NAME_LENGTH 30 // (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names) #define skill_ischangesex(id) ( \ @@ -1599,7 +1600,7 @@ struct skill_condition { // Database skills struct s_skill_db { unsigned short nameid; - char name[NAME_LENGTH]; + char name[MAX_SKILL_NAME_LENGTH]; char desc[40]; int range[MAX_SKILL_LEVEL],hit,inf,element[MAX_SKILL_LEVEL],nk,splash[MAX_SKILL_LEVEL],max; int num[MAX_SKILL_LEVEL]; diff --git a/src/map/status.c b/src/map/status.c index 992cc0855..a43be5726 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -8329,10 +8329,17 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_BLOOD_SUCKER: { +<<<<<<< HEAD struct block_list *src = iMap->id2bl(sce->val2); val3 = 1; if(src) val3 = 200 + 100 * sce->val1 + status_get_int(src); +======= + struct block_list *src = iMap->id2bl(val2); + val3 = 1; + if(src) + val3 = 200 + 100 * val1 + status_get_int(src); +>>>>>>> upstream/master val4 = tick / 1000; tick_time = 1000; // [GodLesZ] tick time } diff --git a/src/map/storage.c b/src/map/storage.c index ea30f6c0f..c999ab07b 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #include "../common/cbasetypes.h" #include "../common/db.h" @@ -75,14 +76,13 @@ static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap) { struct guild_storage *stor = DB->data2ptr(data); if (stor->dirty && stor->storage_status == 0) //Save closed storages. - storage_guild_storagesave(0, stor->guild_id,0); + gstorage->save(0, stor->guild_id,0); return 0; } //Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex] -void do_reconnect_storage(void) -{ +void do_reconnect_storage(void) { guild_storage_db->foreach(guild_storage_db, storage_reconnect_sub); } @@ -253,7 +253,11 @@ int storage_storageget(struct map_session_data* sd, int index, int amount) return 0; if( (flag = pc->additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 ) +<<<<<<< HEAD storage_delitem(sd,index,amount); +======= + storage->delitem(sd,index,amount); +>>>>>>> upstream/master else clif->additem(sd,0,0,flag); @@ -310,7 +314,11 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) return 0; if( pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 ) +<<<<<<< HEAD storage_delitem(sd,index,amount); +======= + storage->delitem(sd,index,amount); +>>>>>>> upstream/master return 1; } @@ -399,7 +407,7 @@ int storage_guild_storageopen(struct map_session_data* sd) return 1; } - if((gstor = guild2storage2(sd->status.guild_id)) == NULL) { + if((gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) { intif_request_guild_storage(sd->status.account_id,sd->status.guild_id); return 0; } @@ -512,7 +520,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) struct guild_storage *stor; nullpo_ret(sd); - nullpo_ret(stor=guild2storage2(sd->status.guild_id)); + nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id)); if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return 0; @@ -527,11 +535,15 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) return 0; if( stor->lock ) { - storage_guild_storageclose(sd); + gstorage->close(sd); return 0; } +<<<<<<< HEAD if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0) +======= + if(gstorage->additem(sd,stor,&sd->status.inventory[index],amount)==0) +>>>>>>> upstream/master pc->delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE); return 1; @@ -565,12 +577,16 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) return 0; if( stor->lock ) { - storage_guild_storageclose(sd); + gstorage->close(sd); return 0; } if((flag = pc->additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0) +<<<<<<< HEAD guild_storage_delitem(sd,stor,index,amount); +======= + gstorage->delitem(sd,stor,index,amount); +>>>>>>> upstream/master else //inform fail clif->additem(sd,0,0,flag); // log_fromstorage(sd, index, 1); @@ -604,7 +620,11 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int if( amount < 1 || amount > sd->status.cart[index].amount ) return 0; +<<<<<<< HEAD if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0) +======= + if(gstorage->additem(sd,stor,&sd->status.cart[index],amount)==0) +>>>>>>> upstream/master pc->cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE); return 1; @@ -637,7 +657,11 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a return 0; if(pc->cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0) +<<<<<<< HEAD guild_storage_delitem(sd,stor,index,amount); +======= + gstorage->delitem(sd,stor,index,amount); +>>>>>>> upstream/master return 1; } @@ -673,7 +697,7 @@ int storage_guild_storagesaved(int guild_id) { struct guild_storage *stor; - if((stor=guild2storage2(guild_id)) != NULL) { + if((stor=gstorage->id2storage2(guild_id)) != NULL) { if (stor->dirty && stor->storage_status == 0) { //Storage has been correctly saved. stor->dirty = 0; @@ -689,7 +713,7 @@ int storage_guild_storageclose(struct map_session_data* sd) struct guild_storage *stor; nullpo_ret(sd); - nullpo_ret(stor=guild2storage2(sd->status.guild_id)); + nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id)); clif->storageclose(sd); if (stor->storage_status) @@ -697,7 +721,7 @@ int storage_guild_storageclose(struct map_session_data* sd) if (iMap->save_settings&4) chrif_save(sd, 0); //This one also saves the storage. [Skotlex] else - storage_guild_storagesave(sd->status.account_id, sd->status.guild_id,0); + gstorage->save(sd->status.account_id, sd->status.guild_id,0); stor->storage_status=0; } sd->state.storage_flag = 0; @@ -710,7 +734,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) struct guild_storage *stor; nullpo_ret(sd); - nullpo_ret(stor=guild2storage2(sd->status.guild_id)); + nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id)); if(flag) { //Only during a guild break flag is 1 (don't save storage) @@ -726,10 +750,46 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) if (iMap->save_settings&4) chrif_save(sd,0); else - storage_guild_storagesave(sd->status.account_id,sd->status.guild_id,1); + gstorage->save(sd->status.account_id,sd->status.guild_id,1); } sd->state.storage_flag = 0; stor->storage_status = 0; return 0; } +void storage_defaults(void) { + storage = &storage_s; + + /* */ + storage->init = do_init_storage; + storage->final = do_final_storage; + /* */ + storage->reconnect = do_reconnect_storage; + /* */ + storage->delitem = storage_delitem; + storage->open = storage_storageopen; + storage->add = storage_storageadd; + storage->get = storage_storageget; + storage->addfromcart = storage_storageaddfromcart; + storage->gettocart = storage_storagegettocart; + storage->close = storage_storageclose; + storage->pc_quit = storage_storage_quit; +} +void gstorage_defaults(void) { + gstorage = &gstorage_s; + + gstorage->id2storage = guild2storage; + gstorage->id2storage2 = guild2storage2; + gstorage->delete = guild_storage_delete; + gstorage->open = storage_guild_storageopen; + gstorage->additem = guild_storage_additem; + gstorage->delitem = guild_storage_delitem; + gstorage->add = storage_guild_storageadd; + gstorage->get = storage_guild_storageget; + gstorage->addfromcart = storage_guild_storageaddfromcart; + gstorage->gettocart = storage_guild_storagegettocart; + gstorage->close = storage_guild_storageclose; + gstorage->pc_quit = storage_guild_storage_quit; + gstorage->save = storage_guild_storagesave; + gstorage->saved = storage_guild_storagesaved; +} diff --git a/src/map/storage.h b/src/map/storage.h index c08ec81cb..058b980b1 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -1,41 +1,52 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #ifndef _STORAGE_H_ #define _STORAGE_H_ -//#include "../common/mmo.h" struct storage_data; struct guild_storage; struct item; -//#include "map.h" struct map_session_data; -int storage_delitem(struct map_session_data* sd, int n, int amount); -int storage_storageopen(struct map_session_data *sd); -int storage_storageadd(struct map_session_data *sd,int index,int amount); -int storage_storageget(struct map_session_data *sd,int index,int amount); -int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount); -int storage_storagegettocart(struct map_session_data *sd,int index,int amount); -void storage_storageclose(struct map_session_data *sd); -int do_init_storage(void); -void do_final_storage(void); -void do_reconnect_storage(void); -void storage_storage_quit(struct map_session_data *sd, int flag); +struct storage_interface { + int (*init) (void); + void (*final) (void); + /* */ + void (*reconnect) (void); + /* */ + int (*delitem) (struct map_session_data* sd, int n, int amount); + int (*open) (struct map_session_data *sd); + int (*add) (struct map_session_data *sd,int index,int amount); + int (*get) (struct map_session_data *sd,int index,int amount); + int (*addfromcart) (struct map_session_data *sd,int index,int amount); + int (*gettocart) (struct map_session_data *sd,int index,int amount); + void (*close) (struct map_session_data *sd); + void (*pc_quit) (struct map_session_data *sd, int flag); +} storage_s; +struct storage_interface *storage; -struct guild_storage* guild2storage(int guild_id); -struct guild_storage *guild2storage2(int guild_id); -int guild_storage_delete(int guild_id); -int storage_guild_storageopen(struct map_session_data *sd); -int guild_storage_additem(struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount); -int guild_storage_delitem(struct map_session_data *sd,struct guild_storage *stor,int n,int amount); -int storage_guild_storageadd(struct map_session_data *sd,int index,int amount); -int storage_guild_storageget(struct map_session_data *sd,int index,int amount); -int storage_guild_storageaddfromcart(struct map_session_data *sd,int index,int amount); -int storage_guild_storagegettocart(struct map_session_data *sd,int index,int amount); -int storage_guild_storageclose(struct map_session_data *sd); -int storage_guild_storage_quit(struct map_session_data *sd,int flag); -int storage_guild_storagesave(int account_id, int guild_id, int flag); -int storage_guild_storagesaved(int guild_id); //Ack from char server that guild store was saved. +struct guild_storage_interface { + struct guild_storage *(*id2storage) (int guild_id); + struct guild_storage *(*id2storage2) (int guild_id); + int (*delete) (int guild_id); + int (*open) (struct map_session_data *sd); + int (*additem) (struct map_session_data *sd,struct guild_storage *stor,struct item *item_data,int amount); + int (*delitem) (struct map_session_data *sd,struct guild_storage *stor,int n,int amount); + int (*add) (struct map_session_data *sd,int index,int amount); + int (*get) (struct map_session_data *sd,int index,int amount); + int (*addfromcart) (struct map_session_data *sd,int index,int amount); + int (*gettocart) (struct map_session_data *sd,int index,int amount); + int (*close) (struct map_session_data *sd); + int (*pc_quit) (struct map_session_data *sd,int flag); + int (*save) (int account_id, int guild_id, int flag); + int (*saved) (int guild_id); //Ack from char server that guild store was saved. +} gstorage_s; + +struct guild_storage_interface *gstorage; + +void storage_defaults(void); +void gstorage_defaults(void); #endif /* _STORAGE_H_ */ diff --git a/src/map/trade.h b/src/map/trade.h index 6bcefdb96..ba56872c2 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -1,10 +1,10 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams #ifndef _TRADE_H_ #define _TRADE_H_ -//#include "map.h" struct map_session_data; struct trade_interface { @@ -20,6 +20,11 @@ struct trade_interface { } trade_s; struct trade_interface *trade; +<<<<<<< HEAD void trade_interface(void); +======= + +void trade_defaults(void); +>>>>>>> upstream/master #endif /* _TRADE_H_ */ diff --git a/src/map/unit.c b/src/map/unit.c index 021859bba..5e836dc2e 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2108,9 +2108,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, buyingstore->close(sd); searchstore->close(sd); if(sd->state.storage_flag == 1) - storage_storage_quit(sd,0); + storage->pc_quit(sd,0); else if (sd->state.storage_flag == 2) - storage_guild_storage_quit(sd,0); + gstorage->pc_quit(sd,0); sd->state.storage_flag = 0; //Force close it when being warped. if(sd->party_invite>0) party->reply_invite(sd,sd->party_invite,0); |