summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.cpp6
-rw-r--r--src/map/script-call.cpp2
-rw-r--r--src/map/script-fun.cpp25
-rw-r--r--src/mmo/clif.t.hpp2
4 files changed, 32 insertions, 3 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 4f0c8d2..96e0cac 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3517,6 +3517,12 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type)
case SP::POS_Y:
val = bl->bl_y;
break;
+ case SP::PVP_CHANNEL:
+ val = sd ? sd->state.pvpchannel : 0;
+ break;
+ case SP::BL_ID:
+ val = unwrap<BlockId>(bl->bl_id);
+ break;
}
return val;
diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp
index 8d2f58f..b9a098a 100644
--- a/src/map/script-call.cpp
+++ b/src/map/script-call.cpp
@@ -84,8 +84,6 @@ void get_val(dumb_ptr<block_list> sd, struct script_data *data)
{
MATCH_CASE (const ScriptDataParam&, u)
{
- if (sd == nullptr)
- PRINTF("get_val error param SP::%d\n"_fmt, u.reg.sp());
int numi = 0;
if (sd)
numi = pc_readparam(sd, u.reg.sp());
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 53b4526..51039ad 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -545,7 +545,7 @@ void builtin_distance(ScriptState *st)
// TODO implement case 1 (walk distance)
case 0:
default:
- if (source->bl_m->name_ != target->bl_m->name_)
+ if (source->bl_m != target->bl_m)
{
// FIXME make it work even if source and target are not in the same map
distance = 0x7fffffff;
@@ -1601,6 +1601,28 @@ void builtin_getcharid(ScriptState *st)
}
/*==========================================
+ *
+ *------------------------------------------
+ */
+static
+void builtin_getnpcid(ScriptState *st)
+{
+ dumb_ptr<npc_data> nd;
+
+ if (HARG(0))
+ nd = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0)))));
+ else
+ nd = map_id2bl(st->oid)->is_npc();
+ if (nd == nullptr)
+ {
+ push_int<ScriptDataInt>(st->stack, -1);
+ return;
+ }
+
+ push_int<ScriptDataInt>(st->stack, unwrap<BlockId>(nd->bl_id));
+}
+
+/*==========================================
*指定IDのPT名取得
*------------------------------------------
*/
@@ -4170,6 +4192,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(makeitem, "IiMxy"_s, '\0'),
BUILTIN(delitem, "Ii"_s, '\0'),
BUILTIN(getcharid, "i?"_s, 'i'),
+ BUILTIN(getnpcid, "?"_s, 'i'),
BUILTIN(getversion, ""_s, 'i'),
BUILTIN(strcharinfo, "i"_s, 's'),
BUILTIN(getequipid, "i?"_s, 'i'),
diff --git a/src/mmo/clif.t.hpp b/src/mmo/clif.t.hpp
index f2ff583..377e953 100644
--- a/src/mmo/clif.t.hpp
+++ b/src/mmo/clif.t.hpp
@@ -472,6 +472,8 @@ enum class SP : uint16_t
POS_X = 1074,
POS_Y = 1075,
+ PVP_CHANNEL = 1076,
+ BL_ID = 1077,
};
constexpr