Skip to content

Commit

Permalink
Patch 1559
Browse files Browse the repository at this point in the history
・スクリプト命令[delmerc]、[setequipcardid]追加(script_ref.txt, script.c)
 Thanks フリージア さん、Dallen さん

・mob_dbのmodeを追加(db_ref.txt, battle.c, mob.c, skill.c, status.*)
 -> ボス属性の持つ悪性状態異常・ハイディング系・ノックバックの各無効特性は維持しています
 -> 各種攻撃無効、ダメージ補正の計算位置は暫定です

・装備一括解除[0xbad]、[0xbf5]を実装(packet_db.lua, clif.c)
 Thanks Dallen さん
  • Loading branch information
refis committed Sep 24, 2024
1 parent 262f62b commit 45b8e3c
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 23 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 1,16 @@
----------------------------------------
//1559 [2024/09/25] by refis

・スクリプト命令[delmerc]、[setequipcardid]追加(script_ref.txt, script.c)
Thanks フリージア さん、Dallen さん

・mob_dbのmodeを追加(db_ref.txt, battle.c, mob.c, skill.c, status.*)
-> ボス属性の持つ悪性状態異常・ハイディング系・ノックバックの各無効特性は維持しています
-> 各種攻撃無効、ダメージ補正の計算位置は暫定です

・装備一括解除[0xbad]、[0xbf5]を実装(packet_db.lua, clif.c)
Thanks Dallen さん

----------------------------------------
//1558 [2024/09/22] by Blaze

Expand Down
4 changes: 2 additions & 2 deletions db/packet_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 1961,7 @@ p(0x0ba9,-1)
p(0x0baa,22)
p(0x0bab,22)
p(0x0bac,22)
p(0x0bad,2)
p(0x0bad,2,"unequipitemall",2)
p(0x0bae,3)
p(0x0baf,16)
p(0x0bb0,9)
Expand All @@ -1983,7 1983,7 @@ p(0x0bbf,12)
p(0x0bc0,3)
p(0x0be9,6,"emotion2",4)
p(0x0bf3,24,"adventureguide",2)
p(0x0bf5,6,"equippurgereq",2)
p(0x0bf5,6,"unequipitemall2",2)



Expand Down
40 changes: 25 additions & 15 deletions doc/db_ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -589,21 589,31 @@ Mode : 基本行動パターン。値を加算していく
(例 : 固定型アクティブモンスターなら、固定(0) 追跡(4) 攻撃(128)=132)
(例 : 移動型アクティブモンスターなら、移動(1) 追跡(4) 攻撃(128)=133)
(例 : ルートリンク型ノンアクティブモンスターなら、移動(1) ルート(2) リンク(8) 攻撃(128)=139)
0 : 固定
1 : 移動
2 : ルート
4 : 追跡
8 : リンク
16 : 詠唱反応
32 : ボス属性というかスティル不可・ハイディング無効
64 : ダメージ1
128 : 攻撃(アクティブ)
256 : 接触反応
512 : 攻撃中ターゲットチェンジ許可
1024 : 追跡中ターゲットチェンジ許可
2048 : 強敵に非アクティブ
4096 : ハイパーアクティブ
8192 : スキル無効
0x0000001 : 移動可能
0x0000002 : ルート
0x0000004 : 追跡(アクティブ)
0x0000008 : リンク
0x0000010 : 詠唱反応
0x0000020 : ボス属性というかスティル不可、コーマ系無効
0x0000040 : ダメージ1
0x0000080 : 攻撃可能
0x0000100 : 接触反応
0x0000200 : 攻撃中ターゲットチェンジ許可
0x0000400 : 追跡中ターゲットチェンジ許可
0x0000800 : 強敵に非アクティブ
0x0001000 : ハイパーアクティブ
0x0002000 : スキル無効
0x0004000 : 悪性状態異常無効
0x0008000 : ランダムターゲット
0x0010000 : 近接物理無効
0x0020000 : 魔法無効
0x0040000 : 遠距離物理無効
0x0080000 : MISC無効
0x0100000 : ハイディング系無効
0x0200000 : ノックバック無効
0x0400000 : 被ダメージ補正1/10
0x0800000 : 被ダメージ補正1/100
0x1000000 : 被ダメージ補正1/1000
Speed : 基本移動速度は150
(1>150<2000 : 移動速度。数値が小さくなれば速く、大きくなれば遅くなる。)
ADelay : 基本攻撃速度は謎
Expand Down
20 changes: 20 additions & 0 deletions doc/script_ref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2100,6 2100,21 @@ AurigaNPCScript
<position>が0のときは全てのカードを取り除きます。
1~4の数字を指定した場合はその箇所のカードのみを取り除くことができます。

