@ginstone/nga-api
Version:
88 lines (87 loc) • 2.31 kB
JavaScript
;
// 道具相关参数
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemUseParam = exports.ItemStoreParam = exports.ItemInventoryParam = exports.ItemBuyParam = exports.ItemInfoParam = exports.BaseItemParam = void 0;
const NukeParams_1 = require("./NukeParams");
/**
* 道具参数公共部分
*/
class BaseItemParam extends NukeParams_1.NukeFuncParam {
constructor(act) {
super("item");
this.act = act;
}
}
exports.BaseItemParam = BaseItemParam;
/**
* * 17.3 获得指定道具的信息
* <a href="https://bbs.nga.cn/read.php?pid=130386150">文档</a>
*/
class ItemInfoParam extends BaseItemParam {
constructor(types) {
super("info");
this.types = types.join(',');
}
}
exports.ItemInfoParam = ItemInfoParam;
/**
* 购买道具参数
*/
class ItemBuyParam extends BaseItemParam {
constructor(id, count) {
super("buy");
this.id = id;
this.count = count;
}
}
exports.ItemBuyParam = ItemBuyParam;
/**
* 查询自己的道具库存
*/
class ItemInventoryParam extends BaseItemParam {
constructor(page) {
super("list");
this.page = page || 1;
}
}
exports.ItemInventoryParam = ItemInventoryParam;
/**
* 查询商店里的道具列表
*/
class ItemStoreParam extends BaseItemParam {
constructor(page, type, subTypes) {
super("store");
this.page = page || 1;
this.type = type;
if (subTypes)
this.sub_type = subTypes.join(",");
}
}
exports.ItemStoreParam = ItemStoreParam;
/**
* 使用道具
*/
class ItemUseParam extends BaseItemParam {
constructor(type, id, arg) {
super(type);
this.id = id;
this.arg = arg;
}
}
/**
* 对用户使用
* @param type 使用类型
* @param id 道具id
* @param userId 目标用户id
*/
ItemUseParam.useToUser = (type, id, userId) => new ItemUseParam(type, id, String(userId));
/**
* 对回复使用
* @param type 使用类型
* @param id 道具id
* @param topicId 主题id
* @param replyId 回复id
* @param recommend 1 = 支持 -1 = 反对 0 = 中立
*/
ItemUseParam.useToReply = (type, id, topicId, replyId, recommend) => new ItemUseParam(type, id, topicId + "\t" + replyId + "\t" + recommend);
exports.ItemUseParam = ItemUseParam;