View Poll Results: Unique?

Voters
60. You may not vote on this poll
  • Yeah, unique.

    49 81.67%
  • Nah, not unique.

    11 18.33%

Thread: [Base] Avatar Base

Page 1 of 6 123 ... LastLast
Results 1 to 10 of 55
  1. #1 [Base] Avatar Base 
    Registered Member

    Join Date
    Jul 2008
    Posts
    939
    Thanks given
    0
    Thanks received
    3
    Rep Power
    781
    Post or expect termination on you.

    Read: This will create an avatar based society in you're source. Basically, you can pick from two races at the moment. Each race has it's bonuses and weapons and emotes. Note, this is only version one and many more updates will come. Although this is untested, the file will work but I'm not saying perfect success in the client class. The only thing that may cause a problem is calling upon the methods in the wrong places. If anyone finds errors about the calling, to post the fix here. Also, this will only work for Devolution or Dodian based servers, sorry!

    Features for Avatar v.1:

    - Goblin/Elf Families
    - Goblin/Elf Separate Walking Animations
    - Goblin/Elf Separate Banking Spots
    - Goblin/Elf Family Based Levels
    - Goblin/Elf Family Based Level Weapon Requirements
    - Goblin/Elf Family Weapon Bonuses
    - Goblin/Elf Family Level Up Messages
    - Goblin/Elf Family Based Starter
    - Goblin/Elf Family Based Setting of NPC Depending on Combat Level
    - Goblin/Elf Basis of Selecting Family in the Beginning
    - Goblin/Elf Leveling up with changing of player NPCID
    - Goblin Only Emotes in Emote Tab

    Adding:

    Create a new file and save it as Avatarhandler.java and then put this in:

    Code:
    /*
    
    Created by: Rog3r
    Version: v0.1
    
    */
    
    public class Avatarhandler {
    
    	public static int Elf, Goblin, familyLevel, elfStarter, goblinStarter, bankSpace, walkAnimation, attackAnimation;
    	public static boolean goblinWeapon, elfWeapon, setPicked;
    	
    	public static String GetItemName(int ItemID) {
    		for (int i = 0; i < server.itemHandler.MaxListedItems; i++) {
    			if (server.itemHandler.ItemList[i] != null) {
    				if (server.itemHandler.ItemList[i].itemId == ItemID) {
    					return server.itemHandler.ItemList[i].itemName;
    				}
                    		if (ItemID == -1) {
                        			return "Unarmed";
                    		}
    			}
    		}
    		return "Non Existing Item - ID:"+ItemID;
    	}
    	
    	public static int GetCLElf(int ItemID) {
    		if (ItemID == -1) {
    			return 0;
    		}
    		String ItemName = GetItemName(ItemID);
    		if (ItemName.startsWith("New_crystal")) {
    			return 5; // You need a Elf family level of 5 to wield this item
    		}
    		if (ItemName.startsWith("Dragon_vamb")) {
    			return 3; // You need a Elf family level of 3 to wield this item (and Def of 60 or what ever dragon is set on)
    		}
    		return 0;
    	}
    	
    	public static int GetCLGoblin(int ItemID) {
    		if (ItemID == -1) {
    			return 0;
    		}
    		String ItemName = GetItemName(ItemID);
    		if (ItemName.startsWith("Dragon sp")) {
    			return 3; // You need a Goblin family level of 5 to wield this item (and Def of 60 or what ever dragon is set on)
    		}
    		if (ItemName.startsWith("Dragon hal")) {
    			return 3; // You need a Goblin family level of 3 to wield this item (and Def of 60 or what ever dragon is set on)
    		}
    		return 0;
    	}
    	
    	public static void weaponBonus(int ItemID) {
    		String ItemName = GetItemName(ItemID);
    		
    		if (Goblin == 1) {
    			if (ItemName.endsWith("spear") || ItemName.endsWith("spear(p)") || ItemName.endsWith("spear(kp)")) { // Weapons that give the class a bonus when attacking
    				goblinWeapon = true;
    			} else {
    				goblinWeapon = false;
    			}
    		}
    		
    		if (Elf == 1) {
    			if (ItemName.endsWith("longbow")) { // Weapons that give the class a bonus when attacking
    				elfWeapon = true;
    			} else {
    				elfWeapon = false;
    			}
    		}
    	}
    	
    	public static void levelUp(int plrID) {
    		client client = (client) PlayerHandler.players[plrID];
    			if (Elf == 1) {
    				switch (client.combatLevel) { // Displays the level up family level at every level followed
    					case 4:
    					case 53:
    					case 73:
    					case 103:
    						playerOn(plrID);
    						client.sendMessage("Congratulations, you are now a level "+familyLevel+" Elf!");
    						break;
    				}
    			}
    			if (Goblin == 1) {
    				switch (client.combatLevel) { // Displays the level up family level at every level followed
    					case 4:
    					case 53:
    					case 73:
    					case 103:
    						playerOn(plrID);
    						client.sendMessage("Congratulations, you are now a level "+familyLevel+" Goblin!");
    						break;
    			}
    		}
    	}
    	
    	public static void playerOn(int plrID) {
    		client client = (client) PlayerHandler.players[plrID];
    			Elf = 1;
    			
    			if (Elf == 1) {
    				bankSpace = 350; // Change the bank space given by the race
    				walkAnimation = 0x333; // Change the walking animation that will be used for the Elf
    				
    				if (elfStarter == 1) {
    					setPicked = true; // < Do not change this! 
    					client.addItem(841, 1); // Change the items that is given by the race when he logs in
    					client.addItem(882, 100);
    					elfStarter = 2;
    				}
    				if (misc.random(2) == 1) {
    					client.sendMessage("You're race is currently set at a level "+familyLevel+" Elf.");
    				} else {
    					client.sendMessage("You are apart of the level "+familyLevel+" Elf family.");
    				}
    				if (client.combatLevel == 3) {
    					client.npcId = 2361;
    					client.isNpc = true;
    					familyLevel = 1;
    				} else if (client.combatLevel >= 4 && client.combatLevel <= 52) {
    					client.npcId = 2359;
    					client.isNpc = true;
    					familyLevel = 2;
    				} else if (client.combatLevel >= 53 && client.combatLevel <= 72) {
    					client.npcId = 2362;
    					client.isNpc = true;
    					familyLevel = 3;
    				} else if (client.combatLevel >= 73 && client.combatLevel <= 102) {
    					client.npcId = 1183;
    					client.isNpc = true;
    					familyLevel = 4;
    				} else if (client.combatLevel >= 103) {
    					client.npcId = 1201;
    					client.isNpc = true;
    					familyLevel = 5;
    				}
    			}
    			
    			if (Goblin == 1) {
    				bankSpace = 300; // Change the bank space given by the race
    				walkAnimation = 0x333; // Change the walking animation that will be used for the Goblin
    				
    				if (goblinStarter == 1) {
    					setPicked = true; // < Do not change this! 
    					client.addItem(1237, 1); // Change the items that is given by the race when he logs in
    					client.addItem(1155, 1);
    					goblinStarter = 2;
    				}
    				if (misc.random(2) == 1) {
    					client.sendMessage("You're race is currently set at a level "+familyLevel+" Goblin.");
    				} else {
    					client.sendMessage("You are apart of the level "+familyLevel+" Goblin family.");
    				}
    				if (client.combatLevel == 3) {
    					client.npcId = 100;
    					client.isNpc = true;
    					familyLevel = 1;
    				} else if (client.combatLevel >= 4 && client.combatLevel <= 52) {
    					client.npcId = 101;
    					client.isNpc = true;
    					familyLevel = 2;
    				} else if (client.combatLevel >= 53 && client.combatLevel <= 72) {
    					client.npcId = 102;
    					client.isNpc = true;
    					familyLevel = 3;
    				} else if (client.combatLevel >= 73 && client.combatLevel <= 102) {
    					client.npcId = 122;
    					client.isNpc = true;
    					familyLevel = 4;
    				} else if (client.combatLevel >= 103) {
    					client.npcId = 3061;
    					client.isNpc = true;
    					familyLevel = 5;
    				}
    			}
    	}
    }
    In the client class, search for:

    if (oldLevel < getLevelForXP(playerXP[skill])) {
    And below it, add the following:

    Code:
    Avatarhandler.levelUp(playerId);
    In the same class, search for:

    if ((playerItems[slot]-1) == wearID) {
    And above it, add the following:

    Code:
    Avatarhandler.weaponBonus(wearID);
    Now, add this. It's just a few lines below this, and shouldn't be a problem adding:

    Code:
    int CLElf = Avatarhandler.GetCLElf(wearID);
    int CLGoblin = Avatarhandler.GetCLGoblin(wearID);
    A bit down, you should add the following. If you don't know where this goes, ask.

    Code:
    			if (CLElf > Avatarhandler.Elf) {
    				sendMessage("You're family level or race doesn't match the requirements");
    				GoFalse = true;
    			}
    			
    			if (CLGoblin > Avatarhandler.Goblin) {
    				sendMessage("You're family level or race doesn't match the requirements");
    				GoFalse = true;
    			}
    Where ever you're welcome message is, add this.

    Code:
    	Avatarhandler.playerOn(playerId);
    	if (!Avatarhandler.setPicked) {
    		/*
    		
    		TODO:  Make a dialogue appear to allow the user to pick their family! 
    			   * When they have picked, what ever code selects their family, place this in depending on what family they picked:
    			   
    			  Avatarhandler.elfStarter = 1;
    			  Avatarhandler.goblinStarter = 1;
    			  
    			  *
    			  
    			  You also don't have to set the boolean, setPicked to true as the starter will do it.
    		
    		*/
    	}
    Oh yeah, if you want some help on how to choose the family, please refer to the quoted out above.
    In packet 185, replace case 52071 and 52072 with the following:

    Code:
    			case 52071:
    				if (Avatarhandler.Goblin == 1) {
    					if (emotes == 0) {
    						emotes = 1;
    						pEmote = 0x84F;
    						updateRequired = true;
    						appearanceUpdateRequired = true;
    					} else {
    						emotes = 0;
    						pEmote = playerSE;
    						updateRequired = true;
    						appearanceUpdateRequired = true;
    					}
    				} else {
    					sendMessage("You must be in the Goblin family to cast this emote.");
    				}
    				break;
    				
    			case 52072:
    				if (Avatarhandler.Goblin == 1) {
    					if (emotes == 0) {
    						emotes = 1;
    						pEmote = 0x850;
    						updateRequired = true;
    						appearanceUpdateRequired = true;
    					} else {
    						emotes = 0;
    						pEmote = playerSE;
    						updateRequired = true;
    						appearanceUpdateRequired = true;
    					}
    				} else {
    					sendMessage("You must be in the Goblin family to cast this emote.");
    				}
    				break;
    In the method Attack, search for:

    boolean UseBow = false;
    And below it, add the following:

    Code:
    	if (Avatarhandler.elfWeapon) {
    		hitDiff = misc.random(playerMaxHit);
    	}
    	
    	if (Avatarhandler.goblinWeapon) {
    		hitDiff = misc.random(playerMaxHit+misc.random(3));
    	}
    In the player class, replace the max bank spots integer with the following:

    Code:
    public int playerBankSize = Avatarhandler.bankSpace;
    In the same class, replace the pWalk integer with this:

    Code:
    public int pWalk = Avatarhandler.walkAnimation;
    You have now finished adding everything.
    Please note that this is untested, but the file itself will work. Just the calling of the methods may be a bit off.

    Credits: 95% Rog3r, 5% 0wned_Pl0x
    I'm Rog3r, fool.
     

  2. #2  
    Officially Retired

    Huey's Avatar
    Join Date
    Jan 2008
    Age
    19
    Posts
    16,489
    Thanks given
    3,387
    Thanks received
    7,726
    Rep Power
    5000
    i still dont get what it does lol

    Listen children don't become this guy.
    Quote Originally Posted by Owner Spikey View Post
    Why can I attack lower level npc's in a matter of a mouse hover but for a higher level npc the only choice to attack is by right clicking option attack?

     

  3. #3  
    Registered Member

    Join Date
    Jul 2008
    Posts
    939
    Thanks given
    0
    Thanks received
    3
    Rep Power
    781
    Quote Originally Posted by T I P View Post
    i still dont get what it does lol
    Basically, you can pick from two races at the moment. Each race has it's bonuses and weapons and emotes.
    I'm Rog3r, fool.
     

  4. #4  
    Officially Retired

    Huey's Avatar
    Join Date
    Jan 2008
    Age
    19
    Posts
    16,489
    Thanks given
    3,387
    Thanks received
    7,726
    Rep Power
    5000
    oh thats cool m8

    Listen children don't become this guy.
    Quote Originally Posted by Owner Spikey View Post
    Why can I attack lower level npc's in a matter of a mouse hover but for a higher level npc the only choice to attack is by right clicking option attack?

     

  5. #5  
    Registered Member
    Lil Str Kid's Avatar
    Join Date
    Jul 2007
    Age
    28
    Posts
    1,302
    Thanks given
    169
    Thanks received
    71
    Rep Power
    260
    Very nice man nice to see people try new things


     

  6. #6  
    Registered Member

    Join Date
    Jul 2008
    Posts
    939
    Thanks given
    0
    Thanks received
    3
    Rep Power
    781
    Quote Originally Posted by Lil Str Kid View Post
    Very nice man nice to see people try new things
    There's a lot more that needs to be worked on, but when I have more time I'll create another version or perhaps fix all the bugs. Or at least test it, but it looks like it'll work. I'll probably hook up some quests to it, make it change the teleport menu etc.
    I'm Rog3r, fool.
     

  7. #7  
    Registered Member pHametic's Avatar
    Join Date
    Nov 2006
    Posts
    637
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    cool idea may use and add on thanks.
     

  8. #8  
    Registered Member

    Join Date
    Jul 2008
    Posts
    939
    Thanks given
    0
    Thanks received
    3
    Rep Power
    781
    Quote Originally Posted by ramli View Post
    cool idea may use and add on thanks.
    Any ideas you want to see in the next version?
    I'm Rog3r, fool.
     

  9. #9  
    Donator

    Sir Lethal's Avatar
    Join Date
    Mar 2008
    Posts
    2,286
    Thanks given
    9
    Thanks received
    74
    Rep Power
    426
    Looks nice,add some pictures .
    [Only registered and activated users can see links. ]
     

  10. #10  
    Registered Member
    LunarKnight's Avatar
    Join Date
    Jan 2009
    Age
    29
    Posts
    676
    Thanks given
    7
    Thanks received
    29
    Rep Power
    87
    Why do people even work with those 2 fail servers?(dodian,devolution)
     

Page 1 of 6 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •