|
|
| (未显示2个用户的7个中间版本) |
| 第1行: |
第1行: |
| __NOTOC__ | | __NOTOC__ |
| <div class="lua-reference" style="max-width:1200px;margin:0 auto;line-height:1.8;color:#29343a;font-family:Arial,'Microsoft YaHei',sans-serif;letter-spacing:0;overflow-wrap:anywhere;"> | | <div class="lua-reference"> |
| [[首页|首页]] · [[Lua接口/服务端函数索引|服务端接口]] · [[Lua接口/服务端函数索引/角色属性与物品|角色属性与物品]] · [[Lua接口/服务端调用约定|调用约定]] | | [[首页|首页]] · [[Lua接口/服务端函数索引|服务端接口]] · [[Lua接口/服务端函数索引/角色属性与物品|角色属性与物品]] · [[Lua接口/服务端调用约定|调用约定]] |
|
| |
|
| <div style="padding:14px 0;border-top:3px solid #287568;border-bottom:1px solid #dbe3e6;">判断指定背包格是否未加交易锁且未加密码锁。</div> | | <div class="lua-lead lua-rule">判断指定背包格是否未加交易锁且未加密码锁。</div> |
|
| |
|
| <div style="margin:10px 0;padding:10px 12px;border-left:3px solid #9a7940;background:#faf7f0;font-size:13px;color:#5f5136;">本页由服务端绑定源码与随包脚本自动整理:用途、参数位置与返回数量取实现体,<b>未在游戏内执行验证</b>。调用点取自 4244 个服务端脚本中的 38 处真实调用。</div>
| | == Lua 调用 == |
| | <pre>LuaFnIsItemAvailable(sceneId, selfId, bagIndex)</pre> |
|
| |
|
| == Lua 调用 ==
| | 服务端脚本中共出现 39 处调用,实参个数出现过:3 个(39 处)。 |
| <pre style="white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7;padding:12px;background:#f5f7f8;border:1px solid #dbe3e6;">LuaFnIsItemAvailable(sceneId, selfId, bagIndex)</pre>
| |
|
| |
|
| 服务端脚本中共出现 38 处调用,实参个数出现过:3 个(38 处)。
| | 实现位于 <code>LuaFnTbl_Attr.h</code>。 |
|
| |
|
| == 参数 == | | == 参数 == |
| {| class="wikitable" style="width:100%;table-layout:fixed;border-collapse:collapse;font-size:13px;" | | {| class="wikitable" |
| ! scope="col" style="text-align:left;background:#edf3f2;padding:8px;width:11%;" | 序号 | | ! scope="col" class="lua-w11" | 序号 |
| ! scope="col" style="text-align:left;background:#edf3f2;padding:8px;width:36%;" | 参数 / 类型 | | ! scope="col" class="lua-w36" | 参数 / 类型 |
| ! scope="col" style="text-align:left;background:#edf3f2;padding:8px;" | 说明 | | ! scope="col" | 说明 |
| |- | | |- |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 1
| | | 1 |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | <code style="white-space:normal;overflow-wrap:anywhere;">sceneId</code><br /><span style="color:#657078;"><code style="white-space:normal;overflow-wrap:anywhere;">number</code></span>
| | | <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span> |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 当前调用所在的场景 ID。<br /><span style="color:#657078;">脚本中的实参:<code style="white-space:normal;overflow-wrap:anywhere;">sceneId</code>(38 处)</span>
| | | 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code>(39 处)</span> |
| |- | | |- |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 2
| | | 2 |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | <code style="white-space:normal;overflow-wrap:anywhere;">selfId</code><br /><span style="color:#657078;"><code style="white-space:normal;overflow-wrap:anywhere;">number</code></span>
| | | <code>selfId</code><br /><span class="lua-muted"><code>number</code></span> |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。<br /><span style="color:#657078;">脚本中的实参:<code style="white-space:normal;overflow-wrap:anywhere;">selfId</code>(38 处)</span>
| | | 当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。<br /><span class="lua-muted">脚本中的实参:<code>selfId</code>(39 处)</span> |
| |- | | |- |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 3
| | | 3 |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | <code style="white-space:normal;overflow-wrap:anywhere;">bagIndex</code><br /><span style="color:#657078;"><code style="white-space:normal;overflow-wrap:anywhere;">number</code></span>
| | | <code>bagIndex</code><br /><span class="lua-muted"><code>number</code></span> |
| | style="padding:8px;vertical-align:top;overflow-wrap:anywhere;" | 背包格子位置,不是物品编号;应先确认格子内是目标物品。<br /><span style="color:#657078;">脚本中的实参:<code style="white-space:normal;overflow-wrap:anywhere;">index</code>(5 处)、<code style="white-space:normal;overflow-wrap:anywhere;">i</code>(3 处)、<code style="white-space:normal;overflow-wrap:anywhere;">nItemIndex2</code>(3 处)</span>
| | | 背包格子位置,不是物品编号;应先确认格子内是目标物品。<br /><span class="lua-muted">脚本中的实参:<code>bagPos</code>(6 处)、<code>index</code>(5 处)、<code>i</code>(3 处)</span> |
| |} | | |} |
|
| |
|
| 第35行: |
第35行: |
|
| |
|
| == 调用示例 == | | == 调用示例 == |
| <pre style="white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7;padding:12px;background:#f5f7f8;border:1px solid #dbe3e6;">if bagPos >= 0 then | | <pre>if bagPos >= 0 then |
| if GetItemTableIndexByIndex(sceneId, selfId, bagPos) == itemTypeSn | | if GetItemTableIndexByIndex(sceneId, selfId, bagPos) == itemTypeSn |
| and LuaFnIsItemAvailable(sceneId, selfId, bagPos) == 1 then | | and LuaFnIsItemAvailable(sceneId, selfId, bagPos) == 1 then |
| -- 已核对物品编号,并通过两种锁的检查 | | -- 物品编号须有效,并通过两种锁的检查 |
| end | | end |
| end</pre> | | end</pre> |
|
| |
| == 脚本中的调用 ==
| |
| 以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。
| |
| <pre style="white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7;padding:12px;background:#f5f7f8;border:1px solid #dbe3e6;">-- city0_building5.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, index1)
| |
|
| |
| -- event/equip/equip_bind.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, itemIndex2)
| |
|
| |
| -- event/equip/equip_changevisual.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, nItemIndex1)
| |
|
| |
| -- event/equip/equip_changevisual.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, nItemIndex2)
| |
|
| |
| -- event/equip/equip_enchance.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, itemidx2)
| |
|
| |
| -- event/EventScript/event_lootitem.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, index)
| |
|
| |
| -- event/huodong/ecircus_doing.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, indexitm)
| |
|
| |
| -- event/liveabilityevent/gem_compound.lua
| |
| LuaFnIsItemAvailable(sceneId, selfId, bagIndexList[i])</pre>
| |
|
| |
|
| == 注意事项 == | | == 注意事项 == |
| * 调用对象必须是当前场景中的有效玩家。 | | * 调用对象必须是当前场景中的有效玩家。 |
| * 该检查不判断格子是否为空,空格也可能返回 1;不能据此判断物品存在、数量足够或物品编号正确。空格的具体返回需要实测。 | | * 该检查不判断格子是否为空,空格也可能返回 1;不能据此判断物品存在、数量足够或物品编号正确。 |
| * 绑定状态不影响此判断。运行时交易锁、密码锁与绑定是不同条件。 | | * 绑定状态不影响此判断。运行时交易锁、密码锁与绑定是不同条件。 |
| * 调用前要求玩家处于可执行逻辑的状态(实现体断言 <code style="white-space:normal;overflow-wrap:anywhere;">pHuman->IsCanLogic()</code>);不满足时会记录断言,应先确认玩家当前状态。 | | * 调用前要求玩家处于可执行逻辑的状态(实现体断言 <code>pHuman->IsCanLogic()</code>);不满足时会记录断言,应先确认玩家当前状态。 |
| | |
| <div style="margin-top:20px;padding-top:10px;border-top:1px solid #dbe3e6;color:#657078;font-size:12px;">核对依据:<code style="white-space:normal;overflow-wrap:anywhere;">LuaFnTbl_Attr.h</code> 第 2877 行,服务端注册表第 441 行。调用格式与返回数量依据当前实现整理;脚本调用点取自 4244 个随包脚本(共 535888 行、命中 85384 处调用),未经运行验证。游戏内效果、边界行为及未注明的业务枚举仍需实测。</div>
| |
|
| |
|
| </div> | | </div> |
首页 · 服务端接口 · 角色属性与物品 · 调用约定
判断指定背包格是否未加交易锁且未加密码锁。
Lua 调用
LuaFnIsItemAvailable(sceneId, selfId, bagIndex)
服务端脚本中共出现 39 处调用,实参个数出现过:3 个(39 处)。
实现位于 LuaFnTbl_Attr.h。
参数
| 序号
|
参数 / 类型
|
说明
|
| 1
|
sceneId
number
|
当前调用所在的场景 ID。 脚本中的实参:sceneId(39 处)
|
| 2
|
selfId
number
|
当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。 脚本中的实参:selfId(39 处)
|
| 3
|
bagIndex
number
|
背包格子位置,不是物品编号;应先确认格子内是目标物品。 脚本中的实参:bagPos(6 处)、index(5 处)、i(3 处)
|
返回值
返回一个 number:能取得格子对象且未加交易锁、未加密码锁时为 1;越界、无法取得格子对象或任一锁存在时为 0;玩家对象无效或异常等失败路径为 -1。
调用示例
if bagPos >= 0 then
if GetItemTableIndexByIndex(sceneId, selfId, bagPos) == itemTypeSn
and LuaFnIsItemAvailable(sceneId, selfId, bagPos) == 1 then
-- 物品编号须有效,并通过两种锁的检查
end
end
注意事项
- 调用对象必须是当前场景中的有效玩家。
- 该检查不判断格子是否为空,空格也可能返回 1;不能据此判断物品存在、数量足够或物品编号正确。
- 绑定状态不影响此判断。运行时交易锁、密码锁与绑定是不同条件。
- 调用前要求玩家处于可执行逻辑的状态(实现体断言
pHuman->IsCanLogic());不满足时会记录断言,应先确认玩家当前状态。