Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • stCky: Palidinho is your OpenGL (was it OpenGL?) stuff open source anywhere?
      August 16, 2017, 09:07:22 PM
    • Travas:BUILD THE WALL
      August 15, 2017, 09:28:49 PM
    • Travas: i have ass cancer
      August 15, 2017, 09:23:29 PM
    • stCky: what are the fudge are you tryna ask?
      August 15, 2017, 08:21:35 PM
    • bader: what are the rsps community alive ?
      August 15, 2017, 05:46:16 PM
    • bader: yo guys
      August 15, 2017, 05:46:08 PM
    • Spacehost:[link] Updated our thread :)
      August 15, 2017, 09:40:34 AM
    • Adaro: The client is in Download section at Homepage
      August 15, 2017, 01:09:20 AM
    • FaTe_Of_GoDs: where do i get the client?????????????
      August 14, 2017, 05:23:14 PM
    • stCky: can anyone help me? I cant login to the shoutbox
      August 13, 2017, 05:45:15 PM
    • drubrkletern: appeal denied
      August 13, 2017, 02:35:27 PM
    • King_Trout:[link]
      August 13, 2017, 11:17:12 AM
    • Cole1497: no sorry
      August 13, 2017, 10:27:14 AM
    • ayz: yo can anyone explain something to me
      August 13, 2017, 08:08:51 AM
    • coolking12: Hi
      August 13, 2017, 04:16:06 AM
    • stCky: n+1
      August 11, 2017, 06:09:24 PM
    • PalidinoDH: How many more pages are going to show errors before this dude gets on and fixes shit
      August 11, 2017, 04:57:00 PM
    • stCky: it is made by the wonderful people at jetbrains
      August 10, 2017, 10:00:06 PM
    • Zoravon: what's the difference between that and eclipse?
      August 10, 2017, 05:59:52 PM
    • stCky: use an IDE like IntelliJ or shitclipse
      August 10, 2017, 05:33:01 PM

    Author Topic: [PI]Bob repairing broken barrows  (Read 2107 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineSmdScape

    • Member
    • **
    • Posts: 41
    • Thanks: +0/-0
      • View Profile
    [PI]Bob repairing broken barrows
    « on: October 26, 2015, 06:08:11 AM »

    This is what you'll be adding:
    (click to show/hide)
    All barrows items are supported.

    First of all, open Player.java
    Add this
    Code: [Select]
    public int barrowsID;

    Open ItemOnNpc and add this -


    Code: [Select]
      if (itemId == 4884 || itemId == 4883 || itemId == 4882|| itemId == 4881 || itemId == 4880
                && npcId == 519) { //dharok helm
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4896 || itemId == 4895 || itemId == 4894 || itemId == 4893 || itemId == 4892
                && npcId == 519) { //dharok platebody
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4902  || itemId == 4901 || itemId == 4900 || itemId == 4899 || itemId == 4898
                && npcId == 519) { //dharok platelegs
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4890  || itemId == 4889 || itemId == 4888 || itemId == 4887 || itemId == 4886
                && npcId == 519) { //dharok greataxe
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4908  || itemId == 4907 || itemId == 4906 || itemId == 4905 || itemId == 4904
                && npcId == 519) { //guthan's helm
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4914  || itemId == 4913 || itemId == 4912 || itemId == 4911 || itemId == 4910
                && npcId == 519) { //guthan's warspear
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4920  || itemId == 4919 || itemId == 4918 || itemId == 4917 || itemId == 4916
                && npcId == 519) { //guthan's platebody
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4926  || itemId == 4925 || itemId == 4924 || itemId == 4923 || itemId == 4922
                && npcId == 519) { //guthan's chainskirt
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4980  || itemId == 4979 || itemId == 4978 || itemId == 4977 || itemId == 4976
                && npcId == 519) { //verac's helm
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4986  || itemId == 4985 || itemId == 4984 || itemId == 4983 || itemId == 4982
                && npcId == 519) { //verac's flail
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4992  || itemId == 4991 || itemId == 4990 || itemId == 4989 || itemId == 4988
                && npcId == 519) { //verac's brassard
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4998  || itemId == 4997 || itemId == 4996 || itemId == 4995 || itemId == 4994
                && npcId == 519) { //verac's skirt
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4956  || itemId == 4955 || itemId == 4954 || itemId == 4953 || itemId == 4952
                && npcId == 519) { //torag's helm
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4962  || itemId == 4961 || itemId == 4960 || itemId == 4959 || itemId == 4958
                && npcId == 519) { //torag's hammer
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4968  || itemId == 4967 || itemId == 4966 || itemId == 4965 || itemId == 4964
                && npcId == 519) { //torag's platebody
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4974  || itemId == 4973 || itemId == 4972 || itemId == 4971 || itemId == 4970
                && npcId == 519) { //torag's platelegs
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4932  || itemId == 4931 || itemId == 4930 || itemId == 4929 || itemId == 4928
                && npcId == 519) { //karil's coif
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4938  || itemId == 4937 || itemId == 4936 || itemId == 4935 || itemId == 4934
                && npcId == 519) { //karil's crossbow
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4944  || itemId == 4943 || itemId == 4942 || itemId == 4941 || itemId == 4940
                && npcId == 519) { //karil's top
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4950  || itemId == 4949 || itemId == 4948 || itemId == 4947 || itemId == 4946
                && npcId == 519) { //karil's skirt
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4860  || itemId == 4959 || itemId == 4958 || itemId == 4957 || itemId == 4956
                && npcId == 519) { //ahrim's hood
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4866  || itemId == 4865 || itemId == 4864 || itemId == 4863 || itemId == 4862
                && npcId == 519) { //ahrim's staff
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4872  || itemId == 4871 || itemId == 4870 || itemId == 4869 || itemId == 4868
                && npcId == 519) { //ahrim's robe top
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


          if (itemId == 4878  || itemId == 4877 || itemId == 4876 || itemId == 4875 || itemId == 4874
                && npcId == 519) { //ahrim's robe skirt
             c.getDH().sendDialogues(534, 519);
             c.barrowsID = itemId;
          }


    Add this to ClickingButtons -


    Code: [Select]
      if (c.barrowsID == 4884 || c.barrowsID == 4883 || c.barrowsID == 4882 ||
             c.barrowsID == 4881 || c.barrowsID == 4880) { //dharok helm
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4716, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the helmet.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4896 || c.barrowsID == 4895 || c.barrowsID == 4894 ||
                   c.barrowsID == 4893 || c.barrowsID == 4892) { //dharok platebody
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4720, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the platebody.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4902 || c.barrowsID == 4901 ||c.barrowsID == 4900
                   ||c.barrowsID == 4899 ||c.barrowsID == 4898) { //dharok platelegs
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4722, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the platelegs.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4890 || c.barrowsID == 4889 || c.barrowsID == 4888
                   || c.barrowsID == 4887 || c.barrowsID == 4886) { //dharok greataxe
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4718, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the greataxe.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4908 || c.barrowsID == 4907 || c.barrowsID == 4906
                   || c.barrowsID == 4905 || c.barrowsID == 4904) { //guthan's helm
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4724, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the helmet.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4914 || c.barrowsID == 4913 || c.barrowsID == 4912 ||
                    c.barrowsID == 4911 || c.barrowsID == 4910) { //guthan's warspear
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4726, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the warspear.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4920 || c.barrowsID == 4919 || c.barrowsID == 1918
                    || c.barrowsID == 4917 || c.barrowsID == 4916) { //guthan's platebody
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4728, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the platebody.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4926 || c.barrowsID == 4925 || c.barrowsID == 4924
                   || c.barrowsID == 4923 || c.barrowsID == 4922) { //guthan's chainskirt
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(4926, 1);
                   c.getItems().addItem(4730, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the chainskirt.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4956 || c.barrowsID == 4955 || c.barrowsID == 4954
                    || c.barrowsID == 4953 || c.barrowsID == 4952) { //torag's helmet
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4745, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the helmet.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4962 || c.barrowsID == 4961 || c.barrowsID == 4960
                    || c.barrowsID == 4959 || c.barrowsID == 4958) { //torag's hammy
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4747, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the hammer.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4968 || c.barrowsID == 4967 || c.barrowsID == 4966
                    || c.barrowsID == 4965 || c.barrowsID == 4964) { //torag's platebody
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4749, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the platebody.");
                   c.getPA().closeAllWindows();
                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4974 || c.barrowsID == 4973 || c.barrowsID == 4972
                    || c.barrowsID == 4971 || c.barrowsID == 4970) { //torag's platelegs
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4751, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the platelegs.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4980 || c.barrowsID == 4979 || c.barrowsID == 4978
                    || c.barrowsID == 4977 || c.barrowsID == 4976) { //verac's  helm
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4753, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the helm.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4998 || c.barrowsID == 4997 || c.barrowsID == 4996
                    || c.barrowsID == 4995 || c.barrowsID == 4994) { //verac's plateskirt
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4759, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the plateskirt.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4992 || c.barrowsID == 4991 || c.barrowsID == 4990
                    || c.barrowsID == 4989 || c.barrowsID == 4988) { //verac's brassy
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4757, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the brassard.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4986 || c.barrowsID == 4985 || c.barrowsID == 4984
                    || c.barrowsID == 4983 || c.barrowsID == 4982) { //verac's flail
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4755, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the flail.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4932 || c.barrowsID == 4931 || c.barrowsID == 4930
                    || c.barrowsID == 4929 || c.barrowsID == 4928) { //karil's coif
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4732, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the coif.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4938 || c.barrowsID == 4937 || c.barrowsID == 4936
                    || c.barrowsID == 4935 || c.barrowsID == 4934) { //karil's crossbow
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4734, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the crossbow.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4950 || c.barrowsID == 4949 || c.barrowsID == 4948
                    || c.barrowsID == 4947 || c.barrowsID == 4946) { //karil's skirt
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4738, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the skirt.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4944 || c.barrowsID == 4943 || c.barrowsID == 4942
                    || c.barrowsID == 4941 || c.barrowsID == 4940) { //karil's top
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4736, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the top.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4860 || c.barrowsID == 4859 || c.barrowsID == 4858
                    || c.barrowsID == 4857 || c.barrowsID == 4856) { //ahrim's hood
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4708, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the hood.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4866 || c.barrowsID == 4865 || c.barrowsID == 4864
                    || c.barrowsID == 4863 || c.barrowsID == 4862) { //ahrim's staff
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4710, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the staff.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4872 || c.barrowsID == 4871 || c.barrowsID == 4870
                    || c.barrowsID == 4869 || c.barrowsID == 4868) { //ahrim's top
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4712, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the robe top.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


             if (c.barrowsID == 4878 || c.barrowsID == 4877 || c.barrowsID == 4876
                    || c.barrowsID == 4875 || c.barrowsID == 4874) { //ahrim's skirt
                if (c.getItems().playerHasItem(995, 250000)) {
                   c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
                   c.getItems().deleteItem(c.barrowsID, 1);
                   c.getItems().addItem(4714, 1);
                   c.barrowsID = 0;
                   c.sendMessage("You repair the skirt.");
                   c.getPA().closeAllWindows();


                } else {
                   c.sendMessage("You do not have enough gold to repair that.");
                   c.getPA().closeAllWindows();
                   c.barrowsID = 0;
                }
             }


    Add this to DialogueHandler -
    Code: [Select]
       case 534:

             sendNpcChat1("It's going to cost 250,000 to repair that.", c.talkingNpc, "Bob");
             c.nextChat = 535;
             break;
             
          case 535:
             c.dialogueAction = 535;
             sendOption2("Sure, please fix it.", "Oh, forget it. That's too expensive!" );
             c.nextChat = 0;
             break;
    « Last Edit: October 28, 2015, 07:59:50 PM by SmdScape »
    Practicing poor code since 2009.
    Feel free to check out my RSPS dev thread -
    moparscape.org/community/server-client-development-showoff/125/pi-smdscape/659033


    Offlineimsuperman05

    • Member
    • ****
    • Posts: 5,352
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #1 on: October 31, 2015, 02:44:27 AM »
    Instead of creating a useless variable, why don't you just check if they have the item in their inventory and create an array of items that are broken, instead of hard coding it.  if u were to do that then you could send this message

    c.sendMessage("You repair the "+ItemAssistant.getItemName(itemId).toLowerCase()+".");


    Offlinepenguinimp

    • Member
    • **
    • Posts: 53
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #2 on: November 03, 2015, 10:07:47 AM »
    While yes it works, there are significant changes you should adapt

    I agree with superman,

    since this is all the same  except for the IF

    Code: Java
    1.       if(itemId ==4950  || itemId ==4949|| itemId ==4948|| itemId ==4947|| itemId ==4946
    2.             && npcId ==519){//karil's skirt
    3.          c.getDH().sendDialogues(534, 519);
    4.          c.barrowsID= itemId;
    5.       }
    6.  
    7.  
    8.       if(itemId ==4860  || itemId ==4959|| itemId ==4958|| itemId ==4957|| itemId ==4956
    9.             && npcId ==519){//ahrim's hood
    10.          c.getDH().sendDialogues(534, 519);
    11.          c.barrowsID= itemId;
    12.       }
    13.  

    you can combine it

    Code: Java
    1.      switch(itemId){
    2.         case4950://karil's skirt
    3.         case4949:
    4.         case4948:
    5.         case4947:
    6.         case4946:
    7.         case4944://karil's top
    8.         case4943:
    9.         case4942:
    10.         case4941:
    11.         case4940:
    12.         case4932://karil's coif
    13.         case4931:
    14.         case4930:
    15.         case4929:
    16.         case4928:
    17.         case4938://karil's crossbow
    18.         case4937:
    19.         case4936:
    20.         case4935:
    21.         case4934:
    22.             if(npcId ==519){
    23.                 c.getDH().sendDialogues(534, 519);
    24.                 c.barrowsID= itemId;
    25.             }
    26.      }
    27.  

    you could do something like this (not tested, might have a syntax error)
    Code: Java
    1.   int[][] barrows ={{4884,4883,4882,4881,4880},{4896,4895,4894,4893,4892}};
    2.   int[] fixed_barrows ={4716,4720};
    3.   int fixed_item =0;
    4.   for(int i =0; i < barrows.length; i++){
    5.       for(int i2 =0; i2 < barrows[0].length; i++){
    6.            if(c.barrowsID== barrows[i][i2]){
    7.                fixed_item = fixed_barrows[i];
    8.            }
    9.       }
    10.   }
    11.  
    12.  

    Or you can use a switch

    Code: Java
    1.     int fixed_item =0;
    2.     switch(c.barrowsID){
    3.         case4884:
    4.         case4883:
    5.         case4882:
    6.         case4881:
    7.         case4880:
    8.             fixed_item =4716;
    9.             break;
    10.         case4896:
    11.         case4895:
    12.         case4894:
    13.         case4893:
    14.         case4892:
    15.             fixed_item =4720;
    16.             break;
    17.     }
    18.  

    Code: Java
    1.   if(fixed_item >0){
    2.         if(c.getItems().playerHasItem(995, 250000)){
    3.            c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 250000);
    4.            c.getItems().deleteItem(c.barrowsID, 1);
    5.            c.getItems().addItem(fixed_item, 1);
    6.            c.barrowsID=0;
    7.            c.sendMessage("You repair the "+ItemAssistant.getItemName(barrowsID).toLowerCase()+".");
    8.            c.getPA().closeAllWindows();
    9.         }else{
    10.            c.sendMessage("You do not have enough gold to repair that.");
    11.            c.getPA().closeAllWindows();
    12.            c.barrowsID=0;
    13.         }
    14.     }
    15.  

    Either have their own advantages, but if/else if/else if/else isn't really a solution even though it's used every where, when you look through your source.
    It's used because someone didn't know that, that isn't a solution.

    I commend the work you've done, and I'm not looking down on you for writing it, but there are better ways to write the code, and this isn't a tutorial it's more of a snippet.
    « Last Edit: November 03, 2015, 10:24:30 AM by penguinimp »
    Respect: Claws Fury
    meh i lose my password too often, it's me ddragonimp

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #3 on: November 03, 2015, 12:57:35 PM »
    To be honest an enum could even be used here...

    Code: Java
    1. importjava.util.Arrays;
    2.  
    3. publicenum BarrowsItem {
    4.        
    5.         DHAROKS_HELM(25000, 0000, 0001, 0002, 0003, 0004),
    6.         DHAROKS_BODY(25000, 0000, 0001, 0002, 0003, 0004),
    7.         DHAROKS_LEGS(25000, 0000, 0001, 0002, 0003, 0004),
    8.         DHAROKS_AXE(25000, 0000, 0001, 0002, 0003, 0004);
    9.        
    10.         privateint costPerLevel, fixedForm;
    11.         privateint[] degradedForms;
    12.        
    13.         BarrowsItem(int costPerLevel, int fixedForm, int... degradedForms){
    14.                 this.costPerLevel= costPerLevel;
    15.                 this.fixedForm= fixedForm;
    16.                 this.degradedForms= degradedForms;
    17.         }
    18.        
    19.         public BarrowsItem getForDegrade(int id){
    20.                 for(BarrowsItem b : BarrowsItem.values()){
    21.                         if(b.degradedForms!=null&&
    22.                                         Arrays.asList(b.degradedForms).contains(id)){
    23.                                 return b;
    24.                         }
    25.                 }
    26.                 returnnull;
    27.         }
    28. }

    The enum would store all the armour ids, the prices, and the fixed versions. You grab the data based on the id the player used (Whether they used it on him, or they went through a dialogue or whatever), then multiply the cost based on the (index + 1) of the id they used (So if I used 0000 it'd be 25k, if I used 0004 it'd be 100k).

    Of course I didn't write all the logics down in the enum, but it's a start if someone wanted.

    OfflinePest

    • Member
    • ***
    • Posts: 222
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #4 on: December 09, 2015, 11:23:29 PM »
    Agree with Sk8rdude :cool:
    Not hard to figure out

    OfflineSessy Pk3r

    • Member
    • ***
    • Posts: 221
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #5 on: April 10, 2016, 01:31:32 AM »
    I think it would be more efficient to add a degradable field in the item definitions as well as a repair price that way you could extend it to even more items without writing a bunch of code every time you want to add a new degradable item.

    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #6 on: July 20, 2016, 12:48:38 PM »
    #msg4138446
    Could make use of this :P
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #7 on: July 20, 2016, 12:54:30 PM »
    #msg4138446
    Could make use of this :P
    Those loops though...

    Offlinelare69

    • Member
    • ****
    • *
    • Posts: 5,321
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #8 on: July 20, 2016, 04:26:02 PM »
    yeah, tables should definitely be used for this. for Java, an enum sounds about right

    Code: Java
    1. importjava.util.Arrays;
    2.  
    3. publicenum BarrowsItem {
    4.        
    5.         DHAROKS_HELM(25000, 0000, 0001, 0002, 0003, 0004),
    6.         DHAROKS_BODY(25000, 0000, 0001, 0002, 0003, 0004),
    7.         DHAROKS_LEGS(25000, 0000, 0001, 0002, 0003, 0004),
    8.         DHAROKS_AXE(25000, 0000, 0001, 0002, 0003, 0004);
    9.        
    10.         privateint costPerLevel, fixedForm;
    11.         privateint[] degradedForms;
    12.        
    13.         BarrowsItem(int costPerLevel, int fixedForm, int... degradedForms){
    14.                 this.costPerLevel= costPerLevel;
    15.                 this.fixedForm= fixedForm;
    16.                 this.degradedForms= degradedForms;
    17.         }
    18.        
    19.         public BarrowsItem getForDegrade(int id){
    20.                 for(BarrowsItem b : BarrowsItem.values()){
    21.                         if(b.degradedForms!=null&&
    22.                                         Arrays.asList(b.degradedForms).contains(id)){
    23.                                 return b;
    24.                         }
    25.                 }
    26.                 returnnull;
    27.         }
    28. }
    so basically this, but iirc the price per degradation level is the same across all barrows items so those values aren't needed
    hi. check out luna:)

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #9 on: July 20, 2016, 04:55:49 PM »
    yeah, tables should definitely be used for this. for Java, an enum sounds about right

    Code: Java
    1. importjava.util.Arrays;
    2.  
    3. publicenum BarrowsItem {
    4.        
    5.         DHAROKS_HELM(25000, 0000, 0001, 0002, 0003, 0004),
    6.         DHAROKS_BODY(25000, 0000, 0001, 0002, 0003, 0004),
    7.         DHAROKS_LEGS(25000, 0000, 0001, 0002, 0003, 0004),
    8.         DHAROKS_AXE(25000, 0000, 0001, 0002, 0003, 0004);
    9.        
    10.         privateint costPerLevel, fixedForm;
    11.         privateint[] degradedForms;
    12.        
    13.         BarrowsItem(int costPerLevel, int fixedForm, int... degradedForms){
    14.                 this.costPerLevel= costPerLevel;
    15.                 this.fixedForm= fixedForm;
    16.                 this.degradedForms= degradedForms;
    17.         }
    18.        
    19.         public BarrowsItem getForDegrade(int id){
    20.                 for(BarrowsItem b : BarrowsItem.values()){
    21.                         if(b.degradedForms!=null&&
    22.                                         Arrays.asList(b.degradedForms).contains(id)){
    23.                                 return b;
    24.                         }
    25.                 }
    26.                 returnnull;
    27.         }
    28. }
    so basically this, but iirc the price per degradation level is the same across all barrows items so those values aren't needed
    I did prices like that because you could expand the system to be more than just barrows gear.

    I.E crystal bows, pvp armour, so on.

    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #10 on: July 23, 2016, 10:12:44 PM »
    #msg4138446
    Could make use of this :P
    Those loops though...
    To give your code a chance after doing some optimizations, i moved my DH sets to the bottom of the array. Then ran these test cases:
    Your code with minor tweaks:
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 1167752 ns

    My code with optimizations, and weighting the search in your favor(end of array):
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 1580838 ns

    My code, DH is first in array
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 686313 ns

    My code, DH is in its spot in default code arrangement.
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 727145 ns

    Code for your test:
    Code for my test:

    Note the search times in yours are faster as the 4 class items in question remained in active memory through the execution of the program. You will in a real run-time setting have many more cold cache hits.
    Mine will too - though all of the code required to iterate through is local (in a solid memory chunk).
    I know - i should crate a sub-routine that does all of this iteration as it is a copy and paste for every chunk. But note - when it was written was before lambda expressions were around.

    The optimization builds a hashed array at class initialization which cuts down on the number of secondary arrays that must be iterated through. Your code structure makes this unlikely without a custom list implementation.

    When you lower the searchCount variable, the rate by which my code pulls ahead is about 3:1
    Yours:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 23551 ns

    Ran 5 lookups 100 times
    Average lookup time 87474 ns

    Ran 10 lookups 100 times
    Average lookup time 94940 ns

    Mine: (this uses the dh in its default location)
    Quote
    Ran 1 lookups 100 times
    Average lookup time 7709 ns

    Ran 5 lookups 100 times
    Average lookup time 17235 ns

    Ran 10 lookups 100 times
    Average lookup time 19175 ns

    When i moved the DH back to the end of the array:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 9808 ns

    Ran 5 lookups 100 times
    Average lookup time 20681 ns

    Ran 10 lookups 100 times
    Average lookup time 24680 ns

    Still noting that both of our number will be slightly larger in a real application - since the 100 iterations is done within the same program the memory remains hot.

    Since you will likely say that my optimization is the reason mine runs faster - i did this test case as well.
    My code without the optimization and DH items at the end of the array:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 20870 ns

    Ran 5 lookups 100 times
    Average lookup time 39382 ns

    Ran 10 lookups 100 times
    Average lookup time 44335 ns

    Optimizations in java are up to the user.

    Edit: With the modifications to use BiFunctions to avoid the copy and paste of loops, there is about 70,000,000 ns for the first iteration and all following are around 38,000~50,000. It is must faster to just leave the code as it.
    « Last Edit: July 23, 2016, 11:16:47 PM by matzie »
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlinelare69

    • Member
    • ****
    • *
    • Posts: 5,321
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #11 on: July 24, 2016, 12:25:40 PM »
    #msg4138446
    Could make use of this :P
    Those loops though...
    To give your code a chance after doing some optimizations, i moved my DH sets to the bottom of the array. Then ran these test cases:
    Your code with minor tweaks:
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 1167752 ns

    My code with optimizations, and weighting the search in your favor(end of array):
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 1580838 ns

    My code, DH is first in array
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 686313 ns

    My code, DH is in its spot in default code arrangement.
    Quote
    Runtime Statistics

    Ran 10000 lookups 100 times
    Average lookup time 727145 ns

    Code for your test:
    Code for my test:

    Note the search times in yours are faster as the 4 class items in question remained in active memory through the execution of the program. You will in a real run-time setting have many more cold cache hits.
    Mine will too - though all of the code required to iterate through is local (in a solid memory chunk).
    I know - i should crate a sub-routine that does all of this iteration as it is a copy and paste for every chunk. But note - when it was written was before lambda expressions were around.

    The optimization builds a hashed array at class initialization which cuts down on the number of secondary arrays that must be iterated through. Your code structure makes this unlikely without a custom list implementation.

    When you lower the searchCount variable, the rate by which my code pulls ahead is about 3:1
    Yours:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 23551 ns

    Ran 5 lookups 100 times
    Average lookup time 87474 ns

    Ran 10 lookups 100 times
    Average lookup time 94940 ns

    Mine: (this uses the dh in its default location)
    Quote
    Ran 1 lookups 100 times
    Average lookup time 7709 ns

    Ran 5 lookups 100 times
    Average lookup time 17235 ns

    Ran 10 lookups 100 times
    Average lookup time 19175 ns

    When i moved the DH back to the end of the array:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 9808 ns

    Ran 5 lookups 100 times
    Average lookup time 20681 ns

    Ran 10 lookups 100 times
    Average lookup time 24680 ns

    Still noting that both of our number will be slightly larger in a real application - since the 100 iterations is done within the same program the memory remains hot.

    Since you will likely say that my optimization is the reason mine runs faster - i did this test case as well.
    My code without the optimization and DH items at the end of the array:
    Quote
    Ran 1 lookups 100 times
    Average lookup time 20870 ns

    Ran 5 lookups 100 times
    Average lookup time 39382 ns

    Ran 10 lookups 100 times
    Average lookup time 44335 ns

    Optimizations in java are up to the user.

    Edit: With the modifications to use BiFunctions to avoid the copy and paste of loops, there is about 70,000,000 ns for the first iteration and all following are around 38,000~50,000. It is must faster to just leave the code as it.
    ZZZZZZZZZZZZZZZZZZZZ that's all insignificant here, OP should be changing it because it sucks not because one of our solutions "performs better"

    premature optimization is EVIL
    hi. check out luna:)

    Offlinematzie

    • Member
    • ****
    • Posts: 1,006
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #12 on: July 24, 2016, 11:10:44 PM »
    ZZZZZZZZZZZZZZZZZZZZ that's all insignificant here, OP should be changing it because it sucks not because one of our solutions "performs better"

    premature optimization is EVIL
    To rephrase what you just said.. he should change it because his is worse, not because ours is better..?
    The difference between X < Y and Y > X...
    The purpose of the shared code was to be a stepping stone in the progress he would eventually make on his own.
    I supplied a lot of the data to him in the array. So he does not need to go look all of it up himself. That array was pre-dated to itemdb.biz, and it had a good amount of time invested in it.

    The purpose of my comment @ Sk8r was because he was talking about all of my loops, which his code does the same thing - behind the scenes with more effort.
    Quote from: Justin Bieber
    Also, I don't know how other people feel about this but personally I really dislike having to interact with community staff since they're usually kids with a pumped up sense of authority.
    Who its by XD

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #13 on: July 25, 2016, 01:25:52 AM »
    ZZZZZZZZZZZZZZZZZZZZ that's all insignificant here, OP should be changing it because it sucks not because one of our solutions "performs better"

    premature optimization is EVIL
    To rephrase what you just said.. he should change it because his is worse, not because ours is better..?
    The difference between X < Y and Y > X...
    The purpose of the shared code was to be a stepping stone in the progress he would eventually make on his own.
    I supplied a lot of the data to him in the array. So he does not need to go look all of it up himself. That array was pre-dated to itemdb.biz, and it had a good amount of time invested in it.

    The purpose of my comment @ Sk8r was because he was talking about all of my loops, which his code does the same thing - behind the scenes with more effort.

    Except the reason I was pointing out "those loops" is because you do it for basically every method..
    Instead of just returning one array out of the 2d array then grabbing each value from it specifically, or something of that nature.


    Offlinelare69

    • Member
    • ****
    • *
    • Posts: 5,321
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #14 on: July 25, 2016, 10:54:40 AM »
    ZZZZZZZZZZZZZZZZZZZZ that's all insignificant here, OP should be changing it because it sucks not because one of our solutions "performs better"

    premature optimization is EVIL
    To rephrase what you just said.. he should change it because his is worse, not because ours is better..?
    no what i meant is that is he should change it because it's poorly designed, not because of performance reasons

    cmon its a Runescape server, not embedded systems programming. people are going to be repairing barrows how often? maybe a few times each hour, if your server is very popular? unless there's a major bottleneck its not necessary to optimize for performance
    hi. check out luna:)

    Offlinelurtz1230

    • Member
    • ***
    • Posts: 118
    • Thanks: +0/-0
      • View Profile
    Re: [PI]Bob repairing broken barrows
    « Reply #15 on: July 25, 2016, 11:35:09 AM »
    ZZZZZZZZZZZZZZZZZZZZ that's all insignificant here, OP should be changing it because it sucks not because one of our solutions "performs better"

    premature optimization is EVIL
    To rephrase what you just said.. he should change it because his is worse, not because ours is better..?
    no what i meant is that is he should change it because it's poorly designed, not because of performance reasons

    cmon its a Runescape server, not embedded systems programming. people are going to be repairing barrows how often? maybe a few times each hour, if your server is very popular? unless there's a major bottleneck its not necessary to optimize for performance


    "Premature optimization is the root of all evil." - Donald Knuth

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal