//--------------------------------------------------------------------------
$017a: //カードWクリック
begin
RFIFOW(2, w);
if (w = 0) or (w > 100) or (tc.Item[w].ID = 0) or
(tc.Item[w].Amount = 0) or (tc.Item[w].Data.IType <> 6) then continue;
td := tc.Item[w].Data;
j := 4;
for i := 1 to 100 do begin
if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount > 0) and (tc.Item[i].Data.IEquip) and
(tc.Item[i].Data.Slot > 0) and (tc.Item[i].Card[tc.Item[i].Data.Slot - 1] = 0) and
(tc.Item[i].Equip = 0) then begin // スロットを持っていてスロットの最後が埋まってなければ
if td.Loc = 0 then begin
//武器
if tc.Item[i].Data.IType = 4 then begin
WFIFOW(j, i);
j := j + 2;
end;
end else begin
//防具
if (tc.Item[i].Data.IType = 5) and ((tc.Item[i].Data.Loc and td.Loc) <> 0) then begin
WFIFOW(j, i);
j := j + 2;
end;
end;
end;
end;
if j <> 4 then begin //挿入可能なアイテムがある場合
WFIFOW(0, $017b);
WFIFOW(2, j);
Socket.SendBuf(buf, j);
end;
end;
//--------------------------------------------------------------------------
$017c: //カード挿入
begin
RFIFOW(2, w1); //src
RFIFOW(4, w2); //dest
if (w1 = 0) or (w1 > 100) or (tc.Item[w1].ID = 0) or (tc.Item[w1].Amount = 0) or
(tc.Item[w1].Data.IType <> 6) or
(w2 = 0) or (w2 > 100) or (tc.Item[w2].ID = 0) or (tc.Item[w2].Amount = 0) or
(not tc.Item[w2].Data.IEquip) or (tc.Item[w2].Data.Slot = 0) or
(tc.Item[w2].Card[tc.Item[w2].Data.Slot - 1] <> 0) or
(tc.Item[w2].Equip <> 0) then begin //カードをさせる状態でない場合
WFIFOW(0, $017d);
WFIFOW(2, w1);
WFIFOW(4, w2);
WFIFOB(6, 1);
Socket.SendBuf(buf, 7);
continue;
end;
ti := tc.Item[w2];
td := tc.Item[w2].Data;
if tc.Item[w1].Data.Loc = 0 then begin
if td.IType <> 4 then continue;
end else begin
if (td.IType <> 5) or ((td.Loc and tc.Item[w1].Data.Loc) = 0) then continue;
end;
for i := 0 to 3 do begin
if(ti.Card[i] = 0) then begin
ti.Card[i] := tc.Item[w1].Data.ID;
WFIFOW(0, $017d);
WFIFOW(2, w1);
WFIFOW(4, w2);
WFIFOB(6, 0);
Socket.SendBuf(buf, 7);
break;
end;
end;