Advertisement
XConquer

Referidos

Jul 7th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.64 KB | None | 0 0
  1.                 #region AdminDeReferidos
  2.                 case 2920:
  3.                     {
  4.                         string refername = "";
  5.                         switch (npcRequest.OptionID)
  6.                         {
  7.                             case 0:
  8.                                 {
  9.                                     dialog.Text("Soy el AdminDeReferidos. Puedes establecer el referido (Nombre del personaje del amigo que te invito al juego) o reclamar premio si invitaste a alguna persona. Tambien puedo darte 215 CPs por cada 30 Minutos que estes conectado (Si se te desconecta, empezara de 0 el tiempo de conexion).");
  10.                                     dialog.Option("Establecer Referido.", 1);
  11.                                     dialog.Option("Reclamar Premio.", 2);
  12.                                     dialog.Option("Ver puntos de referido.", 3);
  13.                                     dialog.Option("Reclamar Premio por estar conectado.", 4);
  14.                                     dialog.Option("Paso.", 255);
  15.                                     dialog.Send();
  16.                                     break;
  17.                                 }
  18.                             case 1:
  19.                                 {
  20.                                     if (client.Account.IDReferido == 0)
  21.                                     {
  22.                                         dialog.Text("Introduce el nombre del jugador que te invito al juego.");
  23.                                         dialog.Input("Nombre del jugador: ", 10, 16);
  24.                                         dialog.Option("Cerrar.", 255);
  25.                                         dialog.Send();
  26.                                     }
  27.                                     else
  28.                                     {
  29.                                         dialog.Text("Ya tienes un jugador establecido como el que te invito a jugar!");
  30.                                         dialog.Option("Vale", 255);
  31.                                         dialog.Send();
  32.                                     }
  33.                                     break;
  34.                                 }
  35.                             case 2:
  36.                                 {
  37.                                     dialog.Text("Elije el premio que quieres reclamar:");
  38.                                     dialog.Option("20.000 CPs y 5 BossPoints [1 Referido].", 20);
  39.                                     dialog.Option("VIP Nivel 6 por 7 Dias [5 Referidos].", 21);
  40.                                     dialog.Option("Cerrar.", 255);
  41.                                     dialog.Send();
  42.                                     break;
  43.                                 }
  44.                             case 3:
  45.                                 {
  46.                                     uint restanteReferidos = client.Entity.NumReferidos - client.Entity.NumReferidosTotal;
  47.                                     dialog.Text("Tienes " + client.Entity.NumReferidos + " Referidos. " + restanteReferidos + " reclamados y " + client.Entity.NumReferidosTotal + " en total.");
  48.                                     dialog.Option("Vale, gracias.", 255);
  49.                                     dialog.Send();
  50.                                     break;
  51.                                 }
  52.                             case 4:
  53.                                 {
  54.                                     int minutosrestantes = client.Entity.OnlinePoints - 30;
  55.                                     if (client.Entity.OnlinePoints >= 30)
  56.                                     {
  57.                                         Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Obtienes 215 CPs por haber estado conectado 30 Minutos en el juego!");
  58.                                         npc.OptionID = 255;
  59.                                         client.Send(npc.ToArray());
  60.                                         client.Entity.OnlinePoints -= 30;
  61.                                         client.Entity.ConquerPoints += 215;
  62.                                     }
  63.                                     else
  64.                                     {
  65.                                         dialog.Text("Has estado conectado " + client.Entity.OnlinePoints + " Minutos. Te quedan " + minutosrestantes + " para reclamar los 215 CPs");
  66.                                         dialog.Option("Vale, gracias.", 255);
  67.                                         dialog.Send();
  68.                                     }
  69.                                     break;
  70.                                 }
  71.                             case 10:
  72.                                 {
  73.                                     if (npcRequest.Input == "" || npcRequest.Input.Contains(" "))
  74.                                     {
  75.                                         dialog.Text("No colocaste ningun nombre de personaje");
  76.                                         dialog.Option("Ya veo.", 255);
  77.                                         dialog.Send();
  78.                                         return;
  79.                                     }
  80.                                     bool readok = false;
  81.                                     if (npcRequest.Input != client.Entity.Name)
  82.                                     {
  83.                                         if (npcRequest.Input != "")
  84.                                         {
  85.                                             using (var rdr = new MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", npcRequest.Input)))
  86.                                             {
  87.                                                 if (rdr.Read())
  88.                                                 {
  89.                                                     refername = rdr.ReadString("Name");
  90.                                                     client.Account.IDReferido = rdr.ReadUInt32("UID");
  91.                                                     readok = true;
  92.                                                 }
  93.                                             }
  94.                                             if (readok == false)
  95.                                             {
  96.                                                 dialog.Text("El nombre de personaje no existe!");
  97.                                                 dialog.Option("Vale!", 255);
  98.                                                 dialog.Send();
  99.                                                 return;
  100.                                             }
  101.                                             if (readok == true)
  102.                                             {
  103.                                                 if (client.Account.Referido(client.Account.IP, client.Account.Username, npcRequest.Input) == false)
  104.                                                 {
  105.                                                     client.Account.GuardarReferidos(client.Account.Username);
  106.                                                     dialog.Text("Jugador " + refername + "Establecido como el que te invito a jugar.");
  107.                                                     dialog.Option("Cerrar.", 255);
  108.                                                     dialog.Send();
  109.                                                     EntityTable.UpdateReferidosPJ(client.Account.IDReferido);
  110.                                                     return;
  111.                                                 }
  112.                                                 else
  113.                                                 {
  114.                                                     dialog.Text("Ese jugador ya lo tienes de referido en alguna de tus cuentas!");
  115.                                                     dialog.Option("Vaya, me has pillado!", 255);
  116.                                                     dialog.Send();
  117.                                                 }
  118.                                             }
  119.                                         }
  120.                                     }
  121.                                     break;
  122.                                 }
  123.                             case 20:
  124.                                 {
  125.                                     if (client.Entity.NumReferidos >= 1)
  126.                                     {
  127.                                         client.Entity.NumReferidos -= 1;
  128.                                         client.Entity.BossPoints += 5;
  129.                                         client.Entity.ConquerPoints += 20000;
  130.                                         dialog.Text("Obtienes el premio por tener un referido");
  131.                                         dialog.Option("Gracias!", 255);
  132.                                         dialog.Send();
  133.                                     }
  134.                                     break;
  135.                                 }
  136.                             case 21:
  137.                                 {
  138.                                     if (client.Entity.VIPLevel != 6)
  139.                                     {
  140.                                         if (client.Entity.NumReferidos >= 5)
  141.                                         {
  142.                                             client.Entity.NumReferidos -= 5;
  143.                                             client.Entity.VIPLevel = 6;
  144.                                             client.Entity.VIPLevelDays = 6;
  145.                                             client.Entity.VIPDays = 7;
  146.                                             dialog.Text("Obtienes el premio por tener un referido");
  147.                                             dialog.Option("Gracias!", 255);
  148.                                             dialog.Send();
  149.                                         }
  150.                                         else
  151.                                         {
  152.                                             dialog.Text("Por favor regresa cuando tengas los 5 referidos.");
  153.                                             dialog.Option("Ya veo.", 255);
  154.                                             dialog.Avatar(116);
  155.                                             dialog.Send();
  156.  
  157.                                         }
  158.                                     }
  159.                                     else
  160.                                     {
  161.                                         dialog.Text("Lo siento, ya tienes VIP nivel 6.");
  162.                                         dialog.Option("Ya veo.", 255);
  163.                                         dialog.Avatar(116);
  164.                                         dialog.Send();
  165.                                     }
  166.                                     break;
  167.                                 }
  168.                         }
  169.                         break;
  170.                     }
  171.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement