155 lines
3.7 KiB
Plaintext
155 lines
3.7 KiB
Plaintext
/*
|
|
文件名:ItemClass.nut
|
|
路径:BaseClass/ItemClass/ItemClass.nut
|
|
创建日期:2024-04-18 15:10
|
|
文件用途:Item类
|
|
*/
|
|
class Item extends Base_C_Object {
|
|
Attribute = null;
|
|
IsEmpty = false;
|
|
constructor(CObject) {
|
|
base.constructor(CObject);
|
|
Attribute = Sq_Point2Blob(CObject, 62);
|
|
if (GetIndex() == 0) IsEmpty = true;
|
|
}
|
|
|
|
function Output() {
|
|
local Str = "[";
|
|
foreach(Value in Attribute) {
|
|
Str = format("%s%02X", Str, Value);
|
|
Str += ",";
|
|
}
|
|
Str += "]";
|
|
print(Str);
|
|
}
|
|
|
|
//获取类型
|
|
function GetType() {
|
|
Attribute.seek(1);
|
|
local Type = Attribute.readn('c');
|
|
switch (Type) {
|
|
case 1:
|
|
return "装备";
|
|
case 2:
|
|
return "消耗品";
|
|
case 3:
|
|
return "材料";
|
|
case 4:
|
|
return "任务材料";
|
|
case 10:
|
|
return "副职业材料";
|
|
default:
|
|
return "未知类型";
|
|
}
|
|
}
|
|
|
|
//获取编号
|
|
function GetIndex() {
|
|
Attribute.seek(2);
|
|
return Attribute.readn('i');
|
|
}
|
|
//获取品级
|
|
function GetRarity() {
|
|
return Sq_CallFunc(S_Ptr("0x80F12D6"), "int", ["pointer"], this.C_Object);
|
|
}
|
|
//设置编号
|
|
function SetIndex(Index) {
|
|
Attribute.seek(2);
|
|
Attribute.writen(Index, 'i');
|
|
}
|
|
|
|
//获取强化等级
|
|
function GetUpgrade() {
|
|
Attribute.seek(6);
|
|
return Attribute.readn('c');
|
|
}
|
|
//设置强化等级
|
|
function SetUpgrade(Level) {
|
|
Attribute.seek(6);
|
|
Attribute.writen(Level, 'c');
|
|
}
|
|
|
|
//获取 品级 或 数量 如果是装备就是品级 如果是其他就是数量
|
|
function GetAdd_Info() {
|
|
Attribute.seek(7);
|
|
return Attribute.readn('i');
|
|
}
|
|
//设置 品级 或 数量 如果是装备就是品级 如果是其他就是数量
|
|
function SetAdd_Info(Value) {
|
|
Attribute.seek(7);
|
|
Attribute.writen(Value, 'i');
|
|
}
|
|
|
|
//获取耐久度
|
|
function GetDurable() {
|
|
Attribute.seek(11);
|
|
return Attribute.readn('c');
|
|
}
|
|
//设置耐久度
|
|
function SetDurable(Value) {
|
|
Attribute.seek(11);
|
|
Attribute.writen(Value, 'c');
|
|
}
|
|
|
|
//获取增幅属性
|
|
function GetAmplification() {
|
|
Attribute.seek(17);
|
|
return Attribute.readn('w');
|
|
}
|
|
//设置增幅属性
|
|
function SetAmplification(Value) {
|
|
Attribute.seek(17);
|
|
Attribute.writen(Value, 'w');
|
|
}
|
|
|
|
//获取锻造属性
|
|
function GetForging() {
|
|
Attribute.seek(51);
|
|
return Attribute.readn('c');
|
|
}
|
|
//设置锻造属性
|
|
function SetForging(Value) {
|
|
Attribute.seek(51);
|
|
Attribute.writen(Value, 'c');
|
|
}
|
|
|
|
//获取附魔属性
|
|
function GetEnchanting() {
|
|
Attribute.seek(13);
|
|
return Attribute.readn('i');
|
|
}
|
|
//设置附魔属性
|
|
function SetEnchanting(Value) {
|
|
Attribute.seek(13);
|
|
Attribute.writen(Value, 'i');
|
|
}
|
|
|
|
|
|
//获取交易类型
|
|
function GetAttachType() {
|
|
return Sq_CallFunc(S_Ptr("0x80F12E2"), "int", ["pointer"], this.C_Object);
|
|
}
|
|
|
|
//刷写装备数据
|
|
function Flush() {
|
|
Sq_WriteBlobToAddress(C_Object, Attribute);
|
|
}
|
|
|
|
//检查是否为空
|
|
// function IsEmpty() {
|
|
// return Sq_CallFunc(S_Ptr("0x811ED66"), "int", ["pointer"], this.C_Object);
|
|
// }
|
|
|
|
//删除道具
|
|
function Delete() {
|
|
Sq_Inven_RemoveItem(C_Object);
|
|
this = null;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//是否可打包
|
|
function Item::IsPackagble() {
|
|
return Sq_CallFunc(S_Ptr("0x828B5B4"), "int", ["pointer"], this.C_Object);
|
|
} |