mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Planes update
This commit is contained in:
@@ -324,11 +324,11 @@ public class Planes : ICommand
|
|||||||
await Task.Delay(TimeSpan.FromMilliseconds(frameLength / 3), ctx);
|
await Task.Delay(TimeSpan.FromMilliseconds(frameLength / 3), ctx);
|
||||||
var neutral = false;
|
var neutral = false;
|
||||||
var frameCounter = 0;
|
var frameCounter = 0;
|
||||||
if (counter % 23 < 3)
|
if (counter % 13 < 3)
|
||||||
{
|
{
|
||||||
while (counter % 23 < 3)
|
while (counter % 13 < 3)
|
||||||
{
|
{
|
||||||
planesDisplay = GetGameBoard(counter%23 - 3, planesBoard, plane, carrierCount, noseUp);
|
planesDisplay = GetGameBoard(counter%13 - 3, planesBoard, plane, carrierCount, noseUp);
|
||||||
await botInstance.KfClient.EditMessageAsync(msgId.ChatMessageId!.Value, planesDisplay);
|
await botInstance.KfClient.EditMessageAsync(msgId.ChatMessageId!.Value, planesDisplay);
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(frameLength), ctx);
|
await Task.Delay(TimeSpan.FromMilliseconds(frameLength), ctx);
|
||||||
logger.Info($"Generated preGameFrame {counter} and waited {frameLength}ms.");
|
logger.Info($"Generated preGameFrame {counter} and waited {frameLength}ms.");
|
||||||
@@ -344,20 +344,20 @@ public class Planes : ICommand
|
|||||||
frameCounter++;
|
frameCounter++;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (planesBoard[plane.Height, counter % 23 - 3])
|
switch (planesBoard[plane.Height, counter % 13 - 3])
|
||||||
{
|
{
|
||||||
case 0: //do nothing plane hit neutral space
|
case 0: //do nothing plane hit neutral space
|
||||||
neutral = true;
|
neutral = true;
|
||||||
break;
|
break;
|
||||||
case 1: //hit rocket
|
case 1: //hit rocket
|
||||||
|
planesBoard[plane.Height, counter % 13 - 3] = 0; //plane consumes rocket
|
||||||
plane.HitRocket();
|
plane.HitRocket();
|
||||||
noseUp = false;
|
noseUp = false;
|
||||||
planesBoard[plane.Height, counter % 23 - 3] = 0; //plane consumes rocket
|
|
||||||
break;
|
break;
|
||||||
case 2: //hit multi
|
case 2: //hit multi
|
||||||
|
planesBoard[plane.Height, counter % 13 - 3] = 0; //plane consumes multi
|
||||||
plane.HitMulti();
|
plane.HitMulti();
|
||||||
noseUp = true;
|
noseUp = true;
|
||||||
planesBoard[plane.Height, counter % 23 - 3] = 0; //plane consumes multi
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
await botInstance.SendChatMessageAsync("Something went wrong, error code 1.", true);
|
await botInstance.SendChatMessageAsync("Something went wrong, error code 1.", true);
|
||||||
@@ -366,9 +366,10 @@ public class Planes : ICommand
|
|||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException e)
|
catch (IndexOutOfRangeException e)
|
||||||
{
|
{
|
||||||
await botInstance.SendChatMessageAsync($"Something went wrong, error code 2. Counter: {counter} Counter%: {counter % 23 - 3} Height: {plane.Height}", true);
|
await botInstance.SendChatMessageAsync($"Something went wrong, error code 2. Counter: {counter} Counter%: {counter %13 - 3} Height: {plane.Height}[br]{e}", true);
|
||||||
logger.Error(
|
logger.Error(
|
||||||
$"Something went wrong, error code 2. Counter: {counter} Counter%: {counter % 23 - 3} Height: {plane.Height}");
|
$"Something went wrong, error code 2. Counter: {counter} Counter%: {counter % 13 - 3} Height: {plane.Height}");
|
||||||
|
logger.Error(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +381,7 @@ public class Planes : ICommand
|
|||||||
else await Task.Delay(TimeSpan.FromMilliseconds(frameLength / (3 * frameCounter)), ctx); //if not the last frame use a fraction of the remaining frame time
|
else await Task.Delay(TimeSpan.FromMilliseconds(frameLength / (3 * frameCounter)), ctx); //if not the last frame use a fraction of the remaining frame time
|
||||||
planesDisplay = GetGameBoard(counter, planesBoard, plane, carrierCount, noseUp);
|
planesDisplay = GetGameBoard(counter, planesBoard, plane, carrierCount, noseUp);
|
||||||
planesDisplay += $"[br]Multi: {plane.MultiTracker}x";
|
planesDisplay += $"[br]Multi: {plane.MultiTracker}x";
|
||||||
for (var i = 0; i < 33; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
planesDisplay += BlankSpace;
|
planesDisplay += BlankSpace;
|
||||||
}
|
}
|
||||||
@@ -394,9 +395,9 @@ public class Planes : ICommand
|
|||||||
}
|
}
|
||||||
//maybe fuckery around here
|
//maybe fuckery around here
|
||||||
}
|
}
|
||||||
plane.Gravity();
|
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
|
plane.Gravity();
|
||||||
if (counter % 23 != 0) continue;
|
if (counter % 23 != 0) continue;
|
||||||
planesBoard = planesBoard2;
|
planesBoard = planesBoard2;
|
||||||
planesBoard2 = CreatePlanesBoard(gambler);
|
planesBoard2 = CreatePlanesBoard(gambler);
|
||||||
@@ -407,7 +408,7 @@ public class Planes : ICommand
|
|||||||
BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor
|
BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor
|
||||||
]);
|
]);
|
||||||
var newBalance = gambler.Balance - wager;
|
var newBalance = gambler.Balance - wager;
|
||||||
if (((counter % 23) - 3) % carrierCount == 0) //if you landed on the carrier
|
if (((counter % 13) - 3) % carrierCount == 0) //if you landed on the carrier
|
||||||
{
|
{
|
||||||
var win = plane.MultiTracker * wager - wager;
|
var win = plane.MultiTracker * wager - wager;
|
||||||
newBalance = gambler.Balance + win;
|
newBalance = gambler.Balance + win;
|
||||||
@@ -430,9 +431,9 @@ public class Planes : ICommand
|
|||||||
var output = "";
|
var output = "";
|
||||||
for (var row = 0; row < 8; row++)
|
for (var row = 0; row < 8; row++)
|
||||||
{
|
{
|
||||||
for (var column = -3; column < 20; column++) //plane starts out 3 space behind to give some space to the view,
|
for (var column = -3; column < 10; column++) //plane starts out 3 space behind to give some space to the view,
|
||||||
{
|
{
|
||||||
if (column == counter - 1 && plane.JustHitMulti > 0)
|
if (row == plane.Height && column == counter - 1 && plane.JustHitMulti > 0)
|
||||||
{
|
{
|
||||||
output += Boost;
|
output += Boost;
|
||||||
}
|
}
|
||||||
@@ -488,10 +489,10 @@ public class Planes : ICommand
|
|||||||
|
|
||||||
private int[,] CreatePlanesBoard(GamblerDbModel gambler)
|
private int[,] CreatePlanesBoard(GamblerDbModel gambler)
|
||||||
{
|
{
|
||||||
var board = new int [6, 20];
|
var board = new int [6, 10];
|
||||||
for (var row = 0; row < 6; row++)
|
for (var row = 0; row < 6; row++)
|
||||||
{
|
{
|
||||||
for (var column = 0; column < 20; column++)
|
for (var column = 0; column < 10; column++)
|
||||||
{
|
{
|
||||||
var randomNum = Money.GetRandomNumber(gambler, 1, 100);
|
var randomNum = Money.GetRandomNumber(gambler, 1, 100);
|
||||||
if (randomNum < 35)
|
if (randomNum < 35)
|
||||||
|
|||||||
Reference in New Issue
Block a user