---
title: 'Guild_Su'
disqus: hackmd
tags: 'API'
---
## **Super User**
A super user, also known as a privileged user, is an account that DP ( Distributed Plug-in ) uses to log in to the game. Since DP plays the role of being the central controller of the game, it has to be allowed to have the privilege to obtain other players’ data. In other words, the privileged user function here is not set to let the current user obtain his own data but to designate a particular player with an additional parameter and obtain that player’s data directly.
The privilege function can only be called when the logged-in account is a super user, or callback will send back an error code that says “not authorized.” The super user function's use and parameter are similar to those of the regular player function. The former function starts with “su,” and if that privilege function aims to operate certain players’ data, there will be an additional parameter “userid” in the function to designate a certain player’s account.
The following is the privilege function of CloudItem. <mark>As for those functions that only their definitions, but not their specific explanations, are mentioned, please refer to the explanation under the regular user function.
</mark>
## **suCreateGuild**
***Create Guild***
***• static void suCreateGuild(CloudGame game, string userid, string name, string note, int maxmember, int permission, int tag, int G1, int G2, int G3, int G4, OnCallCompletionWithData cb, object token)***
Called by a Super User, designates userid as the guild's persident, and creates a guild. Please refer the Callback cb to `CreateGuild()`.
When developers set in the game management backstage that the "normal users" in this game do not have the authorization to create a guild, program designers have to use `suCreateGuild()` instead to create a guild in DP.
| parameter | note |
|:---------- |:------------------------------------------- |
| userid | Designate userid as the guild’s president. |
| name | The guild’s name. The system has no limits on the guilds’ names, and developers can filter out restricted names according to their own needs.|
| note | Guild’s description. |
| maxmember | The maximum number of members the guild allows (the maximum is 100). |
| permission | 0: Anyone can join the guild. / 1: Only the guild’s manager or super user gets to decide whether the player can join the guild. / 2: No one can join. |
| tag | Guild’s tag. |
| G1 ~ G4 | Guild’s registers to store integer data defined by developers. When `GetGuild()` calls, they can designate the sorting order. |
Types of back-sendings:
`void cb(int code, object data, object token)`
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | created successfully |
| not 0 | the creation fails and the code is the error code |
## **suDeleteGuild**
***Delete Guild***
***• static void suDeleteGuild(CloudGame game, uint guildid, OnCallCompletion cb, object token)***
This function is called by a super user to delete a guild that already exists.
| parameter | note |
|:------- |:------------------ |
| guildid | the verification code of the guild one wants to delete |
Types of back-sendings:
`void cb(int code, object data, object token)`
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | the deletion functions successfully |
| not 0 | the deletion fails and the code is the error code |
Supplementary note:
When calling this function, if it does not have the authority to delete a guild, cb() will send in a error code for parameter code, which is not 0.
## **suJoinGuild**
***Join Guild***
***• static void suJoinGuild(CloudGame game, string userid, uint guildid, OnCallCompletion cb, object token)***
This function is called by a Super User and allows the player that userid designates to join the guild.
| parameter | note |
|:------- |:------------------------ |
| guildid | the verification code of the guild one wants to join |
| userid | the userid of the player who wants to join the guild |
Types of back-sendings:
`void cb(int code, object data, object token)`
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | the adding functions successfully |
| not 0 | the adding fails and the code is the error code |
## **suLeaveGuild**
***Leave Guild***
***• static void suLeaveGuild(CloudGame game, string userid, OnCallCompletion cb, object token)***
This function is called by a Super User and allows the player that userid designates to leave the guild that he joins.
| parameter | note |
|:------ |:------------------------ |
| userid | the userid of the player who wants to leave the guild |
Types of back-sendings:
`void cb(int code, object data, object token)`
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | the leaving functions successfully |
| not 0 | the leaving fails and the code is the error code |
## **suUpdateGuild**
***Change Guild's Attribute Data***
***• static void suUpdateGuild(CloudGame game, uint guildid, string name, string note, object maxnumber, object permission, object tag, object G1, object G2, object G3, object G4, OnCallCompletionWithData cb, object token)***
This function is used to change the guild’s attribute data. It has to be called by a Super User to designate the verification code (Guild ID) of the guild that requires changing with parameter guildid.
| parameter | note |
|:------- |:---------- |
| guildid | the guild's verification code|
Supplementary note:
For descriptions on other parameters, please go to `UpdateGuild()`.
cb sends back the same Guild ID, and please refer the other parameters to `UpdateGuild()`.
## **suSetGuildManager**
***Set or Remove Guild Managers***
***• static void suSetGuildManager(CloudGame game, uint guildid, string userid, bool ismanager, OnCallCompletion cb, object token)***
This function is called by a super user and designates the guild with parameter guildid to set or remove a player’s qualification as a manager in this guild.
| parameter | note |
|:------- |:---------- |
| guildid | guild’s verification code |
| userid | the userid one wants to set or remove as the guild’s manager |
| ismanager | true: set as the guild’s manager / false: remove as the guild’s manager |
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | the setting or removing function successfully |
| not 0 | the setting or removing fail and the code is the error code |
## **suSetPlayerGuildRegister**
***Set Player’s Guild Register***
***• static void suSetPlayerGuildRegister(CloudGame game, string userid, object R1, object R2, object R3, object R4, OnCallCompletion cb, object token)***
Called by a Super User to designate the guild registers of the player one wants to set. The player is designated by parameter userid. Parameters R1 ~ R4 correspond to the player’s R1 ~ R4 registers in the guild’s system. If choose to not set a certain register, send in null to the corresponding parameter will do.
| parameter | note |
|:------- |:---------------------------------------------- |
| userid | the userid of the player one wants to set his registers |
| R1 ~ R4 |The registers that need to be set. Have to be integers. If one chooses to not to set, send back null. |
<mark>Please be aware that if the guild’s president or manager can set members’ guild registers by themselves, the authorization needs to be turned on in the management backstage. Or else, only a Super User can complete the setting in DP.</mark>
Types of back-sendings:
`void cb(int code, object data, object token)`
Here are the codes' status codes and their notes.
| status code | note |
|:------ |:---------------------- |
| 0 | the setting functions successfully |
| not 0 | the setting fails and the code is the error code |
## **suGetApplyJoinGuild**
***Get Application for Joining the Guild***
***• static void suGetApplyJoinGuild(CloudGame game, uint guildid, _ApplyType_ state, OnCallCompletionWithData cb, object token)***