Advertisement
AhmedKorwash

Most Buteful Palace

Jan 22nd, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.78 KB | None | 0 0
  1. #region House Voting
  2.  
  3.  
  4.                 case 42493:
  5.                     {
  6.                         switch (npcRequest.OptionID)
  7.                         {
  8.                             case 0:
  9.                                 {
  10.                                     dialog.Text("Hello " + client.Entity.Name + " Iam House Voting Manger");
  11.                                     dialog.Option("Tell Me About The System", 1);
  12.                                     dialog.Option("Let Me join As Voter", 3);
  13.                                     dialog.Option("Let Me Join As House Owner", 2);
  14.                                     dialog.Option(" Change My House Title", 7);
  15.                                     dialog.Option("Thanks Alot Man I will Check it Later", 255);
  16.                                     dialog.Send();
  17.                                     break;
  18.                                 }
  19.                             case 1:
  20.                                 {
  21.                                     dialog.Text("Welcome, This system enable you if u have a house using it to join a big voting to select one house as the most nice house in the game");
  22.                                     dialog.Text("and u can join as voter to make ur choice to select one of this house first time at a day");
  23.  
  24.                                     dialog.Option("Thanks For Information", 255);
  25.                                     break;
  26.  
  27.                                 }
  28.                             case 2: //House Joine Owner
  29.                                 {
  30.                                     dialog.Text("Do U want To Join , you Should Know you will be need to make your house the best to win by voting from another player ");
  31.                                     dialog.Option("I know that, lets go", 4);
  32.                                     dialog.Option("Thanks I Check it later", 255);
  33.                                     break;
  34.                                 }
  35.  
  36.                             case 3: // Voter
  37.                                 {
  38.                                     dialog.Text("Do U want To Vote For A House like you , be sure your choice maybe more affective for final result ");
  39.                                     dialog.Option("I know that, lets go", 5);
  40.                                     dialog.Option("Thanks I Check it later", 255);
  41.                                     break;
  42.                                 }
  43.                             case 5://voter
  44.                                 {
  45.                                     smartinv.Mido.House.HouseInfo voter = new smartinv.Mido.House.HouseInfo();
  46.                                     smartinv.Mido.House.HouseInfo housjoin = new smartinv.Mido.House.HouseInfo();
  47.                                     housjoin.Name = client.Entity.Name;
  48.  
  49.                                     voter.UID = client.Entity.UID;
  50.                                     voter.Name = client.Entity.Name;
  51.                                     voter.Times = client.Entity.Times;
  52.  
  53.  
  54.  
  55.                                     // Sent Dtat to Mysql && Get Owner House ID
  56.                                     MySqlCommand command = new MySqlCommand(MySqlCommandType.INSERT);
  57.                                     command.Insert("VoterHouse").Insert("VoterID", voter.UID)
  58.                                          .Insert("VoterName", voter.Name).Insert("Tiems", voter.Times + 1);
  59.  
  60.                                     command.Execute();
  61.                                     Console.WriteLine("Sent Dtat to Mysql && Get Owner House ID");
  62.                                     //////////////////
  63.                                     //   MySqlCommand commands = new MySqlCommand(MySqlCommandType.INSERT);
  64.                                     //commands.Insert("entities").Insert("VoterHouse", housjoin.Name);
  65.                                     //commands.Execute();
  66.  
  67.  
  68.                                     Console.WriteLine("Replace Name To voterHouse");
  69.  
  70.    
  71.                                     client.Entity.kepspouse = client.Entity.Spouse;
  72.  
  73.                                     string house;
  74.                                     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("housevotjoin"))
  75.                                     using (var reader = new MySqlReader(cmd))
  76.                                         if (reader.Read())
  77.                                         {
  78.  
  79.                                             house = reader.ReadString("HouseName");
  80.                                             client.Entity.Spouse = house;
  81.  
  82.                                             client.Entity.HouseOwner = house;
  83.  
  84.  
  85.  
  86.  
  87.                                             dialog.Text(" Please Select One Of This Competitors");
  88.                                             dialog.Option(client.Entity.HouseOwner, 10);
  89.                                             dialog.Option("Never Mind", 255);
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.                                         }
  98.  
  99.  
  100.                                     /////////
  101.                                     Console.WriteLine("Done Case Vote");
  102.                                     break;
  103.                                 }
  104.                             case 10:
  105.                                 {
  106.                                     if (Mido.House.SpouseHouse(client.Entity.Spouse) != null)
  107.                                     {
  108.                                         var spouse = Mido.House.SpouseHouse(client.Entity.Spouse);
  109.                                         Mido.House.TelePort(client, spouse);
  110.                                     }
  111.                                     else
  112.                                     {
  113.                                         dialog.Text("Sorry can't find one :(");
  114.                                         dialog.Option("Oh Sorry!.", 0xff);
  115.                                         dialog.Send();
  116.                                     }
  117.  
  118.                                     int n = client.Entity.totalvoter;
  119.                                     using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
  120.                                         cmd.Update("totalvoter").Set("totalvoter", n + 1).Where("totalvoter", n)
  121.                                            .Execute();
  122.                                     Console.WriteLine(" TotalVoter Updata Correctly");
  123.                                     uint uid;
  124.                                     uid = client.Entity.UID;
  125.                                     using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
  126.                                         cmd.Update("entities").Set("spouse", client.Entity.kepspouse)
  127.                                             .Where("UID", uid).Execute();
  128.                                     Console.WriteLine(" Spouse Name keep done ");
  129.                                     break;
  130.                                 }
  131.                             case 4: //house owner
  132.                                 {
  133.  
  134.  
  135.                                     smartinv.Mido.House.HouseInfo housjoin = new smartinv.Mido.House.HouseInfo();
  136.                                     housjoin.UID = client.Entity.UID;
  137.                                     housjoin.Name = client.Entity.Name;
  138.                                     housjoin.Percent = client.Entity.Percent;
  139.  
  140.  
  141.                                     dialog.Text(" Your Request Has Been Done");
  142.                                     dialog.Text(" Do u want to rename your House");
  143.                                     dialog.Input("Here:", 6, 14);
  144.                                     dialog.Option("Thanks i prefer My Name", 255);
  145.                                     MySqlCommand command = new MySqlCommand(MySqlCommandType.INSERT);
  146.                                     command.Insert("HouseVotJoin").Insert("HouseID", housjoin.UID)
  147.                                          .Insert("HouseName", housjoin.Name).Insert("Percent", housjoin.Percent);
  148.                                     command.Execute();
  149.  
  150.                                     /////////////
  151.                                     uint uid;
  152.                                     uid = client.Account.EntityID;
  153.                                     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("housevotjoin").Where("HouseID", uid))
  154.                                     using (var reader = new MySqlReader(cmd))
  155.                                         client.Entity.HouseOwner = reader.ReadString("HouseName");
  156.  
  157.                                     break;
  158.                                 }
  159.                             case 6:
  160.                                 {
  161.  
  162.                                     smartinv.Mido.House.HouseInfo housjoin = new smartinv.Mido.House.HouseInfo();
  163.                                     housjoin.title = npcRequest.Input;
  164.  
  165.                                     housjoin.Name = client.Entity.Name;
  166.  
  167.                                     MySqlCommand command = new MySqlCommand(MySqlCommandType.INSERT);
  168.                                     command.Insert("HouseTitle")
  169.                                         .Insert("TittleHouse", housjoin.title).Insert("HouseName", housjoin.Name);
  170.                                     command.Execute();
  171.                                     dialog.Text(" Your House Tittle Has Been Changed");
  172.                                     dialog.Option("Thanks", 255);
  173.                                     break;
  174.                                 }
  175.                             case 7:
  176.                                 {
  177.                                     dialog.Text("Please Insert House Title U need");
  178.                                     dialog.Input("Change My House Tittle", 6, 14);
  179.                                     break;
  180.                                 }
  181.  
  182.                         }
  183.                         break;
  184.                     }
  185.  
  186.  
  187.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement