跳转至

物品函数

GET_ITEM(type, index)

根据物品类别和子索引计算全局物品 ID。

local bladeId = GET_ITEM(0, 18) -- Blade 物品

CGItemDropRecv(lpObj, slot, x, y, mode)

模拟玩家从背包丢弃物品到地面。

  • 返回值: boolean
CGItemDropRecv(player, 12, player.X, player.Y, false)

ItemGive(aIndex, specialValue)

使用 ItemBag(掉落表)系统给予玩家物品。

  • 返回值: boolean
ItemGive(aIndex, 100) -- 从 ItemBag 给予 special value 100 的物品

ItemGiveEx(aIndex, itemIndex, level, durability, opt1, opt2, opt3, newOpt, [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus], [duration], [harmonyExCount], [harmExOp1], [harmExVal1], [harmExOp2], [harmExVal2], [harmExOp3], [harmExVal3], [harmBonusOp], [harmBonusLvl])

创建并给予玩家一个完全自定义的物品到背包。

  • 返回值: boolean

Harmony Ex 参数(可选,从版本 S21.1-2 起可用): - harmonyExCount (integer): Harmony Ex 选项数量(0-3)。默认: 0。 - harmExOp1, harmExVal1 (integer): Harmony Ex 选项 1 的类型和数值。 - harmExOp2, harmExVal2 (integer): Harmony Ex 选项 2 的类型和数值。 - harmExOp3, harmExVal3 (integer): Harmony Ex 选项 3 的类型和数值。 - harmBonusOp, harmBonusLvl (integer): Harmony Bonus 选项和等级。

-- 给予 +9 卓越 Blade(带幸运)
ItemGiveEx(aIndex, GET_ITEM(0, 18), 9, 255, 0, 1, 7, 0x1C)

-- 给予限时物品(1 小时 = 3600 秒)
ItemGiveEx(aIndex, GET_ITEM(13, 30), 0, 255, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 3600)

-- 给予带 Harmony Ex 选项的物品(3 个选项 + 奖励)
ItemGiveEx(aIndex, GET_ITEM(7, 413), 15, 0, 0, 1, 4, 63, 2, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 3, 9, 50, 11, 5, 12, 120, 3, 1000)

ItemDrop(aIndex, mapNumber, x, y, specialValue)

使用 ItemBag 系统在地面上掉落物品。

  • 返回值: boolean
ItemDrop(aIndex, player.Map, player.X, player.Y, 100)

ItemDropEx(aIndex, mapNumber, x, y, itemIndex, level, durability, opt1, opt2, opt3, newOpt, [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus], [duration], [ownerIndex])

在地面上掉落一个完全自定义的物品。

  • 返回值: boolean
ItemDropEx(aIndex, player.Map, player.X, player.Y, GET_ITEM(0, 18), 9, 255, 0, 1, 7, 0x1C)

MoneyDrop(aIndex, mapNumber, x, y, amount)

在地面上掉落 Zen。

  • 返回值: boolean
MoneyDrop(aIndex, player.Map, player.X, player.Y, 50000)

GremoryGive(aIndex, itemIndex, level, dur, opt1, opt2, opt3, newOpt, storageType, rewardSource, daysToExpire, [duration], [setOpt], [johOpt], [optEx], [sock0..4], [sockBonus])

将物品发送到玩家的 Gremory Case。从版本 S9 起可用。

警告: 不要在 OnCharacterEntry 中调用 — 此时 Gremory 数据尚未加载。请改用 OnGremoryCaseReady

  • 返回值: boolean
-- 永久物品到角色存储,7 天过期
GremoryGive(aIndex, GET_ITEM(14, 13), 0, 0, 0, 0, 0, 0,
    GREMORY_CASE_CHARACTER, GREMORY_REWARD_EVENT, GREMORY_EXPIRE_7_DAYS)

-- 限时物品(24小时)到账号存储
GremoryGive(aIndex, GET_ITEM(14, 13), 0, 0, 0, 0, 0, 0,
    GREMORY_CASE_SERVER, GREMORY_REWARD_GM_REWARD, GREMORY_EXPIRE_30_DAYS, 86400)

CheckItemFromSpecialValue(specialValue)

检查 ItemBag 中是否存在指定 special value 的物品(不会实际给予)。

  • 返回值: boolean
if CheckItemFromSpecialValue(100) then
    LogAdd(LOG_GREEN, "ItemBag 100 has a valid item.")
end

GetItemFromItemBag(aIndex, specialValue)

从 ItemBag 获取物品并发送到玩家背包。

  • 返回值: boolean
if GetItemFromItemBag(aIndex, 100) then
    GCNoticeSend(aIndex, 1, "You received a reward!")
end

CharacterSkinSend(aIndex, monsterID)

将玩家的外观变更为怪物模型。使用 -1 恢复原样。

  • 返回值: boolean
CharacterSkinSend(aIndex, 275) -- 变身为怪物 275
CharacterSkinSend(aIndex, -1)  -- 恢复正常