Skip to content
Guest Big Announcement

Cashlaz

Developer
  • Joined

  • Last visited

smolk1984    Cashlaz

Duck Survival [+3 Cheats] ad 

Context

Duck Survival = Unity IL2CPP + ToLua. Ad logic lives in Lua (VipCtrl, AdManager, EventSystem).

The native tweak (DuckSpend) hooks lua_pcall / DecodeData and injects inject.lua into the live Lua state. Once lobby modules exist, we monkey-patch their globals.

How the game normally grants the reward

Typical flow:

  1. UI calls AdManager.ShowAd(reasonId, adOrPayId).
  2. If ad-free is set (VipCtrl.GetAddedAdFreeFlag()), the game skips the video and fires EventDefine.OnFinishAd.
  3. Listeners on OnFinishAd (shop, daily reward, etc.) grant the reward using reasonId / adOrPayId.

So the reward is keyed off the internal Lua event OnFinishAd, not directly off the native SDK callback.

What we do (two layers)

Source: tweak/DuckSpend/inject.lua, gated by on('ads') → _G.__DuckT.ads.

1. Fake VIP / ad-free

function VipCtrl.GetAddedAdFreeFlag()
if on('ads') then return true end
return origVip()
end

Any code that checks “is ad-free?” before showing an ad gets true and often never reaches the SDK.

2. Short-circuit ShowAd (main reward path)

function AdManager.ShowAd(reasonId, adOrPayId)
if not on('ads') then
return origShow(reasonId, adOrPayId)
end
local params = { r = reasonId, i = adOrPayId }
EventSystem:Trigger(EventDefine.OnFinishAd, params)
if AdManager.SendAdsEvent then pcall(AdManager.SendAdsEvent, 3, 1) end
return -- do not call original ShowAd → no video
end
  • skip original ShowAd → no native video;
  • immediately Trigger(OnFinishAd, { r = reasonId, i = adOrPayId }) → same listeners as a real completion;
  • optional SendAdsEvent(3, 1) — analytics “success” (best-effort, not required for the grant).

{ r, i } matches the payload the game’s OnFinishAd handlers expect (same as the vanilla ad-free path).

Why the reward still arrives

We emulate a successful completion at the game’s Lua layer, not a fake response from the ad network. Client Lua treats the watch as done and runs its normal reward flow.

Details

Point Meaning
Idempotency
_G.__DuckAdVip / __DuckAdShow wrap once
Toggle
on('ads') == false → full original path
Timing
wrap installs after VipCtrl/AdManager exist in lobby (retry via pcall inject)
Server
if a reward is validated server-side via an ad token, this may fail; this path is client event-driven

Bottom line: skip = don’t call the SDK + fire OnFinishAd with the same ids, plus the VIP flag as an extra short-circuit for code that checks ad-free before ShowAd.

Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.