diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 9 | ||||
-rw-r--r-- | src/common/mapindex.h | 1 | ||||
-rw-r--r-- | src/common/sql.c | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 6 | ||||
-rw-r--r-- | src/map/battle.c | 23 | ||||
-rw-r--r-- | src/map/npc.c | 10 | ||||
-rw-r--r-- | src/map/npc.h | 5 | ||||
-rw-r--r-- | src/map/packets.h | 37 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 75 | ||||
-rw-r--r-- | src/map/status.c | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 |
14 files changed, 123 insertions, 80 deletions
diff --git a/src/char/char.c b/src/char/char.c index f63f1c66d..1b8d466f9 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1952,17 +1952,16 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { WBUFW(buf,48) = min(p->max_sp, INT16_MAX); WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed; WBUFW(buf,52) = p->class_; - WBUFW(buf,54) = p->hair; - #if PACKETVER >= 20141022 - //When the weapon is sent and your option is riding, the client crashes on login!? - WBUFL(buf,56) = p->option&(0x20|0x80000|0x100000|0x200000|0x400000|0x800000|0x1000000|0x2000000|0x4000000|0x8000000) ? 0 : p->weapon; + WBUFL(buf,54) = p->hair; offset+=2; buf = WBUFP(buffer,offset); #else + WBUFW(buf,54) = p->hair; +#endif + //When the weapon is sent and your option is riding, the client crashes on login!? WBUFW(buf,56) = p->option&(0x20|0x80000|0x100000|0x200000|0x400000|0x800000|0x1000000|0x2000000|0x4000000|0x8000000) ? 0 : p->weapon; -#endif WBUFW(buf,58) = p->base_level; WBUFW(buf,60) = min(p->skill_point, INT16_MAX); diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 91bf4562e..8e552261a 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -54,6 +54,7 @@ #define MAP_MALANGDO "malangdo" #define MAP_MALAYA "malaya" #define MAP_ECLAGE "eclage" +#define MAP_ECLAGE_IN "ecl_in01" #define mapindex_id2name(n) mapindex->id2name((n),__FILE__, __LINE__, __func__) #define mapindex_exists(n) ( mapindex->list[(n)].name[0] != '\0' ) diff --git a/src/common/sql.c b/src/common/sql.c index 7f89e9828..abc2ed57a 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -410,6 +410,7 @@ void Sql_Free(Sql* self) { SQL->FreeResult(self); StrBuf->Destroy(&self->buf); if( self->keepalive != INVALID_TIMER ) timer->delete(self->keepalive, Sql_P_KeepaliveTimer); + mysql_close(&self->handle); aFree(self); } } diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6f97141b2..5e50a06ee 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4591,7 +4591,7 @@ ACMD(disguise) if ((id = atoi(message)) > 0) { //Acquired an ID - if (!mob->db_checkid(id) && !npcdb_checkid(id)) + if (!mob->db_checkid(id) && !npc->db_checkid(id)) id = 0; //Invalid id for either mobs or npcs. } else { //Acquired a Name @@ -4643,7 +4643,7 @@ ACMD(disguiseall) if ((mob_id = mob->db_searchname(message)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(message); - if (!mob->db_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc... + if (!mob->db_checkid(mob_id) && !npc->db_checkid(mob_id)) { //if mob or npc... clif->message(fd, msg_txt(123)); // Monster/NPC name/id not found. return false; } @@ -4676,7 +4676,7 @@ ACMD(disguiseguild) } if( (id = atoi(monster)) > 0 ) { - if( !mob->db_checkid(id) && !npcdb_checkid(id) ) + if( !mob->db_checkid(id) && !npc->db_checkid(id) ) id = 0; } else { if( (id = mob->db_searchname(monster)) == 0 ) { diff --git a/src/map/battle.c b/src/map/battle.c index 86134db52..de57e7d2c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4742,6 +4742,18 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list else wd.dmg_lv = ATK_DEF; break; + + case KO_BAKURETSU: + { +#ifdef RENEWAL + GET_NORMAL_ATTACK((sc && sc->data[SC_MAXIMIZEPOWER] ? 1 : 0) | (sc && sc->data[SC_WEAPONPERFECT] ? 8 : 0)); +#endif + skillratio = skill_lv * (50 + status_get_dex(src) / 4); + skillratio = (int)(skillratio * (sd ? pc->checkskill(sd, NJ_TOBIDOUGU) : 10) * 40.f / 100.0f * status->get_lv(src) / 120); + ATK_RATE(skillratio + 10 * (sd ? sd->status.job_level : 0)); + } + break; + #ifdef RENEWAL case NJ_TATAMIGAESHI: ATK_RATE(200); @@ -4768,17 +4780,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.damage = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage, wd.div_, 0, flag.weapon); } #endif - - case KO_BAKURETSU: - { -#ifdef RENEWAL - GET_NORMAL_ATTACK((sc && sc->data[SC_MAXIMIZEPOWER] ? 1 : 0) | (sc && sc->data[SC_WEAPONPERFECT] ? 8 : 0)); -#endif - skillratio = skill_lv * (50 + status_get_dex(src) / 4); - skillratio = (int)(skillratio * (sd ? pc->checkskill(sd, NJ_TOBIDOUGU) : 10) * 40.f / 100.0f * status->get_lv(src) / 120); - ATK_RATE(skillratio + 10 * (sd ? sd->status.job_level : 0)); - } - break; default: ATK_RATE(battle->calc_skillratio(BF_WEAPON, src, target, skill_id, skill_lv, skillratio, wflag)); } diff --git a/src/map/npc.c b/src/map/npc.c index 04df22f2d..28709d34f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -75,7 +75,7 @@ struct view_data* npc_get_viewdata(int class_) //Returns the viewdata for normal npc classes. if( class_ == INVISIBLE_CLASS ) return &npc_viewdb[0]; - if (npcdb_checkid(class_) || class_ == WARP_CLASS){ + if (npc->db_checkid(class_) || class_ == WARP_CLASS){ if( class_ > MAX_NPC_CLASS2_START ){ return &npc_viewdb2[class_-MAX_NPC_CLASS2_START]; }else{ @@ -85,6 +85,13 @@ struct view_data* npc_get_viewdata(int class_) return NULL; } +//Checks if a given id is a valid npc id. [Skotlex] +//Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001) +bool npc_db_checkid(int id) +{ + return ((id >= 46 && id <= 125) || id == HIDDEN_WARP_CLASS || (id > 400 && id < MAX_NPC_CLASS) || id == INVISIBLE_CLASS || (id > MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END)); +} + /// Returns a new npc id that isn't being used in id_db. /// Fatal error if nothing is available. int npc_get_new_npc_id(void) { @@ -4745,4 +4752,5 @@ void npc_defaults(void) { npc->market_tosql = npc_market_tosql; npc->market_delfromsql = npc_market_delfromsql; npc->market_delfromsql_sub = npc_market_delfromsql_sub; + npc->db_checkid = npc_db_checkid; } diff --git a/src/map/npc.h b/src/map/npc.h index a5a2b4676..b0014e323 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -124,10 +124,6 @@ enum actor_classes { #define MAX_NPC_CLASS2_START 10000 #define MAX_NPC_CLASS2_END 10110 -//Checks if a given id is a valid npc id. [Skotlex] -//Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001) -#define npcdb_checkid(id) ( ( (id) >= 46 && (id) <= 125) || (id) == HIDDEN_WARP_CLASS || ( (id) > 400 && (id) < MAX_NPC_CLASS ) || (id) == INVISIBLE_CLASS || ( (id) > MAX_NPC_CLASS2_START && (id) < MAX_NPC_CLASS2_END ) ) - //Script NPC events. enum npce_event { NPCE_LOGIN, @@ -276,6 +272,7 @@ struct npc_interface { void (*market_tosql) (struct npc_data *nd, unsigned short index); void (*market_delfromsql) (struct npc_data *nd, unsigned short index); void (*market_delfromsql_sub) (const char *npcname, unsigned short index); + bool (*db_checkid) (const int id); /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ diff --git a/src/map/packets.h b/src/map/packets.h index b022e369c..ccf1c28ef 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2767,39 +2767,6 @@ packet(0x020d,-1); packet(0x09DF,7); #endif -// 2014-10-22bRagexe - YomRawr -#if PACKETVER >= 20141022 - packet(0x0369,7,clif->pActionRequest,2,6); - packet(0x083C,10,clif->pUseSkillToId,2,4,6); - packet(0x0437,5,clif->pWalkToXY,2); - packet(0x035F,6,clif->pTickSend,2); - packet(0x08AD,5,clif->pChangeDir,2,4); - packet(0x094E,6,clif->pTakeItem,2); - packet(0x087D,6,clif->pDropItem,2,4); - packet(0x0878,8,clif->pMoveToKafra,2,4); - packet(0x08AA,8,clif->pMoveFromKafra,2,4); - packet(0x023B,10,clif->pUseSkillToPos,2,4,6,8); - packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); - packet(0x096A,6,clif->pGetCharNameRequest,2); - packet(0x0368,6,clif->pSolveCharName,2); - packet(0x0835,12,clif->pSearchStoreInfoListItemClick,2,6,10); - packet(0x0940,2,clif->pSearchStoreInfoNextPage,0); - packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); - packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); - packet(0x0360,6,clif->pReqClickBuyingStore,2); - packet(0x0817,2,clif->pReqCloseBuyingStore,0); - packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); - packet(0x0955,18,clif->pPartyBookingRegisterReq,2,4); - // packet(0x092B,8); // CZ_JOIN_BATTLE_FIELD - packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); - packet(0x093B,19,clif->pWantToConnection,2,6,10,14,18); - packet(0x0896,26,clif->pPartyInvite2,2); - // packet(0x08AB,4); // CZ_GANGSI_RANK - packet(0x091A,26,clif->pFriendsListAdd,2); - packet(0x0899,5,clif->pHomMenu,2,4); - packet(0x0438,36,clif->pStoragePassword,0); -#endif - // 2014-10-16aRagexe - YomRawr #if PACKETVER >= 20141016 packet(0x0369,7,clif->pActionRequest,2,6); @@ -3113,10 +3080,6 @@ packet(0x020d,-1); packetKeys(0x04810281,0x42814281,0x42814281); /* Themon */ #endif -#if PACKETVER >= 20141022 - packetKeys(0x290551EA,0x2B952C75,0x2D67669B); /* YomRawr */ -#endif - #if PACKETVER >= 20141016 packetKeys(0x2DFF467C,0x444B37EE,0x2C1B634F); /* YomRawr */ #endif diff --git a/src/map/script.c b/src/map/script.c index 3ed779fba..aca4650c5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12488,7 +12488,7 @@ BUILDIN(disguise) id = script_getnum(st,2); - if (mob->db_checkid(id) || npcdb_checkid(id)) { + if (mob->db_checkid(id) || npc->db_checkid(id)) { pc->disguise(sd, id); script_pushint(st,id); } else diff --git a/src/map/skill.c b/src/map/skill.c index cd46be0fa..429a0b739 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -493,6 +493,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case AL_WARP: case RETURN_TO_ELDICASTES: case ALL_GUARDIAN_RECALL: + case ECLAGE_RECALL: if(map->list[m].flag.nowarp) { clif->skill_mapinfomessage(sd,0); return 1; @@ -9170,34 +9171,74 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; - case RETURN_TO_ELDICASTES: case ALL_GUARDIAN_RECALL: - if( sd ) - { - short x, y; // Destiny position. - unsigned short map_index; + case ECLAGE_RECALL: + if( sd ) { + short x = 0, y = 0; //Destiny position. + unsigned short map_index = 0; - if( skill_id == RETURN_TO_ELDICASTES) { - x = 198; - y = 187; - map_index = mapindex->name2id(MAP_DICASTES); - } else { - x = 44; - y = 151; - map_index = mapindex->name2id(MAP_MORA); + switch( skill_id ) { + default: + case RETURN_TO_ELDICASTES: + x = 198; + y = 187; + map_index = mapindex->name2id(MAP_DICASTES); + break; + case ALL_GUARDIAN_RECALL: + x = 44; + y = 151; + map_index = mapindex->name2id(MAP_MORA); + break; + case ECLAGE_RECALL: + x = 47; + y = 31; + map_index = mapindex->name2id(MAP_ECLAGE_IN); + break; } - - if(!map_index) { - //Given map not found? + if( !mapindex ) { //Given map not found? clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 0; } - pc->setpos(sd, map_index, x, y, CLR_TELEPORT); + pc->setpos(sd,map_index,x,y,CLR_TELEPORT); } break; + case ECL_SNOWFLIP: + case ECL_PEONYMAMY: + case ECL_SADAGUI: + case ECL_SEQUOIADUST: + switch( skill_id ) { + case ECL_SNOWFLIP: + status_change_end(bl,SC_SLEEP,INVALID_TIMER); + status_change_end(bl,SC_BLOODING,INVALID_TIMER); + status_change_end(bl,SC_BURNING,INVALID_TIMER); + status_change_end(bl,SC_DEEP_SLEEP,INVALID_TIMER); + break; + case ECL_PEONYMAMY: + status_change_end(bl,SC_FREEZE,INVALID_TIMER); + status_change_end(bl,SC_FROSTMISTY,INVALID_TIMER); + status_change_end(bl,SC_COLD,INVALID_TIMER); + break; + case ECL_SADAGUI: + status_change_end(bl,SC_STUN,INVALID_TIMER); + status_change_end(bl,SC_CONFUSION,INVALID_TIMER); + status_change_end(bl,SC_ILLUSION,INVALID_TIMER); + status_change_end(bl,SC_FEAR,INVALID_TIMER); + break; + case ECL_SEQUOIADUST: + status_change_end(bl,SC_STONE,INVALID_TIMER); + status_change_end(bl,SC_POISON,INVALID_TIMER); + status_change_end(bl,SC_CURSE,INVALID_TIMER); + status_change_end(bl,SC_BLIND,INVALID_TIMER); + status_change_end(bl,SC_ORCISH,INVALID_TIMER); + break; + } + clif->skill_nodamage(src,bl,skill_id,skill_lv,1); + clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, 0, 1, skill_id, -2, 6); + break; + case GM_SANDMAN: if( tsc ) { if( tsc->opt1 == OPT1_SLEEP ) diff --git a/src/map/status.c b/src/map/status.c index c0611f97b..7b4e6f274 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6203,7 +6203,7 @@ void status_set_viewdata(struct block_list *bl, int class_) nullpo_retv(bl); if (mob->db_checkid(class_) || mob->is_clone(class_)) vd = mob->get_viewdata(class_); - else if (npcdb_checkid(class_) || (bl->type == BL_NPC && class_ == WARP_CLASS)) + else if (npc->db_checkid(class_) || (bl->type == BL_NPC && class_ == WARP_CLASS)) vd = npc->get_viewdata(class_); else if (homdb_checkid(class_)) vd = homun->get_viewdata(class_); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 034b14b79..c2c6daf58 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3399,6 +3399,8 @@ struct { struct HPMHookPoint *HP_npc_market_delfromsql_post; struct HPMHookPoint *HP_npc_market_delfromsql_sub_pre; struct HPMHookPoint *HP_npc_market_delfromsql_sub_post; + struct HPMHookPoint *HP_npc_db_checkid_pre; + struct HPMHookPoint *HP_npc_db_checkid_post; struct HPMHookPoint *HP_npc_secure_timeout_timer_pre; struct HPMHookPoint *HP_npc_secure_timeout_timer_post; struct HPMHookPoint *HP_party_init_pre; @@ -8482,6 +8484,8 @@ struct { int HP_npc_market_delfromsql_post; int HP_npc_market_delfromsql_sub_pre; int HP_npc_market_delfromsql_sub_post; + int HP_npc_db_checkid_pre; + int HP_npc_db_checkid_post; int HP_npc_secure_timeout_timer_pre; int HP_npc_secure_timeout_timer_post; int HP_party_init_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 21f48134c..89ded9041 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1726,6 +1726,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->market_tosql, HP_npc_market_tosql) }, { HP_POP(npc->market_delfromsql, HP_npc_market_delfromsql) }, { HP_POP(npc->market_delfromsql_sub, HP_npc_market_delfromsql_sub) }, + { HP_POP(npc->db_checkid, HP_npc_db_checkid) }, { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, /* party */ { HP_POP(party->init, HP_party_init) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 9078efe2e..ff08b8909 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -45435,6 +45435,33 @@ void HP_npc_market_delfromsql_sub(const char *npcname, unsigned short index) { } return; } +bool HP_npc_db_checkid(const int id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_npc_db_checkid_pre ) { + bool (*preHookFunc) (const int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_db_checkid_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_npc_db_checkid_pre[hIndex].func; + retVal___ = preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.npc.db_checkid(id); + } + if( HPMHooks.count.HP_npc_db_checkid_post ) { + bool (*postHookFunc) (bool retVal___, const int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_npc_db_checkid_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_npc_db_checkid_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &id); + } + } + return retVal___; +} int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { int hIndex = 0; int retVal___ = 0; |