نخش فى الموضوع على طول نبدأ ببسم الله الرحمن الرحيم اولا
اتدخل علي
1 |
Entity |
او
1 |
player |
اتبحث عن
1 |
public Time32 FreezeStamp; |
وتحتهم
1 2 3 4 5 6 7 |
public uint LotteryItemID = 0; public byte LotteryJadeAdd; public uint LotteryItemPlus; public uint LotteryItemSocket1; public uint LotteryItemSoc2; public uint LotteryItemColor; public ConquerItem LotteryPrize; |
وحط دول كمان
1 |
public LotteryTable.LotteryItem LotoItem; |
في نفس الكلاس اتبحث عن
1 |
public bool UseItem = false; |
تحته
1 |
public uint LotteryItemSoc1; |
في نفس الكلاس ابحث عن
1 |
mapName = "OfflineTG"; |
وتحت كلمة
1 |
break; |
حط تحتها ده
1 2 3 |
case 700: mapName = "LotteryMap"; break; |
في نفس الكلاس ابحث عن
1 |
mapName = "DesertArena"; |
تحت كلمة
1 |
break; |
حط تحتيه
1 2 3 |
case 0x760: mapName = "LotteryHouse"; break; |
ثانيا
اتفتح كلاس
1 |
Entitytable |
اتبحث عن
1 |
public static bool LoadEntity |
وانزل لحد ما تلقي
1 |
client.HeadgearClaim = reader.ReadBoolean("HeadgearClaim"); |
تحتيه
1 2 3 |
client.InLottery = reader.ReadBoolean("InLottery"); client.LotteryEntries = reader.ReadByte("LotteryEntries"); client.LastLotteryEntry = DateTime.FromBinary(reader.ReadInt64("LastLotteryEntry")); |
في نفس الكلاس ابحث عن
1 |
client.ExpBalls = 0; |
تحته
1 |
client.LotteryEntries = 0; |
ابحث عن
1 |
ResetExpball(client); |
تحته
1 |
ResetLottery(client); |
ابحث عن
1 |
public static void ResetExpball |
تحته
1 2 3 4 |
public static void ResetLottery(Client.GameState client) { UpdateData(client, "LotteryEntries", 0); } |
ابحث عن
1 |
.Set("Class", e.Class) |
تحته
1 2 3 |
.Set("InLottery", c.InLottery) .Set("LotteryEntries", c.LotteryEntries) .Set("LastLotteryEntry", c.LastLotteryEntry.Ticks) |
رابعا
افتح كلاس Game state
ابحث عن
1 |
public uint VirtuePoints; |
تحته
1 2 3 |
public DateTime LastLotteryEntry; public byte LotteryEntries; public bool InLottery; |
خامسا
في مسار
network/game packets
اتعمل كلاس باسم
Lottery
حط جواها
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
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
حط دول
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
#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
ابحث عن
1 |
#region PK Explorer |
تحته
1 2 3 4 5 6 7 8 |
#region Lottery (1314) case 1314: { Game.Lottery.Handle(packet, client); break; } #endregion |
ابحث عن
1 |
#region Gates |
تحته
1 2 3 4 5 6 7 8 |
#region SmallLotteryTicketPack case 724002: { client.Inventory.Remove(item, Game.Enums.ItemUse.RemoveFromStack); client.Inventory.Add(711504, 0, 3); break; } #endregion |
ثامنا
في كلاس
vipstatus
ابحث عن
1 |
public enum VIPExtras |
تحت القوس
1 |
BonusLottery = 0x8000, |
تاسعا
في النفي كات
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
--------------------------------------------- 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
اعمل كلاس باسم
1 |
Lottery |
جوه الملف ده حط دول
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
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
اعمل كلاس باسم
1 |
LotteryTable |
وحط جواهم دول
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
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
وفي الاخر اقولكم كل سنه وانتم طيبين ورمضان كريم علينا كلنا
محدش ينسي يكتبلي كلي سنه وانا طيب في الكوممنتات