Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using Mr_Panda.Client;
- using Mr_Panda.Interfaces;
- using Mr_Panda.Network.GamePackets;
- namespace Mr_Panda.Game
- {
- public class TreasureBox
- {
- static Map Map = Kernel.Maps[3820];
- const int MAX_BOXES = 12, ITEMS = 1000, CPSMoney = 1001, LEVEL = 1002, DEATH = 1003, STUN = 1004, KICK = 1005;
- static int CurrentBoxes = 0;
- static Mr_Panda.Interfaces.INpc npc;
- static ushort tempX, tempY = 0;
- static uint BaseId = 101002;
- static List<Point> VaildOnes = new List<Point>();
- public static bool OnGoing;
- public static void Generate()
- {
- try
- {
- if (CurrentBoxes < MAX_BOXES)
- {
- if (Map == null)
- {
- Map = Kernel.Maps[3820];
- return;
- }
- tempX = (ushort)Kernel.Random.Next(0, Map.Floor.Bounds.Width);
- tempY = (ushort)Kernel.Random.Next(0, Map.Floor.Bounds.Height);
- if (Map.Floor[tempX, tempY, MapObjectType.Item, null])
- {
- npc = new Network.GamePackets.NpcSpawn();
- npc.UID = BaseId++;
- npc.Mesh = (ushort)Kernel.RandFromGivingNums(9307, 9277, 9267, 9287, 9287, 9287, 9257, 9257, 9257, 9257, 9257, 9257, 9307, 9307, 9307, 9307, 9307, 9277, 9267, 9267, 9267, 9277, 9277, 9277, 9277, 9277);
- npc.Type = Enums.NpcType.Talker;
- npc.MapID = Map.ID;
- npc.X = tempX;
- npc.Y = tempY;
- npc.Name = "Real-Conquer";
- var value1 = Update.Flags.BlackName;
- Map.AddNpc(npc);
- CurrentBoxes++;
- Kernel.SendWorldMessage(new Message("A new treasure box appeared!", Color.Red, 2012));
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- }
- }
- public static void Reward(GameState client)
- {
- client.Player.CurrentTreasureBoxes++;
- var orders = Kernel.GamePool.Values.OrderByDescending(x => x.Player.CurrentTreasureBoxes).ToArray();
- for (int i = 0; i < orders.Length + 1; i++)
- {
- if (i == 11) break;
- Message msg;
- if (i == 0)
- {
- msg = new Message("", System.Drawing.Color.Red, Message.FirstRightCorner);
- }
- else
- {
- if (orders[i - 1].Player.CurrentTreasureBoxes == 0) continue;
- msg = new Message("No " + i.ToString() + "- " + orders[i - 1].Player.Name + " Opened " + orders[i - 1].Player.CurrentTreasureBoxes.ToString() + " Boxes!", System.Drawing.Color.Red, Message.ContinueRightCorner);
- }
- Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)3820);
- }
- int prize = 0;
- if (client.Player.Level <= 135)
- prize = Kernel.RandFromGivingNums(ITEMS, CPSMoney, KICK, ITEMS, CPSMoney, ITEMS, CPSMoney, DEATH);
- else prize = Kernel.RandFromGivingNums(ITEMS, CPSMoney, KICK, ITEMS, CPSMoney, ITEMS, CPSMoney, DEATH);
- //#warning TREASURE BOX PRIZE
- switch (prize)
- {
- case CPSMoney:
- {
- uint amount = (uint)Kernel.Random.Next(500000, 5000000);
- if (amount >= 1)
- {
- client.Player.ConquerPoints += amount;
- Kernel.SendWorldMessage(new Message(client.Player.Name + " got " + amount.ToString() + " CPs while opening the TreasureBox!", Color.White, Message.Talk));
- }
- break;
- }
- case ITEMS:
- {
- Database.ConquerItemBaseInformation temp;
- uint itemid = (uint)Kernel.RandFromGivingNums(720027, 720027, 720027, 1088000, 1088000, 1088000, 720028, 720028, 720028, 193445, 193525, 193235, 193235,720027, 720027, 720027, 1088000, 1088000, 1088000, 720028, 720028, 720028, 193445, 193525, 193235, 193235, 188515, 720027, 720027, 720027, 1088000, 1088000, 1088000, 720028, 720028, 720028, 193445, 193525, 193235, 193235,720027, 720027, 720027, 1088000, 1088000, 1088000, 720028, 720028, 720028, 193445, 193525, 193235, 193235, 200221);
- client.Inventory.Add(itemid, 0, 1);
- Database.ConquerItemInformation.BaseInformations.TryGetValue(itemid, out temp);
- Kernel.SendWorldMessage(new Message(client.Player.Name + " got " + temp.Name + " while opening the TreasureBox!", Color.White, Message.Talk));
- break;
- }
- case KICK:
- {
- client.Player.Die(client.Player);
- Kernel.SendWorldMessage(new Message(client.Player.Name + " got Death! while opening the TreasureBox!", Color.White, Message.Talk));
- break;
- }
- case DEATH:
- {
- client.Player.Die(client.Player);
- Kernel.SendWorldMessage(new Message(client.Player.Name + " got Death! while opening the TreasureBox!", Color.White, Message.Talk));
- break;
- }
- }
- CurrentBoxes--;
- client.Player.ConquerPoints += 100000;
- //client.Entity.TreasuerPoints += 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement