Merge branch 'develop' into 'feature/onlinelist'
Develop See merge request log-gtav/reallife-gamemode!56
This commit is contained in:
@@ -26,13 +26,24 @@
|
|||||||
}
|
}
|
||||||
let pBlip = playerBlipMap.get(player);
|
let pBlip = playerBlipMap.get(player);
|
||||||
if (player.isDead()) {
|
if (player.isDead()) {
|
||||||
pBlip.setSprite(303);
|
pBlip.setSprite(274);
|
||||||
|
pBlip.setScale(0.7);
|
||||||
} else {
|
} else {
|
||||||
pBlip.setSprite(1);
|
pBlip.setSprite(1);
|
||||||
|
pBlip.setScale(0.7);
|
||||||
}
|
}
|
||||||
let color = player.getVariable("blipColor");
|
let color = player.getVariable("blipColor");
|
||||||
pBlip.setColour(isNaN(color) ? 0 : color);
|
|
||||||
pBlip.setPosition(player.position.x, player.position.y, player.position.z);
|
if (color == -1) {
|
||||||
|
pBlip.setAlpha(0);
|
||||||
|
player.setAlpha(0);
|
||||||
|
} else {
|
||||||
|
pBlip.setAlpha(200);
|
||||||
|
player.setAlpha(255);
|
||||||
|
|
||||||
|
pBlip.setColour(isNaN(color) ? 0 : color);
|
||||||
|
pBlip.setPosition(player.position.x, player.position.y, player.position.z);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ export default function (globalData: IGlobalData): void {
|
|||||||
var draw = false;
|
var draw = false;
|
||||||
var editMode = false;
|
var editMode = false;
|
||||||
var adutyMode = false;
|
var adutyMode = false;
|
||||||
|
var adminUnshow = false;
|
||||||
|
var adminTSupport = false;
|
||||||
var dutyMode = false;
|
var dutyMode = false;
|
||||||
let jailTime = 0;
|
let jailTime = 0;
|
||||||
let att_score = 0;
|
let att_score = 0;
|
||||||
@@ -62,6 +64,14 @@ export default function (globalData: IGlobalData): void {
|
|||||||
adutyMode = toggle;
|
adutyMode = toggle;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mp.events.add('toggleTSupportMode', (toggle) => {
|
||||||
|
adminTSupport = toggle;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('toggleAdminUnshowMode', (toggle) => {
|
||||||
|
adminUnshow = toggle;
|
||||||
|
});
|
||||||
|
|
||||||
mp.events.add("toggleEditMode", (toggle) => {
|
mp.events.add("toggleEditMode", (toggle) => {
|
||||||
editMode = toggle;
|
editMode = toggle;
|
||||||
});
|
});
|
||||||
@@ -300,16 +310,6 @@ export default function (globalData: IGlobalData): void {
|
|||||||
centre: false
|
centre: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (adutyMode === true) {
|
|
||||||
mp.game.graphics.drawText("~r~SUPPORT", [0.92, 0.6],
|
|
||||||
{
|
|
||||||
font: 2,
|
|
||||||
color: [0, 255, 255, 255],
|
|
||||||
scale: [0.7, 0.7],
|
|
||||||
outline: true,
|
|
||||||
centre: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (dutyMode === true) {
|
if (dutyMode === true) {
|
||||||
mp.game.graphics.drawText("~r~Duty", [0.92, 0.55],
|
mp.game.graphics.drawText("~r~Duty", [0.92, 0.55],
|
||||||
{
|
{
|
||||||
@@ -320,7 +320,31 @@ export default function (globalData: IGlobalData): void {
|
|||||||
centre: false
|
centre: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (adutyMode === true) {
|
||||||
|
var adutyText = "~r~SUPPORT";
|
||||||
|
if (adminTSupport) {
|
||||||
|
adutyText = "SUPPORT";
|
||||||
|
}
|
||||||
|
mp.game.graphics.drawText(adutyText, [0.92, 0.6],
|
||||||
|
{
|
||||||
|
font: 2,
|
||||||
|
color: [0, 229, 238, 255],
|
||||||
|
scale: [0.7, 0.7],
|
||||||
|
outline: true,
|
||||||
|
centre: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (adminUnshow) {
|
||||||
|
mp.game.graphics.drawText("~r~UNSHOW", [0.92, 0.65],
|
||||||
|
{
|
||||||
|
font: 2,
|
||||||
|
color: [0, 255, 255, 255],
|
||||||
|
scale: [0.7, 0.7],
|
||||||
|
outline: true,
|
||||||
|
centre: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (countdown > 0) {
|
if (countdown > 0) {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var diff = Math.trunc((now - cdTimestamp) / 1000);
|
var diff = Math.trunc((now - cdTimestamp) / 1000);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const colors = [
|
|||||||
{ id: 2, color: [200, 0, 0, alpha] }, //lsed
|
{ id: 2, color: [200, 0, 0, alpha] }, //lsed
|
||||||
{ id: 3, color: [0, 0, 170, alpha] }, //fib
|
{ id: 3, color: [0, 0, 170, alpha] }, //fib
|
||||||
{ id: 4, color: [255, 180, 0, alpha] }, //trucker
|
{ id: 4, color: [255, 180, 0, alpha] }, //trucker
|
||||||
{ id: 5, color: [255, 255, 255, alpha] }, //terroristen
|
{ id: 5, color: [255, 255, 100, alpha] }, //vagos
|
||||||
{ id: 6, color: [255, 255, 255, alpha] }, //hitman
|
{ id: 6, color: [255, 255, 255, alpha] }, //hitman
|
||||||
{ id: 7, color: [0, 64, 0, alpha] }, //grove
|
{ id: 7, color: [0, 64, 0, alpha] }, //grove
|
||||||
{ id: 8, color: [171, 0, 150, alpha] }, //ballas
|
{ id: 8, color: [171, 0, 150, alpha] }, //ballas
|
||||||
@@ -49,6 +49,10 @@ export default function customNametags() {
|
|||||||
|
|
||||||
let colorId = game.players.at(player.remoteId).nametagColor;
|
let colorId = game.players.at(player.remoteId).nametagColor;
|
||||||
|
|
||||||
|
if (colorId === -3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let color = colors.find(c => c.id === colorId).color;
|
let color = colors.find(c => c.id === colorId).color;
|
||||||
|
|
||||||
let nametagText = player.name + " (" + player.remoteId + ")";
|
let nametagText = player.name + " (" + player.remoteId + ")";
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (afkCounter >= 30) {
|
if (afkCounter >= 60) {
|
||||||
afkStatus = true;
|
afkStatus = true;
|
||||||
globalData.IsAfk = afkStatus;
|
globalData.IsAfk = afkStatus;
|
||||||
setServerAfkStatus(afkStatus);
|
setServerAfkStatus(afkStatus);
|
||||||
|
|||||||
@@ -183,6 +183,8 @@
|
|||||||
var loop = Behaviour.secs()
|
var loop = Behaviour.secs()
|
||||||
|
|
||||||
mp.events.add("render", () => {
|
mp.events.add("render", () => {
|
||||||
|
mp.game.player.setHealthRechargeMultiplier(0);
|
||||||
|
|
||||||
Behaviour.health = Number(mp.players.local.getHealth()) + Number(mp.players.local.getArmour())
|
Behaviour.health = Number(mp.players.local.getHealth()) + Number(mp.players.local.getArmour())
|
||||||
if (loop < Behaviour.secs()) {
|
if (loop < Behaviour.secs()) {
|
||||||
if (Behaviour.active) {
|
if (Behaviour.active) {
|
||||||
|
|||||||
@@ -111,6 +111,11 @@
|
|||||||
self.colorZone_r = 22;
|
self.colorZone_r = 22;
|
||||||
self.colorZone_g = 87;
|
self.colorZone_g = 87;
|
||||||
self.colorZone_b = 0;
|
self.colorZone_b = 0;
|
||||||
|
} else if (owner === "Vagos") {
|
||||||
|
self.color = 33;
|
||||||
|
self.colorZone_r = 255;
|
||||||
|
self.colorZone_g = 255;
|
||||||
|
self.colorZone_b = 100;
|
||||||
} else if (owner === "Neutral") {
|
} else if (owner === "Neutral") {
|
||||||
self.color = 0;
|
self.color = 0;
|
||||||
self.colorZone_r = 255;
|
self.colorZone_r = 255;
|
||||||
|
|||||||
23
ReallifeGamemode.Database/Entities/Logs/Chat/ChatLogEntry.cs
Normal file
23
ReallifeGamemode.Database/Entities/Logs/Chat/ChatLogEntry.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public abstract class ChatLogEntry
|
||||||
|
{
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(UserId))]
|
||||||
|
public User User { get; set; }
|
||||||
|
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class DepartmentChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class FactionChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Faction))]
|
||||||
|
public int FactionId { get; set; }
|
||||||
|
|
||||||
|
public Faction Faction { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class GangChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class GroupChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
public int GroupId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(GroupId))]
|
||||||
|
public Group Group { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class LeaderChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class LocalChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class NewsChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs.Chat
|
||||||
|
{
|
||||||
|
public class OChatLogEntry : ChatLogEntry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
19
ReallifeGamemode.Database/Entities/Logs/CommandLogEntry.cs
Normal file
19
ReallifeGamemode.Database/Entities/Logs/CommandLogEntry.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs
|
||||||
|
{
|
||||||
|
public class CommandLogEntry
|
||||||
|
{
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public User User { get; set; }
|
||||||
|
|
||||||
|
public string Command { get; set; }
|
||||||
|
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
30
ReallifeGamemode.Database/Entities/Logs/LogEntry.cs
Normal file
30
ReallifeGamemode.Database/Entities/Logs/LogEntry.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs
|
||||||
|
{
|
||||||
|
public class LogEntry
|
||||||
|
{
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public User User { get; set; }
|
||||||
|
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
public User AffectedBy { get; set; }
|
||||||
|
|
||||||
|
public int? AffectedById { get; set; }
|
||||||
|
|
||||||
|
public Faction AffectedFaction { get; set; }
|
||||||
|
|
||||||
|
public int? AffectedFactionId { get; set; }
|
||||||
|
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Entities.Logs
|
||||||
|
{
|
||||||
|
public class LoginLogoutLogEntry
|
||||||
|
{
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public string Username { get; set; }
|
||||||
|
|
||||||
|
public string SocialClubName { get; set; }
|
||||||
|
|
||||||
|
public User User { get; set; }
|
||||||
|
|
||||||
|
public long PlayerId { get; set; }
|
||||||
|
|
||||||
|
public string IpAddress { get; set; }
|
||||||
|
|
||||||
|
public bool LoginLogout { get; set; }
|
||||||
|
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
2010
ReallifeGamemode.Database/Migrations/20210419090246_CommandLogs.Designer.cs
generated
Normal file
2010
ReallifeGamemode.Database/Migrations/20210419090246_CommandLogs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class CommandLogs : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CommandLogs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
UserId = table.Column<int>(nullable: true),
|
||||||
|
Command = table.Column<string>(nullable: true),
|
||||||
|
Time = table.Column<DateTime>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CommandLogs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CommandLogs_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CommandLogs_UserId",
|
||||||
|
table: "CommandLogs",
|
||||||
|
column: "UserId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CommandLogs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2051
ReallifeGamemode.Database/Migrations/20210419100958_LoginLogoutLogs.Designer.cs
generated
Normal file
2051
ReallifeGamemode.Database/Migrations/20210419100958_LoginLogoutLogs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class LoginLogoutLogs : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "LoginLogoutLogs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Username = table.Column<string>(nullable: true),
|
||||||
|
SocialClubName = table.Column<string>(nullable: true),
|
||||||
|
UserId = table.Column<int>(nullable: true),
|
||||||
|
PlayerId = table.Column<long>(nullable: false),
|
||||||
|
IpAddress = table.Column<string>(nullable: true),
|
||||||
|
LoginLogout = table.Column<bool>(nullable: false),
|
||||||
|
Time = table.Column<DateTime>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_LoginLogoutLogs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_LoginLogoutLogs_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_LoginLogoutLogs_UserId",
|
||||||
|
table: "LoginLogoutLogs",
|
||||||
|
column: "UserId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "LoginLogoutLogs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2167
ReallifeGamemode.Database/Migrations/20210419104509_ChatLogs.Designer.cs
generated
Normal file
2167
ReallifeGamemode.Database/Migrations/20210419104509_ChatLogs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class ChatLogs : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ChatLogs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
UserId = table.Column<int>(nullable: true),
|
||||||
|
Text = table.Column<string>(nullable: true),
|
||||||
|
Time = table.Column<DateTime>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Discriminator = table.Column<string>(nullable: false),
|
||||||
|
FactionId = table.Column<int>(nullable: true),
|
||||||
|
GroupId = table.Column<int>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ChatLogs", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ChatLogs_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ChatLogs_Factions_FactionId",
|
||||||
|
column: x => x.FactionId,
|
||||||
|
principalTable: "Factions",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ChatLogs_Groups_GroupId",
|
||||||
|
column: x => x.GroupId,
|
||||||
|
principalTable: "Groups",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ChatLogs_UserId",
|
||||||
|
table: "ChatLogs",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ChatLogs_FactionId",
|
||||||
|
table: "ChatLogs",
|
||||||
|
column: "FactionId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ChatLogs_GroupId",
|
||||||
|
table: "ChatLogs",
|
||||||
|
column: "GroupId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ChatLogs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -797,6 +797,57 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
b.ToTable("BankAccountTransactionLogs");
|
b.ToTable("BankAccountTransactionLogs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Discriminator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Time")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int?>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("ChatLogs");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("Discriminator").HasValue("ChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.CommandLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Command")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Time")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int?>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("CommandLogs");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -850,6 +901,40 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
b.ToTable("DeathLogs");
|
b.ToTable("DeathLogs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.LoginLogoutLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("IpAddress")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.Property<bool>("LoginLogout")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<long>("PlayerId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("SocialClubName")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Time")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int?>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("LoginLogoutLogs");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -1653,6 +1738,72 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
b.ToTable("WhitelistEntries");
|
b.ToTable("WhitelistEntries");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.DepartmentChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("DepartmentChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.FactionChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.Property<int?>("FactionId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasIndex("FactionId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("FactionChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GangChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("GangChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GroupChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.Property<int?>("GroupId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("GroupChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.LeaderChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("LeaderChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.LocalChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("LocalChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.NewsChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("NewsChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.OChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("OChatLogEntry");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle");
|
b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle");
|
||||||
@@ -1856,6 +2007,20 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
.HasForeignKey("UserId");
|
.HasForeignKey("UserId");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.CommandLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "Killer")
|
b.HasOne("ReallifeGamemode.Database.Entities.User", "Killer")
|
||||||
@@ -1869,6 +2034,13 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.LoginLogoutLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||||
@@ -1958,6 +2130,20 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.FactionChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("FactionId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GroupChatLogEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GroupId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group")
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace ReallifeGamemode.Database.Models
|
|||||||
e.HasIndex(u => u.Name)
|
e.HasIndex(u => u.Name)
|
||||||
.IsUnique(true);
|
.IsUnique(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
modelBuilder.Entity<Entities.ServerVehicle>()
|
modelBuilder.Entity<Entities.ServerVehicle>()
|
||||||
.Property(sv => sv.Active)
|
.Property(sv => sv.Active)
|
||||||
@@ -87,7 +87,7 @@ namespace ReallifeGamemode.Database.Models
|
|||||||
public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
|
public DbSet<Entities.FactionVehicle> FactionVehicles { get; set; }
|
||||||
|
|
||||||
//Shops
|
//Shops
|
||||||
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
public DbSet<Entities.ShopClothe> ShopClothes { get; set; }
|
||||||
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
public DbSet<Entities.ShopItem> ShopItems { get; set; }
|
||||||
public DbSet<Entities.Weapon> Weapons { get; set; }
|
public DbSet<Entities.Weapon> Weapons { get; set; }
|
||||||
public DbSet<Entities.WeaponCategory> WeaponCategories { get; set; }
|
public DbSet<Entities.WeaponCategory> WeaponCategories { get; set; }
|
||||||
@@ -97,6 +97,21 @@ namespace ReallifeGamemode.Database.Models
|
|||||||
//public DbSet<Logs.Ban> BanLogs { get; set; }
|
//public DbSet<Logs.Ban> BanLogs { get; set; }
|
||||||
public DbSet<Entities.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
|
public DbSet<Entities.Logs.BankAccountTransactionHistory> BankAccountTransactionLogs { get; set; }
|
||||||
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
|
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.CommandLogEntry> CommandLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.LoginLogoutLogEntry> LoginLogoutLogs { get; set; }
|
||||||
|
|
||||||
|
// Chat Logs
|
||||||
|
|
||||||
|
public DbSet<Entities.Logs.Chat.ChatLogEntry> ChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.FactionChatLogEntry> FactionChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.DepartmentChatLogEntry> DepartmentChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.GangChatLogEntry> GangChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.GroupChatLogEntry> GroupChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.LeaderChatLogEntry> LeaderChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.LocalChatLogEntry> LocalChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.NewsChatLogEntry> NewsChatLogs { get; set; }
|
||||||
|
public DbSet<Entities.Logs.Chat.OChatLogEntry> OChatLogs { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//Saves
|
//Saves
|
||||||
public DbSet<Entities.ATM> ATMs { get; set; }
|
public DbSet<Entities.ATM> ATMs { get; set; }
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using ReallifeGamemode.Server.Types;
|
|||||||
using ReallifeGamemode.Server.Common;
|
using ReallifeGamemode.Server.Common;
|
||||||
using ReallifeGamemode.Server.Log;
|
using ReallifeGamemode.Server.Log;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs;
|
||||||
|
using ReallifeGamemode.Server.Core.Extensions;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Core.Commands
|
namespace ReallifeGamemode.Server.Core.Commands
|
||||||
{
|
{
|
||||||
@@ -33,6 +35,18 @@ namespace ReallifeGamemode.Server.Core.Commands
|
|||||||
|
|
||||||
logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command);
|
logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command);
|
||||||
|
|
||||||
|
using var dbContext = Main.GetDbContext();
|
||||||
|
|
||||||
|
var commandLogEntry = new CommandLogEntry()
|
||||||
|
{
|
||||||
|
Command = "/" + string.Join(' ', args),
|
||||||
|
Time = DateTime.Now,
|
||||||
|
User = player.GetUser(dbContext)
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.CommandLogs.Add(commandLogEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
if (legacyCommands.Contains(command))
|
if (legacyCommands.Contains(command))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using GTANetworkAPI;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs.Chat;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Business;
|
using ReallifeGamemode.Server.Business;
|
||||||
using ReallifeGamemode.Server.Classes;
|
using ReallifeGamemode.Server.Classes;
|
||||||
@@ -258,11 +259,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
if (player.GetData<bool>("SAdminduty") == false)
|
if (player.GetData<bool>("SAdminduty") == false)
|
||||||
{
|
{
|
||||||
|
player.TriggerEvent("toggleTSupportMode", true);
|
||||||
player.SetData("SAdminduty", true);
|
player.SetData("SAdminduty", true);
|
||||||
ChatService.SendMessage(player, "~g~ ** " + "Du befindest dich im T-Support");
|
ChatService.SendMessage(player, "~g~ ** " + "Du befindest dich im T-Support");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
player.TriggerEvent("toggleTSupportMode", false);
|
||||||
player.SetData("SAdminduty", false);
|
player.SetData("SAdminduty", false);
|
||||||
ChatService.SendMessage(player, "!{#ee4d2e}** " + "Du befindest dich nicht mehr im T-Support");
|
ChatService.SendMessage(player, "!{#ee4d2e}** " + "Du befindest dich nicht mehr im T-Support");
|
||||||
}
|
}
|
||||||
@@ -302,13 +305,31 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdAdminO(Player player, string message)
|
public void CmdAdminO(Player player, string message)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
if(!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
if (!user.IsAdmin(AdminLevel.SUPPORTER))
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
|
|
||||||
|
var logEntry = new OChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.OChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
message = Regex.Replace(message, "#([0-9A-Fa-f]{6})", m => "!{" + m.Groups[0].Value + "}");
|
message = Regex.Replace(message, "#([0-9A-Fa-f]{6})", m => "!{" + m.Groups[0].Value + "}");
|
||||||
|
|
||||||
string publicMessage = "~b~(( " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + message + " ~b~))";
|
string publicMessage = "~b~(( " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + message + " ~b~))";
|
||||||
@@ -1423,6 +1444,33 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Medic.delReviveTask(target);
|
Medic.delReviveTask(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("aunshow", "~m~Benutzung:~s~ /aunshow")]
|
||||||
|
public void CmdAdminUnshow(Player player)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
if (!user.IsAdmin(AdminLevel.HEADADMIN))
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool currentStatus = user.GetData<bool>("adminUnshow");
|
||||||
|
currentStatus = !currentStatus;
|
||||||
|
user.SetData("adminUnshow", currentStatus);
|
||||||
|
player.TriggerEvent("toggleAdminUnshowMode", currentStatus);
|
||||||
|
|
||||||
|
user.SetBlipAndNametagColor();
|
||||||
|
|
||||||
|
if(currentStatus)
|
||||||
|
{
|
||||||
|
ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun Unshow");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun nicht mehr Unshow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Command("setap", "~m~Benutzung: ~s~/setap [Spieler] (Armor)")]
|
[Command("setap", "~m~Benutzung: ~s~/setap [Spieler] (Armor)")]
|
||||||
public void CmdAdminSetAP(Player player, string name, int armor = 100)
|
public void CmdAdminSetAP(Player player, string name, int armor = 100)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text.RegularExpressions;
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs.Chat;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Admin;
|
using ReallifeGamemode.Server.Admin;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
@@ -30,7 +31,15 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("f", "~m~Benutzung: ~s~/f [Nachricht]", GreedyArg = true)]
|
[Command("f", "~m~Benutzung: ~s~/f [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionF(Player player, string message)
|
public void CmdFactionF(Player player, string message)
|
||||||
{
|
{
|
||||||
Faction f = player.GetUser()?.Faction;
|
if (!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
User user = player.GetUser();
|
||||||
|
|
||||||
|
Faction f = user?.Faction;
|
||||||
if (f == null || f.StateOwned)
|
if (f == null || f.StateOwned)
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
@@ -39,51 +48,78 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
|
|
||||||
string broadcastMessage = "!{02FCFF}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " **";
|
var logEntry = new FactionChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
FactionId = user.Faction.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.FactionChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
string broadcastMessage = "!{02FCFF}** " + user.FactionRank.RankName + " " + player.Name + ": " + message + " **";
|
||||||
ChatService.BroadcastFaction(broadcastMessage, f);
|
ChatService.BroadcastFaction(broadcastMessage, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("ga", "~m~Benutzung: ~s~/ga [Nachricht]", GreedyArg = true)]
|
[Command("ga", "~m~Benutzung: ~s~/ga [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionGA(Player player, string message)
|
public void CmdFactionGA(Player player, string message)
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
if (!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
Faction f = user?.Faction;
|
Faction f = user?.Faction;
|
||||||
if ((f == null || f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN))
|
if ((f == null || !f.GangOwned) && !user.IsAdmin(AdminLevel.ADMIN))
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (f?.Name == "Ballas" || f?.Name == "Grove" || user.IsAdmin(AdminLevel.ADMIN))
|
|
||||||
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
|
|
||||||
|
string rank = string.Empty;
|
||||||
|
|
||||||
|
if (f?.GangOwned == true)
|
||||||
{
|
{
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
rank = user.FactionRank.RankName;
|
||||||
|
|
||||||
string rank = string.Empty;
|
|
||||||
|
|
||||||
if (f?.Name == "Ballas" || f?.Name == "Grove")
|
|
||||||
{
|
|
||||||
rank = player.GetUser().GetFactionRank().RankName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rank = "[ADMIN]";
|
|
||||||
}
|
|
||||||
|
|
||||||
string broadcastMessage = "!{FF0000}** " + rank + " " + player.Name + ": " + message + " **";
|
|
||||||
using (var context = new DatabaseContext())
|
|
||||||
{
|
|
||||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
rank = "[ADMIN]";
|
||||||
|
}
|
||||||
|
|
||||||
|
var logEntry = new GangChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.GangChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
string broadcastMessage = "!{FF0000}** " + rank + " " + player.Name + ": " + message + " **";
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("r", "~m~Benutzung: ~s~/r [Nachricht]", GreedyArg = true)]
|
[Command("r", "~m~Benutzung: ~s~/r [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionR(Player player, string message)
|
public void CmdFactionR(Player player, string message)
|
||||||
{
|
{
|
||||||
Faction f = player.GetUser()?.Faction;
|
if (!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
Faction f = user?.Faction;
|
||||||
if (f == null || !f.StateOwned)
|
if (f == null || !f.StateOwned)
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
@@ -92,6 +128,16 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
|
|
||||||
|
var logEntry = new FactionChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
Faction = user.Faction,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.FactionChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
string broadcastMessage = "!{33AA33}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
|
string broadcastMessage = "!{33AA33}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
|
||||||
ChatService.BroadcastFaction(broadcastMessage, f);
|
ChatService.BroadcastFaction(broadcastMessage, f);
|
||||||
}
|
}
|
||||||
@@ -99,9 +145,16 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("d", "~m~Benutzung: ~s~/d [Nachricht]", GreedyArg = true)]
|
[Command("d", "~m~Benutzung: ~s~/d [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionD(Player player, string message)
|
public void CmdFactionD(Player player, string message)
|
||||||
{
|
{
|
||||||
User u = player.GetUser();
|
if (!player.IsLoggedIn())
|
||||||
Faction f = player.GetUser()?.Faction;
|
{
|
||||||
if ((f == null || !f.StateOwned) && !u.IsAdmin(AdminLevel.ADMIN))
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
Faction f = user?.Faction;
|
||||||
|
if ((f == null || !f.StateOwned) && !user.IsAdmin(AdminLevel.ADMIN))
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
@@ -113,13 +166,22 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
if (f?.StateOwned ?? false)
|
if (f?.StateOwned ?? false)
|
||||||
{
|
{
|
||||||
factionName = u.GetFactionRank().RankName;
|
factionName = user.FactionRank.RankName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
factionName = "[ADMIN]";
|
factionName = "[ADMIN]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logEntry = new DepartmentChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.DepartmentChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **";
|
string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **";
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
@@ -134,23 +196,34 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("news", "~m~Benutzung: ~s~/news [Nachricht]", GreedyArg = true)]
|
[Command("news", "~m~Benutzung: ~s~/news [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionNR(Player player, string message)
|
public void CmdFactionNR(Player player, string message)
|
||||||
{
|
{
|
||||||
Faction f = player.GetUser()?.Faction;
|
if (!player.IsLoggedIn())
|
||||||
if (f == null)
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
Faction f = user?.Faction;
|
||||||
|
if (f == null || f.Id != 9)
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.GetUser().Faction.Id == 9)
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
{
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
|
||||||
|
|
||||||
string broadcastMessage = "!{ff9531}** News Reporter" + " " + player.Name + ": " + message + " **";
|
var logEntry = new NewsChatLogEntry()
|
||||||
ChatService.Broadcast(broadcastMessage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return;
|
Text = message,
|
||||||
}
|
UserId = user.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.NewsChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
string broadcastMessage = "!{ff9531}** News Reporter" + " " + player.Name + ": " + message + " **";
|
||||||
|
ChatService.Broadcast(broadcastMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion NewsReporter commands
|
#endregion NewsReporter commands
|
||||||
@@ -200,7 +273,13 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdFactionLc(Player player, string message)
|
public void CmdFactionLc(Player player, string message)
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
if (!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
if ((user?.FactionId == null || user.FactionLeader == false) && !user.IsAdmin(AdminLevel.ADMIN))
|
if ((user?.FactionId == null || user.FactionLeader == false) && !user.IsAdmin(AdminLevel.ADMIN))
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
@@ -209,10 +288,19 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
|
|
||||||
|
var logEntry = new LeaderChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.LeaderChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
string factionName = string.Empty;
|
string factionName = string.Empty;
|
||||||
if (user.FactionLeader)
|
if (user.FactionLeader)
|
||||||
{
|
{
|
||||||
factionName = player.GetUser().Faction.Name;
|
factionName = user.Faction.Name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -356,7 +444,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
public void CmdFactionMedicHealive(Player player, string receiver, int price = 10)
|
public void CmdFactionMedicHealive(Player player, string receiver, int price = 10)
|
||||||
{
|
{
|
||||||
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
||||||
if(target == null || !target.IsLoggedIn())
|
if (target == null || !target.IsLoggedIn())
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(player);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Text.RegularExpressions;
|
using GTANetworkAPI;
|
||||||
using GTANetworkAPI;
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs.Chat;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
|
|
||||||
@@ -12,14 +14,33 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
[Command("gc", "~m~Benutzung: ~s~/gc [Nachricht]", GreedyArg = true)]
|
[Command("gc", "~m~Benutzung: ~s~/gc [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdGroupG(Player player, string message)
|
public void CmdGroupG(Player player, string message)
|
||||||
{
|
{
|
||||||
Database.Entities.Group group = player.GetUser().Group;
|
if(!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
Group group = user?.Group;
|
||||||
if (group == null)
|
if (group == null)
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
|
||||||
|
var logEntry = new GroupChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = message,
|
||||||
|
UserId = user.Id,
|
||||||
|
GroupId = user.Group.Id
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.GroupChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
message = System.Text.RegularExpressions.Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
message = $"{player.Name}: {message}";
|
message = $"{player.Name}: {message}";
|
||||||
|
|
||||||
ChatService.BroadcastGroup(message, group);
|
ChatService.BroadcastGroup(message, group);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs.Chat;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Events
|
namespace ReallifeGamemode.Server.Events
|
||||||
@@ -9,8 +12,25 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
[ServerEvent(Event.ChatMessage)]
|
[ServerEvent(Event.ChatMessage)]
|
||||||
public void ChatEvent(Player player, string message)
|
public void ChatEvent(Player player, string message)
|
||||||
{
|
{
|
||||||
|
if(!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string serverMsg = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
string serverMsg = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||||
if (serverMsg.Trim().Length == 0) return;
|
if (serverMsg.Trim().Length == 0) return;
|
||||||
|
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
|
||||||
|
var logEntry = new LocalChatLogEntry()
|
||||||
|
{
|
||||||
|
Text = serverMsg,
|
||||||
|
UserId = player.GetUser(dbContext).Id
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.LocalChatLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
NAPI.Player.GetPlayersInRadiusOfPlayer(25, player).ForEach(p =>
|
NAPI.Player.GetPlayersInRadiusOfPlayer(25, player).ForEach(p =>
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}");
|
ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}");
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using ReallifeGamemode.Server.Report;
|
|||||||
using ReallifeGamemode.Server.Factions.Medic;
|
using ReallifeGamemode.Server.Factions.Medic;
|
||||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||||
using ReallifeGamemode.Server.Inventory;
|
using ReallifeGamemode.Server.Inventory;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Event Login (Login.cs)
|
* @overview Life of German Reallife - Event Login (Login.cs)
|
||||||
@@ -40,6 +41,19 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logEntry = new LoginLogoutLogEntry()
|
||||||
|
{
|
||||||
|
LoginLogout = false,
|
||||||
|
User = user,
|
||||||
|
PlayerId = player.Handle.Value,
|
||||||
|
Username = player.Name,
|
||||||
|
SocialClubName = player.SocialClubName,
|
||||||
|
IpAddress = player.Address,
|
||||||
|
Time = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
saveUser.LoginLogoutLogs.Add(logEntry);
|
||||||
|
|
||||||
if (type == DisconnectionType.Left)
|
if (type == DisconnectionType.Left)
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput(player.Name + " left");
|
NAPI.Util.ConsoleOutput(player.Name + " left");
|
||||||
|
|||||||
@@ -22,19 +22,22 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
if (vehicle.HasMarkerBehind())
|
if (vehicle.HasMarkerBehind())
|
||||||
vehicle.RemoveMarkerBehind();
|
vehicle.RemoveMarkerBehind();
|
||||||
|
|
||||||
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
|
if(vehicle != null && !string.IsNullOrEmpty(client.Name))
|
||||||
{
|
{
|
||||||
VehicleManager.lastDriversInVehicle.Add(vehicle, new Dictionary<string, DateTime>());
|
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
|
||||||
}
|
{
|
||||||
|
VehicleManager.lastDriversInVehicle.Add(vehicle, new Dictionary<string, DateTime>());
|
||||||
|
}
|
||||||
|
|
||||||
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
|
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||||
{
|
{
|
||||||
User u = client.GetUser();
|
User u = client.GetUser();
|
||||||
if (u.FactionId != null
|
if (u.FactionId != null
|
||||||
&& veh.GetOwners().Contains(u.FactionId.Value)
|
&& veh.GetOwners().Contains(u.FactionId.Value)
|
||||||
&& (veh.Model == VehicleHash.Burrito3 || veh.Model == VehicleHash.Policet)
|
&& (veh.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || veh.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
&& vehicle.HasData("weaponDeal")
|
&& vehicle.HasData("weaponDeal")
|
||||||
&& vehicle.GetData<bool>("weaponDeal") == true
|
&& vehicle.GetData<bool>("weaponDeal") == true
|
||||||
&& (!vehicle.HasData("WeaponDealLoad") || vehicle.GetData<bool>("WeaponDealLoad") == false))
|
&& (!vehicle.HasData("WeaponDealLoad") || vehicle.GetData<bool>("WeaponDealLoad") == false))
|
||||||
@@ -44,7 +47,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, 3, true, "loadWeaponTransport");
|
CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, 3, true, "loadWeaponTransport");
|
||||||
}
|
}
|
||||||
else if ((u.FactionId != null)
|
else if ((u.FactionId != null)
|
||||||
&& ((VehicleHash)vehicle.Model == VehicleHash.Burrito3 || (VehicleHash)vehicle.Model == VehicleHash.Policet)
|
&& (veh.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || veh.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
&& vehicle.HasData("WeaponDealLoad")
|
&& vehicle.HasData("WeaponDealLoad")
|
||||||
&& vehicle.GetData<bool>("WeaponDealLoad") == true)
|
&& vehicle.GetData<bool>("WeaponDealLoad") == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
{
|
{
|
||||||
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player))
|
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player))
|
||||||
{
|
{
|
||||||
if ((VehicleHash)vehicle.Model == VehicleHash.Burrito3)
|
if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH)
|
||||||
{
|
{
|
||||||
if (WeaponDealManager.checkWeaponDbyVehicle(vehicle))
|
if (WeaponDealManager.checkWeaponDbyVehicle(vehicle))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using ReallifeGamemode.Server.Extensions;
|
|||||||
using ReallifeGamemode.Server.Managers;
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Events
|
namespace ReallifeGamemode.Server.Events
|
||||||
{
|
{
|
||||||
@@ -27,7 +28,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
User u = client.GetUser();
|
User u = client.GetUser();
|
||||||
if ((u.FactionId != null)
|
if ((u.FactionId != null)
|
||||||
&& (veh.GetOwners().Contains(u.FactionId ?? 0))
|
&& (veh.GetOwners().Contains(u.FactionId ?? 0))
|
||||||
&& ((VehicleHash)vehicle.Model == VehicleHash.Burrito3 || (VehicleHash)vehicle.Model == VehicleHash.Policet)
|
&& (veh.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || veh.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
&& vehicle.HasData("weaponDeal")
|
&& vehicle.HasData("weaponDeal")
|
||||||
&& vehicle.GetData<bool>("weaponDeal") == true)
|
&& vehicle.GetData<bool>("weaponDeal") == true)
|
||||||
{
|
{
|
||||||
@@ -35,7 +36,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
client.TriggerEvent("destroyCP");
|
client.TriggerEvent("destroyCP");
|
||||||
}
|
}
|
||||||
else if ((u.FactionId != null)
|
else if ((u.FactionId != null)
|
||||||
&& ((VehicleHash)vehicle.Model == VehicleHash.Burrito3 || (VehicleHash)vehicle.Model == VehicleHash.Policet)
|
&& (veh.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || veh.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
&& vehicle.HasData("WeaponDealLoad")
|
&& vehicle.HasData("WeaponDealLoad")
|
||||||
&& vehicle.GetData<bool>("WeaponDealLoad") == true)
|
&& vehicle.GetData<bool>("WeaponDealLoad") == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
if (user?.FactionId != null)
|
if (user?.FactionId != null)
|
||||||
{
|
{
|
||||||
BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && (user.FactionId == 8 || user.FactionId == 7 || user.FactionId == 1 || user.FactionId == 3));
|
BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && WeaponDealManager.WEAPON_DEAL_FACTIONS.Contains(user.FactionId ?? 0));
|
||||||
if (nearestBehindVehiclePoint != null)
|
if (nearestBehindVehiclePoint != null)
|
||||||
{
|
{
|
||||||
if (player.HasAttachment("ammobox")) return;
|
if (player.HasAttachment("ammobox")) return;
|
||||||
@@ -625,6 +625,15 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(player.GetData<bool>("SellVehicleDecision") == true && player.HasData("VehicleToSell"))
|
||||||
|
{
|
||||||
|
InteractionManager.SellPlayerVehicle(player, player.GetData<int>("VehicleToSell"));
|
||||||
|
player.ResetData("SellVehicleDecision");
|
||||||
|
player.ResetData("VehicleToSell");
|
||||||
|
player.SendNotification("~g~Du hast dein Fahrzeug verkauft");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
User u = player.GetUser();
|
User u = player.GetUser();
|
||||||
|
|
||||||
if (u.JobId == null) return;
|
if (u.JobId == null) return;
|
||||||
@@ -780,6 +789,13 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
Medic.MakeHealDecision(player, false);
|
Medic.MakeHealDecision(player, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (player.GetData<bool>("SellVehicleDecision") == true && player.HasData("VehicleToSell"))
|
||||||
|
{
|
||||||
|
player.ResetData("SellVehicleDecision");
|
||||||
|
player.ResetData("VehicleToSell");
|
||||||
|
player.SendNotification("~r~Du hast den Fahrzeugverkauf abgebrochen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!player.IsInVehicle) return;
|
if (!player.IsInVehicle) return;
|
||||||
if (player.VehicleSeat != 0) return;
|
if (player.VehicleSeat != 0) return;
|
||||||
@@ -806,14 +822,8 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
else if (sV is FactionVehicle fV)
|
else if (sV is FactionVehicle fV)
|
||||||
{
|
{
|
||||||
if (fV.Model == VehicleHash.Burrito3 && u.FactionId == 1
|
if ((fV.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || fV.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 3
|
&& WeaponDealManager.WEAPON_DEAL_FACTIONS.Contains(u.FactionId ?? 0))
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 7
|
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 8
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 1
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 3
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 7
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 8)
|
|
||||||
{
|
{
|
||||||
VehicleStreaming.SetEngineState(v, !state);
|
VehicleStreaming.SetEngineState(v, !state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using ReallifeGamemode.Database.Entities;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Event Login (Login.cs)
|
* @overview Life of German Reallife - Event Login (Login.cs)
|
||||||
@@ -56,6 +57,20 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logEntry = new LoginLogoutLogEntry()
|
||||||
|
{
|
||||||
|
IpAddress = player.Address,
|
||||||
|
User = user,
|
||||||
|
PlayerId = player.Handle.Value,
|
||||||
|
SocialClubName = player.SocialClubName,
|
||||||
|
Username = player.Name,
|
||||||
|
LoginLogout = true,
|
||||||
|
Time = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.LoginLogoutLogs.Add(logEntry);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
player.SetData("dbId", user.Id);
|
player.SetData("dbId", user.Id);
|
||||||
player.Name = username;
|
player.Name = username;
|
||||||
player.TriggerEvent("SERVER:Login_Success");
|
player.TriggerEvent("SERVER:Login_Success");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
|
|||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
using System;
|
using System;
|
||||||
|
using ReallifeGamemode.Database.Entities.Logs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Event Register (Register.cs)
|
* @overview Life of German Reallife - Event Register (Register.cs)
|
||||||
@@ -51,7 +52,20 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var logEntry = new LoginLogoutLogEntry()
|
||||||
|
{
|
||||||
|
IpAddress = player.Address,
|
||||||
|
User = user,
|
||||||
|
PlayerId = player.Handle.Value,
|
||||||
|
SocialClubName = player.SocialClubName,
|
||||||
|
Username = player.Name,
|
||||||
|
LoginLogout = true,
|
||||||
|
Time = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
dbContext.Users.Add(user);
|
dbContext.Users.Add(user);
|
||||||
|
dbContext.LoginLogoutLogs.Add(logEntry);
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
player.SetData("dbId", user.Id);
|
player.SetData("dbId", user.Id);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Types;
|
using ReallifeGamemode.Server.Types;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Events
|
namespace ReallifeGamemode.Server.Events
|
||||||
{
|
{
|
||||||
@@ -38,14 +40,8 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
else if (sV is FactionVehicle fV)
|
else if (sV is FactionVehicle fV)
|
||||||
{
|
{
|
||||||
if (fV.Model == VehicleHash.Burrito3 && u.FactionId == 1
|
if ((fV.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || fV.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 3
|
&& WeaponDealManager.WEAPON_DEAL_FACTIONS.Contains(u.FactionId ?? 0))
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 7
|
|
||||||
|| fV.Model == VehicleHash.Burrito3 && u.FactionId == 8
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 1
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 3
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 7
|
|
||||||
|| fV.Model == VehicleHash.Policet && u.FactionId == 8)
|
|
||||||
{
|
{
|
||||||
VehicleStreaming.SetEngineState(v, !state);
|
VehicleStreaming.SetEngineState(v, !state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,8 +345,14 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool duty = user.GetData<bool>("duty");
|
bool duty = user.GetData<bool>("duty");
|
||||||
|
bool adminUnshow = user.GetData<bool>("adminUnshow");
|
||||||
|
|
||||||
if (player.GetData<bool>("SAdminduty"))
|
if(adminUnshow)
|
||||||
|
{
|
||||||
|
blipColor = -1;
|
||||||
|
nameTagColor = -3;
|
||||||
|
}
|
||||||
|
else if (player.GetData<bool>("SAdminduty"))
|
||||||
{
|
{
|
||||||
blipColor = 30;
|
blipColor = 30;
|
||||||
nameTagColor = -2;
|
nameTagColor = -2;
|
||||||
@@ -378,10 +384,10 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
blipColor = 5;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
blipColor = 33;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using GTANetworkAPI;
|
|||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Managers;
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Extensions
|
namespace ReallifeGamemode.Server.Extensions
|
||||||
{
|
{
|
||||||
@@ -107,7 +108,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 18:
|
case 18:
|
||||||
if ((VehicleHash)vehicle.Model == VehicleHash.Policet)
|
if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
return 1000 * 1000;
|
return 1000 * 1000;
|
||||||
else if ((VehicleHash)vehicle.Model == VehicleHash.Firetruk
|
else if ((VehicleHash)vehicle.Model == VehicleHash.Firetruk
|
||||||
|| (VehicleHash)vehicle.Model == VehicleHash.Pbus
|
|| (VehicleHash)vehicle.Model == VehicleHash.Pbus
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
|||||||
public static void UpdateDutyMedics()
|
public static void UpdateDutyMedics()
|
||||||
{
|
{
|
||||||
|
|
||||||
dutyMedics = NAPI.Pools.GetAllPlayers().Where(c => c.GetData<bool>("duty") == true && c.GetUser().FactionId == 2).ToList().Count;
|
dutyMedics = NAPI.Pools.GetAllPlayers().Where(c => c.IsDuty() == true && c.GetUser().FactionId == 2).ToList().Count;
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", dutyMedics);
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", dutyMedics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
[RemoteEvent("Gangarea:Leave")]
|
[RemoteEvent("Gangarea:Leave")]
|
||||||
public void RmtEvent_TurfLeave(Player client, string jsonId)
|
public void RmtEvent_TurfLeave(Player client, string jsonId)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrEmpty(jsonId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int id = JsonConvert.DeserializeObject<int>(jsonId);
|
int id = JsonConvert.DeserializeObject<int>(jsonId);
|
||||||
|
|
||||||
foreach (var turf in getTurfs())
|
foreach (var turf in getTurfs())
|
||||||
@@ -181,7 +186,13 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
[RemoteEvent("SERVER:StartGangwar")]
|
[RemoteEvent("SERVER:StartGangwar")]
|
||||||
public void RmtEvent_StartGangwar(Player client)
|
public void RmtEvent_StartGangwar(Player client)
|
||||||
{
|
{
|
||||||
if (!client.GetUser().FactionLeader)
|
User user = client.GetUser();
|
||||||
|
if(user == null || user.Faction == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user.FactionLeader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var turf in getTurfs())
|
foreach (var turf in getTurfs())
|
||||||
@@ -192,7 +203,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (client.GetUser().Faction.Name == "Ballas" || client.GetUser().Faction.Name == "Grove")
|
if (user.Faction.GangOwned)
|
||||||
{
|
{
|
||||||
foreach (var turf in getTurfs())
|
foreach (var turf in getTurfs())
|
||||||
{
|
{
|
||||||
@@ -200,8 +211,11 @@ namespace ReallifeGamemode.Server.Gangwar
|
|||||||
{
|
{
|
||||||
if (u == client)
|
if (u == client)
|
||||||
{
|
{
|
||||||
if (turf.Owner != client.GetUser().Faction.Name)
|
if (turf.Owner != user.Faction.Name)
|
||||||
turf.attack(client.GetUser().Faction.Name);
|
{
|
||||||
|
turf.attack(user.Faction.Name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||||
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
@@ -19,7 +20,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
{
|
{
|
||||||
if (!fVeh.GetOwners().Contains(client.GetUser().FactionId ?? 0))
|
if (!fVeh.GetOwners().Contains(client.GetUser().FactionId ?? 0))
|
||||||
return false;
|
return false;
|
||||||
if (fVeh.Model != VehicleHash.Burrito3)
|
if (fVeh.Model != WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -473,18 +473,30 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
var vehPrice = userVehicle.Price;
|
var vehPrice = userVehicle.Price;
|
||||||
var backPrice = (int)(vehPrice * 0.4);
|
var backPrice = (int)(vehPrice * 0.4);
|
||||||
|
player.SetData<bool>("SellVehicleDecision", true);
|
||||||
user.BankAccount.Balance += backPrice;
|
player.SetData<int>("VehicleToSell", id);
|
||||||
|
ChatService.SendMessage(player,"~s~Möchtes du das Fahrzeug ~y~" + veh.DisplayName + " ~s~wirklich für ~g~$" + backPrice + " ~s~verkaufen? Drücke ~g~J~s~ zum Bestätigen oder ~r~N ~s~zum Abbrechen");
|
||||||
ChatService.SendMessage(player, $"~b~[INFO]~s~ Du hast durch den Autoverkauf ~g~{backPrice.ToMoneyString()}~s~ erhalten.");
|
|
||||||
|
|
||||||
dbContext.UserVehicles.Remove(userVehicle);
|
|
||||||
dbContext.SaveChanges();
|
|
||||||
|
|
||||||
veh?.Delete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SellPlayerVehicle(Player player, int id)
|
||||||
|
{
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
var user = player.GetUser(dbContext);
|
||||||
|
var userVehicle = dbContext.UserVehicles.Where(v => v.Id == id && v.UserId == user.Id).FirstOrDefault();
|
||||||
|
var vehPrice = userVehicle.Price;
|
||||||
|
var backPrice = (int)(vehPrice * 0.4);
|
||||||
|
GTANetworkAPI.Vehicle veh = VehicleManager.GetVehicleFromServerVehicle(userVehicle);
|
||||||
|
user.BankAccount.Balance += backPrice;
|
||||||
|
|
||||||
|
ChatService.SendMessage(player, $"~b~[INFO]~s~ Du hast durch den Autoverkauf ~g~{backPrice.ToMoneyString()}~s~ erhalten.");
|
||||||
|
|
||||||
|
dbContext.UserVehicles.Remove(userVehicle);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
|
veh?.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:InteractionMenu_FactionVehicleInteraction")]
|
[RemoteEvent("CLIENT:InteractionMenu_FactionVehicleInteraction")]
|
||||||
public void FactionVehicleInteraction(Player player, int id, string selection)
|
public void FactionVehicleInteraction(Player player, int id, string selection)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,11 +88,17 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
Position = new Vector3(129.8998, -1938.709, 20.61865),
|
Position = new Vector3(129.8998, -1938.709, 20.61865),
|
||||||
FactionId = 7
|
FactionId = 7
|
||||||
};
|
};
|
||||||
|
WeaponPoint weaponPointVagos = new WeaponPoint()
|
||||||
|
{
|
||||||
|
Position = new Vector3(-1076.6572, -1677.4907, 4.575236),
|
||||||
|
FactionId = 5
|
||||||
|
};
|
||||||
|
|
||||||
WeaponPoints.Add(weaponPointLSPD);
|
WeaponPoints.Add(weaponPointLSPD);
|
||||||
WeaponPoints.Add(weaponPointFIB);
|
WeaponPoints.Add(weaponPointFIB);
|
||||||
WeaponPoints.Add(weaponPointBallas);
|
WeaponPoints.Add(weaponPointBallas);
|
||||||
WeaponPoints.Add(weaponPointGrove);
|
WeaponPoints.Add(weaponPointGrove);
|
||||||
|
WeaponPoints.Add(weaponPointVagos);
|
||||||
|
|
||||||
foreach (WeaponPoint w in WeaponPoints)
|
foreach (WeaponPoint w in WeaponPoints)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
{
|
{
|
||||||
public class WeaponDealManager : Script
|
public class WeaponDealManager : Script
|
||||||
{
|
{
|
||||||
|
public static readonly int[] WEAPON_DEAL_GANG_IDS = new int[] { 5, 7, 8 };
|
||||||
|
public static readonly int[] WEAPON_DEAL_STAATSFRAK_IDS = new int[] { 1, 3 };
|
||||||
|
|
||||||
|
public static int[] WEAPON_DEAL_FACTIONS => WEAPON_DEAL_GANG_IDS.Concat(WEAPON_DEAL_STAATSFRAK_IDS).Distinct().ToArray();
|
||||||
|
|
||||||
|
public static readonly VehicleHash WEAPON_DEAL_GANG_VEHICLE_HASH = VehicleHash.Burrito3;
|
||||||
|
public static readonly VehicleHash WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH = VehicleHash.Policet;
|
||||||
|
|
||||||
private const int WEAPON_AMOUNT_GANG = 2;
|
private const int WEAPON_AMOUNT_GANG = 2;
|
||||||
private const int WEAPON_AMOUNT_COP = 4;
|
private const int WEAPON_AMOUNT_COP = 4;
|
||||||
private const int WEAPON_AMOUNT_COP_STUNGUN = 4;
|
private const int WEAPON_AMOUNT_COP_STUNGUN = 4;
|
||||||
@@ -30,14 +38,17 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
public void SrvEVENT_startWeaponDeal(Player client)
|
public void SrvEVENT_startWeaponDeal(Player client)
|
||||||
{
|
{
|
||||||
var user = client.GetUser();
|
var user = client.GetUser();
|
||||||
if(user == null || user.FactionId == null)
|
if (user == null || user.FactionId == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var context = new DatabaseContext(true))
|
using (var context = new DatabaseContext(true))
|
||||||
{
|
{
|
||||||
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == VehicleHash.Burrito3 || f.Model == VehicleHash.Policet).ToList().Where(f => f.GetOwners().Contains(user.FactionId ?? 0)).FirstOrDefault();
|
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == WEAPON_DEAL_GANG_VEHICLE_HASH || f.Model == WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
|
.ToList()
|
||||||
|
.Where(f => f.GetOwners().Contains(user.FactionId ?? 0))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (factionVehicle == null)
|
if (factionVehicle == null)
|
||||||
{
|
{
|
||||||
@@ -54,7 +65,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
}
|
}
|
||||||
|
|
||||||
float distance = fVeh.Position.DistanceTo2D(client.Position);
|
float distance = fVeh.Position.DistanceTo2D(client.Position);
|
||||||
if ((distance > 80 && factionVehicle.Model == VehicleHash.Burrito3) || (distance > 400 && factionVehicle.Model == VehicleHash.Policet))
|
if ((distance > 80 && factionVehicle.Model == WEAPON_DEAL_GANG_VEHICLE_HASH) || (distance > 400 && factionVehicle.Model == WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH))
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(client, "Der Transporter ist zu weit entfernt");
|
ChatService.ErrorMessage(client, "Der Transporter ist zu weit entfernt");
|
||||||
return;
|
return;
|
||||||
@@ -175,7 +186,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((VehicleHash)veh.Model != VehicleHash.Burrito3 && (VehicleHash)veh.Model != VehicleHash.Policet)
|
if ((VehicleHash)veh.Model != WEAPON_DEAL_GANG_VEHICLE_HASH && (VehicleHash)veh.Model != WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -184,11 +195,13 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
FactionVehicle factionVehicle = context.FactionVehicles
|
FactionVehicle factionVehicle = context.FactionVehicles
|
||||||
.Where(f => f.Model == VehicleHash.Burrito3 || f.Model == VehicleHash.Policet)
|
.Where(f => f.Model == WEAPON_DEAL_GANG_VEHICLE_HASH || f.Model == WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Where(f => f.GetOwners().Contains(user.FactionId ?? 0))
|
.Where(f => f.GetOwners().Contains(user.FactionId ?? 0))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
var owners = factionVehicle.GetOwners();
|
||||||
|
|
||||||
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle);
|
||||||
fVeh.SetData("weaponDeal", false);
|
fVeh.SetData("weaponDeal", false);
|
||||||
fVeh.SetData("WeaponDealLoad", true);
|
fVeh.SetData("WeaponDealLoad", true);
|
||||||
@@ -198,7 +211,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh);
|
InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh);
|
||||||
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
int oMembers = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count();
|
||||||
|
|
||||||
if (factionVehicle.GetOwners().Contains(8) || factionVehicle.GetOwners().Contains(7))
|
if (owners.Any(o => WEAPON_DEAL_GANG_IDS.Contains(o))) // Gang WT
|
||||||
{
|
{
|
||||||
VehicleItem item = new VehicleItem() { ItemId = 2, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_GANG * oMembers }; //pistol50
|
VehicleItem item = new VehicleItem() { ItemId = 2, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_GANG * oMembers }; //pistol50
|
||||||
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
||||||
@@ -211,7 +224,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
VehicleItem item5 = new VehicleItem() { ItemId = 13, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_GANG * oMembers }; //AssaultRifle
|
VehicleItem item5 = new VehicleItem() { ItemId = 13, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_GANG * oMembers }; //AssaultRifle
|
||||||
InventoryManager.AddItemToVehicleInventory(fVeh, item5.ItemId, item5.Amount);
|
InventoryManager.AddItemToVehicleInventory(fVeh, item5.ItemId, item5.Amount);
|
||||||
}
|
}
|
||||||
else if (factionVehicle.GetOwners().Contains(1))
|
else if (owners.Contains(1)) // LSPD
|
||||||
{
|
{
|
||||||
VehicleItem item = new VehicleItem() { ItemId = 1, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP * oMembers }; //pistol
|
VehicleItem item = new VehicleItem() { ItemId = 1, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP * oMembers }; //pistol
|
||||||
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
||||||
@@ -228,7 +241,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
|
|||||||
VehicleItem item7 = new VehicleItem() { ItemId = 14, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP_STUNGUN * oMembers }; // AssaultSmg
|
VehicleItem item7 = new VehicleItem() { ItemId = 14, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP_STUNGUN * oMembers }; // AssaultSmg
|
||||||
InventoryManager.AddItemToVehicleInventory(fVeh, item7.ItemId, item7.Amount);
|
InventoryManager.AddItemToVehicleInventory(fVeh, item7.ItemId, item7.Amount);
|
||||||
}
|
}
|
||||||
else if (factionVehicle.GetOwners().Contains(3))
|
else if (owners.Contains(3)) // FIB
|
||||||
{
|
{
|
||||||
VehicleItem item = new VehicleItem() { ItemId = 3, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP * oMembers }; //pistol_mk2
|
VehicleItem item = new VehicleItem() { ItemId = 3, VehicleId = factionVehicle.Id, Amount = WEAPON_AMOUNT_COP * oMembers }; //pistol_mk2
|
||||||
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount);
|
||||||
|
|||||||
Reference in New Issue
Block a user