منتدي اكواد

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

محمد ياسر 2019-09-13 03:56 PM

اضافه ال house
 

السلام عليكم ورحمة الله وبركاته
ياعني ايه اضافه ال house
ياعني حضرتك البيت الي بتشتريه من البني ادم الي في الماركت النصاب الي بياخد منك التذكره علشان يتفتح بيت
انا من زمان وفي معظم السورسات البيت مش بيكون مضاف في السورس دلوقتي احنا انضيفه كامل باذن الله

نفتح Game

تمام ونعمل كلاس بأسم

House.cs

ونضيف فيه دول
كود PHP:

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

namespace 
Conquer_Online_Server.Game
{
    class 
House//Coded By Bogy
    
{
        public static 
void createhouse(Client.GameClient client)
        {
            
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
            
cmd.Insert("house").Insert("id"client.Entity.UID).Insert("mapdoc""3024").Insert("type""7").Insert("weather""0").Insert("owner"client.Entity.UID).Insert("HouseLevel""1");

            
cmd.Execute();

            
//Conquer_Online_Server.Database.MapsTable.MapInformation info = new Conquer_Online_Server.Database.MapsTable.MapInformation();
           // info.ID = (ushort)client.Entity.UID;
           // info.BaseID = 601;
            //info.Status = 7;
           // info.Weather = 0;
            //info.Owner = client.Entity.UID;
            //info.HouseLevel = 1;
            //Conquer_Online_Server.Database.MapsTable.MapInformations.Add(info.ID, info);
            
bool Success DMaps.CreateDynamicMap2(client.Entity.UID1765, (uint)client.Entity.UID1);
            return;
        }
        public static 
void UpgradeHouse(Client.GameClient client)
        {

            
//ServerBase.Kernel.Maps.Remove((ushort)client.Entity.UID);
            
Kernel.Maps.Remove((ushort)client.Entity.UID);
            
bool Success DMaps.CreateDynamicMap2(client.Entity.UID3024, (uint)client.Entity.UID1);
            new 
MySqlCommand(MySqlCommandType.UPDATE).Update("house").Set("HouseLevel""2").Set("mapdoc""3024").Where("id"client.Entity.UID).Execute();
            return;
        }
        public static 
void AddBox(Client.GameClient client)
        {

            
Conquer_Online_Server.Database.MapsTable.MapInformations.Remove((ushort)client.Entity.UID);
            
Kernel.Maps.Remove((ushort)client.Entity.UID);
            
Conquer_Online_Server.Database.MapsTable.MapInformation info = new Conquer_Online_Server.Database.MapsTable.MapInformation();
            
info.ID = (ushort)client.Entity.UID;
            
info.BaseID 1099;
            
info.Status 7;
            
info.Weather 0;
            
info.Owner client.Entity.UID;
            
info.HouseLevel 2;
            
info.Box 1;
            
info.BoxX client.Entity.X;
            
info.BoxY client.Entity.Y;
            
Conquer_Online_Server.Database.MapsTable.MapInformations.Add(info.IDinfo);

           
            new 
MySqlCommand(MySqlCommandType.UPDATE).Update("house").Set("Box""1").Set("BoxX"client.Entity.X).Set("BoxY"client.Entity.Y).Where("id"client.Entity.UID).Execute();
            return;
        }

    }


تمام يسطى كده

هيجيب ايرورات عارف متقولش حاجه

هيطلع 7 ايرورات صح يا معلم

المهم نحل بقى نفهم ونحل

طبعا فى Owner,HouseLevel,Box,BoxY,BoxX,,CreateDynamicMap2,

سهل اوى نحل بقى

نفتح MapsTable.cs

طبعا فى Database

المهم هنلاقى دول فى الاول
كود PHP:

public struct MapInformation
        
{
            public 
ushort ID;
            public 
ushort BaseID;
            public 
uint Status;
            public 
uint Weather;
            public 
uint RaceRecord;
        } 

تمام كده نخليه كده
كود PHP:

public struct MapInformation
        
{
            public 
ushort ID;
            public 
ushort BaseID;
            public 
uint Status;
            public 
uint Weather;
            public 
uint RaceRecord;
            public 
uint Owner;
            public 
uint HouseLevel;
            public 
uint Box;
            public 
uint BoxX;
            public 
uint BoxY;
        } 

هيبقى ناقص 2 تمام يا عم نحلهم

نفتح DMaps.cs

فى داتا برضوة

المهم ندور على
كود PHP:

public static bool CreateDynamicMap(ushort mapaddushort mapneeduint ownerid

فوقيه نضيف دا
كود PHP:

public static Conquer_Online_Server.Game.Map dynamicMap;
        public static 
bool CreateDynamicMap2(ulong mapaddushort mapneeduint owneriduint level)
        {

            
bool addedmap false;
            if (
Kernel.Maps.ContainsKey(3024))
                new 
Conquer_Online_Server.Game.Map(3024Database.DMaps.MapPaths[3024]);
            
Conquer_Online_Server.Game.Map origMap Kernel.Maps[3024];
            
//dynamicMap = origMap.CreateDynamicMap2(ownerid);


            
return addedmap;
        } 

كده زى الفل اتحلو صح يا معلم سحس هقولك ايوة

نخش فى الان بى سى

كود PHP:

#region HouseAdmin
                
case 30156:
                    {
                        switch (
npcRequest.OptionID)
                        {
                            case 
0:
                                {
                                    if (
Kernel.Maps.ContainsKey((ushort)client.Entity.UID))
                                    {
                                        
dialog.Text("Hey there " client.Entity.Name " i'm HouseAdmin Would you like to Enter your");
                                        
dialog.Text(" House, or maybe wana upgrade ur house by using UpgradeCert?");
                                        
dialog.Text(", or buy Tokens and Furniture?");
                                        
//dialog.Option("Enter House", 2);
                                        //dialog.Option("Create House", 1);
                                        // dialog.Option("House Upgrade", 3);
                                        
dialog.Option("Tokens,Furniture"4);
                                        
dialog.Option("Just Passing By!."255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        
dialog.Text("Hey there " client.Entity.Name " i'm HouseAdmin Would you like to create your");
                                        
dialog.Text(" House you need to get an HousePermit so i can help you or u can go inside ur house if");
                                        
dialog.Text(" you have one already , or maybe wana upgrade ur house by using UpgradeCert?");
                                        
//dialog.Option("go to House", 2);
                                        
dialog.Option("Create House"1);
                                        
dialog.Option("Enter House"2);
                                        
//dialog.Option("House Upgrade", 3);
                                        
dialog.Option("Buy Tokens,Furniture"4);
                                        
dialog.Option("Just Passing By!."255);
                                        
dialog.Send();
                                    }
                                    break;
                                }
                            
#region tokens
                            
case 4:
                                {
                                    
dialog.Text("Hey there " client.Entity.Name " i'm HouseAdmin Would you like to buy house Tokens?");
                                    
dialog.Text(" HousePermit Coast 50k cps and HouseUpgrade Coast 50k cps,");
                                    
dialog.Text("ItemBox 50k cps what u want to buy?");
                                    
dialog.Option("HousePermit"5);
                                    
//dialog.Option("UpgradeCert", 6);
                                    
dialog.Option("ItemBox"7);
                                    
dialog.Option("Just Passing By!."255);
                                    
dialog.Send();
                                    break;
                                }
                            case 
5:
                                {
                                    if (
client.Entity.ConquerPoints 50000)
                                    {
                                        
client.Inventory.Add(72117001);
                                        
client.Entity.ConquerPoints -= 50000;
                                        
dialog.Text("Congratulations you got HousePermit Token");
                                        
dialog.Option("Thanks!"255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        
dialog.Text("sorry you dont have Enough cps to get HousePermit");
                                        
dialog.Option("Sorry!"255);
                                        
dialog.Send();
                                        
//break;
                                    
}
                                    break;
                                }
                            case 
6:
                                {
                                    if (
client.Entity.ConquerPoints 50000)
                                    {
                                        
client.Inventory.Add(72117401);
                                        
client.Entity.ConquerPoints -= 50000;
                                        
dialog.Text("Congratulations you got UpgradeCert Token");
                                        
dialog.Option("Thanks!"255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        
dialog.Text("sorry you dont have Enough cps to get UpgradeCert Token");
                                        
dialog.Option("Sorry!"255);
                                        
dialog.Send();
                                        
//break;
                                    
}
                                    break;
                                }
                            case 
7:
                                {
                                    if (
client.Entity.ConquerPoints 50000)
                                    {
                                        
client.Inventory.Add(72118901);
                                        
client.Entity.ConquerPoints -= 50000;
                                        
dialog.Text("Congratulations you got ItemBox");
                                        
dialog.Option("Thanks!"255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        
dialog.Text("sorry you dont have Enough cps to get ItemBox");
                                        
dialog.Option("Sorry!"255);
                                        
dialog.Send();
                                        
//break;
                                    
}
                                    break;
                                }
                            
#endregion
                            #region Create
                            
case 1:
                                {
                                    if (
Kernel.Maps.ContainsKey((ushort)client.Entity.UID))
                                    {
                                        
dialog.Text("Sorry you already have House cant help you");
                                        
dialog.Option("Oh Sorry!."255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        if (
client.Inventory.Contains(7211701))
                                        {
                                            
client.Inventory.Remove(7211701);
                                            
Game.House.createhouse(client);
                                            
dialog.Text("Congratulations you got New House Goodluck in Caribbean");
                                            
dialog.Option("Thanks!"255);
                                            
dialog.Send();
                                        }
                                        else
                                        {
                                            
dialog.Text("sorry you dont have HousePermit come again later ");
                                            
dialog.Option("sorry!"255);
                                            
dialog.Send();
                                        }
                                    }
                                    break;
                                }
                            
#endregion
                            #region Upgrade
                            
case 3:
                                {
                                    if (
Kernel.Maps.ContainsKey((ushort)client.Entity.UID))
                                    {
                                        
dialog.Text("Sorry you dont have House come again later");
                                        
dialog.Option("Oh Sorry!."255);
                                        
dialog.Send();
                                    }
                                    else
                                    {
                                        if (
Kernel.Maps[(ushort)client.Entity.UID].Level == 1)
                                        {
                                            if (
client.Inventory.Contains(7211741))
                                            {
                                                
client.Inventory.Remove(7211741);
                                                
Game.House.UpgradeHouse(client);
                                                
dialog.Text("Congratulations your House now Level [2] Goodluck in Caribbean");
                                                
dialog.Option("Thanks!"255);
                                                
dialog.Send();
                                            }
                                            else
                                            {
                                                
dialog.Text("Sorry you dont have UpgradeCert come again later ");
                                                
dialog.Option("sorry!"255);
                                                
dialog.Send();
                                            }
                                        }
                                        else
                                        {
                                            
dialog.Text("Sorry your House Already Level 2 Cant upgrade it any more ");
                                            
dialog.Option("sorry!"255);
                                            
dialog.Send();
                                        }
                                    }
                                    break;
                                }
                            
#endregion
                            #region House Teleport
                            
case 2:
                                {

                                    if (
Kernel.Maps.ContainsKey((ushort)client.Entity.UID))
                                    {
                                        
dialog.Text("Sorry you dont have House you need to create one first");
                                        
dialog.Option("Oh Sorry!."255);
                                        
dialog.Send();
                                    }
                                    else
                                    {

                                        if (
client != null)
                                        {
                                            if (
client.Team != null && client.Team.TeamLeader)
                                            {
                                                foreach (
Client.GameClient Teammate in client.Team.Teammates)
                                                {
                                                    if (
Teammate != null)
                                                    {
                                                        if (
Teammate != null)
                                                        {

                                                            
Game.Entity entity;
                                                            if (
client.Screen.TryGetValue(Teammate.Entity.UIDout entity))
                                                            {
                                                                
Teammate.Entity.Teleport(30248977);
                                                                
//client.Entity.Teleport(1765, client.Entity.UID, 79, 58);
                                                            
}

                                                        }
                                                    }
                                                }
                                                
client.Entity.Teleport(30248977);
                                            }
                                            else
                                            {
                                                
client.Entity.Teleport(30248977);

                                                
//client.Entity.Teleport((ushort)client.Entity.UID, 79, 58);
                                            
}
                                        }

                                    }
                                    break;
                                }
                            
#endregion
                        
}
                        break;
                    }
                
#endregion 

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

ALz3em 2019-09-13 04:03 PM

رد: اضافه ال house
 
عاش تسلم أيدك

Hassan Emprator 2019-09-13 04:18 PM

رد: اضافه ال house
 
تسلم ايدك يحزومه

abdo1 2019-09-13 04:49 PM

رد: اضافه ال house
 
عاش

Spider 2019-09-13 05:55 PM

رد: اضافه ال house
 
3ash

ابو حمزه9 2019-09-15 12:46 AM

رد: اضافه ال house
 
تسلم ربنا يخليك

mop 2019-11-03 10:04 AM

رد: اضافه ال house
 
تسلم ايدك

سمير 2019-11-04 04:28 PM

رد: اضافه ال house
 
عااااش

TiTo1 2020-02-08 12:54 PM

رد: اضافه ال house
 
تمام

uncelsam 2020-03-05 05:38 PM

رد: اضافه ال house
 
عااااش


الساعة الآن 03:19 PM

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