コード例 #1
0
 public async Task SellHouse(IPlayer player, int houseId)
 {
     try
     {
         if (player == null || !player.Exists || houseId <= 0)
         {
             return;
         }
         int charId = (int)player.GetCharacterMetaId();
         if (charId <= 0)
         {
             return;
         }
         if (!ServerHouses.ExistHouse(houseId) || ServerHouses.GetHouseOwner(houseId) != charId)
         {
             HUDHandler.SendNotification(player, 4, 3500, "Fehler: Dieses Haus gehört nicht dir."); return;
         }
         if (!CharactersBank.HasCharacterBankMainKonto(charId))
         {
             HUDHandler.SendNotification(player, 3, 2500, "Du besitzt kein Haupt-Bankkonto"); return;
         }
         int accNumber  = CharactersBank.GetCharacterBankMainKonto(charId);
         int housePrice = ServerHouses.GetHousePrice(houseId) / 2;
         if (!CharactersBank.ExistBankAccountNumber(accNumber))
         {
             return;
         }
         ServerHouses.SetHouseLocked(houseId, true);
         ServerHouses.SetHouseOwner(houseId, 0);
         CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) + housePrice);
         HUDHandler.SendNotification(player, 2, 2500, $"Haus erfolgreich für {housePrice}$ (50% Kaufpreis) verkauft.");
         ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Immobilienmakler", $"Hausverkauf: {ServerHouses.GetHouseStreet(houseId)}", $"+{housePrice}$", "Online-Banking");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #2
0
 internal static void LockHouse(IPlayer player, int houseId)
 {
     try
     {
         if (player == null || houseId <= 0 || !player.Exists)
         {
             return;
         }
         int charId = (int)player.GetCharacterMetaId();
         if (charId <= 0)
         {
             return;
         }
         if (!ServerHouses.ExistHouse(houseId))
         {
             return;
         }
         if (ServerHouses.GetHouseOwner(houseId) != charId && !ServerHouses.IsCharacterRentedInHouse(charId, houseId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Dieses Haus gehört nicht dir und / oder du bist nicht eingemietet."); return;
         }
         bool lockState = ServerHouses.IsHouseLocked(houseId);
         ServerHouses.SetHouseLocked(houseId, !lockState);
         if (lockState)
         {
             HUDHandler.SendNotification(player, 2, 2500, "Du hast das Haus aufgeschlossen.");
         }
         else
         {
             HUDHandler.SendNotification(player, 3, 2500, "Du hast das Haus abgeschlossen.");
         }
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #3
0
        internal static async void BreakIntoHouse(IPlayer player, int houseId)
        {
            //Funktion: um in andere Häuser einzubrechen
            try
            {
                if (player == null || !player.Exists || houseId <= 0 || player.Dimension < 0 || player.Dimension > 0 || player.IsInVehicle)
                {
                    return;
                }
                int charId = (int)player.GetCharacterMetaId();
                if (charId <= 0)
                {
                    return;
                }
                if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                {
                    HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                }
                if (!ServerHouses.ExistHouse(houseId) || ServerHouses.GetHouseOwner(houseId) <= 0 || !ServerHouses.IsHouseLocked(houseId))
                {
                    return;
                }
                if (!CharactersInventory.ExistCharacterItem(charId, "Brecheisen", "inventory") && !CharactersInventory.ExistCharacterItem(charId, "Brecheisen", "backpack"))
                {
                    return;
                }
                if (ServerFactions.GetFactionDutyMemberCount(2) < 6)
                {
                    HUDHandler.SendNotification(player, 3, 5000, "Es sind nicht genügend Beamte im Dienst (6)."); return;
                }
                if (!player.IsPlayerUsingCrowbar())
                {
                    int houseOwner = ServerHouses.GetHouseOwner(houseId);
                    if (houseOwner <= 0)
                    {
                        return;
                    }
                    //Aufbrechen Starten
                    if (DateTime.Now.Subtract(Convert.ToDateTime(Characters.GetCharacterLastLogin(houseOwner))).TotalHours >= 48)
                    {
                        HUDHandler.SendNotification(player, 4, 5000, "Fehler: Der Hausbesitzer war in den letzten 48 Stunden nicht online."); return;
                    }
                    Position curPos           = player.Position;
                    int      duration         = 300000;
                    var      houseOwnerPlayer = Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x != null && x.Exists && x.GetCharacterMetaId() == (ulong)houseOwner);
                    if (ServerHouses.HasHouseAlarmUpgrade(houseId))
                    {
                        ServerFactions.createFactionDispatch(player, 2, $"Hauseinbruch: {ServerHouses.GetHouseStreet(houseId)}", $"Ein Einbruch in ein Haus wurde gemeldet - ein Dispatch wurde dazu in der Notrufverwaltung angelegt.");
                        if (houseOwnerPlayer != null && (CharactersInventory.ExistCharacterItem(houseOwner, "Tablet", "inventory") || CharactersInventory.ExistCharacterItem(houseOwner, "Tablet", "backpack")))
                        {
                            HUDHandler.SendNotification(houseOwnerPlayer, 3, 3500, $"Jemand bricht in dein Haus ein: {ServerHouses.GetHouseStreet(houseId)}");
                            HUDHandler.SendNotification(houseOwnerPlayer, 3, 3500, $"Jemand bricht in dein Haus ein: {ServerHouses.GetHouseStreet(houseId)}");
                            HUDHandler.SendNotification(houseOwnerPlayer, 3, 3500, $"Jemand bricht in dein Haus ein: {ServerHouses.GetHouseStreet(houseId)}");
                        }
                    }
                    player.GiveWeapon(WeaponModel.Crowbar, 1, true);
                    player.SetPlayerUsingCrowbar(true);
                    //ToDo: Animation
                    HUDHandler.SendNotification(player, 1, duration, "Aufbrechen des Hauses begonnen (5 Minuten)...");
                    await Task.Delay(duration);

                    if (player == null || !player.Exists)
                    {
                        return;
                    }
                    if (!player.Position.IsInRange(curPos, 3f))
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Aufbrechen abgebrochen, du bist zu weit entfernt."); player.SetPlayerUsingCrowbar(false); player.RemoveWeapon(WeaponModel.Crowbar); return;
                    }
                    if (!player.IsPlayerUsingCrowbar())
                    {
                        return;
                    }
                    player.RemoveWeapon(WeaponModel.Crowbar);
                    ServerHouses.SetHouseLocked(houseId, false);
                    HUDHandler.SendNotification(player, 2, 2500, "Haus aufgebrochen, beeil dich.");
                    player.SetPlayerUsingCrowbar(false);
                    return;
                }
                else
                {
                    //Einbruch: Abbrechen
                    player.EmitLocked("Client:Inventory:StopAnimation");
                    HUDHandler.SendNotification(player, 2, 1500, "Du hast den Einbruch abgebrochen.");
                    player.SetPlayerUsingCrowbar(false);
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }