Skip to content

Commit

Permalink
Merge pull request #226 from mekolat/settiles
Browse files Browse the repository at this point in the history
Implement SMSG_MAP_SET_TILES_TYPE
  • Loading branch information
mekolat authored Nov 26, 2016
2 parents 8c380d5 + 6d5919b commit f604a13
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/map/clif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3925,6 +3925,24 @@ void clif_remote_command(dumb_ptr<map_session_data> sd, XString cmd)
clif_send(buf, sd, SendWho::SELF, wrap<ClientVersion>(6));
}

void clif_update_collision(dumb_ptr<map_session_data> sd, short x1, short y1,
short x2, short y2, MapName map_name, int mask)
{
nullpo_retv(sd);

Packet_Fixed<0x0231> fixed_231;
fixed_231.x1 = x1;
fixed_231.y1 = y1;
fixed_231.x2 = x2;
fixed_231.y2 = y2;
fixed_231.mask = mask;
fixed_231.unused_layer = 0;
fixed_231.map = map_name;
Buffer buf = create_fpacket<0x0231, 34>(fixed_231);

clif_send(buf, sd, SendWho::SELF, wrap<ClientVersion>(7));
}

void clif_change_music(dumb_ptr<map_session_data> sd, XString music)
{
nullpo_retv(sd);
Expand Down
1 change: 1 addition & 0 deletions src/map/clif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void clif_setnpcdirection_towards(dumb_ptr<map_session_data> sd, dumb_ptr<npc_da
void clif_npc_send_title(Session *s, BlockId npcid, XString msg);
void clif_server_message(dumb_ptr<map_session_data>, uint8_t, XString msg);
void clif_remote_command(dumb_ptr<map_session_data>, XString);
void clif_update_collision(dumb_ptr<map_session_data>, short, short, short, short, MapName, int);
void clif_change_music(dumb_ptr<map_session_data> sd, XString music);
void clif_npc_action(dumb_ptr<map_session_data>, BlockId, short, int, short, short);
void clif_send_mask(dumb_ptr<map_session_data>, int);
Expand Down
33 changes: 33 additions & 0 deletions src/map/script-fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4186,6 +4186,38 @@ void builtin_remotecmd(ScriptState *st)
clif_remote_command(sd, msg);
}

static
void builtin_sendcollision(ScriptState *st)
{
dumb_ptr<map_session_data> sd = script_rid2sd(st);
MapName map_name = stringish<MapName>(ZString(conv_str(st, &AARG(0))));
int mask = conv_num(st, &AARG(1));
short x1, y1, x2, y2;
x1 = x2 = conv_num(st, &AARG(2));
y1 = y2 = conv_num(st, &AARG(3));

if (HARG(5))
{
x2 = conv_num(st, &AARG(4));
y2 = conv_num(st, &AARG(5));
if (HARG(6))
{
CharName player = stringish<CharName>(ZString(conv_str(st, &AARG(6))));
sd = map_nick2sd(player);
}
}

else if (HARG(4))
{
CharName player = stringish<CharName>(ZString(conv_str(st, &AARG(4))));
sd = map_nick2sd(player);
}

if (sd == nullptr)
return;
clif_update_collision(sd, x1, y1, x2, y2, map_name, mask);
}

static
void builtin_music(ScriptState *st)
{
Expand Down Expand Up @@ -4818,6 +4850,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(title, "s"_s, '\0'),
BUILTIN(smsg, "e??"_s, '\0'),
BUILTIN(remotecmd, "s?"_s, '\0'),
BUILTIN(sendcollision, "Mixy???"_s, '\0'),
BUILTIN(music, "s"_s, '\0'),
BUILTIN(mapmask, "i?"_s, '\0'),
BUILTIN(getmask, ""_s, 'i'),
Expand Down
20 changes: 20 additions & 0 deletions tools/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4796,6 +4796,26 @@ def build_context():
Execute a client command remotely
''',
)
map_user.s(0x0231, 'send area collision',
define='SMSG_MAP_SET_TILES_TYPE',
fixed=[
at(0, u16, 'packet id'),
at(2, u16, 'x1'),
at(4, u16, 'y1'),
at(6, u16, 'x2'),
at(8, u16, 'y2'),
at(10, u32, 'mask'),
at(14, u32, 'unused layer'),
at(18, map_name, 'map'),
],
fixed_size=34,
pre=[NOTHING],
post=[PRETTY],
desc='''
Set updated collision for a square area
''',
)


# TOC_LOGINCHAR
# login char
Expand Down

0 comments on commit f604a13

Please sign in to comment.