Thread: 12k npc spawns 204 osrs

Results 1 to 3 of 3
  1. #1 12k npc spawns 204 osrs 
    Owner of Ghreborn new and old.


    Join Date
    Nov 2009
    Posts
    916
    Thanks given
    47
    Thanks received
    155
    Rep Power
    273
    Code:
    package godzhell.model.npcs;
    
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    
    import com.google.gson.Gson;
    import com.google.gson.JsonIOException;
    import com.google.gson.JsonSyntaxException;
    import com.google.gson.reflect.TypeToken;
    
    public class NPCSpawns {
    
    	/**
    	 * NPCSpawns, each represents a single npc spawn in the server which is held
    	 * within the array {@link #spawns}.
    	 *
    	 * This was based off of Galkon's ItemDefinitions, therefore it will be heavily
    	 * similar in a lot of ways.
    	 *
    	 * @Author Jesse (Sk8rdude461)
    	 * @Author Galkon
    	 */
    
    	/**
    	 * All the npc spawns.
    	 */
    	private static ArrayList<NPCSpawns> spawns;
    
    	/**
    	 * The Id of the npc. Commonly referred to as npcType.
    	 */
    	private int npcId;
    
    	/**
    	 * The home x-pos to the npc
    	 */
    	private int xPos;
    
    	/**
    	 * The home y-pos to the npc
    	 */
    	private int yPos;
    
    	/**
    	 * The height level where the npc is spawned
    	 */
    	private int height;
    
    	/**
    	 * The Walking type for the npc.
    	 */
    	private int walkType;
    
    	/**
    	 * The health(Constitution) of the npc.
    	 */
    	private int health;
    
    	/**
    	 * The highest possible hit for the npc.
    	 */
    	private int maxHit;
    
    	/**
    	 * The attack level of the npc.
    	 */
    	private int attack;
    
    	/**
    	 * The defence level of the npc.
    	 */
    	private int defence;
    
    	private int combatLevel;
    
    	/**
    	 * Extra info I added so you can tell where the npc is spawned.
    	 */
    	private String name;
    
    	public NPCSpawns(int npcid, int xPos, int yPos, int height, int walkType, int health, int maxHit, int attack,
    			int defence, int combatLevel,  String name) {
    		this.npcId = npcid;
    		this.xPos = xPos;
    		this.yPos = yPos;
    		this.height = height;
    		this.walkType = walkType;
    		this.health = health;
    		this.maxHit = maxHit;
    		this.attack = attack;
    		this.defence = defence;
    		this.combatLevel = combatLevel;
    		this.name = name;
    	}
    
    	public static NPCSpawns defaultNPC() {
    		try {
    			NPCSpawns npc = new NPCSpawns(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  "New NPC");
    			npc.setName("New NPC");
    			System.out.println("NPC Made!");
    			return npc;
    		} catch (NullPointerException e) {
    			return null;
    		}
    	}
    
    	/**
    	 * Gets the npc spawns
    	 *
    	 * @Return spawns
    	 */
    	public static ArrayList<NPCSpawns> getNPCSpawns() {
    		return spawns;
    	}
    
    	/**
    	 * Sets the npc spawns
    	 *
    	 * @Param npcSpawns
    	 *            the NPCSpawns to be set.
    	 */
    	public static void setNPCSpawns(ArrayList<NPCSpawns> npcSpawns) {
    		NPCSpawns.spawns = npcSpawns;
    	}
    
    	/**
    	 * Loading the NPCSpawns.
    	 *
    	 * @Param file
    	 *            The file to be read
    	 * @ThroWs java.io.FileNotFoundException
    	 */
    	public static void loadNPCSpawns() throws JsonIOException, JsonSyntaxException, FileNotFoundException {
    		Gson gson = new Gson();
    		long start = System.currentTimeMillis();
    		System.out.println("Loading NPC spawns...");
    
    		try (FileReader reader = new FileReader("./data/json/npc-spawns.json")) {
    			setNPCSpawns(gson.fromJson(reader, new TypeToken<ArrayList<NPCSpawns>>() {
    			}.getType()));
    		} catch (IOException e) {
    			e.printStackTrace();
    			System.out.println("Failed to load NPC spawns!");
    		} finally {
    			System.out.println("Loaded " + NPCSpawns.getNPCSpawns().size() + " npc spawns in "
    					+ (System.currentTimeMillis() - start) + "ms.");
    		}
    
    	}
    
    	/**
    	 * @Return npcId
    	 */
    	public int getNpcId() {
    		return npcId;
    	}
    
    	/**
    	 * @Return xPos
    	 */
    	public int getXPos() {
    		return xPos;
    	}
    
    	/**
    	 * @Return yPos
    	 */
    	public int getYPos() {
    		return yPos;
    	}
    
    	/**
    	 * @Return height
    	 */
    	public int getHeight() {
    		return height;
    	}
    
    	/**
    	 * @Return walkType
    	 */
    	public int getWalkType() {
    		return walkType;
    	}
    
    	/**
    	 * @Return health
    	 */
    	public int getHealth() {
    		return health;
    	}
    
    	/**
    	 * @Return maxHit
    	 */
    	public int getMaxHit() {
    		return maxHit;
    	}
    
    	/**
    	 * @Return attack
    	 */
    	public int getAttack() {
    		return attack;
    	}
    
    	/**
    	 * @Return defence
    	 */
    	public int getDefence() {
    		return defence;
    	}
    
    	/**
    	 * @Return combatLevel
    	 */
    	public int getCombatLevel() { return combatLevel;}
    	/**
    	 * @Return name
    	 */
    	public String getName() {
    		return name;
    	}
    
    	public void setNpcId(int npcId) {
    		this.npcId = npcId;
    	}
    
    	public void setXPos(int xPos) {
    		this.xPos = xPos;
    	}
    
    	public void setYPos(int yPos) {
    		this.yPos = yPos;
    	}
    
    	public void setHeight(int height) {
    		this.height = height;
    	}
    
    	public void setWalkType(int walkType) {
    		this.walkType = walkType;
    	}
    
    	public void setHealth(int health) {
    		this.health = health;
    	}
    
    	public void setMaxHit(int maxHit) {
    		this.maxHit = maxHit;
    	}
    
    	public void setAttack(int attack) {
    		this.attack = attack;
    	}
    
    	public void setDefence(int defence) {
    		this.defence = defence;
    	}
    
    	public void setName(String name) {
    		this.name = name;
    	}
    }
    Code:
    	public static boolean loadAutoSpawn(){
            try{
                    for(int i =0; i < NPCSpawns.getNPCSpawns().size(); i++){
                            NPCSpawns npc = NPCSpawns.getNPCSpawns().get(i);
                            newNPC(npc.getNpcId(), npc.getXPos(), npc.getYPos(),npc.getHeight(),
                                                    npc.getWalkType(), npc.getHealth(), npc.getMaxHit(), npc.getAttack(),
                                                    npc.getDefence());
    
                    }
                    return true;
            }catch(Exception e){
                    return false;
            }
    https://cdn.discordapp.com/attachmen...pc-spawns.json
    Im back and working on reborn,
    Reply With Quote  
     

  2. #2  
    Community Veteran

    Dust R I P's Avatar
    Join Date
    Jan 2008
    Posts
    2,599
    Thanks given
    197
    Thanks received
    221
    Rep Power
    586
    nice share, you took these from the wiki I suppose?
    Reply With Quote  
     

  3. #3  
    Chemist

    Advocatus's Avatar
    Join Date
    Dec 2009
    Posts
    2,622
    Thanks given
    201
    Thanks received
    813
    Rep Power
    1462
    Cool, I just quick took a look. Is this a dump of the positions from the npc update packet? I ask because this has implings within it and implings use a more convoluted spawn method and use an invisible null npc ids (one of them is 9390) on spawn.

    Implings found in Puro-Puro and Gielinor use a unique system for spawning. When caught, implings respawn immediately always on their spawn tile. This spawn tile never changes. After spawning, they are invisible for roughly 2 minutes during which they are able to traverse and roam considerable distances. Once implings become visible, a high-pitched "beckon whistle" sound plays with a subtle rattling.
    Code:
    2020-02-10 20:49:12 [Client] INFO n.r.c.p.implings.ImplingsPlugin - onNpcChanged triggered:
    imp_name: Ninja
    npc_id: 1653
    new_npc_name: Ninja impling
    old_npc_name: null
    hash: 0
    hash_code: 1809858817
    new_comp_id: 1653
    old_comp_id: 9390
    is_in_implings?: true
    Sources:
    https://oldschool.runescape.wiki/w/Impling
    https://github.com/runelite/runelite/issues/10750
    Quote Originally Posted by blakeman8192 View Post
    Quitting is the only true failure.
    Reply With Quote  
     


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. OSRS Rev Cave NPC Spawns and Animations
    By durky in forum Snippets
    Replies: 3
    Last Post: 12-29-2017, 01:27 PM
  2. [REQ][OSRS] NPC Spawns dump
    By Tommeh in forum Requests
    Replies: 3
    Last Post: 10-11-2017, 11:14 AM
  3. [Apollo] OSRS #83 npc spawn
    By Rondo in forum Help
    Replies: 0
    Last Post: 07-17-2016, 01:52 AM
  4. Some OSRS NPC Spawns
    By Eazy in forum Configuration
    Replies: 6
    Last Post: 05-13-2016, 05:04 AM
  5. OSRS Npc Spawns
    By Stanaveli in forum Requests
    Replies: 1
    Last Post: 04-10-2016, 01:03 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
  •