Thread: [Any/Kronos] JSON Equip Weapon/Armor Sounds

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 [Any/Kronos] JSON Equip Weapon/Armor Sounds 
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    I made another thread because I just converted everything to json, didn't like the other way I did it (Some items might have the default sound id and you have to change but I haven't come across any)

    Create a new class called equip_sounds.java in io.ruin.data.impl.items

    equip_sounds.java:

    Code:
    package io.ruin.data.impl.items;
    
    import com.google.gson.annotations.Expose;
    import io.ruin.api.utils.JsonUtils;
    import io.ruin.api.utils.ServerWrapper;
    import io.ruin.cache.ItemDef;
    import io.ruin.data.DataFile;
    import io.ruin.model.achievements.Achievement;
    import io.ruin.model.combat.RangedAmmo;
    import io.ruin.model.combat.RangedWeapon;
    import io.ruin.model.stat.StatType;
    
    import java.lang.reflect.Field;
    import java.util.ArrayList;
    import java.util.List;
    
    public class equip_sounds extends DataFile {
    
        @Override
        public String path() {
            return "items/equip_sounds.json";
        }
    
        @Override
        public Object fromJson(String fileName, String json) {
            List<Temp> temps = JsonUtils.fromJson(json, List.class, Temp.class);
            temps.forEach(temp -> {
                ItemDef def = ItemDef.get(temp.itemid);
                if(def != null)
                    def.soundid = temp.soundid;
    
            });
            return temps;
        }
    
    
    
        public static final class Temp {
            @ Expose public int itemid;
            @ Expose public int soundid;
        }
    
    }
    Go to io.ruin.cache > ItemDef

    Add this with the other variables
    Code:
        public int soundid;
    Add this return method
    Code:
        public int getSoundId() {
            return soundid;
        }
    In io.ruin.model.item.containers > Equipment.java (delete old equip sounds if you added it from other thread)

    Find:

    Code:
    player.closeDialogue();
    Under that line put:
    Code:
    player.privateSound(selectedDef.getSoundId(), 1, 0);
    Replace unequip method with this:
    Code:
        public boolean unequip(Item equipped) {
            ItemDef selectedDef = equipped.getDef();
            Inventory inventory = player.getInventory();
            Item inventoryStack = null;
            if(equipped.getDef().stackable)
                inventoryStack = inventory.findItem(equipped.getId());
            if(inventoryStack != null) {
                equipped.remove();
                inventoryStack.incrementAmount(equipped.getAmount());
            } else {
                int freeSlot = inventory.freeSlot();
                if(freeSlot == -1) {
                    player.sendMessage("You don't have enough free space to do that.");
                    return false;
                }
                equipped.remove();
                inventory.set(freeSlot, equipped);
            }
            player.privateSound(selectedDef.getSoundId(), 1, 0);
            return true;
        }
    Now add this new file in the data/items folder (Will have the file item_info.json in it)

    equip_sounds.json download:

    [Only registered and activated users can see links. ]

    Format:

    Code:
    [
    { "itemid": 35, "soundid": 2238 },
    { "itemid": 74, "soundid": 2240 }
    ]
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    Create a new class called equip_sounds.java in io.ruin.data.impl.items

    Bro It's not a javas classes there, it's a classes.class There are chines language in these files there

    C:\Users\HOME\Desktop\Kronos\Kronos-master\Kronos-master\kronos-server\build\classes\java\main\io\ruin\data\impl\items

    Also here:

    Go to io.ruin.cache > ItemDef
    You mean this?: C:\Users\HOME\Desktop\Kronos\Kronos-master\Kronos-master\kronos-server\build\classes\java\main\io\ruin\cache
    If yes then it's gives me chines language in ItemDef.

    Like this:

    ד ה
    ו ה ז ח
    ג ט ג י ך כ ל ם מ ג ן נ ס
    ג ע ג ף ג פ ג ץ ג צ
    ג ק ג ר
    ג ש ג ת ג   ג ‎ ג ‏
    ג  ג 

    

    

    

    
    Reply With Quote  
     

  4. #3  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post



    Bro It's not a javas classes there, it's a classes.class There are chines language in these files there

    C:\Users\HOME\Desktop\Kronos\Kronos-master\Kronos-master\kronos-server\build\classes\java\main\io\ruin\data\impl\items

    Also here:



    You mean this?: C:\Users\HOME\Desktop\Kronos\Kronos-master\Kronos-master\kronos-server\build\classes\java\main\io\ruin\cache
    If yes then it's gives me chines language in ItemDef.

    Like this:

    ד ה
    ו ה ז ח
    ג ט ג י ך כ ל ם מ ג ן נ ס
    ג ע ג ף ג פ ג ץ ג צ
    ג ק ג ר
    ג ש ג ת ג   ג ‎ ג ‏
    ג  ג







    You are in the wrong spot, the data folder will be in the kronos-server folder. And the items folder will be in the data folder.
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    You are in the wrong spot, the data folder will be in the kronos-server folder. And the items folder will be in the data folder.
    [Only registered and activated users can see links. ]

    I know it's here, so I have to add a folder here and call it: "impl" And then into this folder I will add a class which called: "Items" ?
    Reply With Quote  
     

  6. #5  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post
    [Only registered and activated users can see links. ]

    I know it's here, so I have to add a folder here and call it: "impl" And then into this folder I will add a class which called: "Items" ?
    What are you talking about? You don't need "impl" for anything. A class called items? All you need to do is add a file called "equip_sounds.json"
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    What are you talking about? You don't need "impl" for anything. A class called items? All you need to do is add a file called "equip_sounds.json"
    Ik bro, you just said that: Create a new class called equip_sounds.java in io.ruin.data.impl.items

    You have to edit it man, there is no impl folder in data. As u see in the pic I sent above. Anyway, okay I will add the json java there.
    Reply With Quote  
     

  8. #7  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post
    Ik bro, you just said that: Create a new class called equip_sounds.java in io.ruin.data.impl.items

    You have to edit it man, there is no impl folder in data. As u see in the pic I sent above. Anyway, okay I will add the json java there.
    There's 2 different files, "equip_sounds.java" and "equip_sounds.json" java and json two different files.

    The java file goes to: io.ruin.data.impl.items (in the server files)

    The json file goes to: data/items folder
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    There's 2 different files, "equip_sounds.java" and "equip_sounds.json" java and json two different files.

    The java file goes to: io.ruin.data.impl.items (in the server files)

    The json file goes to: data/items folder
    What about the Lunge hit sound? Try to hit with Lunge it will show you incorrect sound attack

    Chop + Slash + Block attack sound: 2500 it's fine and working
    Lunge attack sound must be: 2501. I tried to change it, it's not working. You have any idea or way of make this button for 2501 sound ID?

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  11. #9  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,618
    Thanks given
    170
    Thanks received
    228
    Rep Power
    326
    Quote Originally Posted by Ilgaz View Post
    What about the Lunge hit sound? Try to hit with Lunge it will show you incorrect sound attack

    Chop + Slash + Block attack sound: 2500 it's fine and working
    Lunge attack sound must be: 2501. I tried to change it, it's not working. You have any idea or way of make this button for 2501 sound ID?

    [Only registered and activated users can see links. ]
    You would have to code it in (add another setting in the weapon_types.json and then check what attack style you are using.)

    Updated equip_sounds with more items

    Quote Originally Posted by Ilgaz View Post
    What about the Lunge hit sound? Try to hit with Lunge it will show you incorrect sound attack

    Chop + Slash + Block attack sound: 2500 it's fine and working
    Lunge attack sound must be: 2501. I tried to change it, it's not working. You have any idea or way of make this button for 2501 sound ID?

    [Only registered and activated users can see links. ]
    What you can do instead of what I said above is edit the attackAnim() method in PlayerCombat.java

    Replace with this:

    Code:
        private void attackAnim() {
            if(attackSet.attackAnimation != null)
                player.animate(attackSet.attackAnimation);
            else
                player.animate(weaponType.attackAnimation);
            if(weaponType.attackSound != -1)
                if(attackSet.style == AttackStyle.STAB) {
                    player.publicSound(2501, 1, 1);
                } else {
                    player.publicSound(weaponType.attackSound, 1, 1);
                }
        }
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    Registered Member
    Join Date
    Nov 2020
    Posts
    78
    Thanks given
    41
    Thanks received
    2
    Rep Power
    23
    Quote Originally Posted by Armo View Post
    You would have to code it in (add another setting in the weapon_types.json and then check what attack style you are using.)

    Updated equip_sounds with more items



    What you can do instead of what I said above is edit the attackAnim() method in PlayerCombat.java

    Replace with this:

    Code:
        private void attackAnim() {
            if(attackSet.attackAnimation != null)
                player.animate(attackSet.attackAnimation);
            else
                player.animate(weaponType.attackAnimation);
            if(weaponType.attackSound != -1)
                if(attackSet.style == AttackStyle.STAB) {
                    player.publicSound(2501, 1, 1);
                } else {
                    player.publicSound(weaponType.attackSound, 1, 1);
                }
        }
    Lunge is not the only attacksound I gonna add. There are much more items combat I will add. I don't think it's good idea to add this attack anim including the sound ID of the stab in attackAnim method.
    Anyway bro' I appricate ur help
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [ANY] [Any/Kronos] Equip Weapon/Armor Sounds
    By Armo in forum Snippets
    Replies: 3
    Last Post: 02-25-2021, 04:47 PM
  2. Replies: 9
    Last Post: 07-23-2011, 06:46 PM
  3. Weapons/Armor [562]
    By iRagequit in forum Help
    Replies: 0
    Last Post: 07-12-2010, 01:13 PM
  4. Etable Weapons/Armor Command
    By Tetris in forum Tutorials
    Replies: 18
    Last Post: 04-13-2009, 11:50 PM
  5. 3 Rs Weapons/armor in a draw (paint)
    By d13 0r n0 in forum Media
    Replies: 19
    Last Post: 12-06-2008, 06:31 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •