صناديق الحظ - ابداع كونكر - Conquer

صناديق الحظ

نخش فى الموضوع على طول نبدأ ببسم الله الرحمن الرحيم اولا

اتدخل علي

Entity

او

player

اتبحث عن

public Time32 FreezeStamp;  

وتحتهم

public uint LotteryItemID = 0;  
        public byte LotteryJadeAdd;  
        public uint LotteryItemPlus;  
        public uint LotteryItemSocket1;  
        public uint LotteryItemSoc2;  
        public uint LotteryItemColor;  
        public ConquerItem LotteryPrize;  

وحط دول كمان

public LotteryTable.LotteryItem LotoItem;

في نفس الكلاس اتبحث عن

public bool UseItem = false;  

تحته

public uint LotteryItemSoc1;  

في نفس الكلاس ابحث عن

mapName = "OfflineTG";

وتحت كلمة

break;

حط تحتها ده

case 700:  
                    mapName = "LotteryMap";  
                    break;

في نفس الكلاس ابحث عن

mapName = "DesertArena";

تحت كلمة

break;

حط تحتيه

case 0x760:  
                    mapName = "LotteryHouse";  
                    break;  

ثانيا

اتفتح كلاس

Entitytable

اتبحث عن

public static bool LoadEntity

وانزل لحد ما تلقي

client.HeadgearClaim = reader.ReadBoolean("HeadgearClaim");

تحتيه

client.InLottery = reader.ReadBoolean("InLottery");  
 client.LotteryEntries = reader.ReadByte("LotteryEntries");  
 client.LastLotteryEntry = DateTime.FromBinary(reader.ReadInt64("LastLotteryEntry"));  

في نفس الكلاس ابحث عن

client.ExpBalls = 0;

تحته

client.LotteryEntries = 0;  

ابحث عن

ResetExpball(client);

تحته

ResetLottery(client);

ابحث عن

public static void ResetExpball

تحته

public static void ResetLottery(Client.GameState client)  
        {  
            UpdateData(client, "LotteryEntries", 0);  
        }  

ابحث عن

.Set("Class", e.Class)

تحته

.Set("InLottery", c.InLottery)  
                    .Set("LotteryEntries", c.LotteryEntries)  
                    .Set("LastLotteryEntry", c.LastLotteryEntry.Ticks)  

رابعا

افتح كلاس Game state

ابحث عن

public uint VirtuePoints;

تحته

public DateTime LastLotteryEntry;  
        public byte LotteryEntries;  
        public bool InLottery;

خامسا

في مسار

network/game packets

اتعمل كلاس باسم

Lottery

حط جواها

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

namespace Conquer_Online_Server.Network.GamePackets 
{ 
    internal class Lottery 
    { 
        private byte[] mData; 
        public enum LotteryTypes 
        { 
            Accept = 0, 
            AddJade = 1, 
            Continue = 2, 
            SocketOne = 7, 
            SocketTwo = 8, 
            ShowGUI = 0x103 
        } 
        public Lottery() 
        { 
            this.mData = new byte[26 + 8]; 
            Writer.Write(26, 0, this.mData); 
            Writer.Write((ushort)1314, 2, this.mData); 
            Writer.Write((byte)1, 6, this.mData); 
        } 

        public Lottery(byte[] d) 
        { 
            this.mData = new byte[d.Length]; 
            d.CopyTo(this.mData, 0); 
        } 

        public static implicit operator byte[](Lottery d) 
        { 
            return d.mData; 
        } 

        public byte AddJadeChances 
        { 
            get 
            { 
                return this.mData[11]; 
            } 
            set 
            { 
                this.mData[11] = value; 
            } 
        } 

        public byte Chances 
        { 
            get 
            { 
                return this.mData[12]; 
            } 
            set 
            { 
                this.mData[12] = value; 
            } 
        } 

        public Game.Enums.Color Color 
        { 
            get 
            { 
                return (Game.Enums.Color)((byte)BitConverter.ToUInt16(this.mData, 10)); 
            } 
            set 
            { 
                Writer.Write((ushort)value, 10, this.mData); 
            } 
        } 

        public byte Plus 
        { 
            get 
            { 
                return this.mData[9]; 
            } 
            set 
            { 
                Writer.Write(value, 9, this.mData); 
            } 
        } 

        public uint Prize 
        { 
            get 
            { 
                return BitConverter.ToUInt32(this.mData, 12); 
            } 
            set 
            { 
                Writer.Write(value, 12, this.mData); 
            } 
        } 

        public byte SocketOne 
        { 
            get 
            { 
                return this.mData[7]; 
            } 
            set 
            { 
                Writer.Write(value, 7, this.mData); 
            } 
        } 

        public byte SocketTwo 
        { 
            get 
            { 
                return this.mData[8]; 
            } 
            set 
            { 
                Writer.Write(value, 8, this.mData); 
            } 
        } 

        public LotteryTypes Type 
        { 
            get 
            { 
                return (LotteryTypes)BitConverter.ToUInt16(this.mData, 4); 
            } 
            set 
            { 
                Writer.Write((ushort)value, 4, this.mData); 
            } 
        } 
    } 
}  

سادسا

في NPC

حط دول

#region LadyLuck 
                            case 923: 
                            case 924: 
                                { 
                                    switch (npcRequest.OptionID) 
                                    { 
                                        case 0: 
                                            { 
                                                if (client.InLottery) 
                                                { 
                                                    dialog.Text("Look!~Here~is~the~LuckyBox,~a~kind~of~magical~box~which~makes~your~dream~come~true."); 

                                                    dialog.Option("Get~me~out~of~here!", 4); 
                                                    dialog.Option("Tell~me~more~about~it~please.", 5); 
                                                    dialog.Option("Exchange~Small~Lottery~Ticket.", 2); 
                                                    dialog.Option("Really?~I~don`t~believe~it.", 255); 
                                                    dialog.Avatar(159); 
                                                    dialog.Send(); 
                                                } 
                                                else 
                                                { 
                                                    dialog.Text("Welcome to the Lottery Center! There are many Lucky Boxes here, each containing incredible treasures! Pay me 3 Small Lottery Tickets to draw from the Lucky Box in the Lottery Center. You are allowed to enter the Lottery Center and try your luck upto 10"); 
                                                    dialog.Text("~times a day. You will have extra lottery chances if you are a VIP player. If you are new to this place, let me show you around the Lottery Center, first!"); 

                                                    dialog.Option("Let`s~try~my~luck!", 1); 
                                                    dialog.Option("Exchange~Small~Lottery~Ticket.", 2); 
                                                    dialog.Option("May~I~know~the~rules~first?", 3); 
                                                    dialog.Option("How~about~the~VIP~privilege?", 6); 
                                                    dialog.Option("Nice~to~see~you.", 255); 
                                                    dialog.Avatar(123); 
                                                    dialog.Send(); 
                                                } 
                                                break; 
                                            } 
                                        case 1: 
                                            { 
                                                if (client.Entity.Level >= 70) 
                                                { 
                                                    client.InLottery = true; 
                                                    client.LotteryEntries++; 
                                                    client.Entity.Teleport(700, 40, 47); 
                                                } 

                                                else 
                                                { 
                                                    dialog.Text("You may not join the lottery , you need level 70 first."); 
                                                    dialog.Option("Ahh sorry.", 255); 
                                                    dialog.Send(); 
                                                } 
                                                break; 
                                            } 
                                        case 2: 
                                            { 
                                                if (!client.Inventory.Contains(711504, 3)) 
                                                { 
                                                    dialog.Text("You don`t have 3 Lottery Tickets to exchange for the Small Lottery Tickets."); 

                                                    dialog.Option("Oops.", 255); 
                                                    dialog.Avatar(123); 
                                                    dialog.Send(); 
                                                } 
                                                else 
                                                { 
                                                    client.Inventory.Remove(711504, 3); 
                                                    client.Inventory.Add(3008856, 0, 1); 
                                                } 
                                                break; 
                                            } 
                                        case 3: 
                                            { 
                                                dialog.Text("There are many Lucky Boxes in the Lottery Center. Pay 3 Small Lottery Tickets, and you can draw from the Lucky Box! If you are not satisfied with the item you get, you can pay 1 more Small Lottery Ticket to change the item you drew. However, you can"); 
                                                dialog.Text("~only pay and change the item for 2 times. Each player is allowed to draw from the Lottery up to 10 times, each day."); 

                                                dialog.Option("Okay,~I~see.", 255); 
                                                dialog.Avatar(123); 
                                                dialog.Send(); 
                                                break; 
                                            } 
                                        case 4: 
                                            { 
                                                client.Entity.Teleport(1036, 219, 193); 
                                                client.InLottery = false; 
                                                break; 
                                            } 
                                        case 5: 
                                            { 
                                                dialog.Text("You~have~chance~to~get~whatever~you~desire~from~a~LuckyBox.~It~May~be~a~Dragonball,~+8~weapon,~or"); 
                                                dialog.Text("~two-socket~boot,~you~don`t~know~what~you~will~get~from~the~Box,~it~totally~depends~on~your~luck.~Well,"); 
                                                dialog.Text("~let`s~get~started~now.~Good~luck!"); 

                                                dialog.Option("Thanks~a~lot.", 255); 
                                                dialog.Avatar(159); 
                                                dialog.Send(); 
                                                break; 
                                            } 
                                        case 6: 
                                            { 
                                                dialog.Text("Each player can draw from the Lottery up to 10 times, each day. But if you are a VIP, you will have extra chances to play! Level 1 VIP: 10 extra chances. Level 2 VIP: 20 extra chances. Level 3 VIP: 30 extra chances."); 
                                                dialog.Text("~Level 4 VIP: 40 extra chances. Level 5 VIP: 50 extra chances. Level 6 VIP: 60 extra chances."); 

                                                dialog.Option("Got~it!", 255); 
                                                dialog.Avatar(123); 
                                                dialog.Send(); 
                                                break; 
                                            } 
                                    } 
                                    break; 
                                } 
                            #endregion 
             #region LuckyBox 
                            case 943: 
                            case 937: 
                            case 944: 
                            case 939: 
                            case 931: 
                                { 
                                    Game.Lottery.LuckyBox(client.ActiveNpc, client, false); 
                                    break; 
                                } 
                            #endregion  

سابعا

في كلاس

packethandler

ابحث عن

#region PK Explorer

تحته

#region Lottery (1314)  
                case 1314:  
                    {  

                        Game.Lottery.Handle(packet, client);  
                        break;  
                    }  
                #endregion

ابحث عن

#region Gates

تحته

#region SmallLotteryTicketPack  
                case 724002:  
                    {  
                        client.Inventory.Remove(item, Game.Enums.ItemUse.RemoveFromStack);  
                        client.Inventory.Add(711504, 0, 3);  
                        break;  
                    }  
                #endregion  

ثامنا

في كلاس

vipstatus

ابحث عن

public enum VIPExtras

تحت القوس

BonusLottery = 0x8000,

تاسعا

في النفي كات

---------------------------------------------
Npc
-------------------------------------------
923    LadyLuck    2    9230    1036    212    188     
924    LadyLuck    2    9236    700    40    50     
944    lucky box    2    9287    700    45    56     
943    lucky box    2    9287    700    56    56     
939    lucky box    2    9287    700    45    45     
937    lucky box    2    9287    700    51    51     
931    lucky box    2    9287    700    56    45  


---------------------------------------------
Map
-------------------------------------------
700    700    66124    0  
-------------------------------------------





