Thread: Curses - Experium Source

Results 1 to 4 of 4
  1. #1 Curses - Experium Source 
    Donator
    Defiled-X's Avatar
    Join Date
    Jun 2010
    Posts
    1,434
    Thanks given
    52
    Thanks received
    78
    Rep Power
    27
    Okay so there is no altar code for this source. So i decided to make one.

    Code:
    case 411:
    			if(c.getFields().getPrayerBook() == PrayerBook.NORMAL) {
    				c.getFields().getPrayerBook(PrayerBook.CURSES);
    				c.setSidebarInterface(5, PrayerBook.CURSES.getInterfaceId());
    				c.performAnimation(new Animation(645));
    				c.sendMessage("You sense a surge of power flow through your body!");
    				c.getPA().resetCurse();
    				}
    		break;
    Error:

    I'm not sure what to do. Other sources use something different so I tried what I could here.

    Code:
    src\org\pandemonium\game\entity\ActionHandler.java:74: error: method getPrayerBo
    ok in class EntityFields cannot be applied to given types;
                                    c.getFields().getPrayerBook(PrayerBook.CURSES);
                                                 ^
      required: no arguments
      found: PrayerBook
      reason: actual and formal argument lists differ in length
    src\org\pandemonium\game\entity\ActionHandler.java:78: error: cannot find symbol
    
                                    c.getPA().resetCurse();
                                             ^
      symbol:   method resetCurse()
      location: class PlayerAssistant
    2 errors
    Press any key to continue . . .
    If you need any classes, please let me know.
    Reply With Quote  
     

  2. #2  
    Registered Member Tx-Sec's Avatar
    Join Date
    Jan 2008
    Age
    30
    Posts
    520
    Thanks given
    34
    Thanks received
    15
    Rep Power
    68
    May i see your prayerbook method and on second error it says theres not method in your class, you need to make it, or import it from a class.
    Reply With Quote  
     

  3. #3  
    Donator
    Defiled-X's Avatar
    Join Date
    Jun 2010
    Posts
    1,434
    Thanks given
    52
    Thanks received
    78
    Rep Power
    27
    Code:
    package org.pandemonium.game.content;
    
    /**
     * Represents a player's prayer book.
     * 
     * @author relex lawl
     */
    
    public enum PrayerBook {
    	
    	NORMAL(5608, "You sense a surge of purity flow through your body!"),
    	CURSES(22500, "You sense a surge of power flow through your body!");
    	
    	/**
    	 * The PrayerBook constructor.
    	 * @param interfaceId	The interface id to switch prayer tab to.
    	 * @param message		The message received upon switching prayers.
    	 */
    	private PrayerBook(int interfaceId, String message) {
    		this.interfaceId = interfaceId;
    		this.message = message;
    	}
    	
    	/**
    	 * The interface id to switch prayer tab to.
    	 */
    	private final int interfaceId;
    	
    	/**
    	 * The message received upon switching prayers.
    	 */
    	private final String message;
    	
    	/**
    	 * Gets the interface id to set prayer tab to.
    	 * @return	The new prayer tab interface id.
    	 */
    	public int getInterfaceId() {
    		return interfaceId;
    	}
    	
    	/**
    	 * Gets the message received when switching to said prayer book.
    	 * @return	The message player will receive.
    	 */
    	public String getMessage() {
    		return message;
    	}
    	
    	/**
    	 * Gets the PrayerBook instance for said id.
    	 * @param id	The id to match to prayer book's ordinal.
    	 * @return		The prayerbook who's ordinal is equal to id.
    	 */
    	public static PrayerBook forId(int id) {
    		for (PrayerBook book : PrayerBook.values()) {
    			if (book.ordinal() == id) {
    				return book;
    			}
    		}
    		return NORMAL;
    	}
    }
    Reply With Quote  
     

  4. #4  
    Donator
    Defiled-X's Avatar
    Join Date
    Jun 2010
    Posts
    1,434
    Thanks given
    52
    Thanks received
    78
    Rep Power
    27
    Okay I have managed to fix this but there are certain problems on how i can call these methods.

    Here is the code. Only 2 errors

    Fixed Code:
    Code:
    case 411:
    			 if (c.getFields().getPrayerBook() == PrayerBook.NORMAL) {
    			 c.getFields().setPrayerBook(PrayerBook.CURSES);
    			 c.setSidebarInterface(5, PrayerBook.CURSES.getInterfaceId());
    			 c.getCombat.resetPrayers();
    			 c.sendMessage("Prayers Switched to Curses");
    			 } else if (c.getFields().getPrayerBook() == PrayerBook.CURSES) {
    				c.setSidebarInterface(5, PrayerBook.NORMAL.getInterfaceId());
    				c.getFields().setPrayerBook(PrayerBook.NORMAL);
    				c.getPA().resetCurse();
    				c.sendMessage("Back to regular prayers");
    				}
    				break;
    Errors:
    Code:
    src\org\pandemonium\game\entity\ActionHandler.java:78: error: cannot find symbol
    
                             c.getCombat.resetPrayers();
                              ^
      symbol:   variable getCombat
      location: variable c of type Player
    src\org\pandemonium\game\entity\ActionHandler.java:83: error: cannot find symbol
    
                                    c.getPA().resetCurse();
                                             ^
      symbol:   method resetCurse()
      location: class PlayerAssistant
    2 errors
    Press any key to continue . . .

    So i looked at a few other previous other sources and it works because the resetCurse and resetPrayer are in PlayerAssistant and CombatAssistant.

    Mine are located here and i don't know how to call them in actionhandler nor can I transfer them to PA or CA. I can import those classes but I still don't know how.

    CombatPrayer.Java
    Code:
    package org.pandemonium.game.content.combat.prayer;
    
    import org.pandemonium.game.GameConstants;
    import org.pandemonium.game.entity.player.Player;
    
    /**
     * Handles combat prayers
     */
    
    public class CombatPrayer extends PrayerData {
    
    	public static void handlePrayerDrain(Player p) {
    		p.usingPrayer = false;
    		double toRemove = 0.0;
    		for (int j = 0; j < prayerData.length; j++) {
    			if (p.prayerActive[j]) {
    				toRemove += prayerData[j] / 20;
    				p.usingPrayer = true;
    			}
    		}
    		for (int j = 0; j < PrayerData.curseData.length; j++) {
    			if (p.curseActive[j]) {
    				toRemove += PrayerData.curseData[j] / 20;
    				p.usingPrayer = true;
    			}
    		}
    		if (toRemove > 0)
    			toRemove /= (1 + (0.035 * p.playerBonus[11]));
    		p.prayerPoint -= toRemove;
    		if (p.prayerPoint <= 0) {
    			p.prayerPoint = 1.0 + p.prayerPoint;
    			reducePrayerLevel(p);
    		}
    	}
    
    	public static void reducePrayerLevel(Player p) {
    		if (p.playerLevel[5] - 1 > 0) {
    			p.playerLevel[5] -= 1;
    		} else {
    			p.sendMessage("You have run out of prayer points!");
    			p.playerLevel[5] = 0;
    			Curses.resetCurse(p);
    			resetPrayers(p);
    			p.prayerId = -1;
    		}
    		p.getPA().refreshSkill(5);
    	}
    
    	public static void resetGlow(Player p, RegularPrayers pray) {
    		p.getPA().sendFrame36(pray.getGlowId(), 0);
    		p.prayerActive[pray.ordinal()] = false;
    	}
    
    	public static void resetPrayers(Player p) {
    		for (RegularPrayers r : RegularPrayers.values()) {
    			p.prayerActive[r.ordinal()] = false;
    			p.getPA().sendFrame36(r.getGlowId(), 0);
    		}
    		p.headIcon = -1;
    		p.getPA().requestUpdates();
    	}
    
    	public static boolean CombatPrayers(RegularPrayers pray) {
    		if (pray == RegularPrayers.RAPID_RESTORE
    				|| pray == RegularPrayers.RAPID_HEAL
    				|| pray == RegularPrayers.PROTECT_ITEM
    				|| pray == RegularPrayers.RETRIBUTION
    				|| pray == RegularPrayers.REDEMPTION
    				|| pray == RegularPrayers.SMITE)
    			return true;
    		return false;
    	}
    
    	public static void resetOtherPrayers(Player p, RegularPrayers pray) {
    		switch (pray) {
    		case THICK_SKIN:
    			resetGlow(p, RegularPrayers.ROCK_SKIN);
    			resetGlow(p, RegularPrayers.STEEL_SKIN);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case BURST_OF_STRENGTH:
    			resetGlow(p, RegularPrayers.SUPERHUMAN_STRENGTH);
    			resetGlow(p, RegularPrayers.ULTIMATE_STRENGTH);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case CLARITY_OF_THOUGHT:
    			resetGlow(p, RegularPrayers.IMPROVED_REFLEXES);
    			resetGlow(p, RegularPrayers.INCREDIBLE_REFLEXES);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case SHARP_EYE:
    			resetGlow(p, RegularPrayers.HAWK_EYE);
    			resetGlow(p, RegularPrayers.EAGLE_EYE);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case MYSTIC_WILL:
    			resetGlow(p, RegularPrayers.MYSTIC_LORE);
    			resetGlow(p, RegularPrayers.MYSTIC_MIGHT);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case ROCK_SKIN:
    			resetGlow(p, RegularPrayers.THICK_SKIN);
    			resetGlow(p, RegularPrayers.STEEL_SKIN);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case SUPERHUMAN_STRENGTH:
    			resetGlow(p, RegularPrayers.BURST_OF_STRENGTH);
    			resetGlow(p, RegularPrayers.ULTIMATE_STRENGTH);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case IMPROVED_REFLEXES:
    			resetGlow(p, RegularPrayers.CLARITY_OF_THOUGHT);
    			resetGlow(p, RegularPrayers.INCREDIBLE_REFLEXES);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case HAWK_EYE:
    			resetGlow(p, RegularPrayers.SHARP_EYE);
    			resetGlow(p, RegularPrayers.EAGLE_EYE);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case MYSTIC_LORE:
    			resetGlow(p, RegularPrayers.MYSTIC_WILL);
    			resetGlow(p, RegularPrayers.MYSTIC_MIGHT);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case ULTIMATE_STRENGTH:
    			resetGlow(p, RegularPrayers.BURST_OF_STRENGTH);
    			resetGlow(p, RegularPrayers.SUPERHUMAN_STRENGTH);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case INCREDIBLE_REFLEXES:
    			resetGlow(p, RegularPrayers.CLARITY_OF_THOUGHT);
    			resetGlow(p, RegularPrayers.IMPROVED_REFLEXES);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case EAGLE_EYE:
    			resetGlow(p, RegularPrayers.SHARP_EYE);
    			resetGlow(p, RegularPrayers.HAWK_EYE);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case MYSTIC_MIGHT:
    			resetGlow(p, RegularPrayers.MYSTIC_WILL);
    			resetGlow(p, RegularPrayers.MYSTIC_LORE);
    			resetGlow(p, RegularPrayers.CHIVALRY);
    			resetGlow(p, RegularPrayers.PIETY);
    			break;
    		case PROTECT_FROM_MAGIC:
    		case PROTECT_FROM_MISSILES:
    		case PROTECT_FROM_MELEE:
    		case RETRIBUTION:
    		case REDEMPTION:
    		case SMITE:
    			for (RegularPrayers r : RegularPrayers.values())
    				if (r.getHeadIcon() > -1 && r != pray)
    					resetGlow(p, r);
    			break;
    		case CHIVALRY:
    		case PIETY:
    			for (RegularPrayers r : RegularPrayers.values())
    				if (!CombatPrayers(r) && r != pray)
    					resetGlow(p, r);
    			break;
    		default:
    			break;
    		}
    	}
    
    	public static void activatePrayer(Player p, int buttonId) {
    		RegularPrayers r = RegularPrayers.forButton(buttonId);
    		int i = r.ordinal();
    		if (p.isDead || p.getConstitution() <= 0)
    			return;
    		if (p.playerRights == 5)
    			p.sendMessage("Pray Name: " + r.getPrayerName());
    		if (p.playerLevel[5] <= 0 && GameConstants.PRAYER_POINTS_REQUIRED) {
    			p.getPA().sendFrame36(r.getGlowId(), 0);
    			p.sendMessage("You have run out of prayer points!");
    			return;
    		}
    		if (p.getPA().getLevelForXP(p.playerXP[5]) < r.getLevelReq()
    				&& GameConstants.PRAYER_LEVEL_REQUIRED) {
    			p.getPA().sendFrame36(r.getGlowId(), 0);
    			p.getDH().sendStatement(
    					"You need a @blu@Prayer level of " + r.getLevelReq()
    							+ " to use " + r.getPrayerName() + ".");
    			return;
    		}
    		boolean headIcon = false;
    		switch (r) {
    		case THICK_SKIN:
    		case BURST_OF_STRENGTH:
    		case CLARITY_OF_THOUGHT:
    		case SHARP_EYE:
    		case MYSTIC_WILL:
    		case ROCK_SKIN:
    		case SUPERHUMAN_STRENGTH:
    		case IMPROVED_REFLEXES:
    		case HAWK_EYE:
    		case MYSTIC_LORE:
    		case STEEL_SKIN:
    		case ULTIMATE_STRENGTH:
    		case INCREDIBLE_REFLEXES:
    		case EAGLE_EYE:
    		case MYSTIC_MIGHT:
    		case CHIVALRY:
    		case PIETY:
    			resetOtherPrayers(p, r);
    			break;
    		case PROTECT_FROM_MAGIC:
    		case PROTECT_FROM_MISSILES:
    		case PROTECT_FROM_MELEE:
    			if (System.currentTimeMillis() - p.stopPrayerDelay < 5000) {
    				p.sendMessage("You have been injured and can't use this prayer!");
    				p.getPA().sendFrame36(r.getGlowId(), 0);
    				return;
    			}
    			headIcon = true;
    			break;
    		case RETRIBUTION:
    		case REDEMPTION:
    		case SMITE:
    			headIcon = true;
    			resetOtherPrayers(p, r);
    			break;
    		default:
    			break;
    		}
    
    		if (!headIcon) {
    			if (p.prayerActive[i] == false) {
    				p.prayerActive[i] = true;
    				p.getPA().sendFrame36(r.getGlowId(), 1);
    			} else {
    				p.prayerActive[i] = false;
    				p.getPA().sendFrame36(r.getGlowId(), 0);
    			}
    		} else {
    			if (p.prayerActive[i] == false) {
    				p.prayerActive[i] = true;
    				p.getPA().sendFrame36(r.getGlowId(), 1);
    				p.headIcon = r.getHeadIcon();
    				p.getPA().requestUpdates();
    			} else {
    				p.prayerActive[i] = false;
    				p.getPA().sendFrame36(r.getGlowId(), 0);
    				p.headIcon = -1;
    				p.getPA().requestUpdates();
    			}
    		}
    	}
    }

    Curses.java

    Code:
    package org.pandemonium.game.content.combat.prayer;
    
    import org.pandemonium.game.GameConstants;
    import org.pandemonium.game.content.PrayerBook;
    import org.pandemonium.game.content.combat.util.ProjectileHandler;
    import org.pandemonium.game.entity.Animation;
    import org.pandemonium.game.entity.Entity;
    import org.pandemonium.game.entity.Entity.AttackTypes;
    import org.pandemonium.game.entity.Graphic;
    import org.pandemonium.game.entity.player.Player;
    import org.pandemonium.utility.Misc;
    
    public class Curses extends PrayerData {
    
    	public static void resetCurse(Player p) {
    		for (CursedPrayers c : CursedPrayers.values()) {
    			p.curseActive[c.ordinal()] = false;
    			p.getPA().sendFrame36(c.getGlowId(), 0);
    		}
    		p.headIcon = -1;
    		p.getPA().requestUpdates();
    	}
    
    	public static void resetGlow(Player p, CursedPrayers curse) {
    		p.getPA().sendFrame36(curse.getGlowId(), 0);
    		p.curseActive[curse.ordinal()] = false;
    	}
    
    	public static boolean CombatPrayers(CursedPrayers curse) {
    		if (curse == CursedPrayers.PROTECT_ITEM
    				|| curse == CursedPrayers.BERSERKER
    				|| curse == CursedPrayers.WRATH
    				|| curse == CursedPrayers.SOULSPLIT)
    			return false;
    		return true;
    	}
    	
    	public static void resetOtherPrayers(Player p, CursedPrayers curses) {
    		switch (curses) {
    		case SAP_WARRIOR:
    			resetGlow(p, CursedPrayers.LEECH_ATTACK);
    			resetGlow(p, CursedPrayers.LEECH_DEFENCE);
    			resetGlow(p, CursedPrayers.LEECH_STRENGTH);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case SAP_MAGE:
    			resetGlow(p, CursedPrayers.LEECH_MAGIC);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case SAP_RANGER:
    			resetGlow(p, CursedPrayers.LEECH_RANGED);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case SAP_SPIRIT:
    			resetGlow(p, CursedPrayers.LEECH_SPECIAL_ATTACK);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case DEFLECT_SUMMONING:
    		case DEFLECT_MAGIC:
    		case DEFLECT_MISSILES:
    		case DEFLECT_MELEE:
    		case WRATH:
    		case SOULSPLIT:
    			for (CursedPrayers c : CursedPrayers.values())
    				if (c.getHeadIcon() > -1 && c != curses)
    					resetGlow(p, c);
    			break;
    		case LEECH_ATTACK:
    			resetGlow(p, CursedPrayers.SAP_WARRIOR);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case LEECH_MAGIC:
    			resetGlow(p, CursedPrayers.SAP_MAGE);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case LEECH_RANGED:
    			resetGlow(p, CursedPrayers.SAP_RANGER);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case LEECH_DEFENCE:
    			resetGlow(p, CursedPrayers.SAP_WARRIOR);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case LEECH_STRENGTH:
    			resetGlow(p, CursedPrayers.SAP_WARRIOR);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case LEECH_SPECIAL_ATTACK:
    			resetGlow(p, CursedPrayers.SAP_SPIRIT);
    			resetGlow(p, CursedPrayers.TURMOIL);
    			break;
    		case TURMOIL:
    			resetGlow(p, CursedPrayers.SAP_WARRIOR);
    			resetGlow(p, CursedPrayers.SAP_MAGE);
    			resetGlow(p, CursedPrayers.SAP_RANGER);
    			resetGlow(p, CursedPrayers.SAP_SPIRIT);
    			resetGlow(p, CursedPrayers.LEECH_ATTACK);
    			resetGlow(p, CursedPrayers.LEECH_MAGIC);
    			resetGlow(p, CursedPrayers.LEECH_RANGED);
    			resetGlow(p, CursedPrayers.LEECH_DEFENCE);
    			resetGlow(p, CursedPrayers.LEECH_STRENGTH);
    			resetGlow(p, CursedPrayers.LEECH_SPECIAL_ATTACK);
    			break;
    		default:
    			break;
    		}
    	}
    
    	public static void activateCurse(Player p, int buttonId) {
    		CursedPrayers curses = CursedPrayers.forButton(buttonId);
    		if (p.playerRights == 5)
    			p.sendMessage("[Debug] Curse Id: " + curses.getPrayerName());
    		if (p.inRFD) {
    			p.sendMessage("You can't use prayer on this minigame.");
    			return;
    		}
    		if (p.playerLevel[1] < 28) {
    			p.getPA().sendFrame36(curses.getGlowId(), 0);
    			p.getDH().sendStatement(
    					"You need a @blu@Defence level of 28 to use "
    							+ curses.getPrayerName() + ".");
    			return;
    		}
    		if (p.getFields().getPrayerBook() != PrayerBook.CURSES) {
    			resetCurse(p);
    			p.sendMessage("You are not on the right prayer book to activate this curse.");
    			return;
    		}
    		if (p.getConstitution() <= 0) {
    			p.getPA().sendFrame36(curses.getGlowId(), 0);
    			p.sendMessage("You can't activate this curse when you are dead.");
    			return;
    		}
    		if (p.playerLevel[5] <= 0 && GameConstants.PRAYER_POINTS_REQUIRED) {
    			p.getPA().sendFrame36(curses.getGlowId(), 0);
    			p.sendMessage("You have run out of Prayer points!");
    			p.sendMessage("You can recharge at an altar.");
    			return;
    		}
    		if (p.getPA().getLevelForXP(p.playerXP[5]) <= curses.getLevelReq()
    				&& GameConstants.PRAYER_LEVEL_REQUIRED) {
    			p.getPA().sendFrame36(curses.getGlowId(), 0);
    			p.getDH().sendStatement(
    					"You need a @blu@Prayer level of " + curses.getLevelReq()
    							+ " to use " + curses.getPrayerName() + ".");
    			return;
    		}
    		boolean headIcon = false;
    		int i = curses.ordinal();
    		switch (curses) {
    		case PROTECT_ITEM:
    			p.performAnimation(new Animation(12567));
    			p.performGraphic(new Graphic(2213));
    			p.lastProtItem = System.currentTimeMillis();
    			break;
    		case BERSERKER:
    			p.performAnimation(new Animation(12589));
    			p.performGraphic(new Graphic(2266));
    			break;
    		case DEFLECT_SUMMONING:
    		case DEFLECT_MAGIC:
    		case DEFLECT_MISSILES:
    		case DEFLECT_MELEE:
    			if (System.currentTimeMillis() - p.stopPrayerDelay < 5000) {
    				p.sendMessage("You have been injured and can't use this prayer!");
    				p.getPA().sendFrame36(curses.getGlowId(), 0);
    				return;
    			}
    			headIcon = true;
    			if (p.curseActive[curses.ordinal()] == false)
    				resetOtherPrayers(p, curses);
    			break;
    		case SAP_WARRIOR:
    		case LEECH_ATTACK:
    		case SAP_RANGER:
    		case LEECH_RANGED:
    		case SAP_MAGE:
    		case LEECH_MAGIC:
    		case SAP_SPIRIT:
    		case LEECH_SPECIAL_ATTACK:
    		case LEECH_DEFENCE:
    		case LEECH_STRENGTH:
    			if (p.curseActive[curses.ordinal()] == false)
    				resetOtherPrayers(p, curses);
    			break;
    		case WRATH:
    		case SOULSPLIT:
    			headIcon = true;
    			if (p.curseActive[curses.ordinal()] == false)
    				resetOtherPrayers(p, curses);
    			break;
    		case TURMOIL:
    			p.performAnimation(new Animation(12565));
    			p.performGraphic(new Graphic(2226));
    			if (p.curseActive[curses.ordinal()] == false)
    				resetOtherPrayers(p, curses);
    			break;
    		default:
    			break;
    		}
    		if (!headIcon) {
    			if (p.curseActive[i] == false) {
    				p.curseActive[i] = true;
    				p.getPA().sendFrame36(curses.getGlowId(), 1);
    			} else {
    				p.curseActive[i] = false;
    				p.getPA().sendFrame36(curses.getGlowId(), 0);
    			}
    		} else {
    			if (p.curseActive[i] == false) {
    				p.curseActive[i] = true;
    				p.getPA().sendFrame36(curses.getGlowId(), 1);
    				p.headIcon = curses.getHeadIcon();
    				p.getPA().requestUpdates();
    			} else {
    				p.curseActive[i] = false;
    				p.getPA().sendFrame36(curses.getGlowId(), 0);
    				p.headIcon = -1;
    				p.getPA().requestUpdates();
    			}
    		}
    	}
    
    	public static void applyCurses(Entity attacker, Entity target, int damage) {
    		if (attacker.isPlayer()) {
    			Player p = (Player) attacker;
    			if (p.curseActive[1] || p.curseActive[2] || p.curseActive[3]
    					|| p.curseActive[10] || p.curseActive[11]
    					|| p.curseActive[12] || p.curseActive[13]
    					|| p.curseActive[14] || p.curseActive[16])
    				applyLeeches(p, target);
    			if (p.curseActive[18])
    				handleSoulSplit(attacker, target, damage);
    		}
    		if (damage > 0)
    			if (target.isPlayer())
    				if (((Player) target).curseActive[7]
    						&& attacker.getAttackType() == AttackTypes.MAGIC)
    					handleDeflectPrayers(attacker, target, damage, 0);
    				else if (((Player) target).curseActive[8]
    						&& attacker.getAttackType() == AttackTypes.RANGED)
    					handleDeflectPrayers(attacker, target, damage, 1);
    				else if (((Player) target).curseActive[9]
    						&& attacker.getAttackType() == AttackTypes.MELEE)
    					handleDeflectPrayers(attacker, target, damage, 2);
    	}
    
    	public static int[] deflectData = { 2228, 2229, 2230 };
    
    	public static void handleDeflectPrayers(Entity attacker, Entity target,
    			int damage, int i) {
    		if (attacker.getConstitution() <= 0)
    			return;
    		if (target == null)
    			return;
    		if (!((Player) target).curseActive[i + 7])
    			return;
    		int deflectDamage = (int) (damage * 0.05) + 1;
    		target.performGraphic(new Graphic(deflectData[i]));
    		target.performAnimation(new Animation(12573));
    		attacker.setDoubleHit(deflectDamage, 0, 3);
    	}
    
    	public static void applyLeeches(Player attacker, Entity target) {
    		if (target == null)
    			return;
    		int[] projectileGfx = { 2252, 2236, 2240, 2242, 2248 };
    		int[] targetGfx = { 2253, 2238, 2242, 2246, 2250 };
    		String[] curseName = { "attack", "ranged", "magic", "defense",
    				"strength" };
    		for (int i = 0; i < 17; i++) {
    			if (i >= 10 && i < 15) {
    				if (attacker.curseActive[i]) {
    					int failed = Misc.random(8);
    					int id = i - 10;
    					if (failed == 8) {
    						double targetEffect = target.prayerEffects[id];
    						double attackerEffect = attacker.prayerEffects[id];
    						if (targetEffect > 0.75 && attackerEffect < 1.1) {
    							if (targetEffect - 0.1 < 0.75)
    								target.prayerEffects[id] = 0.75;
    							else
    								target.prayerEffects[id] -= 0.1;
    							if (attackerEffect + 0.05 > 1.1)
    								attacker.prayerEffects[id] = 1.1;
    							else
    								attacker.prayerEffects[id] += 0.05;
    						}
    						if (target.isPlayer())
    							((Player) target).sendMessage("Your "
    									+ curseName[id] + " has been leeched by "
    									+ attacker.playerName.toLowerCase() + ".");
    
    						ProjectileHandler.curseProjectile(attacker, target,
    								projectileGfx[id]);
    						attacker.sendMessage("Your curse leechs the enemy's "
    								+ curseName[id] + ".");
    						target.performGraphic(new Graphic(targetGfx[id]));
    						attacker.performAnimation(new Animation(12575));
    					}
    				}
    			}
    		}
    		if (attacker.curseActive[16]) {
    			int failed = Misc.random(10);
    			if (failed == 10) {
    				if (target.isPlayer()) {
    					Player t = (Player) target;
    					if (t.specAmount > 1.0) {
    						if (attacker.specAmount <= 9.0) {
    							attacker.specAmount += 1.0;
    							t.specAmount -= 1.0;
    							t.sendMessage("Your special attack has been leeched by "
    									+ attacker.playerName.toLowerCase() + ".");
    						}
    					}
    				}
    				ProjectileHandler.curseProjectile(attacker, target, 2256);
    				target.performGraphic(new Graphic(2258));
    				attacker.performAnimation(new Animation(12575));
    			}
    		}
    		if (attacker.curseActive[1]) {
    			int failed = Misc.random(8);
    			if (failed == 8) {
    				if (target.prayerEffects[0] > 0.8
    						&& target.prayerEffects[0] - 0.1 > 0.8)
    					target.prayerEffects[0] -= 0.1;
    				if (target.prayerEffects[3] > 0.8
    						&& target.prayerEffects[3] - 0.1 > 0.8)
    					target.prayerEffects[3] -= 0.1;
    				if (target.prayerEffects[4] > 0.8
    						&& target.prayerEffects[4] - 0.1 > 0.8)
    					target.prayerEffects[4] -= 0.1;
    				if (target.isPlayer())
    					((Player) target)
    							.sendMessage("Your attack has been drained by "
    									+ attacker.playerName.toLowerCase() + ".");
    			}
    			attacker.performGraphic(new Graphic(2214));
    			ProjectileHandler.curseProjectile(attacker, target, 2215);
    			attacker.sendMessage("Your curse drains the enemy's attack.");
    			target.performGraphic(new Graphic(2234));
    			attacker.performAnimation(new Animation(12569));
    		}
    		if (attacker.curseActive[2]) {
    			int failed = Misc.random(8);
    			if (failed == 8) {
    				if (target.prayerEffects[1] > 0.8
    						&& target.prayerEffects[1] - 0.1 > 0.8)
    					target.prayerEffects[1] -= 0.1;
    				if (target.isPlayer())
    					((Player) target)
    							.sendMessage("Your ranged has been drained by "
    									+ Misc.optimizeText(attacker.playerName)
    											.toLowerCase() + ".");
    
    				attacker.sendMessage("Your curse drains the enemy's ranged.");
    				attacker.performGraphic(new Graphic(2217));
    				ProjectileHandler.curseProjectile(attacker, target, 2218);
    				target.performGraphic(new Graphic(2235));
    				attacker.performAnimation(new Animation(12569));
    			}
    		}
    		if (attacker.curseActive[3]) {
    			int failed = Misc.random(8);
    			if (failed == 8) {
    				if (target.prayerEffects[2] > 0.8
    						&& target.prayerEffects[2] - 0.1 > 0.8)
    					target.prayerEffects[2] -= 0.1;
    				if (target.isPlayer())
    					((Player) target)
    							.sendMessage("Your magic has been drained by "
    									+ Misc.optimizeText(attacker.playerName)
    											.toLowerCase() + ".");
    
    				attacker.sendMessage("Your curse drains the enemy's magic.");
    				attacker.performGraphic(new Graphic(2220));
    				ProjectileHandler.curseProjectile(attacker, target, 2221);
    				target.performGraphic(new Graphic(2239));
    				attacker.performAnimation(new Animation(12569));
    			}
    		}
    	}
    
    	public static void handleSoulSplit(Entity attacker, Entity target,
    			int damage) {
    		Player a = (Player) attacker;
    		int form = damage / 4;
    		if (form <= 0 || target == null || target.getConstitution() <= 0)
    			return;
    		if (attacker.getConstitution() + form >= attacker.getMaxConstitution())
    			attacker.setConstitution(attacker.getMaxConstitution());
    		else
    			attacker.setConstitution(attacker.getConstitution() + form);
    		if (target.isPlayer())
    			if (target.getPrayer() - form > 0)
    				target.setPrayer(target.getPrayer() - form);
    			else
    				target.setPrayer(0);
    		target.performGraphic(new Graphic(2264));
    		a.getPA().refreshSkill(3);
    		ProjectileHandler.soulsplitProjectile(attacker, target);
    	}
    
    	public static void applyWrath(Player attacker, Entity target) {
    		int wrathDamage = (attacker.playerLevel[5] / 100) * 26;
    		if (target == null)
    			return;
    		if (attacker.inDuelArena() || target.inDuelArena())
    			return;
    		attacker.performGraphic(new Graphic(2259));
    		attacker.performAnimation(new Animation(12583));
    		target.performGraphic(new Graphic(2260));
    		target.setSingleHit(wrathDamage, 0, 3);
    	}
    }
    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. 614 Legacy Source - 30def for curses?
    By Coruption in forum Help
    Replies: 9
    Last Post: 02-09-2012, 05:56 AM
  2. Curse prayers./insane pk client/source
    By Regicidal in forum Help
    Replies: 2
    Last Post: 06-22-2011, 04:51 AM
  3. Replies: 3
    Last Post: 02-10-2011, 10:04 AM
  4. [request] new source download(with new curses)
    By Somebodyy in forum Requests
    Replies: 3
    Last Post: 04-21-2010, 02:21 PM
  5. 525 source/client with new curses
    By Somebodyy in forum Requests
    Replies: 6
    Last Post: 04-21-2010, 02:20 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
  •