Skip to main content
Version: 5.9.6

GetRandomGuildInfoV3

public BackendReturnObject GetRandomGuildInfoV3(string metaKey, int value, int gap, int limit);
public BackendReturnObject GetRandomGuildInfoV3(string metaKey, long value, long gap, int limit);

Parameters

ValueTypeDescription
metaKeystringmetaKey to look up(metaKey containing only numeric data)
valueint/longStandard int value
gapint/longValue included above and below based on the standard value
limitintRandom guild information to be loaded. Max 100

Description

Among the guilds with their data in the metaKey, randomly looks up the guilds that meet the condition of the value until the limit.
The values work as standards, and the random lookup applies only to guilds with data that match the values from the table's columns.
When a gap is set, it can be increased or decreased to set the minimum and maximum values.
- metaValue : guildLevel, - value : 100, - gap: 10 In the above settings, only guilds with numerical data between 90-110 in the metaKey called guildLevel will be randomly looked up.

The types of guild information that can be looked up are as follows:

  • Guild name
  • Number of goods
  • Set metadata
  • Number of guild members
  • Guild manager info
  • Guild master's nickname
  • Selected guild's inDate
  • Guild master's gamerIndate Your own guild will be excluded from the search results

Example

Synchronous

//short example
var bro = Backend.Guild.GetRandomGuildInfoV3("metaKey", 10, 0, 1);

//long example
// Randomly looks up 20 guilds with guild levels at -10 or +10
string metaKey = "guildLevel";

