Users clan structure. Slave server version. Any changes in the instance will be sent over to cache server immediately. Note that its contents are not synchronized automatically with instances on other servers.

Constructor

new (s:Server, idv:Int, l:Map<String, Dynamic>)

Fields

read only id:Int

read only leaderID:Int

read only name:String

Methods

acceptRequest (userID:Int):String

Accepts request to join this clan. This request will not change the contents of this instance.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. noRequest - no request for this user. userInClan - user already in another clan.

inline addRequest (userID:Int):Void

Adds request to join this clan. This request will not change the contents of this instance.

Parameters:

userID

User ID.

addUser (userID:Int):String

Adds user to this clan. This request will not change the contents of this instance.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. userInClan - this user ID is already in this clan.

getBool (key:String):Bool

Returns clan attribute value as Bool.

Parameters:

key

Attribute key.

Returns:

Attribute value. Returns false, if this mapping is not found.

getBoolVar (key:String):Bool

Returns clan variable value as Bool.

Parameters:

key

Variable key.

Returns:

Variable value. Returns false, if this mapping is not found.

inline getDynamic (key:String):Dynamic

Returns clan attribute value as Dynamic.

Parameters:

key

Attribute key.

Returns:

Attribute value. Returns null, if this mapping is not found.

inline getDynamicVar (key:String):Dynamic

Returns clan variable value as Dynamic.

Parameters:

key

Variable key.

Returns:

Variable value. Returns null, if this mapping is not found.

getFloat (key:String):Float

Returns clan attribute value as Float.

Parameters:

key

Attribute key.

Returns:

Attribute value. Returns 0, if this mapping is not found.

getFloatVar (key:String):Float

Returns clan variable value as Float.

Parameters:

key

Variable key.

Returns:

Variable value. Returns 0, if this mapping is not found.

inline getInt (key:String):Int

Returns clan attribute value as Int.

Parameters:

key

Attribute key.

Returns:

Attribute value. Returns 0, if this mapping is not found.

inline getIntVar (key:String):Int

Returns clan variable value as Int.

Parameters:

key

Variable key.

Returns:

Variable value. Returns 0, if this mapping is not found.

getRequests ():Array<{id:Int}>

Returns list of user requests to join clan.

Returns:

Number of requests to join clan.

getRequestsAmount ():Int

Returns number of requests to join clan.

Returns:

Number of requests to join clan.

getString (key:String):String

Returns clan attribute value as String.

Parameters:

key

Attribute key.

Returns:

Attribute value. Returns null, if this mapping is not found.

getStringVar (key:String):String

Returns clan variable value as String.

Parameters:

key

Variable key.

Returns:

Variable value. Returns null, if this mapping is not found.

getUser (userID:Int):ClanUserCore

Returns clan user with this ID. Each time this method is called, a new instance of snipe.slave.data.ClanUserCore is created.

Returns:

Clan user instance. Returns null if the user is not in this clan.

inline getUsersAmount ():Int

Returns number of users in clan.

Returns:

Number of users in clan.

inline getUsersRaw ():Array<Dynamic>

Returns array of raw user records in clan.

Returns:

Array of raw user records in clan.

hasRequest (userID:Int):Bool

Returns true if clan has request to join from this user.

Parameters:

userID

User ID.

hasUser (userID:Int):Bool

Returns true if this user is in this clan.

Parameters:

userID

User ID.

refuseRequest (userID:Int):Void

Refuses request to join this clan. This request will not change the contents of this instance.

Parameters:

userID

User ID.

removeUser (userID:Int):String

Removes user from this clan.

Parameters:

userID

User ID.

Returns:

Operation status. ok - operation successful. isLeader - cannot remove leader. userNotInClan - this user ID is not in this clan.

setAttr (key:String, val:Dynamic):Void

Sets clan attribute value. Value has to have a simple database-usable type like number, boolean or string. Clan attributes are stored as the "Clans" database table fields. Therefore the corresponding field must exist in the database table.

Parameters:

key

Attribute key. Has to be lowercase for database reasons. Setting "id", "leaderid" or "params" attributes directly is disallowed.

val

Attribute value.

inline setAttrs (obj:Dynamic):Void

Sets multiple clan attribute values. All values have to have simple database-usable types like numbers, booleans or strings.

Parameters:

obj

Anonymous object with fields acting as attribute keys. All attributes have to be lowercase for database reasons. Setting "id", "leaderid" or "params" attributes directly is disallowed.

setLeader (userID:Int):String

Sets new leader for this clan. This request will not change the contents of this instance.

Parameters:

userID

User ID.

Returns:

Operation status. ok - Operation successful. userNotInClan - This user ID is not in this clan.

setVar (key:String, val:Dynamic):Void

Sets clan variable value. Value has to be properly serializable and deserializable. Clan variables are stored in the serialized "params" field of the clan database row in the "vars" group.

Parameters:

key

Variable key. Setting "users" or "requests" variables directly is disallowed.

val

Variable value.