summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-05-18 13:24:57 -0500
committerWushin <pasekei@gmail.com>2015-05-18 13:24:57 -0500
commit12b13856ee763ab0ad1b6447cebd004536d16edb (patch)
treec0edd029a188977a277e6a1087e2fe90394eeae0 /src/map
parent8022aead434e580f4c9556b69aab145d534ddb02 (diff)
parenta94330e0b5916ddecd98c2fca58ca6799c0770c2 (diff)
downloadtmwa-12b13856ee763ab0ad1b6447cebd004536d16edb.tar.gz
tmwa-12b13856ee763ab0ad1b6447cebd004536d16edb.tar.bz2
tmwa-12b13856ee763ab0ad1b6447cebd004536d16edb.tar.xz
tmwa-12b13856ee763ab0ad1b6447cebd004536d16edb.zip
Merge pull request #91 from mekolat/version
check manaplus version
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chrif.cpp4
-rw-r--r--src/map/clif.cpp30
-rw-r--r--src/map/map.hpp2
-rw-r--r--src/map/pc.cpp4
-rw-r--r--src/map/pc.hpp2
-rw-r--r--src/map/script-fun.cpp8
6 files changed, 42 insertions, 8 deletions
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 8127f20..ce5669e 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -867,11 +867,11 @@ void chrif_parse(Session *s)
AccountId id = payload.account_id;
int login_id2 = payload.login_id2;
- short tmw_version = payload.packet_tmw_version;
+ short client_version = payload.packet_client_version;
CharKey st_key = payload.char_key;
CharData st_data = payload.char_data;
pc_authok(id, login_id2,
- tmw_version,
+ client_version,
&st_key, &st_data);
break;
}
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index b7c047c..897244e 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -826,6 +826,21 @@ void clif_mob007b(dumb_ptr<mob_data> md, Buffer& buf)
*------------------------------------------
*/
static
+void clif_0225_being_move3_sub(dumb_ptr<block_list> bl, const Buffer& buf)
+{
+ nullpo_retv(bl);
+ dumb_ptr<map_session_data> sd = bl->is_player();
+
+ if (sd->sess != nullptr)
+ {
+ if(sd->client_version >= 3)
+ {
+ send_buffer(sd->sess, buf);
+ }
+ }
+}
+
+static
int clif_0225_being_move3(dumb_ptr<mob_data> md)
{
Packet_Head<0x0225> head_225;
@@ -844,7 +859,12 @@ int clif_0225_being_move3(dumb_ptr<mob_data> md)
}
Buffer buf = create_vpacket<0x0225, 14, 1>(head_225, repeat_225);
- clif_send(buf, md, SendWho::AREA);
+
+ map_foreachinarea(std::bind(clif_0225_being_move3_sub, ph::_1, buf),
+ md->bl_m,
+ md->bl_x - AREA_SIZE, md->bl_y - AREA_SIZE,
+ md->bl_x + AREA_SIZE, md->bl_y + AREA_SIZE,
+ BL::PC);
return 0;
}
@@ -2654,7 +2674,7 @@ void clif_skillinfoblock(dumb_ptr<map_session_data> sd)
std::vector<Packet_Repeat<0x010f>> repeat_10f;
for (SkillID i : erange(SkillID(), MAX_SKILL))
{
- if (sd->status.skill[i].lv && sd->tmw_version >= 1)
+ if (sd->status.skill[i].lv && sd->client_version >= 1)
{
Packet_Repeat<0x010f> info;
// [Fate] Version 1 and later don't crash because of bad skill IDs anymore
@@ -4705,6 +4725,9 @@ void clif_sendallquest(dumb_ptr<map_session_data> sd)
if (!sd->sess)
return;
+ if(sd->client_version < 2)
+ return;
+
Session *s = sd->sess;
Packet_Head<0x0215> head_215;
std::vector<Packet_Repeat<0x0215>> repeat_215;
@@ -4739,6 +4762,9 @@ void clif_sendquest(dumb_ptr<map_session_data> sd, QuestId questid, int value)
if (!sd->sess)
return;
+ if(sd->client_version < 2)
+ return;
+
Session *s = sd->sess;
Packet_Fixed<0x0214> fixed;
diff --git a/src/map/map.hpp b/src/map/map.hpp
index f57dcee..ce434fa 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -153,7 +153,7 @@ struct map_session_data : block_list, SessionData
CharId char_id_;
int login_id1, login_id2;
SEX sex;
- unsigned char tmw_version; // tmw client version
+ int client_version; // tmw client version
CharKey status_key;
CharData status;
GenericArray<Option<Borrowed<struct item_data>>, InventoryIndexing<IOff0, MAX_INVENTORY>> inventory_data =
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 1179792..d2b2f44 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -641,7 +641,7 @@ int pc_isequip(dumb_ptr<map_session_data> sd, IOff0 n)
*------------------------------------------
*/
int pc_authok(AccountId id, int login_id2,
- short tmw_version, const CharKey *st_key, const CharData *st_data)
+ short client_version, const CharKey *st_key, const CharData *st_data)
{
dumb_ptr<map_session_data> sd = nullptr;
@@ -652,7 +652,7 @@ int pc_authok(AccountId id, int login_id2,
return 1;
sd->login_id2 = login_id2;
- sd->tmw_version = tmw_version;
+ sd->client_version = client_version;
sd->status_key = *st_key;
sd->status = *st_data;
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index d100938..fc0bdb0 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -80,7 +80,7 @@ int pc_counttargeted(dumb_ptr<map_session_data> sd, dumb_ptr<block_list> src,
int pc_setrestartvalue(dumb_ptr<map_session_data> sd, int type);
void pc_makesavestatus(dumb_ptr<map_session_data>);
int pc_setnewpc(dumb_ptr<map_session_data>, AccountId, CharId, int, uint32_t /*tick_t*/, SEX);
-int pc_authok(AccountId, int, short tmw_version, const CharKey *, const CharData *);
+int pc_authok(AccountId, int, short client_version, const CharKey *, const CharData *);
int pc_authfail(AccountId accid);
EPOS pc_equippoint(dumb_ptr<map_session_data> sd, IOff0 n);
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 744f2c3..9020203 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -971,6 +971,13 @@ void builtin_delitem(ScriptState *st)
}
+static
+void builtin_getversion(ScriptState *st)
+{
+ dumb_ptr<map_session_data> sd = script_rid2sd(st);;
+ push_int<ScriptDataInt>(st->stack, sd->client_version);
+}
+
/*==========================================
*キャラ関係のID取得
*------------------------------------------
@@ -3028,6 +3035,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(makeitem, "IiMxy"_s, '\0'),
BUILTIN(delitem, "Ii"_s, '\0'),
BUILTIN(getcharid, "i?"_s, 'i'),
+ BUILTIN(getversion, ""_s, 'i'),
BUILTIN(strcharinfo, "i"_s, 's'),
BUILTIN(getequipid, "i"_s, 'i'),
BUILTIN(bonus, "ii"_s, '\0'),