Порадуйте игроков своего сервера подарками!
1 вариант
В Inventory.cs ищем строку
После чего заменяем данный case с закомментированным кодом на следующий код:
2 вариант
//ищем
case ItemType.Present:
//ищем
case ItemType.Present:
1 вариант
В Inventory.cs ищем строку
C#:
case ItemType.Present:
C#:
case ItemType.Present:
/* Подарок */
player.Health = (player.Health + 10 > 100) ? 100 : player.Health + 10;
//Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём были:", 3000);
Commands.RPChat("me", player, $"открыл(а) подарок");
Random Rand0 = new Random();
int present = Rand0.Next(1, 7);
switch (present)
{
case 1:
nInventory.Add(player, new nItem(ItemType.HealthKit, 1, 100.ToString()));
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём был аптечка", 3000);
break;
case 2:
if (Main.Players[player].Licenses[6])
{
int amount = 30000;
GameLog.Money($"player({Main.Players[player].UUID})", $"player({Main.Players[player].UUID})", amount, "admin");
MoneySystem.Wallet.Change(player, amount);
GameLog.Admin($"{player.Name}", $"giveMoney({amount})", $"{player.Name}");
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём были деньги: 30000$", 3000);
}
else
{
Main.Players[player].Licenses[6] = true;
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём была лицензия на оружие", 3000);
}
break;
case 3:
nInventory.Add(player, new nItem(ItemType.BodyArmor, 1, 100.ToString()));
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём был бронежилет", 3000);
break;
case 4:
nInventory.Add(player, new nItem(ItemType.Bat, 1, 999999999.ToString()));
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём была бита", 3000);
break;
case 5:
nInventory.Add(player, new nItem(ItemType.Musket, 1, 999999999.ToString()));
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём был мушкет", 3000);
break;
case 6:
Main.Accounts[player].RedBucks += 10;
Trigger.ClientEvent(player, "starset", Main.Accounts[player].RedBucks);
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём было 10DP", 3000);
break;
}
break;
2 вариант
//ищем
case ItemType.Present:
C#:
//и вставляем внутри
player.Health = (player.Health + 10 > 100) ? 100 : player.Health + 10;
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы открыли подарок, в нём были:", 3000);
Tuple<int, int> types = nInventory.PresentsTypes[Convert.ToInt32(item.Data)];
if (types.Item1 <= 2)
{
Main.Players[player].EXP += nInventory.TypesCounts[types.Item1];
if (Main.Players[player].EXP >= 3 + Main.Players[player].LVL * 3)
{
Main.Players[player].EXP = Main.Players[player].EXP - (3 + Main.Players[player].LVL * 3);
Main.Players[player].LVL += 1;
}
Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"{nInventory.TypesCounts[types.Item1]} EXP", 3000);
MoneySystem.Wallet.Change(player, nInventory.TypesCounts[types.Item2]);
Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"$ {nInventory.TypesCounts[types.Item2]}", 3000);
}
else
{
MoneySystem.Wallet.Change(player, nInventory.TypesCounts[types.Item1]);
Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"$ {nInventory.TypesCounts[types.Item1]}", 3000);
Main.Players[player].EXP += nInventory.TypesCounts[types.Item2];
if (Main.Players[player].EXP >= 3 + Main.Players[player].LVL * 3)
{
Main.Players[player].EXP = Main.Players[player].EXP - (3 + Main.Players[player].LVL * 3);
Main.Players[player].LVL += 1;
}
Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"{nInventory.TypesCounts[types.Item2]} EXP", 3000);
}
Commands.RPChat("me", player, $"открыл(а) подарок {types.Item1} + {types.Item2}");
//====================
case ItemType.Present:
C#:
//ищем
public static List<ItemType> AlcoItems = new List<ItemType>()
//и после этого списка добавляем новые
public static readonly List<Tuple<int, int>> PresentsTypes = new List<Tuple<int, int>>()
{
new Tuple<int, int>(0, 5),
new Tuple<int, int>(1, 4),
new Tuple<int, int>(2, 3),
new Tuple<int, int>(5, 0),
new Tuple<int, int>(4, 1),
new Tuple<int, int>(3, 2),
};
public static readonly List<int> TypesCounts = new List<int>()
{
10, 25, 50, 1000, 5000, 10000
};