Trigger API Reference DCEI Functions Service1 - BLKTower/TestWiki GitHub Wiki

Table of Contents

Trigger API Reference\DCEI Functions\Service (2/2) {Trigger-API-ReferenceDCEI-FunctionsService-22}

void WildCastleUpdateGuildSettings(string announcement, int guildJoinType, TypedCallback<object> callback) {void-WildCastleUpdateGuildSettingsstring-announcement-int-guildJoinType-TypedCallbackobject-callback}

void WildCastleUpdateGuildSettings(string announcement, int guildJoinType, TypedCallback<object> callback)

Description

Parameters

Example Usage

void WildCastleUpdateGuildBadge(int background, int pattern, int icon, TypedCallback<object> callback) {void-WildCastleUpdateGuildBadgeint-background-int-pattern-int-icon-TypedCallbackobject-callback}

void WildCastleUpdateGuildBadge(int background, int pattern, int icon, TypedCallback<object> callback)

Description

Parameters

Example Usage

void WildCastleUpdatePlayerBadge(int background, int pattern, int icon, TypedCallback<object> callback) {void-WildCastleUpdatePlayerBadgeint-background-int-pattern-int-icon-TypedCallbackobject-callback}

void WildCastleUpdatePlayerBadge(int background, int pattern, int icon, TypedCallback<object> callback)

Description

Parameters

Example Usage

void WildCastlePostContribution(int contribution, TypedCallback<object> callback) {void-WildCastlePostContributionint-contribution-TypedCallbackobject-callback}

void WildCastlePostContribution(int contribution, TypedCallback<object> callback)

Description

Parameters

Example Usage

void WildCastlePromoteGuildMember(string targetPlayerUuid, TypedCallback<object> callback) {void-WildCastlePromoteGuildMemberstring-targetPlayerUuid-TypedCallbackobject-callback}

void WildCastlePromoteGuildMember(string targetPlayerUuid, TypedCallback<object> callback)

Description

Parameters

Example Usage

void WildCastleDemoteGuildMember(string targetPlayerUuid, TypedCallback<object> callback) {void-WildCastleDemoteGuildMemberstring-targetPlayerUuid-TypedCallbackobject-callback}

void WildCastleDemoteGuildMember(string targetPlayerUuid, TypedCallback<object> callback)

Description

Parameters

Example Usage

void GetLeaderBoardScore(string type, TypedCallback<object> callback) {void-GetLeaderBoardScorestring-type-TypedCallbackobject-callback}

void GetLeaderBoardScore(string type, TypedCallback<object> callback)

Description

Attempts to fetch the leaderboard score for the player as the first parameter in the callback function.

Parameters

  • string type the leaderboard score to fetch.
  • object callback the callback function to handle the score.

Example Usage

DCEI.GetLeaderBoardScore("type1", function(result)
    DCEI.LogMessage(string.format("Group: %i\nPayload: %s\nRank: %i\nScore: %i,\nUUID: %s\n", result.group, result.payload, result.rank, result.score, result.uuid) .. os.date("%x", result.time))
end)

void GetLeaderBoardScoreList(string type, int skip, int limit, TypedCallback<object> callback) {void-GetLeaderBoardScoreListstring-type-int-skip-int-limit-TypedCallbackobject-callback}

void GetLeaderBoardScoreList(string type, int skip, int limit, TypedCallback<object> callback)

Description

Attempts to fetch the leaderboard score list as the first parameter in the callback function, from the given parameters.

Parameters

  • string type the leaderboard score to fetch.
  • int skip the number of entries to skip.
  • int limit the number of entries to return after the skip.
  • object callback the callback function to handle the score list.

Example Usage

local my_record
DCEI.GetLeaderBoardScore("type1", function(result)
    my_record = result
end)
-- Results will start at the previous multiple of 10.
local skip = math.floor((my_record.rank - 1) / 10) * 10
-- Obtain the next 10 results.
local limit = 10;

DCEI.GetLeaderBoardScoreList("type1", skip, limit, function(result)
    local text = string.format("Group %s\n", GetGroupName(result.group))
    for _, user in ipairs(result.users) do
        -- Highlight myself.
        if user.uuid == myid then
            text = text .. "<color=red>" .. Format(user) .. "</color>".. "\n"
        else
            text = text .. Format(user) .. "\n"
        end
    end
    DCEI.LogMessage(text)
end)

function Format(record)
    return string.format("Rank %d, Score %f, User %s, %s", record.rank, record.score, record.uuid, record.payload)
end

void GetLeaderBoardSurroundingUsers(string type, int count, TypedCallback<object> callback) {void-GetLeaderBoardSurroundingUsersstring-type-int-count-TypedCallbackobject-callback}

void GetLeaderBoardSurroundingUsers(string type, int count, TypedCallback<object> callback)

Description

