item_equip/unequip: Rename ItemID and PAID into ItemIndex and PAIndex.

This commit is contained in:
Loïc Hoguin 2010-08-29 23:09:06 +02:00
parent 2ba8020f24
commit 0d3cad936e
2 changed files with 10 additions and 10 deletions

View File

@ -691,15 +691,15 @@ event({item_description_request, ItemID}) ->
%% @todo Apparently B is always ItemID+1. Not sure why. %% @todo Apparently B is always ItemID+1. Not sure why.
%% @todo Currently use a separate file for the data sent for the weapons. %% @todo Currently use a separate file for the data sent for the weapons.
%% @todo TargetGID and TargetLID must be validated, they're either the player's or his NPC characters. %% @todo TargetGID and TargetLID must be validated, they're either the player's or his NPC characters.
event({item_equip, ItemID, TargetGID, TargetLID, A, B}) -> event({item_equip, ItemIndex, TargetGID, TargetLID, A, B}) ->
GID = get(gid), GID = get(gid),
Category = case ItemID of Category = case ItemIndex of
% units would be 8, traps would be 12 % units would be 8, traps would be 12
19 -> 2; % armor 19 -> 2; % armor
Y when Y =:= 5; Y =:= 6; Y =:= 7 -> 0; % clothes Y when Y =:= 5; Y =:= 6; Y =:= 7 -> 0; % clothes
_ -> 1 % weapons _ -> 1 % weapons
end, end,
Filename = case ItemID of Filename = case ItemIndex of
% weapons % weapons
16 -> "p/packet0105_sword.bin"; 16 -> "p/packet0105_sword.bin";
13 -> "p/packet0105_twindaggers.bin"; 13 -> "p/packet0105_twindaggers.bin";
@ -722,21 +722,21 @@ event({item_equip, ItemID, TargetGID, TargetLID, A, B}) ->
_ -> {ok, File} = file:read_file(Filename) _ -> {ok, File} = file:read_file(Filename)
end, end,
send(<< 16#01050300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, send(<< 16#01050300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer,
0:64, TargetGID:32/little-unsigned-integer, TargetLID:32/little-unsigned-integer, ItemID, 1, Category, A, B:32/little-unsigned-integer, 0:64, TargetGID:32/little-unsigned-integer, TargetLID:32/little-unsigned-integer, ItemIndex, 1, Category, A, B:32/little-unsigned-integer,
File/binary >>); File/binary >>);
%% @todo A and B are unknown. %% @todo A and B are unknown.
%% @see item_equip %% @see item_equip
event({item_unequip, ItemID, TargetGID, TargetLID, A, B}) -> event({item_unequip, ItemIndex, TargetGID, TargetLID, A, B}) ->
GID = get(gid), GID = get(gid),
Category = case ItemID of Category = case ItemIndex of
% units would be 8, traps would be 12 % units would be 8, traps would be 12
19 -> 2; % armor 19 -> 2; % armor
Y when Y =:= 5; Y =:= 6; Y =:= 7 -> 0; % clothes Y when Y =:= 5; Y =:= 6; Y =:= 7 -> 0; % clothes
_ -> 1 % weapons _ -> 1 % weapons
end, end,
send(<< 16#01050300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, send(<< 16#01050300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer,
0:64, TargetGID:32/little-unsigned-integer, TargetLID:32/little-unsigned-integer, ItemID, 2, Category, A, B:32/little-unsigned-integer >>); 0:64, TargetGID:32/little-unsigned-integer, TargetLID:32/little-unsigned-integer, ItemIndex, 2, Category, A, B:32/little-unsigned-integer >>);
%% @todo Just ignore the meseta price for now and send the player where he wanna be! %% @todo Just ignore the meseta price for now and send the player where he wanna be!
event(lobby_transport_request) -> event(lobby_transport_request) ->

View File

@ -76,7 +76,7 @@ parse(Size, 16#0102, 2, Data) ->
%% @todo One of the missing events is probably learning a new PA. %% @todo One of the missing events is probably learning a new PA.
parse(Size, 16#0105, Channel, Data) -> parse(Size, 16#0105, Channel, Data) ->
<< _LID:16/little, _VarB:16/little, VarC:32/little, _FromGID:32/little, VarD:32/little, VarE:32/little, TypeID:32/little, GID:32/little, << _LID:16/little, _VarB:16/little, VarC:32/little, _FromGID:32/little, VarD:32/little, VarE:32/little, TypeID:32/little, GID:32/little,
VarF:32/little, VarG:32/little, TargetGID:32/little, TargetLID:32/little, ItemID:8, EventID:8, _PAID:8, VarH:8, VarI:32/little, Rest/bits >> = Data, VarF:32/little, VarG:32/little, TargetGID:32/little, TargetLID:32/little, ItemIndex:8, EventID:8, _PAIndex:8, VarH:8, VarI:32/little, Rest/bits >> = Data,
?ASSERT_EQ(Channel, 2), ?ASSERT_EQ(Channel, 2),
?ASSERT_EQ(VarC, 0), ?ASSERT_EQ(VarC, 0),
?ASSERT_EQ(VarD, 0), ?ASSERT_EQ(VarD, 0),
@ -101,14 +101,14 @@ parse(Size, 16#0105, Channel, Data) ->
item_drop -> item_drop ->
?ASSERT_EQ(Size, 76), ?ASSERT_EQ(Size, 76),
<< _Quantity:32/little, _PosX:32/little-float, _PosY:32/little-float, _PosZ:32/little-float >> = Rest, << _Quantity:32/little, _PosX:32/little-float, _PosY:32/little-float, _PosZ:32/little-float >> = Rest,
%~ {Event, ItemID, Quantity, ...}; %~ {Event, ItemIndex, Quantity, ...};
ignore; ignore;
ignore -> ignore ->
?ASSERT_EQ(Size, 60), ?ASSERT_EQ(Size, 60),
ignore; ignore;
_ -> _ ->
?ASSERT_EQ(Size, 60), ?ASSERT_EQ(Size, 60),
{Event, ItemID, TargetGID, TargetLID, VarH, VarI} {Event, ItemIndex, TargetGID, TargetLID, VarH, VarI}
end; end;
parse(Size, 16#010a, Channel, Data) -> parse(Size, 16#010a, Channel, Data) ->