setequipcardid命令
setequipcardid(<num>,<pos>,<card_id>[,<flag>])

<num> 1-22までの整数を指定します。詳しくはgetequipidを参照のこと。
<pos> 0-3までの整数を指定します。
<card_id> 整数
<flag> 以下の数値を加算して指定、省略可
 0x1 装備を再装着
 0x2 更新後装備をプレビュー表示
 0x4 精練値を0にする

指定した部位のアイテムの<pos>に刺さっているカードを<card_id>にした後<flag>の動作をします
<card_id>が0の場合、カードは削除されます
<flag>を省略した場合、追加動作しません

wedding命令
wedding;

Expand Down Expand Up @@ -2353,6 2368,11 @@ AurigaNPCScript

<merc_id>で指定した傭兵を<time>秒の間召喚します。

delmerc命令
delmerc;

傭兵を解雇します。

openbook命令
openbook <itemid>[,<page>];

Expand Down
17 changes: 16 additions & 1 deletion src/map/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 441,11 @@ static int battle_calc_damage(struct block_list *src, struct block_list *bl, int
}
}

if(tmd && tmd->mode&MD_SKILLIMMUNITY && skill_num > 0)
if(tmd && ((tmd->mode&MD_SKILLIMMUNITY && (flag&BF_SKILL)) ||
(tmd->mode&MD_IGNORE_MELEE && (flag&BF_WEAPON)) ||
(tmd->mode&MD_IGNORE_MAGIC && (flag&BF_MAGIC)) ||
(tmd->mode&MD_IGNORE_RANGED && (flag&BF_LONG)) ||
(tmd->mode&MD_IGNORE_MISC && (flag&BF_MISC)) ))
damage = 0;

if(sc && sc->count > 0) {
Expand Down Expand Up @@ -1152,6 1156,17 @@ static int battle_calc_damage(struct block_list *src, struct block_list *bl, int
if(damage < 1)
damage = (!battle_config.skill_min_damage && flag&BF_MAGIC && src->type == BL_PC)? 0: 1;
}

// mob mode
if(bl->type == BL_MOB) {
// 本来は重複するが排他扱いで実装しておく
if(status_get_mode(bl)&MD_DAMAGEREDUCTION_1000)
damage = damage / 1000;
else if(status_get_mode(bl)&MD_DAMAGEREDUCTION_100)
damage = damage / 100;
else if(status_get_mode(bl)&MD_DAMAGEREDUCTION_10)
damage = damage / 10;
}
}

// 魔導ギアの加熱値上昇
Expand Down
84 changes: 81 additions & 3 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -22092,6 22092,24 @@ void clif_lapineupgradeack(struct map_session_data *sd, int result)
return;
}

/*==========================================
*
*------------------------------------------
*/
void clif_unequipitemallack(struct map_session_data *sd, unsigned char ok)
{
int fd;

nullpo_retv(sd);

fd=sd->fd;
WFIFOW(fd,0)=0xbae;
WFIFOB(fd,8)=ok;
WFIFOSET(fd,packet_db[0xbae].len);

return;
}

/*==========================================
* send packet �f�o�b�O�p
*------------------------------------------
Expand Down Expand Up @@ -27812,9 27830,68 @@ static void clif_parse_AdventureGuide(int fd, struct map_session_data *sd, int c
*
*------------------------------------------
*/
static void clif_parse_EquipPurgeReq(int fd, struct map_session_data *sd, int cmd)
static void clif_parse_UnequipItemAll(int fd, struct map_session_data *sd, int cmd)
{
// TODO
int i;

nullpo_retv(sd);

if (unit_isdead(&sd->bl)) {
clif_clearchar_area(&sd->bl, 1);
return;
}

if (sd->sc.data[SC_BLADESTOP].timer != -1 || sd->sc.data[SC_BERSERK].timer != -1 || sd->sc.data[SC_KYOUGAKU].timer != -1 || sd->sc.data[SC_SUHIDE].timer != -1) {
clif_unequipitemallack(sd,1);
return;
}
if (sd->npc_id != 0 || sd->state.store || (sd->sc.opt1 > OPT1_NORMAL && sd->sc.opt1 != OPT1_BURNNING) || sd->state.mail_appending) {
clif_unequipitemallack(sd,1);
return;
}

for(i=0; i<MAX_INVENTORY; i ) {
if(sd->status.inventory[i].equip) {
pc_unequipitem(sd,i,0);
}
}

clif_unequipitemallack(sd,0);
return;
}