في ملف الاسامي والاضافات ضيف دول
-------------------------------------------------------------
InLottery  Tinyint  5  0  سيب علامه صح

lotteryEntries  Madiumint  10 0  سيب علامه صح

LastLotteryEntry Bigint 255 0 سيب علامه صح

عاشرا

في ملف Game

اعمل كلاس باسم

Lottery

جوه الملف ده حط دول

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using Conquer_Online_Server.Network.GamePackets; 
using Conquer_Online_Server.Interfaces; 

namespace Conquer_Online_Server.Game 
{ 
    public class Lottery 
    { 

        public static void LotteryRewardMessage(Conquer_Online_Server.Client.GameState Hero, ConquerItem i) 
        { 
            string str = ""; 
            string str2 = ""; 
            string str3 = ""; 
            if ((Conquer_Online_Server.Game.Enums.ItemQuality)(i.ID % 10) >= Conquer_Online_Server.Game.Enums.ItemQuality.Elite) 
            { 
                str = "Elite "; 
                if ((Conquer_Online_Server.Game.Enums.ItemQuality)(i.ID % 10) >= Conquer_Online_Server.Game.Enums.ItemQuality.Super) 
                { 
                    str = "Super "; 
                } 
                if (Conquer_Online_Server.Database.ConquerItemInformation.BaseInformations[i.ID].Name.Contains("MoneyBag")) 
                { 
                    str = ""; 
                } 
            } 
            if (i.SocketOne > 0) 
            { 
                str2 = "1-Socket "; 
                if (i.SocketTwo > 0) 
                { 
                    str2 = "2-Socket "; 
                } 
            } 
            if (i.Plus > 0) 
            { 
                str3 = "(+" + i.Plus + ")"; 
            } 
            string str4 = str + str2 + Conquer_Online_Server.Database.ConquerItemInformation.BaseInformations[i.ID].Name + str3; 
            string msg = string.Format("{0} won a {1} from the Lottery!", Hero.Entity.Name, str4); 

            if ((Conquer_Online_Server.Game.Enums.ItemQuality)(i.ID % 10) >= Conquer_Online_Server.Game.Enums.ItemQuality.Elite) 
            { 
                Kernel.SendWorldMessage(new Message(msg, System.Drawing.Color.Red, Conquer_Online_Server.Network.GamePackets.Message.Talk), Program.Values); 



            } 
            else 
            { 
                Hero.Send(new Message(msg, System.Drawing.Color.White, Message.Talk)); 

            } 
        } 
        public static void GiveLotteryPrize(Conquer_Online_Server.Client.GameState Hema) 
        { 
            LotteryRewardMessage(Hema, Hema.Entity.LotteryPrize); 
            Conquer_Online_Server.Database.ConquerItemInformation Itemd = new Conquer_Online_Server.Database.ConquerItemInformation(Hema.Entity.LotteryItemID, 0); 
            //var Itemd = Conquer_Online_Server.Database.ConquerItemInformation.BaseInformations[Hema.Entity.LotteryItemID];  
            ConquerItem Item = new ConquerItem(true); 
            Item.ID = Hema.Entity.LotteryItemID; 

            Item.Plus = (byte)Hema.Entity.LotteryItemPlus; 
            Item.Color = Conquer_Online_Server.Game.Enums.Color.Blue; 
            if (Hema.Entity.LotteryItemSoc1 > 0) 
            { 
                Item.SocketOne = Conquer_Online_Server.Game.Enums.Gem.EmptySocket; 
                Hema.Entity.LotteryItemSoc1 = 0; 
            } 
            if (Hema.Entity.LotteryItemSoc2 > 0) 
            { 
                Item.SocketTwo = Conquer_Online_Server.Game.Enums.Gem.EmptySocket; 
                Hema.Entity.LotteryItemSoc2 = 0; 
            } 
            Item.Durability = Item.MaximDurability = Itemd.BaseInformation.Durability; 

            Hema.Inventory.Add(Item, Conquer_Online_Server.Game.Enums.ItemUse.CreateAndAdd); 


            Hema.Entity.LotteryItemID = 0; 
            Hema.Entity.LotteryJadeAdd = 0; 
        } 
        public static void LuckyBox(uint npcID, Conquer_Online_Server.Client.GameState h, bool jade) 
        { 
            if (jade || h.Inventory.Contains(0xadb50, 3)) 
            { 
                if (!jade) 
                { 
                    h.LotteryEntries += 1; 
                    h.Activenes.SendSinglePacket(h, Activeness.Types.LotteryTask, h.LotteryEntries); 
                } 
                else 
                { 
                    h.Entity.LotteryJadeAdd++; 
                } 
                if ((npcID != 0) && !jade) 
                { 
                    _String packet = new _String(true); 
                    packet.UID = npcID; 
                    packet.TextsCount = 1; 
                    packet.Type = _String.Effect; 
                    packet.Texts.Add("lottery"); 
                    h.Send(packet); 
                } 
            tryagain: 
                int rand = Kernel.Random.Next(Conquer_Online_Server.Database.LotteryTable.LotteryItems.Count); 
            var item = Conquer_Online_Server.Database.LotteryTable.LotteryItems[rand]; 
            var Itemd = Conquer_Online_Server.Database.ConquerItemInformation.BaseInformations[item.ID]; 
                if (Itemd == null || item == null) 
                    goto tryagain; 
                if (item.NPCID != npcID && Kernel.Rate(70)) 
                    goto tryagain; 
                if (!(Network.PacketHandler.GetPositionFromID(item.ID) != Network.PacketHandler.Positions.Garment && Network.PacketHandler.GetPositionFromID(item.ID) != 0 && Kernel.Rate(99))) 
                { 
                    ConquerItem Item = new ConquerItem(true); 
                    Item.ID = item.ID; 
                    h.Entity.LotteryItemID = item.ID; 
                    h.Entity.LotteryItemPlus = item.Plus; 
                    h.Entity.LotteryItemColor = (byte)Conquer_Online_Server.Game.Enums.Color.Blue; 
                    Item.Plus = item.Plus; 
                    Item.Color = Conquer_Online_Server.Game.Enums.Color.Blue; 
                    if (item.Sockets > 0) 
                    { 
                        Item.SocketOne = Conquer_Online_Server.Game.Enums.Gem.EmptySocket; 
                        h.Entity.LotteryItemSoc1 = 255; 
                    } 
                    if (item.Sockets > 1) 
                    { 
                        Item.SocketTwo = Conquer_Online_Server.Game.Enums.Gem.EmptySocket; 
                        h.Entity.LotteryItemSoc2 = 255; 

                    } 
                    Item.Durability = Item.MaximDurability = Itemd.Durability; 
                    // h.Inventory.Add(Item, Game.Enums.ItemUse.Add); 
                    //h.Entity.LotteryPrize = Item; 
                    if ((Item != null)) 
                    { 
                        if (!jade) 
                        { 
                            if (h.Inventory.Contains(0xadb50, 3)) 
                            { 

                                h.Inventory.Remove(0xadb50, 3); 
                            } 
                            else 
                            { 
                                return; 
                            } 
                        } 
                        else 
                        { 
                            if (h.Inventory.Contains(0xadb50, 1)) 
                            { 

                                h.Inventory.Remove(0xadb50, 1); 
                            } 
                            else 
                            { 
                                return; 
                            } 
                        } 

                        h.Entity.LotteryPrize = Item; 
                        Conquer_Online_Server.Network.GamePackets.Lottery lottery = new Conquer_Online_Server.Network.GamePackets.Lottery 
                        { 
                            //Chances = (byte)(10 - h.LotteryEntries), 
                            Color = Item.Color, 
                            Plus = Item.Plus, 
                            Prize = Item.ID, 
                            SocketOne = (byte)Item.SocketOne, 
                            SocketTwo = (byte)Item.SocketTwo, 
                            AddJadeChances = h.Entity.LotteryJadeAdd, 
                            Type = Conquer_Online_Server.Network.GamePackets.Lottery.LotteryTypes.ShowGUI 
                        }; 
                        h.Send((byte[])lottery); 

                    } 
                    else 
                    { 
                        // string msg = string.Format("Error generating lottery prize.", h.Entity.Name, h.Entity.Name); 
                        // h.Send(new Message(msg, System.Drawing.Color.White, Message.Talk)); 

                    } 
                } 
                else 
                    goto tryagain; 
            } 
            else 
            { 
                string msg = string.Format("You need 3 Small Lottery Tickets to try at the lottery!", h.Entity.Name, h.Entity.Name); 
                h.Send(new Message(msg, System.Drawing.Color.White, Message.Talk)); 

            } 
        } 
        public static void Handle(byte[] Data, Conquer_Online_Server.Client.GameState Client) 
        { 

            Conquer_Online_Server.Network.GamePackets.Lottery lottery = new Conquer_Online_Server.Network.GamePackets.Lottery(Data); 
            if (Client != null) 
            { 
                switch (lottery.Type) 
                { 
                    case Conquer_Online_Server.Network.GamePackets.Lottery.LotteryTypes.Accept: 
                        GiveLotteryPrize(Client); 
                        break; 

                    case Conquer_Online_Server.Network.GamePackets.Lottery.LotteryTypes.AddJade: 
                        if ((Client.Entity.LotteryJadeAdd < 2) && Client.Inventory.Contains(0xadb50, 1)) 
                        { 
                            LuckyBox(0, Client, true); 
                        } 
                        break; 

                    case Conquer_Online_Server.Network.GamePackets.Lottery.LotteryTypes.Continue: 
                        LuckyBox(0, Client, false); 
                        break; 
                } 
            } 
        } 
    } 
}  

