Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop

This commit is contained in:
2021-04-10 23:25:56 +02:00
4 changed files with 25 additions and 17 deletions

View File

@@ -67,7 +67,7 @@ namespace ReallifeGamemode.Server.Core.Managers
else else
{ {
//houseBlips[house.Id] = NAPI.Blip.CreateBlip(40, house.Position, 0.7f, 11, "Haus", shortRange: true); too many blips //houseBlips[house.Id] = NAPI.Blip.CreateBlip(40, house.Position, 0.7f, 11, "Haus", shortRange: true); too many blips
houseBlips[house.Id] = Api.Blip.CreateBlip(40, house.Position, "Haus", 11, 0.7f, shortRange: true); houseBlips[house.Id] = Api.Blip.CreateBlip(40, house.Position, "Haus", 11, 0.5f, shortRange: true);
} }
houseLabels[house.Id] = Api.TextLabel.CreateTextLabel(text, housePos, 10f, 1f, 0, new Color(255, 255, 255)); houseLabels[house.Id] = Api.TextLabel.CreateTextLabel(text, housePos, 10f, 1f, 0, new Color(255, 255, 255));

View File

@@ -97,7 +97,7 @@ namespace ReallifeGamemode.Server.Events
user.Dead = true; user.Dead = true;
if (!player.HasData("reviveSperre") || !player.HasData("inGangWar") || player.GetData<bool>("SAdminduty") == true) if (!player.HasData("reviveSperre") && !player.HasData("inGangWar") && player.GetData<bool>("SAdminduty") == false)
{ {
//MEDIC AUFTRAG //MEDIC AUFTRAG
MedicTask reviveTask = new MedicTask() MedicTask reviveTask = new MedicTask()

View File

@@ -40,12 +40,12 @@ namespace ReallifeGamemode.Server.Gangwar
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray())); NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
foreach (var l in NAPI.Pools.GetAllPlayers()) foreach (var l in NAPI.Pools.GetAllPlayers())
{ {
if (!l.IsLoggedIn() && !l.GetUser().FactionLeader) if (l.IsLoggedIn() && l.GetUser()?.FactionLeader == true)
return; {
l.TriggerEvent("CLIENT:Turf_LoadLeaderBlip"); l.TriggerEvent("CLIENT:Turf_LoadLeaderBlip");
} }
} }
}
public static void GangwarKill(Player killer, Player victim) public static void GangwarKill(Player killer, Player victim)
{ {

View File

@@ -243,10 +243,22 @@ namespace ReallifeGamemode.Server.Gangwar
this.timer = null; this.timer = null;
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{ {
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction?.Name == this.Owner).ToArray();
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction?.Name == this.Attacker).ToArray();
Faction ownerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault();
Faction attackerFaction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).FirstOrDefault();
if (ownerFaction == null || attackerFaction == null)
{
return;
}
if (getOwner() == FactionName) if (getOwner() == FactionName)
{ {
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray(); ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", ownerFaction);
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray(); ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", attackerFaction);
foreach (var o in owners) foreach (var o in owners)
{ {
o.TriggerEvent("CLIENT:win"); o.TriggerEvent("CLIENT:win");
@@ -255,15 +267,12 @@ namespace ReallifeGamemode.Server.Gangwar
{ {
a.TriggerEvent("CLIENT:loose"); a.TriggerEvent("CLIENT:loose");
} }
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", dbContext.Factions.Where(f => f.Name == getOwner()).FirstOrDefault()); ownerFaction.BankAccount.Balance += 15000;
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", dbContext.Factions.Where(f => f.Name == getAttacker()).FirstOrDefault());
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).First().BankAccount.Balance += 15000;
} }
else if (getOwner() != FactionName) else if (getOwner() != FactionName)
{ {
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", dbContext.Factions.Where(f => f.Name == getOwner()).FirstOrDefault()); ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", ownerFaction);
Player[] owners = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Owner).ToArray(); ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", attackerFaction);
Player[] attackers = NAPI.Pools.GetAllPlayers().Where(c => c.IsLoggedIn() && c.GetUser().Faction.Name == this.Attacker).ToArray();
foreach (var o in owners) foreach (var o in owners)
{ {
if (o != null) if (o != null)
@@ -275,11 +284,10 @@ namespace ReallifeGamemode.Server.Gangwar
a.TriggerEvent("CLIENT:win"); a.TriggerEvent("CLIENT:win");
} }
this.Owner = FactionName; this.Owner = FactionName;
ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", dbContext.Factions.Where(f => f.Name == getOwner()).FirstOrDefault()); attackerFaction.BankAccount.Balance += 10000;
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Name == getOwner()).First().BankAccount.Balance += 10000;
Turfs turf = dbContext.Turfs.Where(t => t.Id == getId()).FirstOrDefault(); Turfs turf = dbContext.Turfs.Where(t => t.Id == getId()).FirstOrDefault();
turf.Owner = this.Owner; turf.Owner = this.Owner;
turf.FactionId = dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault().Id; turf.FactionId = attackerFaction.Id;
} }
dbContext.SaveChanges(); dbContext.SaveChanges();
} }