summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-10-14 15:58:59 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:46:55 -0400
commit3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1 (patch)
tree158d45edd852a733bfc125a4dd324de98b934334
parent0fd54ac797cea996ba3430168b4a962df13c12fa (diff)
downloadtmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.gz
tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.bz2
tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.xz
tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.zip
add more params, allow get/set to use char id
-rw-r--r--src/map/pc.cpp21
-rw-r--r--src/map/script-fun.cpp28
-rw-r--r--src/mmo/clif.t.hpp4
3 files changed, 50 insertions, 3 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 1440454..0f6c9a6 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3522,6 +3522,12 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type)
case SP::BL_TYPE:
val = static_cast<uint8_t>(bl->bl_type);
break;
+ case SP::PARTNER:
+ val = sd ? unwrap<CharId>(sd->status.partner_id) : 0;
+ break;
+ case SP::CHAR_ID:
+ val = sd ? unwrap<CharId>(sd->status_key.char_id) : 0;
+ break;
}
return val;
@@ -3663,6 +3669,21 @@ int pc_setparam(dumb_ptr<map_session_data> sd, SP type, int val)
case SP::LUK:
pc_statusup2(sd, type, (val - sd->status.attrs[sp_to_attr(type)]));
break;
+ case SP::PARTNER:
+ dumb_ptr<block_list> p_bl;
+ if (val < 2000000 && val >= 150000)
+ {
+ dumb_ptr<map_session_data> p_sd = nullptr;
+ if ((p_sd = map_nick2sd(map_charid2nick(wrap<CharId>(val)))) != nullptr)
+ p_bl = map_id2bl(p_sd->bl_id);
+ }
+ else
+ p_bl = map_id2bl(wrap<BlockId>(val));
+ if (val < 1)
+ pc_divorce(sd);
+ else
+ p_bl ? pc_marriage(sd, p_bl->is_player()) : 0;
+ break;
}
clif_updatestatus(sd, type);
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 3592095..f7108d0 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -995,7 +995,19 @@ void builtin_set(ScriptState *st)
}
else
{
- id = wrap<BlockId>(conv_num(st, sdata));
+ int num = conv_num(st, sdata);
+ if (num >= 2000000)
+ id = wrap<BlockId>(num);
+ else if (num >= 150000)
+ {
+ dumb_ptr<map_session_data> p_sd = nullptr;
+ if ((p_sd = map_nick2sd(map_charid2nick(wrap<CharId>(num)))) != nullptr)
+ id = p_sd->bl_id;
+ else
+ return;
+ }
+ else
+ return;
bl = map_id2bl(id);
}
}
@@ -3399,7 +3411,19 @@ void builtin_get(ScriptState *st)
}
else
{
- id = wrap<BlockId>(conv_num(st, sdata));
+ int num = conv_num(st, sdata);
+ if (num >= 2000000)
+ id = wrap<BlockId>(num);
+ else if (num >= 150000)
+ {
+ dumb_ptr<map_session_data> p_sd = nullptr;
+ if ((p_sd = map_nick2sd(map_charid2nick(wrap<CharId>(num)))) != nullptr)
+ id = p_sd->bl_id;
+ else
+ return;
+ }
+ else
+ return;
bl = map_id2bl(id);
}
diff --git a/src/mmo/clif.t.hpp b/src/mmo/clif.t.hpp
index fec0201..888fd66 100644
--- a/src/mmo/clif.t.hpp
+++ b/src/mmo/clif.t.hpp
@@ -307,8 +307,9 @@ enum class SP : uint16_t
// sent to client
JOBLEVEL = 55,
-#if 0
PARTNER = 57,
+
+#if 0
CART = 58,
FAME = 59,
UNBREAKABLE = 60,
@@ -475,6 +476,7 @@ enum class SP : uint16_t
PVP_CHANNEL = 1076,
BL_ID = 1077,
BL_TYPE = 1078,
+ CHAR_ID = 1079,
};
constexpr