احدا عشر

في ملف Database

اعمل كلاس باسم

LotteryTable

وحط جواهم دول

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

namespace Conquer_Online_Server.Database 
{ 
    public class LotteryTable 
    { 
        public class LotteryItem 
        { 
            public int Rank, Chance; 
            public string Name; 
            public uint ID; 
            public byte Color; 
            public byte Sockets; 
            public byte Plus; 
            public uint NPCID; 

        } 
        public static List<LotteryItem> LotteryItems = new List<LotteryItem>(); 
        public static void Load() 
        { 
            using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("lottery")) 
            using (var reader = cmd.CreateReader()) 
            { 
                while (reader.Read()) 
                { 
                    LotteryItem item = new LotteryItem(); 
                    item.Rank = reader.ReadInt32("Rank"); 
                    item.Chance = reader.ReadInt32("Chance"); 
                    item.Name = reader.ReadString("Prize_Name"); 
                    item.ID = reader.ReadUInt32("Prize_Item"); 
                    item.Color = reader.ReadByte("Color"); 
                    item.Sockets = reader.ReadByte("Hole_Num"); 
                    item.Plus = reader.ReadByte("Addition_Lev"); 
                    LotteryItems.Add(item); 
                } 
            } 
            Console.WriteLine("Lottery items loaded."); 
        } 
    } 
}  

واخر حاجه اترفع الملف ده لنفي كات

https://up.top4top.net/downloadf-866qa6sa1-rar.html

وفي الاخر اقولكم كل سنه وانتم طيبين ورمضان كريم علينا كلنا

محدش ينسي يكتبلي كلي سنه وانا طيب في الكوممنتات

تيم تهيس – jdl jids – تيم تهييس – jdl jidds – team Taheys – سورسات كونكر – فى بى اس – vps – اعلانات السيرفرات الشخصية – اعلانات السيرفرات

أضف تعليق

قوانين المدونة & عن تيم تهيس