/*==========================================
*
*------------------------------------------
*/
static void clif_parse_UnequipItemAll2(int fd, struct map_session_data *sd, int cmd)
{
int i;
int pos = RFIFOL(fd,GETPACKETPOS(cmd,0));

nullpo_retv(sd);

if (unit_isdead(&sd->bl)) {
clif_clearchar_area(&sd->bl, 1);
return;
}

if (sd->sc.data[SC_BLADESTOP].timer != -1 || sd->sc.data[SC_BERSERK].timer != -1 || sd->sc.data[SC_KYOUGAKU].timer != -1 || sd->sc.data[SC_SUHIDE].timer != -1) {
clif_unequipitemallack(sd,1);
return;
}
if (sd->npc_id != 0 || sd->state.store || (sd->sc.opt1 > OPT1_NORMAL && sd->sc.opt1 != OPT1_BURNNING) || sd->state.mail_appending) {
clif_unequipitemallack(sd,1);
return;
}

for(i=0; i<MAX_INVENTORY; i ) {
if(sd->status.inventory[i].equip & pos) {
pc_unequipitem(sd,i,0);
}
}

clif_unequipitemallack(sd,0);
return;
}

Expand Down Expand Up @@ -28232,7 28309,8 @@ static int packetdb_readdb_sub(char *line, int ln)
{ clif_parse_MountOff, "mountoff" },
{ clif_parse_CashMarketOpen, "cashmarketopen" },
{ clif_parse_AdventureGuide, "adventureguide" },
{ clif_parse_EquipPurgeReq, "equippurgereq" },
{ clif_parse_UnequipItemAll, "unequipitemall" },
{ clif_parse_UnequipItemAll2, "unequipitemall2" },
{ NULL, NULL },
};

Expand Down
2 changes: 1 addition & 1 deletion src/map/mob.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 555,7 @@ static int mob_can_lock(struct mob_data *md, struct block_list *bl)