Attempts to fetch the leaderboard scores for the current player and the users surrounding them, as the first parameter of the callback function.

Parameters

  • string type the leaderboard to fetch from.
  • int count the number of users to return, including the player themselves.
  • object callback the callback function to handle the score list.

Example Usage

local my_record
DCEI.GetLeaderBoardScore("type1", function(result)
    my_record = result
end)
-- Results will start at the previous multiple of 10.
local skip = math.floor((my_record.rank - 1) / 10) * 10
-- Obtain the next 10 results.
local limit = 10;

DCEI.GetLeaderBoardSurroundingUsers("type1", 3, function(result)
    local text = string.format("Group %s\n", GetGroupName(result.group))
    for _, user in ipairs(result.users) do
        -- Highlight myself.
        if user.uuid == myid then
            text = text .. "<color=red>" .. Format(user) .. "</color>".. "\n"
        else
            text = text .. Format(user) .. "\n"
        end
    end
    DCEI.LogMessage(text)
end)

function Format(record)
    return string.format("Rank %d, Score %f, User %s, %s", record.rank, record.score, record.uuid, record.payload)
end

void GetLeaderBoardUserScores(string type, List<string> uuids, TypedCallback<object> callback) {void-GetLeaderBoardUserScoresstring-type-Liststring-uuids-TypedCallbackobject-callback}

void GetLeaderBoardUserScores(string type, List<string> uuids, TypedCallback<object> callback)

Description

Parameters

Example Usage

void InitializeInAppPurchaseWithProductId(TypedCallback<string> purchaseCallback, List<string> productIds, TypedCallback<bool> initializationCallback) {void-InitializeInAppPurchaseWithProductIdTypedCallbackstring-purchaseCallback-Liststring-productIds-TypedCallbackbool-initializationCallback}

void InitializeInAppPurchaseWithProductId(TypedCallback<string> purchaseCallback, List<string> productIds, TypedCallback<bool> initializationCallback)

Description

Parameters

Example Usage

void InitializeInAppPurchaseWithProductData(TypedCallback<string> purchaseCallback, CustomIapProductData customIapProductData, TypedCallback<bool> initializationCallback) {void-InitializeInAppPurchaseWithProductDataTypedCallbackstring-purchaseCallback-CustomIapProductData-customIapProductData-TypedCallbackbool-initializationCallback}

void InitializeInAppPurchaseWithProductData(TypedCallback<string> purchaseCallback, CustomIapProductData customIapProductData, TypedCallback<bool> initializationCallback)

Description

Parameters

Example Usage

void PurchaseIapProduct(string productId) {void-PurchaseIapProductstring-productId}

void PurchaseIapProduct(string productId)

Description

Begin the purchase of an in-app product. If successful, it will call the InitializeInAppPurchase from DCEI.InitializeInAppPurchase() with the product id as the first parameter.

Parameters

  • string productId the ID of the product to be purchased.

Example Usage

DCEI.PurchaseIapProduct(product_id)

string GetIapProductLocalizedPrice(string productId) {string-GetIapProductLocalizedPricestring-productId}

string GetIapProductLocalizedPrice(string productId)

Description

Returns the in-app product's localized price, given its ID.

Parameters

  • string productId the ID of the product to return the localized price of.

Example Usage

local localized_price = DCEI.GetIapProductLocalizedPrice(product_id)

void PostLeaderBoardScore(string type, double score, string payload, int spentGems, TypedCallback<object> callback) {void-PostLeaderBoardScorestring-type-double-score-string-payload-int-spentGems-TypedCallbackobject-callback}

void PostLeaderBoardScore(string type, double score, string payload, int spentGems, TypedCallback<object> callback)

Description

Attempts to post the player's score to the given leaderboard.

Parameters

  • string type the leaderboard to post to.
  • double score the score to post.
  • string payload any additional information.
  • int spentGems the amount of gems spent as part of an anti-cheat measure.
  • object callback the callback function that handles a return. Passes the user's leaderboard score as per GetLeaderBoardScore() as a parameter.

Example Usage

local my_score = math.random(1, 100)
local my_record

DCEI.PostLeaderBoardScore("type1", my_score, "I'm here", 0, function(result)
    my_record = result
end)

void SetUserName(string name, TypedCallback<int> callback) {void-SetUserNamestring-name-TypedCallbackint-callback}

void SetUserName(string name, TypedCallback<int> callback)

Description

Attempts to set a player's username.

Parameters

  • string name the new username to assign to the player.
  • object callback the callback function that is run after the name is changed. Passes the number of times the player has changed their username as a parameter.

Example Usage

function OnMapStart()
    DCEI.SetUserName("Username", function(result)
        local user_name = DCEI.GetUserName()
        DCEI.LogMessage(user_name)
        DCEI.LogMessage(result)
    end)
end

⚠️ **GitHub.com Fallback** ⚠️