//Import guild level data from My guild information
var bro = Backend.Guild.GetMyGuildInfoV3();
int myGuildLevel = System.int.Parse(bro.GetReturnValuetoJSON()["guild"][metaKey]["N"].ToString()

// When myGuildLevel is 100, looks up 20 guilds with level data between 90 - 110
var bro2 = Backend.Social.GetRandomGuildInfoV3(metaKey, myGuildLevel, 10, 20);

for(int i=0; i<bro2.Rows().Count; i++)
{
string guildName = bro2.Rows()[i]["guildName"].ToString();
string guildLevel = bro2.Rows()[i][metaKey].ToString();
}

Asynchronous

//short example
Backend.Guild.GetRandomGuildInfoV3("metaKey", 10, 0, 1, callback =>
{
// to do
});

//long example
// Randomly looks up 20 guilds with guild levels at -10 or +10
string metaKey = "guildLevel";

//Import guild level data from My guild information
Backend.Guild.GetMyGuildInfoV3(callback =>
{
int myGuildLevel = System.int.Parse(callback.GetReturnValuetoJSON()["guild"][metaKey]["N"].ToString()

// When myGuildLevel is 100, looks up 20 guilds with level data between 90 - 110
Backend.Social.GetRandomGuildInfoV3(metaKey, myGuildLevel, 10, 20, callback2 =>
{
for(int i=0; i<callback2.Rows().Count; i++)
{
string guildName = callback2.Rows()[i]["guildName"].ToString();
string guildLevel = callback2.Rows()[i][metaKey].ToString();
}
});
});

SendQueue

//short example
SendQueue.Enqueue(Backend.Guild.GetRandomGuildInfoV3, "metaKey", 10, 0, 1, callback =>
{
// to do
});

//long example
// Randomly looks up 20 guilds with guild levels at -10 or +10
string metaKey = "guildLevel";

//Import guild level data from My guild information
SendQueue.Enqueue(Backend.Guild.GetMyGuildInfoV3, callback =>
{
int myGuildLevel = System.int.Parse(callback.GetReturnValuetoJSON()["guild"][metaKey]["N"].ToString()

// When myGuildLevel is 100, looks up 20 guilds with level data between 90 - 110
SendQueue.Enqueue(Backend.Social.GetRandomGuildInfoV3, metaKey, myGuildLevel, 10, 20, callback2 =>
{
for(int i=0; i<callback2.Rows().Count; i++)
{
string guildName = callback2.Rows()[i]["guildName"].ToString();
string guildLevel = callback2.Rows()[i][metaKey].ToString();
}
});
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When the columnName does not exist
statusCode : 200

returnValue : {"rows":[]}

When no data meets the conditions
statusCode : 200

returnValue : {"rows":[]}

Error cases

When the tableName does not exist
statusCode : 404
errorCode : NotFoundException

GetReturnValuetoJSON

{
"rows":
[
{
"guildName":"StrongGuild", // Guild name
"goodsCount":3, // Number of goods
"guildLevel":100, //Set metadata
"comment":"Strongest Guild", //Set metadata2
"memberCount":1, // Number of guild members
"viceMasterList":[ // Guild manager
{"nickname":"tester11","inDate":"2021-06-23T08:38:59.106Z"},
{"nickname":"tester12","inDate":"2021-06-22T04:38:59.216Z"}
],
"masterNickname":"Tester1" ,// Guild master's nickname
"inDate":"2020-09-01T05:54:55.752Z", // Selected guild's inDate
"updatedAt":"2020-11-11T05:23:53.936Z"//Latest guild information update date
"masterInDate":"2020-09-01T06:03:06.175Z " //Guild master's gamerIndate
},
{
"guildName":"GuildName", // Guild name
"goodsCount":3, // Number of goods
"guildLevel":100, //Set metadata
"comment":"Guild Metadata", //Set metadata2
"memberCount":1, // Number of guild members
"viceMasterList":[], // Guild manager
"masterNickname":"Tester2" // Guild master's nickname
"inDate":"2020-02-01T05:34:55.752Z" // Selected guild's inDate
"updatedAt":"2020-11-11T05:23:53.936Z"//Latest guild information update date
"masterInDate":"2021-01-11T06:02:06.275Z" //Guild master's gamerIndate
},
....
]
}

Sample code

public class GuildItem
{
public int memberCount;
public Dictionary<string, string> viceMasterList = new Dictionary<string, string>();
public string masterNickname;
public string inDate;
public string guildName;
public int goodsCount;
public bool _immediateRegistration;
public string _countryCode;
public string masterInDate;
public override string ToString()
{
string viceMasterString = string.Empty;
foreach(var li in viceMasterList)
{
viceMasterString += $"Vice guild master : {li.Value}({li.Key})\n";
}
return $"memberCount : {memberCount}\n" +
$"masterNickname : {masterNickname}\n" +
$"inDate : {inDate}\n" +
$"guildName : {guildName}\n" +
$"goodsCount : {goodsCount}\n" +
$"_immediateRegistration : {_immediateRegistration}\n" +
$"_countryCode : {_countryCode}\n" +
$"masterInDate : {masterInDate}\n" +
$"memberCount : {memberCount}\n" +
viceMasterString;
}
};
public void GetRandomGuildInfoV3()
{
var bro = Backend.Guild.GetRandomGuildInfoV3("metaKey", 10, 0, 1));

if(!bro.IsSuccess())
return;

LitJson.JsonData json = bro.FlattenRows();

List<GuildItem> guildList = new List<GuildItem>();

for(int i = 0; i < json.Count; i++)
{
GuildItem guildItem = new GuildItem();

guildItem.memberCount = int.Parse(json[i]["memberCount"].ToString());
guildItem.masterNickname = json[i]["masterNickname"].ToString();
guildItem.inDate = json[i]["inDate"].ToString();
guildItem.guildName = json[i]["guildName"].ToString();
guildItem.goodsCount = int.Parse(json[i]["goodsCount"].ToString());
if(json[i].ContainsKey("_immediateRegistration"))
{
guildItem._immediateRegistration = json[i]["_immediateRegistration"].ToString() == "true" ? true : false;
}
if(json[i].ContainsKey("_countryCode"))
{
guildItem._countryCode = json[i]["_countryCode"].ToString();
}
guildItem.masterInDate = json[i]["masterInDate"].ToString();

LitJson.JsonData viceListJson = json[i]["viceMasterList"];
for(int j = 0; j < viceListJson.Count; j++)
{
guildItem.viceMasterList.Add(viceListJson[j]["inDate"].ToString(), viceListJson[j]["nickname"].ToString());
}

guildList.Add(guildItem);
Debug.Log(guildItem.ToString());
}
}