if( tsc && (tsc->data[SC_TRICKDEAD].timer != -1 || tsc->data[SC_FORCEWALKING].timer != -1) )
return 0;
if( !(mode&MD_BOSS) && tsc && ( ((tsc->option&(OPTION_HIDE | OPTION_CLOAKING | OPTION_FOOTPRINT)) || tsc->data[SC_CAMOUFLAGE].timer != -1) &&
if( !(mode&MD_BOSS) && !(mode&MD_DETECTOR) && tsc && ( ((tsc->option&(OPTION_HIDE | OPTION_CLOAKING | OPTION_FOOTPRINT)) || tsc->data[SC_CAMOUFLAGE].timer != -1) &&
((race != RCT_INSECT && race != RCT_DEMON) || tsc->data[SC_CLOAKINGEXCEED].timer != -1 || tsc->data[SC_NEWMOON].timer != -1 || tsc->data[SC_STEALTHFIELD].timer != -1)
|| tsc->data[SC_SUHIDE].timer != -1) )
return 0;
Expand Down
62 changes: 62 additions & 0 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -4326,6 4326,7 @@ int buildin_getiteminfo(struct script_state *st);
int buildin_getonlinepartymember(struct script_state *st);
int buildin_getonlineguildmember(struct script_state *st);
int buildin_makemerc(struct script_state *st);
int buildin_delmerc(struct script_state *st);
int buildin_openbook(struct script_state *st);
int buildin_pushpc(struct script_state *st);
int buildin_setcell(struct script_state *st);
Expand Down Expand Up @@ -4367,6 4368,7 @@ int buildin_mobuseskill(struct script_state *st);
int buildin_mobuseskillpos(struct script_state *st);
int buildin_areamobuseskill(struct script_state *st);
int buildin_getequipcardid(struct script_state *st);
int buildin_setequipcardid(struct script_state *st);
int buildin_setpartyinmap(struct script_state *st);
int buildin_getclassjob(struct script_state *st);
int buildin_unittalk(struct script_state *st);
Expand Down Expand Up @@ -4676,6 4678,7 @@ struct script_function buildin_func[] = {
{buildin_getonlinepartymember,"getonlinepartymember","*"},
{buildin_getonlineguildmember,"getonlineguildmember","*"},
{buildin_makemerc,"makemerc","ii"},
{buildin_delmerc,"delmerc",""},
{buildin_openbook,"openbook","i*"},
{buildin_pushpc,"pushpc","ii"},
{buildin_setcell,"setcell","siii*"},
Expand Down Expand Up @@ -4718,6 4721,7 @@ struct script_function buildin_func[] = {
{buildin_mobuseskillpos,"mobuseskillpos","iiiiiii"},
{buildin_areamobuseskill,"areamobuseskill","siiiiiiiiiiii"},
{buildin_getequipcardid,"getequipcardid","ii"},
{buildin_setequipcardid,"setequipcardid","iii*"},
{buildin_setpartyinmap,"setpartyinmap","ii"},
{buildin_getclassjob,"getclassjob","i"},
{buildin_unittalk,"unittalk","*"},
Expand Down Expand Up @@ -13120,6 13124,21 @@ int buildin_makemerc(struct script_state *st)
return 0;
}

/*==========================================
* 傭兵を解雇する
*------------------------------------------
*/
int buildin_delmerc(struct script_state *st)
{
struct map_session_data *sd = script_rid2sd(st);

nullpo_retr(0, sd);

merc_menu(sd,2);

return 0;
}

/*==========================================
* 読書ウィンドウの表示
*------------------------------------------
Expand Down Expand Up @@ -14431,6 14450,49 @@ int buildin_getequipcardid(struct script_state *st)
return 0;
}

/*==========================================
* 装備の指定スロットのカード付与
*------------------------------------------
*/
int buildin_setequipcardid(struct script_state *st)
{
int num, pos, card_id, i = -1;
int flag = 0;
struct map_session_data *sd;

num = conv_num(st,& (st->stack->stack_data[st->start 2]));
pos = conv_num(st,& (st->stack->stack_data[st->start 3]));
card_id = conv_num(st,& (st->stack->stack_data[st->start 4]));
if(st->end > st->start 5)
flag = conv_num(st,& (st->stack->stack_data[st->start 5]));
sd = script_rid2sd(st);

if(num > 0 && num <= EQUIP_INDEX_MAX)
i=pc_checkequip(sd,equip_pos[num-1]);
if(pos < 0 || pos >= 4)
pos = 0;

if(i >= 0) {
int ep=sd->status.inventory[i].equip;
if(itemdb_isspecial(sd->status.inventory[i].card[0])) // 製造・名前入りは不可
return 0;
if(card_id && itemdb_type(card_id) != ITEMTYPE_CARD) // カードタイプ以外は不可
return 0;

pc_unequipitem(sd,i,0);
sd->status.inventory[i].card[pos] = card_id;

if(flag & 4)
sd->status.inventory[i].refine = 0;
if(flag & 2)
clif_item_preview(sd,i);
clif_equiplist(sd);
if(flag & 1)
pc_equipitem(sd,i,ep);
}
return 0;
}

/*==========================================
* パーティーメンバーへ変数設定
*------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,6 2168,8 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
return 0;
if(battle_config.boss_no_knockbacking==2 && mobdb_search(md->class_)->mexp > 0)
return 0;
if(md->mode&MD_KNOCKBACKIMMUNITY)
return 0;
} else if(target->type & (BL_PET | BL_SKILL)) {
; // �������Ȃ�
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/map/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -7151,7 7151,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
return 0;

// ボス属性には無効(ただしカードによる効果は適用される)
if( mode&MD_BOSS && !(flag&1) && status_is_disable(type,0x01) ) {
if( (mode&MD_BOSS || mode&MD_STATUSCHANGEIMMUNITY) && !(flag&1) && status_is_disable(type,0x01) ) {
if(type == SC_BLESSING && !battle_check_undead(race,elem) && race != RCT_DEMON) {
// ブレスは不死/悪魔でないなら効く
;
Expand Down
Loading

0 comments on commit 45b8e3c

Please sign in to comment.