محمد ياسر
2019-09-13, 03:56 PM
السلام عليكم ورحمة الله وبركاته
ياعني ايه اضافه ال house
ياعني حضرتك البيت الي بتشتريه من البني ادم الي في الماركت النصاب الي بياخد منك التذكره علشان يتفتح بيت
انا من زمان وفي معظم السورسات البيت مش بيكون مضاف في السورس دلوقتي احنا انضيفه كامل باذن الله
نفتح Game
تمام ونعمل كلاس بأسم
House.cs
ونضيف فيه دول
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.MapInform ation info = new Conquer_Online_Server.Database.MapsTable.MapInform ation();
// 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.MapInform ations.Add(info.ID, info);
bool Success = DMaps.CreateDynamicMap2(client.Entity.UID, 1765, (uint)client.Entity.UID, 1);
return;
}
public static void UpgradeHouse(Client.GameClient client)
{
//ServerBase.Kernel.Maps.Remove((ushort)client.Entit y.UID);
Kernel.Maps.Remove((ushort)client.Entity.UID);
bool Success = DMaps.CreateDynamicMap2(client.Entity.UID, 3024, (uint)client.Entity.UID, 1);
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.MapInform ations.Remove((ushort)client.Entity.UID);
Kernel.Maps.Remove((ushort)client.Entity.UID);
Conquer_Online_Server.Database.MapsTable.MapInform ation info = new Conquer_Online_Server.Database.MapsTable.MapInform ation();
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.MapInform ations.Add(info.ID, info);
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
المهم هنلاقى دول فى الاول
public struct MapInformation
{
public ushort ID;
public ushort BaseID;
public uint Status;
public uint Weather;
public uint RaceRecord;
}
تمام كده نخليه كده
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
فى داتا برضوة
المهم ندور على
public static bool CreateDynamicMap(ushort mapadd, ushort mapneed, uint ownerid)
فوقيه نضيف دا
public static Conquer_Online_Server.Game.Map dynamicMap;
public static bool CreateDynamicMap2(ulong mapadd, ushort mapneed, uint ownerid, uint level)
{
bool addedmap = false;
if (Kernel.Maps.ContainsKey(3024))
new Conquer_Online_Server.Game.Map(3024, Database.DMaps.MapPaths[3024]);
Conquer_Online_Server.Game.Map origMap = Kernel.Maps[3024];
//dynamicMap = origMap.CreateDynamicMap2(ownerid);
return addedmap;
}
كده زى الفل اتحلو صح يا معلم سحس هقولك ايوة
نخش فى الان بى سى
#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(721170, 0, 1);
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(721174, 0, 1);
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(721189, 0, 1);
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(721170, 1))
{
client.Inventory.Remove(721170, 1);
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(721174, 1))
{
client.Inventory.Remove(721174, 1);
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.UID, out entity))
{
Teammate.Entity.Teleport(3024, 89, 77);
//client.Entity.Teleport(1765, client.Entity.UID, 79, 58);
}
}
}
}
client.Entity.Teleport(3024, 89, 77);
}
else
{
client.Entity.Teleport(3024, 89, 77);
//client.Entity.Teleport((ushort)client.Entity.UID, 79, 58);
}
}
}
break;
}
#endregion
}
break;
}
#endregion
كده فله القاعده بقى
عفواً لايمكن عرض الروابط في الإرشيف (عفواً لايمكن عرض الروابط في الإرشيف)
ياعني ايه اضافه ال house
ياعني حضرتك البيت الي بتشتريه من البني ادم الي في الماركت النصاب الي بياخد منك التذكره علشان يتفتح بيت
انا من زمان وفي معظم السورسات البيت مش بيكون مضاف في السورس دلوقتي احنا انضيفه كامل باذن الله
نفتح Game
تمام ونعمل كلاس بأسم
House.cs
ونضيف فيه دول
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.MapInform ation info = new Conquer_Online_Server.Database.MapsTable.MapInform ation();
// 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.MapInform ations.Add(info.ID, info);
bool Success = DMaps.CreateDynamicMap2(client.Entity.UID, 1765, (uint)client.Entity.UID, 1);
return;
}
public static void UpgradeHouse(Client.GameClient client)
{
//ServerBase.Kernel.Maps.Remove((ushort)client.Entit y.UID);
Kernel.Maps.Remove((ushort)client.Entity.UID);
bool Success = DMaps.CreateDynamicMap2(client.Entity.UID, 3024, (uint)client.Entity.UID, 1);
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.MapInform ations.Remove((ushort)client.Entity.UID);
Kernel.Maps.Remove((ushort)client.Entity.UID);
Conquer_Online_Server.Database.MapsTable.MapInform ation info = new Conquer_Online_Server.Database.MapsTable.MapInform ation();
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.MapInform ations.Add(info.ID, info);
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
المهم هنلاقى دول فى الاول
public struct MapInformation
{
public ushort ID;
public ushort BaseID;
public uint Status;
public uint Weather;
public uint RaceRecord;
}
تمام كده نخليه كده
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
فى داتا برضوة
المهم ندور على
public static bool CreateDynamicMap(ushort mapadd, ushort mapneed, uint ownerid)
فوقيه نضيف دا
public static Conquer_Online_Server.Game.Map dynamicMap;
public static bool CreateDynamicMap2(ulong mapadd, ushort mapneed, uint ownerid, uint level)
{
bool addedmap = false;
if (Kernel.Maps.ContainsKey(3024))
new Conquer_Online_Server.Game.Map(3024, Database.DMaps.MapPaths[3024]);
Conquer_Online_Server.Game.Map origMap = Kernel.Maps[3024];
//dynamicMap = origMap.CreateDynamicMap2(ownerid);
return addedmap;
}
كده زى الفل اتحلو صح يا معلم سحس هقولك ايوة
نخش فى الان بى سى
#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(721170, 0, 1);
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(721174, 0, 1);
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(721189, 0, 1);
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(721170, 1))
{
client.Inventory.Remove(721170, 1);
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(721174, 1))
{
client.Inventory.Remove(721174, 1);
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.UID, out entity))
{
Teammate.Entity.Teleport(3024, 89, 77);
//client.Entity.Teleport(1765, client.Entity.UID, 79, 58);
}
}
}
}
client.Entity.Teleport(3024, 89, 77);
}
else
{
client.Entity.Teleport(3024, 89, 77);
//client.Entity.Teleport((ushort)client.Entity.UID, 79, 58);
}
}
}
break;
}
#endregion
}
break;
}
#endregion
كده فله القاعده بقى
عفواً لايمكن عرض الروابط في الإرشيف (عفواً لايمكن عرض الروابط في الإرشيف)