Merge branch 'Dev' into Stable

This commit is contained in:
ChocoTaco1 2022-11-10 15:50:33 -05:00
commit eabb25b208
4 changed files with 85 additions and 7 deletions

8
Classic/scripts/LakRabbitGame.cs Executable file → Normal file
View file

@ -576,9 +576,9 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am
%weapon = "MINE";
case $DamageType::ShockLance:
%height = getHeight(%sourceObject);
%heightBonus = (mPow(%height,1.20)/14)+1; //was 10
%heightBonus = (mPow(%height,1.20)/12)+1; //was 10
%velBonus /= 2;
%points = mFloor(%distance/2) + (%heightBonus/3); //Added /3 for height
%points = mFloor(%distance/2) + (%heightBonus/2); //Added /2 for height
%accuracy = " [Height:" @ %height @"m]";
// borlak -- check rear shocklance hit
@ -1924,11 +1924,11 @@ function LakRabbitGame::playerTouchFlag(%game, %player, %flag)
// borlak -- points for MA flag grabs
%mask = $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType;
%rayStart = %player.getWorldBoxCenter();
%rayEnd = getWord(%rayStart, 0) SPC getWord(%rayStart, 1) SPC getWord(%rayStart, 2) - 20;
%rayEnd = getWord(%rayStart, 0) SPC getWord(%rayStart, 1) SPC getWord(%rayStart, 2) - 10;
%ground = ContainerRayCast(%rayStart, %rayEnd, %mask, 0);
if(!%ground)
{
%points = mFloor((getSpeed(%player)/8.3) + (getHeight(%player)/2.3)); //was 5.3 - 2.3
%points = mFloor((getSpeed(%player)/6.3) + (getHeight(%player)/3.3)); //was 5.3 - 2.3
%points = %points > 5 ? %points : 5;
messageAll('MsgRabbitFlagTaken', '\c4%1 gets %2 points for a Mid-Air flag grab! [Speed:%3] [Height:%4]~wfx/misc/hunters_horde.wav', %player.client.name, %points, getSpeed(%player), getHeight(%player));
%player.client.morepoints += %points;

View file

@ -285,7 +285,14 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
switch$(%typeName)
{
case "VoteKickPlayer":
if(%client == %arg1) // client is trying to votekick himself
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
if(%curTimeLeftMS <= 120000)
{
messageClient(%client, "", "\c2Kick votes are restricted at this time.");
return;
}
if(%client == %arg1) // client is trying to votekick himself
return; // Use the leave button instead, pal.
if(%isAdmin) // Admin is trying to kick
@ -370,7 +377,14 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
return; // stop the function in its tracks
case "VoteChangeMission":
// Vote-spoof prevention right here
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
if(%curTimeLeftMS <= 120000)
{
messageClient(%client, "", "\c2Change mission votes are restricted at this time.");
return;
}
// Vote-spoof prevention right here
%arg1 = $HostMissionFile[%arg3];
%arg2 = $HostTypeName[%arg4];
if(!checkMapExist(%arg1, %arg2))
@ -697,6 +711,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
return;
case "VoteNextMission":
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
if(%curTimeLeftMS <= 120000)
{
messageClient(%client, "", "\c2Set next mission votes are restricted at this time.");
return;
}
if(!%client.isAdmin && $TotalTeamPlayerCount < 6)
{
messageClient( %client, '', "Need at least 6 players on teams to set the next map." );

View file

@ -122,6 +122,14 @@ function banList_checkGUID(%guid){
return 0;
}
function CreateServer(%mission, %missionType)
{
parent::CreateServer(%mission, %missionType);
//Clean timed out bans at startup
schedule(10000,0,"banListClean",0);
}
};
if (!isActivePackage(dtBan)){
@ -274,3 +282,24 @@ function unbanold(%guid,%ip){
}
saveBanList();
}
//Clean timed out bans at startup
function banListClean(){
%found = 0;
for (%i = 0; %i < 100; %i++){
%fieldList = $dtBanList::NameList[%i];
if($dtBanList::NameList[%i] !$= ""){
%guid = getField($dtBanList::NameList[%i], 1);
%ip = getField($dtBanList::NameList[%i], 2);
%time = $dtBanList::GUID[%guid];
%delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3));
if (%delta > getField(%time,4)){
$dtBanList::NameList[%i] = "";
$dtBanList::GUID[%guid] = "";
$dtBanList::IP[%ip] = "";
error("GUID" SPC %guid SPC "IP" SPC %ip SPC "UNBANNED");
}
}
}
saveBanList();
}

View file

@ -463,3 +463,31 @@ function sendLDATA(%month, %year, %game){
function unlockStatGen(){
$genStatsLockout = 0;
}
//Added Oct 11, 2022
$discordBot::remoteLogCount = 0;
$discordBot::remoteSendCount = 0;
//if %type is 0 then log history is limited to 100 if 1 its unlimited
function remoteLog(%logName, %data, %type){
if($discordBot::remoteLogCount < 5000){
$discordBot::remoteLog[$discordBot::remoteLogCount++] = %logName @ $discordBot::cmdSplit @ %data @ $discordBot::cmdSplit @ %type;
$discordBot::remoteSendCount++;
if(!isEventPending($discordBot::eventId)){
logFeed();
}
}
else{
error("Remote Log Back Buffer Full" SPC %logName SPC %data SPC %type);
}
}
function logFeed(){
%feedRate = 64;
if(isObject(discord) && discord.lastState $= "Connected" && $discordBot::remoteSendCount){
%log = $discordBot::remoteLog[($discordBot::remoteLogCount-$discordBot::remoteSendCount)+1];
discord.send("LOGDATA" @ $discordBot::cmdSplit @ %log @ "\r\n");
if($discordBot::remoteSendCount-- <= 0)
$discordBot::remoteLogCount = 0;
$discordBot::eventId = schedule(%feedRate, 0, "logFeed");
}
}