منتدي اكواد

منتدي اكواد (https://code.vpscairo.com/index.php)
-   تطوير سيرفرات كونكر (https://code.vpscairo.com/forumdisplay.php?f=11)
-   -   اضافه Lottery كامل (https://code.vpscairo.com/showthread.php?t=77)

محمد ياسر 2019-04-20 11:35 AM

اضافه Lottery كامل
 

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

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

يلا نبداء

افتح Entity او player

ابحث عن

كود PHP:

public Time32 FreezeStamp

ضيف فقيهم او تحتيهم دول

كود PHP:

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

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

كود PHP:

public bool UseItem false

ضيف تحته

كود PHP:

public bool UseItem false

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

ابحث عن

كود PHP:

mapName "OfflineTG"

وتتحت break;

حط دول



كود PHP:

case 700:  
mapName "LotteryMap";  
break; 

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

كود PHP:

mapName "DesertArena"

اخر ال break;

وضيف دول

كود PHP:

case 0x760:  
mapName "LotteryHouse";  
break; 

افتح كلاس Entitytable

اتبحث عن

كود PHP:

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

تحتيه ضيف

كود PHP:

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

ابحث عن

كود PHP:

client.ExpBalls 0

ضيف تحتيه

كود PHP:

client.LotteryEntries 0

ابحث عن

كود PHP:

client.LotteryEntries 0

تحتيه ضيف

كود PHP:

ResetLottery(client); 

ابحث عن

كود PHP:

public static void ResetExpball 

تحتيه ضيف دول

كود PHP:

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


خد تعال لسه مخلصناش عارفك زهقت

ابحث عن

كود PHP:

.Set("Class"e.Class) 

كود PHP:

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

افتح كلاس

GameState.cs

ابحث عن



كود PHP:

public uint VirtuePoints

تحتيه ضيف دول

كود PHP:

public DateTime LastLotteryEntry;  
public 
byte LotteryEntries;  
public 
bool InLottery

في مسار

Network/GamePackets

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

Lottery.cs

ضيف فيه

كود PHP:

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(260this.mData); 
Writer.Write((ushort)13142this.mData); 
Writer.Write((byte)16this.mData); 

public 
Lottery(byte[] d

this.mData = new byte[d.Length]; 
d.CopyTo(this.mData0); 

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.mData10)); 

set 

Writer.Write((ushort)value10this.mData); 


public 
byte Plus 

get 

return 
this.mData[9]; 

set 

Writer.Write(value9this.mData); 


public 
uint Prize 

get 

return 
BitConverter.ToUInt32(this.mData12); 

set 

Writer.Write(value12this.mData); 


public 
byte SocketOne 

get 

return 
this.mData[7]; 

set 

Writer.Write(value7this.mData); 


public 
byte SocketTwo 

get 

return 
this.mData[8]; 

set 

Writer.Write(value8this.mData); 


public 
LotteryTypes Type 

get 

return (
LotteryTypes)BitConverter.ToUInt16(this.mData4); 

set 

Writer.Write((ushort)value4this.mData); 





في

npcs.cs

ضيف دول



كود PHP:

#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(7004047); 

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(7115043)) 

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(7115043); 
client.Inventory.Add(300885601); 

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(1036219193); 
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.ActiveNpcclientfalse); 
break; 

#endregion 

في كلاس

PacketHandler.cs

ابحث عن

كود PHP:

#region PK Explorer 

فقيه ضيف دول

كود PHP:

#region Lottery (1314)  
case 1314:  
{  
Game.Lottery.Handle(packetclient);  
break;  
}  
#endregion 

ابحث عن

كود PHP:

#region Gates 

فقيه ضيف

كود PHP:

#region SmallLotteryTicketPack  
case 724002:  
{  
client.Inventory.Remove(itemGame.Enums.ItemUse.RemoveFromStack);  
client.Inventory.Add(71150403);  
break;  
}  
#endregion 

في كلاس

vipstatus.cs

ابحث عن

كود PHP:

public enum VIPExtras 

تحت القوس ضيف

كود PHP:

BonusLottery 0x8000

في النفي كات

npc

كود PHP:

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

كود PHP:

700    700    66124    0 

في ملف entities

ضيف الصفوف ده



كود PHP:

InLottery  Tinyint  5  0  
lotteryEntries  Madiumint  10 0  
LastLotteryEntry Bigint 255 0 

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

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

Lottery.cs

ضيف فيه دول

كود PHP:

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 HeroConquerItem 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.Namestr4); 
if ((
Conquer_Online_Server.Game.Enums.ItemQuality)(i.ID 10) >= Conquer_Online_Server.Game.Enums.ItemQuality.Elite

Kernel.SendWorldMessage(new Message(msgSystem.Drawing.Color.RedConquer_Online_Server.Network.GamePackets.Message.Talk), Program.Values); 

else 

Hero.Send(new Message(msgSystem.Drawing.Color.WhiteMessage.Talk)); 


public static 
void GiveLotteryPrize(Conquer_Online_Server.Client.GameState Hema

LotteryRewardMessage(HemaHema.Entity.LotteryPrize); 
Conquer_Online_Server.Database.ConquerItemInformation Itemd = new Conquer_Online_Server.Database.ConquerItemInformation(Hema.Entity.LotteryItemID0); 
//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(ItemConquer_Online_Server.Game.Enums.ItemUse.CreateAndAdd); 
Hema.Entity.LotteryItemID 0
Hema.Entity.LotteryJadeAdd 0

public static 
void LuckyBox(uint npcIDConquer_Online_Server.Client.GameState hbool jade

if (
jade || h.Inventory.Contains(0xadb503)) 

if (!
jade

h.LotteryEntries += 1
h.Activenes.SendSinglePacket(hActiveness.Types.LotteryTaskh.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) != && 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(0xadb503)) 

h.Inventory.Remove(0xadb503); 

else 

return; 


else 

if (
h.Inventory.Contains(0xadb501)) 

h.Inventory.Remove(0xadb501); 

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.Nameh.Entity.Name); 
h.Send(new Message(msgSystem.Drawing.Color.WhiteMessage.Talk)); 


public static 
void Handle(byte[] DataConquer_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(0xadb501)) 

LuckyBox(0Clienttrue); 

break; 
case 
Conquer_Online_Server.Network.GamePackets.Lottery.LotteryTypes.Continue: 
LuckyBox(0Clientfalse); 
break; 






في فلدر Database

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

LotteryTable.cs



حط فيهم دول



كود PHP:

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 RankChance
public 
string Name
public 
uint ID
public 
byte Color
public 
byte Sockets
public 
byte Plus
public 
uint NPCID

public static List<
LotteryItemLotteryItems = 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."); 




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

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

salahsayed 2019-04-26 01:16 PM

شكرااااااااا

محمد ياسر 2019-04-26 11:49 PM

رد علي الموضوع
 
اقتباس:

المشاركة الأصلية كتبت بواسطة salahsayed (المشاركة 405)
شكرااااااااا

اهلا بيك اخوي

mrkars 2019-06-06 12:35 PM

رد: صناديق الحظ
 
شكرا جدا شكرا جدا

Mo Khalid 2019-06-11 07:56 PM

رد: صناديق الحظ
 
jlhhhhhhhhhhhl

abdo1 2019-09-08 06:25 PM

رد: اضافه Lottery كامل
 
عاش

abdo1 2019-09-08 06:49 PM

رد: اضافه Lottery كامل
 
تمام

zorom 2019-09-10 11:33 AM

رد: اضافه Lottery كامل
 
عاااااااش

ابو مروان 2019-09-10 12:28 PM

رد: اضافه Lottery كامل
 
الله ينور شغل عالى

ElSaher 2020-01-28 01:13 PM

رد: اضافه Lottery كامل
 
عاش يا حازم


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

مرحبا بكم في منتدي اكواد لتطوير الالعاب