1111
This commit is contained in:
@@ -35,6 +35,26 @@ class Inven extends Base_C_Object {
|
||||
|
||||
//检查背包是否拥有指定数量的指定道具
|
||||
function CheckItemCount(ItemId, ItemCount) {
|
||||
if (ItemId == 0) {
|
||||
//检查金币
|
||||
local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object);
|
||||
if (Money >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -1) {
|
||||
//检查点券
|
||||
if (SUser.GetCera() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -2) {
|
||||
//检查代币券
|
||||
if (SUser.GetCeraPoint() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
local SlotIdx = GetSlotById(ItemId);
|
||||
if (SlotIdx != -1) {
|
||||
local SlotItem = GetSlot(1, SlotIdx);
|
||||
@@ -56,6 +76,8 @@ class Inven extends Base_C_Object {
|
||||
return Flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//销毁背包中指定表的道具及数量
|
||||
function DeleteArrItemCount(T) {
|
||||
foreach(value in T) {
|
||||
@@ -67,6 +89,22 @@ class Inven extends Base_C_Object {
|
||||
|
||||
//销毁背包中指定的道具及数量
|
||||
function DeleteItemCount(Id, Count) {
|
||||
if (Id == 0) {
|
||||
//处理金币
|
||||
SUser.RechargeMoney(-Count);
|
||||
return 1;
|
||||
}
|
||||
if (Id == -1) {
|
||||
//处理点券
|
||||
SUser.RechargeCera(-Count);
|
||||
return 1;
|
||||
}
|
||||
if (Id == -2) {
|
||||
//处理代币券
|
||||
SUser.RechargeCeraPoint(-Count);
|
||||
return 1;
|
||||
}
|
||||
|
||||
local Slot = GetSlotById(Id);
|
||||
local Ret = Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, Count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, Slot);
|
||||
@@ -77,4 +115,72 @@ class Inven extends Base_C_Object {
|
||||
function GetAvatarItemMgr() {
|
||||
return Sq_CallFunc(S_Ptr("0x80DD576"), "pointer", ["pointer"], this.C_Object);
|
||||
}
|
||||
|
||||
|
||||
//销毁背包中指定表的道具及数量 并且需要格子匹配
|
||||
function DeleteArrItemCountRindro(T) {
|
||||
foreach(value in T) {
|
||||
if (value.type == 0) {
|
||||
//如果是装备 按格子直接删除
|
||||
Sq_Inven_RemoveItemFormCount(this.C_Object, 1, value.pos, value.count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, value.pos);
|
||||
} else {
|
||||
//如果不是装备 走原逻辑
|
||||
local Slot = GetSlotById(value.itemId);
|
||||
Sq_Inven_RemoveItemFormCount(this.C_Object, 1, Slot, value.count, 10, 1);
|
||||
SUser.SendUpdateItemList(1, 0, Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//检查背包是否拥有指定表的道具及数量 并且是装备还要匹配格子
|
||||
function CheckArrItemCountRindro(T) {
|
||||
local Flag = true;
|
||||
foreach(value in T) {
|
||||
if (!CheckItemCountRindro(value.itemId, value.count, value.pos)) Flag = false;
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
//检查背包是否拥有指定数量的指定道具
|
||||
function CheckItemCountRindro(ItemId, ItemCount, Slot) {
|
||||
if (ItemId == 0) {
|
||||
//检查金币
|
||||
local Money = Sq_CallFunc(S_Ptr("0x817a188"), "int", ["pointer"], SUser.C_Object);
|
||||
if (Money >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -1) {
|
||||
//检查点券
|
||||
if (SUser.GetCera() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ItemId == -2) {
|
||||
//检查代币券
|
||||
if (SUser.GetCeraPoint() >= ItemCount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
local SlotIdx = GetSlotById(ItemId);
|
||||
if (SlotIdx != -1) {
|
||||
local SlotItem = GetSlot(1, SlotIdx);
|
||||
if (SlotItem) {
|
||||
if (SlotItem.GetType() != "装备") {
|
||||
if (SlotItem.GetAdd_Info() >= ItemCount) return true;
|
||||
} else {
|
||||
//如果是装备 检查格子所在的道具id
|
||||
local ItemId2 = GetSlot(1, Slot).GetIndex();
|
||||
//如果这个格子的道具id就是发来的id 那么返回true
|
||||
if (ItemId == ItemId2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user