Thread: Avalon - Economy - Grand Exchange - Great Combat

Page 1 of 18 12311 ... LastLast
Results 1 to 10 of 178
  1. #1 Avalon - Economy - Grand Exchange - Great Combat 
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    AvalonPK Release

    Haven't touched programming in months now, server just sitting in desktop doing nothing.
    Server has both Spawn/Economy, they're seperated by areas, easy to remove, should work fully economy tho. I hosted it but close because lack of players and alot of DDOS attacks.

    Updated Source 2015-11-26 - Click here
    Spoiler for Newest updates:
    Updated NPC aggression ranges
    Fixed some bugs on npc attacking & walking & combat
    Added a ::removealloffers command for grand exchange
    And some more small stuff.


    Updated combat system

    Spoiler for Updates that needs to be done:

    Replace NPCCombat.java
    Spoiler for NPCCombat.java:
    Code:
    package com.rs.game.npc.combat;
    import com.rs.game.Animation;
    import com.rs.game.Entity;
    import com.rs.game.ForceMovement;
    import com.rs.game.World;
    import com.rs.game.WorldTile;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.familiar.Familiar;
    import com.rs.game.npc.fightcaves.FightCavesNPC;
    import com.rs.game.npc.fightkiln.HarAkenTentacle;
    import com.rs.game.npc.godwars.zaros.Nex;
    import com.rs.game.npc.others.Hybrid;
    import com.rs.game.npc.pest.PestPortal;
    import com.rs.game.player.Player;
    import com.rs.game.player.content.Combat;
    import com.rs.utils.MapAreas;
    import com.rs.utils.Utils;
    
    /**
     * 
     * @Improved Andreas - AvalonPK
     * 
     */
    
    public final class NPCCombat {
    
    	private NPC npc;
    	private int combatDelay;
    	private Entity target;
    
    	public NPCCombat(NPC npc) {
    		this.npc = npc;
    	}
    
    	public int getCombatDelay() {
    		return combatDelay;
    	}
    
    	/*
    	 * returns if under combat
    	 */
    	public boolean process() {
    		if (combatDelay > 0)
    			combatDelay--;
    		if (target != null) {
    			if (!checkAll()) {
    				removeTarget();
    				return false;
    			}
    			if (combatDelay <= 0)
    				combatDelay = combatAttack();
    			return true;
    		}
    		return false;
    	}
    
    	/*
    	 * return combatDelay
    	 */
    	private int combatAttack() {
    		Entity target = this.target;
    		if (target == null)
    			return 0;
    		if (npc.isDead() || npc.hasFinished() || npc.isForceWalking() || target.isDead() || target.hasFinished()
    				|| npc.getPlane() != target.getPlane())
    			return 0;
    		NPCCombatDefinitions defs = npc.getCombatDefinitions();
    		int attackStyle = defs.getAttackStyle();
    		if (target instanceof Familiar) {
    			Familiar familiar = (Familiar) target;
    			Player player = familiar.getOwner();
    			if (player != null) {
    				target = player;
    				npc.setTarget(target);
    			}
    			if (target == familiar.getOwner()) {
    				npc.setTarget(target);
    			}
    
    		}
    		int maxDistance = attackStyle == NPCCombatDefinitions.MELEE || attackStyle == NPCCombatDefinitions.SPECIAL2 ? 0
    				: npc instanceof HarAkenTentacle ? 12
    						: npc instanceof FightCavesNPC && attackStyle == NPCCombatDefinitions.SPECIAL ? 12 : 7;
    		if ((!(npc instanceof Nex))
    				&& !npc.clipedProjectile(target, maxDistance == 0 && !forceCheckClipAsRange(target))) {
    			return 0;
    		}
    		int size = npc.getSize();
    		int targetSize = target.getSize();
    		int distanceX = target.getX() - npc.getX();
    		int distanceY = target.getY() - npc.getY();
    		if (distanceX > size + maxDistance || distanceX < -1 - maxDistance || distanceY > size + maxDistance
    				|| distanceY < -1 - maxDistance) {
    			return 0;
    		}
    		// addAttackedByDelay(target);
    		return CombatScriptsHandler.specialAttack(npc, target);
    	}
    
    	protected void doDefenceEmote(Entity target) {
    		target.setNextAnimationNoPriority(new Animation(Combat.getDefenceEmote(target)), target);
    	}
    
    	public Entity getTarget() {
    		return target;
    	}
    
    	public void addAttackedByDelay(Entity target) {
    		target.setAttackedBy(npc);
    		target.setAttackedByDelay(Utils.currentTimeMillis() + 5000); // 8seconds
    	}
    
    	public void setTarget(Entity target) {
    		this.target = target;
    		npc.setNextFaceEntity(target);
    		if (!checkAll()) {
    			removeTarget();
    			return;
    		}
    	}
    
    	// maxDistance = npc.getForceAgressiveDistance() > 0 ? npc
    	// .getForceAgressiveDistance() : 4;
    
    	// maxDistance = npc.getForceTargetDistance() > 0 ? npc
    	// .getForceTargetDistance() * 2 : 8;
    
    	public boolean checkAll() {
    		Entity target = this.target; // prevents multithread issues
    		if (target == null)
    			return false;
    		if (npc.isDead() || npc.hasFinished() || npc.isForceWalking() || target.isDead() || target.hasFinished()
    				|| npc.getPlane() != target.getPlane())
    			return false;
    		int distanceX = npc.getX() - npc.getRespawnTile().getX();
    		int distanceY = npc.getY() - npc.getRespawnTile().getY();
    		int targetdistanceX = target.getX() - npc.getRespawnTile().getX();
    		int targetdistanceY = target.getY() - npc.getRespawnTile().getY();
    		int size = npc.getSize();
    		int maxDistance;
    		int attackStyle = npc.getCombatDefinitions().getAttackStyle();
    		if (npc.getFreezeDelay() >= Utils.currentTimeMillis()) {
    			if ((attackStyle == NPCCombatDefinitions.MELEE || attackStyle == NPCCombatDefinitions.SPECIAL2)
    					&& size == 1)
    				if (npc.getX() == target.getX() + 1 && npc.getY() == target.getY() + 1
    						|| npc.getX() == target.getX() - 1 && npc.getY() == target.getY() - 1
    						|| npc.getX() == target.getX() - 1 && npc.getY() == target.getY() + 1
    						|| npc.getX() == target.getX() + 1 && npc.getY() == target.getY() - 1) {
    					combatDelay = 3;
    					return true;
    				}
    			if (npc.withinDistance(target, 0))
    				return false;
    		}
    		if (!npc.isNoDistanceCheck() && !npc.isCantFollowUnderCombat()) {
    			maxDistance = npc instanceof Familiar ? 32
    					: npc.getForceTargetDistance() != 0 ? npc.getForceTargetDistance() * 2 : 12;
    			if (!(npc instanceof Familiar)) {
    				if (npc.getMapAreaNameHash() != -1) {
    					// if out his area
    					if (!MapAreas.isAtArea(npc.getMapAreaNameHash(), npc) || (!npc.canBeAttackFromOutOfArea()
    							&& !MapAreas.isAtArea(npc.getMapAreaNameHash(), target))) {
    						npc.forceWalkRespawnTile();
    						return false;
    					}
    				} else if (targetdistanceX > size + maxDistance || targetdistanceX < -1 - maxDistance
    						|| targetdistanceY > size + maxDistance || targetdistanceY < -1 - maxDistance) {
    					npc.forceWalkRespawnTile();
    					return false;
    				} else if ((distanceX > size + maxDistance || distanceX < -1 - maxDistance
    						|| distanceY > size + maxDistance || distanceY < -1 - maxDistance)) {
    					return false;
    				}
    			}
    			maxDistance = npc instanceof Familiar ? 16
    					: npc.getForceAgressiveDistance() != 0 ? npc.getForceAgressiveDistance() : 8;
    			if (distanceX > size + maxDistance || distanceX < -1 - maxDistance || distanceY > size + maxDistance
    					|| distanceY < -1 - maxDistance)
    				return false;
    			distanceX = target.getX() - npc.getX();
    			distanceY = target.getY() - npc.getY();
    
    		} else {
    			distanceX = target.getX() - npc.getX();
    			distanceY = target.getY() - npc.getY();
    		}
    		// checks for no multi area :)
    		if (npc instanceof Familiar) {
    			Familiar familiar = (Familiar) npc;
    			if (!familiar.canAttack(target))
    				return false;
    		} else {
    			if (!npc.isForceMultiAttacked()) {
    				if (!target.isAtMultiArea() || !npc.isAtMultiArea()) {
    					if (npc.getAttackedBy() != target && npc.getAttackedByDelay() > Utils.currentTimeMillis())
    						return false;
    					if (target.getAttackedBy() != npc && target.getAttackedByDelay() > Utils.currentTimeMillis())
    						return false;
    				}
    			}
    		}
    		if (!npc.isCantFollowUnderCombat()) {
    			// if is under
    			int targetSize = target.getSize();
    			if (distanceX < size && distanceX > -targetSize && distanceY < size && distanceY > -targetSize
    					&& !target.hasWalkSteps()) {
    				npc.resetWalkSteps();
    				if (!npc.addWalkSteps(target.getX() + 1, npc.getY())) {
    					npc.resetWalkSteps();
    					if (!npc.addWalkSteps(target.getX() - size, npc.getY())) {
    						npc.resetWalkSteps();
    						if (!npc.addWalkSteps(npc.getX(), target.getY() + 1)) {
    							npc.resetWalkSteps();
    							if (!npc.addWalkSteps(npc.getX(), target.getY() - size)) {
    								return true;
    							}
    						}
    					}
    				}
    				return true;
    			}
    			if (npc instanceof Nex) {
    				Nex nex = (Nex) npc;
    				maxDistance = nex.isForceFollowClose() ? 0 : 7;
    				if ((!npc.clipedProjectile(target, maxDistance == 0 && !forceCheckClipAsRange(target)))
    						|| !Utils.isOnRange(npc.getX(), npc.getY(), size, target.getX(), target.getY(), targetSize,
    								maxDistance)) {
    					npc.resetWalkSteps();
    					if (!Utils.isOnRange(npc.getX(), npc.getY(), size, target.getX(), target.getY(), targetSize, 10)) {
    						int[][] dirs = Utils.getCoordOffsetsNear(size);
    						for (int dir = 0; dir < dirs[0].length; dir++) {
    							final WorldTile tile = new WorldTile(new WorldTile(target.getX() + dirs[0][dir],
    									target.getY() + dirs[1][dir], target.getPlane()));
    							if (World.isTileFree(tile.getPlane(), tile.getX(), tile.getY(), size)) {
    								npc.setNextForceMovement(new ForceMovement(new WorldTile(npc), 0, tile, 1,
    										Utils.getMoveDirection(tile.getX() - npc.getX(), tile.getY() - npc.getY())));
    								npc.setNextAnimation(new Animation(17408));
    								npc.setNextWorldTile(tile);
    								return true;
    							}
    						}
    					} else
    						npc.calcFollow(target, 2, true, npc.isIntelligentRouteFinder());
    					return true;
    				} else
    					npc.resetWalkSteps();
    			} else {
    				maxDistance = npc.isForceFollowClose() ? 0
    						: (attackStyle == NPCCombatDefinitions.MELEE || attackStyle == NPCCombatDefinitions.SPECIAL2)
    								? 0
    								: npc instanceof HarAkenTentacle ? 12
    										: npc instanceof FightCavesNPC && attackStyle == NPCCombatDefinitions.SPECIAL
    												? 12 : 7;
    				npc.resetWalkSteps();
    				// is far from target, moves to it till can attack
    				if ((!npc.clipedProjectile(target, maxDistance == 0)) || distanceX > size + maxDistance
    						|| distanceX < -1 - maxDistance || distanceY > size + maxDistance
    						|| distanceY < -1 - maxDistance) {
    					if (npc.isIntelligentRouteFinder()) {
    						if (!npc.calcFollow(target, npc.getRun() ? 2 : 1, true, npc.isIntelligentRouteFinder())
    								&& combatDelay < 3)
    							combatDelay = 3;
    						return true;
    					} else {
    						if (!npc.addWalkStepsInteract(target.getX(), target.getY(), 1, size, true) && combatDelay < 3)
    							combatDelay = 3;
    						return true;
    					}
    				}
    				// if under target, moves
    
    			}
    		}
    		return true;
    	}
    
    	private boolean forceCheckClipAsRange(Entity target) {
    		return target instanceof PestPortal;
    	}
    
    	public void addCombatDelay(int delay) {
    		combatDelay += delay;
    	}
    
    	public void setCombatDelay(int delay) {
    		combatDelay = delay;
    	}
    
    	public boolean underCombat() {
    		return target != null;
    	}
    
    	public void removeTarget() {
    		this.target = null;
    		npc.setNextFaceEntity(null);
    	}
    
    	public void reset() {
    		combatDelay = 0;
    		target = null;
    	}
    
    }

    Replace GrandExchange.java
    Spoiler for GrandExchange.java:
    Code:
    package com.rs.game.player.content.grandexchange;
    
    import java.math.BigInteger;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map.Entry;
    
    import com.rs.cache.loaders.ItemDefinitions;
    import com.rs.game.World;
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.net.decoders.WorldPacketsDecoder;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.Utils;
    
    public class GrandExchange {
    
    	private static final Object LOCK = new Object();
    	// offer uid
    	static HashMap<Long, Offer> OFFERS;
    	private static ArrayList<OfferHistory> OFFERS_TRACK;
    	private static HashMap<Integer, Integer> PRICES;
    
    	private static boolean edited;
    
    	public static void init() {
    		OFFERS = SerializableFilesManager.loadGEOffers();
    		setOFFERS_TRACK(SerializableFilesManager.loadGEHistory());
    		PRICES = SerializableFilesManager.loadGEPrices();
    	}
    
    	public static void removeOffers(Player player) {
    		for (long uid : player.getGeManager().getOfferUIds()) {
    			if (uid == 0) {
    				continue;
    			}
    			System.out.println("uid: " + uid);
    			edited = true;
    			OFFERS.remove(uid);
    		}
    		for (Entry<Long, Offer> entry : OFFERS.entrySet()) {
    			Offer offer = entry.getValue();
    			if (offer.getUsername().equals(player.getUsername())) {
    				edited = true;
    				OFFERS.remove(entry.getKey());
    			}
    		}
    	}
    
    	public static void removeAllOffers() {
    		for (Entry<Long, Offer> entry : OFFERS.entrySet()) {
    			Offer offer = entry.getValue();
    			edited = true;
    			offer.setId(0);
    			offer.setAmount(1);
    			offer.cancel();
    		}
    	}
    
    	public static int getTotalBuyQuantity(int itemId) {
    		int quantity = 0;
    		for (Offer offer : OFFERS.values()) {
    			if (!offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			quantity += offer.getAmount() - offer.getTotalAmmountSoFar();
    		}
    		return quantity;
    	}
    
    	public static int getTotalSellQuantity(int itemId) {
    		int quantity = 0;
    		for (Offer offer : OFFERS.values()) {
    			if (offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			quantity += offer.getAmount() - offer.getTotalAmmountSoFar();
    		}
    		return quantity;
    	}
    
    	public static void sendOfferTracker(Player player) {
    		player.getInterfaceManager().sendInterface(275);
    		int number = 0;
    		for (int i = 0; i < 320; i++) {
    			player.getPackets().sendIComponentText(275, i, "");
    		}
    		for (Offer offer : OFFERS.values()) {
    			if (offer == null)
    				continue;
    			ItemDefinitions defs = ItemDefinitions.getItemDefinitions(offer.getId());
    			if (GrandExchange.getPrice(offer.getId()) < 250000 && !LimitedGEReader.itemIsLimited(offer.getId()))
    				continue;
    			if (offer.isCompleted())
    				continue;
    			player.getPackets().sendIComponentText(275, 1, "Grand Exchange Offers");
    			int totalAmount = offer.getAmount() - offer.getTotalAmmountSoFar();
    			player.getPackets().sendIComponentText(275, (13 + number++),
    					Utils.formatPlayerNameForDisplay(offer.getUsername()) + " ["
    							+ (offer.isBuying() ? "Buying" : "Selling") + "] " + defs.getName() + " x "
    							+ Utils.getFormattedNumber(totalAmount, ',') + " :  Price "
    							+ Utils.getFormattedNumber(offer.getPrice(), ',') + " " + (totalAmount > 1 ? "each" : ""));
    			player.getPackets().sendIComponentText(275, 11,
    					"Amount of Offers: " + number + "<br>It does only show offers above 250k price<br><br>");
    			if (number >= 100) {
    				break;
    			}
    		}
    	}
    
    	public static int getBestBuyPrice(int itemId) {
    		int price = -1;
    		for (Offer offer : OFFERS.values()) {
    			if (!offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			if (offer.getPrice() > price || price == -1) {
    				price = offer.getPrice();
    			}
    		}
    		return price;
    	}
    
    	public static int getBuyQuantity(int itemId) {
    		int quantity = 0;
    		int price = -1;
    		for (Offer offer : OFFERS.values()) {
    			if (!offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			if (offer.getPrice() == getBestBuyPrice(itemId))
    				quantity += offer.getAmount() - offer.getTotalAmmountSoFar();
    		}
    		return quantity;
    	}
    
    	public static int getCheapestSellPrice(int itemId) {
    		int price = -1;
    		for (Offer offer : OFFERS.values()) {
    			if (offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			if (offer.getPrice() < price || price == -1) {
    				price = offer.getPrice();
    			}
    		}
    		return price;
    	}
    
    	public static int getSellQuantity(int itemId) {
    		int quantity = 0;
    		int price = -1;
    		for (Offer offer : OFFERS.values()) {
    			if (offer.isBuying() || offer.getId() != itemId || offer.isCompleted())
    				continue;
    			if (offer.getPrice() == getCheapestSellPrice(itemId))
    				quantity += offer.getAmount() - offer.getTotalAmmountSoFar();
    		}
    		return quantity;
    	}
    
    	public static int getAmount1(int itemId) {
    		return OFFERS.get(itemId).getId();
    	}
    
    	public static void reset(boolean track, boolean price) {
    		if (track)
    			getOFFERS_TRACK().clear();
    		if (price)
    			PRICES.clear();
    		recalcPrices();
    	}
    
    	public static void recalcPrices() {
    		ArrayList<OfferHistory> track = new ArrayList<OfferHistory>(getOFFERS_TRACK());
    		HashMap<Integer, BigInteger> averagePrice = new HashMap<Integer, BigInteger>();
    		HashMap<Integer, BigInteger> averageQuantity = new HashMap<Integer, BigInteger>();
    		for (OfferHistory o : track) {
    			BigInteger price = averagePrice.get(o.getId());
    			if (price != null) {
    				BigInteger quantity = averageQuantity.get(o.getId());
    				averagePrice.put(o.getId(), price.add(BigInteger.valueOf(o.getPrice())));
    				averageQuantity.put(o.getId(), quantity.add(BigInteger.valueOf(o.getQuantity())));
    			} else {
    				averagePrice.put(o.getId(), BigInteger.valueOf(o.getPrice()));
    				averageQuantity.put(o.getId(), BigInteger.valueOf(o.getQuantity()));
    			}
    		}
    
    		for (int id : averagePrice.keySet()) {
    			BigInteger price = averagePrice.get(id);
    			BigInteger quantity = averageQuantity.get(id);
    
    			long oldPrice = getPrice(id);
    			long newPrice = price.divide(quantity).longValue();
    			long min = (long) ((double) oldPrice * 0.8D) - 100;
    			long max = (long) ((double) oldPrice * 1.2D) + 100;
    			if (newPrice < min)
    				newPrice = min;
    			else if (newPrice > max)
    				newPrice = max;
    
    			if (newPrice < 1)
    				newPrice = 1;
    			else if (newPrice > Integer.MAX_VALUE)
    				newPrice = Integer.MAX_VALUE;
    
    			PRICES.put(id, (int) newPrice);
    		}
    		savePrices();
    	}
    
    	private static void savePrices() {
    		SerializableFilesManager.saveGEPrices(PRICES);
    	}
    
    	public static final void save() {
    		if (!edited)
    			return;
    		SerializableFilesManager.saveGEOffers(OFFERS);
    		SerializableFilesManager.saveGEHistory(getOFFERS_TRACK());
    		edited = false;
    	}
    
    	public static void linkOffers(Player player) {
    		boolean itemsWaiting = false;
    		for (int slot = 0; slot < player.getGeManager().getOfferUIds().length; slot++) {
    			Offer offer = getOffer(player, slot);
    			if (offer == null)
    				continue;
    			offer.link(slot, player);
    			offer.update();
    			if (!itemsWaiting && offer.hasItemsWaiting()) {
    				itemsWaiting = true;
    				if (player.getSession() != null) {
    					player.getPackets()
    							.sendGameMessage("You have items from the Grand Exchange waiting in your collection box.");
    				}
    			}
    		}
    	}
    
    	public static Offer getOffer(Player player, int slot) {
    		synchronized (LOCK) {
    			long uid = player.getGeManager().getOfferUIds()[slot];
    			if (uid == 0)
    				return null;
    			Offer offer = OFFERS.get(uid);
    			if (offer == null) {
    				player.getGeManager().getOfferUIds()[slot] = 0;
    				return null;
    			}
    			return offer;
    		}
    
    	}
    
    	public static void sellOffer(Player player, int slot, int itemId, int amount, int price, boolean buy) {
    		synchronized (LOCK) {
    			Offer offer = new Offer(itemId, amount, price, buy);
    			offer.setUsername(player.getUsername());
    			player.getGeManager().getOfferUIds()[slot] = createOffer(offer);
    			offer.link(slot, player);
    			offer.update();
    		}
    	}
    
    	public static void buyOffer(Player player, int slot, int itemId, int amount, int price, boolean buy) {
    		synchronized (LOCK) {
    			Offer offer = new Offer(itemId, amount, price, buy);
    			offer.setUsername(player.getUsername());
    			player.getGeManager().getOfferUIds()[slot] = createOffer(offer);
    			offer.link(slot, player);
    			offer.update();
    		}
    	}
    
    	public static void sendOffer(final Player player, final int slot, final int itemId, final int amount,
    			final int price, final boolean buy) {
    		synchronized (LOCK) {
    			final Offer offer = new Offer(itemId, amount, price, buy);
    			offer.setUsername(player.getUsername());
    			player.getGeManager().getOfferUIds()[slot] = createOffer(offer);
    			offer.link(slot, player);
    			if (!offer.isBuying()) {
    				if (offer.getPrice() <= Math.ceil(GrandExchange.getPrice(itemId) * 0.95)
    						&& (GrandExchange.getPrice(itemId) < 250000 && !LimitedGEReader.itemIsLimited(itemId)
    								|| UnlimitedGEReader.itemIsLimited(itemId)))
    					offer.sellOffer(offer);
    				else
    					findBuyerSeller(offer);
    			} else {
    				if ((GrandExchange.getPrice(itemId) < 250000 && offer.getPrice() >= GrandExchange.getPrice(itemId)
    						&& !LimitedGEReader.itemIsLimited(itemId) && GrandExchange.getPrice(itemId) != 1)
    						|| UnlimitedGEReader.itemIsLimited(itemId)) {
    					offer.buyOffer(offer);
    				} else {
    					findBuyerSeller(offer);
    				}
    			}
    		}
    	}
    
    	public static void abortOffer(Player player, int slot) {
    		synchronized (LOCK) {
    			Offer offer = getOffer(player, slot);
    			if (offer == null)
    				return;
    			edited = true;
    			if (offer.cancel() && offer.forceRemove())
    				deleteOffer(player, slot);
    		}
    	}
    
    	public static void collectItems(Player player, int slot, int invSlot, int option) {
    		synchronized (LOCK) {
    			Offer offer = getOffer(player, slot);
    			if (offer == null)
    				return;
    			edited = true;
    			if (offer.collectItems(invSlot, option) && offer.forceRemove()) {
    				deleteOffer(player, slot);
    				if (offer.getTotalAmmountSoFar() != 0) {
    					OfferHistory o = new OfferHistory(offer.getId(), offer.getTotalAmmountSoFar(),
    							offer.getTotalPriceSoFar(), offer.isBuying());
    					player.getGeManager().addOfferHistory(o);
    				}
    			}
    		}
    	}
    
    	private static void deleteOffer(Player player, int slot) {
    		player.getGeManager().cancelOffer();
    		OFFERS.remove(player.getGeManager().getOfferUIds()[slot]);
    		player.getGeManager().getOfferUIds()[slot] = 0;
    	}
    
    	private static void findBuyerSeller(final Offer offer) {
    		while (!offer.isCompleted()) {
    			Offer bestOffer = null;
    			for (Offer o : OFFERS.values()) {
    				if (o.isBuying() == offer.isBuying() || o.getId() != offer.getId() || o.isCompleted()
    						|| (offer.isBuying() && o.getPrice() > offer.getPrice())
    						|| (!offer.isBuying() && o.getPrice() < offer.getPrice()) || offer.isOfferTooHigh(o))
    					continue;
    				if (bestOffer == null || (offer.isBuying() && o.getPrice() < bestOffer.getPrice())
    						|| (!offer.isBuying() && o.getPrice() > bestOffer.getPrice()))
    					bestOffer = o;
    			}
    			if (bestOffer == null)
    				break;
    			offer.updateOffer(bestOffer);
    		}
    		offer.update();
    	}
    
    	private static long createOffer(Offer offer) {
    		edited = true;
    		long uid = getUId();
    		OFFERS.put(uid, offer);
    		return uid;
    	}
    
    	private static long getUId() {
    		while (true) {
    			long uid = Utils.RANDOM.nextLong();
    			if (OFFERS.containsKey(uid))
    				continue;
    			return uid;
    		}
    	}
    
    	public static int getPrice(int itemId) {
    		ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId);
    		if (defs.isNoted())
    			itemId = defs.getCertId();
    		return defs.getTipitPrice();
    	}
    
    	public static void unlinkOffers(Player player) {
    		for (int slot = 0; slot < player.getGeManager().getOfferUIds().length; slot++) {
    			Offer offer = getOffer(player, slot);
    			if (offer == null)
    				continue;
    			offer.unlink();
    		}
    	}
    
    	public static List<OfferHistory> getHistory() {
    		return getOFFERS_TRACK();
    	}
    
    	public static ArrayList<OfferHistory> getOFFERS_TRACK() {
    		return OFFERS_TRACK;
    	}
    
    	public static void setOFFERS_TRACK(ArrayList<OfferHistory> oFFERS_TRACK) {
    		OFFERS_TRACK = oFFERS_TRACK;
    	}
    }
    }

    Noticed max cape dialogue had a little bug where it says you don't have 99 dungeoneering if you dont have all 99s and 120 dungeoneering, this will fix that.
    Code:
    public void sendRequirementMessages() {
    		if (!player.hasMaxCapeRequirements()) {
    			player.getPackets().sendGameMessage(
    					"You need level 99 in the following: ");
    			for (int skill = 0; skill < 25; skill++) {
    				if (player.getSkills().getLevelForXp(skill) >= 99)
    					continue;
    				player.getPackets().sendGameMessage(
    						player.getSkills().getSkillName(skill));
    			}
    		}
    	}
    Slayer Fixes
    Replace SlayerManager.java
    Replace SlayerMasterD.java

    Client - Click here
    Cache - Click here
    NOTE: Updated Source, removed seperate spawn, fixed up clan wars, fixed up small bugs.

    Information about server:
    Spoiler for Information About Server:
    Perfect Combat for both Player vs Player, Player vs NPC, Great for pking. (It been a pking server since i started hosting it.)
    Decent Pathfinding
    Great Drop tables
    Lots of pvm content
    Grand Exchange working player based/server based
    All skills other than Hunter, Construction & farming works, never botherd to add them.
    Pk Point shops
    Fully working Dungeoneering store
    Working Summoning with charm drops
    Working clue scrolls
    Crystal chest
    Working Boss pets
    Kill count for all the bosses to keep track how many you killed
    Max cape
    Completionist cape
    Working Bones on Altar
    Recipe for the Disaster mini-quest (Rfd gloves)
    Pest control
    Clan wars FFA
    Castle wars
    Perfect Money pouch with overflow fixes.
    Fixed overflow for all items in trading, banking, duel arena, money pouch.
    Axe hut
    Pirate Hut
    Great Combat Following, Melee/range/mage
    Reworked Prayers
    Fixed up most magic spells
    Some extra spells: Veng other, heal other, cure other, Low alchemy, High alchemy
    Fully working Mr Ex with Wildstalker helmet
    Fully working Estocada with Duellist cap

    Great monsters to kill:
    King Black Dragon
    Godwars Bosses
    Tormented Demons
    Revenants
    Dagannoth Kings
    Corporeal Beast
    Kalphite Queen
    Frost Dragons
    And ofcourse Slayer.
    Great server for Team pking, Singles pking, Veng pking, Hybriding.

    Project Thread
    Advertise Thread

    Spoiler for Videos:


    Spoiler for Media:


    Wilderness Obelisk
    Attached image


    Gear Setups
    Attached image
    Attached image
    Attached image


    Grand Exchange











    Dungeoneering rewards


    Slayer
    Slayer includes:
    Slayer tasks, Easy-Medium-Hard-Boss

    Slayer points with rewards/unlocks

    Slayer task locator & also some information in the quest tab.


    Fully working Duel Arena



    Frost dragons to deep wildy to make pking more active

    Added Battlemages in mage bank to make that more active
    They drop runes, enchanted, Infinity, mages book ,master wand



    Added alot of new pets


    Lootshare




    Attached image

    Money pouch images

    Attached image

    Attached image

    Attached image

    All these overflows are fixed, Duel arena, bank, grand exchange, trade, dropping, pick up.

    Also no more double loot piles of same items, noted & stackable items will merge, until it turns to 2147m, if its over 2147m, it will turn to 2147m and leave rest in another pile.


    Attached image

    Quest Tab

    Attached image

    Items Kept On Death

    Attached image

    Working Axe Hut & Pirate Hut

    Attached image
    Attached image

    Teleblock


    2 Minutes because mage protect.
    Attached image

    5 Minutes because no mage protect.
    Attached image

    5 Minutes on mage protect because other player got exp before i put on mage protect, so it counts as i didnt have pray up.
    Attached image

    Korasi Single-way Combat
    Attached image

    Korasi Multi-way Combat, it splits up damage, so if there is 5 npcs, and you hit a 500, it would split up to 100 on each.
    Attached image




    There is loads of more stuff that i've been adding, it's a work that was going on for at least 2 years.

    Credits: Matrix, Andreas, Dennis, Phillip, Arno


    Thanks ~Andreas, Co-Founder - Programmer of AvalonPK

    Avalon Developer
    Reply With Quote  
     


  2. #2  
    Aldor Manager


    Join Date
    Mar 2014
    Age
    28
    Posts
    1,234
    Thanks given
    200
    Thanks received
    297
    Rep Power
    2459
    Looks good! Will take some ideas from it if i had the chance to get the download key?
    Attached image

    Respect goes to everyone as he deserves.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Jun 2012
    Posts
    334
    Thanks given
    9
    Thanks received
    2
    Rep Power
    11
    Looks good, but cant download it ?
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Sec, might have to upload it on dropbox instead.

    Quote Originally Posted by mikkeljj1 View Post
    Looks good, but cant download it ?
    There is a decrypt key now in the post.

    Quote Originally Posted by _Jamal View Post
    Looks good! Will take some ideas from it if i had the chance to get the download key?
    Decrypt key is now in the post, sorry
    Avalon Developer
    Reply With Quote  
     

  7. #5  
    Sweet milk.
    Sense's Avatar
    Join Date
    May 2012
    Posts
    128
    Thanks given
    20
    Thanks received
    12
    Rep Power
    4
    Seems nice, thanks for the contribution
    Dont drink and drive, smoke and fly.
    Reply With Quote  
     

  8. Thankful user:


  9. #6  
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Quote Originally Posted by Sense View Post
    Seems nice, thanks for the contribution
    Hoping that someone experienced continues with it, and cleans it up.
    Avalon Developer
    Reply With Quote  
     

  10. #7  
    Banned
    Join Date
    Jul 2012
    Age
    27
    Posts
    996
    Thanks given
    646
    Thanks received
    266
    Rep Power
    0
    Looks good! Thanks for the contribution!
    Reply With Quote  
     

  11. Thankful user:


  12. #8  
    Registered Member
    Join Date
    Nov 2013
    Posts
    190
    Thanks given
    6
    Thanks received
    7
    Rep Power
    10
    Quick Download links instead of using those encrypt keys:
    Source & cache
    Client



    Btw, nice looking source. Are u running an PK server or something like that? If yes, please send me link for client.
    Reply With Quote  
     

  13. #9  
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Quote Originally Posted by lithuaniia View Post
    Quick Download links instead of using those encrypt keys:
    Source & cache
    Client



    Btw, nice looking source. Are u running an PK server or something like that? If yes, please send me link for client.
    I used to have 3 versions of this server, eco, then spawn then eco/spawn. Closed this server a few months ago due to alot of ddos attacks and lack of players, but 2nd release we had around 130+ players on same time.


    https://www.youtube.com/results?search_query=avalonpk
    Avalon Developer
    Reply With Quote  
     

  14. #10  
    Registered Member
    Join Date
    Nov 2015
    Posts
    29
    Thanks given
    2
    Thanks received
    3
    Rep Power
    11
    look's nice, i bet alot of people would use it. i probably would nor not lol
    Reply With Quote  
     

  15. Thankful user:


Page 1 of 18 12311 ... 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. Replies: 16
    Last Post: 12-11-2015, 10:44 AM
  2. Replies: 26
    Last Post: 04-08-2015, 05:16 AM
  3. Replies: 41
    Last Post: 03-30-2015, 10:40 PM
  4. Replies: 77
    Last Post: 08-26-2013, 02:12 AM
  5. Replies: 67
    Last Post: 06-05-2012, 04:44 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
  •