diff --git a/src/egs_game.erl b/src/egs_game.erl index c4be3f1..dbdcd5d 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -29,7 +29,7 @@ keepalive(#state{socket=Socket}) -> %% @doc Forward the broadcasted command to the client. info({egs, cast, Command}, #state{gid=GID}) -> << A:64/bits, _:32, B:96/bits, _:64, C/bits >> = Command, - psu_game:send(<< A/binary, 16#00011300:32, B/binary, 16#00011300:32, GID:32/little-unsigned-integer, C/binary >>); + psu_game:send(<< A/binary, 16#00011300:32, B/binary, 16#00011300:32, GID:32/little, C/binary >>); %% @doc Forward the chat message to the client. info({egs, chat, FromGID, ChatTypeID, ChatGID, ChatName, ChatModifiers, ChatMessage}, State) -> @@ -60,8 +60,8 @@ info({egs, warp, QuestID, ZoneID, MapID, EntryID}, State) -> %% @todo Handle broadcasting better than that. Review the commands at the same time. %% @doc Position change. Save the position and then dispatch it. cast(16#0503, Data, State=#state{gid=GID}) -> - << _:424, Dir:24/little-unsigned-integer, _PrevCoords:96, X:32/little-float, Y:32/little-float, Z:32/little-float, - QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, _:32 >> = Data, + << _:424, Dir:24/little, _PrevCoords:96, X:32/little-float, Y:32/little-float, Z:32/little-float, + QuestID:32/little, ZoneID:32/little, MapID:32/little, EntryID:32/little, _:32 >> = Data, FloatDir = Dir / 46603.375, {ok, User} = egs_users:read(GID), NewUser = User#users{pos={X, Y, Z, FloatDir}, area={QuestID, ZoneID, MapID}, entryid=EntryID}, @@ -70,9 +70,8 @@ cast(16#0503, Data, State=#state{gid=GID}) -> %% @doc Stand still. Save the position and then dispatch it. cast(16#0514, Data, State=#state{gid=GID}) -> - << _:424, Dir:24/little-unsigned-integer, X:32/little-float, Y:32/little-float, Z:32/little-float, - QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, - MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, _/bits >> = Data, + << _:424, Dir:24/little, X:32/little-float, Y:32/little-float, Z:32/little-float, + QuestID:32/little, ZoneID:32/little, MapID:32/little, EntryID:32/little, _/bits >> = Data, FloatDir = Dir / 46603.375, {ok, User} = egs_users:read(GID), NewUser = User#users{pos={X, Y, Z, FloatDir}, area={QuestID, ZoneID, MapID}, entryid=EntryID}, @@ -97,8 +96,7 @@ cast(Command, Data, #state{gid=GID}) ignore; {ok, Self} -> LID = Self#users.lid, - Packet = << A/binary, 16#00011300:32, GID:32/little-unsigned-integer, B/binary, - GID:32/little-unsigned-integer, LID:32/little-unsigned-integer, C/binary >>, + Packet = << A/binary, 16#00011300:32, GID:32/little, B/binary, GID:32/little, LID:32/little, C/binary >>, {ok, SpawnList} = egs_users:select({neighbors, Self}), lists:foreach(fun(User) -> User#users.pid ! {egs, cast, Packet} end, SpawnList) end. @@ -109,7 +107,7 @@ cast(Command, Data, #state{gid=GID}) %% @todo Spawn cleared response event shouldn't be handled following this packet but when we see the spawn actually dead HP-wise. %% @todo Type shouldn't be :32 but it seems when the later 16 have something it's not a spawn event. raw(16#0402, << _:352, Data/bits >>, #state{gid=GID}) -> - << SpawnID:32/little-unsigned-integer, _:64, Type:32/little-unsigned-integer, _:64 >> = Data, + << SpawnID:32/little, _:64, Type:32/little, _:64 >> = Data, case Type of 7 -> % spawn cleared @todo 1201 sent back with same values apparently, but not always log("cleared spawn ~b", [SpawnID]), @@ -132,12 +130,12 @@ raw(16#0404, << _:352, Data/bits >>, _State) -> %% @todo Used in the tutorial. Not sure what it does. Give an item (the PA) maybe? %% @todo Probably should ignore that until more is known. raw(16#0a09, _Data, #state{gid=GID}) -> - psu_game:send(<< 16#0a090300:32, 0:32, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, 16#00003300:32, 0:32 >>); + psu_game:send(<< 16#0a090300:32, 0:32, 16#00011300:32, GID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:64, 16#00003300:32, 0:32 >>); %% @todo Figure out this command. raw(16#0c11, << _:352, A:32/little, B:32/little >>, #state{gid=GID}) -> log("0c11 ~p ~p", [A, B]), - psu_game:send(<< 16#0c120300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, A:32/little, 1:32/little >>); + psu_game:send(<< 16#0c120300:32, 0:160, 16#00011300:32, GID:32/little, 0:64, A:32/little, 1:32/little >>); %% @doc Set flag handler. Associate a new flag with the character. %% Just reply with a success value for now. @@ -145,33 +143,33 @@ raw(16#0c11, << _:352, A:32/little, B:32/little >>, #state{gid=GID}) -> raw(16#0d04, << _:352, Data/bits >>, #state{gid=GID}) -> << Flag:128/bits, A:16/bits, _:8, B/bits >> = Data, log("flag handler for ~s", [re:replace(Flag, "\\0+", "", [global, {return, binary}])]), - psu_game:send(<< 16#0d040300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, Flag/binary, A/binary, 1, B/binary >>); + psu_game:send(<< 16#0d040300:32, 0:160, 16#00011300:32, GID:32/little, 0:64, Flag/binary, A/binary, 1, B/binary >>); %% @doc Initialize a vehicle object. %% @todo Find what are the many values, including the odd Whut value (and whether it's used in the reply). %% @todo Separate the reply. raw(16#0f00, << _:352, Data/bits >>, _State) -> - << A:32/little-unsigned-integer, 0:16, B:16/little-unsigned-integer, 0:16, C:16/little-unsigned-integer, 0, Whut:8, D:16/little-unsigned-integer, 0:16, - E:16/little-unsigned-integer, 0:16, F:16/little-unsigned-integer, G:16/little-unsigned-integer, H:16/little-unsigned-integer, I:32/little-unsigned-integer >> = Data, + << A:32/little, 0:16, B:16/little, 0:16, C:16/little, 0, Whut:8, D:16/little, 0:16, + E:16/little, 0:16, F:16/little, G:16/little, H:16/little, I:32/little >> = Data, log("init vehicle: ~b ~b ~b ~b ~b ~b ~b ~b ~b ~b", [A, B, C, Whut, D, E, F, G, H, I]), - psu_game:send(<< (psu_game:header(16#1208))/binary, A:32/little-unsigned-integer, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, - 0:16, B:16/little-unsigned-integer, 0:16, C:16/little-unsigned-integer, 0:16, D:16/little-unsigned-integer, 0:112, - E:16/little-unsigned-integer, 0:16, F:16/little-unsigned-integer, H:16/little-unsigned-integer, 1, 0, 100, 0, 10, 0, G:16/little-unsigned-integer, 0:16 >>); + psu_game:send(<< (psu_game:header(16#1208))/binary, A:32/little, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, 16#ffffffff:32, + 0:16, B:16/little, 0:16, C:16/little, 0:16, D:16/little, 0:112, + E:16/little, 0:16, F:16/little, H:16/little, 1, 0, 100, 0, 10, 0, G:16/little, 0:16 >>); %% @doc Enter vehicle. %% @todo Separate the reply. raw(16#0f02, << _:352, Data/bits >>, _State) -> - << A:32/little-unsigned-integer, B:32/little-unsigned-integer, C:32/little-unsigned-integer >> = Data, + << A:32/little, B:32/little, C:32/little >> = Data, log("enter vehicle: ~b ~b ~b", [A, B, C]), HP = 100, - psu_game:send(<< (psu_game:header(16#120a))/binary, A:32/little-unsigned-integer, B:32/little-unsigned-integer, C:32/little-unsigned-integer, HP:32/little-unsigned-integer >>); + psu_game:send(<< (psu_game:header(16#120a))/binary, A:32/little, B:32/little, C:32/little, HP:32/little >>); %% @doc Sent right after entering the vehicle. Can't move without it. %% @todo Separate the reply. raw(16#0f07, << _:352, Data/bits >>, _State) -> - << A:32/little-unsigned-integer, B:32/little-unsigned-integer >> = Data, + << A:32/little, B:32/little >> = Data, log("after enter vehicle: ~b ~b", [A, B]), - psu_game:send(<< (psu_game:header(16#120f))/binary, A:32/little-unsigned-integer, B:32/little-unsigned-integer >>); + psu_game:send(<< (psu_game:header(16#120f))/binary, A:32/little, B:32/little >>); %% @todo Not sure yet. raw(16#1019, _Data, _State) -> @@ -188,7 +186,7 @@ raw(16#1112, << _:352, Data/bits >>, _State) -> %% @todo Not sure yet. Value is probably a TargetID. Used in Airboard Rally. Replying with the same value starts the race. raw(16#1216, << _:352, Data/bits >>, _State) -> - << Value:32/little-unsigned-integer >> = Data, + << Value:32/little >> = Data, log("command 1216 with value ~b", [Value]), psu_game:send_1216(Value); @@ -344,10 +342,10 @@ event({hit, FromTargetID, ToTargetID, A, B}, State=#state{gid=GID}) -> true -> SE = 16#01000200; false -> SE = 16#01000000 end, - psu_game:send(<< 16#0e070300:32, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, - 1:32/little-unsigned-integer, 16#01050000:32, Damage:32/little-unsigned-integer, - A/binary, 0:64, PlayerHP:32/little-unsigned-integer, 0:32, SE:32, - 0:32, TargetHP:32/little-unsigned-integer, 0:32, B/binary, + psu_game:send(<< 16#0e070300:32, 0:160, 16#00011300:32, GID:32/little, 0:64, + 1:32/little, 16#01050000:32, Damage:32/little, + A/binary, 0:64, PlayerHP:32/little, 0:32, SE:32, + 0:32, TargetHP:32/little, 0:32, B/binary, 16#04320000:32, 16#80000000:32, 16#26030000:32, 16#89068d00:32, 16#0c1c0105:32, 0:64 >>) % after TargetHP is SE-related too? end, @@ -425,8 +423,8 @@ event({item_unequip, ItemIndex, TargetGID, TargetLID, A, B}, #state{gid=GID}) -> Y when Y =:= 5; Y =:= 6; Y =:= 7 -> 0; % clothes _ -> 1 % weapons end, - psu_game: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, ItemIndex, 2, Category, A, B:32/little-unsigned-integer >>); + psu_game:send(<< 16#01050300:32, 0:64, GID:32/little, 0:64, 16#00011300:32, GID:32/little, + 0:64, TargetGID:32/little, TargetLID:32/little, ItemIndex, 2, Category, A, B:32/little >>); %% @todo Just ignore the meseta price for now and send the player where he wanna be! event(lobby_transport_request, State) -> @@ -566,8 +564,8 @@ event({npc_shop_enter, ShopID}, #state{gid=GID}) -> event({npc_shop_leave, ShopID}, #state{gid=GID}) -> log("npc shop leave ~p", [ShopID]), egs_users:shop_leave(GID), - psu_game:send(<< 16#010a0300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, - GID:32/little-unsigned-integer, 0:64, GID:32/little-unsigned-integer, 0:32 >>); + psu_game:send(<< 16#010a0300:32, 0:64, GID:32/little, 0:64, 16#00011300:32, + GID:32/little, 0:64, GID:32/little, 0:32 >>); %% @todo Should be 0115(money) 010a03(confirm sale). event({npc_shop_sell, InventoryItemIndex, Quantity}, _State) -> diff --git a/src/psu/psu_appearance.erl b/src/psu/psu_appearance.erl index b49e341..b59a4c2 100644 --- a/src/psu/psu_appearance.erl +++ b/src/psu/psu_appearance.erl @@ -29,10 +29,10 @@ binary_to_tuple(cast, Binary) -> << VoiceType:8, VoicePitch:8, _:24, Torso:32/unsigned-integer, Legs:32/unsigned-integer, Arms:32/unsigned-integer, Ears:32/unsigned-integer, Face:32/unsigned-integer, HeadType:32/unsigned-integer, MainColor:8, _:24, - _:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, _:24, EyesColorY:32/little-unsigned-integer, EyesColorX:32/little-unsigned-integer, - _:96, BodyColor:32/little-unsigned-integer, SubColor:32/little-unsigned-integer, HairstyleColorY:32/little-unsigned-integer, - HairstyleColorX:32/little-unsigned-integer, Proportion:32/little-unsigned-integer, ProportionBoxX:32/little-unsigned-integer, - ProportionBoxY:32/little-unsigned-integer, FaceBoxX:32/little-unsigned-integer, FaceBoxY:32/little-unsigned-integer >> = Binary, + _:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, _:24, EyesColorY:32/little, EyesColorX:32/little, + _:96, BodyColor:32/little, SubColor:32/little, HairstyleColorY:32/little, + HairstyleColorX:32/little, Proportion:32/little, ProportionBoxX:32/little, + ProportionBoxY:32/little, FaceBoxX:32/little, FaceBoxY:32/little >> = Binary, {metal_appearance, VoiceType, VoicePitch, Torso, Legs, Arms, Ears, Face, HeadType, MainColor, 0, Eyebrows, Eyelashes, EyesGroup, Eyes, EyesColorY, EyesColorX, BodyColor, SubColor, HairstyleColorY, HairstyleColorX, Proportion, ProportionBoxX, ProportionBoxY, FaceBoxX, FaceBoxY}; @@ -40,10 +40,10 @@ binary_to_tuple(cast, Binary) -> binary_to_tuple(_, Binary) -> << VoiceType:8, VoicePitch:8, _:24, Jacket:32/unsigned-integer, Pants:32/unsigned-integer, Shoes:32/unsigned-integer, Ears:32/unsigned-integer, Face:32/unsigned-integer, Hairstyle:32/unsigned-integer, JacketColor:8, PantsColor:8, ShoesColor:8, _:8, - _:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, BodySuit:8, _:16, EyesColorY:32/little-unsigned-integer, EyesColorX:32/little-unsigned-integer, - _:96, SkinColor:32/little-unsigned-integer, _:32, HairstyleColorY:32/little-unsigned-integer, - HairstyleColorX:32/little-unsigned-integer, Proportion:32/little-unsigned-integer, ProportionBoxX:32/little-unsigned-integer, - ProportionBoxY:32/little-unsigned-integer, FaceBoxX:32/little-unsigned-integer, FaceBoxY:32/little-unsigned-integer >> = Binary, + _:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, BodySuit:8, _:16, EyesColorY:32/little, EyesColorX:32/little, + _:96, SkinColor:32/little, _:32, HairstyleColorY:32/little, + HairstyleColorX:32/little, Proportion:32/little, ProportionBoxX:32/little, + ProportionBoxY:32/little, FaceBoxX:32/little, FaceBoxY:32/little >> = Binary, {flesh_appearance, VoiceType, VoicePitch, Jacket, Pants, Shoes, Ears, Face, Hairstyle, JacketColor, PantsColor, ShoesColor, 0, 0, Eyebrows, Eyelashes, EyesGroup, Eyes, BodySuit, EyesColorY, EyesColorX, 32767, 32767, 0, SkinColor, HairstyleColorY, HairstyleColorX, Proportion, ProportionBoxX, ProportionBoxY, FaceBoxX, FaceBoxY}. @@ -55,10 +55,10 @@ tuple_to_binary(cast, Tuple) -> Proportion, ProportionBoxX, ProportionBoxY, FaceBoxX, FaceBoxY} = Tuple, << VoiceType:8, VoicePitch:8, 0:24, Torso:32/unsigned-integer, Legs:32/unsigned-integer, Arms:32/unsigned-integer, Ears:32/unsigned-integer, Face:32/unsigned-integer, HeadType:32/unsigned-integer, MainColor:8, 0:16, LineshieldColor:8, - 0:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, 0:24, EyesColorY:32/little-unsigned-integer, EyesColorX:32/little-unsigned-integer, - 16#ff7f0000:32, 16#ff7f0000:32, 0:32, BodyColor:32/little-unsigned-integer, SubColor:32/little-unsigned-integer, HairstyleColorY:32/little-unsigned-integer, - HairstyleColorX:32/little-unsigned-integer, Proportion:32/little-unsigned-integer, ProportionBoxX:32/little-unsigned-integer, - ProportionBoxY:32/little-unsigned-integer, FaceBoxX:32/little-unsigned-integer, FaceBoxY:32/little-unsigned-integer >>; + 0:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, 0:24, EyesColorY:32/little, EyesColorX:32/little, + 16#ff7f0000:32, 16#ff7f0000:32, 0:32, BodyColor:32/little, SubColor:32/little, HairstyleColorY:32/little, + HairstyleColorX:32/little, Proportion:32/little, ProportionBoxX:32/little, + ProportionBoxY:32/little, FaceBoxX:32/little, FaceBoxY:32/little >>; tuple_to_binary(_, Tuple) -> {flesh_appearance, VoiceType, VoicePitch, Jacket, Pants, Shoes, Ears, Face, Hairstyle, JacketColor, PantsColor, ShoesColor, @@ -66,11 +66,11 @@ tuple_to_binary(_, Tuple) -> SkinColor, HairstyleColorY, HairstyleColorX, Proportion, ProportionBoxX, ProportionBoxY, FaceBoxX, FaceBoxY} = Tuple, << VoiceType:8, VoicePitch:8, 0:24, Jacket:32/unsigned-integer, Pants:32/unsigned-integer, Shoes:32/unsigned-integer, Ears:32/unsigned-integer, Face:32/unsigned-integer, Hairstyle:32/unsigned-integer, JacketColor:8, PantsColor:8, ShoesColor:8, LineshieldColor:8, - Badge:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, BodySuit:8, 0:16, EyesColorY:32/little-unsigned-integer, EyesColorX:32/little-unsigned-integer, - LipsIntensity:32/little-unsigned-integer, LipsColorY:32/little-unsigned-integer, LipsColorX:32/little-unsigned-integer, - SkinColor:32/little-unsigned-integer, 16#ffff0200:32, HairstyleColorY:32/little-unsigned-integer, - HairstyleColorX:32/little-unsigned-integer, Proportion:32/little-unsigned-integer, ProportionBoxX:32/little-unsigned-integer, - ProportionBoxY:32/little-unsigned-integer, FaceBoxX:32/little-unsigned-integer, FaceBoxY:32/little-unsigned-integer >>. + Badge:8, Eyebrows:8, Eyelashes:8, EyesGroup:8, Eyes:8, BodySuit:8, 0:16, EyesColorY:32/little, EyesColorX:32/little, + LipsIntensity:32/little, LipsColorY:32/little, LipsColorX:32/little, + SkinColor:32/little, 16#ffff0200:32, HairstyleColorY:32/little, + HairstyleColorX:32/little, Proportion:32/little, ProportionBoxX:32/little, + ProportionBoxY:32/little, FaceBoxX:32/little, FaceBoxY:32/little >>. %% @doc Validate the character creation appearance data. %% Trigger an exception rather than handling errors. diff --git a/src/psu/psu_characters.erl b/src/psu/psu_characters.erl index d302858..d63cb6c 100644 --- a/src/psu/psu_characters.erl +++ b/src/psu/psu_characters.erl @@ -57,12 +57,12 @@ character_user_to_binary(User) -> IntDir = trunc(Dir * 182.0416), TypeID = case Type of npc -> 16#00001d00; _ -> 16#00001200 end, NPCStuff = case Type of npc -> 16#01ff; _ -> 16#0000 end, - << TypeID:32, CharGID:32/little-unsigned-integer, 0:64, CharLID:16/little-unsigned-integer, 0:16, NPCStuff:16, NPCid:16/little, QuestID:32/little-unsigned-integer, - ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:16/little-unsigned-integer, 0:16, - 16#0100:16, IntDir:16/little-unsigned-integer, X:32/little-float, Y:32/little-float, Z:32/little-float, 0:64, - PrevQuestID:32/little-unsigned-integer, PrevZoneID:32/little-unsigned-integer, PrevMapID:32/little-unsigned-integer, PrevEntryID:32/little-unsigned-integer, - CharBin/binary, EXPNextLevel:32/little-unsigned-integer, EXPCurrentLevel:32/little-unsigned-integer, MaxHP:32/little-unsigned-integer, - StatsBin/binary, 0:32, SEBin/binary, 0:32, LV:32/little-unsigned-integer, StatsBin/binary, CurrentHP:32/little-unsigned-integer, MaxHP:32/little-unsigned-integer, + << TypeID:32, CharGID:32/little, 0:64, CharLID:16/little, 0:16, NPCStuff:16, NPCid:16/little, QuestID:32/little, + ZoneID:32/little, MapID:32/little, EntryID:16/little, 0:16, + 16#0100:16, IntDir:16/little, X:32/little-float, Y:32/little-float, Z:32/little-float, 0:64, + PrevQuestID:32/little, PrevZoneID:32/little, PrevMapID:32/little, PrevEntryID:32/little, + CharBin/binary, EXPNextLevel:32/little, EXPCurrentLevel:32/little, MaxHP:32/little, + StatsBin/binary, 0:32, SEBin/binary, 0:32, LV:32/little, StatsBin/binary, CurrentHP:32/little, MaxHP:32/little, 0:1344, 16#0000803f:32, 0:64, 16#0000803f:32, 0:64, 16#0000803f:32, 0:64, 16#0000803f:32, 0:64, 16#0000803f:32, 0:160, 16#0000803f:32, 0:352 >>. %% @doc Convert a class atom into a binary to be sent to clients. @@ -177,8 +177,8 @@ se_list_to_binary(_List) -> stats_tuple_to_binary(Tuple) -> {stats, ATP, ATA, TP, DFP, EVP, MST, STA} = Tuple, - << ATP:16/little-unsigned-integer, DFP:16/little-unsigned-integer, ATA:16/little-unsigned-integer, EVP:16/little-unsigned-integer, - STA:16/little-unsigned-integer, 0:16, TP:16/little-unsigned-integer, MST:16/little-unsigned-integer >>. + << ATP:16/little, DFP:16/little, ATA:16/little, EVP:16/little, + STA:16/little, 0:16, TP:16/little, MST:16/little >>. %% @doc Validate the character's name. %% 00F7 is the RGBA color control character. diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index 4c38bbd..133447c 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -129,7 +129,7 @@ npc_load(Leader, [{PartyPos, NPCGID}|NPCList], State) -> %% @doc Build the packet header. header(Command) -> GID = get(gid), - << Command:16/unsigned-integer, 16#0300:16, 0:160, 16#00011300:32, GID:32/little-unsigned-integer, 0:64 >>. + << Command:16/unsigned-integer, 16#0300:16, 0:160, 16#00011300:32, GID:32/little, 0:64 >>. %% @doc Send the given packet to the client. %% @todo Consolidate the receive and send functions better. @@ -167,11 +167,11 @@ build_010a_list([ItemID|Tail], Acc) -> send_0113() -> {ok, File} = file:read_file("p/typesinfo.bin"), GID = get(gid), - send(<< 16#01130300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, GID:32/little-unsigned-integer, File/binary >>). + send(<< 16#01130300:32, 0:64, GID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:64, GID:32/little, File/binary >>). %% @todo No idea! send_022c(A, B) -> - send(<< (header(16#022c))/binary, A:16/little-unsigned-integer, B:16/little-unsigned-integer >>). + send(<< (header(16#022c))/binary, A:16/little, B:16/little >>). %% @todo Force send a new player location. Used for warps. %% @todo The value before IntDir seems to be the player's current animation. 01 stand up, 08 ?, 17 normal sit @@ -179,15 +179,15 @@ send_0503({PrevX, PrevY, PrevZ, _AnyDir}) -> {ok, User} = egs_users:read(get(gid)), #users{gid=GID, pos={X, Y, Z, Dir}, area={QuestID, ZoneID, MapID}, entryid=EntryID} = User, IntDir = trunc(Dir * 182.0416), - send(<< 16#05030300:32, 0:64, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, GID:32/little-unsigned-integer, 0:32, - 16#1000:16, IntDir:16/little-unsigned-integer, PrevX:32/little-float, PrevY:32/little-float, PrevZ:32/little-float, X:32/little-float, Y:32/little-float, Z:32/little-float, - QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, 1:32/little-unsigned-integer >>). + send(<< 16#05030300:32, 0:64, GID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:64, GID:32/little, 0:32, + 16#1000:16, IntDir:16/little, PrevX:32/little-float, PrevY:32/little-float, PrevZ:32/little-float, X:32/little-float, Y:32/little-float, Z:32/little-float, + QuestID:32/little, ZoneID:32/little, MapID:32/little, EntryID:32/little, 1:32/little >>). %% @todo NPC inventory. Guessing it's only for NPC characters... send_0a04(NPCGID) -> GID = get(gid), {ok, Bin} = file:read_file("p/packet0a04.bin"), - send(<< 16#0a040300:32, 0:32, 16#00001d00:32, NPCGID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, Bin/binary >>). + send(<< 16#0a040300:32, 0:32, 16#00001d00:32, NPCGID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:64, Bin/binary >>). %% @todo Handle more than just goggles. send_0a0a(Inventory) -> @@ -302,11 +302,11 @@ send_0d03(Data0, Data1, Data2, Data3) -> [{status, Status2}, {char, Char2}|_] = Data2, [{status, Status3}, {char, Char3}|_] = Data3, GID = get(gid), - send(<< 16#0d030300:32/unsigned-integer, 0:32, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:104, - Status0:8/unsigned-integer, 0:48, Char0/binary, 0:520, - Status1:8/unsigned-integer, 0:48, Char1/binary, 0:520, - Status2:8/unsigned-integer, 0:48, Char2/binary, 0:520, - Status3:8/unsigned-integer, 0:48, Char3/binary, 0:512 >>). + send(<< 16#0d030300:32/unsigned-integer, 0:32, 16#00011300:32, GID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:104, + Status0:8, 0:48, Char0/binary, 0:520, + Status1:8, 0:48, Char1/binary, 0:520, + Status2:8, 0:48, Char2/binary, 0:520, + Status3:8, 0:48, Char3/binary, 0:512 >>). %% @todo Add a character (NPC or real) to the party members on the right of the screen. %% @todo NPCid is 65535 for normal characters. @@ -323,11 +323,11 @@ send_1004(Type, User, PartyPos) -> #users{gid=GID, character=Character, area={QuestID, ZoneID, MapID}, entryid=EntryID} = User, #characters{npcid=NPCid, name=Name, mainlevel=MainLevel} = Character, Level = MainLevel#level.number, - send(<< 16#10040300:32, 16#ffff0000:32, 0:128, 16#00011300:32, UserGID:32/little-unsigned-integer, 0:64, - TypeID:32, GID:32/little-unsigned-integer, 0:64, Name/binary, - Level:16/little-unsigned-integer, 16#ffff:16, + send(<< 16#10040300:32, 16#ffff0000:32, 0:128, 16#00011300:32, UserGID:32/little, 0:64, + TypeID:32, GID:32/little, 0:64, Name/binary, + Level:16/little, 16#ffff:16, SomeFlag, 1, PartyPos:8, 1, - NPCid:16/little-unsigned-integer, 0:16, + NPCid:16/little, 0:16, %% Odd unknown values. PA related? No idea. Values on invite, 0 in-mission. %~ 16#00001f08:32, 0:32, 16#07000000:32, @@ -338,7 +338,7 @@ send_1004(Type, User, PartyPos) -> %~ 16#24e41f08:32, 0:512, - QuestID:32/little-unsigned-integer, ZoneID:32/little-unsigned-integer, MapID:32/little-unsigned-integer, EntryID:32/little-unsigned-integer, + QuestID:32/little, ZoneID:32/little, MapID:32/little, EntryID:32/little, LID:32/little, 0:64, 16#01000000:32, 16#01000000:32, %% @todo first is current hp, second is max hp @@ -346,14 +346,14 @@ send_1004(Type, User, PartyPos) -> %% @todo No idea. Also the 2 PartyPos in the built packet more often than not match, but sometimes don't? That's probably because one is PartyPos and the other is LID or something. send_100f(NPCid, PartyPos) -> - send(<< (header(16#100f))/binary, NPCid:16/little-unsigned-integer, 1, PartyPos:8, PartyPos:32/little-unsigned-integer >>). + send(<< (header(16#100f))/binary, NPCid:16/little, 1, PartyPos:8, PartyPos:32/little >>). %% @doc Send the mission's quest file when starting a new mission. %% @todo Handle correctly. 0:32 is actually a missing value. Value before that is unknown too. send_1015(QuestID) -> QuestData = egs_quests_db:quest_nbl(QuestID), Size = byte_size(QuestData), - send(<< (header(16#1015))/binary, QuestID:32/little-unsigned-integer, 16#01010000:32, 0:32, Size:32/little-unsigned-integer, QuestData/binary >>). + send(<< (header(16#1015))/binary, QuestID:32/little, 16#01010000:32, 0:32, Size:32/little, QuestData/binary >>). %% @todo No idea. send_1016(PartyPos) -> @@ -362,11 +362,11 @@ send_1016(PartyPos) -> %% @todo No idea. send_101a(NPCid, PartyPos) -> - send(<< (header(16#101a))/binary, NPCid:16/little-unsigned-integer, PartyPos:16/little-unsigned-integer, 16#ffffffff:32 >>). + send(<< (header(16#101a))/binary, NPCid:16/little, PartyPos:16/little, 16#ffffffff:32 >>). %% @todo Boss related command. send_110e(Data) -> - send(<< (header(16#110e))/binary, Data/binary, 0:32, 5:16/little-unsigned-integer, 12:16/little-unsigned-integer, 0:32, 260:32/little-unsigned-integer >>). + send(<< (header(16#110e))/binary, Data/binary, 0:32, 5:16/little, 12:16/little, 0:32, 260:32/little >>). %% @todo Boss related command. send_1113(Data) -> @@ -393,7 +393,7 @@ send_1207() -> %% @todo Object interaction? Figure out. C probably the interaction type. %% @todo Apparently A would be TargetID/ffffffff, B would be the player LID, C would be the object type? D still completely unknown. send_1211(A, B, C, D) -> - send(<< (header(16#1211))/binary, A:32/little-unsigned-integer, B:32/little-unsigned-integer, C:32/little-unsigned-integer, D:32/little-unsigned-integer >>). + send(<< (header(16#1211))/binary, A:32/little, B:32/little, C:32/little, D:32/little >>). %% @doc Make the client load the quest previously sent. send_1212() -> @@ -401,16 +401,16 @@ send_1212() -> %% @todo Not sure. Related to keys. send_1213(A, B) -> - send(<< (header(16#1213))/binary, A:32/little-unsigned-integer, B:32/little-unsigned-integer >>). + send(<< (header(16#1213))/binary, A:32/little, B:32/little >>). %% @todo Related to boss gates. send_1215(A, B) -> - send(<< (header(16#1215))/binary, A:32/little-unsigned-integer, 0:16, B:16/little-unsigned-integer >>). + send(<< (header(16#1215))/binary, A:32/little, 0:16, B:16/little >>). %% @todo Not sure yet. Value is probably a TargetID. Used in Airboard Rally. Replying with the same value starts the race. send_1216(Value) -> GID = get(gid), - send(<< 16#12160300:32, 0:32, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, 16#00011300:32, GID:32/little-unsigned-integer, 0:64, Value:32/little-unsigned-integer >>). + send(<< 16#12160300:32, 0:32, 16#00011300:32, GID:32/little, 0:64, 16#00011300:32, GID:32/little, 0:64, Value:32/little >>). %% @todo Figure out this room packet. send_1309() -> diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 87d72ca..ce9e0cc 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -1449,7 +1449,7 @@ send_0c00(CharUser, #state{socket=Socket, gid=DestGID, lid=DestLID}) -> %% @doc Send the huge pack of quest files available in the counter. send_0c06(Pack, #state{socket=Socket}) -> - packet_send(Socket, << 16#0c060300:32, 0:288, 1:32/little-unsigned-integer, Pack/binary >>). + packet_send(Socket, << 16#0c060300:32, 0:288, 1:32/little, Pack/binary >>). %% @doc Reply that the player is allowed to use the lobby transport. Always allow. send_0c08(#state{socket=Socket, gid=DestGID}) ->