diff --git a/Classic/scripts/LakRabbitGame.cs b/Classic/scripts/LakRabbitGame.cs old mode 100755 new mode 100644 index 26d7b0d..528523f --- a/Classic/scripts/LakRabbitGame.cs +++ b/Classic/scripts/LakRabbitGame.cs @@ -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; diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 8ccafec..79a3a16 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -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." ); diff --git a/Classic/scripts/autoexec/dtBanSystem.cs b/Classic/scripts/autoexec/dtBanSystem.cs index 66e9999..3bf4e51 100644 --- a/Classic/scripts/autoexec/dtBanSystem.cs +++ b/Classic/scripts/autoexec/dtBanSystem.cs @@ -55,7 +55,7 @@ function BanList::add(%guid, %ipAddress, %time){ } } else if(%eIndex == -1){ - %eIndex = %i; + %eIndex = %i; } } if(!%found){ @@ -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)){ @@ -273,4 +281,25 @@ function unbanold(%guid,%ip){ error("IP" SPC %ip SPC "UNBANNED"); } 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(); } \ No newline at end of file diff --git a/Classic/scripts/autoexec/zzDiscordBot.cs b/Classic/scripts/autoexec/zzDiscordBot.cs index 3c23f75..4fae2fc 100644 --- a/Classic/scripts/autoexec/zzDiscordBot.cs +++ b/Classic/scripts/autoexec/zzDiscordBot.cs @@ -462,4 +462,32 @@ 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"); + } } \ No newline at end of file