Advertisement
serhatyucell

CSGO V2 [BETA]

Dec 3rd, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.84 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Random;
  3. import java.util.Scanner;
  4.  
  5. public class CSGONew {
  6.  
  7.     public static void main(String[] args) {
  8.         //Para Sistemi
  9.         int totalCash = 100;
  10.         double currentCash = 100;
  11.         //Kasa anahtarı fiyatları
  12.         int kroma3KeyPrice = 7;
  13.         int kroma2KeyPrice = 5;
  14.         int ankaKeyPrice = 3;
  15.         int revolverKeyPrice = 4;
  16.         //Varsayılan satın alınmış kasa sayısı
  17.         int kroma3keybought = 0, kroma2keybought = 0, ankakeybought = 0, revolverkeybought = 0;
  18.        
  19.         //Döngüleri sonlandırmak için değişkenler
  20.         boolean turnHead = false;
  21.         boolean finall = false;
  22.         boolean returnStart = false;
  23.         //Silah envanteri için ArrayList
  24.         ArrayList<String> guns = new ArrayList<String>();
  25.         ArrayList<Double> gPrice = new ArrayList<Double>();
  26.        
  27.         //Program BAŞLIYOR...
  28.        
  29.         while (finall == false) {
  30.         System.out.println("---[<<CASH INFO>>]---");
  31.         System.out.println("Info: You have " + currentCash + "$ in your wallet. \n");
  32.        
  33.         // Anahter envanterini listesli hiç anahtarım yoksa boşa
  34.        if (kroma3keybought == 0 && kroma2keybought == 0 && ankakeybought == 0 && revolverkeybought == 0) {
  35.            System.out.println("---[<<KEYS>>]---\nYou don't have any key, press 1 to buy!");
  36.        }
  37.        
  38.        else {
  39.            System.out.println("---[<<KEYS>>]---\nYou have Kroma 3 Key: " + kroma3keybought + "\nYou have Kroma 2 Key: " + kroma2keybought + "\nYou have Anka Key: " + ankakeybought + "\nYou have Revolver Key: " + revolverkeybought);
  40.        }
  41.         System.out.println("\n---[<<WEAPONS>>]---");
  42.         int size = guns.size();
  43.         printWeapons(size,guns,gPrice);
  44.        
  45.         System.out.println("\n---[<<START PAGE MENU>>]---");
  46.         System.out.print("1: To Buy Case Key\n2: To Open Case\n3: To sell weapon\n4: Refresh weapon list\n\n[!Process] Enter your choice:");
  47.         Scanner mainmenu = new Scanner (System.in);
  48.         int menu = mainmenu.nextInt();
  49.        
  50.         if (menu==1) {
  51.            
  52.             //Credit System is Starting
  53.            
  54.            
  55.            
  56.             while (turnHead == false && currentCash >= kroma3KeyPrice || currentCash >= kroma2KeyPrice || currentCash >= ankaKeyPrice || currentCash >= revolverKeyPrice) {
  57.             System.out.println("\n--[KEY MENU]--\nWhich type key do you want to buy? \n1:Kroma 3 Key (" + kroma3KeyPrice + "$)\n2:Kroma 2 Key (" + kroma2KeyPrice + "$)\n3:Anka Key (" + ankaKeyPrice + "$)\n4:Revolver Key (" + revolverKeyPrice + "$)\n0:Return Start Menu");
  58.             System.out.print("\n[!Process] Enter the type value: ");
  59.             Scanner type = new Scanner (System.in);
  60.             int keyType = type.nextInt();          
  61.            
  62.             if (keyType!=0) {
  63.                
  64.                
  65.                
  66.                 while (returnStart = false && currentCash >= kroma3KeyPrice || currentCash >= kroma2KeyPrice || currentCash >= ankaKeyPrice || currentCash >= revolverKeyPrice) {
  67.                    
  68.                     if (keyType == 1) {
  69.                         Scanner keyNumberBuy = new Scanner (System.in);
  70.                         System.out.print("\nHow much key do you want? Max(" + maxKeyNumber(currentCash, kroma3KeyPrice) + ") | 0: Change Key Type : ");
  71.                         int keyNumber = keyNumberBuy.nextInt();
  72.                         int boughtKeyPrice = keyNumber*kroma3KeyPrice;
  73.                         currentCash = (currentCash)-(keyNumber*kroma3KeyPrice);
  74.                        
  75.                         if (keyNumber==0) {
  76.                             System.out.println("\nInfo: You returned KEY MENU\n");
  77.                             break;
  78.                         }
  79.                        
  80.                         else if (currentCash >= 0 && keyNumber <= maxKeyNumber(currentCash, kroma3KeyPrice)) {
  81.                             System.out.println("+Succes: You bought " + keyNumber + " Kroma3 key and " + currentCash + "$ cash left.");
  82.                             kroma3keybought = kroma3keybought +keyNumber;
  83.                            
  84.                         }
  85.                        
  86.                         else {
  87.                             System.out.println("You can not buy more than max key value! Your cash is not enough!");
  88.                         }
  89.                        
  90.                        
  91.                     }
  92.                    
  93.                     else if (keyType == 2) {
  94.                         Scanner keyNumberBuy = new Scanner (System.in);
  95.                         System.out.print("How much key do you want? Max(" + maxKeyNumber(currentCash, kroma2KeyPrice) + ") | 0: Change Key Type : ");
  96.                         int keyNumber = keyNumberBuy.nextInt();
  97.                         int boughtKeyPrice = keyNumber*kroma2KeyPrice;
  98.                         currentCash = (currentCash)-(keyNumber*kroma2KeyPrice);
  99.                        
  100.                         if (keyNumber==0) {
  101.                             System.out.println("\nInfo: You returned KEY MENU\n");
  102.                             break;
  103.                         }
  104.                        
  105.                         if (currentCash >= 0 && keyNumber <= maxKeyNumber(currentCash, kroma2KeyPrice)) {
  106.                             System.out.println("+Succes: You bought " + keyNumber + " Kroma2 key and " + currentCash + "$ cash left.");
  107.                             kroma2keybought = kroma2keybought +keyNumber;
  108.                         }
  109.                        
  110.                         else {
  111.                             System.out.println("You can not buy more than max key value! Your cash is not enough!");
  112.                         }
  113.                        
  114.                     }
  115.                    
  116.                     else if (keyType == 3) {
  117.                         Scanner keyNumberBuy = new Scanner (System.in);
  118.                         System.out.print("How much key do you want? Max(" + maxKeyNumber(currentCash, ankaKeyPrice) + ") | 0: Change Key Type : ");
  119.                         int keyNumber = keyNumberBuy.nextInt();
  120.                         int boughtKeyPrice = keyNumber*ankaKeyPrice;
  121.                         currentCash = (currentCash)-(keyNumber*ankaKeyPrice);
  122.                        
  123.                         if (keyNumber==0) {
  124.                             System.out.println("-\nInfo: You returned KEY MENU\n");
  125.                             break;
  126.                         }
  127.                        
  128.                         if (currentCash >= 0 && keyNumber <= maxKeyNumber(currentCash, ankaKeyPrice)) {
  129.                             System.out.println("+Succes: You bought " + keyNumber + " Anka key and " + currentCash + "$ cash left.");
  130.                             ankakeybought = ankakeybought +keyNumber;
  131.                         }
  132.                        
  133.                         else {
  134.                             System.out.println("You can not buy more than max key value! Your cash is not enough!");
  135.                         }
  136.                        
  137.                     }
  138.                    
  139.                     else if (keyType == 4) {
  140.                         Scanner keyNumberBuy = new Scanner (System.in);
  141.                         System.out.print("How much key do you want? Max(" + maxKeyNumber(currentCash, revolverKeyPrice) + ") | 0: Change Key Type : ");
  142.                         int keyNumber = keyNumberBuy.nextInt();
  143.                         int boughtKeyPrice = keyNumber*revolverKeyPrice;
  144.                         currentCash = (currentCash)-(keyNumber*revolverKeyPrice);
  145.                        
  146.                         if (keyNumber==0) {
  147.                             System.out.println("\nInfo: You returned KEY MENU\n");
  148.                             break;
  149.                         }
  150.                        
  151.                         if (currentCash >= 0 && keyNumber <= maxKeyNumber(currentCash, revolverKeyPrice)) {
  152.                             System.out.println("+Succes: You bought " + keyNumber + " Revolver key and " + currentCash + "$ cash left.");
  153.                             revolverkeybought = revolverkeybought +keyNumber;
  154.                         }
  155.                        
  156.                         else {
  157.                             System.out.println("You can not buy more than max key value! Your cash is not enough!");
  158.                         }
  159.                     }
  160.                    
  161.  
  162.                    
  163.                     else {
  164.                         System.out.println("Please enter valid key type number!\n");
  165.                         break;
  166.                     }
  167.                    
  168.                    
  169.                     }//while    
  170.                
  171.                
  172.                
  173.                
  174.             }
  175.            
  176.            
  177.             else {
  178.                 System.out.println("\n+Succes: You returned to start menu!\n");
  179.                 break;
  180.             }
  181.  
  182.             }//while
  183.            
  184.            
  185.            
  186.             //Credits System Ending Here!          
  187.            
  188.         }
  189.        
  190.         else if (menu==2) {
  191.            
  192.             //Kasa Açma Bölümü Burada Başlıyor
  193.            
  194.                // Kroma 3 Kasası Şans Değerleri
  195.             String[] kroma3 = new String[100];
  196.             String[] kroma2 = new String[100];
  197.             String[] anka = new String[100];
  198.             String[] revolver = new String[100];
  199.             //%50
  200.             for (int i = 0; i < 50; i++) {
  201.                 kroma3[i] = "Kroma 3 >> Iron Weapon";
  202.                 kroma2[i] = "Kroma 2 >> Iron Weapon";
  203.                 anka[i] = "Anka >> Iron Weapon";
  204.                 revolver[i] = "Revolver >> Iron Weapon";
  205.                
  206.             }
  207.             //%25
  208.             for (int i = 50; i < 75; i++) {
  209.                 kroma3[i] = "Kroma 3 >> Silver Weapon";
  210.                 kroma2[i] = "Kroma 2 >> Silver Weapon";
  211.                 anka[i] = "Anka >> Silver Weapon";
  212.                 revolver[i] = "Revolver >> Silver Weapon";
  213.                
  214.             }
  215.             //%20
  216.             for (int i = 75; i < 95; i++) {
  217.                 kroma3[i] = "Kroma 3 >> Gold Weapon";
  218.                 kroma2[i] = "Kroma 2 >> Gold Weapon";
  219.                 anka[i] = "Anka >> Gold Weapon";
  220.                 revolver[i] = "Revolver >> Gold Weapon";
  221.                
  222.             }
  223.             //%5
  224.             for (int i = 95; i <= 99; i++) {
  225.                 kroma3[i] = "Kroma 3 >> Titanium Weapon";
  226.                 kroma2[i] = "Kroma 2 >> Titanium Weapon";
  227.                 anka[i] = "Anka >> Titanium Weapon";
  228.                 revolver[i] = "Revolver >> Titanium Weapon";
  229.                
  230.             }
  231.            
  232.             // Silahların Kalitesi
  233.            
  234.             String[] weaponQuality = new String[100];
  235.             //%30
  236.             for (int i = 0; i < 30; i++) {
  237.                 weaponQuality[i] = " | Industrial Grade";
  238.                
  239.             }
  240.             //%30
  241.             for (int i = 30; i < 60; i++) {
  242.                 weaponQuality[i] = " | Restricted";
  243.                
  244.             }
  245.             //%25
  246.             for (int i = 60; i < 85; i++) {
  247.                 weaponQuality[i] = " | Classified";
  248.                
  249.             }
  250.             //%15
  251.             for (int i = 85; i < 99; i++) {
  252.                 weaponQuality[i] = " | Special Edition";
  253.                
  254.             }
  255.            
  256.             if (kroma3keybought>0 || kroma2keybought>0 || ankakeybought>0 || revolverkeybought>0) {
  257.                
  258.                
  259.                  System.out.println("\n1:Kroma 3 | 2:Kroma 2 | 3:Anka Operasyon | 4:Revolver Case | 0:Exit");
  260.                    
  261.                     boolean finish = false;
  262.                    
  263.                     while(finish==false) {
  264.                  
  265.                        
  266.                     Scanner s = new Scanner (System.in);    
  267.                     System.out.print("\n[!Process] Select the box which you want to open: ");
  268.                     int kutu = s.nextInt();
  269.                        
  270.                     Random w = new Random();
  271.                     int RandomWeapon = w.nextInt(100);
  272.                     Random q = new Random();
  273.                     int RandomWeaponQuality = q.nextInt(100);
  274.                  
  275.          
  276.                    if (kutu==1) {
  277.                        
  278.                        if (kroma3keybought>0) { //kroma3 anahtarı var mı kontrol et
  279.                            System.out.println("\n+You won new weapon: " + kroma3[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  280.                            guns.add(kroma3[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  281.                            gPrice.add(printWeaponPrice(RandomWeapon,RandomWeaponQuality));
  282.                            kroma3keybought--;
  283.                         }
  284.                        
  285.                        else {
  286.                            System.out.println("\n-Fail: You do not have Kroma 3 Key!");
  287.                        }
  288.                        
  289.                        
  290.                     }
  291.                    
  292.                     else if (kutu==2) {
  293.                        
  294.                            if (kroma2keybought>0) { //kroma2 anahtarı var mı kontrol et
  295.                                System.out.println("\n+You won new weapon: " + kroma2[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  296.                                guns.add(kroma2[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  297.                                gPrice.add(printWeaponPrice(RandomWeapon,RandomWeaponQuality));
  298.                                kroma2keybought--;
  299.                             }
  300.                            
  301.                            else {
  302.                                System.out.println("\n-Fail: You do not have Kroma 2 Key!");
  303.                            }
  304.                        
  305.                     }
  306.                    
  307.                     else if (kutu==3) {
  308.                        
  309.                            if (ankakeybought>0) { //anka anahtarı var mı kontrol et
  310.                                System.out.println("\n+You won new weapon: " + anka[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  311.                                guns.add(anka[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  312.                                gPrice.add(printWeaponPrice(RandomWeapon,RandomWeaponQuality));
  313.                                ankakeybought--;
  314.                             }
  315.                            
  316.                            else {
  317.                                System.out.println("\n-Fail: You do not have Anka Key!");
  318.                            }
  319.                        
  320.                     }
  321.                    
  322.                     else if (kutu==4) {
  323.                            if (revolverkeybought>0) { //revolver anahtarı var mı kontrol et
  324.                                System.out.println("\n+You won new weapon: " + revolver[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  325.                                guns.add(revolver[RandomWeapon] + weaponQuality[RandomWeaponQuality]);
  326.                                gPrice.add(printWeaponPrice(RandomWeapon,RandomWeaponQuality));
  327.                                
  328.                                revolverkeybought--;
  329.                             }
  330.                            
  331.                            else {
  332.                                System.out.println("\n-Fail: You do not have Revolver Key!");
  333.                            }
  334.                     }
  335.                    
  336.                     else if (kutu==0) {
  337.                        
  338.                         Scanner exit = new Scanner (System.in);
  339.                         System.out.println("\n[!Process] Are you sure about the exit? [y,n]:");
  340.                         char exit2 = exit.nextLine().charAt(0);
  341.                         if (exit2 == 'y' || exit2 == 'Y' ) {
  342.                             break;
  343.                         }
  344.                        
  345.                         else {
  346.                             continue;
  347.          
  348.                         }
  349.                     }
  350.                    
  351.                     else if (kutu>=6) {
  352.                         System.out.println("Please choose correct case number!");
  353.                     }
  354.                    
  355.                    
  356.                    
  357.                     }
  358.                    
  359.                
  360.                
  361.                   //Kasa Açma Bölümü Burada Bitiyor
  362.                
  363.                
  364.             } //if bitti - kasa anahtarı varsa
  365.            
  366.                
  367.             else { //hiç kasa anahtarı yoksa
  368.                 System.out.println("-Fail: You don't have any key! Firstly, you have to buy key.\n");
  369.             }
  370.                
  371.            
  372.            
  373.         }
  374.         // silah satma fonksiyonu başlıyor
  375.        
  376.         else if (menu==3) {
  377.            
  378.             boolean sellgun = false;
  379.             printWeapons(size,guns,gPrice);
  380.            
  381.             while(sellgun == false) {
  382.            
  383.             Scanner sg = new Scanner (System.in);
  384.             System.out.println("Plaese enter the weapon ID to sell [0: Return main menu]: ");
  385.             int sgchoice = sg.nextInt();
  386.            if (sgchoice < 0 || sgchoice > size) {
  387.                System.out.println("Please enter the valid weapon ID!");
  388.            }
  389.            
  390.            else {
  391.                if (sgchoice != 0) {
  392.                 Object o = guns.get(sgchoice-1);
  393.                 double soldGunPrice = gPrice.get(sgchoice-1);
  394.                    if (o!= "SOLD!") {
  395.                    
  396.                        guns.set(sgchoice-1, "SOLD!");
  397.                        gPrice.set(sgchoice-1, 0.0);
  398.                        currentCash = soldGunPrice + currentCash;
  399.                        }
  400.                      
  401.                        else  {
  402.                         System.out.println("You are already sold this item! Try another ID.");
  403.                        }
  404.                
  405.                }
  406.                
  407.                else {
  408.                 break;
  409.                }
  410.            }
  411.            
  412.  
  413.            
  414.         }// sellgun while
  415.            
  416.         }//menu 3 bitti
  417.        
  418.         else if (menu == 4) { // silah listesini yenile
  419.            
  420.             for (int i = 0; i < size; i++) {
  421.                 String a1 = guns.get(i);
  422.                 double a2 = gPrice.get(i);
  423.                
  424.                 if (a1 == "SOLD!" && a2 == 0.0) {
  425.                     guns.remove(i);
  426.                     gPrice.remove(i);
  427.                 }
  428.                 int size2 = guns.size();
  429.                 size = size2;
  430.             }
  431.            
  432.         }//menu 4 bitti
  433.        
  434.         else  { //start menude 1,2 veya 3 dışında bir şeye basıldıysa
  435.             System.out.println("Please enter valid menu option!");
  436.         }
  437.        
  438.        
  439.        
  440.  
  441.     }//first while
  442.    
  443.    
  444.    
  445.    
  446.     }//main methods ending
  447.  
  448.    
  449.  
  450.     private static double printWeaponPrice(int RandomWeapon, int RandomWeaponQuality) {
  451.        
  452.          //Silah fiyatları
  453.         int ironWeaponPrice = 100;
  454.         int silverWeaponPrice = 200;
  455.         int goldWeaponPrice = 200;
  456.         int titaniumWeaponPrice = 400;
  457.         //Silah kalitesi katlayıcısı
  458.         double igPrice = 0.5;
  459.         double resPrice = 0.8;
  460.         double clasPrice = 1.5;
  461.         double specPrice = 3.5;
  462.         double weaponPrice = 0;
  463.        
  464.        
  465.         if (0<=RandomWeapon && RandomWeapon <50) {
  466.            if (0<=RandomWeaponQuality && RandomWeaponQuality<30) {
  467.                weaponPrice = ironWeaponPrice*igPrice;
  468.            }
  469.            
  470.            else if (30<=RandomWeaponQuality && RandomWeaponQuality<60) {
  471.                weaponPrice = ironWeaponPrice*resPrice;
  472.            }
  473.            
  474.            else if (60<=RandomWeaponQuality && RandomWeaponQuality<85) {
  475.                weaponPrice = ironWeaponPrice*clasPrice;
  476.            }
  477.            
  478.            else if (85<=RandomWeaponQuality && RandomWeaponQuality<99) {
  479.                weaponPrice = ironWeaponPrice*specPrice;
  480.            }
  481.            
  482.         }
  483.        
  484.         else if (50<=RandomWeapon && RandomWeapon <75) {
  485.            if (0<=RandomWeaponQuality && RandomWeaponQuality<30) {
  486.                weaponPrice = silverWeaponPrice*igPrice;
  487.            }
  488.            
  489.            else if (30<=RandomWeaponQuality && RandomWeaponQuality<60) {
  490.                weaponPrice = silverWeaponPrice*resPrice;
  491.            }
  492.            
  493.            else if (60<=RandomWeaponQuality && RandomWeaponQuality<85) {
  494.                weaponPrice = silverWeaponPrice*clasPrice;
  495.            }
  496.            
  497.            else if (85<=RandomWeaponQuality && RandomWeaponQuality<99) {
  498.                weaponPrice = silverWeaponPrice*specPrice;
  499.            }
  500.         }
  501.        
  502.         else if (75<=RandomWeapon && RandomWeapon <95) {
  503.            if (0<=RandomWeaponQuality && RandomWeaponQuality<30) {
  504.                weaponPrice = goldWeaponPrice*igPrice;
  505.            }
  506.            
  507.            else if (30<=RandomWeaponQuality && RandomWeaponQuality<60) {
  508.                weaponPrice = goldWeaponPrice*resPrice;
  509.            }
  510.            
  511.            else if (60<=RandomWeaponQuality && RandomWeaponQuality<85) {
  512.                weaponPrice = goldWeaponPrice*clasPrice;
  513.            }
  514.            
  515.            else if (85<=RandomWeaponQuality && RandomWeaponQuality<99) {
  516.                weaponPrice = goldWeaponPrice*specPrice;
  517.            }
  518.         }
  519.        
  520.         else if (95<=RandomWeapon && RandomWeapon <99) {
  521.            if (0<=RandomWeaponQuality && RandomWeaponQuality<30) {
  522.                weaponPrice = titaniumWeaponPrice*igPrice;
  523.            }
  524.            
  525.            else if (30<=RandomWeaponQuality && RandomWeaponQuality<60) {
  526.                weaponPrice = titaniumWeaponPrice*resPrice;
  527.            }
  528.            
  529.            else if (60<=RandomWeaponQuality && RandomWeaponQuality<85) {
  530.                weaponPrice = titaniumWeaponPrice*clasPrice;
  531.            }
  532.            
  533.            else if (85<=RandomWeaponQuality && RandomWeaponQuality<99) {
  534.                weaponPrice = titaniumWeaponPrice*specPrice;
  535.            }
  536.         }
  537.         return weaponPrice;
  538.     }
  539.  
  540.  
  541.  
  542.     private static ArrayList<String> printWeapons(int size,  ArrayList<String> guns, ArrayList<Double> gPrice) {
  543.         printWeaponsPrice(size, gPrice);
  544.         if (size == 0){
  545.             System.out.println("You don't have any weapon");
  546.         }
  547.        
  548.         else {
  549.             for (int i = 0; i < size; i++) {
  550.                 Object allweapons = guns.get(i);
  551.                 Object allweaponPrice = gPrice.get(i);
  552.                 System.out.println((i+1) + ": " + allweapons + "(" +allweaponPrice+"$)");
  553.             }
  554.         }
  555.        
  556.         return guns;
  557.     }
  558.    
  559.     private static ArrayList<Double> printWeaponsPrice(int size,  ArrayList<Double> gPrice) {
  560.         if (size == 0){
  561.            
  562.         }
  563.        
  564.         else {
  565.             for (int i = 0; i < size; i++) {
  566.                 Object allweaponsPrice = gPrice.get(i);
  567.             }
  568.         }
  569.        return gPrice;
  570.     }
  571.  
  572.  
  573.  
  574.     private static double maxKeyNumber(double currentCash, int x) {
  575.         double maxKeyNumber = currentCash/x;
  576.         int maxKeyNumberInt = (int) maxKeyNumber;
  577.         return maxKeyNumberInt;
  578.        
  579.     }
  580.    
  581.  
  582.  
  583. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement