Exemplo n.º 1
0
        public static PersistentPlayerData GetPPD(string playerName)
        {
            PersistentPlayerList playerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData ppd        = playerList.GetPlayerData(playerName);

            return(ppd);
        }
        public static void SetHome2(ClientInfo _cInfo, string _playerName, bool _announce)
        {
            bool                 Found                 = false;
            EntityPlayer         _player               = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            Vector3              _position             = _player.GetPosition();
            int                  x                     = (int)_position.x;
            int                  y                     = (int)_position.y;
            int                  z                     = (int)_position.z;
            int                  _claimSize            = GameStats.GetInt(EnumGameStats.LandClaimSize) / 2;
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_cInfo.playerId);
            List <Vector3i>      _blocks               = _persistentPlayerData.LPBlocks;

            for (int i = 0; i < _blocks.Count; i++)
            {
                Vector3i _vec3i = _blocks[i];
                if ((_vec3i.x - x) * (_vec3i.x - x) + (_vec3i.z - z) * (_vec3i.z - z) <= _claimSize * _claimSize)
                {
                    Found = true;
                    string _sposition = x + "," + y + "," + z;
                    PersistentContainer.Instance.Players[_cInfo.playerId, true].HomePosition2 = _sposition;
                    PersistentContainer.Instance.Save();
                    string _phrase607;
                    if (!Phrases.Dict.TryGetValue(607, out _phrase607))
                    {
                        _phrase607 = "{PlayerName} your home2 has been saved.";
                    }
                    _phrase607 = _phrase607.Replace("{PlayerName}", _cInfo.playerName);
                    if (_announce)
                    {
                        GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase607), Config.Server_Response_Name, false, "ServerTools", true);
                    }
                    else
                    {
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase607), Config.Server_Response_Name, false, "ServerTools", false));
                    }
                }
            }
            if (!Found)
            {
                string _phrase817;
                if (!Phrases.Dict.TryGetValue(817, out _phrase817))
                {
                    _phrase817 = "{PlayerName} you are not inside your own claimed space. You can not save this as your home.";
                }
                _phrase817 = _phrase817.Replace("{PlayerName}", _cInfo.playerName);
                if (_announce)
                {
                    GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase817), Config.Server_Response_Name, false, "ServerTools", true);
                }
                else
                {
                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase817), Config.Server_Response_Name, false, "ServerTools", false));
                }
            }
        }
        public static PersistentPlayerData GetPersistentPlayerData(string _playerId)
        {
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.persistentPlayers;

            if (_persistentPlayerList != null)
            {
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_playerId);
                if (_persistentPlayerData != null)
                {
                    return(_persistentPlayerData);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
        public static EnumLandClaimOwner ClaimedByWho(PlatformUserIdentifierAbs _uId, Vector3i _position)
        {
            PersistentPlayerList persistentPlayerList = GetPersistentPlayerList();

            if (persistentPlayerList != null)
            {
                PersistentPlayerData persistentPlayerData = persistentPlayerList.GetPlayerData(_uId);
                if (persistentPlayerData != null)
                {
                    return(GameManager.Instance.World.GetLandClaimOwner(_position, persistentPlayerData));
                }
            }
            return(EnumLandClaimOwner.None);
        }
Exemplo n.º 5
0
        public static PersistentPlayerData GetPersistentPlayerDataFromUId(PlatformUserIdentifierAbs _uId)
        {
            PersistentPlayerList persistentPlayerList = GetPersistentPlayerList();

            if (persistentPlayerList != null)
            {
                PersistentPlayerData ppd = persistentPlayerList.GetPlayerData(_uId);
                if (ppd != null)
                {
                    return(ppd);
                }
            }
            return(null);
        }
Exemplo n.º 6
0
        public static PersistentPlayerData GetPersistentPlayerDataFromId(string _id)
        {
            PlatformUserIdentifierAbs uId = GetPlatformUserFromNameOrId(_id);

            if (uId != null)
            {
                PersistentPlayerList persistentPlayerList = GetPersistentPlayerList();
                if (persistentPlayerList != null)
                {
                    PersistentPlayerData ppd = persistentPlayerList.GetPlayerData(uId);
                    if (ppd != null)
                    {
                        return(ppd);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 7
0
        public static void CheckLocation(ClientInfo _cInfo, string _amount, int _exec)
        {
            bool                 Found                 = false;
            EntityPlayer         _player               = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            int                  _claimSize            = GameStats.GetInt(EnumGameStats.LandClaimSize) / 2;
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_cInfo.playerId);
            List <Vector3i>      _blocks               = _persistentPlayerData.LPBlocks;

            for (int i = 0; i < _blocks.Count; i++)
            {
                Vector3i _vec3i = _blocks[i];
                if ((_vec3i.x - _player.position.x) * (_vec3i.x - _player.position.x) + (_vec3i.z - _player.position.z) * (_vec3i.z - _player.position.z) <= _claimSize * _claimSize)
                {
                    Found = true;
                    if (_exec == 1)
                    {
                        Deposit(_cInfo, _amount);
                    }
                    if (_exec == 2)
                    {
                        Withdraw(_cInfo, _amount);
                    }
                    if (_exec == 3)
                    {
                        WalletDeposit(_cInfo, _amount);
                    }
                    if (_exec == 4)
                    {
                        WalletWithdraw(_cInfo, _amount);
                    }
                }
            }
            if (!Found)
            {
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}You can not use this command here. Stand in your own claimed space.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false));
            }
        }
Exemplo n.º 8
0
        public static void CheckLP(ClientInfo _cInfo)
        {
            bool                 Found                 = false;
            EntityPlayer         _player               = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            int                  _claimSize            = GameStats.GetInt(EnumGameStats.LandClaimSize) / 2;
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_cInfo.playerId);
            List <Vector3i>      _blocks               = _persistentPlayerData.LPBlocks;

            for (int i = 0; i < _blocks.Count; i++)
            {
                if (!Found)
                {
                    Vector3i _vec3i = _blocks[i];
                    if ((_vec3i.x - _player.position.x) * (_vec3i.x - _player.position.x) + (_vec3i.z - _player.position.z) * (_vec3i.z - _player.position.z) <= _claimSize * _claimSize)
                    {
                        Found = true;
                        if (CheckStuck(_player))
                        {
                            Exec(_cInfo, _player);
                        }
                        else
                        {
                            string _phrase923;
                            if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                            {
                                _phrase923 = "{PlayerName} you do not seem to be stuck.";
                            }
                            _phrase923 = _phrase923.Replace("{PlayerName}", _cInfo.playerName);
                            {
                                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase923), Config.Server_Response_Name, false, "ServerTools", false));
                            }
                        }
                    }
                }
            }
            if (!Found)
            {
                List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients();
                for (int i = 0; i < _cInfoList.Count; i++)
                {
                    ClientInfo _cInfo2 = _cInfoList[i];
                    if (_cInfo2 != null && _cInfo != _cInfo2)
                    {
                        EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                        if (_player2 != null && _player.IsFriendsWith(_player2))
                        {
                            int _claimSize2 = GameStats.GetInt(EnumGameStats.LandClaimSize) / 2;
                            PersistentPlayerData _persistentPlayerData2 = GameManager.Instance.GetPersistentPlayerList().GetPlayerData(_cInfo2.playerId);
                            List <Vector3i>      _blocks2 = _persistentPlayerData.LPBlocks;
                            for (int j = 0; j < _blocks2.Count; j++)
                            {
                                if (!Found)
                                {
                                    Vector3i _vec3i = _blocks2[j];
                                    if ((_vec3i.x - _player.position.x) * (_vec3i.x - _player.position.x) + (_vec3i.z - _player.position.z) * (_vec3i.z - _player.position.z) <= _claimSize2 * _claimSize2)
                                    {
                                        Found = true;
                                        if (CheckStuck(_player))
                                        {
                                            Exec(_cInfo, _player);
                                        }
                                        else
                                        {
                                            string _phrase923;
                                            if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                                            {
                                                _phrase923 = "{PlayerName} you do not seem to be stuck.";
                                            }
                                            _phrase923 = _phrase923.Replace("{PlayerName}", _cInfo.playerName);
                                            {
                                                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase923), Config.Server_Response_Name, false, "ServerTools", false));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (!Found)
            {
                string _phrase921;
                if (!Phrases.Dict.TryGetValue(921, out _phrase921))
                {
                    _phrase921 = "{PlayerName} you are outside of your claimed space or a friends. Command is unavailable.";
                }
                _phrase921 = _phrase921.Replace("{PlayerName}", _cInfo.playerName);
                {
                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase921), Config.Server_Response_Name, false, "ServerTools", false));
                }
            }
        }
Exemplo n.º 9
0
        public static void CheckLP(ClientInfo _cInfo)
        {
            EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _landOwner            = _persistentPlayerList.GetLandProtectionBlockOwner(new Vector3i((int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_cInfo.playerId);

            if (_landOwner != null)
            {
                if (_landOwner != _persistentPlayerData)
                {
                    EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_landOwner.EntityId];
                    if (_player2 != null)
                    {
                        if (_player.IsFriendsWith(_player2))
                        {
                            if (CheckStuck(_player))
                            {
                                Exec(_cInfo, _player);
                            }
                            else
                            {
                                string _phrase923;
                                if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                                {
                                    _phrase923 = "{PlayerName} you do not seem to be stuck.";
                                }
                                _phrase923 = _phrase923.Replace("{PlayerName}", _cInfo.playerName);
                                {
                                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase923), Config.Server_Response_Name, false, "ServerTools", false));
                                }
                            }
                        }
                        else
                        {
                            string _phrase921;
                            if (!Phrases.Dict.TryGetValue(921, out _phrase921))
                            {
                                _phrase921 = "{PlayerName} you can not use this command here.";
                            }
                            _phrase921 = _phrase921.Replace("{PlayerName}", _cInfo.playerName);
                            {
                                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase921), Config.Server_Response_Name, false, "ServerTools", false));
                            }
                        }
                    }
                    else
                    {
                        string _phrase921;
                        if (!Phrases.Dict.TryGetValue(921, out _phrase921))
                        {
                            _phrase921 = "{PlayerName} you can not use this command here.";
                        }
                        _phrase921 = _phrase921.Replace("{PlayerName}", _cInfo.playerName);
                        {
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase921), Config.Server_Response_Name, false, "ServerTools", false));
                        }
                    }
                }
                else
                {
                    if (CheckStuck(_player))
                    {
                        Exec(_cInfo, _player);
                    }
                    else
                    {
                        string _phrase923;
                        if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                        {
                            _phrase923 = "{PlayerName} you do not seem to be stuck.";
                        }
                        _phrase923 = _phrase923.Replace("{PlayerName}", _cInfo.playerName);
                        {
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase923), Config.Server_Response_Name, false, "ServerTools", false));
                        }
                    }
                }
            }
            else
            {
                if (CheckStuck(_player))
                {
                    Exec(_cInfo, _player);
                }
                else
                {
                    string _phrase923;
                    if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                    {
                        _phrase923 = "{PlayerName} you do not seem to be stuck.";
                    }
                    _phrase923 = _phrase923.Replace("{PlayerName}", _cInfo.playerName);
                    {
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase923), Config.Server_Response_Name, false, "ServerTools", false));
                    }
                }
            }
        }
Exemplo n.º 10
0
        public static void Exec(ClientInfo _cInfo)
        {
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];

            if (_player.AttachedToEntity != null)
            {
                int _counter   = 0;
                int _claimSize = GameStats.GetInt(EnumGameStats.LandClaimSize) / 2;
                PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerData(_cInfo.playerId);
                List <Vector3i>      _blocks = _persistentPlayerData.LPBlocks;
                for (int i = 0; i < _blocks.Count; i++)
                {
                    Vector3i _vec3i = _blocks[i];
                    if ((_vec3i.x - _player.position.x) * (_vec3i.x - _player.position.x) + (_vec3i.z - _player.position.z) * (_vec3i.z - _player.position.z) <= _claimSize * _claimSize)
                    {
                        string _phrase781;
                        if (!Phrases.Dict.TryGetValue(781, out _phrase781))
                        {
                            _phrase781 = "{PlayerName} saved your current bike for retrieval.";
                        }
                        _phrase781 = _phrase781.Replace("{PlayerName}", _cInfo.playerName);
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase781), Config.Server_Response_Name, false, "ServerTools", false));
                        PersistentContainer.Instance.Players[_cInfo.playerId, true].BikeId = _player.AttachedToEntity.entityId;
                        PersistentContainer.Instance.Save();
                    }
                    else
                    {
                        _counter++;
                    }
                }
                if (_counter == _blocks.Count)
                {
                    string _phrase780;
                    if (!Phrases.Dict.TryGetValue(780, out _phrase780))
                    {
                        _phrase780 = "{PlayerName} you do not own this land. You can only save your bike inside your own claimed space.";
                    }
                    _phrase780 = _phrase780.Replace("{PlayerName}", _cInfo.playerName);
                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase780), Config.Server_Response_Name, false, "ServerTools", false));
                }
            }
            else
            {
                Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false];
                if (p != null)
                {
                    if (p.BikeId != 0)
                    {
                        List <Entity> Entities = GameManager.Instance.World.Entities.list;
                        int           _counter = 0;
                        bool          Other = false, Found = false;
                        for (int i = 0; i < Entities.Count; i++)
                        {
                            _counter++;
                            Entity _entity = Entities[i];
                            string _name   = EntityClass.list[_entity.entityClass].entityClassName;
                            if (_name == "minibike")
                            {
                                if ((_player.position.x - _entity.position.x) * (_player.position.x - _entity.position.x) + (_player.position.z - _entity.position.z) * (_player.position.z - _entity.position.z) <= 50 * 50)
                                {
                                    if (_entity.entityId == p.BikeId)
                                    {
                                        if (_entity.AttachedToEntity == false)
                                        {
                                            _entity.SetPosition(_player.position);
                                            string _phrase782;
                                            if (!Phrases.Dict.TryGetValue(782, out _phrase782))
                                            {
                                                _phrase782 = "{PlayerName} found your bike and sent it to you.";
                                            }
                                            _phrase782 = _phrase782.Replace("{PlayerName}", _cInfo.playerName);
                                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase782), Config.Server_Response_Name, false, "ServerTools", false));
                                            int _oldCoins = PersistentContainer.Instance.Players[_cInfo.playerId, false].PlayerSpentCoins;
                                            PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = _oldCoins - Command_Cost;
                                            PersistentContainer.Instance.Players[_cInfo.playerId, true].LastBike         = DateTime.Now;
                                            PersistentContainer.Instance.Save();
                                            Found = true;
                                        }
                                        else
                                        {
                                            string _phrase785;
                                            if (!Phrases.Dict.TryGetValue(785, out _phrase785))
                                            {
                                                _phrase785 = "{PlayerName} found your bike but someone else is on it.";
                                            }
                                            _phrase785 = _phrase785.Replace("{PlayerName}", _cInfo.playerName);
                                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase785), Config.Server_Response_Name, false, "ServerTools", false));
                                            Other = true;
                                        }
                                    }
                                }
                            }
                        }
                        if (_counter == Entities.Count && !Other && !Found)
                        {
                            string _phrase784;
                            if (!Phrases.Dict.TryGetValue(784, out _phrase784))
                            {
                                _phrase784 = "{PlayerName} could not find your bike near by.";
                            }
                            _phrase784 = _phrase784.Replace("{PlayerName}", _cInfo.playerName);
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase784), Config.Server_Response_Name, false, "ServerTools", false));
                        }
                    }
                    else
                    {
                        string _phrase783;
                        if (!Phrases.Dict.TryGetValue(783, out _phrase783))
                        {
                            _phrase783 = "{PlayerName} you do not have a bike saved.";
                        }
                        _phrase783 = _phrase783.Replace("{PlayerName}", _cInfo.playerName);
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase783), Config.Server_Response_Name, false, "ServerTools", false));
                    }
                }
            }
        }