احصائياتى

الردود
23

المشاهدات
2818
 
Hazem
.:: المدير العام::.

    غير متواجد

المشاركات
2,311

+التقييم
0.84

تاريخ التسجيل
Apr 2019

الاقامة
Egypt

نظام التشغيل
windows 7

رقم العضوية
1
2019-04-20, 11:35 AM
المشاركة 1
2019-04-20, 11:35 AM
المشاركة 1
افتراضي اضافه Lottery كامل

السلام عليكم ورحمة الله وبركاته

صناديق الحظ ده الي تدخله بالتذاكر وتكسب ايتمات انت وحظك

يلا نبداء

افتح 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 bool UseItem = false; 

في نفس الكلاس مترحش بعيد

ابحث عن


كود:
mapName = "OfflineTG"; 

وتتحت break;

حط دول




كود:
case 700:  
mapName = "LotteryMap";  
break; 

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


كود:
mapName = "DesertArena"; 

اخر ال break;

وضيف دول


كود:
case 0x760:  
mapName = "LotteryHouse";  
break; 

افتح كلاس Entitytable

اتبحث عن


كود:
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; 

ابحث عن


كود:
client.LotteryEntries = 0; 

تحتيه ضيف


كود:
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) 

افتح كلاس

GameState.cs

ابحث عن




كود:
public uint VirtuePoints; 

تحتيه ضيف دول


كود:
public DateTime LastLotteryEntry;  
public 
byte LotteryEntries;  
public 
bool InLottery; 

في مسار

Network/GamePackets

اعمل ملف وسميه باسم

Lottery.cs

ضيف فيه


كود:
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); 
} 
} 
} 
} 

في

npcs.cs

ضيف دول




كود:
#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.cs

ابحث عن


كود:
#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.cs

ابحث عن


كود:
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 

في ملف entities

ضيف الصفوف ده




كود:
InLottery  Tinyint  5  0  
lotteryEntries  Madiumint  10 0  
LastLotteryEntry Bigint 255 0 

في فلدر game في السورس

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

Lottery.cs

ضيف فيه دول


كود:
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.cs



حط فيهم دول




كود:
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."); 
} 
} 
} 

ااخر حاجه ارفع الملف ده لقاعده البيانات

عفواً لايمكن عرض الرابط إلا بعد الرد على الموضوع


قديم 2019-04-26, 01:16 PM
المشاركة 2
salahsayed
.:: عضو نشيط ::.
  • غير متواجد
افتراضي
شكرااااااااا

قديم 2019-04-26, 11:49 PM
المشاركة 3
Hazem
.:: المدير العام::.
  • غير متواجد
افتراضي رد علي الموضوع
عفواً لايمكن عرض الرابط إلا بعد الرد على الموضوع
شكرااااااااا
اهلا بيك اخوي

قديم 2019-06-06, 12:35 PM
المشاركة 4
mrkars
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: صناديق الحظ
شكرا جدا شكرا جدا

قديم 2019-06-11, 07:56 PM
المشاركة 5
Mo Khalid
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: صناديق الحظ
jlhhhhhhhhhhhl

قديم 2019-09-08, 06:25 PM
المشاركة 6
abdo1
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: اضافه Lottery كامل
عاش

قديم 2019-09-08, 06:49 PM
المشاركة 7
abdo1
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: اضافه Lottery كامل
تمام

قديم 2019-09-10, 11:33 AM
المشاركة 8
zorom
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: اضافه Lottery كامل
عاااااااش

قديم 2019-09-10, 12:28 PM
المشاركة 9
ابو مروان
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: اضافه Lottery كامل
الله ينور شغل عالى

قديم 2020-01-28, 01:13 PM
المشاركة 10
ElSaher
.:: مشرف اقسام كونكر ::.
  • غير متواجد
افتراضي رد: اضافه Lottery كامل
عاش يا حازم


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: اضافه Lottery كامل
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
اضافه Hassan Emprator مشكلات السيرفيرات كونكر الشخصيه 2 2019-07-30 05:08 PM
شرح اضافه وحش BoS abuhaneen مشكلات السيرفيرات كونكر الشخصيه 17 2019-05-31 01:34 AM
System Lottery Done 100% Mero تطوير سيرفرات كونكر 11 2019-05-19 04:02 PM
مشكلة في lottery salahsayed مشكلات السيرفيرات كونكر الشخصيه 5 2019-05-09 01:31 PM
مشكلة في lottery salahsayed مشكلات السيرفيرات كونكر الشخصيه 21 2019-04-28 12:54 PM


الساعة الآن 11:11 PM