/*
文件名:PvfItemClass.nut
路径:BaseClass/PvfClass/PvfItemClass.nut
创建日期:2024-04-26	19:28
文件用途:PVF item数据
*/
class PvfItem extends Base_C_Object {
    Attribute = null;
    constructor(CObject) {
        base.constructor(CObject);
        Attribute = Sq_Point2Blob(CObject, 600);
    }

    function Output() {
        local Str = "[";
        foreach(Value in Attribute) {
            Str = format("%s%02X", Str, Value);
            Str += ",";
        }
        Str += "]";
        print(Str);
    }

    //获取编号
    function GetIndex() {
        Attribute.seek(1 * 4);
        return Attribute.readn('i');
    }

    //获取可用等级
    function GetUsableLevel() {
        Attribute.seek(18 * 4);
        return Attribute.readn('i');
    }

    //获取稀有度
    function GetRarity() {
        Attribute.seek(14 * 4);
        return Attribute.readn('i');
    }

    //获取名字
    function GetName() {
        return Sq_GetNameByIdFromPvf(GetIndex());
    }


    //Public
    function GetNameById(Id) {
        return Sq_GetNameByIdFromPvf(Id);
    }
    //Public
    function GetPvfItemById(Idx) {
        local Ret = Sq_GetDataByIdFromPvf(Idx);
        if (Ret) {
            return PvfItem(Ret);
        } else return null;
    }

    //Public 是否是魔法封印
    function IsRandomOption() {
        return Sq_CallFunc(S_Ptr("0x8514E5E"), "int", ["pointer"], this.C_Object);
    }
}

//获取穿戴等级
function PvfItem::GetUsableLevel() {
    return Sq_CallFunc(S_Ptr("0x80F12EE"), "int", ["pointer"], this.C_Object);
}

//是否为消耗品
function PvfItem::IsStackable() {
    return Sq_CallFunc(S_Ptr("0x80f12fa"), "int", ["pointer"], this.C_Object);
}

//获取消耗品类型
function PvfItem::GetItemType() {
    return Sq_CallFunc(S_Ptr("0x8514A84"), "int", ["pointer"], this.C_Object);
}