mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
103 lines
2.5 KiB
ActionScript
103 lines
2.5 KiB
ActionScript
package avatar
|
|
{
|
|
public class UserVarCache
|
|
{
|
|
|
|
private var _cache:Object;
|
|
|
|
public function UserVarCache()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public function init() : void
|
|
{
|
|
this._cache = new Object();
|
|
}
|
|
|
|
public function set playerUserVars(param1:Object) : void
|
|
{
|
|
var _loc2_:String = null;
|
|
this._cache = new Object();
|
|
for(_loc2_ in param1)
|
|
{
|
|
this._cache[_loc2_] = {
|
|
"value":param1[_loc2_].value,
|
|
"type":param1[_loc2_].type
|
|
};
|
|
}
|
|
}
|
|
|
|
public function get playerUserVars() : Object
|
|
{
|
|
return this._cache;
|
|
}
|
|
|
|
public function getUserVarValueById(param1:int) : Number
|
|
{
|
|
if(Boolean(this._cache) && Boolean(this._cache[param1]))
|
|
{
|
|
return this._cache[param1].value;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public function getUserVarTypeById(param1:int) : int
|
|
{
|
|
if(Boolean(this._cache) && Boolean(this._cache[param1]))
|
|
{
|
|
return this._cache[param1].type;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public function isBitSet(param1:int, param2:int) : Boolean
|
|
{
|
|
if(Boolean(this._cache) && Boolean(this._cache[param1]))
|
|
{
|
|
return Utility.areTwoAndedNumbersEqual(this._cache[param1].value,Utility.leftShiftNumbers(param2));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function numBitsSet(param1:int, param2:int) : int
|
|
{
|
|
if(param1 == 0)
|
|
{
|
|
return 0;
|
|
}
|
|
var _loc3_:int = 0;
|
|
var _loc4_:int = 0;
|
|
while(_loc4_ < param2)
|
|
{
|
|
if(Utility.areTwoAndedNumbersEqual(param1,Utility.leftShiftNumbers(_loc4_)))
|
|
{
|
|
_loc3_++;
|
|
}
|
|
_loc4_++;
|
|
}
|
|
return _loc3_;
|
|
}
|
|
|
|
public function updateUserVar(param1:int, param2:Number, param3:int = -1) : void
|
|
{
|
|
if(!this._cache)
|
|
{
|
|
this._cache = new Object();
|
|
}
|
|
if(this._cache[param1])
|
|
{
|
|
this._cache[param1].value = param2;
|
|
}
|
|
else
|
|
{
|
|
this._cache[param1] = {
|
|
"value":param2,
|
|
"type":param3
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|