break;
}
if (thisclient.Fight.TimeStarting >= DateTime.Now)
break;
thisclient.Fight.Start();
}
#endregion
#region fight
else if (thisclient.Fight.Status
== FightStatus.Fighting)
{
var enemy = thisclient.Fight.Enemy;
if (enemy == null || (!enemy.IsBot &&
!WorldServer.world_players.Contains((Client)enemy)))
{
thisclient.Fight.End();
break;
}
if (thisclient.Fight.TryDie())
break;
thisclient.Fight.TrySendQuestion();
thisclient.Fight.TryBullet();
#region if bot
if (enemy.IsBot)
{
Bot bot = (Bot)enemy;
//Нанести урон от бота
if (thisclient.CurrentHP > 0f)
{
bot.CalculateDamage(thisclient);
}
for (int j = 0; j < bot.Fight.Bullet.Count;
j++)
{
Bullet b = bot.Fight.Bullet[j];
if ((DateTime.Now - b.StartTime).TotalMilliseconds
> Config.TimeForBullet)
{
thisclient.CurrentHP -= b.Dmg;
bot.Fight.Bullet.RemoveAt(j);
}
}
}
#endregion
}
#endregion
#region EndFight
else if (thisclient.Fight.Status
== FightStatus.End)
{
BasePlayer enemy = thisclient.Fight.Enemy;
#region Если противник вышел
if (enemy == null || (!enemy.IsBot &&
!WorldServer.world_players.Contains((Client)enemy)))
{
Arena.GoArena(thisclient);
byte fwin = 1;
if (thisclient.CurrentHP == 0f)
fwin = 0;
if (fwin == 1)
{
thisclient.AddRanking(thisclient.Level);
thisclient.CountFightPvpWin++;
short winmon = (short)(Config.MoneyForWinner * (1
+ thisclient.Fight.CountTrueRecpone));
thisclient.AddMoney(winmon);
thisclient.SendFightEnd(PlayerFlags.PVP, fwin, winmon,
(short)thisclient.Level);
AwardsManager.UA_KillPvp(thisclient);
}
else
{
thisclient.AddRanking(-thisclient.Level);
thisclient.CountFightPvpLose++;
thisclient.SendFightEnd(PlayerFlags.PVP, fwin, 0, (short)-thisclient.Level);
}
thisclient.Fight.Reset();
thisclient.CurrentHP = thisclient.MaxHP;
thisclient.SendAttributes();
break;
}
#endregion
byte win1 = 0;
byte win2 = 1;
Arena.GoArena(thisclient);
if (!enemy.IsBot)
Arena.GoArena((Client)enemy);
#region ничья
if (thisclient.CurrentHP == 0f && enemy.CurrentHP
== 0f)
{
win1 = win2 = 2;
thisclient.AddMoney(Config.MoneyForTie);
thisclient.SendFightEnd(PlayerFlags.PVP, win1, Config.MoneyForTie, 0);
thisclient.CountFightPvpTie++;
if (!enemy.IsBot)
{
((Client)enemy).AddMoney(Config.MoneyForTie);
((Client)enemy).SendFightEnd(PlayerFlags.PVP, win2, Config.MoneyForTie, 0);
((Client)enemy).CountFightPvpTie++;
}
}
#endregion
#region игрок выйграл
else if (enemy.CurrentHP == 0f)
{
win1 = 1;
win2 = 0;
if (!enemy.IsBot)
{
((Client)enemy).CountFightPvpLose++;
((Client)enemy).AddRanking(-((Client)enemy).Level);
((Client)enemy).AddMoney(Config.MoneyForLose);
((Client)enemy).SendFightEnd(PlayerFlags.PVP, win2, Config.MoneyForLose, (short)-((Client)enemy).Level);
}
thisclient.CountFightPvpWin++;
thisclient.AddRanking(thisclient.Level);
short winmon = (short)(Config.MoneyForWinner * (1
+ thisclient.Fight.CountTrueRecpone));
thisclient.AddMoney(winmon);
thisclient.SendFightEnd(PlayerFlags.PVP, win1, winmon,
(short)thisclient.Level);
AwardsManager.UA_KillPvp(thisclient);
}
#endregion
#region игрок проиграл
else
{
if (!enemy.IsBot)
{
((Client)enemy).AddRanking(((Client)enemy).Level);
//((Client)enemy).Money += Config.MoneyForWinner;
((Client)enemy).CountFightPvpWin++;
short winmon = (short)(Config.MoneyForWinner * (1
+ ((Client)enemy).Fight.CountTrueRecpone));
((Client)enemy).AddMoney(winmon);
((Client)enemy).SendFightEnd(PlayerFlags.PVP, win2, winmon, (short)((Client)enemy).Level);
AwardsManager.UA_KillPvp((Client)enemy);
}
thisclient.CountFightPvpLose++;
thisclient.AddRanking(-thisclient.Level);
thisclient.AddMoney(Config.MoneyForLose);
thisclient.SendFightEnd(PlayerFlags.PVP, win1, Config.MoneyForLose, (short)-thisclient.Level);
}
#endregion
thisclient.CurrentHP = thisclient.MaxHP;
enemy.CurrentHP = enemy.MaxHP;
thisclient.SendAttributes();
if (!enemy.IsBot)
((Client)enemy).SendAttributes();
thisclient.Fight.Reset();
if (!enemy.IsBot)
((Client)enemy).Fight.Reset();
//((Client)enemy).isproccess = false;
}
#endregion
break;
#endregion
#region FVF
case PlayerFlags.FVF:
#region Start
if (thisclient.Fight.Status == FightStatus.Start)
{
Client enemy = (Client)thisclient.Fight.Enemy;
if (enemy == null || !WorldServer.world_players.Contains(enemy))
{
thisclient.Fight.End();
break;
}
if (thisclient.Fight.TimeStarting >= DateTime.Now)
break;
thisclient.Fight.Start();
}
#endregion
#region fight
else if (thisclient.Fight.Status
== FightStatus.Fighting)
{
Client enemy = (Client)thisclient.Fight.Enemy;
if (enemy == null || !WorldServer.world_players.Contains(enemy))
{
thisclient.Fight.End();
break;
}
if (thisclient.Fight.TryDie())
break;
thisclient.Fight.TrySendQuestion();
thisclient.Fight.TryBullet();