الموضوع: Quest TreasureBox
عرض مشاركة واحدة
قديم 2019-07-12, 06:16 PM
المشاركة 14
Rider
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: Quest TreasureBox
عفواً لايمكن عرض الرابط إلا بعد الرد على الموضوع
طيب لما بفتح الصنديق كلها بتدينى سبس عالى انا عاوز السبس يكون صعب علشان السرفر انا عملو صعب يريت يكون من 100 سبس الى 2000 سبس الى يجيى فى الصنديق كلها اعمل اية علشان يحصل كدة ؟
ف تريجر بوكس حط الكود ده بدل الي عندك و متنساش تعدل علي الريورد
كود بلغة HTML:
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 = 20, 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;

                        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(100,2000);
                        if (amount <= 2000)
                        {
                            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(188755, 192935, 192775, 187405, 188105, 188705, 188945, 188515, 192825, 200220, 187855, 200475, 187405, 187415, 187425, 3004124, 183325, 183495, 184305, 184315, 184375, 187305, 187315, 181395, 184405, 184365);
                        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.Teleport(1002, 338, 345);
                        Kernel.SendWorldMessage(new Message(client.Player.Name + " got KICKED-OUT! 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.Entity.TreasuerPoints += 1;
        }
    }
}