Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions MY_!Base/src/lib/Game.Target.Doodad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ function X.GetDoodadLootMoney(dwDoodadID)
local scene = me and me.GetScene()
return scene and scene.GetLootMoney(dwDoodadID)
else
local doodad = X.GetDoodad(dwDoodadID)
return doodad and doodad.GetLootMoney()
local me = X.GetClientPlayer()
local scene = me and me.GetScene()
return scene and scene.GetLootMoney(dwDoodadID)
end
end

Expand All @@ -61,8 +62,10 @@ function X.GetDoodadLootItemCount(dwDoodadID)
local tLoot = scene and scene.GetLootList(dwDoodadID)
return tLoot and tLoot.nItemCount or nil
else
local doodad = X.GetDoodad(dwDoodadID)
return doodad and doodad.GetItemListCount()
local me = X.GetClientPlayer()
local scene = me and me.GetScene()
local tLoot = scene and scene.GetLootList(dwDoodadID)
return tLoot and tLoot.nItemCount or nil
end
end

Expand All @@ -83,9 +86,14 @@ function X.GetDoodadLootItem(dwDoodadID, nIndex)
end
else
local me = X.GetClientPlayer()
local doodad = X.GetDoodad(dwDoodadID)
if doodad then
return doodad.GetLootItem(nIndex - 1, me)
local scene = me and me.GetScene()
local tLoot = scene and scene.GetLootList(dwDoodadID)
local it = tLoot and tLoot[nIndex - 1]
if it then
local bNeedRoll = it.LootType == X.CONSTANT.LOOT_ITEM_TYPE.NEED_ROLL
local bDist = it.LootType == X.CONSTANT.LOOT_ITEM_TYPE.NEED_DISTRIBUTE
local bBidding = it.LootType == X.CONSTANT.LOOT_ITEM_TYPE.NEED_BIDDING
return it.Item, bNeedRoll, bDist, bBidding
end
end
end
Expand All @@ -102,9 +110,10 @@ function X.DistributeDoodadItem(dwDoodadID, dwItemID, dwTargetPlayerID)
scene.DistributeItem(dwDoodadID, dwItemID, dwTargetPlayerID)
end
else
local doodad = X.GetDoodad(dwDoodadID)
if doodad then
doodad.DistributeItem(dwItemID, dwTargetPlayerID)
local me = X.GetClientPlayer()
local scene = me and me.GetScene()
if scene then
scene.DistributeItem(dwDoodadID, dwItemID, dwTargetPlayerID)
end
end
end
Expand All @@ -120,9 +129,10 @@ function X.GetDoodadLooterList(dwDoodadID)
return scene.GetLooterList(dwDoodadID)
end
else
local doodad = X.GetDoodad(dwDoodadID)
if doodad then
return doodad.GetLooterList()
local me = X.GetClientPlayer()
local scene = me and me.GetScene()
if scene then
return scene.GetLooterList(dwDoodadID)
end
end
end
Expand Down