Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
<Folder Include="assets\css\atm\" />
|
||||
<Folder Include="assets\img\atm\" />
|
||||
<Folder Include="assets\img\items\" />
|
||||
<Folder Include="assets\chat\" />
|
||||
<Folder Include="assets\sound\jobs\busfahrer\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Binary file not shown.
BIN
ReallifeGamemode.Client/assets/chat/fonts/CodeProLC.otf
Normal file
BIN
ReallifeGamemode.Client/assets/chat/fonts/CodeProLC.otf
Normal file
Binary file not shown.
14
ReallifeGamemode.Client/assets/chat/index.html
Normal file
14
ReallifeGamemode.Client/assets/chat/index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="style/checkbox.css" media="screen">
|
||||
<link rel="stylesheet" type="text/css" href="style/main.css" media="screen">
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="chat" class="ui_element">
|
||||
<ul id="chat_messages"></ul>
|
||||
</div>
|
||||
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
5
ReallifeGamemode.Client/assets/chat/jquery-1.11.3.min.js
vendored
Normal file
5
ReallifeGamemode.Client/assets/chat/jquery-1.11.3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
189
ReallifeGamemode.Client/assets/chat/js/main.js
Normal file
189
ReallifeGamemode.Client/assets/chat/js/main.js
Normal file
@@ -0,0 +1,189 @@
|
||||
let chat =
|
||||
{
|
||||
size: 0,
|
||||
history_limit: 50,
|
||||
container: null,
|
||||
input: null,
|
||||
enabled: false,
|
||||
active: true,
|
||||
historyMsgs: [],
|
||||
currentIndex: 0
|
||||
};
|
||||
|
||||
const MAX_MSG_HISTORY = 36;
|
||||
|
||||
function enableChatInput(enable)
|
||||
{
|
||||
if(chat.active == false
|
||||
&& enable == true)
|
||||
return;
|
||||
|
||||
if (enable != (chat.input != null))
|
||||
{
|
||||
mp.invoke("focus", enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
chat.input = $("#chat").append('<div><input id="chat_msg" type="text" /></div>').children(":last");
|
||||
chat.input.children("input").focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
chat.input.fadeOut('fast', function()
|
||||
{
|
||||
chat.input.remove();
|
||||
chat.input = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var chatAPI =
|
||||
{
|
||||
push: (text) =>
|
||||
{
|
||||
let colorPositions = [];
|
||||
let colors = [];
|
||||
let chatElement = "<li>";
|
||||
|
||||
for (let i = 0; i<text.length; i++) {
|
||||
let colorCheck = `${text[i]}${text[i+ 1]}${text[i + 2]}`;
|
||||
|
||||
if (colorCheck === "!{#") {
|
||||
colorPositions.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
colorPositions.forEach(el => {
|
||||
let sub = text.slice(el, -1);
|
||||
colors.push(sub.slice(3, 9));
|
||||
});
|
||||
|
||||
colorPositions.forEach((el, i) => {
|
||||
let sub = text.slice(colorPositions[i] + 10, colorPositions[i + 1]);
|
||||
chatElement += `<span style='color: ${colors[i]}'>${sub}</span>`;
|
||||
});
|
||||
|
||||
chatElement += "</li>";
|
||||
|
||||
if (chatElement === "<li></li>") {
|
||||
chat.container.prepend("<li>" + text + "</li>");
|
||||
} else {
|
||||
chat.container.prepend(chatElement);
|
||||
}
|
||||
|
||||
chat.size++;
|
||||
|
||||
if (chat.size >= chat.history_limit)
|
||||
{
|
||||
chat.container.children(":last").remove();
|
||||
}
|
||||
},
|
||||
|
||||
clear: () =>
|
||||
{
|
||||
chat.container.html("");
|
||||
},
|
||||
|
||||
activate: (toggle) =>
|
||||
{
|
||||
if (toggle == false
|
||||
&& (chat.input != null))
|
||||
enableChatInput(false);
|
||||
|
||||
chat.active = toggle;
|
||||
},
|
||||
|
||||
show: (toggle) =>
|
||||
{
|
||||
if(toggle)
|
||||
$("#chat").show();
|
||||
else
|
||||
$("#chat").hide();
|
||||
|
||||
chat.active = toggle;
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
chat.container = $("#chat ul#chat_messages");
|
||||
|
||||
$(".ui_element").show();
|
||||
chatAPI.push("Multiplayer started");
|
||||
|
||||
$("body").keyup(function(event)
|
||||
{
|
||||
if (event.which == 84 && chat.input == null
|
||||
&& chat.active == true)
|
||||
{
|
||||
chat.currentIndex = 0;
|
||||
enableChatInput(true);
|
||||
event.preventDefault();
|
||||
} else if (event.which == 38) {
|
||||
if (chat.historyMsgs.length === 0)
|
||||
return;
|
||||
|
||||
const previousMessages = chat.historyMsgs;
|
||||
|
||||
if (previousMessages.length === chat.currentIndex)
|
||||
return;
|
||||
|
||||
|
||||
chat.input.children("input").val(previousMessages[chat.currentIndex]);
|
||||
|
||||
setTimeout(() => {
|
||||
chat.input.children("input").setSelectionRange(previousMessages[chat.currentIndex].length, previousMessages[chat.currentIndex].length);
|
||||
}, 1);
|
||||
|
||||
chat.currentIndex = chat.currentIndex + 1;
|
||||
|
||||
|
||||
} else if (event.which == 40) {
|
||||
if (chat.historyMsgs.length === 0)
|
||||
return;
|
||||
|
||||
const previousMessages = chat.historyMsgs;
|
||||
|
||||
if (chat.currentIndex === -1) {
|
||||
chat.input.children("input").val("")
|
||||
return;
|
||||
}
|
||||
|
||||
chat.currentIndex = chat.currentIndex - 1;
|
||||
chat.input.children("input").val(previousMessages[chat.currentIndex]);
|
||||
|
||||
setTimeout(() => {
|
||||
chat.input.children("input").setSelectionRange(previousMessages[chat.currentIndex].length, previousMessages[chat.currentIndex].length);
|
||||
}, 1);
|
||||
}
|
||||
else if (event.which == 13 && chat.input != null)
|
||||
{
|
||||
var value = chat.input.children("input").val();
|
||||
|
||||
if (value.length > 0)
|
||||
{
|
||||
if (chat.historyMsgs.length >= MAX_MSG_HISTORY) {
|
||||
chat.historyMsgs.pop();
|
||||
}
|
||||
|
||||
chat.historyMsgs.unshift(value);
|
||||
chat.currentIndex = 0;
|
||||
|
||||
if (value[0] == "/")
|
||||
{
|
||||
value = value.substr(1);
|
||||
|
||||
if (value.length > 0)
|
||||
mp.invoke("command", value);
|
||||
}
|
||||
else
|
||||
{
|
||||
mp.invoke("chatMessage", value);
|
||||
}
|
||||
}
|
||||
|
||||
enableChatInput(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
1
ReallifeGamemode.Client/assets/chat/style/checkbox.css
Normal file
1
ReallifeGamemode.Client/assets/chat/style/checkbox.css
Normal file
@@ -0,0 +1 @@
|
||||
input[type=checkbox].css-checkbox{position:absolute;z-index:-1000;left:-1000px;overflow:hidden;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0;}input[type=checkbox].css-checkbox+label.css-label{height:20px;width:20px;display:inline-block;background-repeat:no-repeat;background-position:0 0;cursor:pointer;}input[type=checkbox].css-checkbox:checked+label.css-label:after{content:'x';color:white;}label.css-label{background:#7b3784;border-radius:2px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
||||
68
ReallifeGamemode.Client/assets/chat/style/main.css
Normal file
68
ReallifeGamemode.Client/assets/chat/style/main.css
Normal file
@@ -0,0 +1,68 @@
|
||||
*,body,html{
|
||||
padding:0;
|
||||
margin:0}
|
||||
#chat,a,body,html{
|
||||
color:#fff
|
||||
}
|
||||
body,html{
|
||||
-webkit-font-smoothing:antialiased;
|
||||
overflow:hidden;
|
||||
font-size:14px;
|
||||
-webkit-user-select:none
|
||||
}
|
||||
a{
|
||||
text-decoration:none
|
||||
}
|
||||
.ui_element{
|
||||
display:none;position:absolute;
|
||||
width:100vw;height:100vh;z-index:2
|
||||
}
|
||||
#chat{
|
||||
display:block;
|
||||
z-index:0;
|
||||
line-height:24px;
|
||||
font-weight:700;
|
||||
text-shadow:1px 1px 0 #000,-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000;
|
||||
font-family:Myriad Pro,Segoe UI,Verdana,sans-serif;
|
||||
font-size:16px;
|
||||
letter-spacing:.4px;
|
||||
margin-left:15px
|
||||
|
||||
}
|
||||
@media screen and (min-height:1080px){
|
||||
|
||||
#chat{
|
||||
font-size:18px!important;
|
||||
font-weight:700}}
|
||||
#chat ul#chat_messages{
|
||||
overflow-y:auto;
|
||||
height:285px;
|
||||
margin-top:2vh; /*2vh*/
|
||||
transform:rotate(180deg);
|
||||
/*width:37vw; /* old: 37vw*/
|
||||
width: 800px;
|
||||
padding:10px 20px; /* old padding: 10px 20px*/
|
||||
list-style-type:none}
|
||||
#chat ul#chat_messages>li{
|
||||
transform:rotate(-180deg)}
|
||||
#chat input#chat_msg{
|
||||
color:#fff;
|
||||
background:rgba(0,0,0,.5);
|
||||
outline:0;border:none;
|
||||
font-family:Myriad Pro,Open Sans,sans-serif;
|
||||
font-size:13px;
|
||||
line-height:35px;
|
||||
width:35vw;
|
||||
padding:5px 5px 5px 15px}
|
||||
::-webkit-scrollbar{
|
||||
width:11px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb{
|
||||
background:rgba(255, 17, 0, 0.3);
|
||||
border-radius:20px
|
||||
|
||||
}
|
||||
::-webkit-scrollbar-thumb:hover{
|
||||
background: rgba(255, 17, 0, 0.65)
|
||||
|
||||
}
|
||||
@@ -7,6 +7,12 @@
|
||||
import { IGame } from './game';
|
||||
import RageGame from './core/rage-mp/game';
|
||||
|
||||
// Disables default RageMP Chat
|
||||
mp.gui.chat.show(false);
|
||||
|
||||
// Initialize chatbox CEF, mark it as default server chat
|
||||
const chatbox = mp.browsers.new('package://assets/chat/index.html');
|
||||
chatbox.markAsChat();
|
||||
|
||||
var inMenu: boolean = false;
|
||||
|
||||
|
||||
@@ -97,8 +97,9 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("d", "~m~Benutzung: ~s~/d [Nachricht]", GreedyArg = true)]
|
||||
public void CmdFactionD(Player player, string message)
|
||||
{
|
||||
User u = player.GetUser();
|
||||
Faction f = player.GetUser()?.Faction;
|
||||
if (f == null || !f.StateOwned)
|
||||
if ((f == null || !f.StateOwned) && !u.IsAdmin(AdminLevel.ADMIN))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -106,10 +107,21 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
|
||||
string broadcastMessage = "!{CC3333}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
|
||||
string factionName = string.Empty;
|
||||
|
||||
if(f.StateOwned)
|
||||
{
|
||||
factionName = player.GetUser().GetFactionRank().RankName;
|
||||
}
|
||||
else
|
||||
{
|
||||
factionName = "[ADMIN]";
|
||||
}
|
||||
|
||||
string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **";
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned));
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
case 3:
|
||||
//nameTagColor = new Color(173, 0, 118);
|
||||
player.SetSharedData("nameTagColor", factionId);
|
||||
player.SetSharedData("blipColor", 72);
|
||||
player.SetSharedData("blipColor", 63);
|
||||
player.SetAccessories(2, 2, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
dbUser.Wanteds = newWanteds;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
user.Player.SetSharedData("nameTagColor", -1);
|
||||
user.Player.SetSharedData("blipColor", 64);
|
||||
ChatService.SendMessage(user.Player, "!{#FF614A}Du hast ein Verbrechen begangen: " + reason + "" + (cop != null ? " | Gemeldet von: " + cop.Name + "." : ""));
|
||||
ChatService.SendMessage(user.Player, " !{#FFFF00}Fahnundgslevel:~s~ " + newWanteds);
|
||||
|
||||
@@ -123,9 +123,15 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
public static void UpdateFare()
|
||||
{
|
||||
|
||||
foreach (var player in GetPlayerInJob())
|
||||
{
|
||||
User u = player.GetUser();
|
||||
if(u == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (u.JobId != 1) return;
|
||||
if (!player.HasData("hasPassager")) { player.SetData<bool>("hasPassager", false); continue; }
|
||||
int playerId = player.GetUser().Id;
|
||||
|
||||
Reference in New Issue
Block a user