Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Change New
- [Npc(NpcID.Change)]
- public static void Change(Client.GameClient client, ServerSockets.Packet stream, byte Option, string Input, uint id)
- {
- Dialog dialog = new Dialog(client, stream);
- switch (Option)
- {
- case 0:
- {
- dialog.AddText("Hello, here you can change CPs to money.\n");
- dialog.AddText("Please enter the amount of CPs you want to convert to money:");
- dialog.AddInput("", 1);
- dialog.AddOption("Submit", 1);
- dialog.AddOption("No Thanks", 255);
- dialog.AddAvatar(0x3f).FinalizeDialog(false);
- break;
- }
- case 1:
- {
- int inputCPs;
- if (int.TryParse(Input, out inputCPs))
- {
- if (inputCPs <= 0)
- {
- dialog.AddText("Don't Tre CHEAT Again.");
- dialog.AddOption("Try Again", 0).AddAvatar(7).FinalizeDialog();
- return;
- }
- if (client.Player.Level >= 100 && client.Player.ConquerPoints >= inputCPs)
- {
- long money = inputCPs * 10L;
- client.Player.ConquerPoints -= inputCPs;
- client.Player.Money += money;
- string logs = "[ChangeCpsToMoney] " + $"Player {client.Player.Name} changed [CPS {inputCPs}] to [Money {money}] [Map {client.Player.Map}] [IP: {client.Socket.RemoteIp}][Time {DateTime.Now}] Change CPS TO Money NPC.";
- Database.ServerDatabase.LoginQueue.Enqueue(logs);
- client.CreateBoxDialog($"Congratulations! You have received {money} Money in your inventory.");
- }
- else
- {
- dialog.AddText("You do not have enough CPs or are not at level 100.");
- dialog.AddOption("I see", 255).AddAvatar(7).FinalizeDialog();
- }
- }
- else
- {
- dialog.AddText("Invalid input. Please enter a valid number.");
- dialog.AddOption("Try Again", 0).AddAvatar(7).FinalizeDialog();
- }
- break;
- }
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement