Thread: Divinity 614

Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1 Divinity 614 
    Registered Member
    Join Date
    Oct 2013
    Posts
    255
    Thanks given
    16
    Thanks received
    17
    Rep Power
    20
    Divinity 614
    This is a SpawnScape source, not a direct LEECH, as other's just leech and put up, i've added some tweeks here and there,
    and what i need to do is find out how to fix my Shops.java so that i can get more than one shop. I've spent some time, but there's really NO help on 614's shops, on rune-server or anywhere else i can find.

    First:
    My Shops.java
    Spoiler for Shops.java:
    package dragonkk.rs2rsps.model.shops;

    import java.util.ArrayList;
    import java.util.List;

    /**
    * @author Hadyn Fitzgerald
    * @version 1.0
    */
    public class Shops {

    public ArrayList<Shop> shops = new ArrayList<Shop>(10);

    public Shops() {
    setShops();
    }

    public void setShops() {
    if(ShopManager.Voteshop == false) {
    shops.add(new Shop(0, Shop0Items(), Shop0Items().size()));
    } else {
    shops.add(new Shop(1, Shop1Items(), Shop1Items().size()));
    }
    }

    public Shop getShop(int shopid) {
    if(ShopManager.Voteshop) {
    return shops.get(1);
    } else {
    return shops.get(0);
    }
    }

    public static List<int[]> Shop1Items() {
    List<int[]> items = new ArrayList<int[]>(40);
    items.add(new int[]{1205, 100, 1}); //Bronze dagger
    return items;
    }

    public static List<int[]> Shop0Items() {
    List<int[]> items = new ArrayList<int[]>(40);
    // items.add(new int[]{2422, 2147483647, 0}); //Fake Blue Partyhat
    //items.add(new int[]{1205, 1, -1}); //Bronze dagger
    items.add(new int[]{15262, 1000, 1000}); //Shard Pack
    //items.add(new int[]{8007, 1000, 10}); //V Teletab
    items.add(new int[]{8008, 1000, 10}); //L Teletab
    items.add(new int[]{8013, 1000, 10}); //Home Teletab
    //items.add(new int[]{4084, 5, 10000}); //Sled
    items.add(new int[]{2520, 1000, 150}); //Toy horsey
    items.add(new int[]{2526, 1000, 150}); //Toy horsey
    items.add(new int[]{2524, 1000, 150}); //Toy horsey
    items.add(new int[]{2522, 1000, 150}); //Toy horsey
    items.add(new int[]{15098, 1000, 10000}); //Dice bag
    items.add(new int[]{18346, 15, 1000}); //Magic frost book
    //items.add(new int[]{5733, 2147483647, 0}); //Jagex Patato
    items.add(new int[]{6570, 100, 250}); //Firecape
    items.add(new int[]{10551, 100, 125}); //Fighter torso
    items.add(new int[]{17273, 1000, 50}); //Flameburst Defender
    items.add(new int[]{15825, 1000, 125}); //Flameburst Defender (B)
    items.add(new int[]{8839, 100, 130}); // Void
    items.add(new int[]{8840, 100, 130}); // Void
    items.add(new int[]{8841, 100, 130}); // Void
    items.add(new int[]{8842, 100, 130}); // Void
    items.add(new int[]{11663, 100, 100}); // Void
    items.add(new int[]{11664, 100, 100});// Void
    items.add(new int[]{11665, 100, 100}); // Void
    items.add(new int[]{15018, 100, 250}); //Seers(i)
    items.add(new int[]{15019, 100, 250}); //Archers (i)
    items.add(new int[]{15020, 100, 250}); //Warrior (i)
    items.add(new int[]{15220, 100, 250}); //Berserker (i)
    items.add(new int[]{15017, 1000, 100}); //Onyx (i)
    items.add(new int[]{13263, 100, 200}); //Slayer helm
    items.add(new int[]{15300, 100000, 8}); //Recover special
    items.add(new int[]{15349, 1000, 20}); //Ardy Cloak
    items.add(new int[]{19710, 1000000, 350}); //Dung mastercape
    items.add(new int[]{15332, 1000000, 5}); //Overload
    //Whip Upgrades
    items.add(new int[]{1771, 100, 350}); //Green dye
    items.add(new int[]{1765, 100, 600}); //Yellow dye
    items.add(new int[]{1767, 100, 850}); //Blue dye
    items.add(new int[]{11808, 100, 1250}); //Whitefish
    //Castlewars capes
    items.add(new int[]{18739, 10000000, 200}); //Flag cape
    items.add(new int[]{18741, 10000000, 200}); //Hobbyist cape
    items.add(new int[]{18740, 10000000, 200}); //Kill cape
    items.add(new int[]{18742, 10000000, 250}); //enthusiast cape
    items.add(new int[]{18743, 10000000, 350}); //professional cape.
    return items;
    }
    }


    Next, my shopmanager.java
    Spoiler for shopmanager.java:
    package dragonkk.rs2rsps.model.shops;

    import dragonkk.rs2rsps.model.player.Player;
    import dragonkk.rs2rsps.model.World;
    import dragonkk.rs2rsps.model.Container;
    import dragonkk.rs2rsps.model.Item;
    import dragonkk.rs2rsps.rscache.Cache;
    import dragonkk.rs2rsps.rscache.ItemDefinitions;

    /**
    * @author Hadyn Fitzgerald
    * @version 1.0
    */
    public class ShopManager {

    public static Shops shops;
    public static boolean Voteshop = false;
    public ShopManager() {
    shops = new Shops();
    }

    public static void initiateShop(Player player, int i) {
    player.getFrames().sendItems(3, shops.getShop(player.getShophandler().getShopId()) .items, false);
    player.getFrames().sendConfig(118, 3);
    player.getFrames().sendConfig(1496, 553);
    player.getFrames().sendConfig(532, 13654);
    player.getFrames().sendBConfig(199, -1);
    player.getFrames().sendInterface(620);
    player.getFrames().sendInventoryInterface(621);
    for (int index = 0; index < 40; index++) {
    if (index == 0) {
    player.getFrames().sendBConfig(946 + index, 1000);
    continue;
    }
    player.getFrames().sendBConfig(946 + index, -1);
    }
    Object[] params = new Object[] { "Sell 50", "Sell 10", "Sell 5",
    "Sell 1", "Value", -1, 1, 7, 4, 93, 40697856 };
    player.getFrames().sendClientScript(149, params, "IviiiIsssss");
    player.getFrames().sendAMask(0, 27, 621, 0, 36, 1086);
    player.getFrames().sendAMask(0, 12, 620, 26, 0, 1150);
    player.getFrames().sendAMask(0, 240, 620, 25, 0, 1150);
    }

    public void handleSellButtons(Player p, int packetid, int slot, int itemid) {
    int itemworth = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[2];
    switch (packetid) {
    case 24:
    sellItem(p, slot, 1, itemid);
    break;

    case 48:
    sellItem(p, slot, 1, itemid);
    break;

    case 40:
    sellItem(p, slot, 1, itemid);
    break;

    case 13:
    sellItem(p, slot, 1, itemid);
    break;
    }
    }

    public void sellItem(Player p, int slot, int amount, int itemid) {
    try {
    /*if (true) {
    p.getFrames().sendChatMessage(0,"You cannot sell to the shop.");
    return;
    }*/
    if(Voteshop) {
    Shop shop = shops.getShop(p.getShophandler().getShopId());
    if (!shop.sellsItem(itemid)) {
    p.getFrames().sendChatMessage(0, "You can only sell shop items to this shop.");
    return;
    }
    int shopslot = shop.getSlotId(itemid);
    int value = shop.items.get(shopslot)[2];
    if (p.getInventory().numberOf(itemid) < amount) {
    shop.sellItem(shopslot, p.getInventory().numberOf(itemid));
    p.votePoints += value * p.getInventory().numberOf(itemid);
    } else {
    shop.sellItem(shopslot, amount);
    p.votePoints += value * amount;
    }
    p.getInventory().deleteItem(itemid, amount);
    p.getInventory().refresh();
    p.getFrames().sendChatMessage(0, "You sold the <col=3300ff>["+ItemDefinitions.forID(itemid).name+"]</col> for <col=3300ff>["+value+"]</col> vote points.");
    p.getFrames().sendItems(3, shops.getShop(p.getShophandler().getShopId()).item s, false);
    }
    if(!Voteshop) {
    Shop shop = shops.getShop(p.getShophandler().getShopId());
    if (!shop.sellsItem(itemid)) {
    p.getFrames().sendChatMessage(0, "You can only sell shop items to this shop.");
    return;
    }
    int shopslot = shop.getSlotId(itemid);
    int value = shop.items.get(shopslot)[2];
    if (p.getInventory().numberOf(itemid) < amount) {
    shop.sellItem(shopslot, p.getInventory().numberOf(itemid));
    p.Points += value / 1.10 * p.getInventory().numberOf(itemid);
    } else {
    shop.sellItem(shopslot, amount);
    p.Points += value / 1.10 * amount;
    }
    p.getInventory().deleteItem(itemid, amount);
    p.getInventory().refresh();
    p.getFrames().sendChatMessage(0, "You sold the <col=3300ff>["+ItemDefinitions.forID(itemid).name+"]</col> for <col=3300ff>["+(int) (value / 1.10)+"]</col> points.");
    p.getFrames().sendItems(3, shops.getShop(p.getShophandler().getShopId()).item s, false);
    for(Player d : World.getPlayers()) {
    d.getFrames().sendItems(3, shops.getShop(p.getShophandler().getShopId()).item s, false);
    }

    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    public void handleShopButtons(Player p, int buttonid, int packetid, int slot) {
    int itemworth = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[2];
    switch (buttonid) {
    case 25:
    switch (packetid) {
    case 24:
    buyItem(p, slot, 1);
    break;
    case 0:
    case 1:
    case 2:
    case 79:
    if(itemworth == 0) {
    p.getFrames().sendChatMessage(0, "This item is <col=ff0000>FREE</col>!");
    return;
    }
    p.getFrames().sendChatMessage(0, "This item costs <col=ff0000>["+itemworth+"]</col> points.");
    break;

    case 48:
    buyItem(p, slot, 1);
    break;

    case 40:
    buyItem(p, slot, 1);
    break;

    case 13:
    buyItem(p, slot, 1);
    break;

    case 55:
    buyItem(p, slot, 1);
    break;
    }
    break;
    }
    }

    public void buyItem(Player p, int slot, int amount) {
    try {
    if(Voteshop) {
    int itemid = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[0];
    Item item = new Item(itemid, amount);
    int itemworth = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[2];
    if (!p.getInventory().hasRoomFor(itemid, amount)) {
    p.getFrames().sendChatMessage(0,
    "You don't have room to buy this item.");
    return;
    }
    if (shops.getShop(p.getShophandler().getShopId()).ite ms.get(slot)[1]
    - amount < 0) {
    p.getFrames().sendChatMessage(0,
    "Not enough stock to sell this item.");
    return;
    }
    if (p.votePoints * amount >= itemworth) {
    p.getInventory().addItem(itemid, amount);
    p.votePoints -= amount * itemworth;
    shops.getShop(p.getShophandler().getShopId()).buyI tem(slot,
    amount);
    p.getFrames().sendChatMessage(0, "You purchase the <col=3300ff>["+ItemDefinitions.forID(itemid).name+"]</col> for <col=3300ff>["+itemworth+"]</col> vote points.");
    p.getFrames().sendItems(3,
    shops.getShop(p.getShophandler().getShopId()).item s,
    false);
    } else {
    p.getFrames().sendChatMessage(
    0,
    "You need " + amount * itemworth
    + " vote points to buy this.");
    }

    }
    if(!Voteshop) {
    int itemid = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[0];
    Item item = new Item(itemid, amount);
    int itemworth = shops.getShop(p.getShophandler().getShopId()).item s
    .get(slot)[2];
    if (!p.getInventory().hasRoomFor(itemid, amount)) {
    p.getFrames().sendChatMessage(0,
    "You don't have room to buy this item.");
    return;
    }
    if (shops.getShop(p.getShophandler().getShopId()).ite ms.get(slot)[1]
    - amount < 0) {
    p.getFrames().sendChatMessage(0,
    "Not enough stock to sell this item.");
    return;
    }
    if (p.Points * amount >= itemworth) {
    p.getInventory().addItem(itemid, amount);
    p.Points -= amount * itemworth;
    shops.getShop(p.getShophandler().getShopId()).buyI tem(slot,
    amount);
    p.getFrames().sendChatMessage(0, "You purchase the <col=3300ff>["+ItemDefinitions.forID(itemid).name+"]</col> for <col=3300ff>["+itemworth+"]</col> points.");
    p.getFrames().sendItems(3,
    shops.getShop(p.getShophandler().getShopId()).item s,
    false);
    for(Player d : World.getPlayers()) {
    d.getFrames().sendItems(3, shops.getShop(p.getShophandler().getShopId()).item s, false);
    }
    } else {
    p.getFrames().sendChatMessage(
    0,
    "You need " + amount * itemworth
    + " points to buy this.");
    }
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }


    Third, my shop.java
    Spoiler for shop.java:
    package dragonkk.rs2rsps.model.shops;

    import java.util.ArrayList;
    import java.util.List;

    /**
    * @author Hadyn Fitzgerald
    * @version 1.0
    */
    public class Shop {

    public int id;
    public int maxslot;
    public List<int[]> items = new ArrayList<int[]>(40);

    public Shop(int id, List itemlist, int maxslot) {
    this.items = itemlist;
    this.maxslot = maxslot;
    }

    public void buyItem(int slot, int amount) {
    int itemsamount = items.get(slot)[1];
    //System.out.println("ItemAmount: "+itemsamount);
    itemsamount = itemsamount - amount;
    // System.out.println("ItemAmount: "+itemsamount);
    items.get(slot)[1] = itemsamount;
    }

    public void sellItem(int slot, int amount) {
    int itemsamount = items.get(slot)[1];
    // System.out.println("ItemAmount: "+itemsamount);
    itemsamount = itemsamount + amount;
    // System.out.println("ItemAmount: "+itemsamount);
    items.get(slot)[1] = itemsamount;
    }

    public boolean sellsItem(int item) {
    for(int i = 0; i < maxslot; i++) {
    if(items.get(i) == null)
    continue;
    int[] array = items.get(i);
    if(array[0] == item) {
    return true;
    } else {
    }
    }
    return false;
    }

    public int getSlotId(int item) {
    for(int i = 0; i < maxslot; i++) {
    int[] array = items.get(i);
    if(array[0] == item) {
    //System.out.println(i);
    return i;
    } else {
    }
    }
    return 0;
    }
    }


    It would be very nice if someone could help me with adding a new shop!
    Anyway, on to the server!!!!
    Server is not up, im currently still coding, so there's no forums / dl link

    Spoiler for Media:
































    The rest of the Divinity614 Images


    PLEASE NOTE:
    -Im not taking credit for the whole source as it's a SpawnScape source that i've added items to,
    - I know it's SS source, no need to remind me
    - Opinions?
    -Can someone please help me with the shops, either PM me, or post on here.

    Kind regards,
    Leon
    Reply With Quote  
     

  2. #2  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,317
    Thanks given
    400
    Thanks received
    228
    Rep Power
    84
    Ehh.. good luck, but next time post your problems in the help section.
    Reply With Quote  
     

  3. #3  
    Bayley the cat saver! =^-^=

    Kevys Nan's Avatar
    Join Date
    Sep 2013
    Posts
    1,036
    Thanks given
    347
    Thanks received
    158
    Rep Power
    142
    I see slot of 614's. I guess the tokens are nice. Good luck


    Schrodinger keeps me warm :^)
    My Skype is Scarlet.rs if you need me.

    Oh Numbers
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Oct 2013
    Posts
    255
    Thanks given
    16
    Thanks received
    17
    Rep Power
    20
    Quote Originally Posted by Mylyn View Post
    Ehh.. good luck, but next time post your problems in the help section.
    It was kind of showing off my server and requiring help, but Ok Thanks.

    Quote Originally Posted by Imperfection View Post
    I see slot of 614's. I guess the tokens are nice. Good luck
    You see a lot of "SpawnScape LEECHES" This is the source, but not directly leeched, i changed mostly everything on it.
    Thank you however.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Dec 2011
    Posts
    608
    Thanks given
    76
    Thanks received
    89
    Rep Power
    34
    Quote Originally Posted by leonboss1 View Post
    It was kind of showing off my server and requiring help, but Ok Thanks.


    You see a lot of "SpawnScape LEECHES" This is the source, but not directly leeched, i changed mostly everything on it.
    Thank you however.
    You dont even got link for server...
    Reply With Quote  
     

  6. #6  
    Bayley the cat saver! =^-^=

    Kevys Nan's Avatar
    Join Date
    Sep 2013
    Posts
    1,036
    Thanks given
    347
    Thanks received
    158
    Rep Power
    142
    Quote Originally Posted by leonboss1 View Post
    It was kind of showing off my server and requiring help, but Ok Thanks.


    You see a lot of "SpawnScape LEECHES" This is the source, but not directly leeched, i changed mostly everything on it.
    Thank you however.
    If I saw slot of spawnscape leeches I would say I see alot of spawnscape leeches. I said I see alot of 614's. You can have a 614 that's not spawnscape.

    All the best,
    Imperfection


    Schrodinger keeps me warm :^)
    My Skype is Scarlet.rs if you need me.

    Oh Numbers
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2013
    Posts
    255
    Thanks given
    16
    Thanks received
    17
    Rep Power
    20
    Quote Originally Posted by furious3lf View Post
    You dont even got link for server...
    It's not online. It's my beta...
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Dec 2011
    Posts
    608
    Thanks given
    76
    Thanks received
    89
    Rep Power
    34
    Quote Originally Posted by leonboss1 View Post
    It's not online. It's my beta...
    Then why put it on advertisments?

    Idiot....
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Oct 2013
    Posts
    255
    Thanks given
    16
    Thanks received
    17
    Rep Power
    20
    Quote Originally Posted by furious3lf View Post
    Then why put it on advertisments?

    Idiot....
    Shut up, dont call me an idiot mate.
    I put it out there so that i can advertise my Beta and see people's opinions,
    yours may not be one of which i'd approve of but you still replied.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Dec 2011
    Posts
    608
    Thanks given
    76
    Thanks received
    89
    Rep Power
    34
    Quote Originally Posted by leonboss1 View Post
    Shut up, dont call me an idiot mate.
    I put it out there so that i can advertise my Beta and see people's opinions,
    yours may not be one of which i'd approve of but you still replied.
    That's just retarded.

    You could aswell make an advertisment topic and say "This will come out in 3 years", no one give a ****ing crap until the server is out.

    And if you want opinions/help, then there is a "Projects" / "Help" categories.
    Reply With Quote  
     

  11. Thankful user:


Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Divine and Elysian Spirit shield effects.
    By F0rerunner in forum Tutorials
    Replies: 58
    Last Post: 06-07-2010, 04:41 AM
  2. A Divine Trident - includes drop model~
    By J-dog in forum Models
    Replies: 14
    Last Post: 01-19-2010, 06:55 AM
  3. Divinity Script System
    By Songoty in forum Show-off
    Replies: 7
    Last Post: 05-24-2009, 06:19 PM
  4. Divine Sword
    By Vox' in forum Models
    Replies: 5
    Last Post: 02-23-2009, 09:47 PM
  5. Divine PK
    By BiohazardSteven in forum Help
    Replies: 2
    Last Post: 01-29-2009, 04:04 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •