Jump to content

Cashlaz

Developer
  • Posts

    2,943
  • Joined

  • Last visited

Profile Information

  • Jailbroken
    No
  • Rooted
    No

Recent Profile Visitors

15,919 profile views

Cashlaz's Achievements

iOS God

iOS God (14/14)

  • Becoming Popular
  • Favorites
  • 6 Years In
  • Best Answer
  • Spreading Some Love

Recent Badges

8.7k

Reputation

1

Community Answers

Single Status Update

See all updates by Cashlaz

  1. 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 New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines