Пример #1
0
        public static bool ClaimedByAllySelfOrParty(string _id, Vector3i _position)
        {
            PersistentPlayerData _persistentPlayerData = PersistentOperations.GetPersistentPlayerDataFromSteamId(_id);

            if (_persistentPlayerData != null)
            {
                EnumLandClaimOwner _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                if (_owner == EnumLandClaimOwner.Ally || _owner == EnumLandClaimOwner.Self)
                {
                    return(true);
                }
                EntityPlayer _player = PersistentOperations.GetEntityPlayer(_id);
                if (_player != null)
                {
                    List <EntityPlayer> _party = _player.Party.MemberList;
                    if (_party.Count > 0)
                    {
                        for (int i = 0; i < _party.Count; i++)
                        {
                            EntityPlayer _partyMember = _party[i];
                            _persistentPlayerData = PersistentOperations.GetPersistentPlayerDataFromEntityId(_partyMember.entityId);
                            if (_persistentPlayerData != null)
                            {
                                _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                                if (_owner == EnumLandClaimOwner.Self)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
Пример #2
0
        public static void CheckLP(ClientInfo _cInfo)
        {
            EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);

            if (player != null)
            {
                Vector3              position = player.GetPosition();
                int                  x        = (int)position.x;
                int                  y        = (int)position.y;
                int                  z        = (int)position.z;
                Vector3i             vector   = new Vector3i(x, y, z);
                PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(player.entityId);
                EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(vector, _persistentPlayerData);
                if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally || _owner == EnumLandClaimOwner.None)
                {
                    if (CheckStuck(position.x, position.y, position.z))
                    {
                        TeleToSurface(_cInfo, player);
                    }
                    else
                    {
                        Phrases.Dict.TryGetValue("Stuck4", out string _phrase);
                        ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
                else
                {
                    Phrases.Dict.TryGetValue("Stuck2", out string _phrase);
                    ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                }
            }
        }
Пример #3
0
 public static void SaveClaimCheck(ClientInfo _cInfo, string _home)
 {
     try
     {
         if (!Event.Teams.ContainsKey(_cInfo.CrossplatformId.CombinedString))
         {
             EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
             if (player != null)
             {
                 Vector3            position = player.GetPosition();
                 EnumLandClaimOwner owner    = PersistentOperations.ClaimedByWho(_cInfo.CrossplatformId, new Vector3i(position.x, position.y, position.z));
                 if (owner == EnumLandClaimOwner.Ally || owner == EnumLandClaimOwner.Self)
                 {
                     ReservedCheck(_cInfo, _home);
                 }
                 else
                 {
                     Phrases.Dict.TryGetValue("Homes8", out string phrase);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         else
         {
             Phrases.Dict.TryGetValue("Homes3", out string phrase);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Homes.SaveClaimCheck: {0}", e.Message));
     }
 }
Пример #4
0
 public static void SaveClaimCheck(ClientInfo _cInfo, string _waypoint)
 {
     if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
     {
         World                world                 = GameManager.Instance.World;
         EntityPlayer         _player               = world.Players.dict[_cInfo.entityId];
         Vector3              _position             = _player.GetPosition();
         int                  x                     = (int)_position.x;
         int                  y                     = (int)_position.y;
         int                  z                     = (int)_position.z;
         Vector3i             _vec3i                = new Vector3i(x, y, z);
         PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
         PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
         EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner == EnumLandClaimOwner.None)
         {
             SetPoint(_cInfo, _waypoint);
         }
         else
         {
             string _phrase586;
             if (!Phrases.Dict.TryGetValue(586, out _phrase586))
             {
                 _phrase586 = " you can only save a waypoint that is outside of a claimed space.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase586 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you can not use waypoint commands while signed up for or in an event.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Пример #5
0
        private static void FClaimCheck(ClientInfo _cInfo, string _waypoint)
        {
            World                world                 = GameManager.Instance.World;
            EntityPlayer         _player               = world.Players.dict[_cInfo.entityId];
            Vector3              _position             = _player.GetPosition();
            int                  x                     = (int)_position.x;
            int                  y                     = (int)_position.y;
            int                  z                     = (int)_position.z;
            Vector3i             _vec3i                = new Vector3i(x, y, z);
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
            EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);

            if (_owner == EnumLandClaimOwner.None)
            {
                FCommandCost(_cInfo, _waypoint, _player);
            }
            else
            {
                string _phrase576;
                if (!Phrases.Dict.TryGetValue(576, out _phrase576))
                {
                    _phrase576 = " you can only use a waypoint that is outside of a claimed space.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase576 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #6
0
        public static void CheckLP(ClientInfo _cInfo)
        {
            World                world                 = GameManager.Instance.World;
            EntityPlayer         _player               = world.Players.dict[_cInfo.entityId];
            Vector3              _position             = _player.GetPosition();
            int                  x                     = (int)_position.x;
            int                  y                     = (int)_position.y;
            int                  z                     = (int)_position.z;
            Vector3i             _vec3i                = new Vector3i(x, y, z);
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
            EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);

            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally || _owner == EnumLandClaimOwner.None)
            {
                if (CheckStuck(_position.x, _position.y, _position.z))
                {
                    TeleToSurface(_cInfo, _player);
                }
                else
                {
                    Phrases.Dict.TryGetValue(554, out string _phrase554);
                    ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase554 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                Phrases.Dict.TryGetValue(552, out string _phrase552);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase552 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #7
0
 public static void CheckLocation(ClientInfo _cInfo, string _amount, int _exec)
 {
     if (Inside_Claim)
     {
         World                world                 = GameManager.Instance.World;
         EntityPlayer         _player               = world.Players.dict[_cInfo.entityId];
         Vector3              _position             = _player.GetPosition();
         int                  x                     = (int)_position.x;
         int                  y                     = (int)_position.y;
         int                  z                     = (int)_position.z;
         Vector3i             _vec3i                = new Vector3i(x, y, z);
         PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
         PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
         EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
         {
             if (_exec == 1)
             {
                 Deposit(_cInfo, _amount);
             }
             if (_exec == 2)
             {
                 Withdraw(_cInfo, _amount);
             }
             if (_exec == 3)
             {
                 WalletDeposit(_cInfo, _amount);
             }
             if (_exec == 4)
             {
                 WalletWithdraw(_cInfo, _amount);
             }
         }
         else
         {
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you can not use this command here.Stand in your own or a friend's claimed space.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         if (_exec == 1)
         {
             Deposit(_cInfo, _amount);
         }
         if (_exec == 2)
         {
             Withdraw(_cInfo, _amount);
         }
         if (_exec == 3)
         {
             WalletDeposit(_cInfo, _amount);
         }
         if (_exec == 4)
         {
             WalletWithdraw(_cInfo, _amount);
         }
     }
 }
        public static bool ClaimedByUnknown(string _id, Vector3i _position)
        {
            PersistentPlayerData _persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_id);

            if (_persistentPlayerData != null)
            {
                EnumLandClaimOwner _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                if (_owner != EnumLandClaimOwner.None && _owner != EnumLandClaimOwner.Ally && _owner != EnumLandClaimOwner.Self)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #9
0
        public static bool ClaimedByParty(int _entityId, Vector3i _position)
        {
            PersistentPlayerData _persistentPlayerData = PersistentOperations.GetPersistentPlayerDataFromEntityId(_entityId);

            if (_persistentPlayerData != null)
            {
                EnumLandClaimOwner _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                if (_owner == EnumLandClaimOwner.Self)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #10
0
        public static bool ClaimedByAllyOrSelf(string _id, Vector3i _position)
        {
            PersistentPlayerData _persistentPlayerData = GetPersistentPlayerDataFromSteamId(_id);

            if (_persistentPlayerData != null)
            {
                EnumLandClaimOwner _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                if (_owner == EnumLandClaimOwner.Ally || _owner == EnumLandClaimOwner.Self)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #11
0
        private static bool Claimed(ClientInfo _cInfo, Vector3i _position)
        {
            PersistentPlayerList _persistentPlayerList = PersistentOperations.GetPersistentPlayerList();

            if (_persistentPlayerList != null)
            {
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_cInfo.entityId);
                EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(_position, _persistentPlayerData);
                if (_owner == EnumLandClaimOwner.None)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #12
0
 public static void Exec1(ClientInfo _cInfo, EntityPlayer _player)
 {
     if (Inside_Claim)
     {
         World                world                 = GameManager.Instance.World;
         Vector3              _position             = _player.GetPosition();
         int                  x                     = (int)_position.x;
         int                  y                     = (int)_position.y;
         int                  z                     = (int)_position.z;
         Vector3i             _vec3i                = new Vector3i(x, y, z);
         PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
         PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
         EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
         {
             string _phrase781;
             if (!Phrases.Dict.TryGetValue(781, out _phrase781))
             {
                 _phrase781 = "saved your current bike for retrieval.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             string _sql = string.Format("UPDATE Players SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             SQL.FastQuery(_sql);
         }
         else
         {
             string _phrase780;
             if (!Phrases.Dict.TryGetValue(780, out _phrase780))
             {
                 _phrase780 = "you have not claimed this space or a friend. You can only save your bike inside a claimed space.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase780 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         string _phrase781;
         if (!Phrases.Dict.TryGetValue(781, out _phrase781))
         {
             _phrase781 = "saved your current bike for retrieval.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         string _sql = string.Format("UPDATE Players SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
         SQL.FastQuery(_sql);
     }
 }
Пример #13
0
        public static void CheckLP(ClientInfo _cInfo)
        {
            World                world                 = GameManager.Instance.World;
            EntityPlayer         _player               = world.Players.dict[_cInfo.entityId];
            Vector3              _position             = _player.GetPosition();
            int                  x                     = (int)_position.x;
            int                  y                     = (int)_position.y;
            int                  z                     = (int)_position.z;
            Vector3i             _vec3i                = new Vector3i(x, y, z);
            PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
            PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
            EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);

            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
            {
                if (CheckStuck(_player))
                {
                    Exec(_cInfo, _player);
                }
                else
                {
                    string _phrase923;
                    if (!Phrases.Dict.TryGetValue(923, out _phrase923))
                    {
                        _phrase923 = "you do not seem to be stuck.";
                    }
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase923 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                string _phrase921;
                if (!Phrases.Dict.TryGetValue(921, out _phrase921))
                {
                    _phrase921 = "you are outside of your claimed space or a friends. Command is unavailable.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase921 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #14
0
 public static bool GameManager_OpenTileEntityAllowed_Prefix(ref bool __result, ref bool __state, int _entityIdThatOpenedIt, TileEntity _te)
 {
     try
     {
         ClientInfo cInfo = PersistentOperations.GetClientInfoFromEntityId(_entityIdThatOpenedIt);
         if (cInfo != null)
         {
             if (GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.PlatformId) > 0 &&
                 GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.CrossplatformId) > 0)
             {
                 if (DroppedBagProtection.IsEnabled)
                 {
                     if (_te is TileEntityLootContainer)
                     {
                         TileEntityLootContainer lootContainer = _te as TileEntityLootContainer;
                         if (lootContainer.bPlayerBackpack)
                         {
                             if (!DroppedBagProtection.IsAllowed(_entityIdThatOpenedIt, lootContainer))
                             {
                                 Phrases.Dict.TryGetValue("DroppedBagProtection1", out string phrase);
                                 ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                 __result = false;
                                 return(false);
                             }
                         }
                     }
                 }
                 if (Shutdown.UI_Locked)
                 {
                     if (_te is TileEntityLootContainer)
                     {
                         TileEntityLootContainer lootContainer = _te as TileEntityLootContainer;
                         if (lootContainer.bPlayerBackpack)
                         {
                             return(true);
                         }
                     }
                     if (_te is TileEntityWorkstation || _te is TileEntityLootContainer || _te is TileEntitySecureLootContainer ||
                         _te is TileEntityVendingMachine || _te is TileEntityTrader)
                     {
                         if (_te is TileEntityTrader)
                         {
                             __state = true;
                         }
                         Phrases.Dict.TryGetValue("Shutdown3", out string phrase);
                         ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         __result = false;
                         return(false);
                     }
                 }
                 if (WorkstationLock.IsEnabled && _te is TileEntityWorkstation)
                 {
                     EntityPlayer entityPlayer = PersistentOperations.GetEntityPlayer(cInfo.entityId);
                     if (entityPlayer != null)
                     {
                         EnumLandClaimOwner owner = PersistentOperations.ClaimedByWho(cInfo.CrossplatformId, new Vector3i(entityPlayer.position));
                         if (owner != EnumLandClaimOwner.Self && owner != EnumLandClaimOwner.Ally && !PersistentOperations.ClaimedByNone(new Vector3i(entityPlayer.position)))
                         {
                             Phrases.Dict.TryGetValue("WorkstationLock1", out string phrase);
                             ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             __result = false;
                             return(false);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Injections.GameManager_OpenTileEntityAllowed_Prefix: {0}", e.Message));
     }
     return(true);
 }
Пример #15
0
        public static void SaveVehicle(ClientInfo _cInfo, Entity _player, int _vehicle, int _vehicleId)
        {
            if (Inside_Claim)
            {
                World                world                 = GameManager.Instance.World;
                Vector3              _position             = _player.GetPosition();
                int                  x                     = (int)_position.x;
                int                  y                     = (int)_position.y;
                int                  z                     = (int)_position.z;
                Vector3i             _vec3i                = new Vector3i(x, y, z);
                PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
                EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
                if (!(_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally))
                {
                    string _phrase780;
                    if (!Phrases.Dict.TryGetValue(780, out _phrase780))
                    {
                        _phrase780 = "You have not claimed this space or a friend. You can only save your vehicle inside a claimed space.";
                    }
                    ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase780 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    return;
                }
            }
            string _entityName = "", _vehicleName = "";

            if (_vehicle == 1)
            {
                _entityName  = "vehicleBicycle";
                _vehicleName = "bike";
            }
            else if (_vehicle == 2)
            {
                _entityName  = "vehicleMinibike";
                _vehicleName = "minibike";
            }
            else if (_vehicle == 3)
            {
                _entityName  = "vehicleMotorcycle";
                _vehicleName = "motorbike";
            }
            else if (_vehicle == 4)
            {
                _entityName  = "vehicle4x4Truck";
                _vehicleName = "jeep";
            }
            else if (_vehicle == 5)
            {
                _entityName  = "vehicleGyrocopter";
                _vehicleName = "gyro";
            }
            if (_player.AttachedToEntity.EntityClass.entityClassName.ToString() == _entityName)
            {
                if (_vehicle == 1)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].BikeId = _vehicleId;
                }
                else if (_vehicle == 2)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].MiniBikeId = _vehicleId;
                }
                else if (_vehicle == 3)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].MotorBikeId = _vehicleId;
                }
                else if (_vehicle == 4)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].JeepId = _vehicleId;
                }
                else if (_vehicle == 5)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].GyroId = _vehicleId;
                }
                PersistentContainer.Instance.Save();
                string _phrase781;
                if (!Phrases.Dict.TryGetValue(781, out _phrase781))
                {
                    _phrase781 = "Saved your current {Vehicle} for retrieval.";
                    _phrase781 = _phrase781.Replace("{Vehicle}", _vehicleName);
                }
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase781 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                string _phrase787;
                if (!Phrases.Dict.TryGetValue(787, out _phrase787))
                {
                    _phrase787 = "You are on the wrong vehicle to save it with this command. You are using a {Vehicle}.";
                }
                _phrase787 = _phrase787.Replace("{Vehicle}", _vehicleName);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase787 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #16
0
 public static void SaveVehicle(ClientInfo _cInfo)
 {
     try
     {
         EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
         if (player != null)
         {
             if (player.AttachedToEntity == null)
             {
                 Phrases.Dict.TryGetValue("VehicleRecall16", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 return;
             }
             if (Inside_Claim)
             {
                 World              world      = GameManager.Instance.World;
                 Vector3            position   = player.position;
                 int                x          = (int)position.x;
                 int                y          = (int)position.y;
                 int                z          = (int)position.z;
                 Vector3i           vec3i      = new Vector3i(x, y, z);
                 EnumLandClaimOwner claimOwner = PersistentOperations.ClaimedByWho(_cInfo.CrossplatformId, vec3i);
                 if (claimOwner != EnumLandClaimOwner.Self && claimOwner != EnumLandClaimOwner.Ally)
                 {
                     Phrases.Dict.TryGetValue("VehicleRecall6", out string phrase);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     return;
                 }
             }
             int maxVehicles = Normal_Max;
             if (ReservedSlots.IsEnabled)
             {
                 if (ReservedSlots.Dict.ContainsKey(_cInfo.PlatformId.CombinedString) || ReservedSlots.Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString))
                 {
                     if (ReservedSlots.Dict.TryGetValue(_cInfo.PlatformId.CombinedString, out DateTime dt))
                     {
                         if (DateTime.Now < dt)
                         {
                             maxVehicles = Reserved_Max;
                         }
                     }
                     else if (ReservedSlots.Dict.TryGetValue(_cInfo.CrossplatformId.CombinedString, out dt))
                     {
                         if (DateTime.Now < dt)
                         {
                             maxVehicles = Reserved_Max;
                         }
                     }
                 }
             }
             Dictionary <int, string[]> vehicles;
             if (PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles != null && PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles.Count > 0)
             {
                 vehicles = PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles;
             }
             else
             {
                 vehicles = new Dictionary <int, string[]>();
             }
             EntityVehicle vehicle = (EntityVehicle)player.AttachedToEntity;
             if (!vehicles.ContainsKey(vehicle.entityId))
             {
                 if (vehicles.Count < maxVehicles)
                 {
                     vehicles.Add(vehicle.entityId, new string[] { vehicle.EntityClass.entityClassName, new DateTime().ToString() });
                     PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles = vehicles;
                     Phrases.Dict.TryGetValue("VehicleRecall7", out string phrase);
                     phrase = phrase.Replace("{Type}", vehicle.EntityClass.entityClassName);
                     phrase = phrase.Replace("{Value}", vehicle.entityId.ToString());
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
                 else
                 {
                     Phrases.Dict.TryGetValue("VehicleRecall8", out string phrase);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     return;
                 }
             }
             else
             {
                 Phrases.Dict.TryGetValue("VehicleRecall9", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 return;
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in VehicleTeleport.SaveVehicle: {0}", e.Message));
     }
 }
Пример #17
0
        public static void Exec(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
        {
            try
            {
                if (_cInfo != null && _playerDataFile != null && _playerDataFile.bag != null && _playerDataFile.inventory != null)
                {
                    ItemStack[] _bag       = _playerDataFile.bag;
                    ItemStack[] _inventory = _playerDataFile.inventory;

                    if (Crafted.TryGetValue(_cInfo.entityId, out int _craftCount))
                    {
                        if ((int)_playerDataFile.totalItemsCrafted != _craftCount)
                        {
                            Crafted[_cInfo.entityId]   = (int)_playerDataFile.totalItemsCrafted;
                            Bag[_cInfo.entityId]       = _bag;
                            Inventory[_cInfo.entityId] = _inventory;
                            return;
                        }
                    }
                    else
                    {
                        Crafted.Add(_cInfo.entityId, (int)_playerDataFile.totalItemsCrafted);
                        Bag.Add(_cInfo.entityId, _bag);
                        Inventory.Add(_cInfo.entityId, _inventory);
                        return;
                    }

                    List <int> BagSlot = new List <int>();
                    List <int> InvSlot = new List <int>();
                    ItemStack  _bagStackOld, _bagStackNew, _invStackOld, _invStackNew, _CompareBagOld, _CompareBagNew,
                               _CompareInvOld, _CompareInvNew;

                    Bag.TryGetValue(_cInfo.entityId, out ItemStack[]  _bagStacks);
                    {
                        Inventory.TryGetValue(_cInfo.entityId, out ItemStack[] _invStacks);
                        {
                            int _bagSize = _bag.Length;
                            int _invSize = _inventory.Length;
                            for (int i = 0; i < _bagSize; i++)
                            {
                                _bagStackOld = _bagStacks[i];
                                _bagStackNew = _bag[i];
                                bool BagNext = true;
                                int  _oldTotal = 0, _newTotal = 0, _newCount;
                                if (!_bagStackNew.Equals(_bagStackOld) && !_bagStackNew.IsEmpty())
                                {
                                    string _name = _bagStackNew.itemValue.ItemClass.Name;
                                    if (!dict.Contains(_name))
                                    {
                                        for (int j = 0; j < _bagSize; j++)
                                        {
                                            _CompareBagOld = _bagStacks[j];
                                            if (!_CompareBagOld.IsEmpty() && _name == _CompareBagOld.itemValue.ItemClass.Name)
                                            {
                                                _newCount = _oldTotal + _CompareBagOld.count;
                                                _oldTotal = _newCount;
                                            }
                                        }
                                        for (int j = 0; j < _invSize; j++)
                                        {
                                            _CompareInvOld = _invStacks[j];
                                            if (!_CompareInvOld.IsEmpty() && _name == _CompareInvOld.itemValue.ItemClass.Name)
                                            {
                                                _newCount = _oldTotal + _CompareInvOld.count;
                                                _oldTotal = _newCount;
                                            }
                                        }

                                        for (int j = 0; j < _bagSize; j++)
                                        {
                                            _CompareBagNew = _bag[j];
                                            if (!_CompareBagNew.IsEmpty() && _name == _CompareBagNew.itemValue.ItemClass.Name)
                                            {
                                                _newCount = _newTotal + _CompareBagNew.count;
                                                _newTotal = _newCount;
                                            }
                                        }
                                        for (int j = 0; j < _invSize; j++)
                                        {
                                            _CompareInvNew = _inventory[j];
                                            if (!_CompareInvNew.IsEmpty() && _name == _CompareInvNew.itemValue.ItemClass.Name)
                                            {
                                                _newCount = _newTotal + _CompareInvNew.count;
                                                _newTotal = _newCount;
                                            }
                                        }
                                        if (_oldTotal == _newTotal)
                                        {
                                            BagNext = false;
                                        }
                                        if (BagNext)
                                        {
                                            if (_bagStackNew.count == 1)
                                            {
                                                int _counter1 = 0, _counter2 = 0;
                                                for (int j = 0; j < _bagSize; j++)
                                                {
                                                    _CompareBagNew = _bag[j];
                                                    if (!_CompareBagNew.IsEmpty() && _name == _CompareBagNew.itemValue.ItemClass.Name && _CompareBagNew.count == 1)
                                                    {
                                                        _counter1++;
                                                    }
                                                }
                                                for (int j = 0; j < _invSize; j++)
                                                {
                                                    _CompareInvNew = _inventory[j];
                                                    if (!_CompareInvNew.IsEmpty() && _name == _CompareInvNew.itemValue.ItemClass.Name && _CompareInvNew.count == 1)
                                                    {
                                                        _counter2++;
                                                    }
                                                }
                                                if (_counter1 + _counter2 > 1)
                                                {
                                                    for (int j = 0; j < _bagSize; j++)
                                                    {
                                                        _CompareBagOld = _bagStacks[j];
                                                        if (!_CompareBagOld.IsEmpty() && _name == _CompareBagOld.itemValue.ItemClass.Name && _CompareBagOld.count >= _counter1)
                                                        {
                                                            BagNext = false;
                                                        }
                                                    }
                                                    if (BagNext)
                                                    {
                                                        for (int j = 0; j < _invSize; j++)
                                                        {
                                                            _CompareInvOld = _invStacks[j];
                                                            if (!_CompareInvOld.IsEmpty() && _name == _CompareInvOld.itemValue.ItemClass.Name && _CompareInvOld.count >= _counter1)
                                                            {
                                                                BagNext = false;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if (BagNext)
                                        {
                                            if (_bagStackNew.itemValue.HasQuality)
                                            {
                                                for (int j = 0; j < _bagSize; j++)
                                                {
                                                    _CompareBagNew = _bag[j];
                                                    if (!_CompareBagNew.IsEmpty() && _bagStackNew.Equals(_CompareBagNew) && i != j && !BagSlot.Contains(j))
                                                    {
                                                        BagSlot.Add(i);
                                                        EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                        PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                        EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                        if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                        {
                                                            using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their bag inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _name, _bagStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                        else
                                                        {
                                                            using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their bag at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _name, _bagStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                    }
                                                }
                                                for (int j = 0; j < _invSize; j++)
                                                {
                                                    _CompareInvNew = _inventory[j];
                                                    if (!_CompareInvNew.IsEmpty() && _bagStackNew.Equals(_CompareInvNew) && !InvSlot.Contains(j))
                                                    {
                                                        InvSlot.Add(i);
                                                        EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                        PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                        EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                        if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                        {
                                                            using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _name, _bagStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                        else
                                                        {
                                                            using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _name, _bagStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (_bagStackNew.count > 1)
                                                {
                                                    for (int j = 0; j < _bagSize; j++)
                                                    {
                                                        _CompareBagNew = _bag[j];
                                                        if (!_CompareBagNew.IsEmpty() && _bagStackNew.Equals(_CompareBagNew) && i != j && !BagSlot.Contains(j))
                                                        {
                                                            BagSlot.Add(i);
                                                            EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                            PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                            EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their bag, identical to another stack, inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _bagStackNew.count, _name, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their bag, identical to another stack at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _bagStackNew.count, _name, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                        }
                                                    }
                                                    for (int j = 0; j < _invSize; j++)
                                                    {
                                                        _CompareInvNew = _inventory[j];
                                                        if (!_CompareInvNew.IsEmpty() && _bagStackNew.Equals(_CompareInvNew) && !InvSlot.Contains(j))
                                                        {
                                                            InvSlot.Add(i);
                                                            EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                            PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                            EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their bag, identical to another stack, inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _bagStackNew.count, _name, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their bag, identical to another stack at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _bagStackNew.count, _name, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            for (int i = 0; i < _invSize; i++)
                            {
                                bool InvNext = true;
                                _invStackOld = _invStacks[i];
                                _invStackNew = _inventory[i];
                                if (!_invStackNew.Equals(_invStackOld))
                                {
                                    if (!_invStackNew.IsEmpty())
                                    {
                                        string _invName = _invStackNew.itemValue.ItemClass.Name;
                                        if (!dict.Contains(_invName))
                                        {
                                            int _oldTotal = 0, _newTotal = 0, _newCount;
                                            for (int j = 0; j < _invSize; j++)
                                            {
                                                _CompareInvOld = _invStacks[j];
                                                if (!_CompareInvOld.IsEmpty() && _invName == _CompareInvOld.itemValue.ItemClass.Name)
                                                {
                                                    _newCount = _oldTotal + _CompareInvOld.count;
                                                    _oldTotal = _newCount;
                                                }
                                            }
                                            for (int j = 0; j < _bagSize; j++)
                                            {
                                                _CompareBagOld = _bagStacks[j];
                                                if (!_CompareBagOld.IsEmpty() && _invName == _CompareBagOld.itemValue.ItemClass.Name)
                                                {
                                                    _newCount = _oldTotal + _CompareBagOld.count;
                                                    _oldTotal = _newCount;
                                                }
                                            }
                                            for (int j = 0; j < _invSize; j++)
                                            {
                                                _CompareInvNew = _inventory[j];
                                                if (!_CompareInvNew.IsEmpty() && _invName == _CompareInvNew.itemValue.ItemClass.Name)
                                                {
                                                    _newCount = _newTotal + _CompareInvNew.count;
                                                    _newTotal = _newCount;
                                                }
                                            }
                                            for (int j = 0; j < _bagSize; j++)
                                            {
                                                _CompareBagNew = _bag[j];
                                                if (!_CompareBagNew.IsEmpty() && _invName == _CompareBagNew.itemValue.ItemClass.Name)
                                                {
                                                    _newCount = _newTotal + _CompareBagNew.count;
                                                    _newTotal = _newCount;
                                                }
                                            }
                                            if (_oldTotal == _newTotal)
                                            {
                                                InvNext = false;
                                            }
                                            if (InvNext)
                                            {
                                                if (_invStackNew.count == 1)
                                                {
                                                    int _counter1 = 0, _counter2 = 0;
                                                    for (int j = 0; j < _invSize; j++)
                                                    {
                                                        _CompareInvNew = _inventory[j];
                                                        if (!_CompareInvNew.IsEmpty() && _invName == _CompareInvNew.itemValue.ItemClass.Name && _CompareInvNew.count == 1)
                                                        {
                                                            _counter1++;
                                                        }
                                                    }
                                                    for (int j = 0; j < _bagSize; j++)
                                                    {
                                                        _CompareBagNew = _bag[j];
                                                        if (!_CompareBagNew.IsEmpty() && _invName == _CompareBagNew.itemValue.ItemClass.Name && _CompareBagNew.count == 1)
                                                        {
                                                            _counter2++;
                                                        }
                                                    }
                                                    if (_counter1 + _counter2 > 1)
                                                    {
                                                        for (int j = 0; j < _invSize; j++)
                                                        {
                                                            _CompareInvOld = _invStacks[j];
                                                            if (!_CompareInvOld.IsEmpty() && _invName == _CompareInvOld.itemValue.ItemClass.Name && _CompareInvOld.count >= _counter1)
                                                            {
                                                                InvNext = false;
                                                            }
                                                        }
                                                        if (InvNext)
                                                        {
                                                            for (int j = 0; j < _bagSize; j++)
                                                            {
                                                                _CompareBagOld = _bagStacks[j];
                                                                if (!_CompareBagOld.IsEmpty() && _invName == _CompareBagOld.itemValue.ItemClass.Name && _CompareBagOld.count >= _counter1)
                                                                {
                                                                    InvNext = false;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            if (InvNext)
                                            {
                                                if (_invStackNew.itemValue.HasQuality)
                                                {
                                                    for (int j = 0; j < _invSize; j++)
                                                    {
                                                        _CompareInvNew = _inventory[j];
                                                        if (!_CompareInvNew.IsEmpty() && _invStackNew.Equals(_CompareInvNew) && i != j && !InvSlot.Contains(j))
                                                        {
                                                            InvSlot.Add(i);
                                                            EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                            PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                            EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invName, _invStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory, standing at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invName, _invStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                        }
                                                    }
                                                    for (int j = 0; j < _bagSize; j++)
                                                    {
                                                        _CompareBagNew = _bag[j];
                                                        if (!_CompareBagNew.IsEmpty() && _invStackNew.Equals(_CompareBagNew) && !InvSlot.Contains(j))
                                                        {
                                                            InvSlot.Add(i);
                                                            EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                            PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                            EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                            if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invName, _invStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} {2} has added {3} with quality {4} to their inventory, standing at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invName, _invStackNew.itemValue.Quality, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (_invStackNew.count > 1)
                                                    {
                                                        for (int j = 0; j < _invSize; j++)
                                                        {
                                                            _CompareInvNew = _inventory[j];
                                                            if (!_CompareInvNew.IsEmpty() && _invStackNew.Equals(_CompareInvNew) && i != j && !InvSlot.Contains(j))
                                                            {
                                                                InvSlot.Add(i);
                                                                EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                                PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                                EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                                if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                                {
                                                                    using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their inventory, identical to another stack, inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invStackNew.count, _invName, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their inventory, identical to another stack, standing at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invStackNew.count, _invName, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        for (int j = 0; j < _bagSize; j++)
                                                        {
                                                            _CompareBagNew = _bag[j];
                                                            if (!_CompareBagNew.IsEmpty() && _invStackNew.Equals(_CompareBagNew) && !InvSlot.Contains(j))
                                                            {
                                                                InvSlot.Add(i);
                                                                EntityPlayer         _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                                                PersistentPlayerData _persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_player.entityId);
                                                                EnumLandClaimOwner   _owner = GameManager.Instance.World.GetLandClaimOwner(new Vector3i(_player.position.x, _player.position.y, _player.position.z), _persistentPlayerData);
                                                                if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
                                                                {
                                                                    using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their inventory, identical to another stack, inside their own or ally claimed space at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invStackNew.count, _invName, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    using (StreamWriter sw = new StreamWriter(_filepath, true, Encoding.UTF8))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} {2} has added {3} {4} to their inventory, identical to another stack, standing at {5} {6} {7}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _invStackNew.count, _invName, (int)_player.position.x, (int)_player.position.y, (int)_player.position.z));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            Bag[_cInfo.entityId]       = _bag;
                            Inventory[_cInfo.entityId] = _inventory;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in DupeLog.Exec: {0}.", e.Message));
            }
        }
Пример #18
0
        public static void SaveVehicle(ClientInfo _cInfo, Entity _player, int _vehicle, int _vehicleId)
        {
            if (Inside_Claim)
            {
                World                world                 = GameManager.Instance.World;
                Vector3              _position             = _player.GetPosition();
                int                  x                     = (int)_position.x;
                int                  y                     = (int)_position.y;
                int                  z                     = (int)_position.z;
                Vector3i             _vec3i                = new Vector3i(x, y, z);
                PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
                PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
                EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
                if (!PersistentOperations.ClaimedByAllyOrSelf(_cInfo.playerId, _vec3i))
                {
                    Phrases.Dict.TryGetValue(491, out string _phrase491);
                    ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase491 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                    return;
                }
            }
            string _entityName = "", _vehicleName = "";

            if (_vehicle == 1)
            {
                _entityName  = "vehicleBicycle";
                _vehicleName = "bike";
            }
            else if (_vehicle == 2)
            {
                _entityName  = "vehicleMinibike";
                _vehicleName = "minibike";
            }
            else if (_vehicle == 3)
            {
                _entityName  = "vehicleMotorcycle";
                _vehicleName = "motorbike";
            }
            else if (_vehicle == 4)
            {
                _entityName  = "vehicle4x4Truck";
                _vehicleName = "jeep";
            }
            else if (_vehicle == 5)
            {
                _entityName  = "vehicleGyrocopter";
                _vehicleName = "gyro";
            }
            if (_player.AttachedToEntity.EntityClass.entityClassName.ToString() == _entityName)
            {
                if (_vehicle == 1)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].BikeId = _vehicleId;
                }
                else if (_vehicle == 2)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].MiniBikeId = _vehicleId;
                }
                else if (_vehicle == 3)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].MotorBikeId = _vehicleId;
                }
                else if (_vehicle == 4)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].JeepId = _vehicleId;
                }
                else if (_vehicle == 5)
                {
                    PersistentContainer.Instance.Players[_cInfo.playerId].GyroId = _vehicleId;
                }
                PersistentContainer.DataChange = true;
                Phrases.Dict.TryGetValue(492, out string _phrase492);
                _phrase492 = _phrase492.Replace("{Vehicle}", _vehicleName);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase492 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                Phrases.Dict.TryGetValue(498, out string _phrase498);
                _phrase498 = _phrase498.Replace("{Vehicle}", _vehicleName);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase498 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #19
0
 public static void Exec1(ClientInfo _cInfo, Entity _player, int _vehicle)
 {
     if (Inside_Claim)
     {
         World                world                 = GameManager.Instance.World;
         Vector3              _position             = _player.GetPosition();
         int                  x                     = (int)_position.x;
         int                  y                     = (int)_position.y;
         int                  z                     = (int)_position.z;
         Vector3i             _vec3i                = new Vector3i(x, y, z);
         PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
         PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
         EnumLandClaimOwner   _owner                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
         {
             string _vehicleName = "";
             string _messageName = "";
             if (_vehicle == 1)
             {
                 _vehicleName = "vehicleBicycle";
                 _messageName = "bike";
             }
             if (_vehicle == 2)
             {
                 _vehicleName = "vehicleMinibike";
                 _messageName = "minibike";
             }
             if (_vehicle == 3)
             {
                 _vehicleName = "vehicleMotorcycle";
                 _messageName = "motorbike";
             }
             if (_vehicle == 4)
             {
                 _vehicleName = "vehicle4x4Truck";
                 _messageName = "jeep";
             }
             if (_vehicle == 5)
             {
                 _vehicleName = "vehicleGyrocopter";
                 _messageName = "gyro";
             }
             if (_player.AttachedToEntity.EntityClass.entityClassName.ToString() == _vehicleName)
             {
                 string _phrase781;
                 if (!Phrases.Dict.TryGetValue(781, out _phrase781))
                 {
                     _phrase781 = " saved your current vehicle for retrieval.";
                 }
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 string _sql = "";
                 if (_vehicle == 1)
                 {
                     _sql = string.Format("UPDATE Vehicles SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 2)
                 {
                     _sql = string.Format("UPDATE Vehicles SET miniBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 3)
                 {
                     _sql = string.Format("UPDATE Vehicles SET motorBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 4)
                 {
                     _sql = string.Format("UPDATE Vehicles SET jeepId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 5)
                 {
                     _sql = string.Format("UPDATE Vehicles SET gyroId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 SQL.FastQuery(_sql, "VehicleTeleport");
             }
             else
             {
                 string _phrase787;
                 if (!Phrases.Dict.TryGetValue(787, out _phrase787))
                 {
                     _phrase787 = " you are on the wrong vehicle to save it with this command. You are using a {Vehicle}.";
                 }
                 _phrase787 = _phrase787.Replace("{Vehicle}", _messageName);
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase787 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         else
         {
             string _phrase780;
             if (!Phrases.Dict.TryGetValue(780, out _phrase780))
             {
                 _phrase780 = " you have not claimed this space or a friend. You can only save your vehicle inside a claimed space.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase780 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         string _vehicleName = "";
         string _messageName = "";
         if (_vehicle == 1)
         {
             _vehicleName = "vehicleBicycle";
             _messageName = "bike";
         }
         if (_vehicle == 2)
         {
             _vehicleName = "vehicleMinibike";
             _messageName = "minibike";
         }
         if (_vehicle == 3)
         {
             _vehicleName = "vehicleMotorcycle";
             _messageName = "motorbike";
         }
         if (_vehicle == 4)
         {
             _vehicleName = "vehicle4x4Truck";
             _messageName = "jeep";
         }
         if (_vehicle == 5)
         {
             _vehicleName = "vehicleGyrocopter";
             _messageName = "gyro";
         }
         if (_player.AttachedToEntity.name == _vehicleName)
         {
             string _phrase781;
             if (!Phrases.Dict.TryGetValue(781, out _phrase781))
             {
                 _phrase781 = " saved your current vehicle for retrieval.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             string _sql = "";
             if (_vehicle == 1)
             {
                 _sql = string.Format("UPDATE Vehicles SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 2)
             {
                 _sql = string.Format("UPDATE Vehicles SET miniBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 3)
             {
                 _sql = string.Format("UPDATE Vehicles SET motorBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 4)
             {
                 _sql = string.Format("UPDATE Vehicles SET jeepId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 5)
             {
                 _sql = string.Format("UPDATE Vehicles SET gyroId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             SQL.FastQuery(_sql, "VehicleTeleport");
         }
         else
         {
             string _phrase787;
             if (!Phrases.Dict.TryGetValue(787, out _phrase787))
             {
                 _phrase787 = " you are on the wrong vehicle to save it with this command. You are using a {Vehicle}.";
             }
             _phrase787 = _phrase787.Replace("{Vehicle}", _messageName);
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